rcs-general/vimrc

82 lines
1.8 KiB
VimL
Raw Permalink Normal View History

2021-09-23 17:21:07 +02:00
" ~/.vimrc
" byMasterKTO
" Credits: DougBlack's blog post: https://dougblack.io/words/a-good-vimrc.html
" Indentation
" Use space characters (soft tabs)
set expandtab
" Set '1 tab press inserts 2 spaces'
set softtabstop=2
set shiftwidth=2
" If hard tabs are present, set their width to 8 characters (I want to see them)
set tabstop=8
" UI
" syntax highlighting
syntax on
" lines number
set number
" load filetype-specific indent files
" apparently, they're supposed to be at ~/.vim/indent/<lang>.vim
filetype indent on
" visual autocomplete for command menu
set wildmenu
" redraw only when nedded
set lazyredraw
" search as characters are entered
set incsearch
" allow cursor change in tmux mode
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
" TEST: disable all mouse interactions
set mouse=
set ttymouse=
2021-09-23 17:21:07 +02:00
" Specific configurations
augroup configgroup
autocmd!
" remove trailing whitespaces on every files at saving
autocmd BufWritePre * %s/\s\+$//e
" Makefiles specifics
autocmd BufEnter Makefile setlocal noexpandtab
"Python specifics
autocmd BufEnter *.py setlocal filetype=python
" Javascript specifics
autocmd BufEnter *.js setlocal filetype=javascript
autocmd FileType javascript setlocal softtabstop=2
autocmd FileType javascript setlocal shiftwidth=2
" Markdown specifics
autocmd BufEnter *.md setlocal filetype=markdown
autocmd FileType markdown setlocal softtabstop=2
autocmd FileType markdown setlocal shiftwidth=2
augroup END
" Notes
" spellchecking
" Vim seems to be able to use dictionnaries
" We can use `:setlocal spell spelllang=en_GB` and `:setlocal nospell`