6 ms·
I'm guessing you want :%s/^pick/s/ to replace "pick" at the start of line with "s" on all lines? If you execute it once in vim you can recall it later with ju
by tuxlifan 5y ago
I'm guessing you want
:%s/^pick/s/
to replace "pick" at the start of line with "s" on all lines?
If you execute it once in vim you can recall it later with just typing
:%↑
and confirm with Enter.
As for the top of the file:
gg
I use the mnemonic "go go line" (as in Inspector Gadget's "go go gadget") and since you can prefix it with a line number (e.g. 4gg to go to line number 4), leaving it out gets me as close to line number nothing^Wzero as possible, i.e. line 1.
HTH :)
PS:
the % says "on all lines"
your trailing "/g" would make it match&replace "pick" multiple times on the (current, since % is missing) line
PPS:
As an aside, I use "vim somefile +N" all the time to open somefile at line number N;
especially when there's an error message in the form "error at somefile:N" by
typing vim, then double-click-middle-click copy&pasting "somefile:N", Ctrl-E to jump to the end and replacing ":" with " +".
I really should write a shell function for that...
EDIT: formatting
- ZeroGravitas 5y agoVim has some built in support for that syntax https://github.com/Konfekt/vim-compilers https://github.com/Konfekt/vim-compilers