set nocompatible if filereadable(glob("~/.vimrc.before")) source ~/.vimrc.before endif """ mappings let mapleader="\" noremap noremap noremap noremap nnoremap ' ` nnoremap ` ' " nnoremap \ , nnoremap Y y$ nnoremap / :noh " nnoremap gt :exec tabpagenr('$') == 1 ? 'bn' : 'tabnext' " nnoremap gT :exec tabpagenr('$') == 1 ? 'bp' : 'tabprevious' " nnoremap :exec tabpagenr('$') == 1 ? 'bn' : 'tabnext' " nnoremap :exec tabpagenr('$') == 1 ? 'bp' : 'tabprevious' cnoremap w!! w !sudo tee % > /dev/null " inoremap inoremap inoremap inoremap " inoremap jk command W w nnoremap nnoremap nnoremap nnoremap " don't unindent lines starting with # inoremap # X# " don't change the cursor position when joining lines " nnoremap J mzJ`z """ buffers set hidden " programming syntax enable set number set ttyfast set lazyredraw set modelines=1 " has to go after syntax enable let g:solarized_termcolors=256 set background=dark colorscheme solarized highlight Normal ctermbg=235 highlight rubyDefine ctermbg=235 set noshowmode " has to go after solarized highlight LongLine term=reverse cterm=reverse ctermfg=1 guifg=Black guibg=Yellow match LongLine /\%101v./ " searching set gdefault set hlsearch set ignorecase set smartcase " incsearch.vim augroup incsearch-keymap autocmd! autocmd VimEnter * call s:incsearch_keymap() augroup END function! s:incsearch_keymap() IncSearchNoreMap IncSearchNoreMap endfunction let g:incsearch#auto_nohlsearch = 1 let g:incsearch#consistent_n_direction = 1 let g:incsearch#magic = '\v' let g:incsearch#emacs_like_keymap = 1 map / (incsearch-forward) map ? (incsearch-backward) map g/ (incsearch-stay) map n (incsearch-nohl-n) map N (incsearch-nohl-N) map * (incsearch-nohl-*) map # (incsearch-nohl-#) map g* (incsearch-nohl-g*) map g# (incsearch-nohl-g#) " encoding set encoding=utf8 set fileencoding=utf8 set fileformat=unix " reading set linebreak set autoread " set ttyfast set list let &listchars = "tab:\u21e5 ,trail:\u2423,extends:\u21c9,precedes:\u21c7,nbsp:\u00b7" " autogroups augroup CursorLine au! au VimEnter,WinEnter,BufWinEnter * setlocal cursorline au WinLeave * setlocal nocursorline augroup END if v:version >= 700 augroup BufferScrolling au! au BufLeave * if !&diff | let b:winview = winsaveview() | endif au BufEnter * if exists('b:winview') && !&diff | call winrestview(b:winview) | unlet! b:winview | endif augroup END endif " folding " set foldmethod=indent " set foldlevel=3 " set nofoldenable " view set viewdir=$HOME/.vim_view// " " au BufWinLeave ?* mkview " au BufWritePost,BufLeave,WinLeave ?* mkview " for tabs " au BufWinEnter ?* silent loadview " jump to last cursor position when opening a file autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g'\"" | \ endif " diffing set diffopt=filler,context:5 " command mode set undolevels=1000 set wildmode=list:longest " backup set nobackup " set backupdir=$HOME/.vim_backup// set directory=$HOME/.vim_tmp// " shell " set title " set titleold= " customize syntax highlighting " highlight MatchParen ctermbg= " highlight MatchParen cterm=bold ctermbg=none ctermfg=none " highlight Folded ctermfg=1 ctermbg=NONE " highlight FoldColumn ctermfg=1 ctermbg=NONE highlight clear Search " highlight Search ctermfg=6 ctermbg=9 term=underline cterm=underline gui=underline set wildignore+=*.pyc,*/bower_components/*,*/python2.7/*,*/share/doc/*,*/target/* " blessed silence set visualbell " set t_vb " move into blank spaces in visual block mode set virtualedit=block " splits set splitbelow set splitright " http://stackoverflow.com/questions/2158516/delay-before-o-opens-a-new-line set noesckeys " scratch noremap s :Scratch let g:scratchBackupFile='$HOME/.vim/.scratch' " CtrlP let g:ctrlp_map = 'p' let g:ctrlp_match_window='bottom,order:btt,min:1,max:20' let g:ctrlp_working_path_mode='ra' let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] " Powerline python from powerline.vim import setup as powerline_setup python powerline_setup() python del powerline_setup " vim-projectionist nnoremap a :A " rust.vim " let g:rustfmt_autosave = 1 " vim-markdown let g:markdown_fenced_languages = ['ruby'] " vim-go if !empty($GOPATH) packadd vim-go endif " Expand %% into the directory of the current file cnoremap %% getcmdtype() == ':' ? expand('%:h').'/' : '%%' " ripgrep if executable('rg') set grepprg=rg\ --no-heading\ --vimgrep set grepformat=%f:%l:%c:%m endif " vim-dispatch nnoremap d :Dispatch " vim-startify let g:startify_custom_header = [] if has("gui_running") set background=light set guicursor+=a:blinkon0 " disable blinking set guifont=Source\ Code\ Pro\ for\ Powerline:h13 set guioptions-=T set macligatures set macmeta set mousehide end set undofile set undodir=$HOME/.vim_undo// if filereadable(glob("~/.vimrc.local")) source ~/.vimrc.local endif