"""""""""""" " VUNDLE " """""""""""" set nocompatible filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'gmarik/Vundle.vim' "FILETYPES Plugin 'kchmck/vim-coffee-script' Plugin 'plasticboy/vim-markdown' Plugin 'zah/nim.vim' Plugin 'cespare/vim-toml' Plugin 'rust-lang/rust.vim' "FUNCTIONALITY Plugin 'junegunn/vim-easy-align' Plugin 'xolox/vim-misc' Plugin 'xolox/vim-easytags' Plugin 'lilydjwg/fcitx.vim' Plugin 'airblade/vim-gitgutter' Plugin 'itchyny/lightline.vim' Plugin 'tomtom/tcomment_vim' Plugin 'SirVer/ultisnips' call vundle#end() """"""""""""""""""""" " PLUGIN SETTINGS " """"""""""""""""""""" "Start interactive EasyAlign in visual mode (e.g. vip) vmap (EasyAlign) "Start interactive EasyAlign for a motion/text object (e.g. gaip) nmap ga (EasyAlign) "timeout on keycodes to prevent fcitx-switcher from lagging set ttimeoutlen=100 "vertical split ultisnips edit let g:UltiSnipsEditSplit="vertical" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" """""""""""""""""""""" " GENERAL SETTINGS " """""""""""""""""""""" syntax on filetype plugin indent on set autoindent colorscheme shmibs "enable status-line set laststatus=2 "hide mode in cmd set noshowmode "allow edited background buffers set hidden "spelling set spelllang=en_gb "gvim-specific settings set guifont=Tamsyn\ 11 set guioptions=aegimt "visual marker for overflowing the 80th column highlight Column80 ctermbg=black call matchadd('Column80', '\%81v', 100) "highlight space before tab highlight SpaceBeforeTab ctermbg=black call matchadd('SpaceBeforeTab', '^\ \+\t') """"""""""""" " ALIASES " """"""""""""" "i keep accidentally typing these over and over command W w command Wq wq command WQ wq command Q q command E e """""""""""""" " MAPPINGS " """""""""""""" "insert lines below nnoremap = :set pastem`O``:set nopaste "folds! nnoremap fo zO nnoremap fc zC nnoremap fm zM nnoremap fr zR "buffer-handling nnoremap :bn nnoremap :bp nnoremap :buffers:b "copy words from above and below the cursor inoremap pumvisible() ? "\" : matchstr(getline(line('.')-1), '\%' . virtcol('.') . 'v\%(\k\+\\|.\)') inoremap pumvisible() ? "\" : matchstr(getline(line('.')+1), '\%' . virtcol('.') . 'v\%(\k\+\\|.\)') "use the X clipboard for things when running in a virtual terminal, because yes if &term != "linux" && has('clipboard') nnoremap y (v:register ==# '"' ? '"+' : '') . 'y' nnoremap Y (v:register ==# '"' ? '"+' : '') . 'Y' xnoremap y (v:register ==# '"' ? '"+' : '') . 'y' xnoremap Y (v:register ==# '"' ? '"+' : '') . 'Y' nnoremap d (v:register ==# '"' ? '"+' : '') . 'd' nnoremap D (v:register ==# '"' ? '"+' : '') . 'D' xnoremap d (v:register ==# '"' ? '"+' : '') . 'd' xnoremap D (v:register ==# '"' ? '"+' : '') . 'D' nnoremap p (v:register ==# '"' ? '"+' : '') . 'p' nnoremap P (v:register ==# '"' ? '"+' : '') . 'P' xnoremap p (v:register ==# '"' ? '"+' : '') . 'p' xnoremap P (v:register ==# '"' ? '"+' : '') . 'P' end """"""""""""""""""""""" " FILETYPE SETTINGS " """"""""""""""""""""""" "annoying syntax-related values that need to be set before files are "opened let g:c_no_comment_fold = 1 let g:c_no_if0_fold = 1 let g:sh_fold_enabled = 1 if has("autocmd") "always use rust instead of hercules autocmd BufNewFile,BufRead *.rs set filetype=rust "always use LaTeX autocmd BufNewFile,BufRead *.tex set filetype=tex "other filetype-specific settings. i can't figure out how to stick all "the FileTypes in one dict (mostly because i have no idea what i'm "doing with viml), so separate lines it is. autocmd FileType asm call Settings_asm() autocmd FileType c call Settings_c() autocmd FileType coffee call Settings_coffee() autocmd FileType cpp call Settings_c() autocmd FileType css call Settings_c() autocmd FileType d call Settings_c() autocmd FileType tex call Settings_tex() autocmd FileType haskell call Settings_haskell() autocmd FileType html call Settings_html() autocmd FileType xhtml call Settings_html() autocmd FileType make call Settings_script() autocmd FileType matlab call Settings_matlab() autocmd FileType mkd call Settings_text() autocmd FileType nim call Settings_nim() autocmd FileType perl call Settings_script() autocmd FileType python call Settings_script() autocmd FileType ruby call Settings_script() autocmd FileType rust call Settings_rust() autocmd FileType sh call Settings_script() autocmd FileType text call Settings_text() autocmd FileType vim call Settings_vim() autocmd FileType zsh call Settings_script() function! Settings_asm() "settings setlocal foldmethod=syntax "mappings nnoremap -- A; endfunction function! Settings_c() "settings setlocal foldmethod=syntax setlocal shiftwidth=4 setlocal tabstop=4 setlocal softtabstop=4 "mappings nnoremap -- O*/hhi/* endfunction function! Settings_coffee() "settings setlocal foldmethod=syntax setlocal shiftwidth=2 setlocal tabstop=2 setlocal softtabstop=2 "mappings nnoremap -- O# endfunction function! Settings_haskell() "settings "mappings nnoremap -- O-- endfunction function! Settings_html() "settings setlocal foldmethod=syntax setlocal shiftwidth=4 setlocal tabstop=4 setlocal softtabstop=4 "mappings nnoremap -- O-->hhhi