Live data from Hacker News

How Did Vim Become So Popular?

pragmaticpineapple.com

231–240 of 507 posts

Re: How Did Vim Become So Popular?

#232

Earlier quoted context omitted.

100% concur with this. I learnt Vim many years ago and I genuinely don't know what I'd do without it. It's always just there when I ssh into a new server. And the JetBrains suite has an awesome vim mode meaning I can use most (but not all) vim shortcuts with an actual IDE. I don't think vim itself works well as an IDE substitute, and wouldn't use it for hardcore web dev for example - but for quickly editing random fi…

If one wants to do web dev on vim I strongly recommend neovim setup with coc.nvim. I know some people strongly disagree with transforming vim into and IDE, but this is a really productive setup for creating code (works like a charm for my current React project) Personally I’ll sometimes use VSCode to browse big files or explore the codebase, but when it comes to editing them neovim with coc, fzf and a language pack i…

Yep, neovim, coc and fzf has made me really productive in vim lately. After years of vim I was tempted to use VS Code until I found out about coc.

Re: How Did Vim Become So Popular?

#233

Earlier quoted context omitted.

Thanks for the feedback. vscode has regex find replace, but I don’t use it very often. It does show every match highlighted in the current file while entering the find value, which is nice. It does the same for multi files if needed and gives a nice preview of every change. Word navigation I use a great deal (especially with multi-cursor editing). Ctrl+left/right jumps words, home, end to begin end of line. Ctrl+f Z…

Ctrl+arrow is almost as bad as going to the mouse. The thing with vim is you rarely have to leave the home row. Some other random things I use constantly (I am not the person you're replying to): C — replace to the end of the line xp — swap two characters (which I have to use more frequently than I'm willing to admit.) ci( — replace everything in brackets (like the arguments of a function, this also works with " or '…

On a Mac at least, ctrl+n/p/b/f/a/e all navigate text without reaching for the arrows, with the added benefit they work in every application. I quit vim because I prefer using a smaller but universal set of navigation that works everywhere from Xcode to VS code to the terminal or typing in Chrome.

Re: How Did Vim Become So Popular?

#234

For me it is being able to efficiently navigate a file without leaving the home row (Gotta learn touch typing first). Once you understand the commands follow a composable grammar it is really like a superpower for dancing around text. „Go down 5 lines, move right two word, replace the contents of the brackets“. I don‘t use the actual editor all that often but have vim mode enabled in all my „real“ editors like VSCode…

> Go down 5 lines

Look at the beginning of a target line, remember the number (takes up a slot in our limited short-term memory), switch to command mode, type the command.

vs

Hold/mash "down" button until cursor is there.

After watching a few vim coding screen-casts I have the impression that the second way is more popular in vim too.

Re: How Did Vim Become So Popular?

#235

Does anyone have a good video comparing vim speed coding vs vscode using built in editor features? I’ve been using vscode for years and the YouTube videos that demo vim features are shallow (like how to enter a blank line - really?). I can do the same thing I have seen in vim videos without memorizing a bunch of strange key bindings all while being able to edit code instantly without changing modes. I would love to s…

There's no point in comparing them, in my opinion. VS Code is a tool for programming; I would call it an IDE but I 'm not very familiar with the app. Vim is still "just an editor". You can still use it for programming (not just coding bash scripts), but that's making your life harder than it needs to be. In my experience the amazing text editing features of vim are only very rarely useful in a software developer's work. I feel the same about multiline editing though. And Vim has amazing text editing features, but severely lacking code editing features.

Re: How Did Vim Become So Popular?

#236

Earlier quoted context omitted.

Hated Vi at first. Absolutely loathed it. I was all about emacs. But I gave vi another shot, and I'm so glad I did. The learning curve can be steep, and it's really unintuitive at first (or it was for me). But once it clicks a little bit, and you settle in.. Wow. I felt way more productive using it than any other editor.

(Helpful tip) map caps lock to escape: https://vim.fandom.com/wiki/Avoid_the_escape_key

Map caps to ctrl and you can get access to a world of convenient insert mode shortcuts.

ctrl-[ (for right hand) or ctr-3 (left hand, thanks teddyh) => escape

ctrl-i => tab

ctrl-h => backspace

ctrl-m => return

ctrl-w => delete prev word

ctrl-u => clear line

ctrl-o => cmd mode for 1 cmd

...and many, many more, including all the completion options.

Re: How Did Vim Become So Popular?

#237
post #202

Does anyone have a good video comparing vim speed coding vs vscode using built in editor features? I’ve been using vscode for years and the YouTube videos that demo vim features are shallow (like how to enter a blank line - really?). I can do the same thing I have seen in vim videos without memorizing a bunch of strange key bindings all while being able to edit code instantly without changing modes. I would love to s…

One vim hack I like is multi-line macro application. It's a good fallback in case, as I often forget the syntax for certain things. To facilitate this, I've remapped ctrl-space in visual line mode to apply my `q` macro to every selected line. As an example, say I need to add a comma to a bunch of lines. I will record the macro on that line appending a comma to the end, visually select all of the other lines to copy t…

FWIW, your particular example is doable with vanilla Vim with the same efficiency (with less strain)

    Vj (3)
    :'norm A, (8 - The angular brackets are automatically added by vim)
Vs

    qq (2)
    A, (3)
    q (1)
    Vj (3)
     (2)

Re: How Did Vim Become So Popular?

#238
post #184

i tried to switch to emacs+evil, but i can't bring myself to do it. partly because I'd have to invest a lot of time in getting an equivalently productive environment, but partly because of the following 1. vi is everywhere, and... 2. vi with no plugins is still super powerful, which is helpful on random hosts / coworker's machines / basically anywhere, and... 3. since vi is still so powerful out of the box, i only ne…

"using a less "powerful" (non-IDE) editor helps you write better code"

When you see what influential programmers use, its clear that a disproportionate number of them are on vim/emacs.

Re: How Did Vim Become So Popular?

#239

Does anyone have a good video comparing vim speed coding vs vscode using built in editor features? I’ve been using vscode for years and the YouTube videos that demo vim features are shallow (like how to enter a blank line - really?). I can do the same thing I have seen in vim videos without memorizing a bunch of strange key bindings all while being able to edit code instantly without changing modes. I would love to s…

Vim can jump to definitions and stuff too. It integrates with ctags. It can also do code completion and everything else. I have it bound to clang-format with ctrl-k.

Just feel the urge to mention cscope which is ctags on steroids

Re: How Did Vim Become So Popular?

#240
post #149

Earlier quoted context omitted.

I cannot remember the last time I wanted to use CapsLock--more than 30 years ago, anyway. By far the most irritating thing about others' keyboards is they have not disabled it yet. Second most is that Ctrl isn't there instead.

How do you TYPE_A_CONSTANT for the first time, or an ENUM_VALUE (perhaps somewhere you don't have autocomplete)? I keep a caps lock on my programmable keyboard for this (Fn+K). I also like SQL to be formatted with capital letters for keywords.

Either using shift keys or:

  type_a_constant ctrl-[ vawU
That sounds more than it is. Really I just touch type it without thinking consciously about it.

Probably don’t even need visual mode that’s just how I work.

Post reply on HN