您妈妈从未告诉过您的Vim的黑暗角落是什么? [英] What are the dark corners of Vim your mom never told you about?
问题描述
人们谈论常见的技巧有很多问题,特别是 Vim + ctags的技巧和窍门。
There are a plethora of questions where people talk about common tricks, notably "Vim+ctags tips and tricks".
但是,我没有提到Vim新手会觉得很酷的常用快捷方式。我说的是一个经验丰富的Unix用户(他们是开发人员,管理员,两者都是),他认为他们知道我们99%的人从未听说过或梦想过的东西。不仅使他们的工作更轻松,而且使COOL和 hackish 变得更容易。毕竟, Vim 驻留在世界上最黑角的操作系统中,因此它应该具有复杂的功能,只有少数特权者知道并希望与我们分享。
However, I don't refer to commonly used shortcuts that someone new to Vim would find cool. I am talking about a seasoned Unix user (be they a developer, administrator, both, etc.), who thinks they know something 99% of us never heard or dreamed about. Something that not only makes their work easier, but also is COOL and hackish. After all, Vim resides in the most dark-corner-rich OS in the world, thus it should have intricacies that only a few privileged know about and want to share with us.
推荐答案
:! [命令]
在Vim中执行外部命令。
:! [command]
executes an external command while you're in Vim.
但是在冒号后加一个点, :。! [command]
,它将命令的输出转储到当前窗口中。 :。 !
But add a dot after the colon, :.! [command]
, and it'll dump the output of the command into your current window. That's : . !
例如:
:.! ls
我经常将其用于将当前日期添加到我输入的文档中:
I use this a lot for things like adding the current date into a document I'm typing:
:.! date
这篇关于您妈妈从未告诉过您的Vim的黑暗角落是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!