diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README.md (renamed from README) | 9 | ||||
-rw-r--r-- | doc/examples/vim_file_chooser.vim | 2 | ||||
-rw-r--r-- | doc/ranger.1 | 14 | ||||
-rw-r--r-- | doc/ranger.pod | 8 | ||||
-rw-r--r-- | doc/release-checklist.txt | 27 | ||||
-rw-r--r-- | doc/rifle.1 | 4 | ||||
-rw-r--r-- | doc/screenshot.png | bin | 0 -> 55571 bytes | |||
-rw-r--r-- | ranger/config/commands.py | 12 | ||||
-rw-r--r-- | ranger/config/rc.conf | 37 | ||||
-rw-r--r-- | ranger/config/rifle.conf | 5 | ||||
-rw-r--r-- | ranger/container/directory.py | 4 | ||||
-rw-r--r-- | ranger/container/settings.py | 1 | ||||
-rw-r--r-- | ranger/core/actions.py | 3 | ||||
-rw-r--r-- | ranger/core/main.py | 2 | ||||
-rwxr-xr-x | ranger/ext/rifle.py | 7 | ||||
-rw-r--r-- | ranger/gui/colorscheme.py | 5 | ||||
-rw-r--r-- | ranger/gui/widgets/console.py | 27 | ||||
-rw-r--r-- | ranger/gui/widgets/titlebar.py | 3 | ||||
-rwxr-xr-x | setup.py | 2 |
21 files changed, 123 insertions, 52 deletions
diff --git a/.gitignore b/.gitignore index 8c110f00..55687146 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.pyc *.pyo stuff/* +doc/ranger.1.html diff --git a/Makefile b/Makefile index 0a79142e..5ea3d21e 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # This software is distributed under the terms of the GNU GPL version 3. NAME = ranger -VERSION = $(shell grep -m 1 -o '[0-9][0-9.]\+' README) +VERSION = $(shell grep -m 1 -o '[0-9][0-9.]\+' README.md) NAME_RIFLE = rifle VERSION_RIFLE = $(VERSION) SNAPSHOT_NAME ?= $(NAME)-$(VERSION)-$(shell git rev-parse HEAD | cut -b 1-8).tar.gz diff --git a/README b/README.md index aa16ad03..56565c46 100644 --- a/README +++ b/README.md @@ -5,6 +5,8 @@ minimalistic and nice curses interface with a view on the directory hierarchy. It ships with "rifle", a file launcher that is good at automatically finding out which program to use for what file type. +![screenshot](doc/screenshot.png) + This file describes ranger and how to get it to run. For instructions on the usage, please read the man page. See doc/HACKING for development specific information. For configuration, check the files in ranger/config/. They @@ -21,10 +23,9 @@ About ----- * Authors: Check the copyright notices in each source file * License: GNU General Public License Version 3 - * Website: http://ranger.nongnu.org/ * Download: http://ranger.nongnu.org/ranger-stable.tar.gz -* Bug reports: https://savannah.nongnu.org/bugs/?group=ranger&func=additem +* Bug reports: https://github.com/hut/ranger/issues * git clone http://git.sv.gnu.org/r/ranger.git @@ -77,10 +78,10 @@ Use the package manager of your operating system to install ranger. Note that ranger can be started without installing by simply running ranger.py. To install ranger manually: - sudo make install +> sudo make install This translates roughly to: - sudo python setup.py install --optimize=1 --record=install_log.txt +> sudo python setup.py install --optimize=1 --record=install_log.txt This also saves a list of all installed files to install_log.txt, which you can use to uninstall ranger. diff --git a/doc/examples/vim_file_chooser.vim b/doc/examples/vim_file_chooser.vim index 68947d2d..df6aacc9 100644 --- a/doc/examples/vim_file_chooser.vim +++ b/doc/examples/vim_file_chooser.vim @@ -14,11 +14,13 @@ function! RangeChooser() "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 diff --git a/doc/ranger.1 b/doc/ranger.1 index cd993202..2c19a1a5 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) +.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.6.1" "04/28/2014" "ranger manual" +.TH RANGER 1 "ranger-1.6.1" "10/15/2014" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -732,10 +732,10 @@ Sort directories first? .IP "sort_reverse [bool] <or>" 4 .IX Item "sort_reverse [bool] <or>" Reverse the order of files? -.IP "sort [string] <oa>, <ob>, <oc>, <om>, <on>, <ot>, <os>" 4 -.IX Item "sort [string] <oa>, <ob>, <oc>, <om>, <on>, <ot>, <os>" +.IP "sort [string] <oa>, <ob>, <oc>, <om>, <on>, <ot>, <os>, <oz>" 4 +.IX Item "sort [string] <oa>, <ob>, <oc>, <om>, <on>, <ot>, <os>, <oz>" Which sorting mechanism should be used? Choose one of \fBatime\fR, \fBbasename\fR, -\&\fBctime\fR, \fBmtime\fR, \fBnatural\fR, \fBtype\fR, \fBsize\fR +\&\fBctime\fR, \fBmtime\fR, \fBnatural\fR, \fBtype\fR, \fBsize\fR, \fBrandom\fR .Sp Note: You can reverse the order by typing an uppercase second letter in the key combination, e.g. \*(L"oN\*(R" to sort from Z to A. @@ -1201,6 +1201,8 @@ provided along with the source code. .IX Item "The project page: <http://ranger.nongnu.org/>" .IP "The mailing list: <http://savannah.nongnu.org/mail/?group=ranger>" 4 .IX Item "The mailing list: <http://savannah.nongnu.org/mail/?group=ranger>" +.IP "\s-1IRC\s0 channel: #ranger on freenode.net" 4 +.IX Item "IRC channel: #ranger on freenode.net" .PD .PP ranger is maintained with the git version control system. To fetch a fresh @@ -1214,7 +1216,7 @@ copy, run: \&\fIrifle\fR\|(1) .SH "BUGS" .IX Header "BUGS" -Report bugs here: <http://savannah.nongnu.org/bugs/?group=ranger> +Report bugs here: <https://github.com/hut/ranger/issues> .PP Please include as much relevant information as possible. For the most diagnostic output, run ranger like this: \f(CW\*(C`PYTHONOPTIMIZE= ranger \-\-debug\*(C'\fR diff --git a/doc/ranger.pod b/doc/ranger.pod index 182de859..07c6a3bc 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -736,10 +736,10 @@ Sort directories first? Reverse the order of files? -=item sort [string] <oa>, <ob>, <oc>, <om>, <on>, <ot>, <os> +=item sort [string] <oa>, <ob>, <oc>, <om>, <on>, <ot>, <os>, <oz> Which sorting mechanism should be used? Choose one of B<atime>, B<basename>, -B<ctime>, B<mtime>, B<natural>, B<type>, B<size> +B<ctime>, B<mtime>, B<natural>, B<type>, B<size>, B<random> Note: You can reverse the order by typing an uppercase second letter in the key combination, e.g. "oN" to sort from Z to A. @@ -1311,6 +1311,8 @@ GNU General Public License 3 or (at your option) any later version. =item The mailing list: L<http://savannah.nongnu.org/mail/?group=ranger> +=item IRC channel: #ranger on freenode.net + =back ranger is maintained with the git version control system. To fetch a fresh @@ -1330,7 +1332,7 @@ rifle(1) =head1 BUGS -Report bugs here: L<http://savannah.nongnu.org/bugs/?group=ranger> +Report bugs here: L<https://github.com/hut/ranger/issues> Please include as much relevant information as possible. For the most diagnostic output, run ranger like this: C<PYTHONOPTIMIZE= ranger --debug> diff --git a/doc/release-checklist.txt b/doc/release-checklist.txt new file mode 100644 index 00000000..2ef99afe --- /dev/null +++ b/doc/release-checklist.txt @@ -0,0 +1,27 @@ +( ) test everything one last time: +( ) * make test +( ) * ./ranger.py [--clean] +( ) * ranger/ext/rifle.py +( ) * make install +( ) make a release commit: +( ) * update the number in the README +( ) * update the number in ranger/__init__.py +( ) * update the version number in ranger/ext/rifle.py +( ) * rebuild the man page with the updated number +( ) * write changelog entry +( ) * think of a witty commit message +( ) * change VERSION in ranger/__init__.py to something with "stable" +( ) * push the commit +( ) build .tar.gz with "make snapshot" +( ) make, make install and test the snapshot one last time +( ) update the website: +( ) * add the new version as ranger-stable.tar.gz +( ) * add the new version as ranger-X.Y.Z.tar.gz +( ) * update both signatures (gpg -sb <file>) +( ) * update the changelog +( ) * update the man page +( ) * rerun boobies.py +( ) announce the update +( ) * to the mailing list +( ) * in the arch linux forum +( ) * write a news entry on savannah diff --git a/doc/rifle.1 b/doc/rifle.1 index df63d118..999d56d6 100644 --- a/doc/rifle.1 +++ b/doc/rifle.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) +.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "RIFLE 1" -.TH RIFLE 1 "rifle-1.6.1" "04/11/2014" "rifle manual" +.TH RIFLE 1 "rifle-1.6.1" "08/26/2014" "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/screenshot.png b/doc/screenshot.png new file mode 100644 index 00000000..42f13bcf --- /dev/null +++ b/doc/screenshot.png Binary files differdiff --git a/ranger/config/commands.py b/ranger/config/commands.py index 68714009..abc616ee 100644 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -685,6 +685,18 @@ class rename(Command): def tab(self): return self._tab_directory_content() +class renameConsole(Command): + """:renameConsole + + Creates an open_console for the rename command, automatically placing the cursor before the file extension. + """ + + def execute(self): + if "." in self.fm.thisfile.basename: + offset = 6 + len(self.fm.thisfile.basename) - self.fm.thisfile.basename[::-1].index('.') + self.fm.open_console('rename ' + self.fm.thisfile.basename, position=offset) + else: + self.fm.open_console('rename ' + self.fm.thisfile.basename) class chmod(Command): """:chmod <octal number> diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 52b06b4b..644706e8 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -35,7 +35,7 @@ set confirm_on_delete multiple # Which script is used to generate file previews? # ranger ships with scope.sh, a script that calls external programs (see -# README for dependencies) to preview images, archives, etc. +# README.md for dependencies) to preview images, archives, etc. set preview_script ~/.config/ranger/scope.sh # Use the external preview script or display simple plain text or image previews? @@ -147,7 +147,7 @@ set autoupdate_cumulative_size false # Turning this on makes sense for screen readers: set show_cursor false -# One of: size, basename, mtime, type +# One of: size, natural, basename, atime, ctime, mtime, type, random set sort natural # Additional sorting options @@ -166,6 +166,9 @@ set cd_bookmarks true # disable this feature. set preview_max_size 0 +# Add the highlighted file to the path in the titlebar +set show_selection_in_titlebar true + # =================================================================== # == Local Options # =================================================================== @@ -299,14 +302,15 @@ map g? cd /usr/share/doc/ranger map E edit map du shell -p du --max-depth=1 -h --apparent-size map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh -map yp shell -d echo -n %d/%f | xsel -i -map yd shell -d echo -n %d | xsel -i -map yn shell -d echo -n %f | xsel -i +map yp shell -f echo -n %d/%f | xsel -i; xsel -o | xsel -i -b +map yd shell -f echo -n %d | xsel -i; xsel -o | xsel -i -b +map yn shell -f echo -n %f | xsel -i; xsel -o | xsel -i -b # Filesystem Operations map = chmod map cw console rename +map a renameConsole map A eval fm.open_console('rename ' + fm.thisfile.basename) map I eval fm.open_console('rename ' + fm.thisfile.basename, position=7) @@ -372,6 +376,7 @@ map <a-9> tab_open 9 # Sorting map or toggle_option sort_reverse +map oz set sort=random map os chain set sort=size; set sort_reverse=False map ob chain set sort=basename; set sort_reverse=False map on chain set sort=natural; set sort_reverse=False @@ -414,17 +419,17 @@ map m<bg> draw_bookmarks copymap m<bg> um<bg> `<bg> '<bg> # Generate all the chmod bindings with some python help: -eval for arg in "rwxXst": cmd("map +u{0} shell -d chmod u+{0} %s".format(arg)) -eval for arg in "rwxXst": cmd("map +g{0} shell -d chmod g+{0} %s".format(arg)) -eval for arg in "rwxXst": cmd("map +o{0} shell -d chmod o+{0} %s".format(arg)) -eval for arg in "rwxXst": cmd("map +a{0} shell -d chmod a+{0} %s".format(arg)) -eval for arg in "rwxXst": cmd("map +{0} shell -d chmod u+{0} %s".format(arg)) - -eval for arg in "rwxXst": cmd("map -u{0} shell -d chmod u-{0} %s".format(arg)) -eval for arg in "rwxXst": cmd("map -g{0} shell -d chmod g-{0} %s".format(arg)) -eval for arg in "rwxXst": cmd("map -o{0} shell -d chmod o-{0} %s".format(arg)) -eval for arg in "rwxXst": cmd("map -a{0} shell -d chmod a-{0} %s".format(arg)) -eval for arg in "rwxXst": cmd("map -{0} shell -d chmod u-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg)) + +eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg)) +eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg)) # =================================================================== # == Define keys for the console diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf index 68189cd7..4776cdf9 100644 --- a/ranger/config/rifle.conf +++ b/ranger/config/rifle.conf @@ -56,6 +56,7 @@ ext x?html?, has surf, X, flag f = surf -- file://"$1" ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@" ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@" +ext x?html?, has dwb, X, flag f = dwb -- "$@" ext x?html?, has jumanji, X, flag f = jumanji -- "$@" ext x?html?, has luakit, X, flag f = luakit -- "$@" ext x?html?, has uzbl, X, flag f = uzbl -- "$@" @@ -86,6 +87,7 @@ mime ^text, label pager = "$PAGER" -- "$@" ext 1 = man "$1" ext s[wmf]c, has zsnes, X = zsnes "$1" +ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1" ext nes, has fceux, X = fceux "$1" ext exe = wine "$1" name ^[mM]akefile$ = make @@ -133,6 +135,7 @@ mime ^video, terminal, !X, has mplayer = mplayer -- "$@" # Image Viewing: #------------------------------------------- mime ^image, has eog, X, flag f = eog -- "$@" +mime ^image, has eom, X, flag f = eom -- "$@" mime ^image, has sxiv, X, flag f = sxiv -- "$@" mime ^image, has feh, X, flag f = feh -- "$@" mime ^image, has mirage, X, flag f = mirage -- "$@" @@ -148,6 +151,7 @@ ext pdf, has mupdf, X, flag f = mupdf -- "$@" ext pdf, has apvlv, X, flag f = apvlv -- "$@" ext pdf, has xpdf, X, flag f = xpdf -- "$@" ext pdf, has evince, X, flag f = evince -- "$@" +ext pdf, has atril, X, flag f = atril -- "$@" ext pdf, has okular, X, flag f = okular -- "$@" ext pdf, has epdfview, X, flag f = epdfview -- "$@" @@ -160,6 +164,7 @@ ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@" ext djvu, has evince, X, flag f = evince -- "$@" +ext djvu, has atril, X, flag f = atril -- "$@" #------------------------------------------- # Archives diff --git a/ranger/container/directory.py b/ranger/container/directory.py index 136cc8ac..de69c467 100644 --- a/ranger/container/directory.py +++ b/ranger/container/directory.py @@ -2,6 +2,7 @@ # This software is distributed under the terms of the GNU GPL version 3. import os.path +import random import re from os import stat as os_stat, lstat as os_lstat @@ -77,10 +78,11 @@ class Directory(FileSystemObject, Accumulator, Loadable): sort_dict = { 'basename': sort_by_basename, 'natural': sort_naturally, - 'size': lambda path: -path.size, + 'size': lambda path: -(path.size or 1), 'mtime': lambda path: -(path.stat and path.stat.st_mtime or 1), 'ctime': lambda path: -(path.stat and path.stat.st_ctime or 1), 'atime': lambda path: -(path.stat and path.stat.st_atime or 1), + 'random': lambda path: random.random(), 'type': lambda path: path.mimetype or '', } diff --git a/ranger/container/settings.py b/ranger/container/settings.py index 90b6f7ce..0d8b6906 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -39,6 +39,7 @@ ALLOWED_SETTINGS = { 'scroll_offset': int, 'shorten_title': int, 'show_cursor': bool, # TODO: not working? + 'show_selection_in_titlebar': bool, 'show_hidden_bookmarks': bool, 'show_hidden': bool, 'sort_case_insensitive': bool, diff --git a/ranger/core/actions.py b/ranger/core/actions.py index ea4b54eb..f6c41447 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -828,6 +828,9 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): pager = self.ui.get_pager() path = file.realpath + if not path: + return None + if self.settings.preview_images and file.image: pager.set_image(path) return None diff --git a/ranger/core/main.py b/ranger/core/main.py index b0ae4a26..628748bf 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -165,7 +165,7 @@ def main(): print(crash_traceback) print("ranger crashed. " \ "Please report this traceback at:") - print("http://savannah.nongnu.org/bugs/?group=ranger&func=additem") + print("https://github.com/hut/ranger/issues") return 1 return 0 diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py index 1cc2dcf8..4033d639 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -210,7 +210,12 @@ class Rifle(object): elif function == 'mime': return bool(re.search(argument, self._get_mimetype(files[0]))) elif function == 'has': - return argument in get_executables() + if argument.startswith("$"): + if argument[1:] in os.environ: + return os.environ[argument[1:]] in get_executables() + return False + else: + return argument in get_executables() elif function == 'terminal': return _is_terminal() elif function == 'number': diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py index f7eb22b6..6710d8b1 100644 --- a/ranger/gui/colorscheme.py +++ b/ranger/gui/colorscheme.py @@ -20,9 +20,8 @@ path/to/ranger/colorschemes/ context is a struct which contains all entries of CONTEXT_KEYS, associated with either True or False. -define which colorscheme to use by having this to your options.py: -from ranger import colorschemes -colorscheme = "name" +Define which colorscheme in your settings (e.g. ~/.config/ranger/rc.conf): +set colorscheme yourschemename """ import os diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index 91366e7c..8dd201e5 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -214,20 +214,23 @@ class Console(Widget): return unicode_buffer, line, pos if self.fm.py3: - unicode_buffer += key - try: - decoded = unicode_buffer.encode("latin-1").decode("utf-8") - except UnicodeDecodeError: - return unicode_buffer, line, pos - except UnicodeEncodeError: - return unicode_buffer, line, pos - else: + if len(unicode_buffer) >= 4: unicode_buffer = "" - if pos == len(line): - line += decoded + if ord(key) in range(0, 256): + unicode_buffer += key + try: + decoded = unicode_buffer.encode("latin-1").decode("utf-8") + except UnicodeDecodeError: + return unicode_buffer, line, pos + except UnicodeEncodeError: + return unicode_buffer, line, pos else: - line = line[:pos] + decoded + line[pos:] - pos += len(decoded) + unicode_buffer = "" + if pos == len(line): + line += decoded + else: + line = line[:pos] + decoded + line[pos:] + pos += len(decoded) else: if pos == len(line): line += key diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index 38a99a92..fa10a744 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -115,7 +115,8 @@ class TitleBar(Widget): bar.add(path.basename, clr, directory=path) bar.add('/', clr, fixed=True, directory=path) - if self.fm.thisfile is not None: + if self.fm.thisfile is not None and \ + self.settings.show_selection_in_titlebar: bar.add(self.fm.thisfile.basename, 'file') def _get_right_part(self, bar): diff --git a/setup.py b/setup.py index 84325cd9..7bb67837 100755 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ if __name__ == '__main__': ['doc/ranger.1', 'doc/rifle.1']), ('share/doc/ranger', - ['README', + ['README.md', 'CHANGELOG', 'doc/HACKING', 'doc/colorschemes.txt']), |