Skip to content

Instantly share code, notes, and snippets.

@brooth
Created December 10, 2016 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brooth/a89faaa35b52277dd1d1981d5f991d47 to your computer and use it in GitHub Desktop.
Save brooth/a89faaa35b52277dd1d1981d5f991d47 to your computer and use it in GitHub Desktop.
"
" 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 '^[^ ]*'")
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment