如何从 Conque shell 内部在 Vim 中打开文件
我经常发现自己在 Vim 中从 Conque shell 浏览文件系统,并想要打开特定的文件系统文件位于我现有的 MacVim 会话中。这可能吗? - 我希望得到类似的结果:
shell> open some/file.txt
然后在我现有的 Vim 窗口中(最好是在新选项卡中)弹出 file.txt。
Often I find my self navigating the filesystem from a Conque shell in Vim and want to open a specific file inside my existing MacVim session. Is this possible ? - I was hoping for something like:
shell> open some/file.txt
and then have file.txt pop up inside my existing Vim window (preferably in a new tab).
Note: I am using @wycats vim dot files (not sure this matters).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从 ConqueShell 键入
这将在 MacVim 的新选项卡中打开文件。
您还可以编写 Bash 别名来缩短命令(假设您使用的是 bash)。
放入 ~/.profile 中,
这将使您能够
从 ConqueShell 或 bash 键入,并在新的 MacVim 选项卡中打开它,而不是终端 vim。当然,它确实会禁用您运行标准 vim 的能力(尽管您仍然可以使用 vi 命令),因此您可能想要以不同的方式命名别名。
补充一下,只有当您将 mvim 可执行文件放在路径 EG /usr/bin/mvim 上时,这才有效。它带有 MacVim.app
Type from ConqueShell
This will open the file in a new tab in MacVim
You could also write a Bash alias to shorten the command (assuming you are using bash).
Put in your ~/.profile
this would enable you to type
from ConqueShell or bash, and have it open in a new MacVim tab, rather than terminal vim. It of course does disable your ability to run standard vim (although you could still use the vi command), so maybe you would want to name the alias differently.
Just to add, this will work only if you placed the mvim executable on your path E.G. /usr/bin/mvim. It comes with the MacVim.app
从 vim 内部运行 shell 的美妙之处在于您可以使用所有 vim 和 shell。
gf
是你的朋友。一旦您以某种方式获得了想要在屏幕上显示的文件,您就可以进入正常模式,将光标移动到要编辑的文件,然后使用 gf 命令导航到该文件。有很多方法可以使用它。任何输出文件名的程序或命令都非常适合此操作(ll、git status 等)。您还可以在 shell 中输入文件名,只是为了使其在屏幕上可见,而无需实际运行任何终端命令(制表符补全在这里很方便)。The beauty of running a shell from inside vim is you have all of vim and the shell at your disposal.
gf
is your friend. Once you get the file you want displayed on the screen in some way, you can enter normal mode, move the cursor to the file you want to edit, then use thegf
command to navigate to the file. There are many ways to use this. Any program or command that outputs file names is great for this (ll, git status, etc). You could also type the filename into the shell, just to make it visible on the screen without actually running any terminal commands (tab completion is handy here).有可能,您可以将 vim 作为服务器启动,然后添加任意数量的文件,但我对此不是很熟悉,所以我不能给您一个指导。
It is possible, you can start vim as server and then add as many files as you want, but I'm not very familiar with this, so I can't give you just a direction.