mirror of
https://github.com/Hizenberg469/Vim-tutorials.git
synced 2026-04-19 22:02:24 +03:00
Some changes in env_setup.sh and Plugin configuration in .vimrc
This commit is contained in:
91
.vimrc
91
.vimrc
@@ -143,7 +143,7 @@ endif
|
||||
call plug#begin()
|
||||
|
||||
Plug 'dense-analysis/ale' " linting and fixing code.
|
||||
Plug 'airblade/vim-gitgutter' " a git diff in the sign colomn.
|
||||
"Plug 'airblade/vim-gitgutter' " a git diff in the sign colomn.
|
||||
Plug 'habamax/vim-asciidoctor' " Feature-full environment for ASCII Docs.
|
||||
Plug 'majutsushi/tagbar' " Utility to easily browse the tag.
|
||||
Plug 'mbbill/undotree' " Utility to view undo history
|
||||
@@ -158,11 +158,98 @@ call plug#begin()
|
||||
Plug 'vim-scripts/c.vim' " A packages of tools for C and C++.
|
||||
Plug 'vimwiki/vimwiki' " A personal wiki plugin for Vim.
|
||||
Plug 'voldikss/vim-floaterm' " A plugin for floating terminal inside vim.
|
||||
|
||||
Plug 'tpope/vim-commentary' " Commenting tool
|
||||
Plug 'vim-airline/vim-airline-themes' " Themes for airline
|
||||
Plug 'vim-scripts/DoxygenToolkit.vim' " Doxygen support
|
||||
Plug 'vim-scripts/SpellCheck' " Spell checking
|
||||
call plug#end()
|
||||
|
||||
|
||||
" Plugin enable option
|
||||
|
||||
|
||||
" For dense-analysis/ale - linting
|
||||
" Ignore git commit when linting (highly annoying)
|
||||
let g:ale_pattern_options = {
|
||||
\ 'COMMIT_EDITMSG$': {'ale_linters': [], 'ale_fixers': []}
|
||||
\ }
|
||||
let g:ale_linters = {
|
||||
\ 'yaml': ['yamllint'],
|
||||
\ 'cpp': ['clangtidy'],
|
||||
\ 'c': ['clangtidy'],
|
||||
\ 'asciidoc': ['cspell'],
|
||||
\ 'markdown': ['cspell']
|
||||
\ }
|
||||
let g:ale_fixers = {
|
||||
\ 'cpp': ['clang-format'],
|
||||
\ 'c': ['clang-format']}
|
||||
|
||||
" Automatic fixing
|
||||
autocmd FileType c nnoremap <leader>f <Plug>(ale_fix)
|
||||
|
||||
" General settings
|
||||
let g:ale_linters_explicit = 1
|
||||
let g:ale_completion_enabled = 1
|
||||
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
|
||||
let g:ale_set_balloons=1
|
||||
let g:ale_hover_to_floating_preview=1
|
||||
let g:ale_use_global_executables = 1
|
||||
let g:ale_sign_column_always = 1
|
||||
let g:ale_disable_lsp = 1
|
||||
|
||||
" C++ linting
|
||||
let g:ale_cpp_clangtidy_options = '-checks=-*,cppcoreguidelines-*'
|
||||
let g:ale_cpp_clangtidy_checks = ['readability-*,performance-*,bugprone-*,misc-*']
|
||||
let g:ale_cpp_clangtidy_checks += ['clang-analyzer-cplusplus-doc-comments']
|
||||
|
||||
" C linting
|
||||
let g:ale_c_clangtidy_options = '-checks=-*,cppcoreguidelines-*'
|
||||
let g:ale_c_clangtidy_checks = ['readability-*,performance-*,bugprone-*,misc-*']
|
||||
let g:ale_c_clangtidy_checks += ['-readability-function-cognitive-complexity']
|
||||
let g:ale_c_clangtidy_checks += ['-readability-identifier-length']
|
||||
let g:ale_c_clangtidy_checks += ['-misc-redundant-expression']
|
||||
let g:ale_c_build_dir_names = ['build', 'release', 'debug']
|
||||
|
||||
" This function searches for the first clang-tidy config in parent directories and sets it
|
||||
function! SetClangTidyConfig()
|
||||
let l:config_file = findfile('.clang-tidy', expand('%:p:h').';')
|
||||
if !empty(l:config_file)
|
||||
let g:ale_c_clangtidy_options = '--config=' . l:config_file
|
||||
let g:ale_cpp_clangtidy_options = '--config=' . l:config_file
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Run this for c and c++ files
|
||||
autocmd BufRead,BufNewFile *.c,*.cpp,*.h,*.hpp call SetClangTidyConfig()
|
||||
|
||||
|
||||
|
||||
" For tpope/vim-fugitive - git integration.
|
||||
|
||||
nnoremap <Leader>gg :Git<CR>
|
||||
nnoremap <Leader>gs :Git status<CR>
|
||||
nnoremap <Leader>gc :Git commit<CR>
|
||||
nnoremap <Leader>gb :Git blame<CR>
|
||||
nnoremap <Leader>gd :Git difftool<CR>
|
||||
nnoremap <Leader>gm :Git mergetool<CR>
|
||||
nnoremap <Leader>gdv :Gvdiffsplit<CR>
|
||||
nnoremap <Leader>gdh :Gdiffsplit<CR>
|
||||
|
||||
|
||||
" For airblade/vim-gitgutter - git status reporting line by line
|
||||
|
||||
|
||||
" For preservim/nerdtree: the battle tested file explorer
|
||||
let g:NERDTreeWinSize = 40
|
||||
nnoremap <C-n> :NERDTreeToggle<CR>
|
||||
let NERDTreeIgnore = ['\.o$', '\.obj$', '\.a$', '\.so$', '\.out$', '\.git$']
|
||||
let NERDTreeShowHidden = 1
|
||||
|
||||
|
||||
" For majutsushi/tagbar: the ultimate tag bar
|
||||
nmap <F8> :TagbarToggle<CR>
|
||||
|
||||
|
||||
|
||||
" For rainbow coloring of Parentheses
|
||||
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle
|
||||
|
||||
Reference in New Issue
Block a user