Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Going to next line using j unfolds folded code #54

Open
alcazoid opened this issue Mar 13, 2015 · 3 comments
Open

Going to next line using j unfolds folded code #54

alcazoid opened this issue Mar 13, 2015 · 3 comments

Comments

@alcazoid
Copy link

To reproduce:

  1. set the cursor to the start of a function
  2. fold it(default binding is Ctrl+=)
  3. press j to move to the next line
  4. code unfolds

Without Vim plugin we are able to move past the folded code without it being unfolded.

@cldwalker
Copy link
Member

Not able to reproduce locally using examples from CodeMirror's demo. Can you provide some subset of the code that exhibits this behavior? Fwiw, if this behavior is also present in CodeMirror, the appropriate place to report this will be CodeMirror

@alcazoid
Copy link
Author

def hi():
    print "hi"
    return

hi()

This python code does it for me.

  1. Go to line 1(with def)
  2. Press Ctrl+= to fold it
  3. Press j to go one line down
  4. Code gets unfolded

@leafOfTree
Copy link

In CodeMirror vim mode, j, k will unfold code as the cursor moves into folded lines. Using gj, gk will solve this problem.

j,k: moveByLines
gj, gk: moveByDisplayLines

You can create mapping if it feels more convenient.

codeMirror.Vim.map('j', 'gj', 'normal');
codeMirror.Vim.map('k', 'gk', 'normal');

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

No branches or pull requests

3 participants