Skip to content

Instantly share code, notes, and snippets.

@mindscratch
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mindscratch/39596549d7336eaaf620 to your computer and use it in GitHub Desktop.
Save mindscratch/39596549d7336eaaf620 to your computer and use it in GitHub Desktop.
linux config
alias ll='ls -alh'
alias gcm='git commit -m'
alias gp='git push origin $(git_full_branch_name)'
alias ga='git diff --check && git add'
if [ -f ~/.git-completion.sh ]; then
. ~/.git-completion.sh
fi
if [ -f ~/.bashrc.sh ]; then
. ~/.bashrc.sh
fi
PATH=$PATH:$GIT_HOME/bin-wrappers
EDITOR=vim
VISUAL=$EDITOR
export PATH EDITOR VISUAL
unset USERNAME
if [ -f $HOME/.local_profile ]; then
. $HOME/.local_profile
fi
export TERM=xterm-256color
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
if [ -f $HOME/.aliases ]; then
. $HOME/.aliases
fi
# need for "flow control" (not sure what that means) but this
# let's me map Ctrl+s in vim to escape and save a file
stty -ixon -ixoff
function git_branch_name {
echo $(git symbolic-ref HEAD 2>/dev/null | awk -F/ {'print $NF'})
}
function git_full_branch_name {
echo $(git symbolic-ref HEAD 2>/dev/null | awk -Frefs/heads {'print $NF'})
}
function extract_rpm() {
if [ ${#} -eq 0 ]; then
echo "usage: extract_rpm <rpm>"
return 1
fi
rpm2cpio $1 | cpio -idmv
}
if [ -f $HOME/.localrc ]; then
. $HOME/.localrc
fi
# use 256 term for pretty colors
set -g default-terminal "screen-256color"
# increase scroll back history
set -g history-limit 5000
# use vim key bindings
setw -g mode-keys vi
setw -g mode-mouse off
# decrease command delay (increases vim responsiveness)
set -sg escape-time 1
# increase repeat time for repeatable commands
set -g repeat-time 1000
# start window index at 1
set -g base-index 1
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
setw -g alternate-screen on # when you exit less and vim you no longer see the buffer
setw -g utf8 on
### key bindings
unbind C-b
set -g prefix C-j
# paste
unbind C-p
bind C-p paste-buffer
# window splitting
unbind %
bind | split-window -h
unbind '"'
bind - split-window -v
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# create 25% lower split
unbind t
bind t split-window -p 25
# quickly switch panes
unbind ^J
bind ^J select-pane -t :.+
# force reload config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# clear the current pane and history
bind -n C-k send-keys 'S-C-l' \; clear-history
######### status bar
set -g status-utf8 on
set -g status-interval 30
set -g status-justify centre
# status-left
set -g status-left-length 25
set -g status-left "#[default, fg=colour136][#h:#S]"
# status-right
set -g status-right " #[bold, fg=colour64] %H:%M:%S %a %e %b %Y"
set-window-option -g clock-mode-style 24
########### colors
set-option -g status-bg colour235
set-option -g status-fg colour136
set-option -g status-attr default
set-window-option -g window-status-fg colour244
set-window-option -g window-status-bg default
set-window-option -g window-status-current-fg colour166
set-window-option -g window-status-current-bg default
set-option -g pane-border-fg colour235
set-option -g pane-active-border-fg colour240
set-option -g message-bg colour235
set-option -g message-fg colour166
" i use vividchalk colorscheme
" i use pathogen
" i use airline_powerline_fonts and the following bundles
" command-t
" nerdtree
" vim-airline, vim-javascript, vim-markdown
" use vim not vi
set nocompatible
call pathogen#infect()
filetype on
syntax on
set splitbelow " split to the right and bottom
set splitright
set background=dark "prefer darker themes
set autoindex
set smartindent
set nowrap
set ruler " show cursor position
set showmatch " show matching }, ], ... etc
set tabstop=2 " number of visual spaces for a TAB
set softtabstop=2 " the number of spaces to use while editing when you press TAB
set shiftwidth=2
set expandtab " spaces instead of TABs
set nosmarttab
set incsearch "search as characters are entered
set hlsearch " highlight search
set titlestring =%f title " show the filename in the vim title
set noshowcmd " don't display incomplete commands
set nolazyredraw " turn off lazy redraw
set ttyfast " faster redrawing
set number " show number lines
set cursorline " highlight current line
set wildmenu " visual autocomplete for command menu
set visualbell " turn off the audible bell
set ignorecase
set history=1000 " keep a decent history
set statusline=%f
set statusline+=%*
set statusline+=\ %= " left align
set statusline+=%{fugitive#statusline()}
set statusline+=\ Buf:%n
set statusline+=\ %c, " cursor column
set statusline+=%l/%L " cursor line / total lines
set statusline+=\ %P
let mapleader=","
set laststatus=2 " always show status line
" enable syntax highlighting for gradle scripts
au BufNewFile,BufRead *.gradle set filetype=groovy
augroup myfiletypes
" clear old autocmds in group
autocmd!
" autoindent with two spaces, always expand tabs
autocmd FileType ruby,eruby,yaml set ai sw=2 sts=2 et
augroup END
if has("autocmd")
filetype indent on
endif
imap <S-Tab> <C-o><<
inoremap jj <ESC>
nnoremap <silent> <C-t> :CommandT<CR>
nnoremap <silent> <C-b> :CommandTBuffer<CR>
map <C-h> :nohl<cr>
" leave insert mode and save the current file
map <C-s> <Esc>:w<CR>
imap <C-s> <Esc>:w<CR>
" close buffer
map <C-q> <Esc>:q<CR>
imap <C-q> <Esc>:q<CR>
" wrap over lines when moving with h and l
set whichwrap=h,l,~,[,]
" backspace over anything
set backspace=indent,eol,start
nnoremap <F2> :set :invpaste paste?<CR> " disable auto-indent when pasting
set pastetoggle=<F2>
set showmode
let &titleold=getcwd() " restore the xterm title when exiting vim
colorscheme vividchalk
let g:airline_powerline_fonts = 1
autocmd FileType go autocmd BufWritePre <buffer> Fmt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment