atuin icon indicating copy to clipboard operation
atuin copied to clipboard

[Bug]: commented commands not shown in history

Open chain710 opened this issue 9 months ago • 8 comments

What did you expect to happen?

Expect same behavior as bash, like:

# echo hello

You can find this record again using ctrl + r.

What happened?

Fresh install, can not find commands starts with '#'

Atuin doctor output

atuin:
  version: 18.2.0
  sync: null
shell:
  name: bash
  default: unknown
  plugins:
  - atuin
  - bash-preexec
system:
  os: Debian GNU/Linux
  arch: x86_64
  version: '12'
  disks:
  - name: /dev/sda1
    filesystem: ext4


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

chain710 avatar May 03 '24 11:05 chain710

I'm using Atuin 18.2.0 on MacOS and I'd also love to see commented-commands appear in my history

angrychimp avatar May 17 '24 18:05 angrychimp

I'm afraid commented commands not showing is a limitation of bash-preexec. It's a hack we have to use to get shell hooks on bash, as bash does not support them itself

You have two options really

  1. Stick with bash, but use ble.sh
  2. Use any other shell supported by atuin. I'd usually suggest zsh.

ellie avatar May 18 '24 00:05 ellie

I honestly didn't notice before that this bug was for bash. I am using zsh on MacOS - is there a config setting I should be using or something else I ought to do differently?

  version: 18.2.0
  sync: null
shell:
  name: zsh
  default: zsh
  plugins:
  - atuin
system:
  os: Darwin
  arch: arm64
  version: 14.4.1
  disks:
  - name: Macintosh HD
    filesystem: apfs
  - name: Macintosh HD
    filesystem: apfs

angrychimp avatar May 18 '24 00:05 angrychimp

Could you give an example of a commented command that does not work for you? and could you share your zsh config please?

ellie avatar May 18 '24 01:05 ellie

same: Mac + zsh, atuin doesn't show commented commands

Could you give an example of a commented command that does not work for you?

# echo hello

could you share your zsh config please?

export PATH=/usr/local/opt/libpq/bin:$HOME/.local/bin:/usr/local/bin:$PATH
export ZSH="/Users/xx/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
DISABLE_AUTO_UPDATE="true"
plugins=(git)
source $ZSH/oh-my-zsh.sh
if [[ "$TERMINAL_EMULATOR" == "JetBrains-JediTerm" ]]; then
  bindkey "∫" backward-word # Option-b
  bindkey "ƒ" forward-word  # Option-f
  bindkey "∂" delete-word   # Option-d
fi
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
. "/Users/xx/.acme.sh/acme.sh.env"
if [[ ! -o interactive ]]; then
    return
fi
compctl -K _jina jina
_jina() {
  local words completions
  read -cA words
  if [ "${#words}" -eq 2 ]; then
    completions="$(jina commands)"
  else
    completions="$(jina completions ${words[2,-2]})"
  fi
  reply=(${(ps:
:)completions})
}

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
eval "$(atuin init zsh --disable-up-arrow)"

chain710 avatar May 20 '24 06:05 chain710

I have a few more plugins installed, but I'm also using Oh My Zsh with the powerlevel10k theme and iterm2 integration.

angrychimp avatar May 20 '24 14:05 angrychimp

I can replicate this with having installed oh-my-zsh, will see what config it's changing

ellie avatar May 31 '24 07:05 ellie

Hi! Thanks for atuin and for reaching out from the tweet

I have no atuin doctor subcommand

$ atuin --version                    
atuin 18.0.1

I am on nixos and I have this setup in home manager

...
  programs.atuin = {
    enable = true;
  };

  programs.zsh = {
    enable = true;
    enableAutosuggestions = true;
    oh-my-zsh = {
      enable = true;
      plugins = [
        "command-not-found"
      ];
      theme = "agnoster";
    };

...

let me know if you need more details

RCasatta avatar May 31 '24 07:05 RCasatta