diff --git a/vim/abbreviations.vim b/vim/abbreviations.vim deleted file mode 100644 index d477e9e..0000000 --- a/vim/abbreviations.vim +++ /dev/null @@ -1,16 +0,0 @@ -iabbrev @@ wagner.wryn@gmail.com -iabbrev ssig -----------------------Wryn Wagnerwagner.wryn@gmail.com(720)557-5443----------------------- - -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) {} -" }}} - -" -- markdown ---------------------------------------- {{{ -iabbrev termdef ## Terms and DefinitionsTerm \| Definition--- \| --- -" }}} diff --git a/vim/color.vim b/vim/color.vim index 001c4fb..27a6c77 100644 --- a/vim/color.vim +++ b/vim/color.vim @@ -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 diff --git a/vim/formatting.vim b/vim/formatting.vim index d047404..57def4b 100644 --- a/vim/formatting.vim +++ b/vim/formatting.vim @@ -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'] " }}} -" -- ec to 'ExeCute' a file ---------------------- {{{ -augroup execute_file_shortcuts - autocmd FileType tex nnoremap ec :! pdf=$(grep -rl 'documentclass' ./ head -n 1 sed 's/\(.*\)\.tex/\1.pdf/'); $WEBBROWSER $pdf - autocmd FileType markdown nnoremap ec :! $WEBBROWSER %:p - autocmd FileType go nnoremap ec :!clearq:?GoRun +" --- (e)xe(c)ute ----------------------------------------------------- +" (i)nteractive +" (b)uild +" auto-(f)ormat +" (t)ests +" {{{ +augroup file_specific_command_overrides + nnoremap ec :call SplitPaneTest('%:p', v:true) + nnoremap ei :echohl ErrorMsg echom 'ERROR: no interactive execute defined' echohl None + nnoremap eb :echohl ErrorMsg echom 'ERROR: no build steps defined' echohl None + nnoremap ef :echohl ErrorMsg echom 'ERROR: no auto-format steps defined' echohl None + nnoremap et :echohl ErrorMsg echom 'ERROR: no test steps defined' echohl None + + autocmd FileType tex nnoremap ec :! scwrypts -n latex/open-pdf -- %:p + autocmd FileType tex nnoremap eb :! scwrypts -n latex/build-pdf -- %:p + autocmd FileType tex nnoremap ef :! scwrypts -n latex/cleanup -- %:p + + autocmd FileType markdown nnoremap ec :! $WEBBROWSER %:p + + autocmd FileType go nnoremap ec :!clearq:?GoRun + autocmd FileType go nnoremap ef (go-imports) + autocmd FileType go nnoremap gd (go-def-tab) + + autocmd FileType python nnoremap ec :call SplitPaneTest('bpython %') + autocmd FileType python nnoremap ei :call SplitPaneTest('bpython -qi %') augroup end " }}} -" -- Miscellaneous File-specific Commands ---------------- {{{ -augroup latex_commands +" --- organization overrides ------------------------------------------ +" {{{ - " overwrite the 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 t :! clear; texfile=$(grep -rl 'documentclass' ./ head -n 1); timeout 3 pdflatex -synctex=0 $texfile && { clear; pdflatex $texfile lolcat } +source $WRYNVIMPATH/override/rentdynamics.vim +source $WRYNVIMPATH/override/directus.vim -augroup end - -augroup go_commands - autocmd FileType go nmap ef (go-imports) - autocmd FileType go nmap gd (go-def-tab) -augroup end -" }}} - - -" -- Format Override Layers ------------------------------ {{{ -source $WRYNVIMPATH/rentdynamics.vim " }}} diff --git a/vim/navigation.vim b/vim/navigation.vim index fc776b0..b9e33a0 100644 --- a/vim/navigation.vim +++ b/vim/navigation.vim @@ -1,15 +1,21 @@ -" (SHIFT + DIRECTION) for tabs +" (shift + direction) for tabs nnoremap gt nnoremap gT nnoremap T -" (CTRL + DIRECTION) for panes +" (ctrl + direction) for panes nnoremap l nnoremap h nnoremap j nnoremap k -" (CTRL + n/p) for files +" (ctrl + n/p) for buffers nnoremap :n nnoremap :N + +" flip (gf) / (ctrl+w gf) bindings +nnoremap gf gf +vnoremap gf gf +nnoremap gf gf +vnoremap gf gf diff --git a/vim/override/directus.vim b/vim/override/directus.vim new file mode 100644 index 0000000..451d74a --- /dev/null +++ b/vim/override/directus.vim @@ -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 diff --git a/vim/rentdynamics.vim b/vim/override/rentdynamics.vim similarity index 100% rename from vim/rentdynamics.vim rename to vim/override/rentdynamics.vim diff --git a/vim/rc.vim b/vim/rc.vim index c2ccca7..717ac8c 100644 --- a/vim/rc.vim +++ b/vim/rc.vim @@ -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 --------------------------------------------------- {{{ +" --------------------------------------------------------------------- +" {{{ " to execute macro on q nnoremap @q +" \q for `q:` +nnoremap q q: + +" \f for fold +nnoremap f z + +" \s previous selection command +nnoremap s :'<,'> + +" (e)dit / (s)ource vimrc +nnoremap ev :tabedit $WRYNVIMRC +nnoremap sv :source $MYVIMRC + " Q to replace current line/selection with bash execution vnoremap Q !$SHELL nnoremap Q !!$SHELL -" \q for `q:` -nnoremap q q: - -" \s previous selection command -nnoremap s :'<,'> - -" \f for fold -nnoremap f z -nnoremap f z - -" \j for J, but append current line to the line below -nnoremap j ddpkJ - -" move the current line one below where it is +" move the current line down/up one nnoremap - :move +1 nnoremap _ :move -2 -" \t for rerun last 'vimtest' command: -nnoremap t q:?vimtest +" \j like J, but append current line to the line below +nnoremap j ddpkJ -" \b for git blame -nnoremap b :set termwinsize=15*0:execute "terminal git blame -L " .eval(line(".")-5) . ",+10 %":set termwinsize& +" \d insert formatted date below +nnoremap d :let @d = system("date '+%A, %B %-d, %Y'")od -" \d to insert formatted date before/after cursor -nnoremap di :let @d = system("date '+%A, %B %-d, %Y'")id -nnoremap da :let @d = system("date '+%A, %B %-d, %Y'")a d +" \g git fugitive shortcuts +nnoremap gb :Git blame -" - toggle casing for current word -inoremap viw~ea +" \r = open last REPL (p)ython (n)odejs (c)lisp +nnoremap r q:?^echom 'quickrepl' +nnoremap rp q:oechom 'quickrepl' \| call SplitPaneTest('bpython') +nnoremap rn q:oechom 'quickrepl' \| call SplitPaneTest('node') +nnoremap rc q:oechom 'quickrepl' \| call SplitPaneTest('clisp', 1) -" \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 t q:?^echom 'quicktest' +nnoremap tt q:oechom 'quicktest' \| call SplitPaneTest('')F'i +nnoremap te q:?^echom 'quicktest' + +" ./utility.vim +nnoremap w :call Sudowrite() +nnoremap x :call MakeFileExecutable(0) +nnoremap xx :call MakeFileExecutable(1) + +" (c)opy / (p)aste from xclip +" TODO: learn how to compile vim with x11 compatibility and delete vnoremap c :w !xclip nnoremap v o!!xclip -o nnoremap sc :'<,'>w !xclip -" ------- available / rarely used bindings ------- +" --- available / rarely used bindings (personal reference) --- " nnoremap " nnoremap @@ -67,3 +80,4 @@ nnoremap sc :'<,'>w !xclip " nnoremap ^ " }}} +" --------------------------------------------------------------------- diff --git a/vim/testing.vim b/vim/testing.vim index ca365c6..214c2ad 100644 --- a/vim/testing.vim +++ b/vim/testing.vim @@ -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() diff --git a/vim/utility.vim b/vim/utility.vim index 4a8f300..5ce4749 100644 --- a/vim/utility.vim +++ b/vim/utility.vim @@ -2,15 +2,10 @@ function Sudowrite() execute 'w !sudo tee "%"' endfunction -nnoremap w :call Sudowrite()L - -function MakeFileExecutable() - execute '! chmod +x "%"' +function MakeFileExecutable(sudo = 0) + if a:sudo + execute '! sudo chmod +x "%"' + else + execute '! chmod +x "%"' + endif endfunction - -nnoremap x :call MakeFileExecutable()L - -" ( + e + RC_PREFIX) for edit rc -nnoremap ev :tabedit $WRYNVIMRC:NERDTreeToggle -nnoremap sv :source $MYVIMRC -nnoremap ez :tabedit $ZSHRC diff --git a/vim/vundle.vim b/vim/vundle.vim index abeea37..8185deb 100644 --- a/vim/vundle.vim +++ b/vim/vundle.vim @@ -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 :NERDTreeToggle % 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 :call ToggleYCM() nnoremap gd :YcmCompleter GoToDefinition -" --- ALE --------------------------------------------------------------------------- +" w0ryn/ale let g:ale_linters = { \ 'cs' : ['OmniSharp'], \ 'python' : ['pylint'], @@ -87,9 +58,13 @@ let g:ale_sign_column_always = 1 nmap ae (ale_next) nmap ar (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 + +" }}} +" ---------------------------------------------------------------------