From a5c696d860d00db535dca079677f356ef851d239 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Fri, 13 May 2022 16:35:09 +0200 Subject: [PATCH] [WIP] start to rework vim config --- vim.org | 632 ++++++++++++++++---------------------------------------- 1 file changed, 173 insertions(+), 459 deletions(-) diff --git a/vim.org b/vim.org index 243f328..6b27456 100644 --- a/vim.org +++ b/vim.org @@ -11,10 +11,16 @@ call plug#begin('~/.vim/plugged') #+end_src ** Manage Files +File Manager: #+begin_src vimrc -Plug 'tpope/vim-vinegar' " Combine with netrw to create a delicious salad dressing -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } " A command-line fuzzy finder written in Go -Plug 'junegunn/fzf.vim' " Fzf for vim +Plug 'tpope/vim-vinegar' +#+end_src + +Fuzzy Find: +#+begin_src vimrc +Plug 'nvim-lua/plenary.nvim' +Plug 'nvim-telescope/telescope.nvim' +Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } #+end_src ** Text Objects @@ -28,17 +34,14 @@ Plug 'jiangmiao/auto-pairs' " Vim plugin, insert or delete brackets, ** Git #+begin_src vimrc -Plug 'jreybert/vimagit' -Plug 'tpope/vim-fugitive' " A Git wrapper so awesome, it should be illegal -Plug 'junegunn/gv.vim' " A git commit browser -Plug 'mhinz/vim-signify' " Show a diff using Vim its sign column +" Plug 'mhinz/vim-signify' " Show a diff using Vim its sign column +Plug 'TimUntersberger/neogit' #+end_src ** Motions, Search #+begin_src vimrc -Plug 'terryma/vim-expand-region' " Vim plugin that allows you to visually select increasingly larger regions of text using the same key combination Plug 'justinmk/vim-sneak' " The missing motion for Vim -Plug 'haya14busa/is.vim' " Improved incremental searching for Vim +Plug 'haya14busa/is.vim' " Automatically clear highlight after search #+end_src ** Manipulate Things @@ -46,19 +49,18 @@ Plug 'haya14busa/is.vim' " Improved incremental searching for Vim Plug 'tpope/vim-surround' " Quoting/parenthesizing made simple Plug 'tpope/vim-commentary' " Comment stuff out Plug 'junegunn/vim-easy-align' " A Vim alignment plugin -Plug 'Olical/vim-enmasse' " Edit every line in a quickfix list at the same time -Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '(GrepperOperator)'] } " +#+end_src + +The following two packages are used to search and modify multiple files at once +#+begin_src vimrc +" Plug 'Olical/vim-enmasse' " Edit every line in a quickfix list at the same time +" Plug 'mhinz/vim-grepper', { 'on': ['Grepper', '(GrepperOperator)'] } " #+end_src ** Utils #+begin_src vimrc Plug 'tpope/vim-repeat' " Enable repeating supported plugin maps with '.' -Plug 'tpope/vim-obsession' " Continuously updated session files -Plug 'tpope/vim-eunuch' " eunuch.vim: helpers for UNIX -Plug 'kana/vim-operator-user' " Define your own operator easily -Plug 'majutsushi/tagbar' " Vim plugin that displays tags in a window, ordered by scope Plug 'tpope/vim-speeddating' " use CTRL-A/CTRL-X to increment dates, times, and more -Plug 'liuchengxu/vim-which-key' " Vim plugin that shows keybindings in popup #+end_src ** Visual @@ -67,7 +69,6 @@ Plug 'itchyny/lightline.vim' " A light and configurable statusline/tabline for Plug 'Yggdroot/indentLine' " A vim plugin to display the indention levels with thin vertical lines Plug 'ryanoasis/vim-devicons' " Adds file type glyphs/icons to many popular Vim plugins such as: NERDTree, vim-airline, unite, vim-startify and many more Plug 'mhinz/vim-startify' " The fancy start screen for Vim -Plug 'junegunn/goyo.vim' " Distraction-free writing in Vim #+end_src ** Themes @@ -77,36 +78,40 @@ Plug 'morhetz/gruvbox' " Retro groove color scheme for Vim Other nice themes are [[https://github.com/mhartington/oceanic-next][oceanic-next]] and [[https://github.com/jacoborus/tender.vim][tender]]. -** Language Server Protocol +** TODO Language Server Protocol #+begin_src vimrc -Plug 'autozimu/LanguageClient-neovim', { - \ 'branch': 'next', - \ 'do': 'bash install.sh', - \ } +" LSP Support +Plug 'neovim/nvim-lspconfig' +Plug 'williamboman/nvim-lsp-installer' + +" Autocompletion +Plug 'hrsh7th/nvim-cmp' +Plug 'hrsh7th/cmp-buffer' +Plug 'hrsh7th/cmp-path' +Plug 'saadparwaiz1/cmp_luasnip' +Plug 'hrsh7th/cmp-nvim-lsp' +Plug 'hrsh7th/cmp-nvim-lua' + +" Snippets +Plug 'L3MON4D3/LuaSnip' +Plug 'rafamadriz/friendly-snippets' + +Plug 'VonHeikemen/lsp-zero.nvim' +#+end_src + +#+begin_src vimrc +Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} #+end_src ** Snippnets and autocompletion #+begin_src vimrc -Plug 'SirVer/ultisnips' " The ultimate snippet solution for Vim -Plug 'honza/vim-snippets' " Vim-snipmate default snippets +" Plug 'SirVer/ultisnips' " The ultimate snippet solution for Vim +" Plug 'honza/vim-snippets' " Vim-snipmate default snippets #+end_src ** Syntax Checking and Build Utils #+begin_src vimrc -Plug 'neomake/neomake' " Asynchronous linting and make framework for Neovim/Vim -#+end_src - -** Auto Completion -#+begin_src vimrc -if has('nvim') - Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } - Plug 'Nelyah/deoplete-mu' -else - Plug 'Shougo/deoplete.nvim' - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' - Plug 'Nelyah/deoplete-mu' -endif +" Plug 'neomake/neomake' " Asynchronous linting and make framework for Neovim/Vim #+end_src ** Tmux @@ -117,20 +122,12 @@ Plug 'jpalardy/vim-slime' " Used to type text into a REPL ** Syntax #+begin_src vimrc -Plug 'sheerun/vim-polyglot' " A solid language pack for Vim -#+end_src - -** Markdown -#+begin_src vimrc -Plug 'plasticboy/vim-markdown', { 'for': 'markdown' } " Markdown Vim Mode -Plug 'mzlogin/vim-markdown-toc', { 'for': 'markdown' } " A vim plugin to generate table of contents for Markdown files -Plug 'JamshedVesuna/vim-markdown-preview', { 'for': 'markdown' } " A light Vim plugin for previewing markdown files in a browser -Plug 'nelstrom/vim-markdown-folding' " Fold markdown documents by section +" Plug 'sheerun/vim-polyglot' " A solid language pack for Vim #+end_src ** LaTeX #+begin_src vimrc -Plug 'lervag/vimtex', { 'for': 'tex' } " A modern vim plugin for editing LaTeX files. +" Plug 'lervag/vimtex', { 'for': 'tex' } " A modern vim plugin for editing LaTeX files. #+end_src ** Matlab @@ -139,22 +136,6 @@ Plug 'tdehaeze/matlab-vim', { 'for': 'matlab' } " Edit Matlab M-files in Vim Plug 'djoshea/vim-matlab-fold', { 'for': 'matlab' } " Vim code folding for Matlab files #+end_src -** Python -#+begin_src vimrc -Plug 'pixelneo/vim-python-docstring' -#+end_src - -** Org Mode -#+begin_src vimrc -Plug 'nvim-orgmode/orgmode' - -" Plug 'jceb/vim-orgmode' " Text outlining and task management for Vim -" Plug 'vim-scripts/SyntaxRange' " Define a different filetype syntax on regions of a buffer -" Plug 'chrisbra/NrrwRgn' " A Narrow Region Plugin for vim -" Plug 'mattn/calendar-vim' " calendar vimscript -" Plug 'vim-scripts/utl.vim' " Univeral Text Linking - Execute URLs, footnotes, open emails, organize ideas -#+end_src - ** Plug End #+begin_src vimrc call plug#end() @@ -548,13 +529,6 @@ snoremap b[sviw #+end_src * Filetypes -** Vim Which Key -#+begin_src vimrc -nnoremap :WhichKey '' - -let g:which_key_map_local = {} -#+end_src - ** Mails #+begin_src vimrc autocmd FileType mail set spell spelllang=en_us,fr @@ -649,35 +623,18 @@ au FileType python vmap SlimeRegionSen " CD to directory of current file au FileType python nmap c :SlimeSend0('cd '.expand('%:p:h')) - -" let python_highlight_all = 1 -" au FileType python syn keyword pythonDecorator True None False self - -" au BufNewFile,BufRead *.jinja set syntax=htmljinja -" au BufNewFile,BufRead *.mako set ft=mako - -" au FileType python map F :set foldmethod=indent - -" au FileType python inoremap $r return -" au FileType python inoremap $i import -" au FileType python inoremap $p print -" au FileType python inoremap $f #--- a -" au FileType python map 1 /class -" au FileType python map 2 /def -" au FileType python map C ?class -" au FileType python map D ?def #+end_src ** Matlab #+begin_src vimrc " Run Section (delimited by %%) au FileType matlab nmap mm SlimeParagraphSend -let g:which_key_map_local.m = { 'name' : '+matlab' } " Run either Selected text au FileType matlab vmap mm SlimeRegionSend -let g:which_key_map_local.mm = 'run-code' +#+end_src +#+begin_src vimrc func! GetSelectedText() normal gv"xy let result = getreg("x") @@ -687,88 +644,89 @@ endfunc " Help on the current selection au FileType matlab vmap mh :SlimeSend0('help '.expand(GetSelectedText())) -let g:which_key_map_local.mh = 'help' " Documentation on the current selection au FileType matlab vmap mH :SlimeSend0('doc '.expand(GetSelectedText())) -let g:which_key_map_local.mh = 'help' " Open the current file in the Matlab Editor (usefull for debuging) au FileType matlab nmap me :SlimeSend0('edit '.expand('%:p')) -let g:which_key_map_local.me = 'edit-gui' " Run all the file au FileType matlab nmap mr :SlimeSend0('run '.expand('%:t')) -let g:which_key_map_local.mr = 'run-file' " Send "cd filepath" to matlab au FileType matlab nmap mc :SlimeSend0('cd '.expand('%:p:h')) -let g:which_key_map_local.mr = 'cd-file' " Open workspace au FileType matlab nmap mw :SlimeSend0('workspace') -let g:which_key_map_local.mr = 'workspace' -#+end_src - -** Save Which Key Configuration -#+begin_src vimrc -call which_key#register('', "g:which_key_map") #+end_src * Plugins Config +** Treesitter +#+begin_src vimrc +lua <\ %#fzf2#fz%#fzf3#f -endfunction +" function! s:fzf_statusline() +" " Override statusline as you like +" highlight fzf1 ctermfg=161 ctermbg=251 +" highlight fzf2 ctermfg=23 ctermbg=251 +" highlight fzf3 ctermfg=237 ctermbg=251 +" setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f +" endfunction -autocmd! User FzfStatusLine call fzf_statusline() +" autocmd! User FzfStatusLine call fzf_statusline() #+end_src ** =autozimu/LanguageClient-neovim= #+begin_src vimrc -let g:LanguageClient_serverCommands = { - \ 'matlab': ['java', ' -Djava.library.path=$MATLABROOT/bin/glnxa64 -cp $MATLABROOT/extern/engines/java/jar/engine.jar:$MATLABROOT/java/jar/jmi.jar:/home/thomas/github/matlab-langserver/build/libs/lsp-matlab-0.1.jar org.tokor.lspmatlab.Application'], - \ } +" let g:LanguageClient_serverCommands = { +" \ 'matlab': ['java', ' -Djava.library.path=$MATLABROOT/bin/glnxa64 -cp $MATLABROOT/extern/engines/java/jar/engine.jar:$MATLABROOT/java/jar/jmi.jar:/home/thomas/github/matlab-langserver/build/libs/lsp-matlab-0.1.jar org.tokor.lspmatlab.Application'], +" \ } -nnoremap :call LanguageClient_contextMenu() -" Or map each action separately -nnoremap K :call LanguageClient#textDocument_hover() -nnoremap gd :call LanguageClient#textDocument_definition() -nnoremap :call LanguageClient#textDocument_rename() +" nnoremap :call LanguageClient_contextMenu() +" " Or map each action separately +" nnoremap K :call LanguageClient#textDocument_hover() +" nnoremap gd :call LanguageClient#textDocument_definition() +" nnoremap :call LanguageClient#textDocument_rename() #+end_src ** =JamshedVesuna/vim-markdown-preview= #+begin_src vimrc -let vim_markdown_preview_github=1 -let vim_markdown_preview_browser='Google Chrome' -let vim_markdown_preview_temp_file=1 +" let vim_markdown_preview_github=1 +" let vim_markdown_preview_browser='Google Chrome' +" let vim_markdown_preview_temp_file=1 " let vim_markdown_preview_pandoc=1 #+end_src @@ -781,7 +739,7 @@ let g:signify_disable_by_default = 1 ** =Deoplete= #+begin_src vimrc -let g:deoplete#enable_at_startup = 1 +" let g:deoplete#enable_at_startup = 1 " let g:deoplete#omni#functions = {} " set completeopt=longest,menuone,preview @@ -792,12 +750,12 @@ let g:deoplete#enable_at_startup = 1 ** =SirVer/ultisnips= #+begin_src vimrc -let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnip' +" let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnip' -" inoremap pumvisible() ? "\" : "\" -let g:UltiSnipsExpandTrigger="" -let g:UltiSnipsJumpForwardTrigger="" -let g:UltiSnipsJumpBackwardTrigger="" +" " inoremap pumvisible() ? "\" : "\" +" let g:UltiSnipsExpandTrigger="" +" let g:UltiSnipsJumpForwardTrigger="" +" let g:UltiSnipsJumpBackwardTrigger="" #+end_src ** =honza/vim-snippets= @@ -808,23 +766,16 @@ let g:snipMate.scope_aliases = {} ** =itchyny/lightline.vim= #+begin_src vimrc -function! LightlineObsession() -return '%{ObsessionStatus("")}' -endfunction - " \ 'colorscheme': 'gruvbox', let g:lightline = { \ 'colorscheme': 'solarized', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], -\ [ 'filename', 'modified', 'fugitive', 'obsession' ] ] +\ [ 'filename', 'modified', 'fugitive' ] ] \ }, \ 'component': { \ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}' \ }, -\ 'component_expand': { -\ 'obsession': 'LightlineObsession' -\ }, \ 'component_visible_condition': { \ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())' \ }, @@ -833,6 +784,25 @@ let g:lightline = { \ } #+end_src +** Git +#+begin_src vimrc +lua < let b:quitting = 1 - cabbrev q! let b:quitting_bang = 1 q! -endfunction -#+end_src - -Quit Vim if this is the only remaining buffer -#+begin_src vimrc -function! s:goyo_leave() -if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1 -if b:quitting_bang -qa! -else -qa -endif -endif -endfunction -#+end_src - -#+begin_src vimrc -autocmd! User GoyoEnter call goyo_enter() -autocmd! User GoyoLeave call goyo_leave() -#+end_src - ** =tpope/vim-surround= #+begin_src vimrc vmap Si S(i_f) @@ -894,43 +829,33 @@ au FileType mako vmap Si S"i${ _(2f"a) } let g:surround_{char2nr('b')} = "__\r__" #+end_src -** =Vim-Markdown= -#+begin_src vimrc -let g:vim_markdown_folding_disabled = 1 -let g:vim_markdown_conceal = 0 -let g:vim_markdown_toc_autofit = 1 -let g:vim_markdown_toml_frontmatter = 1 - -let g:tex_conceal = "" -#+end_src - ** =Neomake= #+begin_src vimrc -" Latex -autocmd! BufWritePost *.tex Neomake -let g:neomake_tex_chktex_maker = { -\ 'exe': 'chktex', -\ 'args': ['--inputfiles'], -\ 'errorformat': -\ '%EError %n in %f line %l: %m,' . -\ '%WWarning %n in %f line %l: %m,' . -\ '%WMessage %n in %f line %l: %m,' . -\ '%Z%p^,' . -\ '%-G%.%#' -\ } +" " Latex +" autocmd! BufWritePost *.tex Neomake +" let g:neomake_tex_chktex_maker = { +" \ 'exe': 'chktex', +" \ 'args': ['--inputfiles'], +" \ 'errorformat': +" \ '%EError %n in %f line %l: %m,' . +" \ '%WWarning %n in %f line %l: %m,' . +" \ '%WMessage %n in %f line %l: %m,' . +" \ '%Z%p^,' . +" \ '%-G%.%#' +" \ } -let g:neomake_tex_enabled_makers = ['chktex'] +" let g:neomake_tex_enabled_makers = ['chktex'] -" Matlab -autocmd! BufWritePost *.m Neomake -let g:neomake_matlab_mlint_maker = { -\ 'exe': 'mlint', -\ 'mapexpr': "neomake_bufname.':'.v:val", -\ 'errorformat': -\ '%f:L %l (C %c): %m,' . -\ '%f:L %l (C %c-%*[0-9]): %m,', -\ } -let g:neomake_matlab_enabled_makers = ['mlint'] +" " Matlab +" autocmd! BufWritePost *.m Neomake +" let g:neomake_matlab_mlint_maker = { +" \ 'exe': 'mlint', +" \ 'mapexpr': "neomake_bufname.':'.v:val", +" \ 'errorformat': +" \ '%f:L %l (C %c): %m,' . +" \ '%f:L %l (C %c-%*[0-9]): %m,', +" \ } +" let g:neomake_matlab_enabled_makers = ['mlint'] #+end_src ** =lervag/vimtex= @@ -962,361 +887,184 @@ endif let g:EditorConfig_exclude_patterns = ['fugitive://.*'] #+end_src -* Bindings -** Vim Which Key +** Telescope #+begin_src vimrc -nnoremap :WhichKey '' - -let g:which_key_map = {} -#+end_src - -** Direct ones -#+begin_src vimrc -" Switch with last buffer -nnoremap :e # -" let g:which_key_map. = 'last-buffer' +lua <qq :qa -let g:which_key_map.q.q = 'quit' " Quit - Force nnoremap qQ :qa! -let g:which_key_map.q.Q = 'quit-force' - -" Quit - Save -nnoremap qw :wq -let g:which_key_map.q.w = 'quit-save' - -" Quit - Save all -nnoremap qW :wqa -let g:which_key_map.q.W = 'quit-save-all' #+end_src ** Files #+begin_src vimrc -let g:which_key_map.f = { 'name' : '+files' } - " Fast saving nnoremap fs :w! -let g:which_key_map.f.s = 'save-file' - -" Fast saving all -nnoremap fS :wa! -let g:which_key_map.f.S = 'save-all' " Find Files -noremap ff :Files -let g:which_key_map.f.f = 'find-file' - -" Find File corresping to Word -nnoremap fw - \ :call fzf#vim#files('.', fzf#vim#with_preview({'options': ['--query', expand('')]})) - -let g:which_key_map.f.w = 'find-file-word' +nnoremap ff Telescope find_files +nnoremap Telescope find_files #+end_src ** Buffers #+begin_src vimrc -let g:which_key_map.b = { 'name' : '+buffers' } - " Buffer Create noremap bc :enew -let g:which_key_map.b.c = 'buffer-create' " Buffer Delete noremap bd :Bclose -let g:which_key_map.b.d = 'buffer-delete' - -" Buffer Delete all others -noremap bD :bufdo bd -let g:which_key_map.b.D = 'buffer-delete-others' " Buffer Next noremap bn :bnext -let g:which_key_map.b.n = 'buffer-next' " Buffer Previous noremap bp :bprevious -let g:which_key_map.b.p = 'buffer-previous' " Find Buffers -noremap bf :Buffers -let g:which_key_map.b.f = 'buffer-find' - -" Buffer Home (startify) -noremap bh :Startify -let g:which_key_map.b.h = 'buffer-home' - -" CD to buffer path -noremap bw :cd %:p:h:pwd -let g:which_key_map.b.w = 'buffer-pwd' +nnoremap bb Telescope buffers #+end_src ** Tabs #+begin_src vimrc -let g:which_key_map.t = { 'name' : '+tabs' } - " Let 'tt' toggle between this and the last accessed tab let g:lasttab = 1 au TabLeave * let g:lasttab = tabpagenr() " Tab New nnoremap tc :tabnew -let g:which_key_map.t.c = 'tab-create' " Tab Delete nnoremap td :tabclose -let g:which_key_map.t.d = 'tab-delete' - -" Tab Maximize -nnoremap tD :tabonly -let g:which_key_map.t.D = 'tab-delete-others' - -" Tab Left -nnoremap th gt -let g:which_key_map.t.h = 'tab-left' - -" Tab Right -nnoremap tl gT -let g:which_key_map.t.l = 'tab-right' " Tab Move Left nnoremap tH :tabmove -1 -let g:which_key_map.t.H = 'tab-move-left' " Tab Move Right nnoremap tL :tabmove +1 -let g:which_key_map.t.L = 'tab-move-right' " Tab Toggle nnoremap tt :exe "tabn ".g:lasttab -let g:which_key_map.t.t = 'tab-toggle' #+end_src ** Terminals #+begin_src vimrc -let g:which_key_map.T = { 'name' : '+terminals' } - " Quickly create a new terminal in a new tab nnoremap Tc :tab new:term -let g:which_key_map.T.c = 'term-create' " Quickly create a new terminal in a vertical split -nnoremap T/ :vsplit:term -" let g:which_key_map.T./ = 'term-vert' +nnoremap Tv :vsplit:term " Quickly create a new terminal in a horizontal split -nnoremap T- :split:term -" let g:which_key_map.T.- = 'term-hor' +nnoremap Th :split:term #+end_src ** Splits / Windows #+begin_src vimrc -let g:which_key_map.w = { 'name' : '+windows' } - " Split Horizontal -nnoremap w- :split -" let g:which_key_map.w.- = 'win-hor' +nnoremap ws :split " Split Vertical -nnoremap w/ :vsplit -" let g:which_key_map.w./ = 'win-vert' +nnoremap wv :vsplit " Split Maximize -nnoremap wD o -let g:which_key_map.w.D = 'win-delete-others' +nnoremap wm o " Split Delete nnoremap wd q -let g:which_key_map.w.d = 'win-delete' " Split Go Left nnoremap wh :wincmd h -let g:which_key_map.w.h = 'win-left' " Split Go Down nnoremap wj :wincmd j -let g:which_key_map.w.j = 'win-down' " Split Go Up nnoremap wk :wincmd k -let g:which_key_map.w.k = 'win-up' " Split Go Right nnoremap wl :wincmd l -let g:which_key_map.w.l = 'win-right' -" Split to Tab -nnoremap wt T -let g:which_key_map.w.t = 'win-make-tab' +" Split Move Left +nnoremap wH H -" Find window -nnoremap wf :Windows -let g:which_key_map.w.f = 'win-find' +" Split Move Down +nnoremap wJ J -" Maximize window -nnoremap wm :call MaximizeToggle() -let g:which_key_map.w.m = 'win-maximize' +" Split Move Up +nnoremap wK K -function! MaximizeToggle() - if exists("s:maximize_session") - exec "source " . s:maximize_session - call delete(s:maximize_session) - unlet s:maximize_session - let &hidden=s:maximize_hidden_save - unlet s:maximize_hidden_save - else - let s:maximize_hidden_save = &hidden - let s:maximize_session = tempname() - set hidden - exec "mksession! " . s:maximize_session - only - endif -endfunction +" Split Move Right +nnoremap wL L #+end_src -** Check Spell +** TODO Check Spell #+begin_src vimrc -let g:which_key_map.S = { 'name' : '+spell-check' } - " CheckSpell Toggle noremap St :setlocal spell! -let g:which_key_map.S.t = 'spell-toggle' " CheckSpell Correct noremap Sc z= -let g:which_key_map.S.c = 'spell-correct' " CheckSpell Do first noremap SC 1z= -let g:which_key_map.S.C = 'spell-correct-first' " CheckSpell Language noremap Sl :set spelllang= -let g:which_key_map.S.l = 'spell-language' " CheckSpell Next noremap Sn ]s -let g:which_key_map.S.n = 'spell-next' " CheckSpell Next and correct noremap SN ]s1z= -let g:which_key_map.S.N = 'spell-next-correct' " CheckSpell Previous noremap Sp [s -let g:which_key_map.S.p = 'spell-prev' " CheckSpell Previous and correct noremap SP [s1z= -let g:which_key_map.S.P = 'spell-prev-correct' " CheckSpell Add to dictionnary noremap Sa zg -let g:which_key_map.S.a = 'spell-add-dict' #+end_src -** Make +** TODO Make #+begin_src vimrc -let g:which_key_map.m = { 'name' : '+make' } - " Make Make nnoremap mm :Make -B -let g:which_key_map.m.m = 'make' " Make Clean nnoremap mc :Make clean -let g:which_key_map.m.c = 'make-clean' " Make Force nnoremap mf :Make! -B -let g:which_key_map.m.f = 'make-force' " Make Run nnoremap mr :Make! run -let g:which_key_map.m.r = 'make-run' " Make Open nnoremap mo :make! open -let g:which_key_map.m.o = 'make-open' #+end_src ** Search #+begin_src vimrc -let g:which_key_map.s = { 'name' : '+search' } - -" Search History -noremap sh :History -let g:which_key_map.s.h = 'search-history' - -" Search Tags -noremap sT :Tags -let g:which_key_map.s.T = 'search-tags' - -" Search All -noremap sa :Rg -let g:which_key_map.s.g = 'search-all' - -" Search Word -noremap sw :exe ':Rg ' . expand('') -let g:which_key_map.s.w = 'search-word' - -" Search todo keyboard -nnoremap st :Grepper -tool rg -query TODO -let g:which_key_map.s.t = 'search-todos' +nnoremap s Telescope live_grep #+end_src ** GIT #+begin_src vimrc -let g:which_key_map.g = { 'name' : '+git' } - -" Git Gutter -nnoremap gg :SignifyToggle -let g:which_key_map.g.g = 'git-' - -" Git Gutter Highlight -nnoremap gG :SignifyToggleHighlight -let g:which_key_map.g.G = 'git-' - -" Git Commit -nnoremap gc :Gcommit -let g:which_key_map.g.c = 'git-commit' - -" Git Status -nnoremap gs :Gstatus -let g:which_key_map.g.s = 'git-status' - -" Git Diff -nnoremap gd :Gdiff -let g:which_key_map.g.d = 'git-diff' - -" Git Blame -nnoremap gb :Gblame -let g:which_key_map.g.b = 'git-blame' - -" Git Visualise -nnoremap gv :GV -let g:which_key_map.g.v = 'git-visualize' - -" Git File (visualise) -nnoremap gF :GV! -let g:which_key_map.g.F = 'git-file' - -" Git Find Commits -noremap gf :Commits -let g:which_key_map.g.f = 'git-find-commit' +nnoremap g :Neogit #+end_src -** Errors +** TODO Errors #+begin_src vimrc -let g:which_key_map.e = { 'name' : '+errors' } - function! s:GetBufferList() redir =>buflist silent! ls @@ -1362,37 +1110,28 @@ endfunction " Error Toggle nnoremap ee :call ToggleLocationList() -let g:which_key_map.e.e = 'error-toggle' " Error Open nnoremap eo :lopen -let g:which_key_map.e.o = 'error-open' " Error Close nnoremap ec :lclose -let g:which_key_map.e.c = 'error-close' " Error Next nnoremap en :lnext -let g:which_key_map.e.n = 'error-next' " Error Previous nnoremap ep :lprevious -let g:which_key_map.e.p = 'error-previous' #+end_src ** Text #+begin_src vimrc -let g:which_key_map.x = { 'name' : '+text' } - " Start interactive EasyAlign in visual mode (e.g. vipga) and for a motion xmap xa (EasyAlign) nmap xa (EasyAlign) -let g:which_key_map.x.a = 'text-align' " Indent all file nnoremap x= mzgg=G`z -" let g:which_key_map.x.= = 'text-indent-file' " Custom Multiple Cursor " http://www.kevinli.co/posts/2017-01-19-multiple-cursors-in-500-bytes-of-vimscript/ @@ -1401,12 +1140,10 @@ let g:mc = "y/\\V\=escape(@\", '/')\\" " Multiple Cursor nnoremap xm *``cgn vnoremap xm g:mc . "``cgn" -let g:which_key_map.x.m = 'multiple-cursor' " Multiple Cursor - reserve direction nnoremap xM *``cgN vnoremap xM g:mc . "``cgN" -let g:which_key_map.x.M = 'multiple-cursor-reverse' " Delete trainling Whitespaces fun! TrimWhitespace() @@ -1415,13 +1152,10 @@ fun! TrimWhitespace() call winrestview(l:save) endfun nnoremap xt :call TrimWhitespace() -let g:which_key_map.x.t = 'delete-trailing-whitespaces' #+end_src ** Config #+begin_src vimrc -let g:which_key_map.c = { 'name' : '+config' } - let s:activatedsh = 0 function! ToggleSyntaxH() if s:activatedsh == 0 @@ -1435,7 +1169,6 @@ endfunction " Toggle Syntax column nnoremap cs :call ToggleSyntaxH() -let g:which_key_map.c.s = 'toggle-syntax-col' let s:activatedh = 0 function! ToggleH() @@ -1450,35 +1183,16 @@ endfunction " Toggle Highlight nnoremap ch :call ToggleH() -let g:which_key_map.c.h = 'toggle-highlight' " Reload vim config noremap cr :source $MYVIMRC -let g:which_key_map.c.e = 'reload-config' " Edit vim config noremap ce :e $MYVIMRC -let g:which_key_map.c.e = 'edit-config' " Disable highlight noremap c :noh -let g:which_key_map.c.enter = 'disable-highlight' " Theme noremap ct :noh -let g:which_key_map.c.t = 'choose-theme' -#+end_src - -** Insert -#+begin_src vimrc -let g:which_key_map.i = { 'name' : '+insert' } - -" Insert Snippet -noremap is :Snippets -let g:which_key_map.i.s = 'insert-snippet' -#+end_src - -** Save Which Key Configuration -#+begin_src vimrc -call which_key#register('', "g:which_key_map") #+end_src