My Pop! OS setup

I’m keeping a log of my System76 / Pop! OS setup as a reminder to myself as well as to provide others with helpful settings and snippets

Command line tools

Working on the command line is my most fun and efficient way of interacting with the computer. Coming from macOS, I was used to the package manager brew to install and update command line tools. Since apt-get doesn’t provide recent versions of many CLI tools, I’m continuing to use brew on Linux as well.

Tools available in brew

Firstly, installing brew itself:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> ~/.profile
source ~/.profile

And then installing cli tools available via brew:

# fzf - general-purpose command-line fuzzy finder
brew install fzf
/home/linuxbrew/.linuxbrew/opt/fzf/install --key-bindings --completion --update-rc # installs useful keybindings and fuzzy completion
source ~/.bashrc   # source settings made by previous install command

brew install docker-compose
brew install doctl              # DigitalOcean CLI
brew install helm               # K8s package manager
brew install imagemagick        # Image processing
brew install jq                 # JSON processing
brew install kubectl            # Kubernetes CLI
brew install neovim             # My favorite text editor
brew install postgres
brew install ripgrep            # Better grep

Other tools, not available in brew

sudo apt install docker.io                            # docker is also available via brew but I had issues installing it
sudo apt install gnome-shell-extension-autohidetopbar # hides system's top bar
sudo apt install tlp tlp-rdw --no-install-recommends  # incrases battery life: https://support.system76.com/articles/battery/

~/.profile exports

export FZF_DEFAULT_COMMAND='rg --files --follow --hidden -g "!{node_modules/,.git/}"'
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

~/.bashrc aliases

alias decode_ssl='openssl x509 -text -noout -in'

Neovim setup

Many programmers prefer neovim over the original vim and here’s my personal neovim setup:

Installation

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Configuration

Editor settings and plugins go to ~/.config/nvim/init.vim. Run nvim -c "PlugInstall" -c "qa" to install the plugins from your command line, having nvim quit right after.

set backspace=indent,eol,start
set clipboard=unnamedplus
set colorcolumn=91
set nocompatible
set number relativenumber
set ruler
set runtimepath+=~/.vim
set runtimepath+=/home/linuxbrew/.linuxbrew/opt/fzf
set shell=/bin/bash
set whichwrap+=<,>,[,]

let g:ctrlp_max_files=0
let g:ctrlp_max_depth=100
let g:ctrlp_working_path_mode = 'ra'
let g:mapleader = "\<Space>"
let NERDTreeShowHidden=1

call plug#begin()
Plug 'tpope/vim-sensible'
Plug 'editorconfig/editorconfig-vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'Vimjas/vim-python-pep8-indent'
Plug 'yuezk/vim-js'
call plug#end()

filetype plugin indent on

nnoremap <silent> <leader><space> :Files<CR>
" Don't overwrite register with selected text when pasting
" See also: https://stackoverflow.com/questions/290465/#comment71467536_5093286
xnoremap <expr> p 'pgv"'.v:register.'y`>'

" Auto-reload buffer on file change
" https://unix.stackexchange.com/a/383044/79184
autocmd FocusGained,BufEnter,CursorHold,CursorHoldI * if mode() !~ '\v(c|r.?|!|t)' && getcmdwintype() == '' | checktime | endif
autocmd FileChangedShellPost * echohl WarningMsg | echo "File changed on disk. Buffer reloaded." | echohl None

Git configuration

Here’s my .gitconfig. Noteably, it doesn’t provide an alias for git checkout as I prefer its newer “replacements” git restore and git switch.

[alias]
a = add
aa = add .
b = branch
c = commit -m
ca = commit --amend
can = commit --amend --no-edit
d = diff
ds = diff --staged
f = fetch
find = "!git log --color -p -S "
g = log --pretty=oneline --abbrev-commit --graph
gg = log --graph
l = log --pretty=oneline --abbrev-commit
ll = log
p = push
pf = push --force
pl = pull
r = restore
rb = rebase
rba = rebase --abort
rbc = rebase --continue
s = status --short
sh = show
shno = show --name-only
sw = switch
swc = switch -c

[pull]
rebase = false

Some aliases I need so frequently that I make them available as single or two letter shell aliases via .bashrc:

alias a='git a'
alias b='git b'
alias c='git c'
alias d='git d'
alias g='git'
alias p='git p'
alias ll='ls -al'
alias s='git s'
alias sw='git sw'

Peripheral settings

Keyboard

As an avid user of Vim, the escape key is essential to escape edit mode. As the caps lock key is useless to me but easier to reach than the escape key this shell command permantly maps it to the escape key:

gsettings set org.gnome.desktop.input-sources xkb-options "['caps:escape']"

Bluetooth

Since I don’t need Bluetooth, auto-enabling it can be turned off via:

sudo sed -i 's/AutoEnable=true/AutoEnable=false/' /etc/bluetooth/main.conf
comments powered by Disqus