folke / flash.nvim

Navigate your code with search labels, enhanced character motions and Treesitter integration
Apache License 2.0
2.47k stars 33 forks source link

bug: can not work with <C-o> #293

Closed soluty closed 2 months ago

soluty commented 9 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

0.10.0

Operating system/version

windows 10

Describe the bug

command in insert mode, can call a lua function and then back to insert mode. like this `map({ "i" }, "", ':lua print("flash")', { desc = "" })` but if i call jump function from flash, it can work well only i used the first time. `map({ "i" }, "", ':lua require("flash").jump()', { desc = "" })` as it works fine in first time, so that may be there is a bug not in nvim but in flash plugin ### Steps To Reproduce `map({ "i" }, "", ':lua require("flash").jump()', { desc = "" })` then press alt+s , ### Expected Behavior can done search and then back into insert mode ### Repro ```Lua -- 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 vim.keymap.set({ "i" }, "", ':lua require("flash").jump()', { desc = "" }) ```
bluss commented 6 months ago

It works for me with this tweak:

map({ "i" }, "<A-s>", '<C-o><Cmd>lua require("flash").jump()<cr>', { desc = "" })

Using <cmd> is the recommended way in general.

github-actions[bot] commented 2 months ago

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.

github-actions[bot] commented 2 months ago

This issue was closed because it has been stalled for 7 days with no activity.