From 3aca2a5295db525f0431391416648a3083a220cc Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Sat, 17 Jul 2021 21:08:15 +0300 Subject: [PATCH] control cclip opts in mc --- files/cclip | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/files/cclip b/files/cclip index 46be03f..c08951e 100755 --- a/files/cclip +++ b/files/cclip @@ -355,11 +355,16 @@ _gui() { CLIPBOARD=mc fileargs=$(( $# - 1 )) + softlink=0 + hardlink=0 + keeplink=1 + movelink=0 + while :; do _list l $CLIPBOARD echo "$fileargs files selected" - read -s -p "(q)uit/(c)opy/(p)aste/(d)elete/(e)dit/(b)oard" -n 1 key + read -s -p "(q)uit/(c)opy/(p)aste/(d)elete/(e)dit/(b)oard/(o)pts" -n 1 key echo $'\n' if [[ "$key" = "q" ]]; then break @@ -369,12 +374,11 @@ _gui() { break fi if [[ "$key" = "p" ]]; then - _paste + _paste_clipboard "$CLIPBOARD" break fi if [[ "$key" = "d" ]]; then _delete d mc - break fi if [[ "$key" = "e" ]]; then _edit e mc @@ -385,9 +389,36 @@ _gui() { echo Change board: read -e -i "$CLIPBOARD" CLIPBOARD fi + if [[ "$key" = "o" ]]; then + _gui_opts + fi done } +_gui_opts() { + + while :; do + printf "============= +Options: + m move files: %s + s soft link: %s + l hard link: %s + d keep clipboard: %s + e exit + +Toggle option:\n" "$movelink" "$softlink" "$hardlink" "$keeplink" + read -s -n 1 optkey + + case "$optkey" in + m) movelink=$(( 1 - movelink )) ;; + s) softlink=$(( 1 - softlink )) ;; + l) hardlink=$(( 1 - hardlink )) ;; + d) keeplink=$(( 1 - keeplink )) ;; + e) break;; + esac + done + +} _get_completer() { self=$( basename $( readlink -f "$0" ) ) echo '_CCLIP_EXEC_complete() {