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

> Simply put, text manipulation is not at all a productivity bottleneck for me. I need much more time for thinking about code than I need for writing it.

For simple things, there's no perceived bottleneck in any editor… but not everything is simple. The productivity gains come from being able to make complex changes to documents using just normal mode and ex commands, which would normally require macros, scripts or plugins in other editors.

For example, this 12 year-old video by Derek Wyatt [1] demonstrates extracting the text from a XML representation of a mind map and turning it into a hierarchical, bulleted list using Vim’s search and replace commands which support regular expressions. Attempting to do the same thing in Notepad for example might take you 15-20 minutes.

He has a series of these videos, some of them jaw-dropping showing the power and brevity of using Vim for non-trivial editing and data extraction tasks.

And remember—this is Vim from 12 years ago with zero plugins.

> Does code just flow from their brains into their fingers? I don't get it.

There's a reason why the subtitle for Drew Neil's book Practical Vim is "Edit Text at the Speed of Thought" [2]. It's probably the best book on Vim that illuminates the power and efficiency of Vim and why it matters.

One you attain a level of proficiency with Vim, as you think about what to do next, your fingers hit the right keys and without thinking about it, the change is done.

An identifier for a constant needs to be all caps? Say the cursor is at the end of the line and the identifier is at the start of the line and I'm in insert mode.

1. Press Escape (enters normal mode)

2. Press '0' (motion for jump to first character of the line)

3. Press control-v (enter visual block mode)

4. Press 'e' (move the cursor to the end of the word while highlighting the word)

5. Press '~' (switches the case of the highlighted characters)

There's no reaching for the mouse or moving your hand towards the trackpad from the keyboard. It may not seem like much, but for experienced Vim users, an operation like this is a second nature, muscle memory thing that takes about a second to do. There's no break in focus or concentration and you're off doing the next thing.

That's where you save time and editing becomes more efficient. And while there are dozens of these types of simple edits that second nature to Vim users, doing more sophisticated changes can be just as efficient.

[1]: https://vimeo.com/user1690209

[2]: https://pragprog.com/titles/dnvim2/practical-vim-second-edit...



I have mapped esc+hjkl to arrow keys system-wide and moved esc to capslock, which is a already a game changer.

The respect for vim and especially vim keybindings is definitely there, I use it for editing bashrc‘s or similar or inspecting stuff in the terminal, but what do you recommend to get over the hump of learning it better such that e.g. vimbindings in vscode could replace the standard?

For code, I use vscode currently, so your example would be:

* cmd capslock h (to go to the beginning of the line)

* alt capslock l (to move right to the first word and off the whitespace)

* cmd d (to highlight the word und the cursor)

* F2 to rename the symbol codebase-wide or cmd shift g to select all occurrences in the file

* retype the word in allcaps (enter if F2 was used)




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

Search: