diff options
-rw-r--r-- | doc/ranger.1 | 16 | ||||
-rw-r--r-- | doc/ranger.pod | 13 | ||||
-rw-r--r-- | ranger/config/rc.conf | 1 | ||||
-rw-r--r-- | ranger/container/settings.py | 4 | ||||
-rw-r--r-- | ranger/gui/widgets/browsercolumn.py | 6 |
5 files changed, 20 insertions, 20 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1 index ecc4f7f1..b2ba1aac 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -735,9 +735,15 @@ this pattern will hide all files that start with a dot or end with a tilde. The delay that ranger idly waits for user input, in milliseconds, with a resolution of 100ms. Lower delay reduces lag between directory updates but increases \s-1CPU\s0 load. -.IP "line_numbers [bool]" 4 -.IX Item "line_numbers [bool]" -Show line numbers in main column. +.IP "line_numbers [string]" 4 +.IX Item "line_numbers [string]" +Show line numbers in main column. Possible values are: +.Sp +.Vb 3 +\& false turn the feature off +\& absolute absolute line numbers for use with "<N>gg" +\& relative relative line numbers for "<N>k" or "<N>j" +.Ve .IP "max_console_history_size [integer, none]" 4 .IX Item "max_console_history_size [integer, none]" How many console commands should be kept in history? \*(L"none\*(R" will disable the @@ -776,10 +782,6 @@ 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_line_numbers [bool]" 4 -.IX Item "relative_line_numbers [bool]" -Show relative line numbers in main column. Requires \fBline_numbers\fR set to -\&\fBtrue\fR. .IP "save_console_history [bool]" 4 .IX Item "save_console_history [bool]" Should the console history be saved on exit? If disabled, the console history diff --git a/doc/ranger.pod b/doc/ranger.pod index 00c26f12..a69dc52d 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -720,9 +720,13 @@ The delay that ranger idly waits for user input, in milliseconds, with a resolution of 100ms. Lower delay reduces lag between directory updates but increases CPU load. -=item line_numbers [bool] +=item line_numbers [string] -Show line numbers in main column. +Show line numbers in main column. Possible values are: + + false turn the feature off + absolute absolute line numbers for use with "<N>gg" + relative relative line numbers for "<N>k" or "<N>j" =item max_console_history_size [integer, none] @@ -772,11 +776,6 @@ 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_line_numbers [bool] - -Show relative line numbers in main column. Requires B<line_numbers> set to -B<true>. - =item save_console_history [bool] Should the console history be saved on exit? If disabled, the console history diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index cf07b232..ea3a812c 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -203,7 +203,6 @@ set clear_filters_on_dir_change false # Disable displaying line numbers in main column set line_numbers false -set relative_line_numbers false # =================================================================== # == Local Options diff --git a/ranger/container/settings.py b/ranger/container/settings.py index be468c21..85729907 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -26,7 +26,7 @@ ALLOWED_SETTINGS = { 'flushinput': bool, 'hidden_filter': str, 'idle_delay': int, - 'line_numbers': bool, + 'line_numbers': str, 'max_console_history_size': (int, type(None)), 'max_history_size': (int, type(None)), 'metadata_deep_search': bool, @@ -39,7 +39,6 @@ ALLOWED_SETTINGS = { 'preview_images_method': str, 'preview_max_size': int, 'preview_script': (str, type(None)), - 'relative_line_numbers': bool, 'save_console_history': bool, 'scroll_offset': int, 'shorten_title': int, @@ -70,6 +69,7 @@ ALLOWED_SETTINGS = { ALLOWED_VALUES = { 'confirm_on_delete': ['always', 'multiple', 'never'], + 'line_numbers': ['false', 'absolute', 'relative'], 'preview_images_method': ['w3m', 'iterm2'], 'vcs_backend_bzr': ['enabled', 'local', 'disabled'], 'vcs_backend_git': ['enabled', 'local', 'disabled'], diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 964f000a..229c0345 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -193,7 +193,7 @@ class BrowserColumn(Pager): def _format_line_number(self, linum_format, i, selected_i): line_number = i - if self.settings.relative_line_numbers: + if self.settings.line_numbers == 'relative': line_number = abs(selected_i - i) if line_number == 0: line_number = selected_i @@ -299,7 +299,7 @@ class BrowserColumn(Pager): # For (2) we could add self.settings.relative_line_numbers to # key, but we still require a conditional check here for (1), # and it solves both problems at the same time. - if self.main_column and self.settings.line_numbers: + if self.main_column and self.settings.line_numbers != 'false': line_number_text = self._format_line_number(linum_format, i, selected_i) @@ -324,7 +324,7 @@ class BrowserColumn(Pager): space = self.wid # line number field - if self.settings.line_numbers: + if self.settings.line_numbers != 'false': if self.main_column and space - linum_text_len > 2: line_number_text = self._format_line_number(linum_format, i, |