Vim最有效的捷徑是什麼? - What is your most productive shortcut with Vim?

問題:

I've heard a lot about Vim , both pros and cons. 我聽過很多關於Vim的消息 ,包括優點和缺點。 It really seems you should be (as a developer) faster with Vim than with any other editor. 看起來你應該(作爲開發人員)使用Vim比使用任何其他編輯器更快。 I'm using Vim to do some basic stuff and I'm at best 10 times less productive with Vim. 我正在使用Vim來做一些基本的東西,而且使用Vim,我的效率最多只有 10倍。

The only two things you should care about when you talk about speed (you may not care enough about them, but you should) are: 當你談論速度時你應該關心的兩件事(你可能不太關心它們,但你應該這麼做)是:

  1. Using alternatively left and right hands is the fastest way to use the keyboard. 使用左手和右手交替使用鍵盤是最快捷的方式。
  2. Never touching the mouse is the second way to be as fast as possible. 永遠不要觸摸鼠標是第二種儘可能快的方法。 It takes ages for you to move your hand, grab the mouse, move it, and bring it back to the keyboard (and you often have to look at the keyboard to be sure you returned your hand properly to the right place) 移動手,抓住鼠標,移動鼠標並將其帶回鍵盤需要很長時間(而且您經常需要查看鍵盤以確保將手正確地移到正確的位置)

Here are two examples demonstrating why I'm far less productive with Vim. 這裏有兩個例子,說明爲什麼我對Vim的效率低得多。

Copy/Cut & paste. 複製/剪切和粘貼。 I do it all the time. 我一直這樣做。 With all the contemporary editors you press Shift with the left hand, and you move the cursor with your right hand to select text. 使用所有當代編輯器,您可以用左手按Shift鍵 ,然後用右手移動光標以選擇文本。 Then Ctrl + C copies, you move the cursor and Ctrl + V pastes. 然後按Ctrl + C複製,移動光標並按Ctrl + V粘貼。

With Vim it's horrible: 有了Vim,它太可怕了:

  • yy to copy one line (you almost never want the whole line!) yy複製一行(你幾乎從不希望整個行!)
  • [number xx]yy to copy xx lines into the buffer. [number xx]yyxx行復制到緩衝區中。 But you never know exactly if you've selected what you wanted. 但你永遠不知道你是否選擇了你想要的東西。 I often have to do [number xx]dd then u to undo! 我經常要做[number xx]dd然後u撤消!

Another example? 另一個例子? Search & replace. 搜索和替換。

  • In PSPad : Ctrl + f then type what you want you search for, then press Enter . PSPad中 : 按Ctrl + f,然後鍵入要搜索的內容,然後按Enter鍵 。
  • In Vim: / , then type what you want to search for, then if there are some special characters put \\ before each special character, then press Enter . 在Vim中: / ,然後鍵入要搜索的內容,那麼如果有一些特殊的字符放在\\ 每個特殊字符前,然後按Enter鍵 。

And everything with Vim is like that: it seems I don't know how to handle it the right way. 與Vim的一切都是這樣的:似乎我不知道如何以正確的方式處理它。

NB : I've already read the Vim cheat sheet :) NB: 我已經閱讀過Vim 備忘 單了 :)

My question is: 我的問題是:

What is the way you use Vim that makes you more productive than with a contemporary editor? 你使用Vim的方式是什麼讓你比現代編輯更有效率?


解決方案:

參考一: https://en.stackoom.com/question/56xS
參考二: https://stackoom.com/question/56xS
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章