Example Configurations

Here are some configuration files that are pretty simple but should be sane enough defaults. Personally I’m against downloading huge, unwieldy configs that you’ll never understand — better to start simple and add as necessary.

vim (or nvim)

" General
scriptencoding utf-8
set bs=indent,eol,start " Allow backspacing over everything in insert mode
set completeopt=menu,menuone

" Highlight the current line you're on:
set cursorline

" Put all swap files here so they don't clutter your file system:
set directory=${HOME}/.vim/swap//

set hlsearch

" Search case-insensitively
set ignorecase

" Not normally a fan of mouse support, but can't deny the ease of use:
set mouse=a

set nocompatible

" Disables incremental search. You may want this, but I think it's jumpy:
set noincsearch

set ruler
set smartcase
set wildmenu
set wildmode=longest,list,full
set wildignore+=*.so,*.class
let g:matchparen_insert_timeout=5
filetype plugin indent on


" To make this work, install vim-plug: https://github.com/junegunn/vim-plug
" Then after that just do a :PlugInstall to install these:
call plug#begin('~/.vim/plugged')
    Plug 'ctrlpvim/ctrlp.vim' " Fuzzy file menu by pressing Ctrl+P
    Plug 'nanotech/jellybeans.vim'
    Plug 'neoclide/coc.nvim', {'branch': 'release'}
    Plug 'vim-airline/vim-airline'
call plug#end()
" (you don't need to use these, though)


" Tab-related
set expandtab
set tabstop=4
set shiftwidth=4
set smarttab


" Try to stick with an 80-char max line length
set textwidth=80
set colorcolumn=81


" Show tabs and trailing spaces with special characters
if $LANG =~ '\(UTF\|utf\)-\?8' || $LC_CTYPE =~ '\(UTF\|utf\)-\?8'
    set list listchars=tab:»\ ,trail:·
endif


" Folding (collapsing functions, methods, whatever).
" 'zc' = close fold, 'zo' = open fold.
set foldmethod=syntax
" This disables auto-folding:
set foldlevelstart=99


" Syntax Highlighting
set background=dark
if &t_Co >= 17 || has("gui_running")
    colorscheme jellybeans
endif
syntax on


" Open new tabs instead of buffers with CtrlP
let g:ctrlp_prompt_mappings = {
    \ 'AcceptSelection("e")': ['<c-t>'],
    \ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
    \ }


" CtrlP: Speed things up by listing the files with git
let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files --exclude-standard -co']

tmux

# General Options ##############################################################
unbind C-b
set -g prefix C-a

# Start numbering windows at 1 rather than 0
set -g base-index 1

set  -g status-keys vi
setw -g mode-keys vi

set -g history-limit 10000

set -g default-terminal "screen-256color"

# I don't use escape for meta sequences
set -s escape-time 0

set -g bell-action any

set -g mouse on # Not a huge fan, but gives you easy pane resizing and choosing.

# Key Bindings #################################################################
bind      =         split-window -h
bind      -         split-window -v

bind      j         swap-pane -D
bind      k         swap-pane -U

bind      h         previous-window
bind      l         next-window

bind      a         next-window -a

bind -n   ^h        select-pane -L
bind -n   ^j        select-pane -D
bind -n   ^k        select-pane -U
bind -n   ^l        select-pane -R

bind -r   Left      resize-pane -L
bind -r   Down      resize-pane -D
bind -r   Up        resize-pane -U
bind -r   Right     resize-pane -R


# Colors #######################################################################
set -g pane-border-style fg=white,bg=default
set -g pane-active-border-style fg=blue,bg=default

set -g status-style bg=default
set -g window-status-style bg=brightwhite
set -g window-status-current-style fg=blue,bg=brightwhite

# Status Line ##################################################################
set -g status-left-length 20
set -g status-right-length 80

setw -g window-status-format "#[bg=colour7] #I #[default]#[bg=colour15,fg=colour8] #W "
setw -g window-status-current-format "#[fg=white,bg=blue] #I #[bg=colour15,fg=colour0] #W "

set -g status-left  "#[fg=white,bg=red] #S #[default] "
set -g status-right "#[bg=colour7] #[bg=colour15,fg=colour8] #T #[bg=colour7] "