"""""""""""""" " SETTINGS " """""""""""""" syntax on filetype plugin indent on set autoindent "colours! 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') "highlight trailing spaces "highlight TrailingSpace ctermbg=black "call matchadd('TrailingSpace', '\S\s\+$') """"""""""""" " ALIASES " """"""""""""" "i keep accidentally typing these over and over command W w command Wq wq command WQ wq command Q q command E e """"""""""""""""""" " PLUGIN THINGS " """"""""""""""""""" "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) """""""""""""" " MAPPINGS " """""""""""""" "gr is pretty useless, and gq is too cumbersome for reflow commands noremap gr gq "insert lines below nnoremap ++ == nnoremap = Oaj "folds! nnoremap fo zO nnoremap fc zC nnoremap fm zM nnoremap fr zR "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" 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 " """"""""""""""""""""""" "always use rust instead of hercules au BufNewFile,BufRead *.rs set filetype=rust "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 "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 cpp call Settings_c() autocmd FileType tex call Settings_tex() autocmd FileType haskell call Settings_haskell() autocmd FileType make call Settings_script() autocmd FileType matlab call Settings_matlab() autocmd FileType perl call Settings_script() autocmd FileType python call Settings_script() autocmd FileType ruby call Settings_script() autocmd FileType rust call Settings_c() autocmd FileType sh call Settings_script() 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 "mappings nnoremap c :!make nnoremap -- O*/hhi/* endfunction function! Settings_haskell() "settings "mappings nnoremap -- O-- endfunction function! Settings_matlab() "settings "mappings nnoremap -- O% endfunction function! Settings_script() "settings setlocal shiftwidth=4 setlocal tabstop=4 "mappings nnoremap -- O# endfunction function! Settings_tex() "settings setlocal noautoindent setlocal nocindent setlocal nosmartindent setlocal shiftwidth=4 setlocal tabstop=4 setlocal spell let g:tex_comment_nospell=1 "mappings nnoremap -- O% nnoremap c :!latex -output-format=pdf "%" nnoremap C :!latex -output-format=pdf "%" endfunction function! Settings_vim() "settings "mappings nnoremap -- O" endfunction