diff options
author | ache <ache@ache.one> | 2024-01-05 17:50:37 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2024-01-05 17:50:37 +0100 |
commit | 9bcddc3a1f994cb97d89ab142259bc0b0c6c2cfc (patch) | |
tree | 0069d13ac01d15972e85b1688df6fb027bf8553e | |
parent | Add comment to current config (diff) |
Add comments and switch Lazy.nvim for colorscheme
-rwxr-xr-x | plugin/perso.vim | 207 |
1 files changed, 94 insertions, 113 deletions
diff --git a/plugin/perso.vim b/plugin/perso.vim index 3cd6eef..75ab213 100755 --- a/plugin/perso.vim +++ b/plugin/perso.vim @@ -1,99 +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>c :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 ==? "slate" + 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 ==? "solarized8_dark_high" - colo slate + elseif g:colors_name ==? "jellybeans" + colo moonlight else - colo slate + colo moonlight hi CursorLine term=bold cterm=bold ctermbg=white hi CursorColumn ctermbg=Yellow endif catch /^Vim:E121/ - colo slate + 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> @@ -103,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() @@ -150,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) @@ -193,10 +176,12 @@ 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) @@ -206,30 +191,26 @@ xmap <leader>ga <Plug>(EasyAlign) nmap <leader>ga <Plug>(EasyAlign) -noremap <silent> =g :GrammalecteCheck<CR> -noremap <silent> =G :GrammalecteClear<CR> +" 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> -" Hexokinase -let g:Hexokinase_highlighters = ['background', 'virtual'] -set termguicolors - " let g:vimspector_enable_mappings = 'HUMAN' " nmap <leader>dd :call vimspector#Launch()<CR> @@ -257,11 +238,11 @@ 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> -map ]<leader> :ALENext<CR> -map [<leader> :ALEPrevious<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 @@ -269,13 +250,8 @@ 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) -" Rg current word -nnoremap <silent> <Leader>rg :Rg <C-R><C-W><CR> - -nnoremap <silent> <Leader>/ :Files<CR> - +" Congure Grammalecte let g:grammalecte_cli_py='/usr/bin/grammalecte-cli' - function! GrammalecteToggle() try if exists("g:grammalecte_state") && g:grammalecte_state ==? "on" @@ -289,6 +265,7 @@ function! GrammalecteToggle() endfunction +" Congure CopIlot function! CopilotToggle() try if exists("g:copilot_enabled_toggle") && g:copilot_enabled_toggle ==? "on" @@ -305,6 +282,8 @@ function! CopilotToggle() endtry endfunction + +" Congure Tabby function! TabbyToggle() try if exists("g:tabby_enabled_toggle") && g:tabby_enabled_toggle ==? "on" @@ -318,20 +297,22 @@ function! TabbyToggle() endif endtry endfunction - let g:tabby_trigger_mode = 'manual' +" Configure git blame +nnoremap <leader>b :ToggleBlame virtual<cr> - -" call CopilotToggle() - - -nnoremap <leader><F5> :call GrammalecteToggle()<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> -" Move tabs -nmap <C-S-PageUp> :tabmove -1<cr> -nmap <C-S-PageDown> :tabmove +1<cr> |