parent
75c8b4d54a
commit
e4a428c0d7
@ -322,6 +322,13 @@ Does the same as ic and also removes all trailing empty lines.
|
||||
|
||||
NOTE: Don't be surprised that this also works with "deleted lines".
|
||||
|
||||
Map hunk text objects like this:
|
||||
>
|
||||
omap ic <plug>(signify-motion-inner-pending)
|
||||
xmap ic <plug>(signify-motion-inner-visual)
|
||||
omap ac <plug>(signify-motion-outer-pending)
|
||||
xmap ac <plug>(signify-motion-outer-visual)
|
||||
<
|
||||
==============================================================================
|
||||
COLORS *signify-colors*
|
||||
|
||||
|
@ -46,39 +46,55 @@ com! -nargs=0 -bar SyDebug call sy#debug#list_active_buffers()
|
||||
nnoremap <silent> <plug>(signify-toggle) :<c-u>call sy#toggle()<cr>
|
||||
nnoremap <silent> <plug>(signify-toggle-highlight) :<c-u>call sy#highlight#line_toggle()<cr>
|
||||
|
||||
nnoremap <silent> <expr> <plug>(signify-next-hunk) &diff ? ']c' : ":\<c-u>call sy#jump#next_hunk(v:count1)\<cr>"
|
||||
nnoremap <silent> <expr> <plug>(signify-prev-hunk) &diff ? '[c' : ":\<c-u>call sy#jump#prev_hunk(v:count1)\<cr>"
|
||||
|
||||
if exists('g:signify_mapping_toggle')
|
||||
execute 'nmap '. g:signify_mapping_toggle .' <plug>(signify-toggle)'
|
||||
elseif !hasmapto('<plug>(signify-toggle)') && empty(maparg('<leader>gt', 'n'))
|
||||
nmap <leader>gt <plug>(signify-toggle)
|
||||
endif
|
||||
|
||||
if exists('g:signify_mapping_toggle_highlight')
|
||||
execute 'nmap '. g:signify_mapping_toggle_highlight .' <plug>(signify-toggle-highlight)'
|
||||
elseif !hasmapto('<plug>(signify-toggle-highlight)') && empty(maparg('<leader>gh', 'n'))
|
||||
nmap <leader>gh <plug>(signify-toggle-highlight)
|
||||
endif
|
||||
|
||||
" hunk jumping
|
||||
nnoremap <silent> <expr> <plug>(signify-next-hunk) &diff ? ']c' : ":\<c-u>call sy#jump#next_hunk(v:count1)\<cr>"
|
||||
nnoremap <silent> <expr> <plug>(signify-prev-hunk) &diff ? '[c' : ":\<c-u>call sy#jump#prev_hunk(v:count1)\<cr>"
|
||||
|
||||
if empty(maparg(']c', 'n'))
|
||||
nmap ]c <plug>(signify-next-hunk)
|
||||
endif
|
||||
if empty(maparg('[c', 'n'))
|
||||
nmap [c <plug>(signify-prev-hunk)
|
||||
endif
|
||||
if exists('g:signify_mapping_next_hunk')
|
||||
execute 'nmap '. g:signify_mapping_next_hunk .' <plug>(signify-next-hunk)'
|
||||
elseif !hasmapto('<plug>(signify-next-hunk)') && empty(maparg('<leader>gj', 'n'))
|
||||
nmap <leader>gj <plug>(signify-next-hunk)
|
||||
endif
|
||||
|
||||
if exists('g:signify_mapping_prev_hunk')
|
||||
execute 'nmap '. g:signify_mapping_prev_hunk .' <plug>(signify-prev-hunk)'
|
||||
elseif !hasmapto('<plug>(signify-prev-hunk)') && empty(maparg('<leader>gk', 'n'))
|
||||
nmap <leader>gk <plug>(signify-prev-hunk)
|
||||
endif
|
||||
|
||||
if empty(maparg(']c', 'n'))
|
||||
nmap ]c <plug>(signify-next-hunk)
|
||||
endif
|
||||
" hunk text object
|
||||
onoremap <silent> <plug>(signify-motion-inner-pending) :<c-u>call <sid>hunk_text_object(0)<cr>
|
||||
xnoremap <silent> <plug>(signify-motion-inner-visual) :<c-u>call <sid>hunk_text_object(0)<cr>
|
||||
onoremap <silent> <plug>(signify-motion-outer-pending) :<c-u>call <sid>hunk_text_object(1)<cr>
|
||||
xnoremap <silent> <plug>(signify-motion-outer-visual) :<c-u>call <sid>hunk_text_object(1)<cr>
|
||||
|
||||
if empty(maparg('[c', 'n'))
|
||||
nmap [c <plug>(signify-prev-hunk)
|
||||
if !hasmapto('<plug>(signify-motion-inner-pending)') && empty(maparg('ic', 'o'))
|
||||
omap ic <plug>(signify-motion-inner-pending)
|
||||
endif
|
||||
if !hasmapto('<plug>(signify-motion-inner-visual)') && empty(maparg('ic', 'v'))
|
||||
xmap ic <plug>(signify-motion-inner-visual)
|
||||
endif
|
||||
if !hasmapto('<plug>(signify-motion-outer-pending)') && empty(maparg('ac', 'o'))
|
||||
omap ac <plug>(signify-motion-outer-pending)
|
||||
endif
|
||||
if !hasmapto('<plug>(signify-motion-outer-visual)') && empty(maparg('ac', 'v'))
|
||||
xmap ac <plug>(signify-motion-outer-visual)
|
||||
endif
|
||||
|
||||
" Function: save {{{1
|
||||
@ -95,7 +111,7 @@ function! s:refresh_windows() abort
|
||||
execute winnr .'wincmd w'
|
||||
endfunction
|
||||
|
||||
" Text object: ac / ic {{{1
|
||||
" Function: hunk_text_object {{{1
|
||||
function! s:hunk_text_object(emptylines) abort
|
||||
if !exists('b:sy')
|
||||
return
|
||||
@ -121,8 +137,3 @@ function! s:hunk_text_object(emptylines) abort
|
||||
execute hunks[0].end
|
||||
endif
|
||||
endfunction
|
||||
|
||||
onoremap <silent> ac :<c-u>call <sid>hunk_text_object(1)<cr>
|
||||
xnoremap <silent> ac :<c-u>call <sid>hunk_text_object(1)<cr>
|
||||
onoremap <silent> ic :<c-u>call <sid>hunk_text_object(0)<cr>
|
||||
xnoremap <silent> ic :<c-u>call <sid>hunk_text_object(0)<cr>
|
||||
|
Loading…
Reference in New Issue
Block a user