Skip to content

Instantly share code, notes, and snippets.

@kana
Created December 20, 2010 15:34
Show Gist options
  • Save kana/748514 to your computer and use it in GitHub Desktop.
Save kana/748514 to your computer and use it in GitHub Desktop.
" perl: add 'use' statement for package name under the cursor
function! AddUse()
let s:line = line(".")
let s:col = col(".")
normal yiw
let s:default = @"
let s:package = input("Package? ", s:default)
if (search("^use ".s:package, "bnw") == 0)
call search('^use ','b')
execute "normal ouse ".s:package.";"
call cursor(s:line+1,s:col)
endif
endfunction
map ,us :call AddUse()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment