138 lines
4.5 KiB
VimL
138 lines
4.5 KiB
VimL
"" Based on ensimag vim config file version 1.0.2
|
|
"" this file is intended for vim 8.
|
|
"" before using it on your machine however you will need to:
|
|
"" - install plug with :
|
|
"" curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
"" (see https://github.com/junegunn/vim-plug)
|
|
"" - install the languageserver server for each language you indend to use :
|
|
"" * pyls for python (see https://github.com/palantir/python-language-server)
|
|
"" * rls for rust (see https://github.com/rust-lang-nursery/rls)
|
|
"" * clangd for c
|
|
"" - you need to install jedi for python auto-completion
|
|
"" - install some font with powerline symbols for eye candy and icons
|
|
"" (see https://github.com/powerline/fonts)
|
|
"" - change plugin directory to ~/.local/share/nvim/plugged
|
|
|
|
"" after that copy this file as your ~/.vimrc and execute :PlugInstall
|
|
|
|
set nocompatible
|
|
filetype off
|
|
|
|
call plug#begin('~/.local/share/nvim/plugged') " on your own machine
|
|
|
|
" not needed as neovim alreay has (better ?) sane defaults
|
|
"Plug 'tpope/vim-sensible' " sane defaults
|
|
|
|
" eye candy
|
|
Plug 'vim-airline/vim-airline' " status bar (needs special fonts)
|
|
Plug 'vim-airline/vim-airline-themes'
|
|
Plug 'morhetz/gruvbox' " very nice and soft color theme
|
|
Plug 'ryanoasis/vim-devicons' " various symbols (linux, rust, python, ...)
|
|
|
|
" essential plugins
|
|
" see for example https://github.com/autozimu/LanguageClient-neovim/issues/35#issuecomment-288731665
|
|
"Plug 'maralla/completor.vim' " auto-complete
|
|
Plug 'autozimu/LanguageClient-neovim', {
|
|
\ 'branch': 'next',
|
|
\ 'do': 'bash install.sh',
|
|
\ } " as of july 2018 this branch is needed for vim8
|
|
Plug 'tbodt/deoplete-tabnine', {
|
|
\ 'do': './install.sh',
|
|
\ } " auto-complete contextually
|
|
|
|
" rust
|
|
Plug 'rust-lang/rust.vim' " syntax highlighting
|
|
Plug 'mattn/webapi-vim' " used for rust playpen
|
|
|
|
|
|
" not essential
|
|
Plug 'tpope/vim-fugitive' " git
|
|
Plug 'scrooloose/nerdtree' " browse files tree
|
|
" Plug 'junegunn/fzf' " fuzzy files finding
|
|
|
|
" snippets allow to easily 'fill' common patterns
|
|
Plug 'SirVer/ultisnips'
|
|
Plug 'honza/vim-snippets'
|
|
|
|
call plug#end()
|
|
|
|
filetype plugin indent on
|
|
|
|
" configure maralla/completor to use tab
|
|
" other configurations are possible (see website)
|
|
"inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
|
"inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
|
"inoremap <expr> <cr> pumvisible() ? "\<C-y>\<cr>" : "\<cr>"
|
|
|
|
" ultisnips default bindings compete with completor's tab
|
|
" so we need to remap them
|
|
let g:UltiSnipsExpandTrigger="<c-t>"
|
|
let g:UltiSnipsJumpForwardTrigger="<c-b>"
|
|
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
|
|
|
|
" airline :
|
|
" for terminology you will need either to export TERM='xterm-256color'
|
|
" or run it with '-2' option
|
|
let g:airline_powerline_fonts = 1
|
|
set laststatus=2
|
|
au VimEnter * exec 'AirlineTheme hybrid'
|
|
|
|
set encoding=utf-8
|
|
|
|
syntax on
|
|
|
|
colorscheme gruvbox
|
|
set background=dark
|
|
set number relativenumber
|
|
|
|
" see https://jeffkreeftmeijer.com/vim-number/
|
|
:augroup numbertoggle
|
|
: autocmd!
|
|
: autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif
|
|
: autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
|
|
:augroup END
|
|
|
|
|
|
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
|
|
|
|
" tabs
|
|
set tabstop=4
|
|
set shiftwidth=4
|
|
set smartindent
|
|
|
|
" highlight trailing whitespace
|
|
highlight ExtraWhitespace ctermbg=red guibg=red
|
|
match ExtraWhitespace /\s\+\%#\@<!$/
|
|
|
|
" some more rust
|
|
let g:LanguageClient_loadSettings = 1 " this enables you to have per-projects languageserver settings in .vim/settings.json
|
|
let g:rustfmt_autosave = 1
|
|
let g:rust_conceal = 1
|
|
set hidden
|
|
|
|
" I don't really like to use this but if you prefer this kind of symbol you
|
|
" can uncomment this.
|
|
"au BufEnter,BufNewFile,BufRead *.rs syntax match rustEquality "==\ze[^>]" conceal cchar=≟ " Char "question equal to" from unicode: [c-v]U225F
|
|
"au BufEnter,BufNewFile,BufRead *.rs syntax match rustInequality "!=\ze[^>]" conceal cchar=≠ " Char "not equal to" from unicode: [c-v]U2260
|
|
|
|
" let's autoindent c files
|
|
au BufWrite *.c call LanguageClient#textDocument_formatting()
|
|
|
|
" run language server for python, rust and c
|
|
let g:LanguageClient_autoStart = 1
|
|
let g:LanguageClient_serverCommands = {
|
|
\ 'python': ['pyls'],
|
|
\ 'rust': ['rustup', 'run', 'stable', 'rls'],
|
|
\ 'javascript': ['javascript-typescript-stdio'],
|
|
\ 'go': ['go-langserver'],
|
|
\ 'c' : ['clangd']
|
|
\ }
|
|
|
|
" keep the cursor "centered" vertically
|
|
set scrolloff=5
|
|
|
|
" use rg instead of grep. Comment this if you ripgrep is not installed.
|
|
set grepprg=rg\ --vimgrep
|
|
set grepformat=%f:%l:%c:%m
|
|
|