-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathvim.cygclass
116 lines (102 loc) · 3.17 KB
/
vim.cygclass
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
################################################################################
#
# vim.cygclass - functions for installing Vim files
#
# Part of cygport - Cygwin packaging application
# Copyright (C) 2006-2020 Cygport authors
# Provided by the Cygwin project <https://cygwin.com/>
#
# cygport is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cygport is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cygport. If not, see <https://www.gnu.org/licenses/>.
#
################################################################################
#****h* Cygclasses/vim.cygclass
# DESCRIPTION
# Vim is a text editor which is extensible through scripts written in its
# own Vimscript language.
#
# This cygclass includes functions for installing Vim scripts.
#****
#****d* vim.cygclass/VIM
# DESCRIPTION
# Root data directory for the Vim editor.
# NOTE
# This is NOT the path to the Vim editor.
#****
VIM="/usr/share/vim"
#****d* vim.cygclass/VIMFILES
# DESCRIPTION
# Installation path for third-party Vim scripts.
#****
VIMFILES="${VIM}/vimfiles"
#****I* vim.cygclass/viminto
# SYNOPSIS
# viminto SUBDIRECTORY
# DESCRIPTION
# Subdirectory into which dovim and newvim should install. Subdirectories
# supported by Vim are:
# * autoload: automatically loaded functions
# * colors: color scheme scripts
# * compiler: compiler scripts
# * doc: documentation
# * ftplugin: filetype plugins
# * indent: indentation scripts
# * keymap: key mapping scripts
# * lang: translations
# * plugin: automatically loaded plugins
# * print: print encodings
# * spell: spell checking dictionaries
# * syntax: syntax highlighting scripts
# A subdirectory may also be prefixed by "after/" if the scripts to be
# installed are meant to override those included in Vim.
#****
viminto() {
if (( $# != 1 ))
then
error "viminto accepts exactly one argument";
fi
case ${1} in
/*) error "viminto argument should be only a subdirectory" ;;
esac
_viminto_dir=${1};
}
#****I* vim.cygclass/dovim
# SYNOPSIS
# viminto SUBDIRECTORY
# dovim SCRIPT [SCRIPT2] ...
# DESCRIPTION
# Installs the given Vim script(s) into the subdirectory of VIMFILES declared
# by the preceding call to viminto.
#****
dovim() {
local _insinto_tmp=${_insinto_dir}
insinto ${VIMFILES}/${_viminto_dir}
doins ${@}
_insinto_dir=${_insinto_tmp}
}
#****I* vim.cygclass/newvim
# SYNOPSIS
# viminto SUBDIRECTORY
# newvim SCRIPT_FILE NEW_SCRIPT_NAME
# DESCRIPTION
# Installs the given Vim script into the subdirectory of VIMFILES declared
# by the preceding call to viminto, renaming it as indicated by the second
# argument.
#****
newvim() {
local _insinto_tmp=${_insinto_dir}
insinto ${VIMFILES}/${_viminto_dir}
newins ${1} ${2}
_insinto_dir=${_insinto_tmp}
}
readonly -f viminto dovim newvim