Added bash-support

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
2020-11-16 12:54:24 +01:00
parent 5b8989ac04
commit fc7dc3f34a
56 changed files with 12377 additions and 1 deletions

View File

@ -0,0 +1,193 @@
README for bash-support.vim (Version 4.2.1) / March 25 2014
* INSTALLATION
* RELEASE NOTES
* FILES
* ADDITIONAL TIPS
Bash Support implements a bash-IDE for Vim/gVim. It is written to considerably
speed up writing code in a consistent style. This is done by inserting
complete statements, comments, idioms, and code snippets. Syntax checking,
running a script, starting a debugger can be done with a keystroke. There are
many additional hints and options which can improve speed and comfort when
writing shell scripts.
================================================================================
INSTALLATION
================================================================================
(1) LINUX
----------
The subdirectories in the zip archive bash-support.zip mirror the directory
structure which is needed below the local installation directory $HOME/.vim/
(find the value of $HOME with ":echo $HOME" from inside Vim).
(1.0) Save the template files in '$HOME/.vim/bash-support/templates/Templates' if
you have changed any of them.
(1.1) Copy the zip archive bash-support.zip to $HOME/.vim and run
unzip bash-support.zip
(1.2) Loading of plugin files must be enabled. If not use
:filetype plugin on
This is the minimal content of the file '$HOME/.vimrc'. Create one if there
is none or use the files in $HOME/.vim/bash-support/rc as a starting point.
(1.3) Set at least some personal details in the file
'$HOME/.vim/bash-support/templates/Templates'
Here is the minimal personalization (my settings as an example):
SetMacro( 'AUTHOR', 'Dr. Fritz Mehner' )
SetMacro( 'AUTHORREF', 'fgm' )
SetMacro( 'EMAIL', 'mehner.fritz@fh-swf.de' )
SetMacro( 'ORGANIZATION','FH S<>dwestfalen, Iserlohn' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )
(Read more about the template system in the plugin documentation)
(1.4) Make the plugin help accessable by typing the following command on the
Vim command line:
:helptags $HOME/.vim/doc/
(1.5) Consider additional settings in the file '$HOME/.vimrc'. The files
customization.vimrc and customization.gvimrc are replacements or extensions
for your .vimrc and .gvimrc. You may want to use parts of them. The files
are documented.
(2) WINDOWS
------------
The subdirectories in the zip archive bash-support.zip mirror the directory
structure which is needed below the local installation directory
$HOME/vimfiles/ (find the value of $HOME with ":echo $HOME" from inside Vim).
(2.0) Save the template files in '$HOME/vimfiles/bash-support/templates/Templates'
if you have changed any of them.
(2.1) Copy the zip archive bash-support.zip to $HOME/vimfiles and run
unzip bash-support.zip
(2.2) Loading of plugin files must be enabled. If not use
:filetype plugin on
This is the minimal content of the file '$HOME/_vimrc'. Create one if there
is none or use the files in $HOME/vimfiles/bash-support/rc as a starting point.
(2.3) Set at least some personal details in the file
'$HOME/vimfiles/bash-support/templates/Templates'
Here is the minimal personalization (my settings as an example):
SetMacro( 'AUTHOR', 'Dr. Fritz Mehner' )
SetMacro( 'AUTHORREF', 'fgm' )
SetMacro( 'EMAIL', 'mehner.fritz@fh-swf.de' )
SetMacro( 'ORGANIZATION','FH S<>dwestfalen, Iserlohn' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )
(Read more about the template system in the plugin documentation)
(2.4) Make the plugin help accessable by typing the following command on the
Vim command line:
:helptags $HOME\vimfiles\doc\
(2.5) Consider additional settings in the file '$HOME/_vimrc'. The files
customization.vimrc and customization.gvimrc are replacements or extensions
for your _vimrc and _gvimrc. You may want to use parts of them. The files
are documented.
There are a lot of features and options which can be used and influenced:
* use of template files and tags
* using and managing personal code snippets
* bash dictionary for keyword completion
* removing the root menu
* using additional plugins
Look at the bashsupport help with
:help bashsupport
+-----------------------------------------------+
| +-------------------------------------------+ |
| | ** Please read the documentation ** | |
| | Actions differ for different modes! | |
| +-------------------------------------------+ |
+-----------------------------------------------+
=======================================================================================
RELEASE NOTES FOR VERSION 4.2.1
=======================================================================================
- Bugfix: Setup of local templates in case of global installation.
- Help: Bash and utility manuals wrapped on window width.
- Bugfix: \hm and \hh work wrong in insert mode.
- Bugfix: Better compatibility with custom mappings
(use "normal!" and "noremap" consistently).
- Added 'Bash_SetMapLeader' and 'Bash_ResetMapLeader'.
- Minor corrections and improvements.
OLDER RELEASE NOTES : see file 'ChangeLog'
=======================================================================================
=======================================================================================
FILES
=======================================================================================
README.bashsupport This file.
ftplugin/sh.vim The bash filetype plugin.
plugin/bash-support.vim The bash plugin for Vim/gVim.
bash-support/scripts/wrapper.sh A wrapper script for the use of an xterm.
doc/bashsupport.txt The help file for the local online help.
bash-support/codesnippets/* Some code snippets as a starting point.
bash-support/templates/* bash template files (see bashsupport.txt).
bash-support/wordlists/* Additional word lists (dictionaries).
----------------------- -------------------------------------------------------------
----------------------- The following files and extensions are for convenience only.
bash-support.vim will work without them.
-------------------------------------------------------------
bash-support/rc/customization.bashrc Additional settings I use in .bashrc:
set the prompt P2, P3, P4 (for debugging).
bash-support/rc/customization.vimrc Additional settings I use in .vimrc: incremental
search, tabstop, hot keys, font, use of dictionaries,
... The file is commented. Append it to your .vimrc
if you like.
bash-support/rc/customization.gvimrc Additional settings I use in .gvimrc: hot keys,
mouse settings, ... The file is commented.
Append it to your .gvimrc if you like.
bash-support/doc/* Hotkey reference card (PDF), changelog.
=======================================================================================
ADDITIONAL TIPS
=======================================================================================
(1) gvim. Toggle 'insert mode' <--> 'normal mode' with the right mouse button
(see mapping in file customization.gvimrc).
(2) gvim. Use tear off menus and
(3) try 'Focus under mouse' as window behavior (No mouse click when the mouse
pointer is back from the menu entry).
(4) Use Emulate3Buttons "on" (X11) even for a 3-button mouse. Pressing left and
right button simultaneously without moving your fingers is faster then
moving a finger to the middle button (often a wheel).
=======================================================================================

View File

@ -0,0 +1,21 @@
#=== FUNCTION ================================================================
# NAME: _trap_DEBUG
# DESCRIPTION: Trap code for the pseudo-signal DEBUG. Generate a message.
# The DEBUG trap is not inherited by functions.
# Use 'set -o functrace'
# PARAMETERS: 1) identification (e.g. line number $LINENO)
# 2) variable name(s) to be tracked
#===============================================================================
function _trap_DEBUG ()
{
declare identification=$1;
while [ ${#} -gt 1 ]; do
shift
echo -e "DEBUG [$identification] ${1} = '${!1}'"
done
} # ---------- end of function _trap_DEBUG ----------
trap '_trap_DEBUG $LINENO <-variable names->' DEBUG # trap DEBUG
#trap - DEBUG # reset the DEBUG trap

View File

@ -0,0 +1,15 @@
#=== FUNCTION ================================================================
# NAME: _trap_ERROR
# DESCRIPTION: Trap code for the pseudo-signal ERR (A command returning a
# non-zero exit status). Generates an error message.
# PARAMETERS: The current line number given by $LINENO .
#===============================================================================
function _trap_ERROR ()
{
echo -e "\nERROR line ${1}: Command exited with status ${?}"
} # ---------- end of function _trap_ERROR ----------
trap '_trap_ERROR $LINENO' ERR # trap ERR
#trap - ERR # reset the ERR trap

View File

@ -0,0 +1,14 @@
#=== FUNCTION ================================================================
# NAME: _trap_EXIT
# DESCRIPTION: Trap code for the pseudo-signal EXIT. Generates an message.
# PARAMETERS: The current line number given by $LINENO .
#===============================================================================
function _trap_EXIT ()
{
echo -e "\nEXIT line ${1}: Script exited with status ${?}"
} # ---------- end of function ----------
trap '_trap_EXIT $LINENO' EXIT # trap EXIT
#trap - EXIT # reset the EXIT trap

View File

@ -0,0 +1,17 @@
#=== FUNCTION ================================================================
# NAME: _trap_RETURN
# DESCRIPTION: Trap code for the pseudo-signal RETURN. Generates a message.
# The RETURN trap is not inherited by functions.
# Use 'set -o functrace'
# PARAMETERS: The current line number given by $LINENO .
# variable(s) to be tracked
#===============================================================================
function _trap_RETURN ()
{
echo -e "\nRETURN line ${1}: "
} # ---------- end of functionn _trap_RETURN ----------
trap '_trap_RETURN $LINENO' RETURN # trap RETURN
#trap - RETURN # reset the RETURN trap

View File

@ -0,0 +1,5 @@
basename=${pathname##*/}
dirname=${pathname%/*}
filename=${basename%%.*}
lastextension=${basename##*.}
allextensions=${basename#*.}

View File

@ -0,0 +1,3 @@
if [[ $number =~ ^[+-]?[0-9]+$ ]] ; then
echo -e "match found : (signed) integer\n"
fi

View File

@ -0,0 +1,3 @@
if [[ $number =~ ^[0-9]+$ ]] ; then
echo -e "match found : integer\n"
fi

View File

@ -0,0 +1,5 @@
#-----------------------------------------------------------------------
# Check number of command line arguments
#-----------------------------------------------------------------------
[ $# -lt 1 ] && { echo -e "\n\tUsage: ${0##/*/} File\n"; exit 1; }

View File

@ -0,0 +1,3 @@
TMPFILE=$( mktemp /tmp/example.XXXXXXXXXX ) || exit 1
rm --force $TMPFILE

View File

@ -0,0 +1,17 @@
TMPDIR=${TMPDIR:-/tmp} # defaults to /tmp if unset
#-------------------------------------------------------------------------------
# Creates a particular temporary directory inside $TMPDIR.
#-------------------------------------------------------------------------------
TEMPORARY_DIR=$(mktemp -d "$TMPDIR/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") || \
{ echo "ERROR creating a temporary file"; exit 1; }
#-------------------------------------------------------------------------------
# When the program exits, it tries to remove the temporary folder.
# This code is executed even if the process receives a signal 1,2,3 or 15.
#-------------------------------------------------------------------------------
trap '[ "$TEMPORARY_DIR" ] && rm --recursive --force "$TEMPORARY_DIR"' 0
touch $TEMPORARY_DIR/tempfile # new tempfile inside folder

View File

@ -0,0 +1,19 @@
#-----------------------------------------------------------------------
# cleanup temporary file in case of a keyboard interrupt (SIGINT)
# or a termination signal (SIGTERM)
#-----------------------------------------------------------------------
function cleanup_temp
{
[ -e $tmpfile ] && rm --force $tmpfile
exit 0
}
trap cleanup_temp SIGHUP SIGINT SIGPIPE SIGTERM
tmpfile=$(mktemp) || { echo "$0: creation of temporary file failed!"; exit 1; }
# use tmpfile ...
rm --force $tmpfile

View File

@ -0,0 +1,22 @@
# PS4 : timestamp; the current time in 24-hour HH:MM:SS format
PS4='+[\t] '
# PS4 : timestamp; 'seconds.nanoseconds' since 1970-01-01 00:00:00 UT
PS4='+[$(date "+%s.%N")] '
# PS4 : position, line number, function name
# The following line avoids error messages due to an unset FUNCNAME[0] :
# set +o nounset # Treat unset variables as an error
#
PS4='+|${BASH_SOURCE##*/} ${LINENO}${FUNCNAME[0]:+ ${FUNCNAME[0]}}| '
# PS4 : position, line number, function name, subshell information
# The following line avoids error messages due to an unset FUNCNAME[0] :
# set +o nounset # Treat unset variables as an error
#
PS4='+(${BASH_SOURCE##*/}: ${LINENO}) : ${FUNCNAME[0]} - [level ${SHLVL}, '
PS4=$PS4'subshell ${BASH_SUBSHELL}, return code $?]\n '
# PS4 : default prompt
PS4='+ '

View File

@ -0,0 +1,16 @@
#=== FUNCTION ================================================================
# NAME: _assert
# DESCRIPTION: Abort the script if assertion is false.
# PARAMETERS: 1) expression used as test inside brackets
# 2) optional information, e.g. $LINENO
# RETURNS: 0 / 99 assertion is true / false
#===============================================================================
function _assert ()
{
if [ ! $1 ]; then
echo "${0##*/}${2:+:$2}: assertion '$1' failed."
exit 99
fi
return 0
}

View File

@ -0,0 +1,15 @@
DEBUG=${DEBUG:-0} # 0 = no debug output, 1 = show debug output,
# or enable debug with: DEBUG=1 script.sh
#=== FUNCTION ================================================================
# NAME: _debug
# DESCRIPTION: echo debug output controlled by a global variable
# PARAMETERS: list, e.g.; "$LINENO: x=$x"
# RETURNS: always 0
#===============================================================================
_debug ()
{
[ ${DEBUG} -ne 0 ] && echo -e "${@}"
return 0
} # ---------- end of function _debug ----------

View File

@ -0,0 +1,3 @@
# print the positional parameters
printf "'%b'\n" "$0" "$@" | nl -v0 -s': '

View File

@ -0,0 +1,16 @@
DEBUG=${DEBUG:-0} # 0 = no debug output, 1 = show debug output,
# or enable debug with: DEBUG=1 script.sh
#=== FUNCTION ================================================================
# NAME: _debug_timestamp
# DESCRIPTION: timestamp + optional information
# timestamp: {seconds since 1970-01-01 00:00:00}.{nanoseconds}
# PARAMETERS: identification, e.g. $LINENO (optional)
# RETURNS: always 0
#===============================================================================
_debug_timestamp ()
{
[ ${DEBUG} -ne 0 ] && echo -e "[ $(date "+%s.%N") ]${@:+ -- ${@}}"
return 0
} # ---------- end of function _debug_timestamp ----------

View File

@ -0,0 +1,8 @@
#
#==========================================================================
# This program 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 2 of the License, or
# (at your option) any later version.
#==========================================================================
#

View File

@ -0,0 +1,3 @@
timestamp=$(date +"%Y%m%d-%H%M%S") # generate timestamp : YYYYMMDD-hhmmss

View File

@ -0,0 +1,39 @@
ScriptVersion="1.0"
#=== FUNCTION ================================================================
# NAME: usage
# DESCRIPTION: Display usage information.
#===============================================================================
function usage ()
{
cat <<- EOT
Usage : ${0##/*/} [options] [--]
Options:
-h|help Display this message
-v|version Display script version
EOT
} # ---------- end of function usage ----------
#-----------------------------------------------------------------------
# Handle command line arguments
#-----------------------------------------------------------------------
while getopts ":hv" opt
do
case $opt in
h|help ) usage; exit 0 ;;
v|version ) echo "$0 -- Version $ScriptVersion"; exit 0 ;;
\? ) echo -e "\n Option does not exist : $OPTARG\n"
usage; exit 1 ;;
esac # --- end of case ---
done
shift $(($OPTIND-1))

View File

@ -0,0 +1,15 @@
infilename="" # input filename
exec 3<"$infilename"
if [ $? -ne 0 ] ; then
echo -e "Could not link file descriptor with file '$infilename'\n"
exit 1
fi
while read line <&3 ; do
echo -e "$line"
done
exec 3<&- # close file descriptor

View File

@ -0,0 +1,13 @@
outfilename="" # output filename
exec 4>"$outfilename"
if [ $? -ne 0 ] ; then
echo -e "Could not link file descriptor with file '$outfilename'\n"
exit 1
fi
echo -e "text" >&4
exec 4>&- # close file descriptor

View File

@ -0,0 +1,29 @@
set -o nounset # treat unset variables as errors
#===============================================================================
# GLOBAL DECLARATIONS
#===============================================================================
declare -rx SCRIPT=${0##*/} # the name of this script
declare -rx mkdir='/bin/mkdir' # the mkdir(1) command
#===============================================================================
# SANITY CHECKS
#===============================================================================
if [ -z "$BASH" ] ; then
printf "$SCRIPT:$LINENO: run this script with the BASH shell\n" >&2
exit 192
fi
if [ ! -x "$mkdir" ] ; then
printf "$SCRIPT:$LINENO: command '$mkdir' not available - aborting\n" >&2
exit 192
fi
#===============================================================================
# MAIN SCRIPT
#===============================================================================
#===============================================================================
# STATISTICS / CLEANUP
#===============================================================================
exit 0

View File

@ -0,0 +1,9 @@
#-----------------------------------------------------------------------
# set Bash prompts
# PS4 shows the function name when execution is inside a function and
# the xtrace option is set.
#-----------------------------------------------------------------------
export PS2='continue> '
export PS3='choose: '
export PS4='|${BASH_SOURCE} ${LINENO}${FUNCNAME[0]:+ ${FUNCNAME[0]}()}| '

View File

@ -0,0 +1,63 @@
"===============================================================================
"
" File: customization.gvimrc
"
" Description: suggestion for a personal configuration file ~/.gvimrc
"
" VIM Version: 7.0+
" Author: Dr. Fritz Mehner (fgm), mehner.fritz@fh-swf.de
" Organization: FH Südwestfalen, Iserlohn
" Version: 1.0
" Created: 18.05.2013 21:58
" Revision: ---
" License: Copyright (c) 2013, Dr. Fritz Mehner
"===============================================================================
"
"===============================================================================
" GENERAL SETTINGS
"===============================================================================
set cmdheight=2 " Make command line two lines high
set mousehide " Hide the mouse when typing text
highlight Normal guibg=grey90
highlight Cursor guibg=Blue guifg=NONE
highlight lCursor guibg=Cyan guifg=NONE
highlight NonText guibg=grey80
highlight Constant gui=NONE guibg=grey95
highlight Special gui=NONE guibg=grey95
"
let c_comment_strings=1 " highlight strings inside C comments
"
"-------------------------------------------------------------------------------
" Moving cursor to other windows
"
" shift down : change window focus to lower one (cyclic)
" shift up : change window focus to upper one (cyclic)
" shift left : change window focus to one on left
" shift right : change window focus to one on right
"-------------------------------------------------------------------------------
nnoremap <s-down> <c-w>w
nnoremap <s-up> <c-w>W
nnoremap <s-left> <c-w>h
nnoremap <s-right> <c-w>l
"
"-------------------------------------------------------------------------------
" some additional hot keys
"-------------------------------------------------------------------------------
" S-F3 - call gvim file browser
"-------------------------------------------------------------------------------
noremap <silent> <s-F3> :silent browse confirm e<CR>
inoremap <silent> <s-F3> <Esc>:silent browse confirm e<CR>
"
"-------------------------------------------------------------------------------
" toggle insert mode <--> 'normal mode with the <RightMouse>-key
"-------------------------------------------------------------------------------
"
nnoremap <RightMouse> <Insert>
inoremap <RightMouse> <ESC>
"
"-------------------------------------------------------------------------------
" use font with clearly distinguishable brackets : ()[]{}
"-------------------------------------------------------------------------------
"set guifont=Luxi\ Mono\ 14
"

View File

@ -0,0 +1,210 @@
"===============================================================================
"
" File: customization.vimrc
"
" Description: suggestion for a personal configuration file ~/.vimrc
"
" VIM Version: 7.0+
" Author: Dr. Fritz Mehner (fgm), mehner.fritz@fh-swf.de
" Organization: FH Südwestfalen, Iserlohn
" Version: 1.0
" Created: 18.05.2013 21:59
" Revision: ---
" License: Copyright (c) 2013, Dr. Fritz Mehner
"===============================================================================
"
"===============================================================================
" GENERAL SETTINGS
"===============================================================================
"-------------------------------------------------------------------------------
" Use Vim settings, rather then Vi settings.
" This must be first, because it changes other options as a side effect.
"-------------------------------------------------------------------------------
set nocompatible
"
"-------------------------------------------------------------------------------
" Enable file type detection. Use the default filetype settings.
" Also load indent files, to automatically do language-dependent indenting.
"-------------------------------------------------------------------------------
filetype plugin on
filetype indent on
"
"-------------------------------------------------------------------------------
" Switch syntax highlighting on.
"-------------------------------------------------------------------------------
syntax on
"
" Platform specific items:
" - central backup directory (has to be created)
" - default dictionary
" Uncomment your choice.
if has("win16") || has("win32") || has("win64") ||
\ has("win95") || has("win32unix")
"
" runtime mswin.vim
" set backupdir =$VIM\vimfiles\backupdir
" set dictionary=$VIM\vimfiles\wordlists/german.list
else
" set backupdir =$HOME/.vim.backupdir
" set dictionary=$HOME/.vim/wordlists/german.list
endif
"
" Using a backupdir under UNIX/Linux: you may want to include a line similar to
" find $HOME/.vim.backupdir -name "*" -type f -mtime +60 -exec rm -f {} \;
" in one of your shell startup files (e.g. $HOME/.profile)
"
"-------------------------------------------------------------------------------
" Various settings
"-------------------------------------------------------------------------------
set autoindent " copy indent from current line
set autoread " read open files again when changed outside Vim
set autowrite " write a modified buffer on each :next , ...
set backspace=indent,eol,start " backspacing over everything in insert mode
set backup " keep a backup file
set browsedir=current " which directory to use for the file browser
set complete+=k " scan the files given with the 'dictionary' option
set history=50 " keep 50 lines of command line history
set hlsearch " highlight the last used search pattern
set incsearch " do incremental searching
set listchars=tab:>.,eol:\$ " strings to use in 'list' mode
set mouse=a " enable the use of the mouse
set nowrap " do not wrap lines
set popt=left:8pc,right:3pc " print options
set ruler " show the cursor position all the time
set shiftwidth=2 " number of spaces to use for each step of indent
set showcmd " display incomplete commands
set smartindent " smart autoindenting when starting a new line
set tabstop=2 " number of spaces that a <Tab> counts for
set visualbell " visual bell instead of beeping
set wildignore=*.bak,*.o,*.e,*~ " wildmenu: ignore these extensions
set wildmenu " command-line completion in an enhanced mode
"
"===================================================================================
" BUFFERS, WINDOWS
"===================================================================================
"
"-------------------------------------------------------------------------------
" The current directory is the directory of the file in the current window.
"-------------------------------------------------------------------------------
if has("autocmd")
autocmd BufNewFile,BufRead * :lchdir %:p:h
endif
"
"-------------------------------------------------------------------------------
" close window (conflicts with the KDE setting for calling the process manager)
"-------------------------------------------------------------------------------
noremap <C-Esc> :close<CR>
inoremap <C-Esc> <C-C>:close<CR>
"
"-------------------------------------------------------------------------------
" Fast switching between buffers
" The current buffer will be saved before switching to the next one.
" Choose :bprevious or :bnext
"-------------------------------------------------------------------------------
noremap <silent> <s-tab> :if &modifiable && !&readonly &&
\ &modified <CR> :write<CR> :endif<CR>:bprevious<CR>
inoremap <silent> <s-tab> <C-C>:if &modifiable && !&readonly &&
\ &modified <CR> :write<CR> :endif<CR>:bprevious<CR>
"
"-------------------------------------------------------------------------------
" Leave the editor with Ctrl-q (KDE): Write all changed buffers and exit Vim
"-------------------------------------------------------------------------------
nnoremap <C-q> :wqall<CR>
"
"-------------------------------------------------------------------------------
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
"-------------------------------------------------------------------------------
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
endif " has("autocmd")
"
"-------------------------------------------------------------------------------
" some additional hot keys
"-------------------------------------------------------------------------------
" F2 - write file without confirmation
" F3 - call file explorer Ex
" F4 - show tag under curser in the preview window (tagfile must exist!)
" F5 - open quickfix error window
" F6 - close quickfix error window
" F7 - display previous error
" F8 - display next error
"-------------------------------------------------------------------------------
"
noremap <silent> <F2> :write<CR>
noremap <silent> <F3> :Explore<CR>
nnoremap <silent> <F4> :exe ":ptag ".expand("<cword>")<CR>
noremap <silent> <F5> :copen<CR>
noremap <silent> <F6> :cclose<CR>
noremap <silent> <F7> :cp<CR>
noremap <silent> <F8> :cn<CR>
"
inoremap <silent> <F2> <Esc>:write<CR>
inoremap <silent> <F3> <Esc>:Explore<CR>
inoremap <silent> <F4> <Esc>:exe ":ptag ".expand("<cword>")<CR>
inoremap <silent> <F5> <Esc>:copen<CR>
inoremap <silent> <F6> <Esc>:cclose<CR>
inoremap <silent> <F7> <Esc>:cp<CR>
inoremap <silent> <F8> <Esc>:cn<CR>
"-------------------------------------------------------------------------------
" autocomplete parenthesis, brackets and braces
"-------------------------------------------------------------------------------
inoremap ( ()<Left>
inoremap [ []<Left>
inoremap { {}<Left>
"
vnoremap ( s()<Esc>P
vnoremap [ s[]<Esc>P
vnoremap { s{}<Esc>P
"
"-------------------------------------------------------------------------------
" autocomplete quotes
"-------------------------------------------------------------------------------
vnoremap ' s''<Esc>P<Right>
vnoremap " s""<Esc>P<Right>
vnoremap ` s``<Esc>P<Right>
"
inoremap ' '<Esc>:call QuoteInsertionWrapper("'")<CR>a
inoremap " "<Esc>:call QuoteInsertionWrapper('"')<CR>a
inoremap ` `<Esc>:call QuoteInsertionWrapper('`')<CR>a
"
"-------------------------------------------------------------------------------
" function QuoteInsertionWrapper {{{3
"
" Add a second quote only if the left and the right character are not keyword
" characters and the right character is not the same quote.
"-------------------------------------------------------------------------------
function! QuoteInsertionWrapper (quote)
let col = col('.')
let line = getline('.')
if ( line[col-2] =~ '\k' )
\ || ( line[col ] =~ '\k' )
\ || ( line[col-2] =~ a:quote )
\ || ( line[col ] =~ a:quote )
return a:quote
else
return a:quote.a:quote."\<Left>"
endif
endfunction
"
"===============================================================================
" VARIOUS PLUGIN CONFIGURATIONS
"===============================================================================
"
"-------------------------------------------------------------------------------
" plugin bash-support.vim
"-------------------------------------------------------------------------------
" --empty --
"
"-------------------------------------------------------------------------------
" taglist.vim : toggle the taglist window
"-------------------------------------------------------------------------------
noremap <silent> <F11> <Esc><Esc>:Tlist<CR>
inoremap <silent> <F11> <Esc><Esc>:Tlist<CR>

View File

@ -0,0 +1,16 @@
§ =============================================================
§ User Macros
§ =============================================================
SetMacro( 'AUTHOR', 'YOUR NAME' )
SetMacro( 'AUTHORREF', '' )
SetMacro( 'COMPANY', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )
SetMacro( 'EMAIL', '' )
SetMacro( 'LICENSE', 'GNU General Public License' )
SetMacro( 'ORGANIZATION','' )
§ =============================================================
§ File Includes and Shortcuts
§ =============================================================

View File

@ -0,0 +1,35 @@
"===============================================================================
"
" File: sh.vim
"
" Description: Additonal maps for bash-support (version 4.0+)
"
" VIM Version: 7.0+
" Author: Dr. Fritz Mehner (fgm), mehner.fritz@fh-swf.de
" Organization: FH Südwestfalen, Iserlohn
" Version: 1.0
" Created: 20.05.2013 17:20
" Revision: ---
" License: Copyright (c) 2013, Dr. Fritz Mehner
"===============================================================================
"
"-------------------------------------------------------------------------------
" additional mapping : single quotes around a Word (non-whitespaces)
" masks the normal mode command '' (jump to the position
" before the latest jump)
" additional mapping : double quotes around a Word (non-whitespaces)
"-------------------------------------------------------------------------------
nnoremap <buffer> '' ciW''<Esc>P
nnoremap <buffer> "" ciW""<Esc>P
"
"-------------------------------------------------------------------------------
" generate tests
" additional mapping : \t1 expands to [ -<CURSOR> ]
" additional mapping : \t2 expands to [ <CURSOR> - ]
"-------------------------------------------------------------------------------
nnoremap <buffer> <silent> <LocalLeader>t1 a[ - ]<Left><Left><Left>
inoremap <buffer> <silent> <LocalLeader>t1 [ - ]<Left><Left><Left>
"
nnoremap <buffer> <silent> <LocalLeader>t2 a[ - ]<Left><Left><Left><Left><Left>
inoremap <buffer> <silent> <LocalLeader>t2 [ - ]<Left><Left><Left><Left><Left>
"

View File

@ -0,0 +1,34 @@
#!/bin/bash
#===============================================================================
# FILE: wrapper.sh
# USAGE: ./wrapper.sh scriptname [cmd-line-args]
# DESCRIPTION: Wraps the execution of a programm or script.
# Use with xterm: xterm -e wrapper.sh scriptname cmd-line-args
# This script is used by the Vim plugin bash-support.vim
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Dr.-Ing. Fritz Mehner (fgm), mehner.fritz@fh-swf.de
# COMPANY: Fachhochschule Südwestfalen, Iserlohn
# CREATED: 23.11.2004 18:04:01 CET
# REVISION: ---
#===============================================================================
scriptname="${1}" # name of the script to execute
returncode=0 # default return code
if [ ${#} -ge 1 ] ; then
if [ -x "$scriptname" ] ; then # start an executable script?
"${@}"
else
$SHELL "${@}" # start a script which is not executable
fi
returncode=$?
[ $returncode -ne 0 ] && printf "'${@}' returned ${returncode}\n"
else
printf "\n!! ${0} : no argument(s) !!\n"
fi
read -p "... press return key ... " dummy
exit $returncode

View File

@ -0,0 +1,42 @@
§ =============================================================
§ User Macros
§ =============================================================
SetMacro( 'AUTHOR', 'Marcin Woźniak' )
SetMacro( 'AUTHORREF', '' )
SetMacro( 'COMPANY', 'Cognifide Polska' )
SetMacro( 'COPYRIGHT', '' )
SetMacro( 'EMAIL', 'marcin.wozniak@cognifide.com' )
SetMacro( 'LICENSE', '' )
SetMacro( 'ORGANIZATION','' )
SetFormat( 'DATE', '%x' )
SetFormat( 'TIME', '%H:%M' )
SetFormat( 'YEAR', '%Y' )
SetStyle( 'default' )
§ =============================================================
§ File Includes and Shortcuts
§ =============================================================
§ :TODO:14.07.13 12:50:WM: files "paramsub.templates" and "io-redirection.templates": maps, shortcuts? sort alphabetically?
MenuShortcut( 'Comments', 'c' )
MenuShortcut( 'Statements', 's' )
MenuShortcut( 'Tests', 't' )
MenuShortcut( 'ParamSub', 'p' )
MenuShortcut( 'PatternMatching', 'p' )
MenuShortcut( 'IO-Redir', 'i' )
IncludeFile( 'comments.templates' )
IncludeFile( 'statements.templates' )
IncludeFile( 'tests.templates' )
IncludeFile( 'paramsub.templates' )
IncludeFile( 'specialparams.templates' )
IncludeFile( 'environment.templates' )
IncludeFile( 'builtins.templates' )
IncludeFile( 'set.templates' )
IncludeFile( 'shelloptions.templates' )
IncludeFile( 'io-redirection.templates' )
IncludeFile( 'patternmatching.templates' )

View File

@ -0,0 +1,70 @@
§ =============================================================
§ Builtins
§ =============================================================
== LIST: builtins == list ==
'alias',
'bg',
'bind',
'break',
'builtin',
'caller',
'cd',
'command',
'compgen',
'complete',
'continue',
'compopt',
'declare',
'dirs',
'disown',
'echo',
'enable',
'eval',
'exec',
'exit',
'export',
'false',
'fc',
'fg',
'getopts',
'hash',
'help',
'history',
'jobs',
'kill',
'let',
'local',
'logout',
'mapfile',
'popd',
'printf',
'pushd',
'pwd',
'read',
'readarray',
'readonly',
'return',
'set',
'shift',
'shopt',
'source',
'suspend',
'test',
'times',
'trap',
'true',
'type',
'typeset',
'ulimit',
'umask',
'unalias',
'unset',
'wait',
== ENDLIST ==
== Builtins == expandmenu, insert, map:bbu, sc:b ==
|PickList( 'Builtins', 'builtins' )|
|PICK|<CURSOR>
== ENDTEMPLATE ==

View File

@ -0,0 +1,142 @@
§ =============================================================
§ Comments
§ =============================================================
== Comments.end-of-line comment == nomenu, append ==
# <CURSOR>
== Comments.frame == map:cfr, sc:r ==
#-------------------------------------------------------------------------------
# <CURSOR>
#-------------------------------------------------------------------------------
== Comments.function == map:cfu, sc:f ==
#--- FUNCTION ----------------------------------------------------------------
# NAME: |?FUNCTION_NAME|
# DESCRIPTION: <CURSOR>
# PARAMETERS:
# RETURNS:
#-------------------------------------------------------------------------------
== Comments.file header == start, map:ch ==
#!/bin/bash -
#===============================================================================
#
# FILE: |FILENAME|
#
# USAGE: ./|FILENAME|
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: |AUTHOR| , |EMAIL|
# COMPANY: |COMPANY|
# CREATED: |DATE| |TIME|
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)/"
#source $DIR/settings.sh
#####################
# SETTINGS FILE
EMAILSERVER=""
EMAILFROM=""
EMAILADMIN=""
ERRORTITLE=Error-$TITLE
#
#####################
LOG="$DIR/log"
LOG_FILE="$LOG/log-$(date -I).log"
function timestamp(){
echo "[+] "$(date +'%F %T')" [INFO] $@"
}
function err() {
echo "[-] "$(date +'%F %T')" [ERROR] $@" >&2
}
function command_start(){
timestamp "Command $1 has been started."
if ! $1 ; then
err "Command $1 went wrong."
sendmailerr
exit
fi
}
function removelogs(){
find $LOG -mindepth 1 -mtime +365 -delete
}
function sendmailerr (){
echo -e "SERVER-IP: :$(ifconfig | awk '/inet /{print $2}' | sed '/127.0.0.1/d'| tr '\n' ' ')\nSCRIPTNAME: $(basename "$0")" | mailx -v -S smtp=$EMAILSERVER -r $EMAILFROM -s "$ERRORTITLE" -a $LOG_FILE $EMAILADMIN
}
function main(){
timestamp "Script has been started"
timestamp "Everything looks OK ;-)"
}
main >>$LOG_FILE 2>&1
<CURSOR>
== ENDTEMPLATE ==
§ -------------------------------------------------------------
== Comments.date == insert, map:cd, sc:d ==
|DATE|<CURSOR>
== Comments.date+time == insert, map:ct, sc:t ==
|DATE| |TIME|<CURSOR>
== ENDTEMPLATE ==
§ -------------------------------------------------------------
§ Keywords, Special and Macros
§ -------------------------------------------------------------
== LIST: comments_sections == hash ==
'GLOBAL DECLARATIONS' : 'GLOBAL DECLARATIONS',
'COMMAND LINE PROCESSING' : 'COMMAND LINE PROCESSING',
'SANITY CHECKS' : 'SANITY CHECKS',
'FUNCTION DEFINITIONS' : 'FUNCTION DEFINITIONS',
'TRAPS' : 'TRAPS',
'MAIN SCRIPT' : 'MAIN SCRIPT',
'STATISTICS AND CLEAN-UP' : 'STATISTICS AND CLEAN-UP',
== LIST: comments_keywords == hash ==
'bug' : ':BUG:|DATE| |TIME|:|AUTHORREF|: <CURSOR>',
'todo' : ':TODO:|DATE| |TIME|:|AUTHORREF|: <CURSOR>',
'tricky' : ':TRICKY:|DATE| |TIME|:|AUTHORREF|: <CURSOR>',
'warning' : ':WARNING:|DATE| |TIME|:|AUTHORREF|: <CURSOR>',
'workaround' : ':WORKAROUND:|DATE| |TIME|:|AUTHORREF|: <CURSOR>',
'new keyword' : ':<CURSOR>:|DATE| |TIME|:|AUTHORREF|: {+COMMENT+}',
== LIST: comments_macros == hash ==
'AUTHOR' : '|AUTHOR|',
'AUTHORREF' : '|AUTHORREF|',
'COMPANY' : '|COMPANY|',
'COPYRIGHT' : '|COPYRIGHT|',
'EMAIL' : '|EMAIL|',
'ORGANIZATION' : '|ORGANIZATION|',
== ENDLIST ==
§ -------------------------------------------------------------
== Comments.script sections == expandmenu, map:css, sc:s ==
|PickList( 'script sections', 'comments_sections' )|
#===============================================================================
# |PICK|
#===============================================================================
== Comments.keyword comments == expandmenu, append, map:ckc, sc:k ==
|PickList( 'keyword comment', 'comments_keywords' )|
# |PICK|
== Comments.macros == expandmenu, insert, map:cma, sc:m ==
|PickList( 'macro', 'comments_macros' )|
|PICK|
== ENDTEMPLATE ==
== SEP: Comments.sep1 ==

View File

@ -0,0 +1,100 @@
§ =============================================================
§ Environment
§ =============================================================
== LIST: environment == list ==
'BASH',
'BASHOPTS',
'BASHPID',
'BASH_ALIASES',
'BASH_ARGC',
'BASH_ARGV',
'BASH_CMDS',
'BASH_COMMAND',
'BASH_ENV',
'BASH_EXECUTION_STRING',
'BASH_LINENO',
'BASH_REMATCH',
'BASH_SOURCE',
'BASH_SUBSHELL',
'BASH_VERSINFO',
'BASH_VERSION',
'BASH_XTRACEFD',
'CDPATH',
'COLUMNS',
'COMPREPLY',
'COMP_CWORD',
'COMP_KEY',
'COMP_LINE',
'COMP_POINT',
'COMP_TYPE',
'COMP_WORDBREAKS',
'COMP_WORDS',
'DIRSTACK',
'EMAC&S',
'EUID',
'FCEDIT',
'FIGNORE',
'FUNCNAME',
'FUNCNEST',
'GLOBIGNORE',
'GROUPS',
'HISTCMD',
'HISTCONTROL',
'HISTFILE',
'HISTFILESIZE',
'HISTIGNORE',
'HISTSIZE',
'HISTTIMEFORMAT',
'HOME',
'HOSTFILE',
'HOSTNAME',
'HOSTTYPE',
'IFS',
'IGNOREEOF',
'INPUTRC',
'LANG',
'LC_ALL',
'LC_COLLATE',
'LC_CTYPE',
'LC_MESSAGES',
'LC_NUMERIC',
'LINENO',
'LINES',
'MACHTYPE',
'MAIL',
'MAILCHECK',
'MAILPATH',
'OLDPWD',
'OPTARG',
'OPTERR',
'OPTIND',
'OSTYPE',
'PATH',
'PIPESTATUS',
'POSIXLY_CORRECT',
'PPID',
'PROMPT_COMMAND',
'PROMPT_DIRTRIM',
'PS1',
'PS2',
'PS3',
'PS4',
'PWD',
'RANDOM',
'REPLY',
'SECONDS',
'SHELL',
'SHELLOPTS',
'SHLVL',
'TIMEFORMAT',
'TMOUT',
'TMPDIR',
'UID',
== ENDLIST ==
== Environment == expandmenu, insert, map:ben, sc:e ==
|PickList( 'Environment', 'environment' )|
|PICK|<CURSOR>
== ENDTEMPLATE ==

View File

@ -0,0 +1,32 @@
§ =============================================================
§ IO Redirection
§ =============================================================
== LIST: IORedirection == hash ==
'append STDOUT and STDERR &>>': ' &>> <CURSOR>',
'close input from file descr n n<&-': ' <CURSOR><&- ',
'close output from file descr n n>&-': ' <CURSOR>>&- ',
'close STDIN <&-': ' <&- <CURSOR>',
'close STDOUT >&-': ' >&- <CURSOR>',
'direct file descr n to file, append n>>' : ' <CURSOR>>> ',
'direct file descr n to file n>' : ' <CURSOR>> ',
'direct STDOUT and STDERR to file &>' : ' &> <CURSOR>',
'direct STDOUT to file, append >>' : ' >> <CURSOR>',
'direct STDOUT to file >' : ' > <CURSOR>',
'direct STDOUT to STDERR >&2' : ' >&2<CURSOR>',
'duplicate STDIN from file descr n n<&' : ' <<CURSOR>& ',
'duplicate STDOUT to file descr n n>&' : ' ><CURSOR>& ',
'take file descr n from file n<' : ' <CURSOR>< ',
'take STDIN from file <' : ' < <CURSOR>',
== ENDLIST ==
== IO-Redir.redir == expandmenu, insert, sc:r, map:ior ==
|PickList( 'IO-Redir', 'IORedirection' )|
|PICK|
== ENDTEMPLATE ==
== IO-Redir.here-document == insert, sc:h, map:ioh ==
<<-EOF
<SPLIT><CURSOR>
EOF
== ENDTEMPLATE ==

View File

@ -0,0 +1,33 @@
§ =============================================================
§ Parameter Substitution
§ =============================================================
== LIST: ParameterSubstitution == hash ==
'all lower to upper ${ ^^ }' : '${<CURSOR>^^<+pattern+>}',
'all upper to lower ${ ,, }' : '${<CURSOR>,,<+pattern+>}',
'assign default value ${ := }' : '${<CURSOR>:=<+word+>}',
'display error ${ :? }' : '${<CURSOR>:?<+word+>}',
'first lower to upper ${ ^ }' : '${<CURSOR>^<+pattern+>}',
'first upper to lower ${ , }' : '${<CURSOR>,<+pattern+>}',
'indirect parameter expansion ${! }' : '${!<CURSOR>}',
'names matching prefix ${! *}' : '${!<CURSOR>*}',
'parameter length ${# }' : '${#<CURSOR>}',
'pattern substitution all ${ // / }' : '${<CURSOR>//<+pattern+>/<+string+>}',
'pattern substitution begin ${ /# / }' : '${<CURSOR>/#<+pattern+>/<+string+>}',
'pattern substitution ${ / / }' : '${<CURSOR>/<+pattern+>/<+string+>}',
'pattern substitution end ${ /% / }' : '${<CURSOR>/%<+pattern+>/<+string+>}',
'remove all matching prefix pattern ${ ## }' : '${<CURSOR>##<+word+>}',
'remove all matching suffix pattern ${ %% }' : '${<CURSOR>%%<+word+>}',
'remove matching prefix pattern ${ # }' : '${<CURSOR>#<+word+>}',
'remove matching suffix pattern ${ % }' : '${<CURSOR>%<+word+>}',
'substitution ${ }' : '${<SPLIT><CURSOR>}',
'substring expansion ${ : : }' : '${<CURSOR>:<+offset+>:<+length+>}',
'use alternate value ${ :+ }' : '${<CURSOR>:+<+word+>}',
'use default value ${ :- }' : '${<CURSOR>:-<+word+>}',
== ENDLIST ==
== ParamSub == expandmenu, insert, sc:p, map:bps ==
|PickList( 'Parameter Substitution', 'ParameterSubstitution' )|
|PICK|
== ENDTEMPLATE ==

View File

@ -0,0 +1,51 @@
§ =============================================================
§ RegExp
§ =============================================================
== PatternMatching.zero or one == insert, map:pzo, sc:z ==
?(<SPLIT><CURSOR>|)
== PatternMatching.zero or more == insert, map:pzm, sc:z ==
*(<SPLIT><CURSOR>|)
== PatternMatching.one or more == insert, map:pom, sc:o ==
+(<SPLIT><CURSOR>|)
== PatternMatching.exactly one == insert, map:peo, sc:e ==
@(<SPLIT><CURSOR>|)
== PatternMatching.anything except == insert, map:pae, sc:a ==
!(<SPLIT><CURSOR>|)
== ENDTEMPLATE ==
== SEP: PatternMatching.sep1 ==
== LIST: POSIX_CharClasses == list ==
'alnum',
'alpha',
'ascii',
'blank',
'cntrl',
'digit',
'graph',
'lower',
'print',
'punct',
'space',
'upper',
'word',
'xdigit',
== ENDLIST ==
== PatternMatching.POSIX classes == expandmenu, insert, sc:p, map:ppc ==
|PickList( 'POSIX char. classes', 'POSIX_CharClasses' )|
[:|PICK|:]<CURSOR>
== ENDTEMPLATE ==
== LIST: BashRematch == list ==
'${BASH_REMATCH[0]}',
'${BASH_REMATCH[1]}',
'${BASH_REMATCH[2]}',
'${BASH_REMATCH[3]}',
== ENDLIST ==
== PatternMatching.BASH_REMATCH == expandmenu, insert, sc:b, map:pbr ==
|PickList( 'BASH_REMATCH', 'BashRematch' )|
|PICK|<CURSOR>
== ENDTEMPLATE ==

View File

@ -0,0 +1,51 @@
§ =============================================================
§ RegExp
§ =============================================================
== Regexp.zero or one == insert, map:xzo, sc:z ==
?(<SPLIT><CURSOR>|)
== Regexp.zero or more == insert, map:xzm, sc:z ==
*(<SPLIT><CURSOR>|)
== Regexp.one or more == insert, map:xom, sc:o ==
+(<SPLIT><CURSOR>|)
== Regexp.exactly one == insert, map:xeo, sc:e ==
@(<SPLIT><CURSOR>|)
== Regexp.anything except == insert, map:xae, sc:a ==
!(<SPLIT><CURSOR>|)
== ENDTEMPLATE ==
== SEP: Regexp.sep1 ==
== LIST: POSIX_CharClasses == list ==
'alnum',
'alpha',
'ascii',
'blank',
'cntrl',
'digit',
'graph',
'lower',
'print',
'punct',
'space',
'upper',
'word',
'xdigit',
== ENDLIST ==
== Regexp.POSIX classes == expandmenu, insert, sc:p, map:xpc ==
|PickList( 'POSIX char. classes', 'POSIX_CharClasses' )|
[:|PICK|:]<CURSOR>
== ENDTEMPLATE ==
== LIST: BashRematch == list ==
'${BASH_REMATCH[0]}',
'${BASH_REMATCH[1]}',
'${BASH_REMATCH[2]}',
'${BASH_REMATCH[3]}',
== ENDLIST ==
== Regexp.BASH_REMATCH == expandmenu, insert, sc:b, map:xbr ==
|PickList( 'BASH_REMATCH', 'BashRematch' )|
|PICK|<CURSOR>
== ENDTEMPLATE ==

View File

@ -0,0 +1,36 @@
§ =============================================================
§ Set
§ =============================================================
== LIST: set == list ==
'allexport',
'braceexpand',
'emacs',
'errexit',
'errtrace',
'functrace',
'hashall',
'histexpand',
'history',
'ignoreeof',
'keyword',
'monitor',
'noclobber',
'noexec',
'noglob',
'notify',
'nounset',
'onecmd',
'physical',
'pipefail',
'posix',
'privileged',
'verbose',
'vi',
'xtrace',
== ENDLIST ==
== Set == expandmenu, map:bse, sc:s ==
|PickList( 'set option', 'set' )|
set -o |PICK|<CURSOR>
== ENDTEMPLATE ==

View File

@ -0,0 +1,54 @@
§ =============================================================
§ Shell Options
§ =============================================================
== LIST: shopt == list ==
'autocd',
'cdable_vars',
'cdspell',
'checkhash',
'checkjobs',
'checkwinsize',
'cmdhist',
'compat31',
'compat32',
'compat40',
'compat41',
'dirspell',
'direxpand',
'dotglob',
'execfail',
'expand_aliases',
'extdebug',
'extglob',
'extquote',
'failglob',
'force_fignore',
'globstar',
'gnu_errfmt',
'histappend',
'histreedit',
'histverify',
'hostcomplete',
'huponexit',
'interactive_comments',
'lastpipe',
'lithist',
'login_shell',
'mailwarn',
'no_empty_cmd_completion',
'nocaseglob',
'nocasematch',
'nullglob',
'progcomp',
'promptvars',
'restricted_shell',
'shift_verbose',
'sourcepath',
'xpg_echo',
== ENDLIST ==
== Shopts == expandmenu, insert, map:bso, sc:o ==
|PickList( 'Shopts', 'shopt' )|
shopt -s |PICK|<CURSOR>
== ENDTEMPLATE ==

View File

@ -0,0 +1,21 @@
§ =============================================================
§ Special Parameters
§ =============================================================
== LIST: SpecialParameters == hash ==
'number of posit. param., ${#}' : '${#}',
'all posit. param. (quoted spaces), ${*}' : '${*}',
'all posit. param. (unquoted spaces), ${@}' : '${@}',
'number of posit. parameters, ${#@}' : '${#@}',
'return code of last command, ${?}' : '${?}',
'PID of this shell, ${$}' : '${$}',
'flags set, ${-}' : '${-}',
'last argument of prev. command, ${_}' : '${_}',
'PID of last background command, ${!}' : '${!}',
== ENDLIST ==
== SpecParams == expandmenu, insert, sc:p, map:bsp ==
|PickList( 'Special Parameters', 'SpecialParameters' )|
|PICK|<CURSOR>
== ENDTEMPLATE ==

View File

@ -0,0 +1,79 @@
§ =============================================================
§ Statements
§ =============================================================
== Statements.case == map:sc, shortcut:c ==
case <CURSOR> in
)
;;
)
;;
*)
;;
esac # --- end of case ---
== Statements.elif == map:sei, shortcut:e ==
elif <CURSOR> ; then
== Statements.for-in == map:sf, shortcut:f ==
for <CURSOR> in ; do
<SPLIT><-LOOP_BODY->
done
== Statements.for == map:sfo, shortcut:f ==
for (( CNTR=0; CNTR<<CURSOR>0; CNTR+=1 )); do
<SPLIT><-LOOP_BODY->
done
== Statements.if == map:si, shortcut:i ==
if <CURSOR> ; then
<SPLIT><-IF_PART->
fi
== Statements.if-else == map:sie, shortcut:i ==
if <CURSOR> ; then
<SPLIT><-IF_PART->
else
<+ELSE_PART+>
fi
== Statements.select == map:ss, shortcut:s ==
select <CURSOR> in ; do
<SPLIT>done
== Statements.until == map:su, shortcut:u ==
until <CURSOR> ; do
<SPLIT>done
== Statements.while == map:sw, shortcut:w ==
while <CURSOR> ; do
<SPLIT>done
== Statements.function == map:sfu, shortcut:f ==
function |?FUNCTION_NAME| ()
{
<CURSOR><SPLIT>
} # ---------- end of function |FUNCTION_NAME| ----------
== ENDTEMPLATE ==
§ -------------------------------------------------------------
== SEP: Statements.sep-print ==
== Statements.echo == insert, map:se, shortcut:e ==
echo -e "<CURSOR><SPLIT>"
== Statements.printf == insert, map:sp, shortcut:p ==
printf "%s\n" <CURSOR><SPLIT>
== ENDTEMPLATE ==
§ -------------------------------------------------------------
== SEP: Statements.sep-array ==
== Statements.array element == insert, map:sae, shortcut:a ==
${<CURSOR><SPLIT>[]}
== Statements.array elements, all == insert, map:saa, shortcut:a ==
${<CURSOR><SPLIT>[@]}
== Statements.array elements, string == insert, map:sas, shortcut:s ==
${<CURSOR><SPLIT>[*]}
== Statements.subarray == insert, map:ssa, shortcut:s ==
${<CURSOR><SPLIT>[@]::}
== Statements.no of element == insert, map:san, shortcut:n ==
${#<CURSOR><SPLIT>[@]}
== Statements.array indices== insert, map:sai, shortcut:i ==
${!<CURSOR><SPLIT>[@]}
== ENDTEMPLATE ==

View File

@ -0,0 +1,86 @@
§ =============================================================
§ Tests
§ =============================================================
== LIST: TestsArithmetic == hash ==
'arg1 is equal to arg2, -eq' : '-eq',
'arg1 not equal to arg2, -ne' : '-ne',
'arg1 less than arg2, -lt' : '-lt',
'arg1 less than or equal to arg2, -le' : '-le',
'arg1 greater than arg2, -gt' : '-gt',
'arg1 greater than or equal to arg2, -ge' : '-ge',
== ENDLIST ==
== Tests.arithmetic tests == expandmenu, insert, sc:a, map:ta ==
|PickList( 'arithmetic tests', 'TestsArithmetic' )|
[ <CURSOR> |PICK| ]
== ENDTEMPLATE ==
== LIST: TestsFilePermission == hash ==
'readable, -r' : '-r',
'writable, -w' : '-w',
'executable, -x' : '-x',
'SUID-bit is set, -u' : '-u',
'SGID-bit is set, -g' : '-g',
'sticky bit is set, -k' : '-k',
== ENDLIST ==
== Tests.file permissions == expandmenu, insert, sc:p, map:tfp ==
|PickList( 'file permission', 'TestsFilePermission' )|
[ <CURSOR> |PICK| ]
== ENDTEMPLATE ==
== LIST: TestsFileTypes == hash ==
'block special file, -b' : '-b',
'character special file, -c' : '-c',
'directory, -d' : '-d',
'named pipe (FIFO), -p' : '-p',
'regular file, -f' : '-f',
'socket, -S' : '-S',
'symboloc link, -L, -h' : '-L',
== ENDLIST ==
== Tests.file types == expandmenu, insert, sc:t, map:tft ==
|PickList( 'file type', 'TestsFileTypes' )|
[ <CURSOR> |PICK| ]
== ENDTEMPLATE ==
== LIST: TestsFileCharacteristics == hash ==
'file exists, -e, -a' : '-e',
'file exists, size greater zero, -s' : '-s',
'file exists, owned by eff UID, -O' : '-O',
'file exists, owned by eff GID, -G' : '-G',
'file exists, modified since last read, -N' : '-N',
'file1 newer than file2, -nt' : '-nt',
'file1 older than file2, -ot' : '-ot',
'files have same device and inode numbers , -ef' : '-ef',
== ENDLIST ==
== Tests.file characteristics == expandmenu, insert, sc:c, map:tfc ==
|PickList( 'file characteristics', 'TestsFileCharacteristics' )|
[ <CURSOR> |PICK| ]
== ENDTEMPLATE ==
== LIST: TestsStrings == hash ==
'length is zero, -z' : '-z',
'length is non-zero, -n' : '-n',
'strings are equal, ==' : '==',
'strings are not equal, !=' : '!=',
'sorts before, <' : '<',
'sorts after, >' : '>',
== ENDLIST ==
== Tests.string comparison == expandmenu, insert, sc:s, map:ts ==
|PickList( 'string comparisons', 'TestsStrings' )|
[ <CURSOR> |PICK| ]
== ENDTEMPLATE ==
== Tests.option is enabled, -o == insert, map:toe, sc:o ==
[ -o <CURSOR> ]
== Tests.variable has been set, -v == insert, map:tvs, sc:v ==
[ -v <CURSOR> ]
== Tests.file descriptor is open, refers to a terminal, -t == insert, map:tfd, sc:d ==
[ -t <CURSOR> ]
== Tests.string matches regexp == insert, map:tm, sc:m ==
[[ <CURSOR> =~ ]]
== ENDTEMPLATE ==

View File

@ -0,0 +1,264 @@
BASH
BASHPID
BASH_ALIASES
BASH_ARGC
BASH_ARGV
BASH_CMDS
BASH_COMMAND
BASH_ENV
BASH_EXECUTION_STRING
BASH_LINENO
BASHOPTS
BASH_REMATCH
BASH_SOURCE
BASH_SUBSHELL
BASH_VERSINFO
BASH_VERSION
BASH_XTRACEFD
CDPATH
COLUMNS
COMPREPLY
COMP_CWORD
COMP_KEY
COMP_LINE
COMP_POINT
COMP_TYPE
COMP_WORDBREAKS
COMP_WORDS
DIRSTACK
EMACS
EUID
FCEDIT
FIGNORE
FUNCNAME
FUNCNEST
GLOBIGNORE
GROUPS
HISTCMD
HISTCONTROL
HISTFILE
HISTFILESIZE
HISTIGNORE
HISTSIZE
HISTTIMEFORMAT
HOME
HOSTFILE
HOSTNAME
HOSTTYPE
IFS
IGNOREEOF
INPUTRC
LANG
LC_ALL
LC_COLLATE
LC_CTYPE
LC_MESSAGES
LC_NUMERIC
LINENO
LINES
MACHTYPE
MAIL
MAILCHECK
MAILPATH
OLDPWD
OPTARG
OPTERR
OPTIND
OSTYPE
PATH
PIPESTATUS
POSIXLY_CORRECT
PPID
PROMPT_COMMAND
PROMPT_DIRTRIM
PS1
PS2
PS3
PS4
PWD
RANDOM
REPLY
SECONDS
SHELL
SHELLOPTS
SHLVL
TIMEFORMAT
TMOUT
TMPDIR
UID
auto_resume
histchars
alias
bg
bind
break
builtin
caller
cd
command
compgen
complete
compopt
continue
declare
dirs
disown
echo
enable
eval
exec
exit
export
false
fc
fg
getopts
hash
help
history
jobs
kill
let
local
logout
mapfile
popd
printf
pushd
pwd
read
readarray
readonly
return
set
shift
shopt
source
suspend
test
times
trap
true
type
typeset
ulimit
umask
unalias
unset
wait
case
done
elif
else
esac
for
function
select
then
time
until
while
allexport
braceexpand
emacs
errexit
errtrace
functrace
hashall
histexpand
history
ignoreeof
keyword
monitor
noclobber
noexec
noglob
notify
nounset
onecmd
physical
pipefail
posix
privileged
verbose
xtrace
autocd
cdable_vars
cdspell
checkhash
checkjobs
checkwinsize
cmdhist
compat31
compat32
compat40
compat41
dirspell
dotglob
execfail
expand_aliases
extdebug
extglob
extquote
failglob
force_fignore
globstar
gnu_errfmt
histappend
histreedit
histverify
hostcomplete
huponexit
interactive_comments
lastpipe
lithist
login_shell
mailwarn
no_empty_cmd_completion
nocaseglob
nocasematch
nullglob
progcomp
promptvars
restricted_shell
shift_verbose
sourcepath
xpg_echo
SIGABRT
SIGALRM
SIGBUS
SIGCHLD
SIGCONT
SIGFPE
SIGHUP
SIGILL
SIGINT
SIGIO
SIGKILL
SIGPIPE
SIGPROF
SIGPWR
SIGQUIT
SIGRTMAX
SIGRTMIN
SIGSEGV
SIGSTKFLT
SIGSTOP
SIGSYS
SIGTERM
SIGTRAP
SIGTSTP
SIGTTIN
SIGTTOU
SIGURG
SIGUSR1
SIGUSR2
SIGVTALRM
SIGWINCH
SIGXCPU
SIGXFSZ