Skip to content

Instantly share code, notes, and snippets.

@BastianHofmann
BastianHofmann / mad_vim_skills_4.md
Last active June 5, 2018 08:20
Mad VIM Skills #4

Write and Quit

You can use :x or ZZ to write and quit instead of :wq.

@BastianHofmann
BastianHofmann / mad_vim_skills_3.md
Last active June 5, 2018 08:20
Mad VIM Skills #3

Undo and Redo

Use u in command mode to undo the last action and ctrl+r to redo the action. You can also use [count]u and [count]ctrl+r to undo and redo multiple times. You can also use U to revert all the changes in the last modfied line.

@BastianHofmann
BastianHofmann / mad_vim_skills_2.md
Last active June 5, 2018 08:20
Mad VIM Skills #2

Page Scrolling

Use [count] ctrl+e to scroll the window downwards [count] lines. [count] ctrl+y to scroll upwards.

Really usefull is ctrl+d to scroll the half page down and ctrl+u to scroll half the page up. As a side note: "half the page" is only the default. You can use set scroll=[count] to define this behaviour.

@BastianHofmann
BastianHofmann / mad_vim_skills_1.md
Last active August 2, 2020 12:13
Mad VIM Skills #1

Easy Split Navigation

Use :sp to split the current window in two (:vs for vertical split).

Add the following mapping commands to your .vimrc for easier split navigation.

"easy split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap  
@bartoszmajsak
bartoszmajsak / prepare-commit-msg.sh
Last active July 30, 2025 19:22
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"