109 lines
4.0 KiB
VimL
109 lines
4.0 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
|
|
" }}}
|
|
" 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.
|
|
" }}}
|
|
" Leader Shortcuts {{{
|
|
" Various shortcuts called by the <leader> char
|
|
let mapleader="," " the <leader> char is , (\ by default)
|
|
" }}}
|
|
" 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
|
|
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
|
|
|
|
" 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=['~/.vim/ultisnips']
|
|
|
|
" palenight theme
|
|
Plug 'drewtempelmeyer/palenight.vim'
|
|
|
|
" Declare plugins to vim
|
|
call plug#end()
|
|
" }}}
|
|
" 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
|