I initially opened this as a discussion, but I do think this is a bug, unless I'm missing something
Originally posted by **TxHawks** July 26, 2023
When I use char-mode movements in operator-pending mode, e.g., `df`, the cursor will jump to the first instance of `` and will then carry out the operator-pending action - in this case, delete.
So if I have my cursor at the beginning of the following line:
```
A random line of text
```
and then hit `dte`, the cursor will to the `n` in `line`, and delete from there to the label I pick or the first one if I just hit `enter`.
Is this a bug or do I have something misconfigured?
This is my config:
```lua
{
incremental = true,
jump = {
-- Disabling this was the first thing I tried. Didn't help
autojump = false,
},
label = {
current = false,
},
modes = {
char = {
jump_labels = true,
label = { exclude = "abcdehijklrxw" },
},
},
search = {
incremental = true,
},
},
```
I am having the same issue. As-is, flash is "breaking" the functionality of ct<character>. I think the fix would be to disable flash's "char mode" when in operator pending mode. I tried the following, but it did not work:
opts = {
modes = {
char = {
config = function(opts)
if vim.fn.mode(true):find('o') then
vim.notify('Started flash char jump from operator pending mode')
-- these options seem to have no effect in this context
opts.enabled = false
opts.autohide = true
else
vim.notify('Started flash char jump from normal mode')
end
end,
},
},
},
In normal mode, the notify calls are printing correctly when I press t vs. ct. However, the behavior is the same. Flash takes over and jumps to the next letter after ct rather than doing the default vim behavior of deleting up to that character and entering insert mode.
@mrbeardad It still doesn't work. I have had jump_labels set to false the whole time. ct<character> still just jumps forward to that character and doesn't allow the regular c operator to function properly.
When autohide is true, the flash functionality of f and t turns off. The point is to be able to press, for example, fcffffff... to cycle through occurrences of the letter c with them all highlighted instead of pressing fcfcfcfcfc with no highlighting.
It doesn't even work anyway. With autohide set to true, I still can't ct<character>. It has the same behavior as setting autohide to false.
Maybe it's something else in my config that's causing it to fail, so I will try to use a minimal setup to check.
I followed the steps below and confirmed that this is reproducible with a miniaml setup.
Create a file (touch test.lua)
Write the following contents to the file:
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
local plugins = {
{
'folke/flash.nvim',
--
-- rest of the flash config stuff here ...
--
}
}
require('lazy').setup(plugins, {})
Launch vim with this as the config (vim -u test.lua test.lua)
Confirm that flash is working (flffff...)
Test the problem (ct<character>)
This confirms that it's not some other part of my vim config that's causing the problem.
Removing remote_op = { motion = true } made it work. I tried setting motion to true and false back and forth and I couldn't figure out what that setting even does. But with the default motion = false, ct<character> works correctly 🎉
I'm not sure why the remote_op settings would affect anything if require('flash').remote isn't being run though...
Discussed in https://github.com/folke/flash.nvim/discussions/186
I initially opened this as a discussion, but I do think this is a bug, unless I'm missing something
I am having the same issue. As-is, flash is "breaking" the functionality of ct
<character>
. I think the fix would be to disable flash's "char mode" when in operator pending mode. I tried the following, but it did not work:In normal mode, the
notify
calls are printing correctly when I press t vs. ct. However, the behavior is the same. Flash takes over and jumps to the next letter after ct rather than doing the default vim behavior of deleting up to that character and entering insert mode.autohide
is what you want, but it only work whenjump_labels
is false. So, you have to disablejump_labels
too in operator-pending mode.That's great! I only wish there was a way to avoid momentary blink of the labels after pressing char in operator-pending mode.
@mrbeardad It still doesn't work. I have had
jump_labels
set to false the whole time. ct<character>
still just jumps forward to that character and doesn't allow the regularc
operator to function properly.@nullromo What is your config?
You can see my config here. The relevant part is copied below.
jump_labels
is false by default.When
autohide
is true, the flash functionality of f and t turns off. The point is to be able to press, for example, fcffffff... to cycle through occurrences of the letterc
with them all highlighted instead of pressing fcfcfcfcfc with no highlighting.It doesn't even work anyway. With
autohide
set to true, I still can't ct<character>
. It has the same behavior as settingautohide
to false.Maybe it's something else in my config that's causing it to fail, so I will try to use a minimal setup to check.
I followed the steps below and confirmed that this is reproducible with a miniaml setup.
touch test.lua
)vim -u test.lua test.lua
)<character>
)This confirms that it's not some other part of my vim config that's causing the problem.
For detail on
remote_op
, refer to the readmeRemoving
remote_op = { motion = true }
made it work. I tried settingmotion
to true and false back and forth and I couldn't figure out what that setting even does. But with the defaultmotion = false
, ct<character>
works correctly 🎉I'm not sure why the
remote_op
settings would affect anything ifrequire('flash').remote
isn't being run though...I'm also having trouble with this. Adding this config entry does not fix the problem:
My current config (with character motion disabled):
I cannot currently find a way to go from this config to a config where character motions work. I have tried:
or:
or:
or:
@siriobalmelli I started using clever-f again instead of 'char' mode in flash.nvim and that's exactly the behavior I need.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Has not been addressed, so is not stale.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Bump
Bump
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.