TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: What is your favorite lesser known VIM shortcut you can share

11 点作者 irishmansevilla2 个月前
:earlier 10m → Moves your buffer state 10 minutes earlier. :later 5m → Moves your buffer state 5 minutes later.<p>Why it&#x27;s helpful: It acts like a time machine for your edits! If you regret changes but don’t want to undo manually, you can jump back in time.<p>You can also use it with changes, e.g., :earlier 5c (5 changes earlier).

7 条评论

riddley2 个月前
When I&#x27;m showing people the power of vim, I often use the `i` verb, like `ci&quot;` and how it&#x27;s not a &quot;shortcut&quot; but instead a sentence: change in quotes. If you start thinking about vim as a language instead of a collection of things to memorize, it becomes much easier, IMO.
kkoncevicius2 个月前
Maybe one lesser known is changing to visual mode within operation. A few examples (^ marks the cursor):<p><pre><code> one two three ^ </code></pre> &#x27;db&#x27; would leave letter &quot;e&quot; behind. But &#x27;dvb&#x27; would include the &quot;e&quot; as well.<p>Another example, say we want to delete from &quot;two&quot; to &quot;five&quot;.<p><pre><code> one two ^ three four five six </code></pre> &#x27;d&#x2F;five&#x27; would leave a &quot;t&quot; as well as &quot;five&quot;, but &#x27;dV&#x2F;five&#x27; would delete all necessary lines. This helps targeting lines without using relative line numbers.
tmaly2 个月前
sometimes when I copy data into a file, I get some blank lines depending on how the data was formatted. This can often happen when copying from websites.<p>I find this shortcut useful to delete all blank lines in a file<p>:g&#x2F;^$&#x2F;d
评论 #43326600 未加载
zeke2 个月前
:Lexplore opens a split window with a directory listing you can navigate.<p>:33Lexplore opens the split with a slimmer, 33% width, window. :Lex&lt;tab&gt; to autocomplete if you do not want to type as much.
croo2 个月前
I never know what is lesser known but my faviourite is: * searches for the word under the cursor, # searches backwards. You can also use n for next and N for previous hit.
scrapheap2 个月前
Favorite is hard, but if you use vim and don&#x27;t know that `.` repeats the last change then you&#x27;re missing out. It&#x27;s really useful for those times where you need to make the same change in lots of places in a file, but not everywhere.
pizza2 个月前
not a shortcut but still tremendously useful when I need it:<p><pre><code> # open some files in vertical splits &gt; ls $FILES | nvim -O # -o does horizontal splits</code></pre>
评论 #43320982 未加载