config/nvim/init.vim

165 lines
3.1 KiB
VimL
Raw Normal View History

2020-05-14 20:03:55 +02:00
" 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'
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
" 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
2020-07-14 11:50:05 +02:00
autocmd BufRead,BufNewFile *.yml set tabstop=2 shiftwidth=2 expandtab
autocmd BufRead,BufNewFile *.yaml set tabstop=2 shiftwidth=2 expandtab
2022-02-28 18:55:43 +01:00
autocmd BufRead,BufNewFile *.ts set tabstop=2 shiftwidth=2 expandtab
autocmd BufRead,BufNewFile *.vue set tabstop=2 shiftwidth=2 expandtab
2020-05-14 20:03:55 +02:00
" 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
2020-09-01 17:36:45 +02:00
let g:go_fmt_command = "gofumports"
2020-05-14 20:03:55 +02:00
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>