View replace_all_files.vim
This file contains 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
" ReplaceInFiles | |
function! ReplaceInFiles(o, n) | |
exec "Ag '" . a:o . "'" | |
if empty(getqflist()) | |
return | |
endif | |
let l:c = "%s/" . escape(a:o, '\') . "/" . escape(a:n, '\') . "/g" | |
let l:p = input('additinal params? (q=quit) :' . l:c) | |
if l:p == "q" |
View Extract java class name
This file contains 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
" | |
" retuns main class name of current file. uses ctags | |
" | |
function! GetCanonicalClassName() | |
return system("ctags -f - -u --java-kinds=pc " . expand('%:p') . " | grep -m 2 -o '^[^ ]*' | tr '\\n' '.' | sed 's/.$/\\n/'") | |
endfunction | |
function! GetSimpleClassName() | |
return system("ctags -f - -u --java-kinds=c " . expand('%:p') . " | grep -m 1 -o '^[^ ]*'") |
View Vim scroll_mode
This file contains 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
function! ToogleScrollMode() | |
if exists("s:scroll_mode") | |
unmap k | |
unmap j | |
unlet s:scroll_mode | |
echom "scroll mode off" | |
else | |
nnoremap j <C-e>j | |
nnoremap k <C-y>k | |
let s:scroll_mode = 1 |