From 00aca34e560409596c9cfcaa4fa8b9cb8c9fa16a Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Tue, 31 Dec 2019 00:37:09 -0500 Subject: [PATCH] Clean up vimrc --- vim/after/plugin/abolish.vim | 1 + vim/after/plugin/gitgutter.vim | 6 - vim/colors/campo-light.vim | 7 +- vim/templates/skeleton.plan | 2 +- vimrc | 408 ++++++++++++++------------------- 5 files changed, 178 insertions(+), 246 deletions(-) delete mode 100644 vim/after/plugin/gitgutter.vim diff --git a/vim/after/plugin/abolish.vim b/vim/after/plugin/abolish.vim index f45e832..c71f49f 100644 --- a/vim/after/plugin/abolish.vim +++ b/vim/after/plugin/abolish.vim @@ -9,3 +9,4 @@ Abolish kewyord keyword Abolish indentit{y,ies} identit{y,ies} Abolish indetit{y,ies} identit{y,ies} Abolish constnat constant +Abolish darw draw diff --git a/vim/after/plugin/gitgutter.vim b/vim/after/plugin/gitgutter.vim deleted file mode 100644 index 69ec987..0000000 --- a/vim/after/plugin/gitgutter.vim +++ /dev/null @@ -1,6 +0,0 @@ -if !exists(':GitGutter') - finish -endif - -" Disable realtime updates. -autocmd! gitgutter CursorHold,CursorHoldI diff --git a/vim/colors/campo-light.vim b/vim/colors/campo-light.vim index 20f4c8b..5594c87 100644 --- a/vim/colors/campo-light.vim +++ b/vim/colors/campo-light.vim @@ -21,6 +21,7 @@ let s:green = "409b1c" let s:aqua = "00897b" let s:blue = "3b5bb5" let s:purple = "673ab7" +let s:black = "000000" let s:window = "cfd8dc" let s:error_msg_background = s:background @@ -290,7 +291,7 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256 call X("Type", s:blue, "", "none") call X("Define", s:purple, "", "none") call X("Include", s:blue, "", "") - call X("Number", s:orange, "", "") + call X("Number", s:black, "", "") "call X("Ignore", "666666", "", "") " Custom TODO/NOTE colors @@ -345,7 +346,7 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256 call X("pythonDocstring", s:comment, "", "") call X("pythonBuiltinObj", s:red, "", "") call X("pythonBuiltinType", s:orange, "", "") - call X("pythonNumber", s:orange, "", "") + call X("pythonNumber", s:black, "", "") " Go Highlighting @@ -366,7 +367,7 @@ if has("gui_running") || &t_Co == 88 || &t_Co == 256 call X("javaScriptFunction", s:purple, "", "") call X("javaScriptConditional", s:purple, "", "") call X("javaScriptRepeat", s:purple, "", "") - call X("javaScriptNumber", s:orange, "", "") + call X("javaScriptNumber", s:black, "", "") call X("javaScriptMember", s:orange, "", "") " HTML Highlighting diff --git a/vim/templates/skeleton.plan b/vim/templates/skeleton.plan index d18876d..68b63fd 100644 --- a/vim/templates/skeleton.plan +++ b/vim/templates/skeleton.plan @@ -1,5 +1,5 @@ ---------------------------------------------- -Michael Campagnaro's plan for , 2018 +Michael Campagnaro's plan for , 2019 ---------------------------------------------- DO diff --git a/vimrc b/vimrc index e2414de..63daffe 100644 --- a/vimrc +++ b/vimrc @@ -1,7 +1,28 @@ +" @fixme i'm now experiencing end of file history more often after the big +" changes to this file. Coincidence? +" +" Check out https://stackoverflow.com/a/34253629 to change the cursor to a + " @incomplete check for mappings in terminus to verify they don't override anything I used. +" block or whatever depending on the mode. " @incomplete Move all leader definitions to the bottom, so that it's easier to see them. " @incomplete Add setup steps (plugins, cache setup, search tool, etc). -"Remove Menubar and Toolbar from gvim +"################################################################################################### +" +" The config is chopped up into sections. These are the headings, which you +" can use to quickly jump to a particular section: + +" #0. GLOBALS +" #1. PLUGINS +" #2. BASE CONFIG +" #3. PLUGIN CONFIGS +" #4. VISUALS +" #5. HELPER FUNCTIONS +" #6. PERSONAL +" +"################################################################################################### + +" Remove Menubar and Toolbar from gvim "set guioptions -=m "set guioptions -=T @@ -16,10 +37,10 @@ let s:uname = system("echo -n \"$(uname)\"") let s:vim_dir = $HOME . "/.vim" function! IsWindows() - if s:uname =~ "mingw" - return 1 - endif - return 0 + if s:uname =~ "mingw" + return 1 + endif + return 0 endfunction let mapleader="," @@ -27,7 +48,7 @@ let mapleader="," "################################################################ "################################################################ "################################################################ -" 0. GLOBALS +"#0. GLOBALS "################################################################ "################################################################ "################################################################ @@ -37,13 +58,12 @@ let s:default_bg = 'dark' let s:rainbow_theme = s:default_bg let g:quickfix_window_height = 16 " in rows -"----------------------------------------------------------------------------------------- - +"--------------------------------------------------------------------------------------------------- "################################################################ "################################################################ "################################################################ -" 1. PLUGINS +"#1. PLUGINS "################################################################ "################################################################ "################################################################ @@ -54,140 +74,102 @@ call plug#begin('~/.vim/plugged') " MISC "//////////////////////////////////////////////////////////////// -Plug 'bling/vim-airline' -Plug 'vim-scripts/AnsiEsc.vim' -Plug 'embear/vim-localvimrc' " Add a .lvimrc to a folder to override .vimrc config. -Plug 'tpope/vim-obsession' " Continuously updated session files -Plug 'tpope/vim-fugitive' " Git wrapper -Plug 'junegunn/goyo.vim' " Distraction-free mode with centered buffer -Plug 'sir-pinecone/vim-ripgrep' " Wrapper around ripgrep (must intall ripgrep first; use Rust: cargo install ripgrep) -Plug 'itchyny/vim-cursorword' " Underlines the word under the cursor -Plug 'airblade/vim-gitgutter' " See git diff in the gutter and stage/unstage hunks. -Plug 'ctrlpvim/ctrlp.vim' " Fuzzy file, buffer, mru, tag, etc finder +Plug 'bling/vim-airline' " Enhanced status/tabline. +Plug 'embear/vim-localvimrc' " Add a .lvimrc to a folder to override .vimrc config. +Plug 'tpope/vim-obsession' " Continuously updated session files (tracks window positions, open folds, etc). +Plug 'tpope/vim-fugitive' " Git wrapper (I particularly like :Gblame, which I've wrapped as :Blame) +Plug 'junegunn/goyo.vim' " Distraction-free mode with centered buffer. +Plug 'sir-pinecone/vim-ripgrep' " Fast grep-like search. Requires ripgrep; install Rust package: `cargo install ripgrep`. +Plug 'itchyny/vim-cursorword' " Underlines all instances of the symbol under the cursor. +Plug 'airblade/vim-gitgutter' " Displays a git diff in the vim gutter and allows staging/unstaging of hunks. +Plug 'ctrlpvim/ctrlp.vim' " Fuzzy file, buffer, mru, tag, etc finder. +Plug 'majutsushi/tagbar' " Display ctags in a window, ordered by scope. +Plug 'tommcdo/vim-lion' " For text alignment, use gl= and gL= +Plug 'tpope/tpope-vim-abolish' " Easily search for, substitute, and abbreviate multiple variants of a word. Add them to `vim/after/plugin/abolish.vim` +Plug 'vim-scripts/AnsiEsc.vim' " Ansi escape sequences concealed, but highlighted as specified. +Plug 'tommcdo/vim-kangaroo' " Maintain a manually-defined jump stack. Set with zp or a and pop with zP or aa. +Plug 'mh21/errormarker.vim' " Build error highlighting (requires skywind3000/asyncrun.vim). +Plug 'skywind3000/asyncrun.vim' " Async commands. +Plug 'nelstrom/vim-qargs' " For the GlobalReplaceIt function (i.e. search and replace). +" @fixme Disable the file reloading. Plug 'wincent/terminus' " Enhanced terminal integration for Vim (namely iTerm). Changes the cursor depending on the mode; enhanced pasting; file reloading on external changes. if IsWindows() - Plug 'suxpert/vimcaps' " Disable capslock (useful if the OS isn't configured to do so) + Plug 'suxpert/vimcaps' " Disable capslock (useful if the OS isn't configured to do so). else - Plug 'Shougo/vimproc.vim', {'do' : 'make'} - Plug 'itchyny/dictionary.vim' " A way to query dictionary.com with :Dictionary + " Fuzzy search + " @incomplete Test out ctrlp for non-Windows setup. + Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } + Plug 'junegunn/fzf.vim' - " Fuzzy search - Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } - Plug 'junegunn/fzf.vim' + " @fixme Doesn't do anything under Windows... + Plug 'ervandew/supertab' " Improved autocompletion. endif -Plug 'majutsushi/tagbar' -Plug 'jeetsukumaran/vim-filesearch' -Plug 'rking/ag.vim' -Plug 'nelstrom/vim-qargs' " For search and replace -Plug 'tommcdo/vim-lion' " For text alignment, use gl= and gL= - -" Easily search for, substitute, and abbreviate multiple variants of a word -Plug 'tpope/tpope-vim-abolish' - -" Maintain a manually-defined jump stack. Set with zp and pop with zP -Plug 'tommcdo/vim-kangaroo' - -" Async commands + build error highlighting -Plug 'skywind3000/asyncrun.vim' -Plug 'mh21/errormarker.vim' - "/////////////////// " MAYBE SOME DAY "/////////////////// -"Plug 'shougo/unite.vim' " Create user interfaces. Not currently needed. -"Plug 'itchyny/vim-winfix' " Fix the focus and the size of windows in Vim -"Plug 'scrooloose/nerdcommenter' " Better commenting - -"/////////////////// -" DISABLED -"/////////////////// -" I don't think I need this anymore... -"Plug 'craigemery/vim-autotag' " Automatically discover and 'properly' update ctags files on save - -" Doesn't do anything on my Windows desktop... -"Plug 'ervandew/supertab' " For autocompletion +"Plug 'shougo/unite.vim' " Create user interfaces. Not currently needed. +"Plug 'itchyny/vim-winfix' " Fix the focus and the size of windows in Vim. +"Plug 'scrooloose/nerdcommenter' " Better commenting. "//////////////////////////////////////////////////////////////// " COLORS "//////////////////////////////////////////////////////////////// -Plug 'godlygeek/csapprox' " Try to make gvim themes look decent in Windows - -Plug 'sir-pinecone/rainbow' - -" WARNING: Has a lot of themes, but they break the other themes listed below -"Plug 'flazz/vim-colorschemes' +Plug 'sir-pinecone/rainbow' " Rainbow parens. +Plug 'godlygeek/csapprox' " Try to make gvim themes look decent in Windows +"Plug 'flazz/vim-colorschemes' " @warning: Has a lot of themes, but they break the other themes listed below Plug 'elixir-lang/vim-elixir' Plug 'vim-airline/vim-airline-themes' " Light Themes -Plug 'raggi/vim-color-raggi' " No Win support, unless using gvim -Plug 'LanFly/vim-colors' " No Win support, unless using gvim +Plug 'raggi/vim-color-raggi' " @note No Win support, unless using gvim. +Plug 'LanFly/vim-colors' " @note No Win support, unless using gvim. " Dark Themes -Plug 'rhysd/vim-color-spring-night' " No Win support, unless using gvim +Plug 'rhysd/vim-color-spring-night' " @note No Win support, unless using gvim. Plug 'nanotech/jellybeans.vim' Plug 'zcodes/vim-colors-basic' " Hybrid Themes Plug 'sickill/vim-monokai' Plug 'chmllr/elrodeo-vim-colorscheme' " A little dark on Windows, term -Plug 'reedes/vim-colors-pencil' " High-contrast +Plug 'reedes/vim-colors-pencil' " High-contrast " Seabird themes " High contrast: seagull (light), petrel (dark) " Low contrast: greygull (light), stormpetrel (dark) -Plug 'nightsense/seabird' " No Win support, unless using gvim +Plug 'nightsense/seabird' " @note No Win support, unless using gvim. +"////////////////////////////// +" SYNTAX HIGHLIGHTING +"////////////////////////////// -"//////////////////////////////////////////////////////////////// -" CLOJURE -"//////////////////////////////////////////////////////////////// -" Temporarily disabled since I'm not doing any Clojure work atm. +Plug 'tpope/vim-markdown' " Markdown +Plug 'octol/vim-cpp-enhanced-highlight' " C/C++ +Plug 'vim-ruby/vim-ruby' " Ruby +Plug 'fatih/vim-go' " Go +Plug 'rust-lang/rust.vim' " Rust +Plug 'peterhoeg/vim-qml' " QML +Plug 'jdonaldson/vaxe' " Haxe + +" Clojure -- Disabled since I'm not doing any Clojure work atm. "Plug 'tpope/vim-classpath' " For Java "Plug 'guns/vim-clojure-highlight' "Plug 'guns/vim-clojure-static' "Plug 'tpope/vim-fireplace', { 'for': 'clojure' } - -"//////////////////////////////////////////////////////////////// -" OTHER LANGUAGES -"//////////////////////////////////////////////////////////////// - -" Rust -Plug 'rust-lang/rust.vim' - -" Ruby -Plug 'vim-ruby/vim-ruby' - -" Go -Plug 'fatih/vim-go' - -" QML -Plug 'peterhoeg/vim-qml' - -" Markdown -Plug 'tpope/vim-markdown' -"Plug 'vim-pandoc/vim-pandoc-syntax' - -" C++ -Plug 'octol/vim-cpp-enhanced-highlight' - -" Haxe -Plug 'jdonaldson/vaxe' +"////////////////////////////// call plug#end() - filetype plugin indent on - -"----------------------------------------------------------------------------------------- +"--------------------------------------------------------------------------------------------------- "################################################################ "################################################################ "################################################################ -" 2. BASE CONFIG +"#2. BASE CONFIG "################################################################ "################################################################ "################################################################ @@ -196,7 +178,6 @@ filetype plugin indent on """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " BASIC EDITING CONFIGURATION """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" allow unsaved background buffers and remember marks/undo for them set hidden set history=10000 set expandtab @@ -205,24 +186,23 @@ set shiftwidth=4 set softtabstop=4 set autoindent set laststatus=2 -set showcmd " display incomplete commands +set showcmd " Display incomplete commands. set showmatch -set incsearch " Highlight matches as you type -set hlsearch " Highlight matches +set incsearch " Highlight matches as you type. +set hlsearch " Highlight matches. set dictionary+=/usr/share/dict/words -"set clipboard=unnamed " yank and paste with the system clipboard +"set clipboard=unnamed " Yank and paste with the system clipboard. set number -" make searches case-sensitive only if they contain upper-case characters -set ignorecase smartcase -set visualbell " No bell sounds +set ignorecase smartcase " Make searches case-sensitive only if they contain upper-case characters. +set visualbell " No bell sounds. set ttyfast -" highlight current line set cmdheight=2 set switchbuf=useopen,split set numberwidth=5 set showtabline=2 set winwidth=79 +" @warning: This must come AFTER `set ignorecase smartcase` otherwise vim spews out a ton of errors. No idea why! if IsWindows() " Just assume we don't have a zsh shell set shell=bash @@ -230,62 +210,47 @@ else set shell=zsh endif -" Prevent Vim from clobbering the scrollback buffer. See -" http://www.shallowsky.com/linux/noaltscreen.html -set t_ti= t_te= -" keep more context when scrolling off the end of a buffer -set scrolloff=3 - +set t_ti= t_te= " Prevent Vim from clobbering the scrollback buffer. See http://www.shallowsky.com/linux/noaltscreen.html +set scrolloff=3 " keep more context when scrolling off the end of a buffer set cursorline set cursorcolumn -" Store temporary files in a central spot +" Store temporary files in a central spot. Make sure these directories exist on disk. set backup set backupcopy=yes -set directory=X://tmp//vim// " For swap files +set directory=X://tmp//vim// " For swap files. set backupdir=X://tmp//vim// :au BufWritePre * let &bex = '.' . strftime("%Y-%m-%d-%T") . '.bak' set writebackup -" allow backspacing over everything in insert mode -set backspace=indent,eol,start +set backspace=indent,eol,start " Allow backspacing over everything in insert mode. -set complete+=kspell " Spell checking autocomplete. -set complete-=i " Don't scan all included files since it's really slow. +set complete+=kspell " Spell checking autocomplete. +set complete-=i " Don't scan all included files since it's really slow. + +syntax on " Enable highlighting for syntax -" Enable highlighting for syntax -syntax on -" Enable file type detection. -" Use the default filetype settings, so that mail gets 'tw' set to 72, -" 'cindent' is on in C files, etc. -" Also load indent files, to automatically do language-dependent indenting. -" use emacs-style tab completion when selecting files, etc set wildmenu set wildmode=longest,list,full set wildignore+=*/log/*,*.so,*.swp,*.zip,*/rdoc/* let &colorcolumn=s:max_line_length -" Requires ripgrep to be installed. -set grepprg=rg\ --vimgrep +set grepprg=rg\ --vimgrep " Requires ripgrep to be installed. -" Show trailing whitespace. -set list listchars=tab:»·,trail:· +set list listchars=tab:»·,trail:· " Show trailing whitespace. -" Adding this since the esc remap on the 'i' key had a long delay when pressed. -set timeoutlen=300 ttimeoutlen=0 +set timeoutlen=300 ttimeoutlen=0 " Adding this since the esc remap on the 'i' key had a long delay when pressed. -" Allow undo when doing back into a closed file -set undolevels=1000 +" @new might be broken: +" set updatetime=100 " I lowered this to make git-gutter updates faster. + +set undolevels=1000 " Allow undo when going back into a closed file set undoreload=10000 -" Keep undo history across sessions by storing it in a file +" Keep undo history across sessions by storing it in a file. if has('persistent_undo') let undo_dir = expand(s:vim_dir . '/undo') - " Create dirs - if IsWindows() - let mkdir = 'mkdir ' - else - let mkdir = 'mkdir -p ' - endif + " Create directory. + let mkdir = 'mkdir -p ' :silent call system(mkdir . s:vim_dir) :silent call system(mkdir . undo_dir) let &undodir = undo_dir @@ -295,13 +260,13 @@ endif " Fix vim's background colour erase - http://snk.tuxfamily.org/log/vim-256color-bce.html if &term =~ '256color' - " Disable Background Color Erase (BCE) so that color schemes - " work properly when Vim is used inside tmux and GNU screen. - " See also http://snk.tuxfamily.org/log/vim-256color-bce.html - set t_ut= + " Disable Background Color Erase (BCE) so that color schemes + " work properly when Vim is used inside tmux and GNU screen. + " See also http://snk.tuxfamily.org/log/vim-256color-bce.html + set t_ut= endif -" Disable arrow keys +" Disable arrow keys. map map map @@ -311,42 +276,41 @@ imap imap imap - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " CUSTOM AUTOCMDS """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" augroup campoCmds - " Clear all autocmds in the group + " Clear all autocmds in the group. autocmd! - " Automatically wrap at N characters + " Automatically wrap at N characters. autocmd FileType gitcommit setlocal colorcolumn=72 autocmd BufRead,BufNewFile *.{md,txt,plan} execute "setlocal textwidth=" .s:max_line_length - " Spell checking + " Spell checking. autocmd FileType gitcommit,markdown,text setlocal spell - " Jump to last cursor position unless it's invalid or in an event handler + " Jump to last cursor position unless it's invalid or in an event handler. autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif - " Language identation + " Language identation. autocmd FileType ruby,haml,eruby,yaml,html,javascript,rust,go set ai sw=2 sts=2 et autocmd FileType python,qml set sw=4 sts=4 et - " Indent p tags + " Indent HTML

