summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorDmitry Kryukov <remasik@gmail.com>2017-03-12 21:40:43 -0400
committernfnty <git@nfnty.se>2017-03-19 19:28:34 +0100
commited76df7a4991da0aa19423f855bf9874542d2179 (patch)
tree1e4836e199fba8c1058337baa6a0843375d1cc28 /ranger
parentb327b7352e10909d4713d3c802c4c34945523e2b (diff)
downloadranger-ed76df7a4991da0aa19423f855bf9874542d2179.tar.gz
commands: Add setting for cd tab completion case sensitivity
Diffstat (limited to 'ranger')
-rwxr-xr-xranger/config/commands.py9
-rw-r--r--ranger/config/rc.conf3
-rw-r--r--ranger/container/settings.py2
3 files changed, 12 insertions, 2 deletions
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'],