Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using tcsh in a SUSE 11 box and I realized that when typing

makeTab

it allows me to auto-complete the rules available within the Makefile, not the files that are inside the current directory.

I've tested this with RedHat and Ubuntu at work and Debian at home (all with tcsh), and none of them supports this (IMO) nice behavior.

How can this be achieved with the other distributions as well?
This is something I've wanted to have since many years ago.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You need to add calls to complete to your shell startup file (~/.tcshrc). Apparently your SuSE box has predefined rules for make; look for them in /etc/csh.cshrc or some other file provided alongside tcsh (rpm -ql tcsh).

The tcsh distribution comes with some example completions (Debian puts them in /usr/share/doc/tcsh/examples/complete.tcsh.gz); here's the one for make:

complete make \
    'n/-f/f/' \
    'c/*=/f/' \
    'n@*@`cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^     #].*:/s/:.*//p"`@'
share|improve this answer
    
Thanks again @Gilles, "sourcing" that file in Debian gives me immediately auto-completion for make –  nozimica Feb 21 '12 at 22:54
    
I tried this under Mac OS but get the following result: make `cat -s GNUmakefile Makefile makefile |& sed -n -e "/No such file/d" -e "/^[^ #].*:/s/:.*//p"`: No match. –  Stefan Müller Oct 7 '12 at 10:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.