refactoring
This commit is contained in:
parent
21b3126ad4
commit
f44cb29b3f
|
@ -10,3 +10,5 @@ wal_example-dark.vim
|
||||||
wal_example-light.vim
|
wal_example-light.vim
|
||||||
vim/autoload/plug.vim
|
vim/autoload/plug.vim
|
||||||
.is-dev
|
.is-dev
|
||||||
|
.vimrc-config
|
||||||
|
.vimrc-overrides
|
||||||
|
|
101
vimrc
101
vimrc
|
@ -1,5 +1,19 @@
|
||||||
" ●
|
" ●
|
||||||
|
|
||||||
|
if filereadable(expand('.vimrc-config'))"{{{
|
||||||
|
source .vimrc-config
|
||||||
|
endif
|
||||||
|
|
||||||
|
let g:vimrc_load_dev_plugins = exists('g:vimrc_load_dev_plugins')
|
||||||
|
\ ? g:vimrc_load_dev_plugins : 0
|
||||||
|
let g:vimrc_enable_statusline = exists('g:vimrc_enable_statusline')
|
||||||
|
\ ? g:vimrc_enable_statusline : 0
|
||||||
|
let g:vimrc_enable_tabline = exists('g:vimrc_enable_tabline')
|
||||||
|
\ ? g:vimrc_enable_tabline : 0
|
||||||
|
let g:vimrc_auto_window_settings = exists('g:vimrc_auto_window_settings')
|
||||||
|
\ ? g:vimrc_auto_window_settings : 0
|
||||||
|
"}}}
|
||||||
|
|
||||||
" #plugins {{{
|
" #plugins {{{
|
||||||
if empty(glob('~/.vim/autoload/plug.vim'))"{{{
|
if empty(glob('~/.vim/autoload/plug.vim'))"{{{
|
||||||
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
||||||
|
@ -13,7 +27,6 @@ if !has('nvim')
|
||||||
|
|
||||||
Plug '~/.config/vim/vim/bundle/vim-learnxiny'
|
Plug '~/.config/vim/vim/bundle/vim-learnxiny'
|
||||||
|
|
||||||
|
|
||||||
" #Ctrlp {{{
|
" #Ctrlp {{{
|
||||||
Plug 'ctrlpvim/ctrlp.vim'
|
Plug 'ctrlpvim/ctrlp.vim'
|
||||||
" :h ctrlp-commands
|
" :h ctrlp-commands
|
||||||
|
@ -70,22 +83,6 @@ let g:mta_filetypes = {
|
||||||
\ ['relative', 'absolute', 'fixed']
|
\ ['relative', 'absolute', 'fixed']
|
||||||
\ ]
|
\ ]
|
||||||
|
|
||||||
"}}}
|
|
||||||
" #switch {{{
|
|
||||||
"https://github.com/AndrewRadev/switch.vim
|
|
||||||
Plug 'AndrewRadev/switch.vim'
|
|
||||||
|
|
||||||
let g:switch_mapping = '<space>-'
|
|
||||||
let g:switch_custom_definitions = [
|
|
||||||
\ ['0', '1'],
|
|
||||||
\ ['ease-in', 'ease-out', 'ease-in-out', 'linear'],
|
|
||||||
\ ['auto', 'none'],
|
|
||||||
\ ['left', 'right'],
|
|
||||||
\ ['top', 'bottom'],
|
|
||||||
\ ['row', 'column'],
|
|
||||||
\ ['relative', 'absolute', 'fixed']
|
|
||||||
\ ]
|
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
" #undotree {{{
|
" #undotree {{{
|
||||||
Plug 'mbbill/undotree'
|
Plug 'mbbill/undotree'
|
||||||
|
@ -139,7 +136,7 @@ Plug 'studio-vx/vim-qlist'
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
if filereadable(expand('.is-dev'))
|
if g:vimrc_load_dev_plugins
|
||||||
" #ALE {{{
|
" #ALE {{{
|
||||||
" https://github.com/w0rp/ale
|
" https://github.com/w0rp/ale
|
||||||
Plug 'w0rp/ale'
|
Plug 'w0rp/ale'
|
||||||
|
@ -537,18 +534,6 @@ runtime macros/matchit.vim
|
||||||
"----------------------------------------------------------------------------}}}
|
"----------------------------------------------------------------------------}}}
|
||||||
" #functions {{{
|
" #functions {{{
|
||||||
|
|
||||||
function! DoInsertEnter() "{{{
|
|
||||||
" call SetColor('LineNr', '#262626', '', '#cccccc', '', '')
|
|
||||||
" call SetColor('CursorLineNr', '#bcbcbc', '', '#999999', '', 'bold')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"}}}
|
|
||||||
function! DoInsertLeave() "{{{
|
|
||||||
" call SetColor('LineNr', '#3a3a3a', '', '#999999', '', '')
|
|
||||||
" call SetColor('CursorLineNr', '#767676', '', '#777777', '', 'bold')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"}}}
|
|
||||||
function! SetColor(name, fg, bg, fg_l, bg_l, style) abort"{{{
|
function! SetColor(name, fg, bg, fg_l, bg_l, style) abort"{{{
|
||||||
|
|
||||||
if &background ==? 'dark'
|
if &background ==? 'dark'
|
||||||
|
@ -972,14 +957,11 @@ command! ScratchVertical vnew | setlocal buftype=nofile | setlocal bufhidden=hid
|
||||||
"}}}
|
"}}}
|
||||||
" #settings {{{
|
" #settings {{{
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
set ttyfast
|
|
||||||
|
|
||||||
if &term ==? 'xterm-256color'
|
if &term ==? 'xterm-256color'
|
||||||
set termguicolors
|
set termguicolors
|
||||||
endif
|
endif
|
||||||
|
|
||||||
syntax on
|
syntax on
|
||||||
set background=light
|
|
||||||
" set fillchars=stl:\ ,stlnc:\ ,vert:│
|
" set fillchars=stl:\ ,stlnc:\ ,vert:│
|
||||||
set fillchars=stl:\ ,stlnc:\ ,vert:┃
|
set fillchars=stl:\ ,stlnc:\ ,vert:┃
|
||||||
colorscheme monotonous-dark
|
colorscheme monotonous-dark
|
||||||
|
@ -991,14 +973,10 @@ set updatetime=100
|
||||||
set timeoutlen=500
|
set timeoutlen=500
|
||||||
set lazyredraw
|
set lazyredraw
|
||||||
|
|
||||||
set backupdir=~/.vimtmp
|
|
||||||
set directory=~/.vimtmp
|
|
||||||
|
|
||||||
" the ;/home/ray tells vim to stop searching at /home/ray
|
" the ;/home/ray tells vim to stop searching at /home/ray
|
||||||
set tags+=./.tags,.tags,./tags-py,.tags-py;/home/ray/
|
set tags+=./.tags,.tags,./tags-py,.tags-py;/home/ray/
|
||||||
|
|
||||||
" persisitent undo file
|
" persisitent undo file
|
||||||
set undodir=/home/ray/.vim/undodir
|
|
||||||
set undofile
|
set undofile
|
||||||
|
|
||||||
set viewoptions-=options
|
set viewoptions-=options
|
||||||
|
@ -1027,8 +1005,6 @@ set completeopt=longest,menuone
|
||||||
|
|
||||||
set nospell
|
set nospell
|
||||||
set spelllang=en_gb
|
set spelllang=en_gb
|
||||||
set dictionary+=/usr/share/dict/brit-a-z.txt,/usr/share/dict/britcaps.txt
|
|
||||||
set thesaurus+=/usr/share/dict/mthesaur.txt
|
|
||||||
|
|
||||||
set diffopt+=vertical
|
set diffopt+=vertical
|
||||||
|
|
||||||
|
@ -1271,8 +1247,9 @@ augroup linenumbering
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
" WinEnter, WinLeave {{{
|
" auto_window_settings {{{
|
||||||
augroup windowenteringleaving
|
if g:vimrc_auto_window_settings
|
||||||
|
augroup auto_window_settings
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd WinEnter * call SetColorColumn()
|
autocmd WinEnter * call SetColorColumn()
|
||||||
autocmd WinEnter * set cursorline | set cursorcolumn
|
autocmd WinEnter * set cursorline | set cursorcolumn
|
||||||
|
@ -1280,23 +1257,16 @@ augroup windowenteringleaving
|
||||||
autocmd WinLeave * set nocursorline | set nocursorcolumn
|
autocmd WinLeave * set nocursorline | set nocursorcolumn
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
|
endif
|
||||||
" }}}
|
" }}}
|
||||||
" InsertEnter, InsertLeave {{{
|
" Automatically reload .vimrc if changed {{{
|
||||||
augroup insertenterleave
|
|
||||||
au!
|
|
||||||
au InsertEnter * call DoInsertEnter()
|
|
||||||
au InsertLeave * call DoInsertLeave()
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
"}}}
|
|
||||||
" Automatically reload .vimrc if chanaged {{{
|
|
||||||
augroup myvimrc
|
augroup myvimrc
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
|
autocmd BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
" " Open qfix after grepping {{{
|
" Open qfix after grepping {{{
|
||||||
" augroup qfixopen
|
" augroup qfixopen
|
||||||
" autocmd!
|
" autocmd!
|
||||||
" autocmd QuickFixCmdPost *grep* botright cwindow
|
" autocmd QuickFixCmdPost *grep* botright cwindow
|
||||||
|
@ -1314,8 +1284,18 @@ augroup END
|
||||||
|
|
||||||
"----------------------------------------------------------------------------}}}
|
"----------------------------------------------------------------------------}}}
|
||||||
" #statusline {{{
|
" #statusline {{{
|
||||||
|
if g:vimrc_enable_statusline
|
||||||
set statusline=%!GetStatus(1)
|
set statusline=%!GetStatus(1)
|
||||||
|
|
||||||
|
augroup status "{{{
|
||||||
|
autocmd!
|
||||||
|
autocmd WinNew,WinEnter * setlocal statusline=%!GetStatus(1)
|
||||||
|
autocmd WinLeave * setlocal statusline=%!GetStatus(0)
|
||||||
|
" autocmd WinNew * setlocal statusline=%!GetStatus(1)
|
||||||
|
" autocmd InsertChange * setlocal statusline=%!GetStatus(1)
|
||||||
|
augroup END
|
||||||
|
"}}}
|
||||||
|
|
||||||
function! GetStatus(isactive) abort "{{{
|
function! GetStatus(isactive) abort "{{{
|
||||||
" let l:linter = ale#statusline#Count(bufnr(''))
|
" let l:linter = ale#statusline#Count(bufnr(''))
|
||||||
let l:divider = '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >'
|
let l:divider = '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >'
|
||||||
|
@ -1547,18 +1527,12 @@ hi def link LinterInfo Normal
|
||||||
hi def link LinterInfoActive SpellRare
|
hi def link LinterInfoActive SpellRare
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
augroup status "{{{
|
endif
|
||||||
autocmd!
|
" TODO set statusline if not using custom statusline
|
||||||
autocmd WinNew,WinEnter * setlocal statusline=%!GetStatus(1)
|
|
||||||
autocmd WinLeave * setlocal statusline=%!GetStatus(0)
|
|
||||||
" autocmd WinNew * setlocal statusline=%!GetStatus(1)
|
|
||||||
" autocmd InsertChange * setlocal statusline=%!GetStatus(1)
|
|
||||||
augroup END
|
|
||||||
"}}}
|
|
||||||
|
|
||||||
"----------------------------------------------------------------------------}}}
|
"----------------------------------------------------------------------------}}}
|
||||||
" #tabline {{{
|
" #tabline {{{
|
||||||
if exists('+showtabline')
|
if exists('+showtabline') && g:vimrc_enable_tabline
|
||||||
|
|
||||||
" Rename tabs to show tab number.
|
" Rename tabs to show tab number.
|
||||||
" based on:
|
" based on:
|
||||||
|
@ -1638,8 +1612,13 @@ if exists('+showtabline')
|
||||||
hi def link TabLineNum TabLine
|
hi def link TabLineNum TabLine
|
||||||
hi def link TabLineNumSel TabLineSel
|
hi def link TabLineNumSel TabLineSel
|
||||||
|
|
||||||
endif " exists("+showtabline")
|
endif
|
||||||
"----------------------------------------------------------------------------}}}
|
"----------------------------------------------------------------------------}}}
|
||||||
|
|
||||||
|
if filereadable(expand('.vimrc-overrides'))"{{{
|
||||||
|
source .vimrc-overrides
|
||||||
|
endif
|
||||||
|
"}}}
|
||||||
|
|
||||||
|
|
||||||
" vim: set foldmethod=marker:
|
" vim: set foldmethod=marker:
|
||||||
|
|
Loading…
Reference in New Issue