diff --git a/share/completions/make.fish b/share/completions/make.fish index 53dd7eb77..832524cf7 100644 --- a/share/completions/make.fish +++ b/share/completions/make.fish @@ -1,10 +1,19 @@ -#Completions for make +# Completions for make function __fish_print_make_targets set files Makefile makefile GNUmakefile grep -h -E '^[^#%=$[:space:]][^#%=$]*:([^=]|$)' $files | cut -d ":" -f 1 | sed -e 's/^ *//;s/ *$//;s/ */\n/g' ^/dev/null end +# This completion is a bit ugly. It reenables file completion on +# assignments, so e.g. 'make foo FILES=' will recive standard +# filename completion. Unfortunatly, this turns out to be a bit +# complicated to do. + +set -l is_assignment "commandline -ct|grep '..*='" +set -l complete_file_assignment '(commandline -ct)(complete --do-complete=this_command_does_not_exist\ (commandline -ct|sed -e \'s/.*=//\'))' +complete -c make --condition $is_assignment -a $complete_file_assignment + complete -x -c make -a "(__fish_print_make_targets)" -d (N_ "Target") complete -r -c make -s f -d (N_ "Use file as makefile") -r complete -x -c make -s C -x -a "(__fish_complete_directory (commandline -ct))" -d (N_ "Change directory")