有没有一种方法可以在 NERDTree 中使用一个快捷方式或函数关闭所有打开的 windows,然后 return 回到命令行?
Is there a way to close all open windows while in NERDTree with one shortcut or function and return back to the command line?
在 vim 中,我可能同时查看 3 或 4 个文件。在这种情况下,我需要单独关闭所有文件并 return 返回命令行以便我可以做其他事情。
我希望能够快速做到这一点,而不必在所有开放 windows 中执行 :wq
。基本上是将 NERDTree 和其他缓冲区一起关闭的快捷方式。
要return回到命令行,只需使用
:qa " as in quit all
要保存所有文件,请使用 :wqa
。
要关闭所有 windows(splits) 除了当前的,使用 ctrl+w o (C-w o
)
为了关闭除当前缓冲区之外的所有缓冲区,有一个脚本BufOnly
使用 Ctrl + z 返回命令行。那么你可以
fg 1
回到原来的地方。
由于 Isaac 的评论明确指出问题实际上是关于如何 return 到命令行然后 return 到 Vim:
要在 Vim 内打开 shell,请使用命令 :sh
或 :shell
。来自 the docs:
:sh[ell]
This command starts a shell. When the shell exits (after the "exit" command) you return to Vim. The name for the shell command comes from 'shell' option.
另请参阅以下两个命令:
:!{cmd}
Execute {cmd}
with the shell.
:!!
Repeat last :!{cmd}
.
在 vim 中,我可能同时查看 3 或 4 个文件。在这种情况下,我需要单独关闭所有文件并 return 返回命令行以便我可以做其他事情。
我希望能够快速做到这一点,而不必在所有开放 windows 中执行 :wq
。基本上是将 NERDTree 和其他缓冲区一起关闭的快捷方式。
要return回到命令行,只需使用
:qa " as in quit all
要保存所有文件,请使用 :wqa
。
要关闭所有 windows(splits) 除了当前的,使用 ctrl+w o (C-w o
)
为了关闭除当前缓冲区之外的所有缓冲区,有一个脚本BufOnly
使用 Ctrl + z 返回命令行。那么你可以
fg 1
回到原来的地方。
由于 Isaac 的评论明确指出问题实际上是关于如何 return 到命令行然后 return 到 Vim:
要在 Vim 内打开 shell,请使用命令 :sh
或 :shell
。来自 the docs:
:sh[ell]
This command starts a shell. When the shell exits (after the "exit" command) you return to Vim. The name for the shell command comes from 'shell' option.
另请参阅以下两个命令:
:!{cmd}
Execute
{cmd}
with the shell.
:!!
Repeat last
:!{cmd}
.