From b89949e823073670352c630e167cf4cb0c1905ca Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Wed, 15 May 2019 14:00:25 -0400 Subject: [PATCH] Update vimrc --- aliases | 6 +++- vim/templates/skeleton.sh | 12 ++++++-- vimrc | 58 ++++++++++++++++++--------------------- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/aliases b/aliases index c868f70..a71efc4 100644 --- a/aliases +++ b/aliases @@ -28,7 +28,7 @@ elif [[ "${platform,,}" == *'ming'* ]]; then # convert to lowercase then compare alias l='ls -ahg --color' alias ls='ls -ahg --color' - alias rm='echo "use trash command instead!"' + #alias rm='echo "use trash command instead!"' alias rmr='echo "use trash command instead!"' alias trash='recycle-bin.exe ' alias tt='trash ' @@ -60,6 +60,10 @@ bb() { if [ -f build ]; then ./build -o 1 $@ ; else test -f build.sh && ./build.sh -o 1 $@ ; fi } +bp() { + if [ -f build ]; then ./build -p p $@ ; else test -f build.sh && ./build.sh -p p $@ ; fi +} + br() { b $@ ; r } diff --git a/vim/templates/skeleton.sh b/vim/templates/skeleton.sh index fcfd4c1..dd0475d 100644 --- a/vim/templates/skeleton.sh +++ b/vim/templates/skeleton.sh @@ -31,6 +31,14 @@ abort() { set -e cwd=$PWD -platform=`uname` # 'Linux', 'Darwin', etc -printf "${YELLOW}Platform: $platform${NORMAL}\n" +uname_s="$(uname -s)" +case "${uname_s}" in + Linux*) machine=Linux;; + Darwin*) machine=Mac;; + CYGWIN*) machine=Cygwin;; + MINGW*) machine=MinGw;; + *) machine="UNKNOWN:${uname_s}" +esac + +printf "${YELLOW}Platform: $machine${NORMAL}\n" diff --git a/vimrc b/vimrc index 61ab077..3d8413d 100644 --- a/vimrc +++ b/vimrc @@ -29,10 +29,10 @@ let mapleader="," "################################################################ "################################################################ -let s:max_row_length = 100 +let s:max_line_length = 100 let s:default_bg = 'dark' let s:rainbow_theme = s:default_bg - +let g:quickfix_window_height = 16 " in rows "----------------------------------------------------------------------------------------- @@ -53,14 +53,14 @@ call plug#begin('~/.vim/plugged') 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 'jremmen/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 '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 if IsWindows() Plug 'suxpert/vimcaps' " Disable capslock (useful if the OS isn't configured to do so) @@ -168,7 +168,7 @@ Plug 'tpope/vim-markdown' "Plug 'vim-pandoc/vim-pandoc-syntax' " C++ -Plug 'bfrg/vim-cpp-enhanced-highlight' +Plug 'octol/vim-cpp-enhanced-highlight' " Haxe Plug 'jdonaldson/vaxe' @@ -197,9 +197,9 @@ filetype plugin indent on set hidden set history=10000 set expandtab -set tabstop=2 -set shiftwidth=2 -set softtabstop=2 +set tabstop=4 +set shiftwidth=4 +set softtabstop=4 set autoindent set laststatus=2 set showcmd " display incomplete commands @@ -257,7 +257,7 @@ syntax on set wildmenu set wildmode=longest,list,full set wildignore+=*/log/*,*.so,*.swp,*.zip,*/rdoc/* -let &colorcolumn=s:max_row_length +let &colorcolumn=s:max_line_length " Requires ripgrep to be installed. set grepprg=rg\ --vimgrep @@ -316,7 +316,7 @@ augroup campoCmds " Automatically wrap at N characters autocmd FileType gitcommit setlocal colorcolumn=72 - autocmd BufRead,BufNewFile *.{md,txt,plan} execute "setlocal textwidth=" .s:max_row_length + autocmd BufRead,BufNewFile *.{md,txt,plan} execute "setlocal textwidth=" .s:max_line_length " Spell checking autocmd FileType gitcommit,markdown,text setlocal spell @@ -573,6 +573,7 @@ let g:syntastic_check_on_wq = 0 " RIPGREP """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:rg_highlight = 1 +let g:rg_window_height = g:quickfix_window_height """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " CTRL-P @@ -851,19 +852,17 @@ set errorformat+=\\\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m " Microsoft HLSL compiler: fxc.exe set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m -let g:build_window_size = 12 " in rows - function! HideBuildResultsAndClearErrors() RemoveErrorMarkers - call asyncrun#quickfix_toggle(g:build_window_size, 0) + call asyncrun#quickfix_toggle(g:quickfix_window_height, 0) endfunction function! HideAsyncResults() - call asyncrun#quickfix_toggle(g:build_window_size, 0) + call asyncrun#quickfix_toggle(g:quickfix_window_height, 0) endfunction function! ToggleBuildResults() - call asyncrun#quickfix_toggle(g:build_window_size) + call asyncrun#quickfix_toggle(g:quickfix_window_height) endfunction function! StopRunTask() @@ -882,7 +881,7 @@ endfunction " Show results window the moment the async job starts augroup vimrc - autocmd User AsyncRunStart call asyncrun#quickfix_toggle(g:build_window_size, 1) + autocmd User AsyncRunStart call asyncrun#quickfix_toggle(g:quickfix_window_height, 1) augroup END " Toggle build results @@ -893,12 +892,7 @@ nnoremap bc :call ToggleBuildResults() noremap :call HideBuildResultsAndClearErrors() " Execute build script -" Optimizations off -nnoremap ba :AsyncRun! -save=2 ./build_all* nnoremap b :AsyncRun! -save=2 ./build* -" Optimizations on -nnoremap bb :AsyncRun! -save=2 ./build -o 1 -nnoremap baa :AsyncRun! -save=2 ./build_all* -o 1 nnoremap :call SilentBuild() " Execute run script @@ -961,8 +955,8 @@ endfunction map gg :call GlobalReplaceIt(0) map gr :call GlobalReplaceIt(1) -function! Search(case_insensitive) - let helper = "[" . (a:case_insensitive ? "case-insensitive" : "case-sensitive") . "] search: " +function! Search(case_sensitive) + let helper = "[" . (a:case_sensitive ? "case-sensitive" : "case-insensitive") . "] search: " let term = input(helper) if empty(term) return @@ -972,7 +966,7 @@ function! Search(case_insensitive) "quickfix window doesn't seem to parse the ansi color codes. let rg_args = "--trim -g \"!vendor/*\"" - if a:case_insensitive + if !a:case_sensitive let rg_args .= " --ignore-case" endif @@ -987,8 +981,8 @@ function! Search(case_insensitive) execute 'Find ' . term endif endfunction -map s :call Search(1) -map ss :call Search(0) +map s :call Search(0) +map ss :call Search(1) " Navigation for the vim-ripgrep search results. " Hit o on a result line to open the file at that line.