14 Commits

Author SHA1 Message Date
fa28de8b94 Bump version to 0.5.0 2013-06-02 18:30:53 +03:00
0e2cfa2327 Enable load-session command from outside of Tmux
This means that "init" session layouts can now be used to start and/or
re-attach to your main session.

Personally I have a "main" session layout with a couple of default
windows. I can now either start that session, or re-attach to it from
outside of Tmux by just running `tmuxifier s main`, instead of manually
creating a session named "main" and then loading my windows into it.
2013-06-02 18:30:28 +03:00
04c9309668 Bump version to 0.4.1 2013-01-27 02:17:52 +00:00
455d8660f4 Merge pull request #12 from stephenmckinney/fix-list-for-symlinks
Fixes `list` for symlinks
2013-01-26 18:15:37 -08:00
Steve McKinney
00e5c98da0 Fixes list for symlinks 2013-01-26 12:13:47 -05:00
7106a81066 Bump version to 0.4.0 2012-09-06 23:04:20 +01:00
68ee1b8660 Remove capitalization from shell names in headers 2012-09-06 23:01:57 +01:00
11103822c2 Fix tcsh instructions 2012-09-06 23:01:12 +01:00
f460d78f48 Update readme with tcsh installation instructions 2012-09-06 22:57:13 +01:00
2da8fc9d7b Remove hard-coded path to tmuxifier binary from tcsh completion script 2012-09-06 22:51:58 +01:00
e493745b6e Keep indentation consistent 2012-09-06 22:50:18 +01:00
d5d87d3ab2 Fix issue #7
Instead of assuming that the default created window in a new session has
a index of `0`, we now check window index for the session with Tmux's
list-windows command.

Additionally, the default window is now moved to index `999` instead of
`99`, cause I'm paranoid and probably stupid :)
2012-09-06 22:11:51 +01:00
d367b5ecd6 Merge pull request #8 from peter-d/tcsh-support
added setup script and completion script for tcsh
2012-09-06 00:35:59 -07:00
peter-d
3f171997df added setup script and completion script for tcsh 2012-09-05 22:36:52 +02:00
8 changed files with 53 additions and 19 deletions

View File

@@ -52,16 +52,31 @@ Which will yield a Tmux window looking like this:
## Installation
Clone the repo to your machine:
```bash
git clone https://github.com/jimeh/tmuxifier.git ~/.tmuxifier
```
And add the following to your `~/.profile`, `~/.bash_profile` or equivalent:
### bash & zsh
And add the following to your `~/.profile`, `~/.bash_profile`, `~/.zshrc` or
equivalent:
```bash
[[ -s "$HOME/.tmuxifier/init.sh" ]] && source "$HOME/.tmuxifier/init.sh"
```
### tcsh
Add the following to your `~/.cshrc`, `~/.tcshrc` or equivalent:
```tcsh
if ( -s "$HOME/.tmuxifier/init.sh" ) then
source "$HOME/.tmuxifier/init.sh"
endif
```
## Usage
*__Note:__ This section needs expanding upon.*
@@ -117,8 +132,8 @@ in it.
### Custom Installaton Path
To install Tmuxifier to a custom path, clone the repository to your desired
path and set `$TMUXIFIER` to that path, additionally loading `init.sh` from
that same path.
path and set `$TMUXIFIER` to that path, additionally loading `init.sh` or
`init.tcsh` from that same path.
```bash
export TMUXIFIER="$HOME/.dotfiles/tmuxifier"

View File

@@ -0,0 +1,2 @@
complete tmuxifier 'p@1@`tmuxifier commands`@' \
'p@2@`tmuxifier completions $:-1`@'

13
init.tcsh Normal file
View File

@@ -0,0 +1,13 @@
# Set tmuxifier root path.
if ( ! $?TMUXIFIER ) then
setenv TMUXIFIER "${HOME}/.tmuxifier"
endif
# Add `bin` directroy to `$PATH`.
set path = ( $TMUXIFIER/bin $path )
# If `tmuxifier` is available, and `$TMUXIFIER_NO_COMPLETE` is not set, then
# load tmuxifier shell completion.
if ( ! $?TMUXIFIER_NO_COMPLETE ) then
which tmuxifier > /dev/null && source "$TMUXIFIER/completion/tmuxifier.tcsh"
endif

View File

@@ -182,12 +182,10 @@ initialize_session() {
fi
# In order to ensure only specified windows are created, we move the
# default window to position 99, and later remove it with the
# `finalize_session` function.
tmux move-window -s "$session:0" -t "$session:99"
# Ensure correct pane splitting.
__go_to_session
# default window to position 999, and later remove it with the
# `finalize_and_go_to_session` function.
local first_window_index=$(__get_first_window_index)
tmux move-window -s "$session:$first_window_index" -t "$session:999"
# Session created, return ok exit status.
return 0
@@ -207,7 +205,7 @@ initialize_session() {
# to it here.
#
finalize_and_go_to_session() {
! tmux kill-window -t "$session:99" 2>/dev/null
! tmux kill-window -t "$session:999" 2>/dev/null
if [[ "$(tmuxifier-current-session)" != "$session" ]]; then
__go_to_session
fi
@@ -229,6 +227,16 @@ __expand_path() {
echo $(eval echo "$@")
}
__get_first_window_index() {
local index
index=$(tmux list-windows -t "$session:" -F "#{window_index}" 2>/dev/null)
if [ -n "$index" ]; then
echo "$index" | head -1
else
echo "0"
fi
}
__go_to_session() {
if [ -z "$TMUX" ]; then
tmux -u attach-session -t "$session:"

View File

@@ -2,7 +2,7 @@
set -e
[ -n "$TMUXIFIER_DEBUG" ] && set -x
list=$(find "$TMUXIFIER_LAYOUT_PATH" -name "*.session.sh")
list=$(find -L "$TMUXIFIER_LAYOUT_PATH" -name "*.session.sh")
for file in $list; do
file=${file/$TMUXIFIER_LAYOUT_PATH\//}
echo " ${file/.session.sh/}"

View File

@@ -2,7 +2,7 @@
set -e
[ -n "$TMUXIFIER_DEBUG" ] && set -x
list=$(find "$TMUXIFIER_LAYOUT_PATH" -name "*.window.sh")
list=$(find -L "$TMUXIFIER_LAYOUT_PATH" -name "*.window.sh")
for file in $list; do
file=${file/$TMUXIFIER_LAYOUT_PATH\//}
echo " ${file/.window.sh/}"

View File

@@ -18,9 +18,5 @@ fi
# Load runtime functions.
source "$TMUXIFIER/runtime.sh"
if [ ! -z $TMUX ]; then
load_session "$1"
else
echo "tmuxifier: 'load-session' command can only be used from within Tmux."
exit 1
fi
# Load session file.
load_session "$1"

View File

@@ -2,4 +2,4 @@
set -e
[ -n "$TMUXIFIER_DEBUG" ] && set -x
echo "0.3.1"
echo "0.5.0"