myconfigfiles/.vimrc

215 lines
6.9 KiB
VimL

set nocompatible
filetype off
" Set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
" Download plug-ins to the ~/.vim/plugged/ directory
call vundle#begin('~/.vim/plugged')
" Let Vundle manage Vundle
Plugin 'VundleVim/Vundle.vim'
Plugin 'sheerun/vim-polyglot'
Plugin 'scheakur/vim-scheakur'
Plugin 'preservim/nerdtree'
Plugin 'preservim/tagbar'
Plugin 'airblade/vim-gitgutter'
Plugin 'dpelle/vim-Grammalecte'
Plugin 'loremipsum'
Plugin 'mkitt/tabline.vim'
" File Switcher
Plugin 'derekwyatt/vim-fswitch'
Plugin 'francoiscabrol/ranger.vim'
" fzf native plugin
Plugin 'junegunn/fzf'
" fzf.vim
Plugin 'junegunn/fzf.vim'
Plugin 'liuchengxu/vim-which-key'
call vundle#end()
filetype plugin indent on
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Enable syntax highlighting
syntax on
" Set locale for spellcheck
setlocal spell spelllang=fr
set nospell
set background=dark " dark or light
colorscheme scheakur " Your favorite color scheme's name
""""""""""""""""""""""""""""""""""""""
" NERDTree
""""""""""""""""""""""""""""""""""""""
let NERDTreeShowBookmarks = 1 " Show the bookmarks table
let NERDTreeShowHidden = 1 " Show hidden files
let NERDTreeShowLineNumbers = 0 " Hide line numbers
let NERDTreeMinimalMenu = 1 " Use the minimal menu (m)
let NERDTreeWinPos = "left" " Panel opens on the left side
let NERDTreeWinSize = 31 " Set panel width to 31 columns
nmap <silent> <F2> :NERDTreeToggle<CR>
""""""""""""""""""""""""""""""""""""""
" Tagbar
""""""""""""""""""""""""""""""""""""""
" Focus the panel when opening it
let g:tagbar_autofocus = 1
" Highlight the active tag
let g:tagbar_autoshowtag = 1
" Make panel vertical and place on the right
let g:tagbar_position = 'botright vertical'
" Mapping to open and close the panel
nmap <silent> <F8> :TagbarToggle<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
"set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
set number
set relativenumber
set listchars=eol:$,space,tab:▏\ ,trail:_,nbsp:~,extends:>,precedes:<
set list
set colorcolumn=80
" Linebreak on 500 characters
set lbr
set tw=500
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
let mapleader = " "
set termwinsize=12x0 " Set terminal size
set splitbelow " Always split below
set ttymouse=xterm2
set mouse=a " Enable mouse drag on window splits
""""""""""""""""""""""""""""""""""""""
" GitGutter
""""""""""""""""""""""""""""""""""""""
set updatetime=100
set signcolumn=auto
""""""""""""""""""""""""""""""""""""""
" Grammalect
""""""""""""""""""""""""""""""""""""""
let g:grammalecte_cli_py='~/Grammalecte-fr/grammalecte-cli.py'
""""""""""""""""""""""""""""""""""""""
" FSwitch
""""""""""""""""""""""""""""""""""""""
"au! BufEnter *.c let b:fswitchdst = 'hpp,h'
"au! BufEnter *.h let b:fswitchdst = 'cpp,c'
"nmap <C-Z> :vsplit <bar> :wincmd l <bar> :FSHere<CR>
nmap <silent> <leader>z :FSSplitLeft<CR>
""""""""""""""""""""""""""""""""""""""
" Vim Which Key
""""""""""""""""""""""""""""""""""""""
nnoremap <silent> <leader> :silent WhichKey ','<CR>
vnoremap <silent> <leader> :silent <c-u> :silent WhichKeyVisual ','<CR>
let g:which_key_map = {}
let g:which_key_sep = ': '
" Set a shorter timeout, default is 1000
set timeoutlen=100
let g:which_key_use_floating_win = 1
" Single mappings
"let g:which_key_map['/'] = [ '<Plug>NERDCommenterToggle' , 'comment' ]
let g:which_key_map['f'] = [ ':Files' , 'search files' ]
"let g:which_key_map['h'] = [ '<C-W>s' , 'split below']
"let g:which_key_map['S'] = [ ':Startify' , 'start screen' ]
"let g:which_key_map['T'] = [ ':Rg' , 'search text' ]
"let g:which_key_map['E'] = [ ':SSave' , 'save session']
"let g:which_key_map['L'] = [ ':SLoad' , 'load session']
"let g:which_key_map['l'] = [ ':Limelight!!' , 'limelight']
"let g:which_key_map['z'] = [ ':Goyo' , 'zen mode']
let g:which_key_map['r'] = [ ':Ranger' , 'ranger' ]
"let g:which_key_map['g'] = [ ':FloatermNew lazygit' , 'git']
"let g:which_key_map['d'] = [ ':FloatermNew lazydocker' , 'docker']
"let g:which_key_map['k'] = [ ':FloatermNew k9s' , 'k9s']
"let g:which_key_map['t'] = [ ':FloatermNew' , 'terminal']
let g:which_key_map['t'] = [ ':TagbarToggle' , 'Tagbar']
"let g:which_key_map['v'] = [ '<C-W>v' , 'split right']
let g:which_key_map[' '] = [ ':Buffers' , 'open buffers']
let g:which_key_map['/'] = [ ':BLines' , 'search current']
" s is for search
let g:which_key_map.s = {
\ 'name' : '+search' ,
\ '/' : [':History/' , 'history'],
\ ';' : [':Commands' , 'commands'],
\ 'a' : [':Ag' , 'text Ag'],
\ 'c' : [':Commits' , 'commits'],
\ 'C' : [':BCommits' , 'buffer commits'],
\ 'f' : [':Files' , 'files'],
\ 'g' : [':GFiles' , 'git files'],
\ 'G' : [':GFiles?' , 'modified git files'],
\ 'h' : [':History' , 'file history'],
\ 'H' : [':History:' , 'command history'],
\ 'l' : [':Lines' , 'lines'] ,
\ 'm' : [':Marks' , 'marks'] ,
\ 'M' : [':Maps' , 'normal maps'] ,
\ 'p' : [':Helptags' , 'help tags'] ,
\ 'P' : [':Tags' , 'project tags'],
\ 's' : [':CocList snippets' , 'snippets'],
\ 'S' : [':Colors' , 'color schemes'],
\ 't' : [':Rg' , 'Rg text'],
\ 'T' : [':BTags' , 'buffer tags'],
\ 'w' : [':Windows' , 'search windows'],
\ 'y' : [':Filetypes' , 'file types'],
\ 'z' : [':FZF' , 'FZF'],
\ }
" P is for vim-plug
let g:which_key_map.p = {
\ 'name' : '+plug' ,
\ 'i' : [':PlugInstall' , 'install'],
\ 'u' : [':PlugUpdate' , 'update'],
\ 'c' : [':PlugClean' , 'clean'],
\ 's' : [':source ~/.config/nvim/init.vim', 'source vimrc'],
\ }
" Register which key map
call which_key#register(',', "g:which_key_map")