mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 01:46:40 +00:00
51
README.md
51
README.md
@@ -58,23 +58,51 @@ Clone the repo to your machine:
|
||||
git clone https://github.com/jimeh/tmuxifier.git ~/.tmuxifier
|
||||
```
|
||||
|
||||
### bash & zsh
|
||||
Then add `~/.tmuxifier/bin` to your PATH to make the `tmuxifier` executable
|
||||
available to you:
|
||||
|
||||
__In bash & zsh:__
|
||||
|
||||
```bash
|
||||
export PATH="~/.tmuxifier/bin:$PATH"
|
||||
```
|
||||
|
||||
__In tcsh:__
|
||||
|
||||
```tcsh
|
||||
set path = ( "~/.tmuxifier/bin" $path )
|
||||
```
|
||||
|
||||
### Custom Installation Path
|
||||
|
||||
To install Tmuxifier somewhere else than the suggested `~/.tmuxifier`, simply
|
||||
clone the repository to your custom location, and ensure the `bin` folder is
|
||||
added to your PATH making the `tmuxifier` executable available to you.
|
||||
|
||||
## Setup
|
||||
|
||||
__In 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"
|
||||
eval "$(tmuxifier init -)"
|
||||
```
|
||||
|
||||
### tcsh
|
||||
__In tcsh:__
|
||||
|
||||
Add the following to your `~/.cshrc`, `~/.tcshrc` or equivalent:
|
||||
|
||||
```tcsh
|
||||
if ( -s "$HOME/.tmuxifier/init.sh" ) then
|
||||
source "$HOME/.tmuxifier/init.sh"
|
||||
endif
|
||||
eval `tmuxifier init -`
|
||||
```
|
||||
|
||||
## Updating
|
||||
|
||||
```bash
|
||||
cd ~/.tmuxifier
|
||||
git pull
|
||||
```
|
||||
|
||||
## Usage
|
||||
@@ -129,17 +157,6 @@ in it.
|
||||
|
||||
## Configure & Customize
|
||||
|
||||
### 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` or
|
||||
`init.tcsh` from that same path.
|
||||
|
||||
```bash
|
||||
export TMUXIFIER="$HOME/.dotfiles/tmuxifier"
|
||||
[[ -s "$TMUXIFIER/init.sh" ]] && source "$TMUXIFIER/init.sh"
|
||||
```
|
||||
|
||||
### Custom Layouts Path
|
||||
|
||||
You can customize the layouts directory used by Tmuxifier by setting
|
||||
|
||||
@@ -2,8 +2,26 @@
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
resolve_link() {
|
||||
$(type -p greadlink readlink | head -1) $1
|
||||
}
|
||||
|
||||
abs_dirname() {
|
||||
local cwd="$(pwd)"
|
||||
local path="$1"
|
||||
|
||||
while [ -n "$path" ]; do
|
||||
cd "${path%/*}"
|
||||
local name="${path##*/}"
|
||||
path="$(resolve_link "$name" || true)"
|
||||
done
|
||||
|
||||
pwd
|
||||
cd "$cwd"
|
||||
}
|
||||
|
||||
if [ -z "${TMUXIFIER}" ]; then
|
||||
export TMUXIFIER="${HOME}/.tmuxifier"
|
||||
export TMUXIFIER="$(dirname "$(abs_dirname "$0")")"
|
||||
else
|
||||
export TMUXIFIER="${TMUXIFIER%/}"
|
||||
fi
|
||||
|
||||
8
init.sh
8
init.sh
@@ -1,4 +1,4 @@
|
||||
# Set tmuxifier root path.
|
||||
# Set/fix Tmuxifier root path if needed.
|
||||
if [ -z "${TMUXIFIER}" ]; then
|
||||
export TMUXIFIER="${HOME}/.tmuxifier"
|
||||
else
|
||||
@@ -6,10 +6,12 @@ else
|
||||
fi
|
||||
|
||||
# Add `bin` directroy to `$PATH`.
|
||||
export PATH="$TMUXIFIER/bin:$PATH"
|
||||
if [[ ":$PATH:" != *":$TMUXIFIER/bin:"* ]]; then
|
||||
export PATH="$TMUXIFIER/bin:$PATH"
|
||||
fi
|
||||
|
||||
# If `tmuxifier` is available, and `$TMUXIFIER_NO_COMPLETE` is not set, then
|
||||
# load tmuxifier shell completion.
|
||||
# load Tmuxifier shell completion.
|
||||
if [ -n "$(command -v "tmuxifier")" ] && [ -z "$TMUXIFIER_NO_COMPLETE" ]; then
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
source "$TMUXIFIER/completion/tmuxifier.bash"
|
||||
|
||||
10
init.tcsh
10
init.tcsh
@@ -1,13 +1,15 @@
|
||||
# Set tmuxifier root path.
|
||||
# Set Tmuxifier root path if needed.
|
||||
if ( ! $?TMUXIFIER ) then
|
||||
setenv TMUXIFIER "${HOME}/.tmuxifier"
|
||||
endif
|
||||
|
||||
# Add `bin` directroy to `$PATH`.
|
||||
set path = ( $TMUXIFIER/bin $path )
|
||||
# Add `bin` directroy to `$path` if needed.
|
||||
if ( ! (" $path " =~ "* $TMUXIFIER/bin *" ) ) then
|
||||
set path = ( $TMUXIFIER/bin $path )
|
||||
endif
|
||||
|
||||
# If `tmuxifier` is available, and `$TMUXIFIER_NO_COMPLETE` is not set, then
|
||||
# load tmuxifier shell completion.
|
||||
# load Tmuxifier shell completion.
|
||||
if ( ! $?TMUXIFIER_NO_COMPLETE ) then
|
||||
which tmuxifier > /dev/null && source "$TMUXIFIER/completion/tmuxifier.tcsh"
|
||||
endif
|
||||
|
||||
74
libexec/tmuxifier-init
Executable file
74
libexec/tmuxifier-init
Executable file
@@ -0,0 +1,74 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
# Set shell to first argument that is not "-", "-h" or "--help".
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" != "-" ] &&[ "$arg" != "-h" ] && [ "$arg" != "--help" ]; then
|
||||
shell="$arg"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$shell" ]; then
|
||||
shell="$(basename "$SHELL")"
|
||||
fi
|
||||
|
||||
case "$shell" in
|
||||
bash )
|
||||
profile='~/.bash_profile'
|
||||
;;
|
||||
zsh )
|
||||
profile='~/.zshrc'
|
||||
;;
|
||||
ksh )
|
||||
profile='~/.profile'
|
||||
;;
|
||||
csh )
|
||||
profile='~/.cshrc'
|
||||
;;
|
||||
tcsh )
|
||||
profile='~/.tcshrc'
|
||||
;;
|
||||
* )
|
||||
profile='shell init file'
|
||||
;;
|
||||
esac
|
||||
|
||||
# Provide tmuxifier help
|
||||
if [[ " $@ " == *" --help "* ]]; then
|
||||
echo "usage: tmuxifier init -
|
||||
|
||||
Load Tmuxifier by adding the following to your ${profile}:
|
||||
"
|
||||
|
||||
case "$shell" in
|
||||
csh | tcsh )
|
||||
echo " eval \`tmuxifier init -\`
|
||||
"
|
||||
;;
|
||||
* )
|
||||
echo " eval \"\$(tmuxifier init -)\"
|
||||
"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "You might also need to add Tmuxifier's bin directory to your PATH."
|
||||
exit
|
||||
fi
|
||||
|
||||
# Print help if "-" argument is not given
|
||||
if [[ " $@ " != *" - "* ]]; then
|
||||
echo "$(tmuxifier-help init $@)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$shell" in
|
||||
csh | tcsh )
|
||||
echo "setenv TMUXIFIER \"$TMUXIFIER\";"
|
||||
echo "source \"\$TMUXIFIER/init.tcsh\";"
|
||||
;;
|
||||
* )
|
||||
echo "export TMUXIFIER=\"$TMUXIFIER\";"
|
||||
echo "source \"\$TMUXIFIER/init.sh\";"
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user