Hacker News new | ask | show | jobs
by adhesive_wombat 1599 days ago
Interactive git rebase are a good way to casually flex with Vim to a point and clicker, even if you hardly know anything.

"cws" to change "pick" to "s" ("cwf" for fix up), then "j." to repeat for the next line.

Also one of my favourite aliases is "rn" for interactively rebase the last n commits. Something like "!git rebase -i HEAD~$1" (from memory).

3 comments

Thanks to tpope, vim comes with some out of the box editing support for rebase¹. So, you don't even need to use change word. :F[ixup] to change to fixup, which supports ranges too(super useful with <count>V or V<movement>).

The standard vim {in,de}crement commands are bound to :Cycle in rebase buffers as well, so you can use <C-{a/x}> from anywhere in the line to twiddle the command for the current commit.

¹ :e $VIMRUNTIME/ftplugin/gitrebase.vim

Oh wow, thanks for sharing that alias. That could be super useful, I will definitely try that out.
You can also use visual block mode to highlight a range of commands and change in one go. Eg

  C-Ve}c
So that’s set visual highlight block.

Move to the end of the word.

Move down to the end of the paragraph.

Change the highlighted text in one.

Once you think like that it trips off the fingers from muscle memory.