-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_vimrc
More file actions
208 lines (178 loc) · 4.42 KB
/
_vimrc
File metadata and controls
208 lines (178 loc) · 4.42 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
" vim: se ff=unix :
filetype off
if has('win32') || has('win64')
call plug#begin('~/vimfiles/plugins')
else
call plug#begin('~/.vim/plugins')
endif
" Dependencies for snipmate
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'itchyny/lightline.vim'
Plug 'unblevable/quick-scope'
Plug 'Townk/vim-autoclose'
Plug 'garbas/vim-snipmate'
Plug 'honza/vim-snippets'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-vinegar'
Plug 'leafgarland/typescript-vim'
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'w0rp/ale'
Plug 'tpope/vim-abolish'
Plug 'benmills/vimux'
call plug#end()
if has('win32') || has('win64')
source ~/vimfiles/oz/*
else
source ~/.vim/oz/*
endif
filetype on
" Space as leader
let mapleader = " "
" Can define local vimrc
silent! so .vimlocal
"""
""" misc settings and mappings
"""
" make files use tabs
autocmd FileType make setlocal noexpandtab
set ruler
set relativenumber
" rational backspace
set backspace=indent,eol,start
" pray for no crashes
set noswapfile
" Visual autocomplete for command menu
set wildmenu
" Redraw only when we need to.
set lazyredraw
" Quicker exit of insert mode
inoremap jk <Esc>
" Don't select first element when doing ctrl-n
inoremap <C-Space> <C-n><C-p>
" Evaluate math expression using vim calculator
inoremap <C-A> <C-O>y^<End> = <C-R>=<C-R>0<CR>
" Easier saving
nnoremap <leader>s :w<CR>
" Better move to beginning of line (ignores whitespace at the beginning)
nnoremap 0 g^
nnoremap ^ 0
" Copy/Paste to/from clipboard
nnoremap <leader>p "*p
nnoremap <leader>y "*y
vnoremap <leader>y "*y
" Change file type faster
nnoremap <leader>f :set ft=
" Create new file
nnoremap <leader>n :enew<CR>
" Remove history buffer
nnoremap q: <Nop>
" Unmap the tab button (same as c-i) in normal mode so that it can be used to jump back and forth
silent! nunmap <C-I>
" Flip " and ' so that registers are easier to use
nnoremap " '
nnoremap ' "
vnoremap " '
vnoremap ' "
" Open/Close folds with tab
"nnoremap <tab> za
"nnoremap <S-tab> zc
" Show pressed keys in normal mode
set showcmd
" set vim dir to current file's directory, entered twice because conflicts
" with diff commands otherwise, which is annoying
nnoremap <leader>d :cd%:p:h<CR>
nnoremap <leader>dd :cd%:p:h<CR>
"""
""" Searching configurations
"""
set incsearch " search as characters are entered
set hlsearch " highlight matches
nnoremap <CR> :nohl<CR>
" Search as characters are entered
set incsearch
" Highlight matches
set hlsearch
" Remove all highlights
nnoremap <CR> :nohl<CR>
" Call :difft
nnoremap <leader>dt :difft<CR>
nnoremap <leader>do :diffo<CR>
set ignorecase
set smartcase
" Tab handling
filetype plugin indent on " Indentation scripts can be specified in indent/ folder
" auto indentation
set ai
set tabstop=2
set shiftwidth=2
set expandtab
"""
""" Window split related things
"""
"map <leader>w <C-W>
nnoremap <leader>j <C-W><C-J>
nnoremap <leader>k <C-W><C-K>
nnoremap <leader>l <C-W><C-L>
nnoremap <leader>h <C-W><C-H>
set splitbelow
set splitright
"""
""" Tab mappings
"""
nnoremap <leader>t :tabnew<CR>
""" PLUGIN RELATED STUFF
"""
"""
""" Lightline settings
"""
set laststatus=2
set noshowmode
"""
""" Pandoc settings
"""
let g:pandoc#folding#fold_fenced_codeblocks = 1
"""
""" Quick-scope mappings
"""
nmap <leader>q <plug>(QuickScopeToggle)
"""
""" CtrlP Settings
"""
let g:ctrlp_match_window = 'results:200' " overcome limit imposed by max height
let g:ctrlp_max_files=0
let g:ctrlp_max_depth=10000
let g:ctrlp_cache_dir = '~/.cache/ctrlp'
let g:ctrlp_clear_cache_on_exit = 0
let ctrlp_lazy_update=1
let g:ctrlp_working_path_mode = '0'
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|AppData\|myenv\|venv'
let g:ctrlp_switch_buffer = 'e'
nnoremap <C-P> :CtrlP<CR>
nnoremap <C-P><C-P> :CtrlP<CR>
nnoremap <C-P>p :CtrlP<CR>
nnoremap <C-P><C-B> :CtrlPBuffer<CR>
nnoremap <C-P>b :CtrlPBuffer<CR>
nnoremap <C-P><C-M> :CtrlPMRUFiles<CR>
nnoremap <C-P>m :CtrlPMRUFiles<CR>
"""
""" APPEARANCE RELATED STUFF
"""
" GUI fonts
if has("gui_running")
if has("gui_gtk2")
set guifont=Inconsolata\ 12
elseif has("gui_macvim")
set guifont=Menlo\ Regular:h14
elseif has("gui_win32")
"set guifont=Consolas:h11:cANSI
endif
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right scroll-bar
set guioptions-=L "remove left scroll-bar
set guioptions-=e "remove menu bar
set guitablabel=%t
endif