diff options
author | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:54:59 -0400 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:54:59 -0400 |
commit | 3adcf542289a0883924ae9b9be8b898c36702c95 (patch) | |
tree | f02166ef4c95161ffa994eb1a3e5729c93c2c66b /.vim/vimrc | |
parent | dfcc303e7cc284a45f55bae81ed888dc256432b8 (diff) |
Add some Vim plugins
Diffstat (limited to '.vim/vimrc')
-rw-r--r-- | .vim/vimrc | 57 |
1 files changed, 43 insertions, 14 deletions
@@ -1,9 +1,7 @@ | |||
1 | " All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by | 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 | 2 | " the call to :runtime you can find below. If you wish to change any of those " settings, you should do it in this file (/etc/vim/vimrc), since debian.vim |
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. | 3 | " 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 | 4 | " It is recommended to make changes after sourcing debian.vim since it alters " the value of the 'compatible' option. |
6 | " the value of the 'compatible' option. | ||
7 | 5 | ||
8 | " This line should not be removed as it ensures that various options are | 6 | " 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. | 7 | " properly set to work with the Vim-related packages available in Debian. |
@@ -30,7 +28,7 @@ set background=dark | |||
30 | 28 | ||
31 | " Uncomment the following to have Vim jump to the last position when | 29 | " Uncomment the following to have Vim jump to the last position when |
32 | " reopening a file | 30 | " reopening a file |
33 | "au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | 31 | au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif |
34 | 32 | ||
35 | " Uncomment the following to have Vim load indentation rules and plugins | 33 | " Uncomment the following to have Vim load indentation rules and plugins |
36 | " according to the detected filetype. | 34 | " according to the detected filetype. |
@@ -51,7 +49,13 @@ set number " Enable line numbers | |||
51 | set relativenumber " Enable line numbers to be displayed relative to current position | 49 | set relativenumber " Enable line numbers to be displayed relative to current position |
52 | set tabstop=4 " Set default tab size to 4 spaces | 50 | set tabstop=4 " Set default tab size to 4 spaces |
53 | set autoindent " Keep current tab depth on new line | 51 | set autoindent " Keep current tab depth on new line |
54 | colorscheme slate | 52 | |
53 | " Colors | ||
54 | let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" | ||
55 | let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" | ||
56 | " set termguicolors | ||
57 | colorscheme gruvbox | ||
58 | " hi Normal ctermbg=NONE cterm=NONE | ||
55 | 59 | ||
56 | " Document compilation | 60 | " Document compilation |
57 | map <leader>c :!compile % <CR><CR> | 61 | map <leader>c :!compile % <CR><CR> |
@@ -62,13 +66,13 @@ map <leader>s :setlocal spell! spelllang=en_us<CR> | |||
62 | " Disable auto comment continuation | 66 | " Disable auto comment continuation |
63 | autocmd filetype * set formatoptions-=cro | 67 | autocmd filetype * set formatoptions-=cro |
64 | 68 | ||
65 | |||
66 | " C mappings | 69 | " C mappings |
67 | autocmd filetype c inoremap ;c /* */<Left><Left><Left> | 70 | autocmd filetype c inoremap ;c /* */<Left><Left><Left> |
68 | autocmd filetype c inoremap ;p printf(" \n");<Esc>5hi | 71 | autocmd filetype c inoremap ;p printf(" \n");<Esc>5hi |
69 | 72 | ||
70 | " Python mappings | 73 | " 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 | 74 | " autocmd filetype python noremap <C-m> ggI#!/usr/bin/env python3<Return><Return>def main():<Return>pass<Return><Return><Return>if __name__ == '__main__':<Return>main()<Esc>ggji |
75 | let g:autopep8_on_save = 1 | ||
72 | 76 | ||
73 | " Java 'IDE' remappings | 77 | " Java 'IDE' remappings |
74 | autocmd filetype java inoremap [p System.out.println();<Left><Left> | 78 | autocmd filetype java inoremap [p System.out.println();<Left><Left> |
@@ -80,6 +84,21 @@ autocmd filetype nroff inoremap ;c .\" | |||
80 | autocmd filetype nroff inoremap ;b \*[BOLDER]'\*[BOLDERX] <Esc>F'cl | 84 | autocmd filetype nroff inoremap ;b \*[BOLDER]'\*[BOLDERX] <Esc>F'cl |
81 | autocmd filetype nroff inoremap ;h .HEADING | 85 | autocmd filetype nroff inoremap ;h .HEADING |
82 | 86 | ||
87 | " HTML Mappings | ||
88 | autocmd filetype html inoremap ;; <Esc>/<++><Enter>"_c4l | ||
89 | autocmd filetype html inoremap ;1 <h1></h1><Enter><++><Esc>FhT>i | ||
90 | autocmd filetype html inoremap ;2 <h2>`</h2><Enter><++><Esc>k$F`"_cl | ||
91 | autocmd filetype html inoremap ;3 <h3>`</h3><Enter><++><Esc>k$F`"_cl | ||
92 | autocmd filetype html inoremap ;b <strong></strong> <++><Esc>F<F<i | ||
93 | autocmd filetype html inoremap ;i <em></em> <++><Esc>F<F<i | ||
94 | autocmd filetype html inoremap ;l <li></li> <++><Esc>F<F<i | ||
95 | autocmd filetype html inoremap ;u <ul>`</ul><Enter><Enter><++><Esc>2k$F`"_cl | ||
96 | autocmd filetype html inoremap ;p <p>`</p><Enter><Enter><++><Esc>2k$F`"_cl | ||
97 | autocmd filetype html inoremap ;c <pre><code>`</code></pre><Enter><Enter><++><Esc>2k$F`"_cl | ||
98 | |||
99 | " XML (for RSS) | ||
100 | autocmd filetype xml inoremap ;i <item><Enter><title></title><Enter><guid></guid><Enter><link></link><Enter><pubDate></pubDate><Enter><description><![CDATA[]]></description><Enter></item><Esc>k$F[a | ||
101 | |||
83 | " Restart sxhkd when config file is changed | 102 | " Restart sxhkd when config file is changed |
84 | autocmd BufWritePost *sxhkdrc !pkill -SIGUSR1 sxhkd | 103 | autocmd BufWritePost *sxhkdrc !pkill -SIGUSR1 sxhkd |
85 | 104 | ||
@@ -95,10 +114,20 @@ autocmd BufWritePost ~/.config/x11/xresources !xrdb ~/.config/x11/xresources | |||
95 | " Reload dunst after editing configuration file | 114 | " Reload dunst after editing configuration file |
96 | autocmd BufWritePost ~/.config/dunst/dunstrc !pkill dunst; setsid -f dunst | 115 | autocmd BufWritePost ~/.config/dunst/dunstrc !pkill dunst; setsid -f dunst |
97 | 116 | ||
98 | "set completeopt =menuone,longest | 117 | autocmd BufWritePost ~/.config/picom/picom.conf !pkill -SIGUSR1 picom |
118 | |||
119 | autocmd BufWritePost ~/.local/bin/bar !pkill bar; setsid -f ~/.local/bin/bar | ||
120 | |||
121 | set completeopt =menuone,longest | ||
122 | |||
123 | " Start NERDTree and put the cursor back in the other window. | ||
124 | autocmd VimEnter * NERDTree | wincmd p | ||
125 | |||
126 | " Show hidden files in NERDTree | ||
127 | let NERDTreeShowHidden=1 | ||
99 | 128 | ||
100 | " Source a global configuration file if available | 129 | " Exit Vim if NERDTree is the only window remaining in the only tab. |
101 | if filereadable("/etc/vim/vimrc.local") | 130 | autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif |
102 | source /etc/vim/vimrc.local | ||
103 | endif | ||
104 | 131 | ||
132 | " Open the existing NERDTree on each new tab. | ||
133 | autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif | ||