Bash completion: filter out backup (~) files

خرید بک لینک

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, running 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.

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 177 تاريخ: جمعه 7 خرداد 1395 ساعت: 3:16

صفحه بندی