Skip to content
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

Screen Line/Character movement support #116

Closed
rebornix opened this issue Jul 29, 2016 · 6 comments
Closed

Screen Line/Character movement support #116

rebornix opened this issue Jul 29, 2016 · 6 comments
Assignees
Labels

Comments

@rebornix
Copy link
Contributor

We added screen line/character movement command in Visual Studio Code in July. The commands is like

cursroMove({to: 'lineStart', inSelectionMode: true});

More details are listed in microsoft/vscode#2771 . Leveraging thse commands, following Vim commands can be implemented real quick

  • g0
  • g^
  • g$
  • gm
  • gj
  • gk
@zolrath
Copy link

zolrath commented Nov 30, 2016

Would definitely like to see this added! 👍

@karlhorky
Copy link
Contributor

karlhorky commented Jun 24, 2019

A workaround for now regarding gj and gk:

The keybindings below will make j and k behave like gj and gk for amVim normal mode for moving among displayed lines in word wrapping mode.

Ref: My pull request to VSCodeVim VSCodeVim/Vim#3623

  {
    "key": "up",
    "command": "cursorUp",
    "when": "editorTextFocus && amVim.mode == 'NORMAL' && !inDebugRepl && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
  },
  {
    "key": "down",
    "command": "cursorDown",
    "when": "editorTextFocus && amVim.mode == 'NORMAL' && !inDebugRepl && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
  },
  {
    "key": "k",
    "command": "cursorUp",
    "when": "editorTextFocus && amVim.mode == 'NORMAL' && !inDebugRepl &&!suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
  },
  {
    "key": "j",
    "command": "cursorDown",
    "when": "editorTextFocus && amVim.mode == 'NORMAL' && !inDebugRepl && !suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
  }

@karlhorky
Copy link
Contributor

@aioutecism I will test this for a while and if it continues to work well, I would open a pull request documenting this in the readme, if you'd be open to that.

@aioutecism
Copy link
Owner

@karlhorky Thank you for this. I’m not sure this will work for commands such as ‘dj’. Have you get it to work as expected?

@karlhorky
Copy link
Contributor

Yes, this is a caveat of this approach, motions like dj or 10j do not work. I would include this in the documentation.

@alisonatwork
Copy link
Collaborator

Support for gj, gk, g0, g^, g$ and gm has been merged and will be available in the next release. There are some unavoidable quirks around flashing/jumping cursor, and there remains some off-by-one strangeness in visual mode, but I think it's good enough to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants