> I have a user defined bash function which takes one string parameter
> and does some operation on that string. i want to be able to call this
> function from with-in tmux and also pass the parameter from tmux
> itself. how can i achieve that ?
You can invoke bash with a command sequence that sources your alias,
then calls it. Two practical examples:
> bind-key T new-window -c "#{pane_current_path}" "bash -c 'source
> /etc/bash/bash_aliases; tress -f'"
> tress is a function (display directory tree + size in pager)
> tress ()
> {
> [ ! -e "$1" ] && par=$1 && shift || par=;
> [ -z "$1" ] && dir=$(pwd) || dir=$(realpath "$@");
> cat <(tree -hDC --dirsfirst --timefmt '%F' $par "$dir"|sed -r
> 's/([^.])\.\//\1/') <(du -sh "$dir") | less -SR
> }
Also useful to read specific (or all) environment profile variables. You
can use tmux command-prompt to capture user input, f.e.:
> bind-key m command-prompt -p "man:" "split-window -c '#{pane_current_path}'
> -p 90 'source /etc/profile.d/less-termcaps.sh && LESS=\"-SRiMJj.2~ --shift
> 5\" man %% || read -n1'"
> /etc/profile.d/less-termcaps.sh (colors man pages):
> export LESS_TERMCAP_us=$(tput smul; tput setaf 5) # underline start:
> underline, magenta
> export LESS_TERMCAP_ue=$(tput rmul; tput sgr0) # underline end: norm
>
> export LESS_TERMCAP_so=$(tput bold; tput rev; tput setaf 2; tput setab 0) #
> standout mode start: bright green, reverse
> export LESS_TERMCAP_se=$(tput rmso; tput sgr0) # standout mode end: reset
>
> export LESS_TERMCAP_mb=$(tput bold; tput setaf 5) # blinking start: bold,
> magenta
> export LESS_TERMCAP_md=$(tput bold; tput setaf 6) # bold mode start: bold,
> cyan
> export LESS_TERMCAP_me=$(tput sgr0) # mode end: reset
>
> export LESS_TERMCAP_mr=$(tput rev)
> export LESS_TERMCAP_mh=$(tput dim; tput setab 5)
> export LESS_TERMCAP_ZN=$(tput ssubm)
> export LESS_TERMCAP_ZV=$(tput rsubm)
> export LESS_TERMCAP_ZO=$(tput ssupm)
> export LESS_TERMCAP_ZW=$(tput rsupm)
>
> export LESS_TERMCAP_ZZ=$(tput sgr0) # reset: do not litter 'env' output
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
tmux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-users