" " Plugins Install " " PlugInstall [name ...] [#threads] Install plugins " PlugUpdate [name ...] [#threads] Install or update plugins " PlugClean[!] Remove unused directories (bang version will clean without prompt) " PlugUpgrade Upgrade vim-plug itself " PlugStatus Check the status of plugins " PlugDiff Examine changes from the previous update and the pending changes " PlugSnapshot[!] [output path] Generate script for restoring the current snapshot of the plugins if filereadable($HOME . '/.pyenv/versions/nvim/bin/python') let g:nvim_python_path = $HOME . '/.pyenv/versions/nvim/bin' let g:python3_host_prog = g:nvim_python_path . '/python' let $PATH = g:nvim_python_path . ':' . $PATH endif let g:node_host_prog = $HOME . '/.local/bin/npm' if !has('python3') echohl WarningMsg echo 'Missing python3 support - need to pip install pynvim' echohl None endif let g:plug_root = $HOME . '/.config/nvim/.plug' call plug#begin(g:plug_root) " completion / linter Plug 'williamboman/mason.nvim' Plug 'williamboman/mason-lspconfig.nvim' Plug 'neovim/nvim-lspconfig' Plug 'onsails/lspkind-nvim' Plug 'ojroques/nvim-lspfuzzy' Plug 'ray-x/lsp_signature.nvim' Plug 'hrsh7th/nvim-cmp' Plug 'hrsh7th/cmp-buffer' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-path' Plug 'hrsh7th/cmp-nvim-lua' Plug 'ray-x/cmp-treesitter' Plug 'saadparwaiz1/cmp_luasnip' Plug 'L3MON4D3/LuaSnip', {'do': 'make install_jsregexp'} Plug 'rafamadriz/friendly-snippets' Plug 'folke/trouble.nvim' " Utils if executable('gcc') Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} endif Plug 'mhinz/vim-startify' Plug 'nvim-tree/nvim-web-devicons' " weird color bar appear on next commit " Plug 'nvim-tree/nvim-tree.lua', {'commit': 'f24afa2cef551122b8bd53bb2e4a7df42343ce2e'} Plug 'nvim-tree/nvim-tree.lua' Plug 'junegunn/fzf' Plug 'junegunn/fzf.vim' Plug 'chengzeyi/fzf-preview.vim' Plug 'itchyny/lightline.vim' Plug 'josa42/nvim-lightline-lsp' Plug 'Yggdroot/indentLine' Plug 'Raimondi/delimitMate' Plug 'tpope/vim-sensible' Plug 'tpope/vim-commentary' Plug 'tpope/vim-surround' Plug 'tpope/vim-eunuch' Plug 'psliwka/vim-smoothie' Plug 'troydm/zoomwintab.vim' " breaking change - does not detect root pattern with priority Plug 'airblade/vim-rooter', {'commit': 'd64f3e04df9914e784508019a1a1f291cbb40bd4'} Plug 'akinsho/toggleterm.nvim' " Language Specific " python syntax hilight " Plug 'wookayin/semshi', {'do': ':UpdateRemotePlugins'} " nvim-go + deps Plug 'ray-x/go.nvim', {'for': 'go'} Plug 'ray-x/guihua.lua', {'for': 'go'} " puppet Plug 'rodjek/vim-puppet', {'for': 'puppet'} " annotations (require nvim-treesitter) Plug 'danymat/neogen' " ctags / cscope if executable('ctags') Plug 'dhananjaylatkar/cscope_maps.nvim' Plug 'ludovicchabant/vim-gutentags', { \ 'do': 'cd ' . g:plug_root . '/vim-gutentags; patch -p1 -stNr /dev/null < ~/.config/nvim/plugin_patch/vim-gutentags.patch; git commit -am local; true' \} endif Plug 'stevearc/aerial.nvim' " git Plug 'mhinz/vim-signify' Plug 'rhysd/git-messenger.vim' Plug 'jcosmao/blame.nvim' Plug 'sindrets/diffview.nvim' " Colorscheme Plug 'sainnhe/gruvbox-material' Plug 'norcalli/nvim-colorizer.lua' call plug#end() " " Common " set nocompatible filetype off filetype plugin indent on syntax off set mouse= set ttyfast " Indicate fast terminal conn for faster redraw set lazyredraw " Wait to redraw set magic set ruler " affiche la position du curseur en bas droite set showmode " affiche le mode (insert ou autre) set showcmd " Show current command. set laststatus=2 set number set cursorline set cmdheight=2 set signcolumn=auto set encoding=utf-8 set fileencoding=utf-8 set termencoding=utf-8 set backspace=indent,eol,start " activation de la touche backspace set ai " autoindentation active set sm " syntax match: soulignement d'une parenth e associ ,... set hlsearch " colorisation de la recherche set ignorecase set ts=4 " taille des tabulations set sw=4 " taille des indentations set tw=0 " textwidth: largeur du texte (commentaires) 0=pas de limite set expandtab " converti les tab en espaces set directory=/tmp set wildmode=full " vim bar autocomplete set wildmenu set smartindent set autoread " Set vim to update autmatically when a file's read-only state is changed set undodir=~/.cache/vim/undodir set undofile " Persistent undo set undolevels=10000 " maximum number of changes that can be undone set undoreload=100000 " maximum number lines to save for undo on a buffer reload set history=1000 " remember more commands and search history set nobackup " no backup or swap file, live dangerously set noswapfile " swap files give annoying warning set clipboard^=unnamedplus " send yank to system clipboard set updatetime=100 set hidden " Allow modified hidden buffers set autowriteall set noautochdir set keymodel=startsel " shift+arrow selection set diffopt+=vertical " start :diffsplit in vertical mode set conceallevel=0 " Do not interpret markdown for ex " Autocompletion set shortmess+=c set pumheight=20 set termguicolors if !empty("$THEME") exec 'set background='.$THEME else set background=light endif let mapleader = " " " Leader key set to " Load lua plugins config if ! &readonly && has('python3') lua require('config') endif " " Commands mapping " " Remap some common typos command! -bang E e command! -bang Q q command! -bang W w command! -bang QA qa command! -bang Qa qa command! -bang Wa wa command! -bang WA wa command! -bang Wq wq command! -bang WQ wq " Mapping map ? :exec printf('view %s/help.md', fnamemodify(expand($MYVIMRC), ':p:h')) map V :tabedit $MYVIMRC map VV :source $MYVIMRC \| :echo $MYVIMRC 'reloaded' map :call custom#lineInfosToggle() map :NvimTreeFindFileToggle! map :AerialToggle map :IndentLinesToggle map :set number! map :SignifyToggle map :set paste! map :BackgroundToggle map :Startify map :call custom#ToggleMouse() map q empty(filter(getwininfo(), 'v:val.quickfix')) ? ":copen" : ":cclose" map a :execute 'RgWithFilePath' expand('') map A :execute 'Rg' expand('') map s :RgWithFilePath map S :Rg map f :Files map d :Neogen map b :Buffers map t :FZFCtags map c :BCommits map h :History map g :execute 'ToggleBlame virtual' map G :GitMessenger map m :Snippets map ^ imap ^ map $ imap $ map e map b map + :vsplit map = :split map :wincmd k map :wincmd j map :wincmd l map :wincmd h map :wincmd k map :wincmd j map :wincmd l map :wincmd h map :noh map o map k :TroubleToggle document_diagnostics map l :TroubleToggle workspace_diagnostics " paste last yank (not from dd) map p "0p " vim surround map " ysiW" map : ysiw" map ' ysiW' map ; ysiw' nnoremap call smoothie#do("\") vnoremap call smoothie#do("\") nnoremap call smoothie#do("\") vnoremap call smoothie#do("\") " Always forward with n / backward with N noremap n (v:searchforward ? 'n' : 'N') noremap N (v:searchforward ? 'N' : 'n') " Tab lua << EOF local opts = { noremap = true, silent = true } vim.keymap.set({'n', 'i'}, '', ':tabprevious', opts) vim.keymap.set({'n', 'i'}, '', ':tabprevious', opts) vim.keymap.set({'n', 'i'}, '', ':tabnext', opts) vim.keymap.set({'n', 'i'}, '', ':tabnext', opts) vim.keymap.set({'n', 'i'}, '', ':tabnew', opts) EOF for i in range(1, 9) execute "map " . i . " " . i . "gt" endfor map 0 :tablast nmap > (signify-next-hunk) nmap < (signify-prev-hunk) map :ToggleTerm dir=%:p:h " Specific filetype autocmd BufNewFile,BufRead *.lib set filetype=sh autocmd BufNewFile,BufRead *.source set filetype=sh autocmd BufNewFile,BufRead *.pp set filetype=puppet autocmd BufNewFile,BufRead *.inc set filetype=perl autocmd BufNewFile,BufRead *.tf set filetype=terraform autocmd BufNewFile,BufRead *.conf set filetype=ini autocmd WinEnter,BufWinEnter,FileWritePost,BufWritePost,BufRead * call custom#displayFilePath() " remove autoindent on colon : autocmd FileType python,yaml setlocal indentkeys-=<:> autocmd FileType python,yaml setlocal indentkeys-=: autocmd FileType html,javascript,terraform set shiftwidth=2 augroup gomapping autocmd! autocmd FileType go nnoremap :GoCodeLenAct autocmd FileType go nnoremap = :GoIfErr augroup end augroup indentlinesdisable autocmd! autocmd TermOpen * execute 'IndentLinesDisable' autocmd FileType markdown,json,yaml,join(g:custom_special_filtetypes, ",") execute 'IndentLinesDisable' augroup end " trim whitespace autocmd BufWritePre * :%s/\s\+$//e " save without trim imap :noautocmd w map :noautocmd w