File: color-ls.rc

package info (click to toggle)
vile 9.2y-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,700 kB
  • ctags: 7,341
  • sloc: ansic: 78,427; lex: 4,726; perl: 2,922; cpp: 2,710; sh: 2,612; makefile: 715; awk: 212
file content (44 lines) | stat: -rw-r--r-- 1,339 bytes parent folder | download
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
; $Id: color-ls.rc,v 1.1 2000/04/27 23:46:11 tom Exp $
; Use this macro to render the output of "color ls" into a vile buffer.
store-procedure ShowColorLS "Prompt for, and display a color-ls"
	;~trace on
	~local %filter %options %lsbuffer $error-buffer %report
	set-variable %filter &lookup e+l+p &cat vile-manfilt $exec-suffix
	~if &seq %filter ""
		write-message "[Cannot find manpage-filter]"
		~return
	~endif
	set-variable %options &query "options? "
	~if &or &seq %options "ERROR" &seq %options ""
		~return
	~endif
	set-variable %lsbuffer &cat "<ls " &cat %options ">"
	set terse
	setl autocolor=0
	setv %report=$report
	set report=0
	~hidden ~force select-buffer %lsbuffer
	~if $status
		~local $curline $curcol
		setl noview
		~hidden goto-beginning-of-file
		~hidden delete-til end-of-file
		~hidden read-file &cat "!ls --color=always " &cat %options &cat " | " %filter
	~else
		~hidden edit-file &cat "!ls --color=always " &cat %options &cat " | " %filter
		~force rename-buffer %lsbuffer
	~endif
	~hidden goto-beginning-of-file
	~hidden attribute-cntl_a-sequences-til end-of-file
	unmark-buffer
	setl view
	~hidden goto-beginning-of-file
	~if $status
		~hidden position-window .
	~endif
	~force error-buffer %lsbuffer
	write-message "[Done formatting listing.]"
	set report=%report
	set noterse
~endm
bind-key ShowColorLS ^X-l