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

j doesn't go to next "virtual" line like down-arrow does #21

Closed
lf94 opened this issue Jan 11, 2016 · 12 comments
Closed

j doesn't go to next "virtual" line like down-arrow does #21

lf94 opened this issue Jan 11, 2016 · 12 comments
Labels

Comments

@lf94
Copy link

lf94 commented Jan 11, 2016

  1. Turn on text wrapping in user settings.
  2. Press j on a line that's wrapped - it'll go to the next "real" line
  3. Go back and press down-arrow. It'll go to the next "virtual" line, which is the same line but wrapped creating multiple lines within the line.
@aioutecism
Copy link
Owner

VSCode doesn't give an API to access visual line as far as I know.
I haven't find a work around yet.

@lf94
Copy link
Author

lf94 commented Jan 12, 2016

Is there no way to simulate down-arrow?

@aioutecism
Copy link
Owner

Good idea!
There are built-in cursorDown and cursorDownSelect I can make use of.

BTW, I think it should be gj and gk that do the "screen movement".

@lf94
Copy link
Author

lf94 commented Jan 14, 2016

Where did you find those functions? I'd like to help you with this project, but VSCode documentation is sort of sparse. I looked into TextDocument last night and a few other basic classes. I was considering switching back to Emacs but I would really like to make this work. Do you have an IRC channel we can talk in? Or email?

@aioutecism
Copy link
Owner

There is a commands.getCommands() to return all available commands.
The default keybinding file also contains these commands.

@aioutecism
Copy link
Owner

You can send me email but I'd rather you discuss here so everyone can see and search.

@lf94
Copy link
Author

lf94 commented Jan 15, 2016

Alright, I'll keep our discussions here.

Is there a reason why you've created your own handlers and use .translate(), rather than use the movement commands already provided? You would avoid having to fight the editor. On my fork I'm modifying it to use the editor commands rather than the low-level .translate() you've created.

@aioutecism
Copy link
Owner

VSCode's built-in commands only provides "actions" which is impossible to reuse in Vim's system.
In specific, I need to split "motion" with "action" so that motions can do things other than moving cursor.
For example, passing a set of motions to delete action would delete anything those motions cover.

@ghost
Copy link

ghost commented Feb 3, 2016

This is what gj and gk are for. This issue should be closed.

@aioutecism
Copy link
Owner

Since gj and gk are in the command list (#1), I'm closing this one.

@karlhorky
Copy link
Contributor

The keybindings below seem to work for amVim normal mode for moving among displayed lines in word wrapping mode (similar behavior to gj and gk).

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"
  }

@alisonatwork
Copy link
Collaborator

The work to support these motions using standard vim keys is being done in #116, and will be available in the next release.

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

4 participants