" Define the leader key, which is used to create a lot of shortcurts let mapleader = "!" " map leader to bang " I think it's the little help in the right bottom line " It shows the current state of the command like "3y" for "3yy" set showcmd " Why the hell does Vim add \n add the end of a file ? set nofixendofline " Show progress of the file (percentage and nunber of line) set ruler " Turns on file detection, plugin and indentation filetype plugin indent on " Used to move tabs nmap :tabmove -1 nmap :tabmove +1 " Function to quickly change color scheme nnoremap c :call ChangeColor() let g:colors_name = 'badwolf' function! ChangeColor() try if g:colors_name ==? "moonlight" colo badwolf "hi CursorLine term=bold cterm=bold ctermbg=black "hi CursorColumn ctermbg=54 "hi CursorLine term=bold cterm=bold ctermbg=black "hi CursorColumn ctermbg=54 elseif g:colors_name ==? "badwolf" colo jellybeans elseif g:colors_name ==? "jellybeans" colo moonlight else colo moonlight hi CursorLine term=bold cterm=bold ctermbg=white hi CursorColumn ctermbg=Yellow endif catch /^Vim:E121/ colo moonlight hi CursorLine term=bold cterm=bold ctermbg=white hi CursorColumn ctermbg=Yellow endtry endfunction " Color : autocmd ColorScheme * highlight ExtraWhitespace ctermbg=darkred guibg=darkred " Hexokinase " A plugin to color the colorname in the source code by the actual color it's for. let g:Hexokinase_highlighters = ['background', 'virtual'] set termguicolors " To activate maximum of colors ? Don't know " Show a line horizontal line on the cursor set cursorline " Put a colored column on the 120th characers set colorcolumn=120 set cursorcolumn " Activate highlight search. set hls set incsearch " Don't remenber " Set the color of trailing white space in red ! ⛔ match ExtraWhitespace /\s\+$/ " Completion related options " wildcard char = set wildmenu set wildmode=list:longest:full " Emacs style go to Origin/End in insert mode inoremap A inoremap 0i " Set usefull shortcurts for command ca tn tabnew ca tc tabc " Grammatical verification map :setlocal spell! spelllang=fr map :setlocal spell! spelllang=en_us " Quick past the date inoremap =strftime('%F') inoremap =strftime('%c') " Personal compil shortcurts " I'm not sure there are very used noremap :make:cw:!./a.out map :make:cw noremap [q :copen noremap ]q :cclose noremap [Q :cfirst noremap ]Q :clast noremap [[ :cprev noremap ]] :cnext " Allow vim clipboad <-> host clipboard to share data " Very much used. set clipboard=unnamedplus " Quick Comment : autocmd FileType c,cpp,java,go,scala,js let b:comment_leader = '//' autocmd FileType sh,ruby,python let b:comment_leader = '#' autocmd FileType conf,fstab let b:comment_leader = '#' autocmd FileType tex let b:comment_leader = '%' autocmd FileType mail let b:comment_leader = '>' autocmd FileType vim let b:comment_leader = '"' autocmd FileType haskell let b:comment_leader = '--' noremap ,cc :silent s/^/=escape(b:comment_leader,'\/')/:nohlsearch noremap :silent s/^/=escape(b:comment_leader,'\/')/:nohlsearch noremap ,cu :silent s/^\V=escape(b:comment_leader,'\/')//e:nohlsearch noremap :silent s/^\V=escape(b:comment_leader,'\/')//e:nohlsearch " Fold method based on syntax. For Python, there is a plugin for that. autocmd FileType c,cpp,java,go,scala,js,rust set foldmethod=syntax " Completion baed on language ? I don't know. set omnifunc=syntaxcomplete#Complete " Change directory nnoremap cd :cd %:p:h " Type "//" to disable highlight search. nnoremap // :nohls " Compil option autocmd Filetype c call SetCCompiler() function SetCCompiler() if !(filereadable("makefile") || filereadable("Makefile")) set makeprg=gcc\ % endif endfunction autocmd Filetype python call SetPythonCompiler() function SetPythonCompiler() if executable("flake8") set makeprg=flake8\ --ignore=E111,E303,E201,E231,E391,E225,E203,E226,W391\ % set textwidth=2000 endif endfunction noremap zv :!markdown % \| w3m -I utf-8 -T text/html " let g:deoplete#enable_at_startup = 1 " imap (neosnippet_expand_or_jump) " smap (neosnippet_expand_or_jump) " xmap (neosnippet_expand_target) " set completeopt-=preview " call deoplete#custom#option('auto_complete', v:false) " Plugin key-mappings. " Note: It must be "imap" and "smap". It uses mappings. " imap (neosnippet_expand_or_jump) " smap (neosnippet_expand_or_jump) " xmap (neosnippet_expand_target) " SuperTab like snippets behavior. " Note: It must be "imap" and "smap". It uses mappings. "imap " \ pumvisible() ? "\" : " \ neosnippet#expandable_or_jumpable() ? " \ "\(neosnippet_expand_or_jump)" : "\" "smap neosnippet#expandable_or_jumpable() ? "\ "\(neosnippet_expand_or_jump)" : "\" " For conceal markers. " Conceal is an option to hide irrelevant characters. " Maybe disabled if has('conceal') set conceallevel=2 concealcursor=niv endif " C-L to actually toggle conceal feature. map :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=2" " Start interactive EasyAlign in visual mode (e.g. vipga) xmap ga (EasyAlign) " Start interactive EasyAlign for a motion/text object (e.g. gaip) nmap ga (EasyAlign) " Configure linter let b:ale_linters = { 'javascript': ['eslint', 'xo', 'jscs', 'jshint', 'standard'], 'typescript': ['eslint', 'tsserver', 'deno'], 'python': ['ruff']} " LSP is used by nvim let g:ale_disable_lsp = 1 " ale message config : let g:ale_echo_msg_error_str = '⛔' let g:ale_echo_msg_warning_str = '⚠️' let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' " Ale only on save, otherwise, it's called too much and have to many false potitive let g:ale_lint_on_text_changed = 'never' let g:ale_lint_on_enter = 0 " nvim.tree.lua map x :NvimTreeToggle map c :NvimTreeFindFile " let g:vimspector_enable_mappings = 'HUMAN' " nmap dd :call vimspector#Launch() " nmap dx :VimspectorReset " nmap dr :VimspectorReset " nmap de :VimspectorEval " nmap dw :VimspectorWatch " nmap do :VimspectorShowOutputlet g:vimspector_install_gadgets = [ 'debugpy', 'delve', 'CodeLLDB' ] " nmap dt :call vimspector#ToggleBreakpoint() " nmap dT :call vimspector#ClearBreakpoints() " " nmap dp :call vimspector#Pause() " nmap ds :call vimspector#Stop() " nmap dac :call vimspector#Continue() " nmap dar :call vimspector#Restart() " nmap dag :call vimspector#GoToCurrentLine() " nmap dao :call vimspector#StepOver() " nmap da> :call vimspector#StepInto() " nmap da< :call vimspector#StepOut() " nmap dap :call vimspector#UpFrame() " nmap dan :call vimspector#DownFrame() let g:python3_host_prog = '/usr/bin/python3' autocmd BufNewFile,BufRead /tmp/mesms_* set noautoindent filetype=mail wm=0 tw=78 nonumber digraph nolist nopaste " To disable ALE map at :ALEToggle " To move between ALE message (usually errors) map > :ALENext map < :ALEPrevious au BufReadPost,BufNewFile *.tmpl,*.tpm,*.svelte set filetype=html command! -bang -nargs=* Rg \ call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case ".shellescape(), 1, \ fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}), 0) " Congure Grammalecte let g:grammalecte_cli_py='/usr/bin/grammalecte-cli' function! GrammalecteToggle() try if exists("g:grammalecte_state") && g:grammalecte_state ==? "on" GrammalecteClear let g:grammalecte_state = "off" else let g:grammalecte_state = "on" GrammalecteCheck endif endtry endfunction " Congure CopIlot function! CopilotToggle() try if exists("g:copilot_enabled_toggle") && g:copilot_enabled_toggle ==? "on" Copilot disable let g:copilot_enabled_toggle = "off" else if exists("g:copilot_enabled_toggle") Copilot enable else :packadd copilot.vim endif let g:copilot_enabled_toggle = "on" endif endtry endfunction " Congure Tabby function! TabbyToggle() try if exists("g:tabby_enabled_toggle") && g:tabby_enabled_toggle ==? "on" let g:tabby_enabled_toggle = v:false let g:tabby_trigger_mode = 'manual' else if !exists("g:tabby_enabled_toggle") :packadd vim-tabby endif let g:tabby_trigger_mode = 'auto' endif endtry endfunction let g:tabby_trigger_mode = 'manual' " Configure git blame nnoremap b :ToggleBlame virtual " External program call nnoremap x :call TabbyToggle() nnoremap :call CopilotToggle() nnoremap :call GrammalecteToggle() noremap =g :GrammalecteCheck noremap =G :GrammalecteClear " Call ripgrep " To find the current word in the working directory nnoremap rg :Rg " To find a file in the current working directory nnoremap / :Files