Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim Navigation Requires Too Much Thinking [closed]

Tags:

vim

I've been using vim for a few years and I love how easy it is to do simple tasks like insert above current line, delete whole line, etc. I've even mapped my caps lock to escape because of it!

One problem with vim that I could never get over was how much thinking navigation requires compared to mouse movements, even after you've learned the keys. I know about some of the movements like %, ^, $, f/F, t/T and using numbers before a command but I feel like it takes a lot more effort to use them and they disrupt my workflow.

For example, I need to delete the "/many/sections/" of this url and the cursor is in the middle of the word "really":

http://this/is/a/real|ly/long/url/with/many/sections/

With a mouse, it takes no thinking power to just click and select the sections I want to remove and hit delete.

If I do this in vim, I find myself thinking: Ok, first $ brings the cursor to the end. Then I want to delete those sections so I can use the '/' as deliminator and now I have to count how many of the '/' I want to move back. It's two and I have to search backwards so it's F, not f. So I think the command should be $d2F/.

Alternatively, I could have used 'm' as a landmark for the cursor and delete to the end from there but then I'd have to scan the url to look for letters to use. And if there was another m, I'd also have to press ; repeatedly or start counting.

This seems a lot harder than just using a mouse, even with the delay of moving my hands off the keyboard. This is especially true for multiple line selections where I find myself spending a lot of time counting words or lines or looking for deliminators.

Also, sometimes the command either deletes or doesn't delete some extra deliminator characters because I used f instead of t or vice versa whereas with a mouse, I can pinpoint exactly what I'm trying to select.

like image 924
Wei Avatar asked Jan 13 '23 12:01

Wei


1 Answers

The / key is your friend. From where you are hit /ma ENTER. Then, hit D to delete the rest of the line.

like image 77
DJG Avatar answered Jan 18 '23 16:01

DJG