for i in alias array autocmd backtick browse cachedesc calc complete fold g hlobject hlsearch image incsearch litre lpr make mapdb misc mkexrc normal proto ram rcsid showtag smartargs spell split tags textobj v
do {
if feature(i)
then {
if strlen(l;f i) > columns-2
then {
calc l;f
set l=" " f=""
}
let f=f i
}
}
if f != ""
then calc l;f
}
alias! customize {
"Edit a personal copy of one of elvis' configuration files
local d o n f="!^"
if f == ""
then error :customize requires the name of a configuation file
let o = elvispath(f)
if o == ""
then error "!^" is not a known configuration file
if os=="msdos" || os=="os2" || os == "win32"
then let d=$HOME/"elvislib"
else let d=$HOME/".elvislib"
if dirperm(d) == "new"
then eval !mkdir "(d)"
let n = d / f
if exists(n)
then e (n)
else {
e (o)
(=o) file (n)
(=n)se noro
}
}
alias! left {
"Move text to the left side of each line
local report=0 magic magicchar=^$.[*
!%s/^\s*
!%s/\s*$
}
alias! right {
"Move text to the right side of each line
local w report=0 magic magicchar=^$.[*
!%left
try !%s/ \{2,}/ /g
let w = (textwidth == 0) ? columns : textwidth
eval !%s/.$/&("" << w)
eval !%s/^\\\(.\\{(w)}\\\).*/\\1
!%s/^\(.*[^ ]\)\( \+\)$/\2\1/
}
alias! center {
"Move text to the center of each line
local report=0 magic magicchar=^$.[*
!%right
!%s/ / /g
}
alias! rot13 {
"Perform rot-13 encryption/decryption
local i report=0 magic magicchar=^$.[*
for i (0..12)
do {
try eval !%s/(char(i + 'a'))/<TEMP>/g
try eval !%s/(char(i + 'n'))/(char(i + 'a'))/g
try eval !%s/<TEMP>/(char(i + 'n'))/g
try eval !%s/(char(i + 'A'))/<temp>/g
try eval !%s/(char(i + 'N'))/(char(i + 'A'))/g
try eval !%s/<temp>/(char(i + 'N'))/g
}
}
alias! cfmt {
"Adjust C or C++ comment block. Omit the */ line from range.
local report=0 nosaveregexp magic magicchar=^$.[*
if !< == !>
then error you must invoke cfmt with a range of two or more lines
!>a STOP!!
try !%s/^\(\s*\)\/\/\s*/\1/
then {
"C++ comments, already removed the //
!%!!fmt
!<,/^STOP!!$/- s/^\s*/&\/\/ /
}
else {
"C comments, still need to remove the /* or *
!<s,^\s*\([/ ]\*\)\s*,let a="\1",x
!%s,^\(\s*\)[/ ]\*\s*,\1,
!%!!fmt
eval !< s,^\\s*,&(a) ,
try !<+,/^STOP!!$/- s,^\s*,& * ,
}
/^STOP!!$/d
}
alias! wascii {
"Write formatted text as plain ASCII
local lptype=dumb nolpheader lplines=0
if "!*" == ""
then error You must specify a file name
!% lp!? !*
}
alias! lpd {
"Print text using the current display mode
local bufdisplay
let bufdisplay=display
!%lpr!? !*
}
if feature("fold")
then {
alias! foldc {
" Fold C functions and conditional code
local l magic magicchar=^$.[*
let l = current("line")
" This alias works around a bug -- The :g command gets confused by
" the :fold command, apparently because it changes the definition of
" `line' as the :g is running. The work-around is to use :unfold
" until all of the :g commands are finished, and then do :%fold! to
" fold them.
" #if and #else directives
g/^\s*#\s*[ie][fl]/ {
local t a z
let t = quote("()$",line())
let a = current("line");
normal ^%
eval (a),- unfold (t)
}
" function bodies
if feature("showtag")
then {
g/^{/ {
if current("tag")
then .,/^}/ unfold { (current("tag")) }
else .,/^}/ unfold { ... }
}
}
else g/^{/,/^}/ unfold { ... }
" now fold everything
%fold!
eval (l)
}
}
alias! sperror {
" Show the errors from a :make or :cc command, in a new window
if !window("Elvis error list")
then (Elvis error list)split
}
alias! makehtml {
"Convert plain text to HTML source
local report=0 m=text n=text b=false magic magicchar=^$.[*
"
" m is current line mode -- one of "text", "pre", "ol", or "ul"
" n is next line mode
" b is a flag for detecting series of blank lines.