Skip to content

Instantly share code, notes, and snippets.



Last active May 15, 2021
What would you like to do?
Useful vim and git tips


daw - delete a word (under cursor)
caw - delete a word (under cursor) and put in insert mode

Remove first 5 characters in each line:


Remove last two characters from each line:


Swap left and right panes with ^WX.

Reader mode:

vim -R

vimdff merge all changes from buffer 1 to buffer 2:

:%diffget 1
:%diffput 2


Undo last change:

git reset --soft HEAD^
git reset --hard HEAD^

Delete a tag:

git push --delete origin tagname
git tag --delete tagname

Rebase n commits:

git rebase -i -S HEAD~n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment