From d4593cea51f46f84caeaff3013bca3d9cc5eff97 Mon Sep 17 00:00:00 2001 From: Ian Keane Date: Fri, 10 Jul 2020 14:05:02 -0400 Subject: [PATCH] Reconciled differences btwn win and linux vimrcs --- vim/.vimrc | 172 ++++++++++++++++++++++++++++++++++++++--------------- vim/_vimrc | 6 +- 2 files changed, 128 insertions(+), 50 deletions(-) diff --git a/vim/.vimrc b/vim/.vimrc index 9de3cc6..1752b55 100755 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -29,17 +29,17 @@ " Plug 'kovisoft/paredit' Plug 'sainnhe/vim-color-forest-night' Plug 'justinmk/vim-sneak' - Plug 'christoomey/vim-tmux-navigator' - Plug 'ap/vim-css-color' - Plug 'dylanaraps/wal.vim' - Plug 'sjl/tslime.vim' - " TODO setup - Plug 'roxma/vim-tmux-clipboard' - " TODO setup - Plug 'melonmanchan/vim-tmux-resizer' - " Plug 'roman/golden-ratio' + Plug 'axvr/zepl.vim' Plug 'kovisoft/slimv' - + Plug 'tpope/vim-vinegar' + Plug 'preservim/nerdtree' + Plug 'vimwiki/vimwiki' + Plug 'simnalamburt/vim-mundo' + Plug 'tpope/vim-dadbod' + Plug 'junegunn/gv.vim' + Plug 'rbong/vim-flog' + Plug 'tpope/vim-unimpaired' + " Todo: " GV " Gundo (or undotree?) @@ -60,7 +60,6 @@ "}}} " appearance {{{ - colorscheme zenburn " colorscheme wal syntax on " Enable syntax @@ -78,9 +77,16 @@ hi CursorLineNr cterm=bold " Lightline - let g:lightline = { 'colorscheme': 'sceaduhelm', } + let g:lightline = { 'colorscheme': 'sceaduhelm' } set fillchars+=vert:│ + command! LightlineReload call LightlineReload() + + function! LightlineReload() + call lightline#init() + call lightline#colorscheme() + call lightline#update() + endfunction " }}} " Movement {{{ @@ -107,12 +113,12 @@ set updatetime=100 " Make updates happen faster (gitgutter) set splitright " Make split to right by default set winheight=30 " Soft minimum window height (active) - set winminheight=10 " Hard minimum window height (inactive) - set winwidth=80 " Window width for current window + "set winminheight=10 " Hard minimum window height (inactive) + set winwidth=85 " Window width for current window set winminwidth=30 " Hard minimum for window width - set timeoutlen=1000 - set ttimeoutlen=0 - + set t_vb= " No visual bell ever + let g:sneak#use_ic_scs=1 + set virtualedit=block "}}} " searching {{{ @@ -125,10 +131,6 @@ " Nnoremap % " Vnoremap % " Remap tab to jump by window - nnoremap :tabn - vnoremap :tabn - nnoremap :tabp - vnoremap :tabp "}}} @@ -151,10 +153,10 @@ "}}} " long line handling {{{ - set textwidth=79 - set fo=t + " set textwidth=79 + " set fo=t " set colorcolumn=85 -" + "}}} " leaders {{{ @@ -198,7 +200,7 @@ nnoremap k gk "}}} -" + " slimv{{{ let g:slimv_repl_split=2 let g:slimv_repl_split_size=10 @@ -208,7 +210,7 @@ " split pane navigation {{{ " Map vertical split to \ w, switch to it, open explorer, prompt for filename " TODO: make new window prompt use fzf - nnoremap w vl:e open + " nnoremap w vl:e open " Switch panes wit ctrl + h/j/k/l nnoremap h nnoremap j @@ -216,11 +218,16 @@ nnoremap l nnoremap :close nnoremap :bn - nnoremap :bd - " Map resize pane + " Term mode + tnoremap h + tnoremap j + tnoremap k + tnoremap l + tnoremap :close + tnoremap :bn + tnoremap + " TODO: remap pane resize to something else (leader?) - map + :vertical resize +5 - map - :vertical resize -5 " quick-scope " Trigger a highlight in the appropriate direction when pressing these keys: let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] @@ -231,10 +238,7 @@ autocmd ColorScheme * highlight QuickScopeSecondary guifg='#5fffff' gui=underline ctermfg=81 cterm=underline augroup END -"}}} - -" launch love game, check youtube love2d roguelike+rpg day 1 if broken {{{ - " map ,t :! /Applications/love.app/Contents/MacOS/love . + nnoremap gt "}}} @@ -298,7 +302,7 @@ nmap ga (EasyAlign) "}}} -" + " git commands {{{ " TODO: map fugitive commands " TODO: check out gv etc @@ -312,23 +316,93 @@ set diffopt=vertical "}}} -" plugin modification {{{ -" +" fold search {{{ + +" command to fold everything except what you searched for + command! -nargs=* Fs + \ if != '' | + \ exe "normal /".."\" | + \ endif | + \ if @/ != '' | + \ setlocal + \ foldexpr=FoldRegex(v:lnum,@/,2) + \ foldmethod=expr + \ foldlevel=0 | + \ endif + + function! FoldRegex(lnum,pat,context) + " get start/end positions for context lines + let startline=a:lnum-a:context + while startline < 1 + let startline+=1 + endwhile + let endline=a:lnum+a:context + while endline > line('$') + let endline-=1 + endwhile + + let returnval = 2 + + let pos=getpos('.') + + " search from current line to get matches ON the line + call cursor(a:lnum, 1) + let matchline=search(a:pat,'cW',endline) + if matchline==a:lnum + let returnval = 0 + elseif matchline > 0 + " if current line didn't match, there could have been a match within + " trailing context lines + let returnval = 1 + else + " if no match at current line, search leading context lines for a match + call cursor(startline, 1) + let matchline=search(a:pat,'cW',a:lnum) + if matchline > 0 + let returnval = 1 + endif + endif + + call setpos('.',pos) + + return returnval + endfun + +" }}} + +" copy matches {{{ + +function! CopyMatches(reg) + let hits = [] + %s//\=len(add(hits, submatch(0))) ? submatch(0) : ''/gne + let reg = empty(a:reg) ? '+' : a:reg + execute 'let @'.reg.' = join(hits, "\n") . "\n"' +endfunction +command! -register CopyMatches call CopyMatches() + +" }}} + +" vimrc {{{ + " source $MYVIMRC reloads the saved $MYVIMRC + :nmap s :source $MYVIMRC + + " opens $MYVIMRC for editing, or use :tabedit $MYVIMRC + :nmap v :e $MYVIMRC "}}} -" gvim {{{ - set guioptions=Ace - -"}}} - -" tmux {{{ - " tslime - let g:tslime_ensure_trailing_newlines = 1 - let g:tslime_ensure_trailing_newlines = 1 - let g:tslime_normal_mapping = 't' - let g:tslime_visual_mapping = 't' - let g:tslime_vars_mapping = 'T' +" zepl {{{ + augroup zepl + autocmd! + autocmd FileType python let b:repl_config = { 'cmd': 'python3' } + autocmd FileType javascript let b:repl_config = { 'cmd': 'python3' } + autocmd FileType clojure let b:repl_config = { 'cmd': 'clj' } + autocmd FileType scheme let b:repl_config = { 'cmd': 'rlwrap csi' } + autocmd FileType lisp let b:repl_config = { 'cmd': 'sbcl' } + autocmd FileType julia let b:repl_config = { 'cmd': 'julia' } + " autocmd FileType cs let b:repl_config = { 'cmd': '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"' } + autocmd FileType cs let b:repl_config = { 'cmd': 'cmd' } + augroup END "}}} " TODO: rebind c-n diff --git a/vim/_vimrc b/vim/_vimrc index 754cb15..a55929e 100644 --- a/vim/_vimrc +++ b/vim/_vimrc @@ -174,6 +174,7 @@ nnoremap d k :r !date nnoremap k :vert new ~/.vim/bindings.md + tnoremap "}}} @@ -313,7 +314,8 @@ nmap ghn (GitGutterNextHunk) nmap ghp (GitGutterPrevHunk) nmap ghf (GitGutterFold) - + " Controls fugitive diff split direction + set diffopt=vertical "}}} " fold search {{{ @@ -412,6 +414,8 @@ command! -register CopyMatches call CopyMatches() augroup END "}}} +" TODO: rebind c-n +" TODO: change ,k to ,n and add notes to version control " folding options, this must be last in file " vim:foldmethod=marker:foldlevel=0