Skip to content

Instantly share code, notes, and snippets.

@bouzuya
Created February 22, 2012 14:26
Show Gist options
  • Save bouzuya/1885339 to your computer and use it in GitHub Desktop.
Save bouzuya/1885339 to your computer and use it in GitHub Desktop.
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