-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving over folds has undesirable behavior #1
Comments
Turns out vim is doing exactly what is expected, it just doesn't auto expand folds when moving text into them, causing a lot of issuses with continued schlepping. |
For me, it also closes the fold when I schlepp text within an opened fold. |
@Ahg4goo9 I think this is an issue with vim itself. Try moving a line in an open fold with |
Kind of a hack, but I did this and it seems to be working ok: vmap <Plug>SchleppFix zagv
vmap <left> <Plug>SchleppLeft<Plug>SchleppFix
vmap <right> <Plug>SchleppRight<Plug>SchleppFix
vmap <up> <Plug>SchleppUp<Plug>SchleppFix
vmap <down> <Plug>SchleppDown<Plug>SchleppFix Edit: oops, I spoke too soon… it only works when using linewise visual mode. :/ Edit 2: It's getting even more hacky and there are plenty of problems, but in case anybody's interested, this is what I got so far to make it usable with folds. It's better than nothing, since I use them everywhere. function! SchleppDetect(direction)
let mode = mode()
let command = ""
if mode ==# 'v'
let command .= "\<c-v>"
endif
let command .= "\<Plug>Schlepp" . a:direction
if mode ==# 'V'
let command .= "zRgv"
endif
return command
endfunction
vmap <silent> <expr> <Left> SchleppDetect("Left")
vmap <silent> <expr> <Right> SchleppDetect("Right")
vmap <silent> <expr> <Up> SchleppDetect("Up")
vmap <silent> <expr> <Down> SchleppDetect("Down") |
When dragging text over a closed fold the selection gets broken, making dragging not work as expected.
The text was updated successfully, but these errors were encountered: