Created
December 20, 2010 15:34
-
-
Save kana/748514 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" perl: add 'use' statement for package name under the cursor | |
function! AddUse() | |
let line = line('.') | |
let col = col('.') | |
normal! yiw | |
let default = @0 | |
let package = input('Package? ', default) | |
if (search('^use\s\+'.package, 'bnw') == 0) | |
call search('^use\s\+', 'b') | |
put ='use ' . package . ';' | |
call cursor(line+1, col) | |
endif | |
endfunction | |
nnoremap ,us :<C-u>call AddUse()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment