1
0
forked from aniani/vim

updated for version 7.0002

This commit is contained in:
Bram Moolenaar 2004-06-24 15:53:16 +00:00
parent 69a7cb473c
commit f4b8e57ffd
39 changed files with 3963 additions and 2144 deletions

View File

@ -204,7 +204,19 @@ SRC_DOS_UNIX = \
# source files for DOS (also in the extra archive)
SRC_DOS = \
src/GvimExt \
src/GvimExt/*.mak \
src/GvimExt/GvimExt.reg \
src/GvimExt/Makefile \
src/GvimExt/README.txt \
src/GvimExt/gvimext.cpp \
src/GvimExt/gvimext.def \
src/GvimExt/gvimext.h \
src/GvimExt/gvimext.inf \
src/GvimExt/gvimext.rc \
src/GvimExt/gvimext_ming.def \
src/GvimExt/gvimext_ming.rc \
src/GvimExt/resource.h \
src/GvimExt/uninst.bat \
README_srcdos.txt \
src/INSTALLpc.txt \
src/Make_bc3.mak \

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.0aa. Last change: 2004 Jun 20
*eval.txt* For Vim version 7.0aa. Last change: 2004 Jun 22
VIM REFERENCE MANUAL by Bram Moolenaar
@ -1236,10 +1236,19 @@ eventhandler() *eventhandler()*
executable({expr}) *executable()*
This function checks if an executable with the name {expr}
exists. {expr} must be the name of the program without any
arguments. executable() uses the normal $PATH.
On MS-DOS and MS-Windows the ".exe", ".bat", etc. must be
included. It only checks if the file exists and is not a
directory, not if it's really executable.
arguments.
executable() uses the value of $PATH and/or the normal
searchpath for programs. *PATHEXT*
On MS-DOS and MS-Windows the ".exe", ".bat", etc. can
optionally be included. Then the extensions in $PATHEXT are
tried. Thus if "foo.exe" does not exist, "foo.exe.bat" can be
found. If $PATHEXT is not set then ".exe;.com;.bat;.cmd" is
used. A dot by itself can be used in $PATHEXT to try using
the name without an extension. When 'shell' looks like a
Unix shell, then the name is also tried without adding an
extension.
On MS-DOS and MS-Windows it only checks if the file exists and
is not a directory, not if it's really executable.
The result is a Number:
1 exists
0 does not exist

View File

@ -1,4 +1,4 @@
*filetype.txt* For Vim version 7.0aa. Last change: 2004 May 05
*filetype.txt* For Vim version 7.0aa. Last change: 2004 Jun 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -148,7 +148,7 @@ This means that the contents of compressed files are not inspected.
*new-filetype*
If a file type that you want to use is not detected yet, there are three ways
to add it. In any way, it's better not modify the $VIMRUNTIME/filetype.vim
to add it. In any way, it's better not to modify the $VIMRUNTIME/filetype.vim
file. It will be overwritten when installing a new version of Vim.
A. If you want to overrule all default file type checks.

View File

@ -1,4 +1,4 @@
*insert.txt* For Vim version 7.0aa. Last change: 2004 Jun 16
*insert.txt* For Vim version 7.0aa. Last change: 2004 Jun 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -375,6 +375,11 @@ This redefines the backspace key to start a new undo sequence. You can now
undo the effect of the backspace key, without changing what you typed before
that, with CTRL-O u.
Using CTRL-O splits undo: the text typed before and after it is undone
separately. If you want to avoid this (e.g., in a mapping) you might be able
to use CTRL-R = |i_CTRL-R|. E.g., to call a function: >
:imap <F2> <C-R>=MyFunc()<CR>
When the 'whichwrap' option is set appropriately, the <Left> and <Right>
keys on the first/last character in the line make the cursor wrap to the
previous/next line.

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
*repeat.txt* For Vim version 7.0aa. Last change: 2004 Apr 02
*repeat.txt* For Vim version 7.0aa. Last change: 2004 Jun 22
VIM REFERENCE MANUAL by Bram Moolenaar
@ -467,6 +467,13 @@ DEFINING BREAKPOINTS
Set a breakpoint in a sourced file. Example: >
:breakadd file 43 .vimrc
:breaka[dd] here
Set a breakpoint in the current line of the current file.
Like doing: >
:breakadd file <cursor-line> <current-file>
< Note that this only works for commands that are executed when
sourcing the file, not for a function defined in that file.
The [lnum] is the line number of the breakpoint. Vim will stop at or after
this line. When omitted line 1 is used.
@ -501,6 +508,9 @@ DELETING BREAKPOINTS
:breakd[el] file [lnum] {name}
Delete a breakpoint in a sourced file.
:breakd[el] here
Delete a breakpoint at the current line of the current file.
When [lnum] is omitted, the first breakpoint in the function or file is
deleted.
The {name} must be exactly the same as what was typed for the ":breakadd"

View File

@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.0aa. Last change: 2004 Jun 20
*todo.txt* For Vim version 7.0aa. Last change: 2004 Jun 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -30,6 +30,8 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
Change for fsync() error in Vim 6 as patch?
For version 7.0:
- Include many PATCHES:
9 Merge in ideas from tutor.txt (Gabriel Zachmann)
@ -59,7 +61,7 @@ For version 7.0:
InsmodLeave Taro Muraoka, 2004 Jun 16
- Include the kvim patch. http://freenux.org/vim/ (Mickael Marchand)
Do not add Qtopia yet, it doesn't work very well.
Mickael will update the patch before 21st.
update from Mickael 2004 Jun 20.
8 Unix: When libcall() fails there is no clear error message. Johannes
Zellner has a patch for this.
updated patch 2004 June 16.
@ -88,7 +90,8 @@ For version 7.0:
7 Completion of network shares, patch by Yasuhiro Matsumoto.
Update 2004 Jun 17.
8 Patches from Peter "Rain Dog" Cucka:
- guifont selector (2002 Dec 15) will send update
- guifont selector (2002 Dec 15)
update 2004 Jun 20
7 Add an option to set the width of the 'number' column. Eight
positions is often more than needed. Or adjust the width to the
length of the file?
@ -215,11 +218,6 @@ For version 7.0:
7 Motif: use the menu font consistently. Patch from Martin Dalecki 2002
Jan 11.
- Motif: add 3D shading for the menu entries? Patch from Martin Dalecki.
9 When 'autoindent' is set, hitting <CR> twice, while there is text after
the cursor, doesn't delete the autoindent in the resulting blank line.
(Rich Wales) This is Vi compatible, but it looks like a bug. Rich has
a suggestion for a patch to fix this.
e-mail to Rich bounced.
7 For Visual mode: Command to do a search for the string in the marked
area. Only when fewer than two lines. Use "g/" and "gb". Patch from
Yegappan Lakshmanan.
@ -260,6 +258,12 @@ For version 7.0:
ispell inside Vim). Gautam Iyer has an example with "aspell".
"engspchk" from Charles Campbell is a good way. Support for
approximate-regexps will help (agrep http://www.tgries.de/agrep/).
- Charles Campbell asks for method to add "contained" groups to
existing syntax items (to add @Spell). Add ":syntax contains
{pattern} add=@Spell" command? A bit like ":syn cluster" but change
the contains list directly for matching syntax items.
- Keep wordlist in syntax group, load it only once and use it several
times later. Sort of global syntax items.
- REFACTORING: The main() function is very long. Move parts to separate
functions, especially loops. Ideas from Walter Briscoe (2003 Apr 3, 2004
Feb 9).
@ -302,6 +306,11 @@ For version 7.0:
Especially when using the scrollbar. Typing a cursor-movement command
scrolls back to where the cursor is.
8 Support four composing characters, needed for Hebrew. (Ron Aaron)
- Add a few more things to 'diffopt': "horizontal", "vertical",
"foldcolumn". (Benji Fisher, 2004 Jun 21)
- FileChangedShellPost autocommand event: after (not) reloading a changed
file. Can be used to update statusline oslt.
- Displaying size of Visual area: use 24-33 column display.
Vi incompatibility:
@ -1111,6 +1120,8 @@ Problems that will (probably) not be solved:
- GTK: When pasting a selection from Vim to xclipboard gvim crashes with a
ABRT signal. Probably an error in the file gdkselection.c, the assert
always fails when XmbTextListToTextProperty() fails. (Tom Allard)
- GTK 2: gives an assertion error for every non-builtin icon in the toolbar.
This is a GTK 2.4.x bug, fixed in GTK 2.4.2. (Thomas de Grenier de Latour)
- When using an xterm that supports the termresponse feature, and the 't_Co'
termcap option was wrong when Vim started, it will be corrected when the
termresponse is received. Since the number of colors changes, the
@ -2171,6 +2182,9 @@ Command line history:
Insert mode:
9 When 'autoindent' is set, hitting <CR> twice, while there is text after
the cursor, doesn't delete the autoindent in the resulting blank line.
(Rich Wales) This is Vi compatible, but it looks like a bug.
8 When using CTRL-O in Insert mode, then executing an insert command
"a" or "i", should we return to Insert mode after <Esc>? (Eggink)
Perhaps it can be allowed a single time, to be able to do
@ -3299,8 +3313,6 @@ Various improvements:
- Implement 'redraw' option.
- Add special code to 'sections' option to define something else but '{' or
'}' as the start of a section (e.g. one shiftwidth to the right).
- Add 'indent' option: Always use this amount of indent when starting a new
line and when formatting text.
- Use pipes for filtering on Unix. Requires using fork() to be able to read
and write at the same time, or some select() mechanism.
7 Allow using Vim in a pipe: "ls | vim -u xxx.vim - | yyy". Only needs

View File

@ -1,4 +1,4 @@
*usr_05.txt* For Vim version 7.0aa. Last change: 2004 Mar 12
*usr_05.txt* For Vim version 7.0aa. Last change: 2004 Jun 24
VIM USER MANUAL - by Bram Moolenaar
@ -369,8 +369,8 @@ adding. If it's OK, you can give the new one another name: >
mv thefile ~/.vim/ftplugin/stuff_too.vim
The underscore is used to separate the name of the filetype from the rest,
which can be anything. If you would use "otherstuff.vim" it wouldn't work, it
would be loaded for the "otherstuff" filetype.
which can be anything. If you use "otherstuff.vim" it wouldn't work, it would
be loaded for the "otherstuff" filetype.
On MS-DOS you cannot use long filenames. You would run into trouble if you
add a second plugin and the filetype has more than six characters. You can
@ -505,7 +505,7 @@ before and after the option name. For example: >
:help 'wrap'
In case you have messed up an option value, you can set it back to the
default by putting a ampersand (&) after the option name. Example: >
default by putting an ampersand (&) after the option name. Example: >
:set iskeyword&
@ -514,8 +514,8 @@ NOT WRAPPING LINES
Vim normally wraps long lines, so that you can see all of the text. Sometimes
it's better to let the text continue right of the window. Then you need to
scroll the text left-right to see all of a long line. Switch wrapping of with
this command: >
scroll the text left-right to see all of a long line. Switch wrapping off
with this command: >
:set nowrap

View File

@ -1,4 +1,4 @@
*version7.txt* For Vim version 7.0aa. Last change: 2004 Jun 07
*version7.txt* For Vim version 7.0aa. Last change: 2004 Jun 24
VIM REFERENCE MANUAL by Bram Moolenaar
@ -32,6 +32,20 @@ INCOMPATIBLE CHANGES *incompatible-7*
These changes are incompatible with previous releases. Check this list if you
run into a problem when upgrading from Vim 6.x to 7.0
":helpgrep" now uses a help window to display a match.
Minor incompatibilities:
For filetype detection: For many types, instead of ~/.dir/filename use
*/.dir/filename, so that it also works for other user's files.
":0verbose" now sets 'verbose' to zero instead of one.
Removed the old and incomplete "VimBuddy" code.
Buffers without a name report "No Name" instead of "No File". It was
confusing for buffers with a name and 'buftype' set to "nofile".
==============================================================================
NEW FEATURES *new-7*
@ -68,10 +82,21 @@ New autocommand events: ~
New Syntax files: ~
Others: ~
Mac: Add the selection type to the clipboard, so that Block, line and
character selections can be used between two Vims. (Eckehard Berns)
Also fixes the problem that setting 'clipboard' to "unnamed" breaks using
"yyp".
==============================================================================
IMPROVEMENTS *improvements-7*
":helpgrep" accepts a language specifier after the pattern: "pat@it".
":breakadd here" and ":breakdel here" can be used to set or delete a
breakpoint at the cursor.
==============================================================================
COMPILE TIME CHANGES *compile-changes-7*
@ -80,5 +105,51 @@ COMPILE TIME CHANGES *compile-changes-7*
==============================================================================
BUG FIXES *bug-fixes-7*
When using PostScript printing on MS-DOS the default 'printexpr' used "lpr"
instead of "copy". When 'printdevice' was empty the copy command did not
work. Use "LPT1" then.
The GTK font dialog uses a font size zero when the font name doesn't include a
size. Use a default size of 10.
This example in the documentation didn't work:
:e `=foo . ".c" `
Skip over the expression in `=expr` when looking for comments, |, % and #.
When ":helpgrep" doesn't find anything there is no error message.
"L" and "H" did not take closed folds into account.
Win32: The "-P title" argument stopped at the first title that matched, even
when it doesn't support MDI.
Mac GUI: CTRL-^ and CTRL-@ did not work.
"2daw" on "word." at the end of a line didn't include the preceding white
space.
Win32: Using FindExecutable() doesn't work to find a program. Use
SearchPath() instead. For executable() use $PATHEXT when the program searched
for doesn't have an extension.
When 'virtualedit' is set, moving the cursor up after appending a character
may move it to a different column. Was caused by auto-formatting moving the
cursor and not putting it back where it was.
When indent was added automatically and then moving the cursor, the indent was
not deleted (like when pressing ESC). The "I" flag in 'cpoptions' can be used
to make it work the old way.
When <Space> is mapped to something that starts with a space, typing <Space>
does not expand abbreviations. Only disable expanding abbreviations when a
mapping is not remapped, not when the RHS starts with the LHS.
When opening a command-line window, 'textwidth' gets set to 78 by the Vim
filetype plugin. Reset 'textwidth' to 0 to avoid lines are broken.
After using cursor(line, col) moving up/down doesn't keep the same column.
Win32: Borland C before 5.5 requires using ".u." for LowPart and HighPart
fields. (Walter Briscoe)
vim:tw=78:ts=8:ft=help:norl:

View File

@ -1,7 +1,7 @@
"=============================================================================
" File: explorer.vim
" Author: M A Aziz Ahmed (aziz@acorn-networks.com - doesn't work)
" Last Change: 2004 May 13
" Last Change: 2004 Jun 22
" Version: 2.5 + changes
" Additions by Mark Waggoner (waggoner@aracnet.com) et al.
"-----------------------------------------------------------------------------
@ -647,7 +647,7 @@ function! s:ShowDirectory()
let b:maxFileLen = 0
0
/^"=/+1,$g/^/call s:MarkDirs()
normal! `t
keepjumps normal! `t
call s:AddFileInfo()
endif
@ -840,7 +840,7 @@ function! s:AddFileInfo()
call s:AddSeparators()
" return to start
normal! `t
keepjumps normal! `t
let &sc = save_sc
endfunction
@ -973,7 +973,7 @@ function! s:UpdateHeader()
" Go back where we came from if possible
0
if line("'t") != 0
normal! `t
keepjumps normal! `t
endif
let &report=oldRep

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
"
" Language: Logtalk
" Maintainer: Paulo Moura <pmoura@logtalk.org>
" Last Change: 2004 May 16
" Last Change: 2004 June 1
" Quit when a syntax file was already loaded:
@ -55,9 +55,7 @@ syn region logtalkOpenEntityDir matchgroup=logtalkOpenEntityDirTag start=":- cat
" Logtalk closing entity directives
syn match logtalkCloseEntityDir ":- end_object\."
syn match logtalkCloseEntityDir ":- end_protocol\."
syn match logtalkCloseEntityDir ":- end_category\."
syn match logtalkCloseEntityDir ":- end_\(object\|protocol\|category\)\."
" Logtalk entity relations
@ -88,38 +86,24 @@ syn region logtalkDir matchgroup=logtalkDirTag start=":- uses(" matchgroup=log
" Logtalk built-in predicates
syn match logtalkBuiltIn "\<current_object\ze("
syn match logtalkBuiltIn "\<current_protocol\ze("
syn match logtalkBuiltIn "\<current_category\ze("
syn match logtalkBuiltIn "\<current_\(object\|protocol\|category\)\ze("
syn match logtalkBuiltIn "\<create_object\ze("
syn match logtalkBuiltIn "\<create_protocol\ze("
syn match logtalkBuiltIn "\<create_category\ze("
syn match logtalkBuiltIn "\<create_\(object\|protocol\|category\)\ze("
syn match logtalkBuiltIn "\<object_property\ze("
syn match logtalkBuiltIn "\<protocol_property\ze("
syn match logtalkBuiltIn "\<category_property\ze("
syn match logtalkBuiltIn "\<\(object\|protocol\|category\)_property\ze("
syn match logtalkBuiltIn "\<abolish_object\ze("
syn match logtalkBuiltIn "\<abolish_protocol\ze("
syn match logtalkBuiltIn "\<abolish_category\ze("
syn match logtalkBuiltIn "\<abolish_\(object\|protocol\|category\)\ze("
syn match logtalkBuiltIn "\<extends_object\ze("
syn match logtalkBuiltIn "\<extends_protocol\ze("
syn match logtalkBuiltIn "\<implements_protocol\ze("
syn match logtalkBuiltIn "\<instantiates_class\ze("
syn match logtalkBuiltIn "\<specializes_class\ze("
syn match logtalkBuiltIn "\<imports_category\ze("
syn match logtalkBuiltIn "\<extends_\(object\|protocol\)\ze("
syn match logtalkBuiltIn "\<imp\(orts_category\|lements_protocol\)\ze("
syn match logtalkBuiltIn "\<\(instantiates\|specializes\)_class\ze("
syn match logtalkBuiltIn "\<abolish_events\ze("
syn match logtalkBuiltIn "\<\(abolish\|define\)_events\ze("
syn match logtalkBuiltIn "\<current_event\ze("
syn match logtalkBuiltIn "\<define_events\ze("
syn match logtalkBuiltIn "\<current_logtalk_flag\ze("
syn match logtalkBuiltIn "\<set_logtalk_flag\ze("
syn match logtalkBuiltIn "\<\(current\|set\)_logtalk_flag\ze("
syn match logtalkBuiltIn "\<logtalk_compile\ze("
syn match logtalkBuiltIn "\<logtalk_load\ze("
syn match logtalkBuiltIn "\<logtalk_\(compile\|load\)\ze("
syn match logtalkBuiltIn "\<forall\ze("
syn match logtalkBuiltIn "\<retractall\ze("
@ -128,24 +112,20 @@ syn match logtalkBuiltIn "\<retractall\ze("
" Logtalk built-in methods
syn match logtalkBuiltInMethod "\<parameter\ze("
syn match logtalkBuiltInMethod "\<self\ze("
syn match logtalkBuiltInMethod "\<sender\ze("
syn match logtalkBuiltInMethod "\<se\(lf\|nder\)\ze("
syn match logtalkBuiltInMethod "\<this\ze("
syn match logtalkBuiltInMethod "\<current_predicate\ze("
syn match logtalkBuiltInMethod "\<predicate_property\ze("
syn match logtalkBuiltInMethod "\<abolish\ze("
syn match logtalkBuiltInMethod "\<asserta\ze("
syn match logtalkBuiltInMethod "\<assertz\ze("
syn match logtalkBuiltInMethod "\<assert\(a\|z\)\ze("
syn match logtalkBuiltInMethod "\<clause\ze("
syn match logtalkBuiltInMethod "\<retract\ze("
syn match logtalkBuiltInMethod "\<retractall\ze("
syn match logtalkBuiltInMethod "\<bagof\ze("
syn match logtalkBuiltInMethod "\<findall\ze("
syn match logtalkBuiltInMethod "\<forall\ze("
syn match logtalkBuiltInMethod "\<setof\ze("
syn match logtalkBuiltInMethod "\<\(bag\|set\)of\ze("
syn match logtalkBuiltInMethod "\<f\(ind\|or\)all\ze("
syn match logtalkBuiltInMethod "\<before\ze("
syn match logtalkBuiltInMethod "\<after\ze("
@ -163,13 +143,12 @@ syn match logtalkOperator "@"
syn match logtalkKeyword "\<true\>"
syn match logtalkKeyword "\<fail\>"
syn match logtalkKeyword "\<call\ze("
syn match logtalkKeyword "\<ca\(ll\|tch\)\ze("
syn match logtalkOperator "!"
syn match logtalkOperator ","
" syn match logtalkOperator ","
syn match logtalkOperator ";"
syn match logtalkOperator "-->"
syn match logtalkOperator "->"
syn match logtalkKeyword "\<catch\ze("
syn match logtalkKeyword "\<throw\ze("
@ -188,8 +167,7 @@ syn match logtalkKeyword "\<integer\ze("
syn match logtalkKeyword "\<float\ze("
syn match logtalkKeyword "\<atomic\ze("
syn match logtalkKeyword "\<compound\ze("
syn match logtalkKeyword "\<nonvar\ze("
syn match logtalkKeyword "\<number\ze("
syn match logtalkKeyword "\<n\(onvar\|umber\)\ze("
" Term comparison
@ -227,10 +205,8 @@ syn match logtalkOperator ">="
" Stream selection and control
syn match logtalkKeyword "\<current_input\ze("
syn match logtalkKeyword "\<current_output\ze("
syn match logtalkKeyword "\<set_input\ze("
syn match logtalkKeyword "\<set_output\ze("
syn match logtalkKeyword "\<current_\(input\|output\)\ze("
syn match logtalkKeyword "\<set_\(input\|output\)\ze("
syn match logtalkKeyword "\<open\ze("
syn match logtalkKeyword "\<close\ze("
syn match logtalkKeyword "\<flush_output\ze("
@ -241,33 +217,20 @@ syn match logtalkKeyword "\<at_end_of_stream\>"
syn match logtalkKeyword "\<set_stream_position\ze("
" Character input/output
" Character and byte input/output
syn match logtalkKeyword "\<get_char\ze("
syn match logtalkKeyword "\<get_code\ze("
syn match logtalkKeyword "\<peek_char\ze("
syn match logtalkKeyword "\<peek_code\ze("
syn match logtalkKeyword "\<put_char\ze("
syn match logtalkKeyword "\<put_code\ze("
syn match logtalkKeyword "\<\(get\|peek\|put\)_\(char\|code\|byte\)\ze("
syn match logtalkKeyword "\<nl\ze("
syn match logtalkKeyword "\<nl\>"
" Byte input/output
syn match logtalkKeyword "\<get_byte\ze("
syn match logtalkKeyword "\<peek_byte\ze("
syn match logtalkKeyword "\<put_byte\ze("
" Term input/output
syn match logtalkKeyword "\<read_term\ze("
syn match logtalkKeyword "\<read\ze("
syn match logtalkKeyword "\<write_term\ze("
syn match logtalkKeyword "\<write\ze("
syn match logtalkKeyword "\<writeq\ze("
syn match logtalkKeyword "\<write_canonical\ze("
syn match logtalkKeyword "\<write_\(canonical\|term\)\ze("
syn match logtalkKeyword "\<op\ze("
syn match logtalkKeyword "\<current_op\ze("
syn match logtalkKeyword "\<char_conversion\ze("
@ -283,20 +246,15 @@ syn match logtalkKeyword "\<repeat\>"
" Atomic term processing
syn match logtalkKeyword "\<atom_length\ze("
syn match logtalkKeyword "\<atom_concat\ze("
syn match logtalkKeyword "\<atom_\(length\|concat\|chars\|codes\)\ze("
syn match logtalkKeyword "\<sub_atom\ze("
syn match logtalkKeyword "\<atom_chars\ze("
syn match logtalkKeyword "\<atom_codes\ze("
syn match logtalkKeyword "\<char_code\ze("
syn match logtalkKeyword "\<number_chars\ze("
syn match logtalkKeyword "\<number_codes\ze("
syn match logtalkKeyword "\<number_\(chars\|codes\)\ze("
" Implementation defined hooks functions
syn match logtalkKeyword "\<set_prolog_flag\ze("
syn match logtalkKeyword "\<current_prolog_flag\ze("
syn match logtalkKeyword "\<\(current\|set\)_prolog_flag\ze("
syn match logtalkKeyword "\<halt\ze("
syn match logtalkKeyword "\<halt\>"
@ -314,8 +272,7 @@ syn match logtalkKeyword "\<mod\ze("
syn match logtalkKeyword "\<mod\>"
syn match logtalkKeyword "\<abs\ze("
syn match logtalkKeyword "\<sign\ze("
syn match logtalkKeyword "\<float_integer_part\ze("
syn match logtalkKeyword "\<float_fractional_part\ze("
syn match logtalkKeyword "\<float_\(integer\|fractional\)_part\ze("
syn match logtalkKeyword "\<float\ze("
syn match logtalkKeyword "\<floor\ze("
syn match logtalkKeyword "\<truncate\ze("
@ -326,12 +283,11 @@ syn match logtalkKeyword "\<ceiling\ze("
" Other arithemtic functors
syn match logtalkOperator "\*\*"
syn match logtalkKeyword "\<sin\ze("
syn match logtalkKeyword "\<s\(in\|qrt\)\ze("
syn match logtalkKeyword "\<cos\ze("
syn match logtalkKeyword "\<atan\ze("
syn match logtalkKeyword "\<exp\ze("
syn match logtalkKeyword "\<log\ze("
syn match logtalkKeyword "\<sqrt\ze("
" Bitwise functors

View File

@ -2,7 +2,7 @@
" Language: Texinfo (macro package for TeX)
" Maintainer: Sandor Kopanyi <sandor.kopanyi@mailbox.hu>
" URL: <->
" Last Change: 2003 May 11
" Last Change: 2004 Jun 23
"
" the file follows the Texinfo manual structure; this file is based
" on manual for Texinfo version 4.0, 28 September 1999
@ -351,7 +351,7 @@ syn region texinfoPrmAtCmd matchgroup=texinfoAtCmd start="^@oddheading" skip="
syn match texinfoAtCmd "@refill"
syn cluster texinfoAll contains=ALLBUT,{texinfoThisAtCmd,texinfoHFSpecialChar}
syn cluster texinfoAll contains=ALLBUT,texinfoThisAtCmd,texinfoHFSpecialChar
syn cluster texinfoReducedAll contains=texinfoSpecialChar,texinfoBrcPrmAtCmd
"==============================================================================
" highlighting

20
src/GvimExt/GvimExt.reg Normal file
View File

@ -0,0 +1,20 @@
REGEDIT4
[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}]
@="Vim Shell Extension"
[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32]
@="gvimext.dll"
"ThreadingModel"="Apartment"
[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim]
@="{51EEE242-AD87-11d3-9C1E-0090278BBD99}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
"{51EEE242-AD87-11d3-9C1E-0090278BBD99}"="Vim Shell Extension"
[HKEY_LOCAL_MACHINE\Software\Vim\Gvim]
"path"="gvim.exe"
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 7.0aa]
"DisplayName"="Vim 7.0aa: Edit with Vim popup menu entry"
"UninstallString"="uninstal.exe"

43
src/GvimExt/Make_bc5.mak Normal file
View File

@ -0,0 +1,43 @@
### USEDLL no for statically linked version of run-time, yes for DLL runtime
### BOR path to root of Borland C install (c:\bc5)
### (requires cc3250.dll be available in %PATH%)
!if ("$(USEDLL)"=="")
USEDLL = no
!endif
### BOR: root of the BC installation
!if ("$(BOR)"=="")
BOR = c:\bc5
!endif
CC = $(BOR)\bin\Bcc32
BRC = $(BOR)\bin\brc32
LINK = $(BOR)\BIN\ILink32
INCLUDE = $(BOR)\include;.
LIB = $(BOR)\lib
!if ("$(USEDLL)"=="yes")
RT_DEF = -D_RTLDLL
RT_LIB = cw32i.lib
!else
RT_DEF =
RT_LIB = cw32.lib
!endif
all : gvimext.dll
gvimext.obj : gvimext.cpp gvimext.h
$(CC) -tWD -I$(INCLUDE) -c -DFEAT_GETTEXT $(RT_DEF) -w- gvimext.cpp
gvimext.res : gvimext.rc
$(BRC) -r gvimext.rc
gvimext.dll : gvimext.obj gvimext.res
$(LINK) -L$(LIB) -aa gvimext.obj, gvimext.dll, , c0d32.obj $(RT_LIB) import32.lib, gvimext.def, gvimext.res
clean :
-@del gvimext.obj
-@del gvimext.res
-@del gvimext.dll

63
src/GvimExt/Make_ming.mak Normal file
View File

