我想在可视模式下映射ctrl + a来选择并复制当前缓冲区中的所有文本.
基本思想是执行:%y*(将所有缓冲区复制到剪贴板).因此,映射应该是:xmap:%y*(仅适用于可视模式的xmap)
但是,每当我运行此映射时,都会显示以下输出:
E492: Not an editor command: '<,'>%y*
Run Code Online (Sandbox Code Playgroud)
而且,我认为Vim是对的:-).在可视模式下,按":",使cmd-line显示那些令人惊讶的字符:
":'<,'>"
Run Code Online (Sandbox Code Playgroud)
唯一相关的一块信息在哪里可以找到这种模式("<">)是一个:http://vimdoc.sourceforge.net/htmldoc/cmdline.html#v_:(并没有帮助我) .
问题:我做错了什么(配置......)?我的需求是否有另一个答案(将所有文本复制到剪贴板)?
我正在运行Vim 7.3,我只在我的vimrc中设置了nocompatible
谢谢你的帮助,汤姆
使用:
xnoremap <whatever> :<c-u>%y*<return>
Run Code Online (Sandbox Code Playgroud)
附加ctrl- u擦除命令行直到光标.
从vim参考:
*c_CTRL-U*
CTRL-U Remove all characters between the cursor position and
the beginning of the line. Previous versions of vim
deleted all characters on the line. If that is the
preferred behavior, add the following to your .vimrc: >
:cnoremap <C-U> <C-E><C-U>
Run Code Online (Sandbox Code Playgroud)