-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
172 lines (133 loc) · 4.98 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
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Automatic (smart) closing for quotes, parenthesis, brackets etc
" This is what causes deleting to be slow!
" (This plugin makes the cursor turn into a block for a split second every
" time you hit backspace)
" Plugin 'raimondi/delimitmate'
" Gruvbox color scheme
Plugin 'morhetz/gruvbox'
" Color scheme for plugins goyo and limelight
Plugin 'https://github.com/junegunn/seoul256.vim'
" For nicer writing:
Plugin 'https://github.com/junegunn/limelight.vim'
Plugin 'https://github.com/junegunn/goyo.vim'
" For commenting stuff out/in
Plugin 'scrooloose/nerdcommenter'
" For better syntax highlighting and indentation in javascript
Plugin 'pangloss/vim-javascript'
" For highlighting and indentation in JSX (depends on the plugin above!)
Plugin 'mxw/vim-jsx'
" I wrote lots of Python code w/o running it and this seems like a
" faster way of finding bugs.
"Plugin 'w0rp/ale'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" START (of my own, non-plugin settings)
" Without this, you cannot hit backspace to delete stuff you wrote after you
" ":w" (save)
set backspace=2
" Set the color scheme to seoul256
" colo seoul256
" Literally syntax highlighting
syntax on
" Make the search (/) results be highlighted
set hlsearch
" Make line-numbers appear
set nu
" Shows the commands you are typing
set showcmd
" Sets the line numbers as far to the left as they will go
set numberwidth=1
" This enables spell check
" set spell spelllang=en_us
" Shortcut for turning on spell check
nnoremap <C-h> :setlocal spell! spelllang=en_us<CR>
" This makes it so that vim copies and pastes to/from the system clipboard
set clipboard=unnamed
" Make j and k go by visual lines
map j gj
map k gk
" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <C-i> :nohl<CR>
" <S-j> and <S-k> scroll down and up, respectively
nnoremap <S-j> <C-e>
nnoremap <S-k> <C-y>
" Move one space to the left (for escaping parenthesis)
inoremap <C-e> <C-o>l
" Vim cursor behavior-- let vim cursor go one character beyond last letter of
" line
set virtualedit+=onemore
" Stuff to break lines up nice.
set breakindent
let &showbreak = '↳'
" This is what makes the cursor be a vertical bar in insert mode and a box in
" command mode (in Vim). You must have the default cursor be a box (in the
" iTerm2 settings).
let &t_ti.="\e[1 q"
let &t_SI.="\e[5 q"
let &t_EI.="\e[1 q"
let &t_te.="\e[0 q"
" Makes writing comfortable
" To use, ":Write"
function SetWritingSettings()
Goyo 60
colo seoul256
set linebreak
" Limelight 0.9 // Limelight doesn't seem to be working right now
endfunction
command Write echom SetWritingSettings()
" Turn off Esc delay when exiting Visual mode
set timeoutlen=1000 ttimeoutlen=0
" Makes it so that you can scroll in vim using mouse
set mouse=a
" This makes vim display last line instead of a bunch of @@@ and empty space
set display+=lastline
" Makes it so that "x" in normal mode does not copy the character it deletes
nnoremap x "_x
" Turn on persistent undoes in Vim and specify where those files are saved
set undofile
set undodir=~/.vim/undodir
" Set colorscheme to gruvbox and make sure it's the dark alternative
silent! colo gruvbox
set background=dark
" Make it so that searches ("/") do not automatically open folds
set fdo-=search
" Highlight 80th char of each line
set colorcolumn=80
" Make tabs be 2 spaces wide when editing javascript
autocmd Filetype ocaml setlocal tabstop=2 shiftwidth=2
autocmd Filetype c setlocal tabstop=2 shiftwidth=2
autocmd Filetype javascript setlocal tabstop=2 shiftwidth=2
autocmd Filetype css setlocal tabstop=2 shiftwidth=2
autocmd Filetype html setlocal tabstop=2 shiftwidth=2
autocmd Filetype java setlocal tabstop=2 shiftwidth=2
"This is for saving and loading Vim folds. These views are saved to
".vim/views and are NOT automatically deleted when you delete a text file
"that contained folds.
" ?* is for matching all nonempty names (I.e. so that doing `vi` without
" any arguments does not cause either autocommand to run).
set viewoptions-=options
augroup AutoSaveFolds
autocmd BufWinLeave ?* mkview
autocmd BufWinEnter ?* silent loadview
augroup END