-
Notifications
You must be signed in to change notification settings - Fork 10
/
vimrc
220 lines (180 loc) · 4.95 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
:let mapleader=","
" Common settings
filetype plugin on
"" Enable filetype detection
filetype on
" " OPTIONAL: This enables automatic indentation as you type.
filetype indent on
set tags=~/.vim/stdtags,tags,.tags,../tags
set ai sw=4
" enable mouse wherever
set mouse=a
" It's VIM, not VI
set nocompatible
" A tab produces a 2-space indentation
set softtabstop=2
set shiftwidth=2
set expandtab
" Additional vim features to optionally uncomment.
set showcmd
set showmatch
set showmode
set incsearch
set ruler
" Add and delete spaces in increments of `shiftwidth' for tabs
set smarttab
" Highlight syntax in programming languages
syntax on
" In Makefiles, don't expand tabs to spaces, since we need the actual tabs
autocmd FileType make set noexpandtab
" Useful macros for cleaning up code to conform to LLVM coding guidelines
" Delete trailing whitespace and tabs at the end of each line
command! DeleteTrailingWs :%s/\s\+$//
" Convert all tab characters to two spaces
command! Untab :%s/\t/ /g
" Enable pathogen
"call pathogen#infect()
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
" Enable pathogen
call pathogen#infect()
" call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
""" Functions
function! ConditionalPairMap(open, close)
let line = getline('.')
let col = col('.')
if col < col('$') || stridx(line, a:close, col + 1) != -1
return a:open
else
return a:open . a:close . repeat("\<left>", len(a:close))
endif
endf
""" End Functions
syntax enable
if !has('gui_running')
" Compatibility for Terminal
let g:solarized_termtrans=1
if (&t_Co >= 256 || $TERM == 'xterm-256color')
" Do nothing, it handles itself.
else
" Make Solarized use 16 colors for Terminal support
let g:solarized_termcolors=16
endif
endif
""" Colorschemes
colorscheme solarized
hi Normal ctermbg=NONE
set background=dark
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" Folds
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
set foldmethod=indent
set foldlevel=99
" SuperTab plugin
au FileType python set omnifunc=pythoncomplete#Complete
let g:SuperTabDefaultCompletionType = "context"
set completeopt=menuone,longest,preview
" Delete trailing whitespace and tabs at the end of each line
command! DeleteTrailingWs :%s/\s\+$//
" Convert all tab characters to two spaces
command! Untab :%s/\t/ /g
" NERDTree
map <F2> :NERDTreeToggle<CR>
"Enable Ctrl+P to paste
map <C-Y> :set paste<CR>
" Moving around windows
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
map <leader>vimrc :tabe ~/.vim/.vimrc<cr>
nmap <F8> :TagbarToggle<CR>
:map <M-Esc>[62~ <MouseDown>
:map! <M-Esc>[62~ <MouseDown>
:map <M-Esc>[63~ <MouseUp>
:map! <M-Esc>[63~ <MouseUp>
:map <M-Esc>[64~ <S-MouseDown>
:map! <M-Esc>[64~ <S-MouseDown>
:map <M-Esc>[65~ <S-MouseUp>
:map! <M-Esc>[65~ <S-MouseUp>
" Moving around windows
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
" NERDTree
map <F2> :NERDTreeToggle<CR>
"Enable Ctrl+P to paste
map <C-y> :set paste<CR>
" Let's remember some things, like where the .vim folder is.
if has("win32") || has("win64")
let windows=1
let vimfiles=$HOME . "/vimfiles"
let sep=";"
else
let windows=0
let vimfiles=$HOME . "/.vim"
let sep=":"
endif
" Folds
set foldmethod=indent
set foldlevel=99
if has("gui_running")
set cursorline "Highlight background of current line
autocmd VimEnter * NERDTree "run nerdtree
"autocmd VimEnter * TagbarOpen
" Show tabs and newline characters with ,s
nmap <Leader>s :set list!<CR>
set listchars=tab:▸\ ,eol:¬
"Invisible character colors
highlight NonText guifg=#4a4a59
highlight SpecialKey guifg=#4a4a59
endif
if has("gui_macvim") "Use Experimental Renderer option must be enabled for transparencY
let s:uname = system("uname")
if s:uname == "Darwin\n"
set guifont=Menlo\ for\ Powerline:h14
endif
map <SwipeLeft> :bprev<CR>
map <SwipeRight> :bnext<CR>
endif
if filereadable($HOME.'/.vimrc_local')
source $HOME/.vimrc_local
endif
" Syntax highlighting for clojurescript files
autocmd BufRead,BufNewFile *.cljs setlocal filetype=clojure
" For statusline
set encoding=utf-8
set t_Co=256
autocmd bufwritepost .vimrc source $MYVIMRC
" Go tags
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }