Live data from Hacker News

Vim for Humans

vimebook.com

211–220 of 251 posts

Re: Vim for Humans

#211
post #199

Earlier quoted context omitted.

But most modern editors have similarly efficient shortcuts for all those things that fit alongside modern UI shortcuts. e.g. in Sublime: to delete a word. to duplicate a line. [0] for search. to go to the top or bottom. I'm increasingly unconvinced that vim has much to offer in terms of shortcuts when compared to actual modern editors, rather than some kind of strawman notepad. [0] No numeric repetition, but I was ne…

The biggest thing with vim is it provides a language for actions rather than individual actions itself. This allows for far greater action control than a standard editor via shortcuts. For example, maybe you need to delete the next two words (d2w - delete 2 words). Or maybe you want to delete the next four words, then replace them with something else (c4w - change 4 words). Or maybe you need to change the every lette…

As I mentioned above, I'm not really convinced that numeric repetitions are that useful, because counting instances, even at a glance, is more mental overhead than just pressing a button a few times. Because most of the time I don't want to "delete n words", I want to delete these words, and there happen to be n of them.

More generally, my experience of vim is that I'd spend longer working out how to do something with one command than I'd have taken to just use a few simpler actions. And that didn't really get better with time (I used it as my primary editor for a few years), because sufficiently complicated editing tasks just don't arise that often.

And personally, I find Sublime's multiple selections much easier to apply in ad-hoc ways to unusual editing scenarios than vim's vocabulary.

A common scenario I encounter, is that I realise I need to make a change in many matching places, but I don't know immediately whether it applies to the entire file, or whether there are some edge cases. In Sublime, I select one instance, step through adding matching ones to the selection and excluding any I don't want, and then make the edit confident that I'm changing exactly the things I want to.

In vim, my experience was that I'd write a substitution, discover it was too general when it broke something, and then try to work out how to exclude the cases I didn't want, which was often nontrivial. EDIT: Thinking about it now, I guess the vim way to do the above would be to / for the first case, make the change in insert mode and then use /. for the others. Although if it's a complicated edit, it might not be effective to use insert mode, so I'd need a macro maybe? I found those kinda fiddly tbh.

Re: Vim for Humans

#213

Earlier quoted context omitted.

I encourage you to try NeoVim. I did. And I never looked back. After 6 months of Emacs, looks like I'll be back to NeoVim, and I am happy about it.

you might want to give spacemacs a go... it's quite good after you translate whatever vim config to emacs config. out of the box it's actually quite great and this is coming from a hardcore vim user that can't stand using a text editor without vi bindings and proper macro support etc. Everything is done pretty well and there isn't anything that I have found dealbreakingly lacking so far. https://www.youtube.com/watch…

I know about spacemacs, and don't like the idea of core editor. Tried it and ended up using not emacs, not vim, but mix of both, and commands from both. And I do not like that.

Re: Vim for Humans

#214
post #33

Earlier quoted context omitted.

In emacs, at least, every command has a name. Anything you'd like to do can be searched using tab completion and a little guesswork, at first, by typing `alt-x` followed by the first couple letters of a plausible name for the thing you are trying to do. It's an extremely clumsy but totally workable way to get around if you only rarely need to edit a text file on a remote server. For example, if you highlight a sectio…

After a few months using Spacemacs, I moved to neovim, but took the idea of the space leader and "meaningful" mappings with me. I remapped the leader key to space, and created a bunch of sensible mappings: all my Markdown mappings are under m and so on. I left most of the normal mode movements at their defaults, though. It would be cool if someone could do a Spacevim vimrc or plugin.

I''m curious, why did you move away from Spacemacs?

Re: Vim for Humans

#215
post #200

Earlier quoted context omitted.

I use Ctrl+[ instead of Esc, since I find that far faster and requiring less hand movement. I notice from observing other people type that there is an aversion to moving hand position, whereas the idea of moving hand position is not unfathomable to me, perhaps as I have played piano and violin. I'm not averse to moving hand position, and I don't use the strict one-finger-per-key rules either, but I do try to minimise…

Nice trick: remap Capslock to Esc.

My keyboard has one minuscule control key so I prefer to map control to caps lock, but I map 'jj' to escape in insert mode, which makes it super quick to switch modes.

Re: Vim for Humans

#216

Earlier quoted context omitted.

you might want to give spacemacs a go... it's quite good after you translate whatever vim config to emacs config. out of the box it's actually quite great and this is coming from a hardcore vim user that can't stand using a text editor without vi bindings and proper macro support etc. Everything is done pretty well and there isn't anything that I have found dealbreakingly lacking so far. https://www.youtube.com/watch…

I know about spacemacs, and don't like the idea of core editor. Tried it and ended up using not emacs, not vim, but mix of both, and commands from both. And I do not like that.

I had the same experience. I love the idea of the space leader and the mnemonic keymappings, but too much of Emacs leaked through.

I've taken the lessons learned from Spacemacs and applied them to vim, remapping the leader to space and using mnemonics for remapping of some commands — all the markdown based commands are under space m, for example.

Re: Vim for Humans

#217
post #33

Earlier quoted context omitted.

After a few months using Spacemacs, I moved to neovim, but took the idea of the space leader and "meaningful" mappings with me. I remapped the leader key to space, and created a bunch of sensible mappings: all my Markdown mappings are under m and so on. I left most of the normal mode movements at their defaults, though. It would be cool if someone could do a Spacevim vimrc or plugin.

I''m curious, why did you move away from Spacemacs?

It's heavier than Vim and a fair bit of Emacsy stuff leaks through. It's a great project, but I prefer Vims way of doing things. Also I have a bunch of custom Vim functions for doing stuff like invoice generation and I didn't want to reimplement them in Lisp.

Re: Vim for Humans

#218

Earlier quoted context omitted.

That may be, but it's tough to use a customized vim on your local machine, and then switch to a stock install on a server somewhere, no?

I agree. Personally, I prefer getting used to the defaults than going through the pain of customization. I tried it, but it meant additional syncing between my machines, fighting with plugins, and it's not always possible to customize vi mode in some environments (like Eclipse or Sublime). Overall, I think vim is great for simple and fast editing, but as soon as I need to work on a multiple files projects, I switch t…

You CAN customize Vim (I guess you mean Vintageous) on sublime.

Re: Vim for Humans

#219
post #199

Earlier quoted context omitted.

The biggest thing with vim is it provides a language for actions rather than individual actions itself. This allows for far greater action control than a standard editor via shortcuts. For example, maybe you need to delete the next two words (d2w - delete 2 words). Or maybe you want to delete the next four words, then replace them with something else (c4w - change 4 words). Or maybe you need to change the every lette…

As I mentioned above, I'm not really convinced that numeric repetitions are that useful, because counting instances, even at a glance, is more mental overhead than just pressing a button a few times. Because most of the time I don't want to "delete n words", I want to delete these words, and there happen to be n of them. More generally, my experience of vim is that I'd spend longer working out how to do something wit…

I have been using VIM since I had a floppy disc of it on my Amega I got from my dad. I will say I don't use VIM all the time and right now I am loving VS Code but in the end I always am using VIM modes in whatever editor I am in. RStudio or VS Code.

Re: Vim for Humans

#220
post #199

Earlier quoted context omitted.

The biggest thing with vim is it provides a language for actions rather than individual actions itself. This allows for far greater action control than a standard editor via shortcuts. For example, maybe you need to delete the next two words (d2w - delete 2 words). Or maybe you want to delete the next four words, then replace them with something else (c4w - change 4 words). Or maybe you need to change the every lette…

As I mentioned above, I'm not really convinced that numeric repetitions are that useful, because counting instances, even at a glance, is more mental overhead than just pressing a button a few times. Because most of the time I don't want to "delete n words", I want to delete these words, and there happen to be n of them. More generally, my experience of vim is that I'd spend longer working out how to do something wit…

It's not just repetition of say, do this command more times to words. There are more nouns available to apply your verbs to. You can "change a paragraph": `cap`, change the contents of some brackets: `ci(`. I find myself using various permutations of these all the time, and missing them enormously when I'm not in vim. My favourite is `caa` to change an argument in a function call, respecting commas and parens, although that one came in a plugin I think.

I completely agree that often figuring out how many words I want to apply a command to is too much effort; however of course vim has visual selection like any other editor, so I can just press v to begin selecting, then w a few times to move to the beginning of the next word, and then I can apply any of the verbs in my arsenal to the resulting selection.

I find that having the option of repetition is much more useful with large text objects that I can easily subitize. It's very natural for me to delete 3 paragraphs with `d3}` for instance, moreso than selecting them then deleting them.

I think that my very favorite motion in vim might be the `f` key. You use it like `fj` to move to the next occurrence of 'j' on the current line.

I also agree with you that multiple cursors are a much better solution than regexes to the same edit in a few different nearby places. There are multiple selection plugins for vim, but they don't work very well, and I wish it had better support. On the other hand, regexes scale much much better.

Post reply on HN