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
" transparent background
highlight Normal guibg=NONE ctermbg=NONE
highlight SpellBad ctermbg=NONE ctermfg=red
highlight LineNr ctermfg=yellow
highlight Normal guibg=NONE ctermbg=NONE
highlight SpellBad ctermbg=NONE ctermfg=red
highlight LineNr ctermfg=yellow
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)
let &l:tabstop = 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 json call FormatFileType(2, v:false, 'indent', 99, v:false)
augroup end
let g:markdown_fenced_languages = ['javascript', 'json', 'python', 'bash', 'yaml', 'shell=zsh']
" }}}
" -- <Leader>ec to 'ExeCute' a file ---------------------- {{{
augroup execute_file_shortcuts
autocmd FileType tex nnoremap <Leader>ec :! pdf=$(grep -rl 'documentclass' ./ <bar> head -n 1 <bar> sed 's/\(.*\)\.tex/\1.pdf/'); $WEBBROWSER $pdf<CR>
autocmd FileType markdown nnoremap <Leader>ec :! $WEBBROWSER %:p<CR>
autocmd FileType go nnoremap <Leader>ec :!clear<CR><CR>q:?GoRun<CR><CR>
" --- (e)xe(c)ute -----------------------------------------------------
" (i)nteractive
" (b)uild
" auto-(f)ormat
" (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
" }}}
" -- Miscellaneous File-specific Commands ---------------- {{{
augroup latex_commands
" --- organization overrides ------------------------------------------
" {{{
" overwrite the <leader>t 'test' to (double) recompile the latex document.
" in case pdflatex gets in a stuck state, it is run through timeout 3
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>
source $WRYNVIMPATH/override/rentdynamics.vim
source $WRYNVIMPATH/override/directus.vim
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-h> gT
nnoremap <S-t> <C-w>T
" (CTRL + DIRECTION) for panes
" (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/p) for files
" (ctrl + n/p) for buffers
nnoremap <C-n> :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/testing.vim
source $WRYNVIMPATH/formatting.vim
source $WRYNVIMPATH/abbreviations.vim
source $WRYNVIMPATH/navigation.vim
source $WRYNVIMPATH/color.vim
source $WRYNVIMPATH/utility.vim
" -- Bindings --------------------------------------------------- {{{
" ---------------------------------------------------------------------
" {{{
" <SPACE> to execute macro on 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
vnoremap Q !$SHELL<CR>
nnoremap Q !!$SHELL<CR>
" \q for `q:`
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
" move the current line down/up one
nnoremap - :move +1 <CR>
nnoremap _ :move -2 <CR>
" \t for rerun last 'vimtest' command:
nnoremap <Leader>t q:?vimtest<CR><CR>
" \j like J, but append current line to the line below
nnoremap <Leader>j ddpkJ
" \b for git blame
nnoremap <Leader>b :set termwinsize=15*0<BAR>:execute "terminal git blame -L " .eval(line(".")-5) . ",+10 %"<BAR>:set termwinsize&<CR>
" \d insert formatted date below
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
nnoremap <Leader>di :let @d = system("date '+%A, %B %-d, %Y'")<CR>i<C-r>d<BS> <esc>
nnoremap <Leader>da :let @d = system("date '+%A, %B %-d, %Y'")<CR>a <C-r>d<BS><esc>
" \g git fugitive shortcuts
nnoremap <Leader>gb :Git blame<CR>
" - toggle casing for current word
inoremap <C-u> <esc>viw~ea
" \r = open last REPL (p)ython (n)odejs (c)lisp
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
" @TODO: learn how to freaking compile vim with x11 compatibility so these
" aren't necessary :)
" \t = run last quicktest
" t)ype new quicktest
" 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>
nnoremap <Leader>v o<esc>!!xclip -o<CR>
nnoremap <Leader>sc :'<,'>w !xclip<CR><CR>
" ------- available / rarely used bindings -------
" --- available / rarely used bindings (personal reference) ---
" nnoremap <BS>
" nnoremap <C-t>
@ -67,3 +80,4 @@ nnoremap <Leader>sc :'<,'>w !xclip<CR><CR>
" 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")
endfunction
function SplitPaneTest(shellCommand, verticalSplit = 0)
if a:verticalSplit
execute "vertical terminal " . a:shellCommand
function SplitPaneTest(shellCommand, horizontal = v:false)
if a:horizontal
execute "botright terminal " . a:shellCommand
else
execute "terminal " . a:shellCommand
execute "botright vertical terminal " . a:shellCommand
endif
endfunction
@ -41,9 +41,9 @@ function DjangoTmuxTest(paneId = g:defaultTmuxPaneId)
call TmuxTest(l:command, a:paneId)
endfunction
function DjangoSplitTest(verticalSplit = 0)
function DjangoSplitTest(horizontal = v:false)
let l:command = GetDjangoTestCommand()
call SplitPaneTest(l:command, a:verticalSplit)
call SplitPaneTest(l:command, a:horizontal)
endfunction
function DjangoTest()
@ -85,7 +85,7 @@ function DotnetBuild()
call TmuxTest(l:command)
endfunction
function GetDotnetProjectLocation(test = 0)
function GetDotnetProjectLocation(test = v:false)
let l:projectRoot = substitute(expand(getcwd()), '/code.*', '/code', '')
let l:projectName = substitute(expand(getcwd()), l:projectRoot . '/\([^/]*\).*', '\1', '')
if a:test
@ -109,9 +109,9 @@ function NpmTmuxTest(paneId = g:defaultTmuxPaneId)
call TmuxTest(l:command, a:paneId)
endfunction
function NpmSplitTest(verticalSplit = 0)
function NpmSplitTest(horizontal = v:false)
let l:command = GetNpmTestCommand()
call SplitPaneTest(l:command, a:verticalSplit)
call SplitPaneTest(l:command, a:horizontal)
endfunction
function NpmTest()

View File

@ -2,15 +2,10 @@ function Sudowrite()
execute 'w !sudo tee "%"'
endfunction
nnoremap <Leader><Leader>w :call Sudowrite()<CR><CR>L
function MakeFileExecutable()
execute '! chmod +x "%"'
function MakeFileExecutable(sudo = 0)
if a:sudo
execute '! sudo chmod +x "%"'
else
execute '! chmod +x "%"'
endif
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
filetype off
@ -8,52 +5,28 @@ set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" <======================================================>
" <==== Insert plugins here =============================>
" tpope/surround
" --- installed plugins -----------------------------------------------
" {{{
Plugin 'tpope/vim-surround'
" nerdtree
Plugin 'tpope/vim-fugitive'
Plugin 'https://github.com/scrooloose/nerdtree.git'
" go-vim
Plugin 'fatih/vim-go'
" youCompleteMe
Plugin 'https://github.com/Valloric/YouCompleteMe.git'
" omnisharp (c#)
Plugin 'OmniSharp/omnisharp-vim'
" ale -- asynchronus error checking
Plugin 'https://github.com/w0rp/ale'
" <======================================================>
" <======================================================>
" }}}
" ---------------------------------------------------------------------
call vundle#end()
filetype plugin indent on
" To ignore plugin indent changes, instead use:
" filetype plugin on
" :PluginList - lists configured plugins
" :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
" --- plugin configuration --------------------------------------------
" {{{
" see :h vundle for more details or wiki for FAQ
" ===================================================================================
" === PLUGIN-SPECIFIC SETTINGS ======================================================
" ===================================================================================
" --- Nerd Tree ---------------------------------------------------------------------
" scrooloose/nerdtree
nnoremap <C-o> :NERDTreeToggle %<CR>
let g:NERDTreeNodeDelimiter = "\u00a0" " -- Was seeing ^G character, and this should fix that
" --- YouCompleteMe -----------------------------------------------------------------
" Valloric/YouCompleteMe
function! ToggleYCM()
if g:ycm_auto_trigger
let g:ycm_auto_trigger = 0
@ -64,8 +37,6 @@ function! ToggleYCM()
endif
endfunction
" uncomment to deactivate by default
" let g:ycm_auto_trigger=0
let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_goto_buffer_command = 'new-tab'
@ -73,7 +44,7 @@ nnoremap <S-y> :call ToggleYCM()<CR>
nnoremap gd :YcmCompleter GoToDefinition<CR>
" --- ALE ---------------------------------------------------------------------------
" w0ryn/ale
let g:ale_linters = {
\ 'cs' : ['OmniSharp'],
\ 'python' : ['pylint'],
@ -87,9 +58,13 @@ let g:ale_sign_column_always = 1
nmap <Leader>ae <Plug>(ale_next)
nmap <Leader>ar <Plug>(ale_previous)
" --- vim-go ------------------------------------------------------------------------
" fatih/vim-go
let g:go_imports_autosave = 0
let g:go_def_mapping_enabled = 0
let g:go_fmt_fail_silently = 1
let g:go_def_reuse_buffer = 1
let g:go_textobj_enabled = 0
" }}}
" ---------------------------------------------------------------------