1

Normally, when I use tab complete for a program that doesn't have completion defined, it will just default to completing on files. However, with the bat command I get something that looks like this:

1010 ⮚ bat (eval):1: command not found: _bat
(eval):1: command not found: _bat
(eval):1: command not found: _bat
(eval):1: command not found: _bat
bat

How can I get it to complete with files like it does for other programs?

Relevant part of my zsh config:

zstyle ':completion:*' completer _expand _complete _ignored
zstyle ':completion:*' format '%F{blue}%d%f'
zstyle ':completion:*:descriptions' format '%U%F{cyan}%d%f%u'
zstyle ':completion:*' menu select yes interactive
zstyle ':completion:*' select-prompt %SAt %p%s
zstyle ':completion:*' group-name ''
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.cache/zsh
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors
zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' max-errors 2 numeric
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,%cpu,tty,cputime,cmd"
Thayne
  • 6,619
  • 2
  • 42
  • 67
  • Do you have `bat` actually installed? If you just installed it now and didn't restart the shell, it's maybe not in the hashtable yet. Then just call `rehash`. – Georg P. Jul 22 '19 at 08:04
  • yes, bat is installed. And it is complaining that _bat doesn't exist (it doesn't) not bat itself. – Thayne Jul 22 '19 at 08:10
  • https://github.com/sharkdp/bat/issues/503 – sepehr Oct 13 '19 at 07:42

1 Answers1

3

I don't know which distro you are using but the official Debian one had to rename the bat executable to batcat.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • that's not it. bat is in fact called "bat" on my system. – Thayne Jan 05 '21 at 07:27
  • Manually typing and executing the bat command is giving you results but when you are using tab it is not detecting bat ? I faced this problem but I came to know that my executable name was wrong it was batcat but not bat. – rohith vishaal Jan 06 '21 at 09:19