9 Commits

Author SHA1 Message Date
7d2c9aa49f Bump version to 0.1.2 2012-04-26 08:52:02 +01:00
b65355a35a Boolean logic is hard (and buggy? wtf?)
Fixed a bug with alias resolution not working, for reasons that are
currently beyond my understanding of shell scripting it would seem.
2012-04-26 08:51:49 +01:00
8e21664439 Bump version to 0.1.1 2012-04-26 08:29:39 +01:00
d4dfe39037 Improve how return value of certain commands are checked 2012-04-26 02:41:13 +01:00
b0b8d29d27 Make tmuxifier-alias return 1 when no alias is matched 2012-04-26 02:28:03 +01:00
855c522cf0 Avoid exiting with a cleaner syntax for commands that might fail 2012-04-26 02:22:40 +01:00
0d3cfb2494 Improve new_window helper function's internals 2012-04-26 02:10:30 +01:00
60e92c35e8 Improve readme formatting 2012-04-26 00:40:45 +01:00
1e50f0c2c3 Expand usage section in readme 2012-04-26 00:38:03 +01:00
7 changed files with 54 additions and 18 deletions

View File

@@ -65,7 +65,7 @@ And add the following to your `~/.profile`, `~/.bash_profile` or equivalent:
*__Note:__ This section needs expanding upon.* *__Note:__ This section needs expanding upon.*
For a quick reference on available commands, please run: For a quick reference on available commands and their aliases, please run:
tmuxifier help tmuxifier help
@@ -74,6 +74,41 @@ window and session layout files. New layout files are populated with examples
and comments explaining what things do. Also, having a look at the and comments explaining what things do. Also, having a look at the
[examples][] directory will also give you a good idea. [examples][] directory will also give you a good idea.
### Window Layouts
First off you'll want to define a window layout:
tmuxifier new-window my-awesome-window
This will create a new layout file called `my-awesome-window.window.sh` in
your `$TMUXIFIER_LAYOUT_PATH`, and open it with the editor defined in
`$EDITOR`. Customize it as you wish, and save.
You can now load *my-awesome-window* with the following command:
tmuxifier load-window my-awesome-window
You should now have a new Tmux window open created from your custom and
awesome window layout.
### Session Layouts
To create your first session layout, run:
tmuxifier new-session my-awesome-session
Same deal as with creating a new window, except the filename ends with
`.session.sh` instead of `.window.sh`, and the file's pre-populated content
looks different. To have your awesome window loaded, add `load_window
"my-awesome-window"` to the session layout next to existing examples.
To load the session layout simply run:
tmuxifier load-session my-awesome-session
You'll now have a new Tmux session with your previously defined awesome window
in it.
[examples]: https://github.com/jimeh/tmuxifier/tree/master/examples [examples]: https://github.com/jimeh/tmuxifier/tree/master/examples
## Configure & Customize ## Configure & Customize
@@ -168,4 +203,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.

View File

@@ -24,13 +24,12 @@ case "$command" in
;; ;;
* ) * )
command_path="$(command -v "tmuxifier-$command" || true)" # Lookup command, attempt to resolve as alias if fails
! command_path="$(command -v "tmuxifier-$command")"
# Attempt to resolve aliases
if [ -z "$command_path" ]; then if [ -z "$command_path" ]; then
resolved="$(tmuxifier-alias "$command")" resolved="$(tmuxifier-alias "$command")"
if [ ! -z "$resolved" ]; then if [ ! -z "$resolved" ]; then
command_path="$(command -v "tmuxifier-$resolved" || true)" ! command_path="$(command -v "tmuxifier-$resolved")"
fi fi
fi fi

View File

@@ -16,13 +16,14 @@ new_window() {
if [ ! -z "$1" ]; then if [ ! -z "$1" ]; then
window="$1" window="$1"
fi fi
local command=()
if [ ! -z "$2" ]; then if [ ! -z "$2" ]; then
local command="\"$2\"" command+=("$2")
fi fi
if [ ! -z "$window" ]; then if [ ! -z "$window" ]; then
local winarg="-n \"$window\"" local winarg=(-n "$window")
fi fi
eval "tmux new-window -t \"$session:\" $winarg $command" tmux new-window -t "$session:" "${winarg[@]}" "${command[@]}"
} }
# Select a specific window. # Select a specific window.
@@ -156,7 +157,7 @@ initialize_session() {
# created, the session already exists, and we'll need to specifically switch # created, the session already exists, and we'll need to specifically switch
# to it here. # to it here.
finalize_and_go_to_session() { finalize_and_go_to_session() {
tmux kill-window -t "$session:99" 2>/dev/null || true ! tmux kill-window -t "$session:99" 2>/dev/null
if [[ "$(tmuxifier-current-session)" != "$session" ]]; then if [[ "$(tmuxifier-current-session)" != "$session" ]]; then
__go_to_session __go_to_session
fi fi

View File

@@ -30,4 +30,7 @@ case "$1" in
"list-win" | "lsw" ) "list-win" | "lsw" )
echo "list-windows" echo "list-windows"
;; ;;
* )
echo "unknown alias \"$1\""
exit 1
esac esac

View File

@@ -18,13 +18,12 @@ if [ -z "$command" ]; then
exit 1 exit 1
fi fi
command_path="$(command -v "tmuxifier-$command" || true)" # Lookup command, attempt to resolve as alias if fails
! command_path="$(command -v "tmuxifier-$command")"
# Attempt to resolve aliases
if [ -z "$command_path" ]; then if [ -z "$command_path" ]; then
resolved="$(tmuxifier-alias "$command")" resolved="$(tmuxifier-alias "$command")"
if [ ! -z "$resolved" ]; then if [ ! -z "$resolved" ]; then
command_path="$(command -v "tmuxifier-$resolved" || true)" ! command_path="$(command -v "tmuxifier-$resolved")"
fi fi
fi fi

View File

@@ -9,14 +9,14 @@ if [ "$1" == "--complete" ]; then
fi fi
command="$1" command="$1"
command_path="$(command -v "tmuxifier-$command" || true)"
# Attempt to resolve aliases # Lookup command, attempt to resolve as alias if fails
! command_path="$(command -v "tmuxifier-$command")"
if [ -z "$command_path" ]; then if [ -z "$command_path" ]; then
resolved="$(tmuxifier-alias "$command")" resolved="$(tmuxifier-alias "$command")"
if [ ! -z "$resolved" ]; then if [ ! -z "$resolved" ]; then
command="$resolved" command="$resolved"
command_path="$(command -v "tmuxifier-$command" || true)" ! command_path="$(command -v "tmuxifier-$command")"
fi fi
fi fi

View File

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