-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
182 lines (150 loc) · 4.17 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
"Run pathogen
call pathogen#infect()
set rtp+=/usr/local/go/misc/vim
syntax on
" New leader
let mapleader=","
" Yank, comment, paste.
nmap <leader>y yy,c<space>p
vmap <leader>y yygv,c<space>p
" Get rid of the topbar on gui mode
"set guioptions-=T
"set guioptions-=T
syntax enable
set background=dark
" colorscheme solarized
" Solarized background strangeness fix
highlight Normal ctermbg=none
"Set linenumber stuff
"set numberwidth=3
" set relativenumber
"autocmd InsertEnter * :set number
"autocmd InsertLeave * :set relativenumber
highlight LineNr ctermbg=darkgrey
"Set reasonable colors for pyflakes highlighting
hi SpellBad cterm=underline ctermbg=0
filetype on
filetype plugin on
filetype plugin indent on
"Allow moving to the end of the line in visual block mode
set virtualedit+=block
"tabs
set softtabstop=4
set shiftwidth=4
set expandtab
set tabstop=4
set smarttab
"set smartindent
set autoindent
"Search config
set ignorecase
set incsearch
set nohlsearch " do not highlight my search text
set ignorecase
set smartcase
"misc
set history=50 " keep 50 lines of history
set ruler " display cursor position in lower right
set so=2 " show at lease 2 lines around the cursor
set showmatch " show match on brackets
set showcmd " display incomplete commands
"Omni completion
:filetype on
:filetype plugin on
set nocp
au BufReadPost *.scss set syntax=css
if has("autocmd")
autocmd Filetype java setlocal omnifunc=javacomplete#Complete
autocmd Filetype java setlocal completefunc=javacomplete#CompleteParamsInfo
endif
:inoremap <buffer> <C-X><C-U> <C-X><C-U><C-P>
:inoremap <buffer> <C-S-Space> <C-X><C-O>
"Leave insert mode with `jk` (avoid escape!)
imap jk <Esc>
"open file in new tab (similar to gf) with `gf`
map gf <C-w>gf
" unmap arrow keys
"nmap <right> <nop>
"nmap <left> <nop>
"nmap <up> <nop>
"nmap <down> <nop>
"imap <right> <nop>
"imap <left> <nop>
"imap <up> <nop>
"imap <down> <nop>
"http://vim.wikia.com/wiki/VimTip1608
set tags+=~/.vim/tags/alltags
" build tags of your own project with Ctrl-F12
map <C-F12> :!ctags -R --sort=yes --c++-kinds=+lp --fields=+iaS --extra=+q .<CR>
"Reload all buffers with F4
nmap <F4> :bufdo e!<CR>
" Opens tagbar with F2
let g:tagbar_ctags_bin = '/usr/local/bin/ctags'
map <F2> :TagbarToggle<CR>
" Open NERDTree with F3
map <F3> :NERDTreeToggle<CR>
" Open GunDo with F5
map <F5> :GundoToggle<CR>
"Window Resizing
map <C-h> <C-w>>
map <C-j> <C-W>-
map <C-k> <C-W>+
map <C-l> <C-w><
"Tab Movement and creation
:map <C-S-tab> :tabprevious<CR>
:map <C-tab> :tabnext<CR>
:imap <C-S-tab> <Esc>:tabprevious<CR>i
:imap <C-tab> <Esc>:tabnext<CR>i
:nmap <C-S-t> :tabnew<CR>
:imap <C-S-t> <Esc>:tabnew<CR>
"Tabline
if exists("+guioptions")
set go-=e
endif
if exists("+showtabline")
function MyTabLine()
let s = ''
let t = tabpagenr()
let i = 1
while i <= tabpagenr('$')
let buflist = tabpagebuflist(i)
let winnr = tabpagewinnr(i)
let s .= ' %' . i . 'T'
let s .= (i == t ? '%1*[' : '%2*%#TabLineFill#(')
let s .= i
let modified = 0
for curbuf in buflist
let modified += getbufvar(curbuf, "&modified")
endfor
if modified > 0
let s .= '*'
else
let s .= '-'
endif
let s .= '%*'
let s .= (i == t ? '%#TabLineSel#' : '')
let file = bufname(buflist[winnr - 1])
let file = fnamemodify(file, ':p:.:t')
if file == ''
let file = '[No Name]'
endif
let s .= file
if tabpagewinnr(i,'$') > 1
let s .= '/' . tabpagewinnr(i,'$')
endif
let s .= (i == t ? '%#TabLineFill#]' : ')')
let s .= ' '
let i = i + 1
endwhile
let s .= '%T%#TabLineFill#%='
let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
return s
endfunction
set stal=1
set tabline=%!MyTabLine()
endif
fun! GrepWord()
let s:term = expand('<cword>')
:exe ":!grep -r " . s:term . " *"
endfun
map sear :call GrepWord()<CR>