Closed xu910121 closed 1 month ago
hi @xu910121 -
you are doing undo
. Isn't that why buffer is modified?
can you share all your cscope_maps.nvim related config?
ha, use Cscope reopen a file, maybe just to read. for same reason passed u, for example by mistake ...... and buff changd ......
when set skip_picker_for_single_result = true, cscope_maps.nvim/lua/cscope/init.lua will use “edit“ command to reopen the same file(when Cscope f g search symbol in one file)。I think the edit command will cause buff change。
MY config (Lazy.nvim):
local plugins = {
{
"dhananjaylatkar/cscope_maps.nvim",
dependencies = {
"folke/which-key.nvim", -- optional [for whichkey hints]
"ibhagwan/fzf-lua",
"nvim-telescope/telescope.nvim",
"nvim-tree/nvim-web-devicons", -- optional [for devicons in telescope, fzf or mini.pick]
},
opts = {
-- maps related defaults
disable_maps = false, -- "true" disables default keymaps
skip_input_prompt = true, -- "true" doesn't ask for input
prefix = "<leader>c", -- prefix to trigger maps
-- cscope related defaults
cscope = {
-- location of cscope db file
db_file = "./cscope.out", -- DB or table of DBs
-- NOTE:
-- when table of DBs is provided -
-- first DB is "primary" and others are "secondary"
-- primary DB is used for build and project_rooter
-- cscope executable
exec = "cscope", -- "cscope" or "gtags-cscope"
-- choose your fav picker
picker = "fzf-lua", -- "quickfix", "telescope", "fzf-lua" or "mini-pick"
-- size of quickfix window
qf_window_size = 5, -- any positive integer
-- position of quickfix window
qf_window_pos = "bottom", -- "bottom", "right", "left" or "top"
-- "true" does not open picker for single result, just JUMP
skip_picker_for_single_result = true, -- "false" or "true"
-- these args are directly passed to "cscope -f <db_file> <args>"
db_build_cmd_args = { "-bqkv" },
-- statusline indicator, default is cscope executable
statusline_indicator = nil,
-- try to locate db_file in parent dir(s)
project_rooter = {
enable = true, -- "true" or "false"
-- change cwd to where db_file is located
change_cwd = true, -- "true" or "false"
},
},
},
init = function(_, opts)
require("cscope_maps").setup(opts)
end,
keys = {
{'<leader>chg', ':Cscope f g ', { noremap = true, silent = false }, desc = "input :Cscope f g"},
{'<leader>chc', ':Cscope f c ', { noremap = true, silent = false }, desc = "input :Cscope c g"},
{'<leader>chs', ':Cscope f s ', { noremap = true, silent = false }, desc = "input :Cscope s g"},
},
}
@xu910121 Thanks for reporting this edge case. It it fixed now. Please verify and let me know.
@dhananjaylatkar The new version has fixed this issue. Thank you for your work.
first of all, thank you to contribute so great tools.
Describe the bug
where case this: cscope_maps.nvim/lua/cscope/init.lua: if M.opts.skip_picker_for_single_result and #parsed_output == 1 then vim.api.nvim_command("edit +" .. parsed_output[1]["lnum"] .. " " .. parsed_output[1]["filename"]) return RC.SUCCESS end
maybe to solve this problem: if M.opts.skip_picker_for_single_result and #parsed_output == 1 then -- vim.api.nvim_command("edit +" .. parsed_output[1]["lnum"] .. " " .. parsed_output[1]["filename"]) vim.api.nvim_command("badd +" .. parsed_output[1]["lnum"] .. " " .. parsed_output[1]["filename"]) vim.api.nvim_command("buffer +" .. parsed_output[1]["lnum"] .. " " .. parsed_output[1]["filename"]) return RC.SUCCESS end
Is there a great idea?