Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!akgua!mcnc!decvax!harpo!seismo!rlgvax!cvl!umcp-cs!chris From: chris@umcp-cs.UUCP Newsgroups: net.unix-wizards Subject: Re: vi and "set prompt" question Message-ID: <6707@umcp-cs.UUCP> Date: Sun, 22-Apr-84 19:31:03 EST Article-I.D.: umcp-cs.6707 Posted: Sun Apr 22 19:31:03 1984 Date-Received: Mon, 23-Apr-84 07:21:52 EST References: <12443@sri-arpa.UUCP> Organization: Univ. of Maryland, Computer Science Dept. Lines: 26 If you "set prompt" in your .cshrc without carefully first checking whether "prompt" was already set, then the C shell will cheerfully print prompts into the pipe vi uses to expand glob characters. If you say ":e abc*", vi opens a pipe to the C-shell and writes the command "echo abc*" down the pipe, then reads the response. If the response contains spaces or newlines, vi gets confused. If you set your prompt in your .cshrc, vi tends to get "(1) abc.file (2)" back from the C-shell, instead of just "abc.file". The solution is to kludge your .cshrc like this: if ($?prompt) then # things to do for an interactive shell, like: set prompt='(\!) ' endif This works because a non-interactive shell doesn't have a prompt set, while an interactive shell has it set to "% ". If you have a large .cshrc, this can speed things up quite a bit when programs run other programs with "csh -c 'command'", if you put all of it inside that test. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci (301) 454-7690 UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland