-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
209 lines (175 loc) · 6.1 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
"g:my_vim_dir is used elsewhere in my vim configurations
let g:my_vim_dir=expand("$HOME/.vim")
"$HOME/.vim and $HOME/.vim/after are in the &rtp on unix
"But on windows, they need to be added.
if has("win16") || has("win32") || has("win64")
"add g:my_vim_dir to the front of the runtimepath
execute "set rtp^=".g:my_vim_dir
"add g:my_vim_dir\after to the end of the runtimepath
execute "set rtp+=".g:my_vim_dir."\\after"
"Note, pathogen#infect() looks for the 'bundle' folder in each path
"of the &rtp, where the last dir in the '&rtp path' is not 'after'. The
"<path>\bundle\*\after folders will be added if and only if
"the corresponding <path>\after folder is in the &rtp before
"pathogen#infect() is called. So it is very important to add the above
"'after' folder.
" Not necessary, but I like to cleanup &rtp to use \ instead of /
" when on windows machines
"let &rtp=substitute(&rtp,"[/]","\\","g")
set guifont=IBM\ Plex\ Mono\ Light:h12
set fileformats=unix,dos,mac
set lines=38 columns=120
else
set guifont=SF-Mono-Powerline-Regular:h18
set term=xterm-256color-italic " See <https://alexpearce.me/2014/05/italics-in-iterm2-vim-tmux/>
endif
" Autoload plugins in ~/.vim/bundle/
execute pathogen#infect()
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"Added per Installation instructions: <https://github.com/joshdick/onedark.vim#installation>
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799
if (has("termguicolors"))
set termguicolors
endif
endif
" Basic Display Options
" -----------------------
filetype plugin indent on
syntax on
let g:onedark_terminal_italics=1
let g:Powerline_symbols = 'fancy'
set encoding=utf-8
set t_Co=256
" Other options: acme, dark-acme, onedark
colorscheme earl-grey " For onedark, this line must come *after* any theme option settings
set termencoding=utf-8
set colorcolumn=100
set number " Shows line numbers
" Common Shortcuts
" -----------------------
" Shortcut to reopen last file
map <leader>s :source ~/.vimrc<CR>
" Shortcut to remove search highlights
nnoremap <leader><space> :nohlsearch<CR>
" Shortcut to open file tree
nmap <leader>n :NERDTreeToggle<CR>
" Shortcut to hard-wrap current paragraph
nmap <leader>w {gq}
" Use :q and :qa to quit vim even when Goyo is active
function! s:goyo_enter()
let b:quitting = 0
let b:quitting_bang = 0
autocmd QuitPre <buffer> let b:quitting = 1
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
endfunction
function! s:goyo_leave()
" Quit Vim if this is the only remaining buffer
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
if b:quitting_bang
qa!
else
qa
endif
endif
endfunction
autocmd! User GoyoEnter call <SID>goyo_enter()
autocmd! User GoyoLeave call <SID>goyo_leave()
function! GoyoOff()
Goyo!
syn off | syn on " Syntax needs resetting after exiting Goyo
endfunction
nmap <leader>p :Goyo 106<CR>
nmap <leader>o :call GoyoOff()<CR>
let g:light_theme = 'earl-grey'
let g:dark_theme = 'rosepine'
function! DarkTheme()
execute 'hi clear'
execute 'colorscheme ' . g:dark_theme
set background=dark
let g:lightline.colorscheme = 'rosepine_moon'
call lightline#init()
call lightline#colorscheme()
call lightline#update()
redraw!
endfunc
function! LightTheme()
execute 'hi clear'
execute 'colorscheme ' . g:light_theme
let g:lightline.colorscheme = 'rosepine'
call lightline#init()
call lightline#colorscheme()
call lightline#update()
redraw!
endfunc
nmap <leader>d :call DarkTheme()<CR>
nmap <leader>l :call LightTheme()<CR>
"nmap <leader>d :colorscheme rosepine<CR>
"nmap <leader>l :colorscheme earl-grey<CR>
let s:curfontflag = 1
function! ToggleGUIFont()
if has('gui_running')
if s:curfontflag == 1
set guifont=TriplicateARegular:h18
let s:curfontflag = 0
else
set guifont=SF-Mono-Powerline-Regular:h18
let s:curfontflag = 1
endif
endif
endfunction
command! ToggleGUIFont call ToggleGUIFont()
nmap <leader>f :ToggleGUIFont<CR>
set hidden
set history=100
set nowrap
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smartindent
set autoindent
set incsearch " search as characters are entered
set hlsearch " highlight search matches
set showmatch " highlight matching [{()}]
set cursorline " highlights the current line
set wildmenu " provides graphical menu of autocomplete matches for commands
set textwidth=100 " only used when manually re-wrapping lines
augroup configgroup
autocmd!
autocmd BufEnter Makefile setlocal noexpandtab
au! BufRead,BufNewFile *.pm set filetype=pollen
au! BufRead,BufNewFile *.ptree set filetype=pollen
au! BufRead,BufNewFile *.pp set filetype=pollen
au! BufRead,BufNewFile *.scrbl set filetype=scribble
au! BufRead,BufNewFile *.rktd set filetype=racket
augroup END
" Plugin settings
" -----------------------
set laststatus=2 " correct display of LightLine status bar
set noshowmode " --INSERT-- unnecessary since LightLine displays mode
set signcolumn=yes " always display VCS gutter column (prevents weird mvmt)
set updatetime=250 " Shorten to 250msec from default 4 sec (for gitgutter)
let g:markdown_enable_spell_checking = 0
let g:markdown_enable_conceal = 0
let g:markdown_include_jekyll_support = 0
" Signify plugin (replaces gitgutter since it supports Fossil too)
let g:signify_vcs_list = [ 'git', 'fossil' ]
let g:signify_realtime = 0 " realtime=1 results in continuous autosave!
let g:signify_sign_change = '~'
let NERDTreeIgnore=['\.DS_Store', '\~$', '\.swp']
let NERDTreeShowHidden=1 " Show hidden files
let g:lightline = {
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'gitbranch#name'
\ },
\ 'colorscheme': 'rosepine',
\ }