How does gI differ from I?
but it should say _before_ the first non-blank, which is equivalent to _after_ the last leading blank.
71–80 of 179 posts
How does gI differ from I?
but it should say _before_ the first non-blank, which is equivalent to _after_ the last leading blank.
Practical vim by Drew Neil is hands down the best vim learning resource out there. Nothing even comes close.
I'll also note it covers both vim and neovim, with nice little asides explaining the differences where they matter.
The article mentions ”gn” in passing, but it doesn’t give it enough credit: this is an enormously useful motion, almost more useful on its own than the rest of the article. The thing that makes it golden is that it is a motion, and thus combined with a command, it is repeatable! So, like: 1. Search for something (either using / or *). 2. Type ”cgn” in Normal mode (i.e. change next search match) and replace what you s…
Why is this preferable to :%s?
Nice, but still wondering if I should know vim since nano is enough for me :)
The stuff in this article is pretty neat but (even after using vim for about 20 years) most of it doesn't click for me as easily. Eg I don't use marks; I wouldn't think ahead to leave a mark or remember afterward which letter I used for it. Kudos to people who can gain productivity by using this stuff, but I'd need something other than an explanation of what the commands do to be effective with it. I do at least try to use the quickfix stuff; that's a pretty big productivity boost over manually going to the right file and line to fix an error spotted by my compiler.
Vim is getting more popular. Not just within vim, but outside vim! Practically every full-featured editor has a vi or vim mode, and when they say vi, usually they also mean vim. Things that have nothing to do with vim but are inspired by vim are even sprouting up! And apparently it's OK to name something based on vim: https://groups.google.com/g/vim_use/c/EnSMrx_rGg4/m/d_nVlmLQ... Edit: In Bram's reply he mentioned t…
I use vim inside VS code as my main editor and love the experience. It was also an easy way to step into learning vim.
I also have a vim product with vim in the name (it’s practically the whole name) and haven’t had any sort of trademark issues.
Earlier quoted context omitted.
The non-barbarian way to avoid counting characters when there's no convenient motion is visual mode. Hit v, then hit l until you've highlighted the part you want to change, then hit c to start changing it.
Oh I never thought about that either. Thank you.
Vim is getting more popular. Not just within vim, but outside vim! Practically every full-featured editor has a vi or vim mode, and when they say vi, usually they also mean vim. Things that have nothing to do with vim but are inspired by vim are even sprouting up! And apparently it's OK to name something based on vim: https://groups.google.com/g/vim_use/c/EnSMrx_rGg4/m/d_nVlmLQ... Edit: In Bram's reply he mentioned t…
I definitely agree that it’s getting more popular. I use vim inside VS code as my main editor and love the experience. It was also an easy way to step into learning vim. I also have a vim product with vim in the name (it’s practically the whole name) and haven’t had any sort of trademark issues.
The article mentions ”gn” in passing, but it doesn’t give it enough credit: this is an enormously useful motion, almost more useful on its own than the rest of the article. The thing that makes it golden is that it is a motion, and thus combined with a command, it is repeatable! So, like: 1. Search for something (either using / or *). 2. Type ”cgn” in Normal mode (i.e. change next search match) and replace what you s…
nnoremap *``cgn
nnoremap #``cgN
Hit to change the current word and ... to repeat on the next occurrences.
Nice, but still wondering if I should know vim since nano is enough for me :)
Earlier quoted context omitted.
I'm not sure exactly what your plugin does, but are you aware of the "c" flag to substitute, eg :%s/debug/dbg/c vim will show the text which is about to be modified, and you have a prompt to confirm, skip, or quit (and some others).
Yes, I am aware, but it's not nearly as flexible and quick. It doesn't allow me to in the meantime move my cursor around, switch buffers, undo, open/close a fold, etc. It takes complete control of your workflow to temporarily put you in some special 'search/replace mode' in a very non-Vimlike manner. My plugin has a simple operation (if cursor is on a match, replace, regardless jump to next match) that gets repeated…
(This is very unlikely to interest you, but I mention it for the sake of others. I’ve commonly seen people not really know about ranges especially, never stopping and thinking about what the % means (see `:help :%` if you don’t know), beyond possibly having encountered ' by accident when pressing : in Visual mode (for explanation of these, see the help for :', ').)