Added sr.sh, updated README, and put in tmux fixes

master
Steven Saus 4 years ago
parent a277f34909
commit 655c126c75
  1. 11
      README.md
  2. 49
      sr.sh
  3. 26
      tmux_devour.sh
  4. 27
      tmux_sidebar.sh
  5. 27
      tmux_topbar.sh

@ -1,10 +1,13 @@
# multiple_scripts
Multiple scripts that are useful but don't deserve their own repository.
## mansearch.sh
This is often a repository when I work on small ideas until they're big enough
to deserve thier own repo and README. This readme may very well be outdated
or inaccurate!
Uses fzf and such to search both manpages and tldr and cheatsheets with preview. Run
mansearch -p to update database preemptively.
## sr.sh
A transparent wrapper for surfraw that utilizes fzf
## ytube.sh
@ -26,7 +29,7 @@ Create a sidebar (e.g. for reading manpages) and kill when done.
## tmux_topbar.sh
Create a vertical split (it's actually a bottombar) and kill when done.
Create a vertical split and kill when done.
## briefing.sh

49
sr.sh

@ -0,0 +1,49 @@
#!/bin/bash
##############################################################################
#
# sr.sh
# Wrapper for surfraw using fzf but able to be dropped inline
# (c) Steven Saus 2020
# Licensed under the MIT license
#
##############################################################################
AllVars="${@}"
FirstVar="${1}"
SecondVar="${2}"
Binary=$(which surfraw)
# Check if -g was passed to it for graphical browser
if [[ "${FirstVar}" == "-g" ]];then
FirstVar="${SecondVar}"
fi
# read in array of elvi
readarray -t sr_elvi < <(sr -elvi | awk '{print $1}')
# Was the elvi specified on the command line?
if [[ " ${sr_elvi[@]} " =~ " ${FirstVar} " ]]; then
CommandString=$(echo "${Binary} ${AllVars}")
eval "${CommandString}"
fi
# use fzf to determine which elvi to use
if [[ ! " ${sr_elvi[@]} " =~ " ${FirstVar} " ]]; then
Elvi=$(sr -elvi | fzf --multi | awk '{print $1}')
# If nothing selected, assume it's the default and pass it all to sr
if [ -z "${Elvi}" ];then
CommandString=$(echo "${Binary} ${AllVars}")
eval "${CommandString}"
else
for e in $Elvi;do
echo "Searching ${e%}..."
CommandString=$(echo "${Binary} ${e} ${AllVars}")
eval "${CommandString}"
done
fi
fi

@ -1,12 +1,14 @@
#!/bin/bash
##############################################################################
#
# tmux-devour
# (c) Steven Saus 2020
# Licensed under the MIT license
#
##############################################################################
#maybe use this as a setup for those programs and have a permanent sidebar?
#tmux send-keys -t "%74" "chafa " "/home/steven/downloads/images/big_keys_for_logo.jpg" "C-m"
# See the space!!!
#replaces man command - makes help a fallback
# use pick to deal with the output better
#TOD
c_tmux=$(env | grep -c TMUX)
if [ $c_tmux -gt 0 ];then
@ -20,15 +22,7 @@
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}")
tmux resize-pane -Z -t "$c_pane"
tmux send-keys -t "$c_pane" "$command2" C-m
else
eval "$@"
fi
# if [ $c_tmux -gt 0 ];then
# tmux kill-pane -t "$c_pane"
# fi
# Is it tmux?
# Does the sidebar already exist in this window?
# if not, create sidebar and export variable

@ -1,12 +1,14 @@
#!/bin/bash
##############################################################################
#
# tmux-sidebar
# (c) Steven Saus 2020
# Licensed under the MIT license
#
##############################################################################
#maybe use this as a setup for those programs and have a permanent sidebar?
#tmux send-keys -t "%74" "chafa " "/home/steven/downloads/images/big_keys_for_logo.jpg" "C-m"
# See the space!!!
#replaces man command - makes help a fallback
# use pick to deal with the output better
#TOD
c_tmux=$(env | grep -c TMUX)
if [ $c_tmux -gt 0 ];then
@ -21,16 +23,7 @@
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}")
tmux send-keys -t "$c_pane" "$command2" C-m
tmux last-pane
#tmux send-keys -t "$o_pane" C-o C-m
else
eval "$@"
fi
# if [ $c_tmux -gt 0 ];then
# tmux kill-pane -t "$c_pane"
# fi
# Is it tmux?
# Does the sidebar already exist in this window?
# if not, create sidebar and export variable

@ -1,12 +1,13 @@
#!/bin/bash
##############################################################################
#
# tmux-topbar
# (c) Steven Saus 2020
# Licensed under the MIT license
#
##############################################################################
#maybe use this as a setup for those programs and have a permanent sidebar?
#tmux send-keys -t "%74" "chafa " "/home/steven/downloads/images/big_keys_for_logo.jpg" "C-m"
# See the space!!!
#replaces man command - makes help a fallback
# use pick to deal with the output better
#TOD
c_tmux=$(env | grep -c TMUX)
if [ $c_tmux -gt 0 ];then
@ -22,16 +23,6 @@
command2=$(echo "eval \"${command}\" ; tmux kill-pane -t ${c_pane}")
tmux send-keys -t "$c_pane" "$command2" C-m
tmux last-pane
#tmux send-keys -t "$o_pane" C-o C-m
else
eval "$@"
fi
# if [ $c_tmux -gt 0 ];then
# tmux kill-pane -t "$c_pane"
# fi
# Is it tmux?
# Does the sidebar already exist in this window?
# if not, create sidebar and export variable

Loading…
Cancel
Save