When you do a key mapping from within Vim and a certain file, does that mapping get saved for that file (Meaning that when I reopen that file at a later time, the mapping will still hold, but not for other files)?
I have done the remapping in my vimrc before but not like this, so I am unsure.
Thanks
Filetype specific mappings goes to plugin/ftplugins/<filetype>.vim
. You can keep your mapping there, for instance, plugin/ftplugn/cpp.vim
.
For you can make a autocmd for whatever mapping you want
autocmd FileType cpp map <buffer> <key> ...
You can put the filetype-related configuration into ~/.vim/ftplugin/<filetype>/<any-name>.vim
. When you open file or create new file, Vim load all of files named ftplugin/<filetype>.vim
and ftplugin/<filetype>/*.vim
. I suggest to use ~/.vim/ftplugin/<filetype>/*.vim
since you can separate files for each categories. For example,
You can separate configuration file for plugins.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.