This repository has been archived on 2021-04-06. You can view files and clone it, but cannot push or open issues/pull-requests.
dotfiles/home/.config/nvim/init.vim

150 lines
4.1 KiB
VimL
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

" Basic display
set number
set colorcolumn=80
" Persistent undo
set undofile
set undolevels=4096
set undoreload=16384
" Search
set ignorecase
" Autoload settings from file
set modeline
" Use system clipboard
set clipboard=unnamedplus
" Remap leader key
let mapleader = ","
" Jump to the last position
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g`\"" | endif
endif
" Support more file encodings
set fileencodings=ucs-bom,utf-8,default,sjis,latin1
" Scroll before reaching top/bottom
set scrolloff=5
call plug#begin('~/.local/share/nvim/plugged')
" Per-project vim settings
Plug 'MarcWeber/vim-addon-local-vimrc'
" Tagbar
Plug 'majutsushi/tagbar'
nmap <F8> :TagbarToggle<CR>
" Snippets
if has('python3')
Plug 'SirVer/ultisnips'
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
Plug 'honza/vim-snippets'
endif
" Deoplete
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
let g:deoplete#enable_at_startup = 1
" Airline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline_powerline_fonts = 1
let g:airline_solarized_bg='dark'
let g:airline_theme='solarized'
" Airline for tmux
Plug 'edkolev/tmuxline.vim'
" Better word motion
Plug 'chaoren/vim-wordmotion'
" Trailing whitespace highlighting
Plug 'ntpeters/vim-better-whitespace'
" Markdown live preview
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
" Syntax highlighting/Language support
Plug 'ElmCast/elm-vim', { 'for': 'elm' }
Plug 'Glench/Vim-Jinja2-Syntax', { 'for': 'jinja' }
Plug 'cespare/vim-toml', { 'for': 'toml' }
Plug 'fatih/vim-go', { 'for': 'go', 'do': ':GoUpdateBinaries' }
Plug 'mechatroner/rainbow_csv'
Plug 'posva/vim-vue', { 'for': 'vue' }
Plug 'sirtaj/vim-openscad', { 'for': 'openscad' }
" Language Client
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
set hidden
let g:LanguageClient_serverCommands = {
\ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
\ }
let g:LanguageClient_settingsPath = '~/.config/nvim/LanguageClient.json'
function LC_maps()
if has_key(g:LanguageClient_serverCommands, &filetype)
nnoremap <buffer> <silent> <F5> :call LanguageClient_contextMenu()<CR>
nnoremap <buffer> <silent> K :call LanguageClient#textDocument_hover()<CR>
nnoremap <buffer> <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <buffer> <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
set formatexpr=LanguageClient#textDocument_rangeFormatting_sync()
endif
endfunction
autocmd FileType * call LC_maps()
" Multi-entry selection UI
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
" Rust
Plug 'rust-lang/rust.vim'
let g:rustfmt_autosave = 1
" Black (python formatter)
Plug 'psf/black', { 'branch': 'stable' }
" LaTeX helpers
Plug 'lervag/vimtex'
let g:tex_flavor='latex'
let g:vimtex_view_method='zathura'
set conceallevel=1
let g:tex_conceal='abdmg'
" nvr is (currently) not in debian repos and therefore installed with pip (in
" local directory that is not in zathuras PATH)
let g:vimtex_compiler_progname='$HOME/.local/bin/nvr'
" this disables some helful warnings that often have a reason why I ignore them
let g:vimtex_quickfix_ignore_filters = [
\'Underfull \\hbox (badness [0-9]*) in ',
\'Overfull \\hbox ([0-9]*.[0-9]*pt too wide) in ',
\'Package hyperref Warning: Token not allowed in a PDF string',
\'Package typearea Warning: Bad type area settings!',
\]
" When using math environments vim does not know if if it currently is in one
" or outside of one unless it parses the file from the start. Parsing the
" file from the start each time fixes this but leads to a performance drop
" (depending on the number of lines).
" Also, somehow using FileType tex does not work, so this will enable slow
" syntax highlighting everywhere once a *.tex file is opened.
autocmd BufEnter *.tex syntax sync fromstart
" Color schemes
Plug 'altercation/vim-colors-solarized'
call plug#end()
set background=dark
silent! colorscheme solarized