Live data from Hacker News

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

news.ycombinator.com

61–70 of 84 posts

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

#61
post #12

I use emacs with evil and been using it for over a decade now. However, I use VSCode for web development and Rider for game development as the integrations are superior with vim extensions for those IDEs. What you are looking for is a set of principles that make theses editors better. You can take baby steps towards it and 1 - 2 weeks is very limited time if you want to change your editing style (It's like learning a…

This is good advice. The "Zaiste Programming" [1] is a nice intro to Doom Emacs.

I'd say using Vim Keybindings in VSCode, being able to use Vim when on some remote machine and using Doom Emacs with its included packages is a good approach for improving without investing too much time.

[1] https://youtube.com/playlist?list=PLhXZp00uXBk4np17N39WvB80z...

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

#62
post #40

Earlier quoted context omitted.

Reinforcing #1: It's amazing how productive you can be if you're creating things instead of endlessly trying, configuring, and comparing editors.

I mean, you're going to be programming for the rest of your life, right? I put a bunch of time into customizing vim... god, I think it was 15 years ago? Whenever this comes up, people make it sound like you are somehow going to be doing that every single day for the rest of your life or something... and then, awkwardly, I tend to see them screwing around constantly with some new IDE-of-the-week that crashes constantl…

I agree with you, and that's one of the reasons I wanted to try switching away from VSCode. It has been pretty good, but sometimes it's quite slow and does who-knows-what in the background, and then I check my CPU and memory usage and yep, it's eating 32Gi of ram. For what? Editing text? Compiling unncessary stuff when I don't want to compile? Then I restart it, like the good old Windows 95 days, and it's all good again. Probably something with the LSPs, but who knows. The point is, it's a lot of magic in those plugins, and I don't like magic because at some point the extra cost of debugging the magic is not worth it. I'd rather have a system that properly surfaces the complexity even if that means it takes longer to learn.

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

#63

Emacs suggestions in no particular order: Emacs manual is great, at least skim it to see what's out there in stock Emacs. Look at what Spacemacs provides in packages: these are most likely the most popular extensions. You don't need to use Spacemacs, but this is the closest to the curated list of useful packages Emacs has (would be glad to be proven wrong - is there a better list?), so at least reading through it wil…

An addition: you do not _have_ to do everything Emacs-way. Some of "Emacs way" is obsolete, some of it is different from mainstream due to technical limitations of bygone ages or due to the effects of path dependence. Try everything, but feel free to discard things that don't improve your workflow.

For example, I have Command-O bound to "open file" and Command-S bound to "save file", because I don't want to remember another set of obscure hotkeys. I have Command-T for "open me a new blank file", because that's browsers' hotkey.

I use Control-[FBNP] and derivatives because they also work in shells and in majority of edit fields in mac OS. Otherwise I would probably stick to cursor keys.

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

#64
From an ex-Emacs/nvim and happy SublimeText user. Don't switch. Both (vim in particular) will eat a lot of your time to master and (Emacs in particular) to tweak. Ultimately, neither of these made me more productive. IMO there are so many better ways of spending the time :)

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

#65
The proficient people you see rely on customizations that they have slowly improved over many years. No two of their setups are exactly alike.

You can't discover everything by exploring and reading help. The way you make radical improvements to how you use tools like Emacs and Vim is to identify pain points with what you're doing and search for solutions online.

There is a Vim StackExchange site, and Vim questions are also topical on StackOverflow.

For instance, one day I got tired of the clumsy buffer switching commands in Vim, so I researched into buffer management; are there better ways. I discovered buffer management plugins. I found one I liked and then customized its silly keybindings so that to bring up the visual buffer list, I just have to type \\ (backslash backslash).

I got tired of reloading files after quitting, so I researched into sessions. Then customized my ~/.vimrc with some useful things for working well with sessions. I can save a session with just :S , and save with +. Sessions are great. I have sessions named after Jira tickets. When revisiting some ticket, I just "vim -S sess/" and there is the edit session from three weeks ago with all the same files.

I replace Vim's configured grep program with lid, which is a tool from GNU Id-Utils. It uses ahead-of-time indexing (performed by a tool called mkid which builds a binary file called ID) for instantaneous grep-like searches of large trees. In some situations/projects, I also replace Vim's grep with "git grep".

Tags are important in Vim: they are the basis for "jump to definition". The Exuberant Ctags program has a lot of options. You can have it index filenames so that they become tags: :tj foo.h will jump to a foo.h file somewhere deep in the tree.

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

#66
post #37

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 Editing text efficiently is not the same as being a productive developer. The bottleneck is rarely how fast you can type or edit the code; it's how fast you can reason about the code. When you watch a prerecorded video most of the time all the thinking has already happened, a…

> The bottleneck is rarely how fast you can type or edit the code; it's how fast you can reason about the code. That's the reason why I have been not learning to touch type for the last decade or so. I just have this strong feeling that it's my brain, not my fingers that is the bottleneck. At the same time, I somehow acknowledge that being able to touch type could in some still undefined way to me increase my product…

It looked naively obvious to me in the 9th grade of high school that I would crank out code faster if I could touch type. That and write messages faster on dial-up bulletin boards, and crank out essay homework faster also. I signed up for a keyboarding course. After one day though, I thought, WTF am I doing in this mindless class full of ditzes? I could learn this on my own. I promptly dropped out, switching to some other course. Sticking with my initiative to learn to type, I found a book of fprogressive typing exercises: a guide consisting of a sequence of rows: type this row, then go onto this one, ... instead of just typing a row, like the book required, I filled the screen with each exercise, and then some. The book, which I must have found in the public library, started with exercises using just asdf, and jkl; and so forth, adding more areas of the keyboard. I forced myself to look only at the screen, and not the fingers. Several days later, I had gone through the entire book and, whoa, I could type. I wasn't a great typist by any means, but I was "boostrapped". All my regular typing was now done with all fingers, without looking and thus all my regular computer activities now served as typing exercises, making me faster and more accurate.

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

#67
post #37

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 Editing text efficiently is not the same as being a productive developer. The bottleneck is rarely how fast you can type or edit the code; it's how fast you can reason about the code. When you watch a prerecorded video most of the time all the thinking has already happened, a…

> The bottleneck is rarely how fast you can type or edit the code; it's how fast you can reason about the code. That's the reason why I have been not learning to touch type for the last decade or so. I just have this strong feeling that it's my brain, not my fingers that is the bottleneck. At the same time, I somehow acknowledge that being able to touch type could in some still undefined way to me increase my product…

Touch typing will increase your productivity because you will get your HN comments done in 10% of the time, leaving time for thinking about code. :)

Development isn't just coding. It's writing documentation (requirements, high level design, detailed design, reference manuals, ...), commit comments, bug reports, e-mails, status reports, ...

Poor keyboarding skills will definitely hold you back.

In order to reason about code, one thing you can do is write. Not write code, but prose about the subject matter. Writing is a thinking tool, and if you have good typing skills, the words pour out a lot faster, at times almost as fast as you can think.

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

#68

VSCode/IDEs and Vim need not be mutually exclusive. I tend to rely on vim emulation within my vscode, chrome and in other applications. Usually, all I need are the basic vim modalities with the nicer amenities provided by modern editors.

The well known “Vim mode paradox”: if you like the Vim mode provided by another editor, it means you don’t know Vim well enough to justify using Vim nor Vim mode. Vim modes don’t approach even 10% of the Vim features you need to reach the bare minimum of efficient editing.

That's fine, my focus is on mastering software engineering (rather than text editing) :p

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

#69
post #40

Earlier quoted context omitted.

Reinforcing #1: It's amazing how productive you can be if you're creating things instead of endlessly trying, configuring, and comparing editors.

I mean, you're going to be programming for the rest of your life, right? I put a bunch of time into customizing vim... god, I think it was 15 years ago? Whenever this comes up, people make it sound like you are somehow going to be doing that every single day for the rest of your life or something... and then, awkwardly, I tend to see them screwing around constantly with some new IDE-of-the-week that crashes constantl…

There's churn in the Vim world too. Plugins and plugin managers change. For example, with Neovim, Packer and Mason are apparently what's good to use now, and Mason literally came out 3 months ago. I guess if you don't use many plugins (and aren't trying to make Vim a full fledged IDE) then it's fine, but if you are, there's a lot of churn to go through.

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

#70
post #37

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 Editing text efficiently is not the same as being a productive developer. The bottleneck is rarely how fast you can type or edit the code; it's how fast you can reason about the code. When you watch a prerecorded video most of the time all the thinking has already happened, a…

Editing text efficiently is not the same as being a productive dev

That's like saying suturing dexterity does not a good surgeon make. Anything that reduces cognitive friction, including the ease with which keystrokes go from your brain to the screen, makes you a better dev.

I'd say vim wins the fewest-keystrokes battle. But emacs wins the war because it leads you to lisp, and lisp makes you a better programmer.

Post reply on HN