Christian Brabandt wrote: > Hi Charles! > > On Fr, 04 Dez 2015, Charles E Campbell wrote: > >> Christian Brabandt wrote: >>> Hi, >>> let's say I have script, that wants to work on the last visually >>> selected region, e.g. highlight it. >>> >>> Is there any way, to find out, whether the last block-wise selected >>> region used '$' for selection (see :h v_$) or not? This matters, since >>> when using the '$' in visual block mode, all lines up to the end will be >>> selected, while when simply using the cursor to select the end point, >>> only up to the column specified in the last line will be acted on. >>> >> I have a solution of sorts; please try the attached file with its >> IsRaggedRight() function. >> >> Potential Improvement: test all lines in the range instead of just the >> first and last >> >> Caveat: if the user has selected lines that are of equal lengths, then >> IsRaggedRight() will return 0 (even though $ was not used). > Thanks. Interesting idea. But if i am not mistaken, this will fail, if > there are tabs in front of the visual selction. Using virtcol() rather than col() would help with this. > > My current idea is to map a key like this: > xmap <silent><expr> key ":\<c-u>let g:curswant=".getcurpos()[4]."\n" > and then run :norm gvkey > > This works, but is slightly clumsy... > > Made me think, if visualmode should perhaps return '^V$' in this special > case? > Perhaps -- but that would be a change that would affect plugins that would expect a ^V for visual mode, irregardless, thereby causing them to fail.
Regards, Chip Campbell -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
