-
Notifications
You must be signed in to change notification settings - Fork 19
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
Rename handler #19
Comments
Hi! I guess this is possible. Great feature advice. I would be glad to add it. |
I can add a PR for this handler, I just need you to introduce ability on popfix to allow editing the buffer. Once I have that I can do everything else myself :) |
Sure, I would just explain the basic process of creating prompt using popfix Mostly, we need a prompt buffer for this. Popfix provides an easy way of having prompt buffer on cursor using: local opts = {
prompt = {
border = true,
title = 'Renamed',
highlight = 'Normal',
prompt_highlight = 'Normal',
init_text = init_text
},
mode = 'cursor',
keymaps = {
i = {
['<C-c>'] = close_cancelled,
['<CR>'] = edit_close,
},
n = {
['<CR>'] = edit_close,
['q'] = close_cancelled,
['<C-c>'] = close_cancelled,
['<Esc>'] = close_cancelled,
}
},
}
local popup = popfix:new(opts) where close_cancelled, edit_close are functions that accept the parameter One good example of reference can be my In the file I hope nvim-cheat.sh would be a good example. If not sufficient please tell me, I There is also a popfix bug that I have also shown in nvim-cheat.sh code. I am |
Yeah prompt solves most of my issues. I have this code that I call on some word: local function edit_callback(_, line)
print(line)
vim.cmd('stopinsert')
end
local function close_popup(popup)
popup:close()
vim.cmd('stopinsert')
end
function _G.test_popup()
local rename_opts = {
mode = 'cursor',
prompt = {
border = true,
title = '',
init_text = vim.fn.expand('<cword>')
},
keymaps = {
i = {
['<CR>'] = function(popup)
popup:close(edit_callback)
end,
['<Esc>'] = close_popup,
['<C-c>'] = close_popup
},
}
}
require'popfix':new(rename_opts)
end And when I'm on some word, i do |
Hi! Actually this is not a popfix bug. But this is a neovim bug (atlest neovim I would recommend an experiment that would make it more clear.
Then write some text in the buffer in insert mode. Switch to normal mode using Similarly, you can try to use But there is still a way to edit I really wanted to work on this behavior in neovim code but couldn't due to |
I wasn't even aware of the |
Yeah! that's why I didn't make fuzzy search of symbols as default till now due to this weird prompt behavior. I don't know even this is mentioned in the neovim issue list currently. I searched but didn't find anything related to it. I would mention you here if I find it to be fixed. 😄 |
What's the state of this? I'd like to have this feature and may be able to code |
Hi,
any chance to introduce rename handler? CoC for example shows floating window at cursor to enter new name, and triggers lsp rename on enter.
I tried doing this myself, but popfix doesn't allow setting modifiable on the floating buffer.
The text was updated successfully, but these errors were encountered: