diff options
-rw-r--r-- | doc/ranger.1 | 9 | ||||
-rw-r--r-- | doc/ranger.pod | 8 | ||||
-rwxr-xr-x | ranger/config/commands.py | 9 | ||||
-rw-r--r-- | ranger/config/rc.conf | 3 | ||||
-rw-r--r-- | ranger/container/settings.py | 2 |
5 files changed, 29 insertions, 2 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1 index ed41966d..bbf6143c 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -704,6 +704,15 @@ though by turning on this option. .IX Item "cd_bookmarks [bool]" Specify whether bookmarks should be included in the tab completion of the \*(L"cd\*(R" command. +.IP "cd_tab_case [string]" 4 +.IX Item "cd_tab_case [string]" +Changes case sensitivity for the \*(L"cd\*(R" command tab completion. Possible values are: +.Sp +.Vb 3 +\& sensitive +\& insensitive +\& smart +.Ve .IP "collapse_preview [bool] <zc>" 4 .IX Item "collapse_preview [bool] <zc>" When no preview is visible, should the last column be squeezed to make use of diff --git a/doc/ranger.pod b/doc/ranger.pod index 8fd499cf..870ab5fd 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -682,6 +682,14 @@ though by turning on this option. Specify whether bookmarks should be included in the tab completion of the "cd" command. +=item cd_tab_case [string] + +Changes case sensitivity for the "cd" command tab completion. Possible values are: + + sensitive + insensitive + smart + =item collapse_preview [bool] <zc> When no preview is visible, should the last column be squeezed to make use of diff --git a/ranger/config/commands.py b/ranger/config/commands.py index a2b55126..eb4c3609 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -178,8 +178,13 @@ class cd(Command): # are we in the middle of the filename? else: _, dirnames, _ = next(os.walk(abs_dirname)) - dirnames = [dn for dn in dirnames - if dn.startswith(rel_basename)] + if self.fm.settings.cd_tab_case == 'insensitive' or ( + self.fm.settings.cd_tab_case == 'smart' and rel_basename.islower()): + dirnames = [dn for dn in dirnames + if dn.lower().startswith(rel_basename.lower())] + else: + dirnames = [dn for dn in dirnames + if dn.startswith(rel_basename)] except (OSError, StopIteration): # os.walk found nothing pass diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index d6652654..d19113b4 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -192,6 +192,9 @@ set xterm_alt_key false # Whether to include bookmarks in cd command set cd_bookmarks true +# Changes case sensitivity for the cd command tab completion +set cd_tab_case sensitive + # Avoid previewing files larger than this size, in bytes. Use a value of 0 to # disable this feature. set preview_max_size 0 diff --git a/ranger/container/settings.py b/ranger/container/settings.py index b795d4a9..a0f449dd 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -27,6 +27,7 @@ ALLOWED_SETTINGS = { 'autosave_bookmarks': bool, 'autoupdate_cumulative_size': bool, 'cd_bookmarks': bool, + 'cd_tab_case': str, 'collapse_preview': bool, 'colorscheme': str, 'column_ratios': (tuple, list), @@ -85,6 +86,7 @@ ALLOWED_SETTINGS = { } ALLOWED_VALUES = { + 'cd_tab_case': ['sensitive', 'insensitive', 'smart'], 'confirm_on_delete': ['multiple', 'always', 'never'], 'line_numbers': ['false', 'absolute', 'relative'], 'preview_images_method': ['w3m', 'iterm2', 'urxvt', 'urxvt-full'], |