refactoring

This commit is contained in:
ManjaroOne666 2018-12-02 22:33:19 +00:00
parent 21b3126ad4
commit f44cb29b3f
2 changed files with 307 additions and 326 deletions

2
.gitignore vendored
View File

@ -10,3 +10,5 @@ wal_example-dark.vim
wal_example-light.vim
vim/autoload/plug.vim
.is-dev
.vimrc-config
.vimrc-overrides

101
vimrc
View File

@ -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 {{{
if empty(glob('~/.vim/autoload/plug.vim'))"{{{
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
@ -13,7 +27,6 @@ if !has('nvim')
Plug '~/.config/vim/vim/bundle/vim-learnxiny'
" #Ctrlp {{{
Plug 'ctrlpvim/ctrlp.vim'
" :h ctrlp-commands
@ -70,22 +83,6 @@ let g:mta_filetypes = {
\ ['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 {{{
Plug 'mbbill/undotree'
@ -139,7 +136,7 @@ Plug 'studio-vx/vim-qlist'
"}}}
if filereadable(expand('.is-dev'))
if g:vimrc_load_dev_plugins
" #ALE {{{
" https://github.com/w0rp/ale
Plug 'w0rp/ale'
@ -537,18 +534,6 @@ runtime macros/matchit.vim
"----------------------------------------------------------------------------}}}
" #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"{{{
if &background ==? 'dark'
@ -972,14 +957,11 @@ command! ScratchVertical vnew | setlocal buftype=nofile | setlocal bufhidden=hid
"}}}
" #settings {{{
scriptencoding utf-8
set ttyfast
if &term ==? 'xterm-256color'
set termguicolors
endif
syntax on
set background=light
" set fillchars=stl:\ ,stlnc:\ ,vert:│
set fillchars=stl:\ ,stlnc:\ ,vert:┃
colorscheme monotonous-dark
@ -991,14 +973,10 @@ set updatetime=100
set timeoutlen=500
set lazyredraw
set backupdir=~/.vimtmp
set directory=~/.vimtmp
" the ;/home/ray tells vim to stop searching at /home/ray
set tags+=./.tags,.tags,./tags-py,.tags-py;/home/ray/
" persisitent undo file
set undodir=/home/ray/.vim/undodir
set undofile
set viewoptions-=options
@ -1027,8 +1005,6 @@ set completeopt=longest,menuone
set nospell
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
@ -1271,8 +1247,9 @@ augroup linenumbering
augroup END
" }}}
" WinEnter, WinLeave {{{
augroup windowenteringleaving
" auto_window_settings {{{
if g:vimrc_auto_window_settings
augroup auto_window_settings
autocmd!
autocmd WinEnter * call SetColorColumn()
autocmd WinEnter * set cursorline | set cursorcolumn
@ -1280,23 +1257,16 @@ augroup windowenteringleaving
autocmd WinLeave * set nocursorline | set nocursorcolumn
augroup END
endif
" }}}
" InsertEnter, InsertLeave {{{
augroup insertenterleave
au!
au InsertEnter * call DoInsertEnter()
au InsertLeave * call DoInsertLeave()
augroup END
"}}}
" Automatically reload .vimrc if chanaged {{{
" Automatically reload .vimrc if changed {{{
augroup myvimrc
autocmd!
autocmd BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC | if has('gui_running') | so $MYGVIMRC | endif
augroup END
" }}}
" " Open qfix after grepping {{{
" Open qfix after grepping {{{
" augroup qfixopen
" autocmd!
" autocmd QuickFixCmdPost *grep* botright cwindow
@ -1314,8 +1284,18 @@ augroup END
"----------------------------------------------------------------------------}}}
" #statusline {{{
if g:vimrc_enable_statusline
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 "{{{
" let l:linter = ale#statusline#Count(bufnr(''))
let l:divider = '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >'
@ -1547,18 +1527,12 @@ hi def link LinterInfo Normal
hi def link LinterInfoActive SpellRare
"}}}
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
"}}}
endif
" TODO set statusline if not using custom statusline
"----------------------------------------------------------------------------}}}
" #tabline {{{
if exists('+showtabline')
if exists('+showtabline') && g:vimrc_enable_tabline
" Rename tabs to show tab number.
" based on:
@ -1638,8 +1612,13 @@ if exists('+showtabline')
hi def link TabLineNum TabLine
hi def link TabLineNumSel TabLineSel
endif " exists("+showtabline")
endif
"----------------------------------------------------------------------------}}}
if filereadable(expand('.vimrc-overrides'))"{{{
source .vimrc-overrides
endif
"}}}
" vim: set foldmethod=marker: