New Shell, who dis?

My first steps when working on a new machine / environment

Bash

First and foremost, we want to add a few things in our .bashrc

Aliases

Additionally, here’s a group of clever aliases you can copy-pate.

1
2
3
4
5
6
7
alias \
	v=vim \
	sv="sudo vim" \
	g=git \
	gl="git log" \
	df="df -h" \
	du="du -h --max-depth=1"

I’m a big fan of colors, so let’s add those as well.

1
2
3
4
alias \
	grep="grep --color=auto" \
	diff="diff --color=auto" \
	ip="ip -color=auto"

Vim

After configuring the most important program, the shell, we configure the second, vim. Below are a list of useful configs and mappings.

Split Screen

Split screening in vim allows you to edit multiple files at once. You can open a horizontal split with CTRL-W s (That means hitting control and w at the same time, then s) or a vertical slip with CTRL-W v

Navigating between splits in vim involves hitting CTRL-W plus a movement key (h, j, k, or l), but we are going to simplify it with the following bindings

1
2
3
4
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l

This allows you to navigate between splits with CTRL-H, CTRL-J, CTRL-K, and CTRL-L, which move you left, down, up, and right respectively.

Folding

Folding allows you to collapse sections of code based off of syntax. This is something I recently discovered and I’m a big fan of it.

1
2
set foldmethod=syntax
set foldlevelstart=1

To use folding, you can always open up the help menu with :help fold-commands but below is a summary of key bindings in normal mode.

Previous:
Quick Tips
Next:
Secure Boot
Tutorials