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()
|
call plug#begin()
|
||||||
|
|
||||||
Plug 'dense-analysis/ale' " linting and fixing code.
|
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 'habamax/vim-asciidoctor' " Feature-full environment for ASCII Docs.
|
||||||
Plug 'majutsushi/tagbar' " Utility to easily browse the tag.
|
Plug 'majutsushi/tagbar' " Utility to easily browse the tag.
|
||||||
Plug 'mbbill/undotree' " Utility to view undo history
|
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 'vim-scripts/c.vim' " A packages of tools for C and C++.
|
||||||
Plug 'vimwiki/vimwiki' " A personal wiki plugin for Vim.
|
Plug 'vimwiki/vimwiki' " A personal wiki plugin for Vim.
|
||||||
Plug 'voldikss/vim-floaterm' " A plugin for floating terminal inside 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()
|
call plug#end()
|
||||||
|
|
||||||
|
|
||||||
" Plugin enable option
|
" 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
|
" For rainbow coloring of Parentheses
|
||||||
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle
|
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle
|
||||||
|
|||||||
30
env_setup.sh
30
env_setup.sh
@@ -8,6 +8,15 @@ for development in C and C++.
|
|||||||
cmt
|
cmt
|
||||||
|
|
||||||
|
|
||||||
|
user = ""
|
||||||
|
|
||||||
|
if [ '$(whoami)' = 'root' ]; then
|
||||||
|
user = ""
|
||||||
|
else
|
||||||
|
user = "sudo"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# To setup the environment
|
# To setup the environment
|
||||||
|
|
||||||
function settingUpVimrc{
|
function settingUpVimrc{
|
||||||
@@ -34,14 +43,6 @@ function settingUpLatestVim{
|
|||||||
|
|
||||||
# Installing the required packages.
|
# Installing the required packages.
|
||||||
|
|
||||||
user = ""
|
|
||||||
|
|
||||||
if [ '$(whoami)' = 'root' ]; then
|
|
||||||
|
|
||||||
user = ""
|
|
||||||
else
|
|
||||||
|
|
||||||
user = "sudo"
|
|
||||||
|
|
||||||
$user apt install git
|
$user apt install git
|
||||||
$user apt install make
|
$user apt install make
|
||||||
@@ -55,5 +56,16 @@ function settingUpLatestVim{
|
|||||||
git clone https://github.com/vim/vim.git
|
git clone https://github.com/vim/vim.git
|
||||||
|
|
||||||
# Configure for compilation.
|
# Configure for compilation.
|
||||||
./vim/src/configure --with-features=huge --enable-python3interp=yes --enable-multibyte --enable-cscope --prefix=/usr/local
|
|
||||||
|
DIR = /usr/local # Directory to setup the latest vim build.
|
||||||
|
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
DIR = $1
|
||||||
|
fi
|
||||||
|
|
||||||
|
./vim/src/configure --with-features=huge --enable-python3interp=yes --enable-multibyte --enable-cscope --prefix=$DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# For ctags
|
||||||
|
# $user apt install universal-ctags -y
|
||||||
|
|||||||
Reference in New Issue
Block a user