Skip to content

How to prepend \<C-U> to vim.cmd API? #24055

Closed Answered by TheLeoP
linrongbin16 asked this question in Q&A
Discussion options

You must be logged in to vote

In that case, it seems I will miss the <C-U>, thus I cannot get the correct block-wise visual selection?

In this context, those keys only delete '<,'> because it gets automatically inserted in the command line when you press : on visual mode. If you check :h c_ctrl-u you will see that this is what <c-u> does in command mode.

mayby I can try adding a normal! before calling the function: vim.cmd('normal! call getVisualSelection(visualmode())').
because based on another answer: https://stackoverflow.com/a/47051271/4438921, it says
'< and '> don't get updated when the user is still in visual mode.
That is the reason, that I cannot get the correct visual selection in getVisualSelection func…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@oncomouse
Comment options

@linrongbin16
Comment options

@linrongbin16
Comment options

@TheLeoP
Comment options

Answer selected by linrongbin16
@linrongbin16
Comment options

@linrongbin16
Comment options

@linrongbin16
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants