关于 vimrc 中同时使用 iabbrv 和 inoremap 的疑惑
Just4Learning opened this issue · 1 comments
Just4Learning commented
在 vimrc 文件中添加 autocmd! FileType python :iabbrev <buffer> printf print("")<Esc>hi
后,写 Python 代码时输入 printf
可以如愿得到 print("")
。
此时,在 vimrc 文件中多加两句——inoremap ( ()<Esc>i
和 inoremap " ""<Esc>i
之后,再次在 Python 文件中输入 printf
得到的是 print("")"")
,机械地自动配对了括号和引号。
暂时我的解决办法是把 autocmd! FileType python :iabbrev <buffer> printf print("")<Esc>hi
改成 autocmd! FileType python :iabbrev <buffer> printf print("
。
如何让 iabbrev 如实呈现缩写,不要补全成对的符号。
wsdjeg commented
autocmd! FileType python inoreabbrev <buffer> printf print("")<Esc>hi
inoremap ( ()<Esc>i
inoremap " ""<Esc>i