Skip to content

Instantly share code, notes, and snippets.

@mike-burns
Created February 27, 2011 16:10
Show Gist options
  • Save mike-burns/846287 to your computer and use it in GitHub Desktop.
Save mike-burns/846287 to your computer and use it in GitHub Desktop.
~/.vim/ftplugin/java.vim
if exists("b:did_android")
finish
endif
let b:did_android = 1
" Functions
if !exists("*s:Find")
function! s:Find()
if filereadable(expand("<cfile>"))
return expand("<cfile>")
endif
if match(expand("<cfile>"), '\C\<R\>\.', 0) != -1
return expand(substitute(substitute(expand("<cfile>"), "R", "res", ""), '\.', '/', "g") . ".xml")
else
return expand("<cfile>")
endif
endfunction
function! s:OpenFind()
let theFile = s:Find()
execute "find " . theFile
endfunction
endif
" Plumbing
if !hasmapto('<Plug>AndroidOpenFind')
nmap <buffer> <unique> <script> <Plug>AndroidOpenFind <SID>OpenFind
endif
nmap <buffer> <SID>OpenFind :execute "find " . <SID>Find()<CR>
if !hasmapto('<Plug>AndroidOpenFindTab')
nmap <buffer> <unique> <script> <Plug>AndroidOpenFindTab <SID>OpenFindTab
endif
nmap <buffer> <SID>OpenFindTab :execute "tabfind " . <SID>Find()<CR>
" Mappings
nmap <buffer> gf <Plug>AndroidOpenFind
nmap <buffer> <C-W>gf <Plug>AndroidOpenFindTab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment