Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Awesome! I'd love to see something like this as a standalone project. "Vim Critic" or "Vim Coach" - something to say "these are the inefficient things you personally do."

Probably some low-hanging fruit would be "any keystroke in Normal mode that's repeated." Eg, if I'm doing 'jjjj' to move down or even 'wwww' to hop from word to word, I could be searching or using a movement combo like '4j'.



Personally, the main reason I moved from vim to emacs is because I don't want to have to think about my editor, I want it to be pure muscle memory. I'm okay with hitting "jjjjk" to go 3 lines down rather than trying to guess that it's exactly 3 down and typing "3j". Emacs-style navigating/editing is great for this kind of error-tolerant navigation/editing. It leaves my brain mostly free to focus on whatever I'm actually coding at the time.


I think most experienced vim users will tell you that it is pure muscle memory for them. Also, vim supports jjjjk as well as 3j. Anyway, I just realized I am debating vim vs emacs so I'll stop here.


We all know the one true editor is the Chrome console anyway.


ewww


Nothing about vim forces you not to type jjjjk, or better yet use motions or whatever fits your brain. But keep up the good emacs-vs-vim-troll fight


I go with a hybrid approach: I hit the number row somewhere in the loose vicinity of the number of rows I want to move, and then hit "j" a couple times to get exactly there. If it's more than a single-digit number of rows away, I might do the first step more than once.


I think it's better to repeatedly hit j rather than count "ah, 5 lines" and type 5j. Even better, you're already looking at where you want to go, it may be faster to hit / and start typing from that point to jump there.

Or, and this is a wild one, grab the mouse and click the point where you want the cursor, rather than giving some sort of treasure map to Vim: "Starting at the typedef, take 5 steps right, then 10 steps down, and 2 more steps right"


A little tweak that got me in the habit of using things like 5j and 6dd: :set relativenumber.

It numbers your current line as 0, and counts up and down from there. It makes it very easy to see that you need to delete the next 5 lines, or move up 10 lines without doing any math.

As for your mouse comment, I don't think you can compare the speed with which an experienced vim user gets their cursor where they want it to the catastrophic cache miss of removing your hand from the comfort of the home row, grabbing the mouse, moving it where you want, clicking it, and moving your hand back to the keyboard. The mere thought makes me shudder :)


catastrophic cache miss

haha, great prose.

+1 for relative line numbers. I scripted up ctr+n so I can toggle between relative and absolute as needed, though, there are even plugins capable of intelligently switching when necessary (like http://www.vim.org/scripts/script.php?script_id=4212).


I prefer hybrid line numbering. This way, you can see the true number of the line you are on, while all the other lines on the screen are numbered relative to your position.

http://jeffkreeftmeijer.com/2013/vims-new-hybrid-line-number...


Now this is perfection. Get both relative line numbering and absolute line numbers.

However, I use the vim-powerline plugin which displays the current line number/total lines at the bottom which is enough for me.


As someone who watches a lot of people use Vim, I think many would be better off with a little judicious mouse use. Yes, you very busily slam keys, but it seems to take a pretty damn long time and a lot of keystrokes to actually accomplish the monumentally complex task of shifting the cursor 30 lines down and 10 characters over.

My trackball is all of 4 inches from my right hand, and I always know where it is because it doesn't move around. Now, you can try and overplay the difficulty of grabbing the pointer ("I have to instruct my arm muscles to tense and pivot at both the elbow and shoulder while causing my fingers to curl into the appropriate shape" and so on) but I'd wager I could get the cursor to a given semi-distant point on a screen of code faster than even the most frantic of vim key-pounders.


Yes, yes, yes. As someone who used to buy into keyboard fascism, I wholeheartedly agree with this. I consider myself proficient with Vim (and Emacs) in terms of keyboard controls, and know all of the fancy Vim motions and text objects.

However, even when editor keyboard commands become "muscle memory", there's still a little part of your brain that has to make a decision regarding how you're going to navigate/select/change/delete from point A to point B. With the mouse, you don't have to think up an algorithm for editing. You just think about the code at hand. I've found that the fraction-of-a-second decision making regarding _how_ to edit can be enough to interrupt my train of thought. Reading this article ( http://www.asktog.com/TOI/toi06KeyboardVMouse1.html ), while it may be quite old, helped me realize this fact.

That being said, I still think Vim is a great editor, and I don't mean to make any blanket statements about it's effectiveness. I just also believe that the obsession with "efficiency" is totally blown up with regards to editing text. Shouldn't we strive for efficiency in translating algorithmic thought to programming language? I think the keyboard crowd (myself included) tends to get caught up in the little details.


:set mouse=a enables mouse pointer in vim




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: