diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-10-20 14:42:45 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-10-20 14:42:45 +1300 |
commit | f4d28a49dea60bf473b92cb6290cebdfbe4673cb (patch) | |
tree | 0217e239a0a66f633a4dfba8f369c92cb28090d1 /bash | |
parent | Fix consistent spacing in muttrc (diff) | |
download | dotfiles-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')
-rw-r--r-- | bash/bashrc.d/bd.bash | 2 | ||||
-rw-r--r-- | bash/bashrc.d/path.bash | 2 | ||||
-rw-r--r-- | bash/bashrc.d/sd.bash | 2 | ||||
-rw-r--r-- | bash/bashrc.d/ud.bash | 2 |
4 files changed, 8 insertions, 0 deletions
diff --git a/bash/bashrc.d/bd.bash b/bash/bashrc.d/bd.bash index 5d26e2b9..110fca06 100644 --- a/bash/bashrc.d/bd.bash +++ b/bash/bashrc.d/bd.bash @@ -91,6 +91,8 @@ _bd() { done < <(printf %s "$PWD") # Complete with matching dirs + compopt -o filenames + local IFS=$'\n' COMPREPLY=( $(compgen -W "${dirs[*]}" -- "$word") ) } complete -F _bd bd diff --git a/bash/bashrc.d/path.bash b/bash/bashrc.d/path.bash index 29c356ff..e73e6b2f 100644 --- a/bash/bashrc.d/path.bash +++ b/bash/bashrc.d/path.bash @@ -194,6 +194,7 @@ _path() { insert|i|append|add|a|check|c) if ((COMP_CWORD == 2)) ; then compopt -o filenames + local IFS=$'\n' COMPREPLY=( $(compgen -A directory -- "$word") ) fi ;; @@ -201,6 +202,7 @@ _path() { # Complete with any number of directories set|s) compopt -o filenames + local IFS=$'\n' COMPREPLY=( $(compgen -A directory -- "$word") ) ;; 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 diff --git a/bash/bashrc.d/ud.bash b/bash/bashrc.d/ud.bash index 5bcfc2ed..b5279004 100644 --- a/bash/bashrc.d/ud.bash +++ b/bash/bashrc.d/ud.bash @@ -54,6 +54,8 @@ _ud() { if ((COMP_CWORD == 2)) ; then local word word=${COMP_WORDS[COMP_CWORD]} + compopt -o filenames + local IFS=$'\n' COMPREPLY=( $(compgen -A directory -- "$word" ) ) else return 1 |