-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
192 lines (151 loc) · 4.7 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
"*****************************************************************************
"" Basic Settings
"*****************************************************************************
"" Best practice
if has('vim_starting')
set nocompatible
endif
"" Input behavior
set backspace=indent,eol,start
set tabstop=4
set softtabstop=4
set shiftwidth=4
set mousemodel=popup
"" Copy/Paste
set clipboard=unnamedplus
"" Visual
set ruler
set number
set showcmd
set gfn=Monospace\ 10
colorscheme monokai
if (exists('+colorcolumn'))
set colorcolumn=80
highlight ColorColumn ctermbg=236 guibg=236
endif
"" Search
set incsearch
set hlsearch
set ignorecase
set smartcase
"" Syntax Highlighting
syntax on
filetype on
au BufNewFile,BufRead *.vue set filetype=html
"" Backups
set backupdir=~/.config/nvim/backup,.
set directory=~/.config/nvim/backup,.
"" Recommended, but I want to verify I won't ever use comma first
"let mapleader=','
"" Recommended, but I don't understand it
"set hidden
"" Retain undo history between instances
set undofile
if exists('$SHELL')
set shell=$SHELL
else
set shell=/bin/sh
endif
"*****************************************************************************
"" Plug Packages
"*****************************************************************************
call plug#begin(expand('~/.config/nvim/plugged'))
"Plug 'tpope/vim-fugitive'
Plug 'scrooloose/nerdtree'
Plug 'scrooloose/syntastic'
Plug 'bronson/vim-trailing-whitespace'
Plug 'pangloss/vim-javascript'
"Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
Plug 'neomake/neomake'
call plug#end()
"*****************************************************************************
"" Encoding
"*****************************************************************************
if has("multi_byte")
if &termencoding == ""
let &termencoding = &encoding
endif
set encoding=utf-8
setglobal fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,latin1
endif
set fileformats=unix,dos,mac
"*****************************************************************************
"" Session Management
"*****************************************************************************
let g:session_directory = "~/.config/nvim/session"
let g:session_autoload = "no"
let g:session_autosave = "no"
let g:session_command_aliases = 1
"*****************************************************************************
"" Abbreviations
"*****************************************************************************
"" no one is really happy until you have this shortcuts
cnoreabbrev W! w!
cnoreabbrev Q! q!
cnoreabbrev Qall! qall!
cnoreabbrev Wq wq
cnoreabbrev Wa wa
cnoreabbrev wQ wq
cnoreabbrev WQ wq
cnoreabbrev W w
cnoreabbrev Q q
cnoreabbrev Qall qall
cnoreabbrev qw wq
cnoreabbrev Qw wq
cnoreabbrev qW wq
cnoreabbrev QW wq
"" Search mappings: These will make it so that going to the next one in a
"" search will center on the line it's found in.
nnoremap n nzzzv
nnoremap N Nzzzv
"" Fix a long-standing aggrevation with my Latitude E5570 keyboard
nnoremap <PageUp> <nop>
inoremap <PageUp> <nop>
nnoremap <PageDown> <nop>
inoremap <PageDown> <nop>
"*****************************************************************************
"" Autocmd Rules
"*****************************************************************************
"" The PC is fast enough,
"" do syntax highlight syncing from start unless 200 lines
augroup vimrc-sync-fromstart
autocmd!
autocmd BufEnter * :syntax sync maxlines=200
augroup END
"" Remember cursor position
augroup vimrc-remember-cursor-position
autocmd!
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
augroup END
"" make/cmake
augroup vimrc-make-cmake
autocmd!
autocmd FileType make setlocal noexpandtab
autocmd BufNewFile,BufRead CMakeLists.txt setlocal filetype=cmake
augroup END
set autoread
"*****************************************************************************
"" 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
"Checkers
let g:syntastic_javascript_checkers=['eslint']
let g:syntastic_python_checkers=['flake8', 'pylint']
let g:syntastic_cpp_checkers=['gcc']
let g:syntastic_mode_map={
\ "mode": "passive",
\ "active_filetypes": [],
\ "passive_filetypes": [] }
"*****************************************************************************
"" Neomake
"*****************************************************************************
autocmd! BufReadPost,BufWritePost * Neomake
let g:neomake_serialize=1
let g:neomake_serialize_abort_on_error=1