Skip to content

Instantly share code, notes, and snippets.

View brooth's full-sized avatar

Khalidov Oleg brooth

View GitHub Profile
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
"
" 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 '^[^ ]*'")
" 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"