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

Vim inside motion doesn't work for [, (, {, t, others? (OS X) #1003

Closed
prurph opened this issue Oct 22, 2017 · 6 comments
Closed

Vim inside motion doesn't work for [, (, {, t, others? (OS X) #1003

prurph opened this issue Oct 22, 2017 · 6 comments
Labels
bug 🐛 Issue concerns a bug.

Comments

@prurph
Copy link

prurph commented Oct 22, 2017

Expected behavior: typing ci( with the cursor in normal mode and inside (foo) should delete foo and leave the cursor in insert mode inside the remaining ().

Actual behavior in Boostnote on OS X: nothing happens and the cursor remains in normal mode.

The same thing happens for other keys like {, [ and t (for tag)

These commands work in the Codemirror demo--except for t--just not in Boostnote. It only appears to support ci" and ci'.

@asmsuechan
Copy link
Contributor

asmsuechan commented Oct 23, 2017

Hi, @prurph. Thanks for opening an issue. What you want in Vim mode is not actually Boostnote's issue because we use CodeMirror as the code editor so you should open an issue on CodeMirror. However, I'll try to manage them because chances are that there're ways, which I don't know, to implement it. If you have it, please let us know.

@prurph
Copy link
Author

prurph commented Oct 23, 2017

Thank you for responding--the reason I opened it here is because it works in the CodeMirror demo.

For example, go to demo link, put your cursor on the v in (void) and do ci(. Now try the same thing in Boostnote with Vim bindings on. It works in CodeMirror alone but not in Boostnote.

I can try looking at the source to see if it's something the embedding code needs to implement; my hunch was it should work out of the box and something else Boostnote is listening for or doing might be breaking it.

@asmsuechan
Copy link
Contributor

the reason I opened it here is because it works in the CodeMirror demo.

Oh, I didn't know so I'll review the settings and try to improve.

@prurph
Copy link
Author

prurph commented Oct 24, 2017

Great--thank you for taking a look! Boostnote is really cool. :]

@i-give-up
Copy link

i-give-up commented Mar 3, 2018

Just came across this issue myself

My environment:

  • Windows 8.1
  • Boostnote version 0.10.0

Uploaded two videos to compare between behavior on Boostnote and the correct behavior.

  • On Boostnote - nothing happens when pressing the key sequences di) and ci)
  • On CodeMirror.net's demo - pressing di) deletes content inside the parentheses whereas ci) deletes content inside parentheses and changes to Insert mode.

These key sequences (i.e. "Vim text objects") also work on Tampermonkey which uses CodeMirror.


Update

Ok saw some error message on the developer console. I pasted it in this gist: https://gist.github.com/i-give-up/f665d1284cfa2ea3c3470c06570db137

It mentioned something about vim.js:843 TypeError: cm.scanForBracket is not a function.

@Rokt33r Rokt33r added the bug 🐛 Issue concerns a bug. label Mar 3, 2018
@hidaiy
Copy link
Contributor

hidaiy commented Mar 27, 2018

I think there's two reasons why this doesn't work.

1. matchbrackets.js is required

According to demo site, codemirror/addon/edit/matchbrackets.js is required when we use CodeMirror with Vim mode.

If this module is imported in main.html, we can use ci[, ci(, etc...
except when brackets have styles(like color or underscore etc..) of html.
And cit or dit either, it seems like is not supported in CodeMirror.

2. CodeMirror seems like having a problem with the Vim mode.

It seems like Vim mode on CodeMirror can't scan brackets when brackets have styles(like color or underscore etc..) of html.

I opened an issue and pull request on CodeMirror repository to ask this issue.

codemirror/codemirror5#5334

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

No branches or pull requests

5 participants