Skip to content

Commit

Permalink
WIP: discard visual selection
Browse files Browse the repository at this point in the history
it does not work as is...

ref #148
  • Loading branch information
jreybert committed Oct 31, 2017
1 parent 644752e commit d5e8a8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions autoload/magit/mapping.vim
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ function! magit#mapping#set_default()
call s:mg_set_mapping('n', g:magit_discard_hunk_mapping,
\ "magit#stage_hunk(1)", '\<\%(un\)\?staged\>')
call s:mg_set_mapping('n', g:magit_stage_line_mapping,
\ "magit#stage_vselect()", '\<\%(un\)\?staged\>')
\ "magit#stage_vselect(0)", '\<\%(un\)\?staged\>')
call s:mg_set_mapping('x', g:magit_stage_hunk_mapping,
\ "magit#stage_vselect()", '\<\%(un\)\?staged\>')
\ "magit#stage_vselect(0)", '\<\%(un\)\?staged\>')
call s:mg_set_mapping('x', g:magit_discard_hunk_mapping,
\ "magit#stage_vselect(1)", '\<\%(un\)\?staged\>')
call s:mg_set_mapping('n', g:magit_mark_line_mapping,
\ "magit#mark_vselect()", '\<\%(un\)\?staged\>')
call s:mg_set_mapping('x', g:magit_mark_line_mapping,
Expand Down
4 changes: 2 additions & 2 deletions plugin/magit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ endfunction
" INFO: in unstaged section, it stages the file, and in staged section, it
" unstages the file
" return: no
function! magit#stage_vselect() range
function! magit#stage_vselect(discard) range
" func-range a:firstline a:lastline seems to work at least from vim 7.2
let lines = []
let curline = a:firstline
Expand All @@ -1063,7 +1063,7 @@ function! magit#stage_vselect() range
echomsg "https://github.com/jreybert/vimagit/issues/new"
return
endtry
return magit#stage_block(selection, 0)
return magit#stage_block(selection, a:discard)
endfunction

" magit#mark_vselect: wrapper function to mark selected lines (see
Expand Down

0 comments on commit d5e8a8a

Please sign in to comment.