-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
280 lines (210 loc) · 7.66 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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
"""
""" vim-plug
"""
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
" Shorthand notation; fetches https://github.com/altercation/solarized
Plug 'altercation/solarized', { 'rtp': 'vim-colors-solarized' }
" NERDTree
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
" LaTeX
Plug 'lervag/vimtex'
" VIM Table Mode
Plug 'dhruvasagar/vim-table-mode'
" vim-crbasic
Plug 'bearnik/vim-crbasic'
" extline
Plug 'drmikehenry/vim-extline'
" vimspector
Plug 'puremourning/vimspector'
" vim-surround
Plug 'tpope/vim-surround'
" Initialize plugin system
call plug#end()
filetype plugin indent on " Turn on filetype plugins (:help filetype-plugin)
" This enables Vim's and neovim's syntax-related features. Without this, some
" VimTeX features will not work (see ":help vimtex-requirements" for more
" info).
syntax enable
""
"" Key Mappings
""
" Map escape key to jj -- much faster
imap jj <esc>
" Saves time; maps the spacebar to colon
nmap <space> :
""
"" Mouse for Terminal Mode
""
" Enable the mouse, but don't change the settings if this is a GUI.
if has('mouse') && !has('gui_running')
set mouse=a
endif
""
"" Color scheme settings
""
set background=dark
colorscheme solarized
""
"" Basic Setup
""
set number " Show line numbers
set ruler " Show line and column number
set encoding=utf-8 " Set default encoding to UTF-8
""
"" Whitespace
""
if exists("+breakindent")
set breakindent
endif
" set wrap
" set nowrap " don't wrap lines
" set tabstop=2 " a tab is two spaces
set shiftwidth=2 " an autoindent (with <<) is two spaces
set softtabstop=2
set expandtab " use spaces, not tabs
set list " Show invisible characters
set backspace=indent,eol,start " backspace through everything in insert mode
set fileformat=unix
set nojoinspaces " Prevent vim from inserting a second space when joining lines
" List chars
set listchars="" " Reset the listchars
set listchars=tab:\ \ " a tab should display as " ", trailing whitespace as "."
set listchars+=trail:. " show trailing spaces as dots
set listchars+=extends:> " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
set listchars+=precedes:< " The character to show in the last column when wrap is
" off and the line continues beyond the right of the screen
""
"" Searching
""
" set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
""
"" Backup and swap files
""
" set backupdir=~/.vim/_backup " where to put backup files.
" set directory=~/.vim/_temp " where to put swap files.
""
"" Status line settings
""
if has("statusline") && !&cp
set laststatus=2 " always show the status bar
" Without setting this, ZoomWin restores windows in a way that causes
" equalalways behavior to be triggered the next time CommandT is used.
" This is likely a bludgeon to solve some other issue, but it works
set noequalalways
" Start the status line
set statusline=%f\ %m\ %r
" Finish the statusline
set statusline+=Line:%l/%L[%p%%]
set statusline+=\ Col:%v
set statusline+=\ Buf:#%n
set statusline+=\ Char:[%b][0x%B]
endif
" Source the vimrc file after saving it. This way, you don't have to reload
" Vim to see the changes.
if has("autocmd")
autocmd bufwritepost .vimrc source $MYVIMRC
endif
"" Markdown to HTML
" nmap <leader>md :%!/usr/local/bin/Markdown.pl --html4tags <cr>
" Faster shortcut for commenting. Requires T-Comment plugin
" map <leader>c <c-_><c-_>
""
"" Markdown (plasticboy/vim-markdown)
""
" Disable the folding configuration for Markdown
let g:vim_markdown_folding_disabled = 0
" To enable/disable folding use Vim's standard folding configuration.
" set [no]foldenable
" Fold in a style like python-mode
" let g:vim_markdown_folding_style_pythonic = 1
" Prevent foldtext from being set
let g:vim_markdown_override_foldtext = 0
" Set header folding level
" Folding level is a number between 1 and 6. By default, if not specified, it
" is set to 1.
let g:vim_markdown_folding_level = 1
"""
""" LaTeX (verlag/vimtex)
"""
" Set the viewer method.
let g:vimtex_view_method = 'skim'
""
"" File types
""
if has("autocmd")
" Some file types should wrap their text
" See http://vim.wikia.com/wiki/Word_wrap_without_line_breaks
function! SetupWrapping()
set wrap
set linebreak
set textwidth=0
set wrapmargin=0
set nolist
endfunction
" In Makefiles, use real tabs, not tabs expanded to spaces
au FileType make set noexpandtab
" This actually might be confusing, but the plugin +ruby+ already does
" this, so we want to do it only if the plugin +ruby+ is disabled for
" some reason
" if janus#is_plugin_disabled("ruby")
" Set the Ruby filetype for a number of common Ruby files without .rb
" au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,Procfile,config.ru,*.rake} set ft=ruby
" endif
" Make sure all markdown files have the correct filetype set and setup wrapping
au BufRead,BufNewFile *.{md,markdown,mdown,mkd,mkdn} setf markdown | call SetupWrapping()
au BufRead,BufNewFile *.{tex,txt} call SetupWrapping()
" Set syntax highlighting for CRBasic files
au BufRead,BufNewFile *.{CR300,cr1,cr6} set filetype=freebasic
" Treat JSON files like JavaScript
" au BufNewFile,BufRead *.json set ft=javascript
" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
" Remember last location in file, but not for commit messages.
" see :help last-position-jump
" au BufReadPost * if &filetype !~ '^git\c' && line("'\"") > 0 && line("'\"") <= line("$")
" \| exe "normal! g`\"" | endif
endif
" Set up Lilypond plugin, indent mode, and syntax-highlighting
if has('mac')
filetype off
set runtimepath+=/Applications/LilyPond.app/Contents/Resources/share/lilypond/current/vim
filetype on
endif
" Set up make
set makeprg=gcc\ -Wall\ -o\ %:r\ %
" Automatically open, but do not go to (if there are errors) the quickfix /
" location list window, or close it when is has become empty.
"
" Note: Must allow nesting of autocmds to enable any customizations for quickfix
" buffers.
" Note: Normally, :cwindow jumps to the quickfix window if the command opens it
" (but not if it's already open). However, as part of the autocmd, this doesn't
" seem to happen.
autocmd QuickFixCmdPost [^l]* nested cwindow
autocmd QuickFixCmdPost l* nested lwindow
" Abbreviations to make constructing boxes for C comments easier
:abbr #b /********************************************************
" When on the last line of the box, we need to back up one space
:abbr #e <Backspace>*******************************************************/
" Options for VIM Table Mode
let g:table_mode_corner_corner='+'
let g:table_mode_header_fillchar='='
" Options for netrw to make it work like NERDtree
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_winsize = 25
" Configuration for vimspector
let g:vimspector_enable_mappings = 'HUMAN'
" vim-surround commands for reStructuredText italics and bold
autocmd FileType rst,text,markdown,octopress let b:surround_{char2nr('i')} = "*\r*"
autocmd FileType rst,text,markdown,octopress let b:surround_{char2nr('b')} = "**\r**"