Skip to content

Commit

Permalink
Extract tmux format strings to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertAudi committed Mar 31, 2019
1 parent ec0f425 commit 03f9e10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/core/constants.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,17 @@ __tsm_commands=(
)
readonly -l __tsm_commands

local __tsm_tmux_delimiter
__tsm_tmux_delimiter=$'\t'
readonly __tsm_tmux_delimiter

local -A __tsm_tmux_formats
__tsm_tmux_formats=(
pane "#{session_name}${__tsm_tmux_delimiter}#{window_index}:#{window_name}${__tsm_tmux_delimiter}#{window_active}:#{window_flags}${__tsm_tmux_delimiter}#{pane_index}:#{pane_current_path}${__tsm_tmux_delimiter}#{pane_active}"
window "#{session_name}${__tsm_tmux_delimiter}#{window_index}${__tsm_tmux_delimiter}#{window_active}:#{window_flags}${__tsm_tmux_delimiter}#{window_layout}"
grouped_sessions "#{session_grouped}${__tsm_tmux_delimiter}#{session_group}${__tsm_tmux_delimiter}#{session_id}${__tsm_tmux_delimiter}#{session_name}"
state "#{client_session}${__tsm_tmux_delimiter}#{client_last_session}"
)
readonly -l __tsm_tmux_formats

# -------------------------------------------------------------------------- }}}
3 changes: 1 addition & 2 deletions src/helpers/dump.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#
# Caveat: Window panes are ignored.
function __tsm::helpers::dump() {
local d=$'\t'
# FIXME: Fail if tmux is not running
# TODO: Find a way to dump all panes including enough info to be able to restore them
command tmux list-panes -a -F "#S${d}#W${d}#{pane_current_path}"
command tmux list-panes -a -F "${__tsm_tmux_formats[pane]}"
}

0 comments on commit 03f9e10

Please sign in to comment.