Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.3k views
in Technique[技术] by (71.8m points)

vim 仅在在一个 vimrc 中实现不同 filetype 不同映射

【出于某些原因,我不希望动 $VIM/ 里面的东西,用一个 .vimrc 完成所有配置】

" FtDetect
augroup FtDetect
    au! BufRead,BufNewFile    *.via    setfiletype via
    au! FileType            via        call VimAnnotated()
augroup END

" Via

function VimAnnotated()
    " ...
    inor ; <Right>()<Left>
    " ...
endfunction

如何让这个 inoremap 只在 .via 文件中生效?
似乎由于我包了一层函数,<Buffer> 并没有用。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

破案了,<buffer> 是大小写敏感的,严重自闭。 包一层函数并不会影响 <buffer>:setlocal
我是如何用一个小时发现这一点的:https://stackoverflow.com/que...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...