Feat: vim config

This commit is contained in:
Bertrand Benjamin 2022-01-12 05:23:30 +01:00
parent 1bae59ca93
commit 6a1540bcb0
3 changed files with 203 additions and 0 deletions

118
vim/.vim/config/base.vim Normal file
View File

@ -0,0 +1,118 @@
" Lines number
set number
" Always show the statusline
set laststatus=2
" Necessary to show Unicode glyphs
set encoding=utf8
" smart tab
set smartindent
" Tab to..?
set shiftround
" Display edition mode
set showmode
" Ignore case in search mode
set ignorecase
" Override the 'ignorecase' option if the search pattern
" contains upper case characters.
set smartcase
" Display uncomplete commands (??)
set showcmd
" Vim file name completion relative to current file
set autochdir
" While typing a search command, show immediately where the
" so far typed pattern matches.
set incsearch
" Use <C-L> to clear the highlighting of :set hlsearch.
set hlsearch
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
endif
" Turn on the WiLd menu
set wildmenu
" Ignore compiled files
set wildignore=*.o,*~,*.pyc,*.swp
" Wrap lines
set wrap
" Turn backup off, since most stuff is in SVN, git et.c anyway...
set nobackup
set noswapfile
" Having relative number for lines
set relativenumber
" Display tab and ends of lines
" Shortcut to rapidly toggle `set list`
nmap <leader>L :set list!<CR>
" Behaviour of tab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" Folding
set foldmethod=indent
" Use the same symbols as TextMate for tabstops and EOLs
" set listchars=tab:▸\ ,eol:¬
set listchars=nbsp,tab:··,trail,extends:▶,precedes:◀
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
"
" In many terminal emulators the mouse works just fine, thus enable it.
if has('mouse')
set mouse=a
endif
" Decorations
" ====================
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
endif
" When set to "dark", Vim will try to use colors that look
" good on a dark background. When set to "light", Vim will
" try to use colors that look good on a light background.
" Any other value is illegal.
set background=dark
" Color Scheme
colorscheme zenburn
set cursorline
" Align blocks of text and keep them selected
vmap < <gv
vmap > >gv
" Spelling
" set spelllang=fr
autocmd BufRead,BufNewFile *.{md,tex,rst} setlocal spell spelllang=fr
autocmd FileType tex,latex,markdown,md,rst setlocal spell spelllang=fr
" Remove trailing whitespace at the end of lines
autocmd BufWritePre * %s/\s\+$//e
" Different color for far columns
execute "set colorcolumn=" . join(range(81,335), ',')

View File

@ -0,0 +1,24 @@
" lightline -> no need showmod
set noshowmode
let g:lightline = {
\ 'colorscheme': 'selenized_dark',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ }
" Supertab
let g:SuperTabDefaultCompletionType = "context"
" Airline
let g:airline_powerline_fonts = 1
let g:tmuxline_powerline_separators = 0
" Nerdtree
let NERDTreeIgnore = ['.pyc$']
"autocmd VimEnter * NERDTree

61
vim/.vimrc Normal file
View File

@ -0,0 +1,61 @@
set nocompatible " be iMproved, required
noremap <Space> <Nop>
map <Space> <Leader>
let mapleader = "\<Space>"
let localleader = "\<Space>"
" set the runtime path to include plug.com and initialize
call plug#begin('~/.vim/plugged')
"" plug.vim management
Plug 'junegunn/vim-plug'
" Airline statusline
Plug 'itchyny/lightline.vim'
"" Basic config for vim
Plug 'tpope/vim-sensible'
" Git integration
Plug 'tpope/vim-fugitive'
" Nerdtree
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
" Change surround
Plug 'tpope/vim-surround'
" Clever substitute
Plug 'tpope/tpope-vim-abolish'
" Repeat
Plug 'tpope/vim-repeat'
" Git on lines
Plug 'airblade/vim-gitgutter'
" Polyglot synthax hightlight autodetect
Plug 'sheerun/vim-polyglot'
" Show indent lines
Plug 'Yggdroot/indentLine'
" Tmux integration
Plug 'christoomey/vim-tmux-navigator'
"" Color scheme
Plug 'jnurmine/Zenburn'
" All of your Plugs must be added before the following line
call plug#end() " required
"
" import config from ./config
" runtime! config/**/*.vim
"runtime! config/*.vim
runtime! config/base.vim
runtime! config/plugins.vim
set conceallevel=0