dotfiles/init.vim

188 lines
4.4 KiB
VimL
Raw Normal View History

2018-09-19 14:52:29 +02:00
" Pas de compatibilité a VI !
set nocompatible
" PLUGNIS ###########################################################{{{
call plug#begin()
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
2019-06-19 10:03:55 +02:00
" General plugins
2018-09-19 14:52:29 +02:00
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
2019-06-19 10:03:55 +02:00
Plug 'https://gitea.tforgione.fr/tforgione/peach.git'
2018-09-19 14:52:29 +02:00
Plug 'scrooloose/nerdtree'
Plug 'w0rp/ale'
2019-01-30 11:49:57 +01:00
Plug 'tpope/vim-abolish'
2019-06-19 10:03:55 +02:00
" Language specific plugins
2019-06-21 11:13:17 +02:00
" C++
Plug 'Shougo/deoplete-clangx'
2019-06-19 10:03:55 +02:00
" Rust
2019-06-19 10:04:48 +02:00
Plug 'rust-lang/rust.vim'
Plug 'racer-rust/vim-racer'
Plug 'sebastianmarkow/deoplete-rust'
2019-06-19 10:03:55 +02:00
" Elm
2019-06-19 10:04:48 +02:00
Plug 'ElmCast/elm-vim'
Plug 'antew/vim-elm-language-server'
2019-06-19 10:03:55 +02:00
" Toml
2019-06-19 10:04:48 +02:00
Plug 'cespare/vim-toml'
2019-06-19 10:03:55 +02:00
" Pug
2019-06-19 10:04:48 +02:00
Plug 'digitaltoad/vim-pug'
2019-06-19 10:03:55 +02:00
" Spandex
2019-06-19 10:04:48 +02:00
Plug 'rust-spandex/spandex.vim'
2019-06-19 10:03:55 +02:00
2018-09-19 14:52:29 +02:00
call plug#end()
" Line numbers and syntaxic coloration
" set nu
" syntax on
" Highlight bad spaces (not working...)
" }}}
" INDENTATION #######################################################{{{
set expandtab
set tabstop=4
set shiftwidth=4
set autoindent
" }}}
" UI CONFIG #########################################################{{{
set number
2019-06-25 14:12:13 +02:00
if $NVIM_LINE_NUMBER == 'rnu'
set rnu
endif
2018-09-19 14:52:29 +02:00
set showcmd
set wildmenu
set lazyredraw
set encoding=utf8
set clipboard=unnamedplus
set updatecount=50
set mouse=a
2019-06-05 16:59:43 +02:00
set guicursor=
2018-09-19 14:52:29 +02:00
" set ttymouse=sgr
" Espaces insécables grrrr
set list
set listchars=tab:,trail,extends:>,precedes:<,nbsp
" Remove trailing spaces
autocmd BufWritePre * :%s/\s\+$//e
2018-09-19 14:52:29 +02:00
" Compile on F12
if executable('mars')
2019-06-12 15:07:10 +02:00
nnoremap <silent><F12> :wa \| !mars -p %:p<CR>
inoremap <silent><F12> <C-O>:wa \|!mars -p %:p<CR>
vnoremap <silent><F12> :wa \|!mars -p %:p<CR>
elseif executable('make')
2019-06-12 15:07:10 +02:00
nnoremap <silent><F12> :wa \| !make -p %:p<CR>
inoremap <silent><F12> <C-O>:wa \|!make -p %:p<CR>
vnoremap <silent><F12> :wa \|!make -p %:p<CR>
endif
2018-09-19 14:52:29 +02:00
" Escape on F1
map <F1> <Esc>
imap <F1> <Esc>
" vim airline config
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline#extensions#branch#format = 1
let g:airline_theme='dark'
set t_Co=256
" Set textwidth for latex
" autocmd FileType tex set textwidth=79
" }}}
" COLOR #############################################################{{{
set background=dark
syntax enable
2019-04-26 15:37:14 +02:00
try
colorscheme peach
catch
endtry
2018-09-19 14:52:29 +02:00
highlight BadWhitespace ctermbg=red guibg=red
match BadWhitespace / \| \+\t/
" }}}
" SEARCHING #########################################################{{{
set title
set showmatch
set hlsearch
set noincsearch
" }}}
" NERDTREE ##########################################################{{{
let NERDTreeIgnore = ['\.pyc$','__pycache__']
2019-06-25 14:12:13 +02:00
set shell=zsh
2018-09-19 14:52:29 +02:00
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ "Unknown" : "?"
\ }
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
" }}}
" BACKUPS ###########################################################{{{
2019-04-26 14:56:39 +02:00
set dir=$HOME/.nvim/swp//
2019-04-26 14:57:34 +02:00
autocmd BufWritePost * :silent execute ':w! ' ."$HOME/.nvim/backups/" . substitute(escape(substitute(expand('%:p'), "/", "%", "g"), "%"), ' ', '\\ ', 'g')
2018-09-19 14:52:29 +02:00
if exists('+undofile')
set undofile
set undolevels=1000
set undoreload=10000
if exists('+undodir')
2019-04-26 14:57:34 +02:00
set undodir=$HOME/.nvim/undo
2018-09-19 14:52:29 +02:00
endif
endif
" }}}
" MARKDOWN PREVIEW ##################################################{{{
let g:markdown_composer_browser = 'firefox'
let g:instant_markdown_autostart = 0
" }}}
" CODE COMPLETION ###################################################{{{
2019-06-18 17:28:07 +02:00
2018-09-19 14:52:29 +02:00
" Use deoplete
let g:deoplete#enable_at_startup = 1
2019-06-18 17:28:07 +02:00
autocmd FileType elm call deoplete#custom#buffer_option('auto_complete', v:false)
2018-09-19 14:52:29 +02:00
" Autoclose preview
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
2019-06-18 17:28:07 +02:00
" Complete on tab
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
2019-06-18 17:28:07 +02:00
2018-09-19 14:52:29 +02:00
" }}}
2019-05-24 09:53:57 +02:00
" CUSTOM THINGS DEPENDING ON ENV ####################################{{{
2020-02-05 09:04:17 +01:00
let g:rustfmt_autosave = 1
2019-06-04 15:32:08 +02:00
let g:ale_linters = {}
2019-06-21 11:13:17 +02:00
let g:ale_c_parse_compile_commands=1
2019-06-18 17:35:38 +02:00
let g:ale_elm_ls_use_global = 1
let g:ale_linters_ignore = { 'elm': ['make'] }
2019-06-18 17:28:07 +02:00
let g:ale_lint_on_text_changed = 0
2019-06-04 15:32:08 +02:00
if $NVIM_DISABLE_PYTHON_LINTER == '1'
let g:ale_linters.python = []
endif
if $NVIM_DISABLE_JAVA_LINTER == '1'
let g:ale_linters.java = []
2019-05-24 09:53:57 +02:00
endif