-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
202 lines (163 loc) · 5.16 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
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" Add required settings for Vundle
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
" Add enhanced tab completion
set wildmenu
" Show commands in progress as they're being typed
set showcmd
" Make backspace behave in a sane manner
set backspace=indent,eol,start
" Show line numbers
set number
" Allow hidden buffers, don't limit to 1 file per window/split
set hidden
" Increase stored command history
set history=100
" Toggle font sizes (for window snapping and such) in gvim
" See <https://vi.stackexchange.com/q/22528>
let t:jcm_small_text = 0
function! Toggle_jcm_small_text()
if has("gui_running")
if t:jcm_small_text == 0
if has("gui_macvim")
set guifont=Berkeley_Mono:h22,Source_Code_Pro:h22
elseif has("win64") || has("win32") || has("win16")
set guifont=Berkeley\ Mono:h22,Source\ Code\ Pro:h14
else
set guifont=Berkeley\ Mono\ 22,Source\ Code\ Pro\ 22
endif
let t:jcm_small_text = 1
else
if has("gui_macvim")
set guifont=Berkeley_Mono:h14,Source_Code_Pro:h14
elseif has("win64") || has("win32") || has("win16")
set guifont=Berkeley\ Mono:h9,Source\ Code\ Pro:h9
else
set guifont=Berkeley\ Mono\ 14,Source\ Code\ Pro\ 14
endif
let t:jcm_small_text = 0
endif
endif
endfunction
nnoremap <Leader>f : call Toggle_jcm_small_text()<CR>
" Default to Unicode
set encoding=utf-8
" Handle Mac file endings properly
set ffs=unix,mac,dos
" Reload externally changed files
set autoread
" Find matches while we search
set incsearch
" Highlight search matches
set hlsearch
" Set indent options
set expandtab
set shiftwidth=2
set softtabstop=2
set autoindent
" Set folding options
set foldmethod=indent
set foldnestmax=16
" Disable word wrap
set nowrap
set formatoptions-=t
" Add position indicator to bottom right
set ruler
" Set text width to my preference
set textwidth=79
" Set scrolling margins
set scrolloff=5
set sidescrolloff=5
set sidescroll=1
" Disable swap files
set noswapfile
set nobackup
set nowb
" Make splits open in more natural directions
set splitbelow
set splitright
" Disable modelines for security reasons
set modelines=0
set nomodeline
" Specify plugins
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-commentary'
Plugin 'groenewege/vim-less'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'bling/vim-airline'
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'jmcantrell/vim-virtualenv'
Plugin 'danro/rename.vim'
Plugin 'othree/html5.vim'
Plugin 'maxmellon/vim-jsx-pretty'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'niklasl/vim-rdf'
Plugin 'ap/vim-css-color'
Plugin 'pangloss/vim-javascript'
Plugin 'evanleck/vim-svelte'
Plugin 'jvirtanen/vim-hcl'
Plugin 'Glench/Vim-Jinja2-Syntax'
Plugin 'vim-pandoc/vim-pandoc-syntax'
Plugin 'quarto-dev/quarto-vim'
Plugin 'wuelnerdotexe/vim-astro'
Plugin 'jparise/vim-graphql'
" Configure airline
set laststatus=2
let g:airline#extensions#whitespace#enabled=0
" Add vim-less requirement
nnoremap <Leader>m :w <BAR> !lessc % > %:t:r.css<CR><space>
" Add vim-markdown config
let g:vim_markdown_folding_disabled=1
let g:vim_markdown_frontmatter=1
let g:vim_markdown_strikethrough=1
let g:vim_markdown_auto_insert_bullets=0
let g:vim_markdown_new_list_item_indent=0
let g:vim_markdown_edit_url_in='tab'
" Finish Vundle initialization
call vundle#end()
" Enable file type detection, add some new file types and do language-dependent
" indenting
filetype plugin indent on
autocmd Filetype python setlocal shiftwidth=4 softtabstop=4
autocmd Filetype markdown setlocal shiftwidth=4 softtabstop=4
autocmd BufRead,BufNewFile *.thor set filetype=ruby
" Configure colors
syntax enable
set background=dark
colorscheme desert
" Mark the 80th column in the window for PEP 8 purposes
set colorcolumn=79
highlight ColorColumn ctermbg=gray guibg=PaleTurquoise4
" Mark the line currently being edited
set cursorline
highlight CursorLine ctermbg=Black guibg=Black
" Change fugitive's gutter colors
highlight SignColumn guibg=DarkSlateGray
highlight GitGutterAdd guibg=DarkSlateGray guifg=SeaGreen2
highlight GitGutterDelete guibg=DarkSlateGray guifg=firebrick3
highlight GitGutterChange guibg=DarkSlateGray guifg=DodgerBlue1
" Add recommended settings to help editorconfig and fugitive play nicely
" together
let g:EditorConfig_exclude_patterns = ['fugitive://.*']
" Back off on vertical split color
highlight VertSplit ctermbg=Black guibg=Black
" Properly highlight opening characters in Markdown headers
highlight mkdHeading ctermfg=5 gui=bold guifg=indianred
" Ignore temp/OS/dependency files in CtrlP and other situations
set wildignore+=*/tmp/*,*/.tmp/*,*/node_modules/*,.DS_Store,*/.git/*
" Always cd to current file's directory
" Apparently conflicts with some plugins, so watch out
set autochdir
" Map a :nohl shortcut since I use that so often
nnoremap <Leader>n :nohlsearch<CR>
" Map a shortcut to make existing vertical split wide enough to read
nnoremap <Leader>r :vertical resize 90<CR>