summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2018-06-17 13:50:21 +0200
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2018-06-17 13:55:20 +0200
commit835065f2819f2dde2426e203996c12862a97d3f8 (patch)
tree326179e224535f3346d1c6c24e196cc99171cb40
parentf2c8a7ff2680bdb91a499479eca59eda351ddb86 (diff)
downloadranger-835065f2819f2dde2426e203996c12862a97d3f8.tar.gz
New setting: relative_current_zero
Closes #1205.
-rw-r--r--doc/ranger.14
-rw-r--r--doc/ranger.pod5
-rw-r--r--ranger/config/rc.conf7
-rw-r--r--ranger/container/settings.py1
-rw-r--r--ranger/gui/widgets/browsercolumn.py2
5 files changed, 17 insertions, 2 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index 03791924..5b3afa73 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -908,6 +908,10 @@ to disable this feature.
 Which script should handle generating previews?  If the file doesn't exist, or
 use_preview_script is off, ranger will handle previews itself by just printing
 the content.
+.IP "relative_current_zero [bool]" 4
+.IX Item "relative_current_zero [bool]"
+When line_numbers is set to relative, show 0 on the current line if
+true or show the absolute number of the current line when false.
 .IP "save_backtick_bookmark [bool]" 4
 .IX Item "save_backtick_bookmark [bool]"
 Save the \f(CW\*(C`\`\*(C'\fR bookmark to disk.  This bookmark is used to switch to the last
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 24df0fc9..fcee60aa 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -921,6 +921,11 @@ Which script should handle generating previews?  If the file doesn't exist, or
 use_preview_script is off, ranger will handle previews itself by just printing
 the content.
 
+=item relative_current_zero [bool]
+
+When line_numbers is set to relative, show 0 on the current line if
+true or show the absolute number of the current line when false.
+
 =item save_backtick_bookmark [bool]
 
 Save the C<`> bookmark to disk.  This bookmark is used to switch to the last
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index 37a570b5..62331e22 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -261,9 +261,14 @@ set metadata_deep_search false
 # Clear all existing filters when leaving a directory
 set clear_filters_on_dir_change false
 
-# Disable displaying line numbers in main column
+# Disable displaying line numbers in main column.
+# Possible values: false, absolute, relative.
 set line_numbers false
 
+# When line_numbers=relative show the absolute line number in the
+# current line.
+set relative_current_zero false
+
 # Start line numbers from 1 instead of 0
 set one_indexed false
 
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 9002fded..94e455a5 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -66,6 +66,7 @@ ALLOWED_SETTINGS = {
     'preview_images_method': str,
     'preview_max_size': int,
     'preview_script': (str, type(None)),
+    'relative_current_zero': bool,
     'save_backtick_bookmark': bool,
     'save_console_history': bool,
     'save_tabs_on_exit': bool,
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index f85e1646..95260813 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -212,7 +212,7 @@ class BrowserColumn(Pager):  # pylint: disable=too-many-instance-attributes
         line_number = i
         if self.settings.line_numbers == 'relative':
             line_number = abs(selected_i - i)
-            if line_number == 0:
+            if not self.settings.relative_current_zero and line_number == 0:
                 if self.settings.one_indexed:
                     line_number = selected_i + 1
                 else: