Mercurial > dotfiles.old
comparison vimrc @ 122:5ec9c636da2a
Revert "Add targets plugin"
This reverts commit 70236b32790d77ecc5318acf9a6c493af98faf62.
author | zegervdv <zegervdv@me.com> |
---|---|
date | Mon, 29 Sep 2014 20:34:31 +0200 |
parents | eae8e7173918 |
children | 39f36bd51c23 |
comparison
equal
deleted
inserted
replaced
121:eae8e7173918 | 122:5ec9c636da2a |
---|---|
160 | 160 |
161 nnoremap <TAB> % | 161 nnoremap <TAB> % |
162 vnoremap <TAB> % | 162 vnoremap <TAB> % |
163 | 163 |
164 " Move between tabs | 164 " Move between tabs |
165 map <leader>w <ESC>:tabprevious<CR> | 165 map <leader> w <ESC>:tabprevious<CR> |
166 map <leader>n <ESC>:tabnext<CR> | 166 map <leader> n <ESC>:tabnext<CR> |
167 | 167 |
168 " Move between splits | 168 " Move between splits |
169 map <C-j> <C-w>j | 169 map <C-j> <C-w>j |
170 map <C-k> <C-w>k | 170 map <C-k> <C-w>k |
171 map <C-l> <C-w>l | 171 map <C-l> <C-w>l |
256 let fillcharcount = windowwidth - len(line) - len(foldedlinecount) | 256 let fillcharcount = windowwidth - len(line) - len(foldedlinecount) |
257 return line . '…' . repeat(" ",fillcharcount) . foldedlinecount . '…' . ' ' | 257 return line . '…' . repeat(" ",fillcharcount) . foldedlinecount . '…' . ' ' |
258 endfunction " }}} | 258 endfunction " }}} |
259 set foldtext=MyFoldText() | 259 set foldtext=MyFoldText() |
260 | 260 |
261 " }}} | 261 " Next and Last {{{ |
262 " | |
263 " Motion for "next/last object". "Last" here means "previous", not "final". | |
264 " Unfortunately the "p" motion was already taken for paragraphs. | |
265 " | |
266 " Next acts on the next object of the given type, last acts on the previous | |
267 " object of the given type. These don't necessarily have to be in the current | |
268 " line. | |
269 " | |
270 " Currently works for (, [, {, and their shortcuts b, r, B. | |
271 " | |
272 " Next kind of works for ' and " as long as there are no escaped versions of | |
273 " them in the string (TODO: fix that). Last is currently broken for quotes | |
274 " (TODO: fix that). | |
275 " | |
276 " Some examples (C marks cursor positions, V means visually selected): | |
277 " | |
278 " din' -> delete in next single quotes foo = bar('spam') | |
279 " C | |
280 " foo = bar('') | |
281 " C | |
282 " | |
283 " canb -> change around next parens foo = bar('spam') | |
284 " C | |
285 " foo = bar | |
286 " C | |
287 " | |
288 " vin" -> select inside next double quotes print "hello ", name | |
289 " C | |
290 " print "hello ", name | |
291 " VVVVVV | |
292 | |
293 onoremap an :<c-u>call <SID>NextTextObject('a', '/')<cr> | |
294 xnoremap an :<c-u>call <SID>NextTextObject('a', '/')<cr> | |
295 onoremap in :<c-u>call <SID>NextTextObject('i', '/')<cr> | |
296 xnoremap in :<c-u>call <SID>NextTextObject('i', '/')<cr> | |
297 | |
298 onoremap al :<c-u>call <SID>NextTextObject('a', '?')<cr> | |
299 xnoremap al :<c-u>call <SID>NextTextObject('a', '?')<cr> | |
300 onoremap il :<c-u>call <SID>NextTextObject('i', '?')<cr> | |
301 xnoremap il :<c-u>call <SID>NextTextObject('i', '?')<cr> | |
302 | |
303 | |
304 function! s:NextTextObject(motion, dir) | |
305 let c = nr2char(getchar()) | |
306 let d = '' | |
307 | |
308 if c ==# "b" || c ==# "(" || c ==# ")" | |
309 let c = "(" | |
310 elseif c ==# "B" || c ==# "{" || c ==# "}" | |
311 let c = "{" | |
312 elseif c ==# "r" || c ==# "[" || c ==# "]" | |
313 let c = "[" | |
314 elseif c ==# "'" | |
315 let c = "'" | |
316 elseif c ==# '"' | |
317 let c = '"' | |
318 else | |
319 return | |
320 endif | |
321 | |
322 " Find the next opening-whatever. | |
323 execute "normal! " . a:dir . c . "\<cr>" | |
324 | |
325 if a:motion ==# 'a' | |
326 " If we're doing an 'around' method, we just need to select around it | |
327 " and we can bail out to Vim. | |
328 execute "normal! va" . c | |
329 else | |
330 " Otherwise we're looking at an 'inside' motion. Unfortunately these | |
331 " get tricky when you're dealing with an empty set of delimiters because | |
332 " Vim does the wrong thing when you say vi(. | |
333 | |
334 let open = '' | |
335 let close = '' | |
336 | |
337 if c ==# "(" | |
338 let open = "(" | |
339 let close = ")" | |
340 elseif c ==# "{" | |
341 let open = "{" | |
342 let close = "}" | |
343 elseif c ==# "[" | |
344 let open = "\\[" | |
345 let close = "\\]" | |
346 elseif c ==# "'" | |
347 let open = "'" | |
348 let close = "'" | |
349 elseif c ==# '"' | |
350 let open = '"' | |
351 let close = '"' | |
352 endif | |
353 | |
354 " We'll start at the current delimiter. | |
355 let start_pos = getpos('.') | |
356 let start_l = start_pos[1] | |
357 let start_c = start_pos[2] | |
358 | |
359 " Then we'll find it's matching end delimiter. | |
360 if c ==# "'" || c ==# '"' | |
361 " searchpairpos() doesn't work for quotes, because fuck me. | |
362 let end_pos = searchpos(open) | |
363 else | |
364 let end_pos = searchpairpos(open, '', close) | |
365 endif | |
366 | |
367 let end_l = end_pos[0] | |
368 let end_c = end_pos[1] | |
369 | |
370 call setpos('.', start_pos) | |
371 | |
372 if start_l == end_l && start_c == (end_c - 1) | |
373 " We're in an empty set of delimiters. We'll append an "x" | |
374 " character and select that so most Vim commands will do something | |
375 " sane. v is gonna be weird, and so is y. Oh well. | |
376 execute "normal! ax\<esc>\<left>" | |
377 execute "normal! vi" . c | |
378 elseif start_l == end_l && start_c == (end_c - 2) | |
379 " We're on a set of delimiters that contain a single, non-newline | |
380 " character. We can just select that and we're done. | |
381 execute "normal! vi" . c | |
382 else | |
383 " Otherwise these delimiters contain something. But we're still not | |
384 " sure Vim's gonna work, because if they contain nothing but | |
385 " newlines Vim still does the wrong thing. So we'll manually select | |
386 " the guts ourselves. | |
387 let whichwrap = &whichwrap | |
388 set whichwrap+=h,l | |
389 | |
390 execute "normal! va" . c . "hol" | |
391 | |
392 let &whichwrap = whichwrap | |
393 endif | |
394 endif | |
395 endfunction | |
396 " }}} | |
397 " }}} | |
398 | |
399 " VHDL ctags | |
400 let g:tlist_vhdl_settings = 'vhdl;d:package declarations;b:package bodies;e:entities;a:architecture specifications;t:type declarations;p:processes;f:functions;r:procedures' | |
262 " Latex {{{ | 401 " Latex {{{ |
263 " Compile using rubber | 402 " Compile using rubber |
264 nnoremap <leader>m :w<CR>:VimProcBang rubber --pdf --warn all %<CR> | 403 nnoremap <leader>m :w<CR>:VimProcBang rubber --pdf --warn all %<CR> |
265 " Open pdf | 404 " Open pdf |
266 nnoremap <silent> <leader>v :silent !open %:r.pdf<CR><CR> | 405 nnoremap <silent> <leader>v :silent !open %:r.pdf<CR><CR> |