Alias filetypes


Creating aliases with -s enables aliasing commands too files types. Thus, with the alias alias -s txt=less turns ./file.txt into less ./file.txt

Other examples:

alias -s md=glow
alias -s html=open
alias -s txt=less
alias -s json=jq

Recent branches with fzf


Not something I learned today, but i recently configured a alias for recent branches with fuzzy search with fzf. It will show the branches sorted by the date of the head commit when doing git recent. Selecting one with fzf will then do a git checkout of that branch.

Add the following under aliases in gitconfig:

recent = "!git branch --sort=-committerdate --format=\"%(committerdate:relative)%09%(refname:short)\" | fzf --ansi | awk 'BEGIN{FS=\"\t\"} {print $2}' | xargs git checkout"

zz in vim centers line on screen


Learned today that in normal mode in vim typing zz will center the active line in the middle of the screen.