gpakosz / .tmux

🇫🇷 Oh my tmux! My self-contained, pretty & versatile tmux configuration made with ❤️
MIT License
22.01k stars 3.37k forks source link

.tmux.conf being ignored #582

Closed mircsicz closed 2 years ago

mircsicz commented 2 years ago

Hi hi,

so far I've been using your awesome config for several month on my mac. But I can't use it on fedora, it seems to be ignored and if I try to manually load it from within a tmux (tmux source-file ~/.tmux.conf) window I get the following feedback:

'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' returned 2

hope yoou got a hint...

gpakosz commented 2 years ago

Hello @mircsicz 👋

Can you please launch tmux and then from a page run

$ cut -c3- ~/.tmux.conf | sh -sx _apply_configuration

And paste the output here?

mircsicz commented 2 years ago

@gpakosz thx for taking the time

mircsicz@M720q:~$ cut -c3- ~/.tmux.conf | sh -sx _apply_configuration
+ :
+ set -e
+ unset GREP_OPTIONS
+ export LC_NUMERIC=C
+ LC_NUMERIC=C
+ sed -E s///
+ printf ''
++ uname -s
+ _uname_s=Linux
++ tmux -V
++ awk '{gsub(/[^0-9.]/, "", $2); print ($2+0) * 100}'
+ _tmux_version=320
+ command -v pkill
sh: Zeile 750: !\s+: event not found
sh: Zeile 756: !\bssh\b: event not found
sh: Zeile 761: Syntaxfehler beim unerwarteten Symbol »(«
gpakosz commented 2 years ago

So far I have no idea.

mircsicz commented 2 years ago
  • Can you please make sure you're running the most recent commit of `.tmux.conf?
mircsicz@M720q:~/.tmux$ git pull
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 21 (delta 12), reused 10 (delta 10), pack-reused 4
Entpacke Objekte: 100% (21/21), 22.04 KiB | 1.47 MiB/s, fertig.
Von https://github.com/gpakosz/.tmux
   9a2387c..18a111f  master     -> origin/master
Aktualisiere 9a2387c..18a111f
Fast-forward
 .tmux.conf       | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------
 .tmux.conf.local |  25 +++++++++++++++++++------
 2 files changed, 99 insertions(+), 47 deletions(-)
mircsicz@M720q:~/.tmux$ cd -
/home/mircsicz
mircsicz@M720q:~$ cut -c3- ~/.tmux.conf | sh -sx _apply_configuration
+ :
+ set -e
+ unset GREP_OPTIONS
+ export LC_NUMERIC=C
+ LC_NUMERIC=C
+ sed -E s///
+ printf ''
++ uname -s
+ _uname_s=Linux
++ tmux -V
++ awk '{gsub(/[^0-9.]/, "", $2); print ($2+0) * 100}'
+ _tmux_version=320
+ command -v pkill
sh: Zeile 774: !\s+: event not found
sh: Zeile 781: !\bssh\b: event not found
sh: Zeile 785: Syntaxfehler beim unerwarteten Symbol »(«
  • Can you please make sure you didn't modify .tmux.conf?

see my "git pull"

  • Can you please tell me which version of Fedora you're running, and which shell?
mircsicz@M720q ~ $  cat /etc/redhat-release
Fedora release 36 (Thirty Six)
mircsicz@M720q ~ $  bash --version
GNU bash, Version 5.1.16(1)-release (x86_64-redhat-linux-gnu)
gpakosz commented 2 years ago

Which version of perl do you have?

mircsicz commented 2 years ago

mircsicz@M720q ~ $ perl -v

This is perl 5, version 34, subversion 1 (v5.34.1) built for x86_64-linux-thread-multi

gpakosz commented 2 years ago

I can't reproduce your issue so far

$ vagrant init generic/fedora36
$ vagrant up
$ vagrant ssh
$ cd
$ sudo dnf -y install tmux
$ git clone https://github.com/gpakosz/.tmux.git
$ ln -s .tmux/.tmux.conf
$ tmux
image
mircsicz commented 2 years ago

I've two physical machines and one vm all quite fresh setup, all with same config'S deployed by ansible where it hits:

Screenshot

gpakosz commented 2 years ago

Can you share that ansible conf?

mircsicz commented 2 years ago

Sure, just installing vagrant to reproduce your test... Gi'me a sec

mircsicz commented 2 years ago

There u go:

---
- name: Copy dotfiles and/or configs to the host(s)
  hosts: "{{machines}}"
  gather_facts: false
  become: true
  vars:
    tmpldir: ~/ansible/templates/mircsicz/

  tasks:
    - set_fact:
      remote_user: "{{remoteuser}}"
    - name: Add nopasswd entry for {{remoteuser}} to sudoers.d
      ansible.builtin.template:
        src: '{{ tmpldir }}/sudoers.d-mircsicz.j2'
        dest: '/etc/sudoers.d/{{remoteuser}}'
        validate: /usr/sbin/visudo -cf %s
      tags:
        - sudo

    - name: Copy dotfiles
      ansible.builtin.copy:
        src: "{{ item.src }}"
        dest: "{{ item.dst }}"
        owner: "{{ remoteuser }}"
        group: "{{ remoteuser }}"
      with_items:
        - { src: '{{ tmpldir }}.tmux', dst: '/home/{{ remoteuser }}/' }
        - { src: '{{ tmpldir }}.tmuxinator', dst: '/home/{{ remoteuser }}/' }
        - { src: '{{ tmpldir }}.vimrc', dst: '/home/{{ remoteuser }}/' }
       - { src: '{{ tmpldir }}.bash_aliases', dst: '/home/{{ remoteuser }}/' }
        - { src: '{{ tmpldir }}.bash_profile', dst: '/home/{{ remoteuser }}/' }
        - { src: '{{ tmpldir }}.profile', dst: '/home/{{ remoteuser }}/' }
        - { src: '{{ tmpldir }}.config', dst: '/home/{{ remoteuser }}/' }
      tags:
        - files
    - name: Create symlinks
      ansible.builtin.file:
        src: "{{ item.src }}"
        dest: "{{ item.dst }}"
        state: link
      with_items:
        - { src: '/home/{{ remoteuser }}/.tmux/.tmux.conf', dst: '/home/{{ remoteuser }}/.tmux.conf' }
        - { src: '/home/{{ remoteuser }}/.tmux/.tmux.conf.local', dst: '/home/{{ remoteuser }}/.tmux.conf.local' }
      tags:
        - files

- name: Install basic Apps
  ansible.builtin.import_playbook: play_user-apps.yml
  tags:
    - apps

which is run like this: ansible-playbook -i hosts_my_inv.yml myplay.yml --extra-vars "machines=myhostgroup remoteuser=mircsicz --ask-become-pass --tags=files,apps -vv

EDIT: To create the screenshot I've deleted the symlinks and recreated them manually on each of the three hosts!

gpakosz commented 2 years ago

Do you have set -H or histchars=! in .bash_profile or .profile?

mircsicz commented 2 years ago

Doesn't look like:

mircsicz@fedora ~ $  grep 'set -H|histchars=!' .bash_profile
mircsicz@fedora ~ $  grep 'set -H|histchars=!' .profile
mircsicz@fedora ~ $  grep 'histchars=!' .profile
mircsicz@fedora ~ $  grep 'histchars=!' .bash_profile
mircsicz@fedora ~ $  grep 'set -H' .profile
mircsicz@fedora ~ $  grep 'set -H' .bash_profile
mircsicz@fedora ~ $  grep 'hist' .bashrc
# don't put duplicate lines or lines starting with space in the history.
# append to the history file, don't overwrite it
shopt -s histappend

EDIT: vagrant retest is WIP:

╭─mircsicz@mbp13-wlan.bh.one.lan ~
╰─➤  vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'generic/fedora36' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'generic/fedora36'
    default: URL: https://vagrantcloud.com/generic/fedora36
==> default: Adding box 'generic/fedora36' (v4.1.2) for provider: virtualbox
    default: Downloading: https://vagrantcloud.com/generic/boxes/fedora36/versions/4.1.2/providers/virtualbox.box
Progress: 45% (Rate: 1157k/s, Estimated time remaining: 0:12:07)
gpakosz commented 2 years ago

Or

set -o history
set -o histexpand
gpakosz commented 2 years ago

Can you please share the content of your .bash_profile, .profile and .bashrc?

mircsicz commented 2 years ago

Or

set -o history
set -o histexpand

none of those:

mircsicz@fedora ~ $  grep 'hist' .*
.bashrc:# don't put duplicate lines or lines starting with space in the history.
.bashrc:# append to the history file, don't overwrite it
.bashrc:shopt -s histappend
.bashrc:# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
mircsicz commented 2 years ago

Can you please share the content of your .bash_profile, .profile and .bashrc?

.profile

echo 'EXECUTING ~/.profile'

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [[ -L "$HOME/bin" || -d "$HOME/bin" ]] ; then
        echo 'Adding ~/bin to PATH'
        PATH="$HOME/bin:$PATH"
else
        echo '~/bin does not exist'
fi

.bash_profile:

export SHELLOPTS

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

and finally .bashrc:

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

echo 'EXECUTING ~/.bashrc'

HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

HISTSIZE=1000
HISTFILESIZE=2000

shopt -s checkwinsize

#
# Exports
#
export EDITOR="vim"

#
# OS Detection
#
case "$OSTYPE" in
  solaris*) echo "SOLARIS" ;;
  darwin*)  echo "Welcome to bash on MacOS"; export CLICOLOR=YES; export LS_OPTIONS=''; export LSCOLORS="Gxfxcxdxbxegedabagacad";;
  linux*)   echo "Welcome to bash on LINUX"; export CLICOLOR=YES; export LS_OPTIONS='--color=auto -h';;
  bsd*)     echo "Welcome to bash on BSD"; export CLICOLOR=YES; export LSCOLORS="Gxfxcxdxbxegedabagacad"; export LS_OPTIONS='--color=auto -h';;
  freebsd*) echo "Welcome to bash on FreeBSD"; export CLICOLOR=YES; export LSCOLORS="Gxfxcxdxbxegedabagacad"; export LS_OPTIONS='--color=auto -h';;
  msys*)    echo "WINDOWS" ;;
  *)        echo "unknown: $OSTYPE" ;;
esac

#
# SSH Autocompletion
#
if [ $OSTYPE == darwin* ]; then
    if [ -f $(brew --prefix)/etc/bash_completion ]; then
        . $(brew --prefix)/etc/bash_completion
    fi
fi

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    # We have color support; assume it's compliant with Ecma-48
    # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
    # a case would tend to support setf rather than setaf.)
    color_prompt=yes
    else
    color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[38;5;209m\]\u\[$(tput sgr0)\]\[\033[38;5;3m\]@\[$(tput sgr0)\]\[\033[38;5;33m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;3m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;163m\]\\$\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\] '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
fi

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi
gpakosz commented 2 years ago

The problem is caused by export SHELLOPTS

mircsicz commented 2 years ago

Arggghhh

gpakosz commented 2 years ago

Can you please try the gh-582 branch?

mircsicz commented 2 years ago

Gi'me a sec just testing without, ansible is currently deploying it...

mircsicz commented 2 years ago

Can you please try the gh-582 branch?

Awesome, after rolling back to my .bash_profile with "export SHELLOPTS" and a 'git switch gh-582' I can finally start tmux and see your config <3

gpakosz commented 2 years ago

Thanks I will merge the gh-582 branch which will close this issue.

Not sure export SHELLOPTS is a good idea though 🙂