tags. autocmd FileType html,eruby if g:html_indent_tags !~ '\\|p\>' | let g:html_indent_tags .= '\|p\|li\|dt\|dd' | endif - " Properly indent schemes (scheme, racket, etc) + " Properly indent schemes (scheme, racket, etc). autocmd bufread,bufnewfile *.{lisp,scm,rkt} setlocal equalprg=scmindent.rkt - " Auto reload VIM when settings changed + " Auto reload VIM when settings changed. autocmd BufWritePost .vimrc so $MYVIMRC autocmd BufWritePost *.vim so $MYVIMRC autocmd BufWritePost vimrc.symlink so $MYVIMRC - " Generate ctags - " Include local variables for c languages. + " Generate ctags on save. + " Also Include local variables for C-like languages. au BufWritePost *.py,*.c,*.cpp,*.h silent! !eval 'ctags --c-types=+l --c++-types=+l --exclude=vendor -R -o newtags; mv newtags tags' & " Remove trailing whitespace on save all files. @@ -362,11 +326,11 @@ augroup campoCmds " FILE TEMPLATES "//////////////////////////////////////////////////////////////// - " Shell script template + " Shell script template. autocmd BufNewFile *.sh 0r ~/.vim/templates/skeleton.sh autocmd BufNewFile *.plan 0r ~/.vim/templates/skeleton.plan - " C/C++ template + " C/C++ template. autocmd bufnewfile *.{c,cc,cpp,h,hpp} 0r ~/.vim/templates/c_header_notice autocmd bufnewfile *.{c,cc,cpp,h,hpp} exe "2," . 6 . "g/File:.*/s//File: " .expand("%") autocmd bufnewfile *.{c,cc,cpp,h,hpp} exe "2," . 6 . "g/Creation Date:.*/s//Creation Date: " .strftime("%Y-%m-%d") @@ -386,21 +350,23 @@ augroup END """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " MISC KEY MAPS """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Mapping ESC in insert mode and command mode to double i +" Mapping ESC in insert mode and command mode to double i. imap jj "cmap ii -" suspend process +" Suspend vim process and return to the shell. Can return to vim with `fg`. nmap z -" Quickly edit/reload the vimrc file +" Open the vimrc file for editing / reload vimrc file. nmap ev :vsp $MYVIMRC nmap rv :so $MYVIMRC -" Easy way to open a file in the directory of the current file +" Type %/ in the command bar to have it replaced with the current buffer's +" path if the file is on disk. One thing I noticed is that you have to type +" the full %/ quickly otherwise it won't replace it. :cmap %/ %:p:h/ -" remap saving and quiting +" Remap saving and quiting. nmap w :w! nmap q :q nmap qq :q! @@ -412,17 +378,17 @@ nmap x :x :ca W w! :ca Q q -" lowercase the e (have a habit of making it uppercase) +" Lowercase the e (have a habit of making it uppercase). :ca E e command! Q q " Bind :Q to :q command! Qall qall command! Qa qall -" Disable Ex mode +" Disable Ex mode. map Q +" Open a terminal within vim. Use `exit` to close it. if exists(':terminal') - " Terminal mapping map t :terminal tnoremap e tnoremap h @@ -435,14 +401,14 @@ if exists(':terminal') nnoremap l endif -" Map ctrl-movement keys to window switching +" Jump to other buffers. map map map map " Make it easier to jump around the command line. The default behaviour is -" using the arrow keys with or without shift +" using the arrow keys with or without shift. :cnoremap :cnoremap @@ -451,33 +417,33 @@ map map m :vsplit map mm :split -" Delete a word forward and backward -map a daw +" Forward delete and replace a word. map d ciw -" Map paste and nonumber +" Map paste and nonumber. map p :set paste! paste? map o :set number! number? -" Spell checking +" Show spell checking. +" @note: you can add new entries to the dict by moving the cursor over the +" word and pressing `zg`. map j :exec &spell==&spell? "se spell! spelllang=en_us" : "se spell!" map = z= -" NOTE: you can add a new word to the dict with `zg` -" Clear the search buffer (highlighting) when hitting return +" Clear the search buffer (highlighting) when hitting return. function! MapCR() nnoremap :nohlsearch endfunction call MapCR() nnoremap -" Replace currently selected text with default register without yanking it +" Replace currently selected text with default register without yanking it. vnoremap p "_dP -" Use Marked.app to preview Markdown files... +" Use Marked.app to preview Markdown files. nnoremap pp :silent !open -a Marked.app '%:p' -" Switch between C++ source and header files +" Switch between C++ source and header files. map v :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp, "map vv :e %:p:s,.h$,.X123X,:s,.c$,.h,:s,.X123X$,.c, "map vvv :e %:p:s,.h$,.X123X,:s,.cc$,.h,:s,.X123X$,.cc, @@ -524,13 +490,13 @@ inoremap =InsertTabWrapper() inoremap -"----------------------------------------------------------------------------------------- +"--------------------------------------------------------------------------------------------------- "################################################################ "################################################################ "################################################################ -" 3. PLUGIN CONFIGS +"#3. PLUGIN CONFIGS "################################################################ "################################################################ "################################################################ @@ -547,17 +513,22 @@ let g:localvimrc_ask = 0 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" noremap :TagbarToggle +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" KANGAROO +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +nmap a zp +nmap aa zP + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " GITGUTTER """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -let g:gitgutter_enabled = 0 -let g:gitgutter_highlight_lines = 1 +let g:gitgutter_enabled = 1 +let g:gitgutter_highlight_lines = 0 nmap ha GitGutterStageHunk -nmap hh :GitGutterToggle +nmap hh :GitGutterToggle nmap [h GitGutterNextHunk nmap ]h GitGutterPrevHunk -" Run on file save. Realtime update is disabled in after/plugins/gitgutter.vim -autocmd BufWritePost * GitGutter +autocmd BufWritePost * GitGutter " Update marks on save """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " SYNTASTIC @@ -686,13 +657,20 @@ endfunction """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" set tags+=tags;$HOME -"----------------------------------------------------------------------------------------- +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" TERMINUS +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let g:TerminusMouse=0 " Disable mouse stuff. +let g:TerminusFocusReporting=0 " Disable auto file reloading on external changes. + + +"--------------------------------------------------------------------------------------------------- "################################################################ "################################################################ "################################################################ -" 4. VISUALS +"#4. VISUALS "################################################################ "################################################################ "################################################################ @@ -825,12 +803,12 @@ augroup vimrc_annotated_notes \ containedin=.*Comment,vimCommentTitle augroup END -"----------------------------------------------------------------------------------------- +"--------------------------------------------------------------------------------------------------- "################################################################ "################################################################ "################################################################ -" 5. HELPER FUNCTIONS +"#5. HELPER FUNCTIONS "################################################################ "################################################################ "################################################################ @@ -977,14 +955,10 @@ function! Search(case_sensitive) endif if IsWindows() - "@deprecated: Fsgrep is slow...." - "exec 'Fsgrep "' . term . '"' exec 'Rg ' . rg_args . ' "' . term . '"' else - "@deprecated: ripgrep is faster than Ag. - "exec 'Ag "' . term . '"' - " @incomplete pass case sensitivity toggle to Find. - execute 'Find ' . term + " @incomplete Test out ripgrep on non-Windows OS + echo "Not implemented" endif endfunction map s :call Search(0) @@ -996,44 +970,6 @@ map ss :call Search(1) nnoremap o (&buftype is# "quickfix" ? "\|:lopen" : "o") nnoremap p (&buftype is# "quickfix" ? "\|:copen" : "p") -"//////////////////////////////////////////////////////////////// -" FILESEARCH PLUGIN -"//////////////////////////////////////////////////////////////// - let g:filesearch_viewport_split_policy = "B" - let g:filesearch_split_size = 10 - let g:filesearch_autodismiss_on_select = 0 - - -"//////////////////////////////////////////////////////////////// -" SELECTA -- find files with fuzzy-search -"//////////////////////////////////////////////////////////////// - -" Run a given vim command on the results of fuzzy selecting from a given shell -" command. See usage below. -function! SelectaCommand(choice_command, selecta_args, vim_command) - if IsWindows() - let l:term = input('File name: ') - exec 'Fsfind "' . l:term . '"' - else - try - let l:selection = system(a:choice_command . " | selecta " . a:selecta_args) - catch /Vim:Interrupt/ - " Swallow the ^C so that the redraw below happens; otherwise there will be - " leftovers from selecta on the screen - redraw! - return - endtry - redraw! - exec a:vim_command . " " . l:selection - endif -endfunction - -" Find all files in all non-dot directories starting in the working directory. -" Fuzzy select one of those. Open the selected file with :e. -" DISABLED (2019-03) because I'm now using ctrl-p for fuzzy searching. -" nnoremap f :call SelectaCommand("find * -type f ! -path 'resources/public/js/*' ! -path 'resources/.sass-cache/*' ! -path 'target/*'", "", ":e") - - """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " RENAME CURRENT FILE """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -1049,13 +985,13 @@ endfunction map n :call RenameFile() -"----------------------------------------------------------------------------------------- +"--------------------------------------------------------------------------------------------------- "################################################################ "################################################################ "################################################################ -" 6. PERSONAL +"#6. PERSONAL "################################################################ "################################################################ "################################################################ @@ -1064,6 +1000,6 @@ map n :call RenameFile() " FILE MAPPINGS """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Notes and other helpers -map pn :sp ~/.dev-scratchpad +map pn :sp ~/.dev-scratchpad.md "let g:autotagStopAt = "$HOME"