-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
276 lines (209 loc) · 6.6 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
" I use a back background in my editors
set background=dark
filetype plugin on
" Save jumps and marks by default
set viminfo='100,f1
" I like highlighted search results
set hlsearch
" Use incremental searching
set incsearch
" Set standard setting for PEAR coding standards
set tabstop=4
set shiftwidth=4
" Auto expand tabs to spaces
" set expandtab
" Dont implement VI's bugs
set nocompatible
" No gvim toolbar
set guioptions-=T
set autochdir
" Auto indent after a {
set autoindent
set smartindent
" Linewidth to endless
set textwidth=0
" Do not wrap lines automatically
set nowrap
set showcmd
set laststatus=2
" Show line numbers by default
set number
" Jump 5 lines when running out of the screen
set scrolljump=5
" Indicate jump out of the screen when 3 lines before end of the screen
set scrolloff=3
" Repair wired terminal/vim settings
set backspace=start,eol
"set makeprg=jsl\ -nologo\ -nofilelisting\ -nosummary\ -nocontext\ -conf\ '/etc/jsl.conf'\ -process\ %
"set errorformat=%f(%l):\ %m
"make F10 call make for linting etc.
"inoremap <silent> <F10> <C-O>:make<CR>
"map <silent> <F10> :make<CR>
" Map <CTRL>-B to run PHP parser check
" noremap <C-B> :!php -l %<CR>
" noremap <C-TAB> :e #
:map <C-g> :tag
" :map <C-H> :set tags=tags<cr>
" :map <C-n> :! "find lib/*.php js/*.js css/*.css -maxdepth 1 -type f | grep -v js_c | grep -v css_c | xargs ctags"<cr>
" Location list navigation
noremap <S-j> :lnext<cr>
noremap <S-k> :lprevious<cr>
" Map zz to space, center around cursor
nmap <space> zz
" :map <C-o> :buffers<cr>
noremap <C-j> <C-d> zz
noremap <C-k> <C-u> zz
set showtabline=2 " File tabs allways visible
:nmap <C-S-tab> :tabprevious<cr>
:nmap <C-tab> :tabnext<cr>
:nmap <C-t> :tabnew<cr>
:map <C-t> :tabnew<cr>
:map <C-S-tab> :tabprevious<cr>
:map <C-tab> :tabnext<cr>
:map <C-q> :tabclose<cr>
" :map <C-w> :tabclose<cr>
:imap <C-S-tab> <ESC>:tabprevious<cr>i
:imap <C-tab> <ESC>:tabnext<cr>i
:imap <C-t> <ESC>:tabnew<cr>
:imap <C-space> <C-x><C-u>
" Trying to unlearn this..
" :map <S-Right> :tabnext<cr>
" :map <S-Left> :tabprevious<cr>
" :imap <S-Left> <ESC>:tabprevious<cr>i
" :imap <S-Right> <ESC>:tabnext<cr>i
" “”“”“”“”“”“”“”“”“”“”“”“”“”“”"
" Eclim Settings
" “”“”“”“”“”“”“”“”“”“”“”“”“”“”"
" "use default Taglist instead of Eclim, avoid problem
let g:EclimTaglistEnabled=0
" “let g:taglisttoo_disabled = 1 ”maybe of the same use of the above command
" "if the current file is in a Eclipse project, open project tree
" automatically
let g:EclimProjectTreeAutoOpen=1
let g:EclimProjectTreeExpandPathOnOpen=1
let g:EclimProjectTreeSharedInstance=1 "share tree instance through all
" tabs
" " use tabnew instead of split for new action
let g:EclimProjectTreeActions = [{'pattern': '.*', 'name': 'Tab', 'action': 'tabnew'}]
" set winaltkeys=no
":map <C-J> :tabprevious<cr>
":map <C-K> :tabnext<cr>
":imap <C-J> <ESC>:tabprevious<cr>i
":imap <C-K> <ESC>:tabnext<cr>i
:map <C-h> :tabprevious<cr>
:map <C-l> :tabnext<cr>
:imap <C-h> <ESC>:tabprevious<cr>i
:imap <C-l> <ESC>:tabnext<cr>i
" Tab Control (others)
":map <C-1> 1gt
":map <C-2> 2gt
":map <C-3> 3gt
":map <C-4> 4gt
":map <C-5> 5gt
":map <C-6> 6gt
":map <C-7> 7gt
":map <C-8> 8gt
":map <C-9> 9gt
set encoding=utf-8
set tags=tags
" jump to start of line
nmap = ^
" The completion dictionary is provided by Rasmus:
" http://lerdorf.com/funclist.txt
set dictionary-=/home/pookey/funclist.txt dictionary+=/home/pookey/funclist.txt
" Use the dictionary completion
set complete-=k complete+=k
" This function determines, wether we are on the start of the line text (then tab indents) or
" if we want to try autocompletion
function InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
" Delete stuff into black hole register
noremap D "_d
" Block comment
" au FileType haskell,vhdl,ada let b:comment_leader = '-- '
" au FileType vim let b:comment_leader = '" '
" au FileType js,c,cpp,java let b:comment_leader = '// '
" au FileType sh,make let b:comment_leader = '# '
" au FileType tex let b:comment_leader = '% '
" let b:comment_leader = '// '
" noremap <silent> ,c :<C-B>sil <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:noh<CR>
" noremap <silent> ,u :<C-B>sil <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:noh<CR>
noremap <silent> ,c :<C-B>sil <C-E>s/^/<C-R>=escape('// ','\/')<CR>/<CR>:noh<CR>
noremap <silent> ,u :<C-B>sil <C-E>s/^\V<C-R>=escape('// ','\/')<CR>//e<CR>:noh<CR>
" paste from system buffer
" nmap <c-p> "+p<cr>
" map <c-y> "+y<cr>
nnoremap <c-p> :set invpaste paste?<CR>
set pastetoggle=<c-p>
set showmode
" Remap the tab key to select action with InsertTabWrapper
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
" set list
" set listchars=tab:>-,trail:-
" set listchars=tab:>-,trail:-,eol:$
set ignorecase " caseinsensitive searches
set showmode " always show command or insert mode
set ruler " show line and column information
set showmatch " show matching brackets
set formatoptions=tcqor
set whichwrap=b,s,<,>,[,]
syntax on
" CTRL-C = SVN Commit
" map <C-C> :w<CR>:!svn commit<CR>
" What is leader?
map <Leader>e :Explore<cr>
map <Leader>s :Sexplore<cr>
" pressing < or > will let you indent/unident selected lines
"
vnoremap < <gv
vnoremap > >gv
" Map <c-s> to write current buffer.
map <c-s> :w<cr>
imap <c-s> <c-o><c-s>
imap <c-s> <esc><c-s>
" I haven't found how to hide this function (yet)
function! RestoreRegister()
let @" = s:restore_reg
return ''
endfunction
function! s:Repl()
let s:restore_reg = @"
return "p@=RestoreRegister()\<cr>"
endfunction
" NB: this supports "rp that replaces the selection by the contents of @r
" vnoremap <silent> <expr> p <sid>Repl()
let s:putSwap = 1
function TogglePutSwap()
if s:putSwap
vnoremap <silent> <expr> p <sid>Repl()
let s:putSwap = 0
echo 'noreplace put'
else
vnoremap <silent> <expr> p p
let s:putSwap = 1
echo 'replace put'
endif
return
endfunction
noremap ,p :call TogglePutSwap()<cr>
function SurroudIf(fl, ll)
echo 'Iffing'
let intro = 'if(){\n'
let outro = '}'
echo ll
return
endfunction
vmap ,i :call SurroudIf()<cr>
" Eclim code validation
noremap ,s :EclimValidate<cr>
" Automatically open nerdtree
" autocmd vimenter * NERDTree
autocmd vimenter * if !argc() | NERDTree | endif
" Automatically close vim if nerdtree is the only buffer left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif