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

bug: T/F operator movement includes current character #149

Closed
3 tasks done
andrevmatos opened this issue Jul 14, 2023 · 3 comments · Fixed by #148
Closed
3 tasks done

bug: T/F operator movement includes current character #149

andrevmatos opened this issue Jul 14, 2023 · 3 comments · Fixed by #148
Labels
bug Something isn't working

Comments

@andrevmatos
Copy link

Did you check docs and existing issues?

  • I have read all the flash.nvim docs
  • I have searched the existing issues of flash.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.10.0-dev-c379d72

Operating system/version

NixOS unstable (current)

Describe the bug

Doing some backwards char operator movement with T/F includes the current character, which deviates from the native neovim T/F behavior, and can be unexpected for anyone used to how vim char operators behave.

Steps To Reproduce

  1. Imagine the following line and cursor position:
abcdefg
     ^
  1. Command: dTb
  2. Result:
abg
  ^
  1. The above (f being deleted as well) also happens with dF command, although that includes the target b, as expected. This affects other commands as well, like yank.

Expected Behavior

Same as vim's, current character is kept:

abfg
  ^

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/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", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  { "folke/flash.nvim", opts = {} },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@andrevmatos andrevmatos added the bug Something isn't working label Jul 14, 2023
@emxxjnm
Copy link

emxxjnm commented Jul 14, 2023

seems to be a similar issue :)

flash.nvim opts

opts = {
  jump = {
  	pos = "end",
  },
  modes = {
    char = {
      jump_labels = function(motion)
        return vim.v.count == 0 and motion:find("[ftFT]")
      end,
    },
  },
}

steps to reproduce

abcd
^

press dtd<ESC> and I got this

bcd
^

expect

abcd
^

folke added a commit that referenced this issue Jul 14, 2023
@folke folke closed this as completed in b1af2b7 Jul 14, 2023
@folke
Copy link
Owner

folke commented Jul 14, 2023

@emxxjnm your problem is also fixed. esc now properly cancels operator pending mode

@andrevmatos
Copy link
Author

Thank you for your prompt support and great plugin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants