summaryrefslogtreecommitdiffstats
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
parent09b0f2f1044025c8d14d5f7296f43b495cf75ec3 (diff)
parent89146651e07830f15b59b5f076d61741747a0bea (diff)
Merge branch 'master' into emacsv1.7.0-emacsemacs
-rw-r--r--AUTHORS2
-rw-r--r--CHANGELOG24
-rw-r--r--README.md12
-rw-r--r--doc/ranger.132
-rw-r--r--doc/ranger.pod30
-rw-r--r--doc/rifle.12
-rw-r--r--examples/README (renamed from doc/examples/README)0
-rw-r--r--examples/bash_automatic_cd.sh (renamed from doc/examples/bash_automatic_cd.sh)4
-rw-r--r--examples/bash_subshell_notice.sh (renamed from doc/examples/bash_subshell_notice.sh)2
-rw-r--r--examples/plugin_chmod_keybindings.py (renamed from doc/examples/plugin_chmod_keybindings.py)2
-rw-r--r--examples/plugin_file_filter.py (renamed from doc/examples/plugin_file_filter.py)2
-rw-r--r--examples/plugin_hello_world.py (renamed from doc/examples/plugin_hello_world.py)2
-rw-r--r--examples/plugin_new_macro.py (renamed from doc/examples/plugin_new_macro.py)2
-rw-r--r--examples/plugin_new_sorting_method.py (renamed from doc/examples/plugin_new_sorting_method.py)2
-rw-r--r--examples/rifle_different_file_opener.conf (renamed from doc/examples/rifle_different_file_opener.conf)2
-rwxr-xr-xexamples/rifle_sxiv.sh (renamed from doc/examples/rifle_sxiv.sh)2
-rw-r--r--examples/vim_file_chooser.vim (renamed from doc/examples/vim_file_chooser.vim)2
-rwxr-xr-xranger.py4
-rw-r--r--ranger/__init__.py4
-rw-r--r--ranger/api/commands.py3
-rw-r--r--ranger/config/commands.py66
-rw-r--r--ranger/config/rc.conf15
-rw-r--r--ranger/config/rifle.conf22
-rw-r--r--ranger/container/fsobject.py2
-rw-r--r--ranger/container/tags.py37
-rw-r--r--ranger/core/actions.py22
-rw-r--r--ranger/core/environment.py111
-rw-r--r--ranger/core/fm.py4
-rw-r--r--ranger/core/linemode.py18
-rw-r--r--ranger/core/loader.py7
-rw-r--r--ranger/core/shared.py7
-rwxr-xr-xranger/ext/rifle.py2
-rw-r--r--ranger/fsobject.py5
-rw-r--r--ranger/gui/context.py2
-rw-r--r--ranger/gui/displayable.py4
-rw-r--r--ranger/gui/widgets/statusbar.py9
-rwxr-xr-xsetup.py2
37 files changed, 270 insertions, 200 deletions
diff --git a/AUTHORS b/AUTHORS
index 1fda9164..62387efe 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -22,7 +22,7 @@ Copyright 2015 No Suck <admin@nosuck.org>
Copyright 2015 Randy Nance <randynobx@gmail.com>
Copyright 2015 Wojciech Siewierski <wojciech.siewierski@onet.pl>
-Ideally, all contributors of non-trivial code are named here to the extend that
+Ideally, all contributors of non-trivial code are named here to the extent that
a name and e-mail address is available. Please write a mail to hut@hut.pm if
your name is missing, or in case of any other issues.
diff --git a/CHANGELOG b/CHANGELOG
index c5237279..041a7701 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,29 @@
This log documents changes between stable versions.
+2015-04-13: version 1.7.0
+* The default editor is now "vim" instead of "nano"
+* Added automatic updates of tags when a file is renamed from within ranger
+* Added "preview_images_method" which can be set to "iterm2" to use native
+ iTerm2 image previews
+* Added ":rename_append" command to rename files without the file extension
+* Added ":linemode" command to change the way the files are displayed
+ Try this out by pressing M followed by one of the suggested keys.
+ New linemodes can be added with ranger.api.register_linemode().
+* Added ":filter_by_inode" command to only show directories, files or links
+* Added ":meta" command for managing custom file metadata
+* Added ":flat" command for displaying subdirectories
+* Added "solarized" colorscheme
+* Added generic ability to use scope.sh for image previews
+* Added video previews in scope.sh
+* Added option "sort_unicode" to sort according to unicode, not ASCII
+* ":mkdir" can now create multiple directory levels (like `mkdir -p`)
+* ":help" (key binding "?") is now interactive
+* ":find" (key binding "/") is now case insensitive by default
+* "ranger --copy-config=all" now copies a short sample commands.py rather than
+ the full one, so that you can update ranger without having broken commands.
+ The full commands.py is still copied to ~/.config/ranger/commands_full.py.
+* Fixed broken copying of symlinks
+
2013-05-24: Version 1.6.1
* Added support for version control systems, see:
http://lists.nongnu.org/archive/html/ranger-users/2013-03/msg00007.html
diff --git a/README.md b/README.md
index 979aa8f9..c90dbbb8 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-ranger v.1.6.1
+ranger v.1.7.0
==============
ranger is a console file manager with Emacs key bindings. It provides a
minimalistic and nice curses interface with a view on the directory hierarchy.
@@ -9,11 +9,11 @@ out which program to use for what file type.
This file describes ranger and how to get it to run. For instructions on the
usage, please read the man page. See HACKING.md for development specific
-information. For configuration, check the files in ranger/config/. They
-are usually installed to /usr/lib/python*/site-packages/ranger/config/
-and can be obtained with ranger's --copy-config option. The doc/examples/
-directory contains several scripts and plugins that demonstrate how ranger can
-be extended or combined with other programs.
+information. For configuration, check the files in ranger/config/ or copy the
+default config to ~/.config/ranger with ranger's --copy-config option. The
+examples/ directory contains several scripts and plugins that demonstrate how
+ranger can be extended or combined with other programs. These files can be
+found in the git repository or in /usr/share/doc/ranger.
A note to packagers: Versions meant for packaging are listed in the changelog
on the website.
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
diff --git a/doc/examples/README b/examples/README
index ca514853..ca514853 100644
--- a/doc/examples/README
+++ b/examples/README
diff --git a/doc/examples/bash_automatic_cd.sh b/examples/bash_automatic_cd.sh
index 8d72c553..ac96ea12 100644
--- a/doc/examples/bash_automatic_cd.sh
+++ b/examples/bash_automatic_cd.sh
@@ -1,4 +1,4 @@
-# Compatible with ranger 1.4.2 through 1.6.*
+# Compatible with ranger 1.4.2 through 1.7.*
#
# Automatically change the directory in bash after closing ranger
#
@@ -8,7 +8,7 @@
# original directory.
function ranger-cd {
- tempfile='/tmp/chosendir'
+ tempfile="$(mktemp)"
/usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}"
test -f "$tempfile" &&
if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
diff --git a/doc/examples/bash_subshell_notice.sh b/examples/bash_subshell_notice.sh
index bc44d5a8..4c9269c4 100644
--- a/doc/examples/bash_subshell_notice.sh
+++ b/examples/bash_subshell_notice.sh
@@ -1,4 +1,4 @@
-# Compatible with ranger 1.5.3 through 1.6.*
+# Compatible with ranger 1.5.3 through 1.7.*
#
# Change the prompt when you open a shell from inside ranger
#
diff --git a/doc/examples/plugin_chmod_keybindings.py b/examples/plugin_chmod_keybindings.py
index 0ab975ed..1c9558f7 100644
--- a/doc/examples/plugin_chmod_keybindings.py
+++ b/examples/plugin_chmod_keybindings.py
@@ -1,4 +1,4 @@
-# Compatible with ranger 1.6.*
+# Compatible with ranger 1.6.0 through ranger 1.7.*
#
# 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
diff --git a/doc/examples/plugin_file_filter.py b/examples/plugin_file_filter.py
index b9bea1f3..d5ea2d2d 100644
--- a/doc/examples/plugin_file_filter.py
+++ b/examples/plugin_file_filter.py
@@ -1,4 +1,4 @@
-# Compatible since ranger 1.6.1, git commit c82a8a76989c
+# Compatible since ranger 1.7.0 (git commit c82a8a76989c)
#
# This plugin hides the directories "/boot", "/sbin", "/proc" and "/sys" unless
# the "show_hidden" option is activated.
diff --git a/doc/examples/plugin_hello_world.py b/examples/plugin_hello_world.py
index a803e21b..b64916d4 100644
--- a/doc/examples/plugin_hello_world.py
+++ b/examples/plugin_hello_world.py
@@ -1,4 +1,4 @@
-# Compatible with ranger 1.6.*
+# Compatible with ranger 1.6.0 through 1.7.*
#
# This is a sample plugin that displays "Hello World" in ranger's console after
# it started.
diff --git a/doc/examples/plugin_new_macro.py b/examples/plugin_new_macro.py
index 159a92f2..6757e491 100644
--- a/doc/examples/plugin_new_macro.py
+++ b/examples/plugin_new_macro.py
@@ -1,4 +1,4 @@
-# Compatible with ranger 1.6.*
+# Compatible with ranger 1.6.0 through 1.7.*
#
# 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
diff --git a/doc/examples/plugin_new_sorting_method.py b/examples/plugin_new_sorting_method.py
index 6b41b0e1..c6e35a68 100644
--- a/doc/examples/plugin_new_sorting_method.py
+++ b/examples/plugin_new_sorting_method.py
@@ -1,4 +1,4 @@
-# Compatible with ranger 1.6.*
+# Compatible with ranger 1.6.0 through 1.7.*
#
# 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"
diff --git a/doc/examples/rifle_different_file_opener.conf b/examples/rifle_different_file_opener.conf
index 4a8250b8..695f27c6 100644
--- a/doc/examples/rifle_different_file_opener.conf
+++ b/examples/rifle_different_file_opener.conf
@@ -1,4 +1,4 @@
-# Compatible with ranger 1.6.*
+# Compatible with ranger 1.6.0 through 1.7.*
#
# 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.
diff --git a/doc/examples/rifle_sxiv.sh b/examples/rifle_sxiv.sh
index 6307f1c2..8cb13907 100755
--- a/doc/examples/rifle_sxiv.sh
+++ b/examples/rifle_sxiv.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Compatible with ranger 1.6.*
+# Compatible with ranger 1.6.0 through 1.7.*
#
# 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.
diff --git a/doc/examples/vim_file_chooser.vim b/examples/vim_file_chooser.vim
index aa3af763..fb9b7e1b 100644
--- a/doc/examples/vim_file_chooser.vim
+++ b/examples/vim_file_chooser.vim
@@ -1,4 +1,4 @@
-" Compatible with ranger 1.4.2 through 1.6.*
+" Compatible with ranger 1.4.2 through 1.7.*
"
" Add ranger as a file chooser in vim
"
diff --git a/ranger.py b/ranger.py
index 4b2e7daa..1d7e42e1 100755
--- a/ranger.py
+++ b/ranger.py
@@ -9,7 +9,7 @@
# default is simply "ranger". (Not this file itself!)
# The other arguments are passed to ranger.
"""":
-tempfile='/tmp/chosendir'
+tempfile="$(mktemp)"
ranger="${1:-ranger}"
test -z "$1" || shift
"$ranger" --choosedir="$tempfile" "${@:-$(pwd)}"
@@ -17,8 +17,8 @@ returnvalue=$?
test -f "$tempfile" &&
if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
cd "$(cat "$tempfile")"
- rm -f -- "$tempfile"
fi
+rm -f -- "$tempfile"
return $returnvalue
""" and None
diff --git a/ranger/__init__.py b/ranger/__init__.py
index b850f455..fa9ba033 100644
--- a/ranger/__init__.py
+++ b/ranger/__init__.py
@@ -13,7 +13,7 @@ import os
# Information
__license__ = 'GPL3'
-__version__ = '1.6.1'
+__version__ = '1.7.0'
__author__ = __maintainer__ = 'Roman Zimbelmann'
__email__ = 'hut@hut.pm'
@@ -27,7 +27,7 @@ DEFAULT_PAGER = 'less'
LOGFILE = '/tmp/ranger_errorlog'
CACHEDIR = os.path.expanduser("~/.cache/ranger")
USAGE = '%prog [options] [path]'
-VERSION = 'ranger-master %s\n\nPython %s' % (__version__, sys.version)
+VERSION = 'ranger-stable %s\n\nPython %s' % (__version__, sys.version)
# If the environment variable XDG_CONFIG_HOME is non-empty, CONFDIR is ignored
# and the configuration directory will be $XDG_CONFIG_HOME/ranger instead.
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index cf8d28a7..2cf96a9f 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -12,9 +12,6 @@ from ranger.core.shared import FileManagerAware
from ranger.ext.lazy_property import lazy_property
_SETTINGS_RE = re.compile(r'^\s*([^\s]+?)=(.*)$')
-DELETE_WARNING = 'delete seriously? ' # COMPAT
-
-def alias(*_): pass # COMPAT
class CommandContainer(object):
def __init__(self):
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index a1bc7a76..6cdd5cc2 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -435,7 +435,8 @@ class default_linemode(Command):
def tab(self):
mode = self.arg(1)
return (self.arg(0) + " " + linemode
- for linemode in self.fm.thisfile.linemode_dict.keys())
+ for linemode in self.fm.thisfile.linemode_dict.keys()
+ if linemode.startswith(self.arg(1)))
class quit(Command):
@@ -523,10 +524,16 @@ class delete(Command):
self._question_callback, ('n', 'N', 'y', 'Y'))
else:
# no need for a confirmation, just delete
+ for f in self.fm.tags.tags:
+ if str(f).startswith(self.fm.thisfile.path):
+ self.fm.tags.remove(f)
self.fm.delete()
def _question_callback(self, answer):
if answer == 'y' or answer == 'Y':
+ for f in self.fm.tags.tags:
+ if str(f).startswith(self.fm.thisfile.path):
+ self.fm.tags.remove(f)
self.fm.delete()
@@ -725,6 +732,13 @@ class rename(Command):
new_name = self.rest(1)
+ tagged = {}
+ old_name = self.fm.thisfile.basename
+ for f in self.fm.tags.tags:
+ if str(f).startswith(self.fm.thisfile.path):
+ tagged[f] = self.fm.tags.tags[f]
+ self.fm.tags.remove(f)
+
if not new_name:
return self.fm.notify('Syntax: rename <newname>', bad=True)
@@ -738,6 +752,9 @@ class rename(Command):
f = File(new_name)
self.fm.thisdir.pointed_obj = f
self.fm.thisfile = f
+ for t in tagged:
+ self.fm.tags.tags[t.replace(old_name,new_name)] = tagged[t]
+ self.fm.tags.dump()
def tab(self):
return self._tab_directory_content()
@@ -830,22 +847,47 @@ class bulkrename(Command):
self.fm.notify("No renaming to be done!")
return
- # Generate and execute script
+ # Generate script
cmdfile = tempfile.NamedTemporaryFile()
- cmdfile.write(b"# This file will be executed when you close the editor.\n")
- cmdfile.write(b"# Please double-check everything, clear the file to abort.\n")
+ script_lines = []
+ script_lines.append(b"# This file will be executed when you close the editor.\n")
+ script_lines.append(b"# Please double-check everything, clear the file to abort.\n")
+ script_lines.extend("mv -vi -- %s %s\n" % (esc(old), esc(new)) \
+ for old, new in zip(filenames, new_filenames) if old != new)
+ script_content = "".join(script_lines)
if py3:
- cmdfile.write("\n".join("mv -vi -- " + esc(old) + " " + esc(new) \
- for old, new in zip(filenames, new_filenames) \
- if old != new).encode("utf-8"))
+ cmdfile.write(script_content.encode("utf-8"))
else:
- cmdfile.write("\n".join("mv -vi -- " + esc(old) + " " + esc(new) \
- for old, new in zip(filenames, new_filenames) if old != new))
+ cmdfile.write(script_content)
cmdfile.flush()
+
+ # Open the script and let the user review it, then check if the script
+ # was modified by the user
self.fm.execute_file([File(cmdfile.name)], app='editor')
+ cmdfile.seek(0)
+ script_was_edited = (script_content != cmdfile.read())
+
+ # Do the renaming
self.fm.run(['/bin/sh', cmdfile.name], flags='w')
cmdfile.close()
+ # Retag the files, but only if the script wasn't changed during review,
+ # because only then we know which are the source and destination files.
+ if not script_was_edited:
+ tags_changed = False
+ for old, new in zip(filenames, new_filenames):
+ if old != new:
+ oldpath = self.fm.thisdir.path + '/' + old
+ newpath = self.fm.thisdir.path + '/' + new
+ if oldpath in self.fm.tags:
+ old_tag = self.fm.tags.tags[oldpath]
+ self.fm.tags.remove(oldpath)
+ self.fm.tags.tags[newpath] = old_tag
+ tags_changed = True
+ if tags_changed:
+ self.fm.tags.dump()
+ else:
+ fm.notify("files have not been retagged")
class relink(Command):
""":relink <newpath>
@@ -1429,7 +1471,11 @@ class meta(prompt_metadata):
key = self.arg(1)
metadata = self.fm.metadata.get_metadata(self.fm.thisfile.path)
if key in metadata and metadata[key]:
- return self.arg(0) + " " + metadata[key]
+ return [" ".join([self.arg(0), self.arg(1), metadata[key]])]
+ else:
+ return [self.arg(0) + " " + key for key in sorted(metadata)
+ if key.startswith(self.arg(1))]
+
class linemode(default_linemode):
"""
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index 29ccdeb8..18dc8ed4 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -237,11 +237,12 @@ map <C-x>W display_log
map <C-x>w taskview_open
map <A-x> console
-map <A-!> console shell
-map <A-f> chain draw_possible_programs; console open_with
+map <A-!> console shell%space
+map <A-f> chain draw_possible_programs; console open_with%space
# Change the line mode
map <C-x>mf linemode filename
+map <C-x>mi linemode fileinfo
map <C-x>mp linemode permissions
map <C-x>mt linemode metatitle
@@ -257,7 +258,7 @@ map <F3> display_file
map <F4> edit
map <F5> copy
map <F6> cut
-map <F7> console mkdir
+map <F7> console mkdir%space
map <F8> console delete
map <F10> exit
@@ -272,7 +273,7 @@ map <PAGEDOWN> move down=1 pages=True
map <PAGEUP> move up=1 pages=True
map <CR> move right=1
#map <DELETE> console delete
-map <INSERT> console touch
+map <INSERT> console touch%space
copymap <UP> <C-p>
copymap <DOWN> <C-n>
@@ -315,7 +316,7 @@ map <C-x>wn shell -f echo -n %f | xsel -i; xsel -o | xsel -i -b
# Filesystem Operations
map <C-x>= chmod
-map <A-d> console rename
+map <A-d> console rename%space
map <C-e> eval fm.open_console('rename ' + fm.thisfile.basename)
map <C-a> eval fm.open_console('rename ' + fm.thisfile.basename, position=7)
@@ -336,7 +337,7 @@ map <C-x><A-w>a copy mode=add
map <C-x><A-w>r copy mode=remove
# Searching
-map <C-x>s console search_inc
+map <C-x>s console search_inc%space
map <C-s> search_next
map <C-r> search_next forward=False
@@ -392,7 +393,7 @@ map <C-x>zP toggle_option preview_directories
map <C-x>zs toggle_option sort_case_insensitive
map <C-x>zu toggle_option autoupdate_cumulative_size
map <C-x>zv toggle_option use_preview_script
-map <C-x>zf console filter
+map <C-x>zf console filter%space
# Bookmarks
map <C-x>rb<any> enter_bookmark %any
diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf
index 20727458..0dcc41b4 100644
--- a/ranger/config/rifle.conf
+++ b/ranger/config/rifle.conf
@@ -132,17 +132,6 @@ mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
#-------------------------------------------
-# Image Viewing:
-#-------------------------------------------
-mime ^image, has sxiv, X, flag f = sxiv -- "$@"
-mime ^image, has feh, X, flag f = feh -- "$@"
-mime ^image, has mirage, X, flag f = mirage -- "$@"
-mime ^image, has eog, X, flag f = eog -- "$@"
-mime ^image, has eom, X, flag f = eom -- "$@"
-mime ^image, has gimp, X, flag f = gimp -- "$@"
-ext xcf, X, flag f = gimp -- "$@"
-
-#-------------------------------------------
# Documents
#-------------------------------------------
ext pdf, has llpp, X, flag f = llpp "$@"
@@ -168,6 +157,17 @@ ext djvu, has evince, X, flag f = evince -- "$@"
ext djvu, has atril, X, flag f = atril -- "$@"
#-------------------------------------------
+# Image Viewing:
+#-------------------------------------------
+mime ^image, has sxiv, X, flag f = sxiv -- "$@"
+mime ^image, has feh, X, flag f = feh -- "$@"
+mime ^image, has mirage, X, flag f = mirage -- "$@"
+mime ^image, has eog, X, flag f = eog -- "$@"
+mime ^image, has eom, X, flag f = eom -- "$@"
+mime ^image, has gimp, X, flag f = gimp -- "$@"
+ext xcf, X, flag f = g