Skip to content

Instantly share code, notes, and snippets.

@mrmrs
Created July 14, 2013 19:16
Show Gist options
  • Save mrmrs/5995435 to your computer and use it in GitHub Desktop.
Save mrmrs/5995435 to your computer and use it in GitHub Desktop.
set nocompatible
set title
set number
set history=1000 " Default is 20, I'd rather set this to ∞
set nofoldenable " Don't fold shit
set laststatus=2
set encoding=utf-8
execute pathogen#infect()
syntax on
filetype plugin indent on
" Enter newlines without entering insert mode
" http://vim.wikia.com/wiki/Insert_newline_without_entering_insert_mode
nmap <S-Enter> O<Esc>j
nmap <CR> o<Esc>k
if exists('$TMUX')
function! TmuxOrSplitSwitch(wincmd, tmuxdir)
let previous_winnr = winnr()
execute "wincmd " . a:wincmd
if previous_winnr == winnr()
" The sleep and & gives time to get back to vim so tmux's focus tracking
" can kick in and send us our ^[[O
execute "silent !sh -c 'sleep 0.01; tmux select-pane -" . a:tmuxdir . "' &"
redraw!
endif
endfunction
let previous_title = substitute(system("tmux display-message -p '#{pane_title}'"), '\n', '', '')
let &t_ti = "\<Esc>]2;vim\<Esc>\\" . &t_ti
let &t_te = "\<Esc>]2;". previous_title . "\<Esc>\\" . &t_te
nnoremap <silent> <C-h> :call TmuxOrSplitSwitch('h', 'L')<cr>
nnoremap <silent> <C-j> :call TmuxOrSplitSwitch('j', 'D')<cr>
nnoremap <silent> <C-k> :call TmuxOrSplitSwitch('k', 'U')<cr>
nnoremap <silent> <C-l> :call TmuxOrSplitSwitch('l', 'R')<cr>
else
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
endif
" Tab Navigation
nnoremap th :tabfirst<CR>
nnoremap tj :tabnext<CR>
nnoremap tk :tabprev<CR>
nnoremap tl :tablast<CR>
nnoremap tn :tabnew<CR>
nnoremap gb :Gbrowse<CR>
map fj :execute "vimgrep /" . expand("<cword>") . "/j **" <Bar> cnext<CR>
map cn :cn<CR>
" Custom Plugin Mappings
nnoremap ff :CtrlP<CR>
nnoremap -- :GundoToggle<CR>
let g:Powerline_symbols = 'fancy'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment