blob: cef2fda9e1e486f5645dde98f9ebc9df171498d4 (
plain) (
blame)
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
|
" Joiner. Ability to join lines in a text object.
"
" Joiner provides several bindings, with the leader being configurable. This
" documentation assums <C-j> as the leader.
"
" <C-j>s<text_object><string>: join the lines in <text_object> with <string>.
" The lines are stripped of whitesapce before being
" joined
"
" <C-j>S<text_object><string>: join the lines in <text_object> with <string>.
" The lines are joined verbatim.
"
" <C-j><text_object>: join the lines in <text_object>. The lines are stripped
" before being joined.
"
" There are Visual counterparts to these.
if ! exists('g:joiner_include_bindings')
let g:joiner_include_bindings = 1
endif
if ! exists('g:joiner_leader')
let g:joiner_leader = '<C-j>'
endif
noremap <silent> <Plug>(joiner)s :<c-u>let g:JoinerJoinText=function('joiner#join_with_string')<cr>:<c-u>set operatorfunc=joiner#do<cr>g@
noremap <silent> <Plug>(joiner)S :<c-u>let g:JoinerJoinText=function('joiner#join_with_string_literal')<cr>:<c-u>set operatorfunc=joiner#do<cr>g@
noremap <silent> <Plug>(joiner) :<c-u>let g:JoinerJoinText=function('joiner#default_join')<cr>:<c-u>set operatorfunc=joiner#do<cr>g@
vnoremap <silent> <Plug>(joiner)s :<c-u>let g:JoinerJoinText=function('joiner#join_with_string')<cr>gv:<c-u>call joiner#do(visualmode(), 1)<cr>
vnoremap <silent> <Plug>(joiner)S :<c-u>let g:JoinerJoinText=function('joiner#join_with_string_literal')<cr>gv:<c-u>call joiner#do(visualmode(), 1)<cr>
vnoremap <silent> <Plug>(joiner)<space> :<c-u>let g:JoinerJoinText=function('joiner#default_join')<cr>gv:<c-u>call joiner#do(visualmode(), 1)<cr>
if g:joiner_include_bindings exec printf("vnoremap <silent> %s <Plug>(joiner)", g:joiner_leader)
exec printf("noremap <silent> %s <Plug>(joiner)", g:joiner_leader)
endif
|