-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
176 lines (134 loc) · 3.76 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
" Install Vundle first!
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles here:
"
Bundle 'scrooloose/syntastic'
Bundle 'kchmck/vim-coffee-script'
Bundle 'jnwhiteh/vim-golang'
Bundle 'andylei/allhallowseve'
Bundle 'bufkill.vim'
Bundle 'python.vim'
filetype plugin indent on
if has("gui_running")
colorscheme allhallowseve
set listchars=tab:ª\ ,eol:¨
else
colorscheme default
endif
let python_highlight_string_formatting = 1
let python_highlight_string_format = 1
let python_highlight_string_templates = 1
let g:syntastic_enable_signs = 1
" put all swap files in the same place
set directory^=C:\temp,$HOME/.vim_swap//
syntax on
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
set expandtab
set smartcase " ignore case when pattern is all lowercase, sensitive otherwise
set hlsearch " highlight search terms
set incsearch " show matches as you type
set visualbell "don't beep
set noerrorbells "don't beep
" keep 4 visible lines around the cursor always
set scrolloff=4
" status line
set statusline=%f%m%r%h%w\ [%Y\ %{&ff}]\ [%c\ %l/%L\ (%p%%)]
set laststatus=2
" line numbers
set number
set hidden
set fileformats=unix,dos
" ignore .class and .pyc files
set wildignore=*.pyc,*.class
" bash style completion
set wildmode=longest,list,full
set wildmenu
" backspaces delete things
set backspace=2
" lets you switch out of unsaved buffers
set hidden
" automagically save / restore folds
au BufWinLeave *.* mkview
au BufWritePost *.* mkview
au BufWinEnter *.* silent loadview
" show invisibles
set list
" remove tool, menu, and scroll bars from gvim
set guioptions-=m
set guioptions-=T
set guioptions+=Lrbl
set guioptions-=Lrbl
" enable alt space, perhaps even alt tab
set winaltkeys=yes
" gvim font
set guifont=Consolas:h10
set gdefault " makes /g searches happen by default
set clipboard=unnamed " automatically yank to the windows clipboard
" Middle Mouse button pastes all the time on accident
" Apparently double / triple / quadruple middle mouse click also pastes
map <MiddleMouse> <Nop>
imap <MiddleMouse> <Nop>
map <2-MiddleMouse> <Nop>
imap <2-MiddleMouse> <Nop>
map <3-MiddleMouse> <Nop>
imap <3-MiddleMouse> <Nop>
map <4-MiddleMouse> <Nop>
imap <4-MiddleMouse> <Nop>
" F3 => tell me what highlight group it is
map <F3> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
nnoremap j gj
nnoremap k gk
" single char deletes don't update default register
noremap x "_x
" paste doesn't update default register
vnoremap p "_dP
" Control-n => NERDTree
nmap <silent> <c-n> :NERDTreeToggle<CR>
" NERDTree should ignore pyc files
let NERDTreeIgnore=['\.vim$', '\~$', '\.pyc$']
" superfast commands
nnoremap ; :
let mapleader = ","
" ,/ => clear search buffer
nmap <silent> <LEADER>/ :let @/=""<CR>
" ,c => cd to current file
nmap <LEADER>c :lcd %:p:h<CR>
nmap <LEADER>C :cd %:p:h<CR>
" make space toggle folds
nnoremap <silent> <Space> @=(foldlevel('.')?'za':'l')<CR>
vnoremap <Space> zf
" buffer next, prev
nnoremap <silent> ˚ :bp<CR>
nnoremap <silent> ˝ :bn<CR>
" F12 => redo syntax highlighting
noremap <F12> <Esc>:syntax sync fromstart<CR>
" F11 => full screen
if has("gui_running")
map <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
endif
function! SetTab(num)
let num = a:num
execute('set shiftwidth='.num)
execute('set softtabstop='.num)
execute('set tabstop='.num)
endfunction
if has("python")
" Let me use gf on python libraries
python << EOF
import os
import sys
import vim
for p in sys.path:
if os.path.isdir(p):
vim.command(r"set path+=%s" % (p.replace(" ", r"\ ")))
EOF
endif