Closed DreamMaoMao closed 6 months ago
keymap:
vim.keymap.set("v", "<leader>ro", '<cmd>lua require("spectre").open_file_search()<CR>', { desc = "Search selected str in current file", })
https://github.com/nvim-pack/nvim-spectre/assets/30348075/9dfc32ad-c1a8-4b82-91cb-e71d67c54f32
in the video,you can see:
apple
orange
when i select apple string to toggle search current file again.it will search orange string.
It always searches for the last selected string instead of the current selected string.
have resolved by add <esc>
<esc>
vim.keymap.set("v", "<leader>ro", '<esc><cmd>lua require("spectre").open_file_search()<CR>', { desc = "Search selected str in current file", })
keymap:
https://github.com/nvim-pack/nvim-spectre/assets/30348075/9dfc32ad-c1a8-4b82-91cb-e71d67c54f32
in the video,you can see:
apple
string to toggle search current file, it will search nothing first time.orange
string to toggle search current file,it will searhapple
string.when i select
apple
string to toggle search current file again.it will searchorange
string.It always searches for the last selected string instead of the current selected string.