English 中文(简体)
是否可以重新绘制“wq”地图,以拯救和关闭目前的缓冲地带,而不是在维姆储蓄和开诚布公?
原标题:Is it possible to remap ‘wq’ to save and close the current buffer instead of saving and quitting in Vim?
  • 时间:2010-11-07 00:02:23
  •  标签:
  • vim
  • macvim

Vim Newbie。

当我发布<代码>:wq 在我指挥下,我想把它拯救起来,只是关闭积极的缓冲,而不是拯救它,然后从维姆撤出。

同样,我谨提出<代码>:q。 标题与<代码>:bd相同。

任何关于如何实施这种行为的建议?

问题回答

Vim allows the user to add key mappings for commands in all modes, including the Command-line mode, so one can define the following mappings (in one’s .vimrc file):

:cnoreabbrev wq w<bar>bd
:cnoreabbrev q bd

These commands instruct Vim to expand the WQ key presses in the command line into w|bd and, similarly, expand Q into bd. See :help key-mapping for more details.





相关问题
Autoupdate VIM Plugins?

Is it possible to update vim plugins automatically?

how to unindent in vim without leaving edit mode?

I m writing a lot of python code recently, and i used the tab-to-space mode in vim. I was just wondering how would i unindent in vim without leaving edit mode for example after i finished if...: block....

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

Vim - Deleting XML Comments

How do I delete comments in XML? If the opening and the closing comment tags are on the same line, I use :g/^<!--.*-->$/d to delete the comment. How to delete the comments that are spread ...

Limiting a match in vim to certain filetypes?

I have the following in my .vimrc to highlight lines longer than 80 chars: highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.*/ This works quite well. However, the ...

Profiling Vim startup time

I’ve got a lot of plugins enabled when using Vim – I have collected plugins over the years. I’m a bit fed up with how long Vim takes to start now, so I’d like to profile its startup and see which of ...

热门标签