.vimrc (2726B)
1 execute pathogen#infect() 2 syntax on 3 filetype plugin indent on 4 5 inoremap <Esc> <Nop> 6 inoremap <special> fd <Esc> 7 8 set backspace=indent,eol,start 9 set tabstop=8 10 set shiftwidth=8 11 set ai 12 set hlsearch 13 set colorcolumn=80 14 set nowrap 15 set hidden 16 set wrap 17 set rnu nu 18 19 hi ColorColumn ctermbg=8 20 21 map Y y$ 22 23 syntax on 24 25 set clipboard=unnamed 26 27 let mapleader = "\\" 28 let maplocalleader = "\\" 29 nmap <Leader>xda ma:%s/\s\+$//g<CR>`a 30 nmap <Leader>f ma:%! 31 32 nmap <Leader>co :cfile build.log<CR>:copen<CR>:wincmd k<CR> 33 nmap <Leader>cl :close<CR>:q<CR> 34 nmap <Leader>cx :close<CR>:x<CR> 35 nmap <Leader>cm :!make >& build.log<CR>:cfile build.log<CR>:copen<CR>:wincmd k<CR> 36 nmap <Leader>cr :!bash .buildcmd >& build.log<CR>:cfile build.log<CR>:copen<CR>:wincmd k<CR> 37 nmap <Leader>ct :!cargo test >& build.log<CR>:cfile build.log<CR>:copen<CR>:wincmd k<CR> 38 39 nmap ]t :tn<CR> 40 nmap [t :tp<CR> 41 42 " Custom key binding for :cn (next quickfix) with window adjustments 43 nnoremap <silent> <C-n> :cn<CR>:wincmd j<CR>zt:wincmd k<CR> 44 45 " Optional: Custom key binding for :cp (previous quickfix) with window adjustments 46 nnoremap <silent> <C-p> :cp<CR>:wincmd j<CR>zt:wincmd k<CR> 47 48 imap <A-j> { 49 imap <A-k> } 50 imap <A-n> [ 51 imap <A-m> ] 52 imap <A-h> ( 53 imap <A-l> ) 54 imap <A-u> _ 55 imap <A-i> - 56 imap <A-o> + 57 imap <A-,> = 58 imap <A-Space> <CR> 59 60 autocmd FileType go autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe gofmt\<esc>:loadview\<esc>`z" 61 autocmd FileType go set wrap rnu 62 "autocmd FileType rust autocmd BufWritePre <buffer> execute "normal! mz:mkview\<esc>:%!fmtsafe rustfmt\<esc>:loadview\<esc>`z" 63 "autocmd FileType rust nnoremap <buffer> <leader>f :mkview<CR>:%!fmtsafe rustfmt<CR>:loadview<CR> 64 autocmd FileType rust setlocal tags=./rusty-tags.vi;/ 65 autocmd FileType rust nnoremap <buffer> <leader>f :call RustFormat()<CR> 66 "autocmd VimEnter *.rs cgetfile build.log 67 "autocmd QuickFixCmdPost [^l]* nested cwindow 68 autocmd filetype js set sw=2 ts=2 expandtab 69 70 autocmd BufEnter,BufNew *.nix set sw=2 ts=2 expandtab 71 autocmd BufEnter,BufNew *.gmi set wrap linebreak 72 73 autocmd QuickFixCmdPost * if &buftype == 'quickfix' | 74 \ execute 'wincmd j' | execute 'normal! zt' | execute 'wincmd k' | 75 \ endif 76 77 " Automatically scroll the window so the current error is at the top 78 au BufWritePost,FileWritePost ~/.Xdefaults,~/.Xresources silent! !xrdb -load % >/dev/null 2>&1 79 80 " Automatically move the cursor to the last editing position in a file when you open it, provided that position is valid. 81 if has("autocmd") 82 au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") 83 \| exe "normal! g'\"" | endif 84 endif 85 86 function! RustFormat() 87 let l:view = winsaveview() 88 silent! mkview 89 silent! %!fmtsafe rustfmt 90 call winrestview(l:view) 91 endfunction