是否可以在VIM打开的文本文件中执行VIM命令?例如,我们可以有以下文本,并且我们希望在不键入它的情况下执行它。:help w
Read the text in the help window to find out how the help works.
Type CTRL-W CTRL-W to jump from one window to another.
Type :q <ENTER> to close the help window.
You can find help on just about any subject, by giving an argument to the
":help" command. Try these (don't forget pressing <ENTER>):
:help w
:help c_CTRL-D
:help insert-index
:help user-manual
Run Code Online (Sandbox Code Playgroud)
您可以创建以下映射来执行当前行中定义的命令:
nnoremap <c-e> :exe getline('.')<cr>
Run Code Online (Sandbox Code Playgroud)
将光标放在行中:help w并键入Ctrl+E将打开帮助页面。