config/nvim/init.vim

169 lines
3.2 KiB
VimL

" Set the encoding to UTF-8
scriptencoding utf-8
set encoding=utf8
set shada="NONE"
" Run :PlugInstall to install plugins
" Plugins
call plug#begin()
" UI
Plug 'ctrlpvim/ctrlp.vim'
"Plug 'Shougo/echodoc.vim'
" Formatting helpers
Plug 'tpope/vim-commentary'
" Language specific
Plug 'fatih/vim-go'
Plug 'exu/pgsql.vim'
" Git helpers
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
call plug#end()
" Set the vertical split character
set fillchars+=vert:\|
set inccommand=split
" Prevent useless redraws
set lazyredraw
" Set colors
set termguicolors
set t_Co=256
colorscheme Tomorrow-Night
let g:gitgutter_sign_added = '+ '
let g:gitgutter_sign_modified = '~ '
let g:gitgutter_sign_modified_removed = '__'
let g:gitgutter_sign_removed = '_ '
" Syntax
syntax on
set showmatch
" Set backspace to work everywhere
set backspace=start,eol,indent
set laststatus=1
" Show indents and trailing whitespace
set list listchars=trail,tab:»\ ,eol
" Set indent settings
set tabstop=4 shiftwidth=4 noexpandtab
autocmd BufRead,BufNewFile *.py set tabstop=4 shiftwidth=4 noexpandtab
autocmd BufRead,BufNewFile *.yml set tabstop=2 shiftwidth=2 expandtab
autocmd BufRead,BufNewFile *.yaml set tabstop=2 shiftwidth=2 expandtab
" Disable auto newlines
set wrap
set textwidth=0
set wrapmargin=0
set formatoptions=l
" GUI options
set mouse=a
set clipboard=unnamedplus
" Line numbers
set number
set numberwidth=6
highlight LineNr ctermfg=darkgrey
set relativenumber
set ruler
set showtabline=1
set completeopt=menuone,noinsert
" Configure CtrlP
let g:ctrlp_working_path_mode = 'r'
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
let g:netrw_dirhistmax=0
let g:netrw_liststyle=3
set shortmess+=c
let g:cm_auto_popup = 0
let g:cm_sources_override = {
\ 'cm-tags': {'enable':0}
\ }
" echodoc
"let g:echodoc_enable_at_startup = 1
"set noshowmode
au FileType go nmap <F11> :GoAlternate<CR>
" Go
let g:go_fmt_command = "goimports"
let g:go_fmt_fail_silently = 1
" let g:go_gocode_unimported_packages = 0
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_types = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1
let g:go_metalinter_autosave = 0
" let g:go_metalinter_autosave_enabled = ['golint', 'ineffassign']
let g:go_template_autocreate = 0
" let g:go_auto_type_info=1
" let g:go_updatetime = 250
au BufNewFile,BufRead *.gohtml setf gohtmltmpl
au BufNewFile,BufRead *.tmpl setf gohtmltmpl
" Rust
let g:rustfmt_autosave = 0
let g:racer_experimental_completer = 1
autocmd BufRead,BufNewFile *.rs set tabstop=4 shiftwidth=4 expandtab
au FileType rust nmap gd <Plug>(rust-def)
au FileType rust nmap K <Plug>(rust-doc)
" Set keybindings
nnoremap <Tab> <C-w><C-w>
nnoremap <C-\>> <C-w><\>>
nnoremap <C-\<> <C-w><\<>
nnoremap <silent> <Home> ^
vnoremap <silent> <Home> ^
inoremap <silent> <Home> <C-o>^
map <silent> <F5> :nohl<CR>
inoremap <C-Space> <C-x><C-o>
nnoremap d "_d
vnoremap d "_d
nnoremap D "_D
map q: <nop>
map Q <nop>