@ -0,0 +1,63 @@
# Project: gvimext
# Generates gvimext.dll with gcc.
# Can be used for Cygwin and MingW (MingW ignores -mno-cygwin)
#
# Originally, the DLL base address was fixed: -Wl,--image-base=0x1C000000
# Now it is allocated dymanically by the linker by evaluating all DLLs
# already loaded in memory. The binary image contains as well information
# for automatic pseudo-rebasing, if needed by the system. ALV 2004-02-29
# If cross-compiling set this to yes, else set it to no
CROSS = no
#CROSS = yes
# For the old MinGW 2.95 (the one you get e.g. with debian woody)
# set the following variable to yes and check if the executables are
# really named that way.
# If you have a newer MinGW or you are using cygwin set it to no and
# check also the executables
MINGWOLD = no
ifeq ($(CROSS),yes)
ifeq ($(MINGWOLD),yes)
CXX = i586-mingw32msvc-g++
CXXFLAGS := -O2 -mno-cygwin -fvtable-thunks
WINDRES = i586-mingw32msvc-windres
else
CXX = i386-mingw32msvc-g++
CXXFLAGS := -O2 -mno-cygwin
WINDRES = i386-mingw32msvc-windres
endif
else
CXX := g++.exe
WINDRES := windres.exe
CXXFLAGS := -O2 -mno-cygwin
endif
LIBS := -luuid
RES := gvimext.res
DEFFILE = gvimext_ming.def
OBJ := gvimext.o
DLL := gvimext.dll
.PHONY: all all-before all-after clean clean-custom
all: all-before $(DLL) all-after
$(DLL): $(OBJ) $(RES) $(DEFFILE)
$(CXX) -shared $(CXXFLAGS) -s -o $@ \
-Wl,--enable-auto-image-base \
-Wl,--enable-auto-import \
-Wl,--whole-archive \
$^ \
-Wl,--no-whole-archive \
$(LIBS)
gvimext.o: gvimext.cpp
$(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@
$(RES): gvimext_ming.rc
$(WINDRES) --input-format=rc --output-format=coff -DMING $? -o $@
clean: clean-custom
$(RM) $(OBJ) $(RES) $(DLL)

35
src/GvimExt/Makefile Normal file
View File

@ -0,0 +1,35 @@
# Makefile for GvimExt, using MSVC
# Options:
# DEBUG=yes Build debug version (for VC7 and maybe later)
#
TARGETOS=BOTH
APPVER=4.0
!if "$(DEBUG)" != "yes"
NODEBUG = 1
!endif
!include <win32.mak>
all: gvimext.dll
gvimext.dll: gvimext.obj \
gvimext.res
$(implib) /NOLOGO -machine:$(CPU) -def:gvimext.def $** -out:gvimext.lib
$(link) $(dlllflags) -base:0x1C000000 -out:$*.dll $** $(olelibsdll) shell32.lib gvimext.lib comctl32.lib gvimext.exp
gvimext.obj: gvimext.h
.cpp.obj:
$(cc) $(cflags) -DFEAT_GETTEXT $(cvarsdll) $*.cpp
gvimext.res: gvimext.rc
$(rc) $(rcflags) $(rcvars) gvimext.rc
clean:
- if exist gvimext.dll del gvimext.dll
- if exist gvimext.lib del gvimext.lib
- if exist gvimext.exp del gvimext.exp
- if exist gvimext.obj del gvimext.obj
- if exist gvimext.res del gvimext.res

94
src/GvimExt/README.txt Normal file
View File

@ -0,0 +1,94 @@
README.txt for the gvimext DLL.
Written by Tianmiao Hu. Edited by Bram Moolenaar.
INSTALLATION
To install the "Edit with Vim" popup menu entry, it is recommended to use the
"install.exe" program. It will ask you a few questions and install the needed
registry entries.
In special situations you might want to make changes by hand. Check these
items:
- The gvimext.dll, gvim.exe and uninstal.exe either need to be in the search
path, or you have to set the full path in the registry entries. You could
move the gvimext.dll to the "windows\system" or "windows\system32"
directory, where the other DLL files are.
- You can find the names of the used registry entries in the file
"GvimExt.reg". You can edit this file to add the paths. To install the
registry entries, right-click the gvimext.reg file and choose the "merge"
menu option.
- The registry key [HKEY_LOCAL_MACHINE\Software\Vim\Gvim] is used by the
gvimext.dll. The value "path" specifies the location of "gvim.exe". If
gvim.exe is in the search path, the path can be omitted. The value "lang"
can be used to set the language, for example "de" for German. If "lang" is
omitted, the language set for Windows will be used.
It is the preferred method to keep gvim.exe with the runtime files, so that
Vim will find them (also the translated menu items are there).
UNINSTALLATION
To uninstall the "Edit with Vim" popup menu entry, it is recommended to use
the "uninstal.exe" program.
In special situations you might want to uninstall by hand:
- Open the registry by running regedit.exe.
- Delete all the keys listed in GvimExt.reg, except this one:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved]
For this key, only delete one value:
"{51EEE242-AD87-11d3-9C1E-0090278BBD99}"="Vim Shell Extension"
- Delete the gvimext.dll, if you want. You might need to reboot the machine
in order to remove this file. A quick way is to log off and re-login.
Another method is by using the uninst.bat script:
uninst gvimext.inf
This batch file will remove all the registry keys from the system. Then you
can remove the gvimext.dll file.
Note: In order for this batch file to work, you must have two system files:
rundll32.exe and setupapi.dll. I believe you will have rundll32.exe in your
system. I know windows nt 4.0 with the service pack 4 has setupapi.dll. My
windows 95 has setupapi.dll. I find that the internet explorer 4.0 comes with
the setupapi.dll in file Ie4_5.cab.
If you do encounter problems running this script, then probably you need to
modify the uninst.bat to suit to your system. Basically, you must find out
where are the locations for your rundll32.exe and setupapi.dll files. In
windows nt, both files are under c:\winnt\system32 directory. In my windows 95
system, I got setupapi.dll at c:\windows\system and rundll32.exe at
c:\windows. So you might want to try something like:
rundll32.exe c:\windows\system\setupapi.dll,InstallHinfSection DefaultUninstall 128 %1
where %1 can be substitued by gvimext.inf
THE SOURCE CODE
I have provided the source code here in hope that gvim users around world can
further enhance this little dll. I believe the only thing you need to change
is gvimext.cpp file. The important two functions you need to look at are
QueryContextMenu and InvokeCommand. You can modify right-click menus in the
QueryContextMenu function and invoke gvim in the InvokeCommand function. Note
the selected files can be accessed from the DragQueryFile function. I am not
familiar with the invoking options for gvim. I believe there are some
improvements that can be made on that side.
I use MS Visual C++ 6.0's nmake to make the gvimext.dll. I don't have a
chance to try earlier versions of MSVC. The files that are required for build
are:
gvimext.cpp
gvimext.h
gvimext.def
gvimext.rc
resource.h
Makefile
To compile the DLL from the command line:
vcvars32
nmake -f Makefile
If you did something interesting to this dll, please let me know
@ tianmiao@acm.org.
Happy vimming!!!

979
src/GvimExt/gvimext.cpp Normal file
View File

@ -0,0 +1,979 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved gvimext by Tianmiao Hu
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
*/
/*
* gvimext is a DLL which is used for the "Edit with Vim" context menu
* extension. It implements a MS defined interface with the Shell.
*
* If you have any questions or any suggestions concerning gvimext, please
* contact Tianmiao Hu: tianmiao@acm.org.
*/
#include "gvimext.h"
#ifdef __BORLANDC__
# include <dir.h>
# ifndef _strnicmp
# define _strnicmp(a, b, c) strnicmp((a), (b), (c))
# endif
#else
static char *searchpath(char *name);
#endif
// Always get an error while putting the following stuff to the
// gvimext.h file as class protected variables, give up and
// declare them as global stuff
FORMATETC fmte = {CF_HDROP,
(DVTARGETDEVICE FAR *)NULL,
DVASPECT_CONTENT,
-1,
TYMED_HGLOBAL
};
STGMEDIUM medium;
HRESULT hres = 0;
UINT cbFiles = 0;
//
// Get the name of the Gvim executable to use, with the path.
// When "runtime" is non-zero, we were called to find the runtime directory.
// Returns the path in name[MAX_PATH]. It's empty when it fails.
//
static void
getGvimName(char *name, int runtime)
{
HKEY keyhandle;
DWORD hlen;
// Get the location of gvim from the registry.
name[0] = 0;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
KEY_READ, &keyhandle) == ERROR_SUCCESS)
{
hlen = MAX_PATH;
if (RegQueryValueEx(keyhandle, "path", 0, NULL, (BYTE *)name, &hlen)
!= ERROR_SUCCESS)
name[0] = 0;
else
name[hlen] = 0;
RegCloseKey(keyhandle);
}
// Registry didn't work, use the search path.
if (name[0] == 0)
strcpy(name, searchpath("gvim.exe"));
if (!runtime)
{
// Only when looking for the executable, not the runtime dir, we can
// search for the batch file or a name without a path.
if (name[0] == 0)
strcpy(name, searchpath("gvim.bat"));
if (name[0] == 0)
strcpy(name, "gvim"); // finds gvim.bat or gvim.exe
// avoid that Vim tries to expand wildcards in the file names
strcat(name, " --literal");
}
}
//
// Get the Vim runtime directory into buf[MAX_PATH].
// The result is empty when it failed.
// When it works, the path ends in a slash or backslash.
//
static void
getRuntimeDir(char *buf)
{
int idx;
getGvimName(buf, 1);
if (buf[0] != 0)
{
// When no path found, use the search path to expand it.
if (strchr(buf, '/') == NULL && strchr(buf, '\\') == NULL)
strcpy(buf, searchpath(buf));
// remove "gvim.exe" from the end
for (idx = strlen(buf) - 1; idx >= 0; idx--)
if (buf[idx] == '\\' || buf[idx] == '/')
{
buf[idx + 1] = 0;
break;
}
}
}
//
// GETTEXT: translated messages and menu entries
//
#ifndef FEAT_GETTEXT
# define _(x) x
#else
# define _(x) (*dyn_libintl_gettext)(x)
# define VIMPACKAGE "vim"
# ifndef GETTEXT_DLL
# define GETTEXT_DLL "libintl.dll"
# endif
// Dummy functions
static char *null_libintl_gettext(const char *);
static char *null_libintl_textdomain(const char *);
static char *null_libintl_bindtextdomain(const char *, const char *);
static int dyn_libintl_init(char *dir);
static void dyn_libintl_end(void);
static HINSTANCE hLibintlDLL = 0;
static char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
static char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain;
static char *(*dyn_libintl_bindtextdomain)(const char *, const char *)
= null_libintl_bindtextdomain;
//
// Attempt to load libintl.dll. If it doesn't work, use dummy functions.
// "dir" is the directory where the libintl.dll might be.
// Return 1 for success, 0 for failure.
//
static int
dyn_libintl_init(char *dir)
{
int i;
static struct
{
char *name;
FARPROC *ptr;
} libintl_entry[] =
{
{"gettext", (FARPROC*)&dyn_libintl_gettext},
{"textdomain", (FARPROC*)&dyn_libintl_textdomain},
{"bindtextdomain", (FARPROC*)&dyn_libintl_bindtextdomain},
{NULL, NULL}
};
// No need to initialize twice.
if (hLibintlDLL)
return 1;
// Load gettext library, first try the Vim runtime directory, then search
// the path.
strcat(dir, GETTEXT_DLL);
hLibintlDLL = LoadLibrary(dir);
if (!hLibintlDLL)
{
hLibintlDLL = LoadLibrary(GETTEXT_DLL);
if (!hLibintlDLL)
return 0;
}
// Get the addresses of the functions we need.
for (i = 0; libintl_entry[i].name != NULL
&& libintl_entry[i].ptr != NULL; ++i)
{
if ((*libintl_entry[i].ptr = GetProcAddress(hLibintlDLL,
libintl_entry[i].name)) == NULL)
{
dyn_libintl_end();
return 0;
}
}
return 1;
}
static void
dyn_libintl_end(void)
{
if (hLibintlDLL)
FreeLibrary(hLibintlDLL);
hLibintlDLL = NULL;
dyn_libintl_gettext = null_libintl_gettext;
dyn_libintl_textdomain = null_libintl_textdomain;
dyn_libintl_bindtextdomain = null_libintl_bindtextdomain;
}
static char *
null_libintl_gettext(const char *msgid)
{
return (char *)msgid;
}
static char *
null_libintl_bindtextdomain(const char *domainname, const char *dirname)
{
return NULL;
}
static char *
null_libintl_textdomain(const char* domainname)
{
return NULL;
}
//
// Setup for translating strings.
//
static void
dyn_gettext_load(void)
{
char szBuff[MAX_PATH];
char szLang[MAX_PATH];
DWORD len;
HKEY keyhandle;
int gotlang = 0;
strcpy(szLang, "LANG=");
// First try getting the language from the registry, this can be
// used to overrule the system language.
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0,
KEY_READ, &keyhandle) == ERROR_SUCCESS)
{
len = MAX_PATH;
if (RegQueryValueEx(keyhandle, "lang", 0, NULL, (BYTE*)szBuff, &len)
== ERROR_SUCCESS)
{
szBuff[len] = 0;
strcat(szLang, szBuff);
gotlang = 1;
}
RegCloseKey(keyhandle);
}
if (!gotlang && getenv("LANG") == NULL)
{
// Get the language from the system.
// Could use LOCALE_SISO639LANGNAME, but it's not in Win95.
// LOCALE_SABBREVLANGNAME gives us three letters, like "enu", we use
// only the first two.
len = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SABBREVLANGNAME,
(LPTSTR)szBuff, MAX_PATH);
if (len >= 2 && _strnicmp(szBuff, "en", 2) != 0)
{
// There are a few exceptions (probably more)
if (_strnicmp(szBuff, "cht", 3) == 0
|| _strnicmp(szBuff, "zht", 3) == 0)
strcpy(szBuff, "zh_TW");
else if (_strnicmp(szBuff, "chs", 3) == 0
|| _strnicmp(szBuff, "zhc", 3) == 0)
strcpy(szBuff, "zh_CN");
else if (_strnicmp(szBuff, "jp", 2) == 0)
strcpy(szBuff, "ja");
else
szBuff[2] = 0; // truncate to two-letter code
strcat(szLang, szBuff);
gotlang = 1;
}
}
if (gotlang)
putenv(szLang);
// Try to locate the runtime files. The path is used to find libintl.dll
// and the vim.mo files.
getRuntimeDir(szBuff);
if (szBuff[0] != 0)
{
len = strlen(szBuff);
if (dyn_libintl_init(szBuff))
{
strcpy(szBuff + len, "lang");
(*dyn_libintl_bindtextdomain)(VIMPACKAGE, szBuff);
(*dyn_libintl_textdomain)(VIMPACKAGE);
}
}
}
static void
dyn_gettext_free(void)
{
dyn_libintl_end();
}
#endif // FEAT_GETTEXT
//
// Global variables
//
UINT g_cRefThisDll = 0; // Reference count of this DLL.
HINSTANCE g_hmodThisDll = NULL; // Handle to this DLL itself.
//---------------------------------------------------------------------------
// DllMain
//---------------------------------------------------------------------------
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
// Extension DLL one-time initialization
g_hmodThisDll = hInstance;
break;
case DLL_PROCESS_DETACH:
break;
}
return 1; // ok
}
static void
inc_cRefThisDLL()
{
#ifdef FEAT_GETTEXT
if (g_cRefThisDll == 0)
dyn_gettext_load();
#endif
InterlockedIncrement((LPLONG)&g_cRefThisDll);
}
static void
dec_cRefThisDLL()
{
#ifdef FEAT_GETTEXT
if (InterlockedDecrement((LPLONG)&g_cRefThisDll) == 0)
dyn_gettext_free();
#else
InterlockedDecrement((LPLONG)&g_cRefThisDll);
#endif
}
//---------------------------------------------------------------------------
// DllCanUnloadNow
//---------------------------------------------------------------------------
STDAPI DllCanUnloadNow(void)
{
return (g_cRefThisDll == 0 ? S_OK : S_FALSE);
}
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppvOut)
{
*ppvOut = NULL;
if (IsEqualIID(rclsid, CLSID_ShellExtension))
{
CShellExtClassFactory *pcf = new CShellExtClassFactory;
return pcf->QueryInterface(riid, ppvOut);
}
return CLASS_E_CLASSNOTAVAILABLE;
}
CShellExtClassFactory::CShellExtClassFactory()
{
m_cRef = 0L;
inc_cRefThisDLL();
}
CShellExtClassFactory::~CShellExtClassFactory()
{
dec_cRefThisDLL();
}
STDMETHODIMP CShellExtClassFactory::QueryInterface(REFIID riid,
LPVOID FAR *ppv)
{
*ppv = NULL;
// Any interface on this object is the object pointer
if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory))
{
*ppv = (LPCLASSFACTORY)this;
AddRef();
return NOERROR;
}
return E_NOINTERFACE;
}
STDMETHODIMP_(ULONG) CShellExtClassFactory::AddRef()
{
return InterlockedIncrement((LPLONG)&m_cRef);
}
STDMETHODIMP_(ULONG) CShellExtClassFactory::Release()
{
if (InterlockedDecrement((LPLONG)&m_cRef))
return m_cRef;
delete this;
return 0L;
}
STDMETHODIMP CShellExtClassFactory::CreateInstance(LPUNKNOWN pUnkOuter,
REFIID riid,
LPVOID *ppvObj)
{
*ppvObj = NULL;
// Shell extensions typically don't support aggregation (inheritance)
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
// Create the main shell extension object. The shell will then call
// QueryInterface with IID_IShellExtInit--this is how shell extensions are
// initialized.
LPCSHELLEXT pShellExt = new CShellExt(); //Create the CShellExt object
if (NULL == pShellExt)
return E_OUTOFMEMORY;
return pShellExt->QueryInterface(riid, ppvObj);
}
STDMETHODIMP CShellExtClassFactory::LockServer(BOOL fLock)
{
return NOERROR;
}
// *********************** CShellExt *************************
CShellExt::CShellExt()
{
m_cRef = 0L;
m_pDataObj = NULL;
inc_cRefThisDLL();
}
CShellExt::~CShellExt()
{
if (m_pDataObj)
m_pDataObj->Release();
dec_cRefThisDLL();
}
STDMETHODIMP CShellExt::QueryInterface(REFIID riid, LPVOID FAR *ppv)
{
*ppv = NULL;
if (IsEqualIID(riid, IID_IShellExtInit) || IsEqualIID(riid, IID_IUnknown))
{
*ppv = (LPSHELLEXTINIT)this;
}
else if (IsEqualIID(riid, IID_IContextMenu))
{
*ppv = (LPCONTEXTMENU)this;
}
if (*ppv)
{
AddRef();
return NOERROR;
}
return E_NOINTERFACE;
}
STDMETHODIMP_(ULONG) CShellExt::AddRef()
{
return InterlockedIncrement((LPLONG)&m_cRef);
}
STDMETHODIMP_(ULONG) CShellExt::Release()
{
if (InterlockedDecrement((LPLONG)&m_cRef))
return m_cRef;
delete this;
return 0L;
}
//
// FUNCTION: CShellExt::Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY)
//
// PURPOSE: Called by the shell when initializing a context menu or property
// sheet extension.
//
// PARAMETERS:
// pIDFolder - Specifies the parent folder
// pDataObj - Spefifies the set of items selected in that folder.
// hRegKey - Specifies the type of the focused item in the selection.
//
// RETURN VALUE:
//
// NOERROR in all cases.
//
// COMMENTS: Note that at the time this function is called, we don't know
// (or care) what type of shell extension is being initialized.
// It could be a context menu or a property sheet.
//
STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST pIDFolder,
LPDATAOBJECT pDataObj,
HKEY hRegKey)
{
// Initialize can be called more than once
if (m_pDataObj)
m_pDataObj->Release();
// duplicate the object pointer and registry handle
if (pDataObj)
{
m_pDataObj = pDataObj;
pDataObj->AddRef();
}
return NOERROR;
}
//
// FUNCTION: CShellExt::QueryContextMenu(HMENU, UINT, UINT, UINT, UINT)
//
// PURPOSE: Called by the shell just before the context menu is displayed.
// This is where you add your specific menu items.
//
// PARAMETERS:
// hMenu - Handle to the context menu
// indexMenu - Index of where to begin inserting menu items
// idCmdFirst - Lowest value for new menu ID's
// idCmtLast - Highest value for new menu ID's
// uFlags - Specifies the context of the menu event
//
// RETURN VALUE:
//
//
// COMMENTS:
//
STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu,
UINT indexMenu,
UINT idCmdFirst,
UINT idCmdLast,
UINT uFlags)
{
UINT idCmd = idCmdFirst;
hres = m_pDataObj->GetData(&fmte, &medium);
if (medium.hGlobal)
cbFiles = DragQueryFile((HDROP)medium.hGlobal, (UINT)-1, 0, 0);
// InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL);
// Initialize m_cntOfHWnd to 0
m_cntOfHWnd = 0;
// Retieve all the vim instances
EnumWindows(EnumWindowsProc, (LPARAM)this);
if (cbFiles > 1)
{
InsertMenu(hMenu,
indexMenu++,
MF_STRING|MF_BYPOSITION,
idCmd++,
_("Edit with &multiple Vims"));
InsertMenu(hMenu,
indexMenu++,
MF_STRING|MF_BYPOSITION,
idCmd++,
_("Edit with single &Vim"));
if (cbFiles <= 4)
{
// Can edit up to 4 files in diff mode
InsertMenu(hMenu,
indexMenu++,
MF_STRING|MF_BYPOSITION,
idCmd++,
_("&Diff with Vim"));
m_edit_existing_off = 3;
}
else
m_edit_existing_off = 2;
}
else
{
InsertMenu(hMenu,
indexMenu++,
MF_STRING|MF_BYPOSITION,
idCmd++,
_("Edit with &Vim"));
m_edit_existing_off = 1;
}
// Now display all the vim instances
for (int i = 0; i < m_cntOfHWnd; i++)
{
char title[MAX_PATH];
char temp[MAX_PATH];
// Obtain window title, continue if can not
if (GetWindowText(m_hWnd[i], title, MAX_PATH - 1) == 0)
continue;
// Truncate the title before the path, keep the file name
char *pos = strchr(title, '(');
if (pos != NULL)
{
if (pos > title && pos[-1] == ' ')
--pos;
*pos = 0;
}
// Now concatenate
strncpy(temp, _("Edit with existing Vim - &"), MAX_PATH - 1);
strncat(temp, title, MAX_PATH - 1);
InsertMenu(hMenu,
indexMenu++,
MF_STRING|MF_BYPOSITION,
idCmd++,
temp);
}
// InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL);
// Must return number of menu items we added.
return ResultFromShort(idCmd-idCmdFirst);
}
//
// FUNCTION: CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO)
//
// PURPOSE: Called by the shell after the user has selected on of the
// menu items that was added in QueryContextMenu().
//
// PARAMETERS:
// lpcmi - Pointer to an CMINVOKECOMMANDINFO structure
//
// RETURN VALUE:
//
//
// COMMENTS:
//
STDMETHODIMP CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
{
HRESULT hr = E_INVALIDARG;
// If HIWORD(lpcmi->lpVerb) then we have been called programmatically
// and lpVerb is a command that should be invoked. Otherwise, the shell
// has called us, and LOWORD(lpcmi->lpVerb) is the menu ID the user has
// selected. Actually, it's (menu ID - idCmdFirst) from QueryContextMenu().
if (!HIWORD(lpcmi->lpVerb))
{
UINT idCmd = LOWORD(lpcmi->lpVerb);
if (idCmd >= m_edit_existing_off)
{
// Existing with vim instance
hr = PushToWindow(lpcmi->hwnd,
lpcmi->lpDirectory,
lpcmi->lpVerb,
lpcmi->lpParameters,
lpcmi->nShow,
idCmd - m_edit_existing_off);
}
else
{
switch (idCmd)
{
case 0:
hr = InvokeGvim(lpcmi->hwnd,
lpcmi->lpDirectory,
lpcmi->lpVerb,
lpcmi->lpParameters,
lpcmi->nShow);
break;
case 1:
hr = InvokeSingleGvim(lpcmi->hwnd,
lpcmi->lpDirectory,
lpcmi->lpVerb,
lpcmi->lpParameters,
lpcmi->nShow,
0);
break;
case 2:
hr = InvokeSingleGvim(lpcmi->hwnd,
lpcmi->lpDirectory,
lpcmi->lpVerb,
lpcmi->lpParameters,
lpcmi->nShow,
1);
break;
}
}
}
return hr;
}
STDMETHODIMP CShellExt::PushToWindow(HWND hParent,
LPCSTR pszWorkingDir,
LPCSTR pszCmd,
LPCSTR pszParam,
int iShowCmd,
int idHWnd)
{
HWND hWnd = m_hWnd[idHWnd];
// Show and bring vim instance to foreground
if (IsIconic(hWnd) != 0)
ShowWindow(hWnd, SW_RESTORE);
else
ShowWindow(hWnd, SW_SHOW);
SetForegroundWindow(hWnd);
// Post the selected files to the vim instance
PostMessage(hWnd, WM_DROPFILES, (WPARAM)medium.hGlobal, 0);
return NOERROR;
}
STDMETHODIMP CShellExt::GetCommandString(UINT idCmd,
UINT uFlags,
UINT FAR *reserved,
LPSTR pszName,
UINT cchMax)
{
if (uFlags == GCS_HELPTEXT && cchMax > 35)
lstrcpy(pszName, _("Edits the selected file(s) with Vim"));
return NOERROR;
}
BOOL CALLBACK CShellExt::EnumWindowsProc(HWND hWnd, LPARAM lParam)
{
char temp[MAX_PATH];
// First do a bunch of check
// No invisible window
if (!IsWindowVisible(hWnd)) return TRUE;
// No child window ???
// if (GetParent(hWnd)) return TRUE;
// Class name should be Vim, if failed to get class name, return
if (GetClassName(hWnd, temp, sizeof(temp)) == 0)
return TRUE;
// Compare class name to that of vim, if not, return
if (_strnicmp(temp, "vim", sizeof("vim")) != 0)
return TRUE;
// First check if the number of vim instance exceeds MAX_HWND
CShellExt *cs = (CShellExt*) lParam;
if (cs->m_cntOfHWnd >= MAX_HWND) return TRUE;
// Now we get the vim window, put it into some kind of array
cs->m_hWnd[cs->m_cntOfHWnd] = hWnd;
cs->m_cntOfHWnd ++;
return TRUE; // continue enumeration (otherwise this would be false)
}
#ifdef WIN32
// This symbol is not defined in older versions of the SDK or Visual C++.
#ifndef VER_PLATFORM_WIN32_WINDOWS
# define VER_PLATFORM_WIN32_WINDOWS 1
#endif
static DWORD g_PlatformId;
//
// Set g_PlatformId to VER_PLATFORM_WIN32_NT (NT) or
// VER_PLATFORM_WIN32_WINDOWS (Win95).
//
static void
PlatformId(void)
{
static int done = FALSE;
if (!done)
{
OSVERSIONINFO ovi;
ovi.dwOSVersionInfoSize = sizeof(ovi);
GetVersionEx(&ovi);
g_PlatformId = ovi.dwPlatformId;
done = TRUE;
}
}
# ifndef __BORLANDC__
static char *
searchpath(char *name)
{
static char widename[2 * MAX_PATH];
static char location[2 * MAX_PATH + 2];
// There appears to be a bug in FindExecutableA() on Windows NT.
// Use FindExecutableW() instead...
PlatformId();
if (g_PlatformId == VER_PLATFORM_WIN32_NT)
{
MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)name, -1,
(LPWSTR)widename, MAX_PATH);
if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"",
(LPWSTR)location) > (HINSTANCE)32)
{
WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1,
(LPSTR)widename, 2 * MAX_PATH, NULL, NULL);
return widename;
}
}
else
{
if (FindExecutableA((LPCTSTR)name, (LPCTSTR)"",
(LPTSTR)location) > (HINSTANCE)32)
return location;
}
return "";
}
# endif
#endif
STDMETHODIMP CShellExt::InvokeGvim(HWND hParent,
LPCSTR pszWorkingDir,
LPCSTR pszCmd,
LPCSTR pszParam,
int iShowCmd)
{
char m_szFileUserClickedOn[MAX_PATH];
char cmdStr[MAX_PATH];
UINT i;
for (i = 0; i < cbFiles; i++)
{
DragQueryFile((HDROP)medium.hGlobal,
i,
m_szFileUserClickedOn,
sizeof(m_szFileUserClickedOn));
getGvimName(cmdStr, 0);
strcat(cmdStr, " \"");
if ((strlen(cmdStr) + strlen(m_szFileUserClickedOn) + 2) < MAX_PATH)
{
strcat(cmdStr, m_szFileUserClickedOn);
strcat(cmdStr, "\"");
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
// Start the child process.
if (!CreateProcess(NULL, // No module name (use command line).
cmdStr, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi) // Pointer to PROCESS_INFORMATION structure.
)
{
MessageBox(
hParent,
_("Error creating process: Check if gvim is in your path!"),
_("gvimext.dll error"),
MB_OK);
}
else
{
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
}
else
{
MessageBox(
hParent,
_("Path length too long!"),
_("gvimext.dll error"),
MB_OK);
}
}
return NOERROR;
}
STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent,
LPCSTR pszWorkingDir,
LPCSTR pszCmd,
LPCSTR pszParam,
int iShowCmd,
int useDiff)
{
char m_szFileUserClickedOn[MAX_PATH];
char *cmdStr;
size_t cmdlen;
size_t len;
UINT i;
cmdlen = MAX_PATH;
cmdStr = (char *)malloc(cmdlen);
getGvimName(cmdStr, 0);
if (useDiff)
strcat(cmdStr, " -d");
for (i = 0; i < cbFiles; i++)
{
DragQueryFile((HDROP)medium.hGlobal,
i,
m_szFileUserClickedOn,
sizeof(m_szFileUserClickedOn));
len = strlen(cmdStr) + strlen(m_szFileUserClickedOn) + 4;
if (len > cmdlen)
{
cmdlen = len + MAX_PATH;
cmdStr = (char *)realloc(cmdStr, cmdlen);
}
strcat(cmdStr, " \"");
strcat(cmdStr, m_szFileUserClickedOn);
strcat(cmdStr, "\"");
}
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
// Start the child process.
if (!CreateProcess(NULL, // No module name (use command line).
cmdStr, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi) // Pointer to PROCESS_INFORMATION structure.
)
{
MessageBox(
hParent,
_("Error creating process: Check if gvim is in your path!"),
_("gvimext.dll error"),
MB_OK);
}
else
{
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
free(cmdStr);
return NOERROR;
}

8
src/GvimExt/gvimext.def Normal file
View File

@ -0,0 +1,8 @@
;gvimdef.def : Declares the module parameters for the DLL.
LIBRARY gvimext
DESCRIPTION 'Vim Shell Extension'
EXPORTS
DllCanUnloadNow private
DllGetClassObject private

164
src/GvimExt/gvimext.h Normal file
View File

@ -0,0 +1,164 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved gvimext by Tianmiao Hu
*
* Do ":help uganda" in Vim to read copying and usage conditions.
* Do ":help credits" in Vim to see a list of people who contributed.
*/
/*
* If you have any questions or any suggestions concerning gvimext, please
* contact Tianmiao Hu: tianmiao@acm.org.
*/
#if !defined(AFX_STDAFX_H__3389658B_AD83_11D3_9C1E_0090278BBD99__INCLUDED_)
#define AFX_STDAFX_H__3389658B_AD83_11D3_9C1E_0090278BBD99__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Insert your headers here
// #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
//--------------------------------------------------------------
// common user interface routines
//
//
//--------------------------------------------------------------
#ifndef STRICT
#define STRICT
#endif
#define INC_OLE2 // WIN32, get ole2 from windows.h
#include <windows.h>
#include <windowsx.h>
#include <shlobj.h>
#define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)))
// Initialize GUIDs (should be done only and at-least once per DLL/EXE)
//
#pragma data_seg(".text")
#define INITGUID
#include <initguid.h>
#include <shlguid.h>
//
// The class ID of this Shell extension class.
//
// class id: {51EEE242-AD87-11d3-9C1E-0090278BBD99}
//
//
// NOTE!!! If you use this shell extension as a starting point,
// you MUST change the GUID below. Simply run UUIDGEN.EXE
// to generate a new GUID.
//
// {51EEE242-AD87-11d3-9C1E-0090278BBD99}
// static const GUID <<name>> =
// { 0x51eee242, 0xad87, 0x11d3, { 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99 } };
//
//
// {51EEE242-AD87-11d3-9C1E-0090278BBD99}
// IMPLEMENT_OLECREATE(<<class>>, <<external_name>>,
// 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99);
//
// {51EEE242-AD87-11d3-9C1E-0090278BBD99} -- this is the registry format
DEFINE_GUID(CLSID_ShellExtension, 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99);
// this class factory object creates context menu handlers for windows 32 shell
class CShellExtClassFactory : public IClassFactory
{
protected:
ULONG m_cRef;
public:
CShellExtClassFactory();
~CShellExtClassFactory();
//IUnknown members
STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
//IClassFactory members
STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR *);
STDMETHODIMP LockServer(BOOL);
};
typedef CShellExtClassFactory *LPCSHELLEXTCLASSFACTORY;
#define MAX_HWND 100
// this is the actual OLE Shell context menu handler
class CShellExt : public IContextMenu,
IShellExtInit
{
protected:
ULONG m_cRef;
LPDATAOBJECT m_pDataObj;
UINT m_edit_existing_off;
// For some reason, this callback must be static
static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
STDMETHODIMP PushToWindow(HWND hParent,
LPCSTR pszWorkingDir,
LPCSTR pszCmd,
LPCSTR pszParam,
int iShowCmd,
int idHWnd);
STDMETHODIMP InvokeGvim(HWND hParent,
LPCSTR pszWorkingDir,
LPCSTR pszCmd,
LPCSTR pszParam,
int iShowCmd);
STDMETHODIMP InvokeSingleGvim(HWND hParent,
LPCSTR pszWorkingDir,
LPCSTR pszCmd,
LPCSTR pszParam,
int iShowCmd,
int useDiff);
public:
int m_cntOfHWnd;
HWND m_hWnd[MAX_HWND];
CShellExt();
~CShellExt();
//IUnknown members
STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
//IShell members
STDMETHODIMP QueryContextMenu(HMENU hMenu,
UINT indexMenu,
UINT idCmdFirst,
UINT idCmdLast,
UINT uFlags);
STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi);
STDMETHODIMP GetCommandString(UINT idCmd,
UINT uFlags,
UINT FAR *reserved,
LPSTR pszName,
UINT cchMax);
//IShellExtInit methods
STDMETHODIMP Initialize(LPCITEMIDLIST pIDFolder,
LPDATAOBJECT pDataObj,
HKEY hKeyID);
};
typedef CShellExt *LPCSHELLEXT;
#pragma data_seg()
#endif

22
src/GvimExt/gvimext.inf Normal file
View File

@ -0,0 +1,22 @@
[Version]
Signature="$Windows NT$""
Provider="Tianmiao"
[Manufacture]
[DefaultInstall]
AddReg=ThisDll.Add.Reg
[DefaultUninstall]
DelReg=ThisDLL.Add.Reg
[ThisDll.Add.Reg]
HKCR,CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}
HKCR,CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32
HKCR,*\shellex\ContextMenuHandlers\gvim
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved",{51EEE242-AD87-11d3-9C1E-0090278BBD99}
HKLM,Software\Vim\Gvim
HKLM,"Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 6.0"
[Strings]
ThisDll="gvimext.dll"

111
src/GvimExt/gvimext.rc Normal file
View File

@ -0,0 +1,111 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef __BORLANDC__
# include "afxres.h"
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x3L
#else
FILEFLAGS 0x2L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Developed using COM architecture!\0"
VALUE "CompanyName", "Tianmiao Hu's Developer Studio\0"
VALUE "FileDescription", "A small project for the context menu of gvim!\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "gvim right-click menu extension\0"
VALUE "LegalCopyright", "Copyright © 1999 Tianmiao Hu\0"
VALUE "LegalTrademarks", "Tianmiao Hu's Gvim Context Menu Extension\0"
VALUE "OriginalFilename", "gvimext.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Tianmiao Hu's gvimext context menu extension\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,10 @@
;gvimdef_ming.def : Declares the module parameters for the DLL.
;The mingw environment doesn't know anything about private declarations
;Hence this is the same file as gvimext.def with private removed
LIBRARY gvimext
DESCRIPTION 'Vim Shell Extension build with MinGW'
EXPORTS
DllCanUnloadNow = DllCanUnloadNow@0
DllGetClassObject = DllGetClassObject@12

View File

@ -0,0 +1,45 @@
#include <windows.h>
#define xstr(x) str(x)
#define str(x) #x
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x3L
#else
FILEFLAGS 0x2L
#endif
FILEOS 0x4L
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
{
BLOCK "StringFileInfo"
{
BLOCK "040904b0"
{
VALUE "Comments", "Developed using COM architecture!\0"
VALUE "CompanyName", "Tianmiao Hu's Developer Studio\0"
VALUE "FileDescription", "A small project for the context menu of gvim!\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "gvim right-click menu extension\0"
VALUE "LegalCopyright", "Copyright © 1999 Tianmiao Hu\0"
VALUE "LegalTrademarks", "Tianmiao Hu's Gvim Context Menu Extension\0"
VALUE "OriginalFilename", "gvimext.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Tianmiao Hu's gvimext context menu extension\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
#if defined(__GNUC__)
VALUE "SpecialBuild", "Build With " "MingW " xstr(__GNUC__) "." xstr(__GNUC_MINOR__) "." xstr(__GNUC_PATCHLEVEL__) " on " __DATE__ " " __TIME__ "\0"
#else
VALUE "SpecialBuild", "Unknown compiler\0"
#endif
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x409, 1200
}
}

15
src/GvimExt/resource.h Normal file
View File

@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by gvimext.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

1
src/GvimExt/uninst.bat Normal file
View File

@ -0,0 +1 @@
rundll32.exe setupapi,InstallHinfSection DefaultUninstall 128 %1

View File

@ -4658,8 +4658,10 @@ stop_insert(end_insert_pos, esc)
* insertion (or moving the cursor), but it's required when appending
* a line and having it end in a space. But only do it when something
* was actually inserted, otherwise undo won't work. */
if (!ins_need_undo)
if (!ins_need_undo && has_format_option(FO_AUTO))
{
pos_T tpos = curwin->w_cursor;
/* When the cursor is at the end of the line after a space the
* formatting will move it to the following word. Avoid that by
* moving the cursor onto the space. */
@ -4669,27 +4671,45 @@ stop_insert(end_insert_pos, esc)
dec_cursor();
cc = gchar_cursor();
if (!vim_iswhite(cc))
inc_cursor();
curwin->w_cursor = tpos;
}
auto_format(TRUE, FALSE);
if (vim_iswhite(cc) && gchar_cursor() != NUL)
inc_cursor();
if (vim_iswhite(cc))
{
if (gchar_cursor() != NUL)
inc_cursor();
#ifdef FEAT_VIRTUALEDIT
/* If the cursor is still at the same character, also keep
* the "coladd". */
if (gchar_cursor() == NUL
&& curwin->w_cursor.lnum == tpos.lnum
&& curwin->w_cursor.col == tpos.col)
curwin->w_cursor.coladd = tpos.coladd;
#endif
}
}
/* If a space was inserted for auto-formatting, remove it now. */
check_auto_format(TRUE);
/* If we just did an auto-indent, remove the white space from the end
* of the line, and put the cursor back. */
if (did_ai && esc)
* of the line, and put the cursor back.
* Do this when ESC was used or moving the cursor up/down. */
if (did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL
&& curwin->w_cursor.lnum != end_insert_pos->lnum)))
{
pos_T tpos = curwin->w_cursor;
curwin->w_cursor = *end_insert_pos;
if (gchar_cursor() == NUL && curwin->w_cursor.col > 0)
--curwin->w_cursor.col;
while (cc = gchar_cursor(), vim_iswhite(cc))
(void)del_char(TRUE);
if (cc != NUL)
if (curwin->w_cursor.lnum != tpos.lnum)
curwin->w_cursor = tpos;
else if (cc != NUL)
++curwin->w_cursor.col; /* put cursor back on the NUL */
#ifdef FEAT_VISUAL

View File

@ -3784,6 +3784,8 @@ f_cursor(argvars, retvar)
if (has_mbyte)
mb_adjust_cursor();
#endif
curwin->w_set_curswant = TRUE;
}
/*

View File

@ -375,6 +375,7 @@ dbg_parsearg(arg)
char_u *p = arg;
char_u *q;
struct debuggy *bp;
int here = FALSE;
if (ga_grow(&dbg_breakp, 1) == FAIL)
return FAIL;
@ -385,6 +386,16 @@ dbg_parsearg(arg)
bp->dbg_type = DBG_FUNC;
else if (STRNCMP(p, "file", 4) == 0)
bp->dbg_type = DBG_FILE;
else if (STRNCMP(p, "here", 4) == 0)
{
if (curbuf->b_ffname == NULL)
{
EMSG(_(e_noname));
return FAIL;
}
bp->dbg_type = DBG_FILE;
here = TRUE;
}
else
{
EMSG2(_(e_invarg2), p);
@ -393,7 +404,9 @@ dbg_parsearg(arg)
p = skipwhite(p + 4);
/* Find optional line number. */
if (VIM_ISDIGIT(*p))
if (here)
bp->dbg_lnum = curwin->w_cursor.lnum;
else if (VIM_ISDIGIT(*p))
{
bp->dbg_lnum = getdigits(&p);
p = skipwhite(p);
@ -402,7 +415,8 @@ dbg_parsearg(arg)
bp->dbg_lnum = 0;
/* Find the function or file name. Don't accept a function name with (). */
if (*p == NUL
if ((!here && *p == NUL)
|| (here && *p != NUL)
|| (bp->dbg_type == DBG_FUNC && strstr((char *)p, "()") != NULL))
{
EMSG2(_(e_invarg2), arg);
@ -411,6 +425,8 @@ dbg_parsearg(arg)
if (bp->dbg_type == DBG_FUNC)
bp->dbg_name = vim_strsave(p);
else if (here)
bp->dbg_name = vim_strsave(curbuf->b_ffname);
else
{
/* Expand the file name in the same way as do_source(). This means

View File

@ -5181,6 +5181,10 @@ ex_window()
set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL);
}
/* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin
* sets 'textwidth' to 78). */
curbuf->b_p_tw = 0;
/* Fill the buffer with the history. */
init_history();
if (hislen > 0)

View File

@ -3965,8 +3965,10 @@ restore_backup:
* original and the backup file to be lost when halting the system right
* after writing the file. That's because only the meta-data is
* journalled. Syncing the file slows down the system, but assures it has
* been written to disk and we don't lose it. */
if (fsync(fd) != 0)
* been written to disk and we don't lose it.
* For a device do try the fsync() but don't complain if it does not work
* (could be a pipe). */
if (fsync(fd) != 0 && !device)
{
errmsg = (char_u *)_("E667: Fsync failed");
end = 0;

View File

@ -100,6 +100,7 @@ static int KeyNoremap = FALSE; /* remapping disabled */
#define RM_YES 0 /* tb_noremap: remap */
#define RM_NONE 1 /* tb_noremap: don't remap */
#define RM_SCRIPT 2 /* tb_noremap: remap local script mappings */
#define RM_ABBR 4 /* tb_noremap: don't remap, do abbrev. */
/* typebuf.tb_buf has three parts: room in front (for result of mappings), the
* middle for typeahead and room for new characters (which needs to be 3 *
@ -896,6 +897,8 @@ init_typebuf()
*
* If noremap is REMAP_YES, new string can be mapped again.
* If noremap is REMAP_NONE, new string cannot be mapped again.
* If noremap is REMAP_SKIP, fist char of new string cannot be mapped again,
* but abbreviations are allowed.
* If noremap is REMAP_SCRIPT, new string cannot be mapped again, except for
* script-local mappings.
* If noremap is > 0, that many characters of the new string cannot be mapped.
@ -993,6 +996,8 @@ ins_typebuf(str, noremap, offset, nottyped, silent)
/* If noremap == REMAP_SCRIPT: do remap script-local mappings. */
if (noremap == REMAP_SCRIPT)
val = RM_SCRIPT;
else if (noremap == REMAP_SKIP)
val = RM_ABBR;
else
val = RM_NONE;
@ -1004,7 +1009,9 @@ ins_typebuf(str, noremap, offset, nottyped, silent)
* If noremap > 0: "noremap" characters are not remappable, the rest
* mappable
*/
if (noremap < 0)
if (noremap == REMAP_SKIP)
nrm = 1;
else if (noremap < 0)
nrm = addlen;
else
nrm = noremap;
@ -1856,8 +1863,8 @@ vgetorpeek(advance)
&& (no_zero_mapping == 0 || c1 != '0')
&& (typebuf.tb_maplen == 0
|| (p_remap
&& typebuf.tb_noremap[typebuf.tb_off]
!= RM_NONE))
&& (typebuf.tb_noremap[typebuf.tb_off]
& (RM_NONE|RM_ABBR)) == 0))
&& !(p_paste && (State & (INSERT + CMDLINE)))
&& !(State == HITRETURN && (c1 == CAR || c1 == ' '))
&& State != ASKMORE
@ -1973,7 +1980,7 @@ vgetorpeek(advance)
* remapped, skip the entry.
*/
for (n = mlen; --n >= 0; )
if (*s++ == RM_NONE)
if (*s++ & (RM_NONE|RM_ABBR))
break;
if (n >= 0)
continue;
@ -2132,7 +2139,8 @@ vgetorpeek(advance)
+ typebuf.tb_off, 1);
}
KeyNoremap = (typebuf.tb_noremap[
typebuf.tb_off] != REMAP_YES);
typebuf.tb_off]
& (RM_NONE|RM_SCRIPT));
del_typebuf(1, 0);
}
break; /* got character, break for loop */
@ -2233,7 +2241,8 @@ vgetorpeek(advance)
/*
* Insert the 'to' part in the typebuf.tb_buf.
* If 'from' field is the same as the start of the
* 'to' field, don't remap the first character.
* 'to' field, don't remap the first character (but do
* allow abbreviations).
* If m_noremap is set, don't remap the whole 'to'
* part.
*/
@ -2241,8 +2250,8 @@ vgetorpeek(advance)
mp->m_noremap != REMAP_YES
? mp->m_noremap
: STRNCMP(mp->m_str, mp->m_keys,
(size_t)keylen)
? REMAP_YES : 1,
(size_t)keylen) != 0
? REMAP_YES : REMAP_SKIP,
0, TRUE, cmd_silent || mp->m_silent) == FAIL)
{
c = -1;

View File

@ -4014,7 +4014,8 @@ fullpathcmp(s1, s2, checkname)
}
/*
* get the tail of a path: the file name.
* Get the tail of a path: the file name.
* Fail safe: never returns NULL.
*/
char_u *
gettail(fname)

View File

@ -3115,7 +3115,7 @@ set_init_3()
* "-c" and "\"", but not for DJGPP, because it starts the shell without
* command.com. And for Win32 we need to set p_sxq instead.
*/
if (strstr((char *)p_sh, "sh") != NULL)
if (strstr((char *)gettail(p_sh), "sh") != NULL)
{
int idx3;

View File

@ -129,6 +129,7 @@
#define CPO_FNAMEW 'F' /* set file name for ":w file" */
#define CPO_GOTO1 'g' /* goto line 1 for ":edit" */
#define CPO_INTMOD 'i' /* interrupt a read makes buffer modified */
#define CPO_INDENT 'I' /* remove auto-indent more often */
#define CPO_JOINSP 'j' /* only use two spaces for join after '.' */
#define CPO_ENDOFSENT 'J' /* need two spaces to detect end of sentence */
#define CPO_KEYCODE 'k' /* don't recognize raw key code in mappings */
@ -158,7 +159,7 @@
#define CPO_STAR '*' /* ":*" means ":@" */
#define CPO_SPECI '<' /* don't recognize <> in mappings */
#define CPO_DEFAULT "aABceFs"
#define CPO_ALL "aAbBcCdDeEfFgijJkKlLmMnoOprRsStuvwWxy$!%*<"
#define CPO_ALL "aAbBcCdDeEfFgiIjJkKlLmMnoOprRsStuvwWxy$!%*<"
/* characters for p_ww option: */
#define WW_ALL "bshl<>[],~"

View File

@ -1521,7 +1521,7 @@ theend:
/*
* Return TRUE if "name" is in $PATH.
* TODO: Should also check if it's really executable.
* TODO: Should somehow check if it's really executable.
*/
static int
executable_exists(char *name)
@ -2556,7 +2556,43 @@ mch_writable(char_u *name)
int
mch_can_exe(char_u *name)
{
return executable_exists((char *)name);
char_u buf[_MAX_PATH];
int len = STRLEN(name);
char_u *p;
if (len >= _MAX_PATH) /* safety check */
return FALSE;
/* If there already is an extension try using the name directly. Also do
* this with a Unix-shell like 'shell'. */
if (vim_strchr(gettail(name), '.') != NULL
|| strstr((char *)gettail(p_sh), "sh") != NULL)
if (executable_exists((char *)name))
return TRUE;
/*
* Loop over all extensions in $PATHEXT.
*/
STRNCPY(buf, name, _MAX_PATH);
p = mch_getenv("PATHEXT");
if (p == NULL)
p = (char_u *)".com;.exe;.bat;.cmd";
while (*p)
{
if (p[0] == '.' && (p[1] == NUL || p[1] == ';'))
{
/* A single "." means no extension is added. */
buf[len] = NUL;
++p;
if (*p)
++p;
}
else
copy_option_part(&p, buf + len, _MAX_PATH - len, ";");
if (executable_exists((char *)buf))
return TRUE;
}
return FALSE;
}
#endif
@ -4659,14 +4695,14 @@ copy_infostreams(char_u *from, char_u *to)
{
streamname[len - 6] = 0;
copy_substream(sh, &context, tow, streamname,
(long)sid.Size.LowPart);
(long)sid.Size.u.LowPart);
}
}
/* Advance to the next stream. We might try seeking too far,
* but BackupSeek() doesn't skip over stream borders, thus
* that's OK. */
(void)BackupSeek(sh, sid.Size.LowPart, sid.Size.HighPart,
(void)BackupSeek(sh, sid.Size.LowPart, sid.Size.u.HighPart,
&lo, &hi, &context);
}

File diff suppressed because it is too large Load Diff

View File

@ -726,6 +726,7 @@ extern char* (*dyn_libintl_textdomain)(const char* domainname);
#define REMAP_YES 0 /* allow remapping */
#define REMAP_NONE -1 /* no remapping */
#define REMAP_SCRIPT -2 /* remap script-local mappings only */
#define REMAP_SKIP -3 /* no remapping for first char */
/* Values for mch_call_shell() second argument */
#define SHELL_FILTER 1 /* filtering text */