Closed grecodavide closed 3 years ago
What is the key combo for opening the file browser?
I also just added :checkhealth which_key
, you may want to check that too.
What do you get when doing :map <leader>
The key combo is
As for map
That warning is OK.
Only for <leader>
combos, or also for other things like g
?
No, just tried and this doesn't happen for g. It seems to me that only if I open a popup I have this problem, since also things like comment line (
Can you tell me exactly what happens when you do:
<leader>
and wait till popup, then type f
<leader>f
and wait till popupFor both of the above, is the popup correctly showing the e
option?
do you have more mappings under <leader>fe
? like <leader>feeeee
or something like that?
Is the key combo a <plug>
by any chance?
Yes it shows correctly, and if I do it slowly I don't have any problem at all.
Nop, it's the only mapping under <leader>fe
, but also things like <leader>ff
, mapped to telescope find files doesn't work, and it isn't a <plug>
, this is the mapping
vim.api.nvim_set_keymap('n', '<Leader>fe', '<cmd>lua require(\'telescope.builtin\').file_browser({hidden = true})<CR>', {hidden = true, noremap = true})
Aha, what is hidden=true
🙂
Need to check that
sorry, I typed it wrong, it's a silent = true
I defined a global for the options, so I wrote manually that part and misstyped
Don't know if this could help, but I have the same problem if I open something through Dashboard: I have set dashboard_default_executive = 'telescope'
, and if I try to open from the dashboard screen something like
lua require(\'telescope.builtin\').oldfiles({hidden = true, shorten_path = true})
I have the same problem
So pressing enter on one of the dashboard links opens the popup?
Yes, if I press enter on a dashboard link it behaves as if i instantly completed the key combo, same way as <Leader>fe
if the popup triggers and stays open, what does the below give?
:lua print(require("which-key.view").keys)`
and this one:
:lua print(vim.inspect(require("which-key.keys").get_tree("n").tree:get("<leader>fe")))
For the first one, as soon as I start typing the which key popup closes and i tsrta typing in the telescope popup
the second one gives this output
That's fine. Even if it closes, when you do that first command, it should show the prefix that was used. Can you show it?
it gives me just :
I guess I'm not doing it right, what I did is: I opened the telescope popup, i pressed double column to enter command mode, but that closes the which key popup
I know. Just enter the command after the popup and telescope are closed.
Doesn't print anything this way, I'm guessing it prints space?
Also, to check if it was actually printing space, i reset the leader key to \
, and everything works fine, I get no problem at all
So it only seems to be an issue when leader is set to space?
did you set mapleader
to <space>
instead of a literal space character
?
I tried now (vim.g.mapleader = '<Space>'
, but it didn't change the problem with dashboard and if I tried to do <Space>fe
nothing happens, and neovim freezes
mapleader should be a literal " " character
Oh sorry, it already was a literal space
Also, I have a function that does:
<cmd>bd!<CR>
then checks if the current buffer is empty, and if it is it opens Dashboard
if the function (which is called by <leader>bd
) just closes the buffer (meaning I have another buffer opened, and so it simply switches to that second buffer) i have no problem at all, but if the Dashboard screen is opened the which key popup is opened, and again, if I do the same key combo, but slow enough, the which key popup does not show up
I just pushed some changes that may be related to that problem, so would be great if you could see if it fixes this
can you also show the full autocommand for that bd check?
Just made another change that might be related :)
(I'm quite a noob soo probably the function sucks )
As for the changes, now even if I do the key combo slowly the popup shows :cry:
I want to see the autocmd that triggers that function. Maybe it interfers when the popup closes.
no autocmd, it's just a mapping to that function
I'm a bit at loss here. Very weird.
As for the changes, now even if I do the key combo slowly the popup shows 😢
So you mean that you type slowly, popup opens, then file broswer launches and popup stays open? Or does it somehow reopen again?
yes, the first you said, it opens the popup, but when I finish the key combo it behaves as if I did the key combo qiuckly
Just to be sure:
the file browser open, and the popup is visible behind. After I enter the key combo, the popup in the back shows the <leader>
screen, as if I just pressed my leader key:
those in the background are the prefixes of my leader mappings
update: I think the prolem is with the fact that the leader key is space. I tried to change it to ,
and it worked just fine, without giving me any problem, but I don't understand why the space key doesn't work properly
It should work with space for sure. Most people (including myself) set that up as their leader.
I have vim.g.mapleader = " "
That's what I don't understand. I have that exact same line, and it doesn't work, but if instead of " "
i put ","
it just works fine
Can you try doing :WhichKey <leader>ef
and :WhichKey <space>ef
?
Both should open Telescope without showing the popup.
I tried both with space
and with ,
as leader key.
:WhichKey <leader>fe
didn't show anything in both cases, while
with ,
as leader
:WhichKey ,fe
worked just fine
with <space>
as leader
:WhichKey <space>fe
didn't show anything
mapleader
is set to space, before setting those telescope keybindings?
That is even weirder. Telescope should at least show
yes, the file in which I define the leader key is the first line of the second file i require in my init.lua, before anything
There must be something going on with your keybindings somewehre.
:map <leader>fe
:map <leader>f
output of :map <leader>fe
output of :map <leader>f
I really don't get it. Those mappings look correct.
Try doing :set timeoutlen=3000
and then quickly doing typing the combo.
There's no reason the popup can even start then, since it will never be hit.
I also tried verbose map <Leader>
with comma and space set as leader key, but both gave me the same output, set at line 2 from the which key plugin, this is what I got
those mappings all are correct, that's ok
If i set timeoutlen to 3000 the popup doesn't show when I press the key combo, but as soon as Telescope popup is opened whichkey popup also opens
ok! We're getting somewhere :) Can you share your Telescope config? Do you have any autocmds set there?
sure, no autocmds there
Do you prefer me sending the zipped folder containing tele config and keymappings or just screenshots?
I'm sure this is just something I messed up, but I can't understand where is the problem. If I finish a key combination fast enough not to trigger Which Key, it still opens. This is an example of what I get if I open the file browser, and if I press esc everything works fine. I also tried to to a key combination slow enough to pop the menu immediately, and again everything works fine (same thing with timeoutlen = 0)