I would like bash to filter out backup files, with a name ending in ~ (tilde), when auto-completing filenames.
I have written a script to set this when using vim (I have very little experience with shell scripting):
#!/bin/bash
no_backups_complete()
{
local cur=$2
COMPREPLY=( $( compgen -o plusdirs -f -X '*~' -- "$cur" ) )
retu 0
}
complete -o filenames -F no_backups_complete vim
However, ruing the script has no apparent effect, vim[Tab] still shows every file.
I have tried escaping / not escaping the ~, and putting $2 and $cur in / not in quotes, with no difference.
برچسب:
نویسنده: استخدام کار