call plug#begin('~/vimDebugPlugin')
"""""""""""""""""""""""""""""""""""
" color schema
"""""""""""""""""""""""""""""""""""
Plug 'altercation/vim-colors-solarized' " solarized color for vim
Plug 'lifepillar/vim-solarized8'
Plug 'morhetz/gruvbox'
Plug 'romainl/flattened'
Plug 'drewtempelmeyer/palenight.vim'
Plug 'ayu-theme/ayu-vim'
"set termguicolors " enable true colors support
"let ayucolor="light" " for light version of theme
"let ayucolor="mirage" " for mirage version of theme
"let ayucolor="dark" " for dark version of theme
"colorscheme ayu
Plug 'arcticicestudio/nord-vim'
Plug 'rakr/vim-one'
Plug 'mhartington/oceanic-next'
""""""""""""""""""""""""""""""""""
"Plug 'ncm2/float-preview.nvim'
"Plug 'Yggdroot/indentLine' " bug for json file were '' disparait
Plug 'nathanaelkane/vim-indent-guides'
Plug 'heavenshell/vim-pydocstring', { 'do': 'make install' }
Plug 'lifepillar/vim-cheat40'
Plug 'jackguo380/vim-lsp-cxx-highlight' "syntaxe highlight C++ for coc.nvim
Plug 'MattesGroeger/vim-bookmarks'
Plug 'tpope/vim-surround' "surround word under cursor with flag (\"\" or ()...)
Plug 'luochen1990/rainbow' "color pair of bracket for better lisibility
Plug 'mhinz/vim-startify' "show last recent opened file to vim startup
"Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
"Plug 'sbdchd/neoformat'
"Plug 'grailbio/bazel-compilation-database'
Plug 'easymotion/vim-easymotion'
Plug 'jreybert/vimagit'
Plug 'liuchengxu/vim-which-key'
Plug 'liuchengxu/vim-which-key', { 'on': ['WhichKey', 'WhichKey!'] }
Plug 'neoclide/jsonc.vim'
if has('nvim')
else
Plug 'pakutoma/toggle-terminal'
endif
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } }
Plug 'will133/vim-dirdiff' "diff between directory
Plug 'rstacruz/vim-closer'
Plug 'tpope/vim-fugitive' "fugitive = git wrapper
Plug 'lambdalisue/gina.vim'
Plug 'gregsexton/gitv', {'on': ['Gitv']} "top git log
Plug 'majutsushi/tagbar' "display a menu with tag in file
"Plug 'vim-scripts/Gundo' "Gundo.vim is Vim plugin to visualize your Vim undo tree
Plug 'mbbill/undotree' "show vim history
Plug 'Konfekt/FastFold' "empeche les lag avec syntaxe fold method
Plug 'Shougo/echodoc' "Displays function signatures from completions in the command line
Plug 'Chiel92/vim-autoformat' "autoformat
"Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clangd-completer --clang-completer --clang-tidy --js-completer' } " YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for Vim. command ofr install : python install.py. alternative from omnicompletion + jedi-vim(for pyhton file)
"Plug 'rdnetto/YCM-Generator', { 'branch': 'stable'}
Plug 'itchyny/lightline.vim'
Plug 'alvan/vim-closetag' "close html tag with key '>' or '>>'
"Plug 'ludovicchabant/vim-gutentags' "auto tag git project
Plug 'tell-k/vim-autopep8' "allow command autopep8 in vim for python file
"Plug 'sjl/splice.vim' "tool for resolve threeMerge conflict
"Plug 'sirver/ultisnips' "UltiSnips is the ultimate solution for snippets in Vim (coc_ultisnip used but documentation available here)
Plug 'scrooloose/nerdcommenter' "allow comment cc for comment
"Plug 'Raimondi/delimitMate' "close bracket
Plug 'rchicoli/vim-zoomwin' "zoom with ctl-w-o
Plug 'airblade/vim-gitgutter'
Plug 'vim-scripts/DoxygenToolkit.vim'
"Plug 'dpelle/vim-Grammalecte'
Plug 'mhinz/vim-grepper'
Plug 'vigoux/LanguageTool.nvim'
"Plug 'dpelle/vim-LanguageTool'
Plug 'rhysd/vim-grammarous'
Plug 'junegunn/vim-easy-align' "align text
Plug 'skywind3000/asyncrun.vim'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'puremourning/vimspector'
"Plug 'mphe/grayout.vim'
"Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}}
Plug 'neoclide/coc.nvim', {'branch': 'release'} "can replaceYCM (more modern)
"Plug 'MaskRay/ccls', {'do': 'yarn install --frozen-lockfile'}
"Note: You may need to execute these commands in the "Developer Command Prompt for VS"
"git clone https://github.com/llvm/llvm-project.git
"cd llvm-project
"# Download ccls
"cd ccls
"cmake -H. -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_PREFIX_PATH="D:/llvm/Release;D:/llvm/Release/tools/clang;D:/llvm;D:/llvm/tools/clang"
"ninja -C Release
"Plug 'universal-ctags/ctags', {'do' : nmake -f mk_mvc.mak}
Plug 'universal-ctags/ctags'
Plug 'voldikss/vim-translator'
call plug#end()
""""""""""""""""""""""""""""""""""""
" disable to print FX on insert mode
""""""""""""""""""""""""""""""""""""
map!
map!
map!
map!
map!
map!
map!
map!
map!
map!
map!
packadd termdebug " add gdb to vim
syntax on " syntax highlighting
filetype on " try to detect filetypes
filetype plugin indent on " enable loading indent file for filetype
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" automatically leave insert mode after 'updatetime' milliseconds of inaction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"augroup Foo
"au CursorHoldI stopinsert"
"" set 'updatetime' to 15 seconds when in insert mode
"au InsertEnter let updaterestore=&updatetime | set updatetime=15000
"au InsertLeave * let &updatetime=updaterestore
"augroup END
"autocmd! Foo
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" return on normal mode when vim lost focus
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"autocmd FocusLost * call feedkeys("\")
"""""""""""""""""
" set powershell by terminal default
"""""""""""""""""
"set shell=powershell "create a bug on plug install !!! be careful
"set shellcmdflag=-command
"
"set shell=powershell.exe
"set shellcmdflag=-NoProfile\ -NoLogo\ -NonInteractive\ -Command
"set shellpipe=|
"set shellredir=>
"set shell=powershell.exe\ -NoLogo\ -NoProfile\ -NonInteractive\ -ExecutionPolicy\ RemoteSigned
" if shellcmdflag starts with '-' then tempname() uses forward slashes, see
" https://groups.google.com/forum/#!topic/vim_dev/vTR05EZyfE0
"set shellcmdflag=\ -Command
"set shellquote=
"set shellxquote=(
"let &shellpipe='| Out-File -Encoding UTF8 %s'
"let &shellredir='| Out-File -Encoding UTF8 %s'
"set noshellslash
"""""""""""""""""""
" asyncrun
""""""""""""""""""""
let g:asyncrun_wrapper = 'powershell -command'
"let g:asyncrun_wrapper = 'pwsh -command'
"""""""""""""""""""
" a.vim
"""""""""""""""""""
"unmap leader is who provoque a bug
""""""""""""""""""""
" markdownPreview.vim
"""""""""""""""""""
" set to 1, nvim will open the preview window after entering the markdown buffer
" default: 0
let g:mkdp_auto_start = 0
" set your favorite shell
"let g:toggle_terminal#command = 'pwsh'
let g:toggle_terminal#command = 'powershell'
" set terminal window position
" (see possible options at :help vertical)
let g:toggle_terminal#position = 'topleft'
endif
"
"-----------------
"" Plugin gutentag
"-----------------
"let g:gutentags_exclude_filetypes = "cxx,hxx"
"-----------------
"" Plugin ALE
"-----------------
"let g:ale_completion_enabled = 1
" let g:ale_linters = {
" \ 'rust': ['rls', 'cargo']
" }
" let g:ale_linters={'python': ['pylint', 'pydocstyle', 'mypy']}
"-----------------
"" Plugin fugitive
"-----------------
autocmd BufReadPost fugitive:// set bufhidden=delete
"autocmd QuickFixCmdPost grep* cwindow "alow to choose file in quickFiXList whit :Ggrep command
"nnoremap a :Gstatus
" let g:EasyGrepOpenWindowOnMatch=0
""""""""""""""""""""""
" Configure ctags for vim
""""""""""""""""""""""
"Auto chearsh the first tags file from the current file
set tags=./tags;,tags;
"""""""""""""""""""
"YouCompleteMe
"""""""""""""""""""
"disable arrow key and use tab for selection
let g:ycm_key_list_select_completion = ['']
let g:ycm_key_list_previous_completion = ['']
let g:ycm_key_list_stop_completion = ['', '', '']
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'
"let g:ycm_clangd_binary_path = exepath('clangd')
"let g:loaded_youcompleteme = 1
"-----------------
" let g:ycm_log_level = 'debug'
" let g:ycm_show_diagnostics_ui = 0
"let g:enable_ycm_at_startup = 0
""""""" Let clangd fully control code completion
let g:ycm_clangd_uses_ycmd_caching = 0
" Use installed clangd, not YCM-bundled clangd which doesn't get updates.
let g:ycm_clangd_binary_path = exepath("clangd")
let g:ycm_autoclose_preview_window_after_insertion = 1
if has('nvim')
else
"set pythondll=D:\ftarroux\Logiciel\Python2\python27.dll
"set pythonthreedll=D:\ftarroux\Logiciel\Python36\python36.dll
"set pythonthreedll=D:\LOGICELW7\Python3.7.7\python37.dll
endif
noremap gr :YcmCompleter GoToReferences
nnoremap gg :YcmCompleter GoTo
nnoremap ge :YcmCompleter GoToDeclaration
nnoremap gt :YcmCompleter GetType
nnoremap gd :YcmCompleter GetDoc
nnoremap gf :YcmCompleter FixIt
nnoremap :YcmForceCompileAndDiagnostics
nnoremap :YcmCompleter Format
"nnoremap ² :YcmCompleter Format
"-----------------
"" Plugin Ctrlp
"-----------------
" let g:ctrlp_working_path_mode = 'rc'
" let g:ctrlp_by_filename = 1
" let g:ctrlp_max_files = 0
" map j :CtrlP
" map :CtrlPMRUFiles
" map :CtrlPBuffer
"""""""""""""""""""""
" Autoclose old buffer
"""""""""""""""""""""
" function CloseLast ()
" python <<EOF
" import vim
" N = 10
" listed_buffers = [b for b in vim.buffers if b.options['buflisted'] and not b.options['modified']]
" for i in range (0, len (listed_buffers) - N):
" vim.command (':bd' + str (listed_buffers[i].number))
" EOF
" endfunction
" autocmd BufNew * call CloseLast()
"-----------------
"" Plugin NerdTree
"-----------------
let NERDChristmasTree=1
let NERDTreeWinSize=100
map :NERDTreeToggle
map :NERDTreeFind
"
"
"-----------------
"" Plugin Tagbar
"-----------------
map :Tagbar
"let g:tagbar_ctags_bin = 'D:\ftarroux\Logiciel\ctags58\ctags.exe'
"let g:tagbar_ctags_bin = 'D:\LOGICELW7\ctags\ctags.exe'
"let g:tagbar_ctags_bin='ctags'
let g:tagbar_width=30
let g:tagbar_autofocus = 1
let g:tagbar_sort = 1
"
"-----------------
"" Configure gvim
"-----------------
"set guioptions-=T " remove Tool bar
"set guioptions-=r " remove Right bar
"set guioptions-=L " remove Left bar
"set guioptions=c
" you can copy with maj in insert modeuu
" cause big lag on visual mode (set guioption+=a
":set guioptions+=a keymodel=startsel,stopsel
"use system clipboard
set clipboard=unnamed
"correct cursor bug for gnome terminal
let &t_SI = "\[6 q"
let &t_SR = "\[4 q"
let &t_EI = "\[2 q"
"Change cursor shape for GNU screen
if &term =~ "screen."
let &t_ti.="\eP\e[1 q\e\"
let &t_SI.="\eP\e[5 q\e\"
let &t_EI.="\eP\e[1 q\e\"
let &t_te.="\eP\e[0 q\e\"
else
let &t_ti.="\[1 q"
let &t_SI.="\[5 q"
let &t_EI.="\[1 q"
let &t_te.="\[0 q"
endif
"use classic editor shortcut
set mouse=a
set nu
map GVgg
nnoremap :w
inoremap :w
noremap h :history
nmap q:
map y
"imap :%s/
nmap :%s/
vmap :s/
" vnoremap "hy:%s/h//gcmap /
"Allow to shearch visula selection with
vnoremap y/\VC-r>=escape(@",'/\')<CR
" Smart way to move between windows
map h
map l
map k
map j
"nnoremap v :e ~/.vimrc
"===============================
" Common Configuration for Vim
"================================
set encoding=utf-8 " utf-8 default (others: big5, gbk, euc-jp)
set fencs=utf-8 " fileencodings: utf-8 default (others:gbk,ucs-bom)
set showcmd
set noshowmode " not show Insert,Normal at bottom left
set wildmenu
set number " Show line number
set cursorline " Show underline in current cursor
"highlight CursorLine cterm=underline gui=underline
set cursorcolumn " Show highlight in current column
" red line to 80 column
"highlight OverLength ctermbg=red ctermfg=white guibg=#592929
"match OverLength /\%81v.+/"
set wrap " not wrap the long line
set colorcolumn=81 " Display the limit of text width.
"au BufRead,BufNewFile CMakeLists.txt setlocal textwidth=80"
"set textwidth=80 " Restrict text width.
set mouse=a " Enable mouse to use (all mode)
set scrolloff=999 " Keep space from top and bottom. 999=center cursor vertically
set laststatus=2 " Alway show status bar at bottom
""" Tab setting
"set smartindent
set tabstop=2 " Tab key indents X spaces at a time
set softtabstop=2 " makes the spaces feel like real tabs
set shiftwidth=2 " X spaces indents
set expandtab " Use spaces when the key is pressed"
""" Searching and Pattens
set hlsearch " Highlight search by default.
set smarttab " handle tab more intelligently.
set incsearch " search pattern when still typing
set backspace=indent,eol,start
"size of commande line
set cmdheight=1
"set autochdir "move repository to current buffer
""""""""""""""""""""""""""""""""""
"history and backup functionality"
""""""""""""""""""""""""""""""""""
"set nobackup
"set nowb
"set noswapfile
"set backup
"set wb
set swapfile
"set shortmess=A
if !isdirectory($HOME . "/.vim/.backup")
call mkdir($HOME . "/.vim/.backup", "p", 0700)
endif
if !isdirectory($HOME . "/.vim/.undo")
call mkdir($HOME . "/.vim/.undo", "p", 0700)
endif
if !isdirectory($HOME . "/.vim/.swp")
call mkdir($HOME . "/.vim/.swp", "p", 0700)
endif
set undofile
set undodir=~/.vim/.undo//
set backupdir=~/.vim/.backup//
set directory=~/.vim/.swp//
set autoread
" No shearch sensitive case
set ignorecase
map cd :cd %:p:h:pwd
""""""""""""""""""""""
" enable fold methode
""""""""""""""""""""""
autocmd FileType jsonc set foldmethod=indent
set foldmethod=syntax
"set foldmethod=indent
set foldenable
set foldlevel=99
""enable fortran folding
let fortran_fold=1 " increase drastycely lag
let fortran_fold_conditionals=1
""fortran77 insert "&" on a new line column 6
let fortran_fixed_source=1
" let fortran_free_source=0
" let fortran_more_precise=1
let fortran_dialect="f77"
let fortran_have_tabs=1
" syn match fortranContinueMark display "^.{5}\S"lc=5
"" unlet! fortran_free_source
"filetype plugin indent on
let fortran_do_enddo=1
"" add column to left for folder numero and git wrapper
set foldcolumn=2
""DOXYGEN syntaxe
let g:load_doxygen_syntax=1
autocmd FileType c,cpp,h set comments-=://
autocmd FileType c,cpp,h set comments+=:///<
autocmd FileType c,cpp,h set comments+=://
autocmd FileType c,cpp,h set comments+=://!<
"set comments=sO:\ -,mO:\ \ ,exO:/,s1:/,mb:,ex:/,bO:///,O://,bO://!<
""""""""""""""""""""""""""""
" Add fr and en dictionary
""""""""""""""""""""""""""""
"setlocal spell spelllang=fr
map ":silent setlocal spell! spelllang=en"
map ":silent setlocal spell! spelllang=fr"
"hi clear SpellBad "disable udernlined error for spell"
"hi clear SpellCap "disable udernlined error for spell"
"hi clear SpellRare "disable udernlined error for spell"
"hi clear SpellLocal "disable udernlined error for spell"
set nospell "disable spell on vim start (push F6 or F7 for enable)"
set keymodel-=stopsel
set dictionary=D:\ftarroux\Documents\FRED\baseGit\vimrc-bashrc\liste.de.mots.francais.frgut.txt
"black hole register by default for d keyword
nnoremap dd "_dd
nnoremap d "_d
vnoremap d "_d
nnoremap D "_D
vnoremap D "_D
nnoremap x "_x
vnoremap x "_x
"c use register by default
nnoremap cc dd
nnoremap c d
vnoremap c d
"use black hole for suppr key map
noremap "_x
"grep word under cursor
nnoremap K :Ggrep! "\b\b":cw
" Keymapping for grep word under cursor with interactive mode
"nnoremap K :exe 'CocList -I --input='.expand('').' grep'
"Clear highlight on pressing ESC
nnoremap :noh
"map terminal
tnoremap
tnoremap
tnoremap
tnoremap
"show hidden char
set listchars=nbsp:☠,tab:▸␣
set list
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Function to allow to quit all secondary window.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! CloseAll()
silent! :CocCommand explorer --quit
"silent! :CocCommand explorer --quit
silent! pclose "close preview YCM
silent! ccl "close result ggrep
silent! helpclose "close help
silent! call Close_gstatus() "close gstatu
silent! call MyCloseDiff() "close git diff
call DeleteBufferByExtension(".git") "close git windows
"call Close_gina() "don t work
"silent! :CocCommand explorer --quit
endfunction
noremap q :call CloseAll()
"function! MyCloseFugitive()
"if &filetype('#') !~ '^fugitive:' && bufname('%') =~ '^fugitive:'
function! DeleteBufferByExtension(strExt)
let s:bufNr = bufnr("$")
while s:bufNr > 0
if buflisted(s:bufNr)
if (matchstr(bufname(s:bufNr), a:strExt) == a:strExt )
if getbufvar(s:bufNr, '&modified') == 0
execute "bd ".s:bufNr
endif
endif
endif
let s:bufNr = s:bufNr-1
endwhile
endfunction
" close current buffer if alternate is not fugitive but current one is
if bufname('#') !~ '^fugitive:' && bufname('%') =~ '^fugitive:'
if bufwinnr("#") == -1
b #
bd #
k
diffoff
close
else
bd
endif
else
bd #
k
diffoff
close
endif
endfunction
function! Close_gstatus()
for l:winnr in range(1, winnr('$'))
if !empty(getwinvar(l:winnr, 'fugitive_status'))
execute l:winnr.'close'
endif
endfor
endfunction
function Close_gina()
"for l:winnr in range(1, winnr('$'))
"don t show unlisted buffer with bufnr (:ls!)"
let s:bufNr = bufnr("$")
while s:bufNr > 0
if buflisted(s:bufNr)
echom s:bufNr
echom getbufvar(s:bufNr, 'current_syntax')
if (getbufvar(s:bufNr, 'current_syntax')==#'gina-status')
echom "fred2"
echom getbufvar(s:bufNr, 'current_syntax')
execute s:bufNr.'close'
endif
endif
let s:bufNr = s:bufNr-1
endwhile
endfunction
"pip install cmake_format to launch for this command
function! CmakeFormat()
execute "!cmake-format.exe -i " bufname("%")
endfunction
nnoremap :silent! call CmakeFormat()
com! CmakeFormat silent! call CmakeFormat()
:command! -complete=file -nargs=1 Rpdf :r !pdftotext -nopgbrk - |fmt -csw78
"""""""""""""""""""""""""""""""""""""
" coc-config-general
"""""""""""""""""""""""""""""""""""""
" TextEdit might fail if hidden is not set.
set hidden
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Give more space for displaying messages.
set cmdheight=2
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=500
" Don't pass messages to |ins-completion-menu|.
set shortmess+=c
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
"set signcolumn=yes
"" Find symbol of current document.
nnoremap no :CocList -A --tab outline
"" Search workspace symbols.
nnoremap ns :CocList -I symbols
" Use `[g` and `]g` to navigate diagnostics
nmap nh (coc-diagnostic-prev)
nmap nl (coc-diagnostic-next)
" GoTo code navigation.
nmap nd (coc-definition)
nmap ny (coc-type-definition)
nmap ni (coc-implementation)
nmap nr (coc-references)
" Use K to show documentation in preview window.
nnoremap nk :call show_documentation()
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('')
else
call CocAction('doHover')
endif
endfunction
"showSignatureHelp
autocmd User CocJumpPlaceholder call
\ CocActionAsync('showSignatureHelp')
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Symbol renaming.
nmap na (coc-rename)
xmap nf (coc-format)
nmap nf (coc-format)
" Apply AutoFix to problem on the current line.
nmap nq (coc-fix-current)
"""""""""""""""""""""""""""""""""""""
" coc-prettier configuration
"""""""""""""""""""""""""""""""""""""
nmap ² :CocCommand prettier.formatFile
"""""""""""""""""""""""""""""""""""""
" coc-snippets configuration
"""""""""""""""""""""""""""""""""""""
" Use for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = ''
" Use for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = ''
" Use for both expand and jump (make expand higher priority.)
"imap (coc-snippets-expand-jump)
" Use for trigger snippet expand.
" Use for select text for visual placeholder of snippet.
"nmap coc#expandableOrJumpable()
"Map for trigger completion, completion confirm, snippet expand and jump
"like VSCode. >
inoremap
\ pumvisible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" :
\ check_back_space() ? "\" :
\ coc#refresh()
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
"let g:coc_snippet_next = ''
" Use to trigger completion.
inoremap coc#refresh()
"for working with git gutter
if has('nvim')
set signcolumn=yes:2
else
set signcolumn=yes
endif
inoremap pumvisible() ? "\" : "\"
inoremap pumvisible() ? "\" : "\"
" Use for trigger snippet expand.
"imap (coc-snippets-expand)
" Use for select text for visual placeholder of snippet.
"vmap (coc-snippets-select)
"""""""""""""""""""""""""""""""""""""""""""""
"coc-completion
"""""""""""""""""""""""""""""""""""""""""""""
"Use and to navigate the completion list:
"inoremap pumvisible() ? "\" : "\"
"inoremap pumvisible() ? "\" : "\"
"inoremap pumvisible() ? "\" : "\"
"inoremap pumvisible() ? "\" : "\"
"Use to confirm completion
"inoremap pumvisible() ? "\" : "\u\"
"Note: you have to remap to make sure it confirm completion when pum is visible.
"Note: \u is used to break undo level.
"To make select the first completion item and confirm the completion when no item has been selected:
"inoremap pumvisible() ? coc#_select_confirm() : "\u\"
"To make coc.nvim format your code on , use keymap:
"inoremap pumvisible() ? coc#_select_confirm() : "\u\\=coc#on_enter()\"
"Close the preview window when completion is done. bug in buffer commandline
"with ctrl-F. to disable in this
"autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
"""""""""""""""""""""""""""""""""""""""""""
" coc-explorer
""""""""""""""""""""""""""""""""""""""""""""
:nmap e :CocCommand explorer --toggle
"""""""""""""""""""""""""""""""""""""""""""
" coc-json
""""""""""""""""""""""""""""""""""""""""""""
"auto update json schema
":autocmd FileType json call CocCommand json.retryResolveSchema
""""""""""""""""""""""""""""""""""""""""""""
" MAGIT
""""""""""""""""""""""""""""""""""""""""""""
nnoremap m :Magit
"""""""""""""""""""""""""""""""""""""""""""
" vim-which-key
""""""""""""""""""""""""""""""""""""""""""
nnoremap :WhichKey ''
"vnoremap :WhichKey ''
"set timeoutlen=1000
autocmd! FileType which_key
autocmd FileType which_key set laststatus=0 noshowmode noruler
\| autocmd BufLeave set laststatus=2 showmode ruler
""""""""""""""""""""""""""""""""""""""""""""
" coc-todolist
""""""""""""""""""""""""""""""""""""""""""""
:nmap ll :CocList -A --tab todolist
:nmap lc :CocCommand todolist.create
"map (easymotion-j)
"map (easymotion-k)
map l (easymotion-w)
map h (easymotion-b)
""map (easymotion-J)
""map (easymotion-K)
map L (easymotion-W)
map H (easymotion-B)
map e (easymotion-s)
"map (easymotion-j)
"map (easymotion-k)
"map (easymotion-w)
"map (easymotion-b)
"map (easymotion-J)
"map (easymotion-K)
"map L (easymotion-W)
"map H (easymotion-B)
"autocmd InsertChange * :CocCommand prettier.formatFile
"
"
""""""""""""""""""""""""""""""""""""""""""""""""
" coc-translator"
""""""""""""""""""""""""""""""""""""""""""""""""
" popup
"nmap ntt (coc-translator-p)
"vmap ntt (coc-translator-pv)
"" echo
"nmap nte (coc-translator-e)
"vmap nte (coc-translator-ev)
"" replace
"nmap ntr (coc-translator-r)
"vmap ntr (coc-translator-rv)
""""""""""""""""""""""""""""""""""""""""""""""""
" vim-translator"
""""""""""""""""""""""""""""""""""""""""""""""""
let g:translator_target_lang = 'fr'
let g:translator_source_lang = 'en'
" Echo translation in the cmdline
nmap te Translate
vmap te TranslateV
" Display translation in a window
nmap tt TranslateW
vmap tt TranslateWV
" Replace the text with translation
nmap tr TranslateR
vmap tr TranslateRV
" Translate the text in clipboard
nmap tx TranslateX
" Echo translation in the cmdline
nmap te! Translate!
vmap te! TranslateV!
" Display translation in a window
nmap tt! TranslateW!
vmap tt! TranslateWV!
" Replace the text with translation
nmap tr! TranslateR!
vmap tr! TranslateRV!
" Translate the text in clipboard
nmap tx! TranslateX!
""""""""""""""""""""""""""""""""""""""""""""""""
" rainbow_active"
""""""""""""""""""""""""""""""""""""""""""""""""
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle
au FileType cmake RainbowToggleOff "bug syntax higlighting
""""""""""""""""""""""""""""""""""""""""""""""""
" coc-bookmark"" to use when debugged
""""""""""""""""""""""""""""""""""""""""""""""""
"nmap bl (coc-bookmark-next)
"nmap bh (coc-bookmark-prev)
"nmap bt (coc-bookmark-toggle)
"nmap ba (coc-bookmark-annotate)
"nmap bz :CocList -A --tab bookmark
"""""""""""""""""""""""""""""""""""""""""""""""
" vim-bookmark"
"""""""""""""""""""""""""""""""""""""""""""""""
nmap bi BookmarkAnnotate
nmap ba BookmarkShowAll
nmap bj BookmarkNext
nmap bk BookmarkPrev
nmap
Good morning, sir,
The symbol " disappears for JSON files in my config because of this plugin. I use coc-json and neovim
my vimrc config below: ` set nocompatible " be iMproved, required filetype off " required, so vundle will be loaded properly
"let g:mapleader = "," let mapleader=" "
set rtp+=~/vimDebugPlugin set rtp+=~/.vim let g:coc_global_extensions = [ \ 'coc-ultisnips', \ 'coc-json', \ 'coc-prettier', \ 'coc-tsserver', \ 'coc-html', \ 'coc-css', \ 'coc-yaml', \ 'coc-highlight', \ 'coc-angular', \ 'coc-eslint', \ 'coc-marketplace', \ 'coc-snippets', \ 'coc-calc', \ 'coc-explorer', \ 'coc-tslint', \ 'coc-todolist', \ 'coc-tabnine', \ 'coc-cspell-dicts', \ 'coc-spell-checker', \ 'coc-browser', \ 'cspell-dict-vimlang', \'coc-pairs', \'coc-dictionary', \'coc-bookmark', \'coc-cmake' ]
call plug#begin('~/vimDebugPlugin') """"""""""""""""""""""""""""""""""" " color schema """"""""""""""""""""""""""""""""""" Plug 'altercation/vim-colors-solarized' " solarized color for vim Plug 'lifepillar/vim-solarized8' Plug 'morhetz/gruvbox' Plug 'romainl/flattened' Plug 'drewtempelmeyer/palenight.vim' Plug 'ayu-theme/ayu-vim' "set termguicolors " enable true colors support "let ayucolor="light" " for light version of theme "let ayucolor="mirage" " for mirage version of theme "let ayucolor="dark" " for dark version of theme "colorscheme ayu Plug 'arcticicestudio/nord-vim' Plug 'rakr/vim-one' Plug 'mhartington/oceanic-next' """"""""""""""""""""""""""""""""""
"Plug 'ncm2/float-preview.nvim' "Plug 'Yggdroot/indentLine' " bug for json file were '' disparait Plug 'nathanaelkane/vim-indent-guides' Plug 'heavenshell/vim-pydocstring', { 'do': 'make install' } Plug 'lifepillar/vim-cheat40' Plug 'jackguo380/vim-lsp-cxx-highlight' "syntaxe highlight C++ for coc.nvim Plug 'MattesGroeger/vim-bookmarks' Plug 'tpope/vim-surround' "surround word under cursor with flag (\"\" or ()...) Plug 'luochen1990/rainbow' "color pair of bracket for better lisibility
Plug 'mhinz/vim-startify' "show last recent opened file to vim startup "Plug 'prettier/vim-prettier', { 'do': 'yarn install' } "Plug 'sbdchd/neoformat' "Plug 'grailbio/bazel-compilation-database' Plug 'easymotion/vim-easymotion' Plug 'jreybert/vimagit' Plug 'liuchengxu/vim-which-key' Plug 'liuchengxu/vim-which-key', { 'on': ['WhichKey', 'WhichKey!'] } Plug 'neoclide/jsonc.vim' if has('nvim') else Plug 'pakutoma/toggle-terminal' endif Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() } } Plug 'will133/vim-dirdiff' "diff between directory Plug 'rstacruz/vim-closer' Plug 'tpope/vim-fugitive' "fugitive = git wrapper Plug 'lambdalisue/gina.vim' Plug 'gregsexton/gitv', {'on': ['Gitv']} "top git log Plug 'majutsushi/tagbar' "display a menu with tag in file "Plug 'vim-scripts/Gundo' "Gundo.vim is Vim plugin to visualize your Vim undo tree Plug 'mbbill/undotree' "show vim history Plug 'Konfekt/FastFold' "empeche les lag avec syntaxe fold method Plug 'Shougo/echodoc' "Displays function signatures from completions in the command line Plug 'Chiel92/vim-autoformat' "autoformat "Plug 'Valloric/YouCompleteMe', { 'do': './install.py --clangd-completer --clang-completer --clang-tidy --js-completer' } " YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for Vim. command ofr install : python install.py. alternative from omnicompletion + jedi-vim(for pyhton file) "Plug 'rdnetto/YCM-Generator', { 'branch': 'stable'} Plug 'itchyny/lightline.vim' Plug 'alvan/vim-closetag' "close html tag with key '>' or '>>' "Plug 'ludovicchabant/vim-gutentags' "auto tag git project Plug 'tell-k/vim-autopep8' "allow command autopep8 in vim for python file "Plug 'sjl/splice.vim' "tool for resolve threeMerge conflict "Plug 'sirver/ultisnips' "UltiSnips is the ultimate solution for snippets in Vim (coc_ultisnip used but documentation available here) Plug 'scrooloose/nerdcommenter' "allow commentcc for comment
"Plug 'Raimondi/delimitMate' "close bracket
Plug 'rchicoli/vim-zoomwin' "zoom with ctl-w-o
Plug 'airblade/vim-gitgutter'
Plug 'vim-scripts/DoxygenToolkit.vim'
"Plug 'dpelle/vim-Grammalecte'
Plug 'mhinz/vim-grepper'
Plug 'vigoux/LanguageTool.nvim'
"Plug 'dpelle/vim-LanguageTool'
Plug 'rhysd/vim-grammarous'
Plug 'junegunn/vim-easy-align' "align text
Plug 'skywind3000/asyncrun.vim'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'puremourning/vimspector'
"Plug 'mphe/grayout.vim'
"Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}}
Plug 'neoclide/coc.nvim', {'branch': 'release'} "can replaceYCM (more modern)
"Plug 'MaskRay/ccls', {'do': 'yarn install --frozen-lockfile'}
"Note: You may need to execute these commands in the "Developer Command Prompt for VS"
"git clone https://github.com/llvm/llvm-project.git
"cd llvm-project
"cmake -Hllvm -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_PROJECTS=clang "ninja -C Release clangFormat clangFrontendTool clangIndex clangTooling clang
"# Download ccls "cd ccls "cmake -H. -BRelease -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_PREFIX_PATH="D:/llvm/Release;D:/llvm/Release/tools/clang;D:/llvm;D:/llvm/tools/clang" "ninja -C Release "Plug 'universal-ctags/ctags', {'do' : nmake -f mk_mvc.mak} Plug 'universal-ctags/ctags' Plug 'voldikss/vim-translator' call plug#end() """""""""""""""""""""""""""""""""""" " disable to print FX on insert mode """""""""""""""""""""""""""""""""""" map!
map!
map!
map!
map!
map!
map!
map!
map!
map!
map!
packadd termdebug " add gdb to vim
syntax on " syntax highlighting
filetype on " try to detect filetypes
filetype plugin indent on " enable loading indent file for filetype
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " automatically leave insert mode after 'updatetime' milliseconds of inaction """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "augroup Foo "au CursorHoldI stopinsert" "" set 'updatetime' to 15 seconds when in insert mode "au InsertEnter let updaterestore=&updatetime | set updatetime=15000 "au InsertLeave * let &updatetime=updaterestore "augroup END "autocmd! Foo
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " return on normal mode when vim lost focus """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" "autocmd FocusLost * call feedkeys("\")
""""""""""""""""" " set powershell by terminal default """"""""""""""""" "set shell=powershell "create a bug on plug install !!! be careful "set shellcmdflag=-command " "set shell=powershell.exe "set shellcmdflag=-NoProfile\ -NoLogo\ -NonInteractive\ -Command "set shellpipe=| "set shellredir=> "set shell=powershell.exe\ -NoLogo\ -NoProfile\ -NonInteractive\ -ExecutionPolicy\ RemoteSigned " if shellcmdflag starts with '-' then tempname() uses forward slashes, see " https://groups.google.com/forum/#!topic/vim_dev/vTR05EZyfE0 "set shellcmdflag=\ -Command "set shellquote= "set shellxquote=( "let &shellpipe='| Out-File -Encoding UTF8 %s' "let &shellredir='| Out-File -Encoding UTF8 %s' "set noshellslash """"""""""""""""""" " asyncrun """""""""""""""""""" let g:asyncrun_wrapper = 'powershell -command' "let g:asyncrun_wrapper = 'pwsh -command'
""""""""""""""""""" " a.vim """"""""""""""""""" "unmap leader is who provoque a bug
"""""""""""""""""""" " markdownPreview.vim """"""""""""""""""" " set to 1, nvim will open the preview window after entering the markdown buffer " default: 0 let g:mkdp_auto_start = 0
"----------------- "" Plugin GRAMMALECT "----------------- "let g:grammalecte_cli_py='D:/ftarroux/Logiciel/Grammalecte-fr-v1.5.0/grammalecte-cli.py' "let g:grammalecte_cli_py='D:\ftarroux\Logiciel\Grammalecte-fr-v1.5.0\build\scripts-3.7\grammalecte-cli.py' "----------------- "" Plugin DEOPLETE "----------------- "let g:deoplete#enable_at_startup = 1 "----------------- "" Plugin Curtline "----------------- noremapgh :call CurtineIncSw()
"
"-----------------
"" Plugin Autoformat
"-----------------
"au BufWrite * :Autoformat "autoformat on save
"noremap :Autoformat
"autocmd FileType f,tex let b:autoformat_autoindent=0
"-----------------
"" Plugin delimitMate
"-----------------
let loaded_delimitMate = 1
"----------------- "" Plugin languageTool "----------------- "let g:grammarous#languagetool_cmd = '~\scoop/apps/languagetool/current/languagetool-commandline.jar' ":let g:languagetool_jar='~\scoop/apps/languagetool/current/languagetool-commandline.jar' :let g:languagetool_server_jar='~/scoop/apps/languagetool/current/languagetool-server.jar' "____ "vdebug "--------------------- "let g:vdebug_keymap = { "\ "run" : "",
"\ "run_to_cursor" : "",
"\ "step_over" : "",
"\ "step_into" : "",
"\ "step_out" : "",
"\ "close" : "",
"\ "detach" : "",
"\ "set_breakpoint" : "",
"\ "get_context" : "",
"\ "eval_under_cursor" : "",
"\ "eval_visual" : "e",
"}
"
"-----------------
"" toggle terminal
"-----------------
if has('nvim')
let g:term_buf = 0
let g:term_win = 0
function! Term_toggle(height)
if win_gotoid(g:term_win)
hide
else
"botright new
"vertical bo split new
vertical bo 80vsplit new
"belowright new
"exec "resize " . a:height
try
exec "buffer " . g:term_buf
catch
call termopen("powershell", {"detach": 0})
let g:term_buf = bufnr("")
endtry
startinsert!
let g:term_win = win_getid()
endif
endfunction
mapà :call Term_toggle(15)
tmap à <C->:call Term_toggle(15)
tmap <C->
tmap <C->
au BufEnter * if &buftype == 'terminal' | :startinsert | endif
else " map <C-@> to toggle tnoremap <C-@> :ToggleTerminal
nnoremap <C-@> :ToggleTerminal
" set your favorite shell "let g:toggle_terminal#command = 'pwsh' let g:toggle_terminal#command = 'powershell'
" set terminal window position " (see possible options at :help vertical) let g:toggle_terminal#position = 'topleft' endif " "----------------- "" Plugin gutentag "----------------- "let g:gutentags_exclude_filetypes = "cxx,hxx"
"----------------- "" Plugin ALE "----------------- "let g:ale_completion_enabled = 1 " let g:ale_linters = { " \ 'rust': ['rls', 'cargo'] " } " let g:ale_linters={'python': ['pylint', 'pydocstyle', 'mypy']}
"----------------- "" Plugin fugitive "----------------- autocmd BufReadPost fugitive:// set bufhidden=delete "autocmd QuickFixCmdPost grep* cwindow "alow to choose file in quickFiXList whit :Ggrep command "nnoremap a :Gstatus
" let g:EasyGrepOpenWindowOnMatch=0
"""""""""""""""""""""" " Configure ctags for vim """""""""""""""""""""" "Auto chearsh the first tags file from the current file set tags=./tags;,tags;
""""""""""""""""""""""""""""""""""" " Splice setting """"""""""""""""""""""""""""""""""" " let g:splice_prefix = "t "
""""""""""""""""""""""""""""""""""" " lightline setting """"""""""""""""""""""""""""""""""" let g:lightline = { \ 'active': { \ 'left':[ [ 'mode', 'paste' ], \ [ 'gitbranch', 'cocstatus','readonly', 'filename', 'modified' ] \ ] \ }, \ 'component': { \ 'lineinfo': ' %3l:%-2v', \ }, \ 'component_function': { \ 'gitbranch': 'fugitive#head', \ } \ } let g:lightline.separator = { \ 'left': '|', 'right': '|' } let g:lightline.subseparator = { \ 'left': '|', 'right': '|' }
let g:lightline.tabline = { \ 'left': [ ['tabs'] ], \ 'right': [ ['close'] ] \ }
let g:lightline = { \ 'colorscheme': 'wombat', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], \ [ 'cocstatus', 'readonly', 'filename', 'modified' ] ] \ }, \ 'component_function': { \ 'cocstatus': 'coc#status' \ }, \ }
" Use auocmd to force lightline update. autocmd User CocStatusChange,CocDiagnosticChange call lightline#update() set showtabline=2 " Show tabline set guioptions-=e " Don't use GUI tabline """"""""""""""""""" "markdown """"""""""""""""""" "let g:instant_markdown_slow = 1 "let g:instant_markdown_autostart = 0 "let g:instant_markdown_open_to_the_world = 1 "let g:instant_markdown_allow_unsafe_content = 1 "let g:instant_markdown_allow_external_content = 0 "let g:instant_markdown_mathjax = 1 "let g:instant_markdown_logfile = '/tmp/instant_markdown.log' "let g:instant_markdown_autoscroll = 0 "let g:instant_markdown_port = 8888 "let g:instant_markdown_python = 1 """"""""""""""""""" "Rip-rip clang-completion """""""""""""""""""
"let g:clang_library_path='/usr/bin/clang'
""""""""""""""""""" "clang-completion """"""""""""""""""" "let g:clang_format_auto = 1 "let g:clang_check_syntax_auto = 1 "let g:clang_verbose_pmenu = 1
""""""""""""""""""" "YouCompleteMe """"""""""""""""""" "disable arrow key and use tab for selection let g:ycm_key_list_select_completion = ['']
let g:ycm_key_list_previous_completion = ['']
let g:ycm_key_list_stop_completion = ['', '', '']
let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py'
"let g:ycm_clangd_binary_path = exepath('clangd')
"let g:loaded_youcompleteme = 1
"-----------------
" let g:ycm_log_level = 'debug'
" let g:ycm_show_diagnostics_ui = 0
"let g:enable_ycm_at_startup = 0
""""""" Let clangd fully control code completion
let g:ycm_clangd_uses_ycmd_caching = 0
" Use installed clangd, not YCM-bundled clangd which doesn't get updates.
let g:ycm_clangd_binary_path = exepath("clangd")
let g:ycm_autoclose_preview_window_after_insertion = 1
if has('nvim')
else
"set pythondll=D:\ftarroux\Logiciel\Python2\python27.dll
"set pythonthreedll=D:\ftarroux\Logiciel\Python36\python36.dll
"set pythonthreedll=D:\LOGICELW7\Python3.7.7\python37.dll
endif
noremapgr :YcmCompleter GoToReferences
nnoremap gg :YcmCompleter GoTo
nnoremap ge :YcmCompleter GoToDeclaration
nnoremap gt :YcmCompleter GetType
nnoremap gd :YcmCompleter GetDoc
nnoremap gf :YcmCompleter FixIt
nnoremap :YcmForceCompileAndDiagnostics
nnoremap :YcmCompleter Format
"nnoremap ² :YcmCompleter Format
"----------------- "" Plugin solarized "----------------- syntax enable "set background=dark "set guifont=Monospace\ Bold\ 16 "colorscheme solarized "colorscheme gruvbox colorscheme solarized8 "set guifont=Source_Code_Pro:h13 set guifont=Consolas:h14:cANSI set background=dark ":GuiFont! Consolas:h13:cANSI "set guifont=*:h13 "set guifont=Source_Code_Pro:b:h13.5
" let g:ctrlp_by_filename = 1
"----------------- "" Plugin Ctrlp "----------------- " let g:ctrlp_working_path_mode = 'rc' " let g:ctrlp_by_filename = 1 " let g:ctrlp_max_files = 0 " mapj :CtrlP
" map :CtrlPMRUFiles
" map :CtrlPBuffer
""""""""""""""""""""" " Autoclose old buffer """"""""""""""""""""" " function CloseLast () " python <<EOF " import vim " N = 10 " listed_buffers = [b for b in vim.buffers if b.options['buflisted'] and not b.options['modified']] " for i in range (0, len (listed_buffers) - N): " vim.command (':bd' + str (listed_buffers[i].number)) " EOF " endfunction " autocmd BufNew * call CloseLast()
"----------------- "" Plugin NerdTree "----------------- let NERDChristmasTree=1 let NERDTreeWinSize=100 map :NERDTreeToggle
map :NERDTreeFind
" " "----------------- "" Plugin Tagbar "----------------- map :Tagbar
"let g:tagbar_ctags_bin = 'D:\ftarroux\Logiciel\ctags58\ctags.exe'
"let g:tagbar_ctags_bin = 'D:\LOGICELW7\ctags\ctags.exe'
"let g:tagbar_ctags_bin='ctags'
let g:tagbar_width=30
let g:tagbar_autofocus = 1
let g:tagbar_sort = 1
"----------------- "" Plugin Gundo "----------------- "nnoremap :GundoToggle
" inoremap :GundoToogle
"
"-----------------
"" Plugin UndotreeToggle
"-----------------
nnoremap :UndotreeToggle
""----------------- """ Plugin supertab ""----------------- "let g:SuperTabDefaultCompletionType = ""
" "----------------- "" Configure gvim "----------------- "set guioptions-=T " remove Tool bar "set guioptions-=r " remove Right bar "set guioptions-=L " remove Left bar "set guioptions=c " you can copy with maj in insert modeuu " cause big lag on visual mode (set guioption+=a ":set guioptions+=a keymodel=startsel,stopsel "use system clipboard set clipboard=unnamed "correct cursor bug for gnome terminal let &t_SI = "\[6 q"
let &t_SR = "\[4 q"
let &t_EI = "\[2 q"
"Change cursor shape for GNU screen
if &term =~ "screen."
let &t_ti.="\eP\e[1 q\e\"
let &t_SI.="\eP\e[5 q\e\"
let &t_EI.="\eP\e[1 q\e\"
let &t_te.="\eP\e[0 q\e\"
else
let &t_ti.="\[1 q"
let &t_SI.="\[5 q"
let &t_EI.="\[1 q"
let &t_te.="\[0 q"
endif
"use classic editor shortcut
set mouse=a
set nu
map GVgg
nnoremap :w
inoremap :w
noremap h :history
nmap q:
map y
"imap :%s/
nmap :%s/
vmap :s/
" vnoremap "hy:%s/h//gcmap /
"Allow to shearch visula selection with
vnoremap y/\VC-r>=escape(@",'/\')<CR
" Smart way to move between windows
map h
map l
map k
map j
"nnoremapv :e ~/.vimrc
"===============================
" Common Configuration for Vim
"================================
set encoding=utf-8 " utf-8 default (others: big5, gbk, euc-jp)
set fencs=utf-8 " fileencodings: utf-8 default (others:gbk,ucs-bom)
set showcmd
set noshowmode " not show
Insert,Normal
at bottom left set wildmenu set number " Show line number set cursorline " Show underline in current cursor "highlight CursorLine cterm=underline gui=underline set cursorcolumn " Show highlight in current column " red line to 80 column "highlight OverLength ctermbg=red ctermfg=white guibg=#592929 "match OverLength /\%81v.+/" set wrap " not wrap the long line set colorcolumn=81 " Display the limit of text width. "au BufRead,BufNewFile CMakeLists.txt setlocal textwidth=80" "set textwidth=80 " Restrict text width. set mouse=a " Enable mouse to use (all mode)set scrolloff=999 " Keep space from top and bottom. 999=center cursor vertically
set laststatus=2 " Alway show status bar at bottom """ Tab setting "set smartindent set tabstop=2 " Tab key indents X spaces at a time set softtabstop=2 " makes the spaces feel like real tabs set shiftwidth=2 " X spaces indents set expandtab " Use spaces when the key is pressed"
""" Searching and Pattens
set hlsearch " Highlight search by default.
set smarttab " handle tab more intelligently.
set incsearch " search pattern when still typing
set backspace=indent,eol,start
"size of commande line
set cmdheight=1
"set autochdir "move repository to current buffer
""""""""""""""""""""""""""""""""""
"history and backup functionality"
""""""""""""""""""""""""""""""""""
"set nobackup
"set nowb
"set noswapfile
"set backup
"set wb
set swapfile
"set shortmess=A
if !isdirectory($HOME . "/.vim/.backup")
call mkdir($HOME . "/.vim/.backup", "p", 0700)
endif
if !isdirectory($HOME . "/.vim/.undo")
call mkdir($HOME . "/.vim/.undo", "p", 0700)
endif
if !isdirectory($HOME . "/.vim/.swp")
call mkdir($HOME . "/.vim/.swp", "p", 0700)
endif
set undofile set undodir=~/.vim/.undo// set backupdir=~/.vim/.backup// set directory=~/.vim/.swp// set autoread
" No shearch sensitive case set ignorecase mapcd :cd %:p:h:pwd
"""""""""""""""""""""" " enable fold methode """""""""""""""""""""" autocmd FileType jsonc set foldmethod=indent set foldmethod=syntax "set foldmethod=indent set foldenable set foldlevel=99 ""enable fortran folding let fortran_fold=1 " increase drastycely lag let fortran_fold_conditionals=1 ""fortran77 insert "&" on a new line column 6 let fortran_fixed_source=1 " let fortran_free_source=0 " let fortran_more_precise=1 let fortran_dialect="f77" let fortran_have_tabs=1 " syn match fortranContinueMark display "^.{5}\S"lc=5 "" unlet! fortran_free_source "filetype plugin indent on let fortran_do_enddo=1 "" add column to left for folder numero and git wrapper set foldcolumn=2
""DOXYGEN syntaxe let g:load_doxygen_syntax=1 autocmd FileType c,cpp,h set comments-=:// autocmd FileType c,cpp,h set comments+=:///< autocmd FileType c,cpp,h set comments+=:// autocmd FileType c,cpp,h set comments+=://!< "set comments=sO:\ -,mO:\ \ ,exO:/,s1:/,mb:,ex:/,bO:///,O://,bO://!< """""""""""""""""""""""""""" " Add fr and en dictionary """""""""""""""""""""""""""" "setlocal spell spelllang=fr map ":silent setlocal spell! spelllang=en"
map ":silent setlocal spell! spelllang=fr"
"hi clear SpellBad "disable udernlined error for spell"
"hi clear SpellCap "disable udernlined error for spell"
"hi clear SpellRare "disable udernlined error for spell"
"hi clear SpellLocal "disable udernlined error for spell"
"hi SpellBad cterm=underline ctermfg=9 ctermbg=0 gui=undercurl "hi SpellCap cterm=underline ctermfg=14 ctermbg=0 gui=undercurl "hi SpellRare cterm=underline ctermfg=13 ctermbg=0 gui=undercurl "hi SpellLocal cterm=underline ctermfg=11 ctermbg=0 gui=undercurl
set nospell "disable spell on vim start (push F6 or F7 for enable)" set keymodel-=stopsel set dictionary=D:\ftarroux\Documents\FRED\baseGit\vimrc-bashrc\liste.de.mots.francais.frgut.txt
"""""""""""""""""""""""""" " Personal remap """"""""""""""""""""""""" mapè :resize 10
"nnoremap >>
"nnoremap <<
"vnoremap >gv
"vnoremap <gv
nnoremap << >>
nnoremap >> <<
vnoremap << >gv
vnoremap >> <gv
"black hole register by default for d keyword nnoremap dd "_dd nnoremap d "_d vnoremap d "_d nnoremap D "_D vnoremap D "_D
nnoremap x "_x vnoremap x "_x
"c use register by default nnoremap cc dd nnoremap c d vnoremap c d
"use black hole for suppr key map noremap
"_x"grep word under cursor nnoremap K :Ggrep! "\b\b":cw
" Keymapping for grep word under cursor with interactive mode
"nnoremap K :exe 'CocList -I --input='.expand('').' grep'
"Clear highlight on pressing ESC nnoremap :noh
"map terminal
tnoremap
tnoremap
tnoremap
tnoremap
"show hidden char
set listchars=nbsp:☠,tab:▸␣
set list
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Function to allow to quit all secondary window.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! CloseAll()
silent! :CocCommand explorer --quit
"silent! :CocCommand explorer --quit
silent! pclose "close preview YCM
silent! ccl "close result ggrep
silent! helpclose "close help
silent! call Close_gstatus() "close gstatu
silent! call MyCloseDiff() "close git diff
call DeleteBufferByExtension(".git") "close git windows
"call Close_gina() "don t work
"silent! :CocCommand explorer --quit
endfunction
noremap q :call CloseAll()
"function! MyCloseFugitive()
"if &filetype('#') !~ '^fugitive:' && bufname('%') =~ '^fugitive:'
function! DeleteBufferByExtension(strExt) let s:bufNr = bufnr("$") while s:bufNr > 0 if buflisted(s:bufNr) if (matchstr(bufname(s:bufNr), a:strExt) == a:strExt ) if getbufvar(s:bufNr, '&modified') == 0 execute "bd ".s:bufNr endif endif endif let s:bufNr = s:bufNr-1 endwhile endfunction
function! MyCloseDiff() if (&diff == 0 || getbufvar('#', '&diff') == 0) \ && (bufname('%') !~ '^fugitive:' && bufname('#') !~ '^fugitive:') echom "Not in diff view." return endif
" close current buffer if alternate is not fugitive but current one is if bufname('#') !~ '^fugitive:' && bufname('%') =~ '^fugitive:' if bufwinnr("#") == -1 b # bd #