romkatv / zsh4humans

A turnkey configuration for Zsh
MIT License
1.81k stars 116 forks source link

tmux mode issues #138

Closed kurktchiev closed 3 years ago

kurktchiev commented 3 years ago

Here is how I normally run z4h (v3 and v4):

When I try to do the above with v5 and its internal tmux enabled, I hit a deadstop at step 2. My local tmux -CC just never fires up and it indefinitely sits there until i go and do killall tmux

I am getting around this by disabling the integrated tmux but that kinda robs me of all the cool new stuff you have been working on.

Additional info - I am using tmuxinator to "manage" my local tmux, but ultimately it just still fires up tmux -CC and then fires off a few window create commands to restore my session. Here is the config for the local host if it matters

name: aristotle
root: ~/

# The two options below are needed in order to work integrate with iTerm2 properly
attach: false
on_project_exit: tmux -CC attach

windows:
  - router:
      layout: tiled
      pre:
        - sleep 3
        - tab_color 90 90 90
      panes:
        - rssh router
  - zeus:
      layout: tiled
      pre:
        - sleep 3
        - tab_color 110 150 150
      panes:
        - mosh -n -4 -p 3335 --ssh="ssh -p 3333" --server=/usr/local/bin/mosh-server router-remote
  - ~:
    layout: tiled
    panes:
      -
  - ~:
      layout: tiled
      panes:
        -
  - ~:
      layout: tiled
      panes:
        -
  - sources:
      layout: tiled
      pre:
        - sleep 3
        - tab_color 65 45 35
      panes:
        - cd ~/Sources/

Here is my tmux.conf thats present on both the local and remote box:

# Change prefix key to C-a, easier to type, same to "screen"
unbind C-b
set -g prefix C-a

# Allow Ctrl+a to be passed to the terminal
bind a send-prefix

# ==========================
# ===  General settings  ===
# ==========================
# Set the default $TERM
set -g default-terminal "tmux-256color"
set -gw xterm-keys on
set -qg status-utf8 on
setw -qg utf8 on

# Enable True Colors
set -ga terminal-overrides ",*:Tc"

set -g @copy_use_osc52_fallback on

# Set the maximum number of lines held in window history. TODO: find a way to do get "unlimited"
set -g history-limit 500000

# Set the amount of paste-buffers to store, basically your paste-history
set -g buffer-limit 500000

# Wait time to decide if you are doing a tmux shortcut or not.
set -sg escape-time 10

# Set the amount of time for which status line messages and other on-screen indicators are displayed
set -g display-time 1500

# prevent tmux from closing a window (pane) when the process running it ends
set -g remain-on-exit off

# Allow multiple commands to be entered without pressing the prefix-key again in the
set -g repeat-time 500

# Re-number the windows as you open/close new windows
set -g renumber-windows on

# Allow the windows to be renamed
setw -g allow-rename on

# Do NOT rename the windows automatically, eg change the name to the current process
setw -g automatic-rename off

# This means that tmux will resize the window to the size of the smallest or largest session (see the window-size option) for
# which it is the current window, rather than the session to which it is attached.
# The window may resize when the current window is changed on another session
setw -g aggressive-resize on
# Quick hack to disable aggresive-resize if we are using iTerm
if-shell -b '[ "$LC_TERMINAL" = "iTerm2" ]' 'setw -g aggressive-resize off'

# Set the clock to 24h format
set -g clock-mode-style 24

# Start index of window/pane with 1
set -g base-index 1
setw -g pane-base-index 1

# Enable mouse support
set -g mouse on

# ==========================
# ===   Key bindings     ===
# ==========================

# Unbind default key bindings, we're going to override
unbind "\$" # rename-session
unbind ,    # rename-window
unbind %    # split-window -h
unbind '"'  # split-window
unbind "\}" # swap-pane -D
unbind "\{" # swap-pane -U
unbind "\[" # paste-buffer
unbind "\]"
unbind "'"  # select-window
unbind n    # next-window
unbind p    # previous-window
unbind l    # last-window
unbind M-n  # next window with alert
unbind M-p  # next window with alert
unbind o    # focus thru panes
unbind &    # kill-window
unbind "#"  # list-buffer
unbind =    # choose-buffer
unbind z    # zoom-pane
unbind M-Up  # resize 5 rows up
unbind M-Down # resize 5 rows down
unbind M-Right # resize 5 rows right
unbind M-Left # resize 5 rows left

# Edit configuration and reload
bind C-e new-window -n 'tmux.conf' "sh -c '\${EDITOR:-vim} ~/.tmux.conf && tmux source ~/.tmux.conf && tmux display \"Config reloaded\"'"

# Reload tmux configuration
bind C-r source-file ~/.tmux.conf \; display "Config reloaded"

# new window and retain cwd
bind -n M-t new-window -c "#{pane_current_path}"

# Prompt to rename window right after it's created
#set-hook -g after-new-window 'command-prompt -I "#{window_name}" "rename-window '%%'"'

# Rename session and window
bind r command-prompt -I "#{window_name}" "rename-window '%%'"

# Split panes
bind -nr M-d split-window -h -c "#{pane_current_path}"
bind -nr M-D split-window -v -c "#{pane_current_path}"

# Select pane and windows
bind -nr M-Left previous-window
bind -nr M-Right next-window
bind -nr M-S-Left select-pane -L
bind -nr M-S-Right select-pane -R
bind -nr M-S-Up select-pane -U
bind -nr M-S-Down select-pane -D
bind -r Tab last-window   # cycle thru MRU tabs

# Zoom pane
bind -n M-Enter resize-pane -Z

# Kill pane/window/session shortcuts
bind -nr M-w kill-pane
bind -nr M-W kill-window
bind Q confirm-before -p "kill-session #S? (y/n)" kill-session

# Detach from session
bind d detach

# Hide status bar on demand
bind C-s if -F '#{s/off//:status}' 'set status off' 'set status on'

# Set sync input on/off
bind -n M-I set-window-option synchronize-panes

#TODO: The below tries to play around with changing the background to something non-standard when sync is on
# if -b '$(tmux show-window-options -t nl-cluster synchronize-panes | cut -d " " -f2) = "on"' 'tmux setw -t nl-cluster window-active-style "fg=$color_white,bg=colour088" && tmux setw -t nl-cluster window-style "fg=$color_white,bg=colour052"' 'tmux setw -t nl-cluster window-style "fg=$color_white,bg=$color_dark_grey" && tmux setw -t nl-cluster window-active-style "fg=$color_white,bg=$color_black"'

# ==================================================
# === Window monitoring for activity and silence ===
# ==================================================
# Activity bell and whistles
set -g visual-activity off
set -g monitor-activity on
set -g visual-silence off
set -g visual-bell off
setw -g bell-action other

# ================================================
# ===     Copy mode, scroll and clipboard      ===
# ================================================
# Prefer vi style key table
setw -g mode-keys vi

# Copy mode configuration
bind -n M-Up copy-mode

# Scroll up/down by 1 line, half screen, whole screen
bind -T copy-mode-vi M-Up              send-keys -X scroll-up
bind -T copy-mode-vi M-Down            send-keys -X scroll-down
bind -T copy-mode-vi M-PageUp          send-keys -X halfpage-up
bind -T copy-mode-vi M-PageDown        send-keys -X halfpage-down
bind -T copy-mode-vi PageDown          send-keys -X page-down
bind -T copy-mode-vi PageUp            send-keys -X page-up

# When scrolling with mouse wheel, reduce number of scrolled rows per tick to "1" (default is 5)
bind -T copy-mode-vi WheelUpPane       select-pane \; send-keys -X -N 1 scroll-up
bind -T copy-mode-vi WheelDownPane     select-pane \; send-keys -X -N 1 scroll-down

run -b 'tmux bind -t vi-copy v begin-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
run -b 'tmux bind -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind -t vi-copy y copy-selection 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'

# copy to macOS clipboard
if -b 'command -v pbcopy > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | pbcopy"'
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
# copy to Windows clipboard
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind y run -b "tmux save-buffer - | clip.exe"'
if -b '[ -c /dev/clipboard ]' 'bind y run -b "tmux save-buffer - > /dev/clipboard"'

# buffer manipulations
bind b list-buffers  # list paste buffers
bind p paste-buffer  # paste from the top paste buffer
bind -n M-V choose-buffer # choose which buffer to paste from

# yank="~/.tmux/yank.sh"

# Copy selected text
#bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "$yank"
#bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "$yank"
#bind -T copy-mode-vi Y send-keys -X copy-line \;\
#    run "tmux save-buffer - | $yank"
#bind-key -T copy-mode-vi D send-keys -X copy-end-of-line \;\
#    run "tmux save-buffer - | $yank"
#bind -T copy-mode-vi C-j send-keys -X copy-pipe-and-cancel "$yank"
#bind-key -T copy-mode-vi A send-keys -X append-selection-and-cancel \;\
#    run "tmux save-buffer - | $yank"

# Copy selection on drag end event, but do not cancel copy mode and do not clear selection
# clear select on subsequence mouse click
# bind -T copy-mode-vi MouseDragEnd1Pane \
#    send-keys -X copy-pipe "$yank"
# bind -T copy-mode-vi MouseDown1Pane select-pane \;\
#    send-keys -X clear-selection

# iTerm2 works with clipboard out of the box, set-clipboard already set to "external"
# tmux show-options -g -s set-clipboard
# set-clipboard on|external

# =====================================
# ===           Theme               ===
# =====================================

# Feel free to NOT use this variables at all (remove, rename)
# this are named colors, just for convenience
color_orange="colour202"
color_purple="colour134"
color_green="colour076"
color_blue="colour039"
color_yellow="colour220"
color_red="colour160"
color_dark_red="colour088"
color_black="colour233"
color_white="colour015"
color_light_grey="colour245"
color_dark_grey="colour234"
color_magenta="colour197"

# This is a theme CONTRACT, you are required to define variables below
# Change values, but not remove/rename variables itself
color_dark="$color_black"
color_light="$color_white"
color_session_text="$color_blue"
color_status_text="$color_light_grey"
color_main="$color_orange"
color_secondary="$color_purple"
color_level_ok="$color_green"
color_level_warn="$color_yellow"
color_level_stress="$color_red"
color_window_off_indicator="$color_dark_red"
color_window_off_status_bg="$color_dark_grey"
color_window_off_status_current_bg="$color_white"

# =====================================
# ===    Appearence and status bar  ===
# =====================================
# Setting bg=default or bg=terminal should match the used berminal coloring
# for background, this is useful as that way you can keep having transperency
# and other niceties

set -g mode-style "fg=default,bg=terminal"

# command line style
set -g message-style "fg=$color_main,bg=terminal"

# status line style
set -g status-style "fg=$color_status_text,bg=terminal"

# window segments in status line
set -g window-status-separator ''

# Set parent terminal title to reflect current window in tmux session
# This controls whats show in the iTerm window/tab name
set -g set-titles on
set -g set-titles-string "#I:#W"

#      
setw -g window-status-format " #I:#W "
setw -g window-status-current-style "fg=$color_dark,bold,bg=$color_main"
setw -g window-status-current-format "#[fg=$color_main,bg=terminal]#I:#W#[fg=$color_main,bg=terminal]"
#setw -g window-status-current-format "#[fg=$color_main,bg=terminal]$separator_powerline_left#[default]#I:#W#[fg=$color_main,bg=terminal]$separator_powerline_right#[default]"

# when window has monitoring notification
setw -g window-status-activity-style "fg=$color_blue"

# outline for active pane
setw -g pane-active-border-style "fg=$color_main"

# enable pane names
#set -g pane-border-status bottom
#setw -g pane-border-format '#{pane_title}'

# set inactive/active window styles
# this is a bit confusing but window-style is the the "default" color to be used
# the active style applies on top of it. Which means, that you in order to have a differentiating
# setup, you kinda have to do it backwards by setting the "default" to the color you want your INactive pane to be
set -g window-style "fg=$color_white,bg=$color_dark_grey"
set -g window-active-style "fg=$color_white,bg=terminal"

# general status bar settings
set -g status on
set -g status-interval 1
set -g status-position bottom
set -g status-justify left
set -g status-right-length 100

# define widgets we're going to use in status bar
# note, that this is not the complete list, some of them are loaded from plugins
wg_session="#[fg=$color_dark,bold,bg=$color_magenta] #S#[fg=$color_magenta,bg=default]"
wg_is_zoomed="#[fg=$color_level_warn,bg=terminal]#{?window_zoomed_flag,ZOOMED,}#[default]"
#wg_is_synced="#[fg=$color_dark,bg=$color_level_stress]#{?pane_synchronized,[SYNCED INPUT],}#[default]"
wg_date_time=" %m-%d-%Y %H:%M "

set -g status-left "$wg_session"
set -g status-right "#{prefix_highlight} $wg_is_zoomed $wg_date_time"

# ============================
# ===       Plugins        ===
# ============================
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'pschmitt/tmux-ssh-split'
set -g @plugin 'fcsonline/tmux-thumbs'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'

# Plugin properties

# Configure tmux-prefix-highlight colors
set -g @prefix_highlight_output_prefix ''
set -g @prefix_highlight_output_suffix ''
set -g @prefix_highlight_fg "$color_secondary"
set -g @prefix_highlight_bg "terminal"
set -g @prefix_highlight_show_copy_mode 'on'
set -g @prefix_highlight_copy_mode_attr "fg=$color_secondary,bg=terminal"
set -g @prefix_highlight_show_sync_mode 'on'
set -g @prefix_highlight_sync_prompt ' SYNCED INPUT '
set -g @prefix_highlight_sync_mode_attr "fg=$color_level_stress,bg=terminal"

# Configure tmux-ssh-split
# TODO: this doesnt work when you are nesting sessions, might look at extending
set -g @ssh-split-keep-cwd "true"
set -g @ssh-split-fail "false"
set -g @ssh-split-no-shell "false"
set -g @ssh-split-strip-cmd "false"
set -g @ssh-split-verbose "false"
set -g @ssh-split-h-key "|"
set -g @ssh-split-v-key "_"

# Configure tmux-thumbs
set -g @thumbs-osc52 "1"
set -g @thumbs-unique "true"
set -g @thumbs-key "F"
# Example extra matches
set -g @thumbs-regexp-1 '[a-z]+@[a-z]+.com' # Match emails
set -g @thumbs-regexp-2 '[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:' # Match MAC addresses
set -g @thumbs-regexp-3 'Vlan\d+' # match Vlan interface on network devices

# Run all plugins' scripts
run '~/.tmux/plugins/tpm/tpm'
romkatv commented 3 years ago

I am getting around this by disabling the integrated tmux but that kinda robs me of all the cool new stuff you have been working on.

Which features don't work if you do this?

kurktchiev commented 3 years ago

I guess let me rephrase, the cool new tmux pop up window integrations, cmd line always on bottom obviously do not work and they feel better usability wise than the standard mode of v4.

romkatv commented 3 years ago

They should work. If they don’t work for you, please describe in detail what you are doing. Omit everything that’s not relevant to demonstrate the issue.

kurktchiev commented 3 years ago

I did, if I can only open one window and cannot use v5 under my workflow then it doesn’t work as described in the issue since whatever is happening seems to be happening because of the tmux nesting

romkatv commented 3 years ago

I need detailed instructions that, when followed, show that prompt doesn’t start at the bottom when it should.

kurktchiev commented 3 years ago

Follow the instructions I already posted. Observe nothing working

-B On Sep 18, 2021, 08:28 -0400, Roman Perepelitsa @.***>, wrote:

I need detailed instructions that, when followed, show that prompt doesn’t start at the bottom when it should. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

romkatv commented 3 years ago

Can you post zshrc that I can use to reproduce this?

kurktchiev commented 3 years ago

sure

# Personal Zsh configuration file. It is strongly recommended to keep all
# shell customization and configuration (including exported environment
# variables such as PATH) in this file or in files source by it.
#
# Documentation: https://github.com/romkatv/zsh4humans/blob/v5/README.md.

# Periodic auto-update on Zsh startup: 'ask' or 'no'.
# You can manually run `z4h update` to update everything.
zstyle ':z4h:' auto-update      'ask'
# Ask whether to auto-update this often; has no effect if auto-update is 'no'.
zstyle ':z4h:' auto-update-days '28'

# Automaticaly wrap TTY with a transparent tmux ('integrated'), or start a
# full-fledged tmux ('system'), or disable features that require tmux ('no').
zstyle ':z4h:' start-tmux       'no'
# Move prompt to the bottom when zsh starts up so that it's always in the
# same position. Has no effect if start-tmux is 'no'.
zstyle ':z4h:' prompt-at-bottom 'yes'

# Keyboard type: 'mac' or 'pc'.
zstyle ':z4h:bindkey' keyboard  'mac'

# Right-arrow key accepts one character ('partial-accept') from
# command autosuggestions or the whole thing ('accept')?
zstyle ':z4h:autosuggestions' forward-char 'accept'

# Recursively traverse directories when TAB-completing files.
zstyle ':z4h:fzf-complete' recurse-dirs 'yes'

# Enable ('yes') or disable ('no') automatic teleportation of z4h over
# ssh when connecting to these hosts.
zstyle ':z4h:ssh:example-hostname1'   enable 'yes'
zstyle ':z4h:ssh:*.example-hostname2' enable 'no'
# The default value if none of the overrides above match the hostname.
zstyle ':z4h:ssh:*'                   enable 'no'

# Send these files over to the remote host when connecting over ssh to the
# enabled hosts.
#zstyle ':z4h:ssh:*' send-extra-files '~/.nanorc' '~/.env.zsh'

# Clone additional Git repositories from GitHub.
#
# This doesn't do anything apart from cloning the repository and keeping it
# up-to-date. Cloned files can be used after `z4h init`. This is just an
# example. If you don't plan to use Oh My Zsh, delete this line.
#z4h install ohmyzsh/ohmyzsh || return

# Install or update core components (fzf, zsh-autosuggestions, etc.) and
# initialize Zsh. After this point console I/O is unavailable until Zsh
# is fully initialized. Everything that requires user interaction or can
# perform network I/O must be done above. Everything else is best done below.
z4h init || return

# Extend PATH.
path=(~/bin $path)

# Export environment variables.
export GPG_TTY=$TTY

# Source additional local files if they exist.
# z4h source ~/.env.zsh

# Use additional Git repositories pulled in with `z4h install`.
#
# This is just an example that you should delete. It does nothing useful.
# z4h source $Z4H/ohmyzsh/ohmyzsh/lib/diagnostics.zsh
# z4h source $Z4H/ohmyzsh/ohmyzsh/plugins/emoji-clock/emoji-clock.plugin.zsh
# fpath+=($Z4H/ohmyzsh/ohmyzsh/plugins/supervisor)

# Define key bindings.
z4h bindkey undo Ctrl+/  # undo the last command line change
z4h bindkey redo Alt+/   # redo the last undone command line change

z4h bindkey z4h-cd-back    Shift+Left   # cd into the previous directory
z4h bindkey z4h-cd-forward Shift+Right  # cd into the next directory
z4h bindkey z4h-cd-up      Shift+Up     # cd into the parent directory
z4h bindkey z4h-cd-down    Shift+Down   # cd into a child directory

# Autoload functions.
autoload -Uz zmv

# Define functions and completions.
function md() { [[ $# == 1 ]] && mkdir -p -- "$1" && cd -- "$1" }
compdef _directories md

# Define named directories: ~w <=> Windows home directory on WSL.
[[ -z $z4h_win_home ]] || hash -d w=$z4h_win_home

# Define aliases.
alias tree='tree -a -I .git'

# Add flags to existing aliases.
alias ls="${aliases[ls]:-ls} -A"

# Set shell options: http://zsh.sourceforge.net/Doc/Release/Options.html.
setopt glob_dots     # no special treatment for file names with a leading dot
setopt no_auto_menu  # require an extra TAB press to open the completion menu

z4h source ~/.zshrc.boris.zsh

my extensions

# Extend PATH.
export GOPATH=$HOME/go
export GOROOT=/usr/local/opt/go/libexec
path=(/usr/local/sbin /usr/local/bin /usr/local/opt/ruby/bin ~/.local/bin $GOROOT/bin $GOPATH/bin $path)
# This is a bit dumb, but only way to get around the fact there is system ruby and brew ruby
if (( $+commands[gem] )); then
  export MYGEMS=$(gem env gemdir)
  path=($MYGEMS/bin $path)
fi

# Add Get Mesh Istio binary
export GETMESH_HOME="$HOME/.getmesh"
export PATH="$GETMESH_HOME/bin:$PATH"

# If on a remote host do this
# if [[ -n $Z4H_SSH ]]; then
#   zstyle ...
# else
#   zstyle ...
# fi

# Set color on tabs
function tab_color() {
  echo -ne "\033]6;1;bg;red;brightness;$1\a"
  echo -ne "\033]6;1;bg;green;brightness;$2\a"
  echo -ne "\033]6;1;bg;blue;brightness;$3\a"
}
function tab_color_reset() {
  echo -ne "\033]6;1;bg;*;default\a"
  trap - INT EXIT
}

# Use this to see if True Colors are supported in the terminal
function term_color_support() {
  emulate -L zsh -o prompt_percent -o ksh_arrays
  autoload -Uz zmathfunc && zmathfunc
  local bg fg
  local -i i r g b
  for i in {0..$((COLUMNS-1))}; do
    b='i * 255 / COLUMNS'
    r='255 - b'
    g='255 - abs(r - b)'
    printf -v bg '%02x' $r $g $b
    print -nP "%K{#$bg} "
  done
  print
}

# Spits out a a nice color list and number so you can use for "themeing"
function color_table() {
  for i in {0..255}; do print -Pn "%K{$i}  %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done
}

# Auto retry
function auto-retry()
{
  false
  while [ $? -ne 0 ]; do
      "$@" || (sleep 1;false)
  done
}

# define a function that does clean SSH so we dont pass through z4h
function cssh() { command ssh "$@" }

# Auto retry an ssh connection
function rssh()
{
  # Check we've got command line arguments
  if [ -z "$*" ]; then
      echo "Need to specify ssh options"
      exit 1
  fi
  auto-retry ssh "$@"
}
function rcssh()
{
  # Check we've got command line arguments
  if [ -z "$*" ]; then
      echo "Need to specify ssh options"
      exit 1
  fi
  auto-retry cssh "$@"
}

# Define a title setting function
function settitle_hostname() {
  echo -ne "\033k"$(hostname -s)"\007"
}
function settitle_vpn_text() {
  echo -ne "\033k"$@"\007"
}

# Send command to be executed in the pane below
# function tsb() {
#   args=$@
#   tmux send-keys -t bottom "$args" C-m
# }
# Create a VPN creator for TMUX
# note that you want to work it as: tvpn "some vpn string #tag"
# where #tag will be used to name the newly created pane/split
function tvpn() {
  name=$(awk '{print $NF}' <<< "$@")
  if tmux list-windows | grep -qw "vpns"; then
    tmux split-pane -t vpns -v -p 80 $@
    tmux setw -t vpns pane-border-status bottom
    tmux setw -t vpns pane-border-format "$name"
  else
    tmux new-window -n vpns $@
    tmux setw -t vpns pane-border-status bottom
    tmux setw -t vpns pane-border-format "$name"
  fi
}

# Setup history file pull
# imports on shell start
() {
  local hist
  for hist in ~/.zsh_history*~$HISTFILE(N); do
    fc -RI $hist
  done
}
# callable function to import history on demand
update_history() {
  local hist
  for hist in ~/.zsh_history*~$HISTFILE(N); do
    fc -RI $hist
  done
}

function z4h-ssh-configure() {
  (( z4h_ssh_enable )) || return 0
  local file
  for file in $ZDOTDIR/.zsh_history.*:$z4h_ssh_host(N); do
    (( $+z4h_ssh_send_files[$file] )) && continue
    z4h_ssh_send_files[$file]='"$ZDOTDIR"'${file:t}
  done
}

# Create the control-master dir if it doesnt exist
[[ -e ~/.ssh/control-master ]] || zf_mkdir -p -m 700 ~/.ssh/control-master

# Setup LSD if installed, else setup vanilla LS
if (( $+commands[lsd] )); then
# Setup LSD if installed, else setup vanilla LS
  alias ls='lsd --date "+%m-%d-%Y |%H:%M:%S|"'
  alias l='ls -l'
  alias ll='ls -aL'
  alias lt='ls -aLtr'
  alias la='ls -la'
  alias lat='ls -latr'
else
  alias ls="ls -G"
  alias l='ls -l'
  alias la='ls -la'
  alias ll='ls -la'
fi

# Setup LS_COLORS based on https://raw.githubusercontent.com/trapd00r/LS_COLORS/master/LS_COLORS
# you need brew install coreutils and then gdircolors -b $file in order to "upgrade" to latest
# nice breakdown of values for further tweaking http://www.bigsoft.co.uk/blog/2008/04/11/configuring-ls_colors
# Default value when using the Monokai color scheme in iTerm:
# LS_COLORS=fi=00:mi=00:mh=00:ln=01;36:or=01;31:di=01;34:ow=04;01;34:st=34:tw=04;34:pi=01;33:so=01;33:do=01;33:bd=01;33:cd=01;33:su=01;35:sg=01;35:ca=01;35:ex=01;32:no=38;5;248
export LS_COLORS='bd=38;5;68:ca=38;5;17:cd=38;5;113;1:di=1;34:do=38;5;127:ex=38;5;208;1:pi=38;5;126:fi=0:ln=target:mh=38;5;222;1:no=0:or=48;5;196;38;5;232;1:ow=38;5;220;1:sg=48;5;3;38;5;0:su=38;5;220;1;3;100;1:so=38;5;197:st=38;5;86;48;5;234:tw=48;5;235;38;5;139;3:*LS_COLORS=48;5;89;38;5;197;1;3;4;7:*README=38;5;220;1:*README.rst=38;5;220;1:*README.md=38;5;220;1:*LICENSE=38;5;220;1:*COPYING=38;5;220;1:*INSTALL=38;5;220;1:*COPYRIGHT=38;5;220;1:*AUTHORS=38;5;220;1:*HISTORY=38;5;220;1:*CONTRIBUTORS=38;5;220;1:*PATENTS=38;5;220;1:*VERSION=38;5;220;1:*NOTICE=38;5;220;1:*CHANGES=38;5;220;1:*.log=38;5;190:*.txt=38;5;253:*.etx=38;5;184:*.info=38;5;184:*.markdown=38;5;184:*.md=38;5;184:*.mkd=38;5;184:*.nfo=38;5;184:*.pod=38;5;184:*.rst=38;5;184:*.tex=38;5;184:*.textile=38;5;184:*.bib=38;5;178:*.json=38;5;178:*.jsonl=38;5;178:*.jsonnet=38;5;178:*.libsonnet=38;5;142:*.ndjson=38;5;178:*.msg=38;5;178:*.pgn=38;5;178:*.rss=38;5;178:*.xml=38;5;178:*.fxml=38;5;178:*.toml=38;5;178:*.yaml=38;5;178:*.yml=38;5;178:*.RData=38;5;178:*.rdata=38;5;178:*.xsd=38;5;178:*.dtd=38;5;178:*.sgml=38;5;178:*.rng=38;5;178:*.rnc=38;5;178:*.cbr=38;5;141:*.cbz=38;5;141:*.chm=38;5;141:*.djvu=38;5;141:*.pdf=38;5;141:*.PDF=38;5;141:*.mobi=38;5;141:*.epub=38;5;141:*.docm=38;5;111;4:*.doc=38;5;111:*.docx=38;5;111:*.odb=38;5;111:*.odt=38;5;111:*.rtf=38;5;111:*.odp=38;5;166:*.pps=38;5;166:*.ppt=38;5;166:*.pptx=38;5;166:*.ppts=38;5;166:*.pptxm=38;5;166;4:*.pptsm=38;5;166;4:*.csv=38;5;78:*.tsv=38;5;78:*.ods=38;5;112:*.xla=38;5;76:*.xls=38;5;112:*.xlsx=38;5;112:*.xlsxm=38;5;112;4:*.xltm=38;5;73;4:*.xltx=38;5;73:*.pages=38;5;111:*.numbers=38;5;112:*.key=38;5;166:*config=1:*cfg=1:*conf=1:*rc=1:*authorized_keys=1:*known_hosts=1:*.ini=1:*.plist=1:*.viminfo=1:*.pcf=1:*.psf=1:*.hidden-color-scheme=1:*.hidden-tmTheme=1:*.last-run=1:*.merged-ca-bundle=1:*.sublime-build=1:*.sublime-commands=1:*.sublime-keymap=1:*.sublime-settings=1:*.sublime-snippet=1:*.sublime-project=1:*.sublime-workspace=1:*.tmTheme=1:*.user-ca-bundle=1:*.epf=1:*.git=38;5;197:*.gitignore=38;5;240:*.gitattributes=38;5;240:*.gitmodules=38;5;240:*.awk=38;5;172:*.bash=38;5;172:*.bat=38;5;172:*.BAT=38;5;172:*.sed=38;5;172:*.sh=38;5;172:*.zsh=38;5;172:*.vim=38;5;172:*.kak=38;5;172:*.ahk=38;5;41:*.py=38;5;41:*.ipynb=38;5;41:*.rb=38;5;41:*.gemspec=38;5;41:*.pl=38;5;208:*.PL=38;5;160:*.t=38;5;114:*.msql=38;5;222:*.mysql=38;5;222:*.pgsql=38;5;222:*.sql=38;5;222:*.tcl=38;5;64;1:*.r=38;5;49:*.R=38;5;49:*.gs=38;5;81:*.clj=38;5;41:*.cljs=38;5;41:*.cljc=38;5;41:*.cljw=38;5;41:*.scala=38;5;41:*.sc=38;5;41:*.dart=38;5;51:*.asm=38;5;81:*.cl=38;5;81:*.lisp=38;5;81:*.rkt=38;5;81:*.lua=38;5;81:*.moon=38;5;81:*.c=38;5;81:*.C=38;5;81:*.h=38;5;110:*.H=38;5;110:*.tcc=38;5;110:*.c++=38;5;81:*.h++=38;5;110:*.hpp=38;5;110:*.hxx=38;5;110:*.ii=38;5;110:*.M=38;5;110:*.m=38;5;110:*.cc=38;5;81:*.cs=38;5;81:*.cp=38;5;81:*.cpp=38;5;81:*.cxx=38;5;81:*.cr=38;5;81:*.go=38;5;81:*.f=38;5;81:*.F=38;5;81:*.for=38;5;81:*.ftn=38;5;81:*.f90=38;5;81:*.F90=38;5;81:*.f95=38;5;81:*.F95=38;5;81:*.f03=38;5;81:*.F03=38;5;81:*.f08=38;5;81:*.F08=38;5;81:*.nim=38;5;81:*.nimble=38;5;81:*.s=38;5;110:*.S=38;5;110:*.rs=38;5;81:*.scpt=38;5;219:*.swift=38;5;219:*.sx=38;5;81:*.vala=38;5;81:*.vapi=38;5;81:*.hi=38;5;110:*.hs=38;5;81:*.lhs=38;5;81:*.agda=38;5;81:*.lagda=38;5;81:*.lagda.tex=38;5;81:*.lagda.rst=38;5;81:*.lagda.md=38;5;81:*.agdai=38;5;110:*.zig=38;5;81:*.v=38;5;81:*.pyc=38;5;240:*.tf=38;5;168:*.tfstate=38;5;168:*.tfvars=38;5;168:*.css=38;5;125;1:*.less=38;5;125;1:*.sass=38;5;125;1:*.scss=38;5;125;1:*.htm=38;5;125;1:*.html=38;5;125;1:*.jhtm=38;5;125;1:*.mht=38;5;125;1:*.eml=38;5;125;1:*.mustache=38;5;125;1:*.coffee=38;5;074;1:*.java=38;5;074;1:*.js=38;5;074;1:*.mjs=38;5;074;1:*.jsm=38;5;074;1:*.jsp=38;5;074;1:*.php=38;5;81:*.ctp=38;5;81:*.twig=38;5;81:*.vb=38;5;81:*.vba=38;5;81:*.vbs=38;5;81:*Dockerfile=38;5;155:*.dockerignore=38;5;240:*Makefile=38;5;155:*MANIFEST=38;5;243:*pm_to_blib=38;5;240:*.nix=38;5;155:*.dhall=38;5;178:*.rake=38;5;155:*.am=38;5;242:*.in=38;5;242:*.hin=38;5;242:*.scan=38;5;242:*.m4=38;5;242:*.old=38;5;242:*.out=38;5;242:*.SKIP=38;5;244:*.diff=48;5;197;38;5;232:*.patch=48;5;197;38;5;232;1:*.bmp=38;5;97:*.dicom=38;5;97:*.tiff=38;5;97:*.tif=38;5;97:*.TIFF=38;5;97:*.cdr=38;5;97:*.flif=38;5;97:*.gif=38;5;97:*.icns=38;5;97:*.ico=38;5;97:*.jpeg=38;5;97:*.JPG=38;5;97:*.jpg=38;5;97:*.nth=38;5;97:*.png=38;5;97:*.psd=38;5;97:*.pxd=38;5;97:*.pxm=38;5;97:*.xpm=38;5;97:*.webp=38;5;97:*.ai=38;5;99:*.eps=38;5;99:*.epsf=38;5;99:*.drw=38;5;99:*.ps=38;5;99:*.svg=38;5;99:*.avi=38;5;114:*.divx=38;5;114:*.IFO=38;5;114:*.m2v=38;5;114:*.m4v=38;5;114:*.mkv=38;5;114:*.MOV=38;5;114:*.mov=38;5;114:*.mp4=38;5;114:*.mpeg=38;5;114:*.mpg=38;5;114:*.ogm=38;5;114:*.rmvb=38;5;114:*.sample=38;5;114:*.wmv=38;5;114:*.3g2=38;5;115:*.3gp=38;5;115:*.gp3=38;5;115:*.webm=38;5;115:*.gp4=38;5;115:*.asf=38;5;115:*.flv=38;5;115:*.ts=38;5;115:*.ogv=38;5;115:*.f4v=38;5;115:*.VOB=38;5;115;1:*.vob=38;5;115;1:*.ass=38;5;117:*.srt=38;5;117:*.ssa=38;5;117:*.sub=38;5;117:*.sup=38;5;117:*.vtt=38;5;117:*.3ga=38;5;137;1:*.S3M=38;5;137;1:*.aac=38;5;137;1:*.amr=38;5;137;1:*.au=38;5;137;1:*.caf=38;5;137;1:*.dat=38;5;137;1:*.dts=38;5;137;1:*.fcm=38;5;137;1:*.m4a=38;5;137;1:*.mod=38;5;137;1:*.mp3=38;5;137;1:*.mp4a=38;5;137;1:*.oga=38;5;137;1:*.ogg=38;5;137;1:*.opus=38;5;137;1:*.s3m=38;5;137;1:*.sid=38;5;137;1:*.wma=38;5;137;1:*.ape=38;5;136;1:*.aiff=38;5;136;1:*.cda=38;5;136;1:*.flac=38;5;136;1:*.alac=38;5;136;1:*.mid=38;5;136;1:*.midi=38;5;136;1:*.pcm=38;5;136;1:*.wav=38;5;136;1:*.wv=38;5;136;1:*.wvc=38;5;136;1:*.afm=38;5;66:*.fon=38;5;66:*.fnt=38;5;66:*.pfb=38;5;66:*.pfm=38;5;66:*.ttf=38;5;66:*.otf=38;5;66:*.woff=38;5;66:*.woff2=38;5;66:*.PFA=38;5;66:*.pfa=38;5;66:*.7z=38;5;40:*.a=38;5;40:*.arj=38;5;40:*.bz2=38;5;40:*.cpio=38;5;40:*.gz=38;5;40:*.lrz=38;5;40:*.lz=38;5;40:*.lzma=38;5;40:*.lzo=38;5;40:*.rar=38;5;40:*.s7z=38;5;40:*.sz=38;5;40:*.tar=38;5;40:*.tgz=38;5;40:*.warc=38;5;40:*.WARC=38;5;40:*.xz=38;5;40:*.z=38;5;40:*.zip=38;5;40:*.zipx=38;5;40:*.zoo=38;5;40:*.zpaq=38;5;40:*.zst=38;5;40:*.zstd=38;5;40:*.zz=38;5;40:*.apk=38;5;215:*.ipa=38;5;215:*.deb=38;5;215:*.rpm=38;5;215:*.jad=38;5;215:*.jar=38;5;215:*.cab=38;5;215:*.pak=38;5;215:*.pk3=38;5;215:*.vdf=38;5;215:*.vpk=38;5;215:*.bsp=38;5;215:*.dmg=38;5;215:*.r[0-9]{0,2}=38;5;239:*.zx[0-9]{0,2}=38;5;239:*.z[0-9]{0,2}=38;5;239:*.part=38;5;239:*.iso=38;5;124:*.bin=38;5;124:*.nrg=38;5;124:*.qcow=38;5;124:*.sparseimage=38;5;124:*.toast=38;5;124:*.vcd=38;5;124:*.vmdk=38;5;124:*.accdb=38;5;60:*.accde=38;5;60:*.accdr=38;5;60:*.accdt=38;5;60:*.db=38;5;60:*.fmp12=38;5;60:*.fp7=38;5;60:*.localstorage=38;5;60:*.mdb=38;5;60:*.mde=38;5;60:*.sqlite=38;5;60:*.typelib=38;5;60:*.nc=38;5;60:*.pacnew=38;5;33:*.un~=38;5;241:*.orig=38;5;241:*.BUP=38;5;241:*.bak=38;5;241:*.o=38;5;241:*core=38;5;241:*.mdump=38;5;241:*.rlib=38;5;241:*.dll=38;5;241:*.swp=38;5;244:*.swo=38;5;244:*.tmp=38;5;244:*.sassc=38;5;244:*.pid=38;5;248:*.state=38;5;248:*lockfile=38;5;248:*lock=38;5;248:*.err=38;5;160;1:*.error=38;5;160;1:*.stderr=38;5;160;1:*.aria2=38;5;241:*.dump=38;5;241:*.stackdump=38;5;241:*.zcompdump=38;5;241:*.zwc=38;5;241:*.pcap=38;5;29:*.cap=38;5;29:*.dmp=38;5;29:*.DS_Store=38;5;239:*.localized=38;5;239:*.CFUserTextEncoding=38;5;239:*.allow=38;5;112:*.deny=38;5;196:*.service=38;5;45:*@.service=38;5;45:*.socket=38;5;45:*.swap=38;5;45:*.device=38;5;45:*.mount=38;5;45:*.automount=38;5;45:*.target=38;5;45:*.path=38;5;45:*.timer=38;5;45:*.snapshot=38;5;45:*.application=38;5;116:*.cue=38;5;116:*.description=38;5;116:*.directory=38;5;116:*.m3u=38;5;116:*.m3u8=38;5;116:*.md5=38;5;116:*.properties=38;5;116:*.sfv=38;5;116:*.theme=38;5;116:*.torrent=38;5;116:*.urlview=38;5;116:*.webloc=38;5;116:*.lnk=38;5;39:*CodeResources=38;5;239:*PkgInfo=38;5;239:*.nib=38;5;57:*.car=38;5;57:*.dylib=38;5;241:*.entitlements=1:*.pbxproj=1:*.strings=1:*.storyboard=38;5;196:*.xcconfig=1:*.xcsettings=1:*.xcuserstate=1:*.xcworkspacedata=1:*.xib=38;5;208:*.asc=38;5;192;3:*.bfe=38;5;192;3:*.enc=38;5;192;3:*.gpg=38;5;192;3:*.signature=38;5;192;3:*.sig=38;5;192;3:*.p12=38;5;192;3:*.pem=38;5;192;3:*.pgp=38;5;192;3:*.p7s=38;5;192;3:*id_dsa=38;5;192;3:*id_rsa=38;5;192;3:*id_ecdsa=38;5;192;3:*id_ed25519=38;5;192;3:*.32x=38;5;213:*.cdi=38;5;213:*.fm2=38;5;213:*.rom=38;5;213:*.sav=38;5;213:*.st=38;5;213:*.a00=38;5;213:*.a52=38;5;213:*.A64=38;5;213:*.a64=38;5;213:*.a78=38;5;213:*.adf=38;5;213:*.atr=38;5;213:*.gb=38;5;213:*.gba=38;5;213:*.gbc=38;5;213:*.gel=38;5;213:*.gg=38;5;213:*.ggl=38;5;213:*.ipk=38;5;213:*.j64=38;5;213:*.nds=38;5;213:*.nes=38;5;213:*.sms=38;5;213:*.8xp=38;5;121:*.8eu=38;5;121:*.82p=38;5;121:*.83p=38;5;121:*.8xe=38;5;121:*.stl=38;5;216:*.dwg=38;5;216:*.ply=38;5;216:*.wrl=38;5;216:*.pot=38;5;7:*.pcb=38;5;7:*.mm=38;5;7:*.gbr=38;5;7:*.scm=38;5;7:*.xcf=38;5;7:*.spl=38;5;7:*.Rproj=38;5;11:*.sis=38;5;7:*.1p=38;5;7:*.3p=38;5;7:*.cnc=38;5;7:*.def=38;5;7:*.ex=38;5;7:*.example=38;5;7:*.feature=38;5;7:*.ger=38;5;7:*.ics=38;5;7:*.map=38;5;7:*.mf=38;5;7:*.mfasl=38;5;7:*.mi=38;5;7:*.mtx=38;5;7:*.pc=38;5;7:*.pi=38;5;7:*.plt=38;5;7:*.pm=38;5;7:*.rdf=38;5;7:*.ru=38;5;7:*.sch=38;5;7:*.sty=38;5;7:*.sug=38;5;7:*.tdy=38;5;7:*.tfm=38;5;7:*.tfnt=38;5;7:*.tg=38;5;7:*.vcard=38;5;7:*.vcf=38;5;7:*.xln=38;5;7:*.iml=38;5;166:';

# Get external IP
alias whatsmyip="curl ifconfig.me"

# Use Bat instead of cat if available and pass in some options to make things more readable
if (( $+commands[bat] )); then
  alias cat="bat -p --wrap character"
  export MANPAGER="sh -c 'col -bx | bat -l man -p'"
fi

# if vmux (https://github.com/jceb/vmux) is installed, set it up
if (( $+commands[vmux] && $+commands[nvim] )); then
  export VMUX_EDITOR=nvim
  export VMUX_REALEDITOR_NVIM=/usr/local/bin/nvim
  export VMUX_NOT_SELECT_PANE=0
  export VMUX_GLOBAL=1
  alias nvim="vmux"
fi

# Skin tmux-panes if its around
if (( $+commands[xpanes] )); then
  export TMUX_XPANES_PANE_BORDER_FORMAT="#T #[default]"
fi

# Send these files over to the remote host when using `z4h ssh`.
zstyle ':z4h:ssh:*'                           send-extra-files  '~/.iterm2_shell_integration.zsh' '~/.nanorc' '~/.nano' '~/.zshrc.boris.zsh' '~/.local/share/*' '~/.local/kubectl-aliases.zsh'
zstyle -e ':z4h:ssh:*'                        retrieve-history  'reply=($ZDOTDIR/.zsh_history.${(%):-%m}:$z4h_ssh_host)'
zstyle ':z4h:ssh:*'                           ssh-command       command ssh

# Make tab completion use ~/.ssh/config when invoking ssh
zstyle ':completion:*:ssh:argument-1:'        tag-order         hosts users
zstyle ':completion:*:scp:argument-rest:'     tag-order         hosts files users
zstyle ':completion:*:(ssh|scp):*:hosts'      hosts

# Change the tab title to the ~/.ssh/config equivalent
# zstyle ':z4h:term-title:ssh'                precmd            ${${${Z4H_SSH##*:}//\%/%%}:-%m}
# zstyle ':z4h:term-title:ssh'                preexec           ${${${Z4H_SSH##*:}//\%/%%}:-%m}

# dont engage the z4h ssh wrapper for specific host
zstyle ':z4h:ssh:zeus'                        enable       'no'
zstyle ':z4h:ssh:router'                      enable       'no'
zstyle ':z4h:ssh:*'                              enable       'yes'

# Source additional local files if they exist.
# Enable iTerm integration if we are indeed running iTerm
if [ "$LC_TERMINAL" = "iTerm2" ]; then
  zstyle ':z4h:' iterm2-integration yes
  export ITERM_ENABLE_SHELL_INTEGRATION_WITH_TMUX=YES
fi

# Export environment variables.
export EDITOR=${${commands[nano]:t}:-vi}
export PAGER=less
export LESS="--mouse"

# Install zsh-substring-search
# SHOULDNT BE NEEDED, ITS INCLUDED WITH Z4H NOW
#z4h install -f zsh-users/zsh-history-substring-search || return
#z4h source $Z4H/zsh-users/zsh-history-substring-search/zsh-history-substring-search.zsh
#bindkey '^[[A' history-substring-search-up
#bindkey '^[[B' history-substring-search-down

z4h source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc
z4h source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc
z4h source ~/.local/share/completions/dctl
z4h source <(stern --completion=zsh)
z4h source <(flux completion zsh)
z4h source <(k3d completion zsh)
z4h source <(eksctl completion zsh)
#z4h source <(istioctl completion zsh)
# Add rapture
eval "$( command rapture shell-init )"

# Source the k aliasing for kubectl
z4h source ~/.local/kubectl-aliases.zsh
romkatv commented 3 years ago

This config is rather long. Can you reproduce this issue with a smaller zshrc? Start with the stock zshrc from v5 and make as few changes as you can. Ideally, only change the line with “start-tmux”.

kurktchiev commented 3 years ago

None of my extended configs really affects z4h, I am taking the stock zshrc and everything else i am adding is functions to extend my environment, not configure z4h. So taking the stock zshrc and trying to next tmux still breaks.

-B On Sep 18, 2021, 17:07 -0400, Roman Perepelitsa @.***>, wrote:

This config is rather long. Can you reproduce this issue with a smaller zshrc? Start with the stock zshrc from v5 and make as few changes as you can. Ideally, only change the line with “start-tmux”. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

romkatv commented 3 years ago

If I understand correctly, you are saying that prompt does not start at the bottom of the terminal in some cases when zsh is running under tmux and prompt-at-bottom is set to yes. I would really like to have instructions that I can follow to see this for myself. In the absence of such instructions I've tried the following:

  1. Installed macOS Big Sur.
    • Note: User shell is at its default value: /bin/zsh
  2. Installed iTerm2.
    • Note: All settings are at their default values.
  3. Opened iTerm2.
  4. Installed Homebrew:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  5. Installed tmux:
    brew install tmux
    • Note: There is no ~/.tmux.conf
  6. Downloaded this .zshenv (the current latest version from v5):
    curl -fsSLo ~/.zshenv https://raw.githubusercontent.com/romkatv/zsh4humans/2361c7c63309108e35cfbea1acf2cf8e3a3af6a8/.zshenv
  7. Downloaded this .zshrc (the current latest version from v5):
    curl -fsSLo ~/.zshrc https://raw.githubusercontent.com/romkatv/zsh4humans/2361c7c63309108e35cfbea1acf2cf8e3a3af6a8/.zshrc.mac
  8. Flipped start-tmux from integrated to no:
    sed -i.bak -e '/start-tmux/ s/integrated/no/' ~/.zshrc
  9. Created .p10k.zsh, .p10k-8color.zsh and .p10k-ascii-8color.zsh:
    cat >~/.p10k.zsh >~/.p10k-8color.zsh >~/.p10k-ascii-8color.zsh <<END
    POWERLEVEL9K_MODE=ascii
    POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true
    END
  10. Restarted zsh:
    exec zsh
  11. Started tmux in command center mode:
    tmux -CC

Here's what I've got:

Screenshot 2021-09-19 at 10 36 38

There are two iTerm2 windows on the screenshot. The one in the back is where I typed tmux -CC. The one in the front opened upon execution of that command. Note that prompt is at the bottom in the front window. Thus, my attempt to reproduce the issue has failed.

What am I doing wrong?

kurktchiev commented 3 years ago

repeat what you did but leave start-tmux to yes

romkatv commented 3 years ago

'yes' is not a valid value for start-tmux. I assume you mean 'integrated'. This is technically valid but shouldn't be used if you intend to use tmux manually. Since you do, you shouldn't set start-tmux to integrated.

Do you experience any issues if you set start-tmux to no? If so, provide detailed instructions that I can follow.

kurktchiev commented 3 years ago
# Automaticaly wrap TTY with a transparent tmux ('integrated'), or start a
# full-fledged tmux ('system'), or disable features that require tmux ('no').
zstyle ':z4h:' start-tmux       'integrated'
# Move prompt to the bottom when zsh starts up so that it's always in the
# same position. Has no effect if start-tmux is 'no'.
zstyle ':z4h:' prompt-at-bottom 'yes'

Please explain how this block of documentation is supposed to be interpreted? The way I read it, prompt-at-bottom has no effect if start-tmux is set to 'no'. Also, since i have no idea what "features that require tmux" are and am guessing based on snippets of comments in the files, I am trying to find a way to turn the feature on and integrate it in my workflow.

Might I suggest you create an issue template, with the information you want people to supply you from the start in the format you want and understand rather than the current status quo?

romkatv commented 3 years ago

Please explain how this block of documentation is supposed to be interpreted?

These comments are incorrect.

z4h can automatically start tmux when it's not already running in tmux. That's what start-tmux specifies. If you set it to no, it won't start tmux. system will start plain tmux, which will use your tmux config. command tmux [args].. is similar to system but allows you to specify custom arguments. intergrated will start a special instance of tmux that's almost invisible -- it doesn't respect any special key combinations that tmux normally respects, doesn't respond to manual tmux commands, etc.

There are features in z4h that only work when zsh is running in tmux. Prompt at the bottom is one of them. As far as these features are concerned, it doesn't matter how tmux was started as long as it was started.

I am trying to find a way to turn the feature on and integrate it in my workflow.

My very first comment on this issue gave you the answer. Unfortunately, you replied that this doesn't work and then repeated this multiple times.

Does it or does it not work if you set start-tmux to no? If it does not, describe what you do, what you expect and what you observe.

Might I suggest you create an issue template

If you are implying that it would have caused less frustration on this issue, I doubt it.