aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_completion.d/_completion_ignore_case.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-02 17:59:29 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-02 17:59:29 +1300
commit7d6fe8b1886f902f8ffbec2a9985fae9f91121cb (patch)
tree282fac0bb1809e726a373916c90260832ab23ced /bash/bash_completion.d/_completion_ignore_case.bash
parentReduce ud() completion to just dirnames (diff)
downloaddotfiles-7d6fe8b1886f902f8ffbec2a9985fae9f91121cb.tar.gz
dotfiles-7d6fe8b1886f902f8ffbec2a9985fae9f91121cb.zip
Overhaul Bash completion scripts
Some general changes: * Apply case sensitivity switching in more contexts, using a dynamically loaded helper function * Use array counters for appending to COMPREPLY where possible * Lots more short-circuiting to limit structural depth These changes are expansive and there will definitely be bugs.
Diffstat (limited to 'bash/bash_completion.d/_completion_ignore_case.bash')
-rw-r--r--bash/bash_completion.d/_completion_ignore_case.bash12
1 files changed, 12 insertions, 0 deletions
diff --git a/bash/bash_completion.d/_completion_ignore_case.bash b/bash/bash_completion.d/_completion_ignore_case.bash
new file mode 100644
index 00000000..fe8208fc
--- /dev/null
+++ b/bash/bash_completion.d/_completion_ignore_case.bash
@@ -0,0 +1,12 @@
+# Return whether to ignore case for filename completion
+_completion_ignore_case() {
+
+ # Check Readline settings for case-insensitive matching
+ while read -r _ set ; do
+ [[ $set == 'completion-ignore-case on' ]] || continue
+ return 0
+ done < <(bind -v)
+
+ # Didn't find it, stay case-sensitive
+ return 1
+}