diff options
Diffstat (limited to 'plugin/perso.vim')
-rwxr-xr-x | plugin/perso.vim | 273 |
1 files changed, 181 insertions, 92 deletions
diff --git a/plugin/perso.vim b/plugin/perso.vim index 1981757..75ab213 100755 --- a/plugin/perso.vim +++ b/plugin/perso.vim @@ -1,97 +1,98 @@ -set showcmd +" Define the leader key, which is used to create a lot of shortcurts +let mapleader = "!" " map leader to bang -set backspace=indent,eol,start +" 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 - -set clipboard=unnamedplus +" Show progress of the file (percentage and nunber of line) set ruler -set t_Co=256 -"map <leader>j <C-W>j -"map <leader>k <C-W>k -"map <leader>h <C-W>h -"map <leader>l <C-W>l -inoremap <C-N> <C-P> -inoremap <C-P> <C-N> +" Turns on file detection, plugin and indentation +filetype plugin indent on -let mapleader = "!" " map leader to bang +" Used to move tabs +nmap <C-S-PageUp> :tabmove -1<cr> +nmap <C-S-PageDown> :tabmove +1<cr> -nnoremap <leader>f :call FoldColumnToggle()<cr> -function! FoldColumnToggle() +" Function to quickly change color scheme +nnoremap <leader>c :call ChangeColor()<cr> +let g:colors_name = 'badwolf' +function! ChangeColor() try - if g:colors_name ==? "pink" + 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 + "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 pink + colo moonlight hi CursorLine term=bold cterm=bold ctermbg=white hi CursorColumn ctermbg=Yellow endif catch /^Vim:E121/ - colo pink + colo moonlight hi CursorLine term=bold cterm=bold ctermbg=white hi CursorColumn ctermbg=Yellow endtry endfunction -filetype plugin indent on - " Color : autocmd ColorScheme * highlight ExtraWhitespace ctermbg=darkred guibg=darkred -colo badwolf -hi CursorLine term=bold cterm=bold ctermbg=black -hi CursorColumn ctermbg=54 +" 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 = <TAB> set wildmenu set wildmode=list:longest:full -nnoremap <silent><A-o> :set paste<CR>m`o<Esc>``:set nopaste<CR> -nnoremap <silent><A-O> :set paste<CR>m`O<Esc>``:set nopaste<CR> - +" Emacs style go to Origin/End in insert mode inoremap <c-e> <Esc>A inoremap <c-a> <Esc>0i -"Perso C définition" -inoremap prt printf -inoremap swf printf -inoremap #in< #include <><left> -inoremap #in" #include ""<left> -inoremap #def #define -inoremap #un #undef -inoremap #ifn #ifndef -inoremap #ifd #ifdef -inoremap #std #include <stdlib.h> -inoremap #io #include <stdio.h> - -inoremap #main int main(void) {<CR>}<Esc><Up>A -inoremap ##main int main(int argc, char* argv[]) {<CR>}<Esc><Up>A - -" Personal shortcurts - +" Set usefull shortcurts for command ca tn tabnew ca tc tabc +" Grammatical verification map <F5> :setlocal spell! spelllang=fr<CR> map <F6> :setlocal spell! spelllang=en_us<CR> + +" Quick past the date inoremap <F7> <C-r>=strftime('%F')<CR> inoremap <F8> <C-r>=strftime('%c')<CR> " Personal compil shortcurts +" I'm not sure there are very used noremap <Space><F9> :make<CR>:cw<CR><CR>:!./a.out<CR> map <F9> :make<CR>:cw<CR><CR> noremap <silent> [q :copen<CR> @@ -101,37 +102,37 @@ noremap <silent> ]Q :clast<CR> noremap <silent> [[ :cprev<CR> noremap <silent> ]] :cnext<CR> - - - -"Allow vim clipboad <-> host clipboard to share data +" 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 = '--' - -autocmd FileType c,cpp,java,go,scala set foldmethod=syntax - +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 <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> +noremap <silent> <c-c><c-c> :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> +noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> +noremap <silent> <c-c><c-x> :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> -noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> -noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> +" 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 -noremap <silent> <c-c><c-c> :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> -noremap <silent> <c-c>c :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> +" Completion baed on language ? I don't know. +set omnifunc=syntaxcomplete#Complete +" Change directory nnoremap cd :cd %:p:h<CR> +" Type "//" to disable highlight search. nnoremap <silent> // :nohls<CR> - - " Compil option autocmd Filetype c call SetCCompiler() function SetCCompiler() @@ -148,25 +149,9 @@ function SetPythonCompiler() endif endfunction - - - noremap <silent> zv :!markdown % \| w3m -I utf-8 -T text/html - - - - -set colorcolumn=80 -set cursorcolumn -set hls -set incsearch - -let $VIMHOME=expand('<sfile>:p:h:h') -au BufNewFile *.c 0r $VIMHOME/template/skel.c - - " let g:deoplete#enable_at_startup = 1 " imap <C-k> <Plug>(neosnippet_expand_or_jump) " smap <C-k> <Plug>(neosnippet_expand_or_jump) @@ -191,39 +176,143 @@ au BufNewFile *.c 0r $VIMHOME/template/skel.c " 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 <C-l> :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=2"<CR> " Start interactive EasyAlign in visual mode (e.g. vipga) -xmap ga <Plug>(EasyAlign) +xmap <leader>ga <Plug>(EasyAlign) " Start interactive EasyAlign for a motion/text object (e.g. gaip) -nmap ga <Plug>(EasyAlign) +nmap <leader>ga <Plug>(EasyAlign) -noremap <silent> =g :GrammalecteCheck<CR> -noremap <silent> =G :GrammalecteClear<CR> -let b:ale_linters = { 'javascript': ['eslint', 'xo', 'jscs', 'jshint', 'standard'], 'typescript': ['eslint', 'tsserver', 'deno'] } +" 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 = 'E' -let g:ale_echo_msg_warning_str = 'W' + +" 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 +" 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 <C-C>x :NvimTreeToggle<CR> +map <C-C>c :NvimTreeFindFile<CR> + + +" let g:vimspector_enable_mappings = 'HUMAN' +" nmap <leader>dd :call vimspector#Launch()<CR> +" nmap <leader>dx :VimspectorReset<CR> +" nmap <leader>dr :VimspectorReset<CR> +" nmap <leader>de :VimspectorEval +" nmap <leader>dw :VimspectorWatch +" nmap <leader>do :VimspectorShowOutputlet g:vimspector_install_gadgets = [ 'debugpy', 'delve', 'CodeLLDB' ] +" nmap <Leader>dt :call vimspector#ToggleBreakpoint()<CR> +" nmap <Leader>dT :call vimspector#ClearBreakpoints()<CR> +" +" nmap <Leader>dp :call vimspector#Pause()<CR> +" nmap <Leader>ds :call vimspector#Stop()<CR> +" nmap <Leader>dac :call vimspector#Continue()<CR> +" nmap <Leader>dar :call vimspector#Restart()<CR> +" nmap <Leader>dag :call vimspector#GoToCurrentLine()<CR> +" nmap <Leader>dao :call vimspector#StepOver()<CR> +" nmap <Leader>da> :call vimspector#StepInto()<CR> +" nmap <Leader>da< :call vimspector#StepOut()<CR> +" nmap <Leader>dap :call vimspector#UpFrame()<CR> +" nmap <Leader>dan :call vimspector#DownFrame()<CR> + + +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 <Esc>at :ALEToggle<CR> - -set omnifunc=syntaxcomplete#Complete +" To move between ALE message (usually errors) +map <leader>> :ALENext<CR> +map <leader>< :ALEPrevious<CR> 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(<q-args>), 1, + \ fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}), <bang>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 <leader>b :ToggleBlame virtual<cr> + +" External program call +nnoremap <leader>x :call TabbyToggle()<cr> +nnoremap <leader><m-x> :call CopilotToggle()<cr> +nnoremap <leader><F5> :call GrammalecteToggle()<cr> +noremap <silent> =g :GrammalecteCheck<CR> +noremap <silent> =G :GrammalecteClear<CR> + +" Call ripgrep +" To find the current word in the working directory +nnoremap <silent> <Leader>rg :Rg <C-R><C-W><CR> +" To find a file in the current working directory +nnoremap <silent> <Leader>/ :Files<CR> + + |