diff options
author | Bram Moolenaar <Bram@vim.org> | 2004-06-13 20:20:40 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2004-06-13 20:20:40 +0000 |
commit | 071d4279d6ab81b7187b48f3a0fc61e587b6db6c (patch) | |
tree | 221cbe3c40e043163c06f61c52a7ba2eb41e12ce /runtime/macros | |
parent | b4210b3bc14e2918f153a7307530fbe6eba659e1 (diff) |
updated for version 7.0001v7.0001
Diffstat (limited to 'runtime/macros')
38 files changed, 2972 insertions, 0 deletions
diff --git a/runtime/macros/README.txt b/runtime/macros/README.txt new file mode 100644 index 0000000000..61066c5a56 --- /dev/null +++ b/runtime/macros/README.txt @@ -0,0 +1,22 @@ +The macros in the maze, hanoi and urm directories can be used to test Vim for +vi compatibility. They have been written for vi to show its unlimited +possibilities. The life macros can be used for performance comparisons. + +hanoi Macros that solve the tower of hanoi problem. +life Macros that run Conway's game of life. +maze Macros that solve a maze (amazing!). +urm Macros that simulate a simple computer: "Universal Register Machine" + + +The other files contain some handy utilities. They also serve as examples for +how to use Vi and Vim functionality. + +dvorak for when you use a Dvorak keyboard +justify.vim user function for justifying text +matchit.vim + matchit.txt make % match if-fi, HTML tags, and much more +less.sh + less.vim make Vim work like less (or more) +shellmenu.vim menus for editing shell scripts in the GUI version +swapmous.vim swap left and right mouse buttons + +This one is only for Unix. It can be found in the extra archive: +file_select.vim macros that make a handy file selector diff --git a/runtime/macros/README.txt.info b/runtime/macros/README.txt.info Binary files differnew file mode 100644 index 0000000000..d173e72e7f --- /dev/null +++ b/runtime/macros/README.txt.info diff --git a/runtime/macros/dvorak b/runtime/macros/dvorak new file mode 100644 index 0000000000..0c75888703 --- /dev/null +++ b/runtime/macros/dvorak @@ -0,0 +1,164 @@ +When using a dvorak keyboard this file may be of help to you. +These mappings have been made by Lawrence Kesteloot <kesteloo@cs.unc.edu>. +What they do is that the most often used keys, like hjkl, are put in a more +easy to use position. +It may take some time to learn using this. + +Put these lines in your .vimrc: +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +" Key to go into dvorak mode: +map ,d :source ~/.dvorak +" Key to get out of dvorak mode: +map ,q :source ~/.qwerty +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +write these lines into the file ~/.dvorak: +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +" Dvorak keyboard, only in insert mode and ex mode. +" You may want to add a list of map's too. +imap! a a +imap! b x +imap! c j +imap! d e +imap! e . +imap! f u +imap! g i +imap! h d +imap! i c +imap! j h +imap! k t +imap! l n +imap! m m +imap! n b +imap! o r +imap! p l +imap! q ' +imap! r p +imap! s o +imap! t y +imap! u g +imap! v k +imap! w , +imap! x q +imap! y f +imap! z ; +imap! ; s +imap! ' - +imap! " _ +imap! , w +imap! . v +imap! / z +imap! A A +imap! B X +imap! C J +imap! D E +imap! E > +imap! F U +imap! G I +imap! H D +imap! I C +imap! J H +imap! K T +imap! L N +imap! M M +imap! N B +imap! O R +imap! P L +imap! Q " +imap! R P +imap! S O +imap! T Y +imap! U G +imap! V K +imap! W < +imap! X Q +imap! Y F +imap! Z : +imap! < W +imap! > V +imap! ? Z +imap! : S +imap! [ / +imap! ] = +imap! { ? +imap! } + +imap! - [ +imap! _ { +imap! = ] +imap! + } +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- + +write these lines into the file ~/.qwerty +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +" Qwerty keyboard +unmap! a +unmap! b +unmap! c +unmap! d +unmap! e +unmap! f +unmap! g +unmap! h +unmap! i +unmap! j +unmap! k +unmap! l +unmap! m +unmap! n +unmap! o +unmap! p +unmap! q +unmap! r +unmap! s +unmap! t +unmap! u +unmap! v +unmap! w +unmap! x +unmap! y +unmap! z +unmap! ; +unmap! ' +unmap! \" +unmap! , +unmap! . +unmap! / +unmap! A +unmap! B +unmap! C +unmap! D +unmap! E +unmap! F +unmap! G +unmap! H +unmap! I +unmap! J +unmap! K +unmap! L +unmap! M +unmap! N +unmap! O +unmap! P +unmap! Q +unmap! R +unmap! S +unmap! T +unmap! U +unmap! V +unmap! W +unmap! X +unmap! Y +unmap! Z +unmap! < +unmap! > +unmap! ? +unmap! : +unmap! [ +unmap! ] +unmap! { +unmap! } +unmap! - +unmap! _ +unmap! = +unmap! + +-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- diff --git a/runtime/macros/hanoi.info b/runtime/macros/hanoi.info Binary files differnew file mode 100644 index 0000000000..8072e56788 --- /dev/null +++ b/runtime/macros/hanoi.info diff --git a/runtime/macros/hanoi/click.me b/runtime/macros/hanoi/click.me new file mode 100644 index 0000000000..24f178bfe3 --- /dev/null +++ b/runtime/macros/hanoi/click.me @@ -0,0 +1,14 @@ + + +See Vim solve the towers of Hanoi! + +Instructions: + type ":so hanoi.vim<RETURN>" to load the macros + type "g" to start it + +and watch it go. + + to quit type ":q!<RETURN>" +to interrupt type CTRL-C + +(This text will disappear as soon as you type "g") diff --git a/runtime/macros/hanoi/click.me.info b/runtime/macros/hanoi/click.me.info Binary files differnew file mode 100644 index 0000000000..f38cb5a0ac --- /dev/null +++ b/runtime/macros/hanoi/click.me.info diff --git a/runtime/macros/hanoi/hanoi.vim b/runtime/macros/hanoi/hanoi.vim new file mode 100644 index 0000000000..834d6f2c4b --- /dev/null +++ b/runtime/macros/hanoi/hanoi.vim @@ -0,0 +1,64 @@ +set remap +set noterse +set wrapscan +" to set the height of the tower, change the digit in the following +" two lines to the height you want (select from 1 to 9) +map t 7 +map! t 7 +map L 1G/t
X/^0
$P1GJ$An$BGC0e$X0E0F$X/T
@f
@h
$A1GJ@f0l$Xn$PU +map g IL + +map J /^0[^t]*$
+map X x +map P p +map U L +map A "fyl +map B "hyl +map C "fp +map e "fy2l +map E "hp +map F "hy2l + +" initialisations: +" KM cleanup buffer +" Y create tower of desired height +" NOQ copy it and inster a T +" NO copy this one +" S change last char into a $ +" R change last char in previous line into a n +" T insert two lines containing a zero +" V add a last line containing a backslash +map I KMYNOQNOSkRTV + +"create empty line +map K 1Go + +"delete to end of file +map M dG + +"yank one line +map N yy + +"put +map O p + +"delete more than height-of-tower characters +map q tllD + +"create a tower of desired height +map Y o0123456789Z0q + +"insert a T in column 1 +map Q 0iT + +"substitute last character with a n +map R $rn + +"substitute last character with a $ +map S $r$ + +"insert two lines containing a zero +map T ko0
0
+ +"add a backslash at the end +map V Go/ diff --git a/runtime/macros/hanoi/poster b/runtime/macros/hanoi/poster new file mode 100644 index 0000000000..dd03b2613d --- /dev/null +++ b/runtime/macros/hanoi/poster @@ -0,0 +1,36 @@ +Article 2913 of alt.sources: +Path: oce-rd1!hp4nl!mcsun!uunet!munnari.oz.au!metro!cluster!swift!softway!otc!gregm +From: gregm@otc.otca.oz.au (Greg McFarlane) +Newsgroups: comp.sources.d,alt.sources,comp.editors +Subject: VI SOLVES HANOI +Message-ID: <2323@otc.otca.oz> +Date: 19 Feb 91 01:32:14 GMT +Sender: news@otc.otca.oz +Reply-To: gregm@otc.otca.oz.au (Greg McFarlane) +Organization: OTC Development Unit, Australia +Lines: 80 +Xref: oce-rd1 comp.sources.d:5702 alt.sources:2913 comp.editors:2313 + +Submitted-by: gregm@otc.otca.oz.au +Archive-name: hanoi.vi.macros/part01 + +Everyone seems to be writing stupid Tower of Hanoi programs. +Well, here is the stupidest of them all: the hanoi solving vi macros. + +Save this article, unshar it, and run uudecode on hanoi.vi.macros.uu. +This will give you the macro file hanoi.vi.macros. +Then run vi (with no file: just type "vi") and type: + :so hanoi.vi.macros + g +and watch it go. + +The default height of the tower is 7 but can be easily changed by editing +the macro file. + +The disks aren't actually shown in this version, only numbers representing +each disk, but I believe it is possible to write some macros to show the +disks moving about as well. Any takers? + +(For maze solving macros, see alt.sources or comp.editors) + +Greg diff --git a/runtime/macros/hanoi/poster.info b/runtime/macros/hanoi/poster.info Binary files differnew file mode 100644 index 0000000000..780fa35ede --- /dev/null +++ b/runtime/macros/hanoi/poster.info diff --git a/runtime/macros/justify.vim b/runtime/macros/justify.vim new file mode 100644 index 0000000000..41d0591fe4 --- /dev/null +++ b/runtime/macros/justify.vim @@ -0,0 +1,316 @@ +" Function to left and rigt align text. +" +" Written by: Preben "Peppe" Guldberg <c928400@student.dtu.dk> +" Created: 980806 14:13 (or around that time anyway) +" Revised: 001103 00:36 (See "Revisions" below) + + +" function Justify( [ textwidth [, maxspaces [, indent] ] ] ) +" +" Justify() will left and right align a line by filling in an +" appropriate amount of spaces. Extra spaces are added to existing +" spaces starting from the right side of the line. As an example, the +" following documentation has been justified. +" +" The function takes the following arguments: + +" textwidth argument +" ------------------ +" If not specified, the value of the 'textwidth' option is used. If +" 'textwidth' is zero a value of 80 is used. +" +" Additionally the arguments 'tw' and '' are accepted. The value of +" 'textwidth' will be used. These are handy, if you just want to specify +" the maxspaces argument. + +" maxspaces argument +" ------------------ +" If specified, alignment will only be done, if the longest space run +" after alignment is no longer than maxspaces. +" +" An argument of '' is accepted, should the user like to specify all +" arguments. +" +" To aid user defined commands, negative values are accepted aswell. +" Using a negative value specifies the default behaviour: any length of +" space runs will be used to justify the text. + +" indent argument +" --------------- +" This argument specifies how a line should be indented. The default is +" to keep the current indentation. +" +" Negative values: Keep current amount of leading whitespace. +" Positive values: Indent all lines with leading whitespace using this +" amount of whitespace. +" +" Note that the value 0, needs to be quoted as a string. This value +" leads to a left flushed text. +" +" Additionally units of 'shiftwidth'/'sw' and 'tabstop'/'ts' may be +" added. In this case, if the value of indent is positive, the amount of +" whitespace to be added will be multiplied by the value of the +" 'shiftwidth' and 'tabstop' settings. If these units are used, the +" argument must be given as a string, eg. Justify('','','2sw'). +" +" If the values of 'sw' or 'tw' are negative, they are treated as if +" they were 0, which means that the text is flushed left. There is no +" check if a negative number prefix is used to change the sign of a +" negative 'sw' or 'ts' value. +" +" As with the other arguments, '' may be used to get the default +" behaviour. + + +" Notes: +" +" If the line, adjusted for space runs and leading/trailing whitespace, +" is wider than the used textwidth, the line will be left untouched (no +" whitespace removed). This should be equivalent to the behaviour of +" :left, :right and :center. +" +" If the resulting line is shorter than the used textwidth it is left +" untouched. +" +" All space runs in the line are truncated before the alignment is +" carried out. +" +" If you have set 'noexpandtab', :retab! is used to replace space runs +" with whitespace using the value of 'tabstop'. This should be +" conformant with :left, :right and :center. +" +" If joinspaces is set, an extra space is added after '.', '?' and '!'. +" If 'cpooptions' include 'j', extra space is only added after '.'. +" (This may on occasion conflict with maxspaces.) + + +" Related mappings: +" +" Mappings that will align text using the current text width, using at +" most four spaces in a space run and keeping current indentation. +nmap _j :%call Justify('tw',4)<CR> +vmap _j :call Justify('tw',4)<CR> +" +" Mappings that will remove space runs and format lines (might be useful +" prior to aligning the text). +nmap ,gq :%s/\s\+/ /g<CR>gq1G +vmap ,gq :s/\s\+/ /g<CR>gvgq + + +" User defined command: +" +" The following is an ex command that works as a shortcut to the Justify +" function. Arguments to Justify() can be added after the command. +com! -range -nargs=* Justify <line1>,<line2>call Justify(<f-args>) +" +" The following commands are all equivalent: +" +" 1. Simplest use of Justify(): +" :call Justify() +" :Justify +" +" 2. The _j mapping above via the ex command: +" :%Justify tw 4 +" +" 3. Justify visualised text at 72nd column while indenting all +" previously indented text two shiftwidths +" :'<,'>call Justify(72,'','2sw') +" :'<,'>Justify 72 -1 2sw +" +" This documentation has been justified using the following command: +":se et|kz|1;/^" function Justify(/+,'z-g/^" /s/^" //|call Justify(70,3)|s/^/" / + +" Revisions: +" 001103: If 'joinspaces' was set, calculations could be wrong. +" Tabs at start of line could also lead to errors. +" Use setline() instead of "exec 's/foo/bar/' - safer. +" Cleaned up the code a bit. +" +" Todo: Convert maps to the new script specific form + +" Error function +function! Justify_error(message) + echohl Error + echo "Justify([tw, [maxspaces [, indent]]]): " . a:message + echohl None +endfunction + + +" Now for the real thing +function! Justify(...) range + + if a:0 > 3 + call Justify_error("Too many arguments (max 3)") + return 1 + endif + + " Set textwidth (accept 'tw' and '' as arguments) + if a:0 >= 1 + if a:1 =~ '^\(tw\)\=$' + let tw = &tw + elseif a:1 =~ '^\d\+$' + let tw = a:1 + else + call Justify_error("tw must be a number (>0), '' or 'tw'") + return 2 + endif + else + let tw = &tw + endif + if tw == 0 + let tw = 80 + endif + + " Set maximum number of spaces between WORDs + if a:0 >= 2 + if a:2 == '' + let maxspaces = tw + elseif a:2 =~ '^-\d\+$' + let maxspaces = tw + elseif a:2 =~ '^\d\+$' + let maxspaces = a:2 + else + call Justify_error("maxspaces must be a number or ''") + return 3 + endif + else + let maxspaces = tw + endif + if maxspaces <= 1 + call Justify_error("maxspaces should be larger than 1") + return 4 + endif + + " Set the indentation style (accept sw and ts units) + let indent_fix = '' + if a:0 >= 3 + if (a:3 == '') || a:3 =~ '^-[1-9]\d*\(shiftwidth\|sw\|tabstop\|ts\)\=$' + let indent = -1 + elseif a:3 =~ '^-\=0\(shiftwidth\|sw\|tabstop\|ts\)\=$' + let indent = 0 + elseif a:3 =~ '^\d\+\(shiftwidth\|sw\|tabstop\|ts\)\=$' + let indent = substitute(a:3, '\D', '', 'g') + elseif a:3 =~ '^\(shiftwidth\|sw\|tabstop\|ts\)$' + let indent = 1 + else + call Justify_error("indent: a number with 'sw'/'ts' unit") + return 5 + endif + if indent >= 0 + while indent > 0 + let indent_fix = indent_fix . ' ' + let indent = indent - 1 + endwhile + let indent_sw = 0 + if a:3 =~ '\(shiftwidth\|sw\)' + let indent_sw = &sw + elseif a:3 =~ '\(tabstop\|ts\)' + let indent_sw = &ts + endif + let indent_fix2 = '' + while indent_sw > 0 + let indent_fix2 = indent_fix2 . indent_fix + let indent_sw = indent_sw - 1 + endwhile + let indent_fix = indent_fix2 + endif + else + let indent = -1 + endif + + " Avoid substitution reports + let save_report = &report + set report=1000000 + + " Check 'joinspaces' and 'cpo' + if &js == 1 + if &cpo =~ 'j' + let join_str = '\(\. \)' + else + let join_str = '\([.!?!] \)' + endif + endif + + let cur = a:firstline + while cur <= a:lastline + + let str_orig = getline(cur) + let save_et = &et + set et + exec cur . "retab" + let &et = save_et + let str = getline(cur) + + let indent_str = indent_fix + let indent_n = strlen(indent_str) + " Shall we remember the current indentation + if indent < 0 + let indent_orig = matchstr(str_orig, '^\s*') + if strlen(indent_orig) > 0 + let indent_str = indent_orig + let indent_n = strlen(matchstr(str, '^\s*')) + endif + endif + + " Trim trailing, leading and running whitespace + let str = substitute(str, '\s\+$', '', '') + let str = substitute(str, '^\s\+', '', '') + let str = substitute(str, '\s\+', ' ', 'g') + let str_n = strlen(str) + + " Possible addition of space after punctuation + if exists("join_str") + let str = substitute(str, join_str, '\1 ', 'g') + endif + let join_n = strlen(str) - str_n + + " Can extraspaces be added? + " Note that str_n may be less than strlen(str) [joinspaces above] + if strlen(str) < tw - indent_n && str_n > 0 + " How many spaces should be added + let s_add = tw - str_n - indent_n - join_n + let s_nr = strlen(substitute(str, '\S', '', 'g') ) - join_n + let s_dup = s_add / s_nr + let s_mod = s_add % s_nr + + " Test if the changed line fits with tw + if 0 <= (str_n + (maxspaces - 1)*s_nr + indent_n) - tw + + " Duplicate spaces + while s_dup > 0 + let str = substitute(str, '\( \+\)', ' \1', 'g') + let s_dup = s_dup - 1 + endwhile + + " Add extra spaces from the end + while s_mod > 0 + let str = substitute(str, '\(\(\s\+\S\+\)\{' . s_mod . '}\)$', ' \1', '') + let s_mod = s_mod - 1 + endwhile + + " Indent the line + if indent_n > 0 + let str = substitute(str, '^', indent_str, '' ) + endif + + " Replace the line + call setline(cur, str) + + " Convert to whitespace + if &et == 0 + exec cur . 'retab!' + endif + + endif " Change of line + endif " Possible change + + let cur = cur + 1 + endwhile + + norm ^ + + let &report = save_report + +endfunction + +" EOF vim: tw=78 ts=8 sw=4 sts=4 noet ai diff --git a/runtime/macros/less.sh b/runtime/macros/less.sh new file mode 100755 index 0000000000..256936b5e3 --- /dev/null +++ b/runtime/macros/less.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# Shell script to start Vim with less.vim. +# Read stdin if no arguments were given. + +if test $# = 0; then + vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - +else + vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" +fi diff --git a/runtime/macros/less.vim b/runtime/macros/less.vim new file mode 100644 index 0000000000..48ee7ab11c --- /dev/null +++ b/runtime/macros/less.vim @@ -0,0 +1,244 @@ +" Vim script to work like "less" +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2004 Feb 19 + +" 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() + quit + endif + next + 1 + 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> + +" 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 + +" 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 <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 <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 <C-J> + unmap b + unmap <C-B> + unmap w + unmap <Esc>v + unmap u + unmap <C-U> + unmap k + 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 < |