forked from square/maximum-awesome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc.local
230 lines (189 loc) · 6.3 KB
/
vimrc.local
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
let $VIM = expand('~/.vim/')
let $TMP = expand($VIM . 'tmp/')
let $BUNDLES = expand($VIM . 'bundle/')
let g:author = 'Maciek Wcislik <[email protected]>'
if !isdirectory($TMP)
call mkdir($TMP, "p")
endif
set nocursorline " don't highlight current line
set relativenumber
set number
" keyboard shortcuts
inoremap jk <ESC>
inoremap kj <ESC>
inoremap <ESC> <Nop>
" highlight search
"set hlsearch
"nmap <leader>hl :let @/ = ""<CR>
" gui settings
if (&t_Co == 256 || has('gui_running'))
if ($TERM_PROGRAM == 'iTerm.app')
colorscheme solarized
else
colorscheme desert
endif
endif
" Disambiguate ,a & ,t from the Align plugin, making them fast again.
"
" This section is here to prevent AlignMaps from adding a bunch of mappings
" that interfere with the very-common ,a and ,t mappings. This will get run
" at every startup to remove the AlignMaps for the *next* vim startup.
"
" If you do want the AlignMaps mappings, remove this section, remove
" ~/.vim/bundle/Align, and re-run rake in maximum-awesome.
function! s:RemoveConflictingAlignMaps()
if exists("g:loaded_AlignMapsPlugin")
AlignMapsClean
endif
endfunction
command! -nargs=0 RemoveConflictingAlignMaps call s:RemoveConflictingAlignMaps()
silent! autocmd VimEnter * RemoveConflictingAlignMaps
set backspace=indent,eol,start
set shiftwidth=4
set softtabstop=4
set tabstop=8
set notimeout
set ttimeout
set ttimeoutlen=10
set completeopt=longest,menuone
set ofu=syntaxcomplete#Complete
set wildignore+=.hg,.git,.svn,rel
set wildignore+=*.aux,*.out,*.toc
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest
set wildignore+=*.spl
set wildignore+=*.DS_Store
set wildignore+=*.luac
set wildignore+=migrations
set wildignore+=*.pyc
set wildignore+=*.beam
autocmd FileType gitcommit set spell
autocmd FileType markdown set spell
autocmd FileType make set modelines=0
autocmd FileType unite call s:unite_settings()
autocmd BufWritePost *.py call Flake8()
nnoremap <leader>x <C-W>c
nnoremap <leader>y :tab sp<CR>
nnoremap <leader>h :tabclose<CR>
nnoremap <leader>, :set paste!<CR>
function! Preserve(command)
let _s=@/
let l = line(".")
let c = col(".")
execute a:command
let @/=_s
call cursor(l, c)
endfunction
nmap <leader>i :call Preserve("normal gg=G")<CR>
nmap <leader>C :call Preserve("%s/\\s\\+$//e")<CR>
set backup
set backupdir=$TMP
set history=5000
set noswapfile
set undodir=$TMP
set undofile
set undolevels=5000
silent! execute '!find '. $TMP .' -type f -mtime +60 -exec rm {} \;'
silent! execute '!mkdir '. $TMP .'> /dev/null 2>&1'
function! ShortCwd()
return substitute(getcwd(), $HOME, "~", "")
endfunction
set laststatus=2
set statusline=
set statusline +=%#error#
set statusline +=%{&paste?'[paste]':''}
set statusline +=%*
if exists(":Git")
set statusline +=\ %{fugitive#statusline()}
endif
set statusline +=\ %<%f\ %*
set statusline +=\ \ %m%r%w\
set statusline +=%=%l%*
set statusline +=:%=%c%*
set statusline +=\ %y\ %*
set statusline +=\ %{&ff}\ %*
set statusline +=%{strlen(&fenc)?&fenc:'none'}
set statusline +=\ \|\ %{ShortCwd()}
set list
set listchars=
set lcs+=tab:>-
set lcs+=extends:›
set lcs+=precedes:‹
set lcs+=nbsp:·
set lcs+=trail:·
set sua+=.erl
set sua+=.hrl
let erlp=substitute(system("command -v erl"), "/bin/erl", "/lib/**/src/", "")
exe ":set path+="."src/,deps/**/src/,apps/**/src/,**/include/," . erlp
function! GoToFile()
call inputsave()
let f = input('File/Module: ')
call inputrestore()
exec "find " . f
endfunction
noremap <C-g> :call GoToFile()<CR>
let g:unite_enable_start_insert = 1
let g:unite_winheight = 10
let g:unite_split_rule = 'botright'
let g:unite_source_grep_command = 'ack-grep'
let g:unite_source_grep_default_opts = '--no-heading --no-color -a -H'
let g:unite_source_grep_recursive_opt = ''
function! s:unite_settings()
imap <buffer> jj <Plug>(unite_insert_leave)
imap <buffer> <C-w> <Plug>(unite_delete_backward_path)
imap <buffer> <leader> <Esc><leader>
endfunction
nnoremap <leader>b :<C-u>Unite buffer<CR>
nnoremap <leader>a :<C-u>Unite grep -default-action=above<CR>
nnoremap <leader>A :<C-u>execute
\ 'Unite grep:.::' . expand("<cword>") . '
\ -default-action=above -auto-preview'<CR>
nnoremap <C-p> :<C-u>:Unite history/yank<CR>
let g:ref_use_vimproc = 1
let g:ref_open = 'split'
let g:ref_cache_dir = expand($TMP . '/vim_ref_cache/')
nno <leader>K :<C-u>Unite ref/erlang
\ -vertical -default-action=split<CR>
let g:neosnippet#snippets_directory = expand($VIM . 'snippets')
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behaviour.
imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" ?
\: "\<TAB>"
" For snippet_complete marker
if has('conceal')
set conceallevel=2 concealcursor=i
endif
let g:neosnippet#enable_snipmate_compatibility = 1
nnoremap <leader>gs :Gstatus<CR><C-W>15+
autocmd BufReadPost fugitive://* set bufhidden=delete
autocmd BufReadPost fugitive://*
\ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' |
\ nnoremap <buffer> .. :edit %:h<CR> |
\ endif
if has("lua")
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
"return neocomplete#close_popup() . "\<CR>"
"For no inserting <CR> key.
return pumvisible() ? neocomplete#close_popup() : "\<CR>"
endfunction
autocmd FileType erlang setlocal omnifunc=erlang_complete#Complete
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
call neocomplete#util#set_default_dictionary(
\'g:neocomplete#force_omni_input_patterns',
\'erlang',
\'\<[[:digit:][:alnum:]_-]\+:[[:digit:][:alnum:]_-]*')
endif
match ErrorMsg '\%>79v.\+'
2match ErrorMsg '\s\+$'
3match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'