TMux

Installation

Use Caps Lock key to send TMux prefix

Vim

execute pathogen#infect()

" last position
if has("autocmd")
    au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif

set re=0
" solarized color
syntax enable
set background=dark
let g:solarized_termcolors=256
colorscheme solarized

autocmd BufWritePre *.* :%s/\s\+$//e

"python
"let g:python3_host_prog="/usr/local/bin/python3"
"let g:autoformat_verbosemode=1
"au BufWrite *.py :Autoformat

"golang
autocmd FileType go noremap tl :GoDef<CR>
autocmd FileType go noremap th <C-o>
autocmd FileType go noremap tk :GoDoc<CR>
autocmd FileType go noremap <leader>b :GoBuild<CR>
autocmd FileType go noremap <leader>r :GoRun<CR>
autocmd FileType go noremap <C-k><C-k> <C-x><C-p>

let g:go_gopls_enabled = 1
let g:go_gopls_options = ['-remote=auto']
let g:go_def_mode='gopls'
let g:go_info_mode='gopls'
let g:go_referrers_mode = 'gopls'
"let g:go_def_mode='guru'
"let g:go_gocode_propose_source=0
let g:go_code_completion_enabled = 1

let g:go_metalinter_enabled = []

"let g:go_metalinter_command = 'golangci-lint'
"let g:go_metalinter_command = 'golint'
let g:go_metalinter_autosave = 1
"let g:go_metalinter_autosave_enabled = ['vet','revive','errcheck','staticcheck','unused','varcheck']
let g:go_metalinter_autosave_enabled = []
let g:go_rename_command = 'gopls'

filetype plugin indent on
set hlsearch
set nu
set cursorline
set paste
" show existing tab with 4 spaces width
set tabstop=4
" " when indenting with '>', use 4 spaces width
set shiftwidth=4
" " On pressing tab, insert 4 spaces
set expandtab

set viminfo='20,<1000

Fix Slow VIM Auto-Save

This is most likely caused by malfunctioning gopls server. Try delete gopls index and restart its server:

rm -rf ~/Library/Caches/gopls/*
killall gopls

Opening a new .go file should start gopls server automatically.

.ssh

It is ok to copy over .ssh folders with existing private and public keys

Fix for Golang Build Freeze on Small EC2 Host

when your RAM fills up (e.g., during go build), the kernel pages out less-used memory to this file on disk instead of freezing or killing processes. It’s slower than RAM but prevents the machine from locking up.

# 1. Create a 4GB file filled with zeros — this becomes the swap space
sudo fallocate -l 4G /swapfile

# 2. Restrict permissions — only root should read/write swap (security)
sudo chmod 600 /swapfile

# 3. Format the file as swap space (writes a swap header)
sudo mkswap /swapfile

# 4. Activate it immediately — kernel starts using it as overflow memory
sudo swapon /swapfile

# 5. Make it persist across reboots by adding to filesystem table
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab