File: ex

package info (click to toggle)
yash 2.43-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,184 kB
  • ctags: 3,159
  • sloc: ansic: 31,766; makefile: 812; sh: 407; sed: 16
file content (101 lines) | stat: -rw-r--r-- 2,164 bytes parent folder | download | duplicates (5)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# (C) 2010 magicant

# Completion script for the "ex" command.
# Supports POSIX 2008, FreeBSD 8.1, OpenBSD 4.8, NetBSD 5.0, SunOS 5.10,
# HP-UX 11i v3.

function completion/ex {

	case $("${WORDS[1]}" --version 2>/dev/null) in (VIM*)
		command -f completion//reexecute vim
		return
	esac
	typeset type="$(uname 2>/dev/null)"

	typeset OPTIONS POSIXOPTIONS ADDOPTIONS ARGOPT PREFIX
	POSIXOPTIONS=( #>#
	"c:; specify a command to be executed after starting up"
	"R; read-only mode"
	"r; recover unsaved files"
	"t:; specify an identifier to jump"
	"w:; specify the value of the window option"
	) #<#
	case ${WORDS[1]##*/} in (e*)
		POSIXOPTIONS=("$POSIXOPTIONS" #>#
		"s; non-interactive batch processing mode"
		"v; operate as the vi editor"
		) #<#
	esac

	ADDOPTIONS=()
	case $type in (*BSD)
		ADDOPTIONS=("$ADDOPTIONS" #>#
		"F; don't copy the entire file when opening it"
		"S; enable the secure option"
		) #<#
		case ${WORDS[1]##*/} in (v*)
			ADDOPTIONS=("$ADDOPTIONS" #>#
			"e; operate as the ex editor"
			) #<#
		esac
		case $type in (FreeBSD|NetBSD)
			ADDOPTIONS=("$ADDOPTIONS" #>#
			"G; enable the gtagsmode option"
			) #<#
		esac
	esac
	case $type in (SunOS|HP-UX)
		ADDOPTIONS=("$ADDOPTIONS" #>#
		"C; enable encryption and assume all text has been encrypted"
		"l; enable the lisp option"
		"x; enable encryption"
		) #<#
	esac
	case $type in
	(SunOS)
		ADDOPTIONS=("$ADDOPTIONS" #>#
		"L; print list of recoverable files"
		"V; echo input commands to the standard error"
		) #<#
		case ${WORDS[1]##*/} in (v*)
			ADDOPTIONS=("$ADDOPTIONS" #>#
			"S; don't assume the tags file is sorted"
			) #<#
		esac
		;;
	(HP-UX)
		case ${WORDS[1]##*/} in (v*)
			ADDOPTIONS=("$ADDOPTIONS" #>#
			"V; echo input commands when sourcing a file"
			) #<#
		esac
		;;
	esac

	OPTIONS=("$POSIXOPTIONS" "$ADDOPTIONS")
	unset POSIXOPTIONS ADDOPTIONS

	command -f completion//parseoptions
	case $ARGOPT in
	(-)
		command -f completion//completeoptions
		;;
	(c)
		;;
	(t)
		if [ -r tags ]; then
			complete -P "$PREFIX" -R "!_TAG_*" -- \
				$(cut -f 1 tags 2>/dev/null)
		fi
		;;
	(w)
		;;
	(*)
		complete -f
		;;
	esac

}


# vim: set ft=sh ts=8 sts=8 sw=8 noet: