withfig / fig

Public issue tracker for Fig.
https://fig.io
MIT License
2.05k stars 63 forks source link

Fig does not work except first time after install #946

Closed torqu3e closed 2 years ago

torqu3e commented 2 years ago

Sanity checks

Issue Details

Description:

Fig only works right after the initial install, not after. Replicable in vscode terminal or terminal. Does not integrate with kitty at all (separate issue)

~$ fig doctor

✅ Everything looks good!

Fig still not working?
Run fig issue to let us know!
Or, email us at hello@fig.io!
~$ cat ~/.bashrc 

#### FIG ENV VARIABLES ####
# Please make sure this block is at the start of this file.
[ -s ~/.fig/shell/pre.sh ] && source ~/.fig/shell/pre.sh
#### END FIG ENV VARIABLES ####
export HISTTIMEFORMAT="%d/%m/%y %T "
export HISTSIZE=10000
export HISTFILESIZE=50000

#### FIG ENV VARIABLES ####
# Please make sure this block is at the end of this file.
[ -s ~/.fig/fig.sh ] && source ~/.fig/fig.sh
#### END FIG ENV VARIABLES ####
~$ cat ~/.bash_profile

#### FIG ENV VARIABLES ####
# Please make sure this block is at the start of this file.
[ -s ~/.fig/shell/pre.sh ] && source ~/.fig/shell/pre.sh
#### END FIG ENV VARIABLES ####
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/opt/homebrew/bin:/usr/local/bin:/Users/myuser/bin
# autocomplete requires bash 5 which leads to warnings on macs hence following
export BASH_SILENCE_DEPRECATION_WARNING=1

#prompt setup
PS1="\w$ "
PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME}:$(basename ${PWD})\007"'

[[ -r "/opt/homebrew/etc/profile.d/bash_completion.sh" ]] && . "/opt/homebrew/etc/profile.d/bash_completion.sh"

# source ~/.kube/kubectl_autocompletion
source <(kubectl completion bash | sed 's/kubectl/k/g')
source <(kubectl completion bash)

# Setup bash aliases
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# Longer and timestamped history
shopt -s histappend
export HISTTIMEFORMAT="%d/%m/%y %T "
export HISTSIZE=10000
export HISTFILESIZE=50000

# Colorize man pages https://boredzo.org/blog/archives/2016-08-15/colorized-man-pages-understood-and-customized
man() {
    env \
    LESS_TERMCAP_mb="$(printf "\e[1;31m")" \
    LESS_TERMCAP_md="$(printf "\e[1;31m")" \
    LESS_TERMCAP_me="$(printf "\e[0m")" \
    LESS_TERMCAP_se="$(printf "\e[0m")" \
    LESS_TERMCAP_so="$(printf "\e[1;44;33m")" \
    LESS_TERMCAP_ue="$(printf "\e[0m")" \
    LESS_TERMCAP_us="$(printf "\e[1;32m")" \
    man "${@}"
}

# Starship 
eval "$(starship init bash)"

# OktaAWSCLI
if [[ -f "$HOME/.okta/bash_functions" ]]; then
    . "$HOME/.okta/bash_functions"
fi
if [[ -d "$HOME/.okta/bin" && ":$PATH:" != *":$HOME/.okta/bin:"* ]]; then
    PATH="$HOME/.okta/bin:$PATH"
fi

# GCLOUD and autocomplete
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc"
source "$(brew --prefix)/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc"

#source /Users/myuser/.bashrc

#### FIG ENV VARIABLES ####
# Please make sure this block is at the end of this file.
[ -s ~/.fig/fig.sh ] && source ~/.fig/fig.sh
#### END FIG ENV VARIABLES ####
~$ cat ~/.config/starship.toml 
add_newline = false
[kubernetes]
disabled = false
style = "bright-blue bold"
[aws]
disabled = true
[gcloud]
disabled = true
[python]
#scan_for_pyfiles = false
[character]
success_symbol = "[\\$](green)"
error_symbol = "[\\$](bold red)"
[memory_usage]
disabled = false
[status]
disabled = false
[time]
disabled = false
format = '[$time]($style) '

SCR-20220215-agx

Environment

~$ fig diagnostics
Fig Version: Version 1.0.55 (B365) [U.S.] 
UserShell: /opt/homebrew/bin/bash
Bundle path: /Applications/Fig.app
Autocomplete: true
Settings.json: true
CLI installed: true
CLI tool path: /Users/myuser/.fig/bin/fig
Accessibility: true
Number of specs: 0
SSH Integration: false
Tmux Integration: false
Keybindings path: 
iTerm Integration: application is not present.
Hyper Integration: application is not present.
VSCode Integration: installed!
Docker Integration: true
Symlinked dotfiles: false
Only insert on tab: false
Installed via Brew: true
Installation Script: true
PseudoTerminal Path: /opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/opt/homebrew/bin:/usr/local/bin:/Users/myuser/bin:/Users/myuser/.fig/bin
SecureKeyboardInput: false
SecureKeyboardProcess: <none>
Current active process: ??? (???) - ???
Current working directory: /Users/myuser
Current window identifier: 39804/% (com.apple.Terminal)
Path: /opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/opt/homebrew/bin:/usr/local/bin:/Users/myuser/bin:/Users/myuser/.fig/bin
Fig environment variables:
  - TERM_SESSION_ID=447AB7B7-C741-41F3-BA77-143757FB2565
  - FIG_ENV_VAR=1
  - FIG_INTEGRATION_VERSION=5
  - FIG_TERM=1
  - FIG_TERM_VERSION=3
  - FIG_CHECKED_PROMPTS=1
MacOS Version: 12.1 21C52
Hardware:
  - Model Name: MacBook Pro
  - Model Identifier: MacBookPro18,1
  - Chip: Apple M1 Pro
  - Cores: 10 (8 performance and 2 efficiency)
  - Memory: 32 GB
~$
mschrage commented 2 years ago

@torqu3e if you quit all terminal sessions and then reopen them does this issue go away?

mschrage commented 2 years ago

Hey @torqu3e, I've looked into this more and I think the issue is related to PROMPT_COMMAND.

I'm looking into it now. See #888 for more details.

mschrage commented 2 years ago

The fix is to change this line:

PROMPT_COMMAND='echo -ne "\033]0;${HOSTNAME}:$(basename ${PWD})\007"'

to

PROMPT_COMMAND+='echo -ne "\033]0;${HOSTNAME}:$(basename ${PWD})\007"'
torqu3e commented 2 years ago

@mschrage changing that leads to an error on a new prompt, show below.

bash: __bp_installecho: command not found

Your comment pointed the fact that the prompt does not need to be set since starship dictates the prompt I use. Commenting the PS1 and PROMPT_COMMAND line has made fig work. Thank you for pointing it out. This issue is resolved.

Its also working with kitty as well which is my primary terminal.

torqu3e commented 2 years ago

@mschrage sorry I take part of my previous comment back. The prompt was being set because kitty's or terminal's tab title comes from the prompt, removing that does not let me figure the difference between multiple tabs. Ideally I'd like for this to be solved and not stop using fig completely.

mschrage commented 2 years ago

This will be fixed in the next release. In the meantime, try:

PROMPT_COMMAND+='; echo -ne "\033]0;${HOSTNAME}:$(basename ${PWD})\007"'
torqu3e commented 2 years ago

That is better as in the new window/tab does not break on the prompt but the title bar does not pick up the basename pwd part with that.