aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/sd.bash
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-10-20 14:42:45 +1300
committerTom Ryder <tom@sanctum.geek.nz>2015-10-20 14:42:45 +1300
commitf4d28a49dea60bf473b92cb6290cebdfbe4673cb (patch)
tree0217e239a0a66f633a4dfba8f369c92cb28090d1 /bash/bashrc.d/sd.bash
parentFix consistent spacing in muttrc (diff)
downloaddotfiles-f4d28a49dea60bf473b92cb6290cebdfbe4673cb.tar.gz
dotfiles-f4d28a49dea60bf473b92cb6290cebdfbe4673cb.zip
Handle spaces correctly in completions
This is technically still wrong; COMPREPLY needs to be specified with null-delimited IFS, as done in the pass() function. This will do for now.
Diffstat (limited to 'bash/bashrc.d/sd.bash')
-rw-r--r--bash/bashrc.d/sd.bash2
1 files changed, 2 insertions, 0 deletions
diff --git a/bash/bashrc.d/sd.bash b/bash/bashrc.d/sd.bash
index 77a48443..d4ba49b3 100644
--- a/bash/bashrc.d/sd.bash
+++ b/bash/bashrc.d/sd.bash
@@ -113,6 +113,8 @@ _sd() {
local word curdir
word=${COMP_WORDS[COMP_CWORD]}
curdir=${PWD##*/}
+ compopt -o filenames
+ local IFS=$'\n'
COMPREPLY=( $(cd .. && compgen -d -X "$curdir" -- "$word") )
}
complete -F _sd sd