Repository navigation
Expand file tree
/
Copy pathvimrc
More file actions
240 lines (196 loc) · 7.07 KB
/
Copy pathvimrc
File metadata and controls
240 lines (196 loc) · 7.07 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
228
229
230
231
232
233
234
235
236
237
238
239
240
" for more information see :help nbf
" ---[ Setup ]--- {{{
"
" Browser detection
" allows for conditional checks against g:os, which will be
" one of 'Windows', 'Linux', 'Darwin' (for mac)
if !exists('g:os')
if has('win32') || has('win16')
let g:os = 'Windows'
else
let g:os = substitute(system('uname'), '\n', '', '')
endif
endif
" Vimfiles discovery
if isdirectory(expand('$HOME/vimfiles'))
let $VIMFILES = expand('$HOME/vimfiles')
elseif isdirectory(expand('$HOME/.vim'))
let $VIMFILES = expand('$HOME/.vim')
endif
" }}}
" ---[ Plugins ]--- {{{
silent! call plug#begin('$VIMFILES/plugged')
" Color Schemes
Plug 'jonathanfilip/vim-lucius'
"Plug 'morhetz/gruvbox'
"Plug 'ajh17/spacegray.vim'
"Plug 'tomasr/molokai'
"Plug 'alessandroyorba/despacio'
" ANSI escape code handling (:help AnsiEsc)
" :AnsiEsc to apply ANSI color codes in file
Plug 'vim-scripts/AnsiEsc.vim'
" PlantUML syntax
Plug 'aklt/plantuml-syntax'
" PlantUML preview in browser (:help plantuml-previewer)
" :PlantumlOpen to open the current plantuml diagram in a browser
Plug 'weirongxu/plantuml-previewer.vim'
au FileType plantuml let g:plantuml_previewer#plantuml_jar_path = get(
\ matchlist(system('cat `which plantuml` | grep plantuml.jar'), '\v.*\s[''"]?(\S+plantuml\.jar).*'),
\ 1,
\ 0
\)
" Pretty status lines (:help airline)
let g:airline_powerline_fonts=1
"let g:airline_left_sep='>'
"let g:airline_right_sep='<'
Plug 'bling/vim-airline'
" filesystem browser (:help nerdtree)
let g:NERDTreeShowBookmarks=1
let g:NERDTreeChDirMode=2
let g:NERDTreeWinSize=30
let g:NERDTreeQuitOnOpen=1
let g:NERDTreeWinPos="right"
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
" nerdtree git integration
Plug 'Xuyuanp/nerdtree-git-plugin'
" git integration for vim (:help fugitive)
Plug 'tpope/vim-fugitive'
" most recently used (MRU) file list (:help MRU)
let MRU_Max_Entries = 50
Plug 'yegappan/mru'
" dynamic font zooming (:help fontsize)
" \\+,+,... and \\-,-,... to increase and decrease fonts
Plug 'drmikehenry/vim-fontsize'
" vim for writers (:help pencil)
let g:pencil#wrapModeDefault = 'soft'
Plug 'reedes/vim-pencil'
" highlight active paragraph (:help limelight)
Plug 'junegunn/limelight.vim'
" focused writing mode (:help goyo)
Plug 'junegunn/goyo.vim'
" ctrl-p project search (:help ctrlp)
if executable('ag')
set grepprg=ag\ --nogroup\ --nocolor
let g:ctrlp_user_command='ag %s -l --nocolor -g ""'
"let g:ctrlp_use_caching = 0
endif
Plug 'ctrlpvim/ctrlp.vim'
" indent guide (:help indent-guides)
let g:indent_guides_guide_size=1
Plug 'preservim/vim-indent-guides'
" rspec helper (:help rspec)
Plug 'thoughtbot/vim-rspec'
call plug#end()
" }}}
" ---[ General Options ]--- {{{
set nocompatible " run in full vim mode
set encoding=utf8 " set default encoding
set number " enable line numbering
set backspace=indent,eol,start " backspacing over everything in insert mode
set noswapfile " no swap files
set backup " enable backup versions
set mouse=a " enable mouse
set splitbelow " open new splits below
set splitright " open new vsplits to the right
set nowrap " start with wrapping disabled
syntax on " enable syntax highlighting
set nohlsearch " disable highlighted searching
set ignorecase " searches are case insensitive...
set smartcase " ...unless an upper case character is sought
set tabstop=2 " basic tab stop
set shiftwidth=2 " spaces per tab
set smarttab " insert tabs as spaces
set expandtab " replace tabs with spaces
set smartindent " autoindent following lines
set backupdir=$VIMFILES/tmp/backup " backup file path
set undodir=$VIMFILES/tmp/undo " undo file path
set directory=$VIMFILES/tmp/swap " swap file path
" }}}
" ---[ Visual Options ]--- {{{
set background=dark " set dark backround coloring
colo lucius " set color scheme
set visualbell " flash instead of beeping
set ruler " show cursor position
set showcmd " display incomplete commands
set wildmenu " enable tab-completion menu in command mode
set history=50 " 50 lines of command line history
set cmdheight=1 " command line is two lines tall
set laststatus=2 " always show a status line
set shortmess+=I " disable the welcome screen
set linespace=0 " use default 0 linespaces even on windows
set colorcolumn=100 " show a vertical line at the 100 character mark
set fillchars=vert:┃,fold:━ " fancy up the separators
set list " show hidden characters (next line sets chars)
set listchars=tab:⇒\ ,trail:‗,extends:⮞,precedes:⮜
" }}}
" ---[ Keyboard Mapping ]--- {{{
" <F1> to open my custom notes
nmap <F1> :help nfnotes<CR>
" \f to open file list
" \r to open most recently used
nmap <silent> <leader>f :NERDTreeToggle<CR>
nmap <silent> <leader>r :MRU<CR>
" \n to toggle line numbering
" \w to toggle line wrap
" \h to toggle highlighted search
" \i to toggle indentation highlights
" \x to toggle writer's mode
nmap <silent> <leader>n :set number!<CR>
nmap <silent> <leader>h :set hlsearch!<CR>
nmap <silent> <leader>x :Write<CR>
nmap <silent> <leader>w :set wrap!<CR>
nmap <silent> <leader>i :IndentGuidesToggle<CR>
" \+ to increase font size
" \- to decrease font size
" \0 to reset font size
nmap <silent> <Leader>+ <Plug>FontsizeInc
nmap <silent> <Leader>- <Plug>FontsizeDec
nmap <silent> <Leader>0 <Plug>FontsizeDefault
" \t to run current spec file
" \s to run nearest spec
" \l to run last spec
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
" }}}
" ---[ Commands ]--- {{{
command! -bar NotesEdit :vi +set\ modifiable $VIMFILES/doc/nfnotes.txt
command! -bar NotesIndex :helptags $VIMFILES/doc|echo "Notes Re-indexed!"
function! ToggleWrite()
Goyo
Limelight!!
TogglePencil
endfunction
command! -bar Write call ToggleWrite()
function! FormatWithJQ()
%!jq "."
endfunction
command! -bar JsonCleanup call FormatWithJQ()
function! Settings()
if &modified
split $MYVIMRC
else
e $MYVIMRC
endif
vsplit $MYGVIMRC
endfunction
command! -bar Settings call Settings()
command! -bar SettingsReload :source $MYVIMRC|source $MYGVIMRC
" use AnsiEsc to color code ansi characters, but re-color some difficult to
" read colors
function! AnsiRecolor()
%s/\[34m/[33m/ge
endfunction
command! -bar -bang Ansi call AnsiRecolor()|:AnsiEsc<bang>
" }}}
" ---[ Filetype configuration ]--- {{{
autocmd BufEnter *.md set cursorline
autocmd BufLeave *.md set nocursorline
" }}}
" ---[ OS Specific Setup ]--- {{{
if g:os == 'Windows'
source $VIMRUNTIME/mswin.vim
behave mswin
endif
" }}}
" vim:fdm=marker:ft=vim