-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
266 lines (221 loc) · 6.61 KB
/
vimrc
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
call plug#begin('~/.local/share/nvim/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'mbbill/undotree'
Plug 'dylanaraps/wal.vim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
Plug 'itchyny/lightline.vim'
Plug 'tpope/vim-commentary'
Plug 'jiangmiao/auto-pairs'
Plug 'sheerun/vim-polyglot'
Plug 'rakr/vim-one'
Plug 'jceb/vim-orgmode'
Plug 'easymotion/vim-easymotion'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'mrtazz/simplenote.vim'
Plug 'godlygeek/tabular'
Plug 'chriskempson/base16-vim'
Plug 'gabrielelana/vim-markdown'
Plug 'kblin/vim-fountain'
Plug 'mattn/emmet-vim'
Plug 'rstacruz/vim-closer'
Plug 'neomake/neomake'
Plug 'junegunn/limelight.vim'
Plug 'junegunn/goyo.vim'
call plug#end()
" Gui Settings
" Render HTML arguments such as class, id, data ... as italic
highlight htmlArg gui=italic
highlight htmlArg cterm=italic
" Render comments in italic
highlight Comment gui=italic
highlight Comment cterm=italic
" Colors
" let $NVIM_TUI_ENABLE_TRUE_COLOR=1
let base16colorspace=256 " Access colors present in 256 colorspace
set termguicolors
set background=dark " for the dark version
" Color Scheme
" let g:one_allow_italics = 1 " I love italic for comments<Paste>
colorscheme base16-tomorrow-night
" colorscheme base16-default-dark
" colorscheme one
" set showtabline=2 " Show tabline
" set guioptions-=e " Don't use GUI tabline
" Fundamental settings
set scrolloff=5
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,gbk,cp936,latin-1
set fileformat=unix
set fileformats=unix,dos,mac
filetype on
filetype plugin on
filetype plugin indent on
syntax on
set foldcolumn=2
set clipboard+=unnamedplus
set smartindent
set expandtab "tab to spaces
set tabstop=8 "the width of a tab
set shiftwidth=8 "the width for indent
set foldenable
set foldmethod=indent "folding by indent
set foldlevel=80
set ignorecase "ignore the case when search texts
set smartcase "if searching text contains uppercase case will not be ignored
set linebreak
set number "line number
set cursorline "hilne
"night the line of the cursor
set autochdir
au FileType python setl sw=2 sts=2 et
au FileType html setl sw=2 sts=2 et
au BufNewFile,BufReadPost *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=markdown
au FileType markdown setlocal textwidth=0
au FileType markdown setlocal showbreak=↳\
au FileType markdown setlocal linebreak
au FileType markdown setlocal nolist
au FileType markdown setlocal spell
au BufNewFile,BufReadPost,BufWrite *.{md,mdown,mkd,mkdn,markdown,mdwn} syntax match Comment /\%^---\_.\{-}---$/
let g:table_mode_corner="|"
" Set header folding level
let g:vim_markdown_folding_level = 1
" Set the number of spaces of indent
let g:vim_markdown_new_list_item_indent = 2
" Enable TOC window auto-fit
let g:vim_markdown_toc_autofit = 1
" Do not conceal [link text](link url) as just link text
let g:vim_markdown_conceal = 0
" Highlight YAML front matter as used by Jekyll or Hugo.
let g:vim_markdown_frontmatter = 1
let g:vim_markdown_fenced_languages = ['csharp=cs', 'ruby=rb', 'vim=vim', 'bash=sh']
" <Leader>f{char} to move to {char}
map <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)
" s{char}{char} to move to {char}{char}
nmap <Leader>F <Plug>(easymotion-overwin-f2)
" Move to line
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)
" Move to word
map <Leader>w <Plug>(easymotion-bd-w)
nmap <Leader>w <Plug>(easymotion-overwin-w)
" NERDTree
map <C-n> :NERDTreeToggle<CR>
" Package Settings
let g:lightline = {
\ 'colorscheme': 'Tomorrow_Night',
\ 'active': {
\ 'left':[ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ]
\ ]
\ },
\ 'component': {
\ 'lineinfo': ' %3l:%-2v',
\ },
\ 'component_function': {
\ 'gitbranch': 'fugitive#head',
\ }
\ }
let g:lightline.separator = {
\ 'left': '', 'right': ''
\}
let g:lightline.subseparator = {
\ 'left': '', 'right': ''
\}
let g:lightline.tabline = {
\ 'left': [ ['tabs'] ],
\ 'right': [ ['close'] ]
\ }
" set showtabline=2 " Show tabline
" set guioptions-=e " Don't use GUI tabline
" FZF
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
function! s:build_quickfix_list(lines)
call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
copen
cc
endfunction
let g:fzf_action = {
\ 'ctrl-q': function('s:build_quickfix_list'),
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
let g:fzf_layout = { 'down': '~30%' }
let g:fzf_colors =
\ { 'fg': ['fg', 'Normal'],
\ 'bg': ['bg', 'Normal'],
\ 'hl': ['fg', 'Comment'],
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
\ 'hl+': ['fg', 'Statement'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Ignore'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
let g:fzf_history_dir = '~/.local/share/fzf-history'
" Automake
call neomake#configure#automake('w')
let g:fzf_action = {
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\ }
nnoremap <c-p> :FZF<cr>
let g:goyo_width = 80
function! s:goyo_enter()
silent !tmux set status off
silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z
set noshowmode
set noshowcmd
set scrolloff=999
Limelight
set statusline=%f\ %m
hi statusline ctermfg=white
endfunction
function! s:goyo_leave()
silent !tmux set status on
silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
set showmode
set showcmd
set scrolloff=5
set background=dark
Limelight!
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
" Use deoplete.
let g:deoplete#enable_at_startup = 1
" Auto-save files
function s:MkNonExDir(file, buf)
if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
let dir=fnamemodify(a:file, ':h')
if !isdirectory(dir)
call mkdir(dir, 'p')
endif
endif
endfunction
augroup BWCCreateDir
autocmd!
autocmd BufWritePre * :call s:MkNonExDir(expand('<afile>'), +expand('<abuf>'))
augroup END
" source ~/.simplenoterc
set t_Co=256
"set t_8b=^[[48;2;%lu;%lu;%lum
"set t_8f=^[[38;2;%lu;%lu;%lum
" Mappings
map j gj
map k gk
nnoremap ; :
vnoremap ; :
map ; :
nmap <c-s> :w<CR>
imap <c-s> <Esc>:w<CR>a
noremap! <C-BS> <C-w>
noremap! <C-h> <C-w>
imap <C-BS> <C-W>