Update vimrc
This commit is contained in:
parent
d4c36b7a4e
commit
b89949e823
6
aliases
6
aliases
|
@ -28,7 +28,7 @@ elif [[ "${platform,,}" == *'ming'* ]]; then # convert to lowercase then compare
|
||||||
|
|
||||||
alias l='ls -ahg --color'
|
alias l='ls -ahg --color'
|
||||||
alias ls='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 rmr='echo "use trash command instead!"'
|
||||||
alias trash='recycle-bin.exe '
|
alias trash='recycle-bin.exe '
|
||||||
alias tt='trash '
|
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
|
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() {
|
br() {
|
||||||
b $@ ; r
|
b $@ ; r
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,14 @@ abort() {
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
cwd=$PWD
|
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"
|
||||||
|
|
58
vimrc
58
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:default_bg = 'dark'
|
||||||
let s:rainbow_theme = s:default_bg
|
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 'bling/vim-airline'
|
||||||
Plug 'vim-scripts/AnsiEsc.vim'
|
Plug 'vim-scripts/AnsiEsc.vim'
|
||||||
Plug 'embear/vim-localvimrc' " Add a .lvimrc to a folder to override .vimrc config.
|
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-obsession' " Continuously updated session files
|
||||||
Plug 'tpope/vim-fugitive' " Git wrapper
|
Plug 'tpope/vim-fugitive' " Git wrapper
|
||||||
Plug 'junegunn/goyo.vim' " Distraction-free mode with centered buffer
|
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 '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 'itchyny/vim-cursorword' " Underlines the word under the cursor
|
||||||
Plug 'airblade/vim-gitgutter' " See git diff in the gutter and stage/unstage hunks.
|
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 'ctrlpvim/ctrlp.vim' " Fuzzy file, buffer, mru, tag, etc finder
|
||||||
|
|
||||||
if IsWindows()
|
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)
|
||||||
|
@ -168,7 +168,7 @@ Plug 'tpope/vim-markdown'
|
||||||
"Plug 'vim-pandoc/vim-pandoc-syntax'
|
"Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||||
|
|
||||||
" C++
|
" C++
|
||||||
Plug 'bfrg/vim-cpp-enhanced-highlight'
|
Plug 'octol/vim-cpp-enhanced-highlight'
|
||||||
|
|
||||||
" Haxe
|
" Haxe
|
||||||
Plug 'jdonaldson/vaxe'
|
Plug 'jdonaldson/vaxe'
|
||||||
|
@ -197,9 +197,9 @@ filetype plugin indent on
|
||||||
set hidden
|
set hidden
|
||||||
set history=10000
|
set history=10000
|
||||||
set expandtab
|
set expandtab
|
||||||
set tabstop=2
|
set tabstop=4
|
||||||
set shiftwidth=2
|
set shiftwidth=4
|
||||||
set softtabstop=2
|
set softtabstop=4
|
||||||
set autoindent
|
set autoindent
|
||||||
set laststatus=2
|
set laststatus=2
|
||||||
set showcmd " display incomplete commands
|
set showcmd " display incomplete commands
|
||||||
|
@ -257,7 +257,7 @@ syntax on
|
||||||
set wildmenu
|
set wildmenu
|
||||||
set wildmode=longest,list,full
|
set wildmode=longest,list,full
|
||||||
set wildignore+=*/log/*,*.so,*.swp,*.zip,*/rdoc/*
|
set wildignore+=*/log/*,*.so,*.swp,*.zip,*/rdoc/*
|
||||||
let &colorcolumn=s:max_row_length
|
let &colorcolumn=s:max_line_length
|
||||||
|
|
||||||
" Requires ripgrep to be installed.
|
" Requires ripgrep to be installed.
|
||||||
set grepprg=rg\ --vimgrep
|
set grepprg=rg\ --vimgrep
|
||||||
|
@ -316,7 +316,7 @@ augroup campoCmds
|
||||||
|
|
||||||
" Automatically wrap at N characters
|
" Automatically wrap at N characters
|
||||||
autocmd FileType gitcommit setlocal colorcolumn=72
|
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
|
" Spell checking
|
||||||
autocmd FileType gitcommit,markdown,text setlocal spell
|
autocmd FileType gitcommit,markdown,text setlocal spell
|
||||||
|
@ -573,6 +573,7 @@ let g:syntastic_check_on_wq = 0
|
||||||
" RIPGREP
|
" RIPGREP
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
let g:rg_highlight = 1
|
let g:rg_highlight = 1
|
||||||
|
let g:rg_window_height = g:quickfix_window_height
|
||||||
|
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
" CTRL-P
|
" CTRL-P
|
||||||
|
@ -851,19 +852,17 @@ set errorformat+=\\\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m
|
||||||
" Microsoft HLSL compiler: fxc.exe
|
" Microsoft HLSL compiler: fxc.exe
|
||||||
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m
|
set errorformat+=\\\ %#%f(%l\\\,%c-%*[0-9]):\ %#%t%[A-z]%#\ %m
|
||||||
|
|
||||||
let g:build_window_size = 12 " in rows
|
|
||||||
|
|
||||||
function! HideBuildResultsAndClearErrors()
|
function! HideBuildResultsAndClearErrors()
|
||||||
RemoveErrorMarkers
|
RemoveErrorMarkers
|
||||||
call asyncrun#quickfix_toggle(g:build_window_size, 0)
|
call asyncrun#quickfix_toggle(g:quickfix_window_height, 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! HideAsyncResults()
|
function! HideAsyncResults()
|
||||||
call asyncrun#quickfix_toggle(g:build_window_size, 0)
|
call asyncrun#quickfix_toggle(g:quickfix_window_height, 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ToggleBuildResults()
|
function! ToggleBuildResults()
|
||||||
call asyncrun#quickfix_toggle(g:build_window_size)
|
call asyncrun#quickfix_toggle(g:quickfix_window_height)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! StopRunTask()
|
function! StopRunTask()
|
||||||
|
@ -882,7 +881,7 @@ endfunction
|
||||||
|
|
||||||
" Show results window the moment the async job starts
|
" Show results window the moment the async job starts
|
||||||
augroup vimrc
|
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
|
augroup END
|
||||||
|
|
||||||
" Toggle build results
|
" Toggle build results
|
||||||
|
@ -893,12 +892,7 @@ nnoremap <leader>bc :call ToggleBuildResults()<cr>
|
||||||
noremap <F10> :call HideBuildResultsAndClearErrors()<cr>
|
noremap <F10> :call HideBuildResultsAndClearErrors()<cr>
|
||||||
|
|
||||||
" Execute build script
|
" Execute build script
|
||||||
" Optimizations off
|
|
||||||
nnoremap <leader>ba :AsyncRun! -save=2 ./build_all*<cr>
|
|
||||||
nnoremap <leader>b :AsyncRun! -save=2 ./build*<cr>
|
nnoremap <leader>b :AsyncRun! -save=2 ./build*<cr>
|
||||||
" Optimizations on
|
|
||||||
nnoremap <leader>bb :AsyncRun! -save=2 ./build -o 1<cr>
|
|
||||||
nnoremap <leader>baa :AsyncRun! -save=2 ./build_all* -o 1<cr>
|
|
||||||
nnoremap <F8> :call SilentBuild()<cr>
|
nnoremap <F8> :call SilentBuild()<cr>
|
||||||
|
|
||||||
" Execute run script
|
" Execute run script
|
||||||
|
@ -961,8 +955,8 @@ endfunction
|
||||||
map <leader>gg :call GlobalReplaceIt(0)<cr>
|
map <leader>gg :call GlobalReplaceIt(0)<cr>
|
||||||
map <leader>gr :call GlobalReplaceIt(1)<cr>
|
map <leader>gr :call GlobalReplaceIt(1)<cr>
|
||||||
|
|
||||||
function! Search(case_insensitive)
|
function! Search(case_sensitive)
|
||||||
let helper = "[" . (a:case_insensitive ? "case-insensitive" : "case-sensitive") . "] search: "
|
let helper = "[" . (a:case_sensitive ? "case-sensitive" : "case-insensitive") . "] search: "
|
||||||
let term = input(helper)
|
let term = input(helper)
|
||||||
if empty(term)
|
if empty(term)
|
||||||
return
|
return
|
||||||
|
@ -972,7 +966,7 @@ function! Search(case_insensitive)
|
||||||
"quickfix window doesn't seem to parse the ansi color codes.
|
"quickfix window doesn't seem to parse the ansi color codes.
|
||||||
let rg_args = "--trim -g \"!vendor/*\""
|
let rg_args = "--trim -g \"!vendor/*\""
|
||||||
|
|
||||||
if a:case_insensitive
|
if !a:case_sensitive
|
||||||
let rg_args .= " --ignore-case"
|
let rg_args .= " --ignore-case"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -987,8 +981,8 @@ function! Search(case_insensitive)
|
||||||
execute 'Find ' . term
|
execute 'Find ' . term
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
map <leader>s :call Search(1)<cr>
|
map <leader>s :call Search(0)<cr>
|
||||||
map <leader>ss :call Search(0)<cr>
|
map <leader>ss :call Search(1)<cr>
|
||||||
|
|
||||||
" Navigation for the vim-ripgrep search results.
|
" Navigation for the vim-ripgrep search results.
|
||||||
" Hit o on a result line to open the file at that line.
|
" Hit o on a result line to open the file at that line.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user