summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-04-14 01:46:12 +0200
committerhut <hut@lepus.uberspace.de>2015-04-14 01:46:12 +0200
commiteb9a75caa91f9315d14b17db14af4dfdd71fa82e (patch)
tree26e2d4002756a20666c6a2e6f8d148aafc990afe /doc
parent09b0f2f1044025c8d14d5f7296f43b495cf75ec3 (diff)
parent89146651e07830f15b59b5f076d61741747a0bea (diff)
downloadranger-1.7.0-emacs.tar.gz
Merge branch 'master' into emacs v1.7.0-emacs
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/README8
-rw-r--r--doc/examples/bash_automatic_cd.sh21
-rw-r--r--doc/examples/bash_subshell_notice.sh7
-rw-r--r--doc/examples/plugin_chmod_keybindings.py20
-rw-r--r--doc/examples/plugin_file_filter.py21
-rw-r--r--doc/examples/plugin_hello_world.py23
-rw-r--r--doc/examples/plugin_new_macro.py19
-rw-r--r--doc/examples/plugin_new_sorting_method.py9
-rw-r--r--doc/examples/rifle_different_file_opener.conf9
-rwxr-xr-xdoc/examples/rifle_sxiv.sh48
-rw-r--r--doc/examples/vim_file_chooser.vim36
-rw-r--r--doc/ranger.132
-rw-r--r--doc/ranger.pod30
-rw-r--r--doc/rifle.12
14 files changed, 57 insertions, 228 deletions
diff --git a/doc/examples/README b/doc/examples/README
deleted file mode 100644
index ca514853..00000000
--- a/doc/examples/README
+++ /dev/null
@@ -1,8 +0,0 @@
-The files in this directory contain applications or extensions of ranger which
-are put here for your inspiration and as references.
-
-In order to use a plugin from this directory, you need to copy it to
-~/.config/ranger/plugins/
-
-Note that if you update ranger to a new minor version (for example,
-from 1.6.* to 1.7.0), your outdated plugins WILL break and crash ranger.
diff --git a/doc/examples/bash_automatic_cd.sh b/doc/examples/bash_automatic_cd.sh
deleted file mode 100644
index 8d72c553..00000000
--- a/doc/examples/bash_automatic_cd.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-# Compatible with ranger 1.4.2 through 1.6.*
-#
-# Automatically change the directory in bash after closing ranger
-#
-# This is a bash function for .bashrc to automatically change the directory to
-# the last visited one after ranger quits.
-# To undo the effect of this function, you can type "cd -" to return to the
-# original directory.
-
-function ranger-cd {
-    tempfile='/tmp/chosendir'
-    /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}"
-    test -f "$tempfile" &&
-    if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
-        cd -- "$(cat "$tempfile")"
-    fi
-    rm -f -- "$tempfile"
-}
-
-# This binds Ctrl-O to ranger-cd:
-bind '"\C-o":"ranger-cd\C-m"'
diff --git a/doc/examples/bash_subshell_notice.sh b/doc/examples/bash_subshell_notice.sh
deleted file mode 100644
index bc44d5a8..00000000
--- a/doc/examples/bash_subshell_notice.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-# Compatible with ranger 1.5.3 through 1.6.*
-#
-# Change the prompt when you open a shell from inside ranger
-#
-# Add this line to your .bashrc for it to work.
-
-[ -n "$RANGER_LEVEL" ] && PS1="$PS1"'(in ranger) '
diff --git a/doc/examples/plugin_chmod_keybindings.py b/doc/examples/plugin_chmod_keybindings.py
deleted file mode 100644
index 0ab975ed..00000000
--- a/doc/examples/plugin_chmod_keybindings.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Compatible with ranger 1.6.*
-#
-# This plugin serves as an example for adding key bindings through a plugin.
-# It could replace the ten lines in the rc.conf that create the key bindings
-# for the "chmod" command.
-
-import ranger.api
-old_hook_init = ranger.api.hook_init
-
-def hook_init(fm):
-    old_hook_init(fm)
-
-    # Generate key bindings for the chmod command
-    command = "map {0}{1}{2} shell -d chmod {1}{0}{2} %s"
-    for mode in list('ugoa') + ['']:
-        for perm in "rwxXst":
-            fm.execute_console(command.format('-', mode, perm))
-            fm.execute_console(command.format('+', mode, perm))
-
-ranger.api.hook_init = hook_init
diff --git a/doc/examples/plugin_file_filter.py b/doc/examples/plugin_file_filter.py
deleted file mode 100644
index b9bea1f3..00000000
--- a/doc/examples/plugin_file_filter.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Compatible since ranger 1.6.1, git commit c82a8a76989c
-#
-# This plugin hides the directories "/boot", "/sbin", "/proc" and "/sys" unless
-# the "show_hidden" option is activated.
-
-# Save the original filter function
-import ranger.container.directory
-old_accept_file = ranger.container.directory.accept_file
-
-HIDE_FILES = ("/boot", "/sbin", "/proc", "/sys")
-
-# Define a new one
-def custom_accept_file(file, filters):
-    if not file.fm.settings.show_hidden and file.path in HIDE_FILES:
-        return False
-    else:
-        return old_accept_file(file, filters)
-
-# Overwrite the old function
-import ranger.container.directory
-ranger.container.directory.accept_file = custom_accept_file
diff --git a/doc/examples/plugin_hello_world.py b/doc/examples/plugin_hello_world.py
deleted file mode 100644
index a803e21b..00000000
--- a/doc/examples/plugin_hello_world.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Compatible with ranger 1.6.*
-#
-# This is a sample plugin that displays "Hello World" in ranger's console after
-# it started.
-
-# We are going to extend the hook "ranger.api.hook_ready", so first we need
-# to import ranger.api:
-import ranger.api
-
-# Save the previously existing hook, because maybe another module already
-# extended that hook and we don't want to lose it:
-old_hook_ready = ranger.api.hook_ready
-
-# Create a replacement for the hook that...
-def hook_ready(fm):
-    # ...does the desired action...
-    fm.notify("Hello World")
-    # ...and calls the saved hook.  If you don't care about the return value,
-    # simply return the return value of the previous hook to be safe.
-    return old_hook_ready(fm)
-
-# Finally, "monkey patch" the existing hook_ready function with our replacement:
-ranger.api.hook_ready = hook_ready
diff --git a/doc/examples/plugin_new_macro.py b/doc/examples/plugin_new_macro.py
deleted file mode 100644
index 159a92f2..00000000
--- a/doc/examples/plugin_new_macro.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Compatible with ranger 1.6.*
-#
-# This plugin adds the new macro %date which is substituted with the current
-# date in commands that allow macros.  You can test it with the command
-# ":shell echo %date; read"
-
-# Save the original macro function
-import ranger.core.actions
-old_get_macros = ranger.core.actions.Actions._get_macros
-
-# Define a new macro function
-import time
-def get_macros_with_date(self):
-       macros = old_get_macros(self)
-       macros['date'] = time.strftime('%m/%d/%Y')
-       return macros
-
-# Overwrite the old one
-ranger.core.actions.Actions._get_macros = get_macros_with_date
diff --git a/doc/examples/plugin_new_sorting_method.py b/doc/examples/plugin_new_sorting_method.py
deleted file mode 100644
index 6b41b0e1..00000000
--- a/doc/examples/plugin_new_sorting_method.py
+++ /dev/null
@@ -1,9 +0,0 @@
-# Compatible with ranger 1.6.*
-#
-# This plugin adds the sorting algorithm called 'random'.  To enable it, type
-# ":set sort=random" or create a key binding with ":map oz set sort=random"
-
-from ranger.container.directory import Directory
-from random import random
-Directory.sort_dict['random'] = lambda path: random()
-
diff --git a/doc/examples/rifle_different_file_opener.conf b/doc/examples/rifle_different_file_opener.conf
deleted file mode 100644
index 4a8250b8..00000000
--- a/doc/examples/rifle_different_file_opener.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-# Compatible with ranger 1.6.*
-#
-# Replace your rifle.conf with this file to use xdg-open as your file opener.
-# This is, of course, adaptable for use with any other file opener.
-else = xdg-open "$1"
-
-# You need an "editor" and "pager" in order to use certain functions in ranger:
-label editor = "$EDITOR" -- "$@"
-label pager  = "$PAGER" -- "$@"
diff --git a/doc/examples/rifle_sxiv.sh b/doc/examples/rifle_sxiv.sh
deleted file mode 100755
index 6307f1c2..00000000
--- a/doc/examples/rifle_sxiv.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-# Compatible with ranger 1.6.*
-#
-# This script searches image files in a directory, opens them all with sxiv and
-# sets the first argument to the first image displayed by sxiv.
-#
-# This is supposed to be used in rifle.conf as a workaround for the fact that
-# sxiv takes no file name arguments for the first image, just the number.  Copy
-# this file somewhere into your $PATH and add this at the top of rifle.conf:
-#
-#   mime ^image, has sxiv, X, flag f = path/to/this/script -- "$@"
-#
-# Implementation notes: this script is quite slow because of POSIX limitations
-# and portability concerns. First calling the shell function 'abspath' is
-# quicker than calling 'realpath' because it would fork a whole process, which
-# is slow. Second, we need to append a file list to sxiv, which can only be done
-# properly in two ways: arrays (which are not POSIX) or \0 sperated
-# strings. Unfortunately, assigning \0 to a variable is not POSIX either (will
-# not work in dash and others), so we cannot store the result of listfiles to a
-# variable.
-
-if [ $# -eq 0 ]; then
-    echo "Usage: ${0##*/} PICTURES"
-    exit
-fi
-
-[ "$1" == '--' ] && shift
-
-abspath () {
-    case "$1" in
-        /*) printf "%s\n" "$1";;
-        *)  printf "%s\n" "$PWD/$1";;
-    esac
-}
-
-listfiles () {
-    find -L "$(dirname "$target")" -maxdepth 1 -type f -iregex \
-      '.*\(jpe?g\|bmp\|png\|gif\)$' -print0 | sort -z
-}
-
-target="$(abspath "$1")"
-count="$(listfiles | grep -m 1 -ZznF "$target" | cut -d: -f1)"
-
-if [ -n "$count" ]; then
-    listfiles | xargs -0 sxiv -n "$count" --
-else
-    sxiv -- "$@" # fallback
-fi
diff --git a/doc/examples/vim_file_chooser.vim b/doc/examples/vim_file_chooser.vim
deleted file mode 100644
index aa3af763..00000000
--- a/doc/examples/vim_file_chooser.vim
+++ /dev/null
@@ -1,36 +0,0 @@
-" Compatible with ranger 1.4.2 through 1.6.*
-"
-" Add ranger as a file chooser in vim
-"
-" If you add this code to the .vimrc, ranger can be started using the command
-" ":RangerChooser" or the keybinding "<leader>r".  Once you select one or more
-" files, press enter and ranger will quit again and vim will open the selected
-" files.
-
-function! RangeChooser()
-    let temp = tempname()
-    " The option "--choosefiles" was added in ranger 1.5.1. Use the next line
-    " with ranger 1.4.2 through 1.5.0 instead.
-    "exec 'silent !ranger --choosefile=' . shellescape(temp)
-    exec 'silent !ranger --choosefiles=' . shellescape(temp)
-    if !filereadable(temp)
-        redraw!
-        " Nothing to read.
-        return
-    endif
-    let names = readfile(temp)
-    if empty(names)
-        redraw!
-        " Nothing to open.
-        return
-    endif
-    " Edit the first item.
-    exec 'edit ' . fnameescape(names[0])
-    " Add any remaning items to the arg list/buffer list.
-    for name in names[1:]
-        exec 'argadd ' . fnameescape(name)
-    endfor
-    redraw!
-endfunction
-command! -bar RangerChooser call RangeChooser()
-nnoremap <leader>r :<C-U>RangerChooser<CR>
diff --git a/doc/ranger.1 b/doc/ranger.1
index 7c01dc26..426ec0cf 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -133,7 +133,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RANGER 1"
-.TH RANGER 1 "ranger-1.6.1" "03/31/2015" "ranger manual"
+.TH RANGER 1 "ranger-1.7.0" "04/13/2015" "ranger manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -162,8 +162,13 @@ The \fI\s-1README\s0\fR contains install instructions.
 The file \fI\s-1HACKING\s0.md\fR contains guidelines for code modification.
 .PP
 The directory \fIdoc/configs\fR contains configuration files.  They are usually
-installed to \fI/usr/lib/python*/site\-packages/ranger/config\fR and can be
-obtained with ranger's \-\-copy\-config option.
+installed to \fI/usr/share/doc/ranger/config\fR and can be obtained with ranger's
+\&\-\-copy\-config option.
+.PP
+The directory \fIexamples\fR contains reference implementations for ranger
+plugins, sample configuration files and some programs for integrating ranger
+with other software.  They are usually installed to
+\&\fI/usr/share/doc/ranger/examples\fR.
 .PP
 The man page of \fIrifle\fR\|(1) describes the functions of the file opener
 .PP
@@ -320,6 +325,14 @@ Macros for file paths are generally shell-escaped so they can be used in the
 Additionally, if you create a key binding that uses <any>, a special statement
 which accepts any key, then the macro \f(CW%any\fR (or \f(CW%any0\fR, \f(CW%any1\fR, \f(CW%any2\fR, ...) can be
 used in the command to get the key that was pressed.
+.PP
+The macro \f(CW%rangerdir\fR expands to the directory of ranger's python library, you
+can use it for something like this command:
+  alias show_commands shell less \f(CW%rangerdir\fR/config/commands.py
+.PP
+The macro \f(CW%space\fR expands to a space character. You can use it to add spaces to
+the end of a command when needed, while preventing editors to strip spaces off
+the end of the line automatically.
 .SS "\s-1BOOKMARKS\s0"
 .IX Subsection "BOOKMARKS"
 Type \fB<C\-x>rm<key>\fR to bookmark the current directory. You can
@@ -841,6 +854,7 @@ including their parameters, excluding descriptions:
 \& find pattern
 \& flat level
 \& grep pattern
+\& help
 \& linemode linemodename
 \& load_copy_buffer
 \& map key command
@@ -862,6 +876,7 @@ including their parameters, excluding descriptions:
 \& search pattern
 \& search_inc pattern
 \& set option value
+\& setintag tags option value
 \& setlocal [path=<path>] option value
 \& shell [\-FLAGS] command
 \& terminal
@@ -994,12 +1009,16 @@ values \-2 and less are invalid.
 .IP "grep \fIpattern\fR" 2
 .IX Item "grep pattern"
 Looks for a string in all marked files or directories.
+.IP "help" 2
+.IX Item "help"
+Provides a quick way to view ranger documentations.
 .IP "linemode \fIlinemodename\fR" 2
 .IX Item "linemode linemodename"
 Sets the linemode of all files in the current directory.  The linemode may be:
 .Sp
-.Vb 5
+.Vb 6
 \& "filename": display each line as "<basename>...<size>"
+\& "fileinfo": display each line as "<basename>...<file(1) output>"
 \& "permissions": display each line as "<permissions> <owner> <group> <basename>"
 \& "metatitle": display metadata from .metadata.json files if
 \&     available, fall back to the "filename" linemode if no
@@ -1140,6 +1159,11 @@ doesn't work for functions and regular expressions. Valid values are:
 \& list           | 1,2,3,4
 \& none           | none
 .Ve
+.IP "setintag \fItags\fR \fIoption\fR \fIvalue\fR" 2
+.IX Item "setintag tags option value"
+Assigns a new value to an option, but locally for the directories that are
+marked with \fItag\fR.  This means, that this option only takes effect when
+visiting that directory.
 .IP "setlocal [path=\fIpath\fR] \fIoption\fR \fIvalue\fR" 2
 .IX Item "setlocal [path=path] option value"
 Assigns a new value to an option, but locally for the directory given by
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 5ebdbc98..eea82c3e 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -35,8 +35,13 @@ The F<README> contains install instructions.
 The file F<HACKING.md> contains guidelines for code modification.
 
 The directory F<doc/configs> contains configuration files.  They are usually
-installed to F</usr/lib/python*/site-packages/ranger/config> and can be
-obtained with ranger's --copy-config option.
+installed to F</usr/share/doc/ranger/config> and can be obtained with ranger's
+--copy-config option.
+
+The directory F<examples> contains reference implementations for ranger
+plugins, sample configuration files and some programs for integrating ranger
+with other software.  They are usually installed to
+F</usr/share/doc/ranger/examples>.
 
 The man page of rifle(1) describes the functions of the file opener
 
@@ -217,6 +222,14 @@ Additionally, if you create a key binding that uses <any>, a special statement
 which accepts any key, then the macro %any (or %any0, %any1, %any2, ...) can be
 used in the command to get the key that was pressed.
 
+The macro %rangerdir expands to the directory of ranger's python library, you
+can use it for something like this command:
+  alias show_commands shell less %rangerdir/config/commands.py
+
+The macro %space expands to a space character. You can use it to add spaces to
+the end of a command when needed, while preventing editors to strip spaces off
+the end of the line automatically.
+
 =head2 BOOKMARKS
 
 Type B<E<lt>C-xE<gt>rm<keyE<gt>> to bookmark the current directory. You can
@@ -848,6 +861,7 @@ including their parameters, excluding descriptions:
  find pattern
  flat level
  grep pattern
+ help
  linemode linemodename
  load_copy_buffer
  map key command
@@ -869,6 +883,7 @@ including their parameters, excluding descriptions:
  search pattern
  search_inc pattern
  set option value
+ setintag tags option value
  setlocal [path=<path>] option value
  shell [-FLAGS] command
  terminal
@@ -1024,11 +1039,16 @@ values -2 and less are invalid.
 
 Looks for a string in all marked files or directories.
 
+=item help
+
+Provides a quick way to view ranger documentations.
+
 =item linemode I<linemodename>
 
 Sets the linemode of all files in the current directory.  The linemode may be:
 
  "filename": display each line as "<basename>...<size>"
+ "fileinfo": display each line as "<basename>...<file(1) output>"
  "permissions": display each line as "<permissions> <owner> <group> <basename>"
  "metatitle": display metadata from .metadata.json files if
      available, fall back to the "filename" linemode if no
@@ -1183,6 +1203,12 @@ doesn't work for functions and regular expressions. Valid values are:
  list           | 1,2,3,4
  none           | none
 
+=item setintag I<tags> I<option> I<value>
+
+Assigns a new value to an option, but locally for the directories that are
+marked with I<tag>.  This means, that this option only takes effect when
+visiting that directory.
+
 =item setlocal [path=I<path>] I<option> I<value>
 
 Assigns a new value to an option, but locally for the directory given by
diff --git a/doc/rifle.1 b/doc/rifle.1
index f7e9df78..95010452 100644
--- a/doc/rifle.1
+++ b/doc/rifle.1
@@ -133,7 +133,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RIFLE 1"
-.TH RIFLE 1 "rifle-1.6.1" "03/31/2015" "rifle manual"
+.TH RIFLE 1 "rifle-1.7.0" "04/13/2015" "rifle manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l