diff options
Diffstat (limited to 'nvim')
-rw-r--r-- | nvim/.config/nvim/init.vim | 137 |
1 files changed, 20 insertions, 117 deletions
diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index d071c83..26e74cf 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim | |||
@@ -5,7 +5,6 @@ Plug 'Shougo/deoplete-clangx' | |||
5 | Plug 'deoplete-plugins/deoplete-jedi' | 5 | Plug 'deoplete-plugins/deoplete-jedi' |
6 | Plug 'Shougo/deol.nvim' | 6 | Plug 'Shougo/deol.nvim' |
7 | Plug 'ap/vim-css-color' | 7 | Plug 'ap/vim-css-color' |
8 | Plug 'luochen1990/rainbow' | ||
9 | Plug 'tpope/vim-eunuch' | 8 | Plug 'tpope/vim-eunuch' |
10 | Plug 'tpope/vim-commentary' | 9 | Plug 'tpope/vim-commentary' |
11 | Plug 'scrooloose/nerdtree' | 10 | Plug 'scrooloose/nerdtree' |
@@ -20,7 +19,7 @@ call plug#end() | |||
20 | set guicursor= | 19 | set guicursor= |
21 | set number relativenumber | 20 | set number relativenumber |
22 | set mouse=a | 21 | set mouse=a |
23 | set background=dark | 22 | set background=light |
24 | syntax enable | 23 | syntax enable |
25 | set cursorline | 24 | set cursorline |
26 | set ignorecase | 25 | set ignorecase |
@@ -35,7 +34,7 @@ set shiftwidth=4 " number of spaces to use for autoindent | |||
35 | set expandtab " tabs are space | 34 | set expandtab " tabs are space |
36 | set autoindent | 35 | set autoindent |
37 | set copyindent " copy indent from the previous line | 36 | set copyindent " copy indent from the previous line |
38 | colorscheme bloodbath | 37 | colorscheme pencil |
39 | "hi Normal ctermbg=16 guibg=#000000 | 38 | "hi Normal ctermbg=16 guibg=#000000 |
40 | "hi LineNr ctermbg=16 guibg=#000000 | 39 | "hi LineNr ctermbg=16 guibg=#000000 |
41 | 40 | ||
@@ -56,9 +55,6 @@ let g:gitgutter_sign_removed = '-' | |||
56 | let g:gitgutter_sign_removed_first_line = '^' | 55 | let g:gitgutter_sign_removed_first_line = '^' |
57 | let g:gitgutter_sign_modified_removed = '#' | 56 | let g:gitgutter_sign_modified_removed = '#' |
58 | 57 | ||
59 | " rainbow | ||
60 | let g:rainbow_active = 1 | ||
61 | |||
62 | " vim-markdown | 58 | " vim-markdown |
63 | let g:vim_markdown_no_default_key_mappings=1 | 59 | let g:vim_markdown_no_default_key_mappings=1 |
64 | let g:vim_markdown_toml_frontmatter=1 | 60 | let g:vim_markdown_toml_frontmatter=1 |
@@ -92,6 +88,12 @@ hi Comment cterm=italic | |||
92 | scriptencoding utf-8 | 88 | scriptencoding utf-8 |
93 | 89 | ||
94 | " statusline | 90 | " statusline |
91 | hi PrimaryBlock ctermbg=NONE ctermfg=8 | ||
92 | hi ModeBlock ctermbg=NONE ctermfg=2 | ||
93 | hi SecondaryBlock ctermbg=NONE ctermfg=8 | ||
94 | hi TeritaryBlock ctermbg=NONE ctermfg=9 | ||
95 | hi Blanks ctermbg=NONE | ||
96 | hi statusline ctermbg=NONE | ||
95 | let g:currentmode={ | 97 | let g:currentmode={ |
96 | \ 'n' : 'NORMAL ', | 98 | \ 'n' : 'NORMAL ', |
97 | \ 'no' : 'N·OPERATOR PENDING ', | 99 | \ 'no' : 'N·OPERATOR PENDING ', |
@@ -112,114 +114,15 @@ let g:currentmode={ | |||
112 | \ 'r?' : 'CONFIRM ', | 114 | \ 'r?' : 'CONFIRM ', |
113 | \ '!' : 'SHELL ', | 115 | \ '!' : 'SHELL ', |
114 | \ 't' : 'TERMINAL '} | 116 | \ 't' : 'TERMINAL '} |
115 | 117 | set statusline= | |
116 | hi PrimaryBlock ctermfg=00 ctermbg=6 | 118 | set statusline+=%#ModeBlock# |
117 | hi SecondaryBlock ctermfg=07 ctermbg=10 | 119 | set statusline+=\ %{g:currentmode[mode()]} |
118 | hi Blanks ctermfg=00 ctermbg=11 | 120 | set statusline+=%#TeritaryBlock# |
119 | 121 | set statusline+=\ %f\ | |
120 | hi User1 ctermfg=01 ctermbg=0 | 122 | set statusline+=%M\ |
121 | hi User2 ctermfg=02 ctermbg=0 | 123 | set statusline+=%#Blanks# |
122 | hi User3 ctermfg=03 ctermbg=0 | 124 | set statusline+=%= |
123 | hi User4 ctermfg=04 ctermbg=0 | 125 | set statusline+=%#PrimaryBlock# |
124 | hi User5 ctermfg=05 ctermbg=0 | 126 | set statusline+=\ %Y\ |
125 | hi User6 ctermfg=06 ctermbg=0 | 127 | set statusline+=%#SecondaryBlock# |
126 | hi User7 ctermfg=07 ctermbg=0 | 128 | set statusline+=\ %P\ |
127 | hi User8 ctermfg=08 ctermbg=0 | ||
128 | hi User9 ctermfg=09 ctermbg=0 | ||
129 | |||
130 | highlight EndOfBuffer ctermfg=black ctermbg=black | ||
131 | |||
132 | function! GitBranch() | ||
133 | return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'") | ||
134 | endfunction | ||
135 | |||
136 | function! StatuslineGit() | ||
137 | let l:branchname = GitBranch() | ||
138 | return strlen(l:branchname) > 0?'* '.l:branchname.' ':'' | ||
139 | endfunction | ||
140 | |||
141 | function! ReadOnly() abort | ||
142 | if !&modifiable && &readonly | ||
143 | return ' RO' | ||
144 | elseif &modifiable && &readonly | ||
145 | return 'RO' | ||
146 | elseif !&modifiable && !&readonly | ||
147 | return '' | ||
148 | else | ||
149 | return '' | ||
150 | endif | ||
151 | endfunction | ||
152 | |||
153 | function! Filepath() abort | ||
154 | let l:basename = expand('%:h') | ||
155 | let l:filename = expand('%:t') | ||
156 | let l:extension = expand('%:e') | ||
157 | let l:prefix = (l:basename ==# '' || l:basename ==# '.') ? | ||
158 | \ '' : substitute(l:basename . '/', '\C^' . $HOME, '~', '') | ||
159 | |||
160 | if empty(l:prefix) && empty(l:filename) | ||
161 | return printf('%%8*%%f%%*%s %%m%%*', '%8*') | ||
162 | elseif empty(l:prefix) | ||
163 | return printf('%%8*%%f%%*%s %%m%%*', '%6*') | ||
164 | else | ||
165 | return printf('%%8*%s%%*%s%s%%*', l:prefix, &modified ? '%6*' : '%8*', l:filename) | ||
166 | endif | ||
167 | endfunction | ||
168 | |||
169 | function! LinterStatus() abort | ||
170 | let info = get(b:, 'coc_diagnostic_info', {}) | ||
171 | if empty(info) | return '' | endif | ||
172 | let msgs = [] | ||
173 | if get(info, 'error', 0) | ||
174 | call add(msgs, printf('%%5*%s×%%*', info['error'])) | ||
175 | endif | ||
176 | if get(info, 'warning', 0) | ||
177 | call add(msgs, printf('%%3*%s!%%*', info['warning'])) | ||
178 | endif | ||
179 | return join(msgs, ' ') | ||
180 | endfunction | ||
181 | |||
182 | function! StatusLine(mode) abort | ||
183 | let l:line='' | ||
184 | |||
185 | " help or man pages | ||
186 | if &filetype ==# 'help' || &filetype ==# 'man' | ||
187 | let l:line.=' %#StatusLineNC# ['. &filetype .'] %f ' | ||
188 | return l:line | ||
189 | endif | ||
190 | |||
191 | " active | ||
192 | if a:mode ==# 'active' | ||
193 | let l:line.='%7*%{StatuslineGit()}' | ||
194 | let l:line.='%<' | ||
195 | let l:line.=Filepath() | ||
196 | |||
197 | let l:line.='%5*' | ||
198 | let l:line.=' %{ReadOnly()} %w%*' | ||
199 | let l:line.='%9* %=%*' | ||
200 | |||
201 | let l:line.='%7* %l,%c %*' | ||
202 | let l:line.='%8* %{g:currentmode[mode()]}%*' | ||
203 | let l:line.=' ' | ||
204 | let l:line.=LinterStatus() | ||
205 | let l:line.=' ' | ||
206 | let l:line.='%8*'. &filetype | ||
207 | |||
208 | else | ||
209 | " inactive | ||
210 | let l:line.='%#Blanks#' | ||
211 | let l:line.='%f %5*%m%*' | ||
212 | let l:line.='%#Blanks# %=%*' | ||
213 | endif | ||
214 | |||
215 | let l:line.='%*' | ||
216 | |||
217 | return l:line | ||
218 | endfunction | ||
219 | |||
220 | set statusline=%!StatusLine('active') | ||
221 | augroup MyStatusLine | ||
222 | autocmd! | ||
223 | autocmd WinEnter * setl statusline=%!StatusLine('active') | ||
224 | autocmd WinLeave * setl statusline=%!StatusLine('inactive') | ||
225 | augroup END | ||