Well I see that finally I did my programmer life learning only switching insert mode / edit mode, maybe 5 commands like A x etc...,and :q or :wq!
Well I see that finally I did my programmer life learning only switching insert mode / edit mode, maybe 5 commands like A x etc...,and :q or :wq!
Eg from the first “pick” you could press * to highlight occurrences and move to the next one use cw to change it to “s” and bounce on n to move to the next one you to squash and use . to repeat the change.
That’s visual and lets you decide which commits to squash.
If I wanted to squash all the other commits I’d probably use visual block and } instead, but that’s just me.
I’d save a macro for more complex edits.
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.
mostly emacs user here, but when I'm on vim I use :0 and :%
:%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
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. :)
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.
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