diff options
Diffstat (limited to '.vim/vimrc')
| -rw-r--r-- | .vim/vimrc | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/.vim/vimrc b/.vim/vimrc new file mode 100644 index 0000000..a3ea897 --- /dev/null +++ b/.vim/vimrc | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | " All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by | ||
| 2 | " the call to :runtime you can find below. If you wish to change any of those | ||
| 3 | " settings, you should do it in this file (/etc/vim/vimrc), since debian.vim | ||
| 4 | " will be overwritten everytime an upgrade of the vim packages is performed. | ||
| 5 | " It is recommended to make changes after sourcing debian.vim since it alters | ||
| 6 | " the value of the 'compatible' option. | ||
| 7 | |||
| 8 | " This line should not be removed as it ensures that various options are | ||
| 9 | " properly set to work with the Vim-related packages available in Debian. | ||
| 10 | runtime! debian.vim | ||
| 11 | " Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc. | ||
| 12 | " This happens after /etc/vim/vimrc(.local) are loaded, so it will override | ||
| 13 | " any settings in these files. | ||
| 14 | " If you don't want that to happen, uncomment the below line to prevent | ||
| 15 | " defaults.vim from being loaded. | ||
| 16 | " let g:skip_defaults_vim = 1 | ||
| 17 | |||
| 18 | " Uncomment the next line to make Vim more Vi-compatible | ||
| 19 | " NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous | ||
| 20 | " options, so any other options should be set AFTER setting 'compatible'. | ||
| 21 | "set compatible | ||
| 22 | |||
| 23 | " Vim5 and later versions support syntax highlighting. Uncommenting the next | ||
| 24 | " line enables syntax highlighting by default. | ||
| 25 | syntax on | ||
| 26 | |||
| 27 | " If using a dark background within the editing area and syntax highlighting | ||
| 28 | " turn on this option as well | ||
| 29 | set background=dark | ||
| 30 | |||
| 31 | " Uncomment the following to have Vim jump to the last position when | ||
| 32 | " reopening a file | ||
| 33 | "au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | ||
| 34 | |||
| 35 | " Uncomment the following to have Vim load indentation rules and plugins | ||
| 36 | " according to the detected filetype. | ||
| 37 | filetype plugin indent on | ||
| 38 | |||
| 39 | " The following are commented out as they cause vim to behave a lot | ||
| 40 | " differently from regular Vi. They are highly recommended though. | ||
| 41 | let mapleader =" " " Map leader | ||
| 42 | set showcmd " Show (partial) command in status line. | ||
| 43 | set showmatch " Show matching brackets. | ||
| 44 | set ignorecase " Do case insensitive matching | ||
| 45 | set smartcase " Do smart case matching | ||
| 46 | set incsearch " Incremental search | ||
| 47 | set autowrite " Automatically save before commands like :next and :make | ||
| 48 | set hidden " Hide buffers when they are abandoned | ||
| 49 | set mouse=a " Enable mouse usage (all modes) | ||
| 50 | set number " Enable line numbers | ||
| 51 | set relativenumber " Enable line numbers to be displayed relative to current position | ||
| 52 | set tabstop=4 " Set default tab size to 4 spaces | ||
| 53 | set autoindent " Keep current tab depth on new line | ||
| 54 | colorscheme slate " Enable my custom colorscheme | ||
| 55 | |||
| 56 | " Document compilation | ||
| 57 | map <leader>c :!compile % <CR><CR> | ||
| 58 | " Document Preview | ||
| 59 | map <leader>p :!pdf-preview % <CR><CR> | ||
| 60 | " Spell Check | ||
| 61 | map <leader>s :setlocal spell! spelllang=en_us<CR> | ||
| 62 | " Disable auto comment continuation | ||
| 63 | autocmd filetype * set formatoptions-=cro | ||
| 64 | |||
| 65 | |||
| 66 | " C mappings | ||
| 67 | autocmd filetype c inoremap ;c /* */<Left><Left><Left> | ||
| 68 | autocmd filetype c inoremap ;p printf(" \n");<Esc>5hi | ||
| 69 | |||
| 70 | " Python mappings | ||
| 71 | autocmd filetype python noremap <C-m> i<Return><Return><Return>def main():<Return>pass<Return><Return><Return>if __name__ == '__main__':<Return>main()<Esc>gg | ||
| 72 | |||
| 73 | " Java 'IDE' remappings | ||
| 74 | autocmd filetype java inoremap [p System.out.println();<Left><Left> | ||
| 75 | autocmd filetype java noremap <C-m> ipublic class {<Return>public static void main(String[] args) {<Return><Return>}<Return>}<Esc>ggwwhhi | ||
| 76 | autocmd filetype java noremap <C-c> ipublic class {<Return><Return>}<Esc>ggwwhhi | ||
| 77 | |||
| 78 | " Groff Mappings | ||
| 79 | autocmd filetype nroff inoremap ;c .\" | ||
| 80 | autocmd filetype nroff inoremap ;b \*[BOLDER]'\*[BOLDERX] <Esc>F'cl | ||
| 81 | autocmd filetype nroff inoremap ;h .HEADING | ||
| 82 | |||
| 83 | " Restart sxhkd when config file is changed | ||
| 84 | autocmd BufWritePost *sxhkdrc !pkill -SIGUSR1 sxhkd | ||
| 85 | |||
| 86 | " Recompile and restart dwmblocks when file is changed | ||
| 87 | autocmd BufWritePost ~/.local/src/dwmblocks/blocks.h !cd ~/.local/src/dwmblocks/; sudo make install && pkill dwmblocks; setsid -f dwmblocks | ||
| 88 | |||
| 89 | " Recompile dwm when config.h is changed | ||
| 90 | autocmd BufWritePost ~/.local/src/dwm/config.h !cd ~/.local/src/dwm/; sudo make install | ||
| 91 | |||
| 92 | " Reload Xresources when saved | ||
| 93 | autocmd BufWritePost ~/.config/x11/xresources !xrdb ~/.config/x11/xresources | ||
| 94 | |||
| 95 | " Reload dunst after editing configuration file | ||
| 96 | autocmd BufWritePost ~/.config/dunst/dunstrc !pkill dunst; setsid -f dunst | ||
| 97 | |||
| 98 | "set completeopt =menuone,longest | ||
| 99 | |||
| 100 | " Source a global configuration file if available | ||
| 101 | if filereadable("/etc/vim/vimrc.local") | ||
| 102 | source /etc/vim/vimrc.local | ||
| 103 | endif | ||
| 104 | |||
