Skip to content

Instantly share code, notes, and snippets.

@bouzuya

bouzuya/gist:1885339

Created Feb 22, 2012
Embed
What would you like to do?
autoload/*.vim <-> plugin/*.vim
function! s:open_pair_file()
let path = expand('%:p')
let pairs = [
\ ['/autoload/\([^/]\+\).vim$', '/plugin/\1.vim'],
\ ['/plugin/\([^/]\+\).vim$', '/autoload/\1.vim']
\ ]
for [pat, sub] in pairs
if match(path, pat) != -1
execute 'hide' 'edit' substitute(path, pat, sub, '')
break
endif
endfor
endfunction
nnoremap <Space>p :<C-u>call <SID>open_pair_file()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment