Skip to content

Instantly share code, notes, and snippets.

@mislav mislav/bashrc

Last active Nov 23, 2016
What would you like to do?
Basic vimrc and tmux config for servers

My minimal setup for a new server: tmux, Vim and RubyGems config.

curl -fsSL "" | bash -e
PS1='\[\033[31m\]\w\[\033[0m\] $ '
export EDITOR=vim
alias st='git status -sb'
gem: --no-ri --no-rdoc
curl -fsSL \
"" -o ~/.gemrc \
"" -o ~/.vimrc \
"" -o ~/.ssh/rc \
"" -o ~/.tmux.conf
curl -fsSL "" >> ~/.bashrc
chmod +x ~/.ssh/rc
if [ -S "$SSH_AUTH_SOCK" ]; then
# This gets executed by sshd on every client login, symlinking the forwarded
# agent socket into a predictable location to be picked up by tmux.
ln -sf "$SSH_AUTH_SOCK" "/tmp/ssh-auth-${USER}.sock"
## Optional: Ctrl-a as prefix instead of Ctrl-b
## I'm keeping C-b because my desktop tmux is set to C-a already
# set -g prefix C-a
# unbind C-b
# bind C-a send-prefix
# Faster escape sequences (default is 500ms).
# This helps when exiting insert mode in Vim:
set -s escape-time 50
# start numbering windows from 1 instead of zero
set -g base-index 1
# syntax highlighting in Vim
set -g default-terminal "screen-256color"
# status bar contents
set -g status-left-length 15
# remove SSH_AUTH_SOCK from the default list of variables to be auto-updated
# set it to the symlink set by ~/.ssh/rc
setenv -g SSH_AUTH_SOCK /tmp/ssh-auth-$USER.sock
set nocompatible " choose no compatibility with legacy vi
syntax enable
set encoding=utf-8
filetype plugin indent on " load file type plugins + indentation
"" Tweaks
set hidden " allow backgrounding buffers without writing them
set nonumber " line numbers aren't needed
set scrolloff=3 " have some context around the current line always on screen
set history=200 " remember more Ex commands
set synmaxcol=800 " don't try to highlight long lines
" Time out on key codes but not mappings. Makes terminal Vim work sanely
set notimeout
set ttimeout
set ttimeoutlen=100
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
set backspace=indent,eol,start " backspace through everything in insert mode
"" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
set gdefault " replace all matches per line (instead of just first)
"" Have Vim able to edit crontab files again
set backupskip=/tmp/*,/private/tmp/*"
"" Status line
set showcmd " display incomplete commands
if has("statusline") && !&cp
set laststatus=2 " always show the status bar
set statusline=%f\ %m\ %r " filename, modified, readonly
set statusline+=\ %l/%L[%p%%] " current line/total lines
set statusline+=\ %v[0x%B] " current column [hex char]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.