You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
178 lines
6.6 KiB
VimL
178 lines
6.6 KiB
VimL
" Personal vimrc
|
|
" (originally from https://dougblack.io/words/a-good-vimrc.html)
|
|
" TODO: add license
|
|
|
|
" Base {{{
|
|
" Fundamental settings
|
|
set modelines=1 " Enables the use of modelines to tweak things on a single document scale (see last line for an example
|
|
set nocompatible " Don't try to be compatible with vi
|
|
set path+=**
|
|
" }}}
|
|
" Tabs and spaces {{{
|
|
"Set the size and type of space made by a TAB stroke
|
|
set tabstop=4 " TABS are read as 4 spaces
|
|
set softtabstop=4 " TABS are edited as 4 spaces
|
|
set expandtab " TABS are (actually) spaces
|
|
"}}}
|
|
" Various UI config {{{
|
|
" Various tweakings of the UI
|
|
set number " Show line number
|
|
set cursorline " Highlights the current line
|
|
set wildmenu " Visual menu for autocompletion
|
|
set lazyredraw " Do not redraw screen too often (to make macros quicker)
|
|
set showmatch " Shows matching pairs of [] () etc.
|
|
" }}}
|
|
" Shortcuts {{{
|
|
" Various shortcuts
|
|
" Use inkscape-figures (https://github.com/gillescastel/inkscape-figures)
|
|
inoremap <C-f> <Esc>: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/"'<CR><CR>:w<CR>
|
|
nnoremap <C-f> : silent exec '!inkscape-figures edit "'.b:vimtex.root.'/figures/" > /dev/null 2>&1 &'<CR><CR>:redraw!<CR>
|
|
" Various shortcuts called by the <leader> char
|
|
let mapleader="," " the <leader> char is , (\ by default)
|
|
let maplocalleader=","
|
|
nnoremap <leader>t :tabnew<CR>
|
|
" Split screen and move between splits with fewer strokes
|
|
" Split screen vertically and move to the left split
|
|
nnoremap <leader>h :vertical split
|
|
" Same but move to the right Split
|
|
nnoremap <leader>l :vertical split<CR><C-w><C-l>
|
|
" Split screen horizontally and move to the top / bottom split
|
|
nnoremap <leader>j :split<CR><C-w><C-j>
|
|
nnoremap <leader>k :split<CR>
|
|
" Move through splits with less keystrokes
|
|
nnoremap <C-h> <C-w><C-h>
|
|
nnoremap <C-l> <C-w><C-l>
|
|
nnoremap <C-j> <C-w><C-j>
|
|
nnoremap <C-k> <C-w><C-k>
|
|
" }}}
|
|
" Spelling and autocompletion {{{
|
|
" Get and correct spelling mistakes
|
|
setlocal spell
|
|
set spelllang=fr,en_gb
|
|
inoremap <C-l> <c-g>u<Esc>[s1z=`]a<c-g>u
|
|
|
|
set complete+=kspell " Add dictionary to completion
|
|
set completeopt=menuone,longest " the way completion are displayed: the longest match first, even displayed if there is only one match
|
|
set shortmess+=c " Remove the completion info in the bottom left
|
|
" Navigate the autocompletion menu with arrows
|
|
inoremap <expr> <Down> pumvisible() ? "<C-n>" :"<Down>"
|
|
inoremap <expr> <Up> pumvisible() ? "<C-p>" :"<Up>"
|
|
inoremap <expr> <Right> pumvisible() ? "<C-y>" : "<Right>"
|
|
inoremap <expr> <CR> pumvisible() ? "<C-y>" : "<CR>"
|
|
inoremap <expr> <Left> pumvisible() ? "<C-e>" : "<Left>"
|
|
|
|
" }}}
|
|
" Searching {{{
|
|
" How search results are displayed
|
|
set incsearch " search as typing
|
|
set hlsearch " highlight matches
|
|
" Shortcut to turn off search highlights (typing :nohlsearch being cumbersome)
|
|
nnoremap <leader>k :nohlsearch<CR>
|
|
" }}}
|
|
" Code folding {{{
|
|
" Fold some nested blocks to help your brain
|
|
set foldenable " Turn folding on
|
|
set foldlevelstart=10 " Only fold blocks nested more than 10 times
|
|
set foldnestmax=10 " Do not fld within folds more than 10 times
|
|
set foldmethod=indent " Base folding on the indentation
|
|
" Use space to unfold a block
|
|
nnoremap <space> za
|
|
" }}}
|
|
" Autogroups {{{
|
|
" Set some file specific rules
|
|
filetype plugin on " Run ftplugin now to be able to ovewrite..
|
|
augroup configgroup
|
|
autocmd!
|
|
autocmd VimEnter * highlight clear SignColumn
|
|
autocmd Filetype conf setlocal foldmethod=marker " I like to fold my rc files
|
|
autocmd Filetype conf setlocal foldlevel=0
|
|
autocmd Filetype twig setlocal filetype=htmldjango
|
|
""" livetex files : basic tex with autowrite to have real-time compilation
|
|
autocmd TextChanged,TextChangedI *.livetex silent write
|
|
autocmd BufNewFile,BufRead *.livetex setlocal filetype=tex
|
|
augroup END
|
|
" }}}
|
|
" Plugins {{{
|
|
" Plugin specific settings, using vim-plug https://github.com/junegunn/vim-plug
|
|
" Check whether vim-plug is installed and possibly install it
|
|
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
|
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
|
endif
|
|
" Call vim-plug to look for plugins
|
|
call plug#begin('~/.vim/bundles')
|
|
" Declare the plugins to use
|
|
|
|
" A wonderful LaTeX plugin
|
|
Plug 'lervag/vimtex'
|
|
let g:tex_flavor='latex'
|
|
let g:vimtex_view_method='zathura' " Use zathura to view the compiled document
|
|
let g:vimtex_quickfix_mode=0
|
|
set conceallevel=1
|
|
let g:tex_conceal='abdmg' " Conceal LaTeX forumlae code to display it in a nice readable way when it is not on the edited line
|
|
let g:vimtex_indent_enabled=0 " Disable auto-indentation
|
|
|
|
" become a snippet master
|
|
Plug 'SirVer/ultisnips'
|
|
let g:UltiSnipsExpandTrigger='<tab>' " Expand snippets with a TAB
|
|
let g:UltiSnipsJumpForwardTrigger='<tab>' " Use TAB to navigate the different zones of your snippet
|
|
let g:UltiSnipsJumpBackwardTrigger='<s-tab>' " Use SUPER+TAB to naviguate backwards
|
|
let g:UltiSnipsSnippetDirectories=['ultisnips', 'UltiSnips']
|
|
|
|
" Pop completion menu automatically
|
|
Plug 'vim-scripts/AutoComplPop'
|
|
|
|
" palenight theme
|
|
Plug 'drewtempelmeyer/palenight.vim'
|
|
|
|
" Lightline, a nice bottom status line
|
|
Plug 'itchyny/lightline.vim'
|
|
set laststatus=2
|
|
set noshowmode
|
|
let g:lightline = {
|
|
\ 'colorscheme' : 'one',
|
|
\ }
|
|
|
|
" fzf
|
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
|
Plug 'junegunn/fzf.vim'
|
|
inoremap <leader>o <Esc>:Files<CR>
|
|
nnoremap <leader>o :Files<CR>
|
|
inoremap <leader>b <Esc>:Buffers<CR>
|
|
nnoremap <leader>b :Buffers<CR>
|
|
inoremap <leader>m <Esc>:call fzf#run(fzf#wrap({'source' : 'khard email --parsable', 'sink' : ':r !firstcolumn'}))<CR>
|
|
|
|
" notmuch-vim
|
|
Plug 'felipec/notmuch-vim'
|
|
|
|
" Declare plugins to vim
|
|
call plug#end()
|
|
|
|
" filetype plugin indent off
|
|
" autoindent on
|
|
|
|
" }}}
|
|
" Colors {{{
|
|
" To install a new color scheme simply download the colorscheme.vim file in
|
|
" your ~/.vim/clors and add the relevant line under here.
|
|
|
|
" Enabling 'true colors'
|
|
if (has("nvim"))
|
|
" For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
|
|
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
|
endif
|
|
" For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
|
|
" Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
|
|
" < https://github.com/neovim/neovim/wiki/Following-HEAD#201605 >
|
|
if (has("termguicolors"))
|
|
set termguicolors
|
|
endif
|
|
|
|
colorscheme palenight " Installed with vum-plug, but see https://github.com/drewtempelmeyer/palenight.vim
|
|
set t_Co=256
|
|
|
|
syntax enable " If you want syntax coloring...
|
|
" }}}
|
|
" vim: foldmethod=marker:foldlevel=0
|