-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc.after
109 lines (87 loc) · 2.66 KB
/
.vimrc.after
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
colorscheme ir_black
filetype plugin on
command! -nargs=* Wrap call s:EnableWrap()
function s:EnableWrap()
set wrap linebreak nolist
nnoremap k gk
nnoremap j gj
endfunction
" Don't interpret numbers with leading 0 as octal numbers (e.g <C-A> on 007
" yields 008 and not 010
set nrformats=
" Increase command history capacity
set history=400
" Always show some context
set scrolloff=3
set sidescrolloff=5
" Enable 'scrolling with filtering' using <C-p> and <C-n>
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
" Join two lines with <C-j>
nnoremap <C-j> <S-j>
" tab navigation
nnoremap <C-tab> :tabnext<CR>
nnoremap <S-k> :tabnext<CR>
nnoremap <S-j> :tabprevious<CR>
nnoremap <C-t> :tabnew<CR>
" buffer navigation
nnoremap <silent> <Leader>b :bprevious<CR>
nnoremap <silent> <Leader>B :bnext<CR>
" repeate last substitution with same flags
nnoremap & :&&<CR>
xnoremap & :&&<CR>
" map ` to <Leader>m because it doesn't work on german keyboards
nnoremap <Leader>m `
" map <C-]> to <Leader>g
nnoremap <Leader>g <C-]>
" enable mouse in all modes
set mouse=a
" Bind ack to <Leader>f
nnoremap <Leader>f :Ack
" Remap %:h<Tab> to %% for edit, write, saveas and read commands
cnoremap <expr> %% getcmdtype() == ':' ? expand('%:h').'/' : '%%'
" Write file as super user
cnoremap wsu w !sudo tee % > /dev/null
" Run default rake task
nnoremap <Leader>r :wa<CR>:!rake<CR>
" create not existing directories
" code from
" http://stackoverflow.com/questions/4292733/vim-creating-parent-directories-on-save
function s:MkNonExDir(file, buf)
if empty(getbufvar(a:buf, '&buftype')) && a:file!~#'\v^\w+\:\/'
let dir=fnamemodify(a:file, ':h')
if !isdirectory(dir)
call mkdir(dir, 'p')
endif
endif
endfunction
augroup BWCCreateDir
autocmd!
augroup END
autocmd BufWritePre * :call s:MkNonExDir(expand('<afile>'), +expand('<abuf>'))
" Qargs command which populates the args with all files in the quickfix
" list
command! -nargs=0 -bar Qargs execute 'args' QuickfixFilenames()
function! QuickfixFilenames()
let buffer_numbers = {}
for quickfix_item in getqflist()
let buffer_numbers[quickfix_item['bufnr']] = bufname(quickfix_item['bufnr'])
endfor
return join(map(values(buffer_numbers), 'fnameescape(v:val)'))
endfunction
" clojure settings
" vim-clojure-static plugin
let g:clojure_align_multiline_strings = 1
" Syntastic
" Automatically show error list
let g:syntastic_auto_loc_list = 1
" Make the list a little shorter
let g:syntastic_loc_list_height = 5
" -----------
" C++ Tooling
" -----------
" don't ask before using YCM
let g:ycm_confirm_extra_conf = 0
" clang-format
map <Leader>k :%pyf ~/.janus/clang-format.py<CR>
imap <C-K> <ESC>:pyf ~/.janus/clang-format.py<CR>i