From 58564ae6b7a31a7ba396c4dfecc1ba1310df989a Mon Sep 17 00:00:00 2001 From: Nathan Daly Date: Tue, 23 Aug 2016 22:39:15 -0500 Subject: [PATCH] Added .tmux script so the plugin works with `tpm`. Now the plugin can be installed via tmux-plugins/tpm in addition to being installed through zsh's antigen package manager. It now only calls `make install` when installed through antigen; the tmux plugin automatically compiles the binary, but leaves it in the plugin directory. This also allows skipping the "if exists" check, which means plugin updates can also automatically rebuild any changes to the compiled part of the plugin. Updated the README to reflect this new install option. This is part of Issue #43. --- README.rst | 17 ++++++++++++++++- tmux-mem-cpu-load.plugin.tmux | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100755 tmux-mem-cpu-load.plugin.tmux diff --git a/README.rst b/README.rst index 4125e0a..a901ec8 100644 --- a/README.rst +++ b/README.rst @@ -81,7 +81,16 @@ Install make install logout -Build and Install Using `Antigen`_ +Build and Install Using tpm_ +------- + +Include the plugin in your ``.tmux.conf`` + +:: + + set -g @plugin 'thewtex/tmux-mem-cpu-load' + +Build and Install Using Antigen_ ------- Include the bundle in your ``.zshrc`` @@ -100,6 +109,11 @@ Edit ``$HOME/.tmux.conf`` to display the program's output in *status-left* or set -g status-left "#S #[fg=green,bg=black]#(tmux-mem-cpu-load --colors --interval 2)#[default]" set -g status-left-length 60 +If you installed using tpm, you must specify the full path to the +``tmux-mem-cpu-load`` script, like below:: + + set -g status-right "#[fg=green]#($TMUX_PLUGIN_MANAGER_PATH/tmux-mem-cpu-load/tmux-mem-cpu-load --colors --powerline-right --interval 2)#[default]" + Note that the *interval* argument to `tmux-mem-cpu-load` should be the same number of seconds that *status-interval* is set at. @@ -157,6 +171,7 @@ Contributions from: .. _tmux: http://tmux.sourceforge.net/ .. _CMake: http://www.cmake.org .. _`project homepage`: http://github.com/thewtex/tmux-mem-cpu-load +.. _`tpm`: http://github.com/tmux-plugins/tpm .. _`Antigen`: https://github.com/zsh-users/antigen .. _`terminals with 256 color support`: http://misc.flogisoft.com/bash/tip_colors_and_formatting#terminals_compatibility .. _`Pawel 'l0ner' Soltys` : http://l0ner.github.io/ diff --git a/tmux-mem-cpu-load.plugin.tmux b/tmux-mem-cpu-load.plugin.tmux new file mode 100755 index 0000000..bbc9dbf --- /dev/null +++ b/tmux-mem-cpu-load.plugin.tmux @@ -0,0 +1,24 @@ + # vim: tabstop=2 shiftwidth=2 expandtab textwidth=80 linebreak wrap + # + # Copyright 2012 Matthew McCormick + # Copyright 2015 Pawel 'l0ner' Soltys + # + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + +# The directory where this plugin is located. +CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +pushd $CURRENT_DIR #Pushd to the directory where this plugin is located. +cmake . +make +popd