Live data from Hacker News

Ask HN: How to become good at Emacs/Vim?

news.ycombinator.com

1–10 of 84 posts

Ask HN: How to become good at Emacs/Vim?

#1
I've tried switching from IDEs like VSCode to Emacs (with evil mode) a few times now, but I always gave up after a while because my productivity decreases. Even after 1-2 weeks it's still not close to what it was with VScode. That's frustrating. But when I watch proficient people using these editors I'm always amazed at what they can do, and they appear more productive than I am with VSCode. So with enough effort it should be a worthwhile investment.

I think my problem is the lack of a structured guide/tutorial focused on real-world project usage. I can do all basic operations, but I'm probably doing them in an inefficient way, which ends up being slower than a GUI. But I don't know what I don't know, so I don't know what commands and keybindings I should use instead or what my options are.

How did you become good at using these editors? Just using them doesn't really work because by myself I'd never discover most of the features and keybindings.

Re: Ask HN: How to become good at Emacs/Vim?

#2
I think what I did was just force myself to use it and if there was something in particular I wanted to do I would look it up, or if there was something that I was doing repeatedly I would try to find how to do it in the lowest number of keystrokes.

After I got the basic movements down (doing vimtutor if I needed refresher), then I would watch videos on youtube of peoples favourite keybinds, or lesser known keybinds. A lot of times this would open up a lot of things I didn't realize was possible.

Eventually I started to understand the vim "language", and things became natural to the point where I don't even really think about the keybinds I'm using, it just happens.

It was definitely a struggle at first though. If I could go back and be a TA again for intro to programming labs I would have found a way to give people extra credit for learning vim. The best time to start putting in the work is now, you'll thank yourself later.

If you program in C, google "Ctags" and the associated keybinds and vim command line argument (-t). Most useful utility for me personally.

Re: Ask HN: How to become good at Emacs/Vim?

#3
When I wrists started hurting after a few years of professional programming, I became motivated to learn him.

I used vimtutor on Mac to get started.

Then I also tried my hands at a few vimgolfs and then tried to understand the winning answers.

There’s a lot of YouTube tutorials now too.

Re: Ask HN: How to become good at Emacs/Vim?

#4
I made the switch to vim a few years ago. You'll want to start with learning the keybindings. Every major IDE and editor out there has a "vim mode" and an "emacs mode" so pick one you like and enable it. Whenever you need to move more quickly just switch back to your usual keybindings and get it done. Once you have the keybindings memorized, try to use them everywhere. There are browser plugins like vimium that let you navigate with vim keybindings for example.

It gets a bit weirder from there. If you pick vim for example theres a whole lot of customization rabbit holes you can go down. My advice is to find some sensible defaults and layer in stuff as you need it from there. vim-sensible[0] is a good start.

Good luck!

[0] - https://github.com/tpope/vim-sensible

Re: Ask HN: How to become good at Emacs/Vim?

#5
I dabbled with neovim on and off for a while - kind of following the same logic as you, wanting to be like many people I saw on Youtube. It never really worked since I was really comfortable with my existing workflow - vscode + iterm and "swiping" between screens on macOS. I was super-fast with the Macbook trackpad with its sensitivity turned up to the max.

It finally clicked when I started a job where I had to use a windows laptop with a linux VM as my primary computer. I found that using vscode either within the VM or over "Remote-SSH" from windows was severely cramping my productivity. So I switched to NeoVim+Tmux cold turkey (SSHing into VM using "Windows Terminal"). I set up some shortcuts that made sense for me somewhat from vscode (e.g. Alt+ for switching "tabs", alt+hjkl or alt+arrow keys to switch between tmux panes etc.). Within a couple of weeks I was back to my old level of productivity.

My usual setup has neovim on the left and a terminal in the right pane. Adding more panes vertically or horizontally is super easy as well. This may not be the most optimal setup, and there are still a few pain points from time to time - particularly with the LSP/"intellisense" stuff. But it works for me.

Oh and when I am coding on my MacBook Pro at home, I still prefer to use vscode + iTerm.

Some resources that helped:

"Practical Vim" by Drew Neil. I didn't read it cover to cover but I have scanned through it enough to pick up the important stuff.

https://www.youtube.com/watch?v=iF4RvQq6yU0

https://www.youtube.com/watch?v=GUptUQGrJLE

https://www.youtube.com/watch?v=wlR5gYd6um0

Re: Ask HN: How to become good at Emacs/Vim?

#6
Pair programming is a great way to learn. Just watch what others do and pick up tricks.

Also, check out fugitive by tim pope. It’s a git plugin for vim that’s changed my life. It’ll open your files with the old version in one split and the new version in another. You can then pull in changes chunk by chunk. It’s amazing.

Re: Ask HN: How to become good at Emacs/Vim?

#7
Honestly I never devoted myself to trying emacs, but I learned vim the same way you're being inspired. Seeing other people, asking "Hey how'd you do that?" and then going from there

Taking those and making a point to work them into muscle memory has been key.

Eventually I found that I was familiar with the core modifiers (and figuring out new things) without any real effort. I knew that shift + something would do a specific thing

It takes knowing about the thing... and using it so much that you don't even have to think about it

The cases where I'm a little bit beyond what one can reasonably handle with sed is when I get to flex the vim muscles. Things like visual mode, finding/replacing, etc.

Re: Ask HN: How to become good at Emacs/Vim?

#9
I use Helix (very much like vim) and a lot of applications that use keyboard focused vim-like UX, and the only advice I have is to keep using it. It's like playing an instrument, eventually your mind just makes your will a reality through your fingertips, you don't even have to think about it, but until then, you do.

Get the basic operations down, keep a cheatsheet handy, anything you'd want to do that you think might have a key combo look it up the minute you need it. Take an interest in it for it's own sake every now and then.

Post reply on HN