Skip to content

Instantly share code, notes, and snippets.

@Dekker1
Created October 25, 2016 09:45
Show Gist options
  • Save Dekker1/da817d7fcc83197427afa6e0d45c171e to your computer and use it in GitHub Desktop.
Save Dekker1/da817d7fcc83197427afa6e0d45c171e to your computer and use it in GitHub Desktop.
Neovim configuration (Should I ever want to try again)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Dein.vim initialisation
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if &compatible
set nocompatible
endif
set runtimepath+=~/.config/nvim/repos/github.com/Shougo/dein.vim
call dein#begin(expand('~/.config/nvim/'))
call dein#add('Shougo/dein.vim')
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Dein.vim packages
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Adds quick motions
call dein#add('easymotion/vim-easymotion')
" Adds file tree
call dein#add('scrooloose/nerdtree', {'on_cmd': 'NERDTreeToggle'})
map <C-l> :NERDTreeToggle<CR>
let NERDTreeQuitOnOpen=1
" Adds fuzzy file finder
call dein#add('ctrlpvim/ctrlp.vim', {'on_cmd': 'CtrlP'})
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_map = '<c-n>'
map <C-n> :CtrlP<CR>
" Adds git information to the file tree
call dein#add('Xuyuanp/nerdtree-git-plugin')
" Adds git information to the gutter
call dein#add('airblade/vim-gitgutter')
" Adds powerline to vim
call dein#add('itchyny/lightline.vim')
" Adds Gruvbox colorscheme
call dein#add('morhetz/gruvbox')
" Adds keyword completion
call dein#add('Shougo/deoplete.nvim')
let g:deoplete#enable_at_startup = 1
if !exists('g:deoplete#omni#input_patterns')
let g:deoplete#omni#input_patterns = {}
endif
" Adds syntax checking / Linting
call dein#add('scrooloose/syntastic')
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" Adds comment helpers
call dein#add('tpope/vim-commentary')
" Adds undo tree
call dein#add('mbbill/undotree', {'on_cmd': 'UndotreeToggle'})
nnoremap <F5> :UndotreeToggle<cr>
" Adds Indentation lines
call dein#add('yggdroot/indentline')
let g:indentLine_char = '┆'
let g:indentLine_leadingSpaceChar = '˰'
let g:indentLine_leadingSpaceEnabled = 1
" Language support
" Go
call dein#add('fatih/vim-go', {'on_ft': 'go'})
let g:go_fmt_command = "goimports"
" DTrace
call dein#add('vim-scripts/dtrace-syntax-file', {'on_ft': 'd'})
" MiniZinc
call dein#add('vale1410/vim-minizinc', {'on_ft': 'zinc'})
" LaTeX
call dein#add('lervag/vimtex', {'on_ft': ['tex', 'bib']})
let g:deoplete#omni#input_patterns.tex = '\\(?:'
\ . '\w*cite\w*(?:\s*\[[^]]*\]){0,2}\s*{[^}]*'
\ . '|\w*ref(?:\s*\{[^}]*|range\s*\{[^,}]*(?:}{)?)'
\ . '|hyperref\s*\[[^]]*'
\ . '|includegraphics\*?(?:\s*\[[^]]*\]){0,2}\s*\{[^}]*'
\ . '|(?:include(?:only)?|input)\s*\{[^}]*'
\ . '|\w*(gls|Gls|GLS)(pl)?\w*(\s*\[[^]]*\]){0,2}\s*\{[^}]*'
\ . '|includepdf(\s*\[[^]]*\])?\s*\{[^}]*'
\ . '|includestandalone(\s*\[[^]]*\])?\s*\{[^}]*'
\ .')'
" LilyPond
filetype off
set runtimepath+=/usr/local/share/lilypond/2.18.2/vim/
filetype on
" Rust
call dein#add('rust-lang/rust.vim', {'on_ft': 'rust'})
let g:rustfmt_autosave = 1
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Dein.vim ending
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
call dein#end()
filetype plugin indent on
syntax enable
set termguicolors
colorscheme gruvbox
set background=light
set number
set clipboard=unnamed
set textwidth=80
set wrap linebreak nolist
" Switching between tabs and spaces
function! SetTab(spaces)
let spaces = a:spaces
if a:spaces > 0
echo a:spaces
execute 'set tabstop='.spaces
execute 'set shiftwidth='.spaces
execute 'set expandtab'
else
set tabstop=2
set shiftwidth=2
set noexpandtab
endif
endfunction
command -nargs=? ST :call SetTab(<f-args>)
call SetTab(0)
set swapfile
set dir=~/.config/nvim/swap/
if has("persistent_undo")
set undodir=~/.config/nvim/undo/
set undofile
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment