Code Monkey home page Code Monkey logo

Comments (15)

ggandor avatar ggandor commented on May 10, 2024 1

Oh, got it, Visual mode is also ok, I just forgot to use <cmd> in the Vimscript example (the Lua snippet is fine). Correcting the docs in a minute.

from lightspeed.nvim.

svanharmelen avatar svanharmelen commented on May 10, 2024 1

Just tested it and if mapped before plugging, it indeed works 👍🏻

from lightspeed.nvim.

ggandor avatar ggandor commented on May 10, 2024 1

@andrevmatos Good catch! This is not because of the workaround, repeating with t/T behaves the same way (edit: yeah, I see your edit now :D). I know where the problem is, raised a separate issue (#19). Thanks again for catching this.

from lightspeed.nvim.

svanharmelen avatar svanharmelen commented on May 10, 2024

Yeah not having the ability to prevent mapping fFtT and also not have the ;, work as expected is a is frustration/limitation with using this plugin...

from lightspeed.nvim.

ggandor avatar ggandor commented on May 10, 2024

You can disable that if you want, just map dummy key(seq)s to the corresponding <Plug> keys (:h lightspeed-disable-default-mappings). (Or, if you've been using Sneak: mapping f/F/t/T to Sneak's corresponding commands also works.) As for mapping ;,, I am working on a clean solution. I don't really want to encourage that, but I see that I should provide some workaround for people who (have to) use vanilla Vim a lot, and cannot undo the muscle memory.

from lightspeed.nvim.

svanharmelen avatar svanharmelen commented on May 10, 2024

I tried adding:

nnoremap lf <Plug>Lightspeed_f
nnoremap lF <Plug>Lightspeed_F
nnoremap lt <Plug>Lightspeed_t
nnoremap lT <Plug>Lightspeed_T

But it still remaps the default fFtF keys...

from lightspeed.nvim.

svanharmelen avatar svanharmelen commented on May 10, 2024

I don't really want to encourage that, but I see that I should provide some workaround for people who (have to) use vanilla Vim a lot, and cannot undo the muscle memory.

So how would you suggest to do it? If if do f, it highlights all , but doesn't allow we to choose which to jump to. So is that a bug then?

from lightspeed.nvim.

ggandor avatar ggandor commented on May 10, 2024

I tried adding:

nnoremap lf <Plug>Lightspeed_f
nnoremap lF <Plug>Lightspeed_F
nnoremap lt <Plug>Lightspeed_t
nnoremap lT <Plug>Lightspeed_T

But it still remaps the default fFtF keys...

You should use nmap instead of nnoremap when mapping to <Plug> keys, since these should work recursively by nature - they are aliases for other mappings. But I don't recommend lf, etc., because that will cause a lag every time you press the l key. Use something like <C-F12> for the prefix, that won't collide with anything... you get the idea.

from lightspeed.nvim.

ggandor avatar ggandor commented on May 10, 2024

I don't really want to encourage that, but I see that I should provide some workaround for people who (have to) use vanilla Vim a lot, and cannot undo the muscle memory.

So how would you suggest to do it? If if do f, it highlights all , but doesn't allow we to choose which to jump to. So is that a bug then?

What do you mean by choosing which to jump to? There are no labels for f/t searches in this plugin, but you can repeat them (by pressing the same key again), and thus move forward/backward, or give them a count, like 3fa, just like with the native f/t.

There is a bug with the workaround I just commited (Visual mode is not so simple, Normal is fine now), so the ;, issue is still pending, but working on it...

from lightspeed.nvim.

svanharmelen avatar svanharmelen commented on May 10, 2024

It still remaps f...

I now have:

nmap <C-F9> <Plug>Lightspeed_f
nmap <C-F10> <Plug>Lightspeed_F
nmap <C-F11> <Plug>Lightspeed_t
nmap <C-F12> <Plug>Lightspeed_T

And when I open a new nvim and type :verbose nmap f I get this:

image

from lightspeed.nvim.

svanharmelen avatar svanharmelen commented on May 10, 2024

I tested the workaround for ;, and it seems to work great (at least in normal mode). So in that case I don't mind that fFtT are remapped, I can use them in the same fashion now 👍🏻

from lightspeed.nvim.

ggandor avatar ggandor commented on May 10, 2024

It still remaps f...

I guess the problem is that you remapped them after the plugin has loaded... (it simply cannot be anything else). Would you please try that again, putting those lines before the Plug section, so that we can close this? Thanks very much!

from lightspeed.nvim.

andrevmatos avatar andrevmatos commented on May 10, 2024

The suggested fun! doesn't seem to work on visual selection for t/T: if I'm visually selecting with t, and type ;, it seems to recall previous f operation, instead of the current t one

from lightspeed.nvim.

ggandor avatar ggandor commented on May 10, 2024

@andrevmatos You probably used a simple :call, instead of <cmd>call, isn't that the problem? It should work with the latter, I cannot reproduce the issue.

from lightspeed.nvim.

andrevmatos avatar andrevmatos commented on May 10, 2024

@ggandor thank you for your response, I had just copied the command from a previous commit, and it was not working because I had some t? binds on my config which seems to prevent t moving from working properly in x/v mode.

Unfortunately, it's still not working perfectly: by moving with f, I can move correctly between two consecutive occurrences of a character with ; and back with ,, but if I try to do the same with t, it seems that the first time I switch between ; and ,, it skips one occurrence. e.g. if I'm in the beginning of a line with 4 letters x, and type tx, it'll go to the 1st x, pressing ; will go to the 2nd, and again, to the 3rd and 4th, but then if I press ,, it'll jump to the 2nd, and again to 1st, and back to ; will jump to 3rd and 4th, skipping next char occurrence when switching between moving with ; and ,.
This is seem both on normal and visual selection modes. It doesn't occur with f.
Thank you again for your support and the great plugin.

Edit: noticed this "skipping" also happens when alternating between prev/next occurrence with Tt as well, not only with ;,, so I'd say this is a small unrelated bug.

from lightspeed.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.