質問

I have a custom "go to definition" shortcut that works great in python (using ropevim) but when I'm in a coffee-script file I need to use the normal ctags lookup to navigate around. Would it be possible to make just one shortcut that did either a ropevim lookup OR a ctags lookup depending on the file type that is open in the current buffer?

役に立ちましたか?

解決

You can put if/endif tests in your mappings by way of :execute but that's a bit messy.

What you should do instead is define your mappings in filetype-specific autocmds (see :h autocmd):

autocmd FileType python nnoremap this that

or, better, define them in ~/.vim/after/ftplugin/python.vim (and another file for coffeescript and so on):

nnoremap <buffer> this that
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top