Closed rohit-s8 closed 1 year ago
After the hang occurs, Neovim's memory consumption shoots up and gets exponentially higher every second. By the time I kill the process manually, the memory usage is upwards of 3GB.
Could this be related to https://github.com/neovim/neovim/issues/20726?
terminal: neovide
First thing I’d like to eliminate is the use of neovide, can you try with iTerm2 when you’re testing this on your Mac?
CTRL-J keymap
Do you have any neovim terminal mapping for ctrl-j (use :tmap verbose <C-j>
)?
Do you have any special mapping for ctrl-j in $FZF_DEFAULT_OPTS
?
Does the same happen if you use ctrl-n instead (also defaults to line down in fzf)?
This may have something to do with shada. Once i removed the shada-! option, the issue stopped occurring on Linux, but still occurs in Mac.
Seems uncorrelated to me but anything can happen :)
I figured out what's happening!!
Do you have any neovim terminal mapping for ctrl-j
Turns out this is the issue. I added the following mappings to be able to jump between windows more easily:
vim.keymap.set("t", "<esc>", "<C-\\><C-n>")
vim.keymap.set("t", "<C-j>", "<esc><C-j>", { remap = true })
vim.keymap.set("t", "<C-k>", "<esc><C-k>", { remap = true })
vim.keymap.set("t", "<C-h>", "<esc><C-h>", { remap = true })
vim.keymap.set("t", "<C-l>", "<esc><C-l>", { remap = true })
It's only when the above <C-j>
keymap is set that the hang occurs. Since i use lazy.nvim, these mappings only take effect once the terminal plugin (toggleterm) loads. Until then fzf-lua works fine and this explains the intermittence. I just never realized that the issue occurs only after using the terminal.
You can find screenshots below of the terminal mappings before and after using the terminal. Notice that the <C-j>
terminal mode mapping i added actually gets translated into <ESC><NL>
Which i did not expect.
The actual cause of the hang must be a bug in neovim itself. I will see if i can reproduce this in bare neovim.
Thanks @ibhagwan for your help :)
terminal mappings when using fzf-lua before using terminal:
terminal mappings when using the terminal:
terminal mappings when using fzf-lua after using the terminal (hang occurs when using <C-j>
in this state):
Great find, happy you were able to solve this :)
@rohit-s8 I think that I may be suffering from this. Were you able to make any progress on this?
@rohit-s8 I think that I may be suffering from this. Were you able to make any progress on this?
@peterlvilim, if you read the issue throughly @rohit-s8 was able to solve the issue as explained in https://github.com/ibhagwan/fzf-lua/issues/922#issuecomment-1797960809
Oh I meant about the mention of a bug in neovim. Anyway, the way I “solved” this was to just stop using C-j C-k.
Info
nvim --version
: 0.9.2fzf --version
: 0.43.0mini.sh
fzf-lua configuration
```lua require("fzf-lua").setup { winopts = { width = 0.85, preview = { horizontal = "right:45%", title_align = "center" }, }, fzf_opts = { ["--info"] = "default", ["--no-separator"] = "", ["--pointer"] = " ", ["--marker"] = "+ ", }, fzf_colors = require("fzf_colors"), files = { prompt = "❯ ", rg_opts = "--color=never --files --hidden -g '!.git' -g '!.m2' -g '!node_modules'", fd_opts = "--color=never --type f --hidden --exclude .git --exclude .m2 --exclude node_modules", winopts = { title = "Files", title_pos = "center" } }, oldfiles = { prompt = "❯ ", cwd_only = true, include_current_session = true, winopts = { title = "Recent Files", title_pos = "center" } }, git = { files = { prompt = "❯ ", winopts = { title = "Git Files", title_pos = "center" } }, commits = { prompt = "❯ ", winopts = { title = "Git Commits", title_pos = "center" } }, branches = { prompt = "❯ ", winopts = { title = "Git Branches", title_pos = "center" } } }, buffers = { prompt = "❯ ", winopts = { title = "Buffers", title_pos = "center" } }, tabs = { prompt = "❯ ", winopts = { title = "Tabs", title_pos = "center", width = 0.5, height = 0.33, }, previewer = false }, grep = { prompt = "❯ ", winopts = { title = "Grep", title_pos = "center" }, }, lsp = { prompt_postfix = "❯ ", jump_to_single_result = true, includeDeclaration = false, winopts = { title = "LSP", title_pos = "center" }, symbols = { prompt = "❯ ", winopts = { title = "Symbols", title_pos = "center" }, }, code_actions = { prompt = "❯ ", winopts = { title = "Code Actions", title_pos = "center", width = 0.5 }, }, finder = { prompt = "❯ ", winopts = { title = "LSP Finder", title_pos = "center" }, } }, diagnostics = { prompt = "❯ ", winopts = { title = "Diagnostics", title_pos = "center" }, } } ```Description
This is a very weird issue and I apologize in advance for not being able to provide more information on this. Here is what happens:
Occasionally, when I open any of FzfLua's pickers and try to go down to an item using the CTRL-J keymap, Neovim hangs. This happens randomly and without any foreshadowing. I cannot reproduce the issue on demand but I have been facing this issue for a few months now and I can't make any progress. Here is all the information I have been able to obtain while trying to debug this:
Once again I apologize for the lack of information. If you could advise on how to debug this and obtain more information that would be really great.