" vimrc shortcut
map vrc :e ~/.vimrc
" core
let mapleader=","
set t_Co=256 " use 256 colors in terminator
" pathogen
silent! call pathogen#runtime_append_all_bundles()
syntax on
filetype plugin indent on " required!
" color scheme
colorscheme molokai
let g:molokai_original = 1
let g:rehash256 = 1
" config
set history=1000 " Increase history from 20 default to 1000
set hidden " When a buffer is brought to foreground, remember undo history and marks.
set nonu " Disable line numbers.
set noerrorbells " Disable error bells.
set foldmethod=syntax " Markers are used to specify folds.
set foldenable
set foldlevel=2
set esckeys " Allow cursor keys in insert mode.
set nohlsearch " Enable search result highlighting.
set incsearch " Highlight dynamically as pattern is typed.
set noinsertmode " Don't start vim in insert mode.
set magic " Enable extended regexes.
set report=0 " Show all changes.
set ruler " Show the cursor position.
set shortmess=I " Don't show the intro message when starting vim.
set showmode " Show the current mode.
set nostartofline " Don't jump to the start of the line when moving around.
set title " Show the filename in the window titlebar.
set wildchar=<TAB> " Character for CLI expansion (TAB-completion).
set wildmenu " Hitting TAB in command mode will show possible completions above command line.
set wildmode=list:longest " Complete only until point of ambiguity.
set expandtab " Expand tabs to spaces.
set tabstop=2 " Hitting the tab key results in 4 spaces.
set shiftwidth=2 " The # of spaces for indenting.
set smarttab " At start of line, <Tab> inserts shiftwidth spaces, <Bs> deletes shiftwidth spaces.
set backspace=start,indent,eol
set ignorecase " In searches, ignore case of lower case letters.
set smartcase " Override ignorecase if search contains upper case letters.
set scrolloff=3 " Start scrolling three lines before horizontal border of window.
set shortmess=atI " Shorten command line text and other info tokens.
set splitbelow splitright
set cul
set ls=2
set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P
set autowrite
set grepprg=ag
set diffopt=filler,vertical
set paste
set noswapfile
set clipboard+=unnamedplus
set mouse +=a
set diffopt=filler " Add vertical spaces to keep right and left aligned
set diffopt+=iwhite " Ignore whitespace changes (focus on code changes)
set noshowmode " Don't show the current mode (airline.vim takes care of us)
set cindent
set smartindent
set autoindent " Copy indent from last line when starting new line.
" sudo write
noremap <leader>2 :w !sudo tee %<CR>
" copypasta
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <ESC>"+pa
imap <C-v> <Esc><C-v>a
" because im shitfy
command WQ wq
command Wq wq
command W w
command Q q
" using buffers instead of tabs
nnoremap <Leader>p :buffers<CR>:buffer<Space>
nnoremap <Leader>n :bn<CR>
nnoremap <Leader>b :bp<CR>
" vim.notes
let g:notes_directories = ['/home/dmix/notes']
let g:notes_suffix = '.txt'
" ctrlp
let g:ctrlp_map = '<C-p>'
let g:ctrlp_cmd = 'CtrlPMixed' " search anything (in files, buffers and MRU files at the same time.)
let g:ctrlp_working_path_mode = 'ra' " search for nearest ancestor like .git, .hg, and the directory of the current file
let g:ctrlp_match_window_bottom = 0 " show the match window at the top of the screen
let g:ctrlp_max_height = 10 " maxiumum height of match window
let g:ctrlp_switch_buffer = 'et' " jump to a file if it's open already
"let g:ctrlp_use_caching = 1 " enable caching
let g:ctrlp_clear_cache_on_exit=0 " speed up by not removing clearing cache evertime
let g:ctrlp_show_hidden = 1 " show me dotfiles
" silver search > grep/ack
let g:ackprg = 'ag --nogroup --nocolor --column' " use silver_searcher instead of ack
" neocomplete
let g:neocomplcache_enable_at_startup = 1
" remove trailing whitespace
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd FileType c,cpp,java,php,ruby,python autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
" DISABLED FOR NOW
" Automatically cd into the directory that the file is in
"autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' ')