3 ms·
I relate quite heavily to this when using vi to do all my git-related activities. git rebase -i ... followed by ↓dw ↓←dw ↓←dw ↓←dw ↓←dw ↓←dw i s ↓s ↓s ↓s ↓s
by ohmahjong 5y ago
I relate quite heavily to this when using vi to do all my git-related activities.
git rebase -i ...
followed by
↓dw ↓←dw ↓←dw ↓←dw ↓←dw ↓←dw i s ↓s ↓s ↓s ↓s ↓s
because I keep forgetting :s/pick/s/g is a thing
i, a, :q, :wq, dd, xdd, and D are all the ones I remember, but cutting/yanking pasting is still something I don't have the muscle memory for.
Shift+G takes me to the bottom of a file, but I don't know how to get back to the top :D
.
I really need to make time for vimtutor and commit to it.
- aulin 5y ago> Shift+G takes me to the bottom of a file, but I don't know how to get back to the top :D mostly emacs user here, but when I'm on vim I use :0 and :%
- tuxlifan 5y agoI'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
- Jare 5y ago> Shift+G takes me to the bottom of a file, but I don't know how to get back to the top :D I know the complement to Shift+G, it's gg. But I can never remember which one goes to the top and which to the bottom, so half the time I press both. :)
- pjungwir 5y agoG takes a line number as its "object" like other vim commands. So 1G is the first line, 10G the tenth, etc. G is the last. (0G goes to the last line too.)
- zwegner 5y agoFor a case like that, I'll use rectangular block mode--it's really fast and intuitive, so I'll usually pick that over :s/a/b/g if it's applicable. The whole thing would be something like <ctrl-v>5jecs<esc>. Ctrl-v starts rectangular block mode, go down 5 lines and to the end of the word, change selection to "s", return to normal mode.
- ohmahjong 5y agoThank you everyone for the _really_ helpful responses! It is immediately apparent to me that my interaction with vim has been heavily informed and limited by my preconceptions and previous text editing experiences. Time to start engaging with vim as its own entity, with its own conventions and idiosyncrasies. EDIT: Formatting