Browse Source

copy vimrc changes from lappy

master
= 5 years ago
parent
commit
0470cd6e67
  1. 120
      vim/.vimrc

120
vim/.vimrc

@ -39,6 +39,7 @@ colorscheme deus
set hlsearch
set wrap
set linebreak
set mouse+=a
set noequalalways " don't auto resize windows when closing (eg: qf window)
set colorcolumn=80
@ -68,7 +69,7 @@ let php_folding = 2
set wildmode=longest,list,full
set wildmenu
" attempts to fix delay when mode switch, also need tmux option "set -s escape-time 0"
" attempts to fix delay when mode switch, also need tmux option 'set -s escape-time 0'
set ttimeoutlen=10
" line numbering gutter
@ -82,6 +83,14 @@ if has("gui_running")
set lines=60 columns=100
endif
"------------------
" plugin configs
" bufexplorer
let g:bufExplorerSortBy='name'
let g:bufExplorerDefaultHelp=0
let g:bufExplorerShowRelativePath=1
"------------------
" airline plugin stuffs
set laststatus=2
@ -96,20 +105,16 @@ let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.linenr = ''
"let g:airline#extensions#tabline#enabled = 1
"------------------
" BufExplorer plugin
let g:bufExplorerSortBy='name'
"------------------
" custom keybinds
" C-PageUp/Down conflicts with xfce-terminal, so there is a trick to fixing
" https://unix.stackexchange.com/questions/159979/xfce4-terminal-disable-individual-shortcut
map <C-PageDown> :bnext<CR>
map <C-PageUp> :bprev<CR>
"map <C-PageDown> :bnext<CR>
"map <C-PageUp> :bprev<CR>
" jump to word under cursor in a preview window
noremap <F2> :ptjump <c-r><c-w> <cr>
" search for word under cursor in current directory
noremap <F3> ::AsyncRun grep -RIn --exclude=tags --exclude-dir=build <c-r><c-w> <cr>
noremap <F3> ::AsyncRun grep -RIn --exclude=tags --exclude-dir=build --exclude-dir=ext --exclude-dir=.git <c-r><c-w> <cr>
" close and delete current buffer
noremap <F4> :bp\|bd #<cr>
noremap <F5> :call RunMake()<cr>
@ -119,6 +124,7 @@ noremap <F6> :call QfToggle() <cr>
" AsyncRun
let g:asyncrun_timer = 250
let g:qf_toggle = ''
let g:asyncrun_prog = ''
function QfToggle()
if (g:qf_toggle == '')
@ -140,6 +146,17 @@ function RunMake()
" trying to update ctags blocks AsyncRun, maybe need autocommands?
":AsyncRun -cwd=<root> ctags -R ./src/
:AsyncRun -cwd=<root> -save=2 make -j4
let g:asyncrun_prog = 'make'
endfunction
function CheckMakeStatus()
if (g:asyncrun_prog == 'make')
if (g:asyncrun_status == 'success')
call QfToggle()
endif
let g:asyncrun_prog = ''
endif
endfunction
"------------------
@ -150,6 +167,7 @@ augroup vimrc
" custom copen
autocmd User AsyncRunStart call QfJumpAndReturn()
autocmd User AsyncRunStop call CheckMakeStatus()
" Don't screw up folds when inserting text that might affect them, until
" " leaving insert mode. Foldmethod is local to the window. Protect against
@ -158,8 +176,10 @@ augroup vimrc
autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif
" save folds/cursor positions of buffers
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview
" FIXME: uncommenting these is now deleting buffers when switching as of
" 2021-11-16
"autocmd BufWinLeave *.* mkview
"autocmd BufWinEnter *.* silent loadview
" glsl filetype plugin
autocmd! BufNewFile,BufRead *.vs,*.fs set ft=glsl
@ -205,46 +225,46 @@ endif
" Testing airline/asyncrun colors ------------------
" Define new accents
function! AirlineThemePatch(palette)
" [ guifg, guibg, ctermfg, ctermbg, opts ].
" See "help attr-list" for valid values for the "opt" value.
" http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim
let a:palette.accents.running = [ '', '', '', '', '' ]
let a:palette.accents.success = [ '#00ff00', '' , 'green', '', '' ]
let a:palette.accents.failure = [ '#ff0000', '' , 'red', '', '' ]
endfunction
let g:airline_theme_patch_func = 'AirlineThemePatch'
" Change color of the relevant section according to g:asyncrun_status, a global variable exposed by AsyncRun
" 'running': default, 'success': green, 'failure': red
let g:async_status_old = ''
function! Get_asyncrun_running()
let async_status = g:asyncrun_status
if async_status != g:async_status_old
if async_status == 'running'
call airline#parts#define_accent('asyncrun_status', 'running')
elseif async_status == 'success'
call airline#parts#define_accent('asyncrun_status', 'success')
elseif async_status == 'failure'
call airline#parts#define_accent('asyncrun_status', 'failure')
endif
let g:airline_section_x = airline#section#create(['asyncrun_status'])
"AirlineRefresh
let g:async_status_old = async_status
endif
return async_status
endfunction
call airline#parts#define_function('asyncrun_status', 'Get_asyncrun_running')
let g:airline_section_x = airline#section#create(['asyncrun_status'])
" " Define new accents
" function! AirlineThemePatch(palette)
" " [ guifg, guibg, ctermfg, ctermbg, opts ].
" See help attr-list for valid values for the opt value.
" " http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim
" let a:palette.accents.running = [ '', '', '', '', '' ]
" let a:palette.accents.success = [ '#00ff00', '' , 'green', '', '' ]
" let a:palette.accents.failure = [ '#ff0000', '' , 'red', '', '' ]
" endfunction
" let g:airline_theme_patch_func = 'AirlineThemePatch'
"
"
" " Change color of the relevant section according to g:asyncrun_status, a global variable exposed by AsyncRun
" " 'running': default, 'success': green, 'failure': red
" let g:async_status_old = ''
" function! Get_asyncrun_running()
"
" let async_status = g:asyncrun_status
" if async_status != g:async_status_old
"
" if async_status == 'running'
" call airline#parts#define_accent('asyncrun_status', 'running')
" elseif async_status == 'success'
" call airline#parts#define_accent('asyncrun_status', 'success')
" elseif async_status == 'failure'
" call airline#parts#define_accent('asyncrun_status', 'failure')
" endif
"
" let g:airline_section_x = airline#section#create(['asyncrun_status'])
" "AirlineRefresh
" let g:async_status_old = async_status
"
" endif
"
" return async_status
"
" endfunction
"
" call airline#parts#define_function('asyncrun_status', 'Get_asyncrun_running')
" let g:airline_section_x = airline#section#create(['asyncrun_status'])
"let g:asyncrun_status = ''
"let g:airline_section_error = airline#section#create_right(['%{g:asyncrun_status}'])

Loading…
Cancel
Save