-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_vimrc
More file actions
227 lines (185 loc) · 6.71 KB
/
Copy pathdot_vimrc
File metadata and controls
227 lines (185 loc) · 6.71 KB
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim Plug
""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Correct filetype/highlighting for chezmoi source files (dot_*, *.tmpl).
" use_tmp_buffer removes the load-order requirement; chezmoi.vim must not
" be lazy-loaded, so it's listed first below.
let g:chezmoi#use_tmp_buffer = 1
call plug#begin()
Plug 'alker0/chezmoi.vim'
"Plug 'chazy/cscope_maps'
"Plug 'simplyzhao/cscope_maps.vim'
" Plug 'scrooloose/nerdcommenter'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'christoomey/vim-tmux-navigator'
"Plug 'abudden/taghighlight-automirror'
Plug 'nathanaelkane/vim-indent-guides'
"Plug 'ludovicchabant/vim-gutentags'
"Plug 'freitass/todo.txt-vim'
"Plug 'morhetz/gruvbox'
"Plug 'nanotech/jellybeans.vim'
"Plug 'sjl/badwolf'
"Plug 'altercation/vim-colors-solarized'
"Plug 'sunuslee/vim-plugin-random-colorscheme-picker'
"Plug 'flazz/vim-colorschemes'
"Plug 'arcticicestudio/nord-vim'
" Use fork until colors are fixed: https://github.com/nordtheme/vim/pull/350
Plug 'MitchiLaser/fork-nord-vim'
call plug#end()
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Look and Feel
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" turn off the vi compatibility mode
set nocompatible
" set up the font for GUI
if has('gui_running')
set guifont=Inconsolata:h14
" get rid of the toolbar..useless
set guioptions-=T
endif
" doublewide command line
set laststatus=2
" truecolor when the terminal supports it (matches nvim's termguicolors)
if has('termguicolors') && ($COLORTERM ==# 'truecolor' || $COLORTERM ==# '24bit')
set termguicolors
endif
" gotta pick a theme
silent! colorscheme nord
" turn on syntax highlighting
syntax on
" no annoying backups
set nobackup nowritebackup
" better bracket support
set showmatch
" better backspacing
set backspace=indent,eol,start
" get rid of message prompt
set shortmess=atI
" show relative line numbering
set relativenumber
" Statusline: colored mode badge + file + fugitive branch + position.
function! s:StatuslineLabel() abort
let l:modes = {
\ 'n':'NORMAL', 'i':'INSERT', 'v':'VISUAL', 'V':'V-LINE',
\ "\<C-v>":'V-BLOCK', 's':'SELECT', 'c':'COMMAND',
\ 'R':'REPLACE', 't':'TERMINAL' }
return get(l:modes, mode(), toupper(mode()))
endfunction
function! StatuslineMode() abort
let l:hls = {
\ 'n':'StatusModeNormal', 'i':'StatusModeInsert', 'v':'StatusModeVisual',
\ 'V':'StatusModeVisual', "\<C-v>":'StatusModeVisual',
\ 'R':'StatusModeReplace', 'c':'StatusModeCommand', 't':'StatusModeTerminal' }
return '%#' . get(l:hls, mode(), 'StatusModeNormal') . '# ' . s:StatuslineLabel() . ' %*'
endfunction
function! StatuslineModePlain() abort
return s:StatuslineLabel()
endfunction
function! StatuslineGit() abort
if exists('*FugitiveHead')
let l:head = FugitiveHead()
return empty(l:head) ? '' : ' ' . l:head . ' '
endif
return ''
endfunction
function! s:SetStatusHl() abort
highlight StatusModeNormal guifg=#2e3440 guibg=#81a1c1 gui=bold ctermfg=0 ctermbg=4
highlight StatusModeInsert guifg=#2e3440 guibg=#a3be8c gui=bold ctermfg=0 ctermbg=2
highlight StatusModeVisual guifg=#2e3440 guibg=#b48ead gui=bold ctermfg=0 ctermbg=5
highlight StatusModeReplace guifg=#2e3440 guibg=#bf616a gui=bold ctermfg=0 ctermbg=1
highlight StatusModeCommand guifg=#2e3440 guibg=#ebcb8b gui=bold ctermfg=0 ctermbg=3
highlight StatusModeTerminal guifg=#2e3440 guibg=#8fbcbb gui=bold ctermfg=0 ctermbg=6
endfunction
call s:SetStatusHl()
augroup StatuslineHl
autocmd!
autocmd ColorScheme * call s:SetStatusHl()
augroup END
" %{%...%} re-evaluates its result as statusline syntax (needs Vim 8.2.2854+),
" which is what lets the mode badge inject its own highlight; older Vims fall
" back to plain uncolored mode text.
if has('patch-8.2.2854')
let &statusline = '%{%StatuslineMode()%} %<%f%m%r%h%w%=%{StatuslineGit()}%y %l:%v %p%% %L '
else
let &statusline = ' %{StatuslineModePlain()} %<%f%m%r%h%w%=%{StatuslineGit()}%y %l:%v %p%% %L '
endif
" share system clipboard
set clipboard=unnamed
" minimum lines about or below the cursor
set scrolloff=10
" enable omni completion and per-filetype indent scripts (yaml/python/c/...)
filetype plugin indent on
set omnifunc=syntaxcomplete#Complete
" enable indent guides
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_auto_colors=0
hi IndentGuidesEven ctermbg=238
hi IndentGuidesOdd ctermbg=236
let g:indent_guides_soft_pattern = ' '
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text Formatting/Layout
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" how automatic formatting is to be done
set formatoptions=tcrqn
" take indent for new line from previous line
set autoindent
" NOTE: global smartindent/cindent forced C-style indenting onto every
" filetype (e.g. inserting bogus indent in YAML on <CR>). With
" 'filetype plugin indent on' set above, the correct indent script loads
" per filetype -- C files still get C indenting -- so these are dropped.
" tab spacing (settings below are just to unify it)
set tabstop=3
" unify
set softtabstop=3
" unify
set shiftwidth=3
" no tabs please
set expandtab
" do not wrap lines
set nowrap
" use tabs at the start of a line, spaces elsewhere
set smarttab
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Searching
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" case insensitive searching unless I add case to search
set ignorecase
set smartcase
" turn on incremental search
set incsearch
" turn on search highlighting
set hlsearch
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Key Remappings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" control - hjkl change vim panes
noremap <C-H> <C-W><C-H>
noremap <C-J> <C-W><C-J>
noremap <C-K> <C-W><C-K>
noremap <C-L> <C-W><C-L>
" switch tabs w/ control tab
noremap <C-Tab> <C-PageDown>
noremap <C-S-Tab> <C-PageUp>
" Leader-d inserts current date
inoremap <leader>d <C-R>=strftime("%Y-%m-%d")<CR>
inoremap <leader>f <C-R>=strftime("%H:%M:%S")<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Path rules
""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Move swap directory to tmp
set directory=/tmp
""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Syntax Rules
""""""""""""""""""""""""""""""""""""""""""""""""""""""
" load up organi kon file highlighting if .kon file
au BufNewFile,BufRead *.kon setf kon
" wiki highlighting
au BufNewFile,BufRead *wiki.vi* setf moin
" A66 assembler files
au BufNewFile,BufRead *.A66 setf pic
""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Abbreviations
""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Save with Sudo
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!