-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
130 lines (102 loc) · 2.72 KB
/
init.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
" init.vim
" Personal neovim configuration file
" Author: Kamil Vojanec <xvojan00@stud.fit.vutbr.cz>
" Firstly, tell neovim not to behave like Vi
set nocompatible
" Set 256 colour mode for neovim
set t_Co=256
set t_ut=
" Use 4 spaces by default
set tabstop=4 softtabstop=4
set expandtab
set smartindent
" Do not wrap lines when they are too long
set nowrap
" Make backspace work like most other programs
set backspace=2
" Automatically reload files changed outside neovim
set autoread
" Allow mouse selection
set ttyfast
set mouse=a
" Case insensitive search
set ignorecase
" Open new splits to the right or bottom
set splitright
" Show line numbers
set number
" C-s to save in any mode
nnoremap <C-s> :w<cr>
inoremap <C-s> <Esc>:w <cr>
vnoremap <C-s> <Esc>:w <cr>
" Use space as leader key
let mapleader=" "
" Netrw parameters
let g:netrw_browse_split=4
let g:netrw_banner=0
let g:netwr_altv=1
let g:netrw_winsize=25
let g:netrw_liststyle=3
" Leader key mappings
nnoremap <leader>h :wincmd h<CR>
nnoremap <leader>j :wincmd j<CR>
nnoremap <leader>k :wincmd k<CR>
nnoremap <leader>l :wincmd l<CR>
nnoremap <leader>u :UndotreeShow<CR>
nnoremap <leader>pv :Vex <bar> :vertical resize 30<CR>
nnoremap <silent> <Leader>+ :vertical resize +5<CR>
nnoremap <silent> <Leader>- :vertical resize -5<CR>
" Set shorter update time
set updatetime=300
" We do not need swp files everywhere
set noswapfile
set nobackup
" Enable syntax highlight
syntax on
filetype plugin indent on
call plug#begin(stdpath('data').'/plugged')
Plug 'morhetz/gruvbox'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'dense-analysis/ale'
Plug 'vim-scripts/DoxygenToolkit.vim'
Plug 'lyuts/vim-rtags'
Plug 'ycm-core/YouCompleteMe'
Plug 'mbbill/undotree'
call plug#end()
" Youcompleteme settings
nnoremap <silent> <Leader>gd :YcmCompleter GoTo<CR>
nnoremap <silent> <Leader>gf :YcmCompleter FixIt<CR>
" Use powerline for airline
let g:airline_powerline_fonts=1
" Use Dark+ colorscheme from vscode
colorscheme gruvbox
set background=dark
let g:airline_theme = 'gruvbox'
" C/C++ additional syntax highlighting
let g:cpp_class_scope_highlight=1
let g:cpp_member_variable_highlight=1
let g:cpp_class_decl_highlight=1
let g:cpp_posix_standard=1
" Use ALE in statusline
let g:airline#extensions#ale#enabled=1
" Trims trailing whitespace
function TrimWhiteSpace()
%s/\s*$//
''
endfunction
" Trim whitespace on buffer save
autocmd BufWritePre * call TrimWhiteSpace()
" Disable Arrow keys in Normal mode
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" Disable Arrow keys in Insert mode
imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>