disable sabbrev completions? #288
-
Making abbreviations, makes them show in the menu completion as arguments for commands. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
ble.sh doesn't provide the configuration interface for this. If you would like to turn it off, you can rewrite the shell function
You can just replace the function with an empty command. # blerc
function mozirilla213/suppress-sabbrev-completion.hook {
function ble/complete/source:sabbrev { return 0; }
}
blehook/eval-after-load complete mozirilla213/suppress-sabbrev-completion.hook
This would be a bit tricky. One needs to rely on the ble.sh's internal functions. For example, to suppress the sabbrev completions for # blerc
function mozirilla213/filter-sabbrev-completion.hook {
ble/function#advice around ble/complete/source:sabbrev '
local comp_words comp_line comp_point comp_cword
ble/syntax:bash/extract-command "$_ble_edit_ind" || return 1
if [[ ${comp_words[0]} != echo ]]; then
ble/function#advice/do
fi
'
}
blehook/eval-after-load complete mozirilla213/filter-sabbrev-completion.hook Edit (2023-03-09): An example implemention was added at ble-import config/github288-filter-sabbrev-completion
# Example: Always ignore sabbrev completions for command arguments
bleopt complete_source_sabbrev_command_ignore='*'
# Example: Ignore sabbrev completions for `echo` command and `ble/*` commands.
bleopt complete_source_sabbrev_command_ignore='echo:ble/*' |
Beta Was this translation helpful? Give feedback.
-
I'm currently thinking about changing the ordering of the completions in the menu. Currently, the sabbrev words are shown first in the list, but I think that is the reason for the impression that these would feel annoying. I think the sabbrev words can be put at the end of the list. |
Beta Was this translation helpful? Give feedback.
I also added options
bleopt complete_source_sabbrev_opts=no-empty-completion
andbleopt complete_source_sabbrev_ignore=<pattern1>:<pattern2>:...
to adjust the detailed behavior of the sabbrev completion generation. The former makes the sabbrev completion generation inactive when the word to complete is an empty string. The latter specifies the exclude patterns for the sabbrev completions. I haven't yet added the description of these options in the wiki, but I'll later do that.