# HG changeset patch # User vimboss # Date 1122498781 0 # Node ID 7472c565592a373abca2ea571e229b4bcbfd7b15 # Parent c773cb978acfd216004c871e883d2b31cd4cc0bf updated for version 7.0117 diff --git a/Filelist b/Filelist --- a/Filelist +++ b/Filelist @@ -511,6 +511,8 @@ RT_SCRIPTS = \ runtime/delmenu.vim \ runtime/synmenu.vim \ runtime/makemenu.vim \ + runtime/autoload/*.vim \ + runtime/autoload/README.txt \ runtime/colors/*.vim \ runtime/colors/README.txt \ runtime/compiler/*.vim \ @@ -690,6 +692,7 @@ LANG_GEN = \ # generic language files, binary LANG_GEN_BIN = \ + runtime/spell/README_en.txt \ runtime/spell/en.ascii.spl \ runtime/spell/en.latin1.spl \ runtime/spell/en.utf-8.spl \ diff --git a/runtime/autoload/README.txt b/runtime/autoload/README.txt new file mode 100644 --- /dev/null +++ b/runtime/autoload/README.txt @@ -0,0 +1,6 @@ +The autoload directory is for standard Vim autoload scripts. + +These are functions used by plugins and for general use. They will be loaded +automatically when the function is invoked. See ":help autoload". + +gzip.vim for editing compressed files diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim new file mode 100644 --- /dev/null +++ b/runtime/autoload/gzip.vim @@ -0,0 +1,173 @@ +" Vim autoload file for editing compressed files. +" Maintainer: Bram Moolenaar +" Last Change: 2005 Jul 26 + +" These functions are used by the gzip plugin. + +" Function to check that executing "cmd [-f]" works. +" The result is cached in s:have_"cmd" for speed. +fun s:check(cmd) + let name = substitute(a:cmd, '\(\S*\).*', '\1', '') + if !exists("s:have_" . name) + let e = executable(name) + if e < 0 + let r = system(name . " --version") + let e = (r !~ "not found" && r != "") + endif + exe "let s:have_" . name . "=" . e + endif + exe "return s:have_" . name +endfun + +" Set b:gzip_comp_arg to the gzip argument to be used for compression, based on +" the flags in the compressed file. +" The only compression methods that can be detected are max speed (-1) and max +" compression (-9). +fun s:set_compression(line) + " get the Compression Method + let l:cm = char2nr(a:line[2]) + " if it's 8 (DEFLATE), we can check for the compression level + if l:cm == 8 + " get the eXtra FLags + let l:xfl = char2nr(a:line[8]) + " max compression + if l:xfl == 2 + let b:gzip_comp_arg = "-9" + " min compression + elseif l:xfl == 4 + let b:gzip_comp_arg = "-1" + endif + endif +endfun + + +" After reading compressed file: Uncompress text in buffer with "cmd" +fun gzip#read(cmd) + " don't do anything if the cmd is not supported + if !s:check(a:cmd) + return + endif + + " for gzip check current compression level and set b:gzip_comp_arg. + silent! unlet b:gzip_comp_arg + if a:cmd[0] == 'g' + call s:set_compression(getline(1)) + endif + + " make 'patchmode' empty, we don't want a copy of the written file + let pm_save = &pm + set pm= + " remove 'a' and 'A' from 'cpo' to avoid the alternate file changes + let cpo_save = &cpo + set cpo-=a cpo-=A + " set 'modifiable' + let ma_save = &ma + setlocal ma + " when filtering the whole buffer, it will become empty + let empty = line("'[") == 1 && line("']") == line("$") + let tmp = tempname() + let tmpe = tmp . "." . expand(":e") + " write the just read lines to a temp file "'[,']w tmp.gz" + execute "silent '[,']w " . tmpe + " uncompress the temp file: call system("gzip -dn tmp.gz") + call system(a:cmd . " " . tmpe) + if !filereadable(tmp) + " uncompress didn't work! Keep the compressed file then. + echoerr "Error: Could not read uncompressed file" + return + endif + " delete the compressed lines; remember the line number + let l = line("'[") - 1 + if exists(":lockmarks") + lockmarks '[,']d _ + else + '[,']d _ + endif + " read in the uncompressed lines "'[-1r tmp" + setlocal nobin + if exists(":lockmarks") + execute "silent lockmarks " . l . "r " . tmp + else + execute "silent " . l . "r " . tmp + endif + + " if buffer became empty, delete trailing blank line + if empty + silent $delete _ + 1 + endif + " delete the temp file and the used buffers + call delete(tmp) + silent! exe "bwipe " . tmp + silent! exe "bwipe " . tmpe + let &pm = pm_save + let &cpo = cpo_save + let &l:ma = ma_save + " When uncompressed the whole buffer, do autocommands + if empty + if &verbose >= 8 + execute "doau BufReadPost " . expand("%:r") + else + execute "silent! doau BufReadPost " . expand("%:r") + endif + endif +endfun + +" After writing compressed file: Compress written file with "cmd" +fun gzip#write(cmd) + " don't do anything if the cmd is not supported + if s:check(a:cmd) + " Rename the file before compressing it. + let nm = resolve(expand("")) + let nmt = s:tempname(nm) + if rename(nm, nmt) == 0 + if exists("b:gzip_comp_arg") + call system(a:cmd . " " . b:gzip_comp_arg . " " . nmt) + else + call system(a:cmd . " " . nmt) + endif + call rename(nmt . "." . expand(":e"), nm) + endif + endif +endfun + +" Before appending to compressed file: Uncompress file with "cmd" +fun gzip#appre(cmd) + " don't do anything if the cmd is not supported + if s:check(a:cmd) + let nm = expand("") + + " for gzip check current compression level and set b:gzip_comp_arg. + silent! unlet b:gzip_comp_arg + if a:cmd[0] == 'g' + call s:set_compression(readfile(nm, "b", 1)[0]) + endif + + " Rename to a weird name to avoid the risk of overwriting another file + let nmt = expand(":p:h") . "/X~=@l9q5" + let nmte = nmt . "." . expand(":e") + if rename(nm, nmte) == 0 + if &patchmode != "" && getfsize(nm . &patchmode) == -1 + " Create patchmode file by creating the decompressed file new + call system(a:cmd . " -c " . nmte . " > " . nmt) + call rename(nmte, nm . &patchmode) + else + call system(a:cmd . " " . nmte) + endif + call rename(nmt, nm) + endif + endif +endfun + +" find a file name for the file to be compressed. Use "name" without an +" extension if possible. Otherwise use a weird name to avoid overwriting an +" existing file. +fun s:tempname(name) + let fn = fnamemodify(a:name, ":r") + if !filereadable(fn) && !isdirectory(fn) + return fn + endif + return fnamemodify(a:name, ":p:h") . "/X~=@l9q5" +endfun + +" vim: set sw=2 : diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim new file mode 100644 --- /dev/null +++ b/runtime/autoload/tar.vim @@ -0,0 +1,130 @@ +" vim:set ts=8 sts=4 sw=4: +" +" tar.vim -- a Vim plugin for browsing tarfiles +" Copyright (c) 2002, Michael C. Toren +" Distributed under the GNU General Public License. +" +" Version: 1.01 +" Last Change: 2005 Jul 26 +" +" Updates are available from . If you +" find this script useful, or have suggestions for improvements, please +" let me know. +" Also look there for further comments and documentation. +" +" This part defines the functions. The autocommands are in plugin/tar.vim. + +let s:version = "1.01" + +function! tar#Write(argument) + echo "ERROR: Sorry, no write support for tarfiles yet" +endfunction + +function! tar#Read(argument, cleanup) + let l:argument = a:argument + let l:argument = substitute(l:argument, '^tarfile:', '', '') + let l:argument = substitute(l:argument, '^\~', $HOME, '') + + let l:tarfile = l:argument + while 1 + if (l:tarfile == "" || l:tarfile == "/") + echo "ERROR: Could not find a readable tarfile in path:" l:argument + return + endif + + if filereadable(l:tarfile) " found it! + break + endif + + let l:tarfile = fnamemodify(l:tarfile, ":h") + endwhile + + let l:toextract = strpart(l:argument, strlen(l:tarfile) + 1) + + if (l:toextract == "") + return + endif + + let l:cat = s:TarCatCommand(l:tarfile) + execute "r !" . l:cat . " < '" . l:tarfile . "'" + \ " | tar OPxf - '" . l:toextract . "'" + + if (a:cleanup) + 0d "blank line + execute "doautocmd BufReadPost " . expand("%") + setlocal readonly + silent preserve + endif +endfunction + +function! tar#Browse(tarfile) + setlocal noswapfile + setlocal buftype=nofile + setlocal bufhidden=hide + setlocal filetype= + setlocal nobuflisted + setlocal buftype=nofile + setlocal wrap + setlocal syntax=tar + + let l:tarfile = a:tarfile + let b:tarfile = l:tarfile + let l:cat = s:TarCatCommand(l:tarfile) + + if ! filereadable(l:tarfile) + let l:tarfile = substitute(l:tarfile, '^tarfile:', '', '') + endif + + if ! filereadable(l:tarfile) + echo "ERROR: File not readable:" l:tarfile + return + endif + + call s:Say("\" tar.vim version " . s:version) + call s:Say("\" Browsing tarfile " . l:tarfile) + call s:Say("\" Hit ENTER to view a file in a new window") + call s:Say("") + + silent execute "r!" . l:cat . "<'" . l:tarfile . "'| tar Ptf - " + 0d "blank line + /^$/1 + + setlocal readonly + setlocal nomodifiable + noremap :call TarBrowseSelect() +endfunction + +function! s:TarBrowseSelect() + let l:line = getline(".") + + if (l:line =~ '^" ') + return + endif + + if (l:line =~ '/$') + echo "Please specify a file, not a directory" + return + endif + + let l:selection = "tarfile:" . b:tarfile . "/" . l:line + new + wincmd _ + execute "e " . l:selection +endfunction + +" kludge to deal with compressed archives +function! s:TarCatCommand(tarfile) + if a:tarfile =~# '\.\(gz\|tgz\|Z\)$' + let l:cat = "gzip -d -c" + elseif a:tarfile =~# '\.bz2$' + let l:cat = "bzip2 -d -c" + else + let l:cat = "cat" + endif + return l:cat +endfunction + +function! s:Say(string) + let @" = a:string + $ put +endfunction diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.0aa. Last change: 2005 Jul 06 +*index.txt* For Vim version 7.0aa. Last change: 2005 Jul 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1059,6 +1059,7 @@ The commands are sorted on the non-optio |:cNfile| :cNf[ile] go to last error in previous file |:cabbrev| :ca[bbrev] like ":abbreviate" but for Command-line mode |:cabclear| :cabc[lear] clear all abbreviations for Command-line mode +|:caddfile| :cad[dfile] add error message to current quickfix list |:call| :cal[l] call a function |:catch| :cat[ch] part of a :try command |:cbuffer| :cb[uffer] parse error messages and jump to first error @@ -1066,6 +1067,7 @@ The commands are sorted on the non-optio |:cclose| :ccl[ose] close quickfix window |:cd| :cd change directory |:center| :ce[nter] format lines at the center +|:cexpr| :cex[pr] read errors from expr and jump to first |:cfile| :cf[ile] read file with error messages and jump to first |:cfirst| :cfir[st] go to the specified error, default first one |:cgetfile| :cg[etfile] read file with error messages diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.0aa. Last change: 2005 Apr 08 +*insert.txt* For Vim version 7.0aa. Last change: 2005 Jul 26 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1004,6 +1004,7 @@ NOTE: ":append" and ":insert" don't work Note that when using this command in a function or script, the insertion only starts after the function or script is finished. + This command does not work from |:normal|. {not in Vi} {not available when compiled without the +ex_extra feature} diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -1,4 +1,4 @@ -*message.txt* For Vim version 7.0aa. Last change: 2005 Feb 13 +*message.txt* For Vim version 7.0aa. Last change: 2005 Jul 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -714,9 +714,10 @@ 3. Messages *messages* This is an (incomplete) overview of various messages that Vim gives: - *hit-enter* *press-enter* *hit-return* *press-return* > + *hit-enter* *press-enter* *hit-return* + *press-return* *hit-enter-prompt* - Hit ENTER or type command to continue + Press ENTER or type command to continue This message is given when there is something on the screen for you to read, and the screen is about to be redrawn: @@ -724,10 +725,13 @@ and the screen is about to be redrawn: - Something is displayed on the status line that is longer than the width of the window, or runs into the 'showcmd' or 'ruler' output. --> Hit or to redraw the screen and continue, without that key - being used otherwise. --> Hit ":" or any other Normal mode command character to start that command. --> Hit to copy (yank) a modeless selection to the clipboard register. +-> Press or to redraw the screen and continue, without that + key being used otherwise. +-> Press ':' or any other Normal mode command character to start that command. +-> Press 'k', 'u' or 'b' to scroll back in the messages. This works the same + way as at the |more-prompt|. Only works when 'compatible' is off and + 'more' is on. +-> Press to copy (yank) a modeless selection to the clipboard register. -> Use a menu. The characters defined for Cmdline-mode are used. -> When 'mouse' contains the 'r' flag, clicking the left mouse button works like pressing . This makes it impossible to select text though. @@ -746,8 +750,7 @@ group. *more-prompt* *pager* > -- More -- - -- More -- (RET: line, SPACE: page, d: half page, q: quit) - -- More -- (RET/BS: line, SPACE/b: page, d/u: half page, q: quit) + -- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit This message is given when the screen is filled with messages. It is only given when the 'more' option is on. It is highlighted with the |hl-MoreMsg| @@ -755,11 +758,13 @@ group. Type effect ~ or or j or one more line + d down a page (half a screen) + or down a screen + or k or one line back (*) - or next page - b or previous page (*) - d down half a page - u up half a page (*) + u up a page (half a screen) (*) + b or back a screen (*) + q, or CTRL-C stop the listing : stop the listing and enter a command-line @@ -771,8 +776,8 @@ Type effect ~ Any other key causes the meaning of the keys to be displayed. -(*) backwards scrolling is only supported for these commands: > - :clist +(*) backwards scrolling is {not in Vi}. Only scrolls back to where messages + started to scroll. (**) Clicking the left mouse button only works: - For the GUI: in the last line of the screen. - When 'r' is included in 'mouse' (but then selecting text won't work). diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.0aa. Last change: 2005 Jul 22 +*options.txt* For Vim version 7.0aa. Last change: 2005 Jul 26 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1028,7 +1028,7 @@ A jump table for the options with a shor Vim does not try to send a message to an external debugger (Netbeans or Sun Workshop). - To check wether line breaks in the balloon text work use this check: > + To check whether line breaks in the balloon text work use this check: > if has("balloon_multiline") < *'binary'* *'bin'* *'nobinary'* *'nobin'* @@ -1066,7 +1066,7 @@ A jump table for the options with a shor 'bioskey' 'biosk' boolean (default on) global {not in Vi} {only for MS-DOS} - When on the bios is called to obtain a keyboard character. This works + When on the BIOS is called to obtain a keyboard character. This works better to detect CTRL-C, but only works for the console. When using a terminal over a serial port reset this option. Also see |'conskey'|. diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 7.0aa. Last change: 2005 Jul 25 +*quickfix.txt* For Vim version 7.0aa. Last change: 2005 Jul 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -110,6 +110,11 @@ The following quickfix commands can be u Read the error file. Just like ":cfile" but don't jump to the first error. + *:cad* *:caddfile* +:cad[dfile] [errorfile] Read the error file and add the errors from the + errorfile to the current quickfix list. If a quickfix + list is not present, then a new list is created. + *:cb* *:cbuffer* *E681* :cb[uffer] [bufnr] Read the error list from the current buffer. When [bufnr] is given it must be the number of a @@ -118,6 +123,19 @@ The following quickfix commands can be u A range can be specified for the lines to be used. Otherwise all lines in the buffer are used. + *:cex* *:cexpr* +:cex[pr][!] {expr} Create a quickfix list using the result of {expr}. + If {expr} is a String, then each new-line terminated + line in the String is processed using 'errorformat' + and the result is added to the quickfix list. + If {expr} is a List, then each String item in the list + is processed and added to the quickfix list. + Non String items in the List are ignored. See |:cc| + for [!]. + Examples: > + :cexpr system('grep -n xyz *') + :cexpr getline(1, '$') +< *:cl* *:clist* :cl[ist] [from] [, [to]] List all errors that are valid |quickfix-valid|. diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 7.0aa. Last change: 2005 Jul 13 +*quickref.txt* For Vim version 7.0aa. Last change: 2005 Jul 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -933,6 +933,11 @@ Short explanation of each option: *opti |:cprevious| :cp display the previous error |:clist| :cl list all errors |:cfile| :cf read errors from the file 'errorfile' +|:cgetfile| :cg like :cfile but don't jump to the first error +|:caddfile| :cad add errors from the error file to the current + quickfix list +|:cbuffer| :cb read errors from text in a buffer +|:cexpr| :cex read errors from an expression |:cquit| :cq quit without writing and return error code (to the compiler) |:make| :make [args] start make, read errors, and jump to first diff --git a/runtime/doc/tags b/runtime/doc/tags --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -1753,6 +1753,8 @@ 90.5 usr_90.txt /*90.5* :cabbrev map.txt /*:cabbrev* :cabc map.txt /*:cabc* :cabclear map.txt /*:cabclear* +:cad quickfix.txt /*:cad* +:caddfile quickfix.txt /*:caddfile* :cal eval.txt /*:cal* :call eval.txt /*:call* :cat eval.txt /*:cat* @@ -1766,6 +1768,8 @@ 90.5 usr_90.txt /*90.5* :cd- editing.txt /*:cd-* :ce change.txt /*:ce* :center change.txt /*:center* +:cex quickfix.txt /*:cex* +:cexpr quickfix.txt /*:cexpr* :cf quickfix.txt /*:cf* :cfile quickfix.txt /*:cfile* :cfir quickfix.txt /*:cfir* @@ -5188,6 +5192,7 @@ histget() eval.txt /*histget()* histnr() eval.txt /*histnr()* history cmdline.txt /*history* hit-enter message.txt /*hit-enter* +hit-enter-prompt message.txt /*hit-enter-prompt* hit-return message.txt /*hit-return* hitest.vim syntax.txt /*hitest.vim* hjkl usr_02.txt /*hjkl* @@ -5828,6 +5833,7 @@ new-printing version6.txt /*new-printing new-runtime-dir version5.txt /*new-runtime-dir* new-script version5.txt /*new-script* new-script-5.4 version5.txt /*new-script-5.4* +new-scroll-back version7.txt /*new-scroll-back* new-search-path version6.txt /*new-search-path* new-searchpat version6.txt /*new-searchpat* new-session-files version5.txt /*new-session-files* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.0aa. Last change: 2005 Jul 25 +*todo.txt* For Vim version 7.0aa. Last change: 2005 Jul 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -58,13 +58,13 @@ Awaiting response: PLANNED FOR VERSION 7.0: -- Store messages to allow SCROLLING BACK for all commands. And other "less" - like commands. - "INTELLISENSE". First cleanup the Insert-mode completion. http://www.vim.org/scripts/script.php?script_id=747 www.vim.org script 1213 (Java Development Environment) (Fuchuan Wang) http://sourceforge.net/projects/insenvim of http://insenvim.sourceforge.net + IComplete: http://www.vim.org/scripts/script.php?script_id=1265 + and http://stud4.tuwien.ac.at/~e0125672/icomplete/ http://cedet.sourceforge.net/intellisense.shtml (for Emacs) Ivan Villanueva has something for Java. Ideas from Emads: @@ -104,12 +104,21 @@ PLANNED FOR VERSION 7.0: keep undo: "3h", "1d", "2w", "1y", etc. For the file use dot and extension: ".filename.un~" (like swapfile but "un~" instead of "swp"). 7 Support WINDOW TABS. Works like several pages, each with their own - split windows. Patch for GTK 1.2 passed on by Christian Michon, 2004 Jan 6. + split windows. + In Emacs these are called frames. Could also call them "pages". + Use the name of the first buffer in the tab (ignoring the help window, + unless it's the only one). Add a number for the window count. + First make it work on the console. Use a line of text with highlighting. + Then add GUI Tabs for some systems. + Patch for GTK 1.2 passed on by Christian Michon, 2004 Jan 6. + Simple patch for GTK by Luis M (nov 7). Don't forget to provide an "X" to close a tab. - Also for the console! - In Emacs these are called frames. Could also call them "pages". + Implementation: keep the list of windows as-is. When switching to another + tab make the buffers in the current windows hidden, save the window + layout, buildup the other window layout and fill with buffers. + Need to be able to search the windows in inactive tabs, e.g. for the + quickfix window. Use "1gt" - "99gt" to switch to a tab? - Simple patch for GTK by Luis M (nov 7). - EMBEDDING: Make it possible to run Vim inside a window of another program. For Xwindows this can be done with XReparentWindow(). For GTK Neil Bird has a patch to use Vim like a widget. @@ -238,10 +247,6 @@ Commands to use the location list: :lgetfile idem, don't jump to first one :lbuffer idem, from current buffer. -7 Add a ":cstring" command. Works like ":cfile" but reads from a string - variable. Also accept a list variable? Patch from Yegappan Lakshmanan. - 2005 Feb 17 Now it's ":cexpr". - HTML indenting can be slow, find out why. Any way to do some kind of profiling for Vim script? At least add a function to get the current time in usec. reltime([start, [end]]) diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.0aa. Last change: 2005 Jul 25 +*version7.txt* For Vim version 7.0aa. Last change: 2005 Jul 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -25,6 +25,7 @@ MzScheme interface |new-MzScheme| Printing multi-byte text |new-print-multi-byte| Translated manual pages |new-manpage-trans| Internal grep |new-vimgrep| +Scroll back in messages |new-scroll-back| POSIX compatibility |new-posix| Debugger support |new-debug-support| Various new items |new-items-7| @@ -227,6 +228,17 @@ expands into an arbitrary depth of direc places where file names are expanded, thus also with |:next| and |:args|. +Scroll back in messages *new-scroll-back* +----------------------- + +When displaying messages, at the |more-prompt| and the |hit-enter-prompt|, The +'k', 'u' and 'b' keys can be used to scroll back to previous messages. This +is especially useful for commands such as ":syntax", ":autocommand" and +":highlight". This is implemented in a generic way thus it works for all +commands and highlighting is kept. Only works when the 'more' option is set. +Previously it only partly worked for ":clist". + + POSIX compatibility *new-posix* ------------------- @@ -350,6 +362,12 @@ Win32: The ":winpos" command now also wo |:sort| Sort lines in the buffer without depending on an external command. +|:caddfile| Add error messages to an existing quickfix list + (Yegappan Lakshmanan). + +|:cexpr| Read error messages from a Vim expression (Yegappan + Lakshmanan). + New functions: ~ @@ -1214,4 +1232,12 @@ When using command line completion for " the resulting command ":e +foo" doesn't work. Now insert a backslash: ":e \+foo". +When the translation of "-- More --" was not 10 characters long the following +message would be in the wrong position. + +At the more-prompt the last character in the last line wasn't drawn. + +When deleting non-existing text while 'virtualedit' is set the '[ and '] marks +were not set. + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/ftplugin/diff.vim b/runtime/ftplugin/diff.vim new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/diff.vim @@ -0,0 +1,15 @@ +" Vim filetype plugin file +" Language: Diff +" Maintainer: Bram Moolenaar +" Last Change: 2005 Jul 27 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl modeline<" + +" Don't use modelines in a diff, they apply to the diffed file +setlocal nomodeline diff --git a/runtime/plugin/NetrwFileHandlers.vim b/runtime/plugin/NetrwFileHandlers.vim --- a/runtime/plugin/NetrwFileHandlers.vim +++ b/runtime/plugin/NetrwFileHandlers.vim @@ -1,13 +1,13 @@ " NetrwFileHandlers: contains various extension-based file handlers for " netrw's browsers' x command ("eXecute launcher") -" Author: Charles E. Campbell, Jr. -" Date: Aug 31, 2004 -" Version: 3 +" Author: Charles E. Campbell, Jr. +" Date: Aug 31, 2004 +" Version: 3 " --------------------------------------------------------------------- " Prevent Reloading: {{{1 if exists("g:loaded_netrwfilehandlers") || &cp - finish + finish endif let g:loaded_netrwfilehandlers= "v3" @@ -15,22 +15,16 @@ let g:loaded_netrwfilehandlers= "v3" " NetrwFileHandler_html: handles html when the user hits "x" when the {{{1 " cursor is atop a *.html file fun! NetrwFileHandler_html(pagefile) -" call Dfunc("NetrwFileHandler_html(".a:pagefile.")") - - let page= substitute(a:pagefile,'^','file://','') + let page = substitute(a:pagefile, '^', 'file://', '') if executable("mozilla") -" call Decho("executing !mozilla ".page) - exe "!mozilla \"".page.'"' + exe "!mozilla \"" . page . '"' elseif executable("netscape") -" call Decho("executing !netscape ".page) - exe "!netscape \"".page.'"' + exe "!netscape \"" . page . '"' else -" call Dret("NetrwFileHandler_html 0") - return 0 + return 0 endif -" call Dret("NetrwFileHandler_html 1") return 1 endfun @@ -38,240 +32,192 @@ endfun " NetrwFileHandler_htm: handles html when the user hits "x" when the {{{1 " cursor is atop a *.htm file fun! NetrwFileHandler_htm(pagefile) -" call Dfunc("NetrwFileHandler_htm(".a:pagefile.")") - - let page= substitute(a:pagefile,'^','file://','') + let page = substitute(a:pagefile, '^', 'file://', '') if executable("mozilla") -" call Decho("executing !mozilla ".page) - exe "!mozilla \"".page.'"' + exe "!mozilla \"" . page . '"' elseif executable("netscape") -" call Decho("executing !netscape ".page) - exe "!netscape \"".page.'"' + exe "!netscape \"" . page . '"' else -" call Dret("NetrwFileHandler_htm 0") - return 0 + return 0 endif -" call Dret("NetrwFileHandler_htm 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_jpg: {{{1 fun! NetrwFileHandler_jpg(jpgfile) -" call Dfunc("NetrwFileHandler_jpg(jpgfile<".a:jpgfile.">)") - if executable("gimp") - exe "silent! !gimp -s ".a:jpgfile + exe "silent! !gimp -s " . a:jpgfile elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") -" call Decho("silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".escape(a:jpgfile," []|'")) - exe "!".expand("$SystemRoot")."/SYSTEM32/MSPAINT \"".a:jpgfile.'"' + exe "!" . expand("$SystemRoot") . "/SYSTEM32/MSPAINT \"" . a:jpgfile . '"' else -" call Dret("NetrwFileHandler_jpg 0") - return 0 + return 0 endif -" call Dret("NetrwFileHandler_jpg 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_gif: {{{1 fun! NetrwFileHandler_gif(giffile) -" call Dfunc("NetrwFileHandler_gif(giffile<".a:giffile.">)") - if executable("gimp") - exe "silent! !gimp -s ".a:giffile - elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT \"".a:giffile.'"' + exe "silent! !gimp -s " . a:giffile + elseif executable(expand("$SystemRoot") . "/SYSTEM32/MSPAINT.EXE") + exe "silent! !" . expand("$SystemRoot") . "/SYSTEM32/MSPAINT \"" . a:giffile . '"' else -" call Dret("NetrwFileHandler_gif 0") return 0 endif -" call Dret("NetrwFileHandler_gif 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_png: {{{1 fun! NetrwFileHandler_png(pngfile) -" call Dfunc("NetrwFileHandler_png(pngfile<".a:pngfile.">)") - if executable("gimp") - exe "silent! !gimp -s ".a:pngfile - elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT \"".a:pngfile.'"' + exe "silent! !gimp -s " . a:pngfile + elseif executable(expand("$SystemRoot") . "/SYSTEM32/MSPAINT.EXE") + exe "silent! !" . expand("$SystemRoot") . "/SYSTEM32/MSPAINT \"" . a:pngfile . '"' else -" call Dret("NetrwFileHandler_png 0") return 0 endif -" call Dret("NetrwFileHandler_png 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_pnm: {{{1 fun! NetrwFileHandler_pnm(pnmfile) -" call Dfunc("NetrwFileHandler_pnm(pnmfile<".a:pnmfile.">)") - if executable("gimp") - exe "silent! !gimp -s ".a:pnmfile - elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT \"".a:pnmfile.'"' + exe "silent! !gimp -s " . a:pnmfile + elseif executable(expand("$SystemRoot") . "/SYSTEM32/MSPAINT.EXE") + exe "silent! !" . expand("$SystemRoot") . "/SYSTEM32/MSPAINT \"" . a:pnmfile . '"' else -" call Dret("NetrwFileHandler_pnm 0") return 0 endif -" call Dret("NetrwFileHandler_pnm 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_bmp: visualize bmp files {{{1 fun! NetrwFileHandler_bmp(bmpfile) -" call Dfunc("NetrwFileHandler_bmp(bmpfile<".a:bmpfile.">)") - if executable("gimp") - exe "silent! !gimp -s ".a:bmpfile + exe "silent! !gimp -s " . a:bmpfile elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT \"".a:bmpfile.'"' + exe "silent! !" . expand("$SystemRoot") . "/SYSTEM32/MSPAINT \"" . a:bmpfile . '"' else -" call Dret("NetrwFileHandler_bmp 0") return 0 endif -" call Dret("NetrwFileHandler_bmp 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_pdf: visualize pdf files {{{1 fun! NetrwFileHandler_pdf(pdf) -" " call Dfunc("NetrwFileHandler_pdf(pdf<".a:pdf.">)") - if executable("gs") - exe 'silent! !gs "'.a:pdf.'"' + if executable("acroread") + exe 'silent! !acroread "' . a:pdf . '"' + elseif executable("gs") + exe 'silent! !gs "' . a:pdf . '"' else -" " call Dret("NetrwFileHandler_pdf 0") return 0 endif -" " call Dret("NetrwFileHandler_pdf 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_sxw: visualize sxw files {{{1 fun! NetrwFileHandler_sxw(sxw) -" " call Dfunc("NetrwFileHandler_sxw(sxw<".a:sxw.">)") if executable("gs") - exe 'silent! !gs "'.a:sxw.'"' + exe 'silent! !gs "' . a:sxw . '"' else -" " call Dret("NetrwFileHandler_sxw 0") return 0 endif -" " call Dret("NetrwFileHandler_sxw 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_doc: visualize doc files {{{1 fun! NetrwFileHandler_doc(doc) -" " call Dfunc("NetrwFileHandler_doc(doc<".a:doc.">)") - if executable("oowriter") - exe 'silent! !oowriter "'.a:doc.'"' + exe 'silent! !oowriter "' . a:doc . '"' redraw! else -" " call Dret("NetrwFileHandler_doc 0") return 0 endif -" " call Dret("NetrwFileHandler_doc 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_sxw: visualize sxw files {{{1 fun! NetrwFileHandler_sxw(sxw) -" " call Dfunc("NetrwFileHandler_sxw(sxw<".a:sxw.">)") - if executable("oowriter") - exe 'silent! !oowriter "'.a:sxw.'"' + exe 'silent! !oowriter "' . a:sxw . '"' redraw! else -" " call Dret("NetrwFileHandler_sxw 0") return 0 endif -" " call Dret("NetrwFileHandler_sxw 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_xls: visualize xls files {{{1 fun! NetrwFileHandler_xls(xls) -" " call Dfunc("NetrwFileHandler_xls(xls<".a:xls.">)") - if executable("oocalc") - exe 'silent! !oocalc "'.a:xls.'"' + exe 'silent! !oocalc "' . a:xls . '"' redraw! else -" " call Dret("NetrwFileHandler_xls 0") return 0 endif -" " call Dret("NetrwFileHandler_xls 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_ps: handles PostScript files {{{1 fun! NetrwFileHandler_ps(ps) -" call Dfunc("NetrwFileHandler_ps()") if executable("gs") - exe "silent! !gs ".a:ps + exe "silent! !gs " . a:ps redraw! elseif executable("ghostscript") - exe "silent! !ghostscript ".a:ps + exe "silent! !ghostscript " . a:ps redraw! elseif executable("ghostscript") - exe "silent! !ghostscript ".a:ps + exe "silent! !ghostscript " . a:ps redraw! elseif executable("gswin32") - exe "silent! !gswin32 \"".a:ps.'"' + exe "silent! !gswin32 \"" . a:ps . '"' redraw! else -" call Dret("NetrwFileHandler_ps 0") return 0 endif -" call Dret("NetrwFileHandler_ps 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_eps: handles encapsulated PostScript files {{{1 fun! NetrwFileHandler_eps(eps) -" call Dfunc("NetrwFileHandler_ps()") if executable("gs") - exe "silent! !gs ".a:eps + exe "silent! !gs " . a:eps redraw! elseif executable("ghostscript") - exe "silent! !ghostscript ".a:eps + exe "silent! !ghostscript " . a:eps redraw! elseif executable("ghostscript") - exe "silent! !ghostscript ".a:eps + exe "silent! !ghostscript " . a:eps redraw! elseif executable("gswin32") - exe "silent! !gswin32 \"".a:eps.'"' + exe "silent! !gswin32 \"" . a:eps . '"' redraw! else -" call Dret("NetrwFileHandler_ps 0") return 0 endif endfun @@ -279,35 +225,29 @@ endfun " --------------------------------------------------------------------- " NetrwFileHandler_fig: handles xfig files {{{1 fun! NetrwFileHandler_fig(fig) -" call Dfunc("NetrwFileHandler_fig()") if executable("xfig") - exe "silent! !xfig ".a:fig + exe "silent! !xfig " . a:fig redraw! else -" call Dret("NetrwFileHandler_fig 0") return 0 endif -" call Dret("NetrwFileHandler_fig 1") return 1 endfun " --------------------------------------------------------------------- " NetrwFileHandler_obj: handles tgif's obj files {{{1 fun! NetrwFileHandler_obj(obj) -" call Dfunc("NetrwFileHandler_obj()") if has("unix") && executable("tgif") - exe "silent! !tgif ".a:obj + exe "silent! !tgif " . a:obj redraw! else -" call Dret("NetrwFileHandler_obj 0") return 0 endif -" call Dret("NetrwFileHandler_obj 1") return 1 endfun " --------------------------------------------------------------------- -" vim: ts=4 fdm=marker +" vim: fdm=marker diff --git a/runtime/plugin/gzip.vim b/runtime/plugin/gzip.vim --- a/runtime/plugin/gzip.vim +++ b/runtime/plugin/gzip.vim @@ -1,6 +1,6 @@ " Vim plugin for editing compressed files. " Maintainer: Bram Moolenaar -" Last Change: 2005 May 18 +" Last Change: 2005 Jul 26 " Exit quickly when: " - this plugin was already loaded @@ -15,188 +15,22 @@ augroup gzip " Remove all gzip autocommands au! - " Enable editing of gzipped files - " set binary mode before reading the file - " use "gzip -d", gunzip isn't always available + " Enable editing of gzipped files. + " The functions are defined in autoload/gzip.vim. + " + " Set binary mode before reading the file. + " Use "gzip -d", gunzip isn't always available. autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z setlocal bin - autocmd BufReadPost,FileReadPost *.gz call s:read("gzip -dn") - autocmd BufReadPost,FileReadPost *.bz2 call s:read("bzip2 -d") - autocmd BufReadPost,FileReadPost *.Z call s:read("uncompress") - autocmd BufWritePost,FileWritePost *.gz call s:write("gzip") - autocmd BufWritePost,FileWritePost *.bz2 call s:write("bzip2") - autocmd BufWritePost,FileWritePost *.Z call s:write("compress -f") - autocmd FileAppendPre *.gz call s:appre("gzip -dn") - autocmd FileAppendPre *.bz2 call s:appre("bzip2 -d") - autocmd FileAppendPre *.Z call s:appre("uncompress") - autocmd FileAppendPost *.gz call s:write("gzip") - autocmd FileAppendPost *.bz2 call s:write("bzip2") - autocmd FileAppendPost *.Z call s:write("compress -f") + autocmd BufReadPost,FileReadPost *.gz call gzip#read("gzip -dn") + autocmd BufReadPost,FileReadPost *.bz2 call gzip#read("bzip2 -d") + autocmd BufReadPost,FileReadPost *.Z call gzip#read("uncompress") + autocmd BufWritePost,FileWritePost *.gz call gzip#write("gzip") + autocmd BufWritePost,FileWritePost *.bz2 call gzip#write("bzip2") + autocmd BufWritePost,FileWritePost *.Z call gzip#write("compress -f") + autocmd FileAppendPre *.gz call gzip#appre("gzip -dn") + autocmd FileAppendPre *.bz2 call gzip#appre("bzip2 -d") + autocmd FileAppendPre *.Z call gzip#appre("uncompress") + autocmd FileAppendPost *.gz call gzip#write("gzip") + autocmd FileAppendPost *.bz2 call gzip#write("bzip2") + autocmd FileAppendPost *.Z call gzip#write("compress -f") augroup END - -" Function to check that executing "cmd [-f]" works. -" The result is cached in s:have_"cmd" for speed. -fun s:check(cmd) - let name = substitute(a:cmd, '\(\S*\).*', '\1', '') - if !exists("s:have_" . name) - let e = executable(name) - if e < 0 - let r = system(name . " --version") - let e = (r !~ "not found" && r != "") - endif - exe "let s:have_" . name . "=" . e - endif - exe "return s:have_" . name -endfun - -" Set b:gzip_comp_arg to the gzip argument to be used for compression, based on -" the flags in the compressed file. -" The only compression methods that can be detected are max speed (-1) and max -" compression (-9). -fun s:set_compression(line) - " get the Compression Method - let l:cm = char2nr(a:line[2]) - " if it's 8 (DEFLATE), we can check for the compression level - if l:cm == 8 - " get the eXtra FLags - let l:xfl = char2nr(a:line[8]) - " max compression - if l:xfl == 2 - let b:gzip_comp_arg = "-9" - " min compression - elseif l:xfl == 4 - let b:gzip_comp_arg = "-1" - endif - endif -endfun - - -" After reading compressed file: Uncompress text in buffer with "cmd" -fun s:read(cmd) - " don't do anything if the cmd is not supported - if !s:check(a:cmd) - return - endif - - " for gzip check current compression level and set b:gzip_comp_arg. - silent! unlet b:gzip_comp_arg - if a:cmd[0] == 'g' - call s:set_compression(getline(1)) - endif - - " make 'patchmode' empty, we don't want a copy of the written file - let pm_save = &pm - set pm= - " remove 'a' and 'A' from 'cpo' to avoid the alternate file changes - let cpo_save = &cpo - set cpo-=a cpo-=A - " set 'modifiable' - let ma_save = &ma - setlocal ma - " when filtering the whole buffer, it will become empty - let empty = line("'[") == 1 && line("']") == line("$") - let tmp = tempname() - let tmpe = tmp . "." . expand(":e") - " write the just read lines to a temp file "'[,']w tmp.gz" - execute "silent '[,']w " . tmpe - " uncompress the temp file: call system("gzip -dn tmp.gz") - call system(a:cmd . " " . tmpe) - if !filereadable(tmp) - " uncompress didn't work! Keep the compressed file then. - echoerr "Error: Could not read uncompressed file" - return - endif - " delete the compressed lines; remember the line number - let l = line("'[") - 1 - if exists(":lockmarks") - lockmarks '[,']d _ - else - '[,']d _ - endif - " read in the uncompressed lines "'[-1r tmp" - setlocal nobin - if exists(":lockmarks") - execute "silent lockmarks " . l . "r " . tmp - else - execute "silent " . l . "r " . tmp - endif - - " if buffer became empty, delete trailing blank line - if empty - silent $delete _ - 1 - endif - " delete the temp file and the used buffers - call delete(tmp) - silent! exe "bwipe " . tmp - silent! exe "bwipe " . tmpe - let &pm = pm_save - let &cpo = cpo_save - let &l:ma = ma_save - " When uncompressed the whole buffer, do autocommands - if empty - if &verbose >= 8 - execute "doau BufReadPost " . expand("%:r") - else - execute "silent! doau BufReadPost " . expand("%:r") - endif - endif -endfun - -" After writing compressed file: Compress written file with "cmd" -fun s:write(cmd) - " don't do anything if the cmd is not supported - if s:check(a:cmd) - " Rename the file before compressing it. - let nm = resolve(expand("")) - let nmt = s:tempname(nm) - if rename(nm, nmt) == 0 - if exists("b:gzip_comp_arg") - call system(a:cmd . " " . b:gzip_comp_arg . " " . nmt) - else - call system(a:cmd . " " . nmt) - endif - call rename(nmt . "." . expand(":e"), nm) - endif - endif -endfun - -" Before appending to compressed file: Uncompress file with "cmd" -fun s:appre(cmd) - " don't do anything if the cmd is not supported - if s:check(a:cmd) - let nm = expand("") - - " for gzip check current compression level and set b:gzip_comp_arg. - silent! unlet b:gzip_comp_arg - if a:cmd[0] == 'g' - call s:set_compression(readfile(nm, "b", 1)[0]) - endif - - " Rename to a weird name to avoid the risk of overwriting another file - let nmt = expand(":p:h") . "/X~=@l9q5" - let nmte = nmt . "." . expand(":e") - if rename(nm, nmte) == 0 - if &patchmode != "" && getfsize(nm . &patchmode) == -1 - " Create patchmode file by creating the decompressed file new - call system(a:cmd . " -c " . nmte . " > " . nmt) - call rename(nmte, nm . &patchmode) - else - call system(a:cmd . " " . nmte) - endif - call rename(nmt, nm) - endif - endif -endfun - -" find a file name for the file to be compressed. Use "name" without an -" extension if possible. Otherwise use a weird name to avoid overwriting an -" existing file. -fun s:tempname(name) - let fn = fnamemodify(a:name, ":r") - if !filereadable(fn) && !isdirectory(fn) - return fn - endif - return fnamemodify(a:name, ":p:h") . "/X~=@l9q5" -endfun - -" vim: set sw=2 : diff --git a/runtime/plugin/tar.vim b/runtime/plugin/tar.vim --- a/runtime/plugin/tar.vim +++ b/runtime/plugin/tar.vim @@ -1,185 +1,34 @@ -" vim:set ts=4 sw=4 ai nobackup: - -" tar.vim -- a vim plugin for browsing tarfiles +" tar.vim -- a Vim plugin for browsing tarfiles " Copyright (c) 2002, Michael C. Toren +" Distributed under the GNU General Public License. +" +" Version: 1.01 +" Last Change: 2005 Jul 26 " " Updates are available from . If you " find this script useful, or have suggestions for improvements, please " let me know. -" -" Usage: -" Once this script is installed, attempting to edit a tarfile will present -" the user with a list of files contained in the tar archive. By moving the -" cursor over a filename and pressing ENTER, the contents of a file can be -" viewed in read-only mode, in a new window. Unfortunately, write support -" for tarfile components is not currently possible. -" -" Requirements: -" GNU tar, or a tar implementation that supports the "P" (don't strip -" out leading /'s from filenames), and "O" (extract files to standard -" output) options. Additionally, gzip is required for handling *.tar.Z, -" *.tar.gz, and *.tgz compressed tarfiles, and bzip2 is required for -" handling *.tar.bz2 compressed tarfiles. A unix-like operating system -" is probably also required. -" -" Installation: -" Place this file, tar.vim, in your $HOME/.vim/plugin directory, and -" either restart vim, or execute ":source $HOME/.vim/plugin/tar.vim" +" Also look there for further comments and documentation. " -" Todo: -" - Handle zipfiles? -" - Implement write support, somehow. -" -" License: -" This program is free software; you can redistribute it and/or modify it -" under the terms of the GNU General Public License, version 2, as published -" by the Free Software Foundation. -" -" 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. -" -" A copy of the GNU GPL is available as /usr/doc/copyright/GPL on Debian -" systems, or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html -" You can also obtain it by writing to the Free Software Foundation, Inc., -" 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA -" -" Changelog: -" Tue Dec 31 13:38:08 EST 2002 First release to beta testers -" Sat Jan 4 14:06:19 EST 2003 Version 1.00 released - -let s:version = "1.00" +" This part only sets the autocommands. The functions are in autoload/tar.vim. if has("autocmd") -augroup tar - au! - au BufReadCmd tarfile:* call s:TarRead(expand(""), 1) - au BufReadCmd tarfile:*/* call s:TarRead(expand(""), 1) - au FileReadCmd tarfile:* call s:TarRead(expand(""), 0) - au FileReadCmd tarfile:*/* call s:TarRead(expand(""), 0) - - au BufWriteCmd tarfile:* call s:TarWrite(expand("")) - au BufWriteCmd tarfile:*/* call s:TarWrite(expand("")) - au FileWriteCmd tarfile:* call s:TarWrite(expand("")) - au FileWriteCmd tarfile:*/* call s:TarWrite(expand("")) - - au BufReadCmd *.tar call s:TarBrowse(expand("")) - au BufReadCmd *.tar.gz call s:TarBrowse(expand("")) - au BufReadCmd *.tar.bz2 call s:TarBrowse(expand("")) - au BufReadCmd *.tar.Z call s:TarBrowse(expand("")) - au BufReadCmd *.tgz call s:TarBrowse(expand("")) -augroup END -endif - -function! s:TarWrite(argument) - echo "ERROR: Sorry, no write support for tarfiles yet" -endfunction - -function! s:TarRead(argument, cleanup) - let l:argument = a:argument - let l:argument = substitute(l:argument, '^tarfile:', '', '') - let l:argument = substitute(l:argument, '^\~', $HOME, '') - - let l:tarfile = l:argument - while 1 - if (l:tarfile == "" || l:tarfile == "/") - echo "ERROR: Could not find a readable tarfile in path:" l:argument - return - endif - - if filereadable(l:tarfile) " found it! - break - endif - - let l:tarfile = fnamemodify(l:tarfile, ":h") - endwhile - - let l:toextract = strpart(l:argument, strlen(l:tarfile) + 1) - - if (l:toextract == "") - return - endif - - let l:cat = s:TarCatCommand(l:tarfile) - execute "r !" . l:cat . " < '" . l:tarfile . "'" - \ " | tar OPxf - '" . l:toextract . "'" - - if (a:cleanup) - 0d "blank line - execute "doautocmd BufReadPost " . expand("%") - setlocal readonly - silent preserve - endif -endfunction + augroup tar + au! + au BufReadCmd tarfile:* call tar#Read(expand(""), 1) + au BufReadCmd tarfile:*/* call tar#Read(expand(""), 1) + au FileReadCmd tarfile:* call tar#Read(expand(""), 0) + au FileReadCmd tarfile:*/* call tar#Read(expand(""), 0) -function! s:TarBrowse(tarfile) - setlocal noswapfile - setlocal buftype=nofile - setlocal bufhidden=hide - setlocal filetype= - setlocal nobuflisted - setlocal buftype=nofile - setlocal wrap - - let l:tarfile = a:tarfile - let b:tarfile = l:tarfile - let l:cat = s:TarCatCommand(l:tarfile) - - if ! filereadable(l:tarfile) - let l:tarfile = substitute(l:tarfile, '^tarfile:', '', '') - endif - - if ! filereadable(l:tarfile) - echo "ERROR: File not readable:" l:tarfile - return - endif - - call s:Say("\" tar.vim version " . s:version) - call s:Say("\" Browsing tarfile " . l:tarfile) - call s:Say("\" Hit ENTER to view contents in new window") - call s:Say("") - - silent execute "r!" . l:cat . "<'" . l:tarfile . "'| tar Ptf - " - 0d "blank line - /^$/1 + au BufWriteCmd tarfile:* call tar#Write(expand("")) + au BufWriteCmd tarfile:*/* call tar#Write(expand("")) + au FileWriteCmd tarfile:* call tar#Write(expand("")) + au FileWriteCmd tarfile:*/* call tar#Write(expand("")) - setlocal readonly - setlocal nomodifiable - noremap :call TarBrowseSelect() -endfunction - -function! s:TarBrowseSelect() - let l:line = getline(".") - - if (l:line =~ '^" ') - return - endif - - if (l:line =~ '/$') - echo "Please specify a file, not a directory" - return - endif - - let l:selection = "tarfile:" . b:tarfile . "/" . l:line - new - wincmd _ - execute "e " . l:selection -endfunction - -" kludge to deal with compressed archives -function! s:TarCatCommand(tarfile) - if a:tarfile =~# '\.\(gz\|tgz\|Z\)$' - let l:cat = "gzip -d -c" - elseif a:tarfile =~# '\.bz2$' - let l:cat = "bzip2 -d -c" - else - let l:cat = "cat" - endif - return l:cat -endfunction - -function! s:Say(string) - let @" = a:string - $ put -endfunction + au BufReadCmd *.tar call tar#Browse(expand("")) + au BufReadCmd *.tar.gz call tar#Browse(expand("")) + au BufReadCmd *.tar.bz2 call tar#Browse(expand("")) + au BufReadCmd *.tar.Z call tar#Browse(expand("")) + au BufReadCmd *.tgz call tar#Browse(expand("")) + augroup END +endif diff --git a/runtime/spell/README_en.txt b/runtime/spell/README_en.txt new file mode 100644 --- /dev/null +++ b/runtime/spell/README_en.txt @@ -0,0 +1,914 @@ +en_US +20040623 release. +-- +This dictionary is based on a subset of the original +English wordlist created by Kevin Atkinson for Pspell +and Aspell and thus is covered by his original +LGPL license. The affix file is a heavily modified +version of the original english.aff file which was +released as part of Geoff Kuenning's Ispell and as +such is covered by his BSD license. + +Thanks to both authors for there wonderful work. + + +=================================================== +en_AU: +This dictionary was based on the en_GB Myspell dictionary +which in turn was initially based on a subset of the +original English wordlist created by Kevin Atkinson for +Pspell and Aspell and thus is covered by his original +LGPL licence. + +The credit for this en_AU dictionary goes to: + +Kelvin Eldridge (maintainer) +Jean Hollis Weber +David Wilson + +- Words incorrect in Australian English removed +- a list from the previously removed words with corrected spelling was added +- a list of major rivers was added +- a list of place names was added +- a list of Australian mammals was added +- a list of Aboriginal/Koori words commonly used was added + +A total of 119,267 words are now recognized +by the dictionary. + +Of course, special thanks go to the editors of the +en_GB dictionary (David Bartlett, Brian Kelk and +Andrew Brown) which provided the starting point +for this dictionary. + +The affix file is currently a duplicate of the en_AU.aff +created completely from scratch by David Bartlett and +Andrew Brown, based on the published +rules for MySpell and is also provided under the LGPL. + +If you find omissions or bugs or have new words to +add to the dictionary, please contact the en_AU +maintainer at: + + "Kelvin" + + + +=================================================== +en_CA: +The dictionary file was created using the "final" English and Canadian SCOWL (Spell Checker Oriented Word Lists) wordlists available at Kevin's Word Lists Page (http://wordlist.sourceforge.net). Lists with the suffixes 10, 20, 35, 50, 65 and 65 were used. Lists with the suffixes 70, 80 and 95 were excluded. Copyright information for SCOWL and the wordlists used in creating it is reproduced below. + +The affix file is identical to the MySpell English (United States) affix file. It is a heavily modified version of the original english.aff file which was released as part of Geoff Kuenning's Ispell and as such is covered by his BSD license. + +--- + +COPYRIGHT, SOURCES, and CREDITS from SCOWL readme file: + +The collective work is Copyright 2000 by Kevin Atkinson as well as any +of the copyrights mentioned below: + + Copyright 2000 by Kevin Atkinson + + Permission to use, copy, modify, distribute and sell these word + lists, the associated scripts, the output created from the scripts, + and its documentation for any purpose is hereby granted without fee, + provided that the above copyright notice appears in all copies and + that both that copyright notice and this permission notice appear in + supporting documentation. Kevin Atkinson makes no representations + about the suitability of this array for any purpose. It is provided + "as is" without express or implied warranty. + +Alan Beale also deserves special credit as he has, +in addition to providing the 12Dicts package and being a major +contributor to the ENABLE word list, given me an incredible amount of +feedback and created a number of special lists (those found in the +Supplement) in order to help improve the overall quality of SCOWL. + +The 10 level includes the 1000 most common English words (according to +the Moby (TM) Words II [MWords] package), a subset of the 1000 most +common words on the Internet (again, according to Moby Words II), and +frequently class 16 from Brian Kelk's "UK English Wordlist +with Frequency Classification". + +The MWords package was explicitly placed in the public domain: + + The Moby lexicon project is complete and has + been place into the public domain. Use, sell, + rework, excerpt and use in any way on any platform. + + Placing this material on internal or public servers is + also encouraged. The compiler is not aware of any + export restrictions so freely distribute world-wide. + + You can verify the public domain status by contacting + + Grady Ward + 3449 Martha Ct. + Arcata, CA 95521-4884 + + grady@netcom.com + grady@northcoast.com + +The "UK English Wordlist With Frequency Classification" is also in the +Public Domain: + + Date: Sat, 08 Jul 2000 20:27:21 +0100 + From: Brian Kelk + +> I was wondering what the copyright status of your "UK English + > Wordlist With Frequency Classification" word list as it seems to + > be lacking any copyright notice. + + There were many many sources in total, but any text marked + "copyright" was avoided. Locally-written documentation was one + source. An earlier version of the list resided in a filespace called + PUBLIC on the University mainframe, because it was considered public + domain. + + Date: Tue, 11 Jul 2000 19:31:34 +0100 + + > So are you saying your word list is also in the public domain? + + That is the intention. + +The 20 level includes frequency classes 7-15 from Brian's word list. + +The 35 level includes frequency classes 2-6 and words appearing in at +least 11 of 12 dictionaries as indicated in the 12Dicts package. All +words from the 12Dicts package have had likely inflections added via +my inflection database. + +The 12Dicts package and Supplement is in the Public Domain. + +The WordNet database, which was used in the creation of the +Inflections database, is under the following copyright: + + This software and database is being provided to you, the LICENSEE, + by Princeton University under the following license. By obtaining, + using and/or copying this software and database, you agree that you + have read, understood, and will comply with these terms and + conditions.: + + Permission to use, copy, modify and distribute this software and + database and its documentation for any purpose and without fee or + royalty is hereby granted, provided that you agree to comply with + the following copyright notice and statements, including the + disclaimer, and that the same appear on ALL copies of the software, + database and documentation, including modifications that you make + for internal use or for distribution. + + WordNet 1.6 Copyright 1997 by Princeton University. All rights + reserved. + + THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND PRINCETON + UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR + IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON + UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT- + ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE + LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE ANY + THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + + The name of Princeton University or Princeton may not be used in + advertising or publicity pertaining to distribution of the software + and/or database. Title to copyright in this software, database and + any associated documentation shall at all times remain with + Princeton University and LICENSEE agrees to preserve same. + +The 50 level includes Brian's frequency class 1, words words appearing +in at least 5 of 12 of the dictionaries as indicated in the 12Dicts +package, and uppercase words in at least 4 of the previous 12 +dictionaries. A decent number of proper names is also included: The +top 1000 male, female, and Last names from the 1990 Census report; a +list of names sent to me by Alan Beale; and a few names that I added +myself. Finally a small list of abbreviations not commonly found in +other word lists is included. + +The name files form the Census report is a government document which I +don't think can be copyrighted. + +The name list from Alan Beale is also derived from the linux words +list, which is derived from the DEC list. He also added a bunch of +miscellaneous names to the list, which he released to the Public Domain. + +The DEC Word list doesn't have a formal name. It is labeled as "FILE: +english.words; VERSION: DEC-SRC-92-04-05" and was put together by Jorge +Stolfi DEC Systems Research Center. The DEC Word +list has the following copyright statement: + + (NON-)COPYRIGHT STATUS + + To the best of my knowledge, all the files I used to build these + wordlists were available for public distribution and use, at least + for non-commercial purposes. I have confirmed this assumption with + the authors of the lists, whenever they were known. + + Therefore, it is safe to assume that the wordlists in this package + can also be freely copied, distributed, modified, and used for + personal, educational, and research purposes. (Use of these files in + commercial products may require written permission from DEC and/or + the authors of the original lists.) + + Whenever you distribute any of these wordlists, please distribute + also the accompanying README file. If you distribute a modified + copy of one of these wordlists, please include the original README + file with a note explaining your modifications. Your users will + surely appreciate that. + + (NO-)WARRANTY DISCLAIMER + + These files, like the original wordlists on which they are based, + are still very incomplete, uneven, and inconsitent, and probably + contain many errors. They are offered "as is" without any warranty + of correctness or fitness for any particular purpose. Neither I nor + my employer can be held responsible for any losses or damages that + may result from their use. + +However since this Word List is used in the linux.words package which +the author claims is free of any copyright I assume it is OK to use +for most purposes. If you want to use this in a commercial project +and this concerns you the information from the DEC word list can +easily be removed without much sacrifice in quality as only the name +lists were used. + +The file special-jargon.50 uses common.lst and word.lst from the +"Unofficial Jargon File Word Lists" which is derived from "The Jargon +File". All of which is in the Public Domain. This file also contain +a few extra UNIX terms which are found in the file "unix-terms" in the +special/ directory. + +The 60 level includes Brian's frequency class 0 and all words +appearing in at least 2 of the 12 dictionaries as indicated by the +12Dicts package. A large number of names are also included: The 4,946 +female names and 3,897 male names from the MWords package and the +files "computer.names", "misc.names", and "org.names" from the DEC +package. + +The 65 level includes words found in the Ispell "medium" word list. +The Ispell word lists are under the same copyright of Ispell itself +which is: + + Copyright 1993, Geoff Kuenning, Granada Hills, CA + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All modifications to the source code must be clearly marked as + such. Binary redistributions based on modified source code + must be clearly marked as modified versions in the documentation + and/or other materials provided with the distribution. + 4. All advertising materials mentioning features or use of this software + must display the following acknowledgment: + This product includes software developed by Geoff Kuenning and + other unpaid contributors. + 5. The name of Geoff Kuenning may not be used to endorse or promote + products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS + IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GEOFF + KUENNING OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +The 70 level includes the 74,550 common dictionary words and the 21,986 names +list from the MWords package. The common dictionary words, like those +from the 12Dicts package, have had all likely inflections added. + +The 80 level includes the ENABLE word list, all the lists in the +ENABLE supplement package (except for ABLE), the "UK Advanced Cryptics +Dictionary" (UKACD), the list of signature words in from YAWL package, +and the 10,196 places list from the MWords package. + +The ENABLE package, mainted by M\Cooper , +is in the Public Domain: + + The ENABLE master word list, WORD.LST, is herewith formally released + into the Public Domain. Anyone is free to use it or distribute it in + any manner they see fit. No fee or registration is required for its + use nor are "contributions" solicited (if you feel you absolutely + must contribute something for your own peace of mind, the authors of + the ENABLE list ask that you make a donation on their behalf to your + favorite charity). This word list is our gift to the Scrabble + community, as an alternate to "official" word lists. Game designers + may feel free to incorporate the WORD.LST into their games. Please + mention the source and credit us as originators of the list. Note + that if you, as a game designer, use the WORD.LST in your product, + you may still copyright and protect your product, but you may *not* + legally copyright or in any way restrict redistribution of the + WORD.LST portion of your product. This *may* under law restrict your + rights to restrict your users' rights, but that is only fair. + +UKACD, by J Ross Beresford , is under the +following copyright: + + Copyright (c) J Ross Beresford 1993-1999. All Rights Reserved. + + The following restriction is placed on the use of this publication: + if The UK Advanced Cryptics Dictionary is used in a software package + or redistributed in any form, the copyright notice must be + prominently displayed and the text of this document must be included + verbatim. + + There are no other restrictions: I would like to see the list + distributed as widely as possible. + +The 95 level includes the 354,984 single words and 256,772 compound +words from the MWords package, ABLE.LST from the ENABLE Supplement, +and some additional words found in my part-of-speech database that +were not found anywhere else. + +Accent information was taken from UKACD. + +My VARCON package was used to create the American, British, and +Canadian word list. + +Since the original word lists used used in the +VARCON package came from the Ispell distribution they are under the +Ispell copyright. + +The variant word lists were created from a list of variants found in +the 12dicts supplement package as well as a list of variants I created +myself. + + + + +=================================================== +en_GB: +This dictionary was initially based on a subset of the +original English wordlist created by Kevin Atkinson for +Pspell and Aspell and thus is covered by his original +LGPL licence. + +It has been extensively updated by David Bartlett, Brian Kelk +and Andrew Brown: +- numerous Americanism have been removed +- numerous American spellings have been corrected +- missing words have been added +- many errors have been corrected +- compound hyphenated words have been added where appropriate + +Valuable inputs to this process were received from many other +people - far too numerous to name. Serious thanks to you all +for your greatly appreciated help. + +This word list is intended to be a good representation of +current modern British English and thus it should be a good +basis for Commonwealth English in most countries of the world +outside North America. + +The affix file has been created completely from scratch +by David Bartlett and Andrew Brown, based on the published +rules for MySpell and is also provided under the LGPL. + +In creating the affix rules an attempt has been made to +reproduce the most general rules for English word +formation, rather than merely use it as a means to +compress the size of the dictionary. It is hoped that this +will facilitate future localisation to other variants of +English. + +Please let David Bartlett know of any +errors that you find. + +The current release is R 1.18, 11/04/05 +=================================================== +en_NZ: +I. Copyright +II. Copying (Licence) +---------------------------- + +I. Copyright + +NZ English Dictionary v0.9 beta - Build 06SEP03 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +NB This is an initial version, please check: +http://lingucomponent.openoffice.org/download_dictionary.html +or +http://www.girlza.com/dictionary/download.html +for a final version, after a little while (no hurry). + +This dictionary is based on the en_GB Myspell dictionary +which in turn was initially based on a subset of the +original English wordlist created by Kevin Atkinson for +Pspell and Aspell and thus is covered by his original +LGPL licence. + + +Introduction +~~~~~~~~~~~~ +en_NZ.dic has been altered to include New Zealand places, +including major cities and towns, and major suburbs. It +also contains NZ words, organisations and expressions. + +en_NZ.aff has had a few REPlace strings added, but is +basically unchanged. + + +Acknowledgements +~~~~~~~~~~~~~~~~ +Thanks must go to the original creators of the British +dictionary, David Bartlett, Brian Kelk and Andrew Brown. + +I wouldn't have started this without seeing the Australian +dictionary, thanks Kelvin Eldridge, Jean Hollis Weber and +David Wilson. + +And thank you to all who've contributed to OpenOffice.org. + + +License +~~~~~~~ +This dictionary is covered by the GNU Lesser General Public +License, viewable at http://www.gnu.org/copyleft/lesser.html + + +Issues +~~~~~~ +Many of the proper nouns already in the dictionary do not have +an affix for 's. +All my new words start after the z's of the original dictionary. + + +Contact +~~~~~~~ +Contact Tristan Burtenshaw (hooty@slingshot.co.nz) with any words, +places or other suggestions for the dictionary. + + + +II. Copying + + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 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. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +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 and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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 with +this License. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + diff --git a/runtime/spell/de/main.aap b/runtime/spell/de/main.aap --- a/runtime/spell/de/main.aap +++ b/runtime/spell/de/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for Dutch Vim spell files. +# Aap recipe for German Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): diff --git a/runtime/spell/fr/main.aap b/runtime/spell/fr/main.aap --- a/runtime/spell/fr/main.aap +++ b/runtime/spell/fr/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for Dutch Vim spell files. +# Aap recipe for French Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): @@ -19,7 +19,7 @@ all: $(SPELLDIR)/fr.latin1.spl $(SPELLDI :sys env LANG=fr_FR.UTF-8 $(VIM) -e -c "mkspell! $(SPELLDIR)/fr fr_FR" -c q -../README_fr.txt : lisez-moi.txt +../README_fr.txt : README_fr_FR.txt :copy $source $target # diff --git a/runtime/spell/he/main.aap b/runtime/spell/he/main.aap --- a/runtime/spell/he/main.aap +++ b/runtime/spell/he/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for Dutch Vim spell files. +# Aap recipe for Hebrew Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): diff --git a/runtime/spell/pl/main.aap b/runtime/spell/pl/main.aap --- a/runtime/spell/pl/main.aap +++ b/runtime/spell/pl/main.aap @@ -1,4 +1,4 @@ -# Aap recipe for Dutch Vim spell files. +# Aap recipe for Polish Vim spell files. # Use a freshly compiled Vim if it exists. @if os.path.exists('../../../src/vim'): diff --git a/runtime/syntax/tar.vim b/runtime/syntax/tar.vim new file mode 100644 --- /dev/null +++ b/runtime/syntax/tar.vim @@ -0,0 +1,17 @@ +" Language : Tar Listing Syntax +" Maintainer : Bram Moolenaar +" Last change: Sep 08, 2004 + +if exists("b:current_syntax") + finish +endif + +syn match tarComment '^".*' contains=tarFilename +syn match tarFilename 'tarfile \zs.*' contained +syn match tarDirectory '.*/$' + +hi def link tarComment Comment +hi def link tarFilename Constant +hi def link tarDirectory Type + +" vim: ts=8 diff --git a/src/Make_ivc.mak b/src/Make_ivc.mak --- a/src/Make_ivc.mak +++ b/src/Make_ivc.mak @@ -88,8 +88,8 @@ LINK32=link.exe CPP_PROJ= /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c # ADD CPP /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c -LINK32_FLAGS= oldnames.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib uuid.lib /nologo /machine:I386 /nodefaultlib -# ADD LINK32 oldnames.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib uuid.lib /nologo /machine:I386 /nodefaultlib +LINK32_FLAGS= oldnames.lib kernel32.lib user32.lib gdi32.lib version.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib uuid.lib /nologo /machine:I386 /nodefaultlib +# ADD LINK32 oldnames.lib kernel32.lib user32.lib gdi32.lib version.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib uuid.lib /nologo /machine:I386 /nodefaultlib # SUBTRACT LINK32 /incremental:yes RSC_PROJ= /l 0x409 /d "FEAT_GUI_W32" diff --git a/src/Makefile b/src/Makefile --- a/src/Makefile +++ b/src/Makefile @@ -879,6 +879,7 @@ HELPSUBDIR = /doc COLSUBDIR = /colors SYNSUBDIR = /syntax INDSUBDIR = /indent +AUTOSUBDIR = /autoload PLUGSUBDIR = /plugin FTPLUGSUBDIR = /ftplugin LANGSUBDIR = /lang @@ -899,6 +900,7 @@ PODIR = po ### COLSUBLOC location for colorscheme files ### SYNSUBLOC location for syntax files ### INDSUBLOC location for indent files +### AUTOSUBLOC location for standard autoload files ### PLUGSUBLOC location for standard plugin files ### FTPLUGSUBLOC location for ftplugin files ### LANGSUBLOC location for language files @@ -919,6 +921,7 @@ HELPSUBLOC = $(VIMRTLOC)$(HELPSUBDIR) COLSUBLOC = $(VIMRTLOC)$(COLSUBDIR) SYNSUBLOC = $(VIMRTLOC)$(SYNSUBDIR) INDSUBLOC = $(VIMRTLOC)$(INDSUBDIR) +AUTOSUBLOC = $(VIMRTLOC)$(AUTOSUBDIR) PLUGSUBLOC = $(VIMRTLOC)$(PLUGSUBDIR) FTPLUGSUBLOC = $(VIMRTLOC)$(FTPLUGSUBDIR) LANGSUBLOC = $(VIMRTLOC)$(LANGSUBDIR) @@ -1018,6 +1021,9 @@ SYNSOURCE = ../runtime/syntax INDSOURCE = ../runtime/indent # Where to copy the standard plugin files from +AUTOSOURCE = ../runtime/autoload + +# Where to copy the standard plugin files from PLUGSOURCE = ../runtime/plugin # Where to copy the ftplugin files from @@ -1290,6 +1296,7 @@ DEST_HELP = $(DESTDIR)$(HELPSUBLOC) DEST_COL = $(DESTDIR)$(COLSUBLOC) DEST_SYN = $(DESTDIR)$(SYNSUBLOC) DEST_IND = $(DESTDIR)$(INDSUBLOC) +DEST_AUTO = $(DESTDIR)$(AUTOSUBLOC) DEST_PLUG = $(DESTDIR)$(PLUGSUBLOC) DEST_FTP = $(DESTDIR)$(FTPLUGSUBLOC) DEST_LANG = $(DESTDIR)$(LANGSUBLOC) @@ -1739,7 +1746,8 @@ INSTALLMANARGS = $(VIMLOC) $(SCRIPTLOC) # install the help files; first adjust the contents for the final location installruntime: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \ $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) \ - $(DEST_FTP) $(DEST_PLUG) $(DEST_TUTOR) $(DEST_SPELL) $(DEST_COMP) + $(DEST_FTP) $(DEST_AUTO) $(DEST_PLUG) $(DEST_TUTOR) \ + $(DEST_SPELL) $(DEST_COMP) -$(SHELL) ./installman.sh install $(DEST_MAN) "" $(INSTALLMANARGS) @echo generating help tags # Generate the help tags with ":helptags" to handle all languages. @@ -1801,6 +1809,9 @@ installruntime: $(HELPSOURCE)/vim.1 $(DE # install the indent files cd $(INDSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_IND) cd $(DEST_IND); chmod $(HELPMOD) *.vim README.txt +# install the standard autoload files + cd $(AUTOSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_AUTO) + cd $(DEST_AUTO); chmod $(HELPMOD) *.vim README.txt # install the standard plugin files cd $(PLUGSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_PLUG) cd $(DEST_PLUG); chmod $(HELPMOD) *.vim README.txt @@ -1965,7 +1976,7 @@ install-icons: $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) $(DEST_FTP) \ $(DEST_LANG) $(DEST_KMAP) $(DEST_COMP) \ $(DEST_MACRO) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_SPELL) \ - $(DEST_PLUG): + $(DEST_AUTO) $(DEST_PLUG): -$(SHELL) ./mkinstalldirs $@ -chmod $(DIRMOD) $@ @@ -2103,8 +2114,9 @@ uninstall_runtime: -rm -f $(DEST_PRINT)/*.ps -rmdir $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) -rm -rf $(DEST_FTP)/*.vim $(DEST_FTP)/README.txt + -rm -f $(DEST_AUTO)/*.vim $(DEST_AUTO)/README.txt -rm -f $(DEST_PLUG)/*.vim $(DEST_PLUG)/README.txt - -rmdir $(DEST_FTP) $(DEST_PLUG) $(DEST_RT) + -rmdir $(DEST_FTP) $(DEST_AUTO) $(DEST_PLUG) $(DEST_RT) # This will fail when other Vim versions are installed, no worries. -rmdir $(DEST_VIM) diff --git a/src/buffer.c b/src/buffer.c --- a/src/buffer.c +++ b/src/buffer.c @@ -25,7 +25,6 @@ * The current implementation remembers all file names ever used. */ - #include "vim.h" #if defined(FEAT_CMDL_COMPL) || defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -639,7 +639,6 @@ static int handle_subscript __ARGS((char static typval_T *alloc_tv __ARGS((void)); static typval_T *alloc_string_tv __ARGS((char_u *string)); static void free_tv __ARGS((typval_T *varp)); -static void clear_tv __ARGS((typval_T *varp)); static void init_tv __ARGS((typval_T *varp)); static long get_tv_number __ARGS((typval_T *varp)); static long get_tv_number_chk __ARGS((typval_T *varp, int *denote)); @@ -683,7 +682,7 @@ static int # endif prof_self_cmp __ARGS((const void *s1, const void *s2)); #endif -static int script_autoload __ARGS((char_u *name)); +static int script_autoload __ARGS((char_u *name, int reload)); static char_u *autoload_name __ARGS((char_u *name)); static void cat_func_name __ARGS((char_u *buf, ufunc_T *fp)); static void func_free __ARGS((ufunc_T *fp)); @@ -1308,6 +1307,30 @@ get_spellword(list, pp) } #endif +/* + * Top level evaluation function, + */ + typval_T * +eval_expr(arg, nextcmd) + char_u *arg; + char_u **nextcmd; +{ + typval_T *tv; + + tv = (typval_T *)alloc(sizeof(typval_T)); + if (!tv) + return NULL; + + if (eval0(arg, tv, nextcmd, TRUE) == FAIL) + { + vim_free(tv); + return NULL; + } + + return tv; +} + + #if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO) /* * Call some vimL function and return the result in "*rettv". @@ -7101,7 +7124,7 @@ call_func(name, len, rettv, argcount, ar } #endif /* Try loading a package. */ - if (fp == NULL && script_autoload(fname) && !aborting()) + if (fp == NULL && script_autoload(fname, TRUE) && !aborting()) { /* loaded a package, search for the function again */ fp = find_func(fname); @@ -15528,7 +15551,7 @@ free_tv(varp) /* * Free the memory for a variable value and set the value to NULL or 0. */ - static void + void clear_tv(varp) typval_T *varp; { @@ -15774,9 +15797,11 @@ find_var_in_ht(ht, varname, writing) if (HASHITEM_EMPTY(hi)) { /* For global variables we may try auto-loading the script. If it - * worked find the variable again. */ + * worked find the variable again. Don't auto-load a script if it was + * loaded already, otherwise it would be loaded every time when + * checking if a function name is a Funcref variable. */ if (ht == &globvarht && !writing - && script_autoload(varname) && !aborting()) + && script_autoload(varname, FALSE) && !aborting()) hi = hash_find(ht, varname); if (HASHITEM_EMPTY(hi)) return NULL; @@ -17566,29 +17591,52 @@ prof_self_cmp(s1, s2) #endif +/* The names of packages that once were loaded is remembered. */ +static garray_T ga_loaded = {0, 0, sizeof(char_u *), 4, NULL}; + /* * If "name" has a package name try autoloading the script for it. * Return TRUE if a package was loaded. */ static int -script_autoload(name) - char_u *name; +script_autoload(name, reload) + char_u *name; + int reload; /* load script again when already loaded */ { char_u *p; - char_u *scriptname; + char_u *scriptname, *tofree; int ret = FALSE; - - /* If there is no colon after name[1] there is no package name. */ + int i; + + /* If there is no '#' after name[0] there is no package name. */ p = vim_strchr(name, AUTOLOAD_CHAR); - if (p == NULL || p <= name + 2) + if (p == NULL || p == name) return FALSE; - /* Try loading the package from $VIMRUNTIME/autoload/.vim */ - scriptname = autoload_name(name); - if (cmd_runtime(scriptname, FALSE) == OK) - ret = TRUE; - - vim_free(scriptname); + tofree = scriptname = autoload_name(name); + + /* Find the name in the list of previously loaded package names. Skip + * "autoload/", it's always the same. */ + for (i = 0; i < ga_loaded.ga_len; ++i) + if (STRCMP(((char_u **)ga_loaded.ga_data)[i] + 9, scriptname + 9) == 0) + break; + if (!reload && i < ga_loaded.ga_len) + ret = FALSE; /* was loaded already */ + else + { + /* Remember the name if it wasn't loaded already. */ + if (i == ga_loaded.ga_len && ga_grow(&ga_loaded, 1) == OK) + { + ((char_u **)ga_loaded.ga_data)[ga_loaded.ga_len++] = scriptname; + tofree = NULL; + } + + /* Try loading the package from $VIMRUNTIME/autoload/.vim */ + if (cmd_runtime(scriptname, FALSE) == OK) + ret = TRUE; + } + + vim_free(tofree); return ret; } diff --git a/src/ex_cmds.h b/src/ex_cmds.h --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -187,6 +187,8 @@ EX(CMD_cabbrev, "cabbrev", ex_abbreviat EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), EX(CMD_cabclear, "cabclear", ex_abclear, EXTRA|TRLBAR|CMDWIN), +EX(CMD_caddfile, "caddfile", ex_cfile, + TRLBAR|FILE1), EX(CMD_call, "call", ex_call, RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), EX(CMD_catch, "catch", ex_catch, @@ -201,6 +203,8 @@ EX(CMD_cd, "cd", ex_cd, BANG|FILE1|TRLBAR|CMDWIN), EX(CMD_center, "center", ex_align, TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), +EX(CMD_cexpr, "cexpr", ex_cexpr, + NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG), EX(CMD_cfile, "cfile", ex_cfile, TRLBAR|FILE1|BANG), EX(CMD_cfirst, "cfirst", ex_cc, diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -114,6 +114,7 @@ static int getargopt __ARGS((exarg_T *ea # define ex_cc ex_ni # define ex_cnext ex_ni # define ex_cfile ex_ni +# define ex_cexpr ex_ni # define qf_list ex_ni # define qf_age ex_ni # define ex_helpgrep ex_ni diff --git a/src/globals.h b/src/globals.h --- a/src/globals.h +++ b/src/globals.h @@ -166,8 +166,6 @@ EXTERN int need_maketitle INIT(= TRUE); #endif EXTERN int quit_more INIT(= FALSE); /* 'q' hit at "--more--" msg */ -EXTERN int more_back INIT(= 0); /* 'b' or 'u' at "--more--" msg */ -EXTERN int more_back_used INIT(= FALSE); /* using more_back */ #if defined(UNIX) || defined(__EMX__) || defined(VMS) || defined(MACOS_X) EXTERN int newline_on_exit INIT(= FALSE); /* did msg in altern. screen */ EXTERN int intr_char INIT(= 0); /* extra interrupt character */ diff --git a/src/gui.c b/src/gui.c --- a/src/gui.c +++ b/src/gui.c @@ -455,6 +455,7 @@ gui_init() * where Vim was started. */ emsg_on_display = FALSE; msg_scrolled = 0; + clear_sb_text(); need_wait_return = FALSE; msg_didany = FALSE; diff --git a/src/main.aap b/src/main.aap --- a/src/main.aap +++ b/src/main.aap @@ -237,6 +237,7 @@ Source = fileio.c fold.c getchar.c + hardcopy.c hashtable.c if_cscope.c if_xcmdsrv.c @@ -440,6 +441,7 @@ HELPSUBDIR = /doc COLSUBDIR = /colors SYNSUBDIR = /syntax INDSUBDIR = /indent +AUTOSUBDIR = /autoload PLUGSUBDIR = /plugin FTPLUGSUBDIR = /ftplugin LANGSUBDIR = /lang @@ -459,6 +461,7 @@ PODIR = po ### COLSUBLOC location for colorscheme files ### SYNSUBLOC location for syntax files ### INDSUBLOC location for indent files +### AUTOSUBLOC location for standard autoload files ### PLUGSUBLOC location for standard plugin files ### FTPLUGSUBLOC location for ftplugin files ### LANGSUBLOC location for language files @@ -478,6 +481,7 @@ HELPSUBLOC = $VIMRTLOC$HELPSUBDIR COLSUBLOC = $VIMRTLOC$COLSUBDIR SYNSUBLOC = $VIMRTLOC$SYNSUBDIR INDSUBLOC = $VIMRTLOC$INDSUBDIR +AUTOSUBLOC = $VIMRTLOC$AUTOSUBDIR PLUGSUBLOC = $VIMRTLOC$PLUGSUBDIR FTPLUGSUBLOC = $VIMRTLOC$FTPLUGSUBDIR LANGSUBLOC = $VIMRTLOC$LANGSUBDIR @@ -566,6 +570,9 @@ SYNSOURCE = ../runtime/syntax INDSOURCE = ../runtime/indent # Where to copy the standard plugin files from +AUTOSOURCE = ../runtime/autoload + +# Where to copy the standard plugin files from PLUGSOURCE = ../runtime/plugin # Where to copy the ftplugin files from @@ -600,6 +607,7 @@ DEST_HELP = $DESTDIR$HELPSUBLOC DEST_COL = $DESTDIR$COLSUBLOC DEST_SYN = $DESTDIR$SYNSUBLOC DEST_IND = $DESTDIR$INDSUBLOC +DEST_AUTO = $DESTDIR$AUTOSUBLOC DEST_PLUG = $DESTDIR$PLUGSUBLOC DEST_FTP = $DESTDIR$FTPLUGSUBLOC DEST_LANG = $DESTDIR$LANGSUBLOC @@ -614,7 +622,7 @@ DEST_MAN = $DESTDIR$MANSUBDIR # These are directories, create them when needed. :attr {directory = $DIRMOD} $DEST_BIN $DEST_VIM $DEST_RT $DEST_HELP $DEST_COL - $DEST_SYN $DEST_IND $DEST_PLUG $DEST_FTP $DEST_LANG + $DEST_SYN $DEST_IND $DEST_AUTO $DEST_PLUG $DEST_FTP $DEST_LANG $DEST_COMP $DEST_KMAP $DEST_MACRO $DEST_TOOLS $DEST_TUTOR $DEST_SCRIPT $DEST_PRINT $DEST_MAN @@ -657,7 +665,8 @@ installvimbin {virtual}{force}: $Target # install the help files; first adjust the contents for the location installruntime {virtual}{force}: $HELPSOURCE/vim.1 $DEST_MAN $DEST_VIM $DEST_RT $DEST_HELP $DEST_COL $DEST_SYN $DEST_IND - $DEST_FTP $DEST_PLUG $DEST_TUTOR $DEST_COMP $DEST_PRINT + $DEST_FTP $DEST_AUTO $DEST_PLUG $DEST_TUTOR $DEST_COMP + $DEST_PRINT :print generating $DEST_MAN/$(VIMNAME).1 :cat $HELPSOURCE/vim.1 | :eval re.sub("/usr/local/lib/vim", _no.VIMLOC, stdin) | @@ -762,6 +771,9 @@ installruntime {virtual}{force}: $HELPSO # install the indent files :copy $INDSOURCE/*.vim $INDSOURCE/README.txt $DEST_IND :chmod $HELPMOD $DEST_IND/*.vim +# install the standard autoload files + :copy $AUTOSOURCE/*.vim $AUTOSOURCE/README.txt $DEST_AUTO + :chmod $HELPMOD $DEST_AUTO/*.vim $DEST_AUTO/README.txt # install the standard plugin files :copy $PLUGSOURCE/*.vim $PLUGSOURCE/README.txt $DEST_PLUG :chmod $HELPMOD $DEST_PLUG/*.vim $DEST_PLUG/README.txt @@ -1041,8 +1053,9 @@ uninstall_runtime {virtual}{force}: :del {force}{recursive} $DEST_COMP :deldir {force} $DEST_HELP $DEST_COL $DEST_SYN $DEST_IND :del {force}{recursive} $DEST_FTP/*.vim $DEST_FTP/README.txt + :del {force} $DEST_AUTO/*.vim $DEST_AUTO/README.txt :del {force} $DEST_PLUG/*.vim $DEST_PLUG/README.txt - :deldir {force} $DEST_FTP $DEST_PLUG $DEST_PRINT $DEST_RT + :deldir {force} $DEST_FTP $DEST_AUTO $DEST_PLUG $DEST_PRINT $DEST_RT # This will fail when other Vim versions are installed, no worries. @try: :deldir $DEST_VIM diff --git a/src/main.c b/src/main.c --- a/src/main.c +++ b/src/main.c @@ -1034,6 +1034,7 @@ main_loop(cmdwin, noexmode) emsg_on_display = FALSE; /* can delete error message now */ did_emsg = FALSE; msg_didany = FALSE; /* reset lines_left in msg_start() */ + clear_sb_text(); /* clear scroll-back text */ showruler(FALSE); setcursor(); diff --git a/src/message.c b/src/message.c --- a/src/message.c +++ b/src/message.c @@ -29,7 +29,12 @@ static void msg_home_replace_attr __ARGS static char_u *screen_puts_mbyte __ARGS((char_u *s, int l, int attr)); #endif static void msg_puts_attr_len __ARGS((char_u *str, int maxlen, int attr)); -static void t_puts __ARGS((int t_col, char_u *t_s, char_u *s, int attr)); +static void msg_puts_display __ARGS((char_u *str, int maxlen, int attr, int recurse)); +static void msg_scroll_up __ARGS((void)); +static void store_sb_text __ARGS((char_u **sb_str, char_u *s, int attr, int *sb_col, int finish)); +static void t_puts __ARGS((int *t_col, char_u *t_s, char_u *s, int attr)); +static void msg_puts_printf __ARGS((char_u *str, int maxlen)); +static int do_more_prompt __ARGS((int typed_char)); static void msg_screen_putchar __ARGS((int c, int attr)); static int msg_check_screen __ARGS((void)); static void redir_write __ARGS((char_u *s, int maxlen)); @@ -924,6 +929,22 @@ wait_return(redraw) c = K_IGNORE; } #endif + if (p_more && !p_cp && (c == 'b' || c == 'k' || c == 'u')) + { + /* scroll back to show older messages */ + do_more_prompt(c); + if (quit_more) + { + c = CAR; /* just pretend CR was hit */ + quit_more = FALSE; + got_int = FALSE; + } + else + { + c = K_IGNORE; + hit_return_msg(); + } + } } while ((had_got_int && c == Ctrl_C) || c == K_IGNORE #ifdef FEAT_GUI @@ -1031,14 +1052,18 @@ wait_return(redraw) static void hit_return_msg() { - if (msg_didout) /* start on a new line */ + int save_p_more = p_more; + + p_more = FALSE; /* don't want see this message when scrolling back */ + if (msg_didout) /* start on a new line */ msg_putchar('\n'); if (got_int) MSG_PUTS(_("Interrupt: ")); - MSG_PUTS_ATTR(_("Hit ENTER or type command to continue"), hl_attr(HLF_R)); + MSG_PUTS_ATTR(_("Press ENTER or type command to continue"), hl_attr(HLF_R)); if (!msg_use_printf()) msg_clr_eos(); + p_more = save_p_more; } /* @@ -1515,7 +1540,7 @@ msg_prt_line(s, list) if (*s == NUL && !(list && lcs_eol != NUL)) msg_putchar(' '); - for (;;) + while (!got_int) { if (n_extra) { @@ -1711,22 +1736,10 @@ msg_puts_attr_len(str, maxlen, attr) int maxlen; int attr; { - int oldState; - char_u *s = str; - char_u *p; - char_u buf[4]; - char_u *t_s = str; /* string from "t_s" to "s" is still todo */ - int t_col = 0; /* screen cells todo, 0 when "t_s" not used */ -#ifdef FEAT_MBYTE - int l; - int cw; -#endif - int c; - /* * If redirection is on, also write to the redirection file. */ - redir_write(s, maxlen); + redir_write(str, maxlen); /* * Don't print anything when using ":silent cmd". @@ -1737,7 +1750,7 @@ msg_puts_attr_len(str, maxlen, attr) /* if MSG_HIST flag set, add message to history */ if ((attr & MSG_HIST) && maxlen < 0) { - add_msg_hist(s, -1, attr); + add_msg_hist(str, -1, attr); attr &= ~MSG_HIST; } @@ -1759,72 +1772,42 @@ msg_puts_attr_len(str, maxlen, attr) * cursor is. */ if (msg_use_printf()) - { -#ifdef WIN3264 - if (!(silent_mode && p_verbose == 0)) - mch_settmode(TMODE_COOK); /* handle '\r' and '\n' correctly */ -#endif - while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen)) - { - if (!(silent_mode && p_verbose == 0)) - { - p = &buf[0]; - /* NL --> CR NL translation (for Unix, not for "--version") */ - /* NL --> CR translation (for Mac) */ - if (*s == '\n' && !info_message) - *p++ = '\r'; -#if defined(USE_CR) && !defined(MACOS_X_UNIX) - else + msg_puts_printf(str, maxlen); + else + msg_puts_display(str, maxlen, attr, FALSE); +} + +/* + * The display part of msg_puts_attr_len(). + * May be called recursively to display scroll-back text. + */ + static void +msg_puts_display(str, maxlen, attr, recurse) + char_u *str; + int maxlen; + int attr; + int recurse; +{ + char_u *s = str; + char_u *t_s = str; /* string from "t_s" to "s" is still todo */ + int t_col = 0; /* screen cells todo, 0 when "t_s" not used */ +#ifdef FEAT_MBYTE + int l; + int cw; #endif - *p++ = *s; - *p = '\0'; - if (info_message) /* informative message, not an error */ - mch_msg((char *)buf); - else - mch_errmsg((char *)buf); - } - - /* primitive way to compute the current column */ -#ifdef FEAT_RIGHTLEFT - if (cmdmsg_rl) - { - if (*s == '\r' || *s == '\n') - msg_col = Columns - 1; - else - --msg_col; - } - else -#endif - { - if (*s == '\r' || *s == '\n') - msg_col = 0; - else - ++msg_col; - } - ++s; - } - msg_didout = TRUE; /* assume that line is not empty */ - -#ifdef WIN3264 - if (!(silent_mode && p_verbose == 0)) - mch_settmode(TMODE_RAW); -#endif - return; - } + char_u *sb_str = str; + int sb_col = msg_col; + int wrap; did_wait_return = FALSE; while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen)) { /* - * The screen is scrolled up when: - * - When outputting a newline in the last row - * - when outputting a character in the last column of the last row - * (some terminals scroll automatically, some don't. To avoid - * problems we scroll ourselves) + * We are at the end of the screen line when: + * - When outputting a newline. + * - When outputting a character in the last column. */ - if (msg_row >= Rows - 1 - && (*s == '\n' - || ( + if (!recurse && msg_row >= Rows - 1 && (*s == '\n' || ( #ifdef FEAT_RIGHTLEFT cmdmsg_rl ? ( @@ -1844,47 +1827,55 @@ msg_puts_attr_len(str, maxlen, attr) # endif )))) { + /* + * The screen is scrolled up when at the last row (some terminals + * scroll automatically, some don't. To avoid problems we scroll + * ourselves). + */ if (t_col > 0) - { /* output postponed text */ - t_puts(t_col, t_s, s, attr); - t_col = 0; - } + t_puts(&t_col, t_s, s, attr); /* When no more prompt an no more room, truncate here */ if (msg_no_more && lines_left == 0) break; -#ifdef FEAT_GUI - /* Remove the cursor before scrolling, ScreenLines[] is going to - * become invalid. */ - if (gui.in_use) - gui_undraw_cursor(); -#endif - /* scrolling up always works */ - screen_del_lines(0, 0, 1, (int)Rows, TRUE, NULL); - - if (!can_clear((char_u *)" ")) - { - /* Scrolling up doesn't result in the right background. Set - * the background here. It's not efficient, but avoids that - * we have to do it all over the code. */ - screen_fill((int)Rows - 1, (int)Rows, 0, - (int)Columns, ' ', ' ', 0); - - /* Also clear the last char of the last but one line if it was - * not cleared before to avoid a scroll-up. */ - if (ScreenAttrs[LineOffset[Rows - 2] + Columns - 1] - == (sattr_T)-1) - screen_fill((int)Rows - 2, (int)Rows - 1, - (int)Columns - 1, (int)Columns, ' ', ' ', 0); - } + + /* Scroll the screen up one line. */ + msg_scroll_up(); msg_row = Rows - 2; if (msg_col >= Columns) /* can happen after screen resize */ msg_col = Columns - 1; + /* Display char in last column before showing more-prompt. */ + if (*s >= ' ' +#ifdef FEAT_RIGHTLEFT + && !cmdmsg_rl +#endif + ) + { +#ifdef FEAT_MBYTE + if (has_mbyte) + { + if (enc_utf8 && maxlen >= 0) + /* avoid including composing chars after the end */ + l = utfc_ptr2len_check_len(s, + (int)((str + maxlen) - s)); + else + l = (*mb_ptr2len_check)(s); + s = screen_puts_mbyte(s, l, attr); + } + else +#endif + msg_screen_putchar(*s++, attr); + } + + if (p_more) + /* store text for scrolling back */ + store_sb_text(&sb_str, s, attr, &sb_col, TRUE); + ++msg_scrolled; - need_wait_return = TRUE; /* may need wait_return in main() */ + need_wait_return = TRUE; /* may need wait_return in main() */ if (must_redraw < VALID) must_redraw = VALID; redraw_cmdline = TRUE; @@ -1892,170 +1883,38 @@ msg_puts_attr_len(str, maxlen, attr) --cmdline_row; /* - * if screen is completely filled wait for a character + * If screen is completely filled and 'more' is set then wait + * for a character. */ if (p_more && --lines_left == 0 && State != HITRETURN && !msg_no_more && !exmode_active) { - oldState = State; - State = ASKMORE; -#ifdef FEAT_MOUSE - setmouse(); -#endif - msg_moremsg(FALSE); - for (;;) - { - /* - * Get a typed character directly from the user. - */ - c = get_keystroke(); - -#if defined(FEAT_MENU) && defined(FEAT_GUI) - if (c == K_MENU) - { - int idx = get_menu_index(current_menu, ASKMORE); - - /* Used a menu. If it starts with CTRL-Y, it must - * be a "Copy" for the clipboard. Otherwise - * assume that we end */ - if (idx == MENU_INDEX_INVALID) - continue; - c = *current_menu->strings[idx]; - if (c != NUL && current_menu->strings[idx][1] != NUL) - ins_typebuf(current_menu->strings[idx] + 1, - current_menu->noremap[idx], 0, TRUE, - current_menu->silent[idx]); - } -#endif - - switch (c) - { - case BS: - case 'k': - case K_UP: - if (!more_back_used) - { - msg_moremsg(TRUE); - continue; - } - more_back = 1; - lines_left = 1; - break; - case CAR: /* one extra line */ - case NL: - case 'j': - case K_DOWN: - lines_left = 1; - break; - case ':': /* start new command line */ #ifdef FEAT_CON_DIALOG - if (!confirm_msg_used) -#endif - { - /* Since got_int is set all typeahead will be - * flushed, but we want to keep this ':', remember - * that in a special way. */ - typeahead_noflush(':'); - cmdline_row = Rows - 1; /* put ':' on this line */ - skip_redraw = TRUE; /* skip redraw once */ - need_wait_return = FALSE; /* don't wait in main() */ - } - /*FALLTHROUGH*/ - case 'q': /* quit */ - case Ctrl_C: - case ESC: -#ifdef FEAT_CON_DIALOG - if (confirm_msg_used) - { - /* Jump to the choices of the dialog. */ - s = confirm_msg_tail; - lines_left = Rows - 1; - } - else -#endif - { - got_int = TRUE; - quit_more = TRUE; - } - break; - case 'u': /* Up half a page */ - case K_PAGEUP: - if (!more_back_used) - { - msg_moremsg(TRUE); - continue; - } - more_back = Rows / 2; - /*FALLTHROUGH*/ - case 'd': /* Down half a page */ - lines_left = Rows / 2; - break; - case 'b': /* one page back */ - if (!more_back_used) - { - msg_moremsg(TRUE); - continue; - } - more_back = Rows - 1; - /*FALLTHROUGH*/ - case ' ': /* one extra page */ - case K_PAGEDOWN: - case K_LEFTMOUSE: - lines_left = Rows - 1; - break; - -#ifdef FEAT_CLIPBOARD - case Ctrl_Y: - /* Strange way to allow copying (yanking) a modeless - * selection at the more prompt. Use CTRL-Y, - * because the same is used in Cmdline-mode and at the - * hit-enter prompt. However, scrolling one line up - * might be expected... */ - if (clip_star.state == SELECT_DONE) - clip_copy_modeless_selection(TRUE); - continue; -#endif - default: /* no valid response */ - msg_moremsg(TRUE); - continue; - } - break; - } - - /* clear the --more-- message */ - screen_fill((int)Rows - 1, (int)Rows, - 0, (int)Columns, ' ', ' ', 0); - State = oldState; -#ifdef FEAT_MOUSE - setmouse(); + if (do_more_prompt(NUL)) + s = confirm_msg_tail; +#else + (void)do_more_prompt(NUL); #endif if (quit_more) - { - msg_row = Rows - 1; - msg_col = 0; - return; /* the string is not displayed! */ - } -#ifdef FEAT_RIGHTLEFT - if (cmdmsg_rl) - msg_col = Columns - 1; -#endif + return; } } - if (t_col > 0 - && (vim_strchr((char_u *)"\n\r\b\t", *s) != NULL - || *s == BELL + wrap = *s == '\n' || msg_col + t_col >= Columns #ifdef FEAT_MBYTE || (has_mbyte && (*mb_ptr2cells)(s) > 1 && msg_col + t_col >= Columns - 1) #endif - )) - { + ; + if (t_col > 0 && (wrap || *s == '\r' || *s == '\b' + || *s == '\t' || *s == BELL)) /* output any postponed text */ - t_puts(t_col, t_s, s, attr); - t_col = 0; - } + t_puts(&t_col, t_s, s, attr); + + if (wrap && p_more && !recurse) + /* store text for scrolling back */ + store_sb_text(&sb_str, s, attr, &sb_col, TRUE); if (*s == '\n') /* go to next line */ { @@ -2073,7 +1932,7 @@ msg_puts_attr_len(str, maxlen, attr) if (msg_col) --msg_col; } - else if (*s == TAB) /* translate into spaces */ + else if (*s == TAB) /* translate Tab into spaces */ { do msg_screen_putchar(' ', attr); @@ -2141,17 +2000,172 @@ msg_puts_attr_len(str, maxlen, attr) /* output any postponed text */ if (t_col > 0) - t_puts(t_col, t_s, s, attr); + t_puts(&t_col, t_s, s, attr); + if (p_more && !recurse) + store_sb_text(&sb_str, s, attr, &sb_col, FALSE); msg_check(); } /* + * Scroll the screen up one line for displaying the next message line. + */ + static void +msg_scroll_up() +{ +#ifdef FEAT_GUI + /* Remove the cursor before scrolling, ScreenLines[] is going + * to become invalid. */ + if (gui.in_use) + gui_undraw_cursor(); +#endif + /* scrolling up always works */ + screen_del_lines(0, 0, 1, (int)Rows, TRUE, NULL); + + if (!can_clear((char_u *)" ")) + { + /* Scrolling up doesn't result in the right background. Set the + * background here. It's not efficient, but avoids that we have to do + * it all over the code. */ + screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); + + /* Also clear the last char of the last but one line if it was not + * cleared before to avoid a scroll-up. */ + if (ScreenAttrs[LineOffset[Rows - 2] + Columns - 1] == (sattr_T)-1) + screen_fill((int)Rows - 2, (int)Rows - 1, + (int)Columns - 1, (int)Columns, ' ', ' ', 0); + } +} + +/* + * To be able to scroll back at the "more" and "hit-enter" prompts we need to + * store the displayed text and remember where screen lines start. + */ +typedef struct msgchunk_S msgchunk_T; +struct msgchunk_S +{ + msgchunk_T *sb_next; + msgchunk_T *sb_prev; + char sb_eol; /* TRUE when line ends after this text */ + int sb_msg_col; /* column in which text starts */ + int sb_attr; /* text attributes */ + char_u sb_text[1]; /* text to be displayed, actually longer */ +}; + +static msgchunk_T *last_msgchunk = NULL; /* last displayed text */ + +static msgchunk_T *msg_sb_start __ARGS((msgchunk_T *mps)); +static msgchunk_T *disp_sb_line __ARGS((int row, msgchunk_T *smp)); + +/* + * Store part of a printed message for displaying when scrolling back. + */ + static void +store_sb_text(sb_str, s, attr, sb_col, finish) + char_u **sb_str; /* start of string */ + char_u *s; /* just after string */ + int attr; + int *sb_col; + int finish; /* line ends */ +{ + msgchunk_T *mp; + + if (s > *sb_str) + { + mp = (msgchunk_T *)alloc((int)(sizeof(msgchunk_T) + (s - *sb_str))); + if (mp != NULL) + { + mp->sb_eol = finish; + mp->sb_msg_col = *sb_col; + mp->sb_attr = attr; + vim_strncpy(mp->sb_text, *sb_str, s - *sb_str); + + if (last_msgchunk == NULL) + { + last_msgchunk = mp; + mp->sb_prev = NULL; + } + else + { + mp->sb_prev = last_msgchunk; + last_msgchunk->sb_next = mp; + last_msgchunk = mp; + } + mp->sb_next = NULL; + } + } + else if (finish && last_msgchunk != NULL) + last_msgchunk->sb_eol = TRUE; + + *sb_str = s; + *sb_col = 0; +} + +/* + * Clear any text remembered for scrolling back. + * Called when redrawing the screen. + */ + void +clear_sb_text() +{ + msgchunk_T *mp; + + while (last_msgchunk != NULL) + { + mp = last_msgchunk->sb_prev; + vim_free(last_msgchunk); + last_msgchunk = mp; + } + last_msgchunk = NULL; +} + +/* + * Move to the start of screen line in already displayed text. + */ + static msgchunk_T * +msg_sb_start(mps) + msgchunk_T *mps; +{ + msgchunk_T *mp = mps; + + while (mp != NULL && mp->sb_prev != NULL && !mp->sb_prev->sb_eol) + mp = mp->sb_prev; + return mp; +} + +/* + * Display a screen line from previously displayed text at row "row". + * Returns a pointer to the text for the next line (can be NULL). + */ + static msgchunk_T * +disp_sb_line(row, smp) + int row; + msgchunk_T *smp; +{ + msgchunk_T *mp = smp; + char_u *p; + + for (;;) + { + msg_row = row; + msg_col = mp->sb_msg_col; + p = mp->sb_text; + if (*p == '\n') /* don't display the line break */ + ++p; + msg_puts_display(p, -1, mp->sb_attr, TRUE); + if (mp->sb_eol || mp->sb_next == NULL) + break; + mp = mp->sb_next; + } + return mp->sb_next; +} + +/* * Output any postponed text for msg_puts_attr_len(). */ static void t_puts(t_col, t_s, s, attr) - int t_col; + int *t_col; char_u *t_s; char_u *s; int attr; @@ -2159,7 +2173,8 @@ t_puts(t_col, t_s, s, attr) /* output postponed text */ msg_didout = TRUE; /* remember that line is not empty */ screen_puts_len(t_s, (int)(s - t_s), msg_row, msg_col, attr); - msg_col += t_col; + msg_col += *t_col; + *t_col = 0; #ifdef FEAT_MBYTE /* If the string starts with a composing character don't increment the * column position for it. */ @@ -2173,7 +2188,6 @@ t_puts(t_col, t_s, s, attr) } } - /* * Returns TRUE when messages should be printed with mch_errmsg(). * This is used when there is no valid screen, so we can see error messages. @@ -2193,6 +2207,309 @@ msg_use_printf() ); } +/* + * Print a message when there is no valid screen. + */ + static void +msg_puts_printf(str, maxlen) + char_u *str; + int maxlen; +{ + char_u *s = str; + char_u buf[4]; + char_u *p; + +#ifdef WIN3264 + if (!(silent_mode && p_verbose == 0)) + mch_settmode(TMODE_COOK); /* handle '\r' and '\n' correctly */ +#endif + while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen)) + { + if (!(silent_mode && p_verbose == 0)) + { + /* NL --> CR NL translation (for Unix, not for "--version") */ + /* NL --> CR translation (for Mac) */ + p = &buf[0]; + if (*s == '\n' && !info_message) + *p++ = '\r'; +#if defined(USE_CR) && !defined(MACOS_X_UNIX) + else +#endif + *p++ = *s; + *p = '\0'; + if (info_message) /* informative message, not an error */ + mch_msg((char *)buf); + else + mch_errmsg((char *)buf); + } + + /* primitive way to compute the current column */ +#ifdef FEAT_RIGHTLEFT + if (cmdmsg_rl) + { + if (*s == '\r' || *s == '\n') + msg_col = Columns - 1; + else + --msg_col; + } + else +#endif + { + if (*s == '\r' || *s == '\n') + msg_col = 0; + else + ++msg_col; + } + ++s; + } + msg_didout = TRUE; /* assume that line is not empty */ + +#ifdef WIN3264 + if (!(silent_mode && p_verbose == 0)) + mch_settmode(TMODE_RAW); +#endif +} + +/* + * Show the more-prompt and handle the user response. + * This takes care of scrolling back and displaying previously displayed text. + * When at hit-enter prompt "typed_char" is the already typed character. + * Returns TRUE when jumping ahead to "confirm_msg_tail". + */ + static int +do_more_prompt(typed_char) + int typed_char; +{ + int used_typed_char = typed_char; + int oldState = State; + int c; +#ifdef FEAT_CON_DIALOG + int retval = FALSE; +#endif + int scroll; + msgchunk_T *mp_last = NULL; + msgchunk_T *mp; + int i; + + State = ASKMORE; +#ifdef FEAT_MOUSE + setmouse(); +#endif + msg_moremsg(FALSE); + for (;;) + { + /* + * Get a typed character directly from the user. + */ + if (used_typed_char != NUL) + { + c = used_typed_char; /* was typed at hit-enter prompt */ + used_typed_char = NUL; + } + else + c = get_keystroke(); + +#if defined(FEAT_MENU) && defined(FEAT_GUI) + if (c == K_MENU) + { + int idx = get_menu_index(current_menu, ASKMORE); + + /* Used a menu. If it starts with CTRL-Y, it must + * be a "Copy" for the clipboard. Otherwise + * assume that we end */ + if (idx == MENU_INDEX_INVALID) + continue; + c = *current_menu->strings[idx]; + if (c != NUL && current_menu->strings[idx][1] != NUL) + ins_typebuf(current_menu->strings[idx] + 1, + current_menu->noremap[idx], 0, TRUE, + current_menu->silent[idx]); + } +#endif + + scroll = 0; + switch (c) + { + case BS: /* scroll one line back */ + case K_BS: + case 'k': + case K_UP: + scroll = -1; + break; + + case CAR: /* one extra line */ + case NL: + case 'j': + case K_DOWN: + scroll = 1; + break; + + case 'u': /* Up half a page */ + case K_PAGEUP: + scroll = -(Rows / 2); + break; + + case 'd': /* Down half a page */ + scroll = Rows / 2; + break; + + case 'b': /* one page back */ + scroll = -(Rows - 1); + break; + + case ' ': /* one extra page */ + case K_PAGEDOWN: + case K_LEFTMOUSE: + scroll = Rows - 1; + break; + + case ':': /* start new command line */ +#ifdef FEAT_CON_DIALOG + if (!confirm_msg_used) +#endif + { + /* Since got_int is set all typeahead will be flushed, but we + * want to keep this ':', remember that in a special way. */ + typeahead_noflush(':'); + cmdline_row = Rows - 1; /* put ':' on this line */ + skip_redraw = TRUE; /* skip redraw once */ + need_wait_return = FALSE; /* don't wait in main() */ + } + /*FALLTHROUGH*/ + case 'q': /* quit */ + case Ctrl_C: + case ESC: +#ifdef FEAT_CON_DIALOG + if (confirm_msg_used) + { + /* Jump to the choices of the dialog. */ + retval = TRUE; + lines_left = Rows - 1; + } + else +#endif + { + got_int = TRUE; + quit_more = TRUE; + } + break; + +#ifdef FEAT_CLIPBOARD + case Ctrl_Y: + /* Strange way to allow copying (yanking) a modeless + * selection at the more prompt. Use CTRL-Y, + * because the same is used in Cmdline-mode and at the + * hit-enter prompt. However, scrolling one line up + * might be expected... */ + if (clip_star.state == SELECT_DONE) + clip_copy_modeless_selection(TRUE); + continue; +#endif + default: /* no valid response */ + msg_moremsg(TRUE); + continue; + } + + if (scroll != 0) + { + if (scroll < 0) + { + /* go to start of last line */ + if (mp_last == NULL) + mp = msg_sb_start(last_msgchunk); + else if (mp_last->sb_prev != NULL) + mp = msg_sb_start(mp_last->sb_prev); + else + mp = NULL; + + /* go to start of line at top of the screen */ + for (i = 0; i < Rows - 2 && mp != NULL && mp->sb_prev != NULL; + ++i) + mp = msg_sb_start(mp->sb_prev); + + if (mp != NULL && mp->sb_prev != NULL) + { + /* Find line to be displayed at top. */ + for (i = 0; i > scroll; --i) + { + if (mp == NULL || mp->sb_prev == NULL) + break; + mp = msg_sb_start(mp->sb_prev); + if (mp_last == NULL) + mp_last = msg_sb_start(last_msgchunk); + else + mp_last = msg_sb_start(mp_last->sb_prev); + } + + if (scroll == -1 && screen_ins_lines(0, 0, 1, + (int)Rows, NULL) == OK) + { + /* clear last line, display line at top */ + screen_fill((int)Rows - 1, (int)Rows, 0, + (int)Columns, ' ', ' ', 0); + (void)disp_sb_line(0, mp); + } + else + { + /* redisplay */ + screenclear(); + for (i = 0; i < Rows - 1; ++i) + mp = disp_sb_line(i, mp); + } + scroll = 0; + } + } + else + { + /* First display any text that we scrolled back. */ + while (scroll > 0 && mp_last != NULL) + { + /* scroll up, display line at bottom */ + msg_scroll_up(); + screen_fill((int)Rows - 2, (int)Rows - 1, 0, + (int)Columns, ' ', ' ', 0); + mp_last = disp_sb_line((int)Rows - 2, mp_last); + --scroll; + } + } + + if (scroll <= 0) + { + /* displayed the requested text, more prompt again */ + msg_moremsg(FALSE); + continue; + } + + /* display more text, return to caller */ + lines_left = scroll; + } + + break; + } + + /* clear the --more-- message */ + screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0); + State = oldState; +#ifdef FEAT_MOUSE + setmouse(); +#endif + if (quit_more) + { + msg_row = Rows - 1; + msg_col = 0; + } +#ifdef FEAT_RIGHTLEFT + else if (cmdmsg_rl) + msg_col = Columns - 1; +#endif + +#ifdef FEAT_CON_DIALOG + return retval; +#else + return FALSE; +#endif +} + #if defined(USE_MCH_ERRMSG) || defined(PROTO) #ifdef mch_errmsg @@ -2344,15 +2661,15 @@ msg_screen_putchar(c, attr) msg_moremsg(full) int full; { - int attr; + int attr; + char_u *s = (char_u *)_("-- More --"); attr = hl_attr(HLF_M); - screen_puts((char_u *)_("-- More --"), (int)Rows - 1, 0, attr); + screen_puts(s, (int)Rows - 1, 0, attr); if (full) - screen_puts(more_back_used - ? (char_u *)_(" (RET/BS: line, SPACE/b: page, d/u: half page, q: quit)") - : (char_u *)_(" (RET: line, SPACE: page, d: half page, q: quit)"), - (int)Rows - 1, 10, attr); + screen_puts((char_u *) + _(" SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "), + (int)Rows - 1, vim_strsize(s), attr); } /* diff --git a/src/ops.c b/src/ops.c --- a/src/ops.c +++ b/src/ops.c @@ -1580,9 +1580,15 @@ op_delete(oap) && *ml_get(oap->start.lnum) == NUL) { /* - * It's an error to operate on an empty region, when 'E' inclucded in + * It's an error to operate on an empty region, when 'E' included in * 'cpoptions' (Vi compatible). */ +#ifdef FEAT_VIRTUALEDIT + if (virtual_op) + /* Virtual editing: Nothing gets deleted, but we set the '[ and '] + * marks as if it happened. */ + goto setmarks; +#endif if (vim_strchr(p_cpo, CPO_EMPTYREGION) != NULL) beep_flush(); return OK; @@ -1858,6 +1864,9 @@ op_delete(oap) msgmore(curbuf->b_ml.ml_line_count - old_lcount); +#ifdef FEAT_VIRTUALEDIT +setmarks: +#endif #ifdef FEAT_VISUAL if (oap->block_mode) { diff --git a/src/proto/eval.pro b/src/proto/eval.pro --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -22,6 +22,7 @@ char_u *eval_to_string_safe __ARGS((char int eval_to_number __ARGS((char_u *expr)); list_T *eval_spell_expr __ARGS((char_u *badword, char_u *expr)); int get_spellword __ARGS((list_T *list, char_u **pp)); +typval_T *eval_expr __ARGS((char_u *arg, char_u **nextcmd)); void *call_func_retstr __ARGS((char_u *func, int argc, char_u **argv, int safe)); void *call_func_retlist __ARGS((char_u *func, int argc, char_u **argv, int safe)); void *save_funccal __ARGS((void)); @@ -59,6 +60,7 @@ void set_reg_var __ARGS((int c)); char_u *v_exception __ARGS((char_u *oldval)); char_u *v_throwpoint __ARGS((char_u *oldval)); char_u *set_cmdarg __ARGS((exarg_T *eap, char_u *oldarg)); +void clear_tv __ARGS((typval_T *varp)); char_u *get_var_value __ARGS((char_u *name)); void new_script_vars __ARGS((scid_T id)); void init_var_dict __ARGS((dict_T *dict, dictitem_T *dict_var)); diff --git a/src/proto/message.pro b/src/proto/message.pro --- a/src/proto/message.pro +++ b/src/proto/message.pro @@ -39,6 +39,7 @@ void msg_puts_title __ARGS((char_u *s)); void msg_puts_long_attr __ARGS((char_u *longstr, int attr)); void msg_puts_long_len_attr __ARGS((char_u *longstr, int len, int attr)); void msg_puts_attr __ARGS((char_u *s, int attr)); +void clear_sb_text __ARGS((void)); int msg_use_printf __ARGS((void)); void mch_errmsg __ARGS((char *str)); void mch_msg __ARGS((char *str)); diff --git a/src/proto/quickfix.pro b/src/proto/quickfix.pro --- a/src/proto/quickfix.pro +++ b/src/proto/quickfix.pro @@ -24,5 +24,6 @@ char_u *skip_vimgrep_pat __ARGS((char_u int get_errorlist __ARGS((list_T *list)); int set_errorlist __ARGS((list_T *list, int action)); void ex_cbuffer __ARGS((exarg_T *eap)); +void ex_cexpr __ARGS((exarg_T *eap)); void ex_helpgrep __ARGS((exarg_T *eap)); /* vim: set ft=c : */ diff --git a/src/proto/screen.pro b/src/proto/screen.pro --- a/src/proto/screen.pro +++ b/src/proto/screen.pro @@ -37,6 +37,7 @@ void windgoto __ARGS((int row, int col)) void setcursor __ARGS((void)); int win_ins_lines __ARGS((win_T *wp, int row, int line_count, int invalid, int mayclear)); int win_del_lines __ARGS((win_T *wp, int row, int line_count, int invalid, int mayclear)); +int screen_ins_lines __ARGS((int off, int row, int line_count, int end, win_T *wp)); int screen_del_lines __ARGS((int off, int row, int line_count, int end, int force, win_T *wp)); int showmode __ARGS((void)); void unshowmode __ARGS((int force)); diff --git a/src/quickfix.c b/src/quickfix.c --- a/src/quickfix.c +++ b/src/quickfix.c @@ -88,7 +88,7 @@ struct eformat /* '-' do not include this line */ }; -static int qf_init_ext __ARGS((char_u *efile, buf_T *buf, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast)); +static int qf_init_ext __ARGS((char_u *efile, buf_T *buf, typval_T *tv, char_u *errorformat, int newlist, linenr_T lnumfirst, linenr_T lnumlast)); static void qf_new_list __ARGS((void)); static int qf_add_entry __ARGS((qfline_T **prevp, char_u *dir, char_u *fname, char_u *mesg, long lnum, int col, int vis_col, char_u *pattern, int nr, int type, int valid)); static void qf_msg __ARGS((void)); @@ -124,7 +124,7 @@ qf_init(efile, errorformat, newlist) { if (efile == NULL) return FAIL; - return qf_init_ext(efile, curbuf, errorformat, newlist, + return qf_init_ext(efile, curbuf, NULL, errorformat, newlist, (linenr_T)0, (linenr_T)0); } @@ -137,9 +137,10 @@ qf_init(efile, errorformat, newlist) * Return -1 for error, number of errors for success. */ static int -qf_init_ext(efile, buf, errorformat, newlist, lnumfirst, lnumlast) +qf_init_ext(efile, buf, tv, errorformat, newlist, lnumfirst, lnumlast) char_u *efile; buf_T *buf; + typval_T *tv; char_u *errorformat; int newlist; /* TRUE: start a new error list */ linenr_T lnumfirst; /* first line number to use */ @@ -176,6 +177,8 @@ qf_init_ext(efile, buf, errorformat, new char_u *directory = NULL; char_u *currfile = NULL; char_u *tail = NULL; + char_u *p_str = NULL; + listitem_T *p_li = NULL; struct dir_stack_T *file_stack = NULL; regmatch_T regmatch; static struct fmtpattern @@ -222,7 +225,7 @@ qf_init_ext(efile, buf, errorformat, new * regex prog. Only a few % characters are allowed. */ /* Use the local value of 'errorformat' if it's set. */ - if (errorformat == p_efm && *buf->b_p_efm != NUL) + if (errorformat == p_efm && tv == NULL && *buf->b_p_efm != NUL) efm = buf->b_p_efm; else efm = errorformat; @@ -432,6 +435,14 @@ qf_init_ext(efile, buf, errorformat, new /* Always ignore case when looking for a matching error. */ regmatch.rm_ic = TRUE; + if (tv != NULL) + { + if (tv->v_type == VAR_STRING) + p_str = tv->vval.v_string; + else if (tv->v_type == VAR_LIST) + p_li = tv->vval.v_list->lv_first; + } + /* * Read the lines in the error file one by one. * Try to recognize one of the error formats in each line. @@ -441,10 +452,57 @@ qf_init_ext(efile, buf, errorformat, new /* Get the next line. */ if (fd == NULL) { - if (buflnum > lnumlast) - break; - vim_strncpy(IObuff, ml_get_buf(buf, buflnum++, FALSE), - CMDBUFFSIZE - 2); + if (tv != NULL) + { + int len; + + if (tv->v_type == VAR_STRING) + { + /* Get the next line from the supplied string */ + char_u *p; + + if (!*p_str) /* Reached the end of the string */ + break; + + p = vim_strchr(p_str, '\n'); + if (p) + len = p - p_str + 1; + else + len = STRLEN(p_str); + + if (len > CMDBUFFSIZE - 2) + vim_strncpy(IObuff, p_str, CMDBUFFSIZE - 2); + else + vim_strncpy(IObuff, p_str, len); + + p_str += len; + } + else if (tv->v_type == VAR_LIST) + { + /* Get the next line from the supplied list */ + while (p_li && p_li->li_tv.v_type != VAR_STRING) + p_li = p_li->li_next; /* Skip non-string items */ + + if (!p_li) /* End of the list */ + break; + + len = STRLEN(p_li->li_tv.vval.v_string); + if (len > CMDBUFFSIZE - 2) + len = CMDBUFFSIZE - 2; + + vim_strncpy(IObuff, p_li->li_tv.vval.v_string, len); + + p_li = p_li->li_next; /* next item */ + } + } + else + { + /* Get the next line from the supplied buffer */ + if (buflnum > lnumlast) + break; + vim_strncpy(IObuff, ml_get_buf(buf, buflnum++, FALSE), + CMDBUFFSIZE - 2); + } } else if (fgets((char *)IObuff, CMDBUFFSIZE - 2, fd) == NULL) break; @@ -1446,7 +1504,6 @@ qf_list(eap) int idx1 = 1; int idx2 = -1; int need_return = TRUE; - int last_printed = 1; char_u *arg = eap->arg; int all = eap->forceit; /* if not :cl!, only show recognised errors */ @@ -1467,7 +1524,6 @@ qf_list(eap) if (idx2 < 0) idx2 = (-idx2 > i) ? 0 : idx2 + i + 1; - more_back_used = TRUE; if (qf_lists[qf_curlist].qf_nonevalid) all = TRUE; qfp = qf_lists[qf_curlist].qf_start; @@ -1478,79 +1534,59 @@ qf_list(eap) if (need_return) { msg_putchar('\n'); + if (got_int) + break; need_return = FALSE; } - if (more_back == 0) - { - fname = NULL; - if (qfp->qf_fnum != 0 + + fname = NULL; + if (qfp->qf_fnum != 0 && (buf = buflist_findnr(qfp->qf_fnum)) != NULL) - { - fname = buf->b_fname; - if (qfp->qf_type == 1) /* :helpgrep */ - fname = gettail(fname); - } - if (fname == NULL) - sprintf((char *)IObuff, "%2d", i); - else - vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", + { + fname = buf->b_fname; + if (qfp->qf_type == 1) /* :helpgrep */ + fname = gettail(fname); + } + if (fname == NULL) + sprintf((char *)IObuff, "%2d", i); + else + vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", i, (char *)fname); - msg_outtrans_attr(IObuff, i == qf_lists[qf_curlist].qf_index - ? hl_attr(HLF_L) : hl_attr(HLF_D)); - if (qfp->qf_lnum == 0) - IObuff[0] = NUL; - else if (qfp->qf_col == 0) - sprintf((char *)IObuff, ":%ld", qfp->qf_lnum); - else - sprintf((char *)IObuff, ":%ld col %d", + msg_outtrans_attr(IObuff, i == qf_lists[qf_curlist].qf_index + ? hl_attr(HLF_L) : hl_attr(HLF_D)); + if (qfp->qf_lnum == 0) + IObuff[0] = NUL; + else if (qfp->qf_col == 0) + sprintf((char *)IObuff, ":%ld", qfp->qf_lnum); + else + sprintf((char *)IObuff, ":%ld col %d", qfp->qf_lnum, qfp->qf_col); - sprintf((char *)IObuff + STRLEN(IObuff), "%s:", + sprintf((char *)IObuff + STRLEN(IObuff), "%s:", (char *)qf_types(qfp->qf_type, qfp->qf_nr)); - msg_puts_attr(IObuff, hl_attr(HLF_N)); - if (qfp->qf_pattern != NULL) - { - qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE); - STRCAT(IObuff, ":"); - msg_puts(IObuff); - } - msg_puts((char_u *)" "); + msg_puts_attr(IObuff, hl_attr(HLF_N)); + if (qfp->qf_pattern != NULL) + { + qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE); + STRCAT(IObuff, ":"); + msg_puts(IObuff); + } + msg_puts((char_u *)" "); - /* Remove newlines and leading whitespace from the text. - * For an unrecognized line keep the indent, the compiler may - * mark a word with ^^^^. */ - qf_fmt_text((fname != NULL || qfp->qf_lnum != 0) + /* Remove newlines and leading whitespace from the text. For an + * unrecognized line keep the indent, the compiler may mark a word + * with ^^^^. */ + qf_fmt_text((fname != NULL || qfp->qf_lnum != 0) ? skipwhite(qfp->qf_text) : qfp->qf_text, IObuff, IOSIZE); - msg_prt_line(IObuff, FALSE); - out_flush(); /* show one line at a time */ - need_return = TRUE; - last_printed = i; - } + msg_prt_line(IObuff, FALSE); + out_flush(); /* show one line at a time */ + need_return = TRUE; } - if (more_back) - { - /* scrolling backwards from the more-prompt */ - /* TODO: compute the number of items from the screen lines */ - more_back = more_back * 2 - 1; - while (i > last_printed - more_back && i > idx1) - { - do - { - qfp = qfp->qf_prev; - --i; - } - while (i > idx1 && !qfp->qf_valid && !all); - } - more_back = 0; - } - else - { - qfp = qfp->qf_next; - ++i; - } + + qfp = qfp->qf_next; + ++i; ui_breakcheck(); } - more_back_used = FALSE; } /* @@ -2330,7 +2366,7 @@ ex_cnext(eap) } /* - * ":cfile" command. + * ":cfile"/":cgetfile"/":caddfile" commands. */ void ex_cfile(eap) @@ -2338,7 +2374,19 @@ ex_cfile(eap) { if (*eap->arg != NUL) set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE); - if (qf_init(p_ef, p_efm, TRUE) > 0 && eap->cmdidx == CMD_cfile) + + /* + * This function is used by the :cfile, :cgetfile and :caddfile + * commands. + * :cfile always creates a new quickfix list and jumps to the + * first error. + * :cgetfile creates a new quickfix list but doesn't jump to the + * first error. + * :caddfile adds to an existing quickfix list. If there is no + * quickfix list then a new list is created. + */ + if (qf_init(p_ef, p_efm, eap->cmdidx != CMD_caddfile) > 0 + && eap->cmdidx == CMD_cfile) qf_jump(0, 0, eap->forceit); /* display first error */ } @@ -2917,11 +2965,32 @@ ex_cbuffer(eap) || eap->line2 < 1 || eap->line2 > buf->b_ml.ml_line_count) EMSG(_(e_invrange)); else - qf_init_ext(NULL, buf, p_efm, TRUE, eap->line1, eap->line2); + qf_init_ext(NULL, buf, NULL, p_efm, TRUE, eap->line1, eap->line2); } } /* + * ":cexpr {expr}" command. + */ + void +ex_cexpr(eap) + exarg_T *eap; +{ + typval_T *tv; + + tv = eval_expr(eap->arg, NULL); + if (!tv || (tv->v_type != VAR_STRING && tv->v_type != VAR_LIST) || + (tv->v_type == VAR_STRING && !tv->vval.v_string) || + (tv->v_type == VAR_LIST && !tv->vval.v_list)) + return; + + if (qf_init_ext(NULL, NULL, tv, p_efm, TRUE, (linenr_T)0, (linenr_T)0) > 0) + qf_jump(0, 0, eap->forceit); /* display first error */ + + clear_tv(tv); +} + +/* * ":helpgrep {pattern}" */ void diff --git a/src/screen.c b/src/screen.c --- a/src/screen.c +++ b/src/screen.c @@ -169,7 +169,6 @@ static void redraw_block __ARGS((int row #endif static int win_do_lines __ARGS((win_T *wp, int row, int line_count, int mayclear, int del)); static void win_rest_invalid __ARGS((win_T *wp)); -static int screen_ins_lines __ARGS((int, int, int, int, win_T *wp)); static void msg_pos_mode __ARGS((void)); #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) static int fillchar_status __ARGS((int *attr, int is_curwin)); @@ -7618,7 +7617,7 @@ win_rest_invalid(wp) * * return FAIL for failure, OK for success. */ - static int + int screen_ins_lines(off, row, line_count, end, wp) int off; int row; diff --git a/src/tag.c b/src/tag.c --- a/src/tag.c +++ b/src/tag.c @@ -770,11 +770,6 @@ do_tag(tag, type, count, forceit, verbos #endif break; } -#if 0 - /* avoid the need to hit when jumping to another file */ - msg_scrolled = 0; - redraw_all_later(NOT_VALID); -#endif cur_match = i - 1; } diff --git a/src/version.h b/src/version.h --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 25)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 25, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 27)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 27, compiled "