From 317950a3b6af900031db32b9e9e74723dce59e19 Mon Sep 17 00:00:00 2001 From: Oxbian Date: Tue, 8 Aug 2023 14:02:22 +0200 Subject: Updating folder configuration to use .config --- .gitignore | 4 + .vim/after/ftplugin/markdown.vim | 1 - .vim/after/ftplugin/python.vim | 30 ------- .vim/keymaps.vim | 179 ------------------------------------- .vim/options.vim | 84 ------------------ .vim/plugins.vim | 184 -------------------------------------- .vim/spell/en.utf-8.add | 11 --- .vim/spell/en.utf-8.add.spl | Bin 211 -> 0 bytes .vim/spell/fr.utf-8.spl | Bin 571627 -> 0 bytes .vim/spell/fr.utf-8.sug | Bin 2324315 -> 0 bytes .vimrc | 6 +- README.md | 2 +- install.sh | 3 +- vim/after/ftplugin/markdown.vim | 1 + vim/after/ftplugin/python.vim | 30 +++++++ vim/keymaps.vim | 179 +++++++++++++++++++++++++++++++++++++ vim/options.vim | 83 ++++++++++++++++++ vim/plugins.vim | 185 +++++++++++++++++++++++++++++++++++++++ vim/spell/en.utf-8.add | 11 +++ vim/spell/en.utf-8.add.spl | Bin 0 -> 211 bytes vim/spell/fr.utf-8.spl | Bin 0 -> 571627 bytes vim/spell/fr.utf-8.sug | Bin 0 -> 2324315 bytes 22 files changed, 499 insertions(+), 494 deletions(-) delete mode 100644 .vim/after/ftplugin/markdown.vim delete mode 100644 .vim/after/ftplugin/python.vim delete mode 100644 .vim/keymaps.vim delete mode 100644 .vim/options.vim delete mode 100644 .vim/plugins.vim delete mode 100644 .vim/spell/en.utf-8.add delete mode 100644 .vim/spell/en.utf-8.add.spl delete mode 100644 .vim/spell/fr.utf-8.spl delete mode 100644 .vim/spell/fr.utf-8.sug create mode 100644 vim/after/ftplugin/markdown.vim create mode 100644 vim/after/ftplugin/python.vim create mode 100644 vim/keymaps.vim create mode 100644 vim/options.vim create mode 100644 vim/plugins.vim create mode 100644 vim/spell/en.utf-8.add create mode 100644 vim/spell/en.utf-8.add.spl create mode 100644 vim/spell/fr.utf-8.spl create mode 100644 vim/spell/fr.utf-8.sug diff --git a/.gitignore b/.gitignore index b0d872e..844bea8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ .vim/plugged .vim/autoload/* .vim/autoload +vim/plugged/* +vim/plugged +vim/autoload/* +vim/autoload diff --git a/.vim/after/ftplugin/markdown.vim b/.vim/after/ftplugin/markdown.vim deleted file mode 100644 index bcda2dd..0000000 --- a/.vim/after/ftplugin/markdown.vim +++ /dev/null @@ -1 +0,0 @@ -setlocal spell diff --git a/.vim/after/ftplugin/python.vim b/.vim/after/ftplugin/python.vim deleted file mode 100644 index 41b1d88..0000000 --- a/.vim/after/ftplugin/python.vim +++ /dev/null @@ -1,30 +0,0 @@ -" Python -let g:lsp_settings = {} -let g:lsp_settings['pylsp-all'] = - \ { - \ 'workspace_config': {'pylsp-all': { - \ 'configurationSources': ['flake8'], - \ 'plugins': { - \ 'pyflakes' : {'enabled': v:false}, - \ 'flake8': {'enabled': v:true}, - \ 'mypy-ls': {'enabled': v:true, 'live_mode': v:false}, - \ 'pylint': {'enabled': v:true}, - \ 'pydocstyle': {'enabled': v:true}, - \ 'pyls_isort': {'enabled': v:true}, - \ 'autopep8': {'enabled': v:false}, - \ 'yapf': {'enabled': v:false}, - \ 'black': {'enabled': v:true}, - \ } - \ }} - \ } - -" Define a custom function that executes :LspDocumentFormat and :!isort -if !exists('*FormatPythonFile') - function! FormatPythonFile() - silent execute '!black %' - silent execute '!isort %' - endfunction -endif -" Remap the custom function to ldf -nnoremap ldf :call FormatPythonFile() - diff --git a/.vim/keymaps.vim b/.vim/keymaps.vim deleted file mode 100644 index 19cee2e..0000000 --- a/.vim/keymaps.vim +++ /dev/null @@ -1,179 +0,0 @@ -""""""""""""""""""""""""""""" -" Keymaps -""""""""""""""""""""""""""""" - -let g:mapleader = "\" -let g:maplocalleader = ',' -nnoremap :WhichKey '' -nnoremap :WhichKey ',' - - -"""""""""""""""""""" -" Window movement -"""""""""""""""""""" - -" Go to the bottom window -noremap j - -" Go to the top window -noremap k - -" Go to the right window -noremap l - -" Go to the left window -noremap h - -"""""""""""""""""""""""" -" Remove highlighting -"""""""""""""""""""""""" - -nnoremap hl :nohlsearch - -" Save file -nnoremap :w! - -"""""""""""""""""""""""""" -" Buffer -""""""""""""""""""""""""" - -" Close the current buffer -noremap bd :Bclose:tabclosegT - -" Close all the buffers -noremap ba :bufdo bd - -" Go to the next buffer -noremap bn :bnext - -" Go to the previous buffer -noremap bp :bprevious - -"""""""""""""""""""""""""""" -" Tabs -""""""""""""""""""""""""""" - -" Open a new tab -noremap tn :tabnew - -" Close all others tab -noremap to :tabonly - -" Close current tab page -noremap tc :tabclose - -" Move tabs after another -noremap tm :tabmove - -" Go to the next tab -noremap t :tabnext - -" Let 'tl' toggle between this and the last accessed tab -let g:lasttab = 1 -nnoremap tl :exe "tabn ".g:lasttab -au TabLeave * let g:lasttab = tabpagenr() - -" Opens a new tab with the current buffer's path -" Super useful when editing files in the same directory -noremap te :tabedit =escape(expand("%:p:h"), " ")/ - -" Switch CWD to the directory of the open buffer -noremap cd :cd %:p:h:pwd - -" Specify the behavior when switching between buffers -try - set switchbuf=useopen,usetab,newtab - set stal=2 -catch -endtry - -" Return to last edit position when opening files (You want this!) -au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif - -"""""""""""""""""""""""" -" Fern -""""""""""""""""""""""" - -" Toggle fern tree view -nnoremap :Fern %:h -drawer -width=35 -toggle - -"""""""""""""""""""" -" GitGutter -"""""""""""""""""""" - -let g:gitgutter_enabled=1 " Enable by default gitgutter - -" Go to the previous hunk -nnoremap hp (GitGutterPrevHunk) - -" Go to the next hunk -nnoremap hn (GitGutterNextHunk) - -" Enable / Disable GitGutter -nnoremap ht (GitGutterToggle) - -" Stage Hunk in Git -nnoremap hs (GitGutterStageHunk) - -" Undo Hunk -nnoremap hu (GitGutterUndoHunk) - -" Preview Hunk -nnoremap hP :GitGutterPreviewHunk - -" Always show the status line -set laststatus=2 - -""""""""""""""""""""" -" Spell -""""""""""""""""""""" - -" Toggle and untoggle spell checking -noremap ss :setlocal spell! - -" Next word to spellcheck -noremap sn ]s - -" Previous word to spellcheck -noremap sp [s - -" Add word into the spellcheck dictionnary -noremap sa zg - -" show the list of alternatives for the word -noremap s? z= - -""""""""""""""""""" -" LSP -""""""""""""""""""" - -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" - -" Go to definition -nnoremap ld :LspDefinition - -" Go next diagnostic -nnoremap lnd :LspNextDiagnostic - -" Go previous diagnostic -nnoremap lpd :LspPreviousDiagnostic - -" Go to reference -nnoremap lf :LspReferences - -" Rename object -nnoremap lr :LspRename - -" LSP stop server -nnoremap ls :LspStopServer - -" peek definition of object -nnoremap lp :LspPeekDefinition - -" Code Action -nnoremap la :LspCodeAction - -" Hover information -nnoremap lh :LspHover - diff --git a/.vim/options.vim b/.vim/options.vim deleted file mode 100644 index 4548b68..0000000 --- a/.vim/options.vim +++ /dev/null @@ -1,84 +0,0 @@ -" Search options -set incsearch " Search for partial typed match -set ignorecase " Search not case sensitive -set smartcase " Search for pattern if contains uppercase -set hlsearch " Highlight all match search pattern - -" Graphics options -syntax on " Show syntax color -set background=dark " Set vim style as dark -colorscheme onedark " Set colorscheme as onedark -set number " Show line number -set relativenumber " Show relative line number -set cursorline " Select the current line -set showmatch " Show matching brackets when overred -set laststatus=2 " Fix for tabline -set noshowmode " Disable the -- INSERTION -- default comment -set so=7 " Set 7 lines to the cursor - when moving vertically - -" Mouse options -set mouse=a " Allow the mouse to do all the editing -set ruler " Show the cursor position on the tagline - -" Indent options -set tabstop=4 " Size of a tab -set shiftwidth=4 " Number of space for each indent -set softtabstop=0 " Useless indent -set noexpandtab " Vim will automatically use tab -set smartindent " Do clever indenting -set copyindent " Copy indent style of the file -set preserveindent " Preserve indent style - -" Automatic options -set autowrite " Automatically write the file on certain actions -set autoread " Automatically read extern changes on the file - -" System -if has('unnamedplus') " ALlow OS & vim clipboard sync - set clipboard=unnamedplus -endif -set undofile " Save undo history -set history =500 " Max line vim remember -set updatetime=500 " Delay before vim write swap file, lower better for gitgutter - -" Autocomplete -set completeopt=menu,menuone,popup,noselect,noinsert " Show a pop up for command completion -set wildmenu " Turn on wildmenu - -" Avoid garbled characters in Chinese language windows OS -let $LANG='en' " Setting lang as en -set langmenu=en " Setting menu lang as en -" This delete all the defined menu -source $VIMRUNTIME/delmenu.vim -source $VIMRUNTIME/menu.vim - -" Ignore compiled files -set wildignore=*.o,*~,*.pyc -if has("win16") || has("win32") - set wildignore+=.git\*,.hg\*,.svn\* -else - set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store -endif - -" Configure backspace so it acts as it should act -set backspace=eol,start,indent -set whichwrap+=<,>,h,l - -" Don't redraw while executing macros (good performance config) -set lazyredraw - -" How many tenths of a second to blink when matching brackets -set mat=2 - -" Set utf8 as standard encoding and en_US as the standard language -set encoding=utf8 - -" Use Unix as the standard file type -set ffs=unix,dos,mac - -" Turn backup off, since most stuff is in SVN, git etc. anyway... -set nobackup -set noswapfile - -" Timeout -set timeoutlen=500 diff --git a/.vim/plugins.vim b/.vim/plugins.vim deleted file mode 100644 index 6db8cc9..0000000 --- a/.vim/plugins.vim +++ /dev/null @@ -1,184 +0,0 @@ -"""""""""""""""""""""""""" -" Plugins -"""""""""""""""""""""""""" -" Install vim-plug if not found -if empty(glob('~/.vim/autoload/plug.vim')) - silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs - \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -endif - -" Run PlugInstall if there are missing plugins -autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) - \| PlugInstall --sync | source $MYVIMRC -\| endif - -call plug#begin('~/.vim/plugged') - -" UI & Themes -Plug 'joshdick/onedark.vim' " Onedark themes for vim -Plug 'vim-airline/vim-airline' " Vim statusline -Plug 'lambdalisue/fern.vim' " Filetree in vim -Plug 'lambdalisue/fern-renderer-devicons.vim' " Icon in fern -Plug 'ryanoasis/vim-devicons' " Devicons -Plug 'lambdalisue/fern-mapping-git.vim' " Fern git mapping -Plug 'lambdalisue/fern-git-status.vim' " Fern git status -Plug 'liuchengxu/vim-which-key' " Show leader mapping cheatsheet - -" Git integration -Plug 'airblade/vim-gitgutter' " Git diff - -" Autocompletion, linter, syntax -Plug 'prabirshrestha/vim-lsp' " Linter & formatter -Plug 'mattn/vim-lsp-settings' " Automatic vim-lsp installation -Plug 'prabirshrestha/asyncomplete.vim' " Autocompletion -Plug 'prabirshrestha/asyncomplete-lsp.vim' " Autocompletion & connection with vim-lsp - -" Tools -Plug 'wakatime/vim-wakatime' " Wakatime - -" Language -Plug 'mattn/emmet-vim', { 'for': ['html', 'css', 'js', 'vue'] } -call plug#end() - -filetype plugin indent on " Allow filetype detection, plugins, indentation - -""""""""""""""""""""""""" -" Configuration -""""""""""""""""""""""""" -" VIM airline -let g:airline_theme='onedark' " Status line color & configuration - -if !exists('g:airline_symbols') - let g:airline_symbols = {} -endif -let g:airline_symbols.colnr = ' ㏇:' -let g:airline_symbols.crypt = 'πŸ”’' -let g:airline_symbols.linenr = ' ΒΆ' -let g:airline_symbols.maxlinenr = '' -let g:airline_symbols.branch = 'βŽ‡' -let g:airline_symbols.paste = 'ρ' -let g:airline_symbols.spell = 'Ꞩ' -let g:airline_symbols.notexists = 'Ι†' -let g:airline_symbols.whitespace = ' Ξ' - -" VIM lsp -let g:lsp_diagnostics_echo_cursor = 1 -let g:lsp_diagnostics_virtual_text_enabled = 0 - -" Fern -" Disable netrw. -let g:loaded_netrw = 1 -let g:loaded_netrwPlugin = 1 -let g:loaded_netrwSettings = 1 -let g:loaded_netrwFileHandlers = 1 - - -let g:fern#default_hidden = 1 " Show hidden files -let g:fern#renderer = 'devicons' -let g:fern_renderer_devicons_disable_warning = 1 - -" Multi window select in which you open the file -function! s:init_fern() abort - nmap - \ (fern-my-open-expand-collapse) - \ fern#smart#leaf( - \ "\(fern-action-open:select)", - \ "\(fern-action-expand)", - \ "\(fern-action-collapse)", - \ ) - nmap action (fern-action-choice) - nmap (fern-my-open-expand-collapse) - nmap a (fern-action-new-path) - nmap d (fern-action-remove) - nmap m (fern-action-move) - nmap r (fern-action-rename) - nmap s (fern-action-open:split) - nmap v (fern-action-open:vsplit) - nmap ga (fern-action-git-stage) - nmap gd (fern-action-git-unstage) -endfunction - -augroup my-fern-hijack - autocmd! - autocmd BufEnter * ++nested call s:hijack_directory() -augroup END - -function! s:hijack_directory() abort - let path = expand('%:p') - if !isdirectory(path) - return - endif - bwipeout % - execute printf('Fern %s', fnameescape(path)) -endfunction - -augroup fern-custom - autocmd! * - autocmd FileType fern call s:init_fern() -augroup END - -" Which Key -call which_key#register('', "g:which_key_map") -let g:which_key_map = {} - -" Buffer key help -let g:which_key_map.b = { - \ 'name' : '+buffer', - \ 'd' : 'current buffer close', - \ 'a' : 'close all buffers', - \ 'n' : 'go to next buffer', - \ 'p' : 'go to previous buffer', - \ } - -" Tab key help -let g:which_key_map.t = { - \ 'name' : '+tab', - \ 't' : 'go to next tab', - \ 'n' : 'open new tab', - \ 'o' : 'close other tabs', - \ 'c' : 'close current tab', - \ 'm' : 'move tab after another', - \ 'l' : 'switch between this & last tab', - \ 'e' : 'open new tab with current buffer', - \ } - -" Spell key help -let g:which_key_map.s = { - \ 'name' : '+spell', - \ 's' : 'toggle spell check', - \ 'n' : 'next spell word', - \ 'p' : 'previous spell word', - \ 'a' : 'add word in dict', - \ '?' : 'list word alternatives', - \ } - -" Hunk key help -let g:which_key_map.h = { - \ 'name' : '+git hunk', - \ 'l' : 'remove highlight', - \ 'p' : 'go previous hunk', - \ 'n' : 'go next hunk', - \ 't' : 'enable/disable gitgutter', - \ 's' : 'stage hunk', - \ 'u' : 'undo hunk', - \ 'P' : 'preview hunk', - \ } - -" LSP key help -let g:which_key_map.l = { - \ 'name' : '+LSP', - \ 'd' : 'go to definition', - \ 'nd' : 'next diagnostic', - \ 'pd' : 'previous diagnostic', - \ 'f' : 'go to reference', - \ 'r' : 'rename object', - \ 's' : 'stop LSP server', - \ 'p' : 'peek definition', - \ 'a' : 'code action', - \ 'h' : 'hover information', - \ 'df' : 'format document', - \ } - -" Emmet -let g:user_emmet_leader_key='Γ©' - diff --git a/.vim/spell/en.utf-8.add b/.vim/spell/en.utf-8.add deleted file mode 100644 index 283920b..0000000 --- a/.vim/spell/en.utf-8.add +++ /dev/null @@ -1,11 +0,0 @@ -linters -nerdtree -GitGutter -keybinds -onedark -LSP -vscode -autocompleter -linter -neovim -untoggle diff --git a/.vim/spell/en.utf-8.add.spl b/.vim/spell/en.utf-8.add.spl deleted file mode 100644 index 29528b3..0000000 Binary files a/.vim/spell/en.utf-8.add.spl and /dev/null differ diff --git a/.vim/spell/fr.utf-8.spl b/.vim/spell/fr.utf-8.spl deleted file mode 100644 index ff27132..0000000 Binary files a/.vim/spell/fr.utf-8.spl and /dev/null differ diff --git a/.vim/spell/fr.utf-8.sug b/.vim/spell/fr.utf-8.sug deleted file mode 100644 index df555d2..0000000 Binary files a/.vim/spell/fr.utf-8.sug and /dev/null differ diff --git a/.vimrc b/.vimrc index 2906e97..06d4127 100644 --- a/.vimrc +++ b/.vimrc @@ -1,4 +1,4 @@ " Vim configuration, do not delete -source ~/.vim/plugins.vim -source ~/.vim/options.vim -source ~/.vim/keymaps.vim +source ~/.config/vim/plugins.vim +source ~/.config/vim/options.vim +source ~/.config/vim/keymaps.vim diff --git a/README.md b/README.md index fb5ac25..f46b2b2 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ For help, use `:help fern`. Keybinds: - `Ctrl+f` open the treeview buffer at the left, - `ga` stage a file from git, -- `gd` unstage a file from git, +- `gu` unstage a file from git, - `a` create a file or folder, - `d` delete a file or folder, - `r` rename a file or folder, diff --git a/install.sh b/install.sh index 895aab6..46b1776 100755 --- a/install.sh +++ b/install.sh @@ -4,4 +4,5 @@ cd $DIR ln -sf $(pwd)/.vimrc $HOME/.vimrc rm -rf $HOME/.vim -ln -sf $(pwd)/.vim $HOME/.vim \ No newline at end of file +rm -rf $HOME/.config/vim +ln -sf $(pwd)/vim $HOME/.config/vim diff --git a/vim/after/ftplugin/markdown.vim b/vim/after/ftplugin/markdown.vim new file mode 100644 index 0000000..bcda2dd --- /dev/null +++ b/vim/after/ftplugin/markdown.vim @@ -0,0 +1 @@ +setlocal spell diff --git a/vim/after/ftplugin/python.vim b/vim/after/ftplugin/python.vim new file mode 100644 index 0000000..41b1d88 --- /dev/null +++ b/vim/after/ftplugin/python.vim @@ -0,0 +1,30 @@ +" Python +let g:lsp_settings = {} +let g:lsp_settings['pylsp-all'] = + \ { + \ 'workspace_config': {'pylsp-all': { + \ 'configurationSources': ['flake8'], + \ 'plugins': { + \ 'pyflakes' : {'enabled': v:false}, + \ 'flake8': {'enabled': v:true}, + \ 'mypy-ls': {'enabled': v:true, 'live_mode': v:false}, + \ 'pylint': {'enabled': v:true}, + \ 'pydocstyle': {'enabled': v:true}, + \ 'pyls_isort': {'enabled': v:true}, + \ 'autopep8': {'enabled': v:false}, + \ 'yapf': {'enabled': v:false}, + \ 'black': {'enabled': v:true}, + \ } + \ }} + \ } + +" Define a custom function that executes :LspDocumentFormat and :!isort +if !exists('*FormatPythonFile') + function! FormatPythonFile() + silent execute '!black %' + silent execute '!isort %' + endfunction +endif +" Remap the custom function to ldf +nnoremap ldf :call FormatPythonFile() + diff --git a/vim/keymaps.vim b/vim/keymaps.vim new file mode 100644 index 0000000..19cee2e --- /dev/null +++ b/vim/keymaps.vim @@ -0,0 +1,179 @@ +""""""""""""""""""""""""""""" +" Keymaps +""""""""""""""""""""""""""""" + +let g:mapleader = "\" +let g:maplocalleader = ',' +nnoremap :WhichKey '' +nnoremap :WhichKey ',' + + +"""""""""""""""""""" +" Window movement +"""""""""""""""""""" + +" Go to the bottom window +noremap j + +" Go to the top window +noremap k + +" Go to the right window +noremap l + +" Go to the left window +noremap h + +"""""""""""""""""""""""" +" Remove highlighting +"""""""""""""""""""""""" + +nnoremap hl :nohlsearch + +" Save file +nnoremap :w! + +"""""""""""""""""""""""""" +" Buffer +""""""""""""""""""""""""" + +" Close the current buffer +noremap bd :Bclose:tabclosegT + +" Close all the buffers +noremap ba :bufdo bd + +" Go to the next buffer +noremap bn :bnext + +" Go to the previous buffer +noremap bp :bprevious + +"""""""""""""""""""""""""""" +" Tabs +""""""""""""""""""""""""""" + +" Open a new tab +noremap tn :tabnew + +" Close all others tab +noremap to :tabonly + +" Close current tab page +noremap tc :tabclose + +" Move tabs after another +noremap tm :tabmove + +" Go to the next tab +noremap t :tabnext + +" Let 'tl' toggle between this and the last accessed tab +let g:lasttab = 1 +nnoremap tl :exe "tabn ".g:lasttab +au TabLeave * let g:lasttab = tabpagenr() + +" Opens a new tab with the current buffer's path +" Super useful when editing files in the same directory +noremap te :tabedit =escape(expand("%:p:h"), " ")/ + +" Switch CWD to the directory of the open buffer +noremap cd :cd %:p:h:pwd + +" Specify the behavior when switching between buffers +try + set switchbuf=useopen,usetab,newtab + set stal=2 +catch +endtry + +" Return to last edit position when opening files (You want this!) +au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + +"""""""""""""""""""""""" +" Fern +""""""""""""""""""""""" + +" Toggle fern tree view +nnoremap :Fern %:h -drawer -width=35 -toggle + +"""""""""""""""""""" +" GitGutter +"""""""""""""""""""" + +let g:gitgutter_enabled=1 " Enable by default gitgutter + +" Go to the previous hunk +nnoremap hp (GitGutterPrevHunk) + +" Go to the next hunk +nnoremap hn (GitGutterNextHunk) + +" Enable / Disable GitGutter +nnoremap ht (GitGutterToggle) + +" Stage Hunk in Git +nnoremap hs (GitGutterStageHunk) + +" Undo Hunk +nnoremap hu (GitGutterUndoHunk) + +" Preview Hunk +nnoremap hP :GitGutterPreviewHunk + +" Always show the status line +set laststatus=2 + +""""""""""""""""""""" +" Spell +""""""""""""""""""""" + +" Toggle and untoggle spell checking +noremap ss :setlocal spell! + +" Next word to spellcheck +noremap sn ]s + +" Previous word to spellcheck +noremap sp [s + +" Add word into the spellcheck dictionnary +noremap sa zg + +" show the list of alternatives for the word +noremap s? z= + +""""""""""""""""""" +" LSP +""""""""""""""""""" + +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" + +" Go to definition +nnoremap ld :LspDefinition + +" Go next diagnostic +nnoremap lnd :LspNextDiagnostic + +" Go previous diagnostic +nnoremap lpd :LspPreviousDiagnostic + +" Go to reference +nnoremap lf :LspReferences + +" Rename object +nnoremap lr :LspRename + +" LSP stop server +nnoremap ls :LspStopServer + +" peek definition of object +nnoremap lp :LspPeekDefinition + +" Code Action +nnoremap la :LspCodeAction + +" Hover information +nnoremap lh :LspHover + diff --git a/vim/options.vim b/vim/options.vim new file mode 100644 index 0000000..795330b --- /dev/null +++ b/vim/options.vim @@ -0,0 +1,83 @@ +" Search options +set incsearch " Search for partial typed match +set ignorecase " Search not case sensitive +set smartcase " Search for pattern if contains uppercase +set hlsearch " Highlight all match search pattern + +" Graphics options +syntax on " Show syntax color +set background=dark " Set vim style as dark +colorscheme onedark " Set colorscheme as onedark +set number " Show line number +set relativenumber " Show relative line number +set cursorline " Select the current line +set showmatch " Show matching brackets when overred +set laststatus=2 " Fix for tabline +set noshowmode " Disable the -- INSERTION -- default comment +set so=7 " Set 7 lines to the cursor - when moving vertically + +" Mouse options +set mouse=a " Allow the mouse to do all the editing +set ruler " Show the cursor position on the tagline + +" Indent options +set tabstop=4 " Size of a tab +set shiftwidth=4 " Number of space for each indent +set softtabstop=0 " Useless indent +set noexpandtab " Vim will automatically use tab +set smartindent " Do clever indenting +set copyindent " Copy indent style of the file +set preserveindent " Preserve indent style +" Automatic options +set autowrite " Automatically write the file on certain actions +set autoread " Automatically read extern changes on the file + +" System +if has('unnamedplus') " ALlow OS & vim clipboard sync + set clipboard=unnamedplus +endif +set undofile " Save undo history +set history =500 " Max line vim remember +set updatetime=500 " Delay before vim write swap file, lower better for gitgutter + +" Autocomplete +set completeopt=menu,menuone,popup,noselect,noinsert " Show a pop up for command completion +set wildmenu " Turn on wildmenu + +" Avoid garbled characters in Chinese language windows OS +let $LANG='en' " Setting lang as en +set langmenu=en " Setting menu lang as en +" This delete all the defined menu +source $VIMRUNTIME/delmenu.vim +source $VIMRUNTIME/menu.vim + +" Ignore compiled files +set wildignore=*.o,*~,*.pyc +if has("win16") || has("win32") + set wildignore+=.git\*,.hg\*,.svn\* +else + set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store +endif + +" Configure backspace so it acts as it should act +set backspace=eol,start,indent +set whichwrap+=<,>,h,l + +" Don't redraw while executing macros (good performance config) +set lazyredraw + +" How many tenths of a second to blink when matching brackets +set mat=2 + +" Set utf8 as standard encoding and en_US as the standard language +set encoding=utf8 + +" Use Unix as the standard file type +set ffs=unix,dos,mac + +" Turn backup off, since most stuff is in SVN, git etc. anyway... +set nobackup +set noswapfile + +" Timeout +set timeoutlen=500 diff --git a/vim/plugins.vim b/vim/plugins.vim new file mode 100644 index 0000000..ebb4278 --- /dev/null +++ b/vim/plugins.vim @@ -0,0 +1,185 @@ +"""""""""""""""""""""""""" +" Plugins +"""""""""""""""""""""""""" +" Install vim-plug if not found +if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +endif + +" Run PlugInstall if there are missing plugins +autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + \| PlugInstall --sync | source $MYVIMRC +\| endif + +call plug#begin('~/.vim/plugged') + +" UI & Themes +Plug 'joshdick/onedark.vim' " Onedark themes for vim +Plug 'vim-airline/vim-airline' " Vim statusline +Plug 'lambdalisue/fern.vim' " Filetree in vim +Plug 'lambdalisue/fern-renderer-devicons.vim' " Icon in fern +Plug 'ryanoasis/vim-devicons' " Devicons +Plug 'lambdalisue/fern-mapping-git.vim' " Fern git mapping +Plug 'lambdalisue/fern-git-status.vim' " Fern git status +Plug 'liuchengxu/vim-which-key' " Show leader mapping cheatsheet + +" Git integration +Plug 'airblade/vim-gitgutter' " Git diff + +" Autocompletion, linter, syntax +Plug 'prabirshrestha/vim-lsp' " Linter & formatter +Plug 'mattn/vim-lsp-settings' " Automatic vim-lsp installation +Plug 'prabirshrestha/asyncomplete.vim' " Autocompletion +Plug 'prabirshrestha/asyncomplete-lsp.vim' " Autocompletion & connection with vim-lsp + +" Tools +Plug 'wakatime/vim-wakatime' " Wakatime +Plug 'ap/vim-css-color' " rgb, hex color preview + +" Language +Plug 'mattn/emmet-vim', { 'for': ['html', 'css', 'js', 'vue'] } +call plug#end() + +filetype plugin indent on " Allow filetype detection, plugins, indentation + +""""""""""""""""""""""""" +" Configuration +""""""""""""""""""""""""" +" VIM airline +let g:airline_theme='onedark' " Status line color & configuration + +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif +let g:airline_symbols.colnr = ' ㏇:' +let g:airline_symbols.crypt = 'πŸ”’' +let g:airline_symbols.linenr = ' ΒΆ' +let g:airline_symbols.maxlinenr = '' +let g:airline_symbols.branch = 'βŽ‡' +let g:airline_symbols.paste = 'ρ' +let g:airline_symbols.spell = 'Ꞩ' +let g:airline_symbols.notexists = 'Ι†' +let g:airline_symbols.whitespace = ' Ξ' + +" VIM lsp +let g:lsp_diagnostics_echo_cursor = 1 +let g:lsp_diagnostics_virtual_text_enabled = 0 + +" Fern +" Disable netrw. +let g:loaded_netrw = 1 +let g:loaded_netrwPlugin = 1 +let g:loaded_netrwSettings = 1 +let g:loaded_netrwFileHandlers = 1 + + +let g:fern#default_hidden = 1 " Show hidden files +let g:fern#renderer = 'devicons' +let g:fern_renderer_devicons_disable_warning = 1 + +" Multi window select in which you open the file +function! s:init_fern() abort + nmap + \ (fern-my-open-expand-collapse) + \ fern#smart#leaf( + \ "\(fern-action-open:select)", + \ "\(fern-action-expand)", + \ "\(fern-action-collapse)", + \ ) + nmap action (fern-action-choice) + nmap (fern-my-open-expand-collapse) + nmap a (fern-action-new-path) + nmap d (fern-action-remove) + nmap m (fern-action-move) + nmap r (fern-action-rename) + nmap s (fern-action-open:split) + nmap v (fern-action-open:vsplit) + nmap ga (fern-action-git-stage) + nmap gu (fern-action-git-unstage) +endfunction + +augroup my-fern-hijack + autocmd! + autocmd BufEnter * ++nested call s:hijack_directory() +augroup END + +function! s:hijack_directory() abort + let path = expand('%:p') + if !isdirectory(path) + return + endif + bwipeout % + execute printf('Fern %s', fnameescape(path)) +endfunction + +augroup fern-custom + autocmd! * + autocmd FileType fern call s:init_fern() +augroup END + +" Which Key +call which_key#register('', "g:which_key_map") +let g:which_key_map = {} + +" Buffer key help +let g:which_key_map.b = { + \ 'name' : '+buffer', + \ 'd' : 'current buffer close', + \ 'a' : 'close all buffers', + \ 'n' : 'go to next buffer', + \ 'p' : 'go to previous buffer', + \ } + +" Tab key help +let g:which_key_map.t = { + \ 'name' : '+tab', + \ 't' : 'go to next tab', + \ 'n' : 'open new tab', + \ 'o' : 'close other tabs', + \ 'c' : 'close current tab', + \ 'm' : 'move tab after another', + \ 'l' : 'switch between this & last tab', + \ 'e' : 'open new tab with current buffer', + \ } + +" Spell key help +let g:which_key_map.s = { + \ 'name' : '+spell', + \ 's' : 'toggle spell check', + \ 'n' : 'next spell word', + \ 'p' : 'previous spell word', + \ 'a' : 'add word in dict', + \ '?' : 'list word alternatives', + \ } + +" Hunk key help +let g:which_key_map.h = { + \ 'name' : '+git hunk', + \ 'l' : 'remove highlight', + \ 'p' : 'go previous hunk', + \ 'n' : 'go next hunk', + \ 't' : 'enable/disable gitgutter', + \ 's' : 'stage hunk', + \ 'u' : 'undo hunk', + \ 'P' : 'preview hunk', + \ } + +" LSP key help +let g:which_key_map.l = { + \ 'name' : '+LSP', + \ 'd' : 'go to definition', + \ 'nd' : 'next diagnostic', + \ 'pd' : 'previous diagnostic', + \ 'f' : 'go to reference', + \ 'r' : 'rename object', + \ 's' : 'stop LSP server', + \ 'p' : 'peek definition', + \ 'a' : 'code action', + \ 'h' : 'hover information', + \ 'df' : 'format document', + \ } + +" Emmet +let g:user_emmet_leader_key='Γ©' + diff --git a/vim/spell/en.utf-8.add b/vim/spell/en.utf-8.add new file mode 100644 index 0000000..283920b --- /dev/null +++ b/vim/spell/en.utf-8.add @@ -0,0 +1,11 @@ +linters +nerdtree +GitGutter +keybinds +onedark +LSP +vscode +autocompleter +linter +neovim +untoggle diff --git a/vim/spell/en.utf-8.add.spl b/vim/spell/en.utf-8.add.spl new file mode 100644 index 0000000..29528b3 Binary files /dev/null and b/vim/spell/en.utf-8.add.spl differ diff --git a/vim/spell/fr.utf-8.spl b/vim/spell/fr.utf-8.spl new file mode 100644 index 0000000..ff27132 Binary files /dev/null and b/vim/spell/fr.utf-8.spl differ diff --git a/vim/spell/fr.utf-8.sug b/vim/spell/fr.utf-8.sug new file mode 100644 index 0000000..df555d2 Binary files /dev/null and b/vim/spell/fr.utf-8.sug differ -- cgit v1.2.3