简体   繁体   中英

I want to change a key mapping in vim while on a specific file

The autocmd in vim is very useful when we want to for example change the key mapping according to filetype:

autocmd Filetype tcl map <f1> :execute "!tclsh %"<CR>

What I need at the moment is to change the key mapping but only on an specific filename. Is this possible?

autocmd BufNew,BufRead filename.ext map <buffer> <f1> :execute "!tclsh %"<CR>

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM