[英]How can I use the + (or =) key in a mapping in vim?
I wanted to remap (for normal mode) Ctrl + a to Ctrl + = and Ctrl + x to Ctrl + - but it didn't work. 我想重新映射(对于普通模式) Ctrl + a到Ctrl + =和Ctrl + x到Ctrl + -但它没有用。
Is there another way to write this? 还有另一种写方法吗?
I had a problem using and because my shell uses those to resize my window and font size. 我在使用时遇到问题,因为我的外壳使用那些内容来调整窗口和字体大小。 I was able to map '+' and '-' to the commands so pressing them in normal mode incremented and decremented values.
我能够将“ +”和“-”映射到命令,因此在正常模式下按它们递增和递减的值即可。
map + <C-a>
map - <C-x>
Is that what you were trying to accomplish? 那是你想要完成的吗? I don't know if that will work for you, since they probably have different uses that I don't use.
我不知道这是否对您有用,因为它们可能具有我不使用的不同用途。
You could also use a mapleader instead of control to do this and not mess with any default uses: 您也可以使用mapleader而不是控件来执行此操作,并且不会与任何默认用法混淆 :
let mapleader=","
map <Leader>+ <C-a>
map <Leader>- <C-x>
Instead of C-+ and C-- , you would use ,+ and ,- . 可以使用,+和,-代替C- +和C-- 。
我不确定Ctrl + = ,但对于Ctrl + - ,请尝试使用Ctrl + _ (用下划线替换连字符)。
Works for me. 为我工作。
map <C-a> <C-=>
map <C-=> :echo 'ken'<CR>
map <C-x> <C-->
map <C--> :echo 'barbie'<CR>
Then <Ca>
should echo ken
and <C-->
should echo barbie
然后
<Ca>
应该回声ken
和<C-->
应该回声barbie
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.