"" Basic Settings {{{{ "" set nocompatible " Use vim, no vi defaults set number " Show line numbers set numberwidth=5 set ruler " Show line and column number set encoding=utf-8 " Set default encoding to UTF-8 set modelines=0 " do not check file for set commands set scrolloff=3 " always show 3 lines above and below cursor set gdefault " use global substitution by default set showmatch " show matching bracket. set showcmd " show last command in last line of screen. set showmode " display mode in last line (e.g VISUAL) set hidden " hide buffers instead of closing them. set cursorline " highlight current line set ttyfast " fast terminal connection set visualbell " turn on visual bell set t_vb= " set visual bell to do nothing set noerrorbells " turn off error bell set exrc " enable per-directory .vimrc files set secure " disable unsafe commands in local .vimrc files set nobackup " do not make backup files set nowritebackup " do not write a backup set splitright " open new splits to the right set splitbelow " open new splits below set autoread " auto load changed files set title " the title of the window will be set to the value of titlestring set clipboard^=unnamed,unnamedplus " use OS clipboard set noswapfile set autowrite set tags=./.git/tags,./tmp/tags,./tags,tags,._tags set nowrap " don't wrap lines set tabstop=2 " a tab is two spaces set softtabstop=2 " number of spaces that a counts for while performing editing set shiftwidth=2 " an autoindent (with <<) is two spaces set shiftround " When shifting lines, round the indentation to the " nearest multiple of 'shiftwidth.' set expandtab " use spaces, not tabs set list " Show invisible characters set backspace=indent,eol,start " backspace through everything in insert mode set autoindent " copy indent from current line when starting a new one set listchars="" " Reset the listchars set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "." set listchars+=trail:. " show trailing spaces as copyright set listchars+=extends:> " The character to show in the last column when wrap is " off and the line continues beyond the right of the screen set listchars+=precedes:< " The character to show in the last column when wrap is " off and the line continues beyond the left of the screen "set colorcolumn=80,100 " show color columns at 80 and 100 set nojoinspaces " Use one space, not two, after punctuation. set hlsearch " highlight matches set incsearch " incremental searching set ignorecase " searches are case insensitive... set smartcase " ... unless they contain at least one capital letter set showmatch " briefly jump to the matching bracket. runtime macros/matchit.vim color happy_hacking syntax enable " Turn on syntax highlighting allowing local overrides set t_Co=256 " }}}} "" Wild settings {{{{ "" set wildmenu set wildmode=longest,list:longest " Disable output and VCS files set wildignore+=*.o,*.out,*.obj,.git,*.rbc,*.rbo,*.class,.svn,*.gem " Disable archive files set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.zst " Ignore bundler and sass cache set wildignore+=*/vendor/gems/*,*/vendor/cache/*,*/.bundle/*,*/.sass-cache/* " Ignore rails temporary asset caches set wildignore+=*/tmp/cache/assets/*/sprockets/*,*/tmp/cache/assets/*/sass/* " Disable temp and backup files set wildignore+=*.swp,*~,._* " Ignore tmp folder, so files and coverage directory. set wildignore+=*/tmp/*,*.so,*/coverage/* " }}}} "" Backup and swap files {{{{ "" " where to put backup files. set backupdir=/tmp// " where to put swap files. set directory=/tmp// " }}}} "" File type-specific settings {{{{ "" filetype plugin indent on " Turn on filetype plugins (:help filetype-plugin) if has("autocmd") au BufNewFile,BufRead *.hql set ft=hive expandtab au BufNewFile,BufRead *.html set nowrap au BufNewFile,BufRead *.json set ft=javascript au BufNewFile,BufRead *.q set ft=hive expandtab au BufRead,BufNewFile *.eco set ft=html au BufRead,BufNewFile *.es6 set ft=javascript au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn,txt} set ft=markdown au BufRead,BufNewFile {*.handlebars,*.hbs} set ft=handlebars syntax=handlebars au BufRead,BufNewFile {Gemfile,Rakefile,RakeFile,Vagrantfile,Thorfile,Procfile,Guardfile,config.ru,*.rake} set ft=ruby au FocusLost * :w endif augroup filetype_vim autocmd! autocmd FileType vim setlocal foldmethod=marker augroup END " }}}} " "" Command-Line Mappings {{{{ "" " After whitespace, insert the current directory into a command-line path cnoremap getcmdline()[getcmdpos()-2] ==# ' ' ? expand('%:p:h') : "\" " Kills Trailing Whitespaces command! KillWhitespace :normal :%s/ *$//g " }}} "" General Mappings (Normal, Visual, Operator-pending) {{{{ "" let mapleader = "," let localleader = "\\" " format the entire file nnoremap fef :normal! gg=G`` " upper/lower word nnoremap u mQviwU`Q nnoremap l mQviwu`Q " upper/lower first char of word nnoremap U mQgewvU`Q nnoremap L mQgewvu`Q " cd to the directory containing the file in the buffer nnoremap cd :lcd %:h " Create the directory containing the file in the buffer nnoremap md :!mkdir -p %:p:h " Swap two words nnoremap gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/`' " Underline the current line with '=' nnoremap ul :t.Vr= " set text wrapping toggles nnoremap tw :set invwrap:set wrap? " find merge conflict markers nnoremap fc /\v^[<=>]{7}( .*\|$) " Map the arrow keys to be based on display lines, not physical lines noremap gj noremap gk " Toggle hlsearch with hs nnoremap hs :set hlsearch! hlsearch? " Adjust viewports to the same size noremap = = nnoremap ev :vsplit $MYVIMRC nnoremap sv :source $MYVIMRC nnoremap :noh nnoremap % vnoremap % nnoremap ; : nnoremap W :%s/\s\+$//:let @/='' nnoremap v vl nnoremap h sl nnoremap h nnoremap j_ nnoremap k_ nnoremap l nnoremap p "+p nnoremap n :NERDTreeFind nnoremap n :NERDTreeClose " open fold nnoremap za " create fold vnoremap zf " surround with " nnoremap " viwa"hbi"lel nnoremap ' viwa'hbi'lel nnoremap H ^ nnoremap L $ inoremap jk " NERDComToggleComment nmap / c vmap / c nnoremap gs :Gstatus nnoremap gb :Gblame -w -M nnoremap / /\v vnoremap / /\v nnoremap F :Ag nnoremap f :Ack nnoremap :GFiles nnoremap :Files nnoremap :Buffers nmap (fzf-maps-n) xmap (fzf-maps-x) omap (fzf-maps-o) imap (fzf-complete-word) imap (fzf-complete-line) " }}}} "" Status Line {{{{ "" if has("statusline") && !&cp set laststatus=2 " always show the status bar set statusline=%f " path to the file set statusline+=\ -\ " separator set statusline+=%y " current file type set statusline+=%= " switch to right side set statusline+=[buffer:%02n] " current buffer set statusline+=[column:%02v] " current column set statusline+=[line:%04l " current line set statusline+=/ " separator set statusline+=%04L] " total lines endif " }}}} "" Abbreviations {{{{ "" iabbrev adn and iabbrev ohter other iabbrev waht what iabbrev teh the iabbrev tehn then iabbrev @@ mo@mokhan.ca " }}}} "" Plugin Configuration {{{{ "" let dart_format_on_save = 1 let dart_style_guide = 2 let g:vroom_map_keys = 0 let g:vroom_use_dispatch = 1 " }}}}