From 29d53a6f590d688774c04d420e861948b6d37772 Mon Sep 17 00:00:00 2001 From: Charles Gueunet Date: Fri, 20 Sep 2019 15:22:22 +0200 Subject: [PATCH] chore(refacto): improve docs and build folder handling --- .vimrc | 4 +- README.md | 89 ++++++++++++++++------------------ config/editor.vim | 4 +- config/functions.vim | 6 ++- config/plugins/Ale.vim | 4 +- extra/vimrc.postconf.sample | 97 ++++++++++++++----------------------- extra/vimrc.preconf.sample | 76 +++++++++++++---------------- 7 files changed, 123 insertions(+), 157 deletions(-) diff --git a/.vimrc b/.vimrc index 9368ebe..559eb87 100644 --- a/.vimrc +++ b/.vimrc @@ -71,7 +71,7 @@ endif " Leader key if !exists('g:mapleader') - let g:mapleader=',' " Leader key is `,`. + let g:mapleader=',' " Leader key is `,`. endif " Basics configuration of the editor (file, search, completion, cursor, ...) @@ -92,7 +92,7 @@ execute 'source '.g:Vimmic_CONFIG.'shortcuts.vim' "dein Scripts----------------------------- if &compatible - set nocompatible " Be iMproved + set nocompatible " Be iMproved endif execute 'set runtimepath^='.g:Vimmic_DEIN diff --git a/README.md b/README.md index 4a1056b..8432ea4 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,7 @@ Dependencies listed here are recommended but not required for all plugins: * **flake8** is used by the plugin for Python **flake8-vim**. Install it through **pip**: `pip install --user flake8`. -* **clangd** is used for C/CPP completion and **clangcheck** - is the default linter. +* **yarn** is used for the asyncronous completion ### Install and update @@ -193,64 +192,60 @@ __Plugins__ Plugins and configurations included by default (lots of them are lazily/conditionally loaded): -['Shougo/dein.vim'](https://github.com/Shougo/dein.vim) -['scrooloose/nerdtree'](https://github.com/scrooloose/nerdtree) -['liuchengxu/vista.vim'](https://github.com/liuchengxu/vista.vim) -['kshenoy/vim-signature'](https://github.com/kshenoy/vim-signature) -['mbbill/undotree'](https://github.com/mbbill/undotree) -['mhinz/vim-startify'](https://github.com/mhinz/vim-startify) -['myusuf3/numbers.vim'](https://github.com/myusuf3/numbers.vim) -['junegunn/vim-peekaboo'](https://github.com/junegunn/vim-peekaboo) -['CharlesGueunet/quickmenu.vim'](https://github.com/CharlesGueunet/quickmenu.vim) -['tpope/vim-dispatch'](https://github.com/tpope/vim-dispatch) -['andymass/vim-tradewinds'](https://github.com/andymass/vim-tradewinds) -['t9md/vim-choosewin'](https://github.com/t9md/vim-choosewin) -['simeji/winresizer'](https://github.com/simeji/winresizer) -['airblade/vim-gitgutter'](https://github.com/airblade/vim-gitgutter) -['zivyangll/git-blame.vim'](https://github.com/zivyangll/git-blame.vim) -['tpope/vim-fugitive'](https://github.com/tpope/vim-fugitive) -['rhysd/committia.vim'](https://github.com/rhysd/committia.vim) -['machakann/vim-highlightedyank'](https://github.com/machakann/vim-highlightedyank) -['inkarkat/vim-mark'](https://github.com/inkarkat/vim-mark) -['luochen1990/rainbow'](https://github.com/luochen1990/rainbow) -['Raimondi/delimitMate'](https://github.com/Raimondi/delimitMate) -['kana/vim-textobj-user'](https://github.com/kana/vim-textobj-user) -['sgur/vim-textobj-parameter'](https://github.com/sgur/vim-textobj-parameter) ['glts/vim-textobj-comment'](https://github.com/glts/vim-textobj-comment) -['kana/vim-textobj-indent'](https://github.com/kana/vim-textobj-indent) ['kana/vim-textobj-entire'](https://github.com/kana/vim-textobj-entire) -['tpope/vim-commentary'](https://github.com/tpope/vim-commentary) -['tpope/vim-surround'](https://github.com/tpope/vim-surround) -['andymass/vim-matchup'](https://github.com/andymass/vim-matchup) +['kana/vim-textobj-indent'](https://github.com/kana/vim-textobj-indent) +['sgur/vim-textobj-parameter'](https://github.com/sgur/vim-textobj-parameter) +['w0rp/ale'](https://github.com/w0rp/ale) +['AndrewRadev/switch.vim'](https://github.com/AndrewRadev/switch.vim) ['ctrlpvim/ctrlp.vim'](https://github.com/ctrlpvim/ctrlp.vim) -['Lokaltog/vim-easymotion'](https://github.com/Lokaltog/vim-easymotion) ['markonm/traces.vim'](https://github.com/markonm/traces.vim) -['google/vim-searchindex'](https://github.com/google/vim-searchindex) +['mbbill/undotree'](https://github.com/mbbill/undotree) +['scrooloose/nerdtree'](https://github.com/scrooloose/nerdtree) +['CharlesGueunet/quickmenu.vim'](https://github.com/CharlesGueunet/quickmenu.vim) +['Lokaltog/vim-easymotion'](https://github.com/Lokaltog/vim-easymotion) +['Raimondi/delimitMate'](https://github.com/Raimondi/delimitMate) +['Shougo/dein.vim'](https://github.com/Shougo/dein.vim) +['SirVer/ultisnips'](https://github.com/SirVer/ultisnips) +['airblade/vim-gitgutter'](https://github.com/airblade/vim-gitgutter) +['andymass/vim-matchup'](https://github.com/andymass/vim-matchup) +['andymass/vim-tradewinds'](https://github.com/andymass/vim-tradewinds) ['eugen0329/vim-esearch'](https://github.com/eugen0329/vim-esearch) -['tommcdo/vim-lion'](https://github.com/tommcdo/vim-lion) -['AndrewRadev/switch.vim'](https://github.com/AndrewRadev/switch.vim) +['google/vim-searchindex'](https://github.com/google/vim-searchindex) +['honza/vim-snippets'](https://github.com/honza/vim-snippets) +['inkarkat/vim-ingo-library'](https://github.com/inkarkat/vim-ingo-library) +['inkarkat/vim-mark'](https://github.com/inkarkat/vim-mark) ['joereynolds/place.vim'](https://github.com/joereynolds/place.vim) -['vim-scripts/YankRing.vim'](https://github.com/vim-scripts/YankRing.vim) -['tommcdo/vim-exchange'](https://github.com/tommcdo/vim-exchange) +['junegunn/vim-peekaboo'](https://github.com/junegunn/vim-peekaboo) +['kana/vim-textobj-user'](https://github.com/kana/vim-textobj-user) +['kshenoy/vim-signature'](https://github.com/kshenoy/vim-signature) +['liuchengxu/vista.vim'](https://github.com/liuchengxu/vista.vim) +['luochen1990/rainbow'](https://github.com/luochen1990/rainbow) +['machakann/vim-highlightedyank'](https://github.com/machakann/vim-highlightedyank) +['mhinz/vim-startify'](https://github.com/mhinz/vim-startify) +['myusuf3/numbers.vim'](https://github.com/myusuf3/numbers.vim) ['neoclide/coc.nvim'](https://github.com/neoclide/coc.nvim) -['w0rp/ale'](https://github.com/w0rp/ale) +['rhysd/committia.vim'](https://github.com/rhysd/committia.vim) +['simeji/winresizer'](https://github.com/simeji/winresizer) +['t9md/vim-choosewin'](https://github.com/t9md/vim-choosewin) +['tommcdo/vim-exchange'](https://github.com/tommcdo/vim-exchange) +['tommcdo/vim-lion'](https://github.com/tommcdo/vim-lion) +['tpope/vim-commentary'](https://github.com/tpope/vim-commentary) +['tpope/vim-dispatch'](https://github.com/tpope/vim-dispatch) +['tpope/vim-fugitive'](https://github.com/tpope/vim-fugitive) ['tpope/vim-repeat'](https://github.com/tpope/vim-repeat) -['SirVer/ultisnips'](https://github.com/SirVer/ultisnips) -['honza/vim-snippets'](https://github.com/honza/vim-snippets) -['inkarkat/vim-ingo-library'](https://github.com/inkarkat/vim-ingo-library) +['tpope/vim-surround'](https://github.com/tpope/vim-surround) +['vim-scripts/YankRing.vim'](https://github.com/vim-scripts/YankRing.vim) +['zivyangll/git-blame.vim'](https://github.com/zivyangll/git-blame.vim) ['ilyachur/cmake4vim'](https://github.com/ilyachur/cmake4vim) +['lervag/vimtex'](https://github.com/lervag/vimtex) +['nickhutchinson/vim-cmake-syntax'](https://github.com/nickhutchinson/vim-cmake-syntax) ['octol/vim-cpp-enhanced-highlight'](https://github.com/octol/vim-cpp-enhanced-highlight) -['neoclide/coc-python'](https://github.com/neoclide/coc-python) -['fatih/vim-go'](https://github.com/fatih/vim-go) +['plasticboy/vim-markdown'](https://github.com/plasticboy/vim-markdown) ['prettier/vim-prettier'](https://github.com/prettier/vim-prettier) +['richq/vim-cmake-completion'](https://github.com/richq/vim-cmake-completion) ['sukima/xmledit'](https://github.com/sukima/xmledit) -['lervag/vimtex'](https://github.com/lervag/vimtex) -['neoclide/coc-vimtex'](https://github.com/neoclide/coc-vimtex) -['plasticboy/vim-markdown'](https://github.com/plasticboy/vim-markdown) ['cespare/vim-toml'](https://github.com/cespare/vim-toml) -['richq/vim-cmake-completion'](https://github.com/richq/vim-cmake-completion) -['nickhutchinson/vim-cmake-syntax'](https://github.com/nickhutchinson/vim-cmake-syntax) - __Copyright__ ------------- diff --git a/config/editor.vim b/config/editor.vim index 8a2defc..e24d6bd 100644 --- a/config/editor.vim +++ b/config/editor.vim @@ -29,8 +29,8 @@ set confirm " dialog foor unsaved changes set splitright " got to right pane by default (Needed for quickmenu) set noequalalways " do not resize when a window is closed set notagrelative " absolute path for catgs (usefull when .git/tags) -set tags+=./.tags -set tags ^=./.git/tags +set tags^=./.tags " find ctags in the project (see the git folder in my dotfiles) +set tags^=./.git/tags " Terminal/GUI setup scriptencoding utf-8 " Fix encoding diff --git a/config/functions.vim b/config/functions.vim index a048269..423c238 100644 --- a/config/functions.vim +++ b/config/functions.vim @@ -119,9 +119,11 @@ function! s:vimmic_link_compile_commands() return endif - if !filereadable('./compile_commands.json') && filereadable('./build/compile_commands.json') + let g:Vimmic_BUILD_DIR = get(g:, 'Vimmic_BUILD_DIR', './build/') + + if !filereadable('./compile_commands.json') && filereadable(g:Vimmic_BUILD_DIR.'compile_commands.json') echom "Create symlink to compile_commands.json ..." - silent !ln -sn ./build/compile_commands.json compile_commands.json + silent exec '!ln -sn '.g:Vimmic_BUILD_DIR.'compile_commands.json compile_commands.json' endif endfunction diff --git a/config/plugins/Ale.vim b/config/plugins/Ale.vim index 4ec1cd6..a8970fc 100644 --- a/config/plugins/Ale.vim +++ b/config/plugins/Ale.vim @@ -30,13 +30,13 @@ if s:loaded == 0 augroup vimmic_c_ale_config autocmd! autocmd FileType c let g:ale_linters = {'c':['clangcheck', 'cpplint']} - autocmd FileType cpp let g:ale_c_build_dir_names = ['.', 'build'] + autocmd FileType cpp let g:ale_c_build_dir_names = ['.', g:Vimmic_BUILD_DIR] augroup end augroup vimmic_cpp_ale_config autocmd! autocmd FileType cpp let g:ale_linters = {'cpp':['clangcheck', 'cppcheck', 'cpplint']} - autocmd FileType cpp let g:ale_c_build_dir_names = ['.', 'build'] + autocmd FileType cpp let g:ale_c_build_dir_names = ['.', g:Vimmic_BUILD_DIR] augroup end augroup vimmic_py_config diff --git a/extra/vimrc.postconf.sample b/extra/vimrc.postconf.sample index c5b41d6..8866cdf 100644 --- a/extra/vimrc.postconf.sample +++ b/extra/vimrc.postconf.sample @@ -1,82 +1,59 @@ -" This file is given as a sample file. -" You might copy it but avoid symbolic link. +" color fix +"autocmd VimEnter,ColorScheme * highlight SignColumn ctermbg=233 +" autocmd VimEnter,ColorScheme * highlight IncSearch ctermfg=DarkRed ctermbg=NONE cterm=bold +"autocmd VimEnter,ColorScheme * highlight Search ctermfg=Yellow ctermbg=NONE cterm=bold +"autocmd VimEnter,ColorScheme * highlight clear VertSplit +"autocmd VimEnter,ColorScheme * highlight clear SignColumn +"autocmd VimEnter,ColorScheme * highlight clear LineNr +"autocmd VimEnter,ColorScheme * highlight Visual ctermbg=234 ctermfg=gray cterm=bold -""""""""""""""""""""""""""""" -" Colorscheme and Theme -""""""""""""""""""""""""""""" - -" Adapt some color to the new theme -augroup highlight_clear_enter - autocmd VimEnter * highlight clear VertSplit - autocmd VimEnter * highlight clear SignColumn - autocmd VimEnter * highlight clear LineNr - " Use bakground of your term - autocmd VimEnter * highlight Normal ctermbg=NONE -augroup END - -" Colorscheme used (no termguicolors) -" colorscheme gruvbox - -" Colorscheme for true colors " set background=dark -"" set termguicolors " if not already in preconf " colorscheme quantum - -" if !has("nvim") +" if !has('nvim') " set term=xterm-256color " endif -"""""""""""""""""""""""""""""""""""" -" Feature -"""""""""""""""""""""""""""""""""""" +" avoid completion on these files +" set wildignore+=*/build/*,*/buildD/*,*/buildR/* +" +" Avoid boost completion (too long) +" autocmd FileType c,cpp set include=^\\s*#\\s*include\ \\( -" Code facilities for qwerty -augroup cpp_replace - autocmd FileType c,cpp inoremap -. -> - autocmd FileType c,cpp inoremap <, << -augroup END +" inoremap fasle false -" Get rid of command window -" map q: :q +" au FileType c,cpp inoremap -, -> -" augroup latex_spell -" autocmd FileType tex set spell spelllang=en +" spell for latex +" autocmd FileType tex set spell spelllang=en + +" no terminal in bufer (not for nvim) +" augroup termIgnore +" autocmd! +" autocmd TerminalOpen * set nobuflisted " augroup END -"""""""""""""""""""""""""""""" -" Plugins configuration -"""""""""""""""""""""""""""""" +" in insert mode, j + direction for action +" imap jh +" imap jj o +" imap jk O +" imap jl +" imap j; gi$;i + -" Asynchronous linter triggers: -" let g:ale_lint_on_text_changed = 0 -" let g:ale_lint_on_enter = 0 -" let g:ale_lint_on_save = 0 +"""""""""""""""""" GitGutter -" Beautiful git marker " let g:gitgutter_sign_added = '│' " let g:gitgutter_sign_modified = '│' " let g:gitgutter_sign_removed = '│' " let g:gitgutter_sign_removed_first_line = '.' " let g:gitgutter_sign_modified_removed = '├' -"""""""""""""""""""""""""""""" -" Filetype custom -"""""""""""""""""""""""""""""" - -" Prevent vim to scan the whole boost library for completion -" autocmd FileType c,cpp set include=^\\s*#\\s*include\ \\(