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

Question: Is there any way to get single character with public API? #861

Closed
yubrot opened this Issue Jan 30, 2017 · 9 comments

Comments

Projects
None yet
2 participants
@yubrot

yubrot commented Jan 30, 2017

  • I've searched for duplicates – also closed issues
  • I've looked at the change log
  • I've provided the below details:

VimFx version: 0.20.8
Firefox version: 51.0.1
OS: Windows 10
Keyboard language: JP106
Example URL (if any): -

This is … (pick one!)

  • A bug report
    • I've filled in steps to reproduce below
  • A feature request
    • Sorry, feature requests are not accepted.
      See issue #860
  • A question
  • Somehting else

Thanks for a great extension!

I have switched from vimperator. I was using page marks (which is suggested in #695 and is called quickmarks on vimperator) heavily, so I implement this function in config.js. Although it works well, it depends vim object's internal API named _enterMode('marks', ..) to get a page-associated character.

Here is a source code: https://github.com/yubrot/d/blob/master/.config/vimfx/config.js#L125

Is there any way to get single character only with public API?

@lydell

This comment has been minimized.

Show comment
Hide comment
@lydell

lydell Jan 30, 2017

Collaborator

Hmm, I didn't think of this use case in commit c4c4173 apparently. So no, I don't think there's currently a way to do that.

However, what exactly are you trying to achieve? Could you give examples?

Collaborator

lydell commented Jan 30, 2017

Hmm, I didn't think of this use case in commit c4c4173 apparently. So no, I don't think there's currently a way to do that.

However, what exactly are you trying to achieve? Could you give examples?

@yubrot

This comment has been minimized.

Show comment
Hide comment
@yubrot

yubrot Jan 30, 2017

Like marks,

  • press qm followed by a letter to associate the current page (URL) with that letter.
  • press go followed by a letter to open the page associated with that letter.

To achieve this, I used this internal idiom:

vim._enterMode('marks', letter => { ... });

yubrot commented Jan 30, 2017

Like marks,

  • press qm followed by a letter to associate the current page (URL) with that letter.
  • press go followed by a letter to open the page associated with that letter.

To achieve this, I used this internal idiom:

vim._enterMode('marks', letter => { ... });
@lydell

This comment has been minimized.

Show comment
Hide comment
@lydell

lydell Jan 30, 2017

Collaborator

Do you really add/change quickmarks so often that you need the qm command? (Instead of defining them in config.js.)

Collaborator

lydell commented Jan 30, 2017

Do you really add/change quickmarks so often that you need the qm command? (Instead of defining them in config.js.)

@yubrot

This comment has been minimized.

Show comment
Hide comment
@yubrot

yubrot Jan 30, 2017

In my case, Yes. Especially I use 0-9 for temporary.

yubrot commented Jan 30, 2017

In my case, Yes. Especially I use 0-9 for temporary.

@lydell lydell added the discussion label Jan 30, 2017

@lydell

This comment has been minimized.

Show comment
Hide comment
@lydell

lydell Jan 30, 2017

Collaborator

Ok.

Even if vim._enterMode was public, vim._enterMode('marks', letter => { ... }); would still be a hack. The “real” solution would be to create a custom mode (which most likely would be very similar to Marks mode). Creating custom modes is possible using the public API, but unfortunately not entering them -.-

Collaborator

lydell commented Jan 30, 2017

Ok.

Even if vim._enterMode was public, vim._enterMode('marks', letter => { ... }); would still be a hack. The “real” solution would be to create a custom mode (which most likely would be very similar to Marks mode). Creating custom modes is possible using the public API, but unfortunately not entering them -.-

@lydell

This comment has been minimized.

Show comment
Hide comment
@lydell

lydell Jan 30, 2017

Collaborator

If you’d like to share a detailed use case example on how you use your quickmarks, I’d be very interested to hear.

Collaborator

lydell commented Jan 30, 2017

If you’d like to share a detailed use case example on how you use your quickmarks, I’d be very interested to hear.

@yubrot

This comment has been minimized.

Show comment
Hide comment
@yubrot

yubrot Jan 30, 2017

Even if vim._enterMode was public, vim._enterMode('marks', letter => { ... }); would still be a hack. The “real” solution would be to create a custom mode (which most likely would be very similar to Marks mode). Creating custom modes is possible using the public API, but unfortunately not entering them -.-

Oh, I see. Thank you for the clarification. Luckily, this internal dependence is minimum.

If you’d like to share a detailed use case example on how you use your quickmarks, I’d be very interested to hear.

Well, consider that there are several projects, each of them owns the project page in Gitlab, Redmine, local environment, etc.
Every time I focus the project, I quickmark the project specific page to the characters like g(itlab), r(edmine), etc. This is not quite often, but it is not appropriate for dotfiles.
The primary "temporary" usage is "Read It Later".

yubrot commented Jan 30, 2017

Even if vim._enterMode was public, vim._enterMode('marks', letter => { ... }); would still be a hack. The “real” solution would be to create a custom mode (which most likely would be very similar to Marks mode). Creating custom modes is possible using the public API, but unfortunately not entering them -.-

Oh, I see. Thank you for the clarification. Luckily, this internal dependence is minimum.

If you’d like to share a detailed use case example on how you use your quickmarks, I’d be very interested to hear.

Well, consider that there are several projects, each of them owns the project page in Gitlab, Redmine, local environment, etc.
Every time I focus the project, I quickmark the project specific page to the characters like g(itlab), r(edmine), etc. This is not quite often, but it is not appropriate for dotfiles.
The primary "temporary" usage is "Read It Later".

@lydell

This comment has been minimized.

Show comment
Hide comment
@lydell

lydell Jan 30, 2017

Collaborator

Thanks! I can see how quickmarks can be useful now.

I guess another way of implementing them is generating commands for qma, qmb, qmc ... and the same thing for go. It will clutter up the help dialog, but it is possible to hide commands there using CSS. This is definitely not a pretty solution, but at least it only uses public APIs ;)

Anyway, I don't expect relying on vim._enterMode will cause you any breakage for the remaining <1 year of the current APIs lifetime.

Collaborator

lydell commented Jan 30, 2017

Thanks! I can see how quickmarks can be useful now.

I guess another way of implementing them is generating commands for qma, qmb, qmc ... and the same thing for go. It will clutter up the help dialog, but it is possible to hide commands there using CSS. This is definitely not a pretty solution, but at least it only uses public APIs ;)

Anyway, I don't expect relying on vim._enterMode will cause you any breakage for the remaining <1 year of the current APIs lifetime.

@lydell

This comment has been minimized.

Show comment
Hide comment
@lydell

lydell Feb 21, 2017

Collaborator

I think we should add a <any> key some time in the future. I'll keep that in mind.

Collaborator

lydell commented Feb 21, 2017

I think we should add a <any> key some time in the future. I'll keep that in mind.

@lydell lydell closed this Feb 21, 2017

@lydell lydell removed the discussion label Feb 21, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment