I am using VS Code as my primary text editor, which I can launch from a terminal with code
.
With bash, I can use code <tab>
in order to generate a list of directories & files for opening a new VS Code session in. However, when I am trying on my fresh install of Ubuntu, I am getting an error as if zsh is trying to run some other command:
(eval):1: command not found: _code.dpkg-new
Example case, from the desktop, where there exists a directory named Projects:
IN:
<usr>-<machine>% code Pro<tab>
OUT:
<usr>-<machine>% code Pro<tab>(eval):1: command not found: _code.dpkg-new
Using other commands results in the expected behavior: the Projects directory is auto-completed. e.g.,:
IN:
<usr>-<machine>% cd Pro<tab>
OUT:
<usr>-<machine>% cd Projects/
My .zshrc
is completely commented out but it seems to make no difference even after starting a new terminal session.
A commentor suggested this was a duplicate of another post, but the suggested solution in that post did not help, rather yielding a different error when I tried (as commented in that post and below).
I am not using Oh-my-zsh.
I am new to Ubuntu. I have a fresh install from yesterday.
IN:
lsb_release -a
OUT:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 23.04
Release: 23.04
Codename: lunar
I have looked at these sites, but the advice does not help:
- https://superuser.com/questions/958903/zsh-autocomplete-filenames-if-no-other-completion-available
- zsh tab completion bug on ubuntu
- Zsh completion need to hit <TAB> twice
- https://superuser.com/questions/394824/how-can-zsh-be-configured-to-autocomplete-directory-name-with-camelcase-matching#:~:text=If%20you%20hit%20TAB%20again%20%28depending%20on%20your,filename%20to%20guide%20the%20completer.%20%E2%80%93%20Phil%20Hord
- How can I get Bash and Zsh completions for VS Code on the commandline?
- And a few others whose links have been buried in the tons of open tabs I have
I will accept an answer that helps me use zsh with the code
command to auto-complete paths using tab as I can already do in bash on this Ubuntu machine (and I'm fairly certain I can already do with zsh on a Macbook, but I have not verified tonight).
Resolution:
I originally installed VS code using apt
following this tutorial. Uninstalling then reinstalling with snap
using the same tutorial resolved the issue. Not sure what is wrong with the apt
installation, but I'm glad the issue is resolved now. Thanks for your posts at this question, @starball.