summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS2
-rw-r--r--doc/ranger.18
-rw-r--r--doc/ranger.pod1
-rw-r--r--ranger/config/rc.conf1
-rw-r--r--ranger/config/rifle.conf32
-rw-r--r--ranger/container/fsobject.py2
-rw-r--r--ranger/core/linemode.py20
-rw-r--r--ranger/gui/context.py2
-rw-r--r--ranger/gui/widgets/statusbar.py9
9 files changed, 53 insertions, 24 deletions
diff --git a/AUTHORS b/AUTHORS
index 3f887d0d..1fda9164 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -19,7 +19,7 @@ Copyright 2015  anekos <anekos@snca.net>
 Copyright 2015  bastorran
 Copyright 2015  Delisa Mason <iskanamagus@gmail.com>
 Copyright 2015  No Suck <admin@nosuck.org>
-Copyright 2015  randnobx <randynobx@gmail.com>
+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
diff --git a/doc/ranger.1 b/doc/ranger.1
index 3ba4fe4e..8a1e00c1 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/03/2015" "ranger manual"
+.TH RANGER 1 "ranger-1.6.1" "30/03/15" "ranger manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -1006,13 +1006,17 @@ Looks for a string in all marked files or directories.
 .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
 \&     metadata was found.  See :meta command.
 .Ve
+.Sp
+The custom linemodes may be added by subclassing the \fILinemodeBase\fR class.
+See the \fIranger.core.linemode\fR module for some examples.
 .IP "load_copy_buffer" 2
 .IX Item "load_copy_buffer"
 Load the copy buffer from \fI~/.config/ranger/copy_buffer\fR.  This can be used to
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 336a886c..a6204403 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -1046,6 +1046,7 @@ Looks for a string in all marked files or directories.
 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
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index ca67c389..62dd030f 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -251,6 +251,7 @@ map cd console cd
 
 # Change the line mode
 map Mf linemode filename
+map Mi linemode fileinfo
 map Mp linemode permissions
 map Mt linemode metatitle
 
diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf
index 6e1e78b9..8e98f966 100644
--- a/ranger/config/rifle.conf
+++ b/ranger/config/rifle.conf
@@ -133,17 +133,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 "$@"
@@ -159,16 +148,27 @@ ext pdf, has qpdfview, X, flag f = qpdfview "$@"
 
 ext docx?, has catdoc,       terminal = catdoc -- "$@" | "$PAGER"
 
-ext                  sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric,    X, flag f = gnumeric -- "$@"
-ext                  sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread,     X, flag f = kspread -- "$@"
-ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
-ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice,     X, flag f = soffice "$@"
-ext od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice,     X, flag f = ooffice "$@"
+ext                        sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric,    X, flag f = gnumeric -- "$@"
+ext                        sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread,     X, flag f = kspread -- "$@"
+ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
+ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice,     X, flag f = soffice "$@"
+ext pptx?|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 -- "$@"
 
 #-------------------------------------------
+# 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 -- "$@"
+
+#-------------------------------------------
 # Archives
 #-------------------------------------------
 # This requires atool
diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py
index 131e2304..1bf08e20 100644
--- a/ranger/container/fsobject.py
+++ b/ranger/container/fsobject.py
@@ -86,7 +86,7 @@ class FileSystemObject(FileManagerAware, SettingsAware):
     _linemode = DEFAULT_LINEMODE
     linemode_dict = dict(
         (linemode.name, linemode()) for linemode in
-        [DefaultLinemode, TitleLinemode, PermissionsLinemode]
+        [DefaultLinemode, TitleLinemode, PermissionsLinemode, FileInfoLinemode]
     )
 
     def __init__(self, path, preload=None, path_is_abs=False, basename_is_rel_to=None):
diff --git a/ranger/core/linemode.py b/ranger/core/linemode.py
index 5c138449..529c6b93 100644
--- a/ranger/core/linemode.py
+++ b/ranger/core/linemode.py
@@ -37,8 +37,9 @@ class LinemodeBase(object):
 
         If `NotImplementedError' is raised (e.g. this method is just
         not implemented in the actual linemode), the caller should
-        provide its own implementation, which in this case means
-        displaying the hardlink count of the directories. Useful
+        provide its own implementation (which in this case means
+        displaying the hardlink count of the directories, size of the
+        files and additionally a symlink marker for symlinks). Useful
         because only the caller (BrowserColumn) possesses the data
         necessary to display that information.
 
@@ -83,3 +84,18 @@ class PermissionsLinemode(LinemodeBase):
 
     def infostring(self, file, metadata):
         return ""
+
+
+class FileInfoLinemode(LinemodeBase):
+    name = "fileinfo"
+
+    def filetitle(self, file, metadata):
+        return file.relative_path
+
+    def infostring(self, file, metadata):
+        if not file.is_directory:
+            from subprocess import check_output
+            fileinfo = check_output(["file", "-bL", file.path]).strip()
+            return fileinfo
+        else:
+            raise NotImplementedError
diff --git a/ranger/gui/context.py b/ranger/gui/context.py
index 2ad27434..e5aef06c 100644
--- a/ranger/gui/context.py
+++ b/ranger/gui/context.py
@@ -11,7 +11,7 @@ CONTEXT_KEYS = ['reset', 'error', 'badinfo',
         'good', 'bad',
         'space', 'permissions', 'owner', 'group', 'mtime', 'nlink',
         'scroll', 'all', 'bot', 'top', 'percentage', 'filter',
-        'marked', 'tagged', 'tag_marker', 'cut', 'copied',
+        'flat', 'marked', 'tagged', 'tag_marker', 'cut', 'copied',
         'help_markup', # COMPAT
         'seperator', 'key', 'special', 'border', # COMPAT
         'title', 'text', 'highlight', 'bars', 'quotes', 'tab', 'loaded',
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index 9ff331a0..f5824d99 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -242,8 +242,15 @@ class StatusBar(Widget):
         max_pos = len(target) - self.column.hei
         base = 'scroll'
 
+        right.add(" ", "space")
+
+        if self.fm.thisdir.flat:
+            right.add("flat=", base, 'flat')
+            right.add(str(self.fm.thisdir.flat), base, 'flat')
+            right.add(", ", "space")
+
         if self.fm.thisdir.filter:
-            right.add(" f=`", base, 'filter')
+            right.add("f=`", base, 'filter')
             right.add(self.fm.thisdir.filter.pattern, base, 'filter')
             right.add("', ", "space")