Skip to content

Commit b68e420

Browse files
Fritz Mehnervim-scripts
authored andcommitted
Version 3.8
- New comment submenu 'script sections'. - Two new hotkeys \css, \ckc for commenting. - Two new plugin tags: LICENSE,ORGANIZATION - Run menu: new item 'Bash cmd. line arg.' (\rba). - I/O-Redir-menu: additional item'>&2' - System-wide installation: minimal Template file for a user will automatically be added. - Hotkey renamed: \t -> \t1 - A few code snippets for debugging added. - Bugfix: \cl did not work in insert mode. - Other minor bugs fixed.
1 parent bbcf4fe commit b68e420

20 files changed

+579
-262
lines changed

README.bashsupport

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
README for bash-support.vim (Version 3.7) / October 18 2011
1+
README for bash-support.vim (Version 3.8) / November 18 2011
22

33
* INSTALLATION
44
* RELEASE NOTES
@@ -136,15 +136,19 @@ Look at the bashsupport help with
136136
+-----------------------------------------------+
137137

138138
=======================================================================================
139-
RELEASE NOTES FOR VERSION 3.7
139+
RELEASE NOTES FOR VERSION 3.8
140140
=======================================================================================
141-
- The three hotkeys \cl, \cj, \cc allow a range, e.g. '3\cl' (see help text and
142-
bash-hot-key.pdf).
143-
- Plugin loads faster: loading the templates is delayed until the first use.
144-
- Plugin now works with pathogen.vim.
145-
- Menus will always be generated (for the use with :emenu).
146-
- Bugfix: no local templates available with a system-wide installation (thanks to Iain Arnell).
147-
- Several improvements.
141+
- New comment submenu 'script sections'.
142+
- Two new hotkeys \css, \ckc for commenting.
143+
- Two new plugin tags: LICENSE,ORGANIZATION
144+
- Run menu: new item 'Bash cmd. line arg.' (\rba).
145+
- I/O-Redir-menu: additional item'>&2'
146+
- System-wide installation: minimal Template file for a user will automatically
147+
be added.
148+
- Hotkey renamed: \t -> \t1
149+
- A few code snippets for debugging added.
150+
- Bugfix: \cl did not work in insert mode.
151+
- Other minor bugs fixed.
148152

149153
=======================================================================================
150154
OLDER RELEASE NOTES : see file 'ChangeLog'

bash-support/codesnippets/_debug_PS4

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# PS4 : timestamp; 'seconds.nanoseconds' since 1970-01-01 00:00:00 UT
2+
PS4='+ [$(date "+%s.%N")] '
3+
4+
# PS4 : position, line number, function name
5+
PS4='+|${BASH_SOURCE##*/} ${LINENO}${FUNCNAME[0]:+ ${FUNCNAME[0]}}| '
6+
7+
# PS4 : position, line number, function name, subshell information
8+
PS4='+(${BASH_SOURCE##*/}: ${LINENO}) : ${FUNCNAME[0]} - [level ${SHLVL}, subshell ${BASH_SUBSHELL}, return code $?]
9+
'
10+
11+
# PS4 : default prompt
12+
PS4='+'
13+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#=== FUNCTION ================================================================
2+
# NAME: _assert
3+
# DESCRIPTION: Abort the script if assertion is false.
4+
# PARAMETERS: 1) expression used as test inside brackets
5+
# 2) optional information, e.g. $LINENO
6+
# RETURNS: 0 / 99 assertion is true / false
7+
#===============================================================================
8+
function _assert ()
9+
{
10+
if [ ! $1 ]; then
11+
echo "${0##*/}${2:+:$2}: assertion '$1' failed."
12+
exit 99
13+
fi
14+
return 0
15+
}
16+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
DEBUG=1 # debugging on (0) / off (1)
3+
4+
#=== FUNCTION ================================================================
5+
# NAME: _debug
6+
# DESCRIPTION: echo debug output controlled by a global variable
7+
# PARAMETERS: list, e.g.; "$LINENO: x=$x"
8+
# RETURNS: always 0
9+
#===============================================================================
10+
_debug ()
11+
{
12+
[ ${DEBUG} -ne 0 ] && echo -e "${@}"
13+
return 0
14+
} # ---------- end of function _debug ----------
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# print argument list for testing
1+
# print the positional parameters
22
printf '"%b"\n' "$0" "$@" | nl -v0 -s": "
3+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
DEBUG=1 # debugging on (0) / off (1)
3+
4+
#=== FUNCTION ================================================================
5+
# NAME: _debug_timestamp
6+
# DESCRIPTION: timestamp + optional information
7+
# timestamp: {seconds since 1970-01-01 00:00:00}.{nanoseconds}
8+
# PARAMETERS: identification, e.g. $LINENO (optional)
9+
# RETURNS: always 0
10+
#===============================================================================
11+
_debug_timestamp ()
12+
{
13+
[ ${DEBUG} -ne 0 ] && echo -e "[ $(date "+%s.%N") ]${@:+ -- ${@}}"
14+
return 0
15+
} # ---------- end of function _debug_timestamp ----------

bash-support/codesnippets/_trap_DEBUG

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#=== FUNCTION ================================================================
2+
# NAME: _trap_DEBUG
3+
# DESCRIPTION: Trap code for the pseudo-signal DEBUG. Generate a message.
4+
# The DEBUG trap is not inherited by functions.
5+
# Use 'set -o functrace'
6+
# PARAMETERS: 1) identification (e.g. line number $LINENO)
7+
# 2) variable name(s) to be tracked
8+
#===============================================================================
9+
function _trap_DEBUG ()
10+
{
11+
declare identification=$1;
12+
while [ ${#} -gt 1 ]; do
13+
shift
14+
echo -e "DEBUG [$identification] ${1} = '${!1}'"
15+
done
16+
} # ---------- end of function _trap_DEBUG ----------
17+
18+
trap '_trap_DEBUG $LINENO <-variable names->' DEBUG # trap DEBUG
19+
20+
#trap - DEBUG # reset the DEBUG trap
21+

bash-support/codesnippets/_trap_ERR

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#=== FUNCTION ================================================================
2+
# NAME: _trap_ERROR
3+
# DESCRIPTION: Trap code for the pseudo-signal ERR (A command returning a
4+
# non-zero exit status). Generates an error message.
5+
# PARAMETERS: The current line number given by $LINENO .
6+
#===============================================================================
7+
function _trap_ERROR ()
8+
{
9+
echo -e "\nERROR line ${1}: Command exited with status ${?}"
10+
} # ---------- end of function _trap_ERROR ----------
11+
12+
trap '_trap_ERROR $LINENO' ERR # trap ERR
13+
14+
#trap - ERR # reset the ERR trap
15+

bash-support/codesnippets/_trap_EXIT

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#=== FUNCTION ================================================================
2+
# NAME: _trap_EXIT
3+
# DESCRIPTION: Trap code for the pseudo-signal EXIT. Generates an message.
4+
# PARAMETERS: The current line number given by $LINENO .
5+
#===============================================================================
6+
function _trap_EXIT ()
7+
{
8+
echo -e "\nEXIT line ${1}: Script exited with status ${?}"
9+
} # ---------- end of function ----------
10+
11+
trap '_trap_EXIT $LINENO' EXIT # trap EXIT
12+
13+
#trap - EXIT # reset the EXIT trap
14+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#=== FUNCTION ================================================================
2+
# NAME: _trap_RETURN
3+
# DESCRIPTION: Trap code for the pseudo-signal RETURN. Generates a message.
4+
# The RETURN trap is not inherited by functions.
5+
# Use 'set -o functrace'
6+
# PARAMETERS: The current line number given by $LINENO .
7+
# variable(s) to be tracked
8+
#===============================================================================
9+
function _trap_RETURN ()
10+
{
11+
echo -e "\nRETURN line ${1}: "
12+
} # ---------- end of functionn _trap_RETURN ----------
13+
14+
trap '_trap_RETURN $LINENO' RETURN # trap RETURN
15+
16+
#trap - RETURN # reset the RETURN trap
17+

0 commit comments

Comments
 (0)