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.
This commit is contained in:
Nathan Daly 2016-08-23 22:39:15 -05:00
parent 54fdf3c68c
commit 58564ae6b7
2 changed files with 40 additions and 1 deletions

@ -81,7 +81,16 @@ Install
make install make install
logout 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`` 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 "#S #[fg=green,bg=black]#(tmux-mem-cpu-load --colors --interval 2)#[default]"
set -g status-left-length 60 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 Note that the *interval* argument to `tmux-mem-cpu-load` should be the same number
of seconds that *status-interval* is set at. of seconds that *status-interval* is set at.
@ -157,6 +171,7 @@ Contributions from:
.. _tmux: http://tmux.sourceforge.net/ .. _tmux: http://tmux.sourceforge.net/
.. _CMake: http://www.cmake.org .. _CMake: http://www.cmake.org
.. _`project homepage`: http://github.com/thewtex/tmux-mem-cpu-load .. _`project homepage`: http://github.com/thewtex/tmux-mem-cpu-load
.. _`tpm`: http://github.com/tmux-plugins/tpm
.. _`Antigen`: https://github.com/zsh-users/antigen .. _`Antigen`: https://github.com/zsh-users/antigen
.. _`terminals with 256 color support`: http://misc.flogisoft.com/bash/tip_colors_and_formatting#terminals_compatibility .. _`terminals with 256 color support`: http://misc.flogisoft.com/bash/tip_colors_and_formatting#terminals_compatibility
.. _`Pawel 'l0ner' Soltys` : http://l0ner.github.io/ .. _`Pawel 'l0ner' Soltys` : http://l0ner.github.io/

24
tmux-mem-cpu-load.plugin.tmux Executable file

@ -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