0

How can I toggle the cursor position in VS Code — from the start to the end of a selection (and vice versa)?

I'm looking for functionality similar to pressing o in Vim's visual mode, which swaps the cursor between the beginning and the end of the selected text.

1 Answer 1

0

I have written an extension: Select By

It exports the command: selectby.swapActive

In the Command Palette: Swap the anchor and active (cursor) position of the selection(s)

Maybe better to make a keybinding for the command if you use it a lot.

  {
    "key": "ctrl+k ctrl+s",
    "when": "editorTextFocus",
    "command": "selectby.swapActive"
  }

You can choose any key combo you like.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.