vim - 我想在特定文件上更改 vim 中的键映射

标签 vim

当我们想要根据文件类型更改键映射时,vim 中的 autocmd 非常有用:

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

我现在需要的是更改键映射,但仅限于特定的文件名。这可能吗?

最佳答案

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

关于vim - 我想在特定文件上更改 vim 中的键映射,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20570316/

相关文章:

linux - 在 vim 中自动编写 for 循环?

vim 去 : How to open files returned by GoFiles

linux - Vim 命令日志

Vim 的 '(insert) VISUAL' 模式?

linux - 在 vim Linux 中向上删除行

vim - 如何在vim中的多行开头添加一个单词?

Vim 错误格式和 Spectrum lint

vim - Gruvbox 航空公司 Vim

Vim:让自动完成变得更智能

windows - 在 VIM 中模拟 Windows C-Del/C-Backspace 行为