vim cleanup

This commit is contained in:
Wryn (yage) Wagner 2022-08-09 17:56:06 -06:00
parent 77ff4928a3
commit 655d580e9d
10 changed files with 123 additions and 134 deletions

View File

@ -1,16 +0,0 @@
iabbrev @@ wagner.wryn@gmail.com
iabbrev ssig <CR>-----------------------<CR>Wryn Wagner<CR>wagner.wryn@gmail.com<CR>(720)557-5443<CR>-----------------------
iabbrev asas // arrange // act // assert
iabbrev aaaa /* arrange */ /* act */ /* assert */
iabbrev apap # arrange # act # assert
iabbrev acac % arrange % act % assert
" -- java -------------------------------------------- {{{
iabbrev psvm public static void main(String[] args) {<CR>}
" }}}
" -- markdown ---------------------------------------- {{{
iabbrev termdef ## Terms and Definitions<CR>Term \| Definition<CR>--- \| ---<CR>
" }}}

View File

@ -2,8 +2,7 @@ silent! colorscheme $COLORSCHEME
set t_Co=256 set t_Co=256
" transparent background highlight Normal guibg=NONE ctermbg=NONE
highlight Normal guibg=NONE ctermbg=NONE highlight SpellBad ctermbg=NONE ctermfg=red
highlight SpellBad ctermbg=NONE ctermfg=red highlight LineNr ctermfg=yellow
highlight LineNr ctermfg=yellow
highlight SignColumn guibg=NONE ctermbg=NONE highlight SignColumn guibg=NONE ctermbg=NONE

View File

@ -1,4 +1,5 @@
" -- Custom Format Settings ------------------------------ {{{ " --- custom format settings ------------------------------------------
" {{{
function FormatFileType(indent, expandtab, foldmethod, foldlevel, spell) function FormatFileType(indent, expandtab, foldmethod, foldlevel, spell)
let &l:tabstop = a:indent let &l:tabstop = a:indent
let &l:softtabstop = a:indent let &l:softtabstop = a:indent
@ -51,36 +52,46 @@ augroup filetype_specific_formatting
autocmd FileType go call FormatFileType(4, v:false, 'manual', 99, v:false) autocmd FileType go call FormatFileType(4, v:false, 'manual', 99, v:false)
autocmd FileType json call FormatFileType(2, v:false, 'indent', 99, v:false) autocmd FileType json call FormatFileType(2, v:false, 'indent', 99, v:false)
augroup end augroup end
let g:markdown_fenced_languages = ['javascript', 'json', 'python', 'bash', 'yaml', 'shell=zsh']
" }}} " }}}
" -- <Leader>ec to 'ExeCute' a file ---------------------- {{{ " --- (e)xe(c)ute -----------------------------------------------------
augroup execute_file_shortcuts " (i)nteractive
autocmd FileType tex nnoremap <Leader>ec :! pdf=$(grep -rl 'documentclass' ./ <bar> head -n 1 <bar> sed 's/\(.*\)\.tex/\1.pdf/'); $WEBBROWSER $pdf<CR> " (b)uild
autocmd FileType markdown nnoremap <Leader>ec :! $WEBBROWSER %:p<CR> " auto-(f)ormat
autocmd FileType go nnoremap <Leader>ec :!clear<CR><CR>q:?GoRun<CR><CR> " (t)ests
" {{{
augroup file_specific_command_overrides
nnoremap <Leader>ec :call SplitPaneTest('%:p', v:true)<CR>
nnoremap <Leader>ei :echohl ErrorMsg <bar> echom 'ERROR: no interactive execute defined' <bar> echohl None<CR>
nnoremap <Leader>eb :echohl ErrorMsg <bar> echom 'ERROR: no build steps defined' <bar> echohl None<CR>
nnoremap <Leader>ef :echohl ErrorMsg <bar> echom 'ERROR: no auto-format steps defined' <bar> echohl None<CR>
nnoremap <Leader>et :echohl ErrorMsg <bar> echom 'ERROR: no test steps defined' <bar> echohl None<CR>
autocmd FileType tex nnoremap <Leader>ec :! scwrypts -n latex/open-pdf -- %:p<CR>
autocmd FileType tex nnoremap <Leader>eb :! scwrypts -n latex/build-pdf -- %:p<CR>
autocmd FileType tex nnoremap <Leader>ef :! scwrypts -n latex/cleanup -- %:p<CR>
autocmd FileType markdown nnoremap <Leader>ec :! $WEBBROWSER %:p<CR>
autocmd FileType go nnoremap <Leader>ec :!clear<CR><CR>q:?GoRun<CR><CR>
autocmd FileType go nnoremap <silent> <Leader>ef <Plug>(go-imports)
autocmd FileType go nnoremap <silent> gd <Plug>(go-def-tab)
autocmd FileType python nnoremap <Leader>ec :call SplitPaneTest('bpython %')<CR>
autocmd FileType python nnoremap <Leader>ei :call SplitPaneTest('bpython -qi %')<CR>
augroup end augroup end
" }}} " }}}
" -- Miscellaneous File-specific Commands ---------------- {{{ " --- organization overrides ------------------------------------------
augroup latex_commands " {{{
" overwrite the <leader>t 'test' to (double) recompile the latex document. source $WRYNVIMPATH/override/rentdynamics.vim
" in case pdflatex gets in a stuck state, it is run through timeout 3 source $WRYNVIMPATH/override/directus.vim
autocmd FileType tex nnoremap <Leader>t :! clear; texfile=$(grep -rl 'documentclass' ./ <bar> head -n 1); timeout 3 pdflatex -synctex=0 $texfile && { clear; pdflatex $texfile <bar> lolcat }<CR>
augroup end
augroup go_commands
autocmd FileType go nmap <silent> <Leader>ef <Plug>(go-imports)
autocmd FileType go nmap <silent> gd <Plug>(go-def-tab)
augroup end
" }}}
" -- Format Override Layers ------------------------------ {{{
source $WRYNVIMPATH/rentdynamics.vim
" }}} " }}}

View File

@ -1,15 +1,21 @@
" (SHIFT + DIRECTION) for tabs " (shift + direction) for tabs
nnoremap <S-l> gt nnoremap <S-l> gt
nnoremap <S-h> gT nnoremap <S-h> gT
nnoremap <S-t> <C-w>T nnoremap <S-t> <C-w>T
" (CTRL + DIRECTION) for panes " (ctrl + direction) for panes
nnoremap <C-l> <C-w>l nnoremap <C-l> <C-w>l
nnoremap <C-h> <C-w>h nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k nnoremap <C-k> <C-w>k
" (CTRL + n/p) for files " (ctrl + n/p) for buffers
nnoremap <C-n> :n<CR> nnoremap <C-n> :n<CR>
nnoremap <C-p> :N<CR> nnoremap <C-p> :N<CR>
" flip (gf) / (ctrl+w gf) bindings
nnoremap <C-w>gf gf
vnoremap <C-w>gf gf
nnoremap gf <C-w>gf
vnoremap gf <C-w>gf

View File

@ -0,0 +1,5 @@
augroup directus
autocmd!
autocmd BufRead,BufEnter,BufNewFile */Projects/directus/core/code/* setlocal noexpandtab
autocmd BufRead,BufEnter,BufNewFile */Projects/directus/cloud/code/* setlocal noexpandtab
augroup end

View File

@ -7,58 +7,71 @@ endif
source $WRYNVIMPATH/options.vim source $WRYNVIMPATH/options.vim
source $WRYNVIMPATH/testing.vim source $WRYNVIMPATH/testing.vim
source $WRYNVIMPATH/formatting.vim source $WRYNVIMPATH/formatting.vim
source $WRYNVIMPATH/abbreviations.vim
source $WRYNVIMPATH/navigation.vim source $WRYNVIMPATH/navigation.vim
source $WRYNVIMPATH/color.vim source $WRYNVIMPATH/color.vim
source $WRYNVIMPATH/utility.vim source $WRYNVIMPATH/utility.vim
" -- Bindings --------------------------------------------------- {{{ " ---------------------------------------------------------------------
" {{{
" <SPACE> to execute macro on q " <SPACE> to execute macro on q
nnoremap <Space> @q nnoremap <Space> @q
" \q for `q:`
nnoremap <Leader>q q:
" \f for fold
nnoremap <Leader>f z
" \s previous selection command
nnoremap <Leader>s :'<,'>
" (e)dit / (s)ource vimrc
nnoremap <Leader>ev :tabedit $WRYNVIMRC<CR>
nnoremap <Leader>sv :source $MYVIMRC<CR>
" Q to replace current line/selection with bash execution " Q to replace current line/selection with bash execution
vnoremap Q !$SHELL<CR> vnoremap Q !$SHELL<CR>
nnoremap Q !!$SHELL<CR> nnoremap Q !!$SHELL<CR>
" \q for `q:` " move the current line down/up one
nnoremap <Leader>q q:
" \s previous selection command
nnoremap <Leader>s :'<,'>
" \f for fold
nnoremap <Leader>f z
nnoremap <Leader>f z
" \j for J, but append current line to the line below
nnoremap <Leader>j ddpkJ
" move the current line one below where it is
nnoremap - :move +1 <CR> nnoremap - :move +1 <CR>
nnoremap _ :move -2 <CR> nnoremap _ :move -2 <CR>
" \t for rerun last 'vimtest' command: " \j like J, but append current line to the line below
nnoremap <Leader>t q:?vimtest<CR><CR> nnoremap <Leader>j ddpkJ
" \b for git blame " \d insert formatted date below
nnoremap <Leader>b :set termwinsize=15*0<BAR>:execute "terminal git blame -L " .eval(line(".")-5) . ",+10 %"<BAR>:set termwinsize&<CR> nnoremap <Leader>d :let @d = system("date '+%A, %B %-d, %Y'")<CR>o<C-r>d<BS> <esc>
" \d to insert formatted date before/after cursor " \g git fugitive shortcuts
nnoremap <Leader>di :let @d = system("date '+%A, %B %-d, %Y'")<CR>i<C-r>d<BS> <esc> nnoremap <Leader>gb :Git blame<CR>
nnoremap <Leader>da :let @d = system("date '+%A, %B %-d, %Y'")<CR>a <C-r>d<BS><esc>
" - toggle casing for current word " \r = open last REPL (p)ython (n)odejs (c)lisp
inoremap <C-u> <esc>viw~ea nnoremap <Leader>r q:?^echom 'quickrepl'<CR><CR>
nnoremap <Leader>rp q:oechom 'quickrepl' \| call SplitPaneTest('bpython')<CR>
nnoremap <Leader>rn q:oechom 'quickrepl' \| call SplitPaneTest('node')<CR>
nnoremap <Leader>rc q:oechom 'quickrepl' \| call SplitPaneTest('clisp', 1)<CR>
" \c \v to copy/paste from xclip " \t = run last quicktest
" @TODO: learn how to freaking compile vim with x11 compatibility so these " t)ype new quicktest
" aren't necessary :) " e)dit last quicktest
nnoremap <Leader>t q:?^echom 'quicktest'<CR><CR>
nnoremap <Leader>tt q:oechom 'quicktest' \| call SplitPaneTest('')<ESC>F'i
nnoremap <Leader>te q:?^echom 'quicktest'<CR>
" ./utility.vim
nnoremap <Leader><Leader>w :call Sudowrite()<CR>
nnoremap <Leader><Leader>x :call MakeFileExecutable(0)<CR>
nnoremap <Leader><Leader>xx :call MakeFileExecutable(1)<CR>
" (c)opy / (p)aste from xclip
" TODO: learn how to compile vim with x11 compatibility and delete
vnoremap <Leader>c :w !xclip<CR><CR> vnoremap <Leader>c :w !xclip<CR><CR>
nnoremap <Leader>v o<esc>!!xclip -o<CR> nnoremap <Leader>v o<esc>!!xclip -o<CR>
nnoremap <Leader>sc :'<,'>w !xclip<CR><CR> nnoremap <Leader>sc :'<,'>w !xclip<CR><CR>
" ------- available / rarely used bindings ------- " --- available / rarely used bindings (personal reference) ---
" nnoremap <BS> " nnoremap <BS>
" nnoremap <C-t> " nnoremap <C-t>
@ -67,3 +80,4 @@ nnoremap <Leader>sc :'<,'>w !xclip<CR><CR>
" nnoremap ^ " nnoremap ^
" }}} " }}}
" ---------------------------------------------------------------------

View File

@ -19,11 +19,11 @@ function TmuxTest(shellCommand, paneId = g:defaultTmuxPaneId)
call system("tmux send-keys -t " . a:paneId . " 'clear; " . a:shellCommand . "' Enter") call system("tmux send-keys -t " . a:paneId . " 'clear; " . a:shellCommand . "' Enter")
endfunction endfunction
function SplitPaneTest(shellCommand, verticalSplit = 0) function SplitPaneTest(shellCommand, horizontal = v:false)
if a:verticalSplit if a:horizontal
execute "vertical terminal " . a:shellCommand execute "botright terminal " . a:shellCommand
else else
execute "terminal " . a:shellCommand execute "botright vertical terminal " . a:shellCommand
endif endif
endfunction endfunction
@ -41,9 +41,9 @@ function DjangoTmuxTest(paneId = g:defaultTmuxPaneId)
call TmuxTest(l:command, a:paneId) call TmuxTest(l:command, a:paneId)
endfunction endfunction
function DjangoSplitTest(verticalSplit = 0) function DjangoSplitTest(horizontal = v:false)
let l:command = GetDjangoTestCommand() let l:command = GetDjangoTestCommand()
call SplitPaneTest(l:command, a:verticalSplit) call SplitPaneTest(l:command, a:horizontal)
endfunction endfunction
function DjangoTest() function DjangoTest()
@ -85,7 +85,7 @@ function DotnetBuild()
call TmuxTest(l:command) call TmuxTest(l:command)
endfunction endfunction
function GetDotnetProjectLocation(test = 0) function GetDotnetProjectLocation(test = v:false)
let l:projectRoot = substitute(expand(getcwd()), '/code.*', '/code', '') let l:projectRoot = substitute(expand(getcwd()), '/code.*', '/code', '')
let l:projectName = substitute(expand(getcwd()), l:projectRoot . '/\([^/]*\).*', '\1', '') let l:projectName = substitute(expand(getcwd()), l:projectRoot . '/\([^/]*\).*', '\1', '')
if a:test if a:test
@ -109,9 +109,9 @@ function NpmTmuxTest(paneId = g:defaultTmuxPaneId)
call TmuxTest(l:command, a:paneId) call TmuxTest(l:command, a:paneId)
endfunction endfunction
function NpmSplitTest(verticalSplit = 0) function NpmSplitTest(horizontal = v:false)
let l:command = GetNpmTestCommand() let l:command = GetNpmTestCommand()
call SplitPaneTest(l:command, a:verticalSplit) call SplitPaneTest(l:command, a:horizontal)
endfunction endfunction
function NpmTest() function NpmTest()

View File

@ -2,15 +2,10 @@ function Sudowrite()
execute 'w !sudo tee "%"' execute 'w !sudo tee "%"'
endfunction endfunction
nnoremap <Leader><Leader>w :call Sudowrite()<CR><CR>L function MakeFileExecutable(sudo = 0)
if a:sudo
function MakeFileExecutable() execute '! sudo chmod +x "%"'
execute '! chmod +x "%"' else
execute '! chmod +x "%"'
endif
endfunction endfunction
nnoremap <Leader><Leader>x :call MakeFileExecutable()<CR><CR>L
" (<LEADER> + e + RC_PREFIX) for edit rc
nnoremap <Leader>ev :tabedit $WRYNVIMRC<CR>:NERDTreeToggle<CR>
nnoremap <Leader>sv :source $MYVIMRC<CR>
nnoremap <Leader>ez :tabedit $ZSHRC<CR>

View File

@ -1,6 +1,3 @@
" ===================================================================================
" === VUNDLE SETTINGS ===============================================================
" ===================================================================================
set nocompatible set nocompatible
filetype off filetype off
@ -8,52 +5,28 @@ set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin() call vundle#begin()
Plugin 'VundleVim/Vundle.vim' Plugin 'VundleVim/Vundle.vim'
" <======================================================> " --- installed plugins -----------------------------------------------
" <==== Insert plugins here =============================> " {{{
" tpope/surround
Plugin 'tpope/vim-surround' Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
" nerdtree
Plugin 'https://github.com/scrooloose/nerdtree.git' Plugin 'https://github.com/scrooloose/nerdtree.git'
" go-vim
Plugin 'fatih/vim-go' Plugin 'fatih/vim-go'
" youCompleteMe
Plugin 'https://github.com/Valloric/YouCompleteMe.git' Plugin 'https://github.com/Valloric/YouCompleteMe.git'
" omnisharp (c#)
Plugin 'OmniSharp/omnisharp-vim'
" ale -- asynchronus error checking
Plugin 'https://github.com/w0rp/ale' Plugin 'https://github.com/w0rp/ale'
" }}}
" <======================================================> " ---------------------------------------------------------------------
" <======================================================>
call vundle#end() call vundle#end()
filetype plugin indent on filetype plugin indent on
" To ignore plugin indent changes, instead use:
" filetype plugin on
" :PluginList - lists configured plugins " --- plugin configuration --------------------------------------------
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate " {{{
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
" see :h vundle for more details or wiki for FAQ " scrooloose/nerdtree
" ===================================================================================
" === PLUGIN-SPECIFIC SETTINGS ======================================================
" ===================================================================================
" --- Nerd Tree ---------------------------------------------------------------------
nnoremap <C-o> :NERDTreeToggle %<CR> nnoremap <C-o> :NERDTreeToggle %<CR>
let g:NERDTreeNodeDelimiter = "\u00a0" " -- Was seeing ^G character, and this should fix that let g:NERDTreeNodeDelimiter = "\u00a0" " -- Was seeing ^G character, and this should fix that
" --- YouCompleteMe ----------------------------------------------------------------- " Valloric/YouCompleteMe
function! ToggleYCM() function! ToggleYCM()
if g:ycm_auto_trigger if g:ycm_auto_trigger
let g:ycm_auto_trigger = 0 let g:ycm_auto_trigger = 0
@ -64,8 +37,6 @@ function! ToggleYCM()
endif endif
endfunction endfunction
" uncomment to deactivate by default
" let g:ycm_auto_trigger=0
let g:ycm_autoclose_preview_window_after_insertion = 1 let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_goto_buffer_command = 'new-tab' let g:ycm_goto_buffer_command = 'new-tab'
@ -73,7 +44,7 @@ nnoremap <S-y> :call ToggleYCM()<CR>
nnoremap gd :YcmCompleter GoToDefinition<CR> nnoremap gd :YcmCompleter GoToDefinition<CR>
" --- ALE --------------------------------------------------------------------------- " w0ryn/ale
let g:ale_linters = { let g:ale_linters = {
\ 'cs' : ['OmniSharp'], \ 'cs' : ['OmniSharp'],
\ 'python' : ['pylint'], \ 'python' : ['pylint'],
@ -87,9 +58,13 @@ let g:ale_sign_column_always = 1
nmap <Leader>ae <Plug>(ale_next) nmap <Leader>ae <Plug>(ale_next)
nmap <Leader>ar <Plug>(ale_previous) nmap <Leader>ar <Plug>(ale_previous)
" --- vim-go ------------------------------------------------------------------------
" fatih/vim-go
let g:go_imports_autosave = 0 let g:go_imports_autosave = 0
let g:go_def_mapping_enabled = 0 let g:go_def_mapping_enabled = 0
let g:go_fmt_fail_silently = 1 let g:go_fmt_fail_silently = 1
let g:go_def_reuse_buffer = 1 let g:go_def_reuse_buffer = 1
let g:go_textobj_enabled = 0 let g:go_textobj_enabled = 0
" }}}
" ---------------------------------------------------------------------