From c78c3edbdb969e8ea32112a8c070d6f307baaf58 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Tue, 26 May 2020 08:36:47 +0200 Subject: [PATCH] Rework ranger custom bindings --- dotfiles/ranger.org | 136 ++++++++++++++++++-------------------------- 1 file changed, 55 insertions(+), 81 deletions(-) diff --git a/dotfiles/ranger.org b/dotfiles/ranger.org index d56b3c8..cf3123f 100644 --- a/dotfiles/ranger.org +++ b/dotfiles/ranger.org @@ -186,12 +186,59 @@ alias travel scout -aefiklst #+END_SRC ** Some Custom Keybindings -*** Extract +Extract #+BEGIN_SRC conf map ,x shell ~/.config/ranger/scripts/extract.sh %f #+END_SRC -**** Extract Script +Compress +#+BEGIN_SRC conf + map ,z shell ~/.config/ranger/scripts/compress.sh %f +#+END_SRC + +Get Bibtex from PDF +#+BEGIN_SRC conf + map ,b shell pdf2bib %f +#+END_SRC + + +Delete first page of pdf +#+BEGIN_SRC conf + map ,d shell pdf-delete-first-page %f +#+END_SRC + +Convert PDF to PNG +#+BEGIN_SRC conf + map ,cp shell pdf2png %f +#+END_SRC + +Magit Status +#+BEGIN_SRC conf + map ,gs shell emacsclient -create-frame --alternate-editor="" -n --eval '(magit-status)' +#+END_SRC + +Upload with 0x0 (previously Tansfer.sh) +#+BEGIN_SRC conf + map ,t shell upload %f +#+END_SRC + +Open current folder with PCManFM +#+begin_src conf + map ,o shell nohup pcmanfm %d & +#+end_src + +Open with Emacs +#+begin_src conf + map ,e shell emacsclient -create-frame --alternate-editor="" -n %f +#+end_src + +Print on Rnice +#+BEGIN_SRC conf + map ,p shell print-rnice %f & +#+END_SRC + +** Scripts +*** Extract Script :PROPERTIES: :header-args: :tangle ~/.config/ranger/scripts/extract.sh :header-args+: :comments both :mkdirp yes @@ -205,12 +252,7 @@ alias travel scout -aefiklst fi #+end_src -*** Compress -#+BEGIN_SRC conf - map ,z shell ~/.config/ranger/scripts/compress.sh %f -#+END_SRC - -**** Compress Script +*** Compress Script :PROPERTIES: :header-args: :tangle ~/.config/ranger/scripts/compress.sh :header-args+: :comments both :mkdirp yes @@ -225,76 +267,6 @@ alias travel scout -aefiklst #+end_src -*** Delete first page of pdf -#+BEGIN_SRC conf - map ,d shell ~/.config/ranger/scripts/pdf-delete-first-page.sh %f -#+END_SRC - -**** Delete first page of PDF -:PROPERTIES: -:header-args: :tangle ~/.config/ranger/scripts/pdf-delete-first-page.sh -:header-args+: :comments both :mkdirp yes -:header-args+: :shebang "#!/usr/bin/env bash" -:END: -The requirement is to have =pdftk= or =stapler= installed. - -#+begin_src bash - if [[ -f $1 && $1 == *.pdf ]]; then - # Argument if a file - if type stapler > /dev/null 2>&1; then - stapler del "$1" 1 /tmp/pdftk_out.pdf && mv /tmp/pdftk_out.pdf "$1" - elif type pdftk > /dev/null 2>&1; then - pdftk "$1" cat 2-end output /tmp/pdftk_out.pdf && mv /tmp/pdftk_out.pdf "$1" - else - echo "Neither pdftk nor stapler are installed" - fi - fi -#+end_src - -*** Convert PDF to PNG -#+BEGIN_SRC conf - map ,cp shell pdftoppm -png %f > $(echo %f | cut -f 1 -d '.' | sed 's/$/.png/') -#+END_SRC - -*** Magit Status -#+BEGIN_SRC conf - map ,gs shell emacsclient -create-frame --alternate-editor="" -n --eval '(magit-status)' -#+END_SRC - -*** Upload with 0x0 (previously Tansfer.sh) -#+BEGIN_SRC conf - 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 | xsel -ib;" && tmux select-pane -U - else - curl --progress-bar -F"file=@$1" https://0x0.st | xsel -ib; - fi -#+end_src - -*** Open current folder with PCManFM -#+begin_src conf - map ,o shell nohup pcmanfm %d & -#+end_src - -*** Open with Emacs -#+begin_src conf - map ,e shell emacsclient -create-frame --alternate-editor="" -n %f -#+end_src - -*** Print on Rnice -#+BEGIN_SRC conf - map ,p shell print-rnice %f & -#+END_SRC - ** Define keys for the browser *** Basic #+BEGIN_SRC conf @@ -380,13 +352,15 @@ The requirement is to have =pdftk= or =stapler= installed. *** Go to special folders #+BEGIN_SRC conf - map gh cd ~ - map ga cd ~/Cloud/administratif + map gh cd ~/ + map gb cd ~/Cloud/brain map gm cd ~/Cloud/thesis map gp cd ~/Pictures + map gP cd ~/Cloud/personal map gT cd ~/.local/share/Trash/files map gd cd ~/Downloads - map gc cd ~/.config/literate-dotfiles + map gc cd ~/Cloud + map gV cd ~/.config/literate-dotfiles #+END_SRC *** Get size of folders