From da54f2d130c441360cde920223683a10ea4b1453 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 9 Nov 2019 15:13:48 +0100 Subject: [PATCH] [UPDATE][VIM] Move plugin settings to directory --- vim/.vim/plugin/settings/ale.vim | 24 +++ vim/.vim/plugin/settings/betterwhitespace.vim | 5 + vim/.vim/plugin/settings/fastfold.vim | 5 + vim/.vim/plugin/settings/gruvbox.vim | 5 + vim/.vim/plugin/settings/lightline.vim | 81 +++++++++ vim/.vim/plugin/settings/ultisnips.vim | 12 ++ vim/.vimrc | 157 +----------------- 7 files changed, 138 insertions(+), 151 deletions(-) create mode 100644 vim/.vim/plugin/settings/ale.vim create mode 100644 vim/.vim/plugin/settings/betterwhitespace.vim create mode 100644 vim/.vim/plugin/settings/fastfold.vim create mode 100644 vim/.vim/plugin/settings/gruvbox.vim create mode 100644 vim/.vim/plugin/settings/lightline.vim create mode 100644 vim/.vim/plugin/settings/ultisnips.vim diff --git a/vim/.vim/plugin/settings/ale.vim b/vim/.vim/plugin/settings/ale.vim new file mode 100644 index 0000000..23c9138 --- /dev/null +++ b/vim/.vim/plugin/settings/ale.vim @@ -0,0 +1,24 @@ +" Always display the sign column to avoid moving the buffer all the time +let g:ale_sign_column_always=1 + +" Change the way ALE display messages +let g:ale_echo_msg_info_str='I' +let g:ale_echo_msg_warning_str='W' +let g:ale_echo_msg_error_str='E' + +" The message displayed in the command line area +let g:ale_echo_msg_format='[%linter%][%severity%]%(code):% %s' + +" The message displayed in the location list +let g:ale_loclist_msg_format='[%linter%]%(code):% %s' + +" Don't lint every time I change the buffer +let g:ale_lint_on_text_changed=0 +" Don't lint on leaving insert mode +let g:ale_lint_on_insert_leave=0 +" Don't lint on entering a buffer +let g:ale_lint_on_enter=0 +" Do lint on save +let g:ale_lint_on_save=1 +" Lint on changing the filetype +let g:ale_lint_on_filetype_changed=1 diff --git a/vim/.vim/plugin/settings/betterwhitespace.vim b/vim/.vim/plugin/settings/betterwhitespace.vim new file mode 100644 index 0000000..71ac74c --- /dev/null +++ b/vim/.vim/plugin/settings/betterwhitespace.vim @@ -0,0 +1,5 @@ +" Enable trailing whitespace high-lighting +let g:better_whitespace_enabled=1 + +" Strip trailing whitespace on file-save +let g:strip_whitespace_on_save=1 diff --git a/vim/.vim/plugin/settings/fastfold.vim b/vim/.vim/plugin/settings/fastfold.vim new file mode 100644 index 0000000..a1f1787 --- /dev/null +++ b/vim/.vim/plugin/settings/fastfold.vim @@ -0,0 +1,5 @@ +" Intercept all fold commands +let g:fastfold_fold_command_suffixes=[ + \ 'x', 'X', 'a', 'A', 'o', 'O', 'c', 'C', + \ 'r', 'R', 'm', 'M', 'i', 'n', 'N' + \ ] diff --git a/vim/.vim/plugin/settings/gruvbox.vim b/vim/.vim/plugin/settings/gruvbox.vim new file mode 100644 index 0000000..4b14437 --- /dev/null +++ b/vim/.vim/plugin/settings/gruvbox.vim @@ -0,0 +1,5 @@ +" Use the high-contrast theme +let g:gruvbox_contrast_dark='hard' + +" Enable italics because urxvt supports them +let g:gruvbox_italic=1 diff --git a/vim/.vim/plugin/settings/lightline.vim b/vim/.vim/plugin/settings/lightline.vim new file mode 100644 index 0000000..feaa733 --- /dev/null +++ b/vim/.vim/plugin/settings/lightline.vim @@ -0,0 +1,81 @@ +" Initialise light-line setting structure +let g:lightline={} + +" Use the wombat colorscheme +let g:lightline.colorscheme='wombat' + +" Status-line for active buffer +let g:lightline.active={ + \ 'left': [ + \ [ 'mode', 'paste' ], + \ [ 'gitbranch', 'readonly', 'filename', 'modified' ], + \ [ 'spell' ], + \ ], + \ 'right': [ + \ [ 'lineinfo' ], + \ [ 'percent' ], + \ [ 'fileformat', 'fileencoding', 'filetype' ], + \ [ 'linter_check', 'linter_errors', 'linter_warn', 'linter_ok' ], + \ [ 'ctags_status' ], + \ ] + \ } + +" Status-line for inactive buffer +let g:lightline.inactive={ + \ 'left': [ + \ [ 'filename' ], + \ ], + \ 'right': [ + \ [ 'lineinfo' ], + \ [ 'percent' ], + \ ], + \ } + +" Which component should be written using which function +let g:lightline.component_function={ + \ 'readonly': 'LightlineReadonly', + \ 'modified': 'LightlineModified', + \ 'gitbranch': 'LightlineFugitive', + \ } + +" Which component can be expanded by using which function +let g:lightline.component_expand={ + \ 'linter_check': 'lightline#ale#checking', + \ 'linter_warn': 'lightline#ale#warnings', + \ 'linter_errors': 'lightline#ale#errors', + \ 'linter_ok': 'lightline#ale#ok', + \ } + +" How to color custom components +let g:lightline.component_type={ + \ 'readonly': 'error', + \ 'linter_checking': 'left', + \ 'linter_warn': 'warning', + \ 'linter_errors': 'error', + \ 'linter_ok': 'left', + \ } + +" Show pretty icons instead of text for linting status +let g:lightline#ale#indicator_checking='⏳' +let g:lightline#ale#indicator_warnings='◆' +let g:lightline#ale#indicator_errors='✗' +let g:lightline#ale#indicator_ok='✓' + +" Show a lock icon when editing a read-only file when it makes sense +function! LightlineReadonly() + return &ft!~?'help\|vimfiler\|netrw' && &readonly ? '' : '' +endfunction + +" Show a '+' when the buffer is modified, '-' if not, when it makes sense +function! LightlineModified() + return &ft=~'help\|vimfiler\|netrw' ? '' : &modified ? '+' : &modifiable ? '' : '-' +endfunction + +" Show branch name with nice icon in status line, when it makes sense +function! LightlineFugitive() + if &ft!~?'help\|vimfiler\|netrw' && exists('*fugitive#head') + let branch=fugitive#head() + return branch!=#'' ? ' '.branch : '' + endif + return '' +endfunction diff --git a/vim/.vim/plugin/settings/ultisnips.vim b/vim/.vim/plugin/settings/ultisnips.vim new file mode 100644 index 0000000..e9d609c --- /dev/null +++ b/vim/.vim/plugin/settings/ultisnips.vim @@ -0,0 +1,12 @@ +" Insert mode trigger for expansion +let g:UltiSnipsExpandTrigger="" + +" Jump forward and backwards in place-holder list with Ctrl-f and Ctrl-b +let g:UltiSnipsJumpBackwardTrigger="" +let g:UltiSnipsJumpForwardTrigger="" + +" Split the windowd vertically when callin :UltiSnipsEdits +let g:UltiSnipsEditSplit="vertical" + +" Store my personal snippets under ~/.vim/UltiSnips +let g:UltiSnipsSnippetsDir='~/.vim/UltiSnips' diff --git a/vim/.vimrc b/vim/.vimrc index 35428be..50f5b69 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -1,5 +1,3 @@ -" FIXME: put all this in .vim folder and import them on a per-file basis - " Basic configuraion {{{ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Don't try to be compatible with Vi @@ -165,6 +163,12 @@ set listchars=tab:>─,trail:·,nbsp:¤ " Timeout quickly on shortcuts, I can't wait two seconds to delete in visual set timeoutlen=500 + +" Set dark mode by default +set background=dark + +" Use gruvbox +colorscheme gruvbox " }}} " Search parameters {{{ @@ -177,155 +181,6 @@ set ignorecase set smartcase " }}} -" Plugin parameters {{{ -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" BetterWhitespace settings {{{ -""""""""""""""""""""""""""" -" Enable trailing whitespace high-lighting -let g:better_whitespace_enabled=1 -" Strip trailing whitespace on file-save -let g:strip_whitespace_on_save=1 -" }}} - -" Theme settings {{{ -"""""""""""""""" -" Use a slightly darker background color to differentiate with the status line -let g:jellybeans_background_color_256='232' -" colorscheme jellybeans -" colorscheme jellybeans - -" Set dark mode by default -set background=dark -let g:gruvbox_contrast_dark='(hard)' -" Enable italics because urxvt supports them -let g:gruvbox_italic=1 -colorscheme gruvbox -" }}} - -" Lightline settings {{{ -"""""""""""""""""""" -let g:lightline={} -" Use the gruvbox colorscheme -let g:lightline.colorscheme='wombat' -let g:lightline.active={ - \ 'left': [ - \ [ 'mode', 'paste' ], - \ [ 'gitbranch', 'readonly', 'filename', 'modified' ], - \ [ 'spell' ], - \ ], - \ 'right': [ - \ [ 'lineinfo' ], - \ [ 'percent' ], - \ [ 'fileformat', 'fileencoding', 'filetype' ], - \ [ 'linter_check', 'linter_errors', 'linter_warn', 'linter_ok' ], - \ [ 'ctags_status' ], - \ ] - \ } -let g:lightline.inactive={ - \ 'left': [ - \ [ 'filename' ], - \ ], - \ 'right': [ - \ [ 'lineinfo' ], - \ [ 'percent' ], - \ ], - \ } -let g:lightline.component_function={ - \ 'readonly': 'LightlineReadonly', - \ 'modified': 'LightlineModified', - \ 'gitbranch': 'LightlineFugitive', - \ } -let g:lightline.component_expand={ - \ 'linter_check': 'lightline#ale#checking', - \ 'linter_warn': 'lightline#ale#warnings', - \ 'linter_errors': 'lightline#ale#errors', - \ 'linter_ok': 'lightline#ale#ok', - \ } -let g:lightline.component_type={ - \ 'readonly': 'error', - \ 'linter_checking': 'left', - \ 'linter_warn': 'warning', - \ 'linter_errors': 'error', - \ 'linter_ok': 'left', - \ } -" Show pretty icons instead of text for linting status -let g:lightline#ale#indicator_checking='⏳' -let g:lightline#ale#indicator_warnings='◆' -let g:lightline#ale#indicator_errors='✗' -let g:lightline#ale#indicator_ok='✓' - -" Lightline function wrappers {{{ -""""""""""""""""""""""""""""" -" Show a lock icon when editing a read-only file when it makes sense -function! LightlineReadonly() - return &ft!~?'help\|vimfiler\|netrw' && &readonly ? '' : '' -endfunction -" Show a '+' when the buffer is modified, '-' if not, when it makes sense -function! LightlineModified() - return &ft=~'help\|vimfiler\|netrw' ? '' : &modified ? '+' : &modifiable ? '' : '-' -endfunction -" Show branch name with nice icon in status line, when it makes sense -function! LightlineFugitive() - if &ft!~?'help\|vimfiler\|netrw' && exists('*fugitive#head') - let branch=fugitive#head() - return branch!=#'' ? ' '.branch : '' - endif - return '' -endfunction -" }}} -" }}} - -" UltiSnips settings {{{ -"""""""""""""""""""" -" Insert mode trigger for expansion -let g:UltiSnipsExpandTrigger="" -" Jump forward and backwards in place-holder list with Ctrl-f and Ctrl-b -let g:UltiSnipsJumpBackwardTrigger="" -let g:UltiSnipsJumpForwardTrigger="" -" Split the windowd vertically when callin :UltiSnipsEdits -let g:UltiSnipsEditSplit="vertical" -" Store my personal snippets under ~/.vim/UltiSnips -let g:UltiSnipsSnippetsDir='~/.vim/UltiSnips' -" }}} - -" ALE settings {{{ -"""""""""""""" -" Always display the sign column to avoid moving the buffer all the time -let g:ale_sign_column_always=1 -" Change the way ALE display messages -let g:ale_echo_msg_info_str='I' -let g:ale_echo_msg_warning_str='W' -let g:ale_echo_msg_error_str='E' -" The message displayed in the command line area -let g:ale_echo_msg_format='[%linter%][%severity%]%(code):% %s' -" The message displayed in the location list -let g:ale_loclist_msg_format='[%linter%]%(code):% %s' - -" Linter timings {{{ -"""""""""""""""" -" Don't lint every time I change the buffer -let g:ale_lint_on_text_changed=0 -" Don't lint on leaving insert mode -let g:ale_lint_on_insert_leave=0 -" Don't lint on entering a buffer -let g:ale_lint_on_enter=0 -" Lint on save -let g:ale_lint_on_save=1 -" Lint on changing the filetype -let g:ale_lint_on_filetype_changed=1 -" }}} -" }}} - -" FastFold settings {{{ -""""""""""""""""""" -" Intercept all fold commands -let g:fastfold_fold_command_suffixes=[ - \ 'x', 'X', 'a', 'A', 'o', 'O', 'c', 'C', - \ 'r', 'R', 'm', 'M', 'i', 'n', 'N' - \ ] -" }}} -" }}} - " Import settings when inside a git repository {{{ """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let git_settings=system("git config --get vim.settings")