zsh-users
 help / color / mirror / code / Atom feed
* Source-File Favoring Completion Revised
@ 2006-06-23 14:16 Chris Johnson
  0 siblings, 0 replies; only message in thread
From: Chris Johnson @ 2006-06-23 14:16 UTC (permalink / raw)
  To: zsh-users

I think I've finally got the completion I'm looking for to complete
source code files before executable or binary files for text editors.
Here's what I have:

   # I don't typically open these files with my text editor.
   zstyle ':completion:*:src-files' ignored-patterns \
          '*?.o' '*?.pdf' '*?.aux' '*?.log'

   # This function filters out executable files who have a source code
   # namesake.  File test will not be returned if test.c exists.
   src_files() {
      if [[ -e $REPLY.c ]]; then
         reply=""
      else
         reply=$REPLY
      fi
   }

   # Complete src_files before others.
   zstyle ':completion:*:*:(emacs|vi|vim):*' file-patterns \
          '%p(e,src_files,):src-files' '*:all-files'

This appears to work well for opening *.c and *.tex instead of the
unreadable binary files that are generated from the source.  Any input
is appreciated!

-- 
Chris Johnson
cjohnson@cs.utk.edu
http://www.cs.utk.edu/~cjohnson


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-06-23 14:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-23 14:16 Source-File Favoring Completion Revised Chris Johnson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).