File: search.rc

package info (click to toggle)
vile 9.6m-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 8,196 kB
  • ctags: 8,459
  • sloc: ansic: 90,876; lex: 9,514; sh: 3,223; cpp: 3,137; perl: 2,928; makefile: 785; awk: 276
file content (48 lines) | stat: -rw-r--r-- 1,057 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
; $Header: /usr/build/vile/vile/macros/RCS/search.rc,v 1.3 2001/08/26 19:20:15 tom Exp $
store-procedure SearchForFile
	~local %path %word %test %find %n
	setv %find &trim $pathname
	~if &equal 0 &length %find
		write-message "No filename at the current position"
		~return
	~endif
	~if &seq $majormode ''
		setv %path '.'
	~elseif &seq $majormode 'make'
		setv %path '.:/usr/share/mk'
	~elseif &seq $majormode 'c'
		setv %path '.:/usr/local/include:/usr/include'
	~else
		setv %path &env 'VILE_SEARCH_PATH'
		~if &seq %path ''
			setv %path &env 'CDPATH'
			~if &seq %path ''
				setv %path '.'
			~endif
		~endif
	~endif
	setv %n 0
	~while &not 0
		setv %test ''
		setv %word &token %n $pathlist-separator %path
		~if &seq %word ''
			~break
		~endif
		setv %test &cat %word &cat '/' %find
		~if &rd %test
			~break
		~endif
		setv %n &add %n 1
	~endwhile
	~if &seq %test ''
		setv %test=%find
	~else
		edit-file %test
	~endif
	~if &rd %test
		edit-file %test
	~else
		write-message &cat 'File not found: ' %test
	~endif
~endm
bind-key SearchForFile ^X-e