aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/after/ftplugin/markdown.vim1
-rw-r--r--vim/after/ftplugin/python.vim30
-rw-r--r--vim/keymaps.vim179
-rw-r--r--vim/options.vim83
-rw-r--r--vim/plugins.vim185
-rw-r--r--vim/spell/en.utf-8.add11
-rw-r--r--vim/spell/en.utf-8.add.splbin0 -> 211 bytes
-rw-r--r--vim/spell/fr.utf-8.splbin0 -> 571627 bytes
-rw-r--r--vim/spell/fr.utf-8.sugbin0 -> 2324315 bytes
9 files changed, 489 insertions, 0 deletions
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 <leader>ldf
+nnoremap <leader>ldf :call FormatPythonFile()<CR>
+
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 = "\<Space>"
+let g:maplocalleader = ','
+nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
+nnoremap <silent> <localleader> :<c-u>WhichKey ','<CR>
+
+
+""""""""""""""""""""
+" Window movement
+""""""""""""""""""""
+
+" Go to the bottom window
+noremap <C-j> <C-w>j
+
+" Go to the top window
+noremap <C-k> <C-w>k
+
+" Go to the right window
+noremap <C-l> <C-w>l
+
+" Go to the left window
+noremap <C-h> <C-w>h
+
+""""""""""""""""""""""""
+" Remove highlighting
+""""""""""""""""""""""""
+
+nnoremap <leader>hl :nohlsearch<CR>
+
+" Save file
+nnoremap <C-s> :w!<CR>
+
+""""""""""""""""""""""""""
+" Buffer
+"""""""""""""""""""""""""
+
+" Close the current buffer
+noremap <leader>bd :Bclose<cr>:tabclose<cr>gT
+
+" Close all the buffers
+noremap <leader>ba :bufdo bd<cr>
+
+" Go to the next buffer
+noremap <leader>bn :bnext<cr>
+
+" Go to the previous buffer
+noremap <leader>bp :bprevious<cr>
+
+""""""""""""""""""""""""""""
+" Tabs
+"""""""""""""""""""""""""""
+
+" Open a new tab
+noremap <leader>tn :tabnew<cr>
+
+" Close all others tab
+noremap <leader>to :tabonly<cr>
+
+" Close current tab page
+noremap <leader>tc :tabclose<cr>
+
+" Move tabs after another
+noremap <leader>tm :tabmove
+
+" Go to the next tab
+noremap <leader>t<leader> :tabnext<cr>
+
+" Let 'tl' toggle between this and the last accessed tab
+let g:lasttab = 1
+nnoremap <leader>tl :exe "tabn ".g:lasttab<CR>
+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 <leader>te :tabedit <C-r>=escape(expand("%:p:h"), " ")<cr>/
+
+" Switch CWD to the directory of the open buffer
+noremap <leader>cd :cd %:p:h<cr>:pwd<cr>
+
+" 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 <C-f> :Fern %:h -drawer -width=35 -toggle<CR>
+
+""""""""""""""""""""
+" GitGutter
+""""""""""""""""""""
+
+let g:gitgutter_enabled=1 " Enable by default gitgutter
+
+" Go to the previous hunk
+nnoremap <leader>hp <Plug>(GitGutterPrevHunk)
+
+" Go to the next hunk
+nnoremap <leader>hn <Plug>(GitGutterNextHunk)
+
+" Enable / Disable GitGutter
+nnoremap <leader>ht <Plug>(GitGutterToggle)
+
+" Stage Hunk in Git
+nnoremap <leader>hs <Plug>(GitGutterStageHunk)
+
+" Undo Hunk
+nnoremap <leader>hu <Plug>(GitGutterUndoHunk)
+
+" Preview Hunk
+nnoremap <leader>hP :GitGutterPreviewHunk<CR>
+
+" Always show the status line
+set laststatus=2
+
+"""""""""""""""""""""
+" Spell
+"""""""""""""""""""""
+
+" Toggle and untoggle spell checking
+noremap <leader>ss :setlocal spell!<cr>
+
+" Next word to spellcheck
+noremap <leader>sn ]s
+
+" Previous word to spellcheck
+noremap <leader>sp [s
+
+" Add word into the spellcheck dictionnary
+noremap <leader>sa zg
+
+" show the list of alternatives for the word
+noremap <leader>s? z=
+
+"""""""""""""""""""
+" LSP
+"""""""""""""""""""
+
+inoremap <silent><expr> <TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
+inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
+
+" Go to definition
+nnoremap <leader>ld :LspDefinition<cr>
+
+" Go next diagnostic
+nnoremap <leader>lnd :LspNextDiagnostic<cr>
+
+" Go previous diagnostic
+nnoremap <leader>lpd :LspPreviousDiagnostic<cr>
+
+" Go to reference
+nnoremap <leader>lf :LspReferences<cr>
+
+" Rename object
+nnoremap <leader>lr :LspRename<cr>
+
+" LSP stop server
+nnoremap <leader>ls :LspStopServer<cr>
+
+" peek definition of object
+nnoremap <leader>lp :LspPeekDefinition<cr>
+
+" Code Action
+nnoremap <leader>la :LspCodeAction<cr>
+
+" Hover information
+nnoremap <leader>lh :LspHover<cr>
+
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 <buffer><expr>
+ \ <Plug>(fern-my-open-expand-collapse)
+ \ fern#smart#leaf(
+ \ "\<Plug>(fern-action-open:select)",
+ \ "\<Plug>(fern-action-expand)",
+ \ "\<Plug>(fern-action-collapse)",
+ \ )
+ nmap <buffer> action <Plug>(fern-action-choice)
+ nmap <buffer> <CR> <Plug>(fern-my-open-expand-collapse)
+ nmap <buffer> a <Plug>(fern-action-new-path)
+ nmap <buffer> d <Plug>(fern-action-remove)
+ nmap <buffer> m <Plug>(fern-action-move)
+ nmap <buffer> r <Plug>(fern-action-rename)
+ nmap <buffer> s <Plug>(fern-action-open:split)
+ nmap <buffer> v <Plug>(fern-action-open:vsplit)
+ nmap <buffer> ga <Plug>(fern-action-git-stage)
+ nmap <buffer> gu <Plug>(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('<Space>', "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<leader>' : '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
--- /dev/null
+++ b/vim/spell/en.utf-8.add.spl
Binary files differ
diff --git a/vim/spell/fr.utf-8.spl b/vim/spell/fr.utf-8.spl
new file mode 100644
index 0000000..ff27132
--- /dev/null
+++ b/vim/spell/fr.utf-8.spl
Binary files differ
diff --git a/vim/spell/fr.utf-8.sug b/vim/spell/fr.utf-8.sug
new file mode 100644
index 0000000..df555d2
--- /dev/null
+++ b/vim/spell/fr.utf-8.sug
Binary files differ
ArKa projects. All rights to me, and your next child right arm.