Update ranger simple scripts to work with tmux

This commit is contained in:
Thomas Dehaeze 2020-01-28 21:29:15 +01:00
parent 9877b248dc
commit f46c0586aa

View File

@ -18,10 +18,10 @@
:END:
* Config
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/rc.conf
:header-args+: :comments both :mkdirp yes
:END:
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/rc.conf
:header-args+: :comments both :mkdirp yes
:END:
** Options
#+BEGIN_SRC conf
@ -225,14 +225,45 @@ alias travel scout -aefiklst
** Some Custom Keybindings
*** Extract
#+BEGIN_SRC conf
map ,x shell atool -x %f
# map ,x shell atool -x %f
map ,x shell ~/.config/ranger/scripts/extract.sh %f
#+END_SRC
**** Extract Script
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/scripts/extract.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
if [ $TMUX ]; then
tmux split -v -l 2 atool -x $1 && tmux select-pane -U
else
atool -x $1
fi
#+end_src
*** Compress
#+BEGIN_SRC conf
map ,z shell apack %f.zip %f
# map ,z shell apack %f.zip %f
map ,z shell ~/.config/ranger/scripts/compress.sh %f
#+END_SRC
**** Compress Script
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/scripts/compress.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
if [ $TMUX ]; then
tmux split -v -l 2 apack ${1%.*}.zip $1 && tmux select-pane -U
else
apack ${1%.*}.zip $1
fi
#+end_src
*** Delete first page of pdf
#+BEGIN_SRC conf
map ,d shell ~/scripts/pdf-delete-first-page.sh %f
@ -248,11 +279,26 @@ map ,z shell apack %f.zip %f
map ,gs shell emacsclient -create-frame --alternate-editor="" -n --eval '(magit-status)'
#+END_SRC
*** Upload with Tansfer.sh
*** Upload with 0x0 (previously Tansfer.sh)
#+BEGIN_SRC conf
map ,t shell curl --progress-bar --upload-file %f https://transfer.sh/$(basename $1) | xclip -in -selection clipboard;
# map ,t shell curl --progress-bar --upload-file %f https://transfer.sh/$(basename $1) | xclip -in -selection clipboard;
map ,t shell ~/.config/ranger/scripts/upload.sh %f
#+END_SRC
**** Upload Script
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/scripts/upload.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
if [ $TMUX ]; then
tmux split -v -l 1 curl --progress-bar -F"file=@$1" https://0x0.st | xclip -in -selection clipboard && tmux select-pane -U
else
curl --progress-bar -F"file=@$1" https://0x0.st | xclip -in -selection clipboard;
fi
#+end_src
*** Open current folder with PCManFM
#+begin_src conf
map ,o shell nohup pcmanfm %d &
@ -267,7 +313,7 @@ map ,z shell apack %f.zip %f
*** Basic
#+BEGIN_SRC conf
map Q quit!
map q quit
map q eval fm.execute_console("shell tmux detach") if 'TMUX' in os.environ.keys() else fm.execute_console("quit")
copymap q ZZ ZQ
map R reload_cwd
@ -360,6 +406,7 @@ map ,z shell apack %f.zip %f
map ga cd ~/Cloud/administratif
map gm cd ~/Cloud/thesis
map gp cd ~/Pictures
map gT cd ~/.local/share/Trash/files
map gd cd ~/Downloads
map gc cd ~/.config/literate-dotfiles
#+END_SRC
@ -395,7 +442,7 @@ Should automatically close mimeopen after the program is chosen.
*** Filesystem Operations
#+BEGIN_SRC conf
map = chmod
map = chmod
#+END_SRC
*** Drag and Drop
@ -430,7 +477,7 @@ map = chmod
*** Delete and move files
#+BEGIN_SRC conf
map dD console delete
map dD shell -s trash-put %s
map dd cut
map ud uncut
map da cut mode=add
@ -481,7 +528,6 @@ map = chmod
map <A-Right> tab_move 1
map <A-Left> tab_move -1
map gt tab_move 1
map gT tab_move -1
map gn tab_new ~
map uq tab_restore
map <a-1> tab_open 1
@ -700,10 +746,10 @@ default_linemode devicons
#+END_SRC
* Rifle
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/rifle.conf
:header-args+: :comments both :mkdirp yes
:END:
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/rifle.conf
:header-args+: :comments both :mkdirp yes
:END:
#+BEGIN_SRC conf
# This is the configuration file of "rifle", ranger's file executor/opener.
@ -912,10 +958,10 @@ default_linemode devicons
#+END_SRC
* Ranger Commands
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/commands.py
:header-args+: :comments both :mkdirp yes
:END:
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/commands.py
:header-args+: :comments both :mkdirp yes
:END:
** Import
#+begin_src python
from ranger.api.commands import *