summaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/colors/jellybeans.vim2
-rw-r--r--nvim/.config/nvim/init.vim151
2 files changed, 139 insertions, 14 deletions
diff --git a/nvim/.config/nvim/colors/jellybeans.vim b/nvim/.config/nvim/colors/jellybeans.vim
index bb57c28..73a0d98 100644
--- a/nvim/.config/nvim/colors/jellybeans.vim
+++ b/nvim/.config/nvim/colors/jellybeans.vim
@@ -88,7 +88,7 @@ endif
88" - g:jellybeans_use_gui_italics (default = 1) 88" - g:jellybeans_use_gui_italics (default = 1)
89" - g:jellybeans_use_term_italics (default = 0) 89" - g:jellybeans_use_term_italics (default = 0)
90 90
91let s:background_color = "070707" 91let s:background_color = "000000"
92 92
93if exists("g:jellybeans_overrides") 93if exists("g:jellybeans_overrides")
94 let s:overrides = g:jellybeans_overrides 94 let s:overrides = g:jellybeans_overrides
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim
index c61ef87..ecb1c98 100644
--- a/nvim/.config/nvim/init.vim
+++ b/nvim/.config/nvim/init.vim
@@ -35,7 +35,7 @@ set shiftwidth=4 " number of spaces to use for autoindent
35set expandtab " tabs are space 35set expandtab " tabs are space
36set autoindent 36set autoindent
37set copyindent " copy indent from the previous line 37set copyindent " copy indent from the previous line
38colorscheme jellybeans 38colorscheme bloodbath
39"hi Normal ctermbg=16 guibg=#000000 39"hi Normal ctermbg=16 guibg=#000000
40"hi LineNr ctermbg=16 guibg=#000000 40"hi LineNr ctermbg=16 guibg=#000000
41 41
@@ -112,15 +112,140 @@ map <C-l> <C-w>l
112nnoremap S :%s//gI<Left><Left><Left> 112nnoremap S :%s//gI<Left><Left><Left>
113 113
114"statusbar 114"statusbar
115hi Comment cterm=italic 115scriptencoding utf-8
116hi CursorLine guibg=#2b2b2b 116
117set statusline= 117" statusline
118set statusline +=%1*\ %n\ %* "buffer number 118
119set statusline +=%5*%{&ff}%* "file format 119let g:currentmode={
120set statusline +=%3*%y%* "file type 120 \ 'n' : 'NORMAL ',
121set statusline +=%4*\ %<%F%* "full path 121 \ 'no' : 'N·OPERATOR PENDING ',
122set statusline +=%2*%m%* "modified flag 122 \ 'v' : 'VISUAL ',
123set statusline +=%1*%=%5l%* "current line 123 \ 'V' : 'V·LINE ',
124set statusline +=%2*/%L%* "total lines 124 \ '' : 'V·BLOCK ',
125set statusline +=%1*%4v\ %* "virtual column number 125 \ 's' : 'SELECT ',
126set statusline +=%2*0x%04B\ %* "character under cursor 126 \ 'S' : 'S·LINE ',
127 \ '' : 'S·BLOCK ',
128 \ 'i' : 'INSERT ',
129 \ 'R' : 'REPLACE ',
130 \ 'Rv' : 'V·REPLACE ',
131 \ 'c' : 'COMMAND ',
132 \ 'cv' : 'VIM EX ',
133 \ 'ce' : 'EX ',
134 \ 'r' : 'PROMPT ',
135 \ 'rm' : 'MORE ',
136 \ 'r?' : 'CONFIRM ',
137 \ '!' : 'SHELL ',
138 \ 't' : 'TERMINAL '}
139
140hi PrimaryBlock ctermfg=00 ctermbg=6
141hi SecondaryBlock ctermfg=07 ctermbg=10
142hi Blanks ctermfg=00 ctermbg=11
143
144hi User1 ctermfg=01 ctermbg=0
145hi User2 ctermfg=02 ctermbg=0
146hi User3 ctermfg=03 ctermbg=0
147hi User4 ctermfg=04 ctermbg=0
148hi User5 ctermfg=05 ctermbg=0
149hi User6 ctermfg=06 ctermbg=0
150hi User7 ctermfg=07 ctermbg=0
151hi User8 ctermfg=08 ctermbg=0
152hi User9 ctermfg=09 ctermbg=0
153
154highlight EndOfBuffer ctermfg=black ctermbg=black
155
156function! GitBranch()
157 return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
158endfunction
159
160function! StatuslineGit()
161 let l:branchname = GitBranch()
162 return strlen(l:branchname) > 0?'* '.l:branchname.' ':''
163endfunction
164
165function! ReadOnly() abort
166 if !&modifiable && &readonly
167 return ' RO'
168 elseif &modifiable && &readonly
169 return 'RO'
170 elseif !&modifiable && !&readonly
171 return ''
172 else
173 return ''
174 endif
175endfunction
176
177function! Filepath() abort
178 let l:basename = expand('%:h')
179 let l:filename = expand('%:t')
180 let l:extension = expand('%:e')
181 let l:prefix = (l:basename ==# '' || l:basename ==# '.') ?
182 \ '' : substitute(l:basename . '/', '\C^' . $HOME, '~', '')
183
184 if empty(l:prefix) && empty(l:filename)
185 return printf('%%8*%%f%%*%s %%m%%*', '%8*')
186 elseif empty(l:prefix)
187 return printf('%%8*%%f%%*%s %%m%%*', '%6*')
188 else
189 return printf('%%8*%s%%*%s%s%%*', l:prefix, &modified ? '%6*' : '%8*', l:filename)
190 endif
191endfunction
192
193function! LinterStatus() abort
194 let info = get(b:, 'coc_diagnostic_info', {})
195 if empty(info) | return '' | endif
196 let msgs = []
197 if get(info, 'error', 0)
198 call add(msgs, printf('%%5*%s×%%*', info['error']))
199 endif
200 if get(info, 'warning', 0)
201 call add(msgs, printf('%%3*%s!%%*', info['warning']))
202 endif
203 return join(msgs, ' ')
204endfunction
205
206function! StatusLine(mode) abort
207 let l:line=''
208
209 " help or man pages
210 if &filetype ==# 'help' || &filetype ==# 'man'
211 let l:line.=' %#StatusLineNC# ['. &filetype .'] %f '
212 return l:line
213 endif
214
215 " active
216 if a:mode ==# 'active'
217 let l:line.='%7*%{StatuslineGit()}'
218 let l:line.='%<'
219 let l:line.=Filepath()
220
221 let l:line.='%5*'
222 let l:line.=' %{ReadOnly()} %w%*'
223 let l:line.='%9* %=%*'
224
225 let l:line.='%7* %l,%c %*'
226 let l:line.='%8* %{g:currentmode[mode()]}%*'
227 let l:line.=' '
228 let l:line.=LinterStatus()
229 let l:line.=' '
230 let l:line.='%8*'. &filetype
231
232 else
233 " inactive
234 let l:line.='%#Blanks#'
235 let l:line.='%f %5*%m%*'
236 let l:line.='%#Blanks# %=%*'
237 endif
238
239 let l:line.='%*'
240
241 return l:line
242endfunction
243
244set statusline=%!StatusLine('active')
245augroup MyStatusLine
246 autocmd!
247 autocmd WinEnter * setl statusline=%!StatusLine('active')
248 autocmd WinLeave * setl statusline=%!StatusLine('inactive')
249augroup END
250
251