« get me outta code hell

dotfiles - Miscellaneous configuration files of my personal use
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.vim/pack/editing/start/vimacs/doc/vimacs.txt1366
-rw-r--r--.vim/pack/editing/start/vimacs/plugin/vimacs-0.93.vim931
2 files changed, 2297 insertions, 0 deletions
diff --git a/.vim/pack/editing/start/vimacs/doc/vimacs.txt b/.vim/pack/editing/start/vimacs/doc/vimacs.txt
new file mode 100644
index 0000000..969e456
--- /dev/null
+++ b/.vim/pack/editing/start/vimacs/doc/vimacs.txt
@@ -0,0 +1,1366 @@
+*vimacs.txt*	Vimacs: Emacs mappings (emulation) for Vim
+
+|Vimacs.01|	Introduction
+|Vimacs.02|	Installing Vimacs
+|Vimacs.03|	Vimacs Options
+|Vimacs.04|	Changes for Emacs users
+|Vimacs.05|	Changes for Vim users
+|Vimacs.06|	Key Map
+|Vimacs.07|	Design Comments
+|Vimacs.08|	Known Problems
+|Vimacs.09|	Revision History (ChangeLog)
+|Vimacs.10|	In the Future ... (TODO list)
+|Vimacs.11|	Contact, Help, Credits
+
+
+==============================================================================
+*Vimacs.01*  Introduction
+
+						*vimacs*
+
+						*vimacs-introduction*
+
+Vimacs (Vim-Improved eMACS) brings Emacs' extensive key bindings and modeless
+editing features to the Vim world, while completely retaining Vim's
+powerful moded editing style.
+
+Vimacs is based on the keymaps of GNU Emacs 21 and XEmacs, so if you are
+familiar with them, you'll feel right at home in Vimacs.  For Emacs users,
+most (if not all) of the common key maps in Emacs are present in Vimacs, such
+as <C-Space>, <C-w> and <C-y> to mark, kill and yank regions, <C-x><C-f> to
+find a file, and <C-x>2 to vertically split a window.  However, you can now
+take advantage of the incredible power of Vim's Normal and Command modes with
+a touch of the <Esc> key.
+
+Why use Vimacs instead of Emacs?  Vim's configuration and option tweaking is
+arguably much easier than doing the same task in the Emacs world; its
+scripting language is simpler and more conventional than LISP, and still very
+powerful.  Python, Perl, and |libcall()| (C library interface) support allow
+for incredibly powerful scripting if you need something which is the equal of
+ELISP.  Vim is heavily optimised for speed and text editing; you may find Vim
+to be much quicker in many tasks.  While Emacs and Vim may run on equally as
+many platforms, Vim often has superior support for non-Unix operating systems
+in comparison to Emacs; e.g. Vim for Win32 can natively function as a DDE
+server and can integrate into Microsoft Visual Studio.
+
+If you're a long-time Vim user, you retain vi's powerful moded editing
+paradigm while gaining all the benefits of Emacs' modeless editing.  After a
+while, the <C-a> and <C-e> keys will become second nature to you, just as
+you're used to the |h|, |j|, |k|, and |l| keys for movement.  Some of the keys
+familiar to you in Insert mode have been changed, but you won't take long to
+get used to Emacs' keys: just like Vim, Emacs' key layout has been designed so
+that commonly used keys are quick to access.  Emacs' initially strange key
+layout will reward you later on for its efficiency, just like Vim does.  Emacs
+experts are just as fast as Vim experts in manipulating text, and as a bonus,
+you start becoming familiar with Emacs keybindings, which are gradually
+becoming more pervasive in Unix applications.  (Even MacOS X supports some
+Emacs keys in its dialog boxes!)
+
+						*vimacs-terminology*
+						
+Vim and Emacs use different (and sometimes conflicting) terminology.  Since
+Vimacs runs within the Vim environment, we will use the Vim terminology rather
+than Emacs terminology.
+
+	Emacs Terminology	Vim Terminology
+
+	(key)binding		map
+	point			cursor
+	kill			yank
+	yank			paste
+	register		mark
+	rectangle		block
+	kill-ring		registers
+
+It is Vim standard that key bindings are written in |<>| notation; thankfully
+this is essentially the same as Emacs' key binding notation.  In Emacs, the
+key combination Control-x followed by Control-f is written as "C-x C-f"; in
+Vim, this is written as "<C-x><C-f>".  Meta-f in Emacs is written as "M-f"; in
+Vim, this is written as "<M-f>" or "<A-f>".  (The 'A' stands for Alt; in Vim,
+there is no distinction between the Meta and Alt keys.)  Vim helpfiles also
+use a |CTRL-X_CTRL-F|-style notation; Vimacs-specific keys will use a
+|vimacs:CTRL-X_CTRL-F| notation.
+
+For the gory details of Vim notation, see |notation|.
+
+						*vimacs-help-navigation*
+
+Emacs users: If you are not in insert mode (if you do not see a line at the
+bottom of the screen saying "-- INSERT MODE --"), use <C-]> to follow a link,
+and <C-t> to go back a link.  If you are using Vimacs keybindings and are in
+Insert mode, you can follow a help link such as |vimacs-introduction| by
+moving your cursor over it and pressing <M-.>.  This is the same as Emacs'
+typical <M-.> keybinding, which is the |vimacs:find-tags| command.  Jump back
+to your previous position using the <M-*> key.
+
+Vim users: Pressing <M-.> in Insert mode performs the same function as
+|CTRL-]| in Normal mode.  <M-*> is equivalent to |CTRL-T|.
+
+
+==============================================================================
+*Vimacs.02*  Installing Vimacs
+
+						*vimacs-quickstart*
+
+The following quick start guides are for Win32 and Unix systems.  Detailed
+installation instructions follow afterward.
+
+						*vimacs-win32-quickstart*
+
+Firstly, you'll need Vim 6 installed.  Vimacs won't work on older
+versions.
+
+To install Vimacs, copy the .txt file in the archive to your Vim
+documentation directory (typically "C:\Program Files\vim\vimfiles\doc"),
+and copy the .vim file to your plugin directory (typically "C:\Program
+Files\vim\vimfiles\plugin").
+
+See the |vimacs-installation| topic in the main Vimacs help file for full
+information.
+
+						*vimacs-unix-quickstart*
+
+Firstly, you'll need Vim 6 installed.  Vimacs won't work on older
+versions.  So, make sure you're running Vim 6:
+>
+	vim --version | head -1
+<
+The reply you get should say "VIM - Vi IMproved 6.0" (or higher).
+
+To install Vimacs, execute the following commands in your shell:
+>
+	mkdir -p $HOME/.vim/doc
+	mkdir -p $HOME/.vim/plugin
+	cp -R doc plugin $HOME/.vim
+<
+Run the following command in a shell to make Vim rescan your documentation
+directory:
+>
+	vim --cmd "helptags $HOME/.vim/doc" --cmd "q"
+<
+That's it.  If you're a Vim user, Emacs key mappings will now be enabled
+whenever you're in Vim's Insert mode.  If you're an Emacs user and have
+never used Vim before, you probably want to always keep Vim in Insert
+Mode, and use Select mode rather than Visual mode:
+>
+	echo 'set insertmode' >> $HOME/.vimrc
+	echo 'set selectmode += cmd' >> $HOME/.vimrc
+<
+Vimacs is now completely installed.  However ...
+
+If you want to have a more sophisticated setup, where you can type a
+different command (such as 'vimacs') to always start in Insert mode, but
+typing 'vim' starts Vim in Normal mode, read on.
+
+Put the shell script located at plugin/vimacs/vim somewhere in your $PATH,
+and symlink it to the appropriate files.  Change the $myscriptdir variable
+below to whatever directory you use for scripts; if you don't currently
+have one, you'll need to mkdir the directory and add it to your $PATH.
+(Consult your local Unix expert on adding directories to your $PATH if you
+don't know how to do this.)
+>
+	myscriptdir=$HOME/bin
+	mkdir -p $myscriptdir
+	cp plugin/vimacs/vim $myscriptdir
+	chmod 755 $myscriptdir/vim
+	ln -s $myscriptdir/vim $myscriptdir/gvim
+	ln -s $myscriptdir/vim $myscriptdir/vm
+	ln -s $myscriptdir/vim $myscriptdir/gvm
+	ln -s $myscriptdir/vim $myscriptdir/vimacs
+	ln -s $myscriptdir/vim $myscriptdir/gvimacs
+	myscriptdir=
+<
+For more detailed installation instructions, see |vimacs-installation| in
+the Vimacs help file.
+
+						*vimacs-installation*
+
+Vimacs is designed for Vim 6 only; if you are running Vim 5.x, please upgrade
+to Vim 6.  There is no intention to `port' Vimacs to run on older versions of
+Vim.
+
+Vimacs is a Vim 6 plugin; simply drop it into any Vim plugin directory, such
+as "$HOME/.vim/plugin" on a Unix system, or "C:\Program
+Files\vim\vimfiles\plugin" on Windows.  You may also want to place this
+documentation (the "vimacs.txt" file) in a Vim documentation directory; e.g.
+"$HOME/.vim/doc", or "C:\Program Files\vim\vimfiles\doc".  You should run the
+|:helptags| command on the documentation directory after installation; see
+|add-local-help| for more information.
+
+Vimacs does not initially start in Insert mode, to be consistent with what Vim
+users normally expect.  If you an Emacs user, you may wish to put
+>
+	set insertmode
+	set selectmode += cmd
+<
+in your |.vimrc| startup file, so that you use a more Emacs-like selection
+mode, as well as being in Insert mode straight away.
+
+Please read the |vimacs-unix| section if you are running Vimacs on a Unix
+systems, and |vimacs-non-unix| if you are installing Vimacs on other operating
+systems (e.g. Windows, Macintosh).
+
+						*vimacs-unix*
+						*vimacs-unix-flow-control*
+
+Like Emacs, Vimacs uses the <C-s> key to search, and <C-q> to insert the next
+character literally ('quoted-insert' in Emacs-speak; normally <C-v> in Vim).
+
+In many Unix terminals, <C-s> and <C-q> are flow control characters used to
+stop and start terminal output, which means that Vim will look like it has
+frozen when you press <C-s>.  (This problem only affects the Unix console
+version of Vim; gvim is not affected.)  Emacs modifies your terminal's
+settings, so it doesn't normally have this problem.  Vim, however, does not
+modify terminal settings, and thus you need to explicitly turn off flow
+control.
+
+To solve the <C-s>/<C-q> flow control problem, you need to turn off XON/XOFF
+flow control processing for your tty.  The stty(1) command will do this: 
+>
+	$ stty -ixon -ixoff
+<
+You may wish to make a shell script somewhere in your path to do this
+automatically, e.g.
+>
+	$ cat << END > $HOME/bin/vim
+	#!/bin/sh
+
+	# turn off flow control if we're a terminal
+	[ -t 0 ] && stty -ixon -ixoff
+
+	exec /usr/bin/vim "$@"
+	END
+<
+For a more in-depth example of using a wrapper shell script to initialise Vim
+(and Vimacs) to your choosing, see |vimacs-unix-progname|
+
+						*vimacs-unix-meta-sends-esc*
+
+This applies to the console version of Vim only (i.e. not gvim).  On many Unix
+terminals, the Meta key typically generates an <Esc> followed by the
+combination key; for example, pressing <M-x> generates the key sequences
+<Esc>x.  However, you may have a terminal emulator that sends <M-x> as an 'x'
+with the 8th bit set, rather than as <Esc>x.  Most Unix terminal emulators,
+(including xterm) have an option to do this, but do not enable it by default.
+If your terminal sends <M-x> as x with the 8th bit set, set the
+|'g:VM_UnixConsoleRemapEsc'| option to 1.
+
+NOTE: This is not a Vimacs-specific problem; Vim also has to work around this
+issue, with options like 'esckeys', 'timeout' and 'ttimeout'.
+
+						*vimacs-unix-progname*
+
+Via the magic of shell scripts (and symlinks), it's possible to change the
+default behaviour of Vimacs, depending on what you typed to run it.  For
+example:
+
+	Command name	Load Vimacs?	Start in/use Insert mode?
+
+	(g)vim		yes		no/no
+	(g)vimacs	yes		yes/yes
+	(g)vm[1]	yes		yes/yes
+
+	1. `vm' is an abbreviation for `ViMacs'
+
+To do the above, firstly, make a directory to store programs and scripts in,
+and add that directory to your $PATH:
+>
+	$ mkdir $HOME/bin 
+	$ export PATH="$HOME/bin:$PATH"
+<
+Save the following shell script in the above directory as "vim".  For
+convenience, this script is also available in the plugin/vimacs directory;
+simply copy it to $HOME/bin/vim.
+>
+	#!/bin/sh
+	
+	# real path to vim
+	VIM_CMD=${VIM_CMD:-/usr/bin/vim}
+	GVIM_CMD=${GVIM_CMD:-/usr/bin/gvim}
+	
+	# what program name was i run as?
+	argv0=`basename $0`
+	
+	# turn off software flow control so <C-s> and <C-q> will work. you can add
+	# extra stty settings by setting $VIM_STTY (i use 'erase ^?' here)
+	[ -t 0 ] && stty -ixon -ixoff $VIM_STTY
+	
+	case "$argv0" in
+	  g*)
+	    VIM_CMD="$GVIM_CMD"
+	    ;;
+	esac
+	
+	case "$argv0" in
+	  *diff)
+	    VIM_CMD="${VIM_CMD}diff"
+	    ;;
+	esac
+	
+	case "$argv0" in
+	  # This case has to come before *vim*, since *vim* will match *vimacs*
+	  *vm*|*vimacs*)
+	    exec $VIM_CMD --cmd "let g:VM_Enabled = 1" \
+			  --cmd "set insertmode" \
+			        "$@"
+	    ;;
+	  *vim*)
+	    exec $VIM_CMD --cmd "let g:VM_Enabled = 1" \
+	                        "$@"
+	    ;;
+	esac
+	
+<
+Now, make your vim command executable:
+>
+	chmod a+x $HOME/bin/vim
+<
+Finally, make symlinks from the `vim' shell script to the other commands
+you'll be running it as:
+>
+	ln -s $HOME/bin/vim $HOME/bin/gvim
+	ln -s $HOME/bin/vim $HOME/bin/vm
+	ln -s $HOME/bin/vim $HOME/bin/gvm
+	ln -s $HOME/bin/vim $HOME/bin/vimacs
+	ln -s $HOME/bin/vim $HOME/bin/gvimacs
+	ln -s $HOME/bin/vim $HOME/bin/vimdiff
+	ln -s $HOME/bin/vim $HOME/bin/gvimdiff
+	ln -s $HOME/bin/vim $HOME/bin/vmdiff
+	ln -s $HOME/bin/vim $HOME/bin/gvmdiff
+	ln -s $HOME/bin/vim $HOME/bin/vimacsdiff
+	ln -s $HOME/bin/vim $HOME/bin/gvimacsdiff
+<
+Now, after all that hard work, you can give Vim different personalities
+just by running a different command name!
+
+						*vimacs-non-unix*
+
+There are no special notes for running Vimacs on non-Unix operating systems.
+
+
+==============================================================================
+*Vimacs.03*  Vimacs Options
+
+						*vimacs-options*
+						
+Vimacs can change its behaviour to your liking by setting variables in your
+Vim startup file ("$HOME/.vimrc" in Unix; "C:\Program Files\vim\_vimrc" in
+Windows; see |.vimrc| for more information).  You can set variables using
+|:let| command, e.g.
+
+>
+	let g:VM_CmdHeightAdj = 0
+	let g:VM_NormalMetaXRemap = 1
+<
+
+						*vimacs-option-list*
+
+						*'g:VM_CmdHeightAdj'*
+
+'g:VM_CmdHeightAdj'		number	(default 1)
+
+	Adjust the current 'cmdheight' setting.  Vimacs will normally increase
+	the 'cmdheight' option to 2 if it's less than 2 and the 'showmode'
+	option is set, because the mode message will often obscure the most
+	recent message.
+
+						*'g:VM_Dev'*
+
+'g:VM_Dev'			number	(default 0)
+
+	Turn on "developer mode"; forces overwriting of commands, functions
+	and maps which already exist when Vimacs is loaded.  Vimacs will not
+	typically load its own commands, functions or mappings if one
+	currently exist.
+
+						*'g:VM_Enabled'*
+
+'g:VM_Enabled'			number	(default 1)
+
+	Don't load Vimacs at all.  May be useful in your startup script, e.g.
+	for Unix people who use the "less" Vim script:
+>
+		if v:progname == "less"
+		  source /usr/share/doc/vim/macros/less.vim
+		  let g:VM_Enabled = 0
+		endif
+<
+						*'g:VM_F10Menu'*
+
+'g:VM_F10Menu'			number	(default 1)
+
+	Enable the <F10> key to pull down the menus which are normally only
+	available in the GUI version of Vim.  (GNU Emacs uses F10 for this
+	purpose.)
+
+						*'g:VM_NormalMetaXRemap'*
+
+'g:VM_NormalMetaXRemap'		number	(default 1)
+
+	In Normal mode, map the <M-x> key to go to Command mode (i.e. it has
+	the same effect as typing |:|).
+
+	NOTE: <M-x> is always enabled in Insert mode; this option affects
+	<M-x> in Normal mode only.
+
+						*'g:VM_SearchRepeatHighlight'*
+
+'g:VM_SearchRepeatHighlight'	number	(default 0)
+
+	Highlight all occurances of your current search on the screen when you
+	repeat a search with <C-s> or <C-r>.  This effectively turns on the
+	'hls' option while you're searching.
+
+						*'g:VM_SingleEscToNormal'*
+
+'g:VM_SingleEscToNormal'	number	(default 1)
+
+	Only need to press the <Esc> once in Insert mode to return to Normal
+	mode.  If this option is off, you need to press <Esc><Esc> to return
+	to Normal mode; see |vimacs-unix-esc-key| for rationale.
+
+						*'g:VM_UnixConsoleMetaSendsEsc'*
+
+'g:VM_UnixConsoleMetaSendsEsc'	number	(default 1)
+
+	Remap <Esc>x to become <M-x> (where x is any keypress); this is needed
+	for Unix terminals which send a Meta key as an Escape sequence, rather
+	than sending the keypress with the 8th bit on.  Most Unix terminals
+	seem to do that these days.
+
+						*vimacs-vim-options*
+
+Vimacs's operation is heavily influenced by a few of Vim's options.  You can
+set them in the usual manner (with the |:set| command).
+
+						*'vimacs-backspace'*
+'backspace' 'bs'	string	(default "")
+			global
+			{not in Vi}
+
+	Vimacs will automatically set this option, since pressing <BS> in
+	Emacs typically backspaces over anything and everything :).
+
+						*'vimacs-cedit'*
+'cedit'			string	(Vi default: "", Vim default: CTRL-F)
+			global
+			{not in Vi}
+			{not available when compiled without the |+vertsplit|
+			feature}
+
+	Currently, Vimacs relies on the 'cedit' option to be CTRL-F.  This is
+	regarded as a bug, and will hopefully be fixed in the future.
+
+				     		*'vimacs-esckeys'*
+'esckeys' 'ek'		boolean	(Vim default: on, Vi default: off)
+			global
+			{not in Vi}
+
+	Vimacs automatically sets this option.  (Note that strictly speaking,
+	this may not be necessary ... please send me a patch if you can't live
+	with this behaviour).
+
+				     		*'vimacs-hidden'*
+'hidden' 'hid'		boolean	(default off)
+			global
+			{not in Vi}
+
+	Vimacs will automatically set this option; Emacs always "hidden
+	buffers".
+
+				 		*'vimacs-incsearch'*
+'incsearch' 'is'	boolean	(default off)
+			global
+			{not in Vi}
+			{not available when compiled without the
+			|+extra_search| feature}
+
+	CTRL-S (incremental search forward) and CTRL-R (incremental search
+	backward) will override Vim's 'incsearch' option; they will always do
+	an incremental search.
+
+						*'vimacs-insertmode'*
+
+'insertmode' 'im'	boolean	(default off)
+			global
+			{not in Vi}
+
+	Setting the 'insertmode' option makes Insert mode the default mode,
+	and effectively makes Vim modeless.  This is important for Vimacs
+	since it allows for a much more complete emulation of Emacs.  (See
+	Vim's 'insertmode' help entry for more detail.)
+
+	When 'insertmode' is set and Vimacs is active, the CTRL-O and CTRL-L
+	keys change to the Emacs behaviour, and <Esc> still escapes back to
+	normal mode.
+	
+	See also: the |'g:VM_SingleEscToNormal'| option and
+	|vimacs-unix-esc-key|.
+
+						*'vimacs-keymodel'*
+'keymodel' 'km'		string	(default "")
+			global
+			{not in Vi}
+
+	Vimacs will automatically manipulate this option to ensure that
+	marking blocks using <C-Space> (and the <Shift> key, if the "key" word
+	is included in 'selectmode') works as intended.
+
+						*'vimacs-selection'*
+'selection' 'sel'	string	(default "inclusive")
+			global
+			{not in Vi}
+
+	Vimacs will change the default value of this option to "exclusive",
+	since it's very much more Emacs-like in its behaviour.
+
+						*'vimacs-selectmode'*
+'selectmode' 'slm'	string	(default "")
+			global
+			{not in Vi}
+
+	If the "cmd" word is in the 'selectmode' option, Vimacs will use
+	Select mode when marking a block using <C-Space>.
+
+						*'vimacs-timeout'*
+'timeout' 'to'		boolean (default on)
+			global
+						*'vimacs-ttimeout'*
+'ttimeout'		boolean (default off)
+			global
+			{not in Vi}
+
+	Vimacs will automatically set these options for optimal behaviour,
+	depending on whether the 'insertmode' and |'g:VM_SingleEscToNormal'|
+	options are set, and whether you're running in a UNIX console or not.
+
+	This is done for safety reasons; it's quite easy to screw up Vim if
+	use <Meta> key mappings extensively and you're running in a UNIX
+	console.
+
+						*'vimacs-whichwrap'*
+'whichwrap' 'ww'	string	(Vim default: "b,s", Vi default: "")
+			global
+			{not in Vi}
+
+	Vimacs will automatically manipulate this option to obtain Emacs-like
+	behaviour.  (If you're that pedantic about this option, why on earth
+	are you using Vimacs in the first place?  Send me a patch, send me
+	a patch ...)
+
+						*'vimacs-wildcharm'*
+'wildcharm' 'wcm'	number	(default: none (0))
+			global
+			{not in Vi}
+
+	Vimacs automatically manipulates this option.  If you don't like that,
+	send me a patch!
+
+						*'vimacs-winaltkeys'*
+'winaltkeys' 'wak'	string	(default "menu")
+			global
+			{not in Vi}
+			{only used in Win32, Motif, GTK and Photon GUI}
+
+	Vimacs will automatically unset this option, since it interferes with
+	remapping the <Alt>/<Meta> keys.
+
+
+==============================================================================
+*Vimacs.04*  Changes for Emacs users
+
+Nothing written yet.  Send patches or hate mail to the |vimacs-author| :).
+
+
+==============================================================================
+*Vimacs.05*  Changes for Vim users
+
+Nothing written yet.  Send patches or hate mail to the |vimacs-author| :).
+
+
+==============================================================================
+*Vimacs.06*  Key Map
+
+Emacs has many keys, and this section of the documentation is currently
+incomplete.  If you want to help complete this section, please send me
+patches!
+
+Other than looking at the vimacs.vim script file itself, a suggested way of
+learning the Emacs key set is from Emacs itself (and Emacs clones such as jed
+and jmacs).  Press <C-h>b in GNU Emacs or XEmacs to get a list of key
+bindings.
+
+Files and Buffers
+						*vimacs:CTRL-X_CTRL-F*
+
+CTRL-X CTRL-F	Loads a new file into the current window; see |:edit|.
+
+						*vimacs:CTRL-X_CTRL-S*
+
+CTRL-X CTRL-S	Saves the current buffer to disk, but only if's been
+		modified.  See |:update|.
+
+						*vimacs:CTRL-X_s*
+
+CTRL-X s	Saves all changes buffers to disk; see |:wa|.
+
+						*vimacs:CTRL-X_i*
+
+CTRL-X i	Inserts a file into the current buffer.  See |:read|.
+
+						*vimacs:CTRL-X_CTRL-W*
+
+CTRL-X CTRL-W	Saves the current buffer to disk as a different filename.
+		See |:write_f|.
+
+
+Error Recovery
+						*vimacs:CTRL-_*
+						*vimacs:CTRL-X_CTRL_U*
+
+CTRL-_
+CTRL-X CTRL-U	Undo your last action.
+
+
+==============================================================================
+*Vimacs.07*  Design Comments
+
+This is a collection of anecdotes, design issues and ramblings that I came
+across with when writing Vimacs.  Vi was certainly never designed to be used
+in a modeless way, and Vimacs pushes Vim's modeless functionality to its
+limits, so I expected to encounter some bugs^H^H^H^Hundocumented features in
+writing Vimacs.  Somewhat surprisingly, there seems to be only a few small
+problems in Vim which limit Vimacs' Emacs emulation capabilities, and these
+tend to be philosophical or conceptual differences between the two editors
+rather than being actual bugs.  (Quite amazing, considering that the two
+editors, at first glance, seem so completely different.)
+
+						*vim-emacs-similarity*
+
+Many Emacs features actually have a direct 1:1 mapping to Vim commands; for
+example, Emacs' |vimacs:META-A| command is exactly the same as Vim's Command
+mode |(| command.  Thus, many of the Vimacs commands were very simple to
+imlpement.
+
+						*cursor-at-eol*
+
+One of the bigger complications that arose in Vimacs is that the cursor
+position is conceptually different between Vim's various modes.  In Insert
+mode, Vim's cursor is treated as being _between_ two characters, not "on" a
+character.
+
+In Normal mode, the cursor is treated as being "on" a character, and not
+between the characters.  (If you use gvim, you can see that the cursor is a
+normal block shape in Command mode, but the shape changes to a thin vertical
+line in Insert Mode.)  This means that switching from Insert mode to Normal
+mode can cause problems if you're at the end of a line.  The cursor seems to
+'jump back' a character, because the cursor is _after_ the last character in
+Insert mode, and when you revert to Normal mode, the cursor cannot be past the
+end of the line, so it goes to the last character on the line.  Going back to
+Insert Mode from there therefore puts your cursor one character back from the
+end of the line, rather than being at the end of the line.
+
+You can use the |a| command instead of the |i| to solve this problem, but then
+you lose precision at the beginning of the line, rather than at the end.  It's
+not a particularly easy problem to solve; I hope that Bram Moolenar provides
+an option to change this behaviour in the future.
+
+						*remapping-CTRL_O*
+
+In Emacs, the <C-o> key is mapped to `open-line'; in Vim, <C-o> executes one
+command in Normal mode, and then returns to Insert mode (see |i_CTRL-O|).
+This poses a problem: internally, Vim uses <C-o> for many commands, and
+remapping it to `open-line' causes problems.  Commands such as |:amenu| use
+<C-o> to return to Normal mode from Insert mode, and thus remapping <C-o> can
+lead to interesting problems.
+
+There will be an option in the future to prevent <C-o> from being remapped at
+all; of course, this means that you can't remap the <C-o> to a function at
+all, which isn't ideal.
+
+The `proper' way to fix this would be for Vim to limit the <C-o> mapping to
+Insert mode only, and fix the other commands (such as |:amenu|) so that they
+always use the unmapped version of <C-o>.
+
+						*vimacs-quotes*
+
+Conrad Parker: "Dude, I gotta get you doing some serious hacking
+projects"
+
+Erik de Castro Lopo: "Oh, so you're the insane guy that K was talking
+about"
+
+Wichert Akkerman: "Gross. Horror. Vim abuse. Mind if I include this as
+an example in the Debian vim packages? :)"
+
+(add yours here if you like :)
+
+
+==============================================================================
+*Vimacs.08*  Known Problems
+
+						*vimacs-and-lazyredraw*
+
+Vim seems to be a bit buggy and occasionally doesn't redraw the screen
+properly when it should, if you have the 'lazyredraw' option set.  Please turn
+it off if you notice redraw glitches.
+
+This is a problem in Vim, not Vimacs, but Vimacs seems to exarcerbate the
+problem.
+
+						*vimacs-meta-d-at-eol*
+
+Pressing <M-d> at the end of the line (EOL) doesn't delete the word.
+
+						*vimacs-unix-esc-key*
+
+On Unix console systems (i.e. not gvim), you may get a warning when you press
+<Esc> twice telling you to use the <F1> or <C-z> keys to return to Normal
+mode.  i.e. You can't do a simple <Esc> press to return to Normal mode, as you
+normally do in Vi(m).  In a nutshell, this is because of Vim's 'insertmode'
+option.
+
+When 'insertmode' is turned on, Vim normally remaps the <Esc> key so that
+novice users don't find themselves in Vim's Normal mode if they accidently hit
+<Esc>.  Remember that 'insertmode' is originally designed for |evim|, which is
+a point-and-click editor in the style of Windows Notepad.  You don't want
+users winding up in Normal mode if they want something as simple as Notepad!
+
+Due to the way that Unix terminals were originally designed, if:
+
+	1. you are running Vimacs in a Unix console,
+	2. have |g:VM_UseInsertMode| (and the 'insertmode' option) set
+	3. have |g:VM_UnixConsoleRemapEsc| set
+	4. have |g:VM_SingleEscToNormal| set
+
+when Vim receives an <Esc> key, it is completely impossible to determine
+whether it is part of a Meta key mapping (such as <M-f>) or the single <Esc>
+key press that you did to get out of Insert mode.  The simple solution to this
+is: either get used to the <F1> or <C-z> keys to get back to Insert mode, or
+change one of the above g:VM_ settings.  There's no way around it, sorry; this
+is a limitation in the way that Vim and Unix consoles were designed.
+
+Another way to solve the problem is to always make the user press <Esc> twice
+to get back to Normal mode.  Vim will interpret an <Esc><Esc> in an
+unambigious way, and therefore you will never have this problem.  To do this,
+turn off the |'g:VM_SingleEscToNormal'| option.  The obvious problem with this
+solution is that you need to change your habits, so that you must press
+<Esc><Esc> to return to Normal mode, rather than a simple <Esc>.
+
+Deep Vim and Unix hackers may be interested to hear why this happens.  Vim can
+normally tell whether the <Esc> key is part of a Meta key sequence (such as
+<Esc>f), by using its multitude of |:timeout|-related options.  However, if
+|:insertmode| is set (which it is if |g:VM_UseInsertMode| is set), Vim changes
+the <Esc> key so that it no longer brings you out of Insert mode.  To get
+around this, we remap the <Esc> ourselves so that it does bring you out of
+Insert mode.  We can do this in an environment which has a completely
+unambigious <Esc> key; i.e. an <Esc> is always an <Esc>.  However, in the Unix
+console, since many (most?) terminals send a <M-x> combo as <Esc>x, we must
+change Vim's terminal settings to interpret a <Esc>x as <M-x>.  However, now
+there's no way for Vim to tell whether the first <Esc> is a single <Esc> by
+itself, or part of a larger sequence like <Esc>x, because we have both the
+<Esc> key remapped to <C-l> and the <Esc> key being part of a larger key
+sequence.  This unfortunate design flaw is therefore a limitation of both Vim
+(because it changes the normal behaviour of <Esc>) and the Unix console
+(because whoever designed the original terminals decided to put the real <Esc>
+key on the keyboard, which should never have happened).  Any suggestions to
+fix this annoying situation would save me a lot of pain :).
+
+						*vimacs-'cedit'*
+
+See the |'vimacs-cedit'| topic in the option summary for details.
+
+
+
+==============================================================================
+*Vimacs.09*  Revision History (ChangeLog)
+
+						*vimacs-changelog*
+
+						*vimacs-0.93*
+
+Made the thankyou (credits) list look a bit nicer :).
+
+						*vimacs-0.92*
+
+<M-n> and <M-p> now cycle through the QuickFix list rather than perform the
+next/previous search
+
+<M-d> at EOL now deletes the word at the start of the next line,
+instead of the last character at the end of the current line
+
+<M-BS> on command line now deletes the word before the cursor
+
+<M-w> on command line copies the selection (to register)
+
+<C-y> on command line pastes the selection
+
+Indenting on <Tab> key moved to a tab-indent.vim
+
+						*vimacs-0.91*
+
+Moved vi check to be much earlier in the script
+
+Rewrote <C-k>: it's (much) simpler now
+
+Updated Unix installation notes
+
+<C-Space> at EOL will now include the last character on the line
+
+Use Vim's 'keymodel' option instead of own g:VM_VisualMode variable
+
+Use Vim's 'selectmode' option instead of own g:VM_ShiftSel variable
+
+						*vimacs-0.9*
+
+Added Piet Delport to THANKS section
+  
+Wrote a function to initialise a variable to a default value, with Piet's help
+  
+Added Barrie Stott to THANKS section
+  
+Added navigation keys such as <M-f> to Operator Pending mode (actually done in
+0.2, but I forgot to add it to the ChangeLog.  Oops.)
+  
+Automatically pop up list of buffers for <C-x>b
+  
+Added <S-PageUp>, <S-PageDown>, <S-Home>, <S-End> to select region (for
+g:VM_ShiftSel)
+  
+Added commandline abbreviations for query_replace
+  
+Added <M-x> to normal mode (yeah, I kept hitting <M-x> instead of just typing
+a colon (':'); sad, innit?
+  
+<C-M-s> is now remapped in Insert mode instead of Normal mode
+  
+<M-%> (query-replace) and <C-M-%> (query-replace-regexp) now escape /
+characters, so the s/// doesn't get messed up
+  
+Remapped <Esc><Space> to <M-Space> (for UNIX terminals)
+
+<M-q> (fill-paragraph) now leaves cursor at fill point, thanks to the
+very useful Mark() function stolen from foo.vim by Benji Fisher.
+
+Added <M-0> ... <M-9> bindings for quick escape into Normal mode
+
+Added <M-`> (that's Meta and a backtick) to return to Normal mode
+
+Added <F10> to pulldown the menus (in the GUI system), ala GNU Emacs
+
+Added VM_Enabled variable to allow users to not load Vimacs
+
+Properly fixed mapping of <Esc>x keys to <M-x> keys, using the :set
+command rather than :map
+
+Added <C-x>r when in Visual mode to switch to Visual Block mode; this is
+meant to (poorly) emulate Emacs' rectangle support.  It'll almost
+definitely be changed at a later date, because this isn't similar to how
+Emacs works at all
+
+Changed <Silent> mappings to <silent> (see :help <silent>; it doesn't
+mention that it's case-sensitive!)
+
+Made <C-s> and <C-r> search forward/backward from within a search prompt
+
+Added Hari Krishna Dara & Arun Easi to THANKS section
+
+Made <C-Space> be more Emacs-like by making Vim go into Select mode rather
+than Visual mode.  (This is now the default; set g:VM_VisualMode to 1 to
+change it back to the old behaviour where <C-Space> triggers Visual mode.)
+
+Added g:VM_SearchRepeatHighlight option, which highlights the current item
+you're searching for if you press <C-s> or <C-r> to search again
+ 
+Default for g:VM_AlwaysRemapEsc changed from 0 to 1, to maintain interface
+consistency throughout all of vim's console/GUI versions
+
+Initial formal documentation (vimacs.txt: check it out!)
+
+Fixed <C-x><C-o> to leave one line
+
+Added <C-x><C-q> (toggle-readonly)
+
+Added <C-x><C-r> (find-file-read-only)
+
+Added <C-x><C-u> (upcase-region)
+
+<C-z> in Insert mode now jumps back to Command mode; to suspend Vimacs
+from Insert mode, press <C-z> twice.  Note that you'll be in Normal mode
+when you resume 
+
+Fixed <M-Space> highlighting one less character than the current word
+
+Changed all functions to have be internal to the script (i.e. use <SID>
+mappings)
+
+Implemented primitive yank-pop (<M-y>) support, but hey, it does work ...
+
+Added Charles E. Campbell to THANKS section
+
+<C-l> now actually redraws as well as recentering cursor
+
+<C-Up> and <C-Down> move by paragraphs
+
+<C-M-v> scrolls other window down.
+
+Integration with Jeff Lanzarotta's BufExplorer plugin for <C-x>b.  Vimacs will
+launch BufExplorer when you press <C-x>b if you have it.  BufExplorer will use
+a default sort order of MRU, since this how it works in Emacs.  You will need
+BufExplorer 6.0.16 for this to work properly, otherwise ':insertmode' will
+screw things up ...
+
+Added <C-M-/>, <C-M-x> and <C-]>: All map to Vim's |insert_expand| command
+
+Added <C-k> to |Cmdline-mode|
+
+<C-^> inserts the character above the cursor (|i_CTRL-Y|)
+
+
+==============================================================================
+*Vimacs.10*  In the Future ... (TODO list)
+
+						*vimacs-todo*
+
+Replace "set <M-x>=^[x" with a loop; ASCII range 7 to 127
+
+Implement haskell-mode and <C-c><C-l> with vimsh for Manuel :)
+
+BufExplorer used for bdelete etc. commands?
+
+Don't overwrite maps.  Err.  Will be hard ...
+
+GotoLine should accept a range or argument
+
+Autoconfiscate ... is that overkill?!
+
+Make <C-x>b silent (for :BufExplorer?)
+
+C-x n p
+
+Emacs-like status line?
+
+"Mark stack" ala <C-Space> in Emacs, and <C-u><C-Space> to jump to last
+marks
+
+Add Mac notes to documentation.
+
+Jed keys: <C-j> = newline but no indent, <C-x><C-l> = ?, <C-x><C-o> =
+leave one line, <C-x><C-v> = find-alternate-file,
+
+Emacs folding keys
+
+Fix <C-M-s> and <C-s> to turn on regexps
+
+Bind <S-Del>, <C-Ins> and <S-Ins>?
+
+Follow mode (http://www.csd.uu.se/~andersl/follow.shtml).  Maybe as a
+separate script; e.g. vimacs-follow.vim
+
+Argument (M-1/M-2/etc) and universal argument keys.  Ahahaha, good
+luck to me ... (hmm, v:count1 looks promising!)
+
+mapcheck() everything -- oooh boy
+
+Port the rest of XEmacs' 419830213 bindings
+
+Zippy, Doctor, kitchen sink
+
+
+==============================================================================
+*Vimacs.11*  Contact, Help, Credits
+
+						*vimacs-author*
+
+The author of Vimacs is Andre Pang <ozone@vimacs.cx>.
+
+						*vimacs-webpage*
+
+The official Vimacs webpage is at http://www.vimacs.cx/.  It is also regularly
+uplaoded to the Vim Online website, at http://vim.sourceforge.net/.
+
+						*vimacs-thanks*
+
+Many people have inspired me to work on Vimacs.  (This is actually a good
+thing.  Really ...)  The following are a brief list of people who have been
+particularly helpful:
+
+  Manuel Chakravarty ~
+  For introducing me to Emacs, otherwise I'd never be writing an
+  alternative for it ;)
+
+  Piet Delport ~
+  Vim scripting help
+
+  Benji Fisher ~
+  Vim scripting help, and the wonderful foo.vim script
+
+  Barrie Stott ~
+  Testing and feedback on early releases
+
+  Hari Krishna Dara, Arun Easi ~
+  Inspiration on how to map <C-s> and <C-r> to repeat your current search
+
+  Charles E. Campbell ~
+  Writing a document on how to write Vim plugins, convincing me use <SID>s
+  and <Plug>s for Vimacs's internal functions, Vim scripting help
+
+  The Vim, GNU Emacs, and XEmacs teams ~
+  For absolutely amazing text editors!
+
+						*vimacs-suggestions*
+
+Please, please ask for key mappings which you consider to be fundamental
+in Emacs!  This is a serious project, it's not another Vigor :).  I'm not
+a veteran Emacs user by any means, so there are potentially scores of
+keys which many consider to be fundamental which I am missing.  Send me
+a request (or even better, a patch!) if you feel like a favourite key
+binding is missing, or if behaviour is incorrect.
+
+						*vimacs-gpl2*
+
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+
+
+==============================================================================
+ vim:tw=78:sts=0:ts=8:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl:
+
diff --git a/.vim/pack/editing/start/vimacs/plugin/vimacs-0.93.vim b/.vim/pack/editing/start/vimacs/plugin/vimacs-0.93.vim
new file mode 100644
index 0000000..aa07fd8
--- /dev/null
+++ b/.vim/pack/editing/start/vimacs/plugin/vimacs-0.93.vim
@@ -0,0 +1,931 @@
+"""
+"" Vimacs (0.93)
+"
+" Vim-Improved eMACS
+"
+" (Oh dear, what have I got myself into?)
+"
+
+"
+" Copyright (C) 2002  Andre Pang <ozone@vimacs.cx>
+"
+" Please see the documentation (vimacs.txt) for the README, installation
+" notes, and the ChangeLog.
+"
+
+"
+" This program is free software; you can redistribute it and/or modify
+" it under the terms of the GNU General Public License as published by
+" the Free Software Foundation; either version 2 of the License, or
+" (at your option) any later version.
+" 
+" This program is distributed in the hope that it will be useful,
+" but WITHOUT ANY WARRANTY; without even the implied warranty of
+" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+" GNU General Public License for more details.
+" 
+" You should have received a copy of the GNU General Public License
+" along with this program; if not, write to the Free Software
+" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+"
+" This General Public License does not permit incorporating your program into
+" proprietary programs.  If your program is a subroutine library, you may
+" consider it more useful to permit linking proprietary applications with the
+" library.  If this is what you want to do, use the GNU Library General
+" Public License instead of this License.
+"
+
+" TODO: :h map-script
+"       :h cpoptions
+"       :h mapleader
+"       :h map-<SID> <SID>
+"       :h <Plug>
+"       :h undo?
+"       :h write-plugin
+
+" Have <unique> for all maps?
+
+
+" Never load Vimacs if user wants true Vi!  (We're not _that_ evil 8)
+if v:progname =~ '^vi$'
+  finish
+endif
+
+if version < 600
+  " We require Vim 6 to work :(
+  echoerr 'Vimacs requires Vim 6 to run :('
+  finish
+endif
+
+" We want to be able to remap <> key codes and do line continuation
+let s:saved_cpoptions = &cpoptions
+set cpoptions-=<,C
+
+
+" Set a default value for a variable only if it doesn't exist
+" (like "$foo |= 'bar'" in Perl)
+"
+" Thanks to Piet Delport for this solution, and Benji Fisher for
+" additional comments :)
+"
+
+function! <SID>LetDefault(var_name, value)
+  if !exists(a:var_name)
+    execute 'let ' . a:var_name . '=' . a:value
+  endif
+endfunction
+
+command! -nargs=+ LetDefault call s:LetDefault(<f-args>)
+
+" Load Vimacs by default
+LetDefault g:VM_Enabled 1
+
+" Developers may want to turn this on, to always load the file
+LetDefault g:VM_Dev 0
+
+if g:VM_Enabled == 0 || (exists("loaded_vimacs") && g:VM_Dev == 0) || &cp
+  finish
+endif
+
+
+"
+" Function to mark a cursor position and restore it afterward -- used in a few
+" functions, like FillParagraph().  Blatantly stolen from foo.vim by Benji
+" Fisher :)
+"
+
+function! <SID>Mark(...)
+  if a:0 == 0
+    let mark = line(".") . "G" . virtcol(".") . "|"
+    normal! H
+    let mark = "normal!" . line(".") . "Gzt" . mark
+    execute mark
+    return mark
+  elseif a:0 == 1
+    return "normal!" . a:1 . "G1|"
+  else
+    return "normal!" . a:1 . "G" . a:2 . "|"
+  endif
+endfun
+
+
+"
+" It's a good idea to have a command height of at least 2 if showmode is on,
+" because many important messages will be overwritten by the mode display.
+" e.g. <C-x><C-s>, which saves the file, will display that the file has been
+" saved, but the notice will be immediately overwritten by the modeline when
+" this happens.
+"
+
+" Don't fork around with cmdheight?
+LetDefault g:VM_CmdHeightAdj 1
+
+if &cmdheight == 1 && &showmode == 1 && g:VM_CmdHeightAdj
+  set cmdheight=2
+endif
+
+
+"
+" Vim options essential for emulating Emacs-ish behaviour
+"
+
+" Turn off <Alt>/<Meta> pulling down GUI menu
+set winaltkeys=no
+" Emacs normally wraps everything
+set whichwrap=b,s,<,>,h,l,[,],~
+" Emacs always has 'hidden buffers'
+set hidden
+" Backspace in Emacs normally backspaces anything :)
+set backspace=indent,eol,start
+" Want to be able to use <Tab> within our mappings
+" (This has got to be the coolest option name ever, btw)
+set wildcharm=<Tab>
+" Recognise key sequences that start with <Esc> in Insert Mode
+set esckeys
+
+
+"
+" For the UNIX console -- make <Esc>x == <M-x>
+"
+
+" Pressing <M-x> sends <Esc>x?  (As Unix terminals often do)
+LetDefault g:VM_UnixConsoleMetaSendsEsc 1
+
+" One or two <Esc>s required to go back to Normal mode?
+LetDefault g:VM_SingleEscToNormal 1
+
+if has("unix") && !has("gui_running") && g:VM_UnixConsoleMetaSendsEsc
+  " <Esc>x maps to <M-x>
+  set <M-1>=1
+  set <M-2>=2
+  set <M-3>=3
+  set <M-4>=4
+  set <M-5>=5
+  set <M-6>=6
+  set <M-7>=7
+  set <M-8>=8
+  set <M-9>=9
+  set <M-0>=0
+  set <M-a>=a
+  set <M-b>=b
+  set <M-c>=c
+  set <M-d>=d
+  set <M-e>=e
+  set <M-f>=f
+  set <M-g>=g
+  set <M-h>=h
+  set <M-i>=i
+  set <M-j>=j
+  set <M-k>=k
+  set <M-l>=l
+  set <M-m>=m
+  set <M-n>=n
+  set <M-o>=o
+  set <M-p>=p
+  set <M-q>=q
+  set <M-r>=r
+  set <M-s>=s
+  set <M-t>=t
+  set <M-u>=u
+  set <M-v>=v
+  set <M-w>=w
+  set <M-x>=x
+  set <M-y>=y
+  set <M-z>=z
+  set <M->=
+  set <M-/>=/
+  " Doing "set <M->>=^[>" throws up an error, so we be dodgey and use Char-190
+  " instead, which is ASCII 62 ('>' + 128).
+  set <Char-190>=>
+  set <M-<>=<
+  set <M-0>=0
+  set <M-%>=%
+  set <M-*>=*
+  set <M-.>=.
+  set <M-^>=^
+  " Can't set <M-Space> right now :(
+  set <M-Space>=^[<Space>
+
+endif
+
+
+"
+" One or two <Esc>s to get back to Normal mode?
+"
+
+" on CmdwinLeave?
+if g:VM_SingleEscToNormal == 1
+  if &insertmode
+    if has('unix') && !has('gui_running') && g:VM_UnixConsoleMetaSendsEsc
+      inoremap <Esc><Esc> <C-o>:UseF1ForNormal<CR>
+    else
+      inoremap <Esc> <C-l>
+    endif
+  endif
+
+  set notimeout
+  set ttimeout
+  set timeoutlen=50
+else
+  inoremap <Esc><Esc> <C-l>
+  vnoremap <Esc><Esc> <Esc>
+  set notimeout
+  set nottimeout
+endif
+
+command! UseF1ForNormal echoerr "Use F1 or <C-z> to return to Normal mode.  :help vimacs-unix-esc-key"
+
+
+"
+" Insert mode <-> Normal mode <-> Command mode
+" 
+
+inoremap <M-x> <C-o>:
+inoremap <M-:> <C-o>:
+inoremap <F1> <C-l>
+inoremap <F2> <C-o>
+inoremap <M-`> <C-o>
+inoremap <silent> <C-z> <C-l>:echo "Returning to Normal mode; press <C-z> again to suspend Vimacs"<CR>
+nnoremap <C-z> :call <SID>Suspend()<CR>
+" M-` isn't defined in Emacs
+
+inoremap <M-1> <C-o>1
+inoremap <M-2> <C-o>2
+inoremap <M-3> <C-o>3
+inoremap <M-4> <C-o>4
+inoremap <M-5> <C-o>5
+inoremap <M-6> <C-o>6
+inoremap <M-7> <C-o>7
+inoremap <M-8> <C-o>8
+inoremap <M-9> <C-o>9
+
+LetDefault g:VM_NormalMetaXRemap 1
+
+if g:VM_NormalMetaXRemap == 1
+  nnoremap <M-x> :
+endif
+
+function! <SID>Suspend()
+  suspend!
+  if &insertmode
+    startinsert
+  endif
+endfunction
+
+
+"
+" Leaving Vim
+"
+
+inoremap <C-x><C-c> <C-o>:confirm qall<CR>
+
+
+"
+" Files & Buffers
+"
+
+inoremap <C-x><C-f> <C-o>:hide edit<Space>
+inoremap <C-x><C-s> <C-o>:update<CR>
+inoremap <C-x>s <C-o>:wall<CR>
+inoremap <C-x>i <C-o>:read<Space>
+"what does C-x C-v do?
+inoremap <C-x><C-w> <C-o>:write<Space>
+inoremap <C-x><C-q> <C-o>:set invreadonly<CR>
+inoremap <C-x><C-r> <C-o>:hide view<Space>
+
+
+"
+" Help Sistemmii (hi Finns)
+"
+"inoremap <C-h> <C-o>:help
+
+
+"
+" Error Recovery
+" 
+
+inoremap <C-_> <C-o>u
+inoremap <C-x><C-u> <C-o>u
+"lots of other stuff :(
+
+
+"
+" Incremental Searching and Query Replace
+"
+
+inoremap <C-s> <C-o>:call <SID>StartSearch('/')<CR><C-o>/
+inoremap <C-r> <C-o>:call <SID>StartSearch('?')<CR><C-o>?
+inoremap <M-n> <C-o>:cnext<CR>
+" <M-n> not in Emacs: next in QuickFix
+inoremap <M-p> <C-o>:cprevious<CR>
+" <M-p> not in Emacs: previous in QuickFix
+inoremap <C-M-s> <C-o>:call <SID>StartSearch('/')<CR><C-o>/
+inoremap <C-M-r> <C-o>:call <SID>StartSearch('?')<CR><C-o>?
+inoremap <M-s> <C-o>:set invhls<CR>
+inoremap <M-%> <C-o>:call <SID>QueryReplace()()<CR>
+inoremap <C-M-%> <C-o>:call <SID>QueryReplace()_regexp()<CR>
+cnoremap <C-r> <CR><C-o>?<Up>
+
+command! QueryReplace :call <SID>QueryReplace()()
+command! QueryReplaceRegexp :call <SID>QueryReplace()_regexp()
+
+" Searching is a bit tricky because we have to emulate Emacs's behaviour of
+" searching again when <C-s> or <C-r> is pressed _inside_ the search
+" commandline.  Vim has no equivalent to this, so we must use a bit of
+" on-the-fly remap trickery (popular in Quake-style games) to provide
+" different functionality for <C-s>, depending on whether you're in 'search
+" mode' or not.
+"
+" We must map <C-g> and <CR> because we have to undo the map trickery that we
+" set up when we abort/finish the search.  All in all, it's not too complex
+" when you actually look at what the code does.
+"
+" Note that <C-c> in Emacs is functionally the same as <CR>.
+
+LetDefault g:VM_SearchRepeatHighlight 0
+
+function! <SID>StartSearch(search_dir)
+  let s:incsearch_status = &incsearch
+  let s:lazyredraw_status = &lazyredraw
+  set incsearch
+  cmap <C-c> <CR>
+  cnoremap <C-s> <CR><C-o>:call <SID>SearchAgain()<CR><C-o>/<Up>
+  cnoremap <C-r> <CR><C-o>:call <SID>SearchAgain()<CR><C-o>?<Up>
+  cnoremap <silent> <CR> <CR><C-o>:call <SID>StopSearch()<CR>
+  cnoremap <silent> <C-g> <C-c><C-o>:call <SID>AbortSearch()<CR>
+  cnoremap <silent> <Esc> <C-c><C-o>:call <SID>AbortSearch()<CR>
+  if a:search_dir == '/'
+    cnoremap <M-s> <CR><C-o>:set invhls<CR><Left><C-o>/<Up>
+  else
+    cnoremap <M-s> <CR><C-o>:set invhls<CR><Left><C-o>?<Up>
+  endif
+  let s:before_search_mark = <SID>Mark()
+endfunction
+
+function! <SID>StopSearch()
+  cunmap <C-c>
+  cunmap <C-s>
+  cunmap <C-r>
+  cunmap <CR>
+  cunmap <C-g>
+  cnoremap <C-g> <C-c>
+  if exists("s:incsearch_status")
+    let &incsearch = s:incsearch_status
+    unlet s:incsearch_status
+  endif
+  if g:VM_SearchRepeatHighlight == 1
+    if exists("s:hls_status")
+      let &hls = s:hls_status
+      unlet s:hls_status
+    endif
+  endif
+endfunction
+
+function! <SID>AbortSearch()
+  call <SID>StopSearch()
+  if exists("s:before_search_mark")
+    execute s:before_search_mark
+    unlet s:before_search_mark
+  endif
+endfunction
+
+function! <SID>SearchAgain()
+  if g:VM_SearchRepeatHighlight == 1
+    if !exists("s:hls_status")
+      let s:hls_status = &hls
+    endif
+    set hls
+  endif
+endfunction
+
+" Emacs' `query-replace' functions
+
+function! <SID>QueryReplace()
+  let magic_status = &magic
+  set nomagic
+  let searchtext = input("Query replace: ")
+  if searchtext == ""
+    echo "(no text entered): exiting to Insert mode"
+    return
+  endif
+  let replacetext = input("Query replace " . searchtext . " with: ")
+  let searchtext_esc = escape(searchtext,'/\^$')
+  let replacetext_esc = escape(replacetext,'/\')
+  execute ".,$s/" . searchtext_esc . "/" . replacetext_esc . "/cg"
+  let &magic = magic_status
+endfunction
+
+function! <SID>QueryReplaceRegexp()
+  let searchtext = input("Query replace regexp: ")
+  if searchtext == ""
+    echo "(no text entered): exiting to Insert mode"
+    return
+  endif
+  let replacetext = input("Query replace regexp " . searchtext . " with: ")
+  let searchtext_esc = escape(searchtext,'/')
+  let replacetext_esc = escape(replacetext,'/')
+  execute ".,$s/" . searchtext_esc . "/" . replacetext_esc . "/cg"
+endfunction
+
+
+"
+" Command line editing
+"
+
+" Navigation
+cmap <C-b> <Left>
+cmap <C-f> <Right>
+cnoremap <M-f> <S-Right>
+cnoremap <M-b> <S-Left>
+cmap <C-a> <Home>
+cmap <C-e> <End>
+
+" Editing
+cmap <M-p> <Up>
+cmap <M-n> <Down>
+cmap <C-d> <Del>
+cnoremap <C-y> <C-r><C-o>"
+cnoremap <M-w> <C-y>
+cnoremap <M-BS> <C-w>
+cnoremap <C-k> <C-f>d$<C-c><End>
+"Should really use &cedit, not just <C-f> -- but how?
+
+
+"
+" Navigation
+"
+
+" Insert/Visual/Operator mode maps
+imap <C-b> <Left>
+vmap <C-b> <Left>
+omap <C-b> <Left>
+imap <C-f> <Right>
+vmap <C-f> <Right>
+omap <C-f> <Right>
+imap <C-p> <Up>
+vmap <C-p> <Up>
+omap <C-p> <Up>
+imap <C-n> <Down>
+vmap <C-n> <Down>
+omap <C-n> <Down>
+inoremap <M-f> <C-o>e<Right>
+vnoremap <M-f> e<Right>
+onoremap <M-f> e<Right>
+inoremap <M-b> <C-Left>
+vnoremap <M-b> <C-Left>
+onoremap <M-b> <C-Left>
+imap <C-a> <Home>
+vmap <C-a> <Home>
+omap <C-a> <Home>
+imap <C-e> <End>
+vmap <C-e> <End>
+omap <C-e> <End>
+inoremap <M-a> <C-o>(
+vnoremap <M-a> (
+onoremap <M-a> (
+inoremap <M-e> <C-o>)
+vnoremap <M-e> )
+onoremap <M-e> )
+inoremap <C-d> <Del>
+vnoremap <C-d> <Del>
+onoremap <C-d> <Del>
+inoremap <M-<> <C-o>1G<C-o>0
+vnoremap <M-<> 1G0
+onoremap <M-<> 1G0
+inoremap <M->> <C-o>G<C-o>$
+vnoremap <M->> G$
+onoremap <M->> G$
+inoremap <C-v> <PageDown>
+vnoremap <C-v> <PageDown>
+onoremap <C-v> <PageDown>
+inoremap <M-v> <PageUp>
+vnoremap <M-v> <PageUp>
+onoremap <M-v> <PageUp>
+inoremap <M-m> <C-o>^
+vnoremap <M-m> ^
+onoremap <M-m> ^
+inoremap <C-x>= <C-g>
+vnoremap <C-x>= <C-g>
+onoremap <C-x>= <C-g>
+inoremap <silent> <M-g> <C-o>:call <SID>GotoLine()<CR>
+vnoremap <silent> <M-g> :<C-u>call <SID>GotoLine()<CR>
+onoremap <silent> <M-g> :call <SID>GotoLine()<CR>
+" Phear, <M-g> works properly even in Visual/Operator-Pending
+" modes :)  (It's rather dangerous with the latter, though ...)
+inoremap <M-Left> <S-Left>
+vnoremap <M-Left> <S-Left>
+onoremap <M-Left> <S-Left>
+inoremap <M-Right> <S-Right>
+vnoremap <M-Right> <S-Right>
+onoremap <M-Right> <S-Right>
+inoremap <C-Up> <C-o>{
+vnoremap <C-Up> {
+onoremap <C-Up> {
+inoremap <C-Down> <C-o>}
+vnoremap <C-Down> }
+onoremap <C-Down> }
+
+command! GotoLine :call <SID>GotoLine()
+
+function! <SID>GotoLine()
+  let targetline = input("Goto line: ")
+  if targetline =~ "^\\d\\+$"
+    execute "normal! " . targetline . "G0"
+  elseif targetline =~ "^\\d\\+%$"
+    execute "normal! " . targetline . "%"
+  elseif targetline == ""
+    echo "(cancelled)"
+  else
+    echo " <- Not a Number"
+  endif
+endfunction
+
+command! GotoLine :call <SID>GotoLine()
+
+
+"
+" General Editing
+"
+
+inoremap <C-c> <Space><Left>
+inoremap <C-u> <C-o>d0
+inoremap <C-q> <C-v>
+inoremap <C-^> <C-y>
+inoremap <M-r> <C-r>=
+
+"" Aborting
+cnoremap <C-g> <C-c>
+onoremap <C-g> <C-c>
+
+
+"
+" Killing and Deleting
+"
+
+inoremap <C-d> <Del>
+inoremap <silent> <M-d> <C-r>=<SID>KillWord()<CR>
+inoremap <M-> <C-w>
+inoremap <M-BS> <C-w>
+inoremap <C-BS> <C-w>
+inoremap <silent> <C-k> <C-r>=<SID>KillLine()<CR>
+" Thanks to Benji Fisher for helping me with getting <C-k> to work!
+inoremap <M-0><C-k> <C-o>d0
+inoremap <M-k> <C-o>d)
+inoremap <C-x><BS> <C-o>d(
+inoremap <M-z> <C-o>dt
+inoremap <M-\> <Esc>beldwi
+
+function! <SID>KillWord()
+  if col('.') > strlen(getline('.'))
+    return "\<Del>\<C-o>dw"
+  else
+    return "\<C-o>dw"
+  endif
+endfunction
+
+function! <SID>KillLine()
+  if col('.') > strlen(getline('.'))
+    " At EOL; join with next line
+    return "\<Del>"
+  else
+    " Not at EOL; kill until end of line
+    return "\<C-o>d$"
+  endif
+endfunction
+
+
+"
+" Abbreviations
+" 
+
+inoremap <M-/> <C-p>
+inoremap <C-M-/> <C-x>
+inoremap <C-M-x> <C-x>
+inoremap <C-]> <C-x>
+
+
+"
+" Visual stuff (aka 'marking' aka 'region' aka 'block' etc etc)
+"
+
+set sel=exclusive
+" Visual mode
+inoremap <silent> <C-Space> <C-r>=<SID>StartVisualMode()<CR>
+" Unix terminals produce <C-@>, not <C-Space>
+imap <C-@> <C-Space>
+vnoremap <C-x><C-Space> <Esc>
+vnoremap <C-g> <Esc>
+vnoremap <C-x><C-@> <Esc>
+vnoremap <M-w> "1y
+"May have to change to "1d and paste ...
+
+" Marking blocks
+inoremap <M-Space> <C-o>:call <SID>StartMarkSel()<CR><C-o>viw
+inoremap <M-h> <C-o>:call <SID>StartMarkSel()<CR><C-o>vap
+inoremap <C-<> <C-o>:call <SID>StartMarkSel()<CR><C-o>v1G0o
+inoremap <C->> <C-o>:call <SID>StartMarkSel()<CR><C-o>vG$o
+inoremap <C-x>h <C-o>:call <SID>StartMarkSel()<CR><Esc>1G0vGo
+
+" Block operations
+vnoremap <C-w> "1d
+vnoremap <S-Del> "_d
+vnoremap <C-x><C-x> o
+vnoremap <C-x><C-u> U
+vnoremap <M-x> :
+
+" Pasting
+inoremap <silent> <C-y> <C-o>:call <SID>ResetKillRing()<CR><C-r><C-o>"
+inoremap <S-Ins> <C-r><C-o>*
+"inoremap <M-y> <C-o>:echoerr "Sorry, yank-pop is not yet implemented!"<CR>
+inoremap <M-y> <C-o>:call <SID>YankPop()<CR>
+
+function! <SID>YankPop()
+  undo
+  if !exists("s:kill_ring_position")
+    call <SID>ResetKillRing()
+  endif
+  execute "normal! i\<C-r>\<C-o>" . s:kill_ring_position . "\<Esc>"
+  call <SID>IncrKillRing()
+endfunction
+
+function! <SID>ResetKillRing()
+  let s:kill_ring_position = 3
+endfunction
+
+function! <SID>IncrKillRing()
+  if s:kill_ring_position >= 9
+    let s:kill_ring_position = 2
+  else
+    let s:kill_ring_position = s:kill_ring_position + 1
+  endif
+endfunction
+
+function! <SID>StartMarkSel()
+  if &selectmode =~ 'key'
+    set keymodel-=stopsel
+  endif
+endfunction
+
+function! <SID>StartVisualMode()
+  call <SID>StartMarkSel()
+  if col('.') > strlen(getline('.'))
+    " At EOL
+    return "\<Right>\<C-o>v\<Left>"
+  else
+    return "\<C-o>v"
+  endif
+endfunction
+
+
+"
+" Use <Shift> to select text, ala Windows.
+" (XEmacs supports this)
+"
+
+" We need to make sure that the 'keymodel' option has stopsel before we
+" start the actual marking, so that the user can cancel it with any
+" navigational key as she normally would.  This is in contrast to the
+" <C-Space> style of marking, where navigational keys do _not_ cancel
+" marking.
+"
+" Note that this doesn't work properly if the user remaps 
+
+inoremap <silent> <S-Up>       <C-o>:call <SID>StartShiftSel()<CR><S-Up>
+inoremap <silent> <S-Down>     <C-o>:call <SID>StartShiftSel()<CR><S-Down>
+inoremap <silent> <S-Left>     <C-o>:call <SID>StartShiftSel()<CR><S-Left>
+inoremap <silent> <S-Right>    <C-o>:call <SID>StartShiftSel()<CR><S-Right>
+inoremap <silent> <S-End>      <C-o>:call <SID>StartShiftSel()<CR><S-End>
+inoremap <silent> <S-Home>     <C-o>:call <SID>StartShiftSel()<CR><S-Home>
+inoremap <silent> <S-PageUp>   <C-o>:call <SID>StartShiftSel()<CR><S-PageUp>
+inoremap <silent> <S-PageDown> <C-o>:call <SID>StartShiftSel()<CR><S-PageDown>
+
+function! <SID>StartShiftSel()
+  if &selectmode =~ "key"
+    set keymodel+=stopsel
+  endif
+endfunction
+
+
+"
+" Window Operations
+"
+
+inoremap <C-x>2 <C-o><C-w>s
+inoremap <C-x>3 <C-o><C-w>v
+inoremap <C-x>0 <C-o><C-w>c
+inoremap <C-x>1 <C-o><C-w>o
+inoremap <C-x>o <C-o><C-w>w
+" <C-x>O is not defined in Emacs ...
+inoremap <C-x>O <C-o><C-w>W
+inoremap <C-Tab> <C-o><C-w>w
+inoremap <C-S-Tab> <C-o><C-w>W
+inoremap <C-x>+ <C-o><C-w>=
+inoremap <silent> <C-M-v> <C-o>:ScrollOtherWindow<CR>
+
+inoremap <C-x>4<C-f> <C-o>:FindFileOtherWindow<Space>
+inoremap <C-x>4f <C-o>:FindFileOtherWindow<Space>
+
+function! <SID>number_of_windows()
+  let i = 1
+  while winbufnr(i) != -1
+    let i = i + 1
+  endwhile
+  return i - 1
+endfunction
+
+function! <SID>FindFileOtherWindow(filename)
+  let num_windows = <SID>number_of_windows()
+  if num_windows <= 1
+    wincmd s
+  endif
+  wincmd w
+  execute "edit " . a:filename
+  wincmd W
+endfunction
+
+command! -nargs=1 -complete=file FindFileOtherWindow :call <SID>FindFileOtherWindow(<f-args>)
+
+command! ScrollOtherWindow silent! execute "normal! \<C-w>w\<PageDown>\<C-w>W"
+
+
+"
+" Formatting
+"
+
+inoremap <silent> <M-q> <C-o>:call <SID>FillParagraph()<CR>
+inoremap <script> <C-o> <CR><Left>
+inoremap <C-M-o> <C-o>:echoerr "<C-M-o> not supported yet; sorry!"<CR>
+inoremap <C-x><C-o> <C-o>:call <SID>DeleteBlankLines()<CR>
+" Try GoZ<Esc>:g/^$/.,/./-j<CR>Gdd
+inoremap <M-^> <Up><End><C-o>J
+vnoremap <C-M-\> =
+vnoremap <C-x><Tab> =
+
+command! FillParagraph :call <SID>FillParagraph()
+
+function! <SID>FillParagraph()
+  let old_cursor_pos = <SID>Mark()
+  normal! gqip
+  execute old_cursor_pos
+endfunction
+
+function! <SID>DeleteBlankLines()
+  if getline(".") == "" || getline(". + 1") == "" || getline(". - 1") == ""
+    ?^.\+$?+1,/^.\+$/-2d"_"
+  endif
+  normal j
+endfunction
+
+
+
+"
+" Case Change
+" 
+
+inoremap <M-l> <C-o>gul<C-o>w
+inoremap <M-u> <C-o>gUe<C-o>w
+inoremap <M-c> <C-o>gUl<C-o>w
+
+
+"
+" Buffers
+"
+
+inoremap <C-x>b <C-r>=<SID>BufExplorerOrBufferList()<CR>
+inoremap <C-x><C-b> <C-o>:buffers<CR>
+inoremap <C-x>k <C-o>:bdelete<Space>
+
+"" Integration with the BufExplorer plugin.  Phear :)  (I so love <C-r>=)
+function! <SID>BufExplorerOrBufferList()
+  if exists(":BufExplorer")
+    if !exists("g:bufExplorerSortBy")
+      " If user hasn't specified a sort order, default to MRU because that's
+      " the default in Emacs, and also select the last viewed file.
+      let g:bufExplorerSortBy = "mru"
+    endif
+"   echo bufexplorer_initial_keys
+    return "\<C-o>:BufExplorer\<CR>"
+  else
+    return "\<C-o>:buffer \<Tab>"
+  endif
+endfunction
+
+
+"
+" Marks (a.k.a. "Registers" in Emacs)
+"
+
+inoremap <C-x>/ <C-o>:call <SID>PointToRegister()<CR>
+inoremap <C-x>r<Space> <C-o>:call <SID>PointToRegister()<CR>
+inoremap <C-x>r<C-Space> <C-o>:call <SID>PointToRegister()<CR>
+inoremap <C-x>r<C-@> <C-o>:call <SID>PointToRegister()<CR>
+
+inoremap <C-x>rj <C-o>:call <SID>JumpToRegister()<CR>
+inoremap <C-x>p <C-o><C-o>
+" <C-x>p not in Emacs -- goes to Previous entry in jump list
+
+command! PointToRegister :call PointToRegister()
+command! JumpToRegister :call JumpToRegister()
+
+function! <SID>PointToRegister()
+  echo "Point to mark: "
+  let c = nr2char(getchar())
+  execute "normal! m" . c
+endfunction
+
+function! <SID>JumpToRegister()
+  echo "Jump to mark: "
+  let c = nr2char(getchar())
+  execute "normal! `" . c
+endfunction
+
+
+
+"
+" Transposing
+"
+
+"" for testing -- foo bar baz quux
+
+inoremap <C-t> <Left><C-o>x<C-o>p
+" M-t behaviour is not exactly the same as Emacs; live with it or send me
+" a patch :)  (Personally, I find Emacs's M-t behaviour not very
+" Do-What-I-Mean'ish anyway)
+inoremap <M-t> <Esc>dawbhpi
+inoremap <C-x><C-t> <Up><C-o>dd<End><C-o>p<Down>
+inoremap <C-M-t> <C-o>:echoerr "C-M-t is not implemented yet; sorry!"<CR>
+
+
+"
+" Tags
+"
+
+inoremap <M-.> <C-o><C-]>
+inoremap <M-*> <C-o><C-t>
+inoremap <C-x>4. <C-o><C-w>}
+
+
+"
+" Shells
+"
+
+vnoremap <M-!> !
+inoremap <M-!> <C-o>:!
+
+
+"
+" Rectangles
+"
+
+vnoremap <C-x>r <C-v>
+
+
+"
+" Abbreviations?
+"
+
+
+"
+" GNU Info Reader?
+"
+
+
+"
+" Keyboard Macros
+"
+
+
+"
+" Redraw
+"
+
+inoremap <C-l> <C-o>zz<C-o><C-l>
+
+
+"
+" Enable menus in the console (like GNU Emacs)
+" Thanks to Piet Delport for this great idea!
+" 
+
+LetDefault g:VM_F10Menu 1
+
+if g:VM_F10Menu == 1
+  runtime menu.vim
+  inoremap <F10> <C-o>:emenu <Tab>
+endif
+
+
+"
+" We're done :)
+"
+
+delcommand LetDefault
+delfunction s:LetDefault
+
+" Restore cpoptions
+let &cpoptions = s:saved_cpoptions
+
+let loaded_vimacs = 1
+
+" vim:sw=2
+