summaryrefslogtreecommitdiff
path: root/.vim/vimrc
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2023-06-11 07:54:59 -0400
committerSam Chudnick <sam@chudnick.com>2023-06-11 07:54:59 -0400
commit3adcf542289a0883924ae9b9be8b898c36702c95 (patch)
treef02166ef4c95161ffa994eb1a3e5729c93c2c66b /.vim/vimrc
parentdfcc303e7cc284a45f55bae81ed888dc256432b8 (diff)
Add some Vim plugins
Diffstat (limited to '.vim/vimrc')
-rw-r--r--.vim/vimrc57
1 files changed, 43 insertions, 14 deletions
diff --git a/.vim/vimrc b/.vim/vimrc
index 7abab94..2f5d820 100644
--- a/.vim/vimrc
+++ b/.vim/vimrc
@@ -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 31au 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
51set relativenumber " Enable line numbers to be displayed relative to current position 49set relativenumber " Enable line numbers to be displayed relative to current position
52set tabstop=4 " Set default tab size to 4 spaces 50set tabstop=4 " Set default tab size to 4 spaces
53set autoindent " Keep current tab depth on new line 51set autoindent " Keep current tab depth on new line
54colorscheme slate 52
53" Colors
54let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
55let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
56" set termguicolors
57colorscheme gruvbox
58" hi Normal ctermbg=NONE cterm=NONE
55 59
56" Document compilation 60" Document compilation
57map <leader>c :!compile % <CR><CR> 61map <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
63autocmd filetype * set formatoptions-=cro 67autocmd filetype * set formatoptions-=cro
64 68
65
66" C mappings 69" C mappings
67autocmd filetype c inoremap ;c /* */<Left><Left><Left> 70autocmd filetype c inoremap ;c /* */<Left><Left><Left>
68autocmd filetype c inoremap ;p printf(" \n");<Esc>5hi 71autocmd filetype c inoremap ;p printf(" \n");<Esc>5hi
69 72
70" Python mappings 73" Python mappings
71autocmd 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
75let g:autopep8_on_save = 1
72 76
73" Java 'IDE' remappings 77" Java 'IDE' remappings
74autocmd filetype java inoremap [p System.out.println();<Left><Left> 78autocmd filetype java inoremap [p System.out.println();<Left><Left>
@@ -80,6 +84,21 @@ autocmd filetype nroff inoremap ;c .\"
80autocmd filetype nroff inoremap ;b \*[BOLDER]'\*[BOLDERX] <Esc>F'cl 84autocmd filetype nroff inoremap ;b \*[BOLDER]'\*[BOLDERX] <Esc>F'cl
81autocmd filetype nroff inoremap ;h .HEADING 85autocmd filetype nroff inoremap ;h .HEADING
82 86
87" HTML Mappings
88autocmd filetype html inoremap ;; <Esc>/<++><Enter>"_c4l
89autocmd filetype html inoremap ;1 <h1></h1><Enter><++><Esc>FhT>i
90autocmd filetype html inoremap ;2 <h2>`</h2><Enter><++><Esc>k$F`"_cl
91autocmd filetype html inoremap ;3 <h3>`</h3><Enter><++><Esc>k$F`"_cl
92autocmd filetype html inoremap ;b <strong></strong> <++><Esc>F<F<i
93autocmd filetype html inoremap ;i <em></em> <++><Esc>F<F<i
94autocmd filetype html inoremap ;l <li></li> <++><Esc>F<F<i
95autocmd filetype html inoremap ;u <ul>`</ul><Enter><Enter><++><Esc>2k$F`"_cl
96autocmd filetype html inoremap ;p <p>`</p><Enter><Enter><++><Esc>2k$F`"_cl
97autocmd filetype html inoremap ;c <pre><code>`</code></pre><Enter><Enter><++><Esc>2k$F`"_cl
98
99" XML (for RSS)
100autocmd 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
84autocmd BufWritePost *sxhkdrc !pkill -SIGUSR1 sxhkd 103autocmd 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
96autocmd BufWritePost ~/.config/dunst/dunstrc !pkill dunst; setsid -f dunst 115autocmd BufWritePost ~/.config/dunst/dunstrc !pkill dunst; setsid -f dunst
97 116
98"set completeopt =menuone,longest 117autocmd BufWritePost ~/.config/picom/picom.conf !pkill -SIGUSR1 picom
118
119autocmd BufWritePost ~/.local/bin/bar !pkill bar; setsid -f ~/.local/bin/bar
120
121set completeopt =menuone,longest
122
123" Start NERDTree and put the cursor back in the other window.
124autocmd VimEnter * NERDTree | wincmd p
125
126" Show hidden files in NERDTree
127let 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.
101if filereadable("/etc/vim/vimrc.local") 130autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
102 source /etc/vim/vimrc.local
103endif
104 131
132" Open the existing NERDTree on each new tab.
133autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif