Import from compactor

This commit is contained in:
fm committed 2012-03-14 10:30:20 +01:00
1 parent 89022a9faa
commit 36a937505c
72 files changed
-5156

No files matched your search

-2
View File
@@ -1,2 +0,0 @@
PATH=~/bin:/usr/local/bin:$PATH
. $HOME/.bashrc
-215
View File
@@ -1,215 +0,0 @@
[ -n "$DISPLAY" ] && export TERM=xterm-color
SHELL=$BASH
if [ -n "$PS1" ] ;then
[[ $0 != -* && $- != *l* ]] && . /etc/profile
[[ $BASH_COMPLETION ]] || . /etc/bash_completion
#. /etc/profile
for p in ~/bin /usr/local/bin ;do
[[ $PATH != *${p}:* ]] && PATH=${p}:$PATH ;done
export SVN_EDITOR=vi
HISTCONTROL=ignoredups
IGNOREEOF=3
HISTSIZE=2000
HISTFILESIZE=50000
__col() {
[[ $TERM == xterm* || $TERM == linux ]] && echo -n '\[\e[3'${1}'m\]'
}
PS1="[$(__col 1)\h $(__col 2)\W$(__col 3)\$(exitrep)$(__col 9)]\\\$ "
eval `dircolors ~/.dircolors`
[ -f /etc/rc.d/functions ] && USECOLOR=yes source /etc/rc.d/functions
alias mark='echo -e "\n\n\n\n ${C_H2}---- `date` ----${C_CLEAR}\n\n\n\n"'
alias l=' less'
alias m=' mark'
alias df=' df -k'
alias ll=' ls -la'
alias ls=' ls --color=auto'
alias where='type -a'
alias grep='grep --color=auto'
alias svnhead="svnlog --limit=20"
alias sort='LC_ALL=C sort'
export SVN=svn+ssh://ampsvn/srv/ampemb
svnlast() { if [[ $# -ge 1 ]] ;then svnlog -p -l 25 "$@" ;else svnlog -p -a $USER -l 25 ;fi; }
svnminfo() { svn mergeinfo $SVN/trunk/embedded \
--show-revs ${@:-eligible} | \
xargs -i svnlog '-{}' svn+ssh://ampsvn/srv/ampemb/trunk/embedded; }
svnst() { svn st "$@" | grep -v '^[X?]'; }
hgst() { hg st "$@" | grep -v '^[X?]'; }
lth() { ls -lat "$@" | head -20; }
alias open='kfmclient exec'
url() { kfmclient openURL "$*"; }
vimless() { vim --cmd 'let no_plugin_maps = 1 | let load_less = 1' \
--cmd 'set readonly noswapfile' \
-c 'set mouse=a' \
-c 'runtime macros/less.vim' "${@:--}"; }
p() { "$@" | less;}
v() { if [[ $# -eq 1 && -e $1 ]] ;then vimless $1 ;else "$@" | vimless ;fi }
vis() { vi +set\ hlsearch $(which "$@"); }
_txt() { eval "file $*" | grep -w text | cut -d: -f1; }
vif() { vi -c set\ hlsearch "+/$*/" $(egrep -l "$*" $(_txt \*)); }
vdiff() { vi -g -f -d --cmd 'set columns=164' -c 'normal <C-W>=' "$@"; }
mt() { xterm +tb -e sh -c "while multitail $@; do : ;done"; }
ToAURoot() { tar zcf - $2 | command ssh $1 tar zxvf - -C /flash/root/; }
Trace() { amp-backtrace.lua "$@" | less +/'ERROR=>' --jump-target=.5; }
psman() { man -aW "$@" | xargs zcat | groff -man -Tps -P-pa4 \
| psnup -pa4 -2 -d1 | less;}
f() { awk -v N="$*" 'BEGIN {split(N, Nr, / |,/)}
{for (n in Nr) {printf("%s%s", (n>1) ? " " : "", $Nr[n])}; print ""}'; }
e() { lua -e "print($*)"; }
__h()
{
local -a C
local -i I
local N
eval $(grep "$@" ~/.bash_history | uniq | command tail -10 | tac \
| awk '{print "C[" I++ "]=\047" gensub("\047", "\047\\\\\047\047", "g", $0) "\047"}')
if [[ ${#C[@]} > 0 ]] ;then
for ((I=0; I<${#C[@]}; I++ )) ;do echo "$I: ${C[$I]}" > /dev/tty ;done
read -n 1 -p "Select command: " N </dev/tty >/dev/tty
if [[ $N = [0-9] && ${#C[$N]} > 0 ]] ;then
echo " ... Running [$N]" >/dev/tty
echo "${C[$N]}"
else
echo '' >/dev/tty
fi
fi
}
h() {
local ___Very_UnL1leLy_7ar=$(__h "$@")
history -s $___Very_UnL1leLy_7ar
eval $___Very_UnL1leLy_7ar
}
alias hi="history|tail"
case $TERM in
sun-cmd) stln() { printf "\033]l %s \033" "$*"; } ; itit() { :; }
;;
xterm*) stln() { printf "\033]2;%s\007" "$*" ; }
itit() { printf "\033]1;%s\007" "$*" ; }
;;
*) stln() { :; } ; itit() { :; }
;;
esac
HostnTty=`uname -n | tr '[a-z]' '[A-Z]'`:`tty | cut -c9-`
Tty=`tty | cut -c10-`
stdir() {
local p=${PWD/$AMPROOT/@}
if [[ $p = @/* ]] ;then Path=${p:2}; else Path=""; fi
local p=${p/$HOME/\~}
local V=''
stln "-- $HostnTty ${TOOLCHAIN_PS1_LABEL/#tt/[tt${TARGET_PLATFORM/#V26/26}] }- $p --"
itit "$Tty - $(sed 's/\([a-zA-Z]\)[a-zA-Z]*/\1/g' <<< ${AMPROOT##*/}) - ${p##*/}"
}
sshwrap() {
local Cmd Host CmdU
Cmd=$1 ; shift
Host=$(command ssh -o 'ProxyCommand=echo %h >/dev/fd/9' -o ControlPath=none "$@" 9>&1 2>&-)
CmdU=$(tr a-z A-Z <<<$Cmd)
itit "$Tty - $CmdU $Host"
command $Cmd "$@"
}
ssh() { sshwrap ssh "$@"; }
aussh() { sshwrap aussh "$@"; }
au-sshgw() { sshwrap au-sshgw "$@"; }
tail() { itit "$Tty - TAIL $@" ; command tail "$@"; }
cu() { itit "$Tty - CU $@" ; command cu "$@"; }
locate()
{
if [[ $# == 1 ]] ;then
command locate -b "$@"
else
command locate "$@"
fi
}
timerep() {
local timeRep=$TIMESHOW ; [[ $timeRep ]] || timeRep=$TIMEREPORT
[[ ! -n $timeRep ]] && return
times > /tmp/.time$$
local no timeStart cmd timeNow
timeNow=$(< /tmp/.time$$)
HISTTIMEFORMAT="%s " history 1 > /tmp/.time$$
read no timeStart cmd < /tmp/.time$$
if [[ -n $_timeprev ]] ;then
echo $_timeprev $timeNow | tr ms ' ' | awk '
{
usrPrev = $5*60 + $6
sysPrev = $7*60 + $8
usrCur = $13*60 + $14
sysCur = $15*60 + $16
total = (usrCur + sysCur) - (usrPrev + sysPrev)
if (total >= timeRep) {
printf("%.3fu %.3fs %d:%02d %.1f%%\n",
usrCur - usrPrev, sysCur - sysPrev,
duration / 60, duration % 60, total / duration * 100.0)
}
}' timeRep=$timeRep duration=$(( $(date +%s) - $timeStart ))
fi
_timeprev=$timeNow
unset TIMESHOW
rm -f /tmp/.time$$
}
TIMEREPORT=1
tim() { TIMESHOW=0 ; "$@"; }
exitrep() {
declare -a P=( ${PIPESTATUS[@]} )
local Last=$((${#P[*]} - 1))
[[ ${P[$Last]} -ne 0 ]] && echo " E:${P[$Last]}"
}
profile_check() {
local curtime=$(stat -c %y $HOME/.bashrc)
if [[ $_profile_time && $_profile_time != $curtime ]] ;then
source $HOME/.bashrc
fi
_profile_time=$curtime
}
PROMPT_COMMAND='history -a; stdir; timerep; profile_check'
if [[ -d ~/.keychain && "$UID" -ne 0 ]] ;then
#keychain --quiet ~/.ssh/id_dsa --timeout 1440 # 24 hours.
keychain --quiet ~/.ssh/id_dsa
. ~/.keychain/`uname -n`-sh
fi
if [[ -f /opt/toolchain/toolchain-setup ]] ;then
tt() { unset TOOLCHAIN_HOME ;. /opt/toolchain/toolchain-setup>/dev/null; }
untt() { unset CROSS_COMPILE ARCH TOOLCHAIN_PS1_LABEL
unalias make; }
tt; untt
fi
amptree() {
if [ $# -eq 0 ] ;then echo $AMPROOT ; return ;fi
if [ $1 == --completions ] ;then
( cd ~/amplex ; ls -1d */arm9 ) | cut -d/ -f1 | grep "^$3"
return
fi
local noCD=""
if [[ $1 == --nocd ]] ;then noCD=1; shift; fi
AMPROOT=~/amplex/$1
CDPATH=""
for d in ~ $AMPROOT/{,arm9,arm9/agentframework/{,agents,libs},arm9/apps/{,drivers},arm9/utils,arm9/drivers} ~/{amplex,releases,src,abs,abs2} ;do
CDPATH=$CDPATH:$d
done
export LUA_CPATH=";;$AMPROOT/arm9/agentframework/lua/?.so"
if [[ ! -n $noCD ]] ;then
echo $AMPROOT/arm9
cd $AMPROOT/arm9
fi
}
complete -C 'amptree --completions' amptree
amptree --nocd embedded
complete -F _command -o filenames p v
complete -c vis env where
fi
# vim: set sw=3 sts=3 et:
-139
View File
@@ -1,139 +0,0 @@
# @(#)cshrc 1.11 89/11/29 SMI
umask 2
set path = ( ~/bin /usr/local/bin $path )
if ( $?prompt ) then
# source /etc/CciCshEnv
#foreach l ( "` env - PATH=/bin sh -c '. /etc/profile; env' | awk -f ~/.envtocsh`" )
# eval "$l"
#end
set HostnTty = `uname -n | tr '[a-z]' '[A-Z]'`
set HostnTty = "$HostnTty":`tty | cut -c9-`
set cdpath = ( /var/abs/* ~ )
if (`tty` !~ /dev/pts/*) then
set term = `tset -Q -` >&/dev/null
else if ( ! $?TERM) then
set term = vt100
endif
eval `dircolors -c ~/.dircolors`
alias h history
alias more less
alias m more
alias df 'df -k'
alias ll 'ls -la'
alias ls 'ls --color=auto'
alias grep 'grep --color=auto'
alias lth 'ls -lat \!* | head -20'
alias open 'kfmclient exec'
alias url 'kfmclient openURL "\!:*"'
alias l less
alias p '\!* | l'
alias v '\!* | vi - +set\ nomodified'
alias vis 'vi +set\ hlsearch `/usr/bin/which \!*`'
alias vif 'vi -c set\ hlsearch +/\!*/ `egrep -l \!* *`'
alias prnt 'enscript -2 -r -j'
alias vdiff "vi -g -f -d --cmd 'set columns=164' -c 'normal <C-W>=' \!:*"
alias mt 'xterm +tb -e sh -c "while multitail \!* ; do : ;done"'
alias ToAURoot 'tar zcf - \!:2 | ssh \!:1 tar zxvf - -C /flash/root/'
alias psman 'man -aW \!* | xargs zcat | groff -man -Tps -P-pa4 | psnup -pa4 -2 -d1 | less '
alias autunnel 'ssh -L 22000:localhost:20532 -t ssh@gatekeeper ssh -p22\!:1 -L20532:localhost:22 root@localhost'
alias aetunnel 'ssh -L 22000:localhost:20532 -t amplex@172.23.0.230 ssh -L20532:localhost:22 root@\!:1'
if ( $TERM == sun-cmd ) then
alias stln 'printf "\033]l %s \033\" \!*'
else if ( $TERM =~ xterm* ) then
alias stln 'printf "\033]2;%s\007\033]1;%s\007" \!* "$HostnTty"'
alias xtitle 'printf "\033]2;%s\007\033]1;%s\007" \!:1 \!:1'
printf "\033]1;%s\007" "$HostnTty"
else
alias stln 'echo "\!*" >/dev/null'
endif
alias stdir 'stln "-- $HostnTty - `/bin/pwd | sed s,^$HOME,~,` --"'
alias cd 'set old="$cwd"; chdir \!:*; stdir'
alias back 'set tmp="$cwd"; chdir "$old"; set old="$tmp" ; stdir'
alias cb back
set history=200
if ($?tcsh) then
setenv SHELL /bin/sh
set autolist
set visiblebell
set time = 2
set histdup = prev
set printexitvalue
set ignoreeof = 2
set echo_style = both
set matchbeep=nomatch
set color=ls-F
unset autologout
#bindkey -v
#bindkey  vi-cmd-mode
bindkey -e
bindkey [1\;2~ complete-word-fwd
bindkey [1\;6~ complete-word-back
bindkey [1\;4~ complete-word-raw
bindkey [1~ complete-word-fwd
bindkey ' ' magic-space
bindkey -b ^W backward-delete-word
bindkey -b ^G list-glob
bindkey -b M-G expand-glob
bindkey -b M-P dabbrev-expand
bindkey -k up history-search-backward
bindkey -k down history-search-forward
bindkey -b ^A spell-word
bindkey -b ^P dabbrev-expand
bindkey -b ^N normalize-path
bindkey -b ^K normalize-command
alias _col ': \!:1'
if ( $term =~ xterm* ) alias _col 'echo -n "%{^[[3\!:1m%}"'
if ($uid > 0) then
set prompt="`_col 1`%m`_col 9`.%h.`_col 2`%c`_col 9`> "
else
set prompt="`_col 1`%m`_col 9`.%h.`_col 2`%c`_col 9`# "
endif
# Esoteric
complete find 'n/-fstype/(nfs ufs)/' 'n/-name/f/' \
'n/-type/(c b d f p l s)/' 'n/-user/u/' 'n/-exec/c/' \
'n/-ok/c/' 'n/-cpio/f/' 'n/-ncpio/f/' 'n/-newer/f/' \
'c/-/(fstype name perm prune type user nouser \
group nogroup size inum atime mtime ctime exec \
ok print ls cpio ncpio newer xdev depth)/' \
'n/*/d/'
complete dd 'c/conv=/(ascii ebcdic ibm block lcase ucase swab \
noerror notrunc sync)/' \
'c/if=/f/' 'c/of=/f/' \
'p/*/(if of ibs obs bs cbs files skip iseek \
oseek seek count conv)/=/'
complete set 'p/1/s/'
complete setenv 'p/1/e/'
complete unset 'p/1/s/'
complete unsetenv 'p/1/e/'
complete vis 'p/1/c/'
complete p 'p/1/c/'
complete v 'p/1/c/'
complete man 'p/1/c/'
complete sudo 'p/1/c/'
complete Su 'p/1/c/'
complete alias 'p/1/a/'
complete unalias 'p/1/a/'
complete bindkey 'p/1/()' 'p/2/b/'
complete complete 'p/1/c/'
complete uncomplete 'p/1/C/'
complete which 'p/*/c/'
complete where 'p/*/c/'
complete cd 'p/1/d/'
endif
if ( "$USER" != "root" ) then
keychain --quiet ~/.ssh/id_dsa --timeout 1440 # 24 hours.
source ~/.keychain/`uname -n`-csh
endif
alias tt 'source ~/.cshrc.tt'
alias amptree 'setenv AMPROOT \!:1; set cdpath = ( ~ ~/{amplex,releases,src,abs,abs2} \!:1/{,arm9,arm9/agentframework/{,agents,libs},arm9/apps/{,drivers},arm9/utils,arm9/drivers} )'
amptree ~/amplex/embedded_ampcom
setenv SVN_EDITOR vi
cd .
endif
-108
View File
@@ -1,108 +0,0 @@
# Configuration file for dircolors, a utility to help you set the
# LS_COLORS environment variable used by GNU ls with the --color option.
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
# slackware version of dircolors) are recognized but ignored.
# Below, there should be one TERM entry for each termtype that is colorizable
TERM linux
TERM linux-c
TERM mach-color
TERM console
TERM con132x25
TERM con132x30
TERM con132x43
TERM con132x60
TERM con80x25
TERM con80x28
TERM con80x30
TERM con80x43
TERM con80x50
TERM con80x60
TERM dtterm
TERM xterm
TERM xterm-color
TERM xterm-16color
TERM xterm-debian
TERM rxvt
TERM screen
TERM screen-w
TERM vt100
TERM Eterm
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00 # global default, although everything should be something.
FILE 00 # normal file
DIR 34 # directory
LINK 36 # symbolic link. (If you set this to 'target' instead of a
# numerical value, the color is as for the file pointed to.)
FIFO 40;33 # pipe
SOCK 04;35 # socket
DOOR 04;35 # door
BLK 33;04 # block device driver
CHR 33;04 # character device driver
ORPHAN 40;31;01 # symlink to nonexistent file
# This is for files with execute permission:
EXEC 32
# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
# If you use DOS-style suffixes, you may want to uncomment the following:
#.cmd 01;32 # executables (green)
#.exe 01;32
#.com 01;32
#.btm 01;32
#.bat 01;32
.tar 31 # archives or compressed (red)
.tgz 31
.arj 31
.taz 31
.lzh 31
.zip 31
.z 31
.Z 31
.gz 31
.bz2 31
.deb 31
.rpm 31
.jar 31
# image formats
.jpg 35
.jpeg 35
.gif 35
.bmp 35
.pbm 35
.pgm 35
.ppm 35
.tga 35
.xbm 35
.xpm 35
.tif 35
.tiff 35
.png 35
.mov 35
.mpg 35
.mpeg 35
.avi 35
.fli 35
.gl 35
.dl 35
.xcf 35
.xwd 35
# audio formats
.ogg 35
.mp3 35
.wav 35
-54
View File
@@ -1,54 +0,0 @@
# Readline settings
set bell-style visible
set show-all-if-ambiguous on
set visible-stats on
set input-meta on
set convert-meta off
set output-meta on
set expand-tilde on
set completion-ignore-case on
set completion-query-items 10000
# Bindings - make it somewhat more like tcsh
"\C-r": redraw-current-line
"\C-d": delete-char-or-list
# Menu completion on Shift-TAB go back with Shift-F1
"\e[Z": menu-complete
"\e[1;2~": menu-complete
"\eO2P": "\e-\e[Z"
# More line editing
$if Bash
" ": magic-space
$endif
"\d": forward-backward-delete-char
"\C-h": backward-delete-char
"\C-x\C-h": backward-kill-line
"\C-x\C-s": reverse-search-history
"\C-x\C-f": forward-search-history
"\C-s": reverse-search-history
"\C-w": unix-filename-rubout
"\ew": unix-word-rubout
"\eu": undo
# CTRL Arrow up and down searches for what is typed so far
"\e[1;3A": history-search-backward
"\e[1;3B": history-search-forward
"\e[1;5A": history-search-backward
"\e[1;5B": history-search-forward
"\e[1;3D": backward-char
"\e[1;3C": forward-char
"\e[D": backward-char
"\e[C": forward-char
# Misc
"\C-xsk": dump-functions
# At least Rdlf has it
"\C-xsh": dump-history
"\C-xkr": kill-region
"\C-xcr": copy-region-as-kill
View File
Whitespace-only changes.
-2
View File
@@ -1,2 +0,0 @@
exe 'syn match luaOperator /||/'
-5
View File
@@ -1,5 +0,0 @@
augroup filetypedetect
au BufNewFile,BufRead *.mwiki setfiletype mediawiki
augroup END
-21
View File
@@ -1,21 +0,0 @@
setlocal encoding=utf-8
setlocal textwidth=0
setlocal linebreak
setlocal matchpairs+=<:>
setlocal showbreak=+\
nnoremap <buffer> k gk
nnoremap <buffer> j gj
nnoremap <buffer> <Up> gk
nnoremap <buffer> <Down> gj
nnoremap <buffer> 0 g0
nnoremap <buffer> ^ g^
nnoremap <buffer> $ g$
inoremap <buffer> <Up> <C-O>gk
inoremap <buffer> <Down> <C-O>gj
vnoremap <buffer> k gk
vnoremap <buffer> j gj
vnoremap <buffer> <Up> gk
vnoremap <buffer> <Down> gj
vnoremap <buffer> 0 g0
vnoremap <buffer> ^ g^
vnoremap <buffer> $ g$
-249
View File
@@ -1,249 +0,0 @@
" Vim script to work like "less"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Dec 05
" Avoid loading this file twice, allow the user to define his own script.
if exists("loaded_less")
finish
endif
let loaded_less = 1
" If not reading from stdin, skip files that can't be read.
" Exit if there is no file at all.
if argc() > 0
let s:i = 0
while 1
if filereadable(argv(s:i))
if s:i != 0
sleep 3
endif
break
endif
if isdirectory(argv(s:i))
echomsg "Skipping directory " . argv(s:i)
elseif getftime(argv(s:i)) < 0
echomsg "Skipping non-existing file " . argv(s:i)
else
echomsg "Skipping unreadable file " . argv(s:i)
endif
echo "\n"
let s:i = s:i + 1
if s:i == argc()
quit
endif
next
endwhile
endif
set nocp
syntax on
set so=0
set hlsearch
set incsearch
nohlsearch
" Don't remember file names and positions
set viminfo=
set nows
" Inhibit screen updates while searching
let s:lz = &lz
set lz
" Used after each command: put cursor at end and display position
if &wrap
noremap <SID>L L0:redraw<CR>:file<CR>
au VimEnter * normal! L0
else
noremap <SID>L Lg0:redraw<CR>:file<CR>
au VimEnter * normal! Lg0
endif
" When reading from stdin don't consider the file modified.
au VimEnter * set nomod
" Can't modify the text
set noma
" Give help
noremap h :call <SID>Help()<CR>
map H h
fun! s:Help()
echo "<Space> One page forward b One page backward"
echo "d Half a page forward u Half a page backward"
echo "<Enter> One line forward k One line backward"
echo "G End of file g Start of file"
echo "N% percentage in file"
echo "\n"
echo "/pattern Search for pattern ?pattern Search backward for pattern"
echo "n next pattern match N Previous pattern match"
echo "\n"
echo ":n<Enter> Next file :p<Enter> Previous file"
echo "\n"
echo "q Quit v Edit file"
let i = input("Hit Enter to continue")
endfun
" Scroll one page forward
noremap <script> <Space> :call <SID>NextPage()<CR><SID>L
map <C-V> <Space>
map f <Space>
map <C-F> <Space>
map z <Space>
map <Esc><Space> <Space>
fun! s:NextPage()
if line(".") == line("$")
if argidx() + 1 >= argc()
exe "normal! \<Esc>"
else
next
1
endif
else
exe "normal! \<C-F>"
endif
endfun
" Re-read file and page forward "tail -f"
map F :e<CR>G<SID>L:sleep 1<CR>F
" Scroll half a page forward
noremap <script> d <C-D><SID>L
map <C-D> d
" Scroll one line forward
noremap <script> <CR> <C-E><SID>L
map <C-N> <CR>
map e <CR>
map <C-E> <CR>
map j <CR>
map <C-J> <CR>
map <Down> <CR>
" Scroll one page backward
noremap <script> b <C-B><SID>L
map <C-B> b
map w b
map <Esc>v b
" Scroll half a page backward
noremap <script> u <C-U><SID>L
noremap <script> <C-U> <C-U><SID>L
" Scroll one line backward
noremap <script> k <C-Y><SID>L
map y k
map <C-Y> k
map <C-P> k
map <C-K> k
map <Up> k
" Redraw
noremap <script> r <C-L><SID>L
noremap <script> <C-R> <C-L><SID>L
noremap <script> R <C-L><SID>L
" Start of file
noremap <script> g gg<SID>L
map < g
map <Esc>< g
" End of file
noremap <script> G G<SID>L
map > G
map <Esc>> G
" Go to percentage
noremap <script> % %<SID>L
map p %
" Search
noremap <script> / H$:call <SID>Forward()<CR>/
if &wrap
noremap <script> ? H0:call <SID>Backward()<CR>?
else
noremap <script> ? Hg0:call <SID>Backward()<CR>?
endif
fun! s:Forward()
" Searching forward
noremap <script> n H$nzt<SID>L
if &wrap
noremap <script> N H0Nzt<SID>L
else
noremap <script> N Hg0Nzt<SID>L
endif
cnoremap <silent> <script> <CR> <CR>:cunmap <lt>CR><CR>zt<SID>L
endfun
fun! s:Backward()
" Searching backward
if &wrap
noremap <script> n H0nzt<SID>L
else
noremap <script> n Hg0nzt<SID>L
endif
noremap <script> N H$Nzt<SID>L
cnoremap <silent> <script> <CR> <CR>:cunmap <lt>CR><CR>zt<SID>L
endfun
call s:Forward()
" Quitting
noremap q :q<CR>
" Switch to editing (switch off less mode)
map v :silent call <SID>End()<CR>
fun! s:End()
set ma
if exists('s:lz')
let &lz = s:lz
endif
unmap h
unmap H
unmap <Space>
unmap <C-V>
unmap f
unmap <C-F>
unmap z
unmap <Esc><Space>
unmap F
unmap d
unmap <C-D>
unmap <CR>
unmap <C-N>
unmap e
unmap <C-E>
unmap j
unmap <Down>
unmap <C-J>
unmap b
unmap <C-B>
unmap w
unmap <Esc>v
unmap u
unmap <C-U>
unmap k
unmap <Up>
unmap y
unmap <C-Y>
unmap <C-P>
unmap <C-K>
unmap r
unmap <C-R>
unmap R
unmap g
unmap <
unmap <Esc><
unmap G
unmap >
unmap <Esc>>
unmap %
unmap p
unmap n
unmap N
unmap q
unmap v
unmap /
unmap ?
endfun
" vim: sw=2
-116
View File
@@ -1,116 +0,0 @@
" Author: fma fro Ron Aarons newfmgr.vim
let g:srcsmgrhelp= "|'o'pen, 'e'dit or 'r'eplace to edit\n|Common listing for: "
" Set up hook to Common buffers:
if 1
aug srcsmgr
au!
au BufReadPre,BufEnter CMN::*/* nested call SrcmgrReload(expand("%"))
au BufReadPre,BufEnter CMN::* nested call SrcmgrReload(expand("%"))
au BufReadPre,BufEnter GRP::* nested call SrcmgrReload(expand("%"))
au BufReadPre,BufEnter GLM::* nested call SrcmgrReload(expand("%"))
au BufReadPre,BufEnter GLW::* nested call SrcmgrReload(expand("%"))
aug END
endif
" This routine gets called when we 'edit' a directory
func! SrcmgrReload(name)
let g:vimedname = a:name
if ! exists("b:last") || (line("$")<=b:last)
call ResultsWindow('-NEW-', g:srcsmgrhelp.a:name, 'call SrcmgrInit()',
\ 'SrcmgrOnClick', 0, 'SrcmgrMap')
endif
endfunc
" This one gets called by the ResultsWindow routine on initializing the window
func! SrcmgrInit()
let b:vimedname = g:vimedname
if exists("b:last") && (line("$")>b:last)
exe (b:last+1).',$ delete _'
endif
if exists("g:CommonRes")
exe "put=g:CommonRes"
unlet g:CommonRes
else
if b:vimedname =~ "CMN::" | let Command = "Common "
elseif b:vimedname =~ "GRP::" | let Command = "Grep "
elseif b:vimedname =~ "GLM::" || b:vimedname =~ "GLW::"
if exists("g:GlimpsePath")
let Command = "glimpse-tt -H ".g:GlimpsePath." "
else
let Command = "Glimpse "
endif
if b:vimedname =~ "GLW::"
let Command = Command."-w "
endif
endif
exe "put=system(\\\"".Command."'".strpart(b:vimedname, 5, 1000)."'\\\")"
endif
set nomodified
syntax match MatchedPart /:.*/
syntax match PathPart1 "/[^/]*$"ms=s+1 contained
syntax match PathPart2 "/[^/:]*:"me=e-1,ms=s+1 contained
syntax match LeadPath "^/[^:]*"ms=s+1 contains=PathPart1,PathPart2
hi link MatchedPart Question
hi link PathPart1 Title
hi link PathPart2 Title
syntax match Hide /^|/ contained
syntax match Lead /^|.*/ contains=Hide
hi link Lead Directory
hi link Hide NonText
endfunc
" as does this, by ENTER or Dbl-click
func! SrcmgrOnClick(line)
call SrcmgrApply('e!')
endfunc
func! SrcmgrApply(what)
" get the file on which the line is
let path = substitute(getline("."), ":.*", '', '')
if path !~ '^\/'
let path = g:GlimpsePath.'/'.path
endif
if ! filereadable(path) && ! isdirectory(path)
return
endif
if b:vimedname !~ '^CMN::'
if &hlsearch == 0
aug srcsmgr
exe "au BufLeave ".path." set nohlsearch | au! srcsmgr BufLeave"
aug END
endif
set hlsearch
let @/ = strpart(b:vimedname, 5, 1000)
else
let @/ = "."
endif
if (a:what == 'new!') " create new window for file
exe 'new +/'.@/.' '.path
elseif (a:what =~ 'e!') " just edit the file
set nomodified
if a:what == 'e!!'
exe "bdelete ".bufnr("%")
endif
exe 'find +/'.@/.' '.path
else
echo 'SrcmgrApply: '.a:what.']'
endif
set readonly
endfunc
" turn special mappings on or off:
func! SrcmgrMap(on)
if a:on
nmap o :call SrcmgrApply('new!')<cr>
nmap e :call SrcmgrApply('e!')<cr>
nmap r :call SrcmgrApply('e!!')<cr>
else
unmap o
unmap e
unmap r
endif
endfunc
-173
View File
@@ -1,173 +0,0 @@
" File: increment.vim
" Author: Srinath Avadhanula
" Email: srinath@eecs.berkeley.edu
"
" This script provides a way to quickly create incremented lists (either
" increasing or decreasing) using the visual block mode.
"
" Synopsis:
" =========
" 1. Suppose you have a column of the following form:
" array(1) = 3;
" array(1) = 3;
" array(1) = 3;
" array(1) = 3;
" array(1) = 3;
" 2. Choose the column of '1's using Ctrl-V and then run the command Inc (you
" should see "'<,'>Inc" on the command line at this point)(if you do not
" have any other user commands starting with 'I', just I will suffice).
" This will tranform the text as:
" array(1) = 3; array(1) = 3;
" array(1) = 3; array(2) = 3;
" array(1) = 3; --> array(3) = 3;
" array(1) = 3; array(4) = 3;
" array(1) = 3; array(5) = 3;
" 3. You can then choose the column of '3's (again using Ctrl-V) and run the
" command "Inc 3" to generate another incremented list. This will
" generate:
" array(1) = 3; array(1) = 3;
" array(2) = 3; array(2) = 6;
" array(3) = 3; --> array(3) = 9;
" array(4) = 3; array(4) = 12;
" array(5) = 3; array(5) = 15;
"
"
" Note: increment.vim automatically pads the numbers in the the column
" with spaces in order to get them right aligned. This is useful in most
" cases, but for cases when this might be bad, use IncN which doesnt do
" any alignment.
"
" Commands:
" =========
" 1. Inc : generates a column of increasing numbers with RIGHT alignment.
" 2. IncN: generates a column of increasing numbers with NO alignment.
" 3. IncL: generates a column of increasing numbers with LEFT alignment
" 2. Inc : generates a column of increasing numbers with RIGHT alignment.
" 4. IncN: generates a column of increasing numbers with NO alignment.
" 6. IncL: generates a column of increasing numbers with LEFT alignment
"
" Tip:
" A mapping which goes well with this command is the following:
"
" vnoremap <c-a> :Inc<CR>
"
" With this mapping, select a column of numbers and press Ctrl-A, which will
" get them in increasing order. I use <c-a> because its similar to the <c-a>
" command in normal mode which increments the number under the cursor.
"
" Last Modification: Dec 17 2001 00:59:09
"===========================================================================
com! -ra -nargs=? Inc :call IncrementColumn(1,<args>)
com! -ra -nargs=? IncR :call IncrementColumn(2,<args>)
com! -ra -nargs=? IncN :call IncrementColumn(0,<args>)
com! -ra -nargs=? IncA :call IncrementColumn(11,<args>)
com! -ra -nargs=? IncAR :call IncrementColumn(12,<args>)
com! -ra -nargs=? IncAN :call IncrementColumn(10,<args>)
vnoremap <c-a> :Inc<CR>
"===========================================================================
function! StrRepeat(str, count)
let i = 1
let retStr = ""
while i <= a:count
let retStr = retStr.a:str
let i = i + 1
endwhile
return retStr
endfunction
" first argument is either 0 or 1 or 2 depending on whether padding with
" spaces is desired (pad = 1,2) or not. the second argument contains the
" counter increment. its optional. if not specified, its assumed to be 1.
function! IncrementColumn(pad, ...)
if a:0 == 0
let incr = 1
elseif a:0 == 1
let incr = a:1
else
return
end
let pad = a:pad
let addonly = 0
if pad >= 10
let addonly = 1
let pad = pad - 10
endif
let c1 = col("'<")
let c2 = col("'>")
let c1v = virtcol("'<")
let c2v = virtcol("'>")
let clen = c2v - c1v
if c1 > c2
let temp = c1
let c1 = c2
let c2 = temp
end
let r1 = line("'<")
let r2 = line("'>")
if r1 > r2
let temp = r1
let r1 = r2
let r2 = temp
end
exe r1
exe "let presNum = ".strpart(getline('.'), c1-1, clen+1)
let lastnum = presNum
if !addonly
let lastnum = lastnum + incr*(r2-r1)
endif
" a simple way to find the number of digits in a number (including decimal
" points, - signs etc).
let maxstrlen = strlen("".lastnum)
let r = r1
exe 'normal '.c1v.'|'
while (r <= r2)
let cnow = col(".")
let linebef = strpart(getline('.'), 0, cnow-1)
let lineaft = strpart(getline('.'), cnow+clen, 1000)
if addonly
exe "let presNum = ".strpart(getline('.'), cnow-1, clen+1)
let presNum = presNum + incr
endif
" find the number of padding spaces required for left/rigth alignment
if pad
let preslen = strlen("".presNum)
let padspace = StrRepeat(" ", maxstrlen - preslen)
else
let padspace = ""
end
" the final line is made up of
" 1. the part of the line before the number
" 2. the padding spaces.
" 3. the present number
" 4. the part of the line after the number
" the padding spaces are either before or after the current number
" depending on whether the pad argument is 1 or 2 (respectively).
if pad == 1
let lineset = linebef.padspace.presNum.lineaft
elseif pad == 2
let lineset = linebef.presNum.padspace.lineaft
else
let lineset = linebef.presNum.lineaft
end
call setline('.', lineset)
let presNum = presNum + incr
normal j
let r = r + 1
endwhile
normal `<
endfunction
-150
View File
@@ -1,150 +0,0 @@
" File: increment.vim
" Author: Srinath Avadhanula
" Email: srinath@eecs.berkeley.edu
"
" This script provides a way to quickly create incremented lists (either
" increasing or decreasing) using the visual block mode.
"
" Synopsis:
" =========
" 1. Suppose you have a column of the following form:
" array(1) = 3;
" array(1) = 3;
" array(1) = 3;
" array(1) = 3;
" array(1) = 3;
" 2. Choose the column of '1's using Ctrl-V and then run the command Inc (you
" should see "'<,'>Inc" on the command line at this point)(if you do not
" have any other user commands starting with 'I', just I will suffice).
" This will tranform the text as:
" array(1) = 3; array(1) = 3;
" array(1) = 3; array(2) = 3;
" array(1) = 3; --> array(3) = 3;
" array(1) = 3; array(4) = 3;
" array(1) = 3; array(5) = 3;
" 3. You can then choose the column of '3's (again using Ctrl-V) and run the
" command "Inc 3" to generate another incremented list. This will
" generate:
" array(1) = 3; array(1) = 3;
" array(2) = 3; array(2) = 6;
" array(3) = 3; --> array(3) = 9;
" array(4) = 3; array(4) = 12;
" array(5) = 3; array(5) = 15;
"
" Note: increment.vim automatically pads the numbers in the the column
" with spaces in order to get them right aligned. This is useful in most
" cases, but for cases when this might be bad, use IncN which doesnt do
" any alignment.
"
" Commands:
" =========
" 1. Inc : generates a column of increasing numbers with RIGHT alignment.
" 2. IncN: generates a column of increasing numbers with NO alignment.
" 3. IncL: generates a column of increasing numbers with LEFT alignment
"
" Tip:
" A mapping which goes well with this command is the following:
"
" vnoremap <c-a> :Inc<CR>
"
" With this mapping, select a column of numbers and press Ctrl-A, which will
" get them in increasing order. I use <c-a> because its similar to the <c-a>
" command in normal mode which increments the number under the cursor.
"
" Last Modification: Dec 17 2001 00:59:09
"===========================================================================
com! -ra -nargs=? Inc :call IncrementColumn(1,<args>)
com! -ra -nargs=? IncR :call IncrementColumn(2,<args>)
com! -ra -nargs=? IncN :call IncrementColumn(0,<args>)
"===========================================================================
function! StrRepeat(str, count)
let i = 1
let retStr = ""
while i <= a:count
let retStr = retStr.a:str
let i = i + 1
endwhile
return retStr
endfunction
" first argument is either 0 or 1 or 2 depending on whether padding with
" spaces is desired (pad = 1,2) or not. the second argument contains the
" counter increment. its optional. if not specified, its assumed to be 1.
function! IncrementColumn(pad, ...)
if a:0 == 0
let incr = 1
elseif a:0 == 1
let incr = a:1
else
return
end
let c1 = col("'<")
let c2 = col("'>")
let c1v = virtcol("'<")
let c2v = virtcol("'>")
let clen = c2v - c1v
if c1 > c2
let temp = c1
let c1 = c2
let c2 = temp
end
let r1 = line("'<")
let r2 = line("'>")
if r1 > r2
let temp = r1
let r1 = r2
let r2 = temp
end
exe r1
exe "let presNum = ".strpart(getline('.'), c1-1, clen+1)
let lastnum = presNum + incr*(r2-r1)
" a simple way to find the number of digits in a number (including decimal
" points, - signs etc).
let maxstrlen = strlen("".lastnum)
let r = r1
exe 'normal '.c1v.'|'
while (r <= r2)
let cnow = col(".")
let linebef = strpart(getline('.'), 0, cnow-1)
let lineaft = strpart(getline('.'), cnow+clen, 1000)
" find the number of padding spaces required for left/rigth alignment
if a:pad
let preslen = strlen("".presNum)
let padspace = StrRepeat(" ", maxstrlen - preslen)
else
let padspace = ""
end
" the final line is made up of
" 1. the part of the line before the number
" 2. the padding spaces.
" 3. the present number
" 4. the part of the line after the number
" the padding spaces are either before or after the current number
" depending on whether the pad argument is 1 or 2 (respectively).
if a:pad == 1
let lineset = linebef.padspace.presNum.lineaft
elseif a:pad == 2
let lineset = linebef.presNum.padspace.lineaft
else
let lineset = linebef.presNum.lineaft
end
call setline('.', lineset)
let presNum = presNum + incr
normal j
let r = r + 1
endwhile
normal `<
endfunction
-90
View File
@@ -1,90 +0,0 @@
" Vim global plugin for javadoc comment wrangling
" Maintainer: fm@amplex.dk
if exists("g:loaded_jdocConvert")
" finish
endif
let g:loaded_jdocConvert = 1
let s:save_cpo = &cpo
set cpo&vim
let &cpo = s:save_cpo
if !hasmapto('<Plug>jdocConvertCompact')
map <unique> <Leader>jc <Plug>jdocConvertCompact
endif
noremap <unique> <script> <Plug>jdocConvertCompact <SID>ConvertCompact
if !hasmapto('<Plug>jdocConvertHere')
map <unique> <Leader>jh <Plug>jdocConvertHere
endif
noremap <unique> <script> <Plug>jdocConvertHere <SID>ConvertHere
function! s:JdocConvert(type, rng1, rng2) range
let [rng1, rng2] = [a:rng1, a:rng2]
if rng2 < rng1
let [rng2,rng1] = [rng1,rng2]
end
let rng2 = max([rng1 + 3, rng2])
let inp = getline(rng1, rng2)
let out = []
let txt = []
let inside = -1
let did_subst = 0
let lead = ""
let lno = rng2 - rng1
for line in inp
if line =~ '^\s*/\*\*'
" Start jdoc
let inside = 1
let lead = substitute(line, '/\*\*.*$', "", "")
elseif line =~ '^\s*\* ' && inside > 0
" Inline jdoc
call add(txt, substitute(line, '^\s*\* ', "", ""))
elseif line =~ '^\s*\*/'
" End jdoc
let inside = 0
if a:type == 1
for l in txt
call add(out, lead.'/// '.l)
endfor
let txt = []
let did_subst = 1
end
elseif len(txt) > 0 && a:type == 2
" Place text on first
call add(out, line.' ///< '.txt[0])
call remove(txt, 0)
let did_subst = 1
if len(txt) > 0
let lead = repeat(" ", len(line)).' ///< '
for l in txt
call add(out, lead.l)
endfor
endif
let txt = []
else
" Copy over
call add(out, line)
endif
let lno += 1
endfor
if did_subst
exe rng1.",".rng2 " delete"
call append(rng1 - 1, out)
exe rng1 - 1 + len(out)
endif
endfunction
function! s:CallConvert(bang, l1, l2)
let type = a:bang == "!" ? 1 : 2
call s:JdocConvert(type, a:l1, a:l2)
endfunction
nnoremap <SID>ConvertCompact :call <SID>JdocConvert(1, line("."), line(".") + v:count1 - 1)<CR>
nnoremap <SID>ConvertHere :call <SID>JdocConvert(2, line("."), line(".") + v:count1 - 1)<CR>
vnoremap <SID>ConvertCompact :call <SID>JdocConvert(1, line("'<"), line("'>"))<CR>
vnoremap <SID>ConvertHere :call <SID>JdocConvert(2, line("'<"), line("'>"))<CR>
command! -bang -range JdocConvert :call s:CallConvert("<bang>", <line1>, <line2>)
let &cpo = s:save_cpo
File diff suppressed because it is too large. Load diff
-258
View File
@@ -1,258 +0,0 @@
" collection of misc code I find useful
" Author: Ron Aaron ron@mossbayeng.com
"
" 'if 0'ed' everything outside the StatusWindow stuff /fma
"
" last update: Sun Jul 11 14:42:38 1999
if 0
set nocp
let g:utils_package_loaded = 1
" define whatever this package does, here
func! SetIfBlank(var, value)
let value = a:value
if !exists(a:var)
if match(a:value, '^expand') >= 0
" expand it
exe 'let value=' a:value
let value=escape(value, '\')
endif
exe 'let ' a:var '= "'. value .'"'
endif
endfunc
command! -nargs=* SetIfBlank call SetIfBlank(<f-args>)
" convert a number or bool to a portion of the passed-in string
func! ValueToString(choices, value, bool)
let retval = '<unknown>'
" first, convert the 'value' to an index:
if (a:bool)
" boolean. 0 == 'n' == 'No' == 'false'
if a:value=~"[a-zA-Z]"
if ((a:value =~ "^[nN]o*") || (a:value=~"^[Ff][aA][lL][sS][eE]"))
let index = 0
else
let index = 1
endif
else
let index = !(a:value == 0)
endif
else
" force numeric.
let index = 0 + a:value
endif
" second, find the 'index'th string in 'choices', which should be a
" comma-delmited string
let x=0
let choice=a:choices
while 1
if (x == index) " that's our boy!
let ix = match(choice, ',')
" extract the string up till the comma
if ix == -1
let ix = 99999
endif
let retval = strpart(choice, 0, ix)
return retval
endif
" get next string part
let ix = match(choice, ',')
if ix == -1
" failed!
return retval
endif
let choice = strpart(choice, ix+1, 99999)
" bump counter
let x = x+1
endwhile
endfunc
" convert a number or bool to a portion of the passed-in string
func! BoolString(bool)
return ValueToString('no,yes', a:bool, 1)
endfunc
endif
func! Fnmunge(name)
let name = substitute(a:name,'[\\/ \t:]', '', 'g')
return name
endfunc
func! On_(true)
if a:true | return "no" | else | return "" | endif
endfunc
func! ResultsWindow (name,help,cmd,action,once,maps)
" turn off reporting
let rep=&report | let mo=On_(&more) | let ch=&ch | let te=On_(&terse)
set report=9999 nomore ch=3 hidden terse
let retval=0
if exists("b:origbuf")
let origbuf = b:origbuf
elseif a:name == '-NEW-'
let origbuf = bufnr(@#)
else
let origbuf = bufnr("")
endif
let b:samebuf=0
if (a:name == '')
let b:samebuf=1
% d _
elseif a:name == '-NEW-'
% d _
else
let name=g:home.'/'.Fnmunge(a:name)
exe 'new ' . name
endif
let b:origbuf = origbuf
let b:resultswindow=1
let b:action = a:action
let b:once = a:once
let b:maps = a:maps " additional map function (one parm: 1=on, 0=off)
0 put=a:help
let b:last = line("$") " save last line number
normal G
" fill in the buffer with something:
exe a:cmd
if v:shell_error < 0
if !b:samebuf
unlet b:resultswindow
bdelete!
endif
echo 'Problem executing command: ' . a:cmd . ':' . v:errmsg
return
endif
let last=line("$") " get new last line number...
if (b:last == last) || ((last ==(b:last+1)) && getline(last)=='') "nothing!!!
if !b:samebuf
unlet b:resultswindow
bdelete!
endif
elseif last == (b:last+1) " one more line
let b:once=1
call ResultsMap(1)
call ResultsAct(last)
let retval=1
else " more than one ... set up window
normal 1zt
" exe 'normal ' . b:last . 'j'
set nomod
let retval=2
call ResultsMap(1)
endif
exe "set ".mo."more ".te."terse"." ch=".ch." report=".rep
return retval
endfunc
func! ResultsAct (lineno)
if (a:lineno <= b:last) " in header
return
else
let line=escape(getline(a:lineno),"'\"")
let buffer=bufnr("")
let action=b:action
let origbuf = b:origbuf
let dodelete = b:once && !b:samebuf
"see if action is a function:
if exists("*".action)
" yes, so 'call'
let act='call '.action."('".line."')"
exe act
elseif (action != '')
" no, just exe
exe action . ' ' . line
endif
if dodelete
exe 'bdelete! '.buffer
let buffer=bufnr("")
" Reestablish alternate file
exe 'buffer '.origbuf
exe 'buffer '.buffer
endif
endif
endfunc
func! ResultsMap (on)
if (a:on)
map <cr> :call ResultsAct(line("."))<cr>
map <2-LeftMouse> <cr>
if (exists("b:maps") && b:maps != '')
exe 'call' b:maps . '(1)'
endif
else
if mapcheck("<cr>")!=''
unmap <2-LeftMouse>
unmap <cr>
endif
if (exists("b:maps") && b:maps != '')
exe 'call' b:maps . '(0)'
endif
endif
endfunc
aug ResultsWindow
au!
au BufEnter * :if exists("b:resultswindow")|:call ResultsMap(1)|:endif
au BufLeave * :if exists("b:resultswindow")|:call ResultsMap(0)|:endif
au VimLeavePre * :call ResultsCleanup()
aug END
func! ResultsCleanup()
let ix = 1
while ix <= bufnr("$")
" NOTE: 'getbufvar' is my enhancement, you need my patches!
if exists("*getbufvar") && getbufvar(ix,'resultswindow')
exe 'bd '.ix
elseif match(bufname(ix), '-results-') >= 0
exe 'bd '.ix
endif
let ix = ix + 1
endwhile
endfunc
if 0
" we need 'g:vimlocal', so create it if not present
if !exists("g:vimlocal")
let g:vimlocal = expand("~") . '/vimscripts'
endif
func! SourceIfReadable(filename)
let retcode=1
if filereadable(g:vimlocal . '/' . a:filename)
exe 'so ' . g:vimlocal . '/' . a:filename
elseif filereadable($VIM . '/' . a:filename)
exe 'so ' . $VIM . '/' . a:filename
elseif filereadable(a:filename)
exe 'so ' . a:filename
else
let retcode=0
endif
return retcode
endfunc
command! -nargs=1 Source call SourceIfReadable(<q-args>)
func! Require(package)
let shortname = fnamemodify(a:package, ':r')
if !exists("g:".shortname.'_package_loaded')
" loads 'package'. First looks in 'vimscripts'
if !SourceIfReadable(a:package)
echo "Error! Cannot load required package " . a:package
endif
endif
endfunc
command! -nargs=1 Require call Require(<q-args>)
SetIfBlank g:home expand("~")
endif
-23
View File
@@ -1,23 +0,0 @@
" pyclewn run time file
" Maintainer: <xdegaye at users dot sourceforge dot net>
"
" Configure VIM to be used with pyclewn and netBeans
"
" $Id: pyclewn.vim 16 2008-06-06 19:08:47Z xdegaye $
if exists("b:did_pyclewn")
finish
endif
let b:did_pyclewn = 1
" pyclewn version
let g:pyclewn_version = "pyclewn-0.5"
" enable balloon_eval
if has("balloon_eval")
set ballooneval
set balloondelay=100
endif
-7
View File
@@ -1,7 +0,0 @@
" my filetype file
if did_filetype()
finish
endif
if getline(1) =~ '^#!/bin/d\=ash'
call SetFileTypeSH("ksh") " defined in filetype.vim
endif
-17
View File
@@ -1,17 +0,0 @@
on
off
param
telenor
onboard
devicemanager
todo
msp
amplex
accessor
dk
CONFIG
TIMESTAMP
msg
deserialize
messageswitch
req
Binary file not shown.
-26
View File
@@ -1,26 +0,0 @@
" Vim syntax file
" Language: debugger variables window syntax file
" Maintainer: <xdegaye at users dot sourceforge dot net>
" Last Change: Oct 8 2007
" $Id: dbgvar.vim 2 2007-12-23 15:10:42Z xavier $
if exists("b:current_syntax")
finish
endif
syn region dbgVarChged display contained matchgroup=dbgIgnore start="={\*}"ms=s+1 end="$"
syn region dbgDeScoped display contained matchgroup=dbgIgnore start="={-}"ms=s+1 end="$"
syn region dbgVarUnChged display contained matchgroup=dbgIgnore start="={=}"ms=s+1 end="$"
syn match dbgItem display transparent "^.*$"
\ contains=dbgVarUnChged,dbgDeScoped,dbgVarChged,dbgVarNum
syn match dbgVarNum display contained "^\s*\d\+:"he=e-1
high def link dbgVarChged Special
high def link dbgDeScoped Comment
high def link dbgVarNum Identifier
high def link dbgIgnore Ignore
let b:current_syntax = "dbgvar"
-292
View File
@@ -1,292 +0,0 @@
" Wikipedia syntax file for Vim
" Published on Wikipedia in 2003-04 and declared authorless.
"
" Based on the HTML syntax file. Probably too closely based, in fact. There
" may well be name collisions everywhere, but ignorance is bliss, so they say.
"
" To do: plug-in support for downloading and uploading to the server.
if !exists("main_syntax")
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
let main_syntax = 'html'
endif
if version < 508
command! -nargs=+ HtmlHiLink hi link <args>
else
command! -nargs=+ HtmlHiLink hi def link <args>
endif
syn case ignore
syn spell toplevel
set spell
" tags
syn region htmlString contained start=+"+ end=+"+ contains=htmlSpecialChar
syn region htmlString contained start=+'+ end=+'+ contains=htmlSpecialChar
syn match htmlValue contained "=[\t ]*[^'" \t>][^ \t>]*"hs=s+1
syn region htmlEndTag start=+</+ end=+>+ contains=htmlTagN
"syn region htmlTag start=+<[^/]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,@htmlArgCluster
syn region htmlTag start=+<[^/]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster
syn match htmlTagN contained +<\s*[-a-zA-Z0-9]\++hs=s+1 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster
syn match htmlTagN contained +</\s*[-a-zA-Z0-9]\++hs=s+2 contains=htmlTagName,htmlSpecialTagName,@htmlTagNameCluster
syn match htmlTagError contained "[^>]<"ms=s+1
" allowed tag names
syn keyword htmlTagName contained b i u font big small sub sup
syn keyword htmlTagName contained h1 h2 h3 h4 h5 h6 cite code em s strike strong tt var div center
syn keyword htmlTagName contained blockquote ol ul dl table caption pre
syn keyword htmlTagName contained ruby rt rb rp
syn keyword htmlTagName contained br p hr li dt dd
syn keyword htmlTagName contained table tr td th div blockquote ol ul
syn keyword htmlTagName contained dl font big small sub sup
syn keyword htmlTagName contained td th tr
syn keyword htmlTagName contained nowiki math
" allowed arg names
syn keyword htmlArg contained title align lang dir width height
syn keyword htmlArg contained bgcolor clear noshade
syn keyword htmlArg contained cite size face color
syn keyword htmlArg contained type start value compact
syn keyword htmlArg contained summary width border frame rules
syn keyword htmlArg contained cellspacing cellpadding valign char
syn keyword htmlArg contained charoff colgroup col span abbr axis
syn keyword htmlArg contained headers scope rowspan colspan
syn keyword htmlArg contained id class name style
" special characters
syn match htmlSpecialChar "&#\=[0-9A-Za-z]\{1,8};"
" comments
syn region htmlComment start=+<!+ end=+>+ contains=htmlCommentPart,htmlCommentError
syn match htmlCommentError contained "[^><!]"
syn region htmlCommentPart contained start=+--+ end=+--\s*+ contains=@htmlPreProc
syn region htmlComment start=+<!DOCTYPE+ keepend end=+>+
" HTML formatting
syn cluster htmlTop contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlComment,htmlLink
syn region htmlBold start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic
syn region htmlBold start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic
syn region htmlBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic
syn region htmlBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlBoldItalicUnderline
syn region htmlBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmlBoldItalicUnderline
syn region htmlBoldUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop
syn region htmlBoldUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop
syn region htmlBoldItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic
syn region htmlUnderline start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlUnderlineBold,htmlUnderlineItalic
syn region htmlUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlUnderlineBoldItalic
syn region htmlUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlUnderlineBoldItalic
syn region htmlUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmUnderlineItalicBold
syn region htmlUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmUnderlineItalicBold
syn region htmlUnderlineItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop
syn region htmlUnderlineItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop
syn region htmlUnderlineBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop
syn region htmlUnderlineBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop
syn region htmlItalic start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlItalicBold,htmlItalicUnderline
syn region htmlItalic start="<em\>" end="</em>"me=e-5 contains=@htmlTop
syn region htmlItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlItalicBoldUnderline
syn region htmlItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlItalicBoldUnderline
syn region htmlItalicBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop
syn region htmlItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlItalicUnderlineBold
syn region htmlItalicUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop
syn region htmlItalicUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop
syn region htmlH1 start="<h1\>" end="</h1>"me=e-5 contains=@htmlTop
syn region htmlH2 start="<h2\>" end="</h2>"me=e-5 contains=@htmlTop
syn region htmlH3 start="<h3\>" end="</h3>"me=e-5 contains=@htmlTop
syn region htmlH4 start="<h4\>" end="</h4>"me=e-5 contains=@htmlTop
syn region htmlH5 start="<h5\>" end="</h5>"me=e-5 contains=@htmlTop
syn region htmlH6 start="<h6\>" end="</h6>"me=e-5 contains=@htmlTop
syn region htmlHead start="<head\>" end="</head>"me=e-7 end="<body\>"me=e-5 end="<h[1-6]\>"me=e-3 contains=htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLink,htmlTitle,cssStyle
syn region htmlTitle start="<title\>" end="</title>"me=e-8 contains=htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment
" wiki formatting
"syn region wikiItalic start="\([^']\|\_^\)''[^']"hs=s+1 end="[^']''\([^']\|\_$\)"he=e-1 skip="<nowiki>.*</nowiki>" contains=wikiLink,wikiItalicBold
"syn region wikiBold start="\([^']\|\_^\)'''[^']" end="[^']'''\([^']\|\_$\)" skip="<nowiki>.*</nowiki>" contains=wikiLink,wikiBoldItalic
"syn region wikiBoldItalic contained start="\([^']\|\_^\)''[^']" end="[^']''\([^']\|\_$\)" skip="<nowiki>.*</nowiki>" contains=wikiLink
"syn region wikiItalicBold contained start="\([^']\|\_^\)'''[^']" end="[^']'''\([^']\|\_$\)" skip="<nowiki>.*</nowiki>" contains=wikiLink
"syn region wikiBoldAndItalic start="'''''" end="'''''" skip="<nowiki>.*</nowiki>" contains=wikiLink
syn region wikiItalic start=+'\@<!'''\@!+ end=+''+ contains=@Spell,wikiLink,wikiItalicBold
syn region wikiBold start=+'''+ end=+'''+ contains=@Spell,wikiLink,wikiBoldItalic
syn region wikiBoldAndItalic start=+'''''+ end=+'''''+ contains=@Spell,wikiLink
syn region wikiBoldItalic contained start=+'\@<!'''\@!+ end=+''+ contains=@Spell,wikiLink
syn region wikiItalicBold contained start=+'''+ end=+'''+ contains=@Spell,wikiLink
syn region wikiH1 start="^=" end="=" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink
syn region wikiH2 start="^==" end="==" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink
syn region wikiH3 start="^===" end="===" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink
syn region wikiH4 start="^====" end="====" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink
syn region wikiH5 start="^=====" end="=====" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink
syn region wikiH6 start="^======" end="======" skip="<nowiki>.*</nowiki>" oneline contains=@Spell,wikiLink
syn region wikiLink start="\[\[" end="\]\]\(s\|'s\|es\|ing\|\)" skip="<nowiki>.*</nowiki>" oneline contains=wikiLink
syn region wikiLink start="\[http:" end="\]" skip="<nowiki>.*</nowiki>" oneline
syn region wikiLink start="\[https:" end="\]" skip="<nowiki>.*</nowiki>" oneline
syn region wikiLink start="\[ftp:" end="\]" skip="<nowiki>.*</nowiki>" oneline
syn region wikiLink start="\[gopher:" end="\]" skip="<nowiki>.*</nowiki>" oneline
syn region wikiLink start="\[news:" end="\]" skip="<nowiki>.*</nowiki>" oneline
syn region wikiLink start="\[mailto:" end="\]" skip="<nowiki>.*</nowiki>" oneline
syn region wikiTemplate start="{{" end="}}" skip="<nowiki>.*</nowiki>"
syn match wikiParaFormatChar /^[\:|\*|;|#]\+/
syn match wikiParaFormatChar /^-----*/
syn match wikiPre /^\ .*$/
syn include @TeX syntax/tex.vim
syntax region wikiTeX matchgroup=htmlTag start="<math>" end="</math>" skip="<nowiki>.*</nowiki>" contains=@TeX
syntax region wikiRef matchgroup=htmlTag start="<ref>" end="</ref>" skip="<nowiki>.*</nowiki>"
" HTML highlighting
HtmlHiLink htmlTag Function
HtmlHiLink htmlEndTag Identifier
HtmlHiLink htmlArg Type
HtmlHiLink htmlTagName htmlStatement
HtmlHiLink htmlSpecialTagName Exception
HtmlHiLink htmlValue String
HtmlHiLink htmlSpecialChar Special
HtmlHiLink htmlH1 Title
HtmlHiLink htmlH2 htmlH1
HtmlHiLink htmlH3 htmlH2
HtmlHiLink htmlH4 htmlH3
HtmlHiLink htmlH5 htmlH4
HtmlHiLink htmlH6 htmlH5
HtmlHiLink htmlHead PreProc
HtmlHiLink htmlTitle Title
HtmlHiLink htmlBoldItalicUnderline htmlBoldUnderlineItalic
HtmlHiLink htmlUnderlineBold htmlBoldUnderline
HtmlHiLink htmlUnderlineItalicBold htmlBoldUnderlineItalic
HtmlHiLink htmlUnderlineBoldItalic htmlBoldUnderlineItalic
HtmlHiLink htmlItalicUnderline htmlUnderlineItalic
HtmlHiLink htmlItalicBold htmlBoldItalic
HtmlHiLink htmlItalicBoldUnderline htmlBoldUnderlineItalic
HtmlHiLink htmlItalicUnderlineBold htmlBoldUnderlineItalic
HtmlHiLink htmlSpecial Special
HtmlHiLink htmlSpecialChar Special
HtmlHiLink htmlString String
HtmlHiLink htmlStatement Statement
HtmlHiLink htmlComment Comment
HtmlHiLink htmlCommentPart Comment
HtmlHiLink htmlValue String
HtmlHiLink htmlCommentError htmlError
HtmlHiLink htmlTagError htmlError
HtmlHiLink htmlEvent javaScript
HtmlHiLink htmlError Error
HtmlHiLink htmlCssStyleComment Comment
HtmlHiLink htmlCssDefinition Special
" The default highlighting.
if version >= 508 || !exists("did_html_syn_inits")
if version < 508
let did_html_syn_inits = 1
endif
HtmlHiLink htmlTag Function
HtmlHiLink htmlEndTag Identifier
HtmlHiLink htmlArg Type
HtmlHiLink htmlTagName htmlStatement
HtmlHiLink htmlSpecialTagName Exception
HtmlHiLink htmlValue String
HtmlHiLink htmlSpecialChar Special
if !exists("html_no_rendering")
HtmlHiLink htmlH1 Title
HtmlHiLink htmlH2 htmlH1
HtmlHiLink htmlH3 htmlH2
HtmlHiLink htmlH4 htmlH3
HtmlHiLink htmlH5 htmlH4
HtmlHiLink htmlH6 htmlH5
HtmlHiLink htmlHead PreProc
HtmlHiLink htmlTitle Title
HtmlHiLink htmlBoldItalicUnderline htmlBoldUnderlineItalic
HtmlHiLink htmlUnderlineBold htmlBoldUnderline
HtmlHiLink htmlUnderlineItalicBold htmlBoldUnderlineItalic
HtmlHiLink htmlUnderlineBoldItalic htmlBoldUnderlineItalic
HtmlHiLink htmlItalicUnderline htmlUnderlineItalic
HtmlHiLink htmlItalicBold htmlBoldItalic
HtmlHiLink htmlItalicBoldUnderline htmlBoldUnderlineItalic
HtmlHiLink htmlItalicUnderlineBold htmlBoldUnderlineItalic
HtmlHiLink htmlLink Underlined
if !exists("html_my_rendering")
hi def htmlBold term=bold cterm=bold gui=bold
hi def htmlBoldUnderline term=bold,underline cterm=bold,underline gui=bold,underline
hi def htmlBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic
hi def htmlBoldUnderlineItalic term=bold,italic,underline cterm=bold,italic,underline gui=bold,italic,underline
hi def htmlUnderline term=underline cterm=underline gui=underline
hi def htmlUnderlineItalic term=italic,underline cterm=italic,underline gui=italic,underline
hi def htmlItalic term=italic cterm=italic gui=italic
endif
endif
HtmlHiLink htmlPreStmt PreProc
HtmlHiLink htmlPreError Error
HtmlHiLink htmlPreProc PreProc
HtmlHiLink htmlPreAttr String
HtmlHiLink htmlPreProcAttrName PreProc
HtmlHiLink htmlPreProcAttrError Error
HtmlHiLink htmlSpecial Special
HtmlHiLink htmlSpecialChar Special
HtmlHiLink htmlString String
HtmlHiLink htmlStatement Statement
HtmlHiLink htmlComment Comment
HtmlHiLink htmlCommentPart Comment
HtmlHiLink htmlValue String
HtmlHiLink htmlCommentError htmlError
HtmlHiLink htmlTagError htmlError
HtmlHiLink htmlEvent javaScript
HtmlHiLink htmlError Error
HtmlHiLink javaScript Special
HtmlHiLink javaScriptExpression javaScript
HtmlHiLink htmlCssStyleComment Comment
HtmlHiLink htmlCssDefinition Special
endif
" wiki highlighting
HtmlHiLink wikiItalic htmlItalic
HtmlHiLink wikiBold htmlBold
HtmlHiLink wikiBoldItalic htmlBoldItalic
HtmlHiLink wikiItalicBold htmlBoldItalic
HtmlHiLink wikiBoldAndItalic htmlBoldItalic
HtmlHiLink wikiH1 htmlH1
HtmlHiLink wikiH2 htmlH2
HtmlHiLink wikiH3 htmlH3
HtmlHiLink wikiH4 htmlH4
HtmlHiLink wikiH5 htmlH5
HtmlHiLink wikiH6 htmlH6
HtmlHiLink wikiLink Underlined
HtmlHiLink wikiTemplate Special
HtmlHiLink wikiParaFormatChar Special
HtmlHiLink wikiPre Constant
HtmlHiLink wikiRef Comment
let b:current_syntax = "html"
delcommand HtmlHiLink
if main_syntax == 'html'
unlet main_syntax
endif
-57
View File
@@ -1,57 +0,0 @@
" Vim syntax file
" Language: SVN commit file
" Maintainer: Ben Collins <bcollins@debian.org>
" URL: XXX
" Last Change: Tue Oct 22 00:22:19 EDT 2002
" Based on the similar CVS commit file syntax
" Place this file as ~/.vim/syntax/svn.vim
"
" Then add the following lines to ~/.vimrc
"
" au BufNewFile,BufRead svn-commit.* setf svn
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn cluster svnChange contains=svnAdd,svnDel,svnMod,svnProp
syn match svnLine /^--This line, and those below, will be ignored--$/ skipwhite skipnl skipempty nextgroup=@svnChange
syn match svnAdd /^A[M ] .*$/ contained skipwhite skipnl skipempty nextgroup=@svnChange
syn match svnDel /^D[M ] .*$/ contained skipwhite skipnl skipempty nextgroup=@svnChange
syn match svnMod /^M[M ] .*$/ contained skipwhite skipnl skipempty nextgroup=@svnChange
syn match svnProp /^_[M ] .*$/ contained skipwhite skipnl skipempty nextgroup=@svnChange
"The following is the old SVN template format markings
"
"syn region svnLine start="^SVN:" end="$" contains=svnAdd,svnDel,svnMod
"syn match svnAdd contained " [A_][ A] .*"
"syn match svnDel contained " [D_][ D] .*"
"syn match svnMod contained " [M_][ M] .*"
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_svn_syn_inits")
if version < 508
let did_svn_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink svnAdd Structure
HiLink svnDel SpecialChar
HiLink svnMod PreProc
HiLink svnProp Keyword
HiLink svnLine Comment
delcommand HiLink
endif
let b:current_syntax = "svn"
-93
View File
@@ -1,93 +0,0 @@
" Vim syntax file
" Language: SVN log file
" Maintainer: Adam Lazur <adam@lazur.org>
" URL: XXX
" Last Change: $Date: 2005-04-16 23:27:24 -0400 (Sat, 16 Apr 2005) $
" 1) Place this file in ~/.vim/syntax
"
" 2a) Then add the following lines to ~/.vimrc
"
" au BufNewFile,BufRead svn-log.* setf svn
"
" 2b) Or for autodetection, make a ~/.vim/scripts.vim with the following:
"
" if did_filetype() " filetype already set...
" finish " ...then don't do these checks
" endif
" if getline(1) =~ /^-\{72}$/
" setfiletype svnlog
" endif
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
syn match svnLogSeparator /^-\{72}$/ skipwhite skipnl skipempty nextgroup=svnRevision
syn cluster svnLogInfoLine contains=svnRevision,svnLogUser,@svnLogDate,svnLogLines,svnLogInfoSeparator
syn match svnRevision /[r:]\d\+/ contained
syn match svnLogUser /\S\+/ contained
syn match svnLogInfoSeparator /|/ skipwhite nextgroup=@svnLogInfoLine
syn cluster svnLogDate contains=svnLogDateStamp,svnLogDateHuman
syn match svnLogDateStamp /\d\{4}-\d\d-\d\d \d\d:\d\d:\d\d -\d\{4}/ skipwhite nextgroup=svnLogDateHuman
syn match svnLogDateHuman /(.\D\{3} \d\d \D\{3} \d\{4})/he=e-1,hs=s+1 skipwhite nextgroup=svnLogInfoSeparator
syn match svnLogLines /\d\+ lines\?/ skipnl nextgroup=svnChangedPaths,svnLogComment
" Changed paths highlighting
syn region svnChangedPaths start=/^Changed paths:$/ end=/^$/ transparent contains=svnChangeLine,svnChange nextgroup=svnLogComment
syn match svnChangeLine /^Changed paths:$/ skipwhite skipnl skipempty contained nextgroup=@svnChange
syn cluster svnChange contains=svnChangeAdd,svnChangeDel,svnChangeMod,svnChangeCopy
syn match svnChangeDel /^ D .\+$/ contained skipnl nextgroup=@svnChange
syn match svnChangeMod /^ M .\+$/ contained skipnl nextgroup=@svnChange
syn match svnChangeAdd /^ A [^ ]\+/ contained skipnl nextgroup=@svnChange
syn match svnChangeCopy /^ A [^ ]* (from [^)]\+)$/ contained skipnl nextgroup=@svnChange contains=svnRevision
" The comment is a region, we're cheating and swallowing the next
" svnLogSeparator, but we add a contains to it'll highlight okay (breaks
" comments containing svnLogSeparator... but that shouldn't be super common)
syn region svnLogComment start=/\n/ end=/^-\{72}$/ skipnl keepend nextgroup=svnRevision contains=svnLogSeparator
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_svnlog_syn_inits")
if version < 508
let did_svnlog_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink svnLogSeparator Comment
HiLink svnLogInfoSeparator Comment
HiLink svnRevision Label
HiLink svnLogUser Normal
HiLink svnLogDateStamp Comment
HiLink svnLogDateHuman Comment
HiLink svnLogLines Comment
HiLink svnLogComment Normal
HiLink svnChangeLine Comment
HiLink svnChangeAdd Identifier
HiLink svnChangeDel WarningMsg
HiLink svnChangeMod PreProc
HiLink svnChangeCopy SpecialKey
delcommand HiLink
endif
let b:current_syntax = "svnlog"
-32
View File
@@ -1,32 +0,0 @@
" Setup my own color preferences for syntax highlighting
if &background == "dark"
hi Comment term=bold ctermfg=Cyan guifg=#80a0ff
hi Type term=underline ctermfg=Magenta guifg=#ffa0a0
hi Special term=bold ctermfg=LightRed guifg=Orange
hi Identifier term=underline cterm=bold ctermfg=Cyan guifg=#40ffff
hi Statement term=bold ctermfg=Yellow guifg=#ffff60 gui=bold
hi PreProc term=underline ctermfg=LightBlue guifg=#ff80ff
hi Constant term=underline ctermfg=LightGreen guifg=#60ff60 gui=bold
hi Ignore ctermfg=black guifg=bg
else
hi Comment term=bold ctermfg=DarkBlue guifg=DarkBlue
hi Type term=underline ctermfg=Brown gui=NONE guifg=DarkRed
hi Special term=bold ctermfg=DarkMagenta guifg=DarkMagenta
hi Identifier term=underline ctermfg=DarkCyan guifg=DarkCyan
hi Statement term=bold ctermfg=DarkRed cterm=bold guifg=DarkRed gui=bold
hi PreProc term=underline ctermfg=DarkMagenta guifg=DarkMagenta
hi Constant term=underline ctermfg=DarkGreen guifg=DarkGreen gui=italic
hi Ignore ctermfg=white guifg=bg
hi NonText ctermfg=white
hi! link NonText Ignore
endif
hi Error term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=White
hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow
hi SpellBad ctermbg=NONE ctermfg=Red cterm=underline
hi SpellCap ctermbg=NONE ctermfg=Blue cterm=underline
hi SpellRare ctermbg=NONE ctermfg=Magenta cterm=underline
hi SpellLocal ctermbg=NONE ctermfg=Cyan cterm=underline
hi MatchParen ctermbg=NONE ctermfg=Cyan cterm=underline
"au! Syntax postscr source /usr/local2/share/vim/syntax/postscr.vim
-408
View File
@@ -1,408 +0,0 @@
" vim: set ts=3 sw=3 et:
"""
""" %Z%%E% %U%, %I% %P%
""" (C) Copyright 2000 CCI-Europe. Author : fma
"""
""" Revision History """
""" End of Revisions """
"
" My .vimrc file
"
set nocompatible " TODO: Why did the default change for 7.3 vs 7.2
if has("win32")
" Use CCI standard setup. This happens automatically on UNIX
if filereadable($VIM . "/vimrc")
source $VIM/vimrc
endif
endif
syntax on
filetype plugin indent on
augroup filetype
autocmd BufEnter *.r set ft=xdefaults
augroup END
set tags=tags,../tags,/opt/toolchain/include/tags
set path=.,include,../include,/opt/toolchain/include
let CurPath = getcwd()
while strlen(CurPath) > 3
if filereadable(CurPath."/tags")
exe "set tags+=".CurPath."/tags"
endif
if strlen(glob(CurPath."/include"))
exe "set path+=".CurPath."/include"
endif
if strlen(glob(CurPath."/*.h"))
exe "set path+=".CurPath
endif
if !exists("g:GlimpsePath") && filereadable(CurPath."/.glimpse_index")
let g:GlimpsePath = CurPath
execute "set path+=".CurPath
endif
let CurPath = substitute(CurPath, '[/\\]\+[^/\\]*$', "", "")
endwhile
if has("win32")
behave xterm
set directory=C:/temp/preserve// " Home of the swap files_
if filereadable('C:\Programs\NT_SFU\Shell\grep.EXE')
set grepprg=grep\ -n " Use POSIX grep if available
endif
" Let VIM know about VisualC++ include files
if exists("$include")
let more = substitute($include, ';', ',', 'g')
let more = substitute(more, ' ', '\\\\\\ ', 'g')
execute "set path+=" . more
let g:incdirs = g:incdirs.",".more
let more = substitute($include, ';', '\\\\\\tags,', 'g')
execute "set tags+=" . substitute(more, ' ', '\\\\\\ ', 'g') . '\\tags'
unlet more
endif
if exists("$SCCSHOME")
" Can not handle '/' to '\' conversion otherwise
let $SCCSHOME = $SCCSHOME . "/"
endif
if has("gui_running")
set guifont=Courier_New:h9
" System menu and quick minimize
map <M-Space> :simalt ~<CR>
map <M-n> :simalt ~n<CR>
" Size the GUI window. Delay positioning until window is created
set lines=50
set columns=82
augroup AutoPos
autocmd BufEnter * winp 200 50 | autocmd! AutoPos
augroup END
endif
else
if (&term == "cygwin") " This seem to have some quirks, work around some
set directory=/var/preserve/
let &t_@7="\<Esc>[4~" " Make <End> work
let &t_kh="\<Esc>[1~" " Make <Home> work
else
set directory=/var/preserve//
if has("gui_running")
let &guifont="Bitstream Vera Sans Mono 8"
else
" Uncomment line below to use :emenu. Adds ~1 second to startup time
" source $VIMRUNTIME/menu.vim
" Make <End> work - Some options cannot be assigned to with 'let'
exe "set t_@7=\<Esc>OF"
" Must be _very_ slow to handle triple clicks
set mousetime=1500
if &ttymouse == "xterm2"
" The xterm2 mode will flood us with messages
set ttymouse=xterm
endif
" Save and restore the "shell" screen on enter and exit
let &t_te = "\<Esc>[2J\<Esc>[?47l\<Esc>8"
let &t_ti = "\<Esc>7\<Esc>[?47h"
" Make <Del> mappings work
exe "set t_kb=\x08"
exe "set t_kD=\x7f"
exe "set t_Co=16"
" Make shifted cursor keys work.
" For the necessary xmodmap commands, see :help hpterm
map <t_F3> <S-Up>
map! <t_F3> <S-Up>
map <t_F6> <S-Down>
map! <t_F6> <S-Down>
map <t_F8> <S-Left>
map! <t_F8> <S-Left>
map <t_F9> <S-Right>
map! <t_F9> <S-Right>
" To make the shift-Tab <S-Tab> key work, also see :help suffixes
cmap <Esc>[1~ <C-P>
cmap <Esc>[1;2~ <C-P>
endif
endif
endif
if has("gui_running")
set title icon
set titlestring=%F%(\ --\ %a%)
set iconstring=%f
else
set notitle noicon " Do _not_ mess with title string of my xterm
endif
set showcmd " Show chars for command in progress on ruler
set exrc " Allow .vimrc in current dir
set hidden " Dont unload buffers BEWARE OF :q! and :qa! !!!
set backspace=indent,eol " Can ^H/^W/^U across lines in insert
set sidescroll=5
set scrolloff=4
set textwidth=100
set whichwrap=h,l,<,>,[,] " Do not backspace/space across line boundaries
set autoindent
set winheight=10 " Make new windows this high
set cmdheight=2 " status line area height - higher for quickfix
set laststatus=2 " always with statusline
set showmatch
set autowrite " write files back at ^Z, :make etc.
set mouse=nv " Use xterm mouse mode in insert/cmdline/prompt
set clipboard=autoselect " Visual to/from clipboard
set fileformats=unix,dos,mac
set showbreak=________ " Show me where long lines break
set showfulltag " Insert function prototype in ^X^]
set incsearch nohlsearch " Search while typing, 'zx' toggles highlighting
set helpheight=100 " Maximize help windows
set shortmess=ato " Brief messages to avoid 'Hit Return' prompts
set formatoptions=crqlo " Comment handling / Dont break while typing
set history=100
set viminfo='20,\"500 " Keep history listings across sessions
set wildmenu " Show completion matches on statusline
set wildmode=list:longest,full
set complete=.,w,b,u,d " The ,t,i from the default was too much, now ,d
set isfname-== " No = allows 'gf' in File=<Path> Constructs
set shiftwidth=4
set softtabstop=4
set expandtab
set spelllang=en_us
set equalprg=csb
set visualbell
set printfont=:h7.5
set printoptions=number:y,duplex:off,left:5mm,top:5mm,bottom:5mm,right:5mm
let c_gnu = 1
let c_no_curly_error = 1
"let &errorformat =
" For running edit-compile-edit (quickfix)
nmap <Esc>n :cnext<CR>
nmap <Esc>l :clist<CR>
nmap <Esc>c :cc<CR>
nmap <Esc>p :cprevious<CR>
nmap <Esc>m :make<CR>
" Various utility keys
nmap ( :bprev<CR>
nmap ) :bnext<CR>
nmap F :files<CR>
nmap Q :bdelete<CR>
nmap !Q :bdelete!<CR>
nmap [f :bunload<CR>
nmap zx :set invhlsearch<CR>
nmap zs :set invspell<CR>
nmap zn :set invnumber<CR>
nmap zf :set invfoldenable<CR>
nmap [s :exe "g/".@/."/p"<CR>
" These seem to be suitable for hitting all keys in mapping within timeout
set timeoutlen=500
set ttimeoutlen=50
" Make cursor keys jump out of insert. Your preference may differ
imap <Left> <Esc>
imap <Right> <Esc>
imap <Up> <Esc>
imap <Down> <Esc>
imap <S-Left> <Esc>
imap <S-Right> <Esc>
imap <S-Up> <Esc>
imap <S-Down> <Esc>
" Movement with "2x3" block navigation keys. Customize to your liking
nnoremap <PageUp> <C-U>
nnoremap <PageDown> <C-D>
nnoremap <Home> <C-Y>
nnoremap <xHome> <C-Y>
nnoremap <End> <C-E>
nmap <Insert> [[z.
nmap <Del> ]]z.
nmap <kDel> ]]z.
nmap <S-Up> {
nmap <S-Down> }
" Insert some standard blobs
map <F2> :r $SCCSHOME/SccsHeaders/static.hdr<CR>
" Always delete to left of cursor
inoremap <Del> <C-H>
cnoremap <Del> <C-H>
" List multiple matches at CTRL-]
nmap <C-]> :T <C-R><C-W><CR>
" Tag "preview" window
nmap <C-X><C-]> :ptag <C-R><C-W><CR>
nmap <C-X><Right> :ptnext<CR>
nmap <C-X><Left> :ptprevious<CR>
nmap <C-X><Down> :ppop<CR>
nmap <C-X><Up> :ptag<CR>
nmap <C-X>x :pclose<CR>
" Some coloring. These are _my_ preferences
hi statusLine term=bold,reverse cterm=NONE ctermbg=7 gui=NONE guibg=grey
hi statusLineNC term=reverse cterm=NONE ctermbg=8 gui=NONE guibg=darkgrey
hi NonText ctermfg=lightgray
hi Visual cterm=Inverse ctermfg=grey ctermbg=black
if &term == "ansi" || &term == "console" || &term == "linux"
set background=dark
hi statusLine ctermfg=black
hi statusLineNC ctermfg=black ctermbg=yellow
endif
" Use :T instead of :ta to see file names in ^D complete-lists
command! -complete=tag_listfiles -nargs=1 T tjump <args>|
\call histadd("cmd", "T <args>")
" File type dependent settings
augroup Private
" Use smartindent in these files.
autocmd FileType tcl,postscr set nocindent smartindent|inoremap # X<BS>#
" Use cindent for C files.
autocmd FileType c,cpp set cindent cinoptions=(0,w1,u0,:1,=2|inoremap # #
" Autowrap while typing in other types of files
autocmd FileType * set formatoptions-=t|set formatoptions+=t
" NO autowrap while typing in source code files
autocmd FileType tcl,postscr,c,cpp set formatoptions-=t | call SetPathAdd()
" These are for CCI source files
"autocmd BufRead * set ts=3 sts=3 sw=3
" And _these_ are most sensible for VIM (ao. PD) source code
"autocmd BufRead */src* set sts=4 sw=4 cinoptions&
" Handle global (non bufferspecific) options
autocmd BufEnter * call BufEnterGlobalOpts()
augroup end
function! SetPathAdd()
let fpath = fnamemodify(expand("<afile>:p"), ":h")
let SccsPath = $SCCSPATH
let b:incdirs = ""
while strlen(SccsPath) > 0
let spc = match(SccsPath, " ")
if spc >= 0
let Part = strpart(SccsPath, 0, spc)
let SccsPath = strpart(SccsPath, spc + 1)
else
let Part = SccsPath
let SccsPath = ""
endif
if strlen(Part) > 0
let b:incdirs = b:incdirs.",".$SCCSHOME."/".$REL.".".Part."/".fpath
endif
endwhile
if strlen(b:incdirs) > 1
let b:incdirs = strpart(b:incdirs, 1)
else
unlet b:incdirs
endif
endfunc
function! BufEnterGlobalOpts()
" Avoid '#-in-1.-column' problem with cindent & smartindent
if &filetype == 'c' || &filetype == 'cpp'
inoremap # #
" Dont highligh this as an error
hi link cCommentStartError Comment
else
inoremap # X<BS>#
endif
" Set up path for private include files - w. help from SetPathAdd()
if exists("g:incdirs")
if exists("b:incdirs")
let &path = ".,".b:incdirs.",".g:incdirs
else
let &path = ".,".g:incdirs
endif
endif
let fpath = expand("<afile>:p")
if fpath =~ '\f\/src\f' || fpath =~ '\f\/BUILD\f' || fpath =~ '\f-\d'
setlocal patchmode=.orig " Always save original file
else
setlocal patchmode&
endif
endfunc
" Pick a status line, or craft one yourself
" statusline #1, two expressions -- Use a continuation line & quote SCCS keys
set statusline=%<%f%=\ %([%1*%M\%*%n%R\%Y%{VarExists(',GZ','b:zipflag')}
\]%)\ %02c%V(%02B)C\ %3l/%LL\ %P
" statusline #2, zero expressions
"set statusline=%<%f%=\ %([%n%Xm%Xr%&,HL&h]%)\ %-19(%3l,%02c%'%o%)'%02Xb'
" statusline #3, the default one
"set statusline&
" Coloring of the modified flag
highlight User1 cterm=bold ctermfg=red ctermbg=gray gui=bold guifg=red guibg=gray
" Testing
"set title titlestring=%<%F%=%l/%L-%P titlelen=70
"set rulerformat=%l,%c%_%t-%P
function! VarExists(s,v)
if exists(a:v)
return a:s
else
return ""
endif
endfunction
function! Show_g_CTRLG()
let col = col(".")
let vcol = virtcol(".")
let line = line(".")
let lline = line("$")
exe "normal $"
let cole = col(".")
let vcole = virtcol(".")
exe "normal " vcol . "|"
let out_str = "Col " . col
if col != vcol
let out_str = out_str . "-" . vcol
endif
let out_str = out_str . " of " . cole
if cole != vcole
let out_str = out_str . "-" . vcole
endif
let out_str = out_str . "; Line " . line . " of " . lline
let out_str = out_str . " (" . (line * 100 / lline) . "%)"
let byte = line2byte(line) + col - 1
let out_str = out_str . "; Char " . byte
let lbyte = line2byte(lline) + strlen(getline(lline))
let out_str = out_str . " of " . lbyte . " (" . (byte * 100 / lbyte) . "%)"
echo out_str
endfunction
" This is _much_ faster than g<C-G> on large files. And it is more verbose
map gK :call Show_g_CTRLG()<CR>
function! Incr()
if ! exists("g:Incr")
let g:Incr = 0
else
let g:Incr = g:Incr + 1
endif
return g:Incr
endfunc
if filereadable($HOME."/.vimrc.priv")
source $HOME/.vimrc.priv
endif
if exists("load_less")
set directory=
set statusline=%3l/%LL\ %P\ %o/%{line2byte(line(\"$\")+1)-1}\ %=%<%f%a
set cmdheight=1
endif
let loaded_explorer=1 " Don't want plugin/explorer.vim
" echo "DONE sourcing"
-173
View File
@@ -1,173 +0,0 @@
"
" Extra vim stuff
"
map `h <Plug>jdocConvertHere
map `c <Plug>jdocConvertCompact
nmap <F2> :call SetCHdr()<CR>
map gy "*y
map gp "*p
map g]p "*]p
map g[P "*[P
function! SetCHdr()
call append(0, ["/**",
\ " * @file ".strpart(bufname("%"), strridx(bufname("%"), "/")+1),
\ " * ABSTRACT HERE << ",
\ " *",
\ " * $Id$",
\ " *",
\ " * (C) Copyright ".strftime("%Y")." Amplex, ".$USER."@amplex.dk",
\ " */"])
call append(line('$'), ["", "// vim: set sw=3 sts=3 et:"])
normal 5G$
set sw=3 sts=3 et
endfunction
function! TextEnableCodeSnip(filetype,start,end) abort
let ft=toupper(a:filetype)
let group='textGroup'.ft
if exists('b:current_syntax')
let s:current_syntax=b:current_syntax
" Remove current syntax definition, as some syntax files (e.g. cpp.vim)
" do nothing if b:current_syntax is defined.
unlet b:current_syntax
endif
execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim'
try
execute 'syntax include @'.group.' after/syntax/'.a:filetype.'.vim'
catch
endtry
if exists('s:current_syntax')
let b:current_syntax=s:current_syntax
else
unlet b:current_syntax
endif
exe 'syntax region textSnip'.ft.
\ ' matchgroup=textSnip '.
\ ' start="'.a:start.'" end="'.a:end.'" '.
\ ' contains=@'.group.' containedin=ALL'
hi link textSnip SpecialComment
endfunction
autocmd Private FileType sh call TextEnableCodeSnip('lua', '--LUA--', '--EOF--') |
\ call TextEnableCodeSnip('awk', '#AWK#', '#EOF#')
nmap gmd :Glimpse NodeType.<C-R><C-W><CR>
let vimrcdir = expand("<sfile>:h").".vim/macros"
func! CciPostLoad(Pattern, File)
augroup CciAutoLoad
exe "autocmd BufNewFile ".a:Pattern "source ".g:vimrcdir."/".a:File
\ ." |let b:isNew = 1 | autocmd! CciAutoLoad BufNewFile ".a:Pattern
augroup CCIstart
exe "autocmd BufNewFile ".a:Pattern "let b:autohdr = 1"
augroup END
endfunc
call CciPostLoad("GLM::*", "srcmgr.vim")
call CciPostLoad("GLW::*", "srcmgr.vim")
delfunction CciPostLoad
"exe "source ".expand("<sfile>:h")."/dot/usr/vim/"."utils.vim"
"exe "source ".expand("<sfile>:h")."/dot/usr/vim/"."newfmgr.vim"
nmap gG :call OpenSpec("GLW::<C-R><C-W>")<CR>
vmap gG :call VisualOpenSpec("GLM::")<CR>
command! -nargs=1 Glimpse call OpenSpec("GLM::<args>")
command! -nargs=1 GlimpseW call OpenSpec("GLW::<args>")
func! OpenSpec(str)
let Str = a:str
exe "edit ".Str
call histadd("cmd", "edit ".Str)
endfunction
func! VisualOpenSpec(Pre)
let Col1 = col("'<")
let Col2 = col("'>")
if line("'<") != line("'>") | return | endif
let Str = strpart(getline(line("'<")), Col1 - 1, Col2 - Col1)
let Str = substitute(Str, " ", ".", "g")
call OpenSpec(a:Pre.Str)
endfunc
set statusline=%<%f%=\ %2*%{VimBuddy()}%*\ %([%1*%M\%*%n%R\%Y
\%{VarExists(',GZ','b:zipflag')}]%)\ %02c%V(%02B)C\ %3l/%LL\ %P
highlight User2 ctermfg=blue ctermbg=gray guifg=darkblue guibg=gray
" OK. So here is the infamous VimBuddy. You can delete it, if it is not
" referenced from your 'statusline'
function! VimBuddy()
" Take a copy for others to see the messages
if ! exists("s:vimbuddy_msg")
let s:vimbuddy_msg = v:statusmsg
endif
if ! exists("s:vimbuddy_warn")
let s:vimbuddy_warn = v:warningmsg
endif
if ! exists("s:vimbuddy_err")
let s:vimbuddy_err = v:errmsg
endif
if ! exists("s:vimbuddy_onemore")
let s:vimbuddy_onemore = ""
endif
if g:actual_curbuf != bufnr("%")
" Not my buffer, sleeping
return "|-o"
elseif s:vimbuddy_err != v:errmsg
let v:errmsg = v:errmsg . " "
let s:vimbuddy_err = v:errmsg
return ":-("
elseif s:vimbuddy_warn != v:warningmsg
let v:warningmsg = v:warningmsg . " "
let s:vimbuddy_warn = v:warningmsg
return "(-:"
elseif s:vimbuddy_msg != v:statusmsg
let v:statusmsg = v:statusmsg . " "
let s:vimbuddy_msg = v:statusmsg
let test = matchstr(v:statusmsg, 'lines *$')
let num = substitute(v:statusmsg, '^\([0-9]*\).*', '\1', '') + 0
" How impressed should we be
if test != "" && num > 20
let str = ":-O"
elseif test != "" && num
let str = ":-o"
else
let str = ":-/"
endif
let s:vimbuddy_onemore = str
return str
elseif s:vimbuddy_onemore != ""
let str = s:vimbuddy_onemore
let s:vimbuddy_onemore = ""
return str
endif
if ! exists("b:lastcol")
let b:lastcol = col(".")
endif
if ! exists("b:lastlineno")
let b:lastlineno = line(".")
endif
let num = b:lastcol - col(".")
let b:lastcol = col(".")
if (num == 1 || num == -1) && b:lastlineno == line(".")
" Let VimBuddy rotate his nose
let num = b:lastcol % 4
if num == 0
let ch = '/'
elseif num == 1
let ch = '-'
elseif num == 2
let ch = '\'
else
let ch = '|'
endif
return ":" . ch . ")"
endif
let b:lastlineno = line(".")
" Happiness is my favourite mood
return ":-)"
endfunction
-26
View File
@@ -1,26 +0,0 @@
if &background == "dark"
hi Comment term=bold ctermfg=Cyan guifg=#80a0ff
hi Type term=underline ctermfg=Magenta guifg=#ffa0a0
hi Special term=bold ctermfg=LightRed guifg=Orange
hi Identifier term=underline cterm=bold ctermfg=Cyan guifg=#40ffff
hi Statement term=bold ctermfg=Yellow guifg=#ffff60 gui=bold
hi PreProc term=underline ctermfg=LightBlue guifg=#ff80ff
hi Constant term=underline ctermfg=LightGreen guifg=#60ff60 gui=bold
hi Ignore ctermfg=black guifg=bg
else
hi Comment term=bold ctermfg=DarkBlue guifg=DarkBlue
hi Type term=underline ctermfg=Brown gui=NONE guifg=DarkRed
hi Special term=bold ctermfg=DarkMagenta guifg=DarkMagenta
hi Identifier term=underline ctermfg=DarkCyan guifg=DarkCyan
hi Statement term=bold ctermfg=DarkRed guifg=DarkRed
hi PreProc term=underline ctermfg=DarkMagenta guifg=DarkMagenta
hi Constant term=underline ctermfg=DarkGreen guifg=DarkGreen gui=italic
hi Ignore ctermfg=white guifg=bg
hi NonText ctermfg=white
hi! link NonText Ignore
endif
hi Error term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=White
hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow
au! Syntax postscr source /usr/local2/share/vim/syntax/postscr.vim
-8
View File
@@ -1,8 +0,0 @@
#!/usr/bin/kermit +
set line /dev/ttyS0
set speed 115200
set flow none
set modem none
set carrier-watch off
show communications
connect
-20
View File
@@ -1,20 +0,0 @@
#!/bin/bash
##
# $Id$
# (C) Copyright 2009 Amplex, fm@amplex.dk
#
# ABSTRACT: Global grep with prebuilt index
##
Dir=$(pwd)
while [ "$Dir" ] ;do
[ -f $Dir/.glimpse_index ] && break
Dir=${Dir%/*}
done
[ "$Dir" ] || { echo "No glimpse index in this directory branch" ; exit 1; }
echo "-- Paths relative to: $Dir"
exec glimpse-tt -y -H $Dir "$@"
// vim: set sw=3 sts=3 et:
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
exec make $CROSS_COMPILE_MAKE_ARGS $TOOLCHAIN_MAKE_ARGS "$@"
-45
View File
@@ -1,45 +0,0 @@
#!/bin/bash
Dir=.
[ $# -gt 0 ] && Dir=$1
cd $Dir
rm -f .glimpse_filenames .glimpse_filenames_index .glimpse_filetimes \
.glimpse_index .glimpse_messages .glimpse_partitions .glimpse_statistics
find . \
-name .svn -prune -o -name rootdisk -prune -o -name shadows -prune -o -name \*-pak -prune -o \
-name doxygen -prune -o -type f -print | cut -c3- \
| /bin/grep -v -E '^tags$|\.glimpse_|\.pdf$|\.o$|\.so$|\.so\.|\.a$|/mapfile$' \
| while read L ;do
read -n4 T < "$L"; [[ $T != ?ELF && $T != BZh* && $T != $'\x1f\x8b\x08'* ]] && echo "$L"
done \
| glimpseindex-tt -n -F -H $Dir | awk '!/^Indexing /'
echo -n "Creating tags ... "
ctags --recurse --exclude=.svn --exclude=rootdisk --exclude=\*-pak \
--sort=no --links=no --excmd=number -f - --extra=+fq --totals=yes \
| { X=$(mktemp); rm -f $X; ctags -f $X /dev/null; cat $X -; rm -f $X; } \
| gawk -F '\t' '
/^!_TAG_FILE_SORTED/ {sub(/[0-9]/, "2")}
{print}
$NF == "F" && $1 ~ /\.h$/ {
file = $2
#print "Searching " file " .." >"/dev/stderr"
lno = 0
while (getline l <file) {
lno++
if (l ~ /^MessageNodeType\(/) {
split(substr(l, 17), arg, ",")
tag = gensub(/^ */, "", 1, arg[1])
print tag "\t" file "\t" lno " \"\tt"
#tags=tags " " tag
extra++
}
}
}
$NF == "f" && $1 ~ /:/ && $2 ~ /\.lua$/ {
npath = split($1, pth, ":")
print pth[npath] "\t" $2 "\t" $3 "\tf"
}
END {print extra+0 " extra tags added" tags >"/dev/stderr"}
' > tags
LC_ALL=C sort --ignore-case -o tags tags
echo done
-8
View File
@@ -1,8 +0,0 @@
#!/bin/sh
# Mkp - Makepkg front for easy cleanup
#
mkdir -p BUILD
cp `ls -1 | grep -v '^BUILD$'` BUILD
(cd BUILD; makepkg "$@"; rm PKGBUILD)
-7
View File
@@ -1,7 +0,0 @@
#!/bin/sh
for DEV in "TPPS/2 IBM TrackPoint" "Synaptics Inc. Composite TouchPad / TrackPoint" ;do
xinput set-int-prop "$DEV" "Evdev Wheel Emulation" 8 1
xinput set-int-prop "$DEV" "Evdev Wheel Emulation Button" 8 2
xinput set-int-prop "$DEV" "Evdev Wheel Emulation Axes" 8 6 7 4 5
done
-27
View File
@@ -1,27 +0,0 @@
#!/bin/bash
declare -a BACKUP=( ampdev0 Backup )
if [[ $1 == "restore" ]] ;then
fname=$(cut -d: -f1 <<< $2)
pattern=$(cut -d: -f2 <<< $2)
ssh ${BACKUP[0]} "cd ${BACKUP[1]}; cat b-$fname.cpio.lzo" | lzop -d | cpio -ivBdum $pattern
exit 0
fi
#eval $(keychain --eval --quiet)
BackupName=$1
cd ~/amplex
for Dir in */backmeup */*/backmeup ;do
Dir=${Dir%/*}
[[ -d $Dir ]] || continue
FDir=${Dir//\//_}
(cd $Dir
svn status | grep '^[AM]' | cut -c9- > /tmp/fn$$
cat /tmp/fn$$ | cpio -o --quiet | lzop \
| ssh ${BACKUP[0]} "cd ${BACKUP[1]}; cat >b-$FDir-$BackupName.cpio.lzo"
scp -q /tmp/fn$$ ${BACKUP[0]}:${BACKUP[1]}/i-$FDir-$BackupName
rm -f /tmp/fn$$
)
done
-11
View File
@@ -1,11 +0,0 @@
#!/usr/bin/env lua
function system(command)
local fd = io.popen(command, "r")
string = fd:read("*all")
fd:close()
return (string.gsub(string, "\n$", ""))
end
amppath = os.getenv("AMPROOT") or error("AMPROOT not defined")
print((string.gsub(arg[1] or system("pwd"), "^"..amppath, "")))
-78
View File
@@ -1,78 +0,0 @@
#!/bin/sh
#
# This script is intended to be run as '~+flashboot.cu <args> from inside cu(1)
#
# Contact the debug port with 'cu -s 115200 -l /dev/ttyS0' or equivalent
# You will of course need the cu(1) program (may be part of uucp).
# You will need chat (from ppp), lsx (lrzsz) and gkermit too.
# Devdump (for sn.txt) is in arm9/utils/devdump
#
# The file boot.bin must be in the current directory.
# Copy the 'Files' directory from the AUTester to support bootstrap mode.
# Create the file sn.txt as 7 numbers to have the serialnumber block programmed.
#
TT=/opt/toolchain/utils/flash-scripts/files
say() { echo "$@" 1>&2; }
die() { say "$@"; exit 1; }
say "Checking for bootstrap mode ..."
if chat -t 3 -e CCC '\c' ;then
[ -f loader.bin ] && P="" || P="$TT/"
[ -f ${P}loader.bin ] \
|| die "Board is in bootstrap mode but no boot files here!"
# Prepare for uboot
lsx ${P}loader.bin
[ -f u-boot.bin ] && P="" || P="$TT/"
[ -f ${P}u-boot.bin ] \
|| die "Board is in bootstrap mode but no boot files here!"
# Send uboot.
chat -t 5 -e CCC '\c' || die "Loader did not load"
lsx ${P}u-boot.bin
chat -e 'autoboot: ' '\rversion' || die "U-boot did not load"
fi
[ "$1" = "boot" ] && exit 0
chat -t 10 -e '' 'blah' 'boot>' 'loadb' || die "Not in u-boot mode"
gkermit --x -s boot.bin
# Remove write protection for boot area in the flash chip
chat -t 10 -e 'boot>' "protect off 10000000 10003fff" \
'boot>' "erase 10000000 10003fff" \
'Erasing' '\c' ECHO OFF \
'Erased' '\c' ECHO ON ' 2 sectors' '\c' \
|| die "Could not erase flash sectors"
# Copy boot.bin from SDRAM to flash. 0x21000000 ==> 0x10000000, 0x3D00 bytes
chat -t 10 -e 'boot>' "cp.b 21000000 10000000 3D00" \
' done' '\c' \
|| die "Could not write to flash"
snSize=1c
if [ -f sn.txt ] ;then
# The sn.txt file is five decimal integers in 1 or more lines
dumpdev -if sn.txt -iformat D4 -of sn.bin -bs 28
if [ -f eth.txt ] ;then
# The eth.txt file is six hex bytes in 1 or more lines
dumpdev -if eth.txt -iformat H1 -bs 6 >> sn.bin
snSize=22
fi
fi
if [ -f sn.bin ] ;then
# Program the serial number block too (34/0x1C bytes)
chat -t 10 -e 'boot>' 'loadb' || die "Missing u-boot prompt ?!"
gkermit --x -s sn.bin
chat -t 10 -e 'boot>' "cp.b 21000000 10003D00 $snSize" \
' done' '\c' \
|| die "Could not write to flash"
fi
# Reprotect the boot sectors in flash
chat -t 10 -e 'boot>' "protect on 10000000 10003fff" \
'Protected 2 sectors' 'blah' \
|| die "Could not reprotect flash"
#
-14
View File
@@ -1,14 +0,0 @@
#!/bin/sh -x
/usr/share/wicd/scripts/50-wicd-suspend.sh
killall vpnc
/etc/rc.d/dnsmasq stop
rm -f /var/run/resolvconf/interfaces/*
echo -n mem >/sys/power/state
/etc/rc.d/dnsmasq start
/usr/share/wicd/scripts/80-wicd-connect.sh
sleep 2
/etc/rc.d/tpfand restart
sh -c 'sleep 10 ; /home/fm/bin/unbind-ultranav-touchpad' &
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
awk '$1 >= T1+0 && $1 <= T2+2' T1=`date -d "$1" +%s` T2=`date -d "$2" +%s` $3
-12
View File
@@ -1,12 +0,0 @@
#!/bin/sh
##
# $Id$
# (C) Copyright 2006 Amplex, fm@amplex.dk
#
# ABSTRACT: Nice formatted hex dump in bytes, hex & ascii
##
exec hexdump -e '"%08.8_Ax\n"' \
-e '"%08.8_ax " 8/1 "%02x " " " 8/1 "%02x "' \
-e '" |" 16/1 "%_p" "|\n"' \
"$@"
-3
View File
@@ -1,3 +0,0 @@
#!/bin/bash
cd
WINEPREFIX="/home/fm/.ies4linux/ie6" wine "/home/fm/.ies4linux/ie6/drive_c/Program Files/Internet Explorer/IEXPLORE.EXE" "$@"
-20
View File
@@ -1,20 +0,0 @@
#!/bin/bash
export SSH_ASKPASS="/home/fm/bin/gksupass"
#export SSH_ASKPASS=/usr/bin/gnome-ssh-askpass2
export DISPLAY=:0
keyFile=$HOME/.ssh/id_dsa
leaveTime=19:00:00
leastMins=120
if [[ ! -f ~/.keychain/`uname -n`-lockf &&
`/usr/bin/xscreensaver-command -time 2>&1` == *non-blanked* ]]
then
eval $(keychain --eval -q)
if [[ `ssh-add -l` != *$keyFile* ]] ;then
#mins=$(((($(date -d $leaveTime +%s) - $(date +%s)) / 60)))
[[ $mins -lt $leastMins ]] && mins=$leastMins
#keychain --lockwait 1 --quiet $keyFile --timeout $mins >/dev/null 2>&1
keychain --lockwait 1 --quiet $keyFile >/dev/null 2>&1
fi
fi
-4
View File
@@ -1,4 +0,0 @@
#!/bin/bash
LUADIR=${LUA_CPATH%/?.so}
LUADIR=${LUADIR##*;}
EXEC $VALGRIND ${LUADIR}/lua-agent "$@"DIR
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
grep -v ^time $1 | awk -F $'\t' '{print strftime("%d-%m-%y %T", $1), "\t", $0}' | cut -d$'\t' -f1,3-
-3
View File
@@ -1,3 +0,0 @@
#!/bin/sh
kfmclient openURL "$@"
-3
View File
@@ -1,3 +0,0 @@
#!/bin/sh
enscript --columns=2 --landscape --borders --highlight "$@"
-3
View File
@@ -1,3 +0,0 @@
#!/bin/sh
dcop kded wmiface findAllWindows '' Thunderbird-bin '' '' '' 0 \
| xargs -l dcop kded wmiface forceActiveWindow
-20
View File
@@ -1,20 +0,0 @@
#!/bin/sh
VENDOR=06cb
PRODUCT=0009
IF=1.0
while read VENDOR PRODUCT ;do
for i in /sys/bus/usb/devices/* ; do
if [ -e $i/idVendor ] && [ `cat $i/idVendor` = $VENDOR ] && \
[ -e $i/idProduct ] && [ `cat $i/idProduct` = $PRODUCT ] && \
[ -e $i\:$IF/driver/unbind ]
then
echo -n `basename $i`\:$IF > $i\:$IF/driver/unbind
break
fi
done
done << EOF
06cb 0009
0002 0007
EOF
-65
View File
@@ -1,65 +0,0 @@
#!/bin/bash
HTTOOLS=$HOME/amplex/ampep/HtTools
runBS() {
BSSERVER=$1 $HTTOOLS/bsTest $HTTOOLS/bsh/$2.bsh
}
mkTemp() {
mktemp /tmp/.updssh-tmp.XXXXXXXXXX
}
getList() {
local F=`mkTemp`
runBS $1 listBoxes > $F
if grep --silent ANNOT: $F ;then
awk '/\t/' $F | sort
else
return 1
fi
rm $F
}
updFile() {
local Ip=`au-sshgw $1 hostip`
local F=`mkTemp`
[[ $1 == *-stg ]] && Ip=${Ip}:8000
echo -n "Updating list for $1 ($Ip) ... "
if getList $Ip > $2.tmp ;then
mv -f $2.tmp $2
echo 'DONE'
else
rm -f $2.tmp
echo 'FAILED'
fi
}
if [[ ! $1 ]] ;then
echo 'Usage: upd-ssh-boxlists {<Server-list>|UPDATE}' 1>&2
exit
fi
if [[ $1 == UPDATE ]] ;then
#sudo vpnc-disconnect
#sudo vpnc amp-ae
for i in `au-sshgw gwlist | grep ^ad-` ;do
File=/opt/toolchain/utils/sshgw/files/boxes-${i}.db
[[ -f $File ]] && updFile $i $File
done
#sudo vpnc-disconnect
#sudo vpnc amp-ain
for i in `au-sshgw gwlist | grep ^ain-` ;do
File=/opt/toolchain/utils/sshgw/files/boxes-${i}.db
[[ -f $File ]] && updFile $i $File
done
svn st /opt/toolchain/utils/sshgw/files
#sudo vpnc-disconnect
exit
fi
for i ;do
getList $i
done
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
exec valgrind --db-attach=yes --db-command='clewn -ga "%f %p"' "$@"
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
exec valgrind --db-attach=yes --db-command='ups %f %p' "$@"
-1
View File
@@ -1 +0,0 @@
/usr/bin/gvim
-1
View File
@@ -1 +0,0 @@
/usr/bin/gvim
-60
View File
@@ -1,60 +0,0 @@
#!/usr/bin/env lua
local function copyrec(s, d)
d = d or {}
for k,v in pairs(s) do d[k] = v end
return d
end
local function findandset(line, pattern, ret)
local t = { line:find(pattern) }
return t[1] and copyrec({ start = t[1], stop = t[2], select(3, unpack(t)) }, ret)
or nil
end
local function regsub_s(t, reg, sub)
local num
t.s, num = string.gsub(t.s, reg, sub, 1234567890)
return num > 0
end
local line,file,modified,pid,running
local pids = {}
local fd = io.popen("sh -c 'vi -r 2>&1'", "r")
while true do
local t = {}
line = fd:read("*line")
if not line then break end
if findandset(line, "^ *In directory (.*)", t) then
io.write(t[1].."\n")
elseif findandset(line, "^ *file name: (.*)", t) then
file = t[1]
elseif findandset(line, "^ *modified: (%a*)", t) then
modified = t[1] ~= "no"
elseif findandset(line, "^ *process ID: (%d*)(.*)", t) then
pid = t[1]
tty = { s = "" }
if string.find(t[2], "(still running)", 1, true) ~= nil then
if pids["pid-"..pid] then
tty.s = pids["pid-"..pid]
else
local ifd = io.popen("ps --no-headers --format tty --pid " .. pid, "r")
tty.s = ":" .. ifd:read("*line")
ifd:close()
if regsub_s(tty, "tty", "") then
elseif regsub_s(tty, "pts/", "pt") then
elseif regsub_s(tty, "tts/", "t") then
end
pids["pid-"..pid] = tty.s
end
end
if file and modified ~= nil then
io.write(string.format("%s %5d%-5s %s\n", modified and "+" or "-",
pid, tty.s, file))
end
line,file,modified,pid,running = nil
end
end
-2
View File
@@ -1,2 +0,0 @@
#!/bin/sh
exec ck-launch-session startxfce4
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
-28
View File
@@ -1,28 +0,0 @@
all: lint
lint: .linted
.linted: root/usr/bin/nmeamux
LUA_EXTRA='../../agentframework/lua/?' /opt/toolchain/utils/scripts/bin/lualint $< && touch $@
pak:
rm -rf amplight-solo-pak
svn export amplight-solo amplight-solo-pak
sed "s/-VVV-/$(shell pakversion gen amplight-solo )/" amplight-solo/pak-info > amplight-solo-pak/pak-info
pak create amplight-solo-pak
pak-clean:
rm -fr *-pak *.pak
doc:
amp-doxygen -W
doc-clean:
rm -rf doxygen
clean: pak-clean doc-clean
rm -fr *.bxml
rm -f ${OBJS} ${TARGETFILE} mapfile
.PHONY: all pak clean doc doc-clean
-1
View File
@@ -1 +0,0 @@
xx
-35
View File
@@ -1,35 +0,0 @@
#!/bin/ash
##
# $Id: pak-tasks 21627 2010-01-18 13:00:38Z fm $
# (C) Copyright 2009 Amplex, fm@amplex.dk
#
# ABSTRACT: Solo kick-off & cleanup on unit
##
export AGENTNAME="nmeamux"
export AGENTBIN="/usr/bin/nmeamux"
start ()
{
start-stop --start --respawn $AGENTBIN
return 0
}
stop ()
{
start-stop --stop --respawn $AGENTBIN
return 0
}
cleanup ()
{
rm -f /var/log/$AGENTNAME.log*
return 0
}
remove ()
{
cleanup()
return 0
}
@@ -1,9 +0,0 @@
#!/bin/ash
DDNS_USER=themadsens
DDNS_PW=nad3080
DDNS_DOMAIN=sysummertime.dyndns.org
wget -q -O /var/run/new.ip http://checkip.dyndns.com/index.html
if [ "`cat /var/run/new.ip`" = "`cat /var/run/cur.ip`" ] ;then
wget -q -O /dev/null "http://$DDNS_USER:$DDNS_PW@members.dyndns.org/nic/update?hostname=$DDNS_DOMAIN"
fi
mv -f /var/run/new.ip /var/run/cur.ip
@@ -1,3 +0,0 @@
#!/bin/sh
ps | grep 'lua.agent.*nmeamux' | grep -v grep | awk '{print $1}' | xargs kill
@@ -1,45 +0,0 @@
#!/bin/ash
exec 1>/dev/console 2>&1
P=/sys$DEVPATH
[ -r $P/../../uevent ] && . $P/../../uevent
[ -r $P/uevent ] && . $P/uevent
# Exit unless proper type
[ $SUBSYSTEM = "usb-serial" -a -n "$DRIVER" ] || exit 0
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
ME=${0##*/}
say ()
{
echo "$ME: $@"
logger -t $ME "$@"
}
MANU=$( ( test -r $P/../manufacturer && cat $P/../manufacturer ) || \
( test -r $P/../../manufacturer && cat $P/../../manufacturer ) || echo "generic" )
PORT=$( cat $P/port_number )
DEV_NM="$DRIVER-$(cat $P/../../idVendor)-$(cat $P/../../idProduct)"
DEVP=/dev/ttyusb/$DEV_NM
if [ $ACTION = "add" ] ;then
mkdir -p $DEVP
ln -sf /dev/$MDEV $DEVP/$PORT
say "ADD $DEVPATH MANU $MANU"
say "Add $DEVP/$PORT -> /dev/$MDEV"
if [ -n $DEVNAME ] ;then
DEVADDR=$(echo $DEVNAME | tr / _)
ln -sf /dev/$MDEV $DEVP/$DEVADDR:$(cat $P/../bInterfaceNumber)
say "Add $DEVP/$DEVADDR -> /dev/$MDEV"
fi
elif [ $ACTION = "remove" ] ;then
rm -f /dev/ttyusb/$MANU/$DEV_NM/$PORT
say "REM $DEVPATH MANU $MANU"
say "Rem $DEVP/$PORT -> /dev/$MDEV"
else
say "Unknown action $ACTION for $MDEV $MANU $DEV_NM PATH $DEVPATH"
fi
-48
View File
@@ -1,48 +0,0 @@
#! /bin/sh
#
# Beregn afhængigheder mellem moduler, opret modules.dep og load moduler fra /etc/modules.
. /etc/init.d/rcS-helper
start() {
# This will work when busysbox is configured with MODPROBE_SMALL
modprobe depmod-dummy 2>/dev/null
# Loop over every line in /etc/modules.
dmesg -n 5
echo -n 'Loading modules: '
(cat /etc/modules; echo) | # The echo make sure there is a LF at the end.
while read module args; do
case "$module" in
\#*|"") continue ;;
esac
echo -n "$module: "
modprobe $module $args
done
echo ''
dmesg -n 7
}
stop() {
:
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
-49
View File
@@ -1,49 +0,0 @@
#!/bin/sh
#
# Mdev coldplugging
#
start() {
# Autodetection of hardware
echo -n "Autodetecting hardware ."
MODALIAS=`find /sys/devices -iname modalias -exec cat {} \;`
while [ `echo "$MODALIAS"|wc -l` -gt `echo "$TMODALIAS"|wc -l` ]; do
echo -n "."
for i in $MODALIAS; do
/sbin/modprobe $i 2>/dev/null
done
[ "$VERBOSE" ] && echo Loaded `echo "$MODALIAS"|wc -l` modaliases
[ "$DRV_WAIT" -gt 0 ] && sleep $DRV_WAIT
TMODALIAS="$MODALIAS"
MODALIAS=`find /sys/devices -iname modalias -exec cat {} \;`
done
echo " done."
}
stop() {
:
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
-6
View File
@@ -1,6 +0,0 @@
#!/bin/ash
modprobe rfcomm
rfcomm bind 0 00:0B:0D:6C:6B:EB
start-stop --start --respawn /usr/bin/nmeamux
-2
View File
@@ -1,2 +0,0 @@
sd[a-z] 0:0 660 - */sbin/hotplug usb
ttyUSB[0-9]* 0:0 660 - */sbin/hotplug usbtty
-607
View File
@@ -1,607 +0,0 @@
#!/usr/bin/env lua-agent
--[[
- @file nmeamux
- ABSTRACT HERE <<
-
- $Id$
-
- (C) Copyright 2011 Amplex, fm@amplex.dk
--]]
require "stdlib" .include { "seq", "list" }
require "posix"
require "socket"
require "Class"
require "trace"
local NIL = Class.NIL
local list = _G.list
local sampleConf
local iometa = getmetatable(io.stdin)
if iometa.fileno and not iometa.getfd then iometa.getfd = iometa.fileno end
local function getMsecs()
local now, mSec = appc.systemTime()
return now * 1000 + mSec
end
local L_OPEN_RETRY = 5 * 1000
local DutyCycle = Class(nil, "DutyCycle", {
mInterval = 1,
mPort = NIL,
mPrefix = NIL,
mTail = NIL,
mLastLog = NIL,
})
function DutyCycle.new(class, port, pfx)
local now = getMsecs()
return class:_new():_merge { mPort = port, mPrefix = pfx , mTail = tnew{}, mLastLog = now }
end
---
-- Keep track of bandwidth etc.
function DutyCycle:add(str)
local now = getMsecs()
local start = now - math.floor(self.mInterval * 1000)
local tail = self.mTail
while #tail > 0 and tail[#tail].t < start do tail:remove() end
self.mTail:insert(1, {t = now, s = str:sub(1,6), l = #str})
if self.mLastLog < start then
local sum, sums = 0, {}
for _,ent in ipairs(tail) do
sum = sum + ent.l
sums[ent.s] = 1 + (sums[ent.s] or 0)
end
local names = List(seq.all_keys(sums)):sort()
log.notice(("PORT:%-12s %s:%3d%% %3d %s"):_(self.mPort.mName, self.mPrefix,
idiv(sum * 1000, self.mPort.mSpeed), sum,
List(seq.map(|n|("%s:%d"):_(n, sums[n]), list.iter(names))):concat(",")))
self.mLastLog = now
end
end
local nodes = {}
local sysmon
local sysstat= {} -- pos, sog, cog, stw, hdg, dpt, wrv, wrb,
--------------------------------------------------------------------
-- NmeaNode
-- Handle node graph and telnet connections
--------------------------------------------------------------------
local NmeaNode = Class(nil, "NmeaNode", {
mName = NIL,
mInputs = NIL,
mSinks = NIL,
mPortNo = NIL,
mPortSock = NIL,
mListeners = NIL,
mSubscriptions = NIL,
})
---
-- Create a generic node
function NmeaNode.new(_class, name, cfg)
return _class:_new():_merge {
mName = name,
mInputs = cfg.inputs,
mSinks = {},
mPortNo = cfg.port,
mListeners = {},
mSubscriptions = {},
}
end
---
-- Data forwarding
function NmeaNode:processInput(str)
-- Simple relay
log.debug(||("NODE:%-12s READ: %t"):_(self.mName, str))
for sink, ix in pairs(self.mSinks) do
sink:processInput(str, ix)
end
for l,_ in pairs(self.mListeners) do
l:send(str.."\r\n")
end
end
---
-- Register a data sink
function NmeaNode:addSink(new, ix)
-- Simple relay
self.mSinks[new] = ix
end
---
-- Read input from a connected peer.
-- Override and embed in derived classes to read input
function NmeaNode:readClient(subscr, inp)
local res, err = posix.read(inp:getfd())
log.debugonly(||("PORT:%-12s NET:%d:%s: %s"):
_(self.mName, inp:getfd(), err or "OK", (res or ""):quotebin()))
if not res or res == "" then
log.notice(("PORT:%-12s Connection %d closed"):_(self.mName, inp:getfd()))
self.mListeners[inp] = nil
self.mSubscriptions[subscr] = nil
subscr:clear()
inp:close()
return nil
end
return res
end
---
-- Startup system interaction
function NmeaNode:start(str)
for ix,s in ipairs(self.mInputs or {}) do
assert(nodes[s], ("No input: %s"):_(s)):addSink(self, ix)
end
if not self.mPortNo then return end
if self.mPortNo then
local sock, err = socket.bind("0.0.0.0", self.mPortNo)
self.mPortSock = assert(sock, ("Can not open listen on %d: %t"):_(self.mPortNo, err))
local subscr = appc.addFileIO(self.mPortSock:getfd(), function(subscr)
local inp = self.mPortSock:accept()
log.notice(("PORT:%-12s Connection %d opened from %t"):
_(self.mName, inp:getfd(), inp:getpeername()))
local subscr = appc.addFileIO(inp:getfd(), function(subscr)
self:readClient(subscr, inp)
end)
self.mSubscriptions[subscr] = true
self.mListeners[inp] = true
end)
self.mSubscriptions[subscr] = true
end
end
---
-- Cleanup subscriptions & listeners
function NmeaNode:clear()
for l,_ in pairs(self.mSubscriptions) do l:clear() end
for l,_ in pairs(self.mListeners) do l:close() end
self.mSubscriptions = NIL
self.mListeners = NIL
if self.mPortSock then self.mPortSock:close() end
self.mPortSock = nil
end
function NmeaNode:__gc() return self:clear() end
--------------------------------------------------------------------
-- NmeaOutput
--------------------------------------------------------------------
local NmeaOutput = Class(NmeaNode, "NmeaOutput", {
mOutput = NIL,
})
---
-- Create an output node
function NmeaOutput.new(_class, name, cfg)
return NmeaOutput:getSuper().new(_class, name, cfg):_merge {
mOutput = assert(cfg.output)
}
end
---
-- Startup system interaction
function NmeaOutput:start(str)
NmeaOutput:getSuper().start(self, str)
self:addSink(nodes[self.mOutput], 1)
end
--------------------------------------------------------------------
-- NmeaPort
--------------------------------------------------------------------
local NmeaPort = Class(NmeaNode, "NmeaPort", {
mPath = NIL,
mSpeed = NIL,
mDutyIn = NIL,
mDutyOut = NIL,
mSerialPort = NIL,
mLineBuffer = NIL,
})
local RawPort
function NmeaPort.new(_class, name, cfg)
local new = RawPort.new(_class, name, cfg)
return new:_merge {
mDutyOut = DutyCycle(new, "O"),
mDutyIn = DutyCycle(new, "I"),
mLineBuffer = tnew {},
}
end
---
-- Startup system interaction
function NmeaPort:start(str)
NmeaPort:getSuper().start(self, str)
return self:reOpen()
end
local function nmeaReadPort(self, port, subscr)
local str, err = posix.read(port:getfd())
if not str or str == "" then
log.error(("PORT:%-12s REOPEN: Failed to read %t: %t"):_(self.mName, self.mPath, err))
port:close()
self.mSerialPort = nil
subscr:clear()
self.mSubscriptions[subscr] = nil
appc.addTimer(L_OPEN_RETRY, function() self:reOpen() end)
return
end
-- TODO: Reopen on error
log.debugonly(||("PPPPORT:%-12s INP:%d:%s: %s"):
_(self.mName, port:getfd(), err or "OK", (str or ""):quotebin()))
if self.mLineBuffer then
local where,whend = str:find("[\r\n]+")
if where then
while where do
self.mLineBuffer:append(str:sub(1, where - 1))
local line = self.mLineBuffer:concat()
if #line > 0 then
--NmeaPort:getSuper().processInput(self, ("%d%s"):_(#self.mLineBuffer,line))
self.mDutyIn:add(str)
NmeaPort:getSuper().processInput(self, line)
end
str = str:sub(whend + 1, -1)
where,whend = str:find("[\r\n]+")
self.mLineBuffer = tnew {}
end
self.mLineBuffer = tnew { str }
else
self.mLineBuffer:append(str)
end
else
log.debugonly(||("PORT:%-12s INP:%d:%s: %s"):
_(self.mName, port:getfd(), err or "OK", (str or ""):quotebin()))
for l,_ in pairs(self.mListeners) do
l:send(str)
end
end
end
---
-- Startup system interaction
function NmeaPort:reOpen()
local port, err = io.open(self.mPath, "r+")
log.debugonly(||("REOPEN:%s %s -> %t, %t"):_(self.mName, self.mPath, port, err))
if not port then
log.error(("PORT:%-12s Failed to open %s: %s"):_(self.mName, self.mPath, err))
appc.addTimer(L_OPEN_RETRY, function() self:reOpen() end)
return
end
self.mSerialPort = port
if self.mSpeed and self.mSpeed > 0 then
os.execute(("stty %d raw -echo -parenb cs8 min 50 time 1 < %s"):_(self.mSpeed, self.mPath))
end
local subscr = appc.addFileIO(self.mSerialPort:getfd(), function(subscr)
return nmeaReadPort(self, port, subscr)
end)
self.mSubscriptions[subscr] = true
end
---
-- Cleanup subscriptions & listeners
function NmeaPort:clear()
NmeaPort:getSuper().clear(self)
if self.mSerialPort then self.mSerialPort:close() end
self.mSerialPort = nil
end
---
-- Data forwarding
function NmeaPort:processInput(str)
if self.mDutyOut then self.mDutyOut:add(str) end
log.debug(||("OUTP:%-12s W: %t"):_(self.mName, str))
posix.write(self.mSerialPort:getfd(), str.."\r\n")
-- if self.mLineBuffer then sysmon:addOut(self, str:sub(1,6)) end
end
---
-- Read input from a connected peer.
function NmeaPort:readClient(subscr, inp)
local str = NmeaPort:getSuper().readClient(self, subscr, inp)
local fd = self.mSerialPort:getfd()
if str and not self.mLineBuffer then
log.debugonly(||("PORT:%-12s OUT:%d:%s: %s"):
_(self.mName, fd, err or "OK", (str or ""):quotebin()))
posix.write(fd, str)
end
end
-- Must delay 'til after NmeaPort methods dur to Class.lua idiosyncasies
-- Create a NmeaNode sans the mLineBufer etc
RawPort = Class(NmeaPort, "RawPort", {})
---
-- Create an output node
function RawPort.new(_class, name, cfg)
return NmeaNode.new(_class, name, cfg):_merge {
mPath = assert(cfg.path),
mSpeed = assert(cfg.speed),
}
end
function RawPort:processInput(str)
log.debug(||("OUTRAW:%-12s W: %t"):_(self.mName, str))
posix.write(self.mSerialPort:getfd(), str)
end
--------------------------------------------------------------------
-- NmeaFilter
--------------------------------------------------------------------
local NmeaFilter = Class(NmeaNode, "NmeaFilter", {
mPosList = NIL,
mNegList = NIL,
mAuxList = NIL,
mPrioTout = NIL,
mPrioList = NIL,
})
---
-- Create an output node
function NmeaFilter.new(_class, name, cfg)
return NmeaFilter:getSuper().new(_class, name, cfg):_merge {
mPosList = cfg.pos,
mNegList = cfg.neg,
mAuxList = cfg.aux,
mPrioTout = cfg.prio_delay,
mPrioList = {},
}
end
---
-- Startup system interaction
function NmeaFilter:start(str)
NmeaFilter:getSuper().start(self, str)
self.mAuxList = List(seq.map(function(cls) return cls() end, self.mAuxList or {}))
end
---
-- Data forwarding
function NmeaFilter:processInput(str, ix)
if self.mNegList then
for _,p in ipairs(self.mNegList) do
if str:find(p) then
log.debug(||("NREJ:%-12s NEG:%s: %t"):_(self.mName, p, str))
return
end
end
end
if self.mPosList then
local pass
for _,p in ipairs(self.mPosList) do
if str:find(p) then
pass = true
break
end
end
if not pass then
log.debug(||("PREJ:%-12s READ: %t"):_(self.mName, str))
return
end
end
if self.mAuxList then
for _,aux in ipairs(self.mAuxList) do
aux:process(self, str, function(str) self:passItOn(str, ix) end)
end
else
self:passItOn(str, ix)
end
end
---
-- Implement priority shadowing
function NmeaFilter:passItOn(str, ix)
if self.mPrioTout then
local now = getMsecs()
local stmt = str:sub(1,6)
local old = self.mPrioList[stmt]
if old and (now - old.timeStamp) < self.mPrioTout and old.prio < ix then
log.debug(||("TREJ:%-12s READ: %t"):_(self.mName, str))
return -- He wins
end
self.mPrioList[stmt] = { timeStamp = now, prio = ix }
end
return NmeaFilter:getSuper().processInput(self, str, ix)
end
--------------------------------------------------------------------
-- NilFilter
--------------------------------------------------------------------
local NilFilter = Class(nil, "NilFilter", {})
function NilFilter:process(port, str, out)
out(str)
end
--------------------------------------------------------------------
-- AisFilter
--------------------------------------------------------------------
local AisFilter = Class(NilFilter, "AisFilter", {mDb = NIL})
--------------------------------------------------------------------
-- GpsComp
--------------------------------------------------------------------
--
local GpsComp = Class(NilFilter, "GpsComp", {mDb = NIL})
--------------------------------------------------------------------
-- MONITOR
--------------------------------------------------------------------
local SysMon= Class(nil, "SysMon", {
mPort = NIL,
mQueue = NIL,
mTimer = NIL,
mIndex = NIL,
})
function SysMon:runTimer()
end
local SysMonTon = Class(nil, "SysMonTon", {
mSysMons = NIL,
mNames = NIL,
mListeners = NIL,
mSocket = NIL,
})
function SysMonTon:openPort(port)
end
function SysMonTon:addIn(port, snt, out)
local q = self.mSysMons[port].mQueue[out and 2 or 1]
q:insert(snt)
sysmon:LineStat(self.mSysMons[port], out)
self.mSysMons[port]:runTimer()
end
function SysMonTon:addOut(port, snt)
return self:addIn(port, snt, true)
end
function SysMonTon:addPort(port)
if self.mSysMons[port] then return end
self.mNames:insert(port.mName)
self.mNames:sort()
for ix,nm in ipairs(self.mNames) do
if nm == port.mName then
self.mSysMons[port] = SysMon { mIndex = ix, mQueue = {{}, {}}, mPort = port }
end
end
end
local function startMonitor(port)
sysmon = SysMonTon { mSysMons = {}, mListeners = {}, mNames = tnew {} }
sysmon:openPort(port)
end
--------------------------------------------------------------------
-- SYSTEM
--------------------------------------------------------------------
local testConf
--[[
= {
outputs = {
testout = { inputs = { "testfilter" }, output = "rawport", port=27002 },
},
nmeaports = {
testgps = { path = "/dev/ttyUSB0", speed=4800 , port=26001},
testport = { path = "/dev/ttyUSB1", speed=4800 , port=26002},
},
rawports = {
rawport = { path = "/dev/ttyUSB2", speed=38400 , port=25006},
},
filter = {
testfilter = { inputs = { "testport", "testgps" } , port=28001,
neg = { "^...GGA", }, prio_delay=2500, aux = {AisFilter} },
},
}
--]]
---
-- Startup system after all nodes are brought into existence
local function startSystem()
for name,n in pairs(nodes) do
n:start(name)
end
end
local function getConf()
-- TODO: Find a configuration
end
local function configure(config)
for cfgNode, classFactory in pairs {
nmeaports = NmeaPort,
rawports = RawPort,
outputs = NmeaOutput,
filter = NmeaFilter,
}
do
for name, cfg in pairs(config[cfgNode] or {}) do
assert(nodes[name] == nil)
nodes[name] = classFactory(name, cfg)
end
end
end
local function runGC()
collectgarbage("collect")
log.notice(("! MEM: %.2f"):_(collectgarbage("count")))
appc.addTimer(10 * 1000, runGC)
end
local function main(args)
--trace.on()
local conf = getConf() or testConf or sampleConf
if not log.debug() and args[1] and args[1] == "trace" then
local traceLog = log.create("nmeamux-trace.log", 0, false, 8000)
log.debugonly = function() end
log.debug = function(str)
if not str then return false end
if type(str) == "function" then str = str() end
return traceLog:log(str)
end
else
log.debugonly = log.debug
end
configure(conf)
startMonitor(117)
startSystem()
runGC()
end
local NM_GPS = { "^...GGA", "^...GSA", "^...RMC", "^...GSV", }
sampleConf = {
outputs = {
instruments = { inputs = {"p_lospeed_1", "nogps", "autopilot"} , port=27001,
output = "p_lospeed_1" },
--sfeed = { inputs = { "gps_bkhousemux" }, output = "p_lospeed_2", port=27002 },
gpsfeed = { inputs = { "gpsmin" }, output = "p_lospeed_2", port=27002 },
garmin_nmea = { inputs = { "p_lospeed_1", "p_lospeed_2", "aisfilter", "nogps", "gps" },
output = "p_hispeed", port=27003 },
},
nmeaports = {
p_lospeed_1 = { path = "/dev/ttyusb/mos7840-9710-7840/0", speed=4800 , port=26001},
p_lospeed_2 = { path = "/dev/ttyusb/mos7840-9710-7840/1", speed=4800 , port=26002},
p_hispeed = { path = "/dev/ttyusb/mos7840-9710-7840/2", speed=38400 , port=26003},
p_gps = { path = "/dev/rfcomm0", speed=38400 , port=26004},
p_ais = { path = "/dev/ttyusb/ftdi_sio-0403-6001/0", speed=38400 , port=25001},
-- p_ais = { path = "/dev/ttyS1", speed=38400 , port=25001},
-- p_gps = { path = "/dev/ttyS1", speed=38400 , port=26004},
p_bkhousemux = { path = "/dev/ttyusb/pl2303-067b-2303/bus_usb_001_009:00",
speed=38400 , port=25005},
},
rawports = {
p_pactor = { path = "/dev/ttyusb/ftdi_sio-0403-d010/0", speed=9600 , port=25002},
p_garmin1 = { path = "/dev/ttyusb/mos7840-9710-7840/3", speed=9600 , port=25003},
p_garmin2 = { path = "/dev/ttyS1", speed=9600 , port=25004},
p_navtex = { path = "/dev/ttyusb/pl2303-067b-2303/bus_usb_001_010:00",
speed=38400 , port=25006},
},
filter = {
nogps = { inputs = { "p_bkhousemux" }, neg = NM_GPS , port=28001, },
gps = { inputs = { "p_gps", "p_bkhousemux", "aisfilter"} , port=28002,
pos = NM_GPS, aux={GpsComp}, prio_delay=2500 },
gpsmin = { inputs = { "gps", pos = { "^...RMC" } } },
autopilot = { inputs = { "p_hispeed" } , port=28003,
pos = { "^...XTE", "^...WPT" } },
aisfilter = { inputs = { "p_ais" } , port=28004,
aux = {AisFilter} }
},
}
return ac.ADDR_TRANSIENT, main
-- vim: set sw=3 sts=3 et nu:
Binary file not shown.
View File
File renamed without changes.