Broke out vim rc into nicer pieces :)

This commit is contained in:
Wryn Wagner 2019-09-26 16:00:03 -06:00
parent 90eef0d7dc
commit 4b195da0e2
9 changed files with 111 additions and 82 deletions

View File

@ -136,10 +136,10 @@ mode "resize" {
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym h resize shrink width 10 px or 10 ppt
bindsym h resize grow width 10 px or 10 ppt
bindsym j resize grow height 10 px or 10 ppt
bindsym k resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
bindsym l resize shrink width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"

View File

@ -31,6 +31,7 @@ if [ ! -f "$LOCAL_VIM_SETUP" ]; then
echo 'let $WRYNVIMRC=expand("$VIM_DIR/rc.vim")' >> $LOCAL_VIM_SETUP
echo 'let $WRYNBASH=expand("$RC_DIR/bashrc")' >> $LOCAL_VIM_SETUP
echo 'let $MYBASHRC=expand("$HOME/.bashrc")' >> $LOCAL_VIM_SETUP
echo 'let $WEBBROWSER="' $(which google-chrome-stable) '"' >> $LOCAL_VIM_SETUP
else
echo 'vim environment variables already set up'
fi

6
vim/abbreviations.vim Normal file
View File

@ -0,0 +1,6 @@
" -- Abbreviation Dictionary ------------------------- {{{
iabbrev @@ wagner.wryn@gmail.com
iabbrev ssig <CR>-----------------------<CR>Wryn Wagner<CR>wagner.wryn@gmail.com<CR>(720)557-5443<CR>-----------------------
iabbrev psvm public static void main(String[] args) {<CR>}
" }}}

6
vim/edit_rc.vim Normal file
View File

@ -0,0 +1,6 @@
" -- VIMRC ------------------------------------------- {{{
nnoremap <Leader>ev :vsp $WRYNVIMRC<CR>
nnoremap <Leader>sv :source $MYVIMRC<CR>
nnoremap <Leader>eb :vsp $MYBASHRC<CR>
nnoremap <Leader>emb :vsp $WRYNBASH<CR>
" }}}

25
vim/file_formatting.vim Normal file
View File

@ -0,0 +1,25 @@
syntax on " detect syntax
" -- File Formatting ------------------------------------- {{{
augroup filetype_specific_formatting
autocmd!
autocmd FileType python setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab foldmethod=indent foldlevel=99
autocmd FileType java setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab foldmethod=indent foldlevel=99
autocmd FileType cs setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab foldmethod=indent foldlevel=99
autocmd FileType html setlocal tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab foldmethod=indent foldlevel=99
autocmd FileType javascript setlocal tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab foldmethod=indent foldlevel=99
autocmd FileType vim setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab foldmethod=marker foldlevel=1
autocmd FileType sh setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab foldmethod=indent foldlevel=99
autocmd FileType lisp setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab foldmethod=manual foldlevel=99
autocmd FileType markdown setlocal tabstop=2 noexpandtab foldmethod=indent foldlevel=99 spell
autocmd FileType tex setlocal tabstop=2 noexpandtab foldmethod=indent foldlevel=99 spell
augroup end
" }}}
" <Leader>ec Commands run on a per-extension basis {{{
augroup execute_file_shortcuts
" tex opens pdf in chrome
autocmd FileType tex nnoremap <Leader>ec :! $WEBBROWSER %:r.pdf<CR>
augroup end
" }}}

22
vim/general_set.vim Normal file
View File

@ -0,0 +1,22 @@
set linebreak " automatically wraps text
set breakindent " indent for single-line wrap
set breakindentopt=shift:3 " indent amount for single-line wrap
set formatoptions=lj
" l = prevents the breaking up of words
" j = remove comment leaders when joining lines
let &t_co=256 " use 256-color
set number " show line numbers
set autoindent " match indentation with next line
set smartindent " match indentation with syntax
set spellfile=$VIM_DIR/en.utf-8.add
set spelllang=en
set showmatch " -- emit 'beep' when no matching symbol,
set matchtime=0 " -- but don't jump to it.
set timeoutlen=200 " -- short timeout for multi-key functions

21
vim/global_sets.vim Normal file
View File

@ -0,0 +1,21 @@
set linebreak " automatically wraps text
set breakindent " indent for single-line wrap
set breakindentopt=shift:3 " indent amount for single-line wrap
set formatoptions=lj
" l = prevents the breaking up of words
" j = remove comment leaders when joining lines
let &t_co=256 " use 256-color
set number " show line numbers
set autoindent " match indentation with next line
set smartindent " match indentation with syntax
set spellfile=$VIM_DIR/en.utf-8.add
set spelllang=en
set showmatch " -- emit 'beep' when no matching symbol,
set matchtime=0 " -- but don't jump to it.
set timeoutlen=200 " -- short timeout for multi-key functions

View File

@ -1,86 +1,24 @@
" -- Environment Variables --------------------------------------- {{{
source $HOME/.my_vim_env
"sets the following variables:
"$RC_DIR $VIM_DIR $WRYNVIMRC $WRYNBASH $MYBASHRC
" Load Vundle Plugins First
source $VIM_DIR/vundle.vim
" }}}
"$RC_DIR $VIM_DIR $WRYNVIMRC $WRYNBASH $MYBASHRC $WEBBROWSER
" -- General Settings -------------------------------------------- {{{
set linebreak " automatically wraps text
set breakindent " indent for single-line wrap
set breakindentopt=shift:3 " indent amount for single-line wrap
set formatoptions=lj
" l = prevents the breaking up of words
" j = remove comment leaders when joining lines
let &t_co=256 " use 256-color
set number " show line numbers
syntax on " detect syntax
set autoindent " match indentation with next line
set smartindent " match indentation with syntax
set spellfile=$VIM_DIR/en.utf-8.add
set spelllang=en
set showmatch " -- emit 'beep' when no matching symbol,
set matchtime=0 " -- but don't jump to it.
set timeoutlen=200 " -- short timeout for multi-key functions
" }}}
" -- File Formatting ------------------------------------- {{{
augroup filetype_specific_formatting
autocmd!
autocmd FileType python setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab foldmethod=indent foldlevel=99
autocmd FileType java setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab foldmethod=indent foldlevel=99
autocmd FileType cs setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab foldmethod=indent foldlevel=99
autocmd FileType html setlocal tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab foldmethod=indent foldlevel=99
autocmd FileType javascript setlocal tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab foldmethod=indent foldlevel=99
autocmd FileType vim setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab foldmethod=marker foldlevel=1
autocmd FileType sh setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab foldmethod=indent foldlevel=99
autocmd FileType lisp setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab foldmethod=manual foldlevel=99
autocmd FileType markdown setlocal tabstop=2 noexpandtab foldmethod=indent foldlevel=99 spell
augroup end
" }}}
" -- Key bindings ---------------------------------------- {{{
let mapleader = "\\"
"let localmapleader = ','
" -- VIMRC ------------------------------------------- {{{
nnoremap <Leader>ev :vsp $WRYNVIMRC<CR>
nnoremap <Leader>sv :source $MYVIMRC<CR>
nnoremap <Leader>eb :vsp $MYBASHRC<CR>
nnoremap <Leader>emb :vsp $WRYNBASH<CR>
" }}}
" 1) Load Vundle first
source $VIM_DIR/vundle.vim
" -- Abbreviation Dictionary ------------------------- {{{
iabbrev @@ wagner.wryn@gmail.com
iabbrev ssig <CR>-----------------------<CR>Wryn Wagner<CR>wagner.wryn@gmail.com<CR>(720)557-5443<CR>-----------------------
iabbrev psvm public static void main(String[] args) {<CR>}
" }}}
" -- Pane/Window Navigation -------------------------- {{{
" (SHIFT + DIRECTION) for tabs
nnoremap <S-l> gt
nnoremap <S-h> gT
" (CTRL + DIRECTION) for panes
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
" }}}
" (CTRL + n) for files
nnoremap <C-n> :n<CR>
nnoremap <C-b> :N<CR>
" open (execute) file in chrome
nnoremap <Leader>ec :!/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %:p<CR>
" 2) Order insensitive plugins
source $VIM_DIR/global_sets.vim
source $VIM_DIR/file_formatting.vim
source $VIM_DIR/edit_rc.vim
source $VIM_DIR/abbreviations.vim
source $VIM_DIR/window_pane_navigation.vim
source $VIM_DIR/my_colors.vim
" 3) Order sensitive plugins
source $VIM_DIR/rd_formatting.vim " Must load after file_formatting
" <SPACE> to execute macro on q
nnoremap <Space> @q
@ -92,7 +30,7 @@ nnoremap Q !!$SHELL<CR>
" \q for `q:`
nnoremap <Leader>q q:
" \t for rerun tests
" \t for rerun last 'test' command:
nnoremap <Leader>t q:?test<CR><CR>
" \f for fold
@ -108,8 +46,3 @@ nnoremap _ :m -2 <CR>
" - (insert mode) set current word to upper-case
inoremap <c-u> <esc>viwUea
" - My Plugins
source $VIM_DIR/rd_formatting.vim
source $VIM_DIR/my_colors.vim
" }}}

View File

@ -0,0 +1,15 @@
" -- Pane/Window Navigation -------------------------- {{{
" (SHIFT + DIRECTION) for tabs
nnoremap <S-l> gt
nnoremap <S-h> gT
" (CTRL + DIRECTION) for panes
nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
" (CTRL + n) for files
nnoremap <C-n> :n<CR>
nnoremap <C-b> :N<CR>
" }}}