Skip to content

Instantly share code, notes, and snippets.

@karldanninger
Created December 24, 2013 04:02
Show Gist options
  • Save karldanninger/8108649 to your computer and use it in GitHub Desktop.
Save karldanninger/8108649 to your computer and use it in GitHub Desktop.
execute pathogen#infect()
call pathogen#incubate()
syntax on
filetype plugin indent on
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
colorscheme railscasts
set fillchars+=vert:\
"set list lcs=trail:·
set number
set ruler
set nowrap
set visualbell
highlight LineNr guibg=#2c2c2c
highlight NonText guifg=#2c2c2c
hi vertsplit guifg=#2c2c2c guibg=#2c2c2c
set cursorline
"hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
set numberwidth=2
"set colorcolumn=80
map <Leader>n <plug>NERDTreeTabsToggle<CR>
" * * * * *
" If macvim, make pretty fonts!
if has('gui_running')
set guifont=Ubuntu_Mono:h14
set linespace=4
endif
" * * * * *
" Removes scroll bars left and right
set guioptions-=rL
" * * * * *
" Run ctrlp on launch
set runtimepath^=~/.vim/bundle/ctrlp.vim
" * * * * *
" Window movement keys, ctrl+hjkl
nmap <silent> <c-k> :wincmd k<CR>
nmap <silent> <c-j> :wincmd j<CR>
nmap <silent> <c-h> :wincmd h<CR>
nmap <silent> <c-l> :wincmd l<CR>
" * * * * *
" maps CtrlP's buffer manager to ctrl+b 'b for buffer'
map <C-B> :CtrlPBuffer<CR>
" * * * * *
" Add feature to swap windows: Mark Window (<leader>mw) and to swap with
" window (<leader>pw) 'p for put window'
function! MarkWindowSwap()
let g:markedWinNum = winnr()
endfunction
function! DoWindowSwap()
"Mark destination
let curNum = winnr()
let curBuf = bufnr( "%" )
exe g:markedWinNum . "wincmd w"
"Switch to source and shuffle dest->source
let markedBuf = bufnr( "%" )
"Hide and open so that we aren't prompted and keep history
exe 'hide buf' curBuf
"Switch to dest and shuffle source->dest
exe curNum . "wincmd w"
"Hide and open so that we aren't prompted and keep history
exe 'hide buf' markedBuf
endfunction
nmap <silent> <leader>mw :call MarkWindowSwap()<CR>
nmap <silent> <leader>pw :call DoWindowSwap()<CR>
" * * * * *
" Adds delete to :CtrlPBuffer ctrl+@
let g:ctrlp_buffer_func = { 'enter': 'MyCtrlPMappings' }
func! MyCtrlPMappings()
nnoremap <buffer> <silent> <c-@> :call <sid>DeleteBuffer()<cr>
endfunc
func! s:DeleteBuffer()
let line = getline('.')
let bufid = line =~ '\[\d\+\*No Name\]$' ? str2nr(matchstr(line, '\d\+'))
\ : fnamemodify(line[2:], ':p')
exec "bd" bufid
exec "norm \<F5>"
endfunc
highlight ExtraWhitespace ctermbg=red guifg=red guibg=#2c2c2c
match ExtraWhitespace /\s\+$/
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#222222 ctermbg=2
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#2c2c2c ctermbg=3
let g:indent_guides_enable_on_vim_startup = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment