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
|
"""
" Plugins
"
call plug#begin(expand('$XDG_CONFIG_HOME/nvim/plugs'))
Plug 'ctrlpvim/ctrlp.vim' " Fuzzy file/buffer/mru/tag/etc. finder
Plug 'mattn/emmet-vim' " Emmet-like snippet system
Plug 'tommcdo/vim-exchange' " Easy text exchange operator
Plug 'tpope/vim-git' " Vim runtime files
Plug 'tpope/vim-fugitive' " Git wrapper
" Asynchronous :make using Neovim's job-control
" Upstream: Plug 'benekastah/neomake'
Plug 'kyrias/neomake', { 'branch': 'clang-check' }
call plug#end()
"""
" Set options
"
syntax on
filetype plugin indent on
set hidden " Automatically hide buffers instead of requiring bangcommands
set number " always show line numbers
set ignorecase " Ignore case of normal letters
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set undolevels=1000
set wildignore=*.swp,*.bak,*.pyc,*.o
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
set backup " use backup files
set undofile " save undo's after file closes
set shortmess+=I " don't show the nag-screen
set showcmd " Show partial command in the last line of the screen
set scrolloff=1 " Minimum number of screen lines under/above the cursor
set linebreak " Don’t wrap lines in the middle of a word
set spelllang=en_us
set backupdir=$XDG_DATA_HOME/nvim/backup " Don't write backups in current dir
set tabstop=4
set shiftwidth=4
set softtabstop=4
set noexpandtab
set copyindent
" Show tabs and end-of-line whitespace
set listchars=tab:»·,trail:·
set list
" List of vim syntaxes to highlight in rST code blocks
let g:rst_syntax_code_list = ['vim', 'c', 'cpp', 'python', 'sh']
"""
" Mappings
"
" Toggle spell checking
nmap <silent> <Leader>s :set spell!<CR>
nmap <silent> <Leader>/ :nohlsearch<CR>
cmap w!! w !sudo tee % >/dev/null
" Easier window moving
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
vmap <C-j> gj
vmap <C-k> gk
nmap <C-j> gj
nmap <C-k> gk
"""
" CtrlP
"
let g:ctrlp_extensions = ['tag', 'buffertag', 'dir', 'undo', 'line',
\ 'changes', 'mixed', 'bookmarkdir']
nmap <silent> <Leader>pf :CtrlP<CR>
nmap <silent> <Leader>pb :CtrlPBuffer<CR>
nmap <silent> <Leader>pm :CtrlPMRU<CR>
nmap <silent> <Leader>px :CtrlPMixed<CR>
"""
" Statusline
"
set statusline=
set statusline+=[%n] " Buffer number
set statusline+=%<\ " Where to truncate
set statusline+=%.99f " Relative path to file
set statusline+=\ %y " Filetype flag, [c]; [help]
set statusline+=%w " Preview window flag, [Preview]
set statusline+=%m " Modified flag, [+]; [-]
" Show a warning if file is read only, [RO]
set statusline+=%#identifier#
set statusline+=%r
set statusline+=%*
if exists('g:loaded_fugitive')
set statusline+=%{fugitive#statusline()}
endif
" Show a warning if file format isn’t unix
set statusline+=%#warningmsg#
set statusline+=%{&ff!='unix'?'['.&ff.']':''}
set statusline+=%*
" Show a warning if file encoding isn’t utf-8
set statusline+=%#warningmsg#
set statusline+=%{(&fenc!='utf-8'&&&fenc!='')?'['.&fenc.']':''}
set statusline+=%*
"" Right side of statusline
set statusline+=%= " Left/right separation point
set statusline+=%-15.((%l,%c-%v)\ %) " Line, column, percentage. (20,0)
set statusline+=%P " Percentage visible
set laststatus=2 " Always show statusline
"""
" Syntax highlighting
"
" Colorscheme
colorscheme Darkcustomside
" Color spaces at end of lines bright red for visibility
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
"""
" Indentation
"
augroup indentation
autocmd!
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 noet
augroup END
"""
" Neomake
"
" Open the location list when adding entries
let g:neomake_open_list = 2
" Run Neomake automatically when saving and entering a file
autocmd! BufWritePost * Neomake
|