literate-dotfiles/docs/ranger.html

1141 lines
52 KiB
HTML
Raw Permalink Normal View History

2020-01-11 22:04:45 +01:00
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
2022-05-09 10:05:23 +02:00
<!-- 2022-05-09 lun. 10:04 -->
2020-01-11 22:04:45 +01:00
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
2021-01-03 22:52:53 +01:00
<title>Ranger</title>
2020-01-11 22:04:45 +01:00
<meta name="author" content="Dehaeze Thomas" />
2021-10-25 14:37:10 +02:00
<meta name="generator" content="Org Mode" />
2021-01-01 20:12:34 +01:00
<link rel="stylesheet" type="text/css" href="./dist/style.css"/>
<script type="text/javascript" src="./dist/script.js"></script>
2020-01-11 22:04:45 +01:00
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="./index.html"> UP </a>
|
<a accesskey="H" href="./index.html"> HOME </a>
2022-05-09 10:05:23 +02:00
</div><div id="content" class="content">
2021-01-03 22:52:53 +01:00
<h1 class="title">Ranger</h1>
2022-05-09 10:05:23 +02:00
<div id="table-of-contents" role="doc-toc">
2020-01-11 22:04:45 +01:00
<h2>Table of Contents</h2>
2022-05-09 10:05:23 +02:00
<div id="text-table-of-contents" role="doc-toc">
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#orgb6407c1">Documentation</a></li>
<li><a href="#org4832301">Config</a>
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#org377a61f">Options</a></li>
<li><a href="#org1fffbc7">Command Aliases in the Console</a></li>
<li><a href="#org678c0de">Some Custom Keybindings</a></li>
<li><a href="#orgf29becc">Scripts</a>
2020-01-28 21:32:38 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#orgb1b07bd">Extract Script</a></li>
<li><a href="#orgc214a55">Compress Script</a></li>
<li><a href="#org24da0c0">Copy File Content</a></li>
<li><a href="#orge10239c">Paste with Rsync</a></li>
2020-01-28 21:32:38 +01:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#org90e8bfd">Define keys for the browser</a>
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#org3d7f0cc">Basic</a></li>
<li><a href="#org5811d27">Open Shell in current directory</a></li>
<li><a href="#orgf09c04f">Open With</a></li>
<li><a href="#orgc9a1e8e">Filter</a></li>
<li><a href="#org0eab614">Tagging / Marking</a></li>
<li><a href="#orga6c4960">VIM-like</a></li>
<li><a href="#orgbaf5bfa">Jumping around</a></li>
<li><a href="#orgd438dd9">Go to special folders</a></li>
<li><a href="#org614f51e">Get size of folders</a></li>
<li><a href="#org9fabfc6">Yank path of directory/file</a></li>
<li><a href="#orgd122cc5">Drag and Drop</a></li>
<li><a href="#org40d7da9">Rename files</a></li>
<li><a href="#orge14bd5c">Paste files</a></li>
<li><a href="#orgaa7c2c3">Delete and move files</a></li>
<li><a href="#org6a0ab9c">Copy files</a></li>
<li><a href="#org96d5c4e">Searching</a></li>
<li><a href="#org9a73d6d">Tabs</a></li>
<li><a href="#org68a56b0">Settings</a></li>
<li><a href="#org0fd03b5">Bookmarks</a></li>
<li><a href="#orgb0115a2">FZF</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#orgdefc138">Define keys for the console</a>
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#org9a83f87">Basic</a></li>
<li><a href="#org1e1bebb">Move around</a></li>
<li><a href="#org31fffe9">Line Editing</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
</ul>
</li>
2021-10-25 14:37:10 +02:00
<li><a href="#rifle">Rifle</a>
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#orgf43c204">Documentation</a></li>
<li><a href="#org23e55de">Text Files</a></li>
<li><a href="#orgde2c8c4">PDF, Epub and jdvu</a></li>
<li><a href="#org1c7acb5">Archives</a></li>
<li><a href="#org76fa21f">Websites</a></li>
<li><a href="#org0700123">Word, Excel and Presentation files</a></li>
<li><a href="#org384b150">Images</a></li>
<li><a href="#org0297fc8">Audio</a></li>
<li><a href="#org915f677">Video</a></li>
<li><a href="#orgc8412d2">Misc</a></li>
2021-10-25 14:37:10 +02:00
</ul>
</li>
2022-05-09 10:05:23 +02:00
<li><a href="#org0e1d7c0">Ranger Commands</a>
2020-01-11 22:04:45 +01:00
<ul>
2022-05-09 10:05:23 +02:00
<li><a href="#orga3bcd54">Import</a></li>
<li><a href="#org5e19416">fzf_select</a></li>
2020-01-11 22:04:45 +01:00
</ul>
</li>
</ul>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgb6407c1" class="outline-2">
<h2 id="orgb6407c1">Documentation</h2>
<div class="outline-text-2" id="text-orgb6407c1">
2020-11-03 16:27:09 +01:00
<blockquote>
<p>
%f the highlighted file
%d the path of the current directory
%s the selected files in the current directory
%t all tagged files in the current directory
%c the full paths of the currently copied/cut files
%p the full paths of selected files
</p>
</blockquote>
2022-05-09 10:05:23 +02:00
<p>
After install, run:
</p>
<div class="org-src-container">
<pre class="src src-bash">ranger --copy-config=scope
</pre>
</div>
<p>
To add <code>scope.sh</code>.
</p>
<p>
To have image preview:
</p>
<div class="org-src-container">
<pre class="src src-bash"><span class="org-type">sudo</span> pip3 install ueberzug
</pre>
</div>
2020-11-03 16:27:09 +01:00
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org4832301" class="outline-2">
<h2 id="org4832301">Config</h2>
<div class="outline-text-2" id="text-org4832301">
2020-01-11 22:04:45 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org377a61f" class="outline-3">
<h3 id="org377a61f">Options</h3>
<div class="outline-text-3" id="text-org377a61f">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-11-03 16:27:09 +01:00
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">Which viewmode should be used? Possible values are:</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">miller: Use miller columns which show multiple levels of the hierarchy</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">multipane: Midnight-commander like multipane view showing all tabs next</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">to each other</span>
2020-01-11 22:04:45 +01:00
set viewmode miller
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">How many columns are there, and what are their relative widths?</span>
set column_ratios <span class="org-highlight-numbers-number">1</span>,<span class="org-highlight-numbers-number">1</span>
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Which files should be hidden? (regular expression)</span>
2020-01-11 22:04:45 +01:00
set hidden_filter ^\.|\.(?:pyc|vrb|pyo|lof|bak|swp|aux|log|nav|out|snm|toc|bcf|run\.xml|synctex\.gz|blg|bbl)$|^lost\+found$|^__(py)?cache__$
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Show hidden files? You can toggle this by typing 'zh'</span>
2020-01-11 22:04:45 +01:00
set show_hidden false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Ask for a confirmation when running the "delete" command?</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Valid values are "always", "never", "multiple" (default)</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">With "multiple", ranger will ask only if you delete multiple files at once.</span>
2020-01-11 22:04:45 +01:00
set confirm_on_delete multiple
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Which script is used to generate file previews?</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">ranger ships with scope.sh, a script that calls external programs (see</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">README.md for dependencies) to preview images, archives, etc.</span>
2020-03-01 22:51:16 +01:00
set preview_script /home/thomas/.config/ranger/scope.sh
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Use the external preview script or display simple plain text or image previews?</span>
2020-01-11 22:04:45 +01:00
set use_preview_script true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Automatically count files in the directory, even before entering them?</span>
2020-01-11 22:04:45 +01:00
set automatically_count_files true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Open all images in this directory when running certain image viewers</span>
2020-01-11 22:04:45 +01:00
set open_all_images true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Be aware of version control systems and display information.</span>
2020-01-11 22:04:45 +01:00
set vcs_aware false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Use one of the supported image preview protocols</span>
2020-01-11 22:04:45 +01:00
set preview_images true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Set the preview image method</span>
2020-05-26 08:40:15 +02:00
set preview_images_method ueberzug
2020-01-11 22:04:45 +01:00
set colorscheme default
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Preview files on the rightmost column?</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">And collapse (shrink) the last column if there is nothing to preview?</span>
2020-01-11 22:04:45 +01:00
set preview_files true
set preview_directories true
set collapse_preview true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Draw the status bar on top of the browser window (default: bottom)</span>
2020-01-11 22:04:45 +01:00
set status_bar_on_top false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Draw a progress bar in the status bar which displays the average state of all</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">currently running tasks which support progress bars?</span>
2020-01-11 22:04:45 +01:00
set draw_progress_bar_in_status_bar true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Draw borders around columns?</span>
2020-01-11 22:04:45 +01:00
set draw_borders true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Display the directory name in tabs?</span>
2020-01-11 22:04:45 +01:00
set dirname_in_tabs false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Enable the mouse support?</span>
2020-01-11 22:04:45 +01:00
set mouse_enabled true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Display the file size in the main column or status bar?</span>
2020-01-11 22:04:45 +01:00
set display_size_in_main_column true
2020-03-01 22:51:16 +01:00
set display_size_in_status_bar false
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Display files tags in all columns or only in main column?</span>
2020-03-01 22:51:16 +01:00
set display_tags_in_all_columns false
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Set a title for the window?</span>
2020-01-11 22:04:45 +01:00
set update_title false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Set the title to "ranger" in the tmux program?</span>
2020-03-01 22:51:16 +01:00
set update_tmux_title true
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Shorten the title if it gets long? The number defines how many</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">directories are displayed at once, 0 turns off this feature.</span>
set shorten_title <span class="org-highlight-numbers-number">3</span>
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Abbreviate $HOME with ~ in the titlebar (first line) of ranger?</span>
2020-01-11 22:04:45 +01:00
set tilde_in_titlebar true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">How many directory-changes or console-commands should be kept in history?</span>
set max_history_size <span class="org-highlight-numbers-number">20</span>
set max_console_history_size <span class="org-highlight-numbers-number">50</span>
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Try to keep so much space between the top/bottom border when scrolling:</span>
set scroll_offset <span class="org-highlight-numbers-number">8</span>
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Flush the input after each key hit? (Noticeable when ranger lags)</span>
2020-01-11 22:04:45 +01:00
set flushinput true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Padding on the right when there's no preview?</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">This allows you to click into the space to run the file.</span>
2020-01-11 22:04:45 +01:00
set padding_right true
set autosave_bookmarks false
set autoupdate_cumulative_size false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Turning this on makes sense for screen readers:</span>
2020-01-11 22:04:45 +01:00
set show_cursor false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">One of: size, natural, basename, atime, ctime, mtime, type, random</span>
2020-01-11 22:04:45 +01:00
set sort natural
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Additional sorting options</span>
2020-01-11 22:04:45 +01:00
set sort_reverse false
set sort_case_insensitive true
set sort_directories_first true
set sort_unicode false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Enable this if key combinations with the Alt Key don't work for you.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">(Especially on xterm)</span>
2020-01-11 22:04:45 +01:00
set xterm_alt_key false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Whether to include bookmarks in cd command</span>
2020-01-11 22:04:45 +01:00
set cd_bookmarks false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Avoid previewing files larger than this size, in bytes. Use a value of 0 to</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">disable this feature.</span>
set preview_max_size <span class="org-highlight-numbers-number">5000000</span>
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Add the highlighted file to the path in the titlebar</span>
2020-01-11 22:04:45 +01:00
set show_selection_in_titlebar true
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">The delay that ranger idly waits for user input, in milliseconds, with a</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">resolution of 100ms. Lower delay reduces lag between directory updates but</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">increases CPU load.</span>
set idle_delay <span class="org-highlight-numbers-number">2000</span>
2020-01-11 22:04:45 +01:00
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">When the metadata manager module looks for metadata, should it only look for</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">a ".metadata.json" file in the current directory, or do a deep search and</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">check all directories above the current one as well?</span>
2020-01-11 22:04:45 +01:00
set metadata_deep_search false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Clear all existing filters when leaving a directory</span>
2020-01-11 22:04:45 +01:00
set clear_filters_on_dir_change false
2020-11-03 16:27:09 +01:00
<span class="org-comment-delimiter"># </span><span class="org-comment">Disable displaying line numbers in main column</span>
2020-01-11 22:04:45 +01:00
set line_numbers false
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org1fffbc7" class="outline-3">
<h3 id="org1fffbc7">Command Aliases in the Console</h3>
<div class="outline-text-3" id="text-org1fffbc7">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2020-03-01 22:51:16 +01:00
<pre class="src src-conf">alias q quit
2020-01-11 22:04:45 +01:00
alias filter scout -prt
alias find scout -aeit
alias mark scout -mr
alias unmark scout -Mr
alias search scout -rs
alias search_inc scout -rts
alias travel scout -aefiklst
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org678c0de" class="outline-3">
<h3 id="org678c0de">Some Custom Keybindings</h3>
<div class="outline-text-3" id="text-org678c0de">
2020-05-26 08:40:15 +02:00
<p>
2021-10-25 14:37:10 +02:00
Extract:
2020-05-26 08:40:15 +02:00
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map ,x shell ~/.config/ranger/scripts/extract.sh %f
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-01-28 21:32:38 +01:00
2020-05-26 08:40:15 +02:00
<p>
2021-10-25 14:37:10 +02:00
Compress:
2020-05-26 08:40:15 +02:00
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map ,z shell ~/.config/ranger/scripts/compress.sh %f
2020-01-28 21:32:38 +01:00
</pre>
</div>
2020-05-26 08:40:15 +02:00
<p>
2021-10-25 14:37:10 +02:00
Get Bibtex from PDF:
2020-05-26 08:40:15 +02:00
</p>
2020-01-28 21:32:38 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map ,b shell pdf2bib %f
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-01-28 21:32:38 +01:00
2020-05-26 08:40:15 +02:00
<p>
2021-10-25 14:37:10 +02:00
Convert images/pdf/&#x2026;:
2020-03-01 22:51:16 +01:00
</p>
<div class="org-src-container">
2021-02-10 18:02:02 +01:00
<pre class="src src-conf">map ,c shell convert-file %f
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-05-26 08:40:15 +02:00
<p>
2021-10-25 14:37:10 +02:00
Open SXIV on current directory:
2020-11-03 16:27:09 +01:00
</p>
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map ,s shell nohup sxiv -t %d &amp;
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-05-26 08:40:15 +02:00
<p>
2021-10-25 14:37:10 +02:00
Upload to <a href="https://0x0.st/">https://0x0.st/</a>:
2020-05-26 08:40:15 +02:00
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map ,t shell upload %f
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-05-26 08:40:15 +02:00
<p>
2021-10-25 14:37:10 +02:00
Open current folder with PCManFM:
2020-05-26 08:40:15 +02:00
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map ,o shell nohup pcmanfm %d &amp;
2020-01-28 21:32:38 +01:00
</pre>
</div>
2020-05-26 08:40:15 +02:00
<p>
2021-10-25 14:37:10 +02:00
Print on Rnice:
2020-05-26 08:40:15 +02:00
</p>
2020-01-28 21:32:38 +01:00
<div class="org-src-container">
2022-05-09 10:05:23 +02:00
<pre class="src src-conf">map ,p shell print-esrf %f &amp;
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-05-26 08:40:15 +02:00
<p>
2021-10-25 14:37:10 +02:00
Backup to NAS:
2020-05-26 08:40:15 +02:00
</p>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-10-25 14:37:10 +02:00
<pre class="src src-conf">map ,B shell ~/.config/ranger/scripts/backup-to-nas.sh %s &amp;
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-11-03 16:27:09 +01:00
<div class="org-src-container">
2021-10-25 14:37:10 +02:00
<pre class="src src-conf">map ,y shell ~/.config/ranger/scripts/copy-content.sh %s &amp;
2020-11-03 16:27:09 +01:00
</pre>
</div>
2020-01-11 22:04:45 +01:00
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgf29becc" class="outline-3">
<h3 id="orgf29becc">Scripts</h3>
<div class="outline-text-3" id="text-orgf29becc">
2020-05-26 08:40:15 +02:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgb1b07bd" class="outline-4">
<h4 id="orgb1b07bd">Extract Script</h4>
<div class="outline-text-4" id="text-orgb1b07bd">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-bash"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-variable-name">TMUX</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
2022-05-09 10:05:23 +02:00
tmux split -v -l <span class="org-highlight-numbers-number">2</span> atool -x <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> &amp;&amp; tmux select-pane -U
2021-01-08 01:34:53 +01:00
<span class="org-keyword">else</span>
2022-05-09 10:05:23 +02:00
atool -x <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span>
2021-01-08 01:34:53 +01:00
<span class="org-keyword">fi</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2020-03-01 22:51:16 +01:00
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgc214a55" class="outline-4">
<h4 id="orgc214a55">Compress Script</h4>
<div class="outline-text-4" id="text-orgc214a55">
2020-03-01 22:51:16 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-bash"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-variable-name">TMUX</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
2022-05-09 10:05:23 +02:00
tmux split -v -l <span class="org-highlight-numbers-number">2</span> apack <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{1%.*}</span></span><span class="org-string">.zip"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> &amp;&amp; tmux select-pane -U
2021-01-08 01:34:53 +01:00
<span class="org-keyword">else</span>
2022-05-09 10:05:23 +02:00
apack <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{1%.*}</span></span><span class="org-string">.zip"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span>
2021-01-08 01:34:53 +01:00
<span class="org-keyword">fi</span>
2020-11-03 16:27:09 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org24da0c0" class="outline-4">
<h4 id="org24da0c0">Copy File Content</h4>
<div class="outline-text-4" id="text-org24da0c0">
2020-11-03 16:27:09 +01:00
<div class="org-src-container">
2022-05-09 10:05:23 +02:00
<pre class="src src-bash">xclip -sel c &lt; <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> &amp;&amp; notify-send <span class="org-string">"Ranger"</span> <span class="org-string">"Copied to clipboard"</span>
2020-11-03 16:27:09 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orge10239c" class="outline-4">
<h4 id="orge10239c">Paste with Rsync</h4>
<div class="outline-text-4" id="text-orge10239c">
2020-11-03 16:27:09 +01:00
<ul class="org-ul">
<li>First argument is the directory where to copy files</li>
<li>All other arguments are files that are to be copied</li>
</ul>
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-bash"><span class="org-keyword">if</span> <span class="org-rainbow-delimiters-depth-1">[</span> $<span class="org-variable-name">TMUX</span> <span class="org-rainbow-delimiters-depth-1">]</span>; <span class="org-keyword">then</span>
2022-05-09 10:05:23 +02:00
tmux split -v -l <span class="org-highlight-numbers-number">1</span> rsync -a --info=progress2 --no-inc-recursive <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{@:2}</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span> &amp;&amp; tmux select-pane -U
2021-01-08 01:34:53 +01:00
<span class="org-keyword">else</span>
2022-05-09 10:05:23 +02:00
rsync -a --info=progress2 --no-inc-recursive <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">{@:2}</span></span><span class="org-string">"</span> <span class="org-string">"</span><span class="org-string"><span class="org-constant">$</span></span><span class="org-string"><span class="org-variable-name">1</span></span><span class="org-string">"</span>
2021-01-08 01:34:53 +01:00
<span class="org-keyword">fi</span>
2020-03-01 22:51:16 +01:00
</pre>
</div>
</div>
</div>
2020-01-11 22:04:45 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org90e8bfd" class="outline-3">
<h3 id="org90e8bfd">Define keys for the browser</h3>
<div class="outline-text-3" id="text-org90e8bfd">
2020-01-11 22:04:45 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org3d7f0cc" class="outline-4">
<h4 id="org3d7f0cc">Basic</h4>
<div class="outline-text-4" id="text-org3d7f0cc">
2020-03-01 22:51:16 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map Q quit!
map q eval fm.execute_console(<span class="org-string">"shell tmux detach"</span>) if <span class="org-string">'TMUX'</span> in os.environ.keys() else fm.execute_console(<span class="org-string">"quit"</span>)
2020-03-01 22:51:16 +01:00
</pre>
</div>
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map &lt;C-c&gt; abort
map &lt;esc&gt; change_mode normal
map ~ set viewmode!
2020-03-01 22:51:16 +01:00
</pre>
</div>
2020-01-11 22:04:45 +01:00
2020-03-01 22:51:16 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map ? help
2020-03-01 22:51:16 +01:00
</pre>
</div>
2020-01-11 22:04:45 +01:00
2020-03-01 22:51:16 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map : console
map ; console
2020-03-01 22:51:16 +01:00
</pre>
</div>
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map ! console shell%space
2020-03-01 22:51:16 +01:00
</pre>
</div>
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map @ console -p6 shell %%s
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org5811d27" class="outline-4">
<h4 id="org5811d27">Open Shell in current directory</h4>
<div class="outline-text-4" id="text-org5811d27">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map s shell $SHELL
map S shell nohup $TERMINAL &amp;
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgf09c04f" class="outline-4">
<h4 id="orgf09c04f">Open With</h4>
<div class="outline-text-4" id="text-orgf09c04f">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map O chain draw_possible_programs; console open_with%space
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgc9a1e8e" class="outline-4">
<h4 id="orgc9a1e8e">Filter</h4>
<div class="outline-text-4" id="text-orgc9a1e8e">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map f console filter%space
<span class="org-comment-delimiter"># </span><span class="org-comment">Reset filter</span>
map F filter
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org0eab614" class="outline-4">
<h4 id="org0eab614">Tagging / Marking</h4>
<div class="outline-text-4" id="text-org0eab614">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf"><span class="org-variable-name">map &lt;Space&gt; mark_files toggle</span>=True
<span class="org-variable-name">map v mark_files all</span>=True toggle=True
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orga6c4960" class="outline-4">
<h4 id="orga6c4960">VIM-like</h4>
<div class="outline-text-4" id="text-orga6c4960">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">copymap &lt;UP&gt; k
copymap &lt;DOWN&gt; j
copymap &lt;LEFT&gt; h
copymap &lt;RIGHT&gt; l
copymap &lt;HOME&gt; gg
copymap &lt;END&gt; G
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgbaf5bfa" class="outline-4">
<h4 id="orgbaf5bfa">Jumping around</h4>
<div class="outline-text-4" id="text-orgbaf5bfa">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map H history_go -1
map L history_go <span class="org-highlight-numbers-number">1</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map ] move_parent <span class="org-highlight-numbers-number">1</span>
map [ move_parent -1
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-03-01 22:51:16 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map } traverse
2020-03-01 22:51:16 +01:00
</pre>
2020-01-11 22:04:45 +01:00
</div>
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map cd console cd%space
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgd438dd9" class="outline-4">
<h4 id="orgd438dd9">Go to special folders</h4>
<div class="outline-text-4" id="text-orgd438dd9">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map gh cd ~/
2022-05-09 10:05:23 +02:00
map gw cd ~/Cloud/work-projects
2021-01-08 01:34:53 +01:00
map gp cd ~/Pictures
2021-10-25 14:37:10 +02:00
map gP cd ~/Cloud/pictures/phone
2021-01-08 01:34:53 +01:00
map gT cd ~/.local/share/Trash/files
map gd cd ~/Downloads
2022-05-09 10:05:23 +02:00
map gD cd ~/Cloud/documents
2021-01-08 01:34:53 +01:00
map gc cd ~/Cloud
map gV cd ~/.config/literate-dotfiles
2022-05-09 10:05:23 +02:00
map gm cd ~/Cloud/meetings
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org614f51e" class="outline-4">
<h4 id="org614f51e">Get size of folders</h4>
<div class="outline-text-4" id="text-org614f51e">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">Get size of all folders</span>
<span class="org-variable-name">map du shell -p du --max-depth</span>=<span class="org-highlight-numbers-number">1</span> -h --apparent-size
<span class="org-comment-delimiter"># </span><span class="org-comment">Get size of all folders and sort them</span>
<span class="org-variable-name">map dU shell -p du --max-depth</span>=<span class="org-highlight-numbers-number">1</span> -h --apparent-size | sort -rh
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org9fabfc6" class="outline-4">
<h4 id="org9fabfc6">Yank path of directory/file</h4>
<div class="outline-text-4" id="text-org9fabfc6">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">Yank path of current directory/file</span>
map yp shell -f echo -n %d/%f | xsel -i; xsel -o | xsel -i -b
<span class="org-comment-delimiter"># </span><span class="org-comment">Yank path of directory</span>
map yd shell -f echo -n %d | xsel -i; xsel -o | xsel -i -b
<span class="org-comment-delimiter"># </span><span class="org-comment">Yank filename</span>
map yn shell -f echo -n %f | xsel -i; xsel -o | xsel -i -b
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgd122cc5" class="outline-4">
<h4 id="orgd122cc5">Drag and Drop</h4>
<div class="outline-text-4" id="text-orgd122cc5">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2022-05-09 10:05:23 +02:00
<pre class="src src-conf">map D shell dragon -a -x %p
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org40d7da9" class="outline-4">
<h4 id="org40d7da9">Rename files</h4>
<div class="outline-text-4" id="text-org40d7da9">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map a rename_append
map C eval fm.execute_console(<span class="org-string">"bulkrename"</span>) if fm.thisdir.marked_items else fm.open_console(<span class="org-string">"rename "</span>)
map A eval fm.open_console(<span class="org-string">'rename '</span> + fm.thisfile.relative_path.replace(<span class="org-string">"%"</span>, <span class="org-string">"%%"</span>))
map I eval fm.open_console(<span class="org-string">'rename '</span> + fm.thisfile.relative_path.replace(<span class="org-string">"%"</span>, <span class="org-string">"%%"</span>), position=<span class="org-highlight-numbers-number">7</span>)
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orge14bd5c" class="outline-4">
<h4 id="orge14bd5c">Paste files</h4>
<div class="outline-text-4" id="text-orge14bd5c">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map pp paste
<span class="org-variable-name">map po paste overwrite</span>=True
<span class="org-variable-name">map pP paste append</span>=True
<span class="org-variable-name">map pO paste overwrite</span>=True append=True
<span class="org-variable-name">map pl paste_symlink relative</span>=False
<span class="org-variable-name">map pL paste_symlink relative</span>=True
map phl paste_hardlink
map pht paste_hardlinked_subtree
2020-01-11 22:04:45 +01:00
</pre>
</div>
2020-11-03 16:27:09 +01:00
<p>
Paste with Rsync
</p>
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map pr shell ~/.config/ranger/scripts/paste-rsync.sh %d %c
2020-11-03 16:27:09 +01:00
</pre>
</div>
2020-01-11 22:04:45 +01:00
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgaa7c2c3" class="outline-4">
<h4 id="orgaa7c2c3">Delete and move files</h4>
<div class="outline-text-4" id="text-orgaa7c2c3">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map dD shell -s trash-put %s
map dd cut
map du uncut
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org6a0ab9c" class="outline-4">
<h4 id="org6a0ab9c">Copy files</h4>
<div class="outline-text-4" id="text-org6a0ab9c">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map yy copy
map yu uncut
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org96d5c4e" class="outline-4">
<h4 id="org96d5c4e">Searching</h4>
<div class="outline-text-4" id="text-org96d5c4e">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map / console search%space
map n search_next
<span class="org-variable-name">map N search_next forward</span>=False
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org9a73d6d" class="outline-4">
<h4 id="org9a73d6d">Tabs</h4>
<div class="outline-text-4" id="text-org9a73d6d">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map &lt;C-n&gt; tab_new ~
map &lt;C-w&gt; tab_close
2020-03-01 22:51:16 +01:00
2021-01-08 01:34:53 +01:00
map &lt;TAB&gt; tab_move <span class="org-highlight-numbers-number">1</span>
map &lt;S-TAB&gt; tab_move -1
2020-01-11 22:04:45 +01:00
2021-01-08 01:34:53 +01:00
map gn tab_new ~
map gt tab_move <span class="org-highlight-numbers-number">1</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org68a56b0" class="outline-4">
<h4 id="org68a56b0">Settings</h4>
<div class="outline-text-4" id="text-org68a56b0">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map zh set show_hidden!
2020-03-01 22:51:16 +01:00
2021-01-08 01:34:53 +01:00
map zi set preview_images!
map zv set use_preview_script!
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org0fd03b5" class="outline-4">
<h4 id="org0fd03b5">Bookmarks</h4>
<div class="outline-text-4" id="text-org0fd03b5">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map `&lt;any&gt; enter_bookmark %any
map <span class="org-string">'&lt;any&gt; enter_bookmark %any</span>
<span class="org-string">map m&lt;any&gt; set_bookmark %any</span>
<span class="org-string">map um&lt;any&gt; unset_bookmark %any</span>
2020-01-11 22:04:45 +01:00
2021-01-08 01:34:53 +01:00
<span class="org-string">map m&lt;bg&gt; draw_bookmarks</span>
<span class="org-string">copymap m&lt;bg&gt; um&lt;bg&gt; `&lt;bg&gt; '</span>&lt;bg&gt;
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgb0115a2" class="outline-4">
<h4 id="orgb0115a2">FZF</h4>
<div class="outline-text-4" id="text-orgb0115a2">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf">map &lt;C-f&gt; fzf_select
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgdefc138" class="outline-3">
<h3 id="orgdefc138">Define keys for the console</h3>
<div class="outline-text-3" id="text-orgdefc138">
2020-01-11 22:04:45 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org9a83f87" class="outline-4">
<h4 id="org9a83f87">Basic</h4>
<div class="outline-text-4" id="text-org9a83f87">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-conf">cmap &lt;tab&gt; eval fm.ui.console.tab()
cmap &lt;s-tab&gt; eval fm.ui.console.tab(-1)
2021-10-25 14:37:10 +02:00
2020-01-11 22:04:45 +01:00
cmap &lt;ESC&gt; eval fm.ui.console.close()
2021-10-25 14:37:10 +02:00
2020-01-11 22:04:45 +01:00
cmap &lt;CR&gt; eval fm.ui.console.execute()
2021-10-25 14:37:10 +02:00
2020-01-11 22:04:45 +01:00
cmap &lt;C-l&gt; redraw_window
copycmap &lt;ESC&gt; &lt;C-c&gt;
copycmap &lt;CR&gt; &lt;C-j&gt;
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org1e1bebb" class="outline-4">
<h4 id="org1e1bebb">Move around</h4>
<div class="outline-text-4" id="text-org1e1bebb">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-conf">cmap &lt;up&gt; eval fm.ui.console.history_move(-1)
2020-11-03 16:27:09 +01:00
cmap &lt;down&gt; eval fm.ui.console.history_move(<span class="org-highlight-numbers-number">1</span>)
<span class="org-variable-name">cmap &lt;left&gt; eval fm.ui.console.move(left</span>=<span class="org-highlight-numbers-number">1</span>)
<span class="org-variable-name">cmap &lt;right&gt; eval fm.ui.console.move(right</span>=<span class="org-highlight-numbers-number">1</span>)
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org31fffe9" class="outline-4">
<h4 id="org31fffe9">Line Editing</h4>
<div class="outline-text-4" id="text-org31fffe9">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
<pre class="src src-conf">cmap &lt;backspace&gt; eval fm.ui.console.delete(-1)
2020-11-03 16:27:09 +01:00
cmap &lt;delete&gt; eval fm.ui.console.delete(<span class="org-highlight-numbers-number">0</span>)
2020-01-11 22:04:45 +01:00
cmap &lt;C-w&gt; eval fm.ui.console.delete_word()
cmap &lt;C-y&gt; eval fm.ui.console.paste()
copycmap &lt;home&gt; &lt;C-a&gt;
copycmap &lt;end&gt; &lt;C-e&gt;
</pre>
</div>
</div>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
<div id="outline-container-rifle" class="outline-2">
<h2 id="rifle">Rifle</h2>
<div class="outline-text-2" id="text-rifle">
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgf43c204" class="outline-3">
<h3 id="orgf43c204">Documentation</h3>
<div class="outline-text-3" id="text-orgf43c204">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">This is the configuration file of "rifle", ranger's file executor/opener.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Each line consists of conditions and a command. For each line the conditions</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">are checked and if they are met, the respective command is run.</span>
<span class="org-comment-delimiter">#</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Syntax:</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">&lt;condition1&gt; , &lt;condition2&gt; , ... = command</span>
<span class="org-comment-delimiter">#</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">The command can contain these environment variables:</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">$1-$9 | The n-th selected file</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">$@ | All selected files</span>
<span class="org-comment-delimiter">#</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">If you use the special command "ask", rifle will ask you what program to run.</span>
<span class="org-comment-delimiter">#</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Prefixing a condition with "!" will negate its result.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">These conditions are currently supported:</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">match &lt;regexp&gt; | The regexp matches $1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">ext &lt;regexp&gt; | The regexp matches the extension of $1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">mime &lt;regexp&gt; | The regexp matches the mime type of $1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">name &lt;regexp&gt; | The regexp matches the basename of $1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">path &lt;regexp&gt; | The regexp matches the absolute path of $1</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">has &lt;program&gt; | The program is installed (i.e. located in $PATH)</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">env &lt;variable&gt; | The environment variable "variable" is non-empty</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">file | $1 is a file</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">directory | $1 is a directory</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">number &lt;n&gt; | change the number of this command to n</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">terminal | stdin, stderr and stdout are connected to a terminal</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">X | $DISPLAY is not empty (i.e. Xorg runs)</span>
<span class="org-comment-delimiter">#</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">There are also pseudo-conditions which have a "side effect":</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">flag &lt;flags&gt; | Change how the program is run. See below.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">label &lt;label&gt; | Assign a label or name to the command so it can</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">| be started with :open_with &lt;label&gt; in ranger</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">| or `rifle -p &lt;label&gt;` in the standalone executable.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">else | Always true.</span>
<span class="org-comment-delimiter">#</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Flags are single characters which slightly transform the command:</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">f | Fork the program, make it run in the background.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">| New command = setsid $command &gt;&amp; /dev/null &amp;</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">r | Execute the command with root permissions</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">| New command = sudo $command</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">t | Run the program in a new terminal. If $TERMCMD is not defined,</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">| rifle will attempt to extract it from $TERM.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">| New command = $TERMCMD -e $command</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Note: The "New command" serves only as an illustration, the exact</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">implementation may differ.</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">Note: When using rifle in ranger, there is an additional flag "c" for</span>
<span class="org-comment-delimiter"># </span><span class="org-comment">only running the current file even if you have marked multiple files.</span>
2021-10-25 14:37:10 +02:00
</pre>
</div>
</div>
</div>
2021-01-08 01:34:53 +01:00
2022-05-09 10:05:23 +02:00
<div id="outline-container-org23e55de" class="outline-3">
<h3 id="org23e55de">Text Files</h3>
<div class="outline-text-3" id="text-org23e55de">
2021-10-25 14:37:10 +02:00
<p>
Define the <code>$EDITOR</code> for text files as first action:
</p>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">mime ^text, label editor</span> = $EDITOR -- <span class="org-string">"$@"</span>
2021-01-08 01:34:53 +01:00
<span class="org-variable-name">mime ^text, label pager</span> = <span class="org-string">"$PAGER"</span> -- <span class="org-string">"$@"</span>
2021-10-25 14:37:10 +02:00
</pre>
</div>
2021-01-08 01:34:53 +01:00
2021-10-25 14:37:10 +02:00
<p>
Favorite editors:
</p>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">mime ^text, has nvim, flag f</span> = nvim <span class="org-string">"$@"</span>
<span class="org-variable-name">mime ^text, has emacsclient, X, flag f</span> = emacsclient -c <span class="org-string">"$@"</span>
</pre>
</div>
<p>
Org mode files
</p>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">ext org, has emacsclient, X, flag f</span> = emacsclient -c <span class="org-string">"$@"</span>
</pre>
</div>
2021-01-08 01:34:53 +01:00
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php</span> = $EDITOR -- <span class="org-string">"$@"</span>
<span class="org-variable-name">!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php</span> = <span class="org-string">"$PAGER"</span> -- <span class="org-string">"$@"</span>
2021-01-08 01:34:53 +01:00
<span class="org-variable-name">ext py</span> = python -- <span class="org-string">"$1"</span>
<span class="org-variable-name">ext pl</span> = perl -- <span class="org-string">"$1"</span>
<span class="org-variable-name">ext rb</span> = ruby -- <span class="org-string">"$1"</span>
<span class="org-variable-name">ext js</span> = node -- <span class="org-string">"$1"</span>
<span class="org-variable-name">ext sh</span> = sh -- <span class="org-string">"$1"</span>
<span class="org-variable-name">ext php</span> = php -- <span class="org-string">"$1"</span>
2021-10-25 14:37:10 +02:00
</pre>
</div>
</div>
</div>
2021-01-08 01:34:53 +01:00
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgde2c8c4" class="outline-3">
<h3 id="orgde2c8c4">PDF, Epub and jdvu</h3>
<div class="outline-text-3" id="text-orgde2c8c4">
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">ext pdf, has zathura, X, flag f</span> = zathura -- <span class="org-string">"$@"</span>
<span class="org-variable-name">ext pdf, has mupdf, X, flag f</span> = mupdf <span class="org-string">"$@"</span>
<span class="org-variable-name">ext pdf, X, flag f</span> = <span class="org-string">"$BROWSER"</span> <span class="org-string">"$@"</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">ext epub, has zathura, X, flag f</span> = zathura -- <span class="org-string">"$@"</span>
<span class="org-variable-name">ext epub, has mupdf, X, flag f</span> = mupdf <span class="org-string">"$@"</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">ext djvu, has zathura, X, flag f</span> = zathura -- <span class="org-string">"$@"</span>
<span class="org-variable-name">ext djvu, has evince, X, flag f</span> = evince -- <span class="org-string">"$@"</span>
<span class="org-variable-name">ext djvu, has atril, X, flag f</span> = atril -- <span class="org-string">"$@"</span>
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org1c7acb5" class="outline-3">
<h3 id="org1c7acb5">Archives</h3>
<div class="outline-text-3" id="text-org1c7acb5">
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool</span> = atool -- <span class="org-string">"$@"</span> | <span class="org-string">"$PAGER"</span>
<span class="org-variable-name">ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool</span> = atool -- <span class="org-string">"$@"</span> | <span class="org-string">"$PAGER"</span>
2021-01-08 01:34:53 +01:00
<span class="org-variable-name">ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack</span> = aunpack -- <span class="org-string">"$@"</span>
<span class="org-variable-name">ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack</span> = aunpack -- <span class="org-string">"$@"</span>
<span class="org-variable-name">ext tar|gz, has tar</span> = tar vvtf <span class="org-string">"$@"</span> | <span class="org-string">"$PAGER"</span>
<span class="org-variable-name">ext tar|gz, has tar</span> = tar vvxf <span class="org-string">"$@"</span>
2021-10-25 14:37:10 +02:00
</pre>
</div>
</div>
</div>
2021-01-08 01:34:53 +01:00
2022-05-09 10:05:23 +02:00
<div id="outline-container-org76fa21f" class="outline-3">
<h3 id="org76fa21f">Websites</h3>
<div class="outline-text-3" id="text-org76fa21f">
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">ext x?html?, has qutebrowser, X, flag f</span> = qutebrowser -- <span class="org-string">"$@"</span>
<span class="org-variable-name">ext x?html?, has firefox, X, flag f</span> = firefox -- <span class="org-string">"$@"</span>
<span class="org-variable-name">ext x?html?, has elinks, terminal</span> = elinks <span class="org-string">"$@"</span>
<span class="org-variable-name">ext x?html?, has w3m, terminal</span> = w3m <span class="org-string">"$@"</span>
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org0700123" class="outline-3">
<h3 id="org0700123">Word, Excel and Presentation files</h3>
<div class="outline-text-3" id="text-org0700123">
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
2022-05-09 10:05:23 +02:00
<pre class="src src-conf"><span class="org-variable-name">ext docx?, has onlyoffice-desktopeditors, X, flag f</span> = onlyoffice-desktopeditors <span class="org-string">"$@"</span>
2021-10-25 14:37:10 +02:00
<span class="org-variable-name">ext docx?, has wps, X, flag f</span> = wps <span class="org-string">"$@"</span>
<span class="org-variable-name">ext docx?, has libreoffice, X, flag f</span> = libreoffice <span class="org-string">"$@"</span>
</pre>
</div>
2021-01-08 01:34:53 +01:00
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
2022-05-09 10:05:23 +02:00
<pre class="src src-conf"><span class="org-variable-name">ext pptx?, has onlyoffice-desktopeditors, X, flag f</span> = onlyoffice-desktopeditors <span class="org-string">"$@"</span>
2021-10-25 14:37:10 +02:00
<span class="org-variable-name">ext pptx?, has wps, X, flag f</span> = wps <span class="org-string">"$@"</span>
<span class="org-variable-name">ext pptx?, has libreoffice, X, flag f</span> = libreoffice <span class="org-string">"$@"</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">ext csv|xlsx?, has sc-im</span> = sc-im -- <span class="org-string">"$@"</span>
2022-05-09 10:05:23 +02:00
<span class="org-variable-name">ext csv|xlsx?, has onlyoffice-desktopeditors, X, flag f</span> = onlyoffice-desktopeditors <span class="org-string">"$@"</span>
2021-10-25 14:37:10 +02:00
<span class="org-variable-name">ext csv|xlsx?, has wps, X, flag f</span> = wps <span class="org-string">"$@"</span>
<span class="org-variable-name">ext csv|xlsx?, has libreoffice, X, flag f</span> = libreoffice <span class="org-string">"$@"</span>
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org384b150" class="outline-3">
<h3 id="org384b150">Images</h3>
<div class="outline-text-3" id="text-org384b150">
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">mime ^image/svg, has inkview, X, flag f</span> = inkview -- <span class="org-string">"$@"</span>
<span class="org-variable-name">mime ^image/svg, has inkscape, X, flag f</span> = inkscape -- <span class="org-string">"$@"</span>
<span class="org-variable-name">mime ^image/svg, has display, X, flag f</span> = display -- <span class="org-string">"$@"</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">mime ^image/gif, has mpv, X, flag f</span> = mpv --loop -- <span class="org-string">"$@"</span>
<span class="org-variable-name">mime ^image/gif, has qutebrowser, X, flag f</span> = qutebrowser -- <span class="org-string">"$@"</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">mime ^image, has sxiv, X, flag f</span> = sxiv -- <span class="org-string">"$@"</span>
<span class="org-variable-name">mime ^image, has feh, X, flag f</span> = feh --scale-down --auto-zoom -- <span class="org-string">"$@"</span>
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org0297fc8" class="outline-3">
<h3 id="org0297fc8">Audio</h3>
<div class="outline-text-3" id="text-org0297fc8">
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">mime ^audio|ogg$, terminal, has mpv</span> = mpv --no-audio-display -- <span class="org-string">"$@"</span>
<span class="org-variable-name">mime ^audio|ogg$, X, flag f, has vlc</span> = vlc -- <span class="org-string">"$@"</span>
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org915f677" class="outline-3">
<h3 id="org915f677">Video</h3>
<div class="outline-text-3" id="text-org915f677">
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
<pre class="src src-conf"><span class="org-variable-name">mime ^video, has mpv, X, flag f</span> = mpv -- <span class="org-string">"$@"</span>
<span class="org-variable-name">mime ^video, has vlc, X, flag f</span> = vlc -- <span class="org-string">"$@"</span>
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orgc8412d2" class="outline-3">
<h3 id="orgc8412d2">Misc</h3>
<div class="outline-text-3" id="text-orgc8412d2">
2021-10-25 14:37:10 +02:00
<div class="org-src-container">
<pre class="src src-conf">ext <span class="org-highlight-numbers-number">1</span> = man <span class="org-string">"$1"</span>
<span class="org-variable-name">ext s[wmf]c, has zsnes, X</span> = zsnes <span class="org-string">"$1"</span>
<span class="org-variable-name">ext s[wmf]c, has snes9x-gtk,X</span> = snes9x-gtk <span class="org-string">"$1"</span>
<span class="org-variable-name">ext nes, has fceux, X</span> = fceux <span class="org-string">"$1"</span>
<span class="org-variable-name">ext exe</span> = wine <span class="org-string">"$1"</span>
<span class="org-variable-name">name ^[mM]akefile$</span> = make
</pre>
</div>
<div class="org-src-container">
<pre class="src src-conf"><span class="org-comment-delimiter"># </span><span class="org-comment">Define the editor for non-text files + pager as last action</span>
2021-01-08 01:34:53 +01:00
<span class="org-variable-name">!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php</span> = ask
<span class="org-variable-name">label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php</span> = $EDITOR -- <span class="org-string">"$@"</span>
<span class="org-variable-name">label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php</span> = <span class="org-string">"$PAGER"</span> -- <span class="org-string">"$@"</span>
2022-05-09 10:05:23 +02:00
<span class="org-variable-name">has dragon, X, flag f</span> = dragon -a -x <span class="org-string">"$@"</span>
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2021-10-25 14:37:10 +02:00
</div>
2020-01-11 22:04:45 +01:00
2022-05-09 10:05:23 +02:00
<div id="outline-container-org0e1d7c0" class="outline-2">
<h2 id="org0e1d7c0">Ranger Commands</h2>
<div class="outline-text-2" id="text-org0e1d7c0">
2020-01-11 22:04:45 +01:00
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-orga3bcd54" class="outline-3">
<h3 id="orga3bcd54">Import</h3>
<div class="outline-text-3" id="text-orga3bcd54">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-python"><span class="org-keyword">from</span> ranger.api.commands <span class="org-keyword">import</span> *
2020-01-11 22:04:45 +01:00
2021-01-08 01:34:53 +01:00
<span class="org-keyword">import</span> os
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
2022-05-09 10:05:23 +02:00
<div id="outline-container-org5e19416" class="outline-3">
<h3 id="org5e19416">fzf_select</h3>
<div class="outline-text-3" id="text-org5e19416">
2020-01-11 22:04:45 +01:00
<div class="org-src-container">
2021-01-08 01:34:53 +01:00
<pre class="src src-python"><span class="org-keyword">class</span> <span class="org-type">fzf_select</span>(Command):
<span class="org-doc">"""</span>
<span class="org-doc"> :fzf_select</span>
<span class="org-doc"> Find a file using fzf.</span>
<span class="org-doc"> With a prefix argument select only directories.</span>
<span class="org-doc"> See: https://github.com/junegunn/fzf</span>
<span class="org-doc"> """</span>
<span class="org-keyword">def</span> <span class="org-function-name">execute</span>(<span class="org-keyword">self</span>):
<span class="org-keyword">import</span> subprocess
<span class="org-keyword">import</span> os.path
<span class="org-keyword">if</span> <span class="org-keyword">self</span>.quantifier:
<span class="org-comment-delimiter"># </span><span class="org-comment">match only directories</span>
<span class="org-variable-name">command</span>=<span class="org-string">"find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \</span>
<span class="org-string"> -o -type d -print 2&gt; /dev/null | sed 1d | cut -b3- | fzf +m"</span>
<span class="org-keyword">else</span>:
<span class="org-comment-delimiter"># </span><span class="org-comment">match files and directories</span>
<span class="org-variable-name">command</span>=<span class="org-string">"find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \</span>
<span class="org-string"> -o -print 2&gt; /dev/null | sed 1d | cut -b3- | fzf +m"</span>
<span class="org-variable-name">fzf</span> = <span class="org-keyword">self</span>.fm.execute_command(command, universal_newlines=<span class="org-constant">True</span>, stdout=subprocess.PIPE)
<span class="org-variable-name">stdout</span>, <span class="org-variable-name">stderr</span> = fzf.communicate()
<span class="org-keyword">if</span> fzf.returncode == <span class="org-highlight-numbers-number">0</span>:
<span class="org-variable-name">fzf_file</span> = os.path.abspath(stdout.rstrip(<span class="org-string">'\n'</span>))
<span class="org-keyword">if</span> os.path.isdir(fzf_file):
<span class="org-keyword">self</span>.fm.cd(fzf_file)
<span class="org-keyword">else</span>:
<span class="org-keyword">self</span>.fm.select_file(fzf_file)
2020-01-11 22:04:45 +01:00
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
2022-05-09 10:05:23 +02:00
<p class="date">Created: 2022-05-09 lun. 10:04</p>
2020-01-11 22:04:45 +01:00
</div>
</body>
</html>