From 2e2ae65a467b651944c6e0413210a319af1d4609 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 08:20:39 +0200 Subject: [PATCH 001/311] updated for version 7.4.384 Problem: Test 102 fails when compiled with small features. Solution: Source small.vim. (Jacob Niehus) --- src/testdir/test102.in | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/testdir/test102.in b/src/testdir/test102.in index 35e9f6c2cf..33b401948f 100644 --- a/src/testdir/test102.in +++ b/src/testdir/test102.in @@ -1,6 +1,7 @@ Test if fnameescape is correct for special chars like ! STARTTEST +:so small.vim :%d :let fname = 'Xspa ce' :try | exe "w! " . fnameescape(fname) | put='Space' | endtry diff --git a/src/version.c b/src/version.c index 663bdfd12c..ab84a36040 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 384, /**/ 383, /**/ From b54358a8309b3c4a3a2b9c0a4d08ce91c65c8af0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 08:20:39 +0200 Subject: [PATCH 002/311] Added tag v7-4-384 for changeset 6f88e2dafbf6 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 3f26008c9e..a297e6e40e 100644 --- a/.hgtags +++ b/.hgtags @@ -3106,3 +3106,4 @@ c3bb76e5b2355c57d7f89997aa9e125e46afdea1 v7-4-376 0a3d958e346ee051667d3e541273b78fb1dfed9a v7-4-381 dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 2f02675bc4b051fff7be63f5107f659045a010e1 v7-4-383 +6f88e2dafbf637f573372bb7d8957fe4f2fd0843 v7-4-384 From 5412935f7375d94e85137fe7b424a231d7b8675b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 08:22:52 +0200 Subject: [PATCH 003/311] updated for version 7.4.385 Problem: When building with tiny or small features building the .mo files fails. Solution: In autoconf do not setup for building the .mo files when it would fail. --- src/auto/configure | 2 +- src/configure.in | 2 +- src/version.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/auto/configure b/src/auto/configure index 4ece95ea80..30db8a022f 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -12966,7 +12966,7 @@ rm -f core conftest.err conftest.$ac_objext \ { $as_echo "$as_me:${as_lineno-$LINENO}: result: msgfmt not found - disabled" >&5 $as_echo "msgfmt not found - disabled" >&6; }; fi - if test $have_gettext = "yes"; then + if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then $as_echo "#define HAVE_GETTEXT 1" >>confdefs.h MAKEMO=yes diff --git a/src/configure.in b/src/configure.in index fc6d405fe7..1cee1e61d1 100644 --- a/src/configure.in +++ b/src/configure.in @@ -3818,7 +3818,7 @@ if test "$enable_nls" = "yes"; then else AC_MSG_RESULT([msgfmt not found - disabled]); fi - if test $have_gettext = "yes"; then + if test $have_gettext = "yes" -a "x$features" != "xtiny" -a "x$features" != "xsmall"; then AC_DEFINE(HAVE_GETTEXT) MAKEMO=yes AC_SUBST(MAKEMO) diff --git a/src/version.c b/src/version.c index ab84a36040..87b1942df9 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 385, /**/ 384, /**/ From c700c42bfc4d9667fc5873ab8785a011a5f823ff Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 08:22:52 +0200 Subject: [PATCH 004/311] Added tag v7-4-385 for changeset 6e24b97dde69 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index a297e6e40e..bd728924ba 100644 --- a/.hgtags +++ b/.hgtags @@ -3107,3 +3107,4 @@ c3bb76e5b2355c57d7f89997aa9e125e46afdea1 v7-4-376 dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 2f02675bc4b051fff7be63f5107f659045a010e1 v7-4-383 6f88e2dafbf637f573372bb7d8957fe4f2fd0843 v7-4-384 +6e24b97dde6930a62ade6bee725babf4a39bb0a4 v7-4-385 From 52f9e3beb0cf10d2ee43dcfbf50e051a6f4f9f33 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 09:05:00 +0200 Subject: [PATCH 005/311] updated for version 7.4.386 Problem: When splitting a window the changelist position is wrong. Solution: Copy the changelist position. (Jacob Niehus) --- src/testdir/Make_amiga.mak | 2 ++ src/testdir/Make_dos.mak | 1 + src/testdir/Make_ming.mak | 1 + src/testdir/Make_os2.mak | 1 + src/testdir/Make_vms.mms | 3 ++- src/testdir/Makefile | 1 + src/testdir/test_changelist.in | 22 ++++++++++++++++++++++ src/testdir/test_changelist.ok | 1 + src/version.c | 2 ++ src/window.c | 5 +++++ 10 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/testdir/test_changelist.in create mode 100644 src/testdir/test_changelist.ok diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 46cd6a90de..b4d829da03 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -41,6 +41,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_qf_title.out \ + test_changelist.out \ test_eval.out \ test_options.out @@ -171,5 +172,6 @@ test_breakindent.out: test_breakindent.in test_listlbr.out: test_listlbr.in test_listlbr_utf8.out: test_listlbr_utf8.in test_qf_title.out: test_qf_title.in +test_changelist.out: test_changelist.in test_eval.out: test_eval.in test_options.out: test_options.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 86176ae481..bd727b8ebd 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -40,6 +40,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_qf_title.out \ + test_changelist.out \ test_eval.out \ test_options.out diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index cf10301b22..0664a95983 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -60,6 +60,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_qf_title.out \ + test_changelist.out \ test_eval.out \ test_options.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index a7f3989f8e..c66489c14a 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -38,6 +38,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test100.out test101.out test102.out test103.out test104.out \ test105.out test106.out test107.out \ test_autoformat_join.out \ + test_changelist.out \ test_eval.out \ test_breakindent.out \ test_listlbr.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 9bf395be37..1a45e35b79 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # -# Last change: 2014 Jul 23 +# Last change: 2014 Jul 30 # # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # Edit the lines in the Configuration section below to select. @@ -101,6 +101,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_qf_title.out \ + test_changelist.out \ test_eval.out \ test_options.out diff --git a/src/testdir/Makefile b/src/testdir/Makefile index b5f5d18030..4e4671d9bd 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -38,6 +38,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_qf_title.out \ + test_changelist.out \ test_eval.out \ test_options.out diff --git a/src/testdir/test_changelist.in b/src/testdir/test_changelist.in new file mode 100644 index 0000000000..6c7c4306c3 --- /dev/null +++ b/src/testdir/test_changelist.in @@ -0,0 +1,22 @@ +Test changelist position after splitting window +Set 'undolevels' to make changelist for sourced file + +STARTTEST +:so small.vim +Gkylp:set ul=100 +Gylp:set ul=100 +gg +:vsplit +:try +: normal g; +: normal ggVGcpass +:catch +: normal ggVGcfail +:finally +: %w! test.out +:endtry +:qa! +ENDTEST + +1 +2 diff --git a/src/testdir/test_changelist.ok b/src/testdir/test_changelist.ok new file mode 100644 index 0000000000..2ae28399f5 --- /dev/null +++ b/src/testdir/test_changelist.ok @@ -0,0 +1 @@ +pass diff --git a/src/version.c b/src/version.c index 87b1942df9..3967da2c11 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 386, /**/ 385, /**/ diff --git a/src/window.c b/src/window.c index 1cf861b476..5012427fae 100644 --- a/src/window.c +++ b/src/window.c @@ -1178,6 +1178,11 @@ win_split_ins(size, flags, new_wp, dir) p_wh = size; } +#ifdef FEAT_JUMPLIST + /* Keep same changelist position in new window. */ + wp->w_changelistidx = oldwin->w_changelistidx; +#endif + /* * make the new window the current window */ From 51efc1f9bbeafe5d5606f8e795a90cc75f5cd00f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 09:05:01 +0200 Subject: [PATCH 006/311] Added tag v7-4-386 for changeset 09af7cb358f0 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index bd728924ba..c06a5ca7b6 100644 --- a/.hgtags +++ b/.hgtags @@ -3108,3 +3108,4 @@ dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 2f02675bc4b051fff7be63f5107f659045a010e1 v7-4-383 6f88e2dafbf637f573372bb7d8957fe4f2fd0843 v7-4-384 6e24b97dde6930a62ade6bee725babf4a39bb0a4 v7-4-385 +09af7cb358f0bafd4b7437ff580f4cd7e15b74a1 v7-4-386 From 83651e512764308e5d5ca5fe18607e525c40637e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 11:00:58 +0200 Subject: [PATCH 007/311] updated for version 7.4.387 Problem: "4gro" replaces one character then executes "ooo". (Urtica Dioica) Solution: Write the ESC in the second stuff buffer. --- src/edit.c | 2 +- src/getchar.c | 11 +++++++++++ src/proto/getchar.pro | 1 + src/testdir/Make_amiga.mak | 2 ++ src/testdir/Make_dos.mak | 1 + src/testdir/Make_ming.mak | 1 + src/testdir/Make_os2.mak | 1 + src/testdir/Make_vms.mms | 1 + src/testdir/Makefile | 1 + src/testdir/test_insertcount.in | 14 ++++++++++++++ src/testdir/test_insertcount.ok | 3 +++ src/version.c | 2 ++ 12 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/testdir/test_insertcount.in create mode 100644 src/testdir/test_insertcount.ok diff --git a/src/edit.c b/src/edit.c index 6bc517e2fb..6f30d81f60 100644 --- a/src/edit.c +++ b/src/edit.c @@ -8389,7 +8389,7 @@ ins_esc(count, cmdchar, nomove) (void)start_redo_ins(); if (cmdchar == 'r' || cmdchar == 'v') - stuffReadbuff(ESC_STR); /* no ESC in redo buffer */ + stuffRedoReadbuff(ESC_STR); /* no ESC in redo buffer */ ++RedrawingDisabled; disabled_redraw = TRUE; return FALSE; /* repeat the insert */ diff --git a/src/getchar.c b/src/getchar.c index 9c1ab0f4bd..d646dc4c15 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -678,6 +678,17 @@ stuffReadbuff(s) add_buff(&readbuf1, s, -1L); } +/* + * Append string "s" to the redo stuff buffer. + * CSI and K_SPECIAL must already have been escaped. + */ + void +stuffRedoReadbuff(s) + char_u *s; +{ + add_buff(&readbuf2, s, -1L); +} + void stuffReadbuffLen(s, len) char_u *s; diff --git a/src/proto/getchar.pro b/src/proto/getchar.pro index 897cad37fc..e90b50527b 100644 --- a/src/proto/getchar.pro +++ b/src/proto/getchar.pro @@ -15,6 +15,7 @@ void AppendToRedobuffLit __ARGS((char_u *str, int len)); void AppendCharToRedobuff __ARGS((int c)); void AppendNumberToRedobuff __ARGS((long n)); void stuffReadbuff __ARGS((char_u *s)); +void stuffRedoReadbuff __ARGS((char_u *s)); void stuffReadbuffLen __ARGS((char_u *s, long len)); void stuffReadbuffSpec __ARGS((char_u *s)); void stuffcharReadbuff __ARGS((int c)); diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index b4d829da03..030542430c 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -43,6 +43,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_qf_title.out \ test_changelist.out \ test_eval.out \ + test_insertcount.out \ test_options.out .SUFFIXES: .in .out @@ -174,4 +175,5 @@ test_listlbr_utf8.out: test_listlbr_utf8.in test_qf_title.out: test_qf_title.in test_changelist.out: test_changelist.in test_eval.out: test_eval.in +test_insertcount.out: test_insertcount.in test_options.out: test_options.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index bd727b8ebd..232e8809d3 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -42,6 +42,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_qf_title.out \ test_changelist.out \ test_eval.out \ + test_insertcount.out \ test_options.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 0664a95983..eb533c9d0b 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -62,6 +62,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_qf_title.out \ test_changelist.out \ test_eval.out \ + test_insertcount.out \ test_options.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index c66489c14a..0bd0096061 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -40,6 +40,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_autoformat_join.out \ test_changelist.out \ test_eval.out \ + test_insertcount.out \ test_breakindent.out \ test_listlbr.out \ test_listlbr_utf8.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 1a45e35b79..7ccdf24e72 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -103,6 +103,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test_qf_title.out \ test_changelist.out \ test_eval.out \ + test_insertcount.out \ test_options.out # Known problems: diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 4e4671d9bd..f2b2216378 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -40,6 +40,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test_qf_title.out \ test_changelist.out \ test_eval.out \ + test_insertcount.out \ test_options.out SCRIPTS_GUI = test16.out diff --git a/src/testdir/test_insertcount.in b/src/testdir/test_insertcount.in new file mode 100644 index 0000000000..c7595b1ce9 --- /dev/null +++ b/src/testdir/test_insertcount.in @@ -0,0 +1,14 @@ +Tests for repeating insert and replace. + +STARTTEST +:so small.vim +:/Second +4gro +:/^First/,$wq! test.out +:" get here when failed and in Insert mode +:.wq! test.out +ENDTEST + +First line +Second line +Last line diff --git a/src/testdir/test_insertcount.ok b/src/testdir/test_insertcount.ok new file mode 100644 index 0000000000..57afab00ff --- /dev/null +++ b/src/testdir/test_insertcount.ok @@ -0,0 +1,3 @@ +First line +ooooecond line +Last line diff --git a/src/version.c b/src/version.c index 3967da2c11..33bcfbabd5 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 387, /**/ 386, /**/ From c5d910b1566e7ad284384f59344345654fe04fd7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 11:00:59 +0200 Subject: [PATCH 008/311] Added tag v7-4-387 for changeset 975d96776111 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index c06a5ca7b6..9a993b16ed 100644 --- a/.hgtags +++ b/.hgtags @@ -3109,3 +3109,4 @@ dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 6f88e2dafbf637f573372bb7d8957fe4f2fd0843 v7-4-384 6e24b97dde6930a62ade6bee725babf4a39bb0a4 v7-4-385 09af7cb358f0bafd4b7437ff580f4cd7e15b74a1 v7-4-386 +975d96776111914f69c8a0b98ef7db3bbb83cd10 v7-4-387 From 5c62021ab70a66e74e9a8f544fff35858bcb2a8c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 11:44:22 +0200 Subject: [PATCH 009/311] updated for version 7.4.388 Problem: With 'linebreak' set and 'list' unset a Tab is not counted properly. (Kent Sibilev) Solution: Check the 'list' option. (Christian Brabandt) --- src/screen.c | 2 +- src/testdir/test_listlbr_utf8.in | 11 +++++++++++ src/testdir/test_listlbr_utf8.ok | 7 +++++++ src/version.c | 2 ++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/screen.c b/src/screen.c index abbd9112d3..188b36f9c0 100644 --- a/src/screen.c +++ b/src/screen.c @@ -4494,7 +4494,7 @@ win_line(wp, lnum, startrow, endrow, nochange) tab_len = (int)wp->w_buffer->b_p_ts - vcol % (int)wp->w_buffer->b_p_ts - 1; #ifdef FEAT_LINEBREAK - if (!wp->w_p_lbr) + if (!wp->w_p_lbr || !wp->w_p_list) #endif /* tab amount depends on current column */ n_extra = tab_len; diff --git a/src/testdir/test_listlbr_utf8.in b/src/testdir/test_listlbr_utf8.in index f8888d5332..ba12adae05 100644 --- a/src/testdir/test_listlbr_utf8.in +++ b/src/testdir/test_listlbr_utf8.in @@ -30,11 +30,22 @@ STARTTEST :redraw! :let line=ScreenChar(winwidth(0)) :call DoRecordScreen() +:" :let g:test ="Test 2: set nolinebreak list" :set list nolinebreak :redraw! :let line=ScreenChar(winwidth(0)) :call DoRecordScreen() +:" +:let g:test ="Test 3: set linebreak nolist" +:$put =\"\t*mask = nil;\" +:$ +:norm! zt +:set nolist linebreak +:redraw! +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() +:" :%w! test.out :qa! ENDTEST diff --git a/src/testdir/test_listlbr_utf8.ok b/src/testdir/test_listlbr_utf8.ok index 576ccfb401..634cf3906d 100644 --- a/src/testdir/test_listlbr_utf8.ok +++ b/src/testdir/test_listlbr_utf8.ok @@ -12,3 +12,10 @@ Test 2: set nolinebreak list +pqrstuvwxyz␣1060ABC +DEFGHIJKLMNOPˑ¶ ¶ + *mask = nil; + +Test 3: set linebreak nolist + *mask = nil; +~ +~ +~ diff --git a/src/version.c b/src/version.c index 33bcfbabd5..d80a08aa65 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 388, /**/ 387, /**/ From 98037efaedd1955b9c78c2d0afced0648601bf5f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 11:44:22 +0200 Subject: [PATCH 010/311] Added tag v7-4-388 for changeset 76e7fb736c0e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 9a993b16ed..5819a6514b 100644 --- a/.hgtags +++ b/.hgtags @@ -3110,3 +3110,4 @@ dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 6e24b97dde6930a62ade6bee725babf4a39bb0a4 v7-4-385 09af7cb358f0bafd4b7437ff580f4cd7e15b74a1 v7-4-386 975d96776111914f69c8a0b98ef7db3bbb83cd10 v7-4-387 +76e7fb736c0e9d06b97ff95ee8baad1fb09d420b v7-4-388 From 481c60bb37c42e0b251e016e79febf26a6c753b3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 12:21:58 +0200 Subject: [PATCH 011/311] updated for version 7.4.389 Problem: Still sometimes Vim enters Replace mode when starting up. Solution: Use a different solution in detecting the termresponse and location response. (Hayaki Saito) --- src/globals.h | 3 - src/os_unix.c | 26 ++------ src/proto/term.pro | 2 - src/term.c | 146 +++++++++++++++++++-------------------------- src/version.c | 2 + 5 files changed, 66 insertions(+), 113 deletions(-) diff --git a/src/globals.h b/src/globals.h index b3310b3680..77528c7b58 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1336,9 +1336,6 @@ EXTERN HWND clientWindow INIT(= 0); #if defined(UNIX) || defined(VMS) EXTERN int term_is_xterm INIT(= FALSE); /* xterm-like 'term' */ #endif -#if defined(UNIX) -EXTERN int xterm_conflict_mouse INIT(= FALSE); -#endif #ifdef BACKSLASH_IN_FILENAME EXTERN char psepc INIT(= '\\'); /* normal path separator character */ diff --git a/src/os_unix.c b/src/os_unix.c index 033ce3cc3b..124c2693bc 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3667,8 +3667,6 @@ mch_setmouse(on) void check_mouse_termcode() { - xterm_conflict_mouse = FALSE; - # ifdef FEAT_MOUSE_XTERM if (use_xterm_mouse() # ifdef FEAT_MOUSE_URXVT @@ -3713,7 +3711,7 @@ check_mouse_termcode() # endif # ifdef FEAT_MOUSE_JSB - /* There is no conflict, but it was disabled for xterm before. */ + /* Conflicts with xterm mouse: "\033[" and "\033[M" ??? */ if (!use_xterm_mouse() # ifdef FEAT_GUI && !gui.in_use @@ -3740,45 +3738,31 @@ check_mouse_termcode() # endif # ifdef FEAT_MOUSE_DEC - /* Conflicts with xterm mouse: "\033[" and "\033[M". - * Also conflicts with the xterm termresponse, skip this if it was - * requested already. */ + /* Conflicts with xterm mouse: "\033[" and "\033[M" */ if (!use_xterm_mouse() -# ifdef FEAT_TERMRESPONSE - && !did_request_esc_sequence() -# endif # ifdef FEAT_GUI && !gui.in_use # endif ) - { set_mouse_termcode(KS_DEC_MOUSE, (char_u *)(term_is_8bit(T_NAME) ? IF_EB("\233", CSI_STR) : IF_EB("\033[", ESC_STR "["))); - xterm_conflict_mouse = TRUE; - } else del_mouse_termcode(KS_DEC_MOUSE); # endif # ifdef FEAT_MOUSE_PTERM - /* same as the dec mouse */ + /* same conflict as the dec mouse */ if (!use_xterm_mouse() -# ifdef FEAT_TERMRESPONSE - && !did_request_esc_sequence() -# endif # ifdef FEAT_GUI && !gui.in_use # endif ) - { set_mouse_termcode(KS_PTERM_MOUSE, (char_u *) IF_EB("\033[", ESC_STR "[")); - xterm_conflict_mouse = TRUE; - } else del_mouse_termcode(KS_PTERM_MOUSE); # endif # ifdef FEAT_MOUSE_URXVT - /* same as the dec mouse */ + /* same conflict as the dec mouse */ if (use_xterm_mouse() == 3 # ifdef FEAT_GUI && !gui.in_use @@ -3794,8 +3778,6 @@ check_mouse_termcode() mch_setmouse(FALSE); setmouse(); } - /* It's OK to request the xterm version for uxterm. */ - resume_get_esc_sequence(); } else del_mouse_termcode(KS_URXVT_MOUSE); diff --git a/src/proto/term.pro b/src/proto/term.pro index 89d58a0d0f..b3d0df39d8 100644 --- a/src/proto/term.pro +++ b/src/proto/term.pro @@ -34,8 +34,6 @@ void set_shellsize __ARGS((int width, int height, int mustset)); void settmode __ARGS((int tmode)); void starttermcap __ARGS((void)); void stoptermcap __ARGS((void)); -int did_request_esc_sequence __ARGS((void)); -void resume_get_esc_sequence __ARGS((void)); void may_req_termresponse __ARGS((void)); void may_req_ambiguous_char_width __ARGS((void)); int swapping_screen __ARGS((void)); diff --git a/src/term.c b/src/term.c index 95c29ccf48..a1ab537295 100644 --- a/src/term.c +++ b/src/term.c @@ -153,11 +153,6 @@ char *UP, *BC, PC; static char_u *vim_tgetstr __ARGS((char *s, char_u **pp)); #endif /* HAVE_TGETENT */ -#if defined(FEAT_TERMRESPONSE) -static int xt_index_in = 0; -static int xt_index_out = 0; -#endif - static int detected_8bit = FALSE; /* detected 8-bit terminal */ static struct builtin_term builtin_termcaps[] = @@ -3312,40 +3307,6 @@ stoptermcap() } #if defined(FEAT_TERMRESPONSE) || defined(PROTO) -# if defined(UNIX) || defined(PROTO) -/* - * Return TRUE when the xterm version was requested or anything else that - * would send an ESC sequence back to Vim. - * If not sent yet, prevent it from being sent soon. - * Used to check whether it is OK to enable checking for DEC mouse codes, - * which conflict with may xterm ESC sequences. - */ - int -did_request_esc_sequence() -{ - if (crv_status == CRV_GET) - crv_status = 0; - if (u7_status == U7_GET) - u7_status = 0; - return crv_status == CRV_SENT || u7_status == U7_SENT - || xt_index_out > xt_index_in; -} - -/* - * If requesting the version was disabled in did_request_esc_sequence(), - * enable it again. - */ - void -resume_get_esc_sequence() -{ - if (crv_status == 0) - crv_status = CRV_GET; - if (u7_status == 0) - u7_status = U7_GET; -} -# endif - - /* * Request version string (for xterm) when needed. * Only do this after switching to raw mode, otherwise the result will be @@ -3358,8 +3319,6 @@ resume_get_esc_sequence() * Insert mode. * On Unix only do it when both output and input are a tty (avoid writing * request to terminal while reading from a file). - * Do not do this when a mouse is being detected that starts with the same ESC - * sequence as the termresponse. * The result is caught in check_termcode(). */ void @@ -3373,7 +3332,6 @@ may_req_termresponse() # ifdef UNIX && isatty(1) && isatty(read_cmd_fd) - && !xterm_conflict_mouse # endif && *T_CRV != NUL) { @@ -3742,8 +3700,8 @@ add_termcode(name, string, flags) #if defined(WIN3264) && !defined(FEAT_GUI) if (s[0] == K_NUL) { - STRMOVE(s + 1, s); - s[1] = 3; + STRMOVE(s + 1, s); + s[1] = 3; } #endif @@ -4212,24 +4170,31 @@ check_termcode(max_offset, buf, bufsize, buflen) #ifdef FEAT_TERMRESPONSE if (key_name[0] == NUL - /* URXVT mouse uses [#;#;#M, but we are matching [ */ - || key_name[0] == KS_URXVT_MOUSE -# ifdef FEAT_MBYTE - || u7_status == U7_SENT + /* Mouse codes of DEC, pterm, and URXVT start with [. When + * detecting the start of these mouse codes they might as well be + * another key code or terminal response. */ +# ifdef FEAT_MOUSE_DEC + || key_name[0] == KS_DEC_MOUSE # endif - ) +# ifdef FEAT_MOUSE_PTERM + || key_name[0] == KS_PTERM_MOUSE +# endif +# ifdef FEAT_MOUSE_URXVT + || key_name[0] == KS_URXVT_MOUSE +# endif + ) { - /* Check for some responses from terminal start with "[" or - * CSI. + /* Check for some responses from the terminal starting with + * "[" or CSI: * - * - xterm version string: [>{x};{vers};{y}c + * - Xterm version string: [>{x};{vers};{y}c * Also eat other possible responses to t_RV, rxvt returns * "[?1;2c". Also accept CSI instead of [. * mrxvt has been reported to have "+" in the version. Assume * the escape sequence ends with a letter or one of "{|}~". * - * - cursor position report: [{row};{col}R - * The final byte is 'R'. now it is only used for checking for + * - Cursor position report: [{row};{col}R + * The final byte must be 'R'. It is used for checking the * ambiguous-width character state. */ p = tp[0] == CSI ? tp + 1 : tp + 2; @@ -4269,36 +4234,42 @@ check_termcode(max_offset, buf, bufsize, buflen) * u7_status is not "sent", it may be from a previous Vim that * just exited. But not for , it sends something * similar, check for row and column to make sense. */ - if (j == 1 && tp[i] == 'R' && row_char == '2' && col >= 2) + if (j == 1 && tp[i] == 'R') { - char *aw = NULL; - - LOG_TR("Received U7 status"); - u7_status = U7_GOT; -# ifdef FEAT_AUTOCMD - did_cursorhold = TRUE; -# endif - if (col == 2) - aw = "single"; - else if (col == 3) - aw = "double"; - if (aw != NULL && STRCMP(aw, p_ambw) != 0) + if (row_char == '2' && col >= 2) { - /* Setting the option causes a screen redraw. Do that - * right away if possible, keeping any messages. */ - set_option_value((char_u *)"ambw", 0L, (char_u *)aw, 0); -# ifdef DEBUG_TERMRESPONSE - { - char buf[100]; - int r = redraw_asap(CLEAR); + char *aw = NULL; - sprintf(buf, "set 'ambiwidth', redraw_asap(): %d", - r); - log_tr(buf); - } -# else - redraw_asap(CLEAR); + LOG_TR("Received U7 status"); + u7_status = U7_GOT; +# ifdef FEAT_AUTOCMD + did_cursorhold = TRUE; # endif + if (col == 2) + aw = "single"; + else if (col == 3) + aw = "double"; + if (aw != NULL && STRCMP(aw, p_ambw) != 0) + { + /* Setting the option causes a screen redraw. Do + * that right away if possible, keeping any + * messages. */ + set_option_value((char_u *)"ambw", 0L, + (char_u *)aw, 0); +# ifdef DEBUG_TERMRESPONSE + { + char buf[100]; + int r = redraw_asap(CLEAR); + + sprintf(buf, + "set 'ambiwidth', redraw_asap(): %d", + r); + log_tr(buf); + } +# else + redraw_asap(CLEAR); +# endif + } } key_name[0] = (int)KS_EXTRA; key_name[1] = (int)KE_IGNORE; @@ -4563,19 +4534,19 @@ check_termcode(max_offset, buf, bufsize, buflen) return -1; /* when mouse reporting is SGR, add 32 to mouse code */ - if (key_name[0] == KS_SGR_MOUSE) - mouse_code += 32; + if (key_name[0] == KS_SGR_MOUSE) + mouse_code += 32; mouse_col = getdigits(&p) - 1; if (*p++ != ';') return -1; mouse_row = getdigits(&p) - 1; - if (key_name[0] == KS_SGR_MOUSE && *p == 'm') + if (key_name[0] == KS_SGR_MOUSE && *p == 'm') mouse_code |= MOUSE_RELEASE; - else if (*p != 'M') + else if (*p != 'M') return -1; - p++; + p++; slen += (int)(p - (tp + slen)); @@ -4592,7 +4563,7 @@ check_termcode(max_offset, buf, bufsize, buflen) for (slen2 = slen; slen2 < len; slen2++) { if (tp[slen2] == 'M' - || (key_name[0] == KS_SGR_MOUSE + || (key_name[0] == KS_SGR_MOUSE && tp[slen2] == 'm')) { cmd_complete = 1; @@ -5769,6 +5740,9 @@ show_one_termcode(name, code, printit) * termcap codes from the terminal itself. * We get them one by one to avoid a very long response string. */ +static int xt_index_in = 0; +static int xt_index_out = 0; + static void req_codes_from_term() { diff --git a/src/version.c b/src/version.c index d80a08aa65..d5aaa90500 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 389, /**/ 388, /**/ From b7637380009022cfc6d3a14d72636bb5b9c37fed Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 30 Jul 2014 12:21:58 +0200 Subject: [PATCH 012/311] Added tag v7-4-389 for changeset 3d206df5c828 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 5819a6514b..59c2c12b7a 100644 --- a/.hgtags +++ b/.hgtags @@ -3111,3 +3111,4 @@ dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 09af7cb358f0bafd4b7437ff580f4cd7e15b74a1 v7-4-386 975d96776111914f69c8a0b98ef7db3bbb83cd10 v7-4-387 76e7fb736c0e9d06b97ff95ee8baad1fb09d420b v7-4-388 +3d206df5c8284f7d5f4a987ae9c7a508f289f008 v7-4-389 From 7288452106164ed54dbfa8d919377e186498f8ed Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 07:49:18 +0200 Subject: [PATCH 013/311] updated for version 7.4.390 Problem: Advancing pointer over end of a string. Solution: Init quote character to -1 instead of zero. (Dominique Pelle) --- src/misc1.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/misc1.c b/src/misc1.c index 3a834aa0cf..2c28aae84c 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -5503,7 +5503,7 @@ cin_has_js_key(text) char_u *text; { char_u *s = skipwhite(text); - int quote = 0; + int quote = -1; if (*s == '\'' || *s == '"') { diff --git a/src/version.c b/src/version.c index d5aaa90500..d2de43f7ac 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 390, /**/ 389, /**/ From 47df6f75b2480d37592095f2c9dd6ff56d37a717 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 07:49:18 +0200 Subject: [PATCH 014/311] Added tag v7-4-390 for changeset d3a674f6c737 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 59c2c12b7a..d76bdabe6f 100644 --- a/.hgtags +++ b/.hgtags @@ -3112,3 +3112,4 @@ dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 975d96776111914f69c8a0b98ef7db3bbb83cd10 v7-4-387 76e7fb736c0e9d06b97ff95ee8baad1fb09d420b v7-4-388 3d206df5c8284f7d5f4a987ae9c7a508f289f008 v7-4-389 +d3a674f6c7370f70d6b66dcefb9e36d22d73c7b7 v7-4-390 From 927d58bae680cd4871bd138e3c444999625cdb44 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 08:20:56 +0200 Subject: [PATCH 015/311] updated for version 7.4.391 Problem: No 'cursorline' highlighting when the cursor is on a line with diff highlighting. (Benjamin Fritz) Solution: Combine the highlight attributes. (Christian Brabandt) --- src/screen.c | 19 ++++++++++++++++--- src/version.c | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/screen.c b/src/screen.c index 188b36f9c0..3ab53d9e27 100644 --- a/src/screen.c +++ b/src/screen.c @@ -3702,7 +3702,12 @@ win_line(wp, lnum, startrow, endrow, nochange) char_attr = 0; /* was: hl_attr(HLF_AT); */ #ifdef FEAT_DIFF if (diff_hlf != (hlf_T)0) + { char_attr = hl_attr(diff_hlf); + if (wp->w_p_cul && lnum == wp->w_cursor.lnum) + char_attr = hl_combine_attr(char_attr, + hl_attr(HLF_CUL)); + } #endif p_extra = NULL; c_extra = ' '; @@ -3753,7 +3758,8 @@ win_line(wp, lnum, startrow, endrow, nochange) #ifdef FEAT_SYN_HL /* combine 'showbreak' with 'cursorline' */ if (wp->w_p_cul && lnum == wp->w_cursor.lnum) - char_attr = hl_combine_attr(char_attr, HLF_CLN); + char_attr = hl_combine_attr(char_attr, + hl_attr(HLF_CUL)); #endif } # endif @@ -3931,6 +3937,8 @@ win_line(wp, lnum, startrow, endrow, nochange) && n_extra == 0) diff_hlf = HLF_CHD; /* changed line */ line_attr = hl_attr(diff_hlf); + if (wp->w_p_cul && lnum == wp->w_cursor.lnum) + line_attr = hl_combine_attr(line_attr, hl_attr(HLF_CUL)); } #endif @@ -4729,7 +4737,12 @@ win_line(wp, lnum, startrow, endrow, nochange) { diff_hlf = HLF_CHD; if (attr == 0 || char_attr != attr) + { char_attr = hl_attr(diff_hlf); + if (wp->w_p_cul && lnum == wp->w_cursor.lnum) + char_attr = hl_combine_attr(char_attr, + hl_attr(HLF_CUL)); + } } # endif } @@ -10174,9 +10187,9 @@ draw_tabline() break; screen_puts_len(NameBuff, len, 0, col, #if defined(FEAT_SYN_HL) - hl_combine_attr(attr, hl_attr(HLF_T)) + hl_combine_attr(attr, hl_attr(HLF_T)) #else - attr + attr #endif ); col += len; diff --git a/src/version.c b/src/version.c index d2de43f7ac..fa2efdf4fd 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 391, /**/ 390, /**/ From 6f69c2d2aaed0bbd2f23856ff60b11821b012fc5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 08:20:56 +0200 Subject: [PATCH 016/311] Added tag v7-4-391 for changeset f051e50a6a5f --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index d76bdabe6f..574438f1e4 100644 --- a/.hgtags +++ b/.hgtags @@ -3113,3 +3113,4 @@ dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 76e7fb736c0e9d06b97ff95ee8baad1fb09d420b v7-4-388 3d206df5c8284f7d5f4a987ae9c7a508f289f008 v7-4-389 d3a674f6c7370f70d6b66dcefb9e36d22d73c7b7 v7-4-390 +f051e50a6a5feb0f0c6d209440d9d305b82f5836 v7-4-391 From 74dc1d13f3cd6ecc37d5a9080b47b956362112b5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 08:36:59 +0200 Subject: [PATCH 017/311] updated for version 7.4.392 Problem: Not easy to detect type of command line window. Solution: Add the getcmdwintype() function. (Jacob Niehus) --- src/eval.c | 22 ++++++++++++++++++++++ src/version.c | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/eval.c b/src/eval.c index aedbaa4ce0..4e512af648 100644 --- a/src/eval.c +++ b/src/eval.c @@ -554,6 +554,7 @@ static void f_getcharmod __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getcmdline __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getcmdpos __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getcmdtype __ARGS((typval_T *argvars, typval_T *rettv)); +static void f_getcmdwintype __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getcwd __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getfontname __ARGS((typval_T *argvars, typval_T *rettv)); static void f_getfperm __ARGS((typval_T *argvars, typval_T *rettv)); @@ -7984,6 +7985,7 @@ static struct fst {"getcmdline", 0, 0, f_getcmdline}, {"getcmdpos", 0, 0, f_getcmdpos}, {"getcmdtype", 0, 0, f_getcmdtype}, + {"getcmdwintype", 0, 0, f_getcmdwintype}, {"getcurpos", 0, 0, f_getcurpos}, {"getcwd", 0, 0, f_getcwd}, {"getfontname", 0, 1, f_getfontname}, @@ -11502,6 +11504,26 @@ f_getcmdtype(argvars, rettv) } } +/* + * "getcmdwintype()" function + */ + static void +f_getcmdwintype(argvars, rettv) + typval_T *argvars UNUSED; + typval_T *rettv; +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; +#ifdef FEAT_CMDWIN + rettv->vval.v_string = alloc(2); + if (rettv->vval.v_string != NULL) + { + rettv->vval.v_string[0] = cmdwin_type; + rettv->vval.v_string[1] = NUL; + } +#endif +} + /* * "getcwd()" function */ diff --git a/src/version.c b/src/version.c index fa2efdf4fd..6610ba110e 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 392, /**/ 391, /**/ From 138df08ba8df61e7b5b497502f492ee8c5ea8b1b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 08:36:59 +0200 Subject: [PATCH 018/311] Added tag v7-4-392 for changeset 589fd07888ab --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 574438f1e4..4326008a12 100644 --- a/.hgtags +++ b/.hgtags @@ -3114,3 +3114,4 @@ dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 3d206df5c8284f7d5f4a987ae9c7a508f289f008 v7-4-389 d3a674f6c7370f70d6b66dcefb9e36d22d73c7b7 v7-4-390 f051e50a6a5feb0f0c6d209440d9d305b82f5836 v7-4-391 +589fd07888abc8a1208616c56b21898d3352fc5b v7-4-392 From 049578126341544d0af7f5c1f624e6eacbb4c1ed Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 09:52:30 +0200 Subject: [PATCH 019/311] updated for version 7.4.393 Problem: Text drawing on newer MS-Windows systems is suboptimal. Some multi-byte characters are not displayed, even though the same font in Notepad can display them. (Srinath Avadhanula) Solution: Add the 'renderoptions' option to enable Direct-X drawing. (Taro Muraoka) --- runtime/doc/eval.txt | 1 + runtime/doc/options.txt | 71 ++++ runtime/doc/various.txt | 1 + src/Make_cyg.mak | 32 +- src/Make_ming.mak | 35 +- src/Make_mvc.mak | 21 + src/eval.c | 3 + src/gui_dwrite.cpp | 901 ++++++++++++++++++++++++++++++++++++++++ src/gui_dwrite.h | 85 ++++ src/gui_w32.c | 204 ++++++++- src/gui_w48.c | 21 + src/option.c | 17 + src/option.h | 3 + src/proto/gui_w32.pro | 2 + src/version.c | 9 + src/vim.h | 7 + 16 files changed, 1390 insertions(+), 23 deletions(-) create mode 100644 src/gui_dwrite.cpp create mode 100644 src/gui_dwrite.h diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index cbd995da3d..62aa167041 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -6622,6 +6622,7 @@ dialog_con Compiled with console dialog support. dialog_gui Compiled with GUI dialog support. diff Compiled with |vimdiff| and 'diff' support. digraphs Compiled with support for digraphs. +directx Compiled with support for Direct-X and 'renderoptions'. dnd Compiled with support for the "~ register |quote_~|. dos16 16 bits DOS version of Vim. dos32 32 bits DOS (DJGPP) version of Vim. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 90d4ca7a70..5f4a06e7ef 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5650,6 +5650,77 @@ A jump table for the options with a short description can be found at |Q_op|. this option at the default "on". Only switch it off when working with old Vi scripts. + *'renderoptions'* *'rop'* +'renderoptions' 'rop' string (default: empty) + global + {not in Vi} + {only available when compiled with GUI and DIRECTX on + MS-Windows} + Select a text renderer and set its options. The options depend on the + renderer. + + Syntax: > + set rop=type:{renderer}(,{name}:{value})* +< + Currently, only one optional renderer is available. + + render behavior ~ + directx Vim will draw text using DirectX (DirectWrite). It makes + drawn glyphs more beautiful than default GDI. + It requires 'encoding' is "utf-8", and only works on + MS-Windows Vista or newer version. + + Options: + name meaning type value ~ + gamma gamma float 1.0 - 2.2 (maybe) + contrast enhancedContrast float (unknown) + level clearTypeLevel float (unknown) + geom pixelGeometry int 0 - 2 (see below) + renmode renderingMode int 0 - 6 (see below) + taamode textAntialiasMode int 0 - 3 (see below) + + See this URL for detail: + http://msdn.microsoft.com/en-us/library/dd368190.aspx + + For geom: structure of a device pixel. + 0 - DWRITE_PIXEL_GEOMETRY_FLAT + 1 - DWRITE_PIXEL_GEOMETRY_RGB + 2 - DWRITE_PIXEL_GEOMETRY_BGR + + See this URL for detail: + http://msdn.microsoft.com/en-us/library/dd368114.aspx + + For renmode: method of rendering glyphs. + 0 - DWRITE_RENDERING_MODE_DEFAULT + 1 - DWRITE_RENDERING_MODE_ALIASED + 2 - DWRITE_RENDERING_MODE_GDI_CLASSIC + 3 - DWRITE_RENDERING_MODE_GDI_NATURAL + 4 - DWRITE_RENDERING_MODE_NATURAL + 5 - DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC + 6 - DWRITE_RENDERING_MODE_OUTLINE + + See this URL for detail: + http://msdn.microsoft.com/en-us/library/dd368118.aspx + + For taamode: antialiasing mode used for drawing text. + 0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT + 1 - D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE + 2 - D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE + 3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED + + See this URL for detail: + http://msdn.microsoft.com/en-us/library/dd368170.aspx + + Example: > + set encoding=utf-8 + set gfn=Ricty_Diminished:h12:cSHIFTJIS + set rop=type:directx +< + If select a raster font (Courier, Terminal or FixedSys) to + 'guifont', it fallbacks to be drawn by GDI automatically. + + Other render types are currently not supported. + *'report'* 'report' number (default 2) global diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index b264e5be8c..a03a0bd94a 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -337,6 +337,7 @@ N *+dialog_con* Support for |:confirm| with console dialog. N *+dialog_con_gui* Support for |:confirm| with GUI and console dialog. N *+diff* |vimdiff| and 'diff' N *+digraphs* |digraphs| *E196* +m *+directx* Win32 GUI only: DirectX and |'renderoptions'| *+dnd* Support for DnD into the "~ register |quote_~|. B *+emacs_tags* |emacs-tags| files N *+eval* expression evaluation |eval.txt| diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index f349798078..24f19c9f2a 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -8,6 +8,7 @@ # Cygwin application use the Makefile (just like on Unix). # # GUI no or yes: set to yes if you want the GUI version (yes) +# DIRECTX no or yes: set to yes if you want use DirectWrite (no) # PERL define to path to Perl dir to get Perl support (not defined) # PERL_VER define to version of Perl being used (56) # DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (yes) @@ -88,6 +89,10 @@ ifndef ARCH ARCH = i386 endif +ifndef DIRECTX +DIRECTX = no +endif + ifndef WINVER WINVER = 0x0500 endif @@ -469,6 +474,15 @@ endif endif +############################## +ifeq (yes, $(DIRECTX)) +# Only allow DIRECTX for a GUI build. +DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX +EXTRA_OBJS += $(OUTDIR)/gui_dwrite.o +EXTRA_LIBS += -ld2d1 -ldwrite +USE_STDCPLUS = yes +endif + ############################## ifdef XPM # Only allow XPM for a GUI build. @@ -495,11 +509,7 @@ ifeq (yes, $(OLE)) DEFINES += -DFEAT_OLE EXTRA_OBJS += $(OUTDIR)/if_ole.o EXTRA_LIBS += -loleaut32 -ifeq (yes, $(STATIC_STDCPLUS)) -EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -else -EXTRA_LIBS += -lstdc++ -endif +USE_STDCPLUS = yes endif ############################## @@ -513,6 +523,15 @@ MKDIR = mkdir DIRSLASH = \\ endif +############################## +ifeq (yes, $(USE_STDCPLUS)) +ifeq (yes, $(STATIC_STDCPLUS)) +EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic +else +EXTRA_LIBS += -lstdc++ +endif +endif + #>>>>> end of choices ########################################################################### @@ -643,6 +662,9 @@ $(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h $(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL) $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o +$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h + $(CC) -c $(CFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o + $(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o diff --git a/src/Make_ming.mak b/src/Make_ming.mak index f7088ad58e..de1d88fe4c 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -31,6 +31,8 @@ DEBUG=no OPTIMIZE=MAXSPEED # set to yes to make gvim, no for vim GUI=yes +# set to yes if you want to use DirectWrite (DirectX) +DIRECTX=no # FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE] # Set to TINY to make minimal version (few features). FEATURES=BIG @@ -456,6 +458,14 @@ endif endif endif +# DirectWrite (DirectX) +ifeq ($(DIRECTX),yes) +# Only allow DirectWrite for a GUI build. +ifeq (yes, $(GUI)) +DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX +endif +endif + # Only allow XPM for a GUI build. ifeq (yes, $(GUI)) @@ -593,6 +603,14 @@ OBJ += $(OUTDIR)/netbeans.o LIB += -lwsock32 endif endif +ifeq ($(DIRECTX),yes) +# Only allow DIRECTX for a GUI build. +ifeq (yes, $(GUI)) +OBJ += $(OUTDIR)/gui_dwrite.o +LIB += -ld2d1 -ldwrite +USE_STDCPLUS = yes +endif +endif ifdef XPM # Only allow XPM for a GUI build. ifeq (yes, $(GUI)) @@ -650,11 +668,7 @@ endif ifeq (yes, $(OLE)) LIB += -loleaut32 OBJ += $(OUTDIR)/if_ole.o -ifeq (yes, $(STATIC_STDCPLUS)) -LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -else -LIB += -lstdc++ -endif +USE_STDCPLUS = yes endif ifeq (yes, $(MBYTE)) @@ -678,6 +692,14 @@ endif DEFINES+=-DDYNAMIC_ICONV endif +ifeq (yes, $(USE_STDCPLUS)) +ifeq (yes, $(STATIC_STDCPLUS)) +LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic +else +LIB += -lstdc++ +endif +endif + all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll vimrun.exe: vimrun.c @@ -751,6 +773,9 @@ $(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h $(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL) $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o +$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h + $(CC) -c $(CFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o + $(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 4a979e419b..24069b24e9 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -24,6 +24,9 @@ # # GUI interface: GUI=yes (default is no) # +# GUI with DirectWrite(DirectX): DIRECTX=yes +# (default is no, requires GUI=yes) +# # OLE interface: OLE=yes (usually with GUI=yes) # # Multibyte support: MBYTE=yes (default is no) @@ -168,6 +171,9 @@ OBJDIR = .\ObjG !else OBJDIR = .\ObjC !endif +!if "$(DIRECTX)" == "yes" +OBJDIR = $(OBJDIR)X +!endif !if "$(OLE)" == "yes" OBJDIR = $(OBJDIR)O !endif @@ -292,6 +298,13 @@ NBDEBUG_SRC = nbdebug.c NETBEANS_LIB = WSock32.lib !endif +# DirectWrite(DirectX) +!if "$(DIRECTX)" == "yes" +DIRECTX_DEFS = -DFEAT_DIRECTX -DDYNAMIC_DIRECTX +DIRECTX_INCL = gui_dwrite.h +DIRECTX_OBJ = $(OUTDIR)\gui_dwrite.obj +!endif + !ifndef XPM # XPM is not set, use the included xpm files, depending on the architecture. !if "$(CPU)" == "AMD64" @@ -642,6 +655,12 @@ GUI_LIB = \ SUBSYSTEM = console !endif +!if "$(GUI)" == "yes" && "$(DIRECTX)" == "yes" +CFLAGS = $(CFLAGS) $(DIRECTX_DEFS) +GUI_INCL = $(GUI_INCL) $(DIRECTX_INCL) +GUI_OBJ = $(GUI_OBJ) $(DIRECTX_OBJ) +!endif + # iconv.dll library (dynamically loaded) !ifndef ICONV ICONV = yes @@ -1107,6 +1126,8 @@ $(OUTDIR)/gui_beval.obj: $(OUTDIR) gui_beval.c $(INCL) $(GUI_INCL) $(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c gui_w48.c $(INCL) $(GUI_INCL) +$(OUTDIR)/gui_dwrite.obj: $(OUTDIR) gui_dwrite.cpp $(INCL) $(GUI_INCL) + $(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL) $(OUTDIR)/if_lua.obj: $(OUTDIR) if_lua.c $(INCL) diff --git a/src/eval.c b/src/eval.c index 4e512af648..ae8331d5aa 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12464,6 +12464,9 @@ f_has(argvars, rettv) #ifdef FEAT_DIGRAPHS "digraphs", #endif +#ifdef FEAT_DIRECTX + "directx", +#endif #ifdef FEAT_DND "dnd", #endif diff --git a/src/gui_dwrite.cpp b/src/gui_dwrite.cpp new file mode 100644 index 0000000000..cf83c05044 --- /dev/null +++ b/src/gui_dwrite.cpp @@ -0,0 +1,901 @@ +/* vi:set ts=8 sts=4 sw=4 noet: */ +/* + * Author: MURAOKA Taro + * + * Contributors: + * - Ken Takata + * + * Copyright (C) 2013 MURAOKA Taro + * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. + */ + +#define WIN32_LEAN_AND_MEAN + +#ifndef DYNAMIC_DIRECTX +# if WINVER < 0x0600 +# error WINVER must be 0x0600 or above to use DirectWrite(DirectX) +# endif +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "gui_dwrite.h" + +#ifdef __MINGW32__ +# define __maybenull SAL__maybenull +# define __in SAL__in +# define __out SAL__out +#endif + +#ifdef DYNAMIC_DIRECTX +extern "C" HINSTANCE vimLoadLib(char *name); + +typedef int (WINAPI *PGETUSERDEFAULTLOCALENAME)(LPWSTR, int); +typedef HRESULT (WINAPI *PD2D1CREATEFACTORY)(D2D1_FACTORY_TYPE, + REFIID, const D2D1_FACTORY_OPTIONS *, void **); +typedef HRESULT (WINAPI *PDWRITECREATEFACTORY)(DWRITE_FACTORY_TYPE, + REFIID, IUnknown **); + +static HINSTANCE hD2D1DLL = NULL; +static HINSTANCE hDWriteDLL = NULL; + +static PGETUSERDEFAULTLOCALENAME pGetUserDefaultLocaleName = NULL; +static PD2D1CREATEFACTORY pD2D1CreateFactory = NULL; +static PDWRITECREATEFACTORY pDWriteCreateFactory = NULL; + +#define GetUserDefaultLocaleName (*pGetUserDefaultLocaleName) +#define D2D1CreateFactory (*pD2D1CreateFactory) +#define DWriteCreateFactory (*pDWriteCreateFactory) + + static void +unload(HINSTANCE &hinst) +{ + if (hinst != NULL) + { + FreeLibrary(hinst); + hinst = NULL; + } +} +#endif // DYNAMIC_DIRECTX + +template inline void SafeRelease(T **ppT) +{ + if (*ppT) + { + (*ppT)->Release(); + *ppT = NULL; + } +} + +struct GdiTextRendererContext +{ + // const fields. + COLORREF color; + FLOAT cellWidth; + + // working fields. + FLOAT offsetX; +}; + + static DWRITE_PIXEL_GEOMETRY +ToPixelGeometry(int value) +{ + switch (value) + { + default: + case 0: + return DWRITE_PIXEL_GEOMETRY_FLAT; + case 1: + return DWRITE_PIXEL_GEOMETRY_RGB; + case 2: + return DWRITE_PIXEL_GEOMETRY_BGR; + } +} + + static int +ToInt(DWRITE_PIXEL_GEOMETRY value) +{ + switch (value) + { + case DWRITE_PIXEL_GEOMETRY_FLAT: + return 0; + case DWRITE_PIXEL_GEOMETRY_RGB: + return 1; + case DWRITE_PIXEL_GEOMETRY_BGR: + return 2; + default: + return -1; + } +} + + static DWRITE_RENDERING_MODE +ToRenderingMode(int value) +{ + switch (value) + { + default: + case 0: + return DWRITE_RENDERING_MODE_DEFAULT; + case 1: + return DWRITE_RENDERING_MODE_ALIASED; + case 2: + return DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC; + case 3: + return DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL; + case 4: + return DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL; + case 5: + return DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC; + case 6: + return DWRITE_RENDERING_MODE_OUTLINE; + } +} + + static D2D1_TEXT_ANTIALIAS_MODE +ToTextAntialiasMode(int value) +{ + switch (value) + { + default: + case 0: + return D2D1_TEXT_ANTIALIAS_MODE_DEFAULT; + case 1: + return D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE; + case 2: + return D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE; + case 3: + return D2D1_TEXT_ANTIALIAS_MODE_ALIASED; + } +} + + static int +ToInt(DWRITE_RENDERING_MODE value) +{ + switch (value) + { + case DWRITE_RENDERING_MODE_DEFAULT: + return 0; + case DWRITE_RENDERING_MODE_ALIASED: + return 1; + case DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC: + return 2; + case DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL: + return 3; + case DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL: + return 4; + case DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC: + return 5; + case DWRITE_RENDERING_MODE_OUTLINE: + return 6; + default: + return -1; + } +} + +class AdjustedGlyphRun : public DWRITE_GLYPH_RUN +{ +private: + FLOAT mDelta; + FLOAT *mAdjustedAdvances; + +public: + AdjustedGlyphRun( + const DWRITE_GLYPH_RUN *glyphRun, + FLOAT cellWidth) : + DWRITE_GLYPH_RUN(*glyphRun), + mDelta(0.0f), + mAdjustedAdvances(new FLOAT[glyphRun->glyphCount]) + { + assert(cellWidth != 0.0f); + for (UINT32 i = 0; i < glyphRun->glyphCount; ++i) + { + FLOAT orig = glyphRun->glyphAdvances[i]; + FLOAT adjusted = adjustToCell(orig, cellWidth); + mAdjustedAdvances[i] = adjusted; + mDelta += adjusted - orig; + } + glyphAdvances = mAdjustedAdvances; + } + + ~AdjustedGlyphRun(void) + { + delete[] mAdjustedAdvances; + } + + FLOAT getDelta(void) const + { + return mDelta; + } + + static FLOAT adjustToCell(FLOAT value, FLOAT cellWidth) + { + int cellCount = (int)floor(value / cellWidth + 0.5f); + if (cellCount < 1) + cellCount = 1; + return cellCount * cellWidth; + } +}; + +class GdiTextRenderer : public IDWriteTextRenderer +{ +public: + GdiTextRenderer( + IDWriteBitmapRenderTarget* bitmapRenderTarget, + IDWriteRenderingParams* renderingParams) : + cRefCount_(0), + pRenderTarget_(bitmapRenderTarget), + pRenderingParams_(renderingParams) + { + pRenderTarget_->AddRef(); + pRenderingParams_->AddRef(); + AddRef(); + } + + ~GdiTextRenderer() + { + SafeRelease(&pRenderTarget_); + SafeRelease(&pRenderingParams_); + } + + IFACEMETHOD(IsPixelSnappingDisabled)( + __maybenull void* clientDrawingContext, + __out BOOL* isDisabled) + { + *isDisabled = FALSE; + return S_OK; + } + + IFACEMETHOD(GetCurrentTransform)( + __maybenull void* clientDrawingContext, + __out DWRITE_MATRIX* transform) + { + //forward the render target's transform + pRenderTarget_->GetCurrentTransform(transform); + return S_OK; + } + + IFACEMETHOD(GetPixelsPerDip)( + __maybenull void* clientDrawingContext, + __out FLOAT* pixelsPerDip) + { + *pixelsPerDip = pRenderTarget_->GetPixelsPerDip(); + return S_OK; + } + + IFACEMETHOD(DrawGlyphRun)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + DWRITE_MEASURING_MODE measuringMode, + __in DWRITE_GLYPH_RUN const* glyphRun, + __in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription, + IUnknown* clientDrawingEffect) + { + HRESULT hr = S_OK; + + GdiTextRendererContext *context = + reinterpret_cast(clientDrawingContext); + + AdjustedGlyphRun adjustedGlyphRun(glyphRun, context->cellWidth); + + // Pass on the drawing call to the render target to do the real work. + RECT dirtyRect = {0}; + + hr = pRenderTarget_->DrawGlyphRun( + baselineOriginX + context->offsetX, + baselineOriginY, + measuringMode, + &adjustedGlyphRun, + pRenderingParams_, + context->color, + &dirtyRect); + + context->offsetX += adjustedGlyphRun.getDelta(); + + return hr; + } + + IFACEMETHOD(DrawUnderline)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + __in DWRITE_UNDERLINE const* underline, + IUnknown* clientDrawingEffect) + { + return E_NOTIMPL; + } + + IFACEMETHOD(DrawStrikethrough)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + __in DWRITE_STRIKETHROUGH const* strikethrough, + IUnknown* clientDrawingEffect) + { + return E_NOTIMPL; + } + + IFACEMETHOD(DrawInlineObject)( + __maybenull void* clientDrawingContext, + FLOAT originX, + FLOAT originY, + IDWriteInlineObject* inlineObject, + BOOL isSideways, + BOOL isRightToLeft, + IUnknown* clientDrawingEffect) + { + return E_NOTIMPL; + } + +public: + IFACEMETHOD_(unsigned long, AddRef) () + { + return InterlockedIncrement(&cRefCount_); + } + + IFACEMETHOD_(unsigned long, Release) () + { + long newCount = InterlockedDecrement(&cRefCount_); + + if (newCount == 0) + { + delete this; + return 0; + } + return newCount; + } + + IFACEMETHOD(QueryInterface)( + IID const& riid, + void** ppvObject) + { + if (__uuidof(IDWriteTextRenderer) == riid) + { + *ppvObject = this; + } + else if (__uuidof(IDWritePixelSnapping) == riid) + { + *ppvObject = this; + } + else if (__uuidof(IUnknown) == riid) + { + *ppvObject = this; + } + else + { + *ppvObject = NULL; + return E_FAIL; + } + + return S_OK; + } + +private: + unsigned long cRefCount_; + IDWriteBitmapRenderTarget* pRenderTarget_; + IDWriteRenderingParams* pRenderingParams_; +}; + +struct DWriteContext { + FLOAT mDpiScaleX; + FLOAT mDpiScaleY; + bool mDrawing; + + ID2D1Factory *mD2D1Factory; + + ID2D1DCRenderTarget *mRT; + ID2D1SolidColorBrush *mBrush; + + IDWriteFactory *mDWriteFactory; + IDWriteGdiInterop *mGdiInterop; + IDWriteRenderingParams *mRenderingParams; + IDWriteTextFormat *mTextFormat; + + HFONT mLastHFont; + DWRITE_FONT_WEIGHT mFontWeight; + DWRITE_FONT_STYLE mFontStyle; + + D2D1_TEXT_ANTIALIAS_MODE mTextAntialiasMode; + + // METHODS + + DWriteContext(); + + virtual ~DWriteContext(); + + HRESULT SetLOGFONT(const LOGFONTW &logFont, float fontSize); + + void SetFont(HFONT hFont); + + void SetFont(const LOGFONTW &logFont); + + void DrawText(HDC hdc, const WCHAR* text, int len, + int x, int y, int w, int h, int cellWidth, COLORREF color); + + float PixelsToDipsX(int x); + + float PixelsToDipsY(int y); + + void SetRenderingParams( + const DWriteRenderingParams *params); + + DWriteRenderingParams *GetRenderingParams( + DWriteRenderingParams *params); +}; + +DWriteContext::DWriteContext() : + mDpiScaleX(1.f), + mDpiScaleY(1.f), + mDrawing(false), + mD2D1Factory(NULL), + mRT(NULL), + mBrush(NULL), + mDWriteFactory(NULL), + mGdiInterop(NULL), + mRenderingParams(NULL), + mTextFormat(NULL), + mLastHFont(NULL), + mFontWeight(DWRITE_FONT_WEIGHT_NORMAL), + mFontStyle(DWRITE_FONT_STYLE_NORMAL), + mTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_DEFAULT) +{ + HRESULT hr; + + HDC screen = ::GetDC(0); + mDpiScaleX = ::GetDeviceCaps(screen, LOGPIXELSX) / 96.0f; + mDpiScaleY = ::GetDeviceCaps(screen, LOGPIXELSY) / 96.0f; + ::ReleaseDC(0, screen); + + hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, + __uuidof(ID2D1Factory), NULL, + reinterpret_cast(&mD2D1Factory)); + _RPT2(_CRT_WARN, "D2D1CreateFactory: hr=%p p=%p\n", hr, mD2D1Factory); + + if (SUCCEEDED(hr)) + { + D2D1_RENDER_TARGET_PROPERTIES props = { + D2D1_RENDER_TARGET_TYPE_DEFAULT, + { DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_IGNORE }, + 0, 0, + D2D1_RENDER_TARGET_USAGE_NONE, + D2D1_FEATURE_LEVEL_DEFAULT + }; + hr = mD2D1Factory->CreateDCRenderTarget(&props, &mRT); + _RPT2(_CRT_WARN, "CreateDCRenderTarget: hr=%p p=%p\n", hr, mRT); + } + + if (SUCCEEDED(hr)) + { + hr = mRT->CreateSolidColorBrush( + D2D1::ColorF(D2D1::ColorF::Black), + &mBrush); + _RPT2(_CRT_WARN, "CreateSolidColorBrush: hr=%p p=%p\n", hr, mBrush); + } + + if (SUCCEEDED(hr)) + { + hr = DWriteCreateFactory( + DWRITE_FACTORY_TYPE_SHARED, + __uuidof(IDWriteFactory), + reinterpret_cast(&mDWriteFactory)); + _RPT2(_CRT_WARN, "DWriteCreateFactory: hr=%p p=%p\n", hr, + mDWriteFactory); + } + + if (SUCCEEDED(hr)) + { + hr = mDWriteFactory->GetGdiInterop(&mGdiInterop); + _RPT2(_CRT_WARN, "GetGdiInterop: hr=%p p=%p\n", hr, mGdiInterop); + } + + if (SUCCEEDED(hr)) + { + hr = mDWriteFactory->CreateRenderingParams(&mRenderingParams); + _RPT2(_CRT_WARN, "CreateRenderingParams: hr=%p p=%p\n", hr, + mRenderingParams); + } +} + +DWriteContext::~DWriteContext() +{ + SafeRelease(&mTextFormat); + SafeRelease(&mRenderingParams); + SafeRelease(&mGdiInterop); + SafeRelease(&mDWriteFactory); + SafeRelease(&mBrush); + SafeRelease(&mRT); + SafeRelease(&mD2D1Factory); +} + + HRESULT +DWriteContext::SetLOGFONT(const LOGFONTW &logFont, float fontSize) +{ + // Most of this function is copy from: http://msdn.microsoft.com/en-us/library/windows/desktop/dd941783(v=vs.85).aspx + HRESULT hr = S_OK; + + IDWriteFont *font = NULL; + IDWriteFontFamily *fontFamily = NULL; + IDWriteLocalizedStrings *localizedFamilyNames = NULL; + + if (SUCCEEDED(hr)) + { + hr = mGdiInterop->CreateFontFromLOGFONT(&logFont, &font); + } + + // Get the font family to which this font belongs. + if (SUCCEEDED(hr)) + { + hr = font->GetFontFamily(&fontFamily); + } + + // Get the family names. This returns an object that encapsulates one or + // more names with the same meaning but in different languages. + if (SUCCEEDED(hr)) + { + hr = fontFamily->GetFamilyNames(&localizedFamilyNames); + } + + // Get the family name at index zero. If we were going to display the name + // we'd want to try to find one that matched the use locale, but for + // purposes of creating a text format object any language will do. + + wchar_t familyName[100]; + if (SUCCEEDED(hr)) + { + hr = localizedFamilyNames->GetString(0, familyName, + ARRAYSIZE(familyName)); + } + + if (SUCCEEDED(hr)) + { + // If no font size was passed in use the lfHeight of the LOGFONT. + if (fontSize == 0) + { + // Convert from pixels to DIPs. + fontSize = PixelsToDipsY(logFont.lfHeight); + if (fontSize < 0) + { + // Negative lfHeight represents the size of the em unit. + fontSize = -fontSize; + } + else + { + // Positive lfHeight represents the cell height (ascent + + // descent). + DWRITE_FONT_METRICS fontMetrics; + font->GetMetrics(&fontMetrics); + + // Convert the cell height (ascent + descent) from design units + // to ems. + float cellHeight = static_cast( + fontMetrics.ascent + fontMetrics.descent) + / fontMetrics.designUnitsPerEm; + + // Divide the font size by the cell height to get the font em + // size. + fontSize /= cellHeight; + } + } + } + + // The text format includes a locale name. Ideally, this would be the + // language of the text, which may or may not be the same as the primary + // language of the user. However, for our purposes the user locale will do. + wchar_t localeName[LOCALE_NAME_MAX_LENGTH]; + if (SUCCEEDED(hr)) + { + if (GetUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH) == 0) + hr = HRESULT_FROM_WIN32(GetLastError()); + } + + if (SUCCEEDED(hr)) + { + // Create the text format object. + hr = mDWriteFactory->CreateTextFormat( + familyName, + NULL, // no custom font collection + font->GetWeight(), + font->GetStyle(), + font->GetStretch(), + fontSize, + localeName, + &mTextFormat); + } + + if (SUCCEEDED(hr)) + { + mFontWeight = static_cast(logFont.lfWeight); + mFontStyle = logFont.lfItalic ? DWRITE_FONT_STYLE_ITALIC + : DWRITE_FONT_STYLE_NORMAL; + } + + SafeRelease(&localizedFamilyNames); + SafeRelease(&fontFamily); + SafeRelease(&font); + + return hr; +} + + void +DWriteContext::SetFont(HFONT hFont) +{ + if (mLastHFont != hFont) + { + LOGFONTW lf; + if (GetObjectW(hFont, sizeof(lf), &lf)) + { + SetFont(lf); + mLastHFont = hFont; + } + } +} + + void +DWriteContext::SetFont(const LOGFONTW &logFont) +{ + SafeRelease(&mTextFormat); + mLastHFont = NULL; + + HRESULT hr = SetLOGFONT(logFont, 0.f); + + if (SUCCEEDED(hr)) + hr = mTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING); + + if (SUCCEEDED(hr)) + hr = mTextFormat->SetParagraphAlignment( + DWRITE_PARAGRAPH_ALIGNMENT_CENTER); + + if (SUCCEEDED(hr)) + hr = mTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); +} + + void +DWriteContext::DrawText(HDC hdc, const WCHAR* text, int len, + int x, int y, int w, int h, int cellWidth, COLORREF color) +{ + HRESULT hr = S_OK; + IDWriteBitmapRenderTarget *bmpRT = NULL; + + // Skip when any fonts are not set. + if (mTextFormat == NULL) + return; + + // Check possibility of zero divided error. + if (cellWidth == 0 || mDpiScaleX == 0.0f || mDpiScaleY == 0.0f) + return; + + if (SUCCEEDED(hr)) + hr = mGdiInterop->CreateBitmapRenderTarget(hdc, w, h, &bmpRT); + + if (SUCCEEDED(hr)) + { + IDWriteTextLayout *textLayout = NULL; + + HDC memdc = bmpRT->GetMemoryDC(); + BitBlt(memdc, 0, 0, w, h, hdc, x, y, SRCCOPY); + + hr = mDWriteFactory->CreateGdiCompatibleTextLayout( + text, len, mTextFormat, PixelsToDipsX(w), + PixelsToDipsY(h), mDpiScaleX, NULL, TRUE, &textLayout); + + if (SUCCEEDED(hr)) + { + DWRITE_TEXT_RANGE textRange = { 0, len }; + textLayout->SetFontWeight(mFontWeight, textRange); + textLayout->SetFontStyle(mFontStyle, textRange); + } + + if (SUCCEEDED(hr)) + { + GdiTextRenderer *renderer = new GdiTextRenderer(bmpRT, + mRenderingParams); + GdiTextRendererContext data = { + color, + PixelsToDipsX(cellWidth), + 0.0f + }; + textLayout->Draw(&data, renderer, 0, 0); + SafeRelease(&renderer); + } + + BitBlt(hdc, x, y, w, h, memdc, 0, 0, SRCCOPY); + + SafeRelease(&textLayout); + } + + SafeRelease(&bmpRT); +} + + float +DWriteContext::PixelsToDipsX(int x) +{ + return x / mDpiScaleX; +} + + float +DWriteContext::PixelsToDipsY(int y) +{ + return y / mDpiScaleY; +} + + void +DWriteContext::SetRenderingParams( + const DWriteRenderingParams *params) +{ + if (mDWriteFactory == NULL) + return; + + IDWriteRenderingParams *renderingParams = NULL; + D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode = + D2D1_TEXT_ANTIALIAS_MODE_DEFAULT; + HRESULT hr; + if (params != NULL) + { + hr = mDWriteFactory->CreateCustomRenderingParams(params->gamma, + params->enhancedContrast, params->clearTypeLevel, + ToPixelGeometry(params->pixelGeometry), + ToRenderingMode(params->renderingMode), &renderingParams); + textAntialiasMode = ToTextAntialiasMode(params->textAntialiasMode); + } + else + hr = mDWriteFactory->CreateRenderingParams(&renderingParams); + if (SUCCEEDED(hr) && renderingParams != NULL) + { + SafeRelease(&mRenderingParams); + mRenderingParams = renderingParams; + mTextAntialiasMode = textAntialiasMode; + } +} + + DWriteRenderingParams * +DWriteContext::GetRenderingParams( + DWriteRenderingParams *params) +{ + if (params != NULL && mRenderingParams != NULL) + { + params->gamma = mRenderingParams->GetGamma(); + params->enhancedContrast = mRenderingParams->GetEnhancedContrast(); + params->clearTypeLevel = mRenderingParams->GetClearTypeLevel(); + params->pixelGeometry = ToInt(mRenderingParams->GetPixelGeometry()); + params->renderingMode = ToInt(mRenderingParams->GetRenderingMode()); + params->textAntialiasMode = mTextAntialiasMode; + } + return params; +} + +//////////////////////////////////////////////////////////////////////////// +// PUBLIC C INTERFACES + + void +DWrite_Init(void) +{ +#ifdef DYNAMIC_DIRECTX + // Load libraries. + hD2D1DLL = vimLoadLib(const_cast("d2d1.dll")); + hDWriteDLL = vimLoadLib(const_cast("dwrite.dll")); + if (hD2D1DLL == NULL || hDWriteDLL == NULL) + { + DWrite_Final(); + return; + } + // Get address of procedures. + pGetUserDefaultLocaleName = (PGETUSERDEFAULTLOCALENAME)GetProcAddress( + GetModuleHandle("kernel32.dll"), "GetUserDefaultLocaleName"); + pD2D1CreateFactory = (PD2D1CREATEFACTORY)GetProcAddress(hD2D1DLL, + "D2D1CreateFactory"); + pDWriteCreateFactory = (PDWRITECREATEFACTORY)GetProcAddress(hDWriteDLL, + "DWriteCreateFactory"); +#endif +} + + void +DWrite_Final(void) +{ +#ifdef DYNAMIC_DIRECTX + pGetUserDefaultLocaleName = NULL; + pD2D1CreateFactory = NULL; + pDWriteCreateFactory = NULL; + unload(hDWriteDLL); + unload(hD2D1DLL); +#endif +} + + DWriteContext * +DWriteContext_Open(void) +{ +#ifdef DYNAMIC_DIRECTX + if (pGetUserDefaultLocaleName == NULL || pD2D1CreateFactory == NULL + || pDWriteCreateFactory == NULL) + return NULL; +#endif + return new DWriteContext(); +} + + void +DWriteContext_BeginDraw(DWriteContext *ctx) +{ + if (ctx != NULL && ctx->mRT != NULL) + { + ctx->mRT->BeginDraw(); + ctx->mRT->SetTransform(D2D1::IdentityMatrix()); + ctx->mDrawing = true; + } +} + + void +DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect) +{ + if (ctx != NULL && ctx->mRT != NULL) + { + ctx->mRT->BindDC(hdc, rect); + ctx->mRT->SetTextAntialiasMode(ctx->mTextAntialiasMode); + } +} + + void +DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont) +{ + if (ctx != NULL) + { + ctx->SetFont(hFont); + } +} + + void +DWriteContext_DrawText( + DWriteContext *ctx, + HDC hdc, + const WCHAR* text, + int len, + int x, + int y, + int w, + int h, + int cellWidth, + COLORREF color) +{ + if (ctx != NULL) + ctx->DrawText(hdc, text, len, x, y, w, h, cellWidth, color); +} + + void +DWriteContext_EndDraw(DWriteContext *ctx) +{ + if (ctx != NULL && ctx->mRT != NULL) + { + ctx->mRT->EndDraw(); + ctx->mDrawing = false; + } +} + + void +DWriteContext_Close(DWriteContext *ctx) +{ + delete ctx; +} + + void +DWriteContext_SetRenderingParams( + DWriteContext *ctx, + const DWriteRenderingParams *params) +{ + if (ctx != NULL) + ctx->SetRenderingParams(params); +} + + DWriteRenderingParams * +DWriteContext_GetRenderingParams( + DWriteContext *ctx, + DWriteRenderingParams *params) +{ + if (ctx != NULL) + return ctx->GetRenderingParams(params); + else + return NULL; +} diff --git a/src/gui_dwrite.h b/src/gui_dwrite.h new file mode 100644 index 0000000000..647f479a6b --- /dev/null +++ b/src/gui_dwrite.h @@ -0,0 +1,85 @@ +/* vi:set ts=8 sts=4 sw=4 noet: */ +/* + * Author: MURAOKA Taro + * + * Contributors: + * - Ken Takata + * + * Copyright (C) 2013 MURAOKA Taro + * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. + */ + +#ifndef GUI_DWRITE_H +#define GUI_DWRITE_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct DWriteContext DWriteContext; + +typedef struct DWriteRenderingParams { + float gamma; + float enhancedContrast; + float clearTypeLevel; + /* + * pixelGeometry: + * 0 - DWRITE_PIXEL_GEOMETRY_FLAT + * 1 - DWRITE_PIXEL_GEOMETRY_RGB + * 2 - DWRITE_PIXEL_GEOMETRY_BGR + */ + int pixelGeometry; + /* + * renderingMode: + * 0 - DWRITE_RENDERING_MODE_DEFAULT + * 1 - DWRITE_RENDERING_MODE_ALIASED + * 2 - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC + * 3 - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL + * 4 - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL + * 5 - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC + * 6 - DWRITE_RENDERING_MODE_OUTLINE + */ + int renderingMode; + /* + * antialiasMode: + * 0 - D2D1_TEXT_ANTIALIAS_MODE_DEFAULT + * 1 - D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE + * 2 - D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE + * 3 - D2D1_TEXT_ANTIALIAS_MODE_ALIASED + */ + int textAntialiasMode; +} DWriteRenderingParams; + +void DWrite_Init(void); +void DWrite_Final(void); + +DWriteContext *DWriteContext_Open(void); +void DWriteContext_BeginDraw(DWriteContext *ctx); +void DWriteContext_BindDC(DWriteContext *ctx, HDC hdc, RECT *rect); +void DWriteContext_SetFont(DWriteContext *ctx, HFONT hFont); +void DWriteContext_DrawText( + DWriteContext *ctx, + HDC hdc, + const WCHAR* text, + int len, + int x, + int y, + int w, + int h, + int cellWidth, + COLORREF color); +void DWriteContext_EndDraw(DWriteContext *ctx); +void DWriteContext_Close(DWriteContext *ctx); + +void DWriteContext_SetRenderingParams( + DWriteContext *ctx, + const DWriteRenderingParams *params); + +DWriteRenderingParams *DWriteContext_GetRenderingParams( + DWriteContext *ctx, + DWriteRenderingParams *params); + +#ifdef __cplusplus +} +#endif +#endif/*GUI_DWRITE_H*/ diff --git a/src/gui_w32.c b/src/gui_w32.c index 2d57fbb272..b42817271c 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -25,6 +25,145 @@ #include "vim.h" +#if defined(FEAT_DIRECTX) +# include "gui_dwrite.h" +#endif + +#if defined(FEAT_DIRECTX) || defined(PROTO) +static DWriteContext *s_dwc = NULL; +static int s_directx_enabled = 0; +static int s_directx_load_attempted = 0; +# define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL) + + int +directx_enabled(void) +{ + if (s_dwc != NULL) + return 1; + else if (s_directx_load_attempted) + return 0; + /* load DirectX */ + DWrite_Init(); + s_directx_load_attempted = 1; + s_dwc = DWriteContext_Open(); + return s_dwc != NULL ? 1 : 0; +} +#endif + +#if defined(FEAT_RENDER_OPTIONS) || defined(PROTO) + int +gui_mch_set_rendering_options(char_u *s) +{ +#ifdef FEAT_DIRECTX + int retval = FAIL; + char_u *p, *q; + + int dx_enable = 0; + int dx_flags = 0; + float dx_gamma = 0.0f; + float dx_contrast = 0.0f; + float dx_level = 0.0f; + int dx_geom = 0; + int dx_renmode = 0; + int dx_taamode = 0; + + /* parse string as rendering options. */ + for (p = s; p != NULL && *p != NUL; ) + { + char_u item[256]; + char_u name[128]; + char_u value[128]; + + copy_option_part(&p, item, sizeof(item), ","); + if (p == NULL) + break; + q = &item[0]; + copy_option_part(&q, name, sizeof(name), ":"); + if (q == NULL) + return FAIL; + copy_option_part(&q, value, sizeof(value), ":"); + + if (STRCMP(name, "type") == 0) + { + if (STRCMP(value, "directx") == 0) + dx_enable = 1; + else + return FAIL; + } + else if (STRCMP(name, "gamma") == 0) + { + dx_flags |= 1 << 0; + dx_gamma = (float)atof(value); + } + else if (STRCMP(name, "contrast") == 0) + { + dx_flags |= 1 << 1; + dx_contrast = (float)atof(value); + } + else if (STRCMP(name, "level") == 0) + { + dx_flags |= 1 << 2; + dx_level = (float)atof(value); + } + else if (STRCMP(name, "geom") == 0) + { + dx_flags |= 1 << 3; + dx_geom = atoi(value); + if (dx_geom < 0 || dx_geom > 2) + return FAIL; + } + else if (STRCMP(name, "renmode") == 0) + { + dx_flags |= 1 << 4; + dx_renmode = atoi(value); + if (dx_renmode < 0 || dx_renmode > 6) + return FAIL; + } + else if (STRCMP(name, "taamode") == 0) + { + dx_flags |= 1 << 5; + dx_taamode = atoi(value); + if (dx_taamode < 0 || dx_taamode > 3) + return FAIL; + } + else + return FAIL; + } + + /* Enable DirectX/DirectWrite */ + if (dx_enable) + { + if (!directx_enabled()) + return FAIL; + DWriteContext_SetRenderingParams(s_dwc, NULL); + if (dx_flags) + { + DWriteRenderingParams param; + DWriteContext_GetRenderingParams(s_dwc, ¶m); + if (dx_flags & (1 << 0)) + param.gamma = dx_gamma; + if (dx_flags & (1 << 1)) + param.enhancedContrast = dx_contrast; + if (dx_flags & (1 << 2)) + param.clearTypeLevel = dx_level; + if (dx_flags & (1 << 3)) + param.pixelGeometry = dx_geom; + if (dx_flags & (1 << 4)) + param.renderingMode = dx_renmode; + if (dx_flags & (1 << 5)) + param.textAntialiasMode = dx_taamode; + DWriteContext_SetRenderingParams(s_dwc, ¶m); + } + } + s_directx_enabled = dx_enable; + + return OK; +#else + return FAIL; +#endif +} +#endif + /* * These are new in Windows ME/XP, only defined in recent compilers. */ @@ -1624,6 +1763,11 @@ gui_mch_init(void) set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd)); #endif +#ifdef FEAT_RENDER_OPTIONS + if (p_rop) + (void)gui_mch_set_rendering_options(p_rop); +#endif + theend: /* Display any pending error messages */ display_errors(); @@ -1695,9 +1839,9 @@ gui_mch_set_shellsize(int width, int height, /* compute the size of the outside of the window */ win_width = width + (GetSystemMetrics(SM_CXFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; win_height = height + (GetSystemMetrics(SM_CYFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 + GetSystemMetrics(SM_CYCAPTION) #ifdef FEAT_MENU + gui_mswin_get_menu_height(FALSE) @@ -2239,6 +2383,9 @@ gui_mch_draw_string( #endif HPEN hpen, old_pen; int y; +#ifdef FEAT_DIRECTX + int font_is_ttf_or_vector = 0; +#endif #ifndef MSWIN16_FASTTEXT /* @@ -2326,6 +2473,20 @@ gui_mch_draw_string( SetTextColor(s_hdc, gui.currFgColor); SelectFont(s_hdc, gui.currFont); +#ifdef FEAT_DIRECTX + if (IS_ENABLE_DIRECTX()) + { + TEXTMETRIC tm; + + GetTextMetrics(s_hdc, &tm); + if (tm.tmPitchAndFamily & (TMPF_TRUETYPE | TMPF_VECTOR)) + { + font_is_ttf_or_vector = 1; + DWriteContext_SetFont(s_dwc, (HFONT)gui.currFont); + } + } +#endif + if (pad_size != Columns || padding == NULL || padding[0] != gui.char_width) { vim_free(padding); @@ -2360,6 +2521,14 @@ gui_mch_draw_string( if (text[n] >= 0x80) break; +#if defined(FEAT_DIRECTX) + /* Quick hack to enable DirectWrite. To use DirectWrite (antialias), it is + * required that unicode drawing routine, currently. So this forces it + * enabled. */ + if (enc_utf8 && IS_ENABLE_DIRECTX()) + n = 0; /* Keep n < len, to enter block for unicode. */ +#endif + /* Check if the Unicode buffer exists and is big enough. Create it * with the same length as the multi-byte string, the number of wide * characters is always equal or smaller. */ @@ -2418,8 +2587,17 @@ gui_mch_draw_string( i += utfc_ptr2len_len(text + i, len - i); ++clen; } - ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), - foptions, pcliprect, unicodebuf, wlen, unicodepdy); +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX() && font_is_ttf_or_vector) + { + DWriteContext_DrawText(s_dwc, s_hdc, unicodebuf, wlen, + TEXT_X(col), TEXT_Y(row), FILL_X(cells), FILL_Y(1), + gui.char_width, gui.currFgColor); + } + else +#endif + ExtTextOutW(s_hdc, TEXT_X(col), TEXT_Y(row), + foptions, pcliprect, unicodebuf, wlen, unicodepdy); len = cells; /* used for underlining */ } else if ((enc_codepage > 0 && (int)GetACP() != enc_codepage) || enc_latin9) @@ -2549,14 +2727,14 @@ gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) *screen_w = workarea_rect.right - workarea_rect.left - (GetSystemMetrics(SM_CXFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; /* FIXME: dirty trick: Because the gui_get_base_height() doesn't include * the menubar for MSwin, we subtract it from the screen height, so that * the window size can be made to fit on the screen. */ *screen_h = workarea_rect.bottom - workarea_rect.top - (GetSystemMetrics(SM_CYFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2 - GetSystemMetrics(SM_CYCAPTION) #ifdef FEAT_MENU - gui_mswin_get_menu_height(FALSE) @@ -3188,13 +3366,13 @@ gui_mch_dialog( GetWindowRect(s_hwnd, &rect); maxDialogWidth = rect.right - rect.left - (GetSystemMetrics(SM_CXFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; + GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; if (maxDialogWidth < DLG_MIN_MAX_WIDTH) maxDialogWidth = DLG_MIN_MAX_WIDTH; maxDialogHeight = rect.bottom - rect.top - (GetSystemMetrics(SM_CYFRAME) + - GetSystemMetrics(SM_CXPADDEDBORDER)) * 4 + GetSystemMetrics(SM_CXPADDEDBORDER)) * 4 - GetSystemMetrics(SM_CYCAPTION); if (maxDialogHeight < DLG_MIN_MAX_HEIGHT) maxDialogHeight = DLG_MIN_MAX_HEIGHT; @@ -3351,11 +3529,11 @@ gui_mch_dialog( /* Restrict the size to a maximum. Causes a scrollbar to show up. */ if (dlgheight > maxDialogHeight) { - msgheight = msgheight - (dlgheight - maxDialogHeight); - dlgheight = maxDialogHeight; - scroll_flag = WS_VSCROLL; - /* Make sure scrollbar doesn't appear in the middle of the dialog */ - messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX; + msgheight = msgheight - (dlgheight - maxDialogHeight); + dlgheight = maxDialogHeight; + scroll_flag = WS_VSCROLL; + /* Make sure scrollbar doesn't appear in the middle of the dialog */ + messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX; } add_word(PixelToDialogY(dlgheight)); diff --git a/src/gui_w48.c b/src/gui_w48.c index 89b60908e5..ae4c921c0d 100644 --- a/src/gui_w48.c +++ b/src/gui_w48.c @@ -2785,6 +2785,10 @@ _OnPaint( out_flush(); /* make sure all output has been processed */ (void)BeginPaint(hwnd, &ps); +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_BeginDraw(s_dwc); +#endif #ifdef FEAT_MBYTE /* prevent multi-byte characters from misprinting on an invalid @@ -2800,9 +2804,20 @@ _OnPaint( #endif if (!IsRectEmpty(&ps.rcPaint)) + { +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_BindDC(s_dwc, s_hdc, &ps.rcPaint); +#endif gui_redraw(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right - ps.rcPaint.left + 1, ps.rcPaint.bottom - ps.rcPaint.top + 1); + } + +#if defined(FEAT_DIRECTX) + if (IS_ENABLE_DIRECTX()) + DWriteContext_EndDraw(s_dwc); +#endif EndPaint(hwnd, &ps); } } @@ -3043,6 +3058,12 @@ gui_mch_insert_lines( void gui_mch_exit(int rc) { +#if defined(FEAT_DIRECTX) + DWriteContext_Close(s_dwc); + DWrite_Final(); + s_dwc = NULL; +#endif + ReleaseDC(s_textArea, s_hdc); DeleteObject(s_brush); diff --git a/src/option.c b/src/option.c index 05d8869eaa..3e6164e5a6 100644 --- a/src/option.c +++ b/src/option.c @@ -2124,6 +2124,15 @@ static struct vimoption {"remap", NULL, P_BOOL|P_VI_DEF, (char_u *)&p_remap, PV_NONE, {(char_u *)TRUE, (char_u *)0L} SCRIPTID_INIT}, + {"renderoptions", "rop", P_STRING|P_COMMA|P_RCLR|P_VI_DEF, +#ifdef FEAT_RENDER_OPTIONS + (char_u *)&p_rop, PV_NONE, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, + {(char_u *)NULL, (char_u *)0L} +#endif + SCRIPTID_INIT}, {"report", NULL, P_NUM|P_VI_DEF, (char_u *)&p_report, PV_NONE, {(char_u *)2L, (char_u *)0L} SCRIPTID_INIT}, @@ -6999,6 +7008,14 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, } #endif +#if defined(FEAT_RENDER_OPTIONS) + else if (varp == &p_rop && gui.in_use) + { + if (!gui_mch_set_rendering_options(p_rop)) + errmsg = e_invarg; + } +#endif + /* Options that are a list of flags. */ else { diff --git a/src/option.h b/src/option.h index edf9058440..696d70d6a2 100644 --- a/src/option.h +++ b/src/option.h @@ -655,6 +655,9 @@ EXTERN long p_rdt; /* 'redrawtime' */ #endif EXTERN int p_remap; /* 'remap' */ EXTERN long p_re; /* 'regexpengine' */ +#ifdef FEAT_RENDER_OPTIONS +EXTERN char_u *p_rop; /* 'renderoptions' */ +#endif EXTERN long p_report; /* 'report' */ #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) EXTERN long p_pvh; /* 'previewheight' */ diff --git a/src/proto/gui_w32.pro b/src/proto/gui_w32.pro index a333233d78..88fbf67c62 100644 --- a/src/proto/gui_w32.pro +++ b/src/proto/gui_w32.pro @@ -1,4 +1,6 @@ /* gui_w32.c */ +int directx_enabled __ARGS((void)); +int gui_mch_set_rendering_options __ARGS((char_u *s)); void gui_mch_set_blinking __ARGS((long wait, long on, long off)); void gui_mch_stop_blink __ARGS((void)); void gui_mch_start_blink __ARGS((void)); diff --git a/src/version.c b/src/version.c index 6610ba110e..fd9e275faa 100644 --- a/src/version.c +++ b/src/version.c @@ -189,6 +189,13 @@ static char *(features[]) = #else "-digraphs", #endif +#ifdef FEAT_GUI_W32 +# ifdef FEAT_DIRECTX + "+directx", +# else + "-directx", +# endif +#endif #ifdef FEAT_DND "+dnd", #else @@ -734,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 393, /**/ 392, /**/ diff --git a/src/vim.h b/src/vim.h index 84e139c75a..887a76d1f4 100644 --- a/src/vim.h +++ b/src/vim.h @@ -134,6 +134,13 @@ # endif #endif +/* Check support for rendering options */ +#ifdef FEAT_GUI +# if defined(FEAT_DIRECTX) +# define FEAT_RENDER_OPTIONS +# endif +#endif + /* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */ #if _MSC_VER >= 1400 # define _CRT_SECURE_NO_DEPRECATE From 15e446046bc0cb624ffa6238ac253f8b36dceba1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 09:52:30 +0200 Subject: [PATCH 020/311] Added tag v7-4-393 for changeset 1bff71d20262 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 4326008a12..3d72b4c98f 100644 --- a/.hgtags +++ b/.hgtags @@ -3115,3 +3115,4 @@ dbd7dc1ea2e6bd0fc3c9ec7faec76382412d0129 v7-4-382 d3a674f6c7370f70d6b66dcefb9e36d22d73c7b7 v7-4-390 f051e50a6a5feb0f0c6d209440d9d305b82f5836 v7-4-391 589fd07888abc8a1208616c56b21898d3352fc5b v7-4-392 +1bff71d202621d97acc4ef21ce9f47b78f68bda3 v7-4-393 From 819f77ecfc868b7f95083f17bdab945eac57356c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 11:49:55 +0200 Subject: [PATCH 021/311] updated for version 7.4.394 Problem: When using DirectX last italic character is incomplete. Solution: Add one to the number of cells. (Ken Takata) --- src/gui_w32.c | 3 ++- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui_w32.c b/src/gui_w32.c index b42817271c..0368dda439 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -2590,8 +2590,9 @@ gui_mch_draw_string( #if defined(FEAT_DIRECTX) if (IS_ENABLE_DIRECTX() && font_is_ttf_or_vector) { + /* Add one to "cells" for italics. */ DWriteContext_DrawText(s_dwc, s_hdc, unicodebuf, wlen, - TEXT_X(col), TEXT_Y(row), FILL_X(cells), FILL_Y(1), + TEXT_X(col), TEXT_Y(row), FILL_X(cells + 1), FILL_Y(1), gui.char_width, gui.currFgColor); } else diff --git a/src/version.c b/src/version.c index fd9e275faa..082c5fc446 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 394, /**/ 393, /**/ From 1f9b77196cd31ba88b1d09febcb8eee841264ced Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 11:49:56 +0200 Subject: [PATCH 022/311] Added tag v7-4-394 for changeset d594c1552137 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 3d72b4c98f..429902a8b4 100644 --- a/.hgtags +++ b/.hgtags @@ -3116,3 +3116,4 @@ d3a674f6c7370f70d6b66dcefb9e36d22d73c7b7 v7-4-390 f051e50a6a5feb0f0c6d209440d9d305b82f5836 v7-4-391 589fd07888abc8a1208616c56b21898d3352fc5b v7-4-392 1bff71d202621d97acc4ef21ce9f47b78f68bda3 v7-4-393 +d594c15521377493d5e23b03e4dbf5108df69acd v7-4-394 From b6607e967c601bd30f22cef459f797f2b29a800a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 12:44:14 +0200 Subject: [PATCH 023/311] updated for version 7.4.395 Problem: C indent is wrong below an if with wrapped condition followed by curly braces. (Trevor Powell) Solution: Make a copy of tryposBrace. --- src/misc1.c | 5 +++++ src/testdir/test3.in | 8 ++++++++ src/testdir/test3.ok | 8 ++++++++ src/version.c | 2 ++ 4 files changed, 23 insertions(+) diff --git a/src/misc1.c b/src/misc1.c index 2c28aae84c..6ae72cfbba 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -6995,6 +6995,7 @@ get_c_indent() char_u *linecopy; pos_T *trypos; pos_T *tryposBrace = NULL; + pos_T tryposBraceCopy; pos_T our_paren_pos; char_u *start; int start_brace; @@ -7532,7 +7533,11 @@ get_c_indent() /* * We are inside braces, there is a { before this line at the position * stored in tryposBrace. + * Make a copy of tryposBrace, it may point to pos_copy inside + * find_start_brace(), which may be changed somewhere. */ + tryposBraceCopy = *tryposBrace; + tryposBrace = &tryposBraceCopy; trypos = tryposBrace; ourscope = trypos->lnum; start = ml_get(ourscope); diff --git a/src/testdir/test3.in b/src/testdir/test3.in index de86700380..7757569e37 100644 --- a/src/testdir/test3.in +++ b/src/testdir/test3.in @@ -464,6 +464,14 @@ label: if (asdf && asdfasdf } +{ +for ( int i = 0; + i < 10; i++ ) +{ +} + i = 0; +} + class bob { int foo() {return 1;} diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok index 0d0e76fce4..e75de0ffa3 100644 --- a/src/testdir/test3.ok +++ b/src/testdir/test3.ok @@ -452,6 +452,14 @@ label: if (asdf && asdfasdf } +{ + for ( int i = 0; + i < 10; i++ ) + { + } + i = 0; +} + class bob { int foo() {return 1;} diff --git a/src/version.c b/src/version.c index 082c5fc446..aa64155908 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 395, /**/ 394, /**/ From 16d903a4a92d28c6dec39ef3f67cfa48aabdb68b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 12:44:14 +0200 Subject: [PATCH 024/311] Added tag v7-4-395 for changeset 65b0974c5beb --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 429902a8b4..f439d76e78 100644 --- a/.hgtags +++ b/.hgtags @@ -3117,3 +3117,4 @@ f051e50a6a5feb0f0c6d209440d9d305b82f5836 v7-4-391 589fd07888abc8a1208616c56b21898d3352fc5b v7-4-392 1bff71d202621d97acc4ef21ce9f47b78f68bda3 v7-4-393 d594c15521377493d5e23b03e4dbf5108df69acd v7-4-394 +65b0974c5bebf5d6b56e9abc90d86759d1c4f6d7 v7-4-395 From 9221cab8c05de38d528bfd8e21ddfea0b308bdc7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 13:17:11 +0200 Subject: [PATCH 025/311] updated for version 7.4.396 Problem: When 'clipboard' is "unnamed", :g/pat/d is very slow. (Praful) Solution: Only set the clipboard after the last delete. (Christian Brabandt) --- src/ex_cmds.c | 8 +++++++ src/ex_cmds2.c | 10 +++++++-- src/ex_docmd.c | 7 +++++++ src/globals.h | 2 ++ src/ops.c | 15 ++++++++++---- src/proto/ui.pro | 2 ++ src/ui.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ src/version.c | 2 ++ 8 files changed, 94 insertions(+), 6 deletions(-) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 62621bfa57..df6700d64b 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5514,7 +5514,15 @@ ex_global(eap) smsg((char_u *)_("Pattern not found: %s"), pat); } else + { +#ifdef FEAT_CLIPBOARD + start_global_changes(); +#endif global_exe(cmd); +#ifdef FEAT_CLIPBOARD + end_global_changes(); +#endif + } ml_clearmarked(); /* clear rest of the marks */ vim_regfree(regmatch.regprog); diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index c502ff8527..908552d580 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -2464,6 +2464,9 @@ ex_listdo(eap) * great speed improvement. */ save_ei = au_event_disable(",Syntax"); #endif +#ifdef FEAT_CLIPBOARD + start_global_changes(); +#endif if (eap->cmdidx == CMD_windo || eap->cmdidx == CMD_tabdo @@ -2591,6 +2594,9 @@ ex_listdo(eap) curbuf->b_fname, TRUE, curbuf); } #endif +#ifdef FEAT_CLIPBOARD + end_global_changes(); +#endif } /* @@ -2750,8 +2756,8 @@ source_runtime(name, all) * used. * Returns OK when at least one match found, FAIL otherwise. * - * If "name" is NULL calls callback for each entry in runtimepath. Cookie is - * passed by reference in this case, setting it to NULL indicates that callback + * If "name" is NULL calls callback for each entry in runtimepath. Cookie is + * passed by reference in this case, setting it to NULL indicates that callback * has done its job. */ int diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 083693b640..ba764bfcf6 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -11534,6 +11534,10 @@ ex_folddo(eap) { linenr_T lnum; +#ifdef FEAT_CLIPBOARD + start_global_changes(); +#endif + /* First set the marks for all lines closed/open. */ for (lnum = eap->line1; lnum <= eap->line2; ++lnum) if (hasFolding(lnum, NULL, NULL) == (eap->cmdidx == CMD_folddoclosed)) @@ -11542,5 +11546,8 @@ ex_folddo(eap) /* Execute the command on the marked lines. */ global_exe(eap->arg); ml_clearmarked(); /* clear rest of the marks */ +#ifdef FEAT_CLIPBOARD + end_global_changes(); +#endif } #endif diff --git a/src/globals.h b/src/globals.h index 77528c7b58..ce831f33d9 100644 --- a/src/globals.h +++ b/src/globals.h @@ -533,6 +533,8 @@ EXTERN int clip_autoselect_plus INIT(= FALSE); EXTERN int clip_autoselectml INIT(= FALSE); EXTERN int clip_html INIT(= FALSE); EXTERN regprog_T *clip_exclude_prog INIT(= NULL); +EXTERN int clip_did_set_selection INIT(= TRUE); +EXTERN int clip_unnamed_saved INIT(= 0); #endif /* diff --git a/src/ops.c b/src/ops.c index 265cf3a854..2b400916f7 100644 --- a/src/ops.c +++ b/src/ops.c @@ -1597,9 +1597,15 @@ adjust_clip_reg(rp) { /* If no reg. specified, and "unnamed" or "unnamedplus" is in 'clipboard', * use '*' or '+' reg, respectively. "unnamedplus" prevails. */ - if (*rp == 0 && clip_unnamed != 0) - *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available) + if (*rp == 0 && (clip_unnamed != 0 || clip_unnamed_saved != 0)) + { + if (clip_unnamed != 0) + *rp = ((clip_unnamed & CLIP_UNNAMED_PLUS) && clip_plus.available) ? '+' : '*'; + else + *rp = ((clip_unnamed_saved & CLIP_UNNAMED_PLUS) && clip_plus.available) + ? '+' : '*'; + } if (!clip_star.available && *rp == '*') *rp = 0; if (!clip_plus.available && *rp == '+') @@ -3203,7 +3209,7 @@ op_yank(oap, deleting, mess) if (clip_star.available && (curr == &(y_regs[STAR_REGISTER]) || (!deleting && oap->regname == 0 - && (clip_unnamed & CLIP_UNNAMED)))) + && ((clip_unnamed | clip_unnamed_saved) & CLIP_UNNAMED)))) { if (curr != &(y_regs[STAR_REGISTER])) /* Copy the text from register 0 to the clipboard register. */ @@ -3224,7 +3230,8 @@ op_yank(oap, deleting, mess) if (clip_plus.available && (curr == &(y_regs[PLUS_REGISTER]) || (!deleting && oap->regname == 0 - && (clip_unnamed & CLIP_UNNAMED_PLUS)))) + && ((clip_unnamed | clip_unnamed_saved) & + CLIP_UNNAMED_PLUS)))) { if (curr != &(y_regs[PLUS_REGISTER])) /* Copy the text from register 0 to the clipboard register. */ diff --git a/src/proto/ui.pro b/src/proto/ui.pro index 234e99fd7e..4100aa7303 100644 --- a/src/proto/ui.pro +++ b/src/proto/ui.pro @@ -14,6 +14,8 @@ void clip_init __ARGS((int can_use)); void clip_update_selection __ARGS((VimClipboard *clip)); void clip_own_selection __ARGS((VimClipboard *cbd)); void clip_lose_selection __ARGS((VimClipboard *cbd)); +void start_global_changes __ARGS((void)); +void end_global_changes __ARGS((void)); void clip_auto_select __ARGS((void)); int clip_isautosel_star __ARGS((void)); int clip_isautosel_plus __ARGS((void)); diff --git a/src/ui.c b/src/ui.c index db13555f4f..21d92f0b7b 100644 --- a/src/ui.c +++ b/src/ui.c @@ -557,6 +557,51 @@ clip_copy_selection(clip) } } +/* + * Save and restore clip_unnamed before doing possibly many changes. This + * prevents accessing the clipboard very often which might slow down Vim + * considerably. + */ + +/* + * Save clip_unnamed and reset it. + */ + void +start_global_changes() +{ + clip_unnamed_saved = clip_unnamed; + + if (clip_did_set_selection) + { + clip_unnamed = FALSE; + clip_did_set_selection = FALSE; + } +} + +/* + * Restore clip_unnamed and set the selection when needed. + */ + void +end_global_changes() +{ + if (!clip_did_set_selection) + { + clip_did_set_selection = TRUE; + clip_unnamed = clip_unnamed_saved; + if (clip_unnamed & CLIP_UNNAMED) + { + clip_own_selection(&clip_star); + clip_gen_set_selection(&clip_star); + } + if (clip_unnamed & CLIP_UNNAMED_PLUS) + { + clip_own_selection(&clip_plus); + clip_gen_set_selection(&clip_plus); + } + } + clip_unnamed_saved = FALSE; +} + /* * Called when Visual mode is ended: update the selection. */ @@ -1428,6 +1473,15 @@ clip_gen_lose_selection(cbd) clip_gen_set_selection(cbd) VimClipboard *cbd; { + if (!clip_did_set_selection) + { + /* Updating postponed, so that accessing the system clipboard won't + * hang Vim when accessing it many times (e.g. on a :g comand). */ + if (cbd == &clip_plus && (clip_unnamed_saved & CLIP_UNNAMED_PLUS)) + return; + else if (cbd == &clip_star && (clip_unnamed_saved & CLIP_UNNAMED)) + return; + } #ifdef FEAT_XCLIPBOARD # ifdef FEAT_GUI if (gui.in_use) diff --git a/src/version.c b/src/version.c index aa64155908..312e4abb60 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 396, /**/ 395, /**/ From b588e66b554c003f87030d56c83ffd0abfc6d7ca Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 13:17:11 +0200 Subject: [PATCH 026/311] Added tag v7-4-396 for changeset 7766142fc7d3 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index f439d76e78..68f9410268 100644 --- a/.hgtags +++ b/.hgtags @@ -3118,3 +3118,4 @@ f051e50a6a5feb0f0c6d209440d9d305b82f5836 v7-4-391 1bff71d202621d97acc4ef21ce9f47b78f68bda3 v7-4-393 d594c15521377493d5e23b03e4dbf5108df69acd v7-4-394 65b0974c5bebf5d6b56e9abc90d86759d1c4f6d7 v7-4-395 +7766142fc7d3e90c2e15a9c606efcd97331edef8 v7-4-396 From 25280030ea3a3b91603a9e587543226d58d627f3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 14:09:16 +0200 Subject: [PATCH 027/311] updated for version 7.4.397 Problem: Matchparen only uses the topmost syntax item. Solution: Go through the syntax stack to find items. (James McCoy) Also use getcurpos() when possible. --- runtime/plugin/matchparen.vim | 13 ++++++++++--- src/version.c | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim index 817ce62b28..3804ab949a 100644 --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -98,10 +98,17 @@ function! s:Highlight_Matching_Pair() call cursor(c_lnum, c_col - before) endif - " When not in a string or comment ignore matches inside them. + " Build an expression that detects whether the current cursor position is in + " certain syntax types (string, comment, etc.), for use as searchpairpos()'s + " skip argument. " We match "escape" for special items, such as lispEscapeSpecial. - let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' . - \ '=~? "string\\|character\\|singlequote\\|escape\\|comment"' + let s_skip = '!empty(filter(map(synstack(line("."), col(".")), ''synIDattr(v:val, "name")''), ' . + \ '''v:val =~? "string\\|character\\|singlequote\\|escape\\|comment"''))' + " If executing the expression determines that the cursor is currently in + " one of the syntax types, then we want searchpairpos() to find the pair + " within those syntax types (i.e., not skip). Otherwise, the cursor is + " outside of the syntax types and s_skip should keep its value so we skip any + " matching pair inside the syntax types. execute 'if' s_skip '| let s_skip = 0 | endif' " Limit the search to lines visible in the window. diff --git a/src/version.c b/src/version.c index 312e4abb60..878ace89d4 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 397, /**/ 396, /**/ From 0b34b16f9bcc843910a57ae61f5c8a2efb11a557 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 6 Aug 2014 14:09:16 +0200 Subject: [PATCH 028/311] Added tag v7-4-397 for changeset 8d361608fe86 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 68f9410268..12981ee35e 100644 --- a/.hgtags +++ b/.hgtags @@ -3119,3 +3119,4 @@ f051e50a6a5feb0f0c6d209440d9d305b82f5836 v7-4-391 d594c15521377493d5e23b03e4dbf5108df69acd v7-4-394 65b0974c5bebf5d6b56e9abc90d86759d1c4f6d7 v7-4-395 7766142fc7d3e90c2e15a9c606efcd97331edef8 v7-4-396 +8d361608fe86c534e51e4c7e583375642d34b7a4 v7-4-397 From 80e1c4adc9ad200d0fb72e4c0c7245b585b64fa8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 7 Aug 2014 08:55:10 +0200 Subject: [PATCH 029/311] updated for version 7.4.398 Problem: Gcc error for the argument of InterlockedIncrement() and InterlockedDecrement(). (Axel Bender) Solution: Remove "unsigned" from the cRefCount_ declaration. --- src/gui_dwrite.cpp | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui_dwrite.cpp b/src/gui_dwrite.cpp index cf83c05044..d4c43a37d6 100644 --- a/src/gui_dwrite.cpp +++ b/src/gui_dwrite.cpp @@ -377,7 +377,7 @@ public: } private: - unsigned long cRefCount_; + long cRefCount_; IDWriteBitmapRenderTarget* pRenderTarget_; IDWriteRenderingParams* pRenderingParams_; }; diff --git a/src/version.c b/src/version.c index 878ace89d4..19183fdac8 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 398, /**/ 397, /**/ From 1f41ca501d2f2571b1b7a67bcc4a979b2ef33d22 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 7 Aug 2014 08:55:10 +0200 Subject: [PATCH 030/311] Added tag v7-4-398 for changeset f62b2e76dd80 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 12981ee35e..bc9ec5c498 100644 --- a/.hgtags +++ b/.hgtags @@ -3120,3 +3120,4 @@ d594c15521377493d5e23b03e4dbf5108df69acd v7-4-394 65b0974c5bebf5d6b56e9abc90d86759d1c4f6d7 v7-4-395 7766142fc7d3e90c2e15a9c606efcd97331edef8 v7-4-396 8d361608fe86c534e51e4c7e583375642d34b7a4 v7-4-397 +f62b2e76dd809dc57cad9d0fd8f04a4f3a7193e9 v7-4-398 From 76449cddc6b6e8a5b4bc8383c5c357bdd35b5e39 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 10 Aug 2014 08:38:34 +0200 Subject: [PATCH 031/311] updated for version 7.4.399 Problem: Encryption implementation is messy. Blowfish encryption has a weakness. Solution: Refactor the encryption, store the state in an allocated struct instead of using a save/restore mechanism. Introduce the "blowfish2" method, which does not have the weakness and encrypts the whole undo file. (largely by David Leadbeater) --- runtime/doc/editing.txt | 34 +- runtime/doc/options.txt | 16 +- src/Makefile | 31 +- src/blowfish.c | 305 +++++++++--------- src/crypt.c | 585 +++++++++++++++++++++++++++++++++ src/crypt_zip.c | 158 +++++++++ src/ex_docmd.c | 3 +- src/fileio.c | 346 ++++++++------------ src/globals.h | 4 - src/main.c | 3 +- src/memline.c | 87 ++--- src/misc2.c | 335 +------------------ src/option.c | 10 +- src/proto.h | 2 + src/proto/blowfish.pro | 10 +- src/proto/crypt.pro | 24 ++ src/proto/crypt_zip.pro | 5 + src/proto/fileio.pro | 2 - src/proto/misc2.pro | 11 +- src/structs.h | 25 +- src/testdir/test71.in | 27 ++ src/testdir/test71.ok | 5 + src/testdir/test71a.in | 4 + src/testdir/test72.in | 27 ++ src/testdir/test72.ok | 4 + src/undo.c | 698 ++++++++++++++++++++++++++++------------ src/version.c | 2 + 27 files changed, 1783 insertions(+), 980 deletions(-) create mode 100644 src/crypt.c create mode 100644 src/crypt_zip.c create mode 100644 src/proto/crypt.pro create mode 100644 src/proto/crypt_zip.pro diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 0b5f69a7b7..cbb9b90e5f 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.4. Last change: 2014 Jul 19 +*editing.txt* For Vim version 7.4. Last change: 2014 Aug 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1370,8 +1370,13 @@ lose your work. The undo file can be disabled without much disadvantage. > Note: The text in memory is not encrypted. A system administrator may be able to see your text while you are editing it. When filtering text with -":!filter" or using ":w !command" the text is not encrypted, this may reveal -it to others. The 'viminfo' file is not encrypted. +":!filter" or using ":w !command" the text is also not encrypted, this may +reveal it to others. The 'viminfo' file is not encrypted. + +You could do this to edit very secret text: > + :set noundofile viminfo= + :noswapfile edit secrets.txt +Keep in mind that without a swap file you risk loosing your work in a crash. WARNING: If you make a typo when entering the key and then write the file and exit, the text will be lost! @@ -1398,18 +1403,25 @@ To disable the encryption, reset the 'key' option to an empty value: > :set key= You can use the 'cryptmethod' option to select the type of encryption, use one -of these two: > - :setlocal cm=zip " weak method, backwards compatible - :setlocal cm=blowfish " strong method +of these: > + :setlocal cm=zip " weak method, backwards compatible + :setlocal cm=blowfish " method with flaws + :setlocal cm=blowfish2 " medium strong method + Do this before writing the file. When reading an encrypted file it will be set automatically to the method used when that file was written. You can change 'cryptmethod' before writing that file to change the method. + To set the default method, used for new files, use one of these in your |vimrc| file: > set cm=zip - set cm=blowfish + set cm=blowfish2 +Use the first one if you need to be compatible with Vim 7.2 and older. Using +"blowfish2" is highly recommended if you can use a Vim version that supports +it. + The message given for reading and writing a file will show "[crypted]" when -using zip, "[blowfish]" when using blowfish. +using zip, "[blowfish]" when using blowfish, etc. When writing an undo file, the same key and method will be used for the text in the undo file. |persistent-undo|. @@ -1444,7 +1456,7 @@ lines to "/etc/magic", "/usr/share/misc/magic" or wherever your system has the 0 string VimCrypt~ Vim encrypted file >9 string 01 - "zip" cryptmethod >9 string 02 - "blowfish" cryptmethod - + >9 string 03 - "blowfish2" cryptmethod Notes: - Encryption is not possible when doing conversion with 'charconvert'. @@ -1468,6 +1480,10 @@ Notes: - Pkzip uses the same encryption as 'cryptmethod' "zip", and US Govt has no objection to its export. Pkzip's public file APPNOTE.TXT describes this algorithm in detail. +- The implmentation of 'cryptmethod' "blowfish" has a flaw. It is possible to + crack the first 64 bytes of a file and in some circumstances more of the + file. Use of it is not recommended, but it's still the strongest method + supported by Vim 7.3 and 7.4. The "zip" method is even weaker. - Vim originates from the Netherlands. That is where the sources come from. Thus the encryption code is not exported from the USA. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 5f4a06e7ef..9d9cb1f937 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -2229,10 +2229,18 @@ A jump table for the options with a short description can be found at |Q_op|. zip PkZip compatible method. A weak kind of encryption. Backwards compatible with Vim 7.2 and older. *blowfish* - blowfish Blowfish method. Strong encryption. Requires Vim 7.3 - or later, files can NOT be read by Vim 7.2 and older. - This adds a "seed" to the file, every time you write - the file the encrypted bytes will be different. + blowfish Blowfish method. Medium strong encryption but it has + an implementation flaw. Requires Vim 7.3 or later, + files can NOT be read by Vim 7.2 and older. This adds + a "seed" to the file, every time you write the file + the encrypted bytes will be different. + *blowfish2* + blowfish2 Blowfish method. Medium strong encryption. Requires + Vim 7.4.399 or later, files can NOT be read by Vim 7.3 + and older. This adds a "seed" to the file, every time + you write the file the encrypted bytes will be + different. The whole undo file is encrypted, not just + the pieces of text. When reading an encrypted file 'cryptmethod' will be set automatically to the detected method of the file being read. Thus if you write it diff --git a/src/Makefile b/src/Makefile index 1d20ec1af1..772b15c7d6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1431,6 +1431,8 @@ BASIC_SRC = \ blowfish.c \ buffer.c \ charset.c \ + crypt.c \ + crypt_zip.c \ diff.c \ digraph.c \ edit.c \ @@ -1520,6 +1522,8 @@ OBJ_COMMON = \ objects/buffer.o \ objects/blowfish.o \ objects/charset.o \ + objects/crypt.o \ + objects/crypt_zip.o \ objects/diff.o \ objects/digraph.o \ objects/edit.o \ @@ -1589,6 +1593,8 @@ PRO_AUTO = \ blowfish.pro \ buffer.pro \ charset.pro \ + crypt.pro \ + crypt_zip.pro \ diff.pro \ digraph.pro \ edit.pro \ @@ -1753,10 +1759,11 @@ xxd/xxd$(EXEEXT): xxd/xxd.c languages: @if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ cd $(PODIR); \ - CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \ + CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix); \ fi -@if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ - cd $(PODIR); CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) converted; \ + cd $(PODIR); \ + CC="$(CC)" $(MAKE) prefix=$(DESTDIR)$(prefix) converted; \ fi # Update the *.po files for changes in the sources. Only run manually. @@ -1883,8 +1890,14 @@ unittest unittests: $(UNITTEST_TARGETS) # Run individual test, assuming that Vim was already compiled. test1 test2 test3 test4 test5 test6 test7 test8 test9 \ test_autoformat_join \ + test_breakindent \ + test_changelist \ test_eval \ + test_insertcount \ + test_listlbr \ + test_listlbr_utf8 \ test_options \ + test_qf_title \ test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \ test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \ test30 test31 test32 test33 test34 test35 test36 test37 test38 test39 \ @@ -2506,6 +2519,12 @@ objects/buffer.o: buffer.c objects/charset.o: charset.c $(CCC) -o $@ charset.c +objects/crypt.o: crypt.c + $(CCC) -o $@ crypt.c + +objects/crypt_zip.o: crypt_zip.c + $(CCC) -o $@ crypt_zip.c + objects/diff.o: diff.c $(CCC) -o $@ diff.c @@ -2855,6 +2874,14 @@ objects/charset.o: charset.c vim.h auto/config.h feature.h os_unix.h auto/osdef. ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ arabic.h +objects/crypt.o: crypt.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ + ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ + gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ + arabic.h +objects/crypt_zip.o: crypt_zip.c vim.h auto/config.h feature.h os_unix.h \ + auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \ + regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \ + globals.h farsi.h arabic.h objects/diff.o: diff.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \ ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \ gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \ diff --git a/src/blowfish.c b/src/blowfish.c index 3d9ba5566a..6bf2482f0e 100644 --- a/src/blowfish.c +++ b/src/blowfish.c @@ -9,17 +9,25 @@ * Blowfish encryption for Vim; in Blowfish cipher feedback mode. * Contributed by Mohsin Ahmed, http://www.cs.albany.edu/~mosh * Based on http://www.schneier.com/blowfish.html by Bruce Schneier. + * + * There are two variants: + * - The old one "blowfish" has a flaw which makes it much easier to crack the + * key. To see this, make a text file with one line of 1000 "x" characters + * and write it encrypted. Use "xxd" to inspect the bytes in the file. You + * will see that a block of 8 bytes repeats 8 times. + * - The new one "blowfish2" is better. It uses an 8 byte CFB to avoid the + * repeats. */ #include "vim.h" -#if defined(FEAT_CRYPT) +#if defined(FEAT_CRYPT) || defined(PROTO) #define ARRAY_LENGTH(A) (sizeof(A)/sizeof(A[0])) #define BF_BLOCK 8 #define BF_BLOCK_MASK 7 -#define BF_CFB_LEN (8*(BF_BLOCK)) +#define BF_MAX_CFB_LEN (8 * BF_BLOCK) typedef union { UINT32_T ul[2]; @@ -37,14 +45,26 @@ typedef union { # endif #endif -static void bf_e_block __ARGS((UINT32_T *p_xl, UINT32_T *p_xr)); -static void bf_e_cblock __ARGS((char_u *block)); -static int bf_check_tables __ARGS((UINT32_T a_ipa[18], UINT32_T a_sbi[4][256], UINT32_T val)); +/* The state of encryption, referenced by cryptstate_T. */ +typedef struct { + UINT32_T pax[18]; /* P-array */ + UINT32_T sbx[4][256]; /* S-boxes */ + int randbyte_offset; + int update_offset; + char_u cfb_buffer[BF_MAX_CFB_LEN]; /* up to 64 bytes used */ + int cfb_len; /* size of cfb_buffer actually used */ +} bf_state_T; + + +static void bf_e_block __ARGS((bf_state_T *state, UINT32_T *p_xl, UINT32_T *p_xr)); +static void bf_e_cblock __ARGS((bf_state_T *state, char_u *block)); +static int bf_check_tables __ARGS((UINT32_T pax[18], UINT32_T sbx[4][256], UINT32_T val)); static int bf_self_test __ARGS((void)); +static void bf_key_init __ARGS((bf_state_T *state, char_u *password, char_u *salt, int salt_len)); +static void bf_cfb_init __ARGS((bf_state_T *state, char_u *seed, int seed_len)); /* Blowfish code */ -static UINT32_T pax[18]; -static UINT32_T ipa[18] = { +static UINT32_T pax_init[18] = { 0x243f6a88u, 0x85a308d3u, 0x13198a2eu, 0x03707344u, 0xa4093822u, 0x299f31d0u, 0x082efa98u, 0xec4e6c89u, 0x452821e6u, @@ -53,8 +73,7 @@ static UINT32_T ipa[18] = { 0xb5470917u, 0x9216d5d9u, 0x8979fb1bu }; -static UINT32_T sbx[4][256]; -static UINT32_T sbi[4][256] = { +static UINT32_T sbx_init[4][256] = { {0xd1310ba6u, 0x98dfb5acu, 0x2ffd72dbu, 0xd01adfb7u, 0xb8e1afedu, 0x6a267e96u, 0xba7c9045u, 0xf12c7f99u, 0x24a19947u, 0xb3916cf7u, 0x0801f2e2u, 0x858efc16u, @@ -314,33 +333,40 @@ static UINT32_T sbi[4][256] = { } }; - #define F1(i) \ - xl ^= pax[i]; \ - xr ^= ((sbx[0][xl >> 24] + \ - sbx[1][(xl & 0xFF0000) >> 16]) ^ \ - sbx[2][(xl & 0xFF00) >> 8]) + \ - sbx[3][xl & 0xFF]; + xl ^= bfs->pax[i]; \ + xr ^= ((bfs->sbx[0][xl >> 24] + \ + bfs->sbx[1][(xl & 0xFF0000) >> 16]) ^ \ + bfs->sbx[2][(xl & 0xFF00) >> 8]) + \ + bfs->sbx[3][xl & 0xFF]; #define F2(i) \ - xr ^= pax[i]; \ - xl ^= ((sbx[0][xr >> 24] + \ - sbx[1][(xr & 0xFF0000) >> 16]) ^ \ - sbx[2][(xr & 0xFF00) >> 8]) + \ - sbx[3][xr & 0xFF]; - + xr ^= bfs->pax[i]; \ + xl ^= ((bfs->sbx[0][xr >> 24] + \ + bfs->sbx[1][(xr & 0xFF0000) >> 16]) ^ \ + bfs->sbx[2][(xr & 0xFF00) >> 8]) + \ + bfs->sbx[3][xr & 0xFF]; static void -bf_e_block(p_xl, p_xr) +bf_e_block(bfs, p_xl, p_xr) + bf_state_T *bfs; UINT32_T *p_xl; UINT32_T *p_xr; { - UINT32_T temp, xl = *p_xl, xr = *p_xr; + UINT32_T temp; + UINT32_T xl = *p_xl; + UINT32_T xr = *p_xr; - F1(0) F2(1) F1(2) F2(3) F1(4) F2(5) F1(6) F2(7) - F1(8) F2(9) F1(10) F2(11) F1(12) F2(13) F1(14) F2(15) - xl ^= pax[16]; - xr ^= pax[17]; + F1(0) F2(1) + F1(2) F2(3) + F1(4) F2(5) + F1(6) F2(7) + F1(8) F2(9) + F1(10) F2(11) + F1(12) F2(13) + F1(14) F2(15) + xl ^= bfs->pax[16]; + xr ^= bfs->pax[17]; temp = xl; xl = xr; xr = temp; @@ -348,22 +374,6 @@ bf_e_block(p_xl, p_xr) *p_xr = xr; } -#if 0 /* not used */ - static void -bf_d_block(p_xl, p_xr) - UINT32_T *p_xl; - UINT32_T *p_xr; -{ - UINT32_T temp, xl = *p_xl, xr = *p_xr; - F1(17) F2(16) F1(15) F2(14) F1(13) F2(12) F1(11) F2(10) - F1(9) F2(8) F1(7) F2(6) F1(5) F2(4) F1(3) F2(2) - xl ^= pax[1]; - xr ^= pax[0]; - temp = xl; xl = xr; xr = temp; - *p_xl = xl; *p_xr = xr; -} -#endif - #ifdef WORDS_BIGENDIAN # define htonl2(x) \ @@ -374,7 +384,8 @@ bf_d_block(p_xl, p_xr) #endif static void -bf_e_cblock(block) +bf_e_cblock(bfs, block) + bf_state_T *bfs; char_u *block; { block8 bk; @@ -382,35 +393,22 @@ bf_e_cblock(block) memcpy(bk.uc, block, 8); htonl2(bk.ul[0]); htonl2(bk.ul[1]); - bf_e_block(&bk.ul[0], &bk.ul[1]); + bf_e_block(bfs, &bk.ul[0], &bk.ul[1]); htonl2(bk.ul[0]); htonl2(bk.ul[1]); memcpy(block, bk.uc, 8); } -#if 0 /* not used */ - void -bf_d_cblock(block) - char_u *block; -{ - block8 bk; - memcpy(bk.uc, block, 8); - htonl2(bk.ul[0]); htonl2(bk.ul[1]); - bf_d_block(&bk.ul[0], &bk.ul[1]); - htonl2(bk.ul[0]); htonl2(bk.ul[1]); - memcpy(block, bk.uc, 8); -} -#endif - /* * Initialize the crypt method using "password" as the encryption key and * "salt[salt_len]" as the salt. */ - void -bf_key_init(password, salt, salt_len) - char_u *password; - char_u *salt; - int salt_len; + static void +bf_key_init(bfs, password, salt, salt_len) + bf_state_T *bfs; + char_u *password; + char_u *salt; + int salt_len; { int i, j, keypos = 0; unsigned u; @@ -418,7 +416,7 @@ bf_key_init(password, salt, salt_len) char_u *key; int keylen; - /* Process the key 1000 times. + /* Process the key 1001 times. * See http://en.wikipedia.org/wiki/Key_strengthening. */ key = sha256_key(password, salt, salt_len); for (i = 0; i < 1000; i++) @@ -437,52 +435,54 @@ bf_key_init(password, salt, salt_len) key[i] = u; } - mch_memmove(sbx, sbi, 4 * 4 * 256); + /* Use "key" to initialize the P-array ("pax") and S-boxes ("sbx") of + * Blowfish. */ + mch_memmove(bfs->sbx, sbx_init, 4 * 4 * 256); for (i = 0; i < 18; ++i) { val = 0; for (j = 0; j < 4; ++j) val = (val << 8) | key[keypos++ % keylen]; - pax[i] = ipa[i] ^ val; + bfs->pax[i] = pax_init[i] ^ val; } data_l = data_r = 0; for (i = 0; i < 18; i += 2) { - bf_e_block(&data_l, &data_r); - pax[i + 0] = data_l; - pax[i + 1] = data_r; + bf_e_block(bfs, &data_l, &data_r); + bfs->pax[i + 0] = data_l; + bfs->pax[i + 1] = data_r; } for (i = 0; i < 4; ++i) { for (j = 0; j < 256; j += 2) { - bf_e_block(&data_l, &data_r); - sbx[i][j + 0] = data_l; - sbx[i][j + 1] = data_r; + bf_e_block(bfs, &data_l, &data_r); + bfs->sbx[i][j + 0] = data_l; + bfs->sbx[i][j + 1] = data_r; } } } /* - * BF Self test for corrupted tables or instructions + * Blowfish self-test for corrupted tables or instructions. */ static int -bf_check_tables(a_ipa, a_sbi, val) - UINT32_T a_ipa[18]; - UINT32_T a_sbi[4][256]; +bf_check_tables(pax, sbx, val) + UINT32_T pax[18]; + UINT32_T sbx[4][256]; UINT32_T val; { int i, j; UINT32_T c = 0; for (i = 0; i < 18; i++) - c ^= a_ipa[i]; + c ^= pax[i]; for (i = 0; i < 4; i++) for (j = 0; j < 256; j++) - c ^= a_sbi[i][j]; + c ^= sbx[i][j]; return c == val; } @@ -520,6 +520,10 @@ bf_self_test() int err = 0; block8 bk; UINT32_T ui = 0xffffffffUL; + bf_state_T state; + + vim_memset(&state, 0, sizeof(bf_state_T)); + state.cfb_len = BF_MAX_CFB_LEN; /* We can't simply use sizeof(UINT32_T), it would generate a compiler * warning. */ @@ -528,21 +532,21 @@ bf_self_test() EMSG(_("E820: sizeof(uint32_t) != 4")); } - if (!bf_check_tables(ipa, sbi, 0x6ffa520a)) + if (!bf_check_tables(pax_init, sbx_init, 0x6ffa520a)) err++; bn = ARRAY_LENGTH(bf_test_data); for (i = 0; i < bn; i++) { - bf_key_init((char_u *)(bf_test_data[i].password), + bf_key_init(&state, (char_u *)(bf_test_data[i].password), bf_test_data[i].salt, (int)STRLEN(bf_test_data[i].salt)); - if (!bf_check_tables(pax, sbx, bf_test_data[i].keysum)) + if (!bf_check_tables(state.pax, state.sbx, bf_test_data[i].keysum)) err++; /* Don't modify bf_test_data[i].plaintxt, self test is idempotent. */ memcpy(bk.uc, bf_test_data[i].plaintxt, 8); - bf_e_cblock(bk.uc); + bf_e_cblock(&state, bk.uc); if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0) { if (err == 0 && memcmp(bk.uc, bf_test_data[i].badcryptxt, 8) == 0) @@ -554,43 +558,43 @@ bf_self_test() return err > 0 ? FAIL : OK; } -/* Cipher feedback mode. */ -static int randbyte_offset = 0; -static int update_offset = 0; -static char_u cfb_buffer[BF_CFB_LEN]; /* 64 bytes */ +/* + * CFB: Cipher Feedback Mode. + */ /* - * Initialize with seed "iv[iv_len]". + * Initialize with seed "seed[seed_len]". */ - void -bf_cfb_init(iv, iv_len) - char_u *iv; - int iv_len; + static void +bf_cfb_init(bfs, seed, seed_len) + bf_state_T *bfs; + char_u *seed; + int seed_len; { int i, mi; - randbyte_offset = update_offset = 0; - vim_memset(cfb_buffer, 0, BF_CFB_LEN); - if (iv_len > 0) + bfs->randbyte_offset = bfs->update_offset = 0; + vim_memset(bfs->cfb_buffer, 0, bfs->cfb_len); + if (seed_len > 0) { - mi = iv_len > BF_CFB_LEN ? iv_len : BF_CFB_LEN; + mi = seed_len > bfs->cfb_len ? seed_len : bfs->cfb_len; for (i = 0; i < mi; i++) - cfb_buffer[i % BF_CFB_LEN] ^= iv[i % iv_len]; + bfs->cfb_buffer[i % bfs->cfb_len] ^= seed[i % seed_len]; } } -#define BF_CFB_UPDATE(c) { \ - cfb_buffer[update_offset] ^= (char_u)c; \ - if (++update_offset == BF_CFB_LEN) \ - update_offset = 0; \ +#define BF_CFB_UPDATE(bfs, c) { \ + bfs->cfb_buffer[bfs->update_offset] ^= (char_u)c; \ + if (++bfs->update_offset == bfs->cfb_len) \ + bfs->update_offset = 0; \ } -#define BF_RANBYTE(t) { \ - if ((randbyte_offset & BF_BLOCK_MASK) == 0) \ - bf_e_cblock(&cfb_buffer[randbyte_offset]); \ - t = cfb_buffer[randbyte_offset]; \ - if (++randbyte_offset == BF_CFB_LEN) \ - randbyte_offset = 0; \ +#define BF_RANBYTE(bfs, t) { \ + if ((bfs->randbyte_offset & BF_BLOCK_MASK) == 0) \ + bf_e_cblock(bfs, &(bfs->cfb_buffer[bfs->randbyte_offset])); \ + t = bfs->cfb_buffer[bfs->randbyte_offset]; \ + if (++bfs->randbyte_offset == bfs->cfb_len) \ + bfs->randbyte_offset = 0; \ } /* @@ -598,90 +602,69 @@ bf_cfb_init(iv, iv_len) * "from" and "to" can be equal to encrypt in place. */ void -bf_crypt_encode(from, len, to) +crypt_blowfish_encode(state, from, len, to) + cryptstate_T *state; char_u *from; size_t len; char_u *to; { + bf_state_T *bfs = state->method_state; size_t i; int ztemp, t; for (i = 0; i < len; ++i) { ztemp = from[i]; - BF_RANBYTE(t); - BF_CFB_UPDATE(ztemp); + BF_RANBYTE(bfs, t); + BF_CFB_UPDATE(bfs, ztemp); to[i] = t ^ ztemp; } } /* - * Decrypt "ptr[len]" in place. + * Decrypt "from[len]" into "to[len]". */ void -bf_crypt_decode(ptr, len) - char_u *ptr; - long len; +crypt_blowfish_decode(state, from, len, to) + cryptstate_T *state; + char_u *from; + size_t len; + char_u *to; { - char_u *p; + bf_state_T *bfs = state->method_state; + size_t i; int t; - for (p = ptr; p < ptr + len; ++p) + for (i = 0; i < len; ++i) { - BF_RANBYTE(t); - *p ^= t; - BF_CFB_UPDATE(*p); + BF_RANBYTE(bfs, t); + to[i] = from[i] ^ t; + BF_CFB_UPDATE(bfs, to[i]); } } -/* - * Initialize the encryption keys and the random header according to - * the given password. - */ void -bf_crypt_init_keys(passwd) - char_u *passwd; /* password string with which to modify keys */ +crypt_blowfish_init(state, key, salt, salt_len, seed, seed_len) + cryptstate_T *state; + char_u* key; + char_u* salt; + int salt_len; + char_u* seed; + int seed_len; { - char_u *p; + bf_state_T *bfs = (bf_state_T *)alloc_clear(sizeof(bf_state_T)); - for (p = passwd; *p != NUL; ++p) - { - BF_CFB_UPDATE(*p); - } -} + state->method_state = bfs; -static int save_randbyte_offset; -static int save_update_offset; -static char_u save_cfb_buffer[BF_CFB_LEN]; -static UINT32_T save_pax[18]; -static UINT32_T save_sbx[4][256]; + /* "blowfish" uses a 64 byte buffer, causing it to repeat 8 byte groups 8 + * times. "blowfish2" uses a 8 byte buffer to avoid repeating. */ + bfs->cfb_len = state->method_nr == CRYPT_M_BF ? BF_MAX_CFB_LEN : BF_BLOCK; -/* - * Save the current crypt state. Can only be used once before - * bf_crypt_restore(). - */ - void -bf_crypt_save() -{ - save_randbyte_offset = randbyte_offset; - save_update_offset = update_offset; - mch_memmove(save_cfb_buffer, cfb_buffer, BF_CFB_LEN); - mch_memmove(save_pax, pax, 4 * 18); - mch_memmove(save_sbx, sbx, 4 * 4 * 256); -} + if (blowfish_self_test() == FAIL) + return; -/* - * Restore the current crypt state. Can only be used after - * bf_crypt_save(). - */ - void -bf_crypt_restore() -{ - randbyte_offset = save_randbyte_offset; - update_offset = save_update_offset; - mch_memmove(cfb_buffer, save_cfb_buffer, BF_CFB_LEN); - mch_memmove(pax, save_pax, 4 * 18); - mch_memmove(sbx, save_sbx, 4 * 4 * 256); + bf_key_init(bfs, key, salt, salt_len); + bf_cfb_init(bfs, seed, seed_len); } /* diff --git a/src/crypt.c b/src/crypt.c new file mode 100644 index 0000000000..758ffb17b2 --- /dev/null +++ b/src/crypt.c @@ -0,0 +1,585 @@ +/* vi:set ts=8 sts=4 sw=4: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * crypt.c: Generic encryption support. + */ +#include "vim.h" + +#if defined(FEAT_CRYPT) || defined(PROTO) +/* + * Optional encryption support. + * Mohsin Ahmed, mosh@sasi.com, 1998-09-24 + * Based on zip/crypt sources. + * Refactored by David Leadbeater, 2014. + * + * NOTE FOR USA: Since 2000 exporting this code from the USA is allowed to + * most countries. There are a few exceptions, but that still should not be a + * problem since this code was originally created in Europe and India. + * + * Blowfish addition originally made by Mohsin Ahmed, + * http://www.cs.albany.edu/~mosh 2010-03-14 + * Based on blowfish by Bruce Schneier (http://www.schneier.com/blowfish.html) + * and sha256 by Christophe Devine. + */ + +typedef struct { + char *name; /* encryption name as used in 'cryptmethod' */ + char *magic; /* magic bytes stored in file header */ + int salt_len; /* length of salt, or 0 when not using salt */ + int seed_len; /* length of seed, or 0 when not using salt */ + int works_inplace; /* encryption/decryption can be done in-place */ + int whole_undofile; /* whole undo file is encrypted */ + + /* Optional function pointer for a self-test. */ + int (* self_test_fn)(); + + /* Function pointer for initializing encryption/decription. */ + void (* init_fn)(cryptstate_T *state, char_u *key, + char_u *salt, int salt_len, char_u *seed, int seed_len); + + /* Function pointers for encoding/decoding from one buffer into another. + * Optional, however, these or the _buffer ones should be configured. */ + void (*encode_fn)(cryptstate_T *state, char_u *from, size_t len, + char_u *to); + void (*decode_fn)(cryptstate_T *state, char_u *from, size_t len, + char_u *to); + + /* Function pointers for encoding and decoding, can buffer data if needed. + * Optional (however, these or the above should be configured). */ + long (*encode_buffer_fn)(cryptstate_T *state, char_u *from, size_t len, + char_u **newptr); + long (*decode_buffer_fn)(cryptstate_T *state, char_u *from, size_t len, + char_u **newptr); + + /* Function pointers for in-place encoding and decoding, used for + * crypt_*_inplace(). "from" and "to" arguments will be equal. + * These may be the same as decode_fn and encode_fn above, however an + * algorithm may implement them in a way that is not interchangeable with + * the crypt_(en|de)code() interface (for example because it wishes to add + * padding to files). + * This method is used for swap and undo files which have a rigid format. + */ + void (*encode_inplace_fn)(cryptstate_T *state, char_u *p1, size_t len, + char_u *p2); + void (*decode_inplace_fn)(cryptstate_T *state, char_u *p1, size_t len, + char_u *p2); +} cryptmethod_T; + +/* index is method_nr of cryptstate_T, CRYPT_M_* */ +static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = { + /* PK_Zip; very weak */ + { + "zip", + "VimCrypt~01!", + 0, + 0, + TRUE, + FALSE, + NULL, + crypt_zip_init, + crypt_zip_encode, crypt_zip_decode, + NULL, NULL, + crypt_zip_encode, crypt_zip_decode, + }, + + /* Blowfish/CFB + SHA-256 custom key derivation; implementation issues. */ + { + "blowfish", + "VimCrypt~02!", + 8, + 8, + TRUE, + FALSE, + blowfish_self_test, + crypt_blowfish_init, + crypt_blowfish_encode, crypt_blowfish_decode, + NULL, NULL, + crypt_blowfish_encode, crypt_blowfish_decode, + }, + + /* Blowfish/CFB + SHA-256 custom key derivation; fixed. */ + { + "blowfish2", + "VimCrypt~03!", + 8, + 8, + TRUE, + TRUE, + blowfish_self_test, + crypt_blowfish_init, + crypt_blowfish_encode, crypt_blowfish_decode, + NULL, NULL, + crypt_blowfish_encode, crypt_blowfish_decode, + }, +}; + +#define CRYPT_MAGIC_LEN 12 /* cannot change */ +static char crypt_magic_head[] = "VimCrypt~"; + +/* + * Return int value for crypt method name. + * 0 for "zip", the old method. Also for any non-valid value. + * 1 for "blowfish". + * 2 for "blowfish2". + */ + int +crypt_method_nr_from_name(name) + char_u *name; +{ + int i; + + for (i = 0; i < CRYPT_M_COUNT; ++i) + if (STRCMP(name, cryptmethods[i].name) == 0) + return i; + return 0; +} + +/* + * Get the crypt method used for a file from "ptr[len]", the magic text at the + * start of the file. + * Returns -1 when no encryption used. + */ + int +crypt_method_nr_from_magic(ptr, len) + char *ptr; + int len; +{ + int i; + + if (len < CRYPT_MAGIC_LEN) + return -1; + + for (i = 0; i < CRYPT_M_COUNT; i++) + if (memcmp(ptr, cryptmethods[i].magic, CRYPT_MAGIC_LEN) == 0) + return i; + + i = (int)STRLEN(crypt_magic_head); + if (len >= i && memcmp(ptr, crypt_magic_head, i) == 0) + EMSG(_("E821: File is encrypted with unknown method")); + + return -1; +} + +/* + * Return TRUE if the crypt method for "method_nr" can be done in-place. + */ + int +crypt_works_inplace(state) + cryptstate_T *state; +{ + return cryptmethods[state->method_nr].works_inplace; +} + +/* + * Get the crypt method for buffer "buf" as a number. + */ + int +crypt_get_method_nr(buf) + buf_T *buf; +{ + return crypt_method_nr_from_name(*buf->b_p_cm == NUL ? p_cm : buf->b_p_cm); +} + +/* + * Return TRUE when the buffer uses an encryption method that encrypts the + * whole undo file, not only the text. + */ + int +crypt_whole_undofile(method_nr) + int method_nr; +{ + return cryptmethods[method_nr].whole_undofile; +} + +/* + * Get crypt method specifc length of the file header in bytes. + */ + int +crypt_get_header_len(method_nr) + int method_nr; +{ + return CRYPT_MAGIC_LEN + + cryptmethods[method_nr].salt_len + + cryptmethods[method_nr].seed_len; +} + +/* + * Set the crypt method for buffer "buf" to "method_nr" using the int value as + * returned by crypt_method_nr_from_name(). + */ + void +crypt_set_cm_option(buf, method_nr) + buf_T *buf; + int method_nr; +{ + free_string_option(buf->b_p_cm); + buf->b_p_cm = vim_strsave((char_u *)cryptmethods[method_nr].name); +} + +/* + * If the crypt method for the current buffer has a self-test, run it and + * return OK/FAIL. + */ + int +crypt_self_test() +{ + int method_nr = crypt_get_method_nr(curbuf); + + if (cryptmethods[method_nr].self_test_fn == NULL) + return OK; + return cryptmethods[method_nr].self_test_fn(); +} + +/* + * Allocate a crypt state and initialize it. + */ + cryptstate_T * +crypt_create(method_nr, key, salt, salt_len, seed, seed_len) + int method_nr; + char_u *key; + char_u *salt; + int salt_len; + char_u *seed; + int seed_len; +{ + cryptstate_T *state = (cryptstate_T *)alloc((int)sizeof(cryptstate_T)); + + state->method_nr = method_nr; + cryptmethods[method_nr].init_fn(state, key, salt, salt_len, seed, seed_len); + return state; +} + +/* + * Allocate a crypt state from a file header and initialize it. + * Assumes that header contains at least the number of bytes that + * crypt_get_header_len() returns for "method_nr". + */ + cryptstate_T * +crypt_create_from_header(method_nr, key, header) + int method_nr; + char_u *key; + char_u *header; +{ + char_u *salt = NULL; + char_u *seed = NULL; + int salt_len = cryptmethods[method_nr].salt_len; + int seed_len = cryptmethods[method_nr].seed_len; + + if (salt_len > 0) + salt = header + CRYPT_MAGIC_LEN; + if (seed_len > 0) + seed = header + CRYPT_MAGIC_LEN + salt_len; + + return crypt_create(method_nr, key, salt, salt_len, seed, seed_len); +} + +/* + * Read the crypt method specific header data from "fp". + * Return an allocated cryptstate_T or NULL on error. + */ + cryptstate_T * +crypt_create_from_file(fp, key) + FILE *fp; + char_u *key; +{ + int method_nr; + int header_len; + char magic_buffer[CRYPT_MAGIC_LEN]; + char_u *buffer; + cryptstate_T *state; + + if (fread(magic_buffer, CRYPT_MAGIC_LEN, 1, fp) != 1) + return NULL; + method_nr = crypt_method_nr_from_magic(magic_buffer, CRYPT_MAGIC_LEN); + if (method_nr < 0) + return NULL; + + header_len = crypt_get_header_len(method_nr); + if ((buffer = alloc(header_len)) == NULL) + return NULL; + mch_memmove(buffer, magic_buffer, CRYPT_MAGIC_LEN); + if (header_len > CRYPT_MAGIC_LEN + && fread(buffer + CRYPT_MAGIC_LEN, + header_len - CRYPT_MAGIC_LEN, 1, fp) != 1) + { + vim_free(buffer); + return NULL; + } + + state = crypt_create_from_header(method_nr, key, buffer); + vim_free(buffer); + return state; +} + +/* + * Allocate a cryptstate_T for writing and initialize it with "key". + * Allocates and fills in the header and stores it in "header", setting + * "header_len". The header may include salt and seed, depending on + * cryptmethod. Caller must free header. + * Returns the state or NULL on failure. + */ + cryptstate_T * +crypt_create_for_writing(method_nr, key, header, header_len) + int method_nr; + char_u *key; + char_u **header; + int *header_len; +{ + int len = crypt_get_header_len(method_nr); + char_u *salt = NULL; + char_u *seed = NULL; + int salt_len = cryptmethods[method_nr].salt_len; + int seed_len = cryptmethods[method_nr].seed_len; + cryptstate_T *state; + + *header_len = len; + *header = alloc(len); + if (*header == NULL) + return NULL; + + mch_memmove(*header, cryptmethods[method_nr].magic, CRYPT_MAGIC_LEN); + if (salt_len > 0 || seed_len > 0) + { + if (salt_len > 0) + salt = *header + CRYPT_MAGIC_LEN; + if (seed_len > 0) + seed = *header + CRYPT_MAGIC_LEN + salt_len; + + /* TODO: Should this be crypt method specific? (Probably not worth + * it). sha2_seed is pretty bad for large amounts of entropy, so make + * that into something which is suitable for anything. */ + sha2_seed(salt, salt_len, seed, seed_len); + } + + state = crypt_create(method_nr, key, salt, salt_len, seed, seed_len); + if (state == NULL) + { + vim_free(*header); + *header = NULL; + } + return state; +} + +/* + * Free the crypt state. + */ + void +crypt_free_state(state) + cryptstate_T *state; +{ + vim_free(state->method_state); + vim_free(state); +} + +/* + * Encode "from[len]" and store the result in a newly allocated buffer, which + * is stored in "newptr". + * Return number of bytes in "newptr", 0 for need more or -1 on error. + */ + long +crypt_encode_alloc(state, from, len, newptr) + cryptstate_T *state; + char_u *from; + size_t len; + char_u **newptr; +{ + cryptmethod_T *method = &cryptmethods[state->method_nr]; + + if (method->encode_buffer_fn != NULL) + /* Has buffer function, pass through. */ + return method->encode_buffer_fn(state, from, len, newptr); + if (len == 0) + /* Not buffering, just return EOF. */ + return len; + + *newptr = alloc(len); + if (*newptr == NULL) + return -1; + method->encode_fn(state, from, len, *newptr); + return len; +} + +/* + * Decrypt "ptr[len]" and store the result in a newly allocated buffer, which + * is stored in "newptr". + * Return number of bytes in "newptr", 0 for need more or -1 on error. + */ + long +crypt_decode_alloc(state, ptr, len, newptr) + cryptstate_T *state; + char_u *ptr; + long len; + char_u **newptr; +{ + cryptmethod_T *method = &cryptmethods[state->method_nr]; + + if (method->decode_buffer_fn != NULL) + /* Has buffer function, pass through. */ + return method->decode_buffer_fn(state, ptr, len, newptr); + + if (len == 0) + /* Not buffering, just return EOF. */ + return len; + + *newptr = alloc(len); + if (*newptr == NULL) + return -1; + method->decode_fn(state, ptr, len, *newptr); + return len; +} + +/* + * Encrypting "from[len]" into "to[len]". + */ + void +crypt_encode(state, from, len, to) + cryptstate_T *state; + char_u *from; + size_t len; + char_u *to; +{ + cryptmethods[state->method_nr].encode_fn(state, from, len, to); +} + +/* + * decrypting "from[len]" into "to[len]". + */ + void +crypt_decode(state, from, len, to) + cryptstate_T *state; + char_u *from; + size_t len; + char_u *to; +{ + cryptmethods[state->method_nr].decode_fn(state, from, len, to); +} + +/* + * Simple inplace encryption, modifies "buf[len]" in place. + */ + void +crypt_encode_inplace(state, buf, len) + cryptstate_T *state; + char_u *buf; + size_t len; +{ + cryptmethods[state->method_nr].encode_inplace_fn(state, buf, len, buf); +} + +/* + * Simple inplace decryption, modifies "buf[len]" in place. + */ + void +crypt_decode_inplace(state, buf, len) + cryptstate_T *state; + char_u *buf; + size_t len; +{ + cryptmethods[state->method_nr].decode_inplace_fn(state, buf, len, buf); +} + +/* + * Free an allocated crypt key. Clear the text to make sure it doesn't stay + * in memory anywhere. + */ + void +crypt_free_key(key) + char_u *key; +{ + char_u *p; + + if (key != NULL) + { + for (p = key; *p != NUL; ++p) + *p = 0; + vim_free(key); + } +} + +/* + * Ask the user for a crypt key. + * When "store" is TRUE, the new key is stored in the 'key' option, and the + * 'key' option value is returned: Don't free it. + * When "store" is FALSE, the typed key is returned in allocated memory. + * Returns NULL on failure. + */ + char_u * +crypt_get_key(store, twice) + int store; + int twice; /* Ask for the key twice. */ +{ + char_u *p1, *p2 = NULL; + int round; + + for (round = 0; ; ++round) + { + cmdline_star = TRUE; + cmdline_row = msg_row; + p1 = getcmdline_prompt(NUL, round == 0 + ? (char_u *)_("Enter encryption key: ") + : (char_u *)_("Enter same key again: "), 0, EXPAND_NOTHING, + NULL); + cmdline_star = FALSE; + + if (p1 == NULL) + break; + + if (round == twice) + { + if (p2 != NULL && STRCMP(p1, p2) != 0) + { + MSG(_("Keys don't match!")); + crypt_free_key(p1); + crypt_free_key(p2); + p2 = NULL; + round = -1; /* do it again */ + continue; + } + + if (store) + { + set_option_value((char_u *)"key", 0L, p1, OPT_LOCAL); + crypt_free_key(p1); + p1 = curbuf->b_p_key; + } + break; + } + p2 = p1; + } + + /* since the user typed this, no need to wait for return */ + if (msg_didout) + msg_putchar('\n'); + need_wait_return = FALSE; + msg_didout = FALSE; + + crypt_free_key(p2); + return p1; +} + + +/* + * Append a message to IObuff for the encryption/decryption method being used. + */ + void +crypt_append_msg(buf) + buf_T *buf; +{ + if (crypt_get_method_nr(buf) == 0) + STRCAT(IObuff, _("[crypted]")); + else + { + STRCAT(IObuff, "["); + STRCAT(IObuff, *buf->b_p_cm == NUL ? p_cm : buf->b_p_cm); + STRCAT(IObuff, "]"); + } +} + +#endif /* FEAT_CRYPT */ diff --git a/src/crypt_zip.c b/src/crypt_zip.c new file mode 100644 index 0000000000..571f3ec746 --- /dev/null +++ b/src/crypt_zip.c @@ -0,0 +1,158 @@ +/* vi:set ts=8 sts=4 sw=4: + * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + */ + +/* + * crypt_zip.c: Zip encryption support. + */ +#include "vim.h" + +#if defined(FEAT_CRYPT) || defined(PROTO) +/* + * Optional encryption support. + * Mohsin Ahmed, mosh@sasi.com, 98-09-24 + * Based on zip/crypt sources. + * + * NOTE FOR USA: Since 2000 exporting this code from the USA is allowed to + * most countries. There are a few exceptions, but that still should not be a + * problem since this code was originally created in Europe and India. + */ + +/* Need a type that should be 32 bits. 64 also works but wastes space. */ +# if VIM_SIZEOF_INT >= 4 +typedef unsigned int u32_T; /* int is at least 32 bits */ +# else +typedef unsigned long u32_T; /* long should be 32 bits or more */ +# endif + +/* The state of encryption, referenced by cryptstate_T. */ +typedef struct { + u32_T keys[3]; +} zip_state_T; + + +static void make_crc_tab __ARGS((void)); + +static u32_T crc_32_table[256]; + +/* + * Fill the CRC table, if not done already. + */ + static void +make_crc_tab() +{ + u32_T s, t, v; + static int done = FALSE; + + if (done) + return; + for (t = 0; t < 256; t++) + { + v = t; + for (s = 0; s < 8; s++) + v = (v >> 1) ^ ((v & 1) * (u32_T)0xedb88320L); + crc_32_table[t] = v; + } + done = TRUE; +} + +#define CRC32(c, b) (crc_32_table[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8)) + +/* + * Return the next byte in the pseudo-random sequence. + */ +#define DECRYPT_BYTE_ZIP(keys, t) { \ + short_u temp = (short_u)keys[2] | 2; \ + t = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); \ +} + +/* + * Update the encryption keys with the next byte of plain text. + */ +#define UPDATE_KEYS_ZIP(keys, c) { \ + keys[0] = CRC32(keys[0], (c)); \ + keys[1] += keys[0] & 0xff; \ + keys[1] = keys[1] * 134775813L + 1; \ + keys[2] = CRC32(keys[2], (int)(keys[1] >> 24)); \ +} + +/* + * Initialize for encryption/decryption. + */ + void +crypt_zip_init(state, key, salt, salt_len, seed, seed_len) + cryptstate_T *state; + char_u *key; + char_u *salt UNUSED; + int salt_len UNUSED; + char_u *seed UNUSED; + int seed_len UNUSED; +{ + char_u *p; + zip_state_T *zs; + + zs = (zip_state_T *)alloc(sizeof(zip_state_T)); + state->method_state = zs; + + make_crc_tab(); + zs->keys[0] = 305419896L; + zs->keys[1] = 591751049L; + zs->keys[2] = 878082192L; + for (p = key; *p != NUL; ++p) + { + UPDATE_KEYS_ZIP(zs->keys, (int)*p); + } +} + +/* + * Encrypt "from[len]" into "to[len]". + * "from" and "to" can be equal to encrypt in place. + */ + void +crypt_zip_encode(state, from, len, to) + cryptstate_T *state; + char_u *from; + size_t len; + char_u *to; +{ + zip_state_T *zs = state->method_state; + size_t i; + int ztemp, t; + + for (i = 0; i < len; ++i) + { + ztemp = from[i]; + DECRYPT_BYTE_ZIP(zs->keys, t); + UPDATE_KEYS_ZIP(zs->keys, ztemp); + to[i] = t ^ ztemp; + } +} + +/* + * Decrypt "from[len]" into "to[len]". + */ + void +crypt_zip_decode(state, from, len, to) + cryptstate_T *state; + char_u *from; + size_t len; + char_u *to; +{ + zip_state_T *zs = state->method_state; + size_t i; + short_u temp; + + for (i = 0; i < len; ++i) + { + temp = (short_u)zs->keys[2] | 2; + temp = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); + UPDATE_KEYS_ZIP(zs->keys, to[i] = from[i] ^ temp); + } +} + +#endif /* FEAT_CRYPT */ diff --git a/src/ex_docmd.c b/src/ex_docmd.c index ba764bfcf6..fecb653b54 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -11506,8 +11506,7 @@ ex_match(eap) ex_X(eap) exarg_T *eap UNUSED; { - if (get_crypt_method(curbuf) == 0 || blowfish_self_test() == OK) - (void)get_crypt_key(TRUE, TRUE); + (void)crypt_get_key(TRUE, TRUE); } #endif diff --git a/src/fileio.c b/src/fileio.c index 38dc2597da..a028b22a5c 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -24,20 +24,6 @@ #define BUFSIZE 8192 /* size of normal write buffer */ #define SMBUFSIZE 256 /* size of emergency write buffer */ -#ifdef FEAT_CRYPT -/* crypt_magic[0] is pkzip crypt, crypt_magic[1] is sha2+blowfish */ -static char *crypt_magic[] = {"VimCrypt~01!", "VimCrypt~02!"}; -static char crypt_magic_head[] = "VimCrypt~"; -# define CRYPT_MAGIC_LEN 12 /* must be multiple of 4! */ - -/* For blowfish, after the magic header, we store 8 bytes of salt and then 8 - * bytes of seed (initialisation vector). */ -static int crypt_salt_len[] = {0, 8}; -static int crypt_seed_len[] = {0, 8}; -#define CRYPT_SALT_LEN_MAX 8 -#define CRYPT_SEED_LEN_MAX 8 -#endif - /* Is there any system that doesn't have access()? */ #define USE_MCH_ACCESS @@ -55,7 +41,6 @@ static char_u *readfile_charconvert __ARGS((char_u *fname, char_u *fenc, int *fd static void check_marks_read __ARGS((void)); #endif #ifdef FEAT_CRYPT -static int crypt_method_from_magic __ARGS((char *ptr, int len)); static char_u *check_for_cryptkey __ARGS((char_u *cryptkey, char_u *ptr, long *sizep, off_t *filesizep, int newfile, char_u *fname, int *did_ask)); #endif #ifdef UNIX @@ -116,6 +101,9 @@ struct bw_info #ifdef HAS_BW_FLAGS int bw_flags; /* FIO_ flags */ #endif +#ifdef FEAT_CRYPT + buf_T *bw_buffer; /* buffer being written */ +#endif #ifdef FEAT_MBYTE char_u bw_rest[CONV_RESTLEN]; /* not converted bytes */ int bw_restlen; /* nr of bytes in bw_rest[] */ @@ -250,7 +238,6 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags) #ifdef FEAT_CRYPT char_u *cryptkey = NULL; int did_ask_for_key = FALSE; - int crypt_method_used; #endif #ifdef FEAT_PERSISTENT_UNDO context_sha256_T sha_ctx; @@ -966,13 +953,6 @@ retry: #endif } -#ifdef FEAT_CRYPT - if (cryptkey != NULL) - /* Need to reset the state, but keep the key, don't want to ask for it - * again. */ - crypt_pop_state(); -#endif - /* * When retrying with another "fenc" and the first time "fileformat" * will be reset. @@ -1174,6 +1154,15 @@ retry: && !read_buffer); if (read_undo_file) sha256_start(&sha_ctx); +#endif +#ifdef FEAT_CRYPT + if (curbuf->b_cryptstate != NULL) + { + /* Need to free the state, but keep the key, don't want to ask for + * it again. */ + crypt_free_state(curbuf->b_cryptstate); + curbuf->b_cryptstate = NULL; + } #endif } @@ -1339,6 +1328,76 @@ retry: size = read_eintr(fd, ptr, size); } +#ifdef FEAT_CRYPT + /* + * At start of file: Check for magic number of encryption. + */ + if (filesize == 0 && size > 0) + cryptkey = check_for_cryptkey(cryptkey, ptr, &size, + &filesize, newfile, sfname, + &did_ask_for_key); + /* + * Decrypt the read bytes. This is done before checking for + * EOF because the crypt layer may be buffering. + */ + if (cryptkey != NULL && size > 0) + { + if (crypt_works_inplace(curbuf->b_cryptstate)) + { + crypt_decode_inplace(curbuf->b_cryptstate, ptr, size); + } + else + { + char_u *newptr = NULL; + int decrypted_size; + + decrypted_size = crypt_decode_alloc( + curbuf->b_cryptstate, ptr, size, &newptr); + + /* If the crypt layer is buffering, not producing + * anything yet, need to read more. */ + if (size > 0 && decrypted_size == 0) + continue; + + if (linerest == 0) + { + /* Simple case: reuse returned buffer (may be + * NULL, checked later). */ + new_buffer = newptr; + } + else + { + long_u new_size; + + /* Need new buffer to add bytes carried over. */ + new_size = (long_u)(decrypted_size + linerest + 1); + new_buffer = lalloc(new_size, FALSE); + if (new_buffer == NULL) + { + do_outofmem_msg(new_size); + error = TRUE; + break; + } + + mch_memmove(new_buffer, buffer, linerest); + if (newptr != NULL) + mch_memmove(new_buffer + linerest, newptr, + decrypted_size); + } + + if (new_buffer != NULL) + { + vim_free(buffer); + buffer = new_buffer; + new_buffer = NULL; + line_start = buffer; + ptr = buffer + linerest; + } + size = decrypted_size; + } + } +#endif + if (size <= 0) { if (size < 0) /* read error */ @@ -1403,21 +1462,6 @@ retry: } #endif } - -#ifdef FEAT_CRYPT - /* - * At start of file: Check for magic number of encryption. - */ - if (filesize == 0) - cryptkey = check_for_cryptkey(cryptkey, ptr, &size, - &filesize, newfile, sfname, - &did_ask_for_key); - /* - * Decrypt the read bytes. - */ - if (cryptkey != NULL && size > 0) - crypt_decode(ptr, size); -#endif } skip_read = FALSE; @@ -1430,10 +1474,9 @@ retry: */ if ((filesize == 0 # ifdef FEAT_CRYPT - || (filesize == (CRYPT_MAGIC_LEN - + crypt_salt_len[use_crypt_method] - + crypt_seed_len[use_crypt_method]) - && cryptkey != NULL) + || (cryptkey != NULL + && filesize == crypt_get_header_len( + crypt_get_method_nr(curbuf))) # endif ) && (fio_flags == FIO_UCSBOM @@ -2262,15 +2305,15 @@ failed: save_file_ff(curbuf); /* remember the current file format */ #ifdef FEAT_CRYPT - crypt_method_used = use_crypt_method; - if (cryptkey != NULL) + if (curbuf->b_cryptstate != NULL) { - crypt_pop_state(); - if (cryptkey != curbuf->b_p_key) - free_crypt_key(cryptkey); - /* don't set cryptkey to NULL, it's used below as a flag that - * encryption was used */ + crypt_free_state(curbuf->b_cryptstate); + curbuf->b_cryptstate = NULL; } + if (cryptkey != NULL && cryptkey != curbuf->b_p_key) + crypt_free_key(cryptkey); + /* Don't set cryptkey to NULL, it's used below as a flag that + * encryption was used. */ #endif #ifdef FEAT_MBYTE @@ -2457,10 +2500,7 @@ failed: #ifdef FEAT_CRYPT if (cryptkey != NULL) { - if (crypt_method_used == 1) - STRCAT(IObuff, _("[blowfish]")); - else - STRCAT(IObuff, _("[crypted]")); + crypt_append_msg(curbuf); c = TRUE; } #endif @@ -2489,9 +2529,7 @@ failed: #ifdef FEAT_CRYPT if (cryptkey != NULL) msg_add_lines(c, (long)linecnt, filesize - - CRYPT_MAGIC_LEN - - crypt_salt_len[use_crypt_method] - - crypt_seed_len[use_crypt_method]); + - crypt_get_header_len(crypt_get_method_nr(curbuf))); else #endif msg_add_lines(c, (long)linecnt, filesize); @@ -2881,33 +2919,6 @@ check_marks_read() #endif #if defined(FEAT_CRYPT) || defined(PROTO) -/* - * Get the crypt method used for a file from "ptr[len]", the magic text at the - * start of the file. - * Returns -1 when no encryption used. - */ - static int -crypt_method_from_magic(ptr, len) - char *ptr; - int len; -{ - int i; - - for (i = 0; i < (int)(sizeof(crypt_magic) / sizeof(crypt_magic[0])); i++) - { - if (len < (CRYPT_MAGIC_LEN + crypt_salt_len[i] + crypt_seed_len[i])) - continue; - if (memcmp(ptr, crypt_magic[i], CRYPT_MAGIC_LEN) == 0) - return i; - } - - i = (int)STRLEN(crypt_magic_head); - if (len >= i && memcmp(ptr, crypt_magic_head, i) == 0) - EMSG(_("E821: File is encrypted with unknown method")); - - return -1; -} - /* * Check for magic number used for encryption. Applies to the current buffer. * If found, the magic number is removed from ptr[*sizep] and *sizep and @@ -2924,7 +2935,7 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) char_u *fname; /* file name to display */ int *did_ask; /* flag: whether already asked for key */ { - int method = crypt_method_from_magic((char *)ptr, *sizep); + int method = crypt_method_nr_from_magic((char *)ptr, *sizep); int b_p_ro = curbuf->b_p_ro; if (method >= 0) @@ -2933,9 +2944,7 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) * Avoids accidentally overwriting the file with garbage. */ curbuf->b_p_ro = TRUE; - set_crypt_method(curbuf, method); - if (method > 0) - (void)blowfish_self_test(); + crypt_set_cm_option(curbuf, method); if (cryptkey == NULL && !*did_ask) { if (*curbuf->b_p_key) @@ -2948,7 +2957,7 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) * Happens when retrying to detect encoding. */ smsg((char_u *)_(need_key_msg), fname); msg_scroll = TRUE; - cryptkey = get_crypt_key(newfile, FALSE); + cryptkey = crypt_get_key(newfile, FALSE); *did_ask = TRUE; /* check if empty key entered */ @@ -2963,24 +2972,18 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) if (cryptkey != NULL) { - int seed_len = crypt_seed_len[method]; - int salt_len = crypt_salt_len[method]; + int header_len; - crypt_push_state(); - use_crypt_method = method; - if (method == 0) - crypt_init_keys(cryptkey); - else - { - bf_key_init(cryptkey, ptr + CRYPT_MAGIC_LEN, salt_len); - bf_cfb_init(ptr + CRYPT_MAGIC_LEN + salt_len, seed_len); - } + curbuf->b_cryptstate = crypt_create_from_header( + method, cryptkey, ptr); + crypt_set_cm_option(curbuf, method); + + /* Remove cryptmethod specific header from the text. */ + header_len = crypt_get_header_len(method); + *filesizep += header_len; + *sizep -= header_len; + mch_memmove(ptr, ptr + header_len, (size_t)*sizep); - /* Remove magic number from the text */ - *filesizep += CRYPT_MAGIC_LEN + salt_len + seed_len; - *sizep -= CRYPT_MAGIC_LEN + salt_len + seed_len; - mch_memmove(ptr, ptr + CRYPT_MAGIC_LEN + salt_len + seed_len, - (size_t)*sizep); /* Restore the read-only flag. */ curbuf->b_p_ro = b_p_ro; } @@ -2992,85 +2995,6 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) return cryptkey; } - -/* - * Check for magic number used for encryption. Applies to the current buffer. - * If found and decryption is possible returns OK; - */ - int -prepare_crypt_read(fp) - FILE *fp; -{ - int method; - char_u buffer[CRYPT_MAGIC_LEN + CRYPT_SALT_LEN_MAX - + CRYPT_SEED_LEN_MAX + 2]; - - if (fread(buffer, CRYPT_MAGIC_LEN, 1, fp) != 1) - return FAIL; - method = crypt_method_from_magic((char *)buffer, - CRYPT_MAGIC_LEN + - CRYPT_SEED_LEN_MAX + - CRYPT_SALT_LEN_MAX); - if (method < 0 || method != get_crypt_method(curbuf)) - return FAIL; - - crypt_push_state(); - if (method == 0) - crypt_init_keys(curbuf->b_p_key); - else - { - int salt_len = crypt_salt_len[method]; - int seed_len = crypt_seed_len[method]; - - if (fread(buffer, salt_len + seed_len, 1, fp) != 1) - return FAIL; - bf_key_init(curbuf->b_p_key, buffer, salt_len); - bf_cfb_init(buffer + salt_len, seed_len); - } - return OK; -} - -/* - * Prepare for writing encrypted bytes for buffer "buf". - * Returns a pointer to an allocated header of length "*lenp". - * When out of memory returns NULL. - * Otherwise calls crypt_push_state(), call crypt_pop_state() later. - */ - char_u * -prepare_crypt_write(buf, lenp) - buf_T *buf; - int *lenp; -{ - char_u *header; - int seed_len = crypt_seed_len[get_crypt_method(buf)]; - int salt_len = crypt_salt_len[get_crypt_method(buf)]; - char_u *salt; - char_u *seed; - - header = alloc_clear(CRYPT_MAGIC_LEN + CRYPT_SALT_LEN_MAX - + CRYPT_SEED_LEN_MAX + 2); - if (header != NULL) - { - crypt_push_state(); - use_crypt_method = get_crypt_method(buf); /* select zip or blowfish */ - vim_strncpy(header, (char_u *)crypt_magic[use_crypt_method], - CRYPT_MAGIC_LEN); - if (use_crypt_method == 0) - crypt_init_keys(buf->b_p_key); - else - { - /* Using blowfish, add salt and seed. */ - salt = header + CRYPT_MAGIC_LEN; - seed = salt + salt_len; - sha2_seed(salt, salt_len, seed, seed_len); - bf_key_init(buf->b_p_key, salt, salt_len); - bf_cfb_init(seed, seed_len); - } - } - *lenp = CRYPT_MAGIC_LEN + salt_len + seed_len; - return header; -} - #endif /* FEAT_CRYPT */ #ifdef UNIX @@ -3224,9 +3148,6 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, int write_undo_file = FALSE; context_sha256_T sha_ctx; #endif -#ifdef FEAT_CRYPT - int crypt_method_used; -#endif if (fname == NULL || *fname == NUL) /* safety check */ return FAIL; @@ -3261,6 +3182,9 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, # ifdef USE_ICONV write_info.bw_iconv_fd = (iconv_t)-1; # endif +#endif +#ifdef FEAT_CRYPT + write_info.bw_buffer = buf; #endif /* After writing a file changedtick changes but we don't want to display @@ -4505,17 +4429,17 @@ restore_backup: #ifdef FEAT_CRYPT if (*buf->b_p_key != NUL && !filtering) { - char_u *header; - int header_len; + char_u *header; + int header_len; - header = prepare_crypt_write(buf, &header_len); - if (header == NULL) + buf->b_cryptstate = crypt_create_for_writing(crypt_get_method_nr(buf), + buf->b_p_key, &header, &header_len); + if (buf->b_cryptstate == NULL || header == NULL) end = 0; else { - /* Write magic number, so that Vim knows that this file is - * encrypted when reading it again. This also undergoes utf-8 to - * ucs-2/4 conversion when needed. */ + /* Write magic number, so that Vim knows how this file is + * encrypted when reading it back. */ write_info.bw_buf = header; write_info.bw_len = header_len; write_info.bw_flags = FIO_NOCONVERT; @@ -4769,12 +4693,13 @@ restore_backup: mch_set_acl(wfname, acl); #endif #ifdef FEAT_CRYPT - crypt_method_used = use_crypt_method; - if (wb_flags & FIO_ENCRYPTED) - crypt_pop_state(); + if (buf->b_cryptstate != NULL) + { + crypt_free_state(buf->b_cryptstate); + buf->b_cryptstate = NULL; + } #endif - #if defined(FEAT_MBYTE) && defined(FEAT_EVAL) if (wfname != fname) { @@ -4924,10 +4849,7 @@ restore_backup: #ifdef FEAT_CRYPT if (wb_flags & FIO_ENCRYPTED) { - if (crypt_method_used == 1) - STRCAT(IObuff, _("[blowfish]")); - else - STRCAT(IObuff, _("[crypted]")); + crypt_append_msg(buf); c = TRUE; } #endif @@ -5740,8 +5662,26 @@ buf_write_bytes(ip) #endif /* FEAT_MBYTE */ #ifdef FEAT_CRYPT - if (flags & FIO_ENCRYPTED) /* encrypt the data */ - crypt_encode(buf, len, buf); + if (flags & FIO_ENCRYPTED) + { + /* Encrypt the data. Do it in-place if possible, otherwise use an + * allocated buffer. */ + if (crypt_works_inplace(ip->bw_buffer->b_cryptstate)) + { + crypt_encode_inplace(ip->bw_buffer->b_cryptstate, buf, len); + } + else + { + char_u *outbuf; + + len = crypt_encode_alloc(curbuf->b_cryptstate, buf, len, &outbuf); + if (len == 0) + return OK; /* Crypt layer is buffering, will flush later. */ + wlen = write_eintr(ip->bw_fd, outbuf, len); + vim_free(outbuf); + return (wlen < len) ? FAIL : OK; + } + } #endif wlen = write_eintr(ip->bw_fd, buf, len); diff --git a/src/globals.h b/src/globals.h index ce831f33d9..d1fdc33acc 100644 --- a/src/globals.h +++ b/src/globals.h @@ -105,10 +105,6 @@ EXTERN int exec_from_reg INIT(= FALSE); /* executing register */ EXTERN int screen_cleared INIT(= FALSE); /* screen has been cleared */ -#ifdef FEAT_CRYPT -EXTERN int use_crypt_method INIT(= 0); -#endif - /* * When '$' is included in 'cpoptions' option set: * When a change command is given that deletes only part of a line, a dollar diff --git a/src/main.c b/src/main.c index 9c92f7a844..2fb2edcb59 100644 --- a/src/main.c +++ b/src/main.c @@ -846,8 +846,7 @@ vim_main2(int argc UNUSED, char **argv UNUSED) #ifdef FEAT_CRYPT if (params.ask_for_key) { - (void)blowfish_self_test(); - (void)get_crypt_key(TRUE, TRUE); + (void)crypt_get_key(TRUE, TRUE); TIME_MSG("getting crypt key"); } #endif diff --git a/src/memline.c b/src/memline.c index fb438d273e..a5053f0233 100644 --- a/src/memline.c +++ b/src/memline.c @@ -63,6 +63,15 @@ typedef struct pointer_entry PTR_EN; /* block/line-count pair */ #define BLOCK0_ID1 '0' /* block 0 id 1 */ #define BLOCK0_ID1_C0 'c' /* block 0 id 1 'cm' 0 */ #define BLOCK0_ID1_C1 'C' /* block 0 id 1 'cm' 1 */ +#define BLOCK0_ID1_C2 'd' /* block 0 id 1 'cm' 2 */ + +#if defined(FEAT_CRYPT) +static int id1_codes[] = { + BLOCK0_ID1_C0, /* CRYPT_M_ZIP */ + BLOCK0_ID1_C1, /* CRYPT_M_BF */ + BLOCK0_ID1_C2, /* CRYPT_M_BF2 */ +}; +#endif /* * pointer to a block, used in a pointer block @@ -151,7 +160,7 @@ struct data_block struct block0 { char_u b0_id[2]; /* id for block 0: BLOCK0_ID0 and BLOCK0_ID1, - * BLOCK0_ID1_C0, BLOCK0_ID1_C1 */ + * BLOCK0_ID1_C0, BLOCK0_ID1_C1, etc. */ char_u b0_version[10]; /* Vim version string */ char_u b0_page_size[4];/* number of bytes per page */ char_u b0_mtime[4]; /* last modification time of file */ @@ -256,7 +265,7 @@ static long char_to_long __ARGS((char_u *)); static char_u *make_percent_swname __ARGS((char_u *dir, char_u *name)); #endif #ifdef FEAT_CRYPT -static void ml_crypt_prepare __ARGS((memfile_T *mfp, off_t offset, int reading)); +static cryptstate_T *ml_crypt_prepare __ARGS((memfile_T *mfp, off_t offset, int reading)); #endif #ifdef FEAT_BYTEOFF static void ml_updatechunk __ARGS((buf_T *buf, long line, long len, int updtype)); @@ -359,8 +368,7 @@ ml_open(buf) b0p->b0_hname[B0_HNAME_SIZE - 1] = NUL; long_to_char(mch_get_pid(), b0p->b0_pid); #ifdef FEAT_CRYPT - if (*buf->b_p_key != NUL) - ml_set_b0_crypt(buf, b0p); + ml_set_b0_crypt(buf, b0p); #endif } @@ -436,11 +444,11 @@ ml_set_b0_crypt(buf, b0p) b0p->b0_id[1] = BLOCK0_ID1; else { - if (get_crypt_method(buf) == 0) - b0p->b0_id[1] = BLOCK0_ID1_C0; - else + int method_nr = crypt_get_method_nr(buf); + + b0p->b0_id[1] = id1_codes[method_nr]; + if (method_nr > CRYPT_M_ZIP) { - b0p->b0_id[1] = BLOCK0_ID1_C1; /* Generate a seed and store it in block 0 and in the memfile. */ sha2_seed(&b0p->b0_seed, MF_SEED_LEN, NULL, 0); mch_memmove(buf->b_ml.ml_mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN); @@ -887,7 +895,8 @@ ml_check_b0_id(b0p) if (b0p->b0_id[0] != BLOCK0_ID0 || (b0p->b0_id[1] != BLOCK0_ID1 && b0p->b0_id[1] != BLOCK0_ID1_C0 - && b0p->b0_id[1] != BLOCK0_ID1_C1) + && b0p->b0_id[1] != BLOCK0_ID1_C1 + && b0p->b0_id[1] != BLOCK0_ID1_C2) ) return FAIL; return OK; @@ -1255,14 +1264,12 @@ ml_recover() } #ifdef FEAT_CRYPT - if (b0p->b0_id[1] == BLOCK0_ID1_C0) - b0_cm = 0; - else if (b0p->b0_id[1] == BLOCK0_ID1_C1) - { - b0_cm = 1; + for (i = 0; i < (int)(sizeof(id1_codes) / sizeof(int)); ++i) + if (id1_codes[i] == b0p->b0_id[1]) + b0_cm = i; + if (b0_cm > 0) mch_memmove(mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN); - } - set_crypt_method(buf, b0_cm); + crypt_set_cm_option(buf, b0_cm < 0 ? 0 : b0_cm); #else if (b0p->b0_id[1] != BLOCK0_ID1) { @@ -1389,7 +1396,7 @@ ml_recover() } else smsg((char_u *)_(need_key_msg), fname_used); - buf->b_p_key = get_crypt_key(FALSE, FALSE); + buf->b_p_key = crypt_get_key(FALSE, FALSE); if (buf->b_p_key == NULL) buf->b_p_key = curbuf->b_p_key; else if (*buf->b_p_key == NUL) @@ -4816,6 +4823,7 @@ ml_encrypt_data(mfp, data, offset, size) char_u *text_start; char_u *new_data; int text_len; + cryptstate_T *state; if (dp->db_id != DATA_ID) return data; @@ -4831,10 +4839,9 @@ ml_encrypt_data(mfp, data, offset, size) mch_memmove(new_data, dp, head_end - (char_u *)dp); /* Encrypt the text. */ - crypt_push_state(); - ml_crypt_prepare(mfp, offset, FALSE); - crypt_encode(text_start, text_len, new_data + dp->db_txt_start); - crypt_pop_state(); + state = ml_crypt_prepare(mfp, offset, FALSE); + crypt_encode(state, text_start, text_len, new_data + dp->db_txt_start); + crypt_free_state(state); /* Clear the gap. */ if (head_end < text_start) @@ -4857,6 +4864,7 @@ ml_decrypt_data(mfp, data, offset, size) char_u *head_end; char_u *text_start; int text_len; + cryptstate_T *state; if (dp->db_id == DATA_ID) { @@ -4869,17 +4877,17 @@ ml_decrypt_data(mfp, data, offset, size) return; /* data was messed up */ /* Decrypt the text in place. */ - crypt_push_state(); - ml_crypt_prepare(mfp, offset, TRUE); - crypt_decode(text_start, text_len); - crypt_pop_state(); + state = ml_crypt_prepare(mfp, offset, TRUE); + crypt_decode_inplace(state, text_start, text_len); + crypt_free_state(state); } } /* * Prepare for encryption/decryption, using the key, seed and offset. + * Return an allocated cryptstate_T *. */ - static void + static cryptstate_T * ml_crypt_prepare(mfp, offset, reading) memfile_T *mfp; off_t offset; @@ -4887,38 +4895,37 @@ ml_crypt_prepare(mfp, offset, reading) { buf_T *buf = mfp->mf_buffer; char_u salt[50]; - int method; + int method_nr; char_u *key; char_u *seed; if (reading && mfp->mf_old_key != NULL) { /* Reading back blocks with the previous key/method/seed. */ - method = mfp->mf_old_cm; + method_nr = mfp->mf_old_cm; key = mfp->mf_old_key; seed = mfp->mf_old_seed; } else { - method = get_crypt_method(buf); + method_nr = crypt_get_method_nr(buf); key = buf->b_p_key; seed = mfp->mf_seed; } - use_crypt_method = method; /* select pkzip or blowfish */ - if (method == 0) + if (method_nr == CRYPT_M_ZIP) { + /* For PKzip: Append the offset to the key, so that we use a different + * key for every block. */ vim_snprintf((char *)salt, sizeof(salt), "%s%ld", key, (long)offset); - crypt_init_keys(salt); - } - else - { - /* Using blowfish, add salt and seed. We use the byte offset of the - * block for the salt. */ - vim_snprintf((char *)salt, sizeof(salt), "%ld", (long)offset); - bf_key_init(key, salt, (int)STRLEN(salt)); - bf_cfb_init(seed, MF_SEED_LEN); + return crypt_create(method_nr, salt, NULL, 0, NULL, 0); } + + /* Using blowfish or better: add salt and seed. We use the byte offset + * of the block for the salt. */ + vim_snprintf((char *)salt, sizeof(salt), "%ld", (long)offset); + return crypt_create(method_nr, key, salt, (int)STRLEN(salt), + seed, MF_SEED_LEN); } #endif diff --git a/src/misc2.c b/src/misc2.c index 1a5b370ba8..1f8878f674 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -3803,322 +3803,6 @@ update_mouseshape(shape_idx) #endif /* CURSOR_SHAPE */ -#ifdef FEAT_CRYPT -/* - * Optional encryption support. - * Mohsin Ahmed, mosh@sasi.com, 98-09-24 - * Based on zip/crypt sources. - * - * NOTE FOR USA: Since 2000 exporting this code from the USA is allowed to - * most countries. There are a few exceptions, but that still should not be a - * problem since this code was originally created in Europe and India. - * - * Blowfish addition originally made by Mohsin Ahmed, - * http://www.cs.albany.edu/~mosh 2010-03-14 - * Based on blowfish by Bruce Schneier (http://www.schneier.com/blowfish.html) - * and sha256 by Christophe Devine. - */ - -/* from zip.h */ - -typedef unsigned short ush; /* unsigned 16-bit value */ -typedef unsigned long ulg; /* unsigned 32-bit value */ - -static void make_crc_tab __ARGS((void)); - -static ulg crc_32_tab[256]; - -/* - * Fill the CRC table. - */ - static void -make_crc_tab() -{ - ulg s,t,v; - static int done = FALSE; - - if (done) - return; - for (t = 0; t < 256; t++) - { - v = t; - for (s = 0; s < 8; s++) - v = (v >> 1) ^ ((v & 1) * (ulg)0xedb88320L); - crc_32_tab[t] = v; - } - done = TRUE; -} - -#define CRC32(c, b) (crc_32_tab[((int)(c) ^ (b)) & 0xff] ^ ((c) >> 8)) - -static ulg keys[3]; /* keys defining the pseudo-random sequence */ - -/* - * Return the next byte in the pseudo-random sequence. - */ -#define DECRYPT_BYTE_ZIP(t) { \ - ush temp; \ - \ - temp = (ush)keys[2] | 2; \ - t = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); \ -} - -/* - * Update the encryption keys with the next byte of plain text. - */ -#define UPDATE_KEYS_ZIP(c) { \ - keys[0] = CRC32(keys[0], (c)); \ - keys[1] += keys[0] & 0xff; \ - keys[1] = keys[1] * 134775813L + 1; \ - keys[2] = CRC32(keys[2], (int)(keys[1] >> 24)); \ -} - -static int crypt_busy = 0; -static ulg saved_keys[3]; -static int saved_crypt_method; - -/* - * Return int value for crypt method string: - * 0 for "zip", the old method. Also for any non-valid value. - * 1 for "blowfish". - */ - int -crypt_method_from_string(s) - char_u *s; -{ - return *s == 'b' ? 1 : 0; -} - -/* - * Get the crypt method for buffer "buf" as a number. - */ - int -get_crypt_method(buf) - buf_T *buf; -{ - return crypt_method_from_string(*buf->b_p_cm == NUL ? p_cm : buf->b_p_cm); -} - -/* - * Set the crypt method for buffer "buf" to "method" using the int value as - * returned by crypt_method_from_string(). - */ - void -set_crypt_method(buf, method) - buf_T *buf; - int method; -{ - free_string_option(buf->b_p_cm); - buf->b_p_cm = vim_strsave((char_u *)(method == 0 ? "zip" : "blowfish")); -} - -/* - * Prepare for initializing encryption. If already doing encryption then save - * the state. - * Must always be called symmetrically with crypt_pop_state(). - */ - void -crypt_push_state() -{ - if (crypt_busy == 1) - { - /* save the state */ - if (use_crypt_method == 0) - { - saved_keys[0] = keys[0]; - saved_keys[1] = keys[1]; - saved_keys[2] = keys[2]; - } - else - bf_crypt_save(); - saved_crypt_method = use_crypt_method; - } - else if (crypt_busy > 1) - EMSG2(_(e_intern2), "crypt_push_state()"); - ++crypt_busy; -} - -/* - * End encryption. If doing encryption before crypt_push_state() then restore - * the saved state. - * Must always be called symmetrically with crypt_push_state(). - */ - void -crypt_pop_state() -{ - --crypt_busy; - if (crypt_busy == 1) - { - use_crypt_method = saved_crypt_method; - if (use_crypt_method == 0) - { - keys[0] = saved_keys[0]; - keys[1] = saved_keys[1]; - keys[2] = saved_keys[2]; - } - else - bf_crypt_restore(); - } -} - -/* - * Encrypt "from[len]" into "to[len]". - * "from" and "to" can be equal to encrypt in place. - */ - void -crypt_encode(from, len, to) - char_u *from; - size_t len; - char_u *to; -{ - size_t i; - int ztemp, t; - - if (use_crypt_method == 0) - for (i = 0; i < len; ++i) - { - ztemp = from[i]; - DECRYPT_BYTE_ZIP(t); - UPDATE_KEYS_ZIP(ztemp); - to[i] = t ^ ztemp; - } - else - bf_crypt_encode(from, len, to); -} - -/* - * Decrypt "ptr[len]" in place. - */ - void -crypt_decode(ptr, len) - char_u *ptr; - long len; -{ - char_u *p; - - if (use_crypt_method == 0) - for (p = ptr; p < ptr + len; ++p) - { - ush temp; - - temp = (ush)keys[2] | 2; - temp = (int)(((unsigned)(temp * (temp ^ 1U)) >> 8) & 0xff); - UPDATE_KEYS_ZIP(*p ^= temp); - } - else - bf_crypt_decode(ptr, len); -} - -/* - * Initialize the encryption keys and the random header according to - * the given password. - * If "passwd" is NULL or empty, don't do anything. - */ - void -crypt_init_keys(passwd) - char_u *passwd; /* password string with which to modify keys */ -{ - if (passwd != NULL && *passwd != NUL) - { - if (use_crypt_method == 0) - { - char_u *p; - - make_crc_tab(); - keys[0] = 305419896L; - keys[1] = 591751049L; - keys[2] = 878082192L; - for (p = passwd; *p!= NUL; ++p) - { - UPDATE_KEYS_ZIP((int)*p); - } - } - else - bf_crypt_init_keys(passwd); - } -} - -/* - * Free an allocated crypt key. Clear the text to make sure it doesn't stay - * in memory anywhere. - */ - void -free_crypt_key(key) - char_u *key; -{ - char_u *p; - - if (key != NULL) - { - for (p = key; *p != NUL; ++p) - *p = 0; - vim_free(key); - } -} - -/* - * Ask the user for a crypt key. - * When "store" is TRUE, the new key is stored in the 'key' option, and the - * 'key' option value is returned: Don't free it. - * When "store" is FALSE, the typed key is returned in allocated memory. - * Returns NULL on failure. - */ - char_u * -get_crypt_key(store, twice) - int store; - int twice; /* Ask for the key twice. */ -{ - char_u *p1, *p2 = NULL; - int round; - - for (round = 0; ; ++round) - { - cmdline_star = TRUE; - cmdline_row = msg_row; - p1 = getcmdline_prompt(NUL, round == 0 - ? (char_u *)_("Enter encryption key: ") - : (char_u *)_("Enter same key again: "), 0, EXPAND_NOTHING, - NULL); - cmdline_star = FALSE; - - if (p1 == NULL) - break; - - if (round == twice) - { - if (p2 != NULL && STRCMP(p1, p2) != 0) - { - MSG(_("Keys don't match!")); - free_crypt_key(p1); - free_crypt_key(p2); - p2 = NULL; - round = -1; /* do it again */ - continue; - } - - if (store) - { - set_option_value((char_u *)"key", 0L, p1, OPT_LOCAL); - free_crypt_key(p1); - p1 = curbuf->b_p_key; - } - break; - } - p2 = p1; - } - - /* since the user typed this, no need to wait for return */ - if (msg_didout) - msg_putchar('\n'); - need_wait_return = FALSE; - msg_didout = FALSE; - - free_crypt_key(p2); - return p1; -} - -#endif /* FEAT_CRYPT */ - /* TODO: make some #ifdef for this */ /*--------[ file searching ]-------------------------------------------------*/ /* @@ -6587,9 +6271,24 @@ put_bytes(fd, nr, len) put_time(fd, the_time) FILE *fd; time_t the_time; +{ + char_u buf[8]; + + time_to_bytes(the_time, buf); + fwrite(buf, (size_t)8, (size_t)1, fd); +} + +/* + * Write time_t to "buf[8]". + */ + void +time_to_bytes(the_time, buf) + time_t the_time; + char_u *buf; { int c; int i; + int bi = 0; time_t wtime = the_time; /* time_t can be up to 8 bytes in size, more than long_u, thus we @@ -6603,7 +6302,7 @@ put_time(fd, the_time) { if (i + 1 > (int)sizeof(time_t)) /* ">>" doesn't work well when shifting more bits than avail */ - putc(0, fd); + buf[bi++] = 0; else { #if defined(SIZEOF_TIME_T) && SIZEOF_TIME_T > 4 @@ -6611,7 +6310,7 @@ put_time(fd, the_time) #else c = (int)((long_u)wtime >> (i * 8)); #endif - putc(c, fd); + buf[bi++] = c; } } } diff --git a/src/option.c b/src/option.c index 3e6164e5a6..62556b69c9 100644 --- a/src/option.c +++ b/src/option.c @@ -2989,7 +2989,7 @@ static char *(p_bg_values[]) = {"light", "dark", NULL}; static char *(p_nf_values[]) = {"octal", "hex", "alpha", NULL}; static char *(p_ff_values[]) = {FF_UNIX, FF_DOS, FF_MAC, NULL}; #ifdef FEAT_CRYPT -static char *(p_cm_values[]) = {"zip", "blowfish", NULL}; +static char *(p_cm_values[]) = {"zip", "blowfish", "blowfish2", NULL}; #endif #ifdef FEAT_CMDL_COMPL static char *(p_wop_values[]) = {"tagfile", NULL}; @@ -6140,7 +6140,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, # endif if (STRCMP(curbuf->b_p_key, oldval) != 0) /* Need to update the swapfile. */ - ml_set_crypt_key(curbuf, oldval, get_crypt_method(curbuf)); + ml_set_crypt_key(curbuf, oldval, crypt_get_method_nr(curbuf)); } else if (gvarp == &p_cm) @@ -6151,7 +6151,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, p = p_cm; if (check_opt_strings(p, p_cm_values, TRUE) != OK) errmsg = e_invarg; - else if (get_crypt_method(curbuf) > 0 && blowfish_self_test() == FAIL) + else if (crypt_self_test() == FAIL) errmsg = e_invarg; else { @@ -6177,7 +6177,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, p = curbuf->b_p_cm; if (STRCMP(s, p) != 0) ml_set_crypt_key(curbuf, curbuf->b_p_key, - crypt_method_from_string(s)); + crypt_method_nr_from_name(s)); /* If the global value changes need to update the swapfile for all * buffers using that value. */ @@ -6188,7 +6188,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, for (buf = firstbuf; buf != NULL; buf = buf->b_next) if (buf != curbuf && *buf->b_p_cm == NUL) ml_set_crypt_key(buf, buf->b_p_key, - crypt_method_from_string(oldval)); + crypt_method_nr_from_name(oldval)); } } } diff --git a/src/proto.h b/src/proto.h index 191ecd8fdd..2b08eb38ff 100644 --- a/src/proto.h +++ b/src/proto.h @@ -70,6 +70,8 @@ extern int _stricoll __ARGS((char *a, char *b)); # ifdef FEAT_CRYPT # include "blowfish.pro" +# include "crypt.pro" +# include "crypt_zip.pro" # endif # include "buffer.pro" # include "charset.pro" diff --git a/src/proto/blowfish.pro b/src/proto/blowfish.pro index 4d64e10e80..66d029cd89 100644 --- a/src/proto/blowfish.pro +++ b/src/proto/blowfish.pro @@ -1,10 +1,6 @@ /* blowfish.c */ -void bf_key_init __ARGS((char_u *password, char_u *salt, int salt_len)); -void bf_cfb_init __ARGS((char_u *iv, int iv_len)); -void bf_crypt_encode __ARGS((char_u *from, size_t len, char_u *to)); -void bf_crypt_decode __ARGS((char_u *ptr, long len)); -void bf_crypt_init_keys __ARGS((char_u *passwd)); -void bf_crypt_save __ARGS((void)); -void bf_crypt_restore __ARGS((void)); +void crypt_blowfish_encode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to)); +void crypt_blowfish_decode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to)); +void crypt_blowfish_init __ARGS((cryptstate_T *state, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len)); int blowfish_self_test __ARGS((void)); /* vim: set ft=c : */ diff --git a/src/proto/crypt.pro b/src/proto/crypt.pro new file mode 100644 index 0000000000..d61df718bd --- /dev/null +++ b/src/proto/crypt.pro @@ -0,0 +1,24 @@ +/* crypt.c */ +int crypt_method_nr_from_name __ARGS((char_u *name)); +int crypt_method_nr_from_magic __ARGS((char *ptr, int len)); +int crypt_works_inplace __ARGS((cryptstate_T *state)); +int crypt_get_method_nr __ARGS((buf_T *buf)); +int crypt_whole_undofile __ARGS((int method_nr)); +int crypt_get_header_len __ARGS((int method_nr)); +void crypt_set_cm_option __ARGS((buf_T *buf, int method_nr)); +int crypt_self_test __ARGS((void)); +cryptstate_T *crypt_create __ARGS((int method_nr, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len)); +cryptstate_T *crypt_create_from_header __ARGS((int method_nr, char_u *key, char_u *header)); +cryptstate_T *crypt_create_from_file __ARGS((FILE *fp, char_u *key)); +cryptstate_T *crypt_create_for_writing __ARGS((int method_nr, char_u *key, char_u **header, int *header_len)); +void crypt_free_state __ARGS((cryptstate_T *state)); +long crypt_encode_alloc __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u **newptr)); +long crypt_decode_alloc __ARGS((cryptstate_T *state, char_u *ptr, long len, char_u **newptr)); +void crypt_encode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to)); +void crypt_decode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to)); +void crypt_encode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len)); +void crypt_decode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len)); +void crypt_free_key __ARGS((char_u *key)); +char_u *crypt_get_key __ARGS((int store, int twice)); +void crypt_append_msg __ARGS((buf_T *buf)); +/* vim: set ft=c : */ diff --git a/src/proto/crypt_zip.pro b/src/proto/crypt_zip.pro new file mode 100644 index 0000000000..5f4e137713 --- /dev/null +++ b/src/proto/crypt_zip.pro @@ -0,0 +1,5 @@ +/* crypt_zip.c */ +void crypt_zip_init __ARGS((cryptstate_T *state, char_u *key, char_u *salt, int salt_len, char_u *seed, int seed_len)); +void crypt_zip_encode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to)); +void crypt_zip_decode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u *to)); +/* vim: set ft=c : */ diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro index 7aa99cfa8a..0d532f4ce2 100644 --- a/src/proto/fileio.pro +++ b/src/proto/fileio.pro @@ -4,8 +4,6 @@ int readfile __ARGS((char_u *fname, char_u *sfname, linenr_T from, linenr_T line int prep_exarg __ARGS((exarg_T *eap, buf_T *buf)); void set_file_options __ARGS((int set_options, exarg_T *eap)); void set_forced_fenc __ARGS((exarg_T *eap)); -int prepare_crypt_read __ARGS((FILE *fp)); -char_u *prepare_crypt_write __ARGS((buf_T *buf, int *lenp)); int check_file_readonly __ARGS((char_u *fname, int perm)); int buf_write __ARGS((buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int filtering)); void msg_add_fname __ARGS((buf_T *buf, char_u *fname)); diff --git a/src/proto/misc2.pro b/src/proto/misc2.pro index 4fd457382f..b2f72d8645 100644 --- a/src/proto/misc2.pro +++ b/src/proto/misc2.pro @@ -84,16 +84,6 @@ int illegal_slash __ARGS((char *name)); char_u *parse_shape_opt __ARGS((int what)); int get_shape_idx __ARGS((int mouse)); void update_mouseshape __ARGS((int shape_idx)); -int crypt_method_from_string __ARGS((char_u *s)); -int get_crypt_method __ARGS((buf_T *buf)); -void set_crypt_method __ARGS((buf_T *buf, int method)); -void crypt_push_state __ARGS((void)); -void crypt_pop_state __ARGS((void)); -void crypt_encode __ARGS((char_u *from, size_t len, char_u *to)); -void crypt_decode __ARGS((char_u *ptr, long len)); -void crypt_init_keys __ARGS((char_u *passwd)); -void free_crypt_key __ARGS((char_u *key)); -char_u *get_crypt_key __ARGS((int store, int twice)); void *vim_findfile_init __ARGS((char_u *path, char_u *filename, char_u *stopdirs, int level, int free_visited, int find_what, void *search_ctx_arg, int tagfile, char_u *rel_fname)); char_u *vim_findfile_stopdir __ARGS((char_u *buf)); void vim_findfile_cleanup __ARGS((void *ctx)); @@ -116,5 +106,6 @@ time_t get8ctime __ARGS((FILE *fd)); char_u *read_string __ARGS((FILE *fd, int cnt)); int put_bytes __ARGS((FILE *fd, long_u nr, int len)); void put_time __ARGS((FILE *fd, time_t the_time)); +void time_to_bytes __ARGS((time_t the_time, char_u *buf)); int has_non_ascii __ARGS((char_u *s)); /* vim: set ft=c : */ diff --git a/src/structs.h b/src/structs.h index 1382380552..441fcaa1c4 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1251,6 +1251,24 @@ typedef struct { } syn_time_T; #endif +#ifdef FEAT_CRYPT +/* + * Structure to hold the type of encryption and the state of encryption or + * decryption. + */ +typedef struct { + int method_nr; + void *method_state; /* method-specific state information */ +} cryptstate_T; + +/* values for method_nr */ +# define CRYPT_M_ZIP 0 +# define CRYPT_M_BF 1 +# define CRYPT_M_BF2 2 +# define CRYPT_M_COUNT 3 /* number of crypt methods */ +#endif + + /* * These are items normally related to a buffer. But when using ":ownsyntax" * a window may have its own instance. @@ -1778,7 +1796,12 @@ struct file_buffer int b_was_netbeans_file;/* TRUE if b_netbeans_file was once set */ #endif -}; +#ifdef FEAT_CRYPT + cryptstate_T *b_cryptstate; /* Encryption state while reading or writing + * the file. NULL when not using encryption. */ +#endif + +}; /* file_buffer */ #ifdef FEAT_DIFF diff --git a/src/testdir/test71.in b/src/testdir/test71.in index 155fd413bc..944b69dc52 100644 --- a/src/testdir/test71.in +++ b/src/testdir/test71.in @@ -13,6 +13,8 @@ STARTTEST :let cm0_bytes = getline('.', '.') :/^start of cm=blowfish bytes/+1 :let cm1_bytes = getline('.', '.') +:/^start of cm=blowfish2 bytes/+1 +:let cm2_bytes = getline('.', '.') :bwipe! :call append(0, text_lines) :$d @@ -36,6 +38,18 @@ barfoo :e Xtestfile barfoo :let cm1_read_back = getline('.', '$') +:set key= +:set cryptmethod=blowfish2 +:" If the blowfish test fails 'cryptmethod' will be 'zip' now. +:%s/^/\=&cryptmethod == 'blowfish2' ? "OK " : "blowfish test failed "/ +:X +bar2foo +bar2foo +:w! Xtestfile +:bwipe! +:e Xtestfile +bar2foo +:let cm2_read_back = getline('.', '$') :bwipe! :set bin noeol key= :call append(0, cm0_bytes) @@ -57,7 +71,20 @@ foofoo :set nobin :e Xtestfile barbar +:let cm1_read_bin = getline('.', '$') +:bwipe! +:set bin noeol key= +:call append(0, cm2_bytes) +:$d +:set fenc=latin1 +:w! Xtestfile +:bwipe! +:set nobin +:e Xtestfile +barburp +:call append(0, cm1_read_bin) :call append(0, cm0_read_bin) +:call append(0, cm2_read_back) :call append(0, cm1_read_back) :call append(0, cm0_read_back) :set key= fenc=latin1 diff --git a/src/testdir/test71.ok b/src/testdir/test71.ok index 24652c4380..de1b0ab837 100644 --- a/src/testdir/test71.ok +++ b/src/testdir/test71.ok @@ -4,7 +4,12 @@ line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx OK 01234567890123456789012345678901234567 OK line 2 foo bar blah OK line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +OK OK 01234567890123456789012345678901234567 +OK OK line 2 foo bar blah +OK OK line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 1234567890 abbccddeff asdfasdfasdf 0001112223333 +abcdefghijklmnopqrstuvwxyz +!@#$%^&*()_+=-`~ diff --git a/src/testdir/test71a.in b/src/testdir/test71a.in index 85bd22cd01..e79a39895a 100644 --- a/src/testdir/test71a.in +++ b/src/testdir/test71a.in @@ -12,3 +12,7 @@ end of cm=zip bytes start of cm=blowfish bytes VimCrypt~02!k)#S=#MJAͥM! end of cm=blowfish bytes + +start of cm=blowfish2 bytes +VimCrypt~03!N;^C).FS6[T˧ؾ9 2 Q@ߚIv.`$% +end of cm=blowfish2 bytes diff --git a/src/testdir/test72.in b/src/testdir/test72.in index 3b3a6a4329..031edbf146 100644 --- a/src/testdir/test72.in +++ b/src/testdir/test72.in @@ -81,6 +81,7 @@ uu:w >>test.out :" :" With encryption, cryptmethod=blowfish :e! Xtestfile +rubbish :set undofile cm=blowfish ggdGijan feb @@ -104,6 +105,32 @@ u:.w >>test.out u:.w >>test.out u:.w >>test.out :" +:" With encryption, cryptmethod=blowfish2 +:e! Xtestfile +rubbish +:set undofile cm=blowfish2 +ggdGijan +feb +mar +apr +jun:set ul=100 +kk0ifoo :set ul=100 +dd:set ul=100 +ibar :set ul=100 +:X +foo2bar +foo2bar +:w! +:bwipe! +:e Xtestfile +foo2bar +:set key= +/bar +:.w >>test.out +u:.w >>test.out +u:.w >>test.out +u:.w >>test.out +:" :" Rename the undo file so that it gets cleaned up. :if has("vms") : call rename("_un_Xtestfile", "Xtestundo") diff --git a/src/testdir/test72.ok b/src/testdir/test72.ok index bb267d0d8b..8d30ba10b3 100644 --- a/src/testdir/test72.ok +++ b/src/testdir/test72.ok @@ -25,3 +25,7 @@ bar apr apr foo mar mar +bar apr +apr +foo mar +mar diff --git a/src/undo.c b/src/undo.c index 5db25f04e8..1661c8074b 100644 --- a/src/undo.c +++ b/src/undo.c @@ -81,8 +81,25 @@ #define UH_MAGIC 0x18dade /* value for uh_magic when in use */ #define UE_MAGIC 0xabc123 /* value for ue_magic when in use */ +/* Size of buffer used for encryption. */ +#define CRYPT_BUF_SIZE 8192 + #include "vim.h" +/* Structure passed around between functions. + * Avoids passing cryptstate_T when encryption not available. */ +typedef struct { + buf_T *bi_buf; + FILE *bi_fp; +#ifdef FEAT_CRYPT + cryptstate_T *bi_state; + char_u *bi_buffer; /* CRYPT_BUF_SIZE, NULL when not buffering */ + size_t bi_used; /* bytes written to/read from bi_buffer */ + size_t bi_avail; /* bytes available in bi_buffer */ +#endif +} bufinfo_T; + + static long get_undolevel __ARGS((void)); static void u_unch_branch __ARGS((u_header_T *uhp)); static u_entry_T *u_get_headentry __ARGS((void)); @@ -98,18 +115,26 @@ static void u_freeentry __ARGS((u_entry_T *, long)); #ifdef FEAT_PERSISTENT_UNDO static void corruption_error __ARGS((char *mesg, char_u *file_name)); static void u_free_uhp __ARGS((u_header_T *uhp)); -static size_t fwrite_crypt __ARGS((buf_T *buf UNUSED, char_u *ptr, size_t len, FILE *fp)); -static char_u *read_string_decrypt __ARGS((buf_T *buf UNUSED, FILE *fd, int len)); -static int serialize_header __ARGS((FILE *fp, buf_T *buf, char_u *hash)); -static int serialize_uhp __ARGS((FILE *fp, buf_T *buf, u_header_T *uhp)); -static u_header_T *unserialize_uhp __ARGS((FILE *fp, char_u *file_name)); -static int serialize_uep __ARGS((FILE *fp, buf_T *buf, u_entry_T *uep)); -static u_entry_T *unserialize_uep __ARGS((FILE *fp, int *error, char_u *file_name)); -static void serialize_pos __ARGS((pos_T pos, FILE *fp)); -static void unserialize_pos __ARGS((pos_T *pos, FILE *fp)); -static void serialize_visualinfo __ARGS((visualinfo_T *info, FILE *fp)); -static void unserialize_visualinfo __ARGS((visualinfo_T *info, FILE *fp)); -static void put_header_ptr __ARGS((FILE *fp, u_header_T *uhp)); +static int undo_write __ARGS((bufinfo_T *bi, char_u *ptr, size_t len)); +static int undo_flush __ARGS((bufinfo_T *bi)); +static int fwrite_crypt __ARGS((bufinfo_T *bi, char_u *ptr, size_t len)); +static int undo_write_bytes __ARGS((bufinfo_T *bi, long_u nr, int len)); +static void put_header_ptr __ARGS((bufinfo_T *bi, u_header_T *uhp)); +static int undo_read_4c __ARGS((bufinfo_T *bi)); +static int undo_read_2c __ARGS((bufinfo_T *bi)); +static int undo_read_byte __ARGS((bufinfo_T *bi)); +static time_t undo_read_time __ARGS((bufinfo_T *bi)); +static int undo_read __ARGS((bufinfo_T *bi, char_u *buffer, size_t size)); +static char_u *read_string_decrypt __ARGS((bufinfo_T *bi, int len)); +static int serialize_header __ARGS((bufinfo_T *bi, char_u *hash)); +static int serialize_uhp __ARGS((bufinfo_T *bi, u_header_T *uhp)); +static u_header_T *unserialize_uhp __ARGS((bufinfo_T *bi, char_u *file_name)); +static int serialize_uep __ARGS((bufinfo_T *bi, u_entry_T *uep)); +static u_entry_T *unserialize_uep __ARGS((bufinfo_T *bi, int *error, char_u *file_name)); +static void serialize_pos __ARGS((bufinfo_T *bi, pos_T pos)); +static void unserialize_pos __ARGS((bufinfo_T *bi, pos_T *pos)); +static void serialize_visualinfo __ARGS((bufinfo_T *bi, visualinfo_T *info)); +static void unserialize_visualinfo __ARGS((bufinfo_T *bi, visualinfo_T *info)); #endif #define U_ALLOC_LINE(size) lalloc((long_u)(size), FALSE) @@ -859,68 +884,294 @@ u_free_uhp(uhp) } /* - * Like fwrite() but crypt the bytes when 'key' is set. - * Returns 1 if successful. + * Write a sequence of bytes to the undo file. + * Buffers and encrypts as needed. + * Returns OK or FAIL. */ - static size_t -fwrite_crypt(buf, ptr, len, fp) - buf_T *buf UNUSED; + static int +undo_write(bi, ptr, len) + bufinfo_T *bi; + char_u *ptr; + size_t len; +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + size_t len_todo = len; + char_u *p = ptr; + + while (bi->bi_used + len_todo >= CRYPT_BUF_SIZE) + { + size_t n = CRYPT_BUF_SIZE - bi->bi_used; + + mch_memmove(bi->bi_buffer + bi->bi_used, p, n); + len_todo -= n; + p += n; + bi->bi_used = CRYPT_BUF_SIZE; + if (undo_flush(bi) == FAIL) + return FAIL; + } + if (len_todo > 0) + { + mch_memmove(bi->bi_buffer + bi->bi_used, p, len_todo); + bi->bi_used += len_todo; + } + return OK; + } +#endif + if (fwrite(ptr, len, (size_t)1, bi->bi_fp) != 1) + return FAIL; + return OK; +} + +#ifdef FEAT_CRYPT + static int +undo_flush(bi) + bufinfo_T *bi; +{ + if (bi->bi_used > 0) + { + crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used); + if (fwrite(bi->bi_buffer, bi->bi_used, (size_t)1, bi->bi_fp) != 1) + return FAIL; + bi->bi_used = 0; + } + return OK; +} +#endif + +/* + * Write "ptr[len]" and crypt the bytes when needed. + * Returns OK or FAIL. + */ + static int +fwrite_crypt(bi, ptr, len) + bufinfo_T *bi; char_u *ptr; size_t len; - FILE *fp; { #ifdef FEAT_CRYPT char_u *copy; char_u small_buf[100]; size_t i; - if (*buf->b_p_key == NUL) - return fwrite(ptr, len, (size_t)1, fp); - if (len < 100) - copy = small_buf; /* no malloc()/free() for short strings */ - else + if (bi->bi_state != NULL && bi->bi_buffer == NULL) { - copy = lalloc(len, FALSE); - if (copy == NULL) - return 0; + /* crypting every piece of text separately */ + if (len < 100) + copy = small_buf; /* no malloc()/free() for short strings */ + else + { + copy = lalloc(len, FALSE); + if (copy == NULL) + return 0; + } + crypt_encode(bi->bi_state, ptr, len, copy); + i = fwrite(copy, len, (size_t)1, bi->bi_fp); + if (copy != small_buf) + vim_free(copy); + return i == 1 ? OK : FAIL; } - crypt_encode(ptr, len, copy); - i = fwrite(copy, len, (size_t)1, fp); - if (copy != small_buf) - vim_free(copy); - return i; -#else - return fwrite(ptr, len, (size_t)1, fp); #endif + return undo_write(bi, ptr, len); } /* - * Read a string of length "len" from "fd". - * When 'key' is set decrypt the bytes. + * Write a number, MSB first, in "len" bytes. + * Must match with undo_read_?c() functions. + * Returns OK or FAIL. */ - static char_u * -read_string_decrypt(buf, fd, len) - buf_T *buf UNUSED; - FILE *fd; + static int +undo_write_bytes(bi, nr, len) + bufinfo_T *bi; + long_u nr; int len; { - char_u *ptr; + char_u buf[8]; + int i; + int bufi = 0; - ptr = read_string(fd, len); -#ifdef FEAT_CRYPT - if (ptr != NULL && *buf->b_p_key != NUL) - crypt_decode(ptr, len); -#endif - return ptr; + for (i = len - 1; i >= 0; --i) + buf[bufi++] = nr >> (i * 8); + return undo_write(bi, buf, (size_t)len); +} + +/* + * Write the pointer to an undo header. Instead of writing the pointer itself + * we use the sequence number of the header. This is converted back to + * pointers when reading. */ + static void +put_header_ptr(bi, uhp) + bufinfo_T *bi; + u_header_T *uhp; +{ + undo_write_bytes(bi, (long_u)(uhp != NULL ? uhp->uh_seq : 0), 4); } static int -serialize_header(fp, buf, hash) - FILE *fp; - buf_T *buf; +undo_read_4c(bi) + bufinfo_T *bi; +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + char_u buf[4]; + int n; + + undo_read(bi, buf, (size_t)4); + n = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; + return n; + } +#endif + return get4c(bi->bi_fp); +} + + static int +undo_read_2c(bi) + bufinfo_T *bi; +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + char_u buf[2]; + int n; + + undo_read(bi, buf, (size_t)2); + n = (buf[0] << 8) + buf[1]; + return n; + } +#endif + return get2c(bi->bi_fp); +} + + static int +undo_read_byte(bi) + bufinfo_T *bi; +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + char_u buf[1]; + + undo_read(bi, buf, (size_t)1); + return buf[0]; + } +#endif + return getc(bi->bi_fp); +} + + static time_t +undo_read_time(bi) + bufinfo_T *bi; +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + char_u buf[8]; + time_t n = 0; + int i; + + undo_read(bi, buf, (size_t)8); + for (i = 0; i < 8; ++i) + n = (n << 8) + buf[i]; + return n; + } +#endif + return get8ctime(bi->bi_fp); +} + +/* + * Read "buffer[size]" from the undo file. + * Return OK or FAIL. + */ + static int +undo_read(bi, buffer, size) + bufinfo_T *bi; + char_u *buffer; + size_t size; +{ +#ifdef FEAT_CRYPT + if (bi->bi_buffer != NULL) + { + int size_todo = size; + char_u *p = buffer; + + while (size_todo > 0) + { + size_t n; + + if (bi->bi_used >= bi->bi_avail) + { + n = fread(bi->bi_buffer, 1, (size_t)CRYPT_BUF_SIZE, bi->bi_fp); + if (n <= 0) + { + /* Error may be checked for only later. Fill with zeros, + * so that the reader won't use garbage. */ + vim_memset(p, 0, size_todo); + return FAIL; + } + bi->bi_avail = n; + bi->bi_used = 0; + crypt_decode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_avail); + } + n = size_todo; + if (n > bi->bi_avail - bi->bi_used) + n = bi->bi_avail - bi->bi_used; + mch_memmove(p, bi->bi_buffer + bi->bi_used, n); + bi->bi_used += n; + size_todo -= n; + p += n; + } + return OK; + } +#endif + if (fread(buffer, (size_t)size, 1, bi->bi_fp) != 1) + return FAIL; + return OK; +} + +/* + * Read a string of length "len" from "bi->bi_fd". + * "len" can be zero to allocate an empty line. + * Decrypt the bytes if needed. + * Append a NUL. + * Returns a pointer to allocated memory or NULL for failure. + */ + static char_u * +read_string_decrypt(bi, len) + bufinfo_T *bi; + int len; +{ + char_u *ptr = alloc((unsigned)len + 1); + + if (ptr != NULL) + { + if (len > 0 && undo_read(bi, ptr, len) == FAIL) + { + vim_free(ptr); + return NULL; + } + ptr[len] = NUL; +#ifdef FEAT_CRYPT + if (bi->bi_state != NULL && bi->bi_buffer == NULL) + crypt_decode_inplace(bi->bi_state, ptr, len); +#endif + } + return ptr; +} + +/* + * Writes the (not encrypted) header and initializes encryption if needed. + */ + static int +serialize_header(bi, hash) + bufinfo_T *bi; char_u *hash; { - int len; + int len; + buf_T *buf = bi->bi_buf; + FILE *fp = bi->bi_fp; + char_u time_buf[8]; /* Start writing, first the magic marker and undo info version. */ if (fwrite(UF_START_MAGIC, (size_t)UF_START_MAGIC_LEN, (size_t)1, fp) != 1) @@ -934,108 +1185,124 @@ serialize_header(fp, buf, hash) char_u *header; int header_len; - put_bytes(fp, (long_u)UF_VERSION_CRYPT, 2); - header = prepare_crypt_write(buf, &header_len); - if (header == NULL) + undo_write_bytes(bi, (long_u)UF_VERSION_CRYPT, 2); + bi->bi_state = crypt_create_for_writing(crypt_get_method_nr(buf), + buf->b_p_key, &header, &header_len); + if (bi->bi_state == NULL) return FAIL; len = (int)fwrite(header, (size_t)header_len, (size_t)1, fp); vim_free(header); if (len != 1) { - crypt_pop_state(); + crypt_free_state(bi->bi_state); + bi->bi_state = NULL; return FAIL; } + + if (crypt_whole_undofile(crypt_get_method_nr(buf))) + { + bi->bi_buffer = alloc(CRYPT_BUF_SIZE); + if (bi->bi_buffer == NULL) + { + crypt_free_state(bi->bi_state); + bi->bi_state = NULL; + return FAIL; + } + bi->bi_used = 0; + } } else #endif - put_bytes(fp, (long_u)UF_VERSION, 2); + undo_write_bytes(bi, (long_u)UF_VERSION, 2); /* Write a hash of the buffer text, so that we can verify it is still the * same when reading the buffer text. */ - if (fwrite(hash, (size_t)UNDO_HASH_SIZE, (size_t)1, fp) != 1) + if (undo_write(bi, hash, (size_t)UNDO_HASH_SIZE) == FAIL) return FAIL; /* buffer-specific data */ - put_bytes(fp, (long_u)buf->b_ml.ml_line_count, 4); + undo_write_bytes(bi, (long_u)buf->b_ml.ml_line_count, 4); len = buf->b_u_line_ptr != NULL ? (int)STRLEN(buf->b_u_line_ptr) : 0; - put_bytes(fp, (long_u)len, 4); - if (len > 0 && fwrite_crypt(buf, buf->b_u_line_ptr, (size_t)len, fp) != 1) + undo_write_bytes(bi, (long_u)len, 4); + if (len > 0 && fwrite_crypt(bi, buf->b_u_line_ptr, (size_t)len) == FAIL) return FAIL; - put_bytes(fp, (long_u)buf->b_u_line_lnum, 4); - put_bytes(fp, (long_u)buf->b_u_line_colnr, 4); + undo_write_bytes(bi, (long_u)buf->b_u_line_lnum, 4); + undo_write_bytes(bi, (long_u)buf->b_u_line_colnr, 4); /* Undo structures header data */ - put_header_ptr(fp, buf->b_u_oldhead); - put_header_ptr(fp, buf->b_u_newhead); - put_header_ptr(fp, buf->b_u_curhead); + put_header_ptr(bi, buf->b_u_oldhead); + put_header_ptr(bi, buf->b_u_newhead); + put_header_ptr(bi, buf->b_u_curhead); - put_bytes(fp, (long_u)buf->b_u_numhead, 4); - put_bytes(fp, (long_u)buf->b_u_seq_last, 4); - put_bytes(fp, (long_u)buf->b_u_seq_cur, 4); - put_time(fp, buf->b_u_time_cur); + undo_write_bytes(bi, (long_u)buf->b_u_numhead, 4); + undo_write_bytes(bi, (long_u)buf->b_u_seq_last, 4); + undo_write_bytes(bi, (long_u)buf->b_u_seq_cur, 4); + time_to_bytes(buf->b_u_time_cur, time_buf); + undo_write(bi, time_buf, 8); /* Optional fields. */ - putc(4, fp); - putc(UF_LAST_SAVE_NR, fp); - put_bytes(fp, (long_u)buf->b_u_save_nr_last, 4); + undo_write_bytes(bi, 4, 1); + undo_write_bytes(bi, UF_LAST_SAVE_NR, 1); + undo_write_bytes(bi, (long_u)buf->b_u_save_nr_last, 4); - putc(0, fp); /* end marker */ + undo_write_bytes(bi, 0, 1); /* end marker */ return OK; } static int -serialize_uhp(fp, buf, uhp) - FILE *fp; - buf_T *buf; +serialize_uhp(bi, uhp) + bufinfo_T *bi; u_header_T *uhp; { int i; u_entry_T *uep; + char_u time_buf[8]; - if (put_bytes(fp, (long_u)UF_HEADER_MAGIC, 2) == FAIL) + if (undo_write_bytes(bi, (long_u)UF_HEADER_MAGIC, 2) == FAIL) return FAIL; - put_header_ptr(fp, uhp->uh_next.ptr); - put_header_ptr(fp, uhp->uh_prev.ptr); - put_header_ptr(fp, uhp->uh_alt_next.ptr); - put_header_ptr(fp, uhp->uh_alt_prev.ptr); - put_bytes(fp, uhp->uh_seq, 4); - serialize_pos(uhp->uh_cursor, fp); + put_header_ptr(bi, uhp->uh_next.ptr); + put_header_ptr(bi, uhp->uh_prev.ptr); + put_header_ptr(bi, uhp->uh_alt_next.ptr); + put_header_ptr(bi, uhp->uh_alt_prev.ptr); + undo_write_bytes(bi, uhp->uh_seq, 4); + serialize_pos(bi, uhp->uh_cursor); #ifdef FEAT_VIRTUALEDIT - put_bytes(fp, (long_u)uhp->uh_cursor_vcol, 4); + undo_write_bytes(bi, (long_u)uhp->uh_cursor_vcol, 4); #else - put_bytes(fp, (long_u)0, 4); + undo_write_bytes(bi, (long_u)0, 4); #endif - put_bytes(fp, (long_u)uhp->uh_flags, 2); + undo_write_bytes(bi, (long_u)uhp->uh_flags, 2); /* Assume NMARKS will stay the same. */ for (i = 0; i < NMARKS; ++i) - serialize_pos(uhp->uh_namedm[i], fp); - serialize_visualinfo(&uhp->uh_visual, fp); - put_time(fp, uhp->uh_time); + serialize_pos(bi, uhp->uh_namedm[i]); + serialize_visualinfo(bi, &uhp->uh_visual); + time_to_bytes(uhp->uh_time, time_buf); + undo_write(bi, time_buf, 8); /* Optional fields. */ - putc(4, fp); - putc(UHP_SAVE_NR, fp); - put_bytes(fp, (long_u)uhp->uh_save_nr, 4); + undo_write_bytes(bi, 4, 1); + undo_write_bytes(bi, UHP_SAVE_NR, 1); + undo_write_bytes(bi, (long_u)uhp->uh_save_nr, 4); - putc(0, fp); /* end marker */ + undo_write_bytes(bi, 0, 1); /* end marker */ /* Write all the entries. */ for (uep = uhp->uh_entry; uep != NULL; uep = uep->ue_next) { - put_bytes(fp, (long_u)UF_ENTRY_MAGIC, 2); - if (serialize_uep(fp, buf, uep) == FAIL) + undo_write_bytes(bi, (long_u)UF_ENTRY_MAGIC, 2); + if (serialize_uep(bi, uep) == FAIL) return FAIL; } - put_bytes(fp, (long_u)UF_ENTRY_END_MAGIC, 2); + undo_write_bytes(bi, (long_u)UF_ENTRY_END_MAGIC, 2); return OK; } static u_header_T * -unserialize_uhp(fp, file_name) - FILE *fp; +unserialize_uhp(bi, file_name) + bufinfo_T *bi; char_u *file_name; { u_header_T *uhp; @@ -1051,56 +1318,56 @@ unserialize_uhp(fp, file_name) #ifdef U_DEBUG uhp->uh_magic = UH_MAGIC; #endif - uhp->uh_next.seq = get4c(fp); - uhp->uh_prev.seq = get4c(fp); - uhp->uh_alt_next.seq = get4c(fp); - uhp->uh_alt_prev.seq = get4c(fp); - uhp->uh_seq = get4c(fp); + uhp->uh_next.seq = undo_read_4c(bi); + uhp->uh_prev.seq = undo_read_4c(bi); + uhp->uh_alt_next.seq = undo_read_4c(bi); + uhp->uh_alt_prev.seq = undo_read_4c(bi); + uhp->uh_seq = undo_read_4c(bi); if (uhp->uh_seq <= 0) { corruption_error("uh_seq", file_name); vim_free(uhp); return NULL; } - unserialize_pos(&uhp->uh_cursor, fp); + unserialize_pos(bi, &uhp->uh_cursor); #ifdef FEAT_VIRTUALEDIT - uhp->uh_cursor_vcol = get4c(fp); + uhp->uh_cursor_vcol = undo_read_4c(bi); #else - (void)get4c(fp); + (void)undo_read_4c(bi); #endif - uhp->uh_flags = get2c(fp); + uhp->uh_flags = undo_read_2c(bi); for (i = 0; i < NMARKS; ++i) - unserialize_pos(&uhp->uh_namedm[i], fp); - unserialize_visualinfo(&uhp->uh_visual, fp); - uhp->uh_time = get8ctime(fp); + unserialize_pos(bi, &uhp->uh_namedm[i]); + unserialize_visualinfo(bi, &uhp->uh_visual); + uhp->uh_time = undo_read_time(bi); /* Optional fields. */ for (;;) { - int len = getc(fp); + int len = undo_read_byte(bi); int what; if (len == 0) break; - what = getc(fp); + what = undo_read_byte(bi); switch (what) { case UHP_SAVE_NR: - uhp->uh_save_nr = get4c(fp); + uhp->uh_save_nr = undo_read_4c(bi); break; default: /* field not supported, skip */ while (--len >= 0) - (void)getc(fp); + (void)undo_read_byte(bi); } } /* Unserialize the uep list. */ last_uep = NULL; - while ((c = get2c(fp)) == UF_ENTRY_MAGIC) + while ((c = undo_read_2c(bi)) == UF_ENTRY_MAGIC) { error = FALSE; - uep = unserialize_uep(fp, &error, file_name); + uep = unserialize_uep(bi, &error, file_name); if (last_uep == NULL) uhp->uh_entry = uep; else @@ -1123,35 +1390,34 @@ unserialize_uhp(fp, file_name) } /* - * Serialize "uep" to "fp". + * Serialize "uep". */ static int -serialize_uep(fp, buf, uep) - FILE *fp; - buf_T *buf; +serialize_uep(bi, uep) + bufinfo_T *bi; u_entry_T *uep; { int i; size_t len; - put_bytes(fp, (long_u)uep->ue_top, 4); - put_bytes(fp, (long_u)uep->ue_bot, 4); - put_bytes(fp, (long_u)uep->ue_lcount, 4); - put_bytes(fp, (long_u)uep->ue_size, 4); + undo_write_bytes(bi, (long_u)uep->ue_top, 4); + undo_write_bytes(bi, (long_u)uep->ue_bot, 4); + undo_write_bytes(bi, (long_u)uep->ue_lcount, 4); + undo_write_bytes(bi, (long_u)uep->ue_size, 4); for (i = 0; i < uep->ue_size; ++i) { len = STRLEN(uep->ue_array[i]); - if (put_bytes(fp, (long_u)len, 4) == FAIL) + if (undo_write_bytes(bi, (long_u)len, 4) == FAIL) return FAIL; - if (len > 0 && fwrite_crypt(buf, uep->ue_array[i], len, fp) != 1) + if (len > 0 && fwrite_crypt(bi, uep->ue_array[i], len) == FAIL) return FAIL; } return OK; } static u_entry_T * -unserialize_uep(fp, error, file_name) - FILE *fp; +unserialize_uep(bi, error, file_name) + bufinfo_T *bi; int *error; char_u *file_name; { @@ -1168,10 +1434,10 @@ unserialize_uep(fp, error, file_name) #ifdef U_DEBUG uep->ue_magic = UE_MAGIC; #endif - uep->ue_top = get4c(fp); - uep->ue_bot = get4c(fp); - uep->ue_lcount = get4c(fp); - uep->ue_size = get4c(fp); + uep->ue_top = undo_read_4c(bi); + uep->ue_bot = undo_read_4c(bi); + uep->ue_lcount = undo_read_4c(bi); + uep->ue_size = undo_read_4c(bi); if (uep->ue_size > 0) { array = (char_u **)U_ALLOC_LINE(sizeof(char_u *) * uep->ue_size); @@ -1188,9 +1454,9 @@ unserialize_uep(fp, error, file_name) for (i = 0; i < uep->ue_size; ++i) { - line_len = get4c(fp); + line_len = undo_read_4c(bi); if (line_len >= 0) - line = read_string_decrypt(curbuf, fp, line_len); + line = read_string_decrypt(bi, line_len); else { line = NULL; @@ -1207,83 +1473,71 @@ unserialize_uep(fp, error, file_name) } /* - * Serialize "pos" to "fp". + * Serialize "pos". */ static void -serialize_pos(pos, fp) +serialize_pos(bi, pos) + bufinfo_T *bi; pos_T pos; - FILE *fp; { - put_bytes(fp, (long_u)pos.lnum, 4); - put_bytes(fp, (long_u)pos.col, 4); + undo_write_bytes(bi, (long_u)pos.lnum, 4); + undo_write_bytes(bi, (long_u)pos.col, 4); #ifdef FEAT_VIRTUALEDIT - put_bytes(fp, (long_u)pos.coladd, 4); + undo_write_bytes(bi, (long_u)pos.coladd, 4); #else - put_bytes(fp, (long_u)0, 4); + undo_write_bytes(bi, (long_u)0, 4); #endif } /* - * Unserialize the pos_T at the current position in fp. + * Unserialize the pos_T at the current position. */ static void -unserialize_pos(pos, fp) +unserialize_pos(bi, pos) + bufinfo_T *bi; pos_T *pos; - FILE *fp; { - pos->lnum = get4c(fp); + pos->lnum = undo_read_4c(bi); if (pos->lnum < 0) pos->lnum = 0; - pos->col = get4c(fp); + pos->col = undo_read_4c(bi); if (pos->col < 0) pos->col = 0; #ifdef FEAT_VIRTUALEDIT - pos->coladd = get4c(fp); + pos->coladd = undo_read_4c(bi); if (pos->coladd < 0) pos->coladd = 0; #else - (void)get4c(fp); + (void)undo_read_4c(bi); #endif } /* - * Serialize "info" to "fp". + * Serialize "info". */ static void -serialize_visualinfo(info, fp) +serialize_visualinfo(bi, info) + bufinfo_T *bi; visualinfo_T *info; - FILE *fp; { - serialize_pos(info->vi_start, fp); - serialize_pos(info->vi_end, fp); - put_bytes(fp, (long_u)info->vi_mode, 4); - put_bytes(fp, (long_u)info->vi_curswant, 4); + serialize_pos(bi, info->vi_start); + serialize_pos(bi, info->vi_end); + undo_write_bytes(bi, (long_u)info->vi_mode, 4); + undo_write_bytes(bi, (long_u)info->vi_curswant, 4); } /* - * Unserialize the visualinfo_T at the current position in fp. + * Unserialize the visualinfo_T at the current position. */ static void -unserialize_visualinfo(info, fp) +unserialize_visualinfo(bi, info) + bufinfo_T *bi; visualinfo_T *info; - FILE *fp; { - unserialize_pos(&info->vi_start, fp); - unserialize_pos(&info->vi_end, fp); - info->vi_mode = get4c(fp); - info->vi_curswant = get4c(fp); -} - -/* - * Write the pointer to an undo header. Instead of writing the pointer itself - * we use the sequence number of the header. This is converted back to - * pointers when reading. */ - static void -put_header_ptr(fp, uhp) - FILE *fp; - u_header_T *uhp; -{ - put_bytes(fp, (long_u)(uhp != NULL ? uhp->uh_seq : 0), 4); + unserialize_pos(bi, &info->vi_start); + unserialize_pos(bi, &info->vi_end); + info->vi_mode = undo_read_4c(bi); + info->vi_curswant = undo_read_4c(bi); } /* @@ -1317,8 +1571,11 @@ u_write_undo(name, forceit, buf, hash) struct stat st_old; struct stat st_new; #endif + bufinfo_T bi; + #ifdef FEAT_CRYPT - int do_crypt = FALSE; + bi.bi_state = NULL; + bi.bi_buffer = NULL; #endif if (name == NULL) @@ -1474,14 +1731,12 @@ u_write_undo(name, forceit, buf, hash) u_sync(TRUE); /* - * Write the header. + * Write the header. Initializes encryption, if enabled. */ - if (serialize_header(fp, buf, hash) == FAIL) + bi.bi_buf = buf; + bi.bi_fp = fp; + if (serialize_header(&bi, hash) == FAIL) goto write_error; -#ifdef FEAT_CRYPT - if (*buf->b_p_key != NUL) - do_crypt = TRUE; -#endif /* * Iteratively serialize UHPs and their UEPs from the top down. @@ -1497,7 +1752,7 @@ u_write_undo(name, forceit, buf, hash) #ifdef U_DEBUG ++headers_written; #endif - if (serialize_uhp(fp, buf, uhp) == FAIL) + if (serialize_uhp(&bi, uhp) == FAIL) goto write_error; } @@ -1516,7 +1771,7 @@ u_write_undo(name, forceit, buf, hash) uhp = uhp->uh_next.ptr; } - if (put_bytes(fp, (long_u)UF_HEADER_END_MAGIC, 2) == OK) + if (undo_write_bytes(&bi, (long_u)UF_HEADER_END_MAGIC, 2) == OK) write_ok = TRUE; #ifdef U_DEBUG if (headers_written != buf->b_u_numhead) @@ -1526,6 +1781,11 @@ u_write_undo(name, forceit, buf, hash) } #endif +#ifdef FEAT_CRYPT + if (bi.bi_state != NULL && undo_flush(&bi) == FAIL) + write_ok = FALSE; +#endif + write_error: fclose(fp); if (!write_ok) @@ -1551,8 +1811,9 @@ write_error: theend: #ifdef FEAT_CRYPT - if (do_crypt) - crypt_pop_state(); + if (bi.bi_state != NULL) + crypt_free_state(bi.bi_state); + vim_free(bi.bi_buffer); #endif if (file_name != name) vim_free(file_name); @@ -1598,9 +1859,7 @@ u_read_undo(name, hash, orig_name) struct stat st_orig; struct stat st_undo; #endif -#ifdef FEAT_CRYPT - int do_decrypt = FALSE; -#endif + bufinfo_T bi; if (name == NULL) { @@ -1644,6 +1903,12 @@ u_read_undo(name, hash, orig_name) EMSG2(_("E822: Cannot open undo file for reading: %s"), file_name); goto error; } + bi.bi_buf = curbuf; + bi.bi_fp = fp; +#ifdef FEAT_CRYPT + bi.bi_state = NULL; + bi.bi_buffer = NULL; +#endif /* * Read the undo file header. @@ -1664,12 +1929,24 @@ u_read_undo(name, hash, orig_name) file_name); goto error; } - if (prepare_crypt_read(fp) == FAIL) + bi.bi_state = crypt_create_from_file(fp, curbuf->b_p_key); + if (bi.bi_state == NULL) { EMSG2(_("E826: Undo file decryption failed: %s"), file_name); goto error; } - do_decrypt = TRUE; + if (crypt_whole_undofile(bi.bi_state->method_nr)) + { + bi.bi_buffer = alloc(CRYPT_BUF_SIZE); + if (bi.bi_buffer == NULL) + { + crypt_free_state(bi.bi_state); + bi.bi_state = NULL; + goto error; + } + bi.bi_avail = 0; + bi.bi_used = 0; + } #else EMSG2(_("E827: Undo file is encrypted: %s"), file_name); goto error; @@ -1681,12 +1958,12 @@ u_read_undo(name, hash, orig_name) goto error; } - if (fread(read_hash, UNDO_HASH_SIZE, 1, fp) != 1) + if (undo_read(&bi, read_hash, (size_t)UNDO_HASH_SIZE) == FAIL) { corruption_error("hash", file_name); goto error; } - line_count = (linenr_T)get4c(fp); + line_count = (linenr_T)undo_read_4c(&bi); if (memcmp(hash, read_hash, UNDO_HASH_SIZE) != 0 || line_count != curbuf->b_ml.ml_line_count) { @@ -1703,13 +1980,13 @@ u_read_undo(name, hash, orig_name) } /* Read undo data for "U" command. */ - str_len = get4c(fp); + str_len = undo_read_4c(&bi); if (str_len < 0) goto error; if (str_len > 0) - line_ptr = read_string_decrypt(curbuf, fp, str_len); - line_lnum = (linenr_T)get4c(fp); - line_colnr = (colnr_T)get4c(fp); + line_ptr = read_string_decrypt(&bi, str_len); + line_lnum = (linenr_T)undo_read_4c(&bi); + line_colnr = (colnr_T)undo_read_4c(&bi); if (line_lnum < 0 || line_colnr < 0) { corruption_error("line lnum/col", file_name); @@ -1717,32 +1994,32 @@ u_read_undo(name, hash, orig_name) } /* Begin general undo data */ - old_header_seq = get4c(fp); - new_header_seq = get4c(fp); - cur_header_seq = get4c(fp); - num_head = get4c(fp); - seq_last = get4c(fp); - seq_cur = get4c(fp); - seq_time = get8ctime(fp); + old_header_seq = undo_read_4c(&bi); + new_header_seq = undo_read_4c(&bi); + cur_header_seq = undo_read_4c(&bi); + num_head = undo_read_4c(&bi); + seq_last = undo_read_4c(&bi); + seq_cur = undo_read_4c(&bi); + seq_time = undo_read_time(&bi); /* Optional header fields. */ for (;;) { - int len = getc(fp); + int len = undo_read_byte(&bi); int what; if (len == 0 || len == EOF) break; - what = getc(fp); + what = undo_read_byte(&bi); switch (what) { case UF_LAST_SAVE_NR: - last_save_nr = get4c(fp); + last_save_nr = undo_read_4c(&bi); break; default: /* field not supported, skip */ while (--len >= 0) - (void)getc(fp); + (void)undo_read_byte(&bi); } } @@ -1758,7 +2035,7 @@ u_read_undo(name, hash, orig_name) goto error; } - while ((c = get2c(fp)) == UF_HEADER_MAGIC) + while ((c = undo_read_2c(&bi)) == UF_HEADER_MAGIC) { if (num_read_uhps >= num_head) { @@ -1766,7 +2043,7 @@ u_read_undo(name, hash, orig_name) goto error; } - uhp = unserialize_uhp(fp, file_name); + uhp = unserialize_uhp(&bi, file_name); if (uhp == NULL) goto error; uhp_table[num_read_uhps++] = uhp; @@ -1898,8 +2175,9 @@ error: theend: #ifdef FEAT_CRYPT - if (do_decrypt) - crypt_pop_state(); + if (bi.bi_state != NULL) + crypt_free_state(bi.bi_state); + vim_free(bi.bi_buffer); #endif if (fp != NULL) fclose(fp); diff --git a/src/version.c b/src/version.c index 19183fdac8..30bcb2e0f4 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 399, /**/ 398, /**/ From aff6183dc976d627946a0998d675c02cdda4a292 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 10 Aug 2014 08:38:34 +0200 Subject: [PATCH 032/311] Added tag v7-4-399 for changeset 18ac55444b37 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index bc9ec5c498..5d6641dacf 100644 --- a/.hgtags +++ b/.hgtags @@ -3121,3 +3121,4 @@ d594c15521377493d5e23b03e4dbf5108df69acd v7-4-394 7766142fc7d3e90c2e15a9c606efcd97331edef8 v7-4-396 8d361608fe86c534e51e4c7e583375642d34b7a4 v7-4-397 f62b2e76dd809dc57cad9d0fd8f04a4f3a7193e9 v7-4-398 +18ac55444b37bcae8ea090f7b3abf4826c679bc3 v7-4-399 From eb3a0a7559165f22c403e6306c18d992ba54e82e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 10 Aug 2014 08:46:36 +0200 Subject: [PATCH 033/311] updated for version 7.4.400 Problem: List of distributed files is incomplete. Solution: Add recently added files. --- Filelist | 6 ++++++ src/version.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Filelist b/Filelist index 46aaa964e3..0f4ed1d828 100644 --- a/Filelist +++ b/Filelist @@ -11,6 +11,8 @@ SRC_ALL = \ src/blowfish.c \ src/buffer.c \ src/charset.c \ + src/crypt.c \ + src/crypt_zip.c \ src/diff.c \ src/digraph.c \ src/edit.c \ @@ -103,6 +105,8 @@ SRC_ALL = \ src/proto/blowfish.pro \ src/proto/buffer.pro \ src/proto/charset.pro \ + src/proto/crypt.pro \ + src/proto/crypt_zip.pro \ src/proto/diff.pro \ src/proto/digraph.pro \ src/proto/edit.pro \ @@ -289,6 +293,8 @@ SRC_DOS = \ src/dosinst.h \ src/glbl_ime.cpp \ src/glbl_ime.h \ + src/gui_dwrite.cpp \ + src/gui_dwrite.h \ src/gui_w16.c \ src/gui_w32.c \ src/gui_w48.c \ diff --git a/src/version.c b/src/version.c index 30bcb2e0f4..57c23b5e62 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 400, /**/ 399, /**/ From b565d4f535e8925cf7db12819a4e0a021c871e43 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 10 Aug 2014 08:46:36 +0200 Subject: [PATCH 034/311] Added tag v7-4-400 for changeset 50a658bf4cff --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 5d6641dacf..7bb9561ca0 100644 --- a/.hgtags +++ b/.hgtags @@ -3122,3 +3122,4 @@ d594c15521377493d5e23b03e4dbf5108df69acd v7-4-394 8d361608fe86c534e51e4c7e583375642d34b7a4 v7-4-397 f62b2e76dd809dc57cad9d0fd8f04a4f3a7193e9 v7-4-398 18ac55444b37bcae8ea090f7b3abf4826c679bc3 v7-4-399 +50a658bf4cff030cbe6a97a53bb838b5976c2e1a v7-4-400 From ec05ee396ac20cb1837a53b032ce25fd79686315 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 10 Aug 2014 11:31:50 +0200 Subject: [PATCH 035/311] updated for version 7.4.401 Problem: Can't build on MS-Windows. Solution: Include the new files in all the Makefiles. --- src/Make_bc3.mak | 2 ++ src/Make_bc5.mak | 2 ++ src/Make_cyg.mak | 5 ++++- src/Make_dice.mak | 8 ++++++++ src/Make_djg.mak | 2 ++ src/Make_ivc.mak | 10 ++++++++++ src/Make_manx.mak | 12 ++++++++++++ src/Make_ming.mak | 2 ++ src/Make_morph.mak | 2 ++ src/Make_mvc.mak | 8 ++++++++ src/Make_os2.mak | 4 ++++ src/Make_sas.mak | 10 ++++++++++ src/version.c | 2 ++ 13 files changed, 68 insertions(+), 1 deletion(-) diff --git a/src/Make_bc3.mak b/src/Make_bc3.mak index 54c42acc6a..dea9e1011a 100644 --- a/src/Make_bc3.mak +++ b/src/Make_bc3.mak @@ -54,6 +54,8 @@ EXE_dependencies = \ blowfish.obj \ buffer.obj \ charset.obj \ + crypt.obj \ + crypt_zip.obj \ diff.obj \ digraph.obj \ edit.obj \ diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak index 5769bd64ba..2b759dce17 100644 --- a/src/Make_bc5.mak +++ b/src/Make_bc5.mak @@ -580,6 +580,8 @@ vimobj = \ $(OBJDIR)\blowfish.obj \ $(OBJDIR)\buffer.obj \ $(OBJDIR)\charset.obj \ + $(OBJDIR)\crypt.obj \ + $(OBJDIR)\crypt_zip.obj \ $(OBJDIR)\diff.obj \ $(OBJDIR)\digraph.obj \ $(OBJDIR)\edit.obj \ diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index 24f19c9f2a..4b9985f70a 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -1,6 +1,7 @@ # # Makefile for VIM on Win32, using Cygnus gcc -# Last updated by Dan Sharp. Last Change: 2013 Dec 11 +# Updated by Dan Sharp. +# Last Change: 2014 Aug 10 # # Also read INSTALLpc.txt! # @@ -546,6 +547,8 @@ OBJ = \ $(OUTDIR)/blowfish.o \ $(OUTDIR)/buffer.o \ $(OUTDIR)/charset.o \ + $(OUTDIR)/crypt.o \ + $(OUTDIR)/crypt_zip.o \ $(OUTDIR)/diff.o \ $(OUTDIR)/digraph.o \ $(OUTDIR)/edit.o \ diff --git a/src/Make_dice.mak b/src/Make_dice.mak index e3a8b9e0fb..890f15d09c 100644 --- a/src/Make_dice.mak +++ b/src/Make_dice.mak @@ -29,6 +29,8 @@ SRC = \ blowfish.c \ buffer.c \ charset.c \ + crypt.c \ + crypt_zip.c \ diff.c \ digraph.c \ edit.c \ @@ -75,6 +77,8 @@ SRC = \ OBJ = o/blowfish.o \ o/buffer.o \ o/charset.o \ + o/crypt.o \ + o/crypt_zip.o \ o/diff.o \ o/digraph.o \ o/edit.o \ @@ -143,6 +147,10 @@ o/buffer.o: buffer.c $(SYMS) o/charset.o: charset.c $(SYMS) +o/crypt.o: crypt.c $(SYMS) + +o/crypt_zip.o: crypt_zip.c $(SYMS) + o/diff.o: diff.c $(SYMS) o/digraph.o: digraph.c $(SYMS) diff --git a/src/Make_djg.mak b/src/Make_djg.mak index f2e7c82712..1a92344765 100644 --- a/src/Make_djg.mak +++ b/src/Make_djg.mak @@ -22,6 +22,8 @@ OBJ = \ obj/blowfish.o \ obj/buffer.o \ obj/charset.o \ + obj/crypt.o \ + obj/crypt_zip.o \ obj/diff.o \ obj/digraph.o \ obj/edit.o \ diff --git a/src/Make_ivc.mak b/src/Make_ivc.mak index 16589ea8ad..a891a9743b 100644 --- a/src/Make_ivc.mak +++ b/src/Make_ivc.mak @@ -213,6 +213,8 @@ LINK32_OBJS= \ "$(INTDIR)/blowfish.obj" \ "$(INTDIR)/buffer.obj" \ "$(INTDIR)/charset.obj" \ + "$(INTDIR)/crypt.obj" \ + "$(INTDIR)/crypt_zip.obj" \ "$(INTDIR)/diff.obj" \ "$(INTDIR)/digraph.obj" \ "$(INTDIR)/edit.obj" \ @@ -339,6 +341,14 @@ SOURCE=.\charset.c # End Source File # Begin Source File +SOURCE=.\crypt.c +# End Source File +# Begin Source File + +SOURCE=.\crypt_zip.c +# End Source File +# Begin Source File + SOURCE=.\diff.c # End Source File # Begin Source File diff --git a/src/Make_manx.mak b/src/Make_manx.mak index 101c5c6b32..6305cd381e 100644 --- a/src/Make_manx.mak +++ b/src/Make_manx.mak @@ -37,6 +37,8 @@ DEL = $(SHELL) -c rm -f SRC = blowfish.c \ buffer.c \ charset.c \ + crypt.c \ + crypt_zip.c \ diff.c \ digraph.c \ edit.c \ @@ -85,6 +87,8 @@ INCL = vim.h feature.h keymap.h macros.h ascii.h term.h structs.h os_amiga.h OBJ = obj/blowfish.o \ obj/buffer.o \ obj/charset.o \ + obj/crypt.o \ + obj/crypt_zip.o \ obj/diff.o \ obj/digraph.o \ obj/edit.o \ @@ -131,6 +135,8 @@ OBJ = obj/blowfish.o \ PRO = proto/blowfish.pro \ proto/buffer.pro \ proto/charset.pro \ + proto/crypt.pro \ + proto/crypt_zip.pro \ proto/diff.pro \ proto/digraph.pro \ proto/edit.pro \ @@ -227,6 +233,12 @@ obj/buffer.o: buffer.c obj/charset.o: charset.c $(CCSYM) $@ charset.c +obj/crypt.o: crypt.c + $(CCSYM) $@ crypt.c + +obj/crypt_zip.o: crypt_zip.c + $(CCSYM) $@ crypt_zip.c + obj/diff.o: diff.c $(CCSYM) $@ diff.c diff --git a/src/Make_ming.mak b/src/Make_ming.mak index de1d88fe4c..82988629ee 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -517,6 +517,8 @@ OBJ = \ $(OUTDIR)/blowfish.o \ $(OUTDIR)/buffer.o \ $(OUTDIR)/charset.o \ + $(OUTDIR)/crypt.o \ + $(OUTDIR)/crypt_zip.o \ $(OUTDIR)/diff.o \ $(OUTDIR)/digraph.o \ $(OUTDIR)/edit.o \ diff --git a/src/Make_morph.mak b/src/Make_morph.mak index aa8fbd927a..15a74773c2 100644 --- a/src/Make_morph.mak +++ b/src/Make_morph.mak @@ -27,6 +27,8 @@ RM = rm SRC = blowfish.c \ buffer.c \ charset.c \ + crypt.c \ + crypt_zip.c \ diff.c \ digraph.c \ edit.c \ diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 24069b24e9..c93f4b4aaa 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -547,6 +547,8 @@ OBJ = \ $(OUTDIR)\blowfish.obj \ $(OUTDIR)\buffer.obj \ $(OUTDIR)\charset.obj \ + $(OUTDIR)\crypt.obj \ + $(OUTDIR)\crypt_zip.obj \ $(OUTDIR)\diff.obj \ $(OUTDIR)\digraph.obj \ $(OUTDIR)\edit.obj \ @@ -1092,6 +1094,10 @@ $(OUTDIR)/buffer.obj: $(OUTDIR) buffer.c $(INCL) $(OUTDIR)/charset.obj: $(OUTDIR) charset.c $(INCL) +$(OUTDIR)/crypt.obj: $(OUTDIR) crypt.c $(INCL) + +$(OUTDIR)/crypt_zip.obj: $(OUTDIR) crypt_zip.c $(INCL) + $(OUTDIR)/diff.obj: $(OUTDIR) diff.c $(INCL) $(OUTDIR)/digraph.obj: $(OUTDIR) digraph.c $(INCL) @@ -1278,6 +1284,8 @@ proto.h: \ proto/blowfish.pro \ proto/buffer.pro \ proto/charset.pro \ + proto/crypt.pro \ + proto/crypt_zip.pro \ proto/diff.pro \ proto/digraph.pro \ proto/edit.pro \ diff --git a/src/Make_os2.mak b/src/Make_os2.mak index 42dbdb346e..cd62d1c6d5 100644 --- a/src/Make_os2.mak +++ b/src/Make_os2.mak @@ -42,6 +42,8 @@ OBJ = \ blowfish.o \ buffer.o \ charset.o \ + crypt.o \ + crypt_zip.o \ diff.o \ digraph.o \ edit.o \ @@ -117,6 +119,8 @@ os_unix.o: os_unix.c $(INCL) blowfish.o: blowfish.c $(INCL) buffer.o: buffer.c $(INCL) charset.o: charset.c $(INCL) +crypt.o: crypt.c $(INCL) +crypt_zip.o: crypt_zip.c $(INCL) diff.o: diff.c $(INCL) digraph.o: digraph.c $(INCL) edit.o: edit.c $(INCL) diff --git a/src/Make_sas.mak b/src/Make_sas.mak index bf57c0dcb2..49dcb6bdcd 100644 --- a/src/Make_sas.mak +++ b/src/Make_sas.mak @@ -92,6 +92,8 @@ SRC = \ blowfish.c \ buffer.c \ charset.c \ + crypt.c \ + crypt_zip.c \ diff.c \ digraph.c \ edit.c \ @@ -139,6 +141,8 @@ OBJ = \ blowfish.o \ buffer.o \ charset.o \ + crypt.o \ + crypt_zip.o \ diff.o \ digraph.o \ edit.o \ @@ -186,6 +190,8 @@ PRO = \ proto/blowfish.pro \ proto/buffer.pro \ proto/charset.pro \ + proto/crypt.pro \ + proto/crypt_zip.pro \ proto/diff.pro \ proto/digraph.pro \ proto/edit.pro \ @@ -290,6 +296,10 @@ buffer.o: buffer.c proto/buffer.pro: buffer.c charset.o: charset.c proto/charset.pro: charset.c +crypt.o: crypt.c +proto/crypt.pro: crypt.c +crypt_zip.o: crypt_zip.c +proto/crypt_zip.pro: crypt_zip.c diff.o: diff.c proto/diff.pro: diff.c digraph.o: digraph.c diff --git a/src/version.c b/src/version.c index 57c23b5e62..33cc85dcfd 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 401, /**/ 400, /**/ From 9a76a314693dd24274c5ecbbe3c9e78acaf115a0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 10 Aug 2014 11:31:51 +0200 Subject: [PATCH 036/311] Added tag v7-4-401 for changeset ab71bb81b84e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 7bb9561ca0..7a4e2cf5d9 100644 --- a/.hgtags +++ b/.hgtags @@ -3123,3 +3123,4 @@ d594c15521377493d5e23b03e4dbf5108df69acd v7-4-394 f62b2e76dd809dc57cad9d0fd8f04a4f3a7193e9 v7-4-398 18ac55444b37bcae8ea090f7b3abf4826c679bc3 v7-4-399 50a658bf4cff030cbe6a97a53bb838b5976c2e1a v7-4-400 +ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 From 398fd11458efa2e97d7b66c2cd1974b1c3f28a34 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 12 Aug 2014 15:14:33 +0200 Subject: [PATCH 037/311] updated for version 7.4.402 Problem: Test 72 crashes under certain conditions. (Kazunobu Kuriyama) Solution: Clear the whole bufinfo_T early. --- src/undo.c | 12 +++--------- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/undo.c b/src/undo.c index 1661c8074b..8f50f0f0a8 100644 --- a/src/undo.c +++ b/src/undo.c @@ -929,7 +929,7 @@ undo_write(bi, ptr, len) undo_flush(bi) bufinfo_T *bi; { - if (bi->bi_used > 0) + if (bi->bi_buffer != NULL && bi->bi_used > 0) { crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used); if (fwrite(bi->bi_buffer, bi->bi_used, (size_t)1, bi->bi_fp) != 1) @@ -1573,10 +1573,7 @@ u_write_undo(name, forceit, buf, hash) #endif bufinfo_T bi; -#ifdef FEAT_CRYPT - bi.bi_state = NULL; - bi.bi_buffer = NULL; -#endif + vim_memset(&bi, 0, sizeof(bi)); if (name == NULL) { @@ -1861,6 +1858,7 @@ u_read_undo(name, hash, orig_name) #endif bufinfo_T bi; + vim_memset(&bi, 0, sizeof(bi)); if (name == NULL) { file_name = u_get_undo_file_name(curbuf->b_ffname, TRUE); @@ -1905,10 +1903,6 @@ u_read_undo(name, hash, orig_name) } bi.bi_buf = curbuf; bi.bi_fp = fp; -#ifdef FEAT_CRYPT - bi.bi_state = NULL; - bi.bi_buffer = NULL; -#endif /* * Read the undo file header. diff --git a/src/version.c b/src/version.c index 33cc85dcfd..e98036195f 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 402, /**/ 401, /**/ From 7a5e6c193d1632ef10032151fff6fbe6c9d2525d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 12 Aug 2014 15:14:33 +0200 Subject: [PATCH 038/311] Added tag v7-4-402 for changeset 3aa37ad2c4ed --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 7a4e2cf5d9..dfb3dd8ed5 100644 --- a/.hgtags +++ b/.hgtags @@ -3124,3 +3124,4 @@ f62b2e76dd809dc57cad9d0fd8f04a4f3a7193e9 v7-4-398 18ac55444b37bcae8ea090f7b3abf4826c679bc3 v7-4-399 50a658bf4cff030cbe6a97a53bb838b5976c2e1a v7-4-400 ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 +3aa37ad2c4ed4d4f979e7c7e7d5d88586c6b74ba v7-4-402 From daf331a968f27416910608676af3cce8943d0637 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 13 Aug 2014 16:58:28 +0200 Subject: [PATCH 039/311] updated for version 7.4.403 Problem: Valgrind reports errors when running test 72. (Dominique Pelle) Solution: Reset the local 'cryptmethod' option before storing the seed. Set the seed in the memfile even when there is no block0 yet. --- src/fileio.c | 1 + src/memline.c | 33 ++++++++++++++++++++++++++++++++- src/option.c | 8 ++++++++ src/version.c | 2 ++ 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/fileio.c b/src/fileio.c index a028b22a5c..17490ac21a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2944,6 +2944,7 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) * Avoids accidentally overwriting the file with garbage. */ curbuf->b_p_ro = TRUE; + /* Set the cryptmethod local to the buffer. */ crypt_set_cm_option(curbuf, method); if (cryptkey == NULL && !*did_ask) { diff --git a/src/memline.c b/src/memline.c index a5053f0233..7adb2dc990 100644 --- a/src/memline.c +++ b/src/memline.c @@ -235,6 +235,7 @@ typedef enum { } upd_block0_T; #ifdef FEAT_CRYPT +static void ml_set_mfp_crypt __ARGS((buf_T *buf)); static void ml_set_b0_crypt __ARGS((buf_T *buf, ZERO_BL *b0p)); #endif static int ml_check_b0_id __ARGS((ZERO_BL *b0p)); @@ -432,6 +433,25 @@ error: } #if defined(FEAT_CRYPT) || defined(PROTO) +/* + * Prepare encryption for "buf" for the current key and method. + */ + static void +ml_set_mfp_crypt(buf) + buf_T *buf; +{ + if (*buf->b_p_key != NUL) + { + int method_nr = crypt_get_method_nr(buf); + + if (method_nr > CRYPT_M_ZIP) + { + /* Generate a seed and store it in the memfile. */ + sha2_seed(buf->b_ml.ml_mfp->mf_seed, MF_SEED_LEN, NULL, 0); + } + } +} + /* * Prepare encryption for "buf" with block 0 "b0p". */ @@ -915,8 +935,19 @@ ml_upd_block0(buf, what) ZERO_BL *b0p; mfp = buf->b_ml.ml_mfp; - if (mfp == NULL || (hp = mf_get(mfp, (blocknr_T)0, 1)) == NULL) + if (mfp == NULL) return; + hp = mf_get(mfp, (blocknr_T)0, 1); + if (hp == NULL) + { +#ifdef FEAT_CRYPT + /* Possibly update the seed in the memfile before there is a block0. */ + if (what == UB_CRYPT) + ml_set_mfp_crypt(buf); +#endif + return; + } + b0p = (ZERO_BL *)(hp->bh_data); if (ml_check_b0_id(b0p) == FAIL) EMSG(_("E304: ml_upd_block0(): Didn't get block 0??")); diff --git a/src/option.c b/src/option.c index 62556b69c9..f928b3ba94 100644 --- a/src/option.c +++ b/src/option.c @@ -6163,6 +6163,14 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, p_cm = vim_strsave((char_u *)"zip"); new_value_alloced = TRUE; } + /* When using ":set cm=name" the local value is going to be empty. + * Do that here, otherwise the crypt functions will still use the + * local value. */ + if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) + { + free_string_option(curbuf->b_p_cm); + curbuf->b_p_cm = empty_option; + } /* Need to update the swapfile when the effective method changed. * Set "s" to the effective old value, "p" to the effective new diff --git a/src/version.c b/src/version.c index e98036195f..b832539c0e 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 403, /**/ 402, /**/ From 1c40d5328041f6fb77a8ccc5211a86a745320d70 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 13 Aug 2014 16:58:28 +0200 Subject: [PATCH 040/311] Added tag v7-4-403 for changeset 86fb698a38d5 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index dfb3dd8ed5..2846d4314a 100644 --- a/.hgtags +++ b/.hgtags @@ -3125,3 +3125,4 @@ f62b2e76dd809dc57cad9d0fd8f04a4f3a7193e9 v7-4-398 50a658bf4cff030cbe6a97a53bb838b5976c2e1a v7-4-400 ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 3aa37ad2c4ed4d4f979e7c7e7d5d88586c6b74ba v7-4-402 +86fb698a38d5c10f59928e57da94ce5b3e124a40 v7-4-403 From ce33edef2519f27c1162931e3a91c474f130c8fc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 13 Aug 2014 17:05:53 +0200 Subject: [PATCH 041/311] updated for version 7.4.404 Problem: Windows 64 bit compiler warnings. Solution: Add type casts. (Mike Williams) --- src/crypt.c | 6 +++--- src/undo.c | 6 +++--- src/version.c | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/crypt.c b/src/crypt.c index 758ffb17b2..c54e15c4af 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -397,13 +397,13 @@ crypt_encode_alloc(state, from, len, newptr) return method->encode_buffer_fn(state, from, len, newptr); if (len == 0) /* Not buffering, just return EOF. */ - return len; + return (long)len; - *newptr = alloc(len); + *newptr = alloc((long)len); if (*newptr == NULL) return -1; method->encode_fn(state, from, len, *newptr); - return len; + return (long)len; } /* diff --git a/src/undo.c b/src/undo.c index 8f50f0f0a8..db6ea29ab7 100644 --- a/src/undo.c +++ b/src/undo.c @@ -992,7 +992,7 @@ undo_write_bytes(bi, nr, len) int bufi = 0; for (i = len - 1; i >= 0; --i) - buf[bufi++] = nr >> (i * 8); + buf[bufi++] = (char_u)(nr >> (i * 8)); return undo_write(bi, buf, (size_t)len); } @@ -1093,7 +1093,7 @@ undo_read(bi, buffer, size) #ifdef FEAT_CRYPT if (bi->bi_buffer != NULL) { - int size_todo = size; + int size_todo = (int)size; char_u *p = buffer; while (size_todo > 0) @@ -1119,7 +1119,7 @@ undo_read(bi, buffer, size) n = bi->bi_avail - bi->bi_used; mch_memmove(p, bi->bi_buffer + bi->bi_used, n); bi->bi_used += n; - size_todo -= n; + size_todo -= (int)n; p += n; } return OK; diff --git a/src/version.c b/src/version.c index b832539c0e..42369f1d6e 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 404, /**/ 403, /**/ From f6a13214b118f76b4b812311467590c62cfbee7b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 13 Aug 2014 17:05:54 +0200 Subject: [PATCH 042/311] Added tag v7-4-404 for changeset 0242c27e40e1 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 2846d4314a..0c9a0a6217 100644 --- a/.hgtags +++ b/.hgtags @@ -3126,3 +3126,4 @@ f62b2e76dd809dc57cad9d0fd8f04a4f3a7193e9 v7-4-398 ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 3aa37ad2c4ed4d4f979e7c7e7d5d88586c6b74ba v7-4-402 86fb698a38d5c10f59928e57da94ce5b3e124a40 v7-4-403 +0242c27e40e1ce913ec2b6540371d5ea5fceeac9 v7-4-404 From ccb8d4a773df83cfaed62b446edb6ff6d02c59d5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Aug 2014 11:28:36 +0200 Subject: [PATCH 043/311] updated for version 7.4.405 Problem: Screen updating is slow when using matches. Solution: Do not use the ">=" as in patch 7.4.362, check the lnum. --- src/screen.c | 2 +- src/testdir/test63.in | 23 ++++++++++++++++++++++- src/testdir/test63.ok | 2 ++ src/version.c | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/screen.c b/src/screen.c index 3ab53d9e27..4c134f0e6d 100644 --- a/src/screen.c +++ b/src/screen.c @@ -3858,7 +3858,7 @@ win_line(wp, lnum, startrow, endrow, nochange) { shl->attr_cur = shl->attr; } - else if (v >= (long)shl->endcol) + else if (v >= (long)shl->endcol && shl->lnum == lnum) { shl->attr_cur = 0; next_search_hl(wp, shl, lnum, (colnr_T)v, cur); diff --git a/src/testdir/test63.in b/src/testdir/test63.in index 5ec315ad7a..a161d6745c 100644 --- a/src/testdir/test63.in +++ b/src/testdir/test63.in @@ -3,6 +3,7 @@ Test for ":match", ":2match", ":3match", "clearmatches()", "getmatches()", STARTTEST :so small.vim +:set encoding=utf8 :" --- Check that "matcharg()" returns the correct group and pattern if a match :" --- is defined. :let @r = "*** Test 1: " @@ -164,7 +165,27 @@ STARTTEST :if v1 != v5 && v6 == v1 && v8 == v5 && v10 == v5 && v11 == v1 : let @r .= "OK\n" :else -: let @r .= "FAILED\n" +: let @r .= "FAILED: " . v5 . "/" . v6 . "/" . v8 . "/" . v10 . "/" . v11 . "\n" +:endif +:call clearmatches() +:" +:call setline(1, 'abcdΣabcdef') +:call matchaddpos("MyGroup1", [[1, 4, 2], [1, 9, 2]]) +:1 +:redraw! +:let v1 = screenattr(1, 1) +:let v4 = screenattr(1, 4) +:let v5 = screenattr(1, 5) +:let v6 = screenattr(1, 6) +:let v7 = screenattr(1, 7) +:let v8 = screenattr(1, 8) +:let v9 = screenattr(1, 9) +:let v10 = screenattr(1, 10) +:let @r .= string(getmatches())."\n" +:if v1 != v4 && v5 == v4 && v6 == v1 && v7 == v1 && v8 == v4 && v9 == v4 && v10 == v1 +: let @r .= "OK\n" +:else +: let @r .= "FAILED: " . v4 . "/" . v5 . "/" . v6 . "/" . v7 . "/" . v8 . "/" . v9 . "/" . v10 . "\n" :endif :call clearmatches() G"rp diff --git a/src/testdir/test63.ok b/src/testdir/test63.ok index f804b693ac..5d619395b7 100644 --- a/src/testdir/test63.ok +++ b/src/testdir/test63.ok @@ -12,3 +12,5 @@ Results of test63: *** Test 11: [{'group': 'MyGroup1', 'id': 3, 'priority': 10, 'pos1': [1, 5, 1], 'pos2': [1, 8, 3]}] OK +[{'group': 'MyGroup1', 'id': 11, 'priority': 10, 'pos1': [1, 4, 2], 'pos2': [1, 9, 2]}] +OK diff --git a/src/version.c b/src/version.c index 42369f1d6e..28a3fdb371 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 405, /**/ 404, /**/ From 80c5267c0ca237764f58ad2147410f7dd74f55c6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Aug 2014 11:28:36 +0200 Subject: [PATCH 044/311] Added tag v7-4-405 for changeset 4c25af735304 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0c9a0a6217..8d0a711562 100644 --- a/.hgtags +++ b/.hgtags @@ -3127,3 +3127,4 @@ ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 3aa37ad2c4ed4d4f979e7c7e7d5d88586c6b74ba v7-4-402 86fb698a38d5c10f59928e57da94ce5b3e124a40 v7-4-403 0242c27e40e1ce913ec2b6540371d5ea5fceeac9 v7-4-404 +4c25af735304ff17a27bb3ce21e7f7d3b304ff88 v7-4-405 From 3f3ed9538a9ff051f5278f17e7ddecda78f18223 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Aug 2014 12:34:34 +0200 Subject: [PATCH 045/311] updated for version 7.4.406 Problem: Test 72 and 100 fail on MS-Windows. Solution: Set fileformat to unix in the tests. (Taro Muraoka) --- src/testdir/test100.in | 3 +++ src/testdir/test72.in | 1 + src/version.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/testdir/test100.in b/src/testdir/test100.in index 61d28c15f0..e703f18199 100644 --- a/src/testdir/test100.in +++ b/src/testdir/test100.in @@ -18,6 +18,7 @@ STARTTEST :call FillBuffer() :call feedkeys(":earlier 10\n", 't') :call UndoLevel() +:set ff=unix :%w! test.out :new two :0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)' @@ -27,6 +28,7 @@ STARTTEST :call UndoLevel() :setlocal ul=10 :call UndoLevel() +:set ff=unix :%w >> test.out :wincmd p :redir >>test.out | echo "global value shouldn't be changed and still be 5!" | echo 'ONE: expecting global undolevels: 5, local undolevels: -123456 (default)'|:setglobal undolevels? | echon ' global' | setlocal undolevels? | echon ' local' |echo "" |redir end @@ -35,6 +37,7 @@ STARTTEST :1put ='global value should be changed to 50' :2put ='THREE: expecting global undolevels: 50, local undolevels: -123456 (default)' :call UndoLevel() +:set ff=unix :%w >> test.out :"sleep 10 :" diff --git a/src/testdir/test72.in b/src/testdir/test72.in index 031edbf146..87c25d4863 100644 --- a/src/testdir/test72.in +++ b/src/testdir/test72.in @@ -8,6 +8,7 @@ STARTTEST :" Test 'undofile': first a simple one-line change. :set nocompatible viminfo+=nviminfo visualbell :set ul=100 undofile nomore +:set ff=unix :e! Xtestfile ggdGithis is one line:set ul=100 :s/one/ONE/ diff --git a/src/version.c b/src/version.c index 28a3fdb371..7e5b3cdd51 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 406, /**/ 405, /**/ From 0b39f324175dc082bb2cadf0cd6b56456fa0e549 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Aug 2014 12:34:34 +0200 Subject: [PATCH 046/311] Added tag v7-4-406 for changeset 1134bba900c1 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 8d0a711562..e3c925d0ee 100644 --- a/.hgtags +++ b/.hgtags @@ -3128,3 +3128,4 @@ ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 86fb698a38d5c10f59928e57da94ce5b3e124a40 v7-4-403 0242c27e40e1ce913ec2b6540371d5ea5fceeac9 v7-4-404 4c25af735304ff17a27bb3ce21e7f7d3b304ff88 v7-4-405 +1134bba900c17abcecdc414c6e30da22c17d32a5 v7-4-406 From 4a3587209bdad89c96071e6a4a33b809aeef5cd1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Aug 2014 13:13:03 +0200 Subject: [PATCH 047/311] updated for version 7.4.407 Problem: Inserting text for Visual block mode, with cursor movement, repeats the wrong text. (Aleksandar Ivanov) Solution: Reset the update_Insstart_orig flag. (Christian Brabandt) --- src/edit.c | 10 ++++++++-- src/testdir/test39.in | 8 ++++++++ src/testdir/test39.ok | Bin 481 -> 514 bytes src/version.c | 2 ++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/edit.c b/src/edit.c index 6f30d81f60..29721afa33 100644 --- a/src/edit.c +++ b/src/edit.c @@ -6768,13 +6768,19 @@ stop_arrow() { if (arrow_used) { + Insstart = curwin->w_cursor; /* new insertion starts here */ + if (Insstart.col > Insstart_orig.col && !ins_need_undo) + /* Don't update the original insert position when moved to the + * right, except when nothing was inserted yet. */ + update_Insstart_orig = FALSE; + Insstart_textlen = (colnr_T)linetabsize(ml_get_curline()); + if (u_save_cursor() == OK) { arrow_used = FALSE; ins_need_undo = FALSE; } - Insstart = curwin->w_cursor; /* new insertion starts here */ - Insstart_textlen = (colnr_T)linetabsize(ml_get_curline()); + ai_col = 0; #ifdef FEAT_VREPLACE if (State & VREPLACE_FLAG) diff --git a/src/testdir/test39.in b/src/testdir/test39.in index c1e1cc49a6..7d1c672522 100644 --- a/src/testdir/test39.in +++ b/src/testdir/test39.in @@ -23,6 +23,9 @@ G$khhhhhkkcmno /^aaaa/ :exe ":norm! l\jjjlllI\\ \" :/^aa/,/^$/w >> test.out +/xaaa$/ +:exe ":norm! \jjjI<>\p\" +:/xaaa$/,/^$/w >> test.out :" Test for Visual block was created with the last $ /^A23$/ :exe ":norm! l\j$Aab\" @@ -77,6 +80,11 @@ bbbbbb cccccc dddddd +xaaa +bbbb +cccc +dddd + A23 4567 diff --git a/src/testdir/test39.ok b/src/testdir/test39.ok index ef7a2c6442ca8ae973f2ca86e6105214a166180d..d8e901563af492e50b8f70c470fee5678644dc0c 100644 GIT binary patch delta 39 lcmaFJ+{7|rqKr*}T}5JIA{UTO0s;`73Jw@i~tx91V8`) diff --git a/src/version.c b/src/version.c index 7e5b3cdd51..2b5dc454e5 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 407, /**/ 406, /**/ From 71d35f6c9bbbc231a5a30a4e1722dafd2bb91bd7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Aug 2014 13:13:03 +0200 Subject: [PATCH 048/311] Added tag v7-4-407 for changeset 3f92ef156c66 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e3c925d0ee..2a493eabdc 100644 --- a/.hgtags +++ b/.hgtags @@ -3129,3 +3129,4 @@ ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 0242c27e40e1ce913ec2b6540371d5ea5fceeac9 v7-4-404 4c25af735304ff17a27bb3ce21e7f7d3b304ff88 v7-4-405 1134bba900c17abcecdc414c6e30da22c17d32a5 v7-4-406 +3f92ef156c664fb8fea1f036a4a4c87af487ba6b v7-4-407 From f873c9ce42a4c87c245ccc5538e51296e1e019ae Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Aug 2014 13:36:43 +0200 Subject: [PATCH 049/311] updated for version 7.4.408 Problem: Visual block insert breaks a multi-byte character. Solution: Calculate the position properly. (Yasuhiro Matsumoto) --- src/ops.c | 20 ++++++++++++++++++++ src/testdir/Make_amiga.mak | 16 +++++++++------- src/testdir/Make_dos.mak | 9 +++++---- src/testdir/Make_ming.mak | 9 +++++---- src/testdir/Make_os2.mak | 5 +++-- src/testdir/Make_vms.mms | 11 ++++++----- src/testdir/Makefile | 9 +++++---- src/version.c | 2 ++ 8 files changed, 55 insertions(+), 26 deletions(-) diff --git a/src/ops.c b/src/ops.c index 2b400916f7..86408a4944 100644 --- a/src/ops.c +++ b/src/ops.c @@ -609,6 +609,26 @@ block_insert(oap, s, b_insert, bdp) } } +#ifdef FEAT_MBYTE + if (has_mbyte && spaces > 0) + { + /* Avoid starting halfway a multi-byte character. */ + if (b_insert) + { + int off = (*mb_head_off)(oldp, oldp + offset + spaces); + spaces -= off; + count -= off; + } + else + { + int off = (*mb_off_next)(oldp, oldp + offset); + offset += off; + spaces = 0; + count = 0; + } + } +#endif + newp = alloc_check((unsigned)(STRLEN(oldp)) + s_len + count + 1); if (newp == NULL) continue; diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 030542430c..5012812448 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -38,13 +38,14 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test104.out test105.out test106.out test107.out \ test_autoformat_join.out \ test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ test_changelist.out \ test_eval.out \ test_insertcount.out \ - test_options.out + test_listlbr.out \ + test_listlbr_utf8.out \ + test_options.out \ + test_qf_title.out \ + test_utf8.out .SUFFIXES: .in .out @@ -170,10 +171,11 @@ test106.out: test106.in test107.out: test107.in test_autoformat_join.out: test_autoformat_join.in test_breakindent.out: test_breakindent.in -test_listlbr.out: test_listlbr.in -test_listlbr_utf8.out: test_listlbr_utf8.in -test_qf_title.out: test_qf_title.in test_changelist.out: test_changelist.in test_eval.out: test_eval.in test_insertcount.out: test_insertcount.in +test_listlbr.out: test_listlbr.in +test_listlbr_utf8.out: test_listlbr_utf8.in test_options.out: test_options.in +test_qf_title.out: test_qf_title.in +test_utf8.out: test_utf8.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 232e8809d3..cd7aa4d487 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -37,13 +37,14 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test105.out test106.out test107.out\ test_autoformat_join.out \ test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ test_changelist.out \ test_eval.out \ test_insertcount.out \ - test_options.out + test_listlbr.out \ + test_listlbr_utf8.out \ + test_options.out \ + test_qf_title.out \ + test_utf8.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index eb533c9d0b..782f89d646 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -57,13 +57,14 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test105.out test106.out test107.out \ test_autoformat_join.out \ test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ test_changelist.out \ test_eval.out \ test_insertcount.out \ - test_options.out + test_listlbr.out \ + test_listlbr_utf8.out \ + test_options.out \ + test_qf_title.out \ + test_utf8.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index 0bd0096061..d3e833793a 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -38,14 +38,15 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test100.out test101.out test102.out test103.out test104.out \ test105.out test106.out test107.out \ test_autoformat_join.out \ + test_breakindent.out \ test_changelist.out \ test_eval.out \ test_insertcount.out \ - test_breakindent.out \ test_listlbr.out \ test_listlbr_utf8.out \ + test_options.out \ test_qf_title.out \ - test_options.out + test_utf8.out .SUFFIXES: .in .out diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 7ccdf24e72..3c7afc346d 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # -# Last change: 2014 Jul 30 +# Last change: 2014 Aug 16 # # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # Edit the lines in the Configuration section below to select. @@ -98,13 +98,14 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test105.out test106.out test107.out \ test_autoformat_join.out \ test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ test_changelist.out \ test_eval.out \ test_insertcount.out \ - test_options.out + test_listlbr.out \ + test_listlbr_utf8.out \ + test_options.out \ + test_qf_title.out \ + test_utf8.out # Known problems: # test17: ? diff --git a/src/testdir/Makefile b/src/testdir/Makefile index f2b2216378..59fe011696 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -35,13 +35,14 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test104.out test105.out test106.out test107.out \ test_autoformat_join.out \ test_breakindent.out \ - test_listlbr.out \ - test_listlbr_utf8.out \ - test_qf_title.out \ test_changelist.out \ test_eval.out \ test_insertcount.out \ - test_options.out + test_listlbr.out \ + test_listlbr_utf8.out \ + test_options.out \ + test_qf_title.out \ + test_utf8.out SCRIPTS_GUI = test16.out diff --git a/src/version.c b/src/version.c index 2b5dc454e5..4a876b5c72 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 408, /**/ 407, /**/ From 4200579fb96d2056c650702e4a92b04471a31525 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Aug 2014 13:36:43 +0200 Subject: [PATCH 050/311] Added tag v7-4-408 for changeset cb3218a69c2f --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 2a493eabdc..8f2b08a461 100644 --- a/.hgtags +++ b/.hgtags @@ -3130,3 +3130,4 @@ ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 4c25af735304ff17a27bb3ce21e7f7d3b304ff88 v7-4-405 1134bba900c17abcecdc414c6e30da22c17d32a5 v7-4-406 3f92ef156c664fb8fea1f036a4a4c87af487ba6b v7-4-407 +cb3218a69c2f0949bbff5bcf9beeccc83ef2ef59 v7-4-408 From 8a72f409a45292cd333b736b3ccd269d9a1c99ca Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 16 Aug 2014 14:45:02 +0200 Subject: [PATCH 051/311] Add files missing from 7.4.408. --- src/testdir/test_utf8.in | 18 ++++++++++++++++++ src/testdir/test_utf8.ok | 4 ++++ 2 files changed, 22 insertions(+) create mode 100644 src/testdir/test_utf8.in create mode 100644 src/testdir/test_utf8.ok diff --git a/src/testdir/test_utf8.in b/src/testdir/test_utf8.in new file mode 100644 index 0000000000..713fee2c8f --- /dev/null +++ b/src/testdir/test_utf8.in @@ -0,0 +1,18 @@ +Tests for Unicode manipulations vim: set ft=vim : + +STARTTEST +:so small.vim +:set encoding=utf-8 +:" Visual block Insert adjusts for multi-byte char +:new +:call setline(1, ["aaa", "あああ", "bbb"]) +:exe ":norm! gg0l\jjIx\" +:let r = getline(1, '$') +: +:bwipeout! +:$put=r +:call garbagecollect(1) +:/^start:/,$wq! test.out +ENDTEST + +start: diff --git a/src/testdir/test_utf8.ok b/src/testdir/test_utf8.ok new file mode 100644 index 0000000000..c5bed54856 --- /dev/null +++ b/src/testdir/test_utf8.ok @@ -0,0 +1,4 @@ +start: +axaa +xあああ +bxbb From c586422c1634416ce2292fdc5aa3309711bad2dc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Aug 2014 12:05:44 +0200 Subject: [PATCH 052/311] updated for version 7.4.409 Problem: Can't build with Perl on Fedora 20. Solution: Find xsubpp in another directory. (Michael Henry) --- src/Makefile | 2 +- src/auto/configure | 9 +++++++++ src/config.mk.in | 3 ++- src/configure.in | 8 ++++++++ src/version.c | 2 ++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index 772b15c7d6..64691a39bc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2477,7 +2477,7 @@ lintinstall: auto/if_perl.c: if_perl.xs $(PERL) -e 'unless ( $$] >= 5.005 ) { for (qw(na defgv errgv)) { print "#define PL_$$_ $$_\n" }}' > $@ - $(PERL) $(PERLLIB)/ExtUtils/xsubpp -prototypes -typemap \ + $(PERL) $(PERL_XSUBPP) -prototypes -typemap \ $(PERLLIB)/ExtUtils/typemap if_perl.xs >> $@ auto/osdef.h: auto/config.h osdef.sh osdef1.h.in osdef2.h.in diff --git a/src/auto/configure b/src/auto/configure index 30db8a022f..b0fba306e6 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -687,6 +687,7 @@ PERL_PRO PERL_OBJ PERL_SRC shrpenv +vi_cv_perl_xsubpp vi_cv_perllib vi_cv_path_perl MZSCHEME_MZC @@ -5604,6 +5605,14 @@ $as_echo "OK" >&6; } fi vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'` + vi_cv_perl_extutils=unknown_perl_extutils_path + for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do + xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp" + if test -f "$xsubpp_path"; then + vi_cv_perl_xsubpp="$xsubpp_path" + fi + done + perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[^ ]*//'` perllibs=`cd $srcdir; $vi_cv_path_perl -MExtUtils::Embed -e 'ldopts' | \ diff --git a/src/config.mk.in b/src/config.mk.in index bd5649e4d7..15b5a62390 100644 --- a/src/config.mk.in +++ b/src/config.mk.in @@ -48,11 +48,12 @@ MZSCHEME_SRC = @MZSCHEME_SRC@ MZSCHEME_OBJ = @MZSCHEME_OBJ@ MZSCHEME_CFLAGS = @MZSCHEME_CFLAGS@ MZSCHEME_PRO = @MZSCHEME_PRO@ -MZSCHEME_EXTRA = @MZSCHEME_EXTRA@ +MZSCHEME_EXTRA = @MZSCHEME_EXTRA@ MZSCHEME_MZC = @MZSCHEME_MZC@ PERL = @vi_cv_path_perl@ PERLLIB = @vi_cv_perllib@ +PERL_XSUBPP = @vi_cv_perl_xsubpp@ PERL_LIBS = @PERL_LIBS@ SHRPENV = @shrpenv@ PERL_SRC = @PERL_SRC@ diff --git a/src/configure.in b/src/configure.in index 1cee1e61d1..62785e171c 100644 --- a/src/configure.in +++ b/src/configure.in @@ -933,6 +933,14 @@ if test "$enable_perlinterp" = "yes" -o "$enable_perlinterp" = "dynamic"; then fi vi_cv_perllib=`$vi_cv_path_perl -MConfig -e 'print $Config{privlibexp}'` AC_SUBST(vi_cv_perllib) + vi_cv_perl_extutils=unknown_perl_extutils_path + for extutils_rel_path in ExtUtils vendor_perl/ExtUtils; do + xsubpp_path="$vi_cv_perllib/$extutils_rel_path/xsubpp" + if test -f "$xsubpp_path"; then + vi_cv_perl_xsubpp="$xsubpp_path" + fi + done + AC_SUBST(vi_cv_perl_xsubpp) dnl Remove "-fno-something", it breaks using cproto. perlcppflags=`$vi_cv_path_perl -Mlib=$srcdir -MExtUtils::Embed \ -e 'ccflags;perl_inc;print"\n"' | sed -e 's/-fno[[^ ]]*//'` diff --git a/src/version.c b/src/version.c index 4a876b5c72..f7084a7cd6 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 409, /**/ 408, /**/ From 66fc3222d9b1741e6546c4816165bf3dccdf2cca Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Aug 2014 12:05:44 +0200 Subject: [PATCH 053/311] Added tag v7-4-409 for changeset de35e123e63c --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 8f2b08a461..7880c10481 100644 --- a/.hgtags +++ b/.hgtags @@ -3131,3 +3131,4 @@ ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 1134bba900c17abcecdc414c6e30da22c17d32a5 v7-4-406 3f92ef156c664fb8fea1f036a4a4c87af487ba6b v7-4-407 cb3218a69c2f0949bbff5bcf9beeccc83ef2ef59 v7-4-408 +de35e123e63c326be4a576f8e678ed9e63ed1f48 v7-4-409 From 19867249fbf526200e9afc30f9f21323f5d7fb24 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Aug 2014 12:24:07 +0200 Subject: [PATCH 054/311] updated for version 7.4.410 Problem: Fold does not open after search when there is a CmdwinLeave autocommand. Solution: Restore KeyTyped. (Jacob Niehus) --- src/ex_getln.c | 14 ++++++++++++++ src/version.c | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/ex_getln.c b/src/ex_getln.c index fcc1d600a6..6ca707e432 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -6363,6 +6363,9 @@ ex_window() #ifdef FEAT_RIGHTLEFT int save_cmdmsg_rl = cmdmsg_rl; #endif +#ifdef FEAT_FOLDING + int save_KeyTyped; +#endif /* Can't do this recursively. Can't do it when typing a password. */ if (cmdwin_type != 0 @@ -6497,8 +6500,19 @@ ex_window() RedrawingDisabled = i; # ifdef FEAT_AUTOCMD + +# ifdef FEAT_FOLDING + save_KeyTyped = KeyTyped; +# endif + /* Trigger CmdwinLeave autocommands. */ apply_autocmds(EVENT_CMDWINLEAVE, typestr, typestr, FALSE, curbuf); + +# ifdef FEAT_FOLDING + /* Restore KeyTyped in case it is modified by autocommands */ + KeyTyped = save_KeyTyped; +# endif + # endif /* Restore the command line info. */ diff --git a/src/version.c b/src/version.c index f7084a7cd6..7126b8b9ed 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 410, /**/ 409, /**/ From a2d1cee15b309a639be55fba5b500b65256e4bca Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 17 Aug 2014 12:24:07 +0200 Subject: [PATCH 055/311] Added tag v7-4-410 for changeset 2fd550c75256 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 7880c10481..e06b455e17 100644 --- a/.hgtags +++ b/.hgtags @@ -3132,3 +3132,4 @@ ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 3f92ef156c664fb8fea1f036a4a4c87af487ba6b v7-4-407 cb3218a69c2f0949bbff5bcf9beeccc83ef2ef59 v7-4-408 de35e123e63c326be4a576f8e678ed9e63ed1f48 v7-4-409 +2fd550c75256cc1ecf06a4afc6a856b305cf7a8a v7-4-410 From bf376115fbd39620f67dbf0837fe71edb69743c4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Aug 2014 08:13:27 +0200 Subject: [PATCH 056/311] updated for version 7.4.411 Problem: "foo bar" sorts before "foo" with sort(). (John Little) Solution: Avoid putting quotes around strings before comparing them. --- src/eval.c | 32 +++++++++++++++++++++++++++----- src/version.c | 2 ++ 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/eval.c b/src/eval.c index ae8331d5aa..654e4187d5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -17382,16 +17382,38 @@ item_compare(s1, s2) const void *s2; { sortItem_T *si1, *si2; + typval_T *tv1, *tv2; char_u *p1, *p2; - char_u *tofree1, *tofree2; + char_u *tofree1 = NULL, *tofree2 = NULL; int res; char_u numbuf1[NUMBUFLEN]; char_u numbuf2[NUMBUFLEN]; si1 = (sortItem_T *)s1; si2 = (sortItem_T *)s2; - p1 = tv2string(&si1->item->li_tv, &tofree1, numbuf1, 0); - p2 = tv2string(&si2->item->li_tv, &tofree2, numbuf2, 0); + tv1 = &si1->item->li_tv; + tv2 = &si2->item->li_tv; + /* tv2string() puts quotes around a string and allocates memory. Don't do + * that for string variables. Use a single quote when comparing with a + * non-string to do what the docs promise. */ + if (tv1->v_type == VAR_STRING) + { + if (tv2->v_type != VAR_STRING || item_compare_numeric) + p1 = (char_u *)"'"; + else + p1 = tv1->vval.v_string; + } + else + p1 = tv2string(tv1, &tofree1, numbuf1, 0); + if (tv2->v_type == VAR_STRING) + { + if (tv1->v_type != VAR_STRING || item_compare_numeric) + p2 = (char_u *)"'"; + else + p2 = tv2->vval.v_string; + } + else + p2 = tv2string(tv2, &tofree2, numbuf2, 0); if (p1 == NULL) p1 = (char_u *)""; if (p2 == NULL) @@ -17411,8 +17433,8 @@ item_compare(s1, s2) res = n1 == n2 ? 0 : n1 > n2 ? 1 : -1; } - /* When the result would be zero, compare the pointers themselves. Makes - * the sort stable. */ + /* When the result would be zero, compare the item indexes. Makes the + * sort stable. */ if (res == 0 && !item_compare_keep_zero) res = si1->idx > si2->idx ? 1 : -1; diff --git a/src/version.c b/src/version.c index 7126b8b9ed..93660b44b5 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 411, /**/ 410, /**/ From eaffe55f3b6fc108b6dc938ac6ae8525e81e3b4e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Aug 2014 08:13:28 +0200 Subject: [PATCH 057/311] Added tag v7-4-411 for changeset d4e0c197e979 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e06b455e17..949232fd41 100644 --- a/.hgtags +++ b/.hgtags @@ -3133,3 +3133,4 @@ ab71bb81b84e9a1cdf030b172f61d779ccda975c v7-4-401 cb3218a69c2f0949bbff5bcf9beeccc83ef2ef59 v7-4-408 de35e123e63c326be4a576f8e678ed9e63ed1f48 v7-4-409 2fd550c75256cc1ecf06a4afc6a856b305cf7a8a v7-4-410 +d4e0c197e97968050596f4c441552383e31db63b v7-4-411 From 7d5b2cbb36b661f7222267d4df108d586a05ba8d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Aug 2014 13:12:57 +0200 Subject: [PATCH 058/311] updated for version 7.4.412 Problem: Can't build on Windows XP with MSVC. Solution: Add SUBSYSTEM_VER to the Makefile. (Yongwei Wu) --- src/INSTALLpc.txt | 24 ++++++++++++++++++++++++ src/Make_mvc.mak | 4 ++++ src/version.c | 2 ++ 3 files changed, 30 insertions(+) diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt index 7ba2801b0a..370c208eec 100644 --- a/src/INSTALLpc.txt +++ b/src/INSTALLpc.txt @@ -192,6 +192,30 @@ To set the environment execute the msvc2010.bat script. You can then build Vim with Make_mvc.mak. +Targeting Windows XP with new MSVC *new-msvc-windows-xp* +---------------------------------- + +Beginning with Visual C++ 2010, Microsoft changed the behavior of LINK.EXE +so that it targets Windows 6.0 (Vista) by default. In order to override +this, the target Windows version number needs to be passed to LINK like +follows: + LINK ... /subsystem:console,5.01 + +Make_mvc.mak now supports a macro SUBSYSTEM_VER to pass the Windows version. +Use lines like follows to target Windows XP (assuming using Visual C++ 2012 +under 64-bit Windows): + set WinSdk71=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A + set SDK_INCLUDE_DIR=%WinSdk71%\Include + set INCLUDE=%WinSdk71%\Include;%INCLUDE% + set LIB=%WinSdk71%\Lib;%LIB% + set PATH=%WinSdk71%\Bin;%PATH% + set CL=/D_USING_V110_SDK71_ + nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.01 + +The following Visual C++ team blog can serve as a reference page: + http://blogs.msdn.com/b/vcblog/archive/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012.aspx + + 2. MinGW ======== diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index c93f4b4aaa..31bcd68440 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -657,6 +657,10 @@ GUI_LIB = \ SUBSYSTEM = console !endif +!if "$(SUBSYSTEM_VER)" != "" +SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER) +!endif + !if "$(GUI)" == "yes" && "$(DIRECTX)" == "yes" CFLAGS = $(CFLAGS) $(DIRECTX_DEFS) GUI_INCL = $(GUI_INCL) $(DIRECTX_INCL) diff --git a/src/version.c b/src/version.c index 93660b44b5..40b7ae483a 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 412, /**/ 411, /**/ From 9743a03d80efb64d387bfe38e1df4337f9bc81cf Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Aug 2014 13:12:57 +0200 Subject: [PATCH 059/311] Added tag v7-4-412 for changeset 4c845a1600d2 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 949232fd41..220b11b517 100644 --- a/.hgtags +++ b/.hgtags @@ -3134,3 +3134,4 @@ cb3218a69c2f0949bbff5bcf9beeccc83ef2ef59 v7-4-408 de35e123e63c326be4a576f8e678ed9e63ed1f48 v7-4-409 2fd550c75256cc1ecf06a4afc6a856b305cf7a8a v7-4-410 d4e0c197e97968050596f4c441552383e31db63b v7-4-411 +4c845a1600d28db8edabd211e6d7a9cd03883ea6 v7-4-412 From 25664af32559b72ec955a24f4ea63ae17101118c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Aug 2014 13:44:33 +0200 Subject: [PATCH 060/311] updated for version 7.4.413 Problem: MS-Windows: Using US international keyboard layout, inserting dead key by pressing space does not always work. Issue 250. Solution: Let MS-Windows translate the message. (John Wellesz) --- src/gui_w48.c | 31 +++++++++++++++---------------- src/version.c | 2 ++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/gui_w48.c b/src/gui_w48.c index ae4c921c0d..cd7fdde549 100644 --- a/src/gui_w48.c +++ b/src/gui_w48.c @@ -614,6 +614,8 @@ _OnChar( char_u string[40]; int len = 0; + dead_key = 0; + len = char_to_string(ch, string, 40, FALSE); if (len == 1 && string[0] == Ctrl_C && ctrl_c_interrupts) { @@ -1788,24 +1790,21 @@ process_message(void) if (msg.message == WM_KEYDOWN || msg.message == WM_SYSKEYDOWN) { vk = (int) msg.wParam; - /* handle key after dead key, but ignore shift, alt and control */ - if (dead_key && vk != VK_SHIFT && vk != VK_MENU && vk != VK_CONTROL) + /* + * If a dead key was pressed and the user presses VK_SPACE, VK_BACK, or + * VK_ESCAPE it means that he actually wants to deal with the dead char + * now, so do nothing special and let Windows handle it. + * + * Note that VK_SPACE combines with the dead_key's character and only + * one WM_CHAR will be generated by TranslateMessage(), in the two + * other cases two WM_CHAR will be generated: the dead char and VK_BACK + * or VK_ESCAPE. That is most likely what the user expects. + */ + if (dead_key && (vk == VK_SPACE || vk == VK_BACK || vk == VK_ESCAPE)) { dead_key = 0; - /* handle non-alphabetic keys (ones that hopefully cannot generate - * umlaut-characters), unless when control is down */ - if (vk < 'A' || vk > 'Z' || (GetKeyState(VK_CONTROL) & 0x8000)) - { - MSG dm; - - dm.message = msg.message; - dm.hwnd = msg.hwnd; - dm.wParam = VK_SPACE; - MyTranslateMessage(&dm); /* generate dead character */ - if (vk != VK_SPACE) /* and send current character once more */ - PostMessage(msg.hwnd, msg.message, msg.wParam, msg.lParam); - return; - } + MyTranslateMessage(&msg); + return; } /* Check for CTRL-BREAK */ diff --git a/src/version.c b/src/version.c index 40b7ae483a..e742d187c1 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 413, /**/ 412, /**/ From c868bdbe1e9fce557399c095977621974527fcf5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Aug 2014 13:44:34 +0200 Subject: [PATCH 061/311] Added tag v7-4-413 for changeset 121613e72e39 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 220b11b517..5b3ad613ec 100644 --- a/.hgtags +++ b/.hgtags @@ -3135,3 +3135,4 @@ de35e123e63c326be4a576f8e678ed9e63ed1f48 v7-4-409 2fd550c75256cc1ecf06a4afc6a856b305cf7a8a v7-4-410 d4e0c197e97968050596f4c441552383e31db63b v7-4-411 4c845a1600d28db8edabd211e6d7a9cd03883ea6 v7-4-412 +121613e72e397db495f5e9b640b249aead5a61c1 v7-4-413 From 9590ab8d2853ce9ac62e218b88ec2aabe14eaef9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Aug 2014 14:21:47 +0200 Subject: [PATCH 062/311] Updated runtime files. --- runtime/autoload/phpcomplete.vim | 121 +++++- runtime/compiler/go.vim | 29 ++ runtime/doc/cmdline.txt | 5 +- runtime/doc/eval.txt | 16 +- runtime/doc/insert.txt | 4 +- runtime/doc/options.txt | 2 +- runtime/doc/pattern.txt | 19 +- runtime/doc/quickref.txt | 3 +- runtime/doc/tags | 5 + runtime/doc/todo.txt | 94 +++-- runtime/doc/usr_41.txt | 3 +- runtime/doc/various.txt | 2 +- runtime/filetype.vim | 7 +- runtime/ftplugin/go.vim | 18 + runtime/ftplugin/vroom.vim | 2 +- runtime/indent/go.vim | 78 ++++ runtime/indent/sh.vim | 6 +- runtime/indent/vroom.vim | 2 +- runtime/optwin.vim | 6 +- runtime/synmenu.vim | 3 +- runtime/syntax/gnuplot.vim | 654 ++++++++++++++++++++++++------- runtime/syntax/go.vim | 208 ++++++++++ runtime/syntax/godoc.vim | 21 + runtime/syntax/vroom.vim | 2 +- runtime/tutor/tutor.es.utf-8 | 2 +- runtime/tutor/tutor.fr | 4 +- runtime/tutor/tutor.fr.utf-8 | 4 +- runtime/tutor/tutor.ja.euc | 7 +- runtime/tutor/tutor.ja.sjis | 7 +- runtime/tutor/tutor.ja.utf-8 | 7 +- runtime/tutor/tutor.pt | 4 +- runtime/tutor/tutor.pt.utf-8 | 4 +- runtime/tutor/tutor.utf-8 | 4 +- runtime/tutor/tutor.zh.big5 | 4 +- runtime/tutor/tutor.zh.euc | 4 +- runtime/tutor/tutor.zh.utf-8 | 4 +- runtime/tutor/tutor.zh_cn.utf-8 | 4 +- runtime/tutor/tutor.zh_tw.utf-8 | 4 +- 38 files changed, 1111 insertions(+), 262 deletions(-) create mode 100644 runtime/compiler/go.vim create mode 100644 runtime/ftplugin/go.vim create mode 100644 runtime/indent/go.vim create mode 100644 runtime/syntax/go.vim create mode 100644 runtime/syntax/godoc.vim diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index 0bdcd5d5fb..c00e55cc1e 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2014 May 30 +" Last Change: 2014 Jul 24 " " OPTIONS: " @@ -277,7 +277,7 @@ endfunction " }}} function! phpcomplete#CompleteGeneral(base, current_namespace, imports) " {{{ - " Complete everything else - + " Complete everything " + functions, DONE " + keywords of language DONE " + defines (constant definitions), DONE @@ -949,12 +949,11 @@ function! phpcomplete#CompleteUserClass(context, base, sccontent, visibility) " endif endfor - let jvars = join(variables, ' ') - let svars = split(jvars, '\$') + let static_vars = split(join(variables, ' '), '\$') let c_variables = {} let var_index = 0 - for i in svars + for i in static_vars let c_var = matchstr(i, \ '^\zs[a-zA-Z_\x7f-\xff][a-zA-Z_0-9\x7f-\xff]*\ze') if c_var != '' @@ -1083,7 +1082,6 @@ endfunction " }}} function! phpcomplete#GetTaglist(pattern) " {{{ - let cache_checksum = '' if g:phpcomplete_cache_taglists == 1 " build a string with format of ":$:..." @@ -1447,6 +1445,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " Get class name " Class name can be detected in few ways: " @var $myVar class + " @var class $myVar " in the same line (php 5.4 (new Class)-> syntax) " line above " or line in tags file @@ -1525,6 +1524,11 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let object_is_array = (object =~ '\v^[^[]+\[' ? 1 : 0) let object = matchstr(object, variable_name_pattern) + let function_boundary = phpcomplete#GetCurrentFunctionBoundaries() + let search_end_line = max([1, function_boundary[0][0]]) + " -1 makes us ignore the current line (where the completion was invoked + let lines = reverse(getline(search_end_line, line('.') - 1)) + " check Constant lookup let constant_object = matchstr(a:context, '\zs'.class_name_pattern.'\ze::') if constant_object != '' @@ -1533,21 +1537,20 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor if classname_candidate == '' " scan the file backwards from current line for explicit type declaration (@var $variable Classname) - let i = 1 " start from the current line - 1 - while i < a:start_line - let line = getline(a:start_line - i) + for line in lines " in file lookup for /* @var $foo Class */ if line =~# '@var\s\+'.object.'\s\+'.class_name_pattern let classname_candidate = matchstr(line, '@var\s\+'.object.'\s\+\zs'.class_name_pattern.'\(\[\]\)\?') let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, a:current_namespace, a:imports) break - elseif line !~ '^\s*$' - " type indicator comments should be next to the variable - " non empty lines break the search + endif + " in file lookup for /* @var Class $foo */ + if line =~# '@var\s\+'.class_name_pattern.'\s\+'.object + let classname_candidate = matchstr(line, '@var\s\+\zs'.class_name_pattern.'\(\[\]\)\?\ze'.'\s\+'.object) + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, a:current_namespace, a:imports) break endif - let i += 1 - endwhile + endfor endif if classname_candidate != '' @@ -1555,12 +1558,9 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " return absolute classname, without leading \ return (class_candidate_namespace == '\' || class_candidate_namespace == '') ? classname_candidate : class_candidate_namespace.'\'.classname_candidate endif - " scan the file backwards from the current line let i = 1 - while i < a:start_line " {{{ - let line = getline(a:start_line - i) - + for line in lines " {{{ " do in-file lookup of $var = new Class if line =~# '^\s*'.object.'\s*=\s*new\s\+'.class_name_pattern && !object_is_array let classname_candidate = matchstr(line, object.'\c\s*=\s*new\s*\zs'.class_name_pattern.'\ze') @@ -1722,7 +1722,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor endif let i += 1 - endwhile " }}} + endfor " }}} if classname_candidate != '' let [classname_candidate, class_candidate_namespace] = phpcomplete#GetCallChainReturnType(classname_candidate, class_candidate_namespace, class_candidate_imports, methodstack) @@ -1962,7 +1962,9 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam let namespace = '\' endif let classlocation = phpcomplete#GetClassLocation(extends_class, namespace) - if classlocation != '' && filereadable(classlocation) + if classlocation == "VIMPHP_BUILTINOBJECT" + let result += [phpcomplete#GenerateBuiltinClassStub(g:php_builtin_classes[tolower(extends_class)])] + elseif classlocation != '' && filereadable(classlocation) let full_file_path = fnamemodify(classlocation, ':p') let result += phpcomplete#GetClassContentsStructure(full_file_path, readfile(full_file_path), extends_class) elseif tolower(current_namespace) == tolower(namespace) @@ -1985,6 +1987,51 @@ function! phpcomplete#GetClassContents(classlocation, class_name) " {{{ endfunction " }}} +function! phpcomplete#GenerateBuiltinClassStub(class_info) " {{{ + let re = 'class '.a:class_info['name']." {" + for [name, initializer] in items(a:class_info.constants) + let re .= "\n\tconst ".name." = ".initializer.";" + endfor + for [name, info] in items(a:class_info.properties) + let re .= "\n\t// @var $".name." ".info.type + let re .= "\n\tpublic $".name.";" + endfor + for [name, info] in items(a:class_info.static_properties) + let re .= "\n\t// @var ".name." ".info.type + let re .= "\n\tpublic static ".name." = ".info.initializer.";" + endfor + for [name, info] in items(a:class_info.methods) + if name =~ '^__' + continue + endif + let re .= "\n\t/**" + let re .= "\n\t * ".name + let re .= "\n\t *" + let re .= "\n\t * @return ".info.return_type + let re .= "\n\t */" + let re .= "\n\tpublic function ".name."(".info.signature."){" + let re .= "\n\t}" + endfor + for [name, info] in items(a:class_info.static_methods) + let re .= "\n\t/**" + let re .= "\n\t * ".name + let re .= "\n\t *" + let re .= "\n\t * @return ".info.return_type + let re .= "\n\t */" + let re .= "\n\tpublic static function ".name."(".info.signature."){" + let re .= "\n\t}" + endfor + let re .= "\n}" + + return { 'class': a:class_info['name'], + \ 'content': re, + \ 'namespace': '', + \ 'imports': {}, + \ 'file': 'VIMPHP_BUILTINOBJECT', + \ 'mtime': 0, + \ } +endfunction " }}} + function! phpcomplete#GetDocBlock(sccontent, search) " {{{ let i = 0 let l = 0 @@ -2307,6 +2354,40 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ endfunction " }}} +function! phpcomplete#GetCurrentFunctionBoundaries() " {{{ + let old_cursor_pos = [line('.'), col('.')] + let current_line_no = old_cursor_pos[0] + let function_pattern = '\c\(.*\%#\)\@!\_^\s*\zs\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function\_.\{-}(\_.\{-})\_.\{-}{' + + let func_start_pos = searchpos(function_pattern, 'Wbc') + if func_start_pos == [0, 0] + call cursor(old_cursor_pos[0], old_cursor_pos[1]) + return 0 + endif + + " get the line where the function declaration actually started + call search('\cfunction\_.\{-}(\_.\{-})\_.\{-}{', 'Wce') + + " get the position of the function block's closing "}" + let func_end_pos = searchpairpos('{', '', '}', 'W') + if func_end_pos == [0, 0] + " there is a function start but no end found, assume that we are in a + " function but the user did not typed the closing "}" yet and the + " function runs to the end of the file + let func_end_pos = [line('$'), len(getline(line('$')))] + endif + + " Decho func_start_pos[0].' <= '.current_line_no.' && '.current_line_no.' <= '.func_end_pos[0] + if func_start_pos[0] <= current_line_no && current_line_no <= func_end_pos[0] + call cursor(old_cursor_pos[0], old_cursor_pos[1]) + return [func_start_pos, func_end_pos] + endif + + call cursor(old_cursor_pos[0], old_cursor_pos[1]) + return 0 +endfunction +" }}} + function! phpcomplete#ExpandClassName(classname, current_namespace, imports) " {{{ " if there's an imported class, just use that class's information if has_key(a:imports, a:classname) && (a:imports[a:classname].kind == 'c' || a:imports[a:classname].kind == 'i') diff --git a/runtime/compiler/go.vim b/runtime/compiler/go.vim new file mode 100644 index 0000000000..cf638f23d6 --- /dev/null +++ b/runtime/compiler/go.vim @@ -0,0 +1,29 @@ +" Vim compiler file +" Compiler: Go +" Maintainer: David Barnett (https://github.com/google/vim-ft-go) +" Last Change: 2014 Aug 16 + +if exists('current_compiler') + finish +endif +let current_compiler = 'go' + +if exists(':CompilerSet') != 2 + command -nargs=* CompilerSet setlocal +endif + +let s:save_cpo = &cpo +set cpo-=C + +CompilerSet makeprg=go\ build +CompilerSet errorformat= + \%-G#\ %.%#, + \%A%f:%l:%c:\ %m, + \%A%f:%l:\ %m, + \%C%*\\s%m, + \%-G%.%# + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: sw=2 sts=2 et diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index f58389af8c..a31f7107f5 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 7.4. Last change: 2014 Feb 23 +*cmdline.txt* For Vim version 7.4. Last change: 2014 Aug 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1084,6 +1084,9 @@ another window, or drag statuslines of other windows. You can drag the statusline of the command-line window itself and the statusline above it. Thus you can resize the command-line window, but not others. +The |getcmdwintype()| function returns the type of the command-line being +edited as described in |cmdwin-char|. + AUTOCOMMANDS diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 62aa167041..28cbb927b9 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Jul 19 +*eval.txt* For Vim version 7.4. Last change: 2014 Aug 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1807,7 +1807,8 @@ getchar( [expr]) Number get one character from the user getcharmod( ) Number modifiers for the last typed character getcmdline() String return the current command-line getcmdpos() Number return cursor position in command-line -getcmdtype() String return the current command-line type +getcmdtype() String return current command-line type +getcmdwintype() String return current command-line window type getcurpos() List position of the cursor getcwd() String the current working directory getfontname( [{name}]) String name of font being used @@ -2112,8 +2113,8 @@ argidx() The result is the current index in the argument list. 0 is arglistid([{winnr}, [ {tabnr} ]]) Return the argument list ID. This is a number which identifies the argument list being used. Zero is used for the - global argument list. - Return zero if the arguments are invalid. + global argument list. See |arglist|. + Return -1 if the arguments are invalid. Without arguments use the current window. With {winnr} only use this window in the current tab page. @@ -3349,6 +3350,11 @@ getcmdtype() *getcmdtype()* Returns an empty string otherwise. Also see |getcmdpos()|, |setcmdpos()| and |getcmdline()|. +getcmdwintype() *getcmdwintype()* + Return the current |command-line-window| type. Possible return + values are the same as |getcmdtype()|. Returns an empty string + when not in the command-line window. + *getcurpos()* getcurpos() Get the position of the cursor. This is like getpos('.'), but includes an extra item in the list: @@ -3359,7 +3365,7 @@ getcurpos() Get the position of the cursor. This is like getpos('.'), but let save_cursor = getcurpos() MoveTheCursorAround call setpos('.', save_cursor) - +< *getcwd()* getcwd() The result is a String, which is the name of the current working directory. diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 4136c91898..2a114bc095 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.4. Last change: 2014 Jul 06 +*insert.txt* For Vim version 7.4. Last change: 2014 Aug 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -51,6 +51,8 @@ char action ~ abbreviation. Note: If your key is hard to hit on your keyboard, train yourself to use CTRL-[. + If Esc doesn't work and you are using a Mac, try CTRL-Esc. + Or disable Listening under Accessibility preferences. *i_CTRL-C* CTRL-C Quit insert mode, go back to Normal mode. Do not check for abbreviations. Does not trigger the |InsertLeave| autocommand diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 9d9cb1f937..2dcfa19e48 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2014 Jul 23 +*options.txt* For Vim version 7.4. Last change: 2014 Aug 09 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 207a43d87f..f66ac170ae 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.4. Last change: 2014 May 28 +*pattern.txt* For Vim version 7.4. Last change: 2014 Jul 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -706,11 +706,18 @@ overview. But to limit the time needed, only the line where what follows matches is searched, and one line before that (if there is one). This should be sufficient to match most things and not be too slow. - The part of the pattern after "\@<=" and "\@\)\@<=.*\%(<\/\(\w\+\)>\)\@=" matching text inside HTML tags. Still using freed memory after using setloclist(). (lcd, 2014 Jul 23) +More info Jul 24. Not clear why. + +Patch for: + CmdUndefined - Like FuncUndefined but for user commands. +Yasuhiro Matsumoto, 2014 Aug 18 Patch to make getregtype() return the right size for non-linux systems. (Yasuhiro Matsumoto, 2014 Jul 8) Breaks test_eval. Inefficient, can we only compute y_width when needed? +Patch to fix a problem with breakindent. (Christian Brabandt, 2014 Aug 17) +It's actually not a breakindent problem. With test: Aug 19. +With renamed test: Aug 20 + Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) -DiffChange highlighting doesn't combine with 'cursurline'. (Benjamin Fritz) -Patch by Christian (2014 Jul 12) +ml_get error when using Python, issue 248. -BufWinLeave autocommand executed in the wrong buffer? (Davit Samvelyan, 2014 -Jul 14) +Patch to fix typos in help files. (Dominique, 2014 Aug 9) -When 'clipboard' is "unnamed", :g/pat/d is very slow. Only set the clipboard -after the last delete? (Praful, 2014 May 28) -Patch by Christian Brabandt, 2014 Jun 18. Update Jun 25. +Way to reproduce problem that characters are put on the screen twice in Insert +mode when using system(). (Jacob Niehus, 2014 Aug 9) +Related to setting TMODE_COOK. Perhaps we can omit that for system()? + +Update for Romanian spell file. (Vanilla Ice, 2014 Aug 13) + +Patch to remove ETO_IGNORELANGUAGE, it causes Chinese characters not to show +up. (Paul Moore, 2014 Jul 30) +Should it depend on the Windows version? Waiting for feedback. +No longer needed after including DirectX patch? + +Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug +14) + Make ":1close" close the first window. + Make ":+1close" close the next window. + Make ":-1close" close the previous window. +Can't easily close the help window, like ":pc" closes the preview window and +":ccl" closes the quickfix window. Add ":hclose". (Chris Gaal) +Patch for :helpclose, Christian Brabandt, 2010 Sep 6. + +Patch by Marcin Szamotulski to add +cmd to buffer commands. +(2014 Aug 18) + +Patch to fix that system() with empty input fails. (Olaf Dabrunz, 2014 Aug 19) + +When using a visual selection of multiple words and doing CTRL-W_] it jumps to +the tag matching the word under the cursor, not the selected text. +(Patrick hemmer) +Patch by Christian, 2014 Aug 8. Completion for :buf does not use 'wildignorecase'. (Akshay H, 2014 May 31) +Patch to handle list with some items locked. (ZyX, 2014 Aug 17) +Prefer the second solution. + ":cd C:\Windows\System32\drivers\etc*" does not work, even though the directory exists. (Sergio Gallelli, 2013 Dec 29) +Patch to add a special key name for K_CURSORHOLD. (Hirohito Higashi, 2014 Aug +10) + The entries added by matchaddpos() are returned by getmatches() but can't be set with setmatches(). (lcd47, 2014 Jun 29) @@ -79,8 +121,6 @@ Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) -When using an undo file, also restore the changelist, so that "g;" works. - Value returned by virtcol() changes depending on how lines wrap. This is inconsistant with the documentation. @@ -94,19 +134,12 @@ Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19) "hi link" does not respect groups with GUI settings only. (Mark Lodato, 2014 Jun 8) -Syntax file for gnuplot. Existing one is very old. (Andrew Rasmussen, 2014 -Feb 24) - -Issue 174: Detect Mason files. - No error for missing endwhile. (ZyX, 2014 Mar 20) -Phpcomplete.vim update. (Complex, 2014 Jan 15) +Patch to add :arglocal and :arglists. (Marcin Szamotulski, 2014 Aug 6) PHP syntax is extremely slow. (Anhad Jai Singh, 2014 Jan 19) -Patch for matchparen. (James McCoy, 2014 Jul 11) - Spell files use a latin single quote. Unicode also has another single quote: 0x2019. (Ron Aaron, 2014 Apr 4) New OpenOffice spell files support this with ICONV. But they are not @@ -116,8 +149,8 @@ Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30) Also fixes wrong result from executable(). Update from Ken Takata, 2014 Jan 10. Newer 2014 Apr 3. -Win32: use 64 bit stat() if possible. (Ken Takata, 2014 May 12) -More tests May 14. Update May 29. +Win32: patch to use 64 bit stat() if possible. (Ken Takata, 2014 May 12) +More tests May 14. Update May 29. Update Aug 10. The garbage collector may use too much stack. Make set_ref_in_item() iterative instead of recursive. Test program by Marc Weber (2013 Dec 10) @@ -215,6 +248,8 @@ command instead of doing this alphabetically. (Mikel Jorgensen) Patch to add v:completed_item. (Shougo Matsu, 2013 Nov 29). +Patch to get MSVC version in a nicer way. (Ken Takata, 2014 Jul 24) + Patch to make test 100 work on MS-Windows. (Taro Muraoka, 2013 Dec 12) Patch to define macros for hardcoded values. (Elias Diem, 2013 Dec 14) @@ -230,7 +265,7 @@ Issue 28. Go through more coverity reports. Patch to add ":undorecover", get as much text out of the undo file as -possible. (Christian Brabandt, 2014 Mar 12) +possible. (Christian Brabandt, 2014 Mar 12, update Aug 16) Include Haiku port? (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24) @@ -367,7 +402,7 @@ Patch to allow setting w:quickfix_title via setqflist() and setloclist() functions. (Christian Brabandt, 2013 May 8, update May 21) Patch to add getlocstack() / setlocstack(). (Christian Brabandt, 2013 May 14) Second one. Update May 22. -Update by Daniel Hahler, 2014 Jul 4. +Update by Daniel Hahler, 2014 Jul 4, Aug 14. Patch to make fold updates much faster. (Christian Brabandt, 2012 Dec) @@ -422,13 +457,6 @@ signs? Patch by Christian Brabandt, 2013 Aug 22. Patch to remove flicker from popup menu. (Yasuhiro Matsumoto, 2013 Aug 15) -Patch to use directX to draw text on Windows. Adds the 'renderoptions' -option. (Taro Muraoka, 2013 Jan 25, update 2013 Apr 3, May 14) -Fixes this problem: -8 Win32: Multi-byte characters are not displayed, even though the same font - in Notepad can display them. (Srinath Avadhanula) Try with the - UTF-8-demo.txt page with Andale Mono. - Patch to add 'completeselect' option. Specifies how to select a candidate in insert completion. (Shougo, 2013 May 29) Update to add to existing 'completeopt'. 2013 May 30 @@ -642,6 +670,7 @@ effects? (Christian Brabandt, 2012 Aug 5, Update 2013 Aug 12) Would also need to do this for spellbadword() and spellsuggest(). Patch for variable tabstops. On github (Christian Brabandt, 2014 May 15) +Update Aug 16 (email). On 64 bit MS-Windows "long" is only 32 bits, but we sometimes need to store a 64 bits value. Change all number options to use nropt_T and define it to the @@ -1349,10 +1378,6 @@ Jul 31) C syntax: {} inside () causes following {} to be highlighted as error. (Michalis Giannakidis, 2006 Jun 1) -Can't easily close the help window, like ":pc" closes the preview window and -":ccl" closes the quickfix window. Add ":hclose". (Chris Gaal) -Patch for :helpclose, Christian Brabandt, 2010 Sep 6. - When 'diffopt' has "context:0" a single deleted line causes two folds to merge and mess up syncing. (Austin Jennings, 2008 Jan 31) @@ -3048,6 +3073,8 @@ Spell checking: Diff mode: +9 When making small changes, e.g. deleting a character, update the diff. + Possibly without running diff. 9 Instead invoking an external diff program, use builtin code. One can be found here: http://www.ioplex.com/~miallen/libmba/dl/src/diff.c It's quite big and badly documented though. @@ -3942,7 +3969,6 @@ Autocommands: when exiting isn't a good idea. CursorHoldC - CursorHold while command-line editing WinMoved - when windows have been moved around, e.g, ":wincmd J" - CmdUndefined - Like FuncUndefined but for user commands. SearchPost - After doing a search command (e.g. to do "M") PreDirChanged/PostDirChanged - Before/after ":cd" has been used (for changing the diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index f30b79a2ea..28bdbad896 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 7.4. Last change: 2014 May 28 +*usr_41.txt* For Vim version 7.4. Last change: 2014 Aug 16 VIM USER MANUAL - by Bram Moolenaar @@ -793,6 +793,7 @@ Command line: *command-line-functions* getcmdpos() get position of the cursor in the command line setcmdpos() set position of the cursor in the command line getcmdtype() return the current command-line type + getcmdwintype() return the current command-line window type Quickfix and location lists: *quickfix-functions* getqflist() list of quickfix errors diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index a03a0bd94a..4ad328773a 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 7.4. Last change: 2014 May 22 +*various.txt* For Vim version 7.4. Last change: 2014 Aug 06 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/filetype.vim b/runtime/filetype.vim index dac44d72af..91afa65a80 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2014 Jul 23 +" Last Change: 2014 Aug 22 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -811,6 +811,9 @@ au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl " Gnuplot scripts au BufNewFile,BufRead *.gpi setf gnuplot +" Go (Google) +au BufNewFile,BufRead *.go setf go + " GrADS scripts au BufNewFile,BufRead *.gs setf grads @@ -1145,7 +1148,7 @@ au BufNewFile,BufRead *.map setf map au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,README.md setf markdown " Mason -au BufNewFile,BufRead *.mason,*.mhtml setf mason +au BufNewFile,BufRead *.mason,*.mhtml,*.comp setf mason " Matlab or Objective C au BufNewFile,BufRead *.m call s:FTm() diff --git a/runtime/ftplugin/go.vim b/runtime/ftplugin/go.vim new file mode 100644 index 0000000000..61dc1a13b7 --- /dev/null +++ b/runtime/ftplugin/go.vim @@ -0,0 +1,18 @@ +" Vim filetype plugin file +" Language: Go +" Maintainer: David Barnett (https://github.com/google/vim-ft-go) +" Last Change: 2014 Aug 16 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +setlocal formatoptions-=t + +setlocal comments=s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//\ %s + +let b:undo_ftplugin = 'setl fo< com< cms<' + +" vim: sw=2 sts=2 et diff --git a/runtime/ftplugin/vroom.vim b/runtime/ftplugin/vroom.vim index 75f61f7b90..3d9e7835d0 100644 --- a/runtime/ftplugin/vroom.vim +++ b/runtime/ftplugin/vroom.vim @@ -1,6 +1,6 @@ " Vim filetype plugin file " Language: Vroom (vim testing and executable documentation) -" Maintainer: David Barnett (https://github.com/google/vim-ft.vroom) +" Maintainer: David Barnett (https://github.com/google/vim-ft-vroom) " Last Change: 2014 Jul 23 if exists('b:did_ftplugin') diff --git a/runtime/indent/go.vim b/runtime/indent/go.vim new file mode 100644 index 0000000000..412ac871c4 --- /dev/null +++ b/runtime/indent/go.vim @@ -0,0 +1,78 @@ +" Vim indent file +" Language: Go +" Maintainer: David Barnett (https://github.com/google/vim-ft-go) +" Last Change: 2014 Aug 16 +" +" TODO: +" - function invocations split across lines +" - general line splits (line ends in an operator) + +if exists('b:did_indent') + finish +endif +let b:did_indent = 1 + +" C indentation is too far off useful, mainly due to Go's := operator. +" Let's just define our own. +setlocal nolisp +setlocal autoindent +setlocal indentexpr=GoIndent(v:lnum) +setlocal indentkeys+=<:>,0=},0=) + +if exists('*GoIndent') + finish +endif + +" The shiftwidth() function is relatively new. +" Don't require it to exist. +if exists('*shiftwidth') + function s:sw() abort + return shiftwidth() + endfunction +else + function s:sw() abort + return &shiftwidth + endfunction +endif + +function! GoIndent(lnum) + let l:prevlnum = prevnonblank(a:lnum-1) + if l:prevlnum == 0 + " top of file + return 0 + endif + + " grab the previous and current line, stripping comments. + let l:prevl = substitute(getline(l:prevlnum), '//.*$', '', '') + let l:thisl = substitute(getline(a:lnum), '//.*$', '', '') + let l:previ = indent(l:prevlnum) + + let l:ind = l:previ + + if l:prevl =~ '[({]\s*$' + " previous line opened a block + let l:ind += s:sw() + endif + if l:prevl =~# '^\s*\(case .*\|default\):$' + " previous line is part of a switch statement + let l:ind += s:sw() + endif + " TODO: handle if the previous line is a label. + + if l:thisl =~ '^\s*[)}]' + " this line closed a block + let l:ind -= s:sw() + endif + + " Colons are tricky. + " We want to outdent if it's part of a switch ("case foo:" or "default:"). + " We ignore trying to deal with jump labels because (a) they're rare, and + " (b) they're hard to disambiguate from a composite literal key. + if l:thisl =~# '^\s*\(case .*\|default\):$' + let l:ind -= s:sw() + endif + + return l:ind +endfunction + +" vim: sw=2 sts=2 et diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index 68f764ee69..0394ee22e8 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -2,7 +2,7 @@ " Language: Shell Script " Maintainer: Peter Aronoff " Original Author: Nikolai Weibull -" Latest Revision: 2013-11-28 +" Latest Revision: 2014-08-22 if exists("b:did_indent") finish @@ -91,7 +91,9 @@ function! GetShIndent() if s:is_case(pine) let ind = indent(lnum) + s:indent_value('case-labels') else - let ind -= s:indent_value('case-statements') - s:indent_value('case-breaks') + let ind -= (s:is_case_label(pine, lnum) && s:is_case_ended(pine) ? + \ 0 : s:indent_value('case-statements')) - + \ s:indent_value('case-breaks') endif elseif s:is_case_break(line) let ind -= s:indent_value('case-breaks') diff --git a/runtime/indent/vroom.vim b/runtime/indent/vroom.vim index 10efb0eb90..d333e2c14e 100644 --- a/runtime/indent/vroom.vim +++ b/runtime/indent/vroom.vim @@ -1,6 +1,6 @@ " Vim indent file " Language: Vroom (vim testing and executable documentation) -" Maintainer: David Barnett (https://github.com/google/vim-ft.vroom) +" Maintainer: David Barnett (https://github.com/google/vim-ft-vroom) " Last Change: 2014 Jul 23 if exists('b:did_indent') diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 0c92f1a791..b51d58bad6 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar -" Last Change: 2014 Apr 01 +" Last Change: 2014 Aug 06 " If there already is an option window, jump to that one. if bufwinnr("option-window") > 0 @@ -606,6 +606,10 @@ if has("gui") call append("$", "guiheadroom\troom (in pixels) left above/below the window") call append("$", " \tset ghr=" . &ghr) endif + if has("directx") + call append("$", "renderoptions\toptions for text rendering") + call OptionG("rop", &rop) + endif call append("$", "guipty\tuse a pseudo-tty for I/O to external commands") call BinOptionG("guipty", &guipty) if has("browse") diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index be88f1c539..2db72a2b60 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -2,7 +2,7 @@ " This file is normally sourced from menu.vim. " " Maintainer: Bram Moolenaar -" Last Change: 2013 Jun 24 +" Last Change: 2014 Aug 13 " Define the SetSyn function, used for the Syntax menu entries. " Set 'filetype' and also 'syntax' if it is manually selected. @@ -326,6 +326,7 @@ an 50.70.270 &Syntax.M.Messages\ (/var/log) :cal SetSyn("messages") an 50.70.280 &Syntax.M.Metafont :cal SetSyn("mf") an 50.70.290 &Syntax.M.MetaPost :cal SetSyn("mp") an 50.70.300 &Syntax.M.MGL :cal SetSyn("mgl") +an 50.70.305 &Syntax.M.MIX :cal SetSyn("mix") an 50.70.310 &Syntax.M.MMIX :cal SetSyn("mmix") an 50.70.320 &Syntax.M.Modconf :cal SetSyn("modconf") an 50.70.330 &Syntax.M.Model :cal SetSyn("model") diff --git a/runtime/syntax/gnuplot.vim b/runtime/syntax/gnuplot.vim index 5a381c7cd6..03d813c99f 100644 --- a/runtime/syntax/gnuplot.vim +++ b/runtime/syntax/gnuplot.vim @@ -1,176 +1,505 @@ " Vim syntax file -" Language: gnuplot 3.8i.0 -" Maintainer: John Hoelzel johnh51@users.sourceforge.net -" Last Change: Mon May 26 02:33:33 UTC 2003 -" Filenames: *.gpi *.gih scripts: #!*gnuplot -" URL: http://johnh51.get.to/vim/syntax/gnuplot.vim -" +" Language: gnuplot 4.7.0 +" Maintainer: Andrew Rasmussen andyras@users.sourceforge.net +" Original Maintainer: John Hoelzel johnh51@users.sourceforge.net +" Last Change: 2014-02-24 +" Filenames: *.gnu *.plt *.gpi *.gih *.gp *.gnuplot scripts: #!*gnuplot +" URL: http://www.vim.org/scripts/script.php?script_id=4873 +" Original URL: http://johnh51.get.to/vim/syntax/gnuplot.vim -" thanks to "David Necas (Yeti)" for heads up - working on more changes . -" *.gpi = GnuPlot Input - what I use because there is no other guideline. jeh 11/2000 -" *.gih = makes using cut/pasting from gnuplot.gih easier ... -" #!*gnuplot = for Linux bash shell scripts of gnuplot commands. -" emacs used a suffix of '' -" gnuplot demo files show no preference. -" I will post mail and newsgroup comments on a standard suffix in 'URL' directory. +" thanks to "David Necas (Yeti)" + +" credit also to Jim Eberle +" for the script http://www.vim.org/scripts/script.php?script_id=1737 + +" some shortened names to make demo files look clean... jeh. 11/2000 +" demos -> 3.8i ... jeh. 5/2003 - a work in progress... +" added current commands, keywords, variables, todos, macros... amr 2014-02-24 + +" For vim version 5.x: Clear all syntax items +" For vim version 6.x: Quit when a syntax file was already loaded -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded if version < 600 syntax clear elseif exists("b:current_syntax") finish endif -" some shortened names to make demo files look clean... jeh. 11/2000 -" demos -> 3.8i ... jeh. 5/2003 - a work in progress... +" ---- Special characters ---- " -" commands +" no harm in just matching any \[char] within double quotes, right? +syn match gnuplotSpecial "\\." contained +" syn match gnuplotSpecial "\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[a-z\\]" contained -syn keyword gnuplotStatement cd call clear exit set unset plot splot help -syn keyword gnuplotStatement load pause quit fit rep[lot] if -syn keyword gnuplotStatement FIT_LIMIT FIT_MAXITER FIT_START_LAMBDA -syn keyword gnuplotStatement FIT_LAMBDA_FACTOR FIT_LOG FIT_SCRIPT -syn keyword gnuplotStatement print pwd reread reset save show test ! functions var -syn keyword gnuplotConditional if -" if is cond + stmt - ok? +" measurements in the units in, cm and pt are special +syn match gnuplotUnit "[0-9]+in" +syn match gnuplotUnit "[0-9]+cm" +syn match gnuplotUnit "[0-9]+pt" -" numbers fm c.vim +" external (shell) commands are special +syn region gnuplotExternal start="!" end="$" -" integer number, or floating point number without a dot and with "f". +" ---- Comments ---- " + +syn region gnuplotComment start="#" end="$" contains=gnuplotTodo + +" ---- Constants ---- " + +" strings +syn region gnuplotString start=+"+ skip=+\\"+ end=+"+ contains=gnuplotSpecial +syn region gnuplotString start="'" end="'" + +" built-in variables +syn keyword gnuplotNumber GNUTERM GPVAL_TERM GPVAL_TERMOPTIONS GPVAL_SPLOT +syn keyword gnuplotNumber GPVAL_OUTPUT GPVAL_ENCODING GPVAL_VERSION +syn keyword gnuplotNumber GPVAL_PATCHLEVEL GPVAL_COMPILE_OPTIONS +syn keyword gnuplotNumber GPVAL_MULTIPLOT GPVAL_PLOT GPVAL_VIEW_ZSCALE +syn keyword gnuplotNumber GPVAL_TERMINALS GPVAL_pi GPVAL_NaN +syn keyword gnuplotNumber GPVAL_ERRNO GPVAL_ERRMSG GPVAL_PWD +syn keyword gnuplotNumber pi NaN GPVAL_LAST_PLOT GPVAL_TERM_WINDOWID +syn keyword gnuplotNumber GPVAL_X_MIN GPVAL_X_MAX GPVAL_X_LOG +syn keyword gnuplotNumber GPVAL_DATA_X_MIN GPVAL_DATA_X_MAX GPVAL_Y_MIN +syn keyword gnuplotNumber GPVAL_Y_MAX GPVAL_Y_LOG GPVAL_DATA_Y_MIN +syn keyword gnuplotNumber GPVAL_DATA_Y_MAX GPVAL_X2_MIN GPVAL_X2_MAX +syn keyword gnuplotNumber GPVAL_X2_LOG GPVAL_DATA_X2_MIN GPVAL_DATA_X2_MAX +syn keyword gnuplotNumber GPVAL_Y2_MIN GPVAL_Y2_MAX GPVAL_Y2_LOG +syn keyword gnuplotNumber GPVAL_DATA_Y2_MIN GPVAL_DATA_Y2_MAX GPVAL_Z_MIN +syn keyword gnuplotNumber GPVAL_Z_MAX GPVAL_Z_LOG GPVAL_DATA_Z_MIN +syn keyword gnuplotNumber GPVAL_DATA_Z_MAX GPVAL_CB_MIN GPVAL_CB_MAX +syn keyword gnuplotNumber GPVAL_CB_LOG GPVAL_DATA_CB_MIN GPVAL_DATA_CB_MAX +syn keyword gnuplotNumber GPVAL_T_MIN GPVAL_T_MAX GPVAL_T_LOG GPVAL_U_MIN +syn keyword gnuplotNumber GPVAL_U_MAX GPVAL_U_LOG GPVAL_V_MIN GPVAL_V_MAX +syn keyword gnuplotNumber GPVAL_V_LOG GPVAL_R_MIN GPVAL_R_LOG +syn keyword gnuplotNumber GPVAL_TERM_XMIN GPVAL_TERM_XMAX GPVAL_TERM_YMIN +syn keyword gnuplotNumber GPVAL_TERM_YMAX GPVAL_TERM_XSIZE +syn keyword gnuplotNumber GPVAL_TERM_YSIZE GPVAL_VIEW_MAP GPVAL_VIEW_ROT_X +syn keyword gnuplotNumber GPVAL_VIEW_ROT_Z GPVAL_VIEW_SCALE + +" function name variables +syn match gnuplotNumber "GPFUN_[a-zA-Z_]*" + +" stats variables +syn keyword gnuplotNumber STATS_records STATS_outofrange STATS_invalid +syn keyword gnuplotNumber STATS_blank STATS_blocks STATS_columns STATS_min +syn keyword gnuplotNumber STATS_max STATS_index_min STATS_index_max +syn keyword gnuplotNumber STATS_lo_quartile STATS_median STATS_up_quartile +syn keyword gnuplotNumber STATS_mean STATS_stddev STATS_sum STATS_sumsq +syn keyword gnuplotNumber STATS_correlation STATS_slope STATS_intercept +syn keyword gnuplotNumber STATS_sumxy STATS_pos_min_y STATS_pos_max_y +syn keyword gnuplotNumber STATS_mean STATS_stddev STATS_mean_x STATS_sum_x +syn keyword gnuplotNumber STATS_stddev_x STATS_sumsq_x STATS_min_x +syn keyword gnuplotNumber STATS_max_x STATS_median_x STATS_lo_quartile_x +syn keyword gnuplotNumber STATS_up_quartile_x STATS_index_min_x +syn keyword gnuplotNumber STATS_index_max_x STATS_mean_y STATS_stddev_y +syn keyword gnuplotNumber STATS_sum_y STATS_sumsq_y STATS_min_y +syn keyword gnuplotNumber STATS_max_y STATS_median_y STATS_lo_quartile_y +syn keyword gnuplotNumber STATS_up_quartile_y STATS_index_min_y +syn keyword gnuplotNumber STATS_index_max_y STATS_correlation STATS_sumxy + +" deprecated fit variables +syn keyword gnuplotError FIT_LIMIT FIT_MAXITER FIT_START_LAMBDA +syn keyword gnuplotError FIT_LAMBDA_FACTOR FIT_LOG FIT_SCRIPT + +" numbers, from c.vim + +" integer number, or floating point number without a dot and with "f". syn case ignore syn match gnuplotNumber "\<[0-9]\+\(u\=l\=\|lu\|f\)\>" -" floating point number, with dot, optional exponent + +" floating point number, with dot, optional exponent syn match gnuplotFloat "\<[0-9]\+\.[0-9]*\(e[-+]\=[0-9]\+\)\=[fl]\=\>" -" floating point number, starting with a dot, optional exponent + +" floating point number, starting with a dot, optional exponent syn match gnuplotFloat "\.[0-9]\+\(e[-+]\=[0-9]\+\)\=[fl]\=\>" -" floating point number, without dot, with exponent + +" floating point number, without dot, with exponent syn match gnuplotFloat "\<[0-9]\+e[-+]\=[0-9]\+[fl]\=\>" -" hex number + +" hex number syn match gnuplotNumber "\<0x[0-9a-f]\+\(u\=l\=\|lu\)\>" syn case match -" flag an octal number with wrong digits by not hilighting + +" flag an octal number with wrong digits by not highlighting syn match gnuplotOctalError "\<0[0-7]*[89]" -" plot args +" ---- Identifiers: Functions ---- " -syn keyword gnuplotType u[sing] tit[le] notit[le] wi[th] steps fs[teps] -syn keyword gnuplotType title notitle t -syn keyword gnuplotType with w -syn keyword gnuplotType li[nes] l -" t - too much? w - too much? l - too much? -syn keyword gnuplotType linespoints via +" numerical functions +syn keyword gnuplotFunc abs acos acosh airy arg asin asinh atan atan2 +syn keyword gnuplotFunc atanh EllipticK EllipticE EllipticPi besj0 besj1 +syn keyword gnuplotFunc besy0 besy1 ceil cos cosh erf erfc exp expint +syn keyword gnuplotFunc floor gamma ibeta inverf igamma imag invnorm int +syn keyword gnuplotFunc lambertw lgamma log log10 norm rand real sgn sin +syn keyword gnuplotFunc sin sinh sqrt tan tanh voigt -" funcs +" string functions +syn keyword gnuplotFunc gprintf sprintf strlen strstrt substr strftime +syn keyword gnuplotFunc strptime system word words -syn keyword gnuplotFunc abs acos acosh arg asin asinh atan atanh atan2 -syn keyword gnuplotFunc besj0 besj1 besy0 besy1 -syn keyword gnuplotFunc ceil column cos cosh erf erfc exp floor gamma -syn keyword gnuplotFunc ibeta inverf igamma imag invnorm int lgamma -syn keyword gnuplotFunc log log10 norm rand real sgn sin sinh sqrt tan -syn keyword gnuplotFunc lambertw -syn keyword gnuplotFunc tanh valid -syn keyword gnuplotFunc tm_hour tm_mday tm_min tm_mon tm_sec -syn keyword gnuplotFunc tm_wday tm_yday tm_year +" other functions +syn keyword gnuplotFunc column columnhead columnheader defined exists +syn keyword gnuplotFunc hsv2rgb stringcolumn timecolumn tm_hour tm_mday +syn keyword gnuplotFunc tm_min tm_mon tm_sec tm_wday tm_yday tm_year +syn keyword gnuplotFunc time valid value -" set vars +" ---- Statements ---- " -syn keyword gnuplotType xdata timefmt grid noytics ytics fs -syn keyword gnuplotType logscale time notime mxtics nomxtics style mcbtics -syn keyword gnuplotType nologscale -syn keyword gnuplotType axes x1y2 unique acs[plines] -syn keyword gnuplotType size origin multiplot xtics xr[ange] yr[ange] square nosquare ratio noratio -syn keyword gnuplotType binary matrix index every thru sm[ooth] -syn keyword gnuplotType all angles degrees radians -syn keyword gnuplotType arrow noarrow autoscale noautoscale arrowstyle -" autoscale args = x y xy z t ymin ... - too much? -" needs code to: using title vs autoscale t -syn keyword gnuplotType x y z zcb -syn keyword gnuplotType linear cubicspline bspline order level[s] -syn keyword gnuplotType auto disc[rete] incr[emental] from to head nohead -syn keyword gnuplotType graph base both nosurface table out[put] data -syn keyword gnuplotType bar border noborder boxwidth -syn keyword gnuplotType clabel noclabel clip noclip cntrp[aram] -syn keyword gnuplotType contour nocontour -syn keyword gnuplotType dgrid3d nodgrid3d dummy encoding format -" set encoding args not included - yet. -syn keyword gnuplotType function grid nogrid hidden[3d] nohidden[3d] isosample[s] key nokey -syn keyword gnuplotType historysize nohistorysize -syn keyword gnuplotType defaults offset nooffset trianglepattern undefined noundefined altdiagonal bentover noaltdiagonal nobentover -syn keyword gnuplotType left right top bottom outside below samplen spacing width height box nobox linestyle ls linetype lt linewidth lw -syn keyword gnuplotType Left Right autotitles noautotitles enhanced noenhanced -syn keyword gnuplotType isosamples -syn keyword gnuplotType label nolabel logscale nolog[scale] missing center font locale -syn keyword gnuplotType mapping margin bmargin lmargin rmargin tmargin spherical cylindrical cartesian -syn keyword gnuplotType linestyle nolinestyle linetype lt linewidth lw pointtype pt pointsize ps -syn keyword gnuplotType mouse nomouse -syn keyword gnuplotType nooffsets data candlesticks financebars linespoints lp vector nosurface -syn keyword gnuplotType term[inal] linux aed767 aed512 gpic -syn keyword gnuplotType regis tek410x tek40 vttek kc-tek40xx -syn keyword gnuplotType km-tek40xx selanar bitgraph xlib x11 X11 -" x11 args -syn keyword gnuplotType aifm cgm dumb fig gif small large size nofontlist winword6 corel dxf emf -syn keyword gnuplotType hpgl -" syn keyword gnuplotType transparent hp2623a hp2648 hp500c pcl5 why jeh -syn keyword gnuplotType hp2623a hp2648 hp500c pcl5 -syn match gnuplotType "\" -syn keyword gnuplotType hpljii hpdj hppj imagen mif pbm png svg -syn keyword gnuplotType postscript enhanced_postscript qms table -" postscript editing values? -syn keyword gnuplotType tgif tkcanvas epson-180dpi epson-60dpi -syn keyword gnuplotType epson-lx800 nec-cp6 okidata starc -syn keyword gnuplotType tandy-60dpi latex emtex pslatex pstex epslatex -syn keyword gnuplotType eepic tpic pstricks texdraw mf metafont mpost mp -syn keyword gnuplotType timestamp notimestamp -syn keyword gnuplotType variables version -syn keyword gnuplotType x2data y2data ydata zdata -syn keyword gnuplotType reverse writeback noreverse nowriteback -syn keyword gnuplotType axis mirror autofreq nomirror rotate autofreq norotate -syn keyword gnuplotType update -syn keyword gnuplotType multiplot nomultiplot mytics -syn keyword gnuplotType nomytics mztics nomztics mx2tics nomx2tics -syn keyword gnuplotType my2tics nomy2tics offsets origin output -syn keyword gnuplotType para[metric] nopara[metric] pointsize polar nopolar -syn keyword gnuplotType zrange x2range y2range rrange cbrange -syn keyword gnuplotType trange urange vrange sample[s] size -syn keyword gnuplotType bezier boxerrorbars boxes bargraph bar[s] -syn keyword gnuplotType boxxy[errorbars] csplines dots fsteps histeps impulses -syn keyword gnuplotType line[s] linesp[oints] points poiinttype sbezier splines steps -" w lt lw ls = optional -syn keyword gnuplotType vectors xerr[orbars] xyerr[orbars] yerr[orbars] financebars candlesticks vector -syn keyword gnuplotType errorb[ars] surface -syn keyword gnuplotType filledcurve[s] pm3d x1 x2 y1 y2 xy closed -syn keyword gnuplotType at pi front -syn keyword gnuplotType errorlines xerrorlines yerrorlines xyerrorlines -syn keyword gnuplotType tics ticslevel ticscale time timefmt view -syn keyword gnuplotType xdata xdtics noxdtics ydtics noydtics -syn keyword gnuplotType zdtics nozdtics x2dtics nox2dtics y2dtics noy2dtics -syn keyword gnuplotType xlab[el] ylab[el] zlab[el] cblab[el] x2label y2label xmtics -syn keyword gnuplotType xmtics noxmtics ymtics noymtics zmtics nozmtics -syn keyword gnuplotType x2mtics nox2mtics y2mtics noy2mtics -syn keyword gnuplotType cbdtics nocbdtics cbmtics nocbmtics cbtics nocbtics -syn keyword gnuplotType xtics noxtics ytics noytics -syn keyword gnuplotType ztics noztics x2tics nox2tics -syn keyword gnuplotType y2tics noy2tics zero nozero zeroaxis nozeroaxis -syn keyword gnuplotType xzeroaxis noxzeroaxis yzeroaxis noyzeroaxis -syn keyword gnuplotType x2zeroaxis nox2zeroaxis y2zeroaxis noy2zeroaxis -syn keyword gnuplotType angles one two fill empty solid pattern -syn keyword gnuplotType default -syn keyword gnuplotType scansautomatic flush b[egin] noftriangles implicit -" b too much? - used in demo -syn keyword gnuplotType palette positive negative ps_allcF nops_allcF maxcolors -syn keyword gnuplotType push fontfile pop -syn keyword gnuplotType rgbformulae defined file color model gradient colornames -syn keyword gnuplotType RGB HSV CMY YIQ XYZ -syn keyword gnuplotType colorbox vertical horizontal user bdefault -syn keyword gnuplotType loadpath fontpath decimalsign in out +" common (builtin) variable names +syn keyword gnuplotKeyword x y t u v z s -" comments + strings -syn region gnuplotComment start="#" end="$" -syn region gnuplotComment start=+"+ skip=+\\"+ end=+"+ -syn region gnuplotComment start=+'+ end=+'+ +" conditionals +syn keyword gnuplotConditional if else -" Define the default highlighting. +" repeats +syn keyword gnuplotRepeat do for while + +" operators +syn match gnuplotOperator "[-+*/^|&?:]" +syn match gnuplotOperator "\*\*" +syn match gnuplotOperator "&&" +syn match gnuplotOperator "||" + +" Keywords + +" keywords for 'fit' command +syn keyword gnuplotKeyword via z x:z x:z:s x:y:z:s +syn keyword gnuplotKeyword x:y:t:z:s x:y:t:u:z:s x:y:t:u:v:z:s + +" keywords for 'plot' command +" 'axes' keyword +syn keyword gnuplotKeyword axes x1y1 x1y2 x2y1 x2y2 +" 'binary' keyword +syn keyword gnuplotKeyword binary matrix general array record format endian +syn keyword gnuplotKeyword filetype avs edf png scan transpose dx dy dz +syn keyword gnuplotKeyword flipx flipy flipz origin center rotate using +syn keyword gnuplotKeyword perpendicular skip every +" datafile keywords +syn keyword gnuplotKeyword binary nonuniform matrix index every using +syn keyword gnuplotKeyword smooth volatile noautoscale every index +" 'smooth' keywords +syn keyword gnuplotKeyword unique frequency cumulative cnormal kdensity +syn keyword gnuplotKeyword csplines acsplines bezer sbezier +" deprecated 'thru' keyword +syn keyword gnuplotError thru +" 'using' keyword +syn keyword gnuplotKeyword using u xticlabels yticlabels zticlabels +syn keyword gnuplotKeyword x2ticlabels y2ticlabels xtic ytic ztic +" 'errorbars' keywords +syn keyword gnuplotKeyword errorbars xerrorbars yerrorbars xyerrorbars +" 'errorlines' keywords +syn keyword gnuplotKeyword errorlines xerrorlines yerrorlines xyerrorlines +" 'title' keywords +syn keyword gnuplotKeyword title t tit notitle columnheader at beginning +syn keyword gnuplotKeyword end +" 'with' keywords +syn keyword gnuplotKeyword with w linestyle ls linetype lt linewidth +syn keyword gnuplotKeyword lw linecolor lc pointtype pt pointsize ps +syn keyword gnuplotKeyword fill fs nohidden3d nocontours nosurface palette +" styles for 'with' +syn keyword gnuplotKeyword lines l points p linespoints lp surface dots +syn keyword gnuplotKeyword impulses labels vectors steps fsteps histeps +syn keyword gnuplotKeyword errorbars errorlines financebars xerrorbars +syn keyword gnuplotKeyword xerrorlines xyerrorbars yerrorbars yerrorlines +syn keyword gnuplotKeyword boxes boxerrorbars boxxyerrorbars boxplot +syn keyword gnuplotKeyword candlesticks circles ellipses filledcurves +syn keyword gnuplotKeyword histogram image rgbimage rgbalpha pm3d variable + +" keywords for 'save' command +syn keyword gnuplotKeyword save functions func variables all var terminal +syn keyword gnuplotKeyword term set + +" keywords for 'set/show' command +" set angles +syn keyword gnuplotKeyword angles degrees deg radians rad +" set arrow +syn keyword gnuplotKeyword arrow from to rto length angle arrowstyle as +syn keyword gnuplotKeyword nohead head backhead heads size filled empty +syn keyword gnuplotKeyword nofilled front back linestyle linetype linewidth +" set autoscale +" TODO regexp here +syn keyword gnuplotKeyword autoscale x y z cb x2 y2 zy min max fixmin +syn keyword gnuplotKeyword fixmax fix keepfix noextend +" set bars +syn keyword gnuplotKeyword bars small large fullwidth front back +" set bind +syn keyword gnuplotKeyword bind +" set margins +" TODO regexp +syn keyword gnuplotKeyword margin bmargin lmargin rmargin tmargin +" set border +syn keyword gnuplotKeyword border front back +" set boxwidth +syn keyword gnuplotKeyword boxwidth absolute relative +" deprecated set clabel +syn keyword gnuplotError clabel +" set clip +syn keyword gnuplotKeyword clip points one two +" set cntrlabel +syn keyword gnuplotKeyword cntrlabel format font start interval onecolor +" set cntrparam +syn keyword gnuplotKeyword cntrparam linear cubicspline bspline points +syn keyword gnuplotKeyword order levels auto discrete incremental +" set colorbox +syn keyword gnuplotKeyword colorbox vertical horizontal default user origin +syn keyword gnuplotKeyword size front back noborder bdefault border +" show colornames +syn keyword gnuplotKeyword colornames +" set contour +syn keyword gnuplotKeyword contour base surface both +" set datafile +syn keyword gnuplotKeyword datafile fortran nofpe_trap missing separator +syn keyword gnuplotKeyword whitespace tab comma commentschars binary +" set decimalsign +syn keyword gnuplotKeyword decimalsign locale +" set dgrid3d +syn keyword gnuplotKeyword dgrid3d splines qnorm gauss cauchy exp box hann +syn keyword gnuplotKeyword kdensity +" set dummy +syn keyword gnuplotKeyword dummy +" set encoding +syn keyword gnuplotKeyword encoding default iso_8859_1 iso_8859_15 +syn keyword gnuplotKeyword iso_8859_2 iso_8859_9 koi8r koi8u cp437 cp850 +syn keyword gnuplotKeyword cp852 cp950 cp1250 cp1251 cp1254 sjis utf8 +" set fit +syn keyword gnuplotKeyword fit logfile default quiet noquiet results brief +syn keyword gnuplotKeyword verbose errorvariables noerrorvariables +syn keyword gnuplotKeyword errorscaling noerrorscaling prescale noprescale +syn keyword gnuplotKeyword maxiter none limit limit_abs start-lambda script +syn keyword gnuplotKeyword lambda-factor +" set fontpath +syn keyword gnuplotKeyword fontpath +" set format +syn keyword gnuplotKeyword format +" show functions +syn keyword gnuplotKeyword functions +" set grid +syn keyword gnuplotKeyword grid polar layerdefault xtics ytics ztics x2tics +syn keyword gnuplotKeyword y2tics cbtics mxtics mytics mztics mx2tics +syn keyword gnuplotKeyword my2tics mcbtics xmtics ymtics zmtics x2mtics +syn keyword gnuplotKeyword y2mtics cbmtics noxtics noytics noztics nox2tics +syn keyword gnuplotKeyword noy2tics nocbtics nomxtics nomytics nomztics +syn keyword gnuplotKeyword nomx2tics nomy2tics nomcbtics +" set hidden3d +syn keyword gnuplotKeyword hidden3d offset trianglepattern undefined +syn keyword gnuplotKeyword altdiagonal noaltdiagonal bentover nobentover +syn keyword gnuplotKeyword noundefined +" set historysize +syn keyword gnuplotKeyword historysize +" set isosamples +syn keyword gnuplotKeyword isosamples +" set key +syn keyword gnuplotKeyword key on off inside outside at left right center +syn keyword gnuplotKeyword top bottom vertical horizontal Left Right +syn keyword gnuplotKeyword opaque noopaque reverse noreverse invert maxrows +syn keyword gnuplotKeyword noinvert samplen spacing width height autotitle +syn keyword gnuplotKeyword noautotitle title enhanced noenhanced font +syn keyword gnuplotKeyword textcolor box nobox linetype linewidth maxcols +" set label +syn keyword gnuplotKeyword label left center right rotate norotate by font +syn keyword gnuplotKeyword front back textcolor point nopoint offset boxed +syn keyword gnuplotKeyword hypertext +" set linetype +syn keyword gnuplotKeyword linetype +" set link +syn keyword gnuplotKeyword link via inverse +" set loadpath +syn keyword gnuplotKeyword loadpath +" set locale +syn keyword gnuplotKeyword locale +" set logscale +syn keyword gnuplotKeyword logscale log +" set macros +syn keyword gnuplotKeyword macros +" set mapping +syn keyword gnuplotKeyword mapping cartesian spherical cylindrical +" set mouse +syn keyword gnuplotKeyword mouse doubleclick nodoubleclick zoomcoordinates +syn keyword gnuplotKeyword nozoomcoordinates ruler noruler at polardistance +syn keyword gnuplotKeyword nopolardistance deg tan format clipboardformat +syn keyword gnuplotKeyword mouseformat labels nolabels zoomjump nozoomjump +syn keyword gnuplotKeyword verbose noverbose +" set multiplot +syn keyword gnuplotKeyword multiplot title font layout rowsfirst downwards +syn keyword gnuplotKeyword downwards upwards scale offset +" set object +syn keyword gnuplotKeyword object behind fillcolor fc fs rectangle ellipse +syn keyword gnuplotKeyword circle polygon at center size units xy xx yy to +syn keyword gnuplotKeyword from +" set offsets +syn keyword gnuplotKeyword offsets +" set origin +syn keyword gnuplotKeyword origin +" set output +syn keyword gnuplotKeyword output +" set parametric +syn keyword gnuplotKeyword parametric +" show plot +syn keyword gnuplotKeyword plot add2history +" set pm3d +syn keyword gnuplotKeyword hidden3d interpolate scansautomatic scansforward +syn keyword gnuplotKeyword scansbackward depthorder flush begin center end +syn keyword gnuplotKeyword ftriangles noftriangles clip1in clip4in mean map +syn keyword gnuplotKeyword corners2color geomean harmean rms median min max +syn keyword gnuplotKeyword c1 c2 c3 c4 pm3d at nohidden3d implicit explicit +" set palette +syn keyword gnuplotKeyword palette gray color gamma rgbformulae defined +syn keyword gnuplotKeyword file functions cubehelix start cycles saturation +syn keyword gnuplotKeyword model RGB HSV CMY YIQ XYZ positive negative +syn keyword gnuplotKeyword nops_allcF ps_allcF maxcolors float int gradient +syn keyword gnuplotKeyword fit2rgbformulae rgbformulae +" set pointintervalbox +syn keyword gnuplotKeyword pointintervalbox +" set pointsize +syn keyword gnuplotKeyword pointsize +" set polar +syn keyword gnuplotKeyword polar +" set print +syn keyword gnuplotKeyword print append +" set psdir +syn keyword gnuplotKeyword psdir +" set raxis +syn keyword gnuplotKeyword raxis rrange rtics +" set samples +syn keyword gnuplotKeyword samples +" set size +syn keyword gnuplotKeyword size square nosquare ratio noratio +" set style +syn keyword gnuplotKeyword style function data noborder rectangle arrow +syn keyword gnuplotKeyword default nohead head heads size filled empty +syn keyword gnuplotKeyword nofilled front back boxplot range fraction +syn keyword gnuplotKeyword outliers nooutliers pointtype candlesticks +syn keyword gnuplotKeyword separation labels off auto x x2 sorted unsorted +syn keyword gnuplotKeyword fill empty transparent solid pattern border +syn keyword gnuplotKeyword increment userstyles financebars line default +syn keyword gnuplotKeyword linetype lt linecolor lc linewidth lw pointtype +syn keyword gnuplotKeyword pt pointsize ps pointinterval pi palette circle +syn keyword gnuplotKeyword radius graph screen wedge nowedge ellipse size +syn keyword gnuplotKeyword units xx xy yy histogram line textbox opaque +syn keyword gnuplotKeyword border noborder +" set surface +syn keyword gnuplotKeyword surface implicit explicit +" set table +syn keyword gnuplotKeyword table +" set terminal (list of terminals) +syn keyword gnuplotKeyword terminal term push pop aed512 aed767 aifm aqua +syn keyword gnuplotKeyword be cairo cairolatex canvas cgm context corel +syn keyword gnuplotKeyword debug dumb dxf dxy800a eepic emf emxvga epscairo +syn keyword gnuplotKeyword epslatex epson_180dpi excl fig ggi gif gpic hpgl +syn keyword gnuplotKeyword grass hp2623a hp2648 hp500c hpljii hppj imagen +syn keyword gnuplotKeyword jpeg kyo latex linux lua mf mif mp next openstep +syn keyword gnuplotKeyword pbm pdf pdfcairo pm png pngcairo postscript +syn keyword gnuplotKeyword pslatex pstex pstricks qms qt regis sun svg svga +syn keyword gnuplotKeyword tek40 tek410x texdraw tgif tikz tkcanvas tpic +syn keyword gnuplotKeyword vgagl vws vx384 windows wx wxt x11 xlib +" keywords for 'set terminal' +syn keyword gnuplotKeyword color monochrome dashlength dl eps pdf fontscale +syn keyword gnuplotKeyword standalone blacktext colortext colourtext header +syn keyword gnuplotKeyword noheader mono color solid dashed notransparent +syn keyword gnuplotKeyword crop crop background input rounded butt square +syn keyword gnuplotKeyword size fsize standalone name jsdir defaultsize +syn keyword gnuplotKeyword timestamp notimestamp colour mitered beveled +syn keyword gnuplotKeyword round squared palfuncparam blacktext nec_cp6 +syn keyword gnuplotKeyword mppoints inlineimages externalimages defaultfont +syn keyword gnuplotKeyword aspect feed nofeed rotate small tiny standalone +syn keyword gnuplotKeyword oldstyle newstyle level1 leveldefault level3 +syn keyword gnuplotKeyword background nobackground solid clip noclip +syn keyword gnuplotKeyword colortext colourtext epson_60dpi epson_lx800 +syn keyword gnuplotKeyword okidata starc tandy_60dpi dpu414 nec_cp6 draft +syn keyword gnuplotKeyword medium large normal landscape portrait big +syn keyword gnuplotKeyword inches pointsmax textspecial texthidden +syn keyword gnuplotKeyword thickness depth version acceleration giant +syn keyword gnuplotKeyword delay loop optimize nooptimize pspoints +syn keyword gnuplotKeyword FNT9X17 FNT13X25 interlace nointerlace courier +syn keyword gnuplotKeyword originreset nooriginreset gparrows nogparrows +syn keyword gnuplotKeyword picenvironment nopicenvironment tightboundingbox +syn keyword gnuplotKeyword notightboundingbox charsize gppoints nogppoints +syn keyword gnuplotKeyword fontscale textscale fulldoc nofulldoc standalone +syn keyword gnuplotKeyword preamble header tikzplot tikzarrows notikzarrows +syn keyword gnuplotKeyword cmykimages externalimages noexternalimages +syn keyword gnuplotKeyword polyline vectors magnification psnfss nopsnfss +syn keyword gnuplotKeyword psnfss-version7 prologues a4paper amstex fname +syn keyword gnuplotKeyword fsize server persist widelines interlace +syn keyword gnuplotKeyword truecolor notruecolor defaultplex simplex duplex +syn keyword gnuplotKeyword nofontfiles adobeglyphnames noadobeglyphnames +syn keyword gnuplotKeyword nostandalone metric textrigid animate nopspoints +syn keyword gnuplotKeyword hpdj FNT5X9 roman emtex rgbimages bitmap +syn keyword gnuplotKeyword nobitmap providevars nointerlace add delete +syn keyword gnuplotKeyword auxfile hacktext unit raise palfuncparam +syn keyword gnuplotKeyword noauxfile nohacktext nounit noraise ctrl noctrl +syn keyword gnuplotKeyword close widget fixed dynamic tek40xx vttek +syn keyword gnuplotKeyword kc-tek40xx km-tek40xx bitgraph perltk +syn keyword gnuplotKeyword interactive red green blue interpolate mode +syn keyword gnuplotKeyword position ctrlq replotonresize position noctrlq +syn keyword gnuplotKeyword noreplotonresize +" set termoption +syn keyword gnuplotKeyword termoption font fontscale solid dashed +" set tics +syn keyword gnuplotKeyword tics add axis border mirror nomirror in out +syn keyword gnuplotKeyword scale rotate norotate by offset nooffset left +syn keyword gnuplotKeyword autojustify format font textcolor right center +" deprecated set ticslevel +syn keyword gnuplotError ticslevel ticscale +" set timestamp +syn keyword gnuplotKeyword timestamp top bottom offset font +" set timefmt +syn keyword gnuplotKeyword timefmt +" set title +syn keyword gnuplotKeyword title offset font textcolor tc +" set ranges +syn keyword gnuplotKeyword trange urange vrange +" show variables +syn keyword gnuplotKeyword variables +" show version +syn keyword gnuplotKeyword version +" set view +syn keyword gnuplotKeyword view map equal noequal xy xyz +" set x2data +syn keyword gnuplotKeyword xdata ydata zdata x2data y2data cbdata xdtics +syn keyword gnuplotKeyword ydtics zdtics x2dtics y2dtics cbdtics xzeroaxis +syn keyword gnuplotKeyword yzeroaxis zzeroaxis x2zeroaxis y2zeroaxis +syn keyword gnuplotKeyword cbzeroaxis time geographic +" set label +syn keyword gnuplotKeyword xlabel ylabel zlabel x2label y2label cblabel +syn keyword gnuplotKeyword offset font textcolor by parallel +" set range +syn keyword gnuplotKeyword xrange yrange zrange x2range y2range cbrange +" set xyplane +syn keyword gnuplotKeyword xyplane +" set zeroaxis +" set zero +syn keyword gnuplotKeyword zero +" set zeroaxis +syn keyword gnuplotKeyword zeroaxis + +" keywords for 'stats' command +syn keyword gnuplotKeyword nooutput + +" keywords for 'test' command +syn keyword gnuplotKeyword terminal palette rgb rbg grb gbr brg bgr + +" ---- Macros ---- " + +syn region gnuplotMacro start="@" end=" " + +" ---- Todos ---- " + +syn keyword gnuplotTodo contained TODO FIXME XXX + +" ---- Types: gnuplot commands ---- " + +" I set the commands as Types to distinguish them visually from keywords for the +" commands. This comes at the end of the syntax file because some commands +" are redundant with keywords. It's probably too much trouble to go and +" create special regions for each redundant keyword/command pair, which means +" that some keywords (e.g. 'p') will be highlighted as commands. + +syn keyword gnuplotStatement cd call clear evaluate exit fit help history +syn keyword gnuplotStatement load lower pause plot p print pwd quit raise +syn keyword gnuplotStatement refresh replot rep reread reset save set show +syn keyword gnuplotStatement shell splot spstats system test undefine unset +syn keyword gnuplotStatement update + +" ---- Define the default highlighting ---- " " For version 5.7 and earlier: only when not done already " For version 5.8 and later: only when an item doesn't have highlighting yet if version >= 508 || !exists("did_gnuplot_syntax_inits") @@ -181,14 +510,41 @@ if version >= 508 || !exists("did_gnuplot_syntax_inits") command -nargs=+ HiLink hi def link endif - HiLink gnuplotStatement Statement - HiLink gnuplotConditional Conditional + " ---- Comments ---- " + HiLink gnuplotComment Comment + + " ---- Constants ---- " + HiLink gnuplotString String HiLink gnuplotNumber Number HiLink gnuplotFloat Float + + " ---- Identifiers ---- " + HiLink gnuplotIdentifier Identifier + + " ---- Statements ---- " + HiLink gnuplotConditional Conditional + HiLink gnuplotRepeat Repeat + HiLink gnuplotKeyword Keyword + HiLink gnuplotOperator Operator + + " ---- PreProcs ---- " + HiLink gnuplotMacro Macro + + " ---- Types ---- " + HiLink gnuplotStatement Type + HiLink gnuplotFunc Identifier + + " ---- Specials ---- " + HiLink gnuplotSpecial Special + HiLink gnuplotUnit Special + HiLink gnuplotExternal Special + + " ---- Errors ---- " + HiLink gnuplotError Error HiLink gnuplotOctalError Error - HiLink gnuplotFunc Type - HiLink gnuplotType Type - HiLink gnuplotComment Comment + + " ---- Todos ---- " + HiLink gnuplotTodo Todo delcommand HiLink endif diff --git a/runtime/syntax/go.vim b/runtime/syntax/go.vim new file mode 100644 index 0000000000..e78f8cf27c --- /dev/null +++ b/runtime/syntax/go.vim @@ -0,0 +1,208 @@ +" Vim syntax file +" Language: Go +" Maintainer: David Barnett (https://github.com/google/vim-ft-go) +" Last Change: 2014 Aug 16 + +" Options: +" There are some options for customizing the highlighting; the recommended +" settings are the default values, but you can write: +" let OPTION_NAME = 0 +" in your ~/.vimrc file to disable particular options. You can also write: +" let OPTION_NAME = 1 +" to enable particular options. At present, all options default to on. +" +" - g:go_highlight_array_whitespace_error +" Highlights white space after "[]". +" - g:go_highlight_chan_whitespace_error +" Highlights white space around the communications operator that don't +" follow the standard style. +" - g:go_highlight_extra_types +" Highlights commonly used library types (io.Reader, etc.). +" - g:go_highlight_space_tab_error +" Highlights instances of tabs following spaces. +" - g:go_highlight_trailing_whitespace_error +" Highlights trailing white space. + +" Quit when a (custom) syntax file was already loaded +if exists('b:current_syntax') + finish +endif + +if !exists('g:go_highlight_array_whitespace_error') + let g:go_highlight_array_whitespace_error = 1 +endif +if !exists('g:go_highlight_chan_whitespace_error') + let g:go_highlight_chan_whitespace_error = 1 +endif +if !exists('g:go_highlight_extra_types') + let g:go_highlight_extra_types = 1 +endif +if !exists('g:go_highlight_space_tab_error') + let g:go_highlight_space_tab_error = 1 +endif +if !exists('g:go_highlight_trailing_whitespace_error') + let g:go_highlight_trailing_whitespace_error = 1 +endif + +syn case match + +syn keyword goDirective package import +syn keyword goDeclaration var const type +syn keyword goDeclType struct interface + +hi def link goDirective Statement +hi def link goDeclaration Keyword +hi def link goDeclType Keyword + +" Keywords within functions +syn keyword goStatement defer go goto return break continue fallthrough +syn keyword goConditional if else switch select +syn keyword goLabel case default +syn keyword goRepeat for range + +hi def link goStatement Statement +hi def link goConditional Conditional +hi def link goLabel Label +hi def link goRepeat Repeat + +" Predefined types +syn keyword goType chan map bool string error +syn keyword goSignedInts int int8 int16 int32 int64 rune +syn keyword goUnsignedInts byte uint uint8 uint16 uint32 uint64 uintptr +syn keyword goFloats float32 float64 +syn keyword goComplexes complex64 complex128 + +hi def link goType Type +hi def link goSignedInts Type +hi def link goUnsignedInts Type +hi def link goFloats Type +hi def link goComplexes Type + +" Treat func specially: it's a declaration at the start of a line, but a type +" elsewhere. Order matters here. +syn match goType /\/ +syn match goDeclaration /^func\>/ + +" Predefined functions and values +syn keyword goBuiltins append cap close complex copy delete imag len +syn keyword goBuiltins make new panic print println real recover +syn keyword goConstants iota true false nil + +hi def link goBuiltins Keyword +hi def link goConstants Keyword + +" Comments; their contents +syn keyword goTodo contained TODO FIXME XXX BUG +syn cluster goCommentGroup contains=goTodo +syn region goComment start="/\*" end="\*/" contains=@goCommentGroup,@Spell +syn region goComment start="//" end="$" contains=@goCommentGroup,@Spell + +hi def link goComment Comment +hi def link goTodo Todo + +" Go escapes +syn match goEscapeOctal display contained "\\[0-7]\{3}" +syn match goEscapeC display contained +\\[abfnrtv\\'"]+ +syn match goEscapeX display contained "\\x\x\{2}" +syn match goEscapeU display contained "\\u\x\{4}" +syn match goEscapeBigU display contained "\\U\x\{8}" +syn match goEscapeError display contained +\\[^0-7xuUabfnrtv\\'"]+ + +hi def link goEscapeOctal goSpecialString +hi def link goEscapeC goSpecialString +hi def link goEscapeX goSpecialString +hi def link goEscapeU goSpecialString +hi def link goEscapeBigU goSpecialString +hi def link goSpecialString Special +hi def link goEscapeError Error + +" Strings and their contents +syn cluster goStringGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU,goEscapeError +syn region goString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@goStringGroup +syn region goRawString start=+`+ end=+`+ + +hi def link goString String +hi def link goRawString String + +" Characters; their contents +syn cluster goCharacterGroup contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU +syn region goCharacter start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup + +hi def link goCharacter Character + +" Regions +syn region goBlock start="{" end="}" transparent fold +syn region goParen start='(' end=')' transparent + +" Integers +syn match goDecimalInt "\<\d\+\([Ee]\d\+\)\?\>" +syn match goHexadecimalInt "\<0x\x\+\>" +syn match goOctalInt "\<0\o\+\>" +syn match goOctalError "\<0\o*[89]\d*\>" + +hi def link goDecimalInt Integer +hi def link goHexadecimalInt Integer +hi def link goOctalInt Integer +hi def link Integer Number + +" Floating point +syn match goFloat "\<\d\+\.\d*\([Ee][-+]\d\+\)\?\>" +syn match goFloat "\<\.\d\+\([Ee][-+]\d\+\)\?\>" +syn match goFloat "\<\d\+[Ee][-+]\d\+\>" + +hi def link goFloat Float + +" Imaginary literals +syn match goImaginary "\<\d\+i\>" +syn match goImaginary "\<\d\+\.\d*\([Ee][-+]\d\+\)\?i\>" +syn match goImaginary "\<\.\d\+\([Ee][-+]\d\+\)\?i\>" +syn match goImaginary "\<\d\+[Ee][-+]\d\+i\>" + +hi def link goImaginary Number + +" Spaces after "[]" +if go_highlight_array_whitespace_error != 0 + syn match goSpaceError display "\(\[\]\)\@<=\s\+" +endif + +" Spacing errors around the 'chan' keyword +if go_highlight_chan_whitespace_error != 0 + " receive-only annotation on chan type + syn match goSpaceError display "\(<-\)\@<=\s\+\(chan\>\)\@=" + " send-only annotation on chan type + syn match goSpaceError display "\(\/ + syn match goExtraType /\/ + syn match goExtraType /\/ + syn match goExtraType /\/ +endif + +" Space-tab error +if go_highlight_space_tab_error != 0 + syn match goSpaceError display " \+\t"me=e-1 +endif + +" Trailing white space error +if go_highlight_trailing_whitespace_error != 0 + syn match goSpaceError display excludenl "\s\+$" +endif + +hi def link goExtraType Type +hi def link goSpaceError Error + +" Search backwards for a global declaration to start processing the syntax. +"syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/ + +" There's a bug in the implementation of grouphere. For now, use the +" following as a more expensive/less precise workaround. +syn sync minlines=500 + +let b:current_syntax = 'go' + +" vim: sw=2 sts=2 et diff --git a/runtime/syntax/godoc.vim b/runtime/syntax/godoc.vim new file mode 100644 index 0000000000..3a07903a77 --- /dev/null +++ b/runtime/syntax/godoc.vim @@ -0,0 +1,21 @@ +" Vim syntax file +" Language: Godoc (generated documentation for go) +" Maintainer: David Barnett (https://github.com/google/vim-ft-go) +" Last Change: 2014 Aug 16 + +if exists('b:current_syntax') + finish +endif + +syn case match +syn match godocTitle "^\([A-Z][A-Z ]*\)$" + +command -nargs=+ HiLink hi def link + +HiLink godocTitle Title + +delcommand HiLink + +let b:current_syntax = 'godoc' + +" vim: sw=2 sts=2 et diff --git a/runtime/syntax/vroom.vim b/runtime/syntax/vroom.vim index 29860a8ac7..0cd6ccce1d 100644 --- a/runtime/syntax/vroom.vim +++ b/runtime/syntax/vroom.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: Vroom (vim testing and executable documentation) -" Maintainer: David Barnett (https://github.com/google/vim-ft.vroom) +" Maintainer: David Barnett (https://github.com/google/vim-ft-vroom) " Last Change: 2014 Jul 23 " For version 5.x: Clear all syntax items. diff --git a/runtime/tutor/tutor.es.utf-8 b/runtime/tutor/tutor.es.utf-8 index 84db8fda97..b7561e4759 100644 --- a/runtime/tutor/tutor.es.utf-8 +++ b/runtime/tutor/tutor.es.utf-8 @@ -121,7 +121,7 @@ NOTA: A medida que vaya avanzando en este tutor no intente memorizar, h (izquierda) j (abajo) k (arriba) l (derecha) 2. Para acceder a Vim (desde el símbolo del sistema %) escriba: - vin FILENAME + vim FILENAME 3. Para salir de Vim escriba: :q! para eliminar todos los cambios. diff --git a/runtime/tutor/tutor.fr b/runtime/tutor/tutor.fr index ec85235847..e35d4914aa 100644 --- a/runtime/tutor/tutor.fr +++ b/runtime/tutor/tutor.fr @@ -1029,10 +1029,10 @@ NOTE : Le compl des Mines du Colorado et reprend des ides fournies par Charles Smith, Universit d'tat du Colorado. E-mail : bware@mines.colorado.edu. - Modifi pour Vim par Bram Moolenar. + Modifi pour Vim par Bram Moolenaar. Traduit en franais par Adrien Beau, en avril 2001. Dernires mises jour par Dominique Pell. E-mail : dominique.pelle@gmail.com - Last Change : 2013 May 10 + Last Change : 2014 Aug 18 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.fr.utf-8 b/runtime/tutor/tutor.fr.utf-8 index d07d1bafaa..ac01cfa538 100644 --- a/runtime/tutor/tutor.fr.utf-8 +++ b/runtime/tutor/tutor.fr.utf-8 @@ -1029,10 +1029,10 @@ NOTE : Le complètement fonctionne pour de nombreuses commandes. Essayez des Mines du Colorado et reprend des idées fournies par Charles Smith, Université d'État du Colorado. E-mail : bware@mines.colorado.edu. - Modifié pour Vim par Bram Moolenar. + Modifié pour Vim par Bram Moolenaar. Traduit en français par Adrien Beau, en avril 2001. Dernières mises à jour par Dominique Pellé. E-mail : dominique.pelle@gmail.com - Last Change : 2013 May 10 + Last Change : 2014 Aug 18 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.ja.euc b/runtime/tutor/tutor.ja.euc index 2160e00e10..e19505ee75 100644 --- a/runtime/tutor/tutor.ja.euc +++ b/runtime/tutor/tutor.ja.euc @@ -55,8 +55,7 @@ NOTE: 2. Τ褦˥: :q! ˤԽƤ¸˥ǥλޤ - 3. ץץȤФƤ顢Υ塼ȥꥢϤ٤ˤ˥ޥ - 򥿥פޤ + 3. Υ塼ȥꥢϤ٤Υޥɤ¹Ԥȡޤ Υޥɤ: vimtutor 4. ޤǤΥƥåפФĤʤСƥå 1 3 ޤǤ @@ -904,7 +903,7 @@ NOTE: 1 ** CTRL-D ǥޥɥ饤䴰 ** - 1. ѥ⡼ɤǤʤȤǧޤ: :set nocp + 1. ߴ⡼ɤǤʤȤǧޤ: :set nocp 2. ߤΥǥ쥯ȥ˺ߤե :!ls :!dir dzǧޤ @@ -949,7 +948,7 @@ NOTE: ˤ Vim Υ塼ȥꥢ򽪤ޤǥñˡ⽼ʬ ȤȤǤ褦ˤȡVim λijǰΤߤ褦Ȥޤ Vim ˤϤ¿ΥޥɤꡢƤ뤳ȤϤǤޤ - ʹߤϥ桼ޥ˥奢򻲾Ȥ: ":help user-manual" + ʹߤϥ桼ޥ˥奢򻲾Ȥ: ":help user-manual" ʸγؽΤˡܤޤ Vim - Vi Improved - by Steve Oualline diff --git a/runtime/tutor/tutor.ja.sjis b/runtime/tutor/tutor.ja.sjis index 2a6de3ad78..132af31bf2 100644 --- a/runtime/tutor/tutor.ja.sjis +++ b/runtime/tutor/tutor.ja.sjis @@ -55,8 +55,7 @@ NOTE: 2. ̂悤Ƀ^Cv: :q! ɂҏWeۑɃGfB^I܂B - 3. VFvvgoĂÃ`[gAn߂ׂɂɃR}h - ^Cv܂B + 3. ̃`[gAn߂ׂ̃R}hsƁAɖ߂܂B ̃R}h: vimtutor 4. ܂ł̃XebvoM‚Ȃ΁AXebv 1 3 ܂ł @@ -904,7 +903,7 @@ NOTE: 1 ** CTRL-D ŃR}hC⊮ ** - 1. Rp`[hłȂƂmF܂: :set nocp + 1. ݊[hłȂƂmF܂: :set nocp 2. ݂̃fBNgɍ݂t@C :!ls :!dir ŊmF܂B @@ -949,7 +948,7 @@ NOTE: ɂ Vim ̃`[gAI܂BGfB^ȒPɁA[ gƂł悤ɂƁAVim ̎ŠTO̗v_݂̂`悤Ƃ܂B Vim ɂ͂ɑ̃R}hAőSĂ邱Ƃ͂ł܂B - ȍ~̓[U}jAQƂ: ":help user-manual" + ȍ~̓[U[}jAQƂ: ":help user-manual" Ȍ̊wK̂߂ɁA̖{𐄑E܂B Vim - Vi Improved - by Steve Oualline diff --git a/runtime/tutor/tutor.ja.utf-8 b/runtime/tutor/tutor.ja.utf-8 index 66a818ad90..99cc7d4634 100644 --- a/runtime/tutor/tutor.ja.utf-8 +++ b/runtime/tutor/tutor.ja.utf-8 @@ -55,8 +55,7 @@ NOTE: カーソルキーでも移動できます。しかし hjkl に一度慣 2. 次のようにタイプ: :q! これにより編集した内容を保存せずにエディタが終了します。 - 3. シェルプロンプトが出てきたら、このチュートリアルを始める為ににコマンド - をタイプします。 + 3. このチュートリアルを始める為のコマンドを実行すると、ここに戻れます。 そのコマンドは: vimtutor 4. これまでのステップを覚え自信がついたならば、ステップ 1 から 3 までを実 @@ -904,7 +903,7 @@ NOTE: 1つの検索コマンドだけ大文字小文字の区別をやめたい ** CTRL-D と でコマンドラインを補完する ** - 1. コンパチモードでないことを確認します: :set nocp + 1. 互換モードでないことを確認します: :set nocp 2. 現在のディレクトリに在るファイルを :!ls か :!dir で確認します。 @@ -949,7 +948,7 @@ NOTE: 補完は多くのコマンドで動作します。そして CTRL-D と . This exits the editor, DISCARDING any changes you have made. - 3. When you see the shell prompt, type the command that got you into this - tutor. That would be: vimtutor + 3. Get back here by executing the command that got you into this tutor. That + might be: vimtutor 4. If you have these steps memorized and are confident, execute steps 1 through 3 to exit and re-enter the editor. diff --git a/runtime/tutor/tutor.zh.big5 b/runtime/tutor/tutor.zh.big5 index 4daad64703..9da8b1a352 100644 --- a/runtime/tutor/tutor.zh.big5 +++ b/runtime/tutor/tutor.zh.big5 @@ -843,10 +843,10 @@ Open up a line above this by typing Shift-O while the cursor is on this line. P xuandong@sh163.net ANBOrץC 2002~0318 - ھBram Molenaarͦb2002~0316骺ӫHnDANvimtutor1.4Ķ + ھBram Moolenaarͦb2002~0316骺ӫHnDANvimtutor1.4Ķ ɯŨvimtutor1.5C 2001~1115 - Nvimtutor1.4Ķ浹Bram MolenaarMSven GuckesC + Nvimtutor1.4Ķ浹Bram MoolenaarMSven GuckesC ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.zh.euc b/runtime/tutor/tutor.zh.euc index df59c32089..50852f8105 100644 --- a/runtime/tutor/tutor.zh.euc +++ b/runtime/tutor/tutor.zh.euc @@ -988,9 +988,9 @@ л xuandong@sh163.net ָ 20020318 ̩ - Bram Molenaar20020316յҪ󣬽vimtutor1.4 + Bram Moolenaar20020316յҪ󣬽vimtutor1.4 vimtutor1.5 20011115 ̩ - vimtutor1.4ύBram MolenaarSven Guckes + vimtutor1.4ύBram MoolenaarSven Guckes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.zh.utf-8 b/runtime/tutor/tutor.zh.utf-8 index 21d702051d..d1fabc236d 100644 --- a/runtime/tutor/tutor.zh.utf-8 +++ b/runtime/tutor/tutor.zh.utf-8 @@ -843,10 +843,10 @@ Open up a line above this by typing Shift-O while the cursor is on this line. 感謝 xuandong@sh163.net 的指正,將兩處錯別字修正。 2002年03月18日 梁昌泰 - 根據Bram Molenaar先生在2002年03月16日的來信要求,將vimtutor1.4中譯 + 根據Bram Moolenaar先生在2002年03月16日的來信要求,將vimtutor1.4中譯 版升級到vimtutor1.5。 2001年11月15日 梁昌泰 - 將vimtutor1.4中譯版提交給Bram Molenaar和Sven Guckes。 + 將vimtutor1.4中譯版提交給Bram Moolenaar和Sven Guckes。 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.zh_cn.utf-8 b/runtime/tutor/tutor.zh_cn.utf-8 index 3ff031f7c5..d986ab2645 100644 --- a/runtime/tutor/tutor.zh_cn.utf-8 +++ b/runtime/tutor/tutor.zh_cn.utf-8 @@ -988,9 +988,9 @@ 感谢 xuandong@sh163.net 的指正,将两处错别字修正。 2002年03月18日 梁昌泰 - 根据Bram Molenaar先生在2002年03月16日的来信要求,将vimtutor1.4中译 + 根据Bram Moolenaar先生在2002年03月16日的来信要求,将vimtutor1.4中译 版升级到vimtutor1.5。 2001年11月15日 梁昌泰 - 将vimtutor1.4中译版提交给Bram Molenaar和Sven Guckes。 + 将vimtutor1.4中译版提交给Bram Moolenaar和Sven Guckes。 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.zh_tw.utf-8 b/runtime/tutor/tutor.zh_tw.utf-8 index 21d702051d..d1fabc236d 100644 --- a/runtime/tutor/tutor.zh_tw.utf-8 +++ b/runtime/tutor/tutor.zh_tw.utf-8 @@ -843,10 +843,10 @@ Open up a line above this by typing Shift-O while the cursor is on this line. 感謝 xuandong@sh163.net 的指正,將兩處錯別字修正。 2002年03月18日 梁昌泰 - 根據Bram Molenaar先生在2002年03月16日的來信要求,將vimtutor1.4中譯 + 根據Bram Moolenaar先生在2002年03月16日的來信要求,將vimtutor1.4中譯 版升級到vimtutor1.5。 2001年11月15日 梁昌泰 - 將vimtutor1.4中譯版提交給Bram Molenaar和Sven Guckes。 + 將vimtutor1.4中譯版提交給Bram Moolenaar和Sven Guckes。 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From a136fe1e337c2edd69eb78232ef4f72cc02b354d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Aug 2014 18:05:54 +0200 Subject: [PATCH 063/311] updated for version 7.4.414 Problem: Cannot define a command only when it's used. Solution: Add the CmdUndefined autocommand event. (partly by Yasuhiro Matsumoto) --- runtime/doc/autocmd.txt | 13 +++++++++++++ src/ex_docmd.c | 20 ++++++++++++++++++++ src/fileio.c | 19 +++++++++++++++++++ src/proto/fileio.pro | 2 ++ src/version.c | 2 ++ 5 files changed, 56 insertions(+) diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 2a8becebff..079b916770 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -278,6 +278,7 @@ Name triggered by ~ |ShellCmdPost| after executing a shell command |ShellFilterPost| after filtering with a shell command +|CmdUndefined| a user command is used but it isn't defined |FuncUndefined| a user function is used but it isn't defined |SpellFileMissing| a spell file is used but it can't be found |SourcePre| before sourcing a Vim script @@ -465,6 +466,16 @@ BufWriteCmd Before writing the whole buffer to a file. *BufWritePost* BufWritePost After writing the whole buffer to a file (should undo the commands for BufWritePre). + *CmdUndefined* +CmdUndefined When a user command is used but it isn't + defined. Useful for defining a command only + when it's used. The pattern is matched + against the command name. Both and + are set to the name of the command. + NOTE: Autocompletion won't work until the + command is defined. An alternative is to + always define the user command and have it + invoke an autoloaded function. See |autoload|. *CmdwinEnter* CmdwinEnter After entering the command-line window. Useful for setting options specifically for @@ -670,6 +681,8 @@ FuncUndefined When a user function is used but it isn't when it's used. The pattern is matched against the function name. Both and are set to the name of the function. + NOTE: When writing Vim scripts a better + alternative is to use an autoloaded function. See |autoload-functions|. *GUIEnter* GUIEnter After starting the GUI successfully, and after diff --git a/src/ex_docmd.c b/src/ex_docmd.c index fecb653b54..6826951737 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2143,6 +2143,26 @@ do_one_cmd(cmdlinep, sourcing, /* Find the command and let "p" point to after it. */ p = find_command(&ea, NULL); +#ifdef FEAT_AUTOCMD + /* If this looks like an undefined user command and there are CmdUndefined + * autocommands defined, trigger the matching autocommands. */ + if (p != NULL && ea.cmdidx == CMD_SIZE && !ea.skip + && ASCII_ISUPPER(*ea.cmd) + && has_cmdundefined()) + { + char_u *p = ea.cmd; + int ret; + + while (ASCII_ISALNUM(*p)) + ++p; + p = vim_strnsave(ea.cmd, p - ea.cmd); + ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL); + vim_free(p); + if (ret && !aborting()) + p = find_command(&ea, NULL); + } +#endif + #ifdef FEAT_USR_CMDS if (p == NULL) { diff --git a/src/fileio.c b/src/fileio.c index 17490ac21a..f2d2040786 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -7641,6 +7641,7 @@ static struct event_name {"BufWriteCmd", EVENT_BUFWRITECMD}, {"CmdwinEnter", EVENT_CMDWINENTER}, {"CmdwinLeave", EVENT_CMDWINLEAVE}, + {"CmdUndefined", EVENT_CMDUNDEFINED}, {"ColorScheme", EVENT_COLORSCHEME}, {"CompleteDone", EVENT_COMPLETEDONE}, {"CursorHold", EVENT_CURSORHOLD}, @@ -9159,6 +9160,24 @@ has_insertcharpre() return (first_autopat[(int)EVENT_INSERTCHARPRE] != NULL); } +/* + * Return TRUE when there is an CmdUndefined autocommand defined. + */ + int +has_cmdundefined() +{ + return (first_autopat[(int)EVENT_CMDUNDEFINED] != NULL); +} + +/* + * Return TRUE when there is an FuncUndefined autocommand defined. + */ + int +has_funcundefined() +{ + return (first_autopat[(int)EVENT_FUNCUNDEFINED] != NULL); +} + static int apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) event_T event; diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro index 0d532f4ce2..5b71d0aadc 100644 --- a/src/proto/fileio.pro +++ b/src/proto/fileio.pro @@ -47,6 +47,8 @@ int has_cursormovedI __ARGS((void)); int has_textchanged __ARGS((void)); int has_textchangedI __ARGS((void)); int has_insertcharpre __ARGS((void)); +int has_cmdundefined __ARGS((void)); +int has_funcundefined __ARGS((void)); void block_autocmds __ARGS((void)); void unblock_autocmds __ARGS((void)); int is_autocmd_blocked __ARGS((void)); diff --git a/src/version.c b/src/version.c index e742d187c1..ae87bb5a04 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 414, /**/ 413, /**/ From d110283771e25cbf95e404eb08c7525065ff9646 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Aug 2014 18:05:54 +0200 Subject: [PATCH 064/311] Added tag v7-4-414 for changeset 67edf731a240 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 5b3ad613ec..e3488afbda 100644 --- a/.hgtags +++ b/.hgtags @@ -3136,3 +3136,4 @@ de35e123e63c326be4a576f8e678ed9e63ed1f48 v7-4-409 d4e0c197e97968050596f4c441552383e31db63b v7-4-411 4c845a1600d28db8edabd211e6d7a9cd03883ea6 v7-4-412 121613e72e397db495f5e9b640b249aead5a61c1 v7-4-413 +67edf731a2403a8023440184872159ddc073093c v7-4-414 From 8116fa68709f126ec1674b45dbcc1862740dfffd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Aug 2014 09:16:20 +0200 Subject: [PATCH 065/311] updated for version 7.4.415 Problem: Cannot build. Warning for shadowed variable. (John Little) Solution: Add missing change. Remove declaration. --- src/ex_docmd.c | 2 +- src/vim.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 6826951737..c4cf1f9e1b 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2150,9 +2150,9 @@ do_one_cmd(cmdlinep, sourcing, && ASCII_ISUPPER(*ea.cmd) && has_cmdundefined()) { - char_u *p = ea.cmd; int ret; + p = ea.cmd; while (ASCII_ISALNUM(*p)) ++p; p = vim_strnsave(ea.cmd, p - ea.cmd); diff --git a/src/vim.h b/src/vim.h index 887a76d1f4..cb2a9e5b3b 100644 --- a/src/vim.h +++ b/src/vim.h @@ -1326,6 +1326,7 @@ enum auto_event EVENT_SHELLFILTERPOST, /* after ":1,2!cmd", ":w !cmd", ":r !cmd". */ EVENT_TEXTCHANGED, /* text was modified */ EVENT_TEXTCHANGEDI, /* text was modified in Insert mode*/ + EVENT_CMDUNDEFINED, /* command undefined */ NUM_EVENTS /* MUST be the last one */ }; From bd392419307427ed953a574fa4f381d7a197abcd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Aug 2014 09:16:20 +0200 Subject: [PATCH 066/311] Added tag v7-4-415 for changeset 20dbceb6f471 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e3488afbda..9ee6e19571 100644 --- a/.hgtags +++ b/.hgtags @@ -3137,3 +3137,4 @@ d4e0c197e97968050596f4c441552383e31db63b v7-4-411 4c845a1600d28db8edabd211e6d7a9cd03883ea6 v7-4-412 121613e72e397db495f5e9b640b249aead5a61c1 v7-4-413 67edf731a2403a8023440184872159ddc073093c v7-4-414 +20dbceb6f4713ccd01be45dc531abc269fbb7579 v7-4-415 From 8f0581508daa9deb764141cc944ee4598a359d2a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Aug 2014 09:18:52 +0200 Subject: [PATCH 067/311] Update version number to 7.4.415 --- src/version.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/version.c b/src/version.c index ae87bb5a04..15b676c1d1 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 415, /**/ 414, /**/ From f0ff0c2b30a3741ddc0c742c4d9e1a639d4e8bb5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Aug 2014 10:31:19 +0200 Subject: [PATCH 068/311] Runtime file updates. --- runtime/doc/autocmd.txt | 2 +- runtime/doc/tags | 1 + runtime/doc/todo.txt | 8 +-- runtime/filetype.vim | 4 +- runtime/indent/html.vim | 6 +- runtime/syntax/json.vim | 149 +++++++++++++++++++++++++++++++++++++--- runtime/syntax/rst.vim | 28 ++++---- 7 files changed, 162 insertions(+), 36 deletions(-) diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 079b916770..03f95cac6d 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.4. Last change: 2014 May 02 +*autocmd.txt* For Vim version 7.4. Last change: 2014 Aug 22 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/tags b/runtime/doc/tags index 55f221f480..c0df15d3b1 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -3454,6 +3454,7 @@ CTRL-^ editing.txt /*CTRL-^* CTRL-{char} intro.txt /*CTRL-{char}* Chinese mbyte.txt /*Chinese* Cmd-event autocmd.txt /*Cmd-event* +CmdUndefined autocmd.txt /*CmdUndefined* Cmdline cmdline.txt /*Cmdline* Cmdline-mode cmdline.txt /*Cmdline-mode* CmdwinEnter autocmd.txt /*CmdwinEnter* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 4be7867ef6..4b2a3db8d8 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Aug 22 +*todo.txt* For Vim version 7.4. Last change: 2014 Aug 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -54,10 +54,6 @@ Regexp problems: Still using freed memory after using setloclist(). (lcd, 2014 Jul 23) More info Jul 24. Not clear why. -Patch for: - CmdUndefined - Like FuncUndefined but for user commands. -Yasuhiro Matsumoto, 2014 Aug 18 - Patch to make getregtype() return the right size for non-linux systems. (Yasuhiro Matsumoto, 2014 Jul 8) Breaks test_eval. Inefficient, can we only compute y_width when needed? @@ -265,7 +261,7 @@ Issue 28. Go through more coverity reports. Patch to add ":undorecover", get as much text out of the undo file as -possible. (Christian Brabandt, 2014 Mar 12, update Aug 16) +possible. (Christian Brabandt, 2014 Mar 12, update Aug 22) Include Haiku port? (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 91afa65a80..68b795ad47 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2014 Aug 22 +" Last Change: 2014 Aug 23 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1011,7 +1011,7 @@ au BufNewFile,BufRead *.jgr setf jgraph au BufNewFile,BufRead *.jov,*.j73,*.jovial setf jovial " JSON -au BufNewFile,BufRead *.json setf json +au BufNewFile,BufRead *.json,*.jsonp setf json " Kixtart au BufNewFile,BufRead *.kix setf kix diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index b5374bd68a..d64a0e5cd3 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -2,7 +2,7 @@ " Header: "{{{ " Maintainer: Bram Moolenaar " Original Author: Andy Wokula -" Last Change: 2014 Jul 04 +" Last Change: 2014 Aug 23 " Version: 1.0 " Description: HTML indent script with cached state for faster indenting on a " range of lines. @@ -497,7 +497,7 @@ func! s:FreshState(lnum) " If previous line ended in a closing tag, line up with the opening tag. if !swendtag && text =~ '\s*$' call cursor(state.lnum, 99999) - normal F< + normal! F< let start_lnum = HtmlIndent_FindStartTag() if start_lnum > 0 let state.baseindent = indent(start_lnum) @@ -898,7 +898,7 @@ func! HtmlIndent() " a tag works very differently. Do not do this when the line starts with " "<", it gets the "htmlTag" ID but we are not inside a tag then. if curtext !~ '^\s*<' - normal ^ + normal! ^ let stack = synstack(v:lnum, col('.')) " assumes there are no tabs let foundHtmlString = 0 for synid in reverse(stack) diff --git a/runtime/syntax/json.vim b/runtime/syntax/json.vim index f2d880b1d0..1fdfea2d09 100644 --- a/runtime/syntax/json.vim +++ b/runtime/syntax/json.vim @@ -1,16 +1,143 @@ " Vim syntax file -" Language: JSON -" Maintainer: David Barnett -" Last Change: 2014 Jul 16 +" Language: JSON +" Maintainer: Eli Parra +" Last Change: 2014 Aug 23 +" Version: 0.12 -" For version 5.x: Clear all syntax items. -" For version 6.x and later: Quit when a syntax file was already loaded. -if exists('b:current_syntax') - finish +if !exists("main_syntax") + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + let main_syntax = 'json' endif -" Use JavaScript syntax. JSON is a subset of JavaScript. -runtime! syntax/javascript.vim -unlet b:current_syntax +syntax match jsonNoise /\%(:\|,\)/ -let b:current_syntax = 'json' +" NOTE that for the concealing to work your conceallevel should be set to 2 + +" Syntax: Strings +" Separated into a match and region because a region by itself is always greedy +syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString +if has('conceal') + syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained +else + syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained +endif + +" Syntax: JSON does not allow strings with single quotes, unlike JavaScript. +syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+ + +" Syntax: JSON Keywords +" Separated into a match and region because a region by itself is always greedy +syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword +if has('conceal') + syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contained +else + syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained +endif + +" Syntax: Escape sequences +syn match jsonEscape "\\["\\/bfnrt]" contained +syn match jsonEscape "\\u\x\{4}" contained + +" Syntax: Numbers +syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>\ze[[:blank:]\r\n]*[,}\]]" + +" ERROR WARNINGS ********************************************** +if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1) + " Syntax: Strings should always be enclosed with quotes. + syn match jsonNoQuotesError "\<[[:alpha:]][[:alnum:]]*\>" + syn match jsonTripleQuotesError /"""/ + + " Syntax: An integer part of 0 followed by other digits is not allowed. + syn match jsonNumError "-\=\<0\d\.\d*\>" + + " Syntax: Decimals smaller than one should begin with 0 (so .1 should be 0.1). + syn match jsonNumError "\:\@<=[[:blank:]\r\n]*\zs\.\d\+" + + " Syntax: No comments in JSON, see http://stackoverflow.com/questions/244777/can-i-comment-a-json-file + syn match jsonCommentError "//.*" + syn match jsonCommentError "\(/\*\)\|\(\*/\)" + + " Syntax: No semicolons in JSON + syn match jsonSemicolonError ";" + + " Syntax: No trailing comma after the last element of arrays or objects + syn match jsonTrailingCommaError ",\_s*[}\]]" + + " Syntax: Watch out for missing commas between elements + syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/ + syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values + syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array + syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value +endif + +" ********************************************** END OF ERROR WARNINGS +" Allowances for JSONP: function call at the beginning of the file, +" parenthesis and semicolon at the end. +" Function name validation based on +" http://stackoverflow.com/questions/2008279/validate-a-javascript-function-name/2008444#2008444 +syn match jsonPadding "\%^[[:blank:]\r\n]*[_$[:alpha:]][_$[:alnum:]]*[[:blank:]\r\n]*(" +syn match jsonPadding ");[[:blank:]\r\n]*\%$" + +" Syntax: Boolean +syn match jsonBoolean /\(true\|false\)\(\_s\+\ze"\)\@!/ + +" Syntax: Null +syn keyword jsonNull null + +" Syntax: Braces +syn region jsonFold matchgroup=jsonBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold +syn region jsonFold matchgroup=jsonBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent fold + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_json_syn_inits") + if version < 508 + let did_json_syn_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + HiLink jsonPadding Operator + HiLink jsonString String + HiLink jsonTest Label + HiLink jsonEscape Special + HiLink jsonNumber Number + HiLink jsonBraces Delimiter + HiLink jsonNull Function + HiLink jsonBoolean Boolean + HiLink jsonKeyword Label + + if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1) + HiLink jsonNumError Error + HiLink jsonCommentError Error + HiLink jsonSemicolonError Error + HiLink jsonTrailingCommaError Error + HiLink jsonMissingCommaError Error + HiLink jsonStringSQError Error + HiLink jsonNoQuotesError Error + HiLink jsonTripleQuotesError Error + endif + HiLink jsonQuote Quote + HiLink jsonNoise Noise + delcommand HiLink +endif + +let b:current_syntax = "json" +if main_syntax == 'json' + unlet main_syntax +endif + +" Vim settings +" vim: ts=8 fdm=marker + +" MIT License +" Copyright (c) 2013, Jeroen Ruigrok van der Werven, Eli Parra +"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +"THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +"See https://twitter.com/elzr/status/294964017926119424 diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim index 425d225113..fce9e5dd3e 100644 --- a/runtime/syntax/rst.vim +++ b/runtime/syntax/rst.vim @@ -1,7 +1,8 @@ " Vim syntax file " Language: reStructuredText documentation format -" Maintainer: Nikolai Weibull -" Latest Revision: 2013-11-26 +" Maintainer: Marshall Ward +" Previous Maintainer: Nikolai Weibull +" Latest Revision: 2014-08-23 if exists("b:current_syntax") finish @@ -47,7 +48,7 @@ syn match rstSimpleTableLines contained display syn cluster rstDirectives contains=rstFootnote,rstCitation, \ rstHyperlinkTarget,rstExDirective -syn match rstExplicitMarkup '^\.\.\_s' +syn match rstExplicitMarkup '^\s*\.\.\_s' \ nextgroup=@rstDirectives,rstComment,rstSubstitutionDefinition let s:ReferenceName = '[[:alnum:]]\+\%([_.-][[:alnum:]]\+\)*' @@ -99,11 +100,11 @@ function! s:DefineInlineMarkup(name, start, middle, end) \ "" call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, "'", "'") - call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '"', '"') - call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '(', ')') - call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\[', '\]') - call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '{', '}') - call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '<', '>') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '"', '"') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '(', ')') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\[', '\]') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '{', '}') + call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '<', '>') call s:DefineOneInlineMarkup(a:name, a:start, middle, a:end, '\%(^\|\s\|[/:]\)', '') @@ -136,23 +137,24 @@ syn match rstStandaloneHyperlink contains=@NoSpell \ "\<\%(\%(\%(https\=\|file\|ftp\|gopher\)://\|\%(mailto\|news\):\)[^[:space:]'\"<>]\+\|www[[:alnum:]_-]*\.[[:alnum:]_-]\+\.[^[:space:]'\"<>]\+\)[[:alnum:]/]" syn region rstCodeBlock contained matchgroup=rstDirective - \ start=+\%(sourcecode\|code\%(-block\)\=\)::\s+ + \ start=+\%(sourcecode\|code\%(-block\)\=\)::\_s*\n\ze\z(\s\+\)+ \ skip=+^$+ - \ end=+^\s\@!+ + \ end=+^\z1\@!+ \ contains=@NoSpell syn cluster rstDirectives add=rstCodeBlock if !exists('g:rst_syntax_code_list') - let g:rst_syntax_code_list = ['vim', 'java', 'cpp', 'lisp', 'php', 'python', 'perl'] + let g:rst_syntax_code_list = ['vim', 'java', 'cpp', 'lisp', 'php', + \ 'python', 'perl', 'sh'] endif for code in g:rst_syntax_code_list unlet! b:current_syntax exe 'syn include @rst'.code.' syntax/'.code.'.vim' exe 'syn region rstDirective'.code.' matchgroup=rstDirective fold ' - \.'start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\s*$# ' + \.'start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\_s*\n\ze\z(\s\+\)# ' \.'skip=#^$# ' - \.'end=#^\s\@!# contains=@NoSpell,@rst'.code.' keepend' + \.'end=#^\z1\@!# contains=@NoSpell,@rst'.code exe 'syn cluster rstDirectives add=rstDirective'.code endfor From 087f0f93251afa128c2b489a91d4469c6b3e0c71 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 24 Aug 2014 16:19:25 +0200 Subject: [PATCH 069/311] updated for version 7.4.416 Problem: Problem with breakindent/showbreak and tabs. Solution: Handle tabs differently. (Christian Brabandt) --- src/charset.c | 5 +---- src/testdir/test_breakindent.in | 17 +++++++++++++++++ src/testdir/test_breakindent.ok | 3 +++ src/version.c | 2 ++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/charset.c b/src/charset.c index e7aabe7ed5..fcc41ec334 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1195,10 +1195,7 @@ win_lbr_chartabsize(wp, line, s, col, headp) if (wp->w_p_bri) added += get_breakindent_win(wp, line); - if (tab_corr) - size += (added / wp->w_buffer->b_p_ts) * wp->w_buffer->b_p_ts; - else - size += added; + size += added; if (col != 0) added = 0; } diff --git a/src/testdir/test_breakindent.in b/src/testdir/test_breakindent.in index 8f40e4f7e5..79e25f79de 100644 --- a/src/testdir/test_breakindent.in +++ b/src/testdir/test_breakindent.in @@ -73,6 +73,23 @@ STARTTEST :let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times :$put =g:test :$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width) +:" +:" Test, that the string " a\tb\tc\td\te" is correctly +:" displayed in a 20 column wide window (see bug report +:" https://groups.google.com/d/msg/vim_dev/ZOdg2mc9c9Y/TT8EhFjEy0IJ +:only +:vert 20new +:set all& nocp breakindent briopt=min:10 +:call setline(1, [" a\tb\tc\td\te", " z y x w v"]) +:/^\s*a +fbgjyl:let line1 = @0 +:?^\s*z +fygjyl:let line2 = @0 +:quit! +:$put ='Test 12: breakindent with wrapping Tab' +:$put =line1 +:$put =line2 +:" :%w! test.out :qa! ENDTEST diff --git a/src/testdir/test_breakindent.ok b/src/testdir/test_breakindent.ok index 723cb25012..d89d424fb3 100644 --- a/src/testdir/test_breakindent.ok +++ b/src/testdir/test_breakindent.ok @@ -53,3 +53,6 @@ Test 4: Simple breakindent + min width: 18 Test 11: strdisplaywidth when breakindent is on strdisplaywidth: 46 == calculated: 64 +Test 12: breakindent with wrapping Tab +d +w diff --git a/src/version.c b/src/version.c index 15b676c1d1..01b9082aa6 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 416, /**/ 415, /**/ From 9968440f868ca29de5a21e739fc975bb12b0ee03 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 24 Aug 2014 16:19:25 +0200 Subject: [PATCH 070/311] Added tag v7-4-416 for changeset 735bd597a8ff --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 9ee6e19571..e2c96237a2 100644 --- a/.hgtags +++ b/.hgtags @@ -3138,3 +3138,4 @@ d4e0c197e97968050596f4c441552383e31db63b v7-4-411 121613e72e397db495f5e9b640b249aead5a61c1 v7-4-413 67edf731a2403a8023440184872159ddc073093c v7-4-414 20dbceb6f4713ccd01be45dc531abc269fbb7579 v7-4-415 +735bd597a8ffcb00edff68b34a26573b8f3cad9a v7-4-416 From 203b0cf01e57089abbc5981d05956339201181a5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 24 Aug 2014 16:39:49 +0200 Subject: [PATCH 071/311] updated for version 7.4.417 Problem: After splitting a window and setting 'breakindent' the default minimum with is not respected. Solution: Call briopt_check() when copying options to a new window. --- src/option.c | 23 +++++++++++++++-------- src/proto/option.pro | 1 - src/testdir/test_breakindent.in | 1 + src/version.c | 2 ++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/option.c b/src/option.c index f928b3ba94..855539b584 100644 --- a/src/option.c +++ b/src/option.c @@ -3097,6 +3097,9 @@ static void fill_breakat_flags __ARGS((void)); static int opt_strings_flags __ARGS((char_u *val, char **values, unsigned *flagp, int list)); static int check_opt_strings __ARGS((char_u *val, char **values, int)); static int check_opt_wim __ARGS((void)); +#ifdef FEAT_LINEBREAK +static int briopt_check __ARGS((win_T *wp)); +#endif /* * Initialize the options, first part. @@ -5289,7 +5292,7 @@ didset_options() (void)check_cedit(); #endif #ifdef FEAT_LINEBREAK - briopt_check(); + briopt_check(curwin); #endif } @@ -5748,7 +5751,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, /* 'breakindentopt' */ else if (varp == &curwin->w_p_briopt) { - if (briopt_check() == FAIL) + if (briopt_check(curwin) == FAIL) errmsg = e_invarg; } #endif @@ -10232,6 +10235,9 @@ win_copy_options(wp_from, wp_to) wp_to->w_farsi = wp_from->w_farsi; # endif # endif +#if defined(FEAT_LINEBREAK) + briopt_check(wp_to); +#endif } #endif @@ -12002,15 +12008,16 @@ find_mps_values(initc, findc, backwards, switchit) * This is called when 'breakindentopt' is changed and when a window is * initialized. */ - int -briopt_check() + static int +briopt_check(wp) + win_T *wp; { char_u *p; int bri_shift = 0; long bri_min = 20; int bri_sbr = FALSE; - p = curwin->w_p_briopt; + p = wp->w_p_briopt; while (*p != NUL) { if (STRNCMP(p, "shift:", 6) == 0 @@ -12035,9 +12042,9 @@ briopt_check() ++p; } - curwin->w_p_brishift = bri_shift; - curwin->w_p_brimin = bri_min; - curwin->w_p_brisbr = bri_sbr; + wp->w_p_brishift = bri_shift; + wp->w_p_brimin = bri_min; + wp->w_p_brisbr = bri_sbr; return OK; } diff --git a/src/proto/option.pro b/src/proto/option.pro index e426e6cfac..3da74e62d0 100644 --- a/src/proto/option.pro +++ b/src/proto/option.pro @@ -62,5 +62,4 @@ int check_ff_value __ARGS((char_u *p)); long get_sw_value __ARGS((buf_T *buf)); long get_sts_value __ARGS((void)); void find_mps_values __ARGS((int *initc, int *findc, int *backwards, int switchit)); -int briopt_check __ARGS((void)); /* vim: set ft=c : */ diff --git a/src/testdir/test_breakindent.in b/src/testdir/test_breakindent.in index 79e25f79de..150c9430db 100644 --- a/src/testdir/test_breakindent.in +++ b/src/testdir/test_breakindent.in @@ -27,6 +27,7 @@ STARTTEST : $put =g:line1 : wincmd p :endfu +:set briopt=min:0 :let g:test="Test 1: Simple breakindent" :let line1=ScreenChar(8) :call DoRecordScreen() diff --git a/src/version.c b/src/version.c index 01b9082aa6..ee2598d8b2 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 417, /**/ 416, /**/ From 285fabeb7ff111bbbba4595f898b5186bc22ebb1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 24 Aug 2014 16:39:49 +0200 Subject: [PATCH 072/311] Added tag v7-4-417 for changeset e60327caf909 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e2c96237a2..1e4191596c 100644 --- a/.hgtags +++ b/.hgtags @@ -3139,3 +3139,4 @@ d4e0c197e97968050596f4c441552383e31db63b v7-4-411 67edf731a2403a8023440184872159ddc073093c v7-4-414 20dbceb6f4713ccd01be45dc531abc269fbb7579 v7-4-415 735bd597a8ffcb00edff68b34a26573b8f3cad9a v7-4-416 +e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 From 3c4386953375a29ed774bf3731ccbdb8270bc999 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 04:02:27 +0200 Subject: [PATCH 073/311] updated for version 7.4.418 Problem: When leaving ":append" the cursor shape is like in Insert mode. (Jacob Niehus) Solution: Do not have State set to INSERT when calling getline(). --- src/ex_cmds.c | 8 ++++++++ src/version.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index df6700d64b..2a81eb7398 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -4011,11 +4011,19 @@ ex_append(eap) eap->nextcmd = p; } else + { + int save_State = State; + + /* Set State to avoid the cursor shape to be set to INSERT mode + * when getline() returns. */ + State = CMDLINE; theline = eap->getline( #ifdef FEAT_EVAL eap->cstack->cs_looplevel > 0 ? -1 : #endif NUL, eap->cookie, indent); + State = save_State; + } lines_left = Rows - 1; if (theline == NULL) break; diff --git a/src/version.c b/src/version.c index ee2598d8b2..b2c3289c65 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 418, /**/ 417, /**/ From b89808dc088b3160b12c7260761bef20430e8765 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 04:02:28 +0200 Subject: [PATCH 074/311] Added tag v7-4-418 for changeset 00f58478e38b --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 1e4191596c..ae44489568 100644 --- a/.hgtags +++ b/.hgtags @@ -3140,3 +3140,4 @@ d4e0c197e97968050596f4c441552383e31db63b v7-4-411 20dbceb6f4713ccd01be45dc531abc269fbb7579 v7-4-415 735bd597a8ffcb00edff68b34a26573b8f3cad9a v7-4-416 e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 +00f58478e38b68faf783d8fe70c1439fe9dd732d v7-4-418 From 394a1bb5863fb4f0b741789b2755f8ce475b2fd0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 04:46:10 +0200 Subject: [PATCH 075/311] updated for version 7.4.419 Problem: Whan part of a list is locked it's possible to make changes. Solution: Check if any of the list items is locked before make a change. (ZyX) --- src/eval.c | 28 ++++++++++++++++++++++++++++ src/testdir/test55.in | 15 +++++++++++++++ src/testdir/test55.ok | 5 +++++ src/version.c | 2 ++ 4 files changed, 50 insertions(+) diff --git a/src/eval.c b/src/eval.c index 654e4187d5..a8e94639df 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2945,6 +2945,23 @@ set_var_lval(lp, endp, rettv, copy, op) ; else if (lp->ll_range) { + listitem_T *ll_li = lp->ll_li; + int ll_n1 = lp->ll_n1; + + /* + * Check whether any of the list items is locked + */ + for (ri = rettv->vval.v_list->lv_first; ri != NULL; ) + { + if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name)) + return; + ri = ri->li_next; + if (ri == NULL || (!lp->ll_empty2 && lp->ll_n2 == ll_n1)) + break; + ll_li = ll_li->li_next; + ++ll_n1; + } + /* * Assign the List values to the list items. */ @@ -3646,6 +3663,17 @@ do_unlet_var(lp, name_end, forceit) else if (lp->ll_range) { listitem_T *li; + listitem_T *ll_li = lp->ll_li; + int ll_n1 = lp->ll_n1; + + while (ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= ll_n1)) + { + li = ll_li->li_next; + if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name)) + return FAIL; + ll_li = li; + ++ll_n1; + } /* Delete a range of List items. */ while (lp->ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= lp->ll_n1)) diff --git a/src/testdir/test55.in b/src/testdir/test55.in index 8e073f30f2..140cb7c0e5 100644 --- a/src/testdir/test55.in +++ b/src/testdir/test55.in @@ -282,6 +282,21 @@ let l = [0, 1, 2, 3] : $put =ps : endfor :endfor +:unlet l +:let l = [1, 2, 3, 4] +:lockvar! l +:$put =string(l) +:unlockvar l[1] +:unlet l[0:1] +:$put =string(l) +:unlet l[1:2] +:$put =string(l) +:unlockvar l[1] +:let l[0:1] = [0, 1] +:$put =string(l) +:let l[1:2] = [0, 1] +:$put =string(l) +:unlet l :" :lockvar/islocked() triggering script autoloading :set rtp+=./sautest :lockvar g:footest#x diff --git a/src/testdir/test55.ok b/src/testdir/test55.ok index dfd8060db7..e8560de401 100644 --- a/src/testdir/test55.ok +++ b/src/testdir/test55.ok @@ -86,6 +86,11 @@ FFFFFFF FFpFFpp 0000-000 ppppppp +[1, 2, 3, 4] +[1, 2, 3, 4] +[1, 2, 3, 4] +[1, 2, 3, 4] +[1, 2, 3, 4] locked g:footest#x:-1 exists g:footest#x:0 g:footest#x: 1 diff --git a/src/version.c b/src/version.c index b2c3289c65..d2ea613407 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 419, /**/ 418, /**/ From a830aa9da8d92e7b3341e1626ee878d7405f0af6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 04:46:10 +0200 Subject: [PATCH 076/311] Added tag v7-4-419 for changeset 0a42938f449c --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index ae44489568..51557579a1 100644 --- a/.hgtags +++ b/.hgtags @@ -3141,3 +3141,4 @@ d4e0c197e97968050596f4c441552383e31db63b v7-4-411 735bd597a8ffcb00edff68b34a26573b8f3cad9a v7-4-416 e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 00f58478e38b68faf783d8fe70c1439fe9dd732d v7-4-418 +0a42938f449cf306a429db373106d5e29d8d4312 v7-4-419 From 95838b37d470567500b595357db8f6acaa49a88e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 05:04:47 +0200 Subject: [PATCH 077/311] updated for version 7.4.420 Problem: It's not obvious how to add a new test. Solution: Add a README file. (Christian Brabandt) --- src/testdir/README.txt | 18 ++++++++++++++++++ src/version.c | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 src/testdir/README.txt diff --git a/src/testdir/README.txt b/src/testdir/README.txt new file mode 100644 index 0000000000..d42c7c9bc7 --- /dev/null +++ b/src/testdir/README.txt @@ -0,0 +1,18 @@ +This directory contains tests for various Vim features. + +If it makes sense, try to add a new test to an already existing file. You may +want to separate it from other tests in that file using :" (that's an Ex +command comment). + +The numbered tests are older, we have switched to named tests. + +To add a new test: +1) Create test_.in and test_.ok files. +2) Add them to all Makefiles (Make*) in alphabetical order (search for an + existing test_file.out to see where to add the new one). +3) Use make test_.out to run a single test file in src/testdir/. +4) Also add an entry in src/Makefile. + +Keep in mind that the files are used as if everything was typed. +A line break is like pressing Enter. If that happens on the last line you'll +hear a beep. diff --git a/src/version.c b/src/version.c index d2ea613407..a34bef22b2 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 420, /**/ 419, /**/ From 346e598d9904f6e7ada5b468ae17ecd4eecb7f57 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 05:04:47 +0200 Subject: [PATCH 078/311] Added tag v7-4-420 for changeset 93aa03401309 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 51557579a1..cfec6486c3 100644 --- a/.hgtags +++ b/.hgtags @@ -3142,3 +3142,4 @@ d4e0c197e97968050596f4c441552383e31db63b v7-4-411 e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 00f58478e38b68faf783d8fe70c1439fe9dd732d v7-4-418 0a42938f449cf306a429db373106d5e29d8d4312 v7-4-419 +93aa0340130912c69d4093fc626a3cbb0cc7ad68 v7-4-420 From bf7c0914efa0f63a87791cf80e3dd0d4aa919b77 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 06:56:32 +0200 Subject: [PATCH 079/311] updated for version 7.4.421 Problem: Crash when searching for "\ze*". (Urtica Dioica) Solution: Disallow a multi after \ze and \zs. --- src/regexp_nfa.c | 17 +++++++++++++++++ src/testdir/test64.in | 13 ++++++++++++- src/testdir/test64.ok | 2 ++ src/version.c | 2 ++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index a7fbe7b254..4ccb05a2b3 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -291,6 +291,7 @@ static int nfa_regpiece __ARGS((void)); static int nfa_regconcat __ARGS((void)); static int nfa_regbranch __ARGS((void)); static int nfa_reg __ARGS((int paren)); +static int re_mult_next __ARGS((char *what)); #ifdef DEBUG static void nfa_set_code __ARGS((int c)); static void nfa_postfix_dump __ARGS((char_u *expr, int retval)); @@ -1323,10 +1324,14 @@ nfa_regatom() { case 's': EMIT(NFA_ZSTART); + if (re_mult_next("\\zs") == FAIL) + return FAIL; break; case 'e': EMIT(NFA_ZEND); nfa_has_zend = TRUE; + if (re_mult_next("\\ze") == FAIL) + return FAIL; break; #ifdef FEAT_SYN_HL case '1': @@ -2276,6 +2281,18 @@ nfa_reg(paren) return OK; } +/* + * Used in a place where no * or \+ can follow. + */ + static int +re_mult_next(what) + char *what; +{ + if (re_multi_type(peekchr()) == MULTI_MULT) + EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what); + return OK; +} + #ifdef DEBUG static char_u code[50]; diff --git a/src/testdir/test64.in b/src/testdir/test64.in index 2abdcd1c08..f2452fc0f3 100644 --- a/src/testdir/test64.in +++ b/src/testdir/test64.in @@ -459,7 +459,7 @@ STARTTEST : let text = t[2] : let matchidx = 3 : for engine in [0, 1, 2] -: if engine == 2 && re == 0 || engine == 1 && re ==1 +: if engine == 2 && re == 0 || engine == 1 && re == 1 : continue : endif : let ®expengine = engine @@ -608,6 +608,17 @@ yeGopA END:" "ayb20gg/..\%$ "bybGo"apo"bp:" :" +:" Check for detecting error +:set regexpengine=2 +:for pat in [' \ze*', ' \zs*'] +: try +: let l = matchlist('x x', pat) +: $put ='E888 NOT detected for ' . pat +: catch +: $put ='E888 detected for ' . pat +: endtry +:endfor +:" :""""" Write the results """"""""""""" :/\%#=1^Results/,$wq! test.out ENDTEST diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok index e7d173141a..ffc0b5341f 100644 --- a/src/testdir/test64.ok +++ b/src/testdir/test64.ok @@ -1097,3 +1097,5 @@ Test Test END EN E +E888 detected for \ze* +E888 detected for \zs* diff --git a/src/version.c b/src/version.c index a34bef22b2..d047c9b8db 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 421, /**/ 420, /**/ From 50c0eadf45fd778096977b8ff55f2b589a9bb9be Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 06:56:32 +0200 Subject: [PATCH 080/311] Added tag v7-4-421 for changeset 3ee39fe2df7d --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index cfec6486c3..bec9d6f49c 100644 --- a/.hgtags +++ b/.hgtags @@ -3143,3 +3143,4 @@ e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 00f58478e38b68faf783d8fe70c1439fe9dd732d v7-4-418 0a42938f449cf306a429db373106d5e29d8d4312 v7-4-419 93aa0340130912c69d4093fc626a3cbb0cc7ad68 v7-4-420 +3ee39fe2df7d60d6376b3429383c5c5e3f9bb3fe v7-4-421 From a38c744b303b69ceb5deff76f6a322c0d866a567 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 07:08:43 +0200 Subject: [PATCH 081/311] =?UTF-8?q?updated=20for=20version=207.4.422=20Pro?= =?UTF-8?q?blem:=20=20=20=20When=20using=20conceal=20with=20linebreak=20so?= =?UTF-8?q?me=20text=20is=20not=20displayed=20=09=20=20=20=20correctly.=20?= =?UTF-8?q?(Gr=C3=BCner=20Gimpel)=20Solution:=20=20=20Check=20for=20concea?= =?UTF-8?q?l=20mode=20when=20using=20linebreak.=20(Christian=20Brabandt)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/screen.c | 11 +++++++++++ src/testdir/test_listlbr.in | 10 ++++++++++ src/testdir/test_listlbr.ok | 7 +++++++ src/version.c | 2 ++ 4 files changed, 30 insertions(+) diff --git a/src/screen.c b/src/screen.c index 4c134f0e6d..7a9311a453 100644 --- a/src/screen.c +++ b/src/screen.c @@ -4514,6 +4514,11 @@ win_line(wp, lnum, startrow, endrow, nochange) int i; int saved_nextra = n_extra; +#ifdef FEAT_CONCEAL + if (is_concealing && vcol_off > 0) + /* there are characters to conceal */ + tab_len += vcol_off; +#endif /* if n_extra > 0, it gives the number of chars, to * use for a tab, else we need to calculate the width * for a tab */ @@ -4539,6 +4544,12 @@ win_line(wp, lnum, startrow, endrow, nochange) #endif } p_extra = p_extra_free; +#ifdef FEAT_CONCEAL + /* n_extra will be increased by FIX_FOX_BOGUSCOLS + * macro below, so need to adjust for that here */ + if (is_concealing && vcol_off > 0) + n_extra -= vcol_off; +#endif } #endif #ifdef FEAT_CONCEAL diff --git a/src/testdir/test_listlbr.in b/src/testdir/test_listlbr.in index 0cce4c23a5..2f28126554 100644 --- a/src/testdir/test_listlbr.in +++ b/src/testdir/test_listlbr.in @@ -46,6 +46,16 @@ STARTTEST :redraw! :let line=ScreenChar(winwidth(0)) :call DoRecordScreen() +:let line="_S_\t bla" +:$put =line +:$ +:norm! zt +:let g:test ="Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated)" +:set cpo&vim list linebreak conceallevel=2 concealcursor=nv listchars=tab:ab +:syn match ConcealVar contained /_/ conceal +:syn match All /.*/ contains=ConcealVar +:let line=ScreenChar(winwidth(0)) +:call DoRecordScreen() :%w! test.out :qa! ENDTEST diff --git a/src/testdir/test_listlbr.ok b/src/testdir/test_listlbr.ok index be323d4dc7..9b8037f4d3 100644 --- a/src/testdir/test_listlbr.ok +++ b/src/testdir/test_listlbr.ok @@ -25,3 +25,10 @@ Test 4: set linebreak with tab and 1 line as long as screen: should break! +aaaaaaaaaaaaaaaaaa ~ ~ +_S_ bla + +Test 5: set linebreak with conceal and set list and tab displayed by different char (line may not be truncated) +Sabbbbbb bla +~ +~ +~ diff --git a/src/version.c b/src/version.c index d047c9b8db..31d1b34d59 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 422, /**/ 421, /**/ From 45b3fb36ab5dcad8befae2a03047f6e2a08db402 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 07:08:43 +0200 Subject: [PATCH 082/311] Added tag v7-4-422 for changeset 69da1498ce89 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index bec9d6f49c..e7055cf90c 100644 --- a/.hgtags +++ b/.hgtags @@ -3144,3 +3144,4 @@ e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 0a42938f449cf306a429db373106d5e29d8d4312 v7-4-419 93aa0340130912c69d4093fc626a3cbb0cc7ad68 v7-4-420 3ee39fe2df7d60d6376b3429383c5c5e3f9bb3fe v7-4-421 +69da1498ce89dd093935c0e5013e1df8060a4e80 v7-4-422 From c05116f7c18aa70381666c01f60ca8c433f8bba6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 07:58:44 +0200 Subject: [PATCH 083/311] updated for version 7.4.423 Problem: expand("$shell") does not work as documented. Solution: Do not escape the $ when expanding environment variables. --- src/misc1.c | 5 +++-- src/os_unix.c | 8 +++++--- src/version.c | 2 ++ src/vim.h | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/misc1.c b/src/misc1.c index 6ae72cfbba..e3e7da8245 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -78,7 +78,8 @@ get_indent_str(ptr, ts, list) if (!list || lcs_tab1) /* count a tab for what it is worth */ count += ts - (count % ts); else - /* in list mode, when tab is not set, count screen char width for Tab: ^I */ + /* In list mode, when tab is not set, count screen char width + * for Tab, displays: ^I */ count += ptr2cells(ptr); } else if (*ptr == ' ') @@ -10767,7 +10768,7 @@ gen_expand_wildcards(num_pat, pat, num_file, file, flags) vim_free(p); ga_clear_strings(&ga); i = mch_expand_wildcards(num_pat, pat, num_file, file, - flags); + flags|EW_KEEPDOLLAR); recursive = FALSE; return i; } diff --git a/src/os_unix.c b/src/os_unix.c index 124c2693bc..b49afc3f8a 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5939,10 +5939,12 @@ mch_expand_wildcards(num_pat, pat, num_file, file, flags) *p++ = '\\'; ++j; } - else if (!intick && vim_strchr(SHELL_SPECIAL, - pat[i][j]) != NULL) + else if (!intick + && ((flags & EW_KEEPDOLLAR) == 0 || pat[i][j] != '$') + && vim_strchr(SHELL_SPECIAL, pat[i][j]) != NULL) /* Put a backslash before a special character, but not - * when inside ``. */ + * when inside ``. And not for $var when EW_KEEPDOLLAR is + * set. */ *p++ = '\\'; /* Copy one character. */ diff --git a/src/version.c b/src/version.c index 31d1b34d59..d8ed2a03a0 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 423, /**/ 422, /**/ diff --git a/src/vim.h b/src/vim.h index cb2a9e5b3b..2a6d9a0445 100644 --- a/src/vim.h +++ b/src/vim.h @@ -835,6 +835,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define EW_ICASE 0x100 /* ignore case */ #define EW_NOERROR 0x200 /* no error for bad regexp */ #define EW_NOTWILD 0x400 /* add match with literal name if exists */ +#define EW_KEEPDOLLAR 0x800 /* do not escape $, $var is expanded */ /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND * is used when executing commands and EW_SILENT for interactive expanding. */ From cc6cf6f4ecacbed99132262620b23156ab05fb49 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 07:58:44 +0200 Subject: [PATCH 084/311] Added tag v7-4-423 for changeset 96a4fa8e530c --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e7055cf90c..447b704698 100644 --- a/.hgtags +++ b/.hgtags @@ -3145,3 +3145,4 @@ e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 93aa0340130912c69d4093fc626a3cbb0cc7ad68 v7-4-420 3ee39fe2df7d60d6376b3429383c5c5e3f9bb3fe v7-4-421 69da1498ce89dd093935c0e5013e1df8060a4e80 v7-4-422 +96a4fa8e530c12137af235a9aaad57d578f9eebd v7-4-423 From 256488a47f6decd1be5727e658424dd6f8ad0866 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 08:49:52 +0200 Subject: [PATCH 085/311] updated for version 7.4.424 Problem: Get ml_get error when using Python to delete lines in a buffer that is not in a window. issue 248. Solution: Do not try adjusting the cursor for a different buffer. --- src/if_py_both.h | 4 +++- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index bf5ea4cf38..5044afbeff 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -4196,7 +4196,9 @@ SetBufferLineList( break; } } - if (buf == curbuf) + if (buf == curbuf && (save_curwin != NULL || save_curbuf == NULL)) + /* Using an existing window for the buffer, adjust the cursor + * position. */ py_fix_cursor((linenr_T)lo, (linenr_T)hi, (linenr_T)-n); if (save_curbuf == NULL) /* Only adjust marks if we managed to switch to a window that diff --git a/src/version.c b/src/version.c index d8ed2a03a0..a3e113961f 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 424, /**/ 423, /**/ From 6867eb07cf53f8f996015b658c6b3b9a408bbf69 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 08:49:52 +0200 Subject: [PATCH 086/311] Added tag v7-4-424 for changeset 85a1802ae810 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 447b704698..4a2fb16886 100644 --- a/.hgtags +++ b/.hgtags @@ -3146,3 +3146,4 @@ e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 3ee39fe2df7d60d6376b3429383c5c5e3f9bb3fe v7-4-421 69da1498ce89dd093935c0e5013e1df8060a4e80 v7-4-422 96a4fa8e530c12137af235a9aaad57d578f9eebd v7-4-423 +85a1802ae810f0e840f8b5d8f2827b4199b39750 v7-4-424 From 55b4c324e9d9d37fa63db10abd19b9bcee9c4cc1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 09:20:51 +0200 Subject: [PATCH 087/311] updated for version 7.4.425 Problem: When 'showbreak' is used "gj" may move to the wrong position. (Nazri Ramliy) Solution: Adjust virtcol when 'showbreak' is set. (Christian Brabandt) --- src/normal.c | 8 +++++++- src/version.c | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/normal.c b/src/normal.c index fc9e94480e..7479ac7891 100644 --- a/src/normal.c +++ b/src/normal.c @@ -4509,13 +4509,19 @@ nv_screengo(oap, dir, dist) #if defined(FEAT_LINEBREAK) || defined(FEAT_MBYTE) if (curwin->w_cursor.col > 0 && curwin->w_p_wrap) { + colnr_T virtcol; + /* * Check for landing on a character that got split at the end of the * last line. We want to advance a screenline, not end up in the same * screenline or move two screenlines. */ validate_virtcol(); - if (curwin->w_virtcol > curwin->w_curswant + virtcol = curwin->w_virtcol; + if (virtcol > (colnr_T)width1 && *p_sbr != NUL) + virtcol -= vim_strsize(p_sbr); + + if (virtcol > curwin->w_curswant && (curwin->w_curswant < (colnr_T)width1 ? (curwin->w_curswant > (colnr_T)width1 / 2) : ((curwin->w_curswant - width1) % width2 diff --git a/src/version.c b/src/version.c index a3e113961f..32a6b3bd0c 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 425, /**/ 424, /**/ From fc6dee8ba964130c690e61890fd33bcff6a2f710 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 09:20:51 +0200 Subject: [PATCH 088/311] Added tag v7-4-425 for changeset 2e804ebb3ee8 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 4a2fb16886..70f8877c1b 100644 --- a/.hgtags +++ b/.hgtags @@ -3147,3 +3147,4 @@ e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 69da1498ce89dd093935c0e5013e1df8060a4e80 v7-4-422 96a4fa8e530c12137af235a9aaad57d578f9eebd v7-4-423 85a1802ae810f0e840f8b5d8f2827b4199b39750 v7-4-424 +2e804ebb3ee8cd59451f8f1c1be2f09ebce0d77a v7-4-425 From d40da63a14c61069759698c79ce796f91aa6f153 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 10:12:19 +0200 Subject: [PATCH 089/311] Update runtime files. --- runtime/doc/eval.txt | 17 ++-- runtime/doc/os_vms.txt | 4 +- runtime/doc/os_win32.txt | 4 +- runtime/doc/pattern.txt | 4 +- runtime/doc/syntax.txt | 4 +- runtime/doc/tags | 2 + runtime/doc/todo.txt | 36 ++++--- runtime/doc/usr_04.txt | 4 +- runtime/doc/version6.txt | 4 +- runtime/doc/version7.txt | 20 ++-- runtime/filetype.vim | 5 +- runtime/ftplugin/dockerfile.vim | 16 +++ runtime/indent/json.vim | 169 ++++++++++++++++++++++++++++++-- runtime/scripts.vim | 6 +- runtime/syntax/asciidoc.vim | 4 +- runtime/syntax/dockerfile.vim | 24 +++++ 16 files changed, 268 insertions(+), 55 deletions(-) create mode 100644 runtime/ftplugin/dockerfile.vim create mode 100644 runtime/syntax/dockerfile.vim diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 28cbb927b9..9aa97b7f76 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Aug 16 +*eval.txt* For Vim version 7.4. Last change: 2014 Aug 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1102,9 +1102,9 @@ are known inside the current Vim session. Using expand() will first try using the environment variables known inside the current Vim session. If that fails, a shell will be used to expand the variable. This can be slow, but it does expand all variables that the shell knows about. Example: > - :echo $version - :echo expand("$version") -The first one probably doesn't echo anything, the second echoes the $version + :echo $shell + :echo expand("$shell") +The first one probably doesn't echo anything, the second echoes the $shell variable (if your shell supports it). @@ -2622,7 +2622,7 @@ cursor({list}) line. If {col} is zero, the cursor will stay in the current column. If {curswant} is given it is used to set the preferred column - for vertical movment. Otherwise {col} is used. + for vertical movement. Otherwise {col} is used. When 'virtualedit' is used {off} specifies the offset in screen columns from the start of the character. E.g., a position within a or after the last character. @@ -2913,7 +2913,8 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()* < Expand() can also be used to expand variables and environment variables that are only known in a shell. But this can be - slow, because a shell must be started. See |expr-env-expand|. + slow, because a shell may be used to do the expansion. See + |expr-env-expand|. The expanded variable is still handled like a list of file names. When an environment variable cannot be expanded, it is left unchanged. Thus ":echo expand('$FOOBAR')" results in @@ -5490,7 +5491,7 @@ setreg({regname}, {value} [,{options}]) Returns zero for success, non-zero for failure. *E883* - Note: you may not use |List| containing more then one item to + Note: you may not use |List| containing more than one item to set search and expression registers. Lists containing no items act like empty strings. @@ -5640,7 +5641,7 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702* after Strings, |Lists| after Numbers. For sorting text in the current buffer use |:sort|. - When {func} is given and it is is '1' or 'i' then case is + When {func} is given and it is '1' or 'i' then case is ignored. When {func} is given and it is 'n' then all items will be diff --git a/runtime/doc/os_vms.txt b/runtime/doc/os_vms.txt index 03b11ba87e..3e5c05c69b 100644 --- a/runtime/doc/os_vms.txt +++ b/runtime/doc/os_vms.txt @@ -1,4 +1,4 @@ -*os_vms.txt* For Vim version 7.4. Last change: 2014 Feb 24 +*os_vms.txt* For Vim version 7.4. Last change: 2014 Aug 29 VIM REFERENCE MANUAL @@ -774,7 +774,7 @@ Version 7.4 - correct RealWaitForChar - after 7.4-119 use different functions lib$cvtf_to_internal_time because Alpha and VAX have G_FLOAT but IA64 uses IEEE float otherwise Vim crashes -- guard agains crashes that are caused by mixed filenames +- guard against crashes that are caused by mixed filenames - [TESTDIR]make_vms.mms changed to see the output files - Improve tests, update known issues - minor compiler warnings fixed diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt index a01a06c8ec..80085a8ed0 100644 --- a/runtime/doc/os_win32.txt +++ b/runtime/doc/os_win32.txt @@ -1,4 +1,4 @@ -*os_win32.txt* For Vim version 7.4. Last change: 2012 May 18 +*os_win32.txt* For Vim version 7.4. Last change: 2014 Aug 29 VIM REFERENCE MANUAL by George Reilly @@ -334,7 +334,7 @@ A. You have two possible solutions depending on what you want: :!start /min ctags -R . < When it has finished you should see file named "tags" in your current directory. You should notice the window title blinking on your taskbar. - This is more noticable for commands that take longer. + This is more noticeable for commands that take longer. Now delete the "tags" file and run this command: > :!start /b ctags -R . < You should have the same "tags" file, but this time there will be no diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index f66ac170ae..205d2d8bf7 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.4. Last change: 2014 Jul 30 +*pattern.txt* For Vim version 7.4. Last change: 2014 Aug 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -829,6 +829,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): branch is used. Example: > /\(.\{-}\zsFab\)\{3} < Finds the third occurrence of "Fab". + This cannot be followed by a multi. *E888* {not in Vi} {not available when compiled without the |+syntax| feature} */\ze* \ze Matches at any position, and sets the end of the match there: The @@ -837,6 +838,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): branch is used. Example: "end\ze\(if\|for\)" matches the "end" in "endif" and "endfor". + This cannot be followed by a multi. *E888* {not in Vi} {not available when compiled without the |+syntax| feature} */\%^* *start-of-file* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 35ea3ad7bc..d47b09a5dd 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2014 Jun 27 +*syntax.txt* For Vim version 7.4. Last change: 2014 Aug 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -501,7 +501,7 @@ inserted for that purpose if no line numbers are shown. This ID attribute takes the form of L123 for single-buffer HTML pages, or W2L123 for diff-view pages, and is used to jump to a specific line (in a specific window of a diff view). Javascript is inserted to open any closed dynamic folds -(|g:html_dynamic_folds|) containing the specificed line before jumping. The +(|g:html_dynamic_folds|) containing the specified line before jumping. The javascript also allows omitting the window ID in the url, and the leading L. For example: > diff --git a/runtime/doc/tags b/runtime/doc/tags index c0df15d3b1..ae78930886 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4329,6 +4329,8 @@ E884 eval.txt /*E884* E885 sign.txt /*E885* E886 starting.txt /*E886* E887 if_pyth.txt /*E887* +E888 pattern.txt /*E888* +E888 pattern.txt /*E888* E89 message.txt /*E89* E90 message.txt /*E90* E91 options.txt /*E91* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 4b2a3db8d8..40caa2ed93 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Aug 23 +*todo.txt* For Vim version 7.4. Last change: 2014 Aug 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -58,15 +58,9 @@ Patch to make getregtype() return the right size for non-linux systems. (Yasuhiro Matsumoto, 2014 Jul 8) Breaks test_eval. Inefficient, can we only compute y_width when needed? -Patch to fix a problem with breakindent. (Christian Brabandt, 2014 Aug 17) -It's actually not a breakindent problem. With test: Aug 19. -With renamed test: Aug 20 - Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) -ml_get error when using Python, issue 248. - Patch to fix typos in help files. (Dominique, 2014 Aug 9) Way to reproduce problem that characters are put on the screen twice in Insert @@ -75,11 +69,21 @@ Related to setting TMODE_COOK. Perhaps we can omit that for system()? Update for Romanian spell file. (Vanilla Ice, 2014 Aug 13) +exepath() may return the wrong value. Patch by Yasuhiro Matsumoto, 2014 Aug +26. + +Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30) +Also fixes wrong result from executable(). +Update from Ken Takata, 2014 Jan 10. Newer 2014 Apr 3. + Patch to remove ETO_IGNORELANGUAGE, it causes Chinese characters not to show up. (Paul Moore, 2014 Jul 30) Should it depend on the Windows version? Waiting for feedback. No longer needed after including DirectX patch? +Fix for ":set all&" not taking care of side effect. (Yukihiro Nakadaira, 2014 +Aug 28) + Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug 14) Make ":1close" close the first window. @@ -104,6 +108,8 @@ Completion for :buf does not use 'wildignorecase'. (Akshay H, 2014 May 31) Patch to handle list with some items locked. (ZyX, 2014 Aug 17) Prefer the second solution. +Issue 252. Patch by Christian, 2014 Aug 26. + ":cd C:\Windows\System32\drivers\etc*" does not work, even though the directory exists. (Sergio Gallelli, 2013 Dec 29) @@ -118,7 +124,7 @@ Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) Value returned by virtcol() changes depending on how lines wrap. This is -inconsistant with the documentation. +inconsistent with the documentation. MS-Windows: Crash opening very long file name starting with "\\". (Christian Brock, 2012 Jun 29) @@ -141,20 +147,18 @@ Spell files use a latin single quote. Unicode also has another single quote: New OpenOffice spell files support this with ICONV. But they are not compatible with Vim spell files. The old files can no longer be downloaded. -Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30) -Also fixes wrong result from executable(). -Update from Ken Takata, 2014 Jan 10. Newer 2014 Apr 3. - Win32: patch to use 64 bit stat() if possible. (Ken Takata, 2014 May 12) More tests May 14. Update May 29. Update Aug 10. The garbage collector may use too much stack. Make set_ref_in_item() iterative instead of recursive. Test program by Marc Weber (2013 Dec 10) Patch by Ben Fritz, 2014 Jun 22. +Related: Vim hangs when freeing a lot of objects. Patch by Yasuhiro +Matsumoto, 2014 Aug 26. Idea: For a window in the middle (has window above and below it), use right-mouse-drag on the status line to move a window up/down without changing -it's height? It's like dragging the status bar above it at the same time. +its height? It's like dragging the status bar above it at the same time. Can we make ":unlet $VAR" use unsetenv() to delete the env var? What for systems that don't have unsetenv()? @@ -239,7 +243,7 @@ instead. (Samuel Ferencik, 2013 Sep 28) Patch for XDG base directory support. (Jean François Bignolles, 2014 Mar 4) Remark on the docs. Should not be a compile time feature. But then what? -Completion of ":e" is ":earlier", whould be ":edit". Complete to the matching +Completion of ":e" is ":earlier", should be ":edit". Complete to the matching command instead of doing this alphabetically. (Mikel Jorgensen) Patch to add v:completed_item. (Shougo Matsu, 2013 Nov 29). @@ -1447,8 +1451,8 @@ files with "foo/**" in 'path'. (Kalisiak, 2006 July 15) Additional info: When using the |wildcards| ** globing, vim hangs indefinitely on lots of directories. The |file-searching| globing, like in ":set path=/**" does not hang as often as with globing with |wildcards|, like -in ":1find /**/file". This is for a files that unix "find" can find very -quick. Merging the 2 kinds of globing might make this an easier fix. (Ian +in ":1find /**/file". This is for files that unix "find" can find very +quickly. Merging the 2 kinds of globing might make this an easier fix. (Ian Kelling, 2008 July 4) When the file name has parenthesis, e.g., "foo (bar).txt", ":!ls '%'" has the diff --git a/runtime/doc/usr_04.txt b/runtime/doc/usr_04.txt index c09cb204c5..5f24c8c6f5 100644 --- a/runtime/doc/usr_04.txt +++ b/runtime/doc/usr_04.txt @@ -1,4 +1,4 @@ -*usr_04.txt* For Vim version 7.4. Last change: 2008 Sep 06 +*usr_04.txt* For Vim version 7.4. Last change: 2014 Aug 29 VIM USER MANUAL - by Bram Moolenaar @@ -186,7 +186,7 @@ commands: /four find the first string "four" cwfive change the word to "five" n find the next "four" - . repeat the change to "five' + . repeat the change to "five" n find the next "four" . repeat the change etc. diff --git a/runtime/doc/version6.txt b/runtime/doc/version6.txt index f18fea8705..2e6fd73237 100644 --- a/runtime/doc/version6.txt +++ b/runtime/doc/version6.txt @@ -1,4 +1,4 @@ -*version6.txt* For Vim version 7.4. Last change: 2013 Jul 28 +*version6.txt* For Vim version 7.4. Last change: 2014 Aug 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -7816,7 +7816,7 @@ Files: src/buffer.c, src/eval.c, src/ex_docmd.c, src/fileio.c, Patch 6.1.212 Problem: When Vim was started with "-R" ":new" creates a buffer 'noreadonly' while ":enew" has 'readonly' set. (Preben Guldberg) -Solution: Don't set 'readonly in a new empty buffer for ":enew". +Solution: Don't set 'readonly' in a new empty buffer for ":enew". Files: src/ex_docmd.c Patch 6.1.213 diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index 1bff5b5da9..833bf9e4ab 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.4. Last change: 2013 Nov 18 +*version7.txt* For Vim version 7.4. Last change: 2014 Aug 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1626,10 +1626,10 @@ and merge it back in. When running the tests and one of them fails to produce "test.out" the following tests are still executed. This helps when running out of memory. -When compiling with EXITFREE defined and the ccmalloc library it is possible -to detect memory leaks. Some memory will always reported as leaked, such as -allocated by X11 library functions and the memory allocated in alloc_cmdbuff() -to store the ":quit" command. +When compiling with EXITFREE defined and the ccmalloc library, it is possible +to detect memory leaks. Some memory will always be reported as leaked, such +as allocated by X11 library functions and the memory allocated in +alloc_cmdbuff() to store the ":quit" command. Moved the code for printing to src/hardcopy.c. @@ -2038,8 +2038,8 @@ Removed the "COUNT" flag from ":argadd", to avoid ":argadd 1*" to be used like Avoid that $LANG is used for the menus when LC_MESSAGES is "en_US". -Added backslashes before dashes in the vim.1 manual page to make the appear as -real dashes. (Pierr Habouzit) +Added backslashes before dashes in the vim.1 manual page to make them appear +as real dashes. (Pierr Habouzit) Where "gq" left the cursor depended on the value of 'formatprg'. Now "gq" always leaves the cursor at the last line of the formatted text. @@ -2049,7 +2049,7 @@ detection may try to check the contents of the file while it's still compressed. Skip setting 'filetype' for compressed files until they have been decompressed. Required for patterns that end in a "*". -Starting with an argument "+cmd" or "-S script" causes the cursor the be moved +Starting with an argument "+cmd" or "-S script" causes the cursor to be moved to the first line. That breaks a BufReadPost autocommand that uses g`". Don't move the cursor if it's somewhere past the first line. @@ -6485,7 +6485,7 @@ Patch 7.1.282 (extra) Problem: Win64: Edit with Vim context menu isn't installed correctly. Compiler warnings and a few other things. Solution: Add [ and ] to entry of class name. Use UINT_PTR instead of UINT. - And a fixes for the other things. (George V. Reilly) + And fixes for other things. (George V. Reilly) Files: src/GvimExt/Makefile, src/dosinst.c, src/if_ole.cpp, src/if_ole.h, src/if_ole.idl, src/INSTALLpc.txt, src/Make_mvc.mak, src/os_win32.c, @@ -15783,7 +15783,7 @@ Files: src/if_py_both.h, src/if_python3.c, src/testdir/test86.in, src/testdir/test87.ok Patch 7.3.944 -Problem: External program receives the termrespone. +Problem: External program receives the termresponse. Solution: Insert a delay and discard input. (Hayaki Saito) Files: src/term.c diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 68b795ad47..896ccc1211 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2014 Aug 23 +" Last Change: 2014 Aug 29 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -530,6 +530,9 @@ au BufNewFile,BufRead configure.in,configure.ac setf config " CUDA Cumpute Unified Device Architecture au BufNewFile,BufRead *.cu setf cuda +" Dockerfile +au BufNewFile,BufRead Dockerfile setf=dockerfile + " WildPackets EtherPeek Decoder au BufNewFile,BufRead *.dcd setf dcd diff --git a/runtime/ftplugin/dockerfile.vim b/runtime/ftplugin/dockerfile.vim new file mode 100644 index 0000000000..2e3c447b59 --- /dev/null +++ b/runtime/ftplugin/dockerfile.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin +" Language: Dockerfile +" Maintainer: Honza Pokorny +" Last Change: 2014 Aug 29 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl commentstring<" + +setlocal commentstring=#\ %s diff --git a/runtime/indent/json.vim b/runtime/indent/json.vim index d50112b934..649f2b8aa5 100644 --- a/runtime/indent/json.vim +++ b/runtime/indent/json.vim @@ -1,13 +1,168 @@ " Vim indent file " Language: JSON -" Maintainer: David Barnett -" Last Change: 2014 Jul 16 +" Mantainer: Eli Parra https://github.com/elzr/vim-json +" Last Change: 2014 Aug 29 +" https://github.com/jakar/vim-json/commit/20b650e22aa750c4ab6a66aa646bdd95d7cd548a#diff-e81fc111b2052e306d126bd9989f7b7c +" Original Author: Rogerz Zhang http://github.com/rogerz/vim-json +" Acknowledgement: Based off of vim-javascript maintained by Darrick Wiebe +" http://www.vim.org/scripts/script.php?script_id=2765 -if exists('b:did_indent') - finish +" 0. Initialization {{{1 +" ================= + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal nosmartindent + +" Now, set up our indentation expression and keys that trigger it. +setlocal indentexpr=GetJSONIndent() +setlocal indentkeys=0{,0},0),0[,0],!^F,o,O,e + +" Only define the function once. +if exists("*GetJSONIndent") + finish endif -" JSON is a subset of JavaScript. JavaScript indenting should work fine. -runtime! indent/javascript.vim +let s:cpo_save = &cpo +set cpo&vim -let b:did_indent = 1 +" 1. Variables {{{1 +" ============ + +let s:line_term = '\s*\%(\%(\/\/\).*\)\=$' +" Regex that defines blocks. +let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term + +" 2. Auxiliary Functions {{{1 +" ====================== + +" Check if the character at lnum:col is inside a string. +function s:IsInString(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') == 'jsonString' +endfunction + +" Find line above 'lnum' that isn't empty, or in a string. +function s:PrevNonBlankNonString(lnum) + let lnum = prevnonblank(a:lnum) + while lnum > 0 + " If the line isn't empty or in a string, end search. + let line = getline(lnum) + if !(s:IsInString(lnum, 1) && s:IsInString(lnum, strlen(line))) + break + endif + let lnum = prevnonblank(lnum - 1) + endwhile + return lnum +endfunction + +" Check if line 'lnum' has more opening brackets than closing ones. +function s:LineHasOpeningBrackets(lnum) + let open_0 = 0 + let open_2 = 0 + let open_4 = 0 + let line = getline(a:lnum) + let pos = match(line, '[][(){}]', 0) + while pos != -1 + let idx = stridx('(){}[]', line[pos]) + if idx % 2 == 0 + let open_{idx} = open_{idx} + 1 + else + let open_{idx - 1} = open_{idx - 1} - 1 + endif + let pos = match(line, '[][(){}]', pos + 1) + endwhile + return (open_0 > 0) . (open_2 > 0) . (open_4 > 0) +endfunction + +function s:Match(lnum, regex) + let col = match(getline(a:lnum), a:regex) + 1 + return col > 0 && !s:IsInString(a:lnum, col) ? col : 0 +endfunction + +" 3. GetJSONIndent Function {{{1 +" ========================= + +function GetJSONIndent() + " 3.1. Setup {{{2 + " ---------- + + " Set up variables for restoring position in file. Could use v:lnum here. + let vcol = col('.') + + " 3.2. Work on the current line {{{2 + " ----------------------------- + + " Get the current line. + let line = getline(v:lnum) + let ind = -1 + + " If we got a closing bracket on an empty line, find its match and indent + " according to it. + let col = matchend(line, '^\s*[]}]') + + if col > 0 && !s:IsInString(v:lnum, col) + call cursor(v:lnum, col) + let bs = strpart('{}[]', stridx('}]', line[col - 1]) * 2, 2) + + let pairstart = escape(bs[0], '[') + let pairend = escape(bs[1], ']') + let pairline = searchpair(pairstart, '', pairend, 'bW') + + if pairline > 0 + let ind = indent(pairline) + else + let ind = virtcol('.') - 1 + endif + + return ind + endif + + " If we are in a multi-line string, don't do anything to it. + if s:IsInString(v:lnum, matchend(line, '^\s*') + 1) + return indent('.') + endif + + " 3.3. Work on the previous line. {{{2 + " ------------------------------- + + let lnum = prevnonblank(v:lnum - 1) + + if lnum == 0 + return 0 + endif + + " Set up variables for current line. + let line = getline(lnum) + let ind = indent(lnum) + + " If the previous line ended with a block opening, add a level of indent. + " if s:Match(lnum, s:block_regex) + " return indent(lnum) + &sw + " endif + + " If the previous line contained an opening bracket, and we are still in it, + " add indent depending on the bracket type. + if line =~ '[[({]' + let counts = s:LineHasOpeningBrackets(lnum) + if counts[0] == '1' || counts[1] == '1' || counts[2] == '1' + return ind + &sw + else + call cursor(v:lnum, vcol) + end + endif + + " }}}2 + + return ind +endfunction + +" }}}1 + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2 ts=8 noet: diff --git a/runtime/scripts.vim b/runtime/scripts.vim index 251e4c8f08..5c136abbb1 100644 --- a/runtime/scripts.vim +++ b/runtime/scripts.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types in scripts " " Maintainer: Bram Moolenaar -" Last change: 2013 May 24 +" Last change: 2014 Aug 24 " This file is called by an autocommand for every file that has just been " loaded into a buffer. It checks if the type of file can be recognized by @@ -319,6 +319,10 @@ else elseif s:line1 =~ '^==\d\+== valgrind' || s:line3 =~ '^==\d\+== Using valgrind' set ft=valgrind + " Go docs + elseif s:line1 =~ '^PACKAGE DOCUMENTATION$' + set ft=godoc + " Renderman Interface Bytestream elseif s:line1 =~ '^##RenderMan' set ft=rib diff --git a/runtime/syntax/asciidoc.vim b/runtime/syntax/asciidoc.vim index 1303db7cf2..ccb079e06b 100644 --- a/runtime/syntax/asciidoc.vim +++ b/runtime/syntax/asciidoc.vim @@ -5,6 +5,7 @@ " URL: http://asciidoc.org/ " Licence: GPL (http://www.gnu.org) " Remarks: Vim 6 or greater +" Last Update: 2014 Aug 29 (see Issue 240) " Limitations: " " - Nested quoted text formatting is highlighted according to the outer @@ -155,7 +156,8 @@ hi def link asciidocQuotedAttributeList Special hi def link asciidocQuotedBold Special hi def link asciidocQuotedDoubleQuoted Label hi def link asciidocQuotedEmphasized2 Type -hi def link asciidocQuotedEmphasized Type +hi asciidocQuotedEmphasizedItalic term=italic cterm=italic gui=italic +hi def link asciidocQuotedEmphasized asciidocQuotedEmphasizedItalic hi def link asciidocQuotedMonospaced2 Identifier hi def link asciidocQuotedMonospaced Identifier hi def link asciidocQuotedSingleQuoted Label diff --git a/runtime/syntax/dockerfile.vim b/runtime/syntax/dockerfile.vim new file mode 100644 index 0000000000..d1693cba41 --- /dev/null +++ b/runtime/syntax/dockerfile.vim @@ -0,0 +1,24 @@ +" dockerfile.vim - Syntax highlighting for Dockerfiles +" Maintainer: Honza Pokorny +" Version: 0.5 +" Last Change: 2014 Aug 29 +" License: BSD + + +if exists("b:current_syntax") + finish +endif + +let b:current_syntax = "dockerfile" + +syntax case ignore + +syntax match dockerfileKeyword /\v^\s*(ONBUILD\s+)?(ADD|CMD|ENTRYPOINT|ENV|EXPOSE|FROM|MAINTAINER|RUN|USER|VOLUME|WORKDIR|COPY)\s/ + +syntax region dockerfileString start=/\v"/ skip=/\v\\./ end=/\v"/ + +syntax match dockerfileComment "\v^\s*#.*$" + +hi def link dockerfileString String +hi def link dockerfileKeyword Keyword +hi def link dockerfileComment Comment From 7bc282678bfbe5549049488318299903aa8c91fd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 10:12:54 +0200 Subject: [PATCH 090/311] updated for version 7.4.426 Problem: README File missing from list of files. Solution: Update the list of files. --- Filelist | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Filelist b/Filelist index 0f4ed1d828..dd09b840ca 100644 --- a/Filelist +++ b/Filelist @@ -82,6 +82,7 @@ SRC_ALL = \ src/xxd/xxd.c \ src/main.aap \ src/testdir/main.aap \ + src/testdir/README.txt \ src/testdir/*.in \ src/testdir/sautest/autoload/*.vim \ src/testdir/test[0-9]*.ok \ diff --git a/src/version.c b/src/version.c index 32a6b3bd0c..0d569f7f96 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 426, /**/ 425, /**/ From 6a47007166e44613c2a47bedea7ecf258aa0fc2e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 10:12:55 +0200 Subject: [PATCH 091/311] Added tag v7-4-426 for changeset 7ab9a9cf2859 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 70f8877c1b..88930b0306 100644 --- a/.hgtags +++ b/.hgtags @@ -3148,3 +3148,4 @@ e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 96a4fa8e530c12137af235a9aaad57d578f9eebd v7-4-423 85a1802ae810f0e840f8b5d8f2827b4199b39750 v7-4-424 2e804ebb3ee8cd59451f8f1c1be2f09ebce0d77a v7-4-425 +7ab9a9cf2859ae4b7c00c4fff016fd5a0869450e v7-4-426 From ab6070565c0a9d1ac6652b451f89f77a40a3f096 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 10:53:52 +0200 Subject: [PATCH 092/311] updated for version 7.4.427 Problem: When an InsertCharPre autocommand executes system() typeahead may be echoed and messes up the display. (Jacob Niehus) Solution: Do not set cooked mode when invoked from ":silent". --- runtime/doc/eval.txt | 6 ++++++ src/eval.c | 12 ++++++++---- src/version.c | 2 ++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 9aa97b7f76..688fc38eb8 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -6093,6 +6093,12 @@ system({expr} [, {input}]) *system()* *E677* list items converted to NULs). Pipes are not used. + When prepended by |:silent| the shell will not be set to + cooked mode. This is meant to be used for commands that do + not need the user to type. It avoids stray characters showing + up on the screen which require |CTRL-L| to remove. > + :silent let f = system('ls *.vim') +< Note: Use |shellescape()| or |::S| with |expand()| or |fnamemodify()| to escape special characters in a command argument. Newlines in {expr} may cause the command to fail. diff --git a/src/eval.c b/src/eval.c index a8e94639df..7bf52c5f30 100644 --- a/src/eval.c +++ b/src/eval.c @@ -18594,6 +18594,7 @@ get_cmd_output_as_rettv(argvars, rettv, retlist) int err = FALSE; FILE *fd; list_T *list = NULL; + int flags = SHELL_SILENT; rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; @@ -18643,6 +18644,11 @@ get_cmd_output_as_rettv(argvars, rettv, retlist) } } + /* Omit SHELL_COOKED when invoked with ":silent". Avoids that the shell + * echoes typeahead, that messes up the display. */ + if (!msg_silent) + flags += SHELL_COOKED; + if (retlist) { int len; @@ -18652,8 +18658,7 @@ get_cmd_output_as_rettv(argvars, rettv, retlist) char_u *end; int i; - res = get_cmd_output(get_tv_string(&argvars[0]), infile, - SHELL_SILENT | SHELL_COOKED, &len); + res = get_cmd_output(get_tv_string(&argvars[0]), infile, flags, &len); if (res == NULL) goto errret; @@ -18694,8 +18699,7 @@ get_cmd_output_as_rettv(argvars, rettv, retlist) } else { - res = get_cmd_output(get_tv_string(&argvars[0]), infile, - SHELL_SILENT | SHELL_COOKED, NULL); + res = get_cmd_output(get_tv_string(&argvars[0]), infile, flags, NULL); #ifdef USE_CR /* translate into */ if (res != NULL) diff --git a/src/version.c b/src/version.c index 0d569f7f96..d43534a11c 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 427, /**/ 426, /**/ From f83e1f21b6254772ce76347d385c5220ed2af60b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 10:53:52 +0200 Subject: [PATCH 093/311] Added tag v7-4-427 for changeset fca35aa9380a --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 88930b0306..36de98fbe9 100644 --- a/.hgtags +++ b/.hgtags @@ -3149,3 +3149,4 @@ e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 85a1802ae810f0e840f8b5d8f2827b4199b39750 v7-4-424 2e804ebb3ee8cd59451f8f1c1be2f09ebce0d77a v7-4-425 7ab9a9cf2859ae4b7c00c4fff016fd5a0869450e v7-4-426 +fca35aa9380a9e3acecc78f85e05f26436e87ae1 v7-4-427 From 5632effa0918848011f56a34f27b3c8ec9940061 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 12:45:32 +0200 Subject: [PATCH 094/311] updated for version 7.4.428 Problem: executable() may return a wrong result on MS-Windows. Solution: Change the way SearchPath() is called. (Yasuhiro Matsumoto, Ken Takata) --- src/os_win32.c | 25 ++++++++++++++++++++++--- src/version.c | 2 ++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/os_win32.c b/src/os_win32.c index 0c896efc37..dd5714158c 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -1906,6 +1906,8 @@ executable_exists(char *name, char_u **path) { char *dum; char fname[_MAX_PATH]; + char *curpath, *newpath; + long n; #ifdef FEAT_MBYTE if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) @@ -1913,11 +1915,19 @@ executable_exists(char *name, char_u **path) WCHAR *p = enc_to_utf16(name, NULL); WCHAR fnamew[_MAX_PATH]; WCHAR *dumw; - long n; + WCHAR *wcurpath, *wnewpath; if (p != NULL) { - n = (long)SearchPathW(NULL, p, NULL, _MAX_PATH, fnamew, &dumw); + wcurpath = _wgetenv(L"PATH"); + wnewpath = (WCHAR*)alloc((unsigned)(wcslen(wcurpath) + 3) + * sizeof(WCHAR)); + if (wnewpath == NULL) + return FALSE; + wcscpy(wnewpath, L".;"); + wcscat(wnewpath, wcurpath); + n = (long)SearchPathW(wnewpath, p, NULL, _MAX_PATH, fnamew, &dumw); + vim_free(wnewpath); vim_free(p); if (n > 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) { @@ -1933,7 +1943,16 @@ executable_exists(char *name, char_u **path) } } #endif - if (SearchPath(NULL, name, NULL, _MAX_PATH, fname, &dum) == 0) + + curpath = getenv("PATH"); + newpath = (char*)alloc((unsigned)(STRLEN(curpath) + 3)); + if (newpath == NULL) + return FALSE; + STRCPY(newpath, ".;"); + STRCAT(newpath, curpath); + n = (long)SearchPath(newpath, name, NULL, _MAX_PATH, fname, &dum); + vim_free(newpath); + if (n == 0) return FALSE; if (mch_isdir(fname)) return FALSE; diff --git a/src/version.c b/src/version.c index d43534a11c..17add4334c 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 428, /**/ 427, /**/ From 203fcca702f2f22d02d227f2ec46f7084e83e656 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 29 Aug 2014 12:45:32 +0200 Subject: [PATCH 095/311] Added tag v7-4-428 for changeset 1fe61f6d5207 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 36de98fbe9..19a69545e3 100644 --- a/.hgtags +++ b/.hgtags @@ -3150,3 +3150,4 @@ e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 2e804ebb3ee8cd59451f8f1c1be2f09ebce0d77a v7-4-425 7ab9a9cf2859ae4b7c00c4fff016fd5a0869450e v7-4-426 fca35aa9380a9e3acecc78f85e05f26436e87ae1 v7-4-427 +1fe61f6d52079f44f61b3e03cf9b0c300f2890d9 v7-4-428 From 5b7ff92ac5f511732d4d74faa6d26c9b55a6bffa Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 30 Aug 2014 08:32:06 +0200 Subject: [PATCH 096/311] updated for version 7.4.429 Problem: Build fails with fewer features. (Elimar Riesebieter) Solution: Add #ifdef. --- src/normal.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/normal.c b/src/normal.c index 7479ac7891..a8d74117c7 100644 --- a/src/normal.c +++ b/src/normal.c @@ -4518,8 +4518,10 @@ nv_screengo(oap, dir, dist) */ validate_virtcol(); virtcol = curwin->w_virtcol; +# if defined(FEAT_LINEBREAK) if (virtcol > (colnr_T)width1 && *p_sbr != NUL) virtcol -= vim_strsize(p_sbr); +# endif if (virtcol > curwin->w_curswant && (curwin->w_curswant < (colnr_T)width1 diff --git a/src/version.c b/src/version.c index 17add4334c..8f35499241 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 429, /**/ 428, /**/ From 49526743bfc547574f659df8fc6c307fcab1dde8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 30 Aug 2014 08:32:06 +0200 Subject: [PATCH 097/311] Added tag v7-4-429 for changeset e98e415ea3b8 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 19a69545e3..8f746a9560 100644 --- a/.hgtags +++ b/.hgtags @@ -3151,3 +3151,4 @@ e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 7ab9a9cf2859ae4b7c00c4fff016fd5a0869450e v7-4-426 fca35aa9380a9e3acecc78f85e05f26436e87ae1 v7-4-427 1fe61f6d52079f44f61b3e03cf9b0c300f2890d9 v7-4-428 +e98e415ea3b8c743a5ab04ad9f498ab1b11ae8cf v7-4-429 From b1c7c8e85c6e5d4f7d40c7b4812feeec340899d6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 30 Aug 2014 13:10:18 +0200 Subject: [PATCH 098/311] updated for version 7.4.430 Problem: test_listlbr fails when compiled with normal features. Solution: Check for the +conceal feature. --- src/testdir/test_listlbr.in | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_listlbr.in b/src/testdir/test_listlbr.in index 2f28126554..f155f85a4b 100644 --- a/src/testdir/test_listlbr.in +++ b/src/testdir/test_listlbr.in @@ -2,7 +2,7 @@ Test for linebreak and list option (non-utf8) STARTTEST :so small.vim -:if !exists("+linebreak") | e! test.ok | w! test.out | qa! | endif +:if !exists("+linebreak") || !exists("+conceal") | e! test.ok | w! test.out | qa! | endif :10new|:vsp|:vert resize 20 :put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \" :norm! zt diff --git a/src/version.c b/src/version.c index 8f35499241..b81d54781b 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 430, /**/ 429, /**/ From 3a71f59ae02257d1bba3d2f84d97d5ff074b4d10 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 30 Aug 2014 13:10:19 +0200 Subject: [PATCH 099/311] Added tag v7-4-430 for changeset f4e9c65a18d4 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 8f746a9560..6eac906f9a 100644 --- a/.hgtags +++ b/.hgtags @@ -3152,3 +3152,4 @@ e60327caf9095d5ec067a5ab47bf4a69c0f58580 v7-4-417 fca35aa9380a9e3acecc78f85e05f26436e87ae1 v7-4-427 1fe61f6d52079f44f61b3e03cf9b0c300f2890d9 v7-4-428 e98e415ea3b8c743a5ab04ad9f498ab1b11ae8cf v7-4-429 +f4e9c65a18d4a5753747f327ed55c10f05d8d91c v7-4-430 From aac5bef39b6622f321d9bd7c19d0bc8ab9f1ee69 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 07:22:06 +0200 Subject: [PATCH 100/311] updated for version 7.4.431 Problem: Compiler warning. Solution: Add type cast. (Mike Williams) --- src/ex_docmd.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index c4cf1f9e1b..e90dfe5935 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2155,7 +2155,7 @@ do_one_cmd(cmdlinep, sourcing, p = ea.cmd; while (ASCII_ISALNUM(*p)) ++p; - p = vim_strnsave(ea.cmd, p - ea.cmd); + p = vim_strnsave(ea.cmd, (int)(p - ea.cmd)); ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL); vim_free(p); if (ret && !aborting()) diff --git a/src/version.c b/src/version.c index b81d54781b..838c1d6079 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 431, /**/ 430, /**/ From 1e01311e2eda8e3f0bcc816b72ddd155c9f1f720 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 07:25:33 +0200 Subject: [PATCH 101/311] updated for version 7.4.432 Problem: When the startup code expands command line arguments, setting 'encoding' will not properly convert the arguments. Solution: Call get_cmd_argsW() early in main(). (Yasuhiro Matsumoto) --- src/main.c | 11 +++++++++++ src/os_mswin.c | 4 ---- src/os_win32.c | 5 +++++ src/version.c | 2 ++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 2fb2edcb59..70d291171f 100644 --- a/src/main.c +++ b/src/main.c @@ -178,6 +178,14 @@ main */ mch_early_init(); +#if defined(WIN32) && defined(FEAT_MBYTE) + /* + * MingW expands command line arguments, which confuses our code to + * convert when 'encoding' changes. Get the unexpanded arguments. + */ + argc = get_cmd_argsW(&argv); +#endif + /* Many variables are in "params" so that we can pass them to invoked * functions without a lot of arguments. "argc" and "argv" are also * copied, so that they can be changed. */ @@ -1496,6 +1504,9 @@ getout(exitval) if (garbage_collect_at_exit) garbage_collect(); #endif +#if defined(WIN32) && defined(FEAT_MBYTE) + free_cmd_argsW(); +#endif mch_exit(exitval); } diff --git a/src/os_mswin.c b/src/os_mswin.c index 871afad9d2..b5786800e4 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -277,10 +277,6 @@ mch_early_init(void) AnsiUpperBuff(toupper_tab, 256); AnsiLowerBuff(tolower_tab, 256); #endif - -#if defined(FEAT_MBYTE) && !defined(FEAT_GUI) - (void)get_cmd_argsW(NULL); -#endif } diff --git a/src/os_win32.c b/src/os_win32.c index dd5714158c..7192c51a03 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -6461,6 +6461,7 @@ get_cmd_argsW(char ***argvp) int argc = 0; int i; + free_cmd_argsW(); ArglistW = CommandLineToArgvW(GetCommandLineW(), &nArgsW); if (ArglistW != NULL) { @@ -6493,7 +6494,11 @@ get_cmd_argsW(char ***argvp) global_argc = argc; global_argv = argv; if (argc > 0) + { + if (used_file_indexes != NULL) + free(used_file_indexes); used_file_indexes = malloc(argc * sizeof(int)); + } if (argvp != NULL) *argvp = argv; diff --git a/src/version.c b/src/version.c index 838c1d6079..18ea863d84 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 432, /**/ 431, /**/ From f2e45692e8326eae9ece41edfde5e4760116bafe Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 08:52:58 +0200 Subject: [PATCH 102/311] updated for version 7.4.433 Problem: Test 75 fails on MS-Windows. Solution: Use ":normal" instead of feedkeys(). (Michael Soyka) --- src/testdir/test75.in | 8 ++++---- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/testdir/test75.in b/src/testdir/test75.in index b7f2783f54..8fabccdf52 100644 --- a/src/testdir/test75.in +++ b/src/testdir/test75.in @@ -23,16 +23,16 @@ STARTTEST Go:" :" Outside of the range, minimum :inoremap a -:call feedkeys("a\u1040\") +:execute "normal a\u1040\" :" Inside of the range, minimum :inoremap b -:call feedkeys("a\u103f\") +:execute "normal a\u103f\" :" Inside of the range, maximum :inoremap c -:call feedkeys("a\uf03f\") +:execute "normal a\uf03f\" :" Outside of the range, maximum :inoremap d -:call feedkeys("a\uf040\") +:execute "normal a\uf040\" :" :/^eof/+1,$w! test.out :qa! diff --git a/src/version.c b/src/version.c index 18ea863d84..4d9fb1ee31 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 433, /**/ 432, /**/ From fb64b434d34dcdb8eb1d63396b6c42da3a9b3a9d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 11:13:08 +0200 Subject: [PATCH 103/311] updated for version 7.4.434 Problem: gettabvar() is not consistent with getwinvar() and getbufvar(). Solution: Return a dict with all variables when the varname is empty. (Yasuhiro Matsumoto) --- runtime/doc/eval.txt | 2 ++ src/eval.c | 13 +++++++++++-- src/testdir/test91.in | 1 + src/testdir/test91.ok | 4 ++-- src/version.c | 2 ++ 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 688fc38eb8..e5aa09c8a5 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -3575,6 +3575,8 @@ gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* Get the value of a tab-local variable {varname} in tab page {tabnr}. |t:var| Tabs are numbered starting with one. + When {varname} is empty a dictionary with all tab-local + variables is returned. Note that the name without "t:" must be used. When the tab or variable doesn't exist {def} or an empty string is returned, there is no error message. diff --git a/src/eval.c b/src/eval.c index 7bf52c5f30..8303bd3759 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12071,7 +12071,8 @@ f_gettabvar(argvars, rettv) typval_T *argvars; typval_T *rettv; { - tabpage_T *tp; + win_T *win, *oldcurwin; + tabpage_T *tp, *oldtabpage; dictitem_T *v; char_u *varname; int done = FALSE; @@ -12083,13 +12084,21 @@ f_gettabvar(argvars, rettv) tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); if (tp != NULL && varname != NULL) { + /* Set curwin to be our win, temporarily. Also set the tabpage, + * otherwise the window is not valid. */ + switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE); + /* look up the variable */ - v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 0, varname, FALSE); + /* Let gettabvar({nr}, "") return the "t:" dictionary. */ + v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE); if (v != NULL) { copy_tv(&v->di_tv, rettv); done = TRUE; } + + /* restore previous notion of curwin */ + restore_win(oldcurwin, oldtabpage, TRUE); } if (!done && argvars[2].v_type != VAR_UNKNOWN) diff --git a/src/testdir/test91.in b/src/testdir/test91.in index e900a522df..b66776b1e4 100644 --- a/src/testdir/test91.in +++ b/src/testdir/test91.in @@ -55,6 +55,7 @@ STARTTEST :tabnew :tabnew :let t:var_list = [1, 2, 3] +:let t:other = 777 :let def_list = [4, 5, 6, 7] :tabrewind :$put =string(gettabvar(3, 'var_list')) diff --git a/src/testdir/test91.ok b/src/testdir/test91.ok index 22e1572209..809952b69d 100644 --- a/src/testdir/test91.ok +++ b/src/testdir/test91.ok @@ -26,8 +26,8 @@ iso-8859-2 0 [1, 2, 3] [1, 2, 3] -'' -[4, 5, 6, 7] +{'var_list': [1, 2, 3], 'other': 777} +{'var_list': [1, 2, 3], 'other': 777} [4, 5, 6, 7] '' [4, 5, 6, 7] diff --git a/src/version.c b/src/version.c index 4d9fb1ee31..1e68b49e9f 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 434, /**/ 433, /**/ From 9005a2a54258df5dd51af755808a96a54de018bc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 11:32:39 +0200 Subject: [PATCH 104/311] updated for version 7.4.435 Problem: Line formatting behaves differently when 'linebreak' is set. (mvxxc) Solution: Disable 'linebreak' temporarily. (Christian Brabandt) --- src/edit.c | 9 +++++++++ src/version.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/edit.c b/src/edit.c index 29721afa33..7e5e29ee91 100644 --- a/src/edit.c +++ b/src/edit.c @@ -6131,6 +6131,12 @@ internal_format(textwidth, second_indent, flags, format_only, c) int no_leader = FALSE; int do_comments = (flags & INSCHAR_DO_COM); #endif +#ifdef FEAT_LINEBREAK + int has_lbr = curwin->w_p_lbr; + + /* make sure win_lbr_chartabsize() counts correctly */ + curwin->w_p_lbr = FALSE; +#endif /* * When 'ai' is off we don't want a space under the cursor to be @@ -6483,6 +6489,9 @@ internal_format(textwidth, second_indent, flags, format_only, c) if (save_char != NUL) /* put back space after cursor */ pchar_cursor(save_char); +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = has_lbr; +#endif if (!format_only && haveto_redraw) { update_topline(); diff --git a/src/version.c b/src/version.c index 1e68b49e9f..5025c68875 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 435, /**/ 434, /**/ From 669558d5917b6e12f4a631eab4b47f5136cb0744 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 11:59:38 +0200 Subject: [PATCH 105/311] updated for version 7.4.436 Problem: ml_get error for autocommand that moves the cursor of the current window. Solution: Check the cursor position after switching back to the current buffer. (Christian Brabandt) --- src/fileio.c | 3 +++ src/version.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/fileio.c b/src/fileio.c index f2d2040786..b9221ed400 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -9009,6 +9009,9 @@ win_found: curwin = aco->save_curwin; curbuf = curwin->w_buffer; + /* In case the autocommand move the cursor to a position that that + * not exist in curbuf. */ + check_cursor(); } } } diff --git a/src/version.c b/src/version.c index 5025c68875..521f2d88c9 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 436, /**/ 435, /**/ From e7303cb8bd20be5bc61eae53c77a4a879df76372 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 12:18:49 +0200 Subject: [PATCH 106/311] updated for version 7.4.437 Problem: New and old regexp engine are not consistent. Solution: Also give an error for "\ze*" for the old regexp engine. --- src/regexp.c | 18 ++++++++++++++++++ src/regexp_nfa.c | 13 ------------- src/version.c | 2 ++ 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/regexp.c b/src/regexp.c index dcb9a3b4e8..f19e139710 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -358,6 +358,8 @@ static void regdump __ARGS((char_u *, bt_regprog_T *)); static char_u *regprop __ARGS((char_u *)); #endif +static int re_mult_next __ARGS((char *what)); + static char_u e_missingbracket[] = N_("E769: Missing ] after %s["); static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%("); static char_u e_unmatchedp[] = N_("E54: Unmatched %s("); @@ -2166,9 +2168,13 @@ regatom(flagp) #endif case 's': ret = regnode(MOPEN + 0); + if (re_mult_next("\\zs") == FAIL) + return NULL; break; case 'e': ret = regnode(MCLOSE + 0); + if (re_mult_next("\\ze") == FAIL) + return NULL; break; default: EMSG_RET_NULL(_("E68: Invalid character after \\z")); @@ -7005,6 +7011,18 @@ regprop(op) } #endif /* DEBUG */ +/* + * Used in a place where no * or \+ can follow. + */ + static int +re_mult_next(what) + char *what; +{ + if (re_multi_type(peekchr()) == MULTI_MULT) + EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what); + return OK; +} + #ifdef FEAT_MBYTE static void mb_decompose __ARGS((int c, int *c1, int *c2, int *c3)); diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 4ccb05a2b3..6531d45fd1 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -291,7 +291,6 @@ static int nfa_regpiece __ARGS((void)); static int nfa_regconcat __ARGS((void)); static int nfa_regbranch __ARGS((void)); static int nfa_reg __ARGS((int paren)); -static int re_mult_next __ARGS((char *what)); #ifdef DEBUG static void nfa_set_code __ARGS((int c)); static void nfa_postfix_dump __ARGS((char_u *expr, int retval)); @@ -2281,18 +2280,6 @@ nfa_reg(paren) return OK; } -/* - * Used in a place where no * or \+ can follow. - */ - static int -re_mult_next(what) - char *what; -{ - if (re_multi_type(peekchr()) == MULTI_MULT) - EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what); - return OK; -} - #ifdef DEBUG static char_u code[50]; diff --git a/src/version.c b/src/version.c index 521f2d88c9..599dd338b3 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 437, /**/ 436, /**/ From 6a2bccdcac28f516dbfba97814101cd23091f37b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 12:33:07 +0200 Subject: [PATCH 107/311] updated for version 7.4.438 Problem: Cached values for 'cino' not reset for ":set all&". Solution: Call parse_cino(). (Yukihiro Nakadaira) --- src/option.c | 3 +++ src/version.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/option.c b/src/option.c index 855539b584..2007dee7db 100644 --- a/src/option.c +++ b/src/option.c @@ -3645,6 +3645,9 @@ set_options_default(opt_flags) #else win_comp_scroll(curwin); #endif +#ifdef FEAT_CINDENT + parse_cino(curbuf); +#endif } /* diff --git a/src/version.c b/src/version.c index 599dd338b3..0ad0376f82 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 438, /**/ 437, /**/ From c8c0dcc50da12f869f337422db9c82c53e664d41 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 12:47:38 +0200 Subject: [PATCH 108/311] updated for version 7.4.439 Problem: Duplicate message in message history. Some quickfix messages appear twice. (Gary Johnson) Solution: Do not reset keep_msg too early. (Hirohito Higashi) --- src/main.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 70d291171f..73f6697ac6 100644 --- a/src/main.c +++ b/src/main.c @@ -1249,9 +1249,9 @@ main_loop(cmdwin, noexmode) char_u *p; /* msg_attr_keep() will set keep_msg to NULL, must free the - * string here. */ + * string here. Don't reset keep_msg, msg_attr_keep() uses it + * to check for duplicates. */ p = keep_msg; - keep_msg = NULL; msg_attr(p, keep_msg_attr); vim_free(p); } diff --git a/src/version.c b/src/version.c index 0ad0376f82..edc87f3548 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 439, /**/ 438, /**/ From b0341fcaf9fae8d98ce6f252c5e3ac70df9d2c36 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 13:29:33 +0200 Subject: [PATCH 109/311] updated for version 7.4.440 Problem: Omni complete popup drawn incorrectly. Solution: Call validate_cursor() instead of check_cursor(). (Hirohito Higashi) --- src/edit.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/edit.c b/src/edit.c index 7e5e29ee91..8243890c52 100644 --- a/src/edit.c +++ b/src/edit.c @@ -4035,7 +4035,7 @@ expand_by_function(type, base) goto theend; } curwin->w_cursor = pos; /* restore the cursor position */ - check_cursor(); + validate_cursor(); if (!equalpos(curwin->w_cursor, pos)) { EMSG(_(e_compldel)); @@ -5273,7 +5273,7 @@ ins_complete(c) return FAIL; } curwin->w_cursor = pos; /* restore the cursor position */ - check_cursor(); + validate_cursor(); if (!equalpos(curwin->w_cursor, pos)) { EMSG(_(e_compldel)); diff --git a/src/version.c b/src/version.c index edc87f3548..2a86184d9c 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 440, /**/ 439, /**/ From 2b298673957165d6b24c4a4e45834313af36485a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 13:45:49 +0200 Subject: [PATCH 110/311] updated for version 7.4.441 Problem: Endless loop and other problems when 'cedit' is set to CTRL-C. Solution: Do not call ex_window() when ex_normal_busy or got_int was set. (Yasuhiro Matsumoto) --- src/ex_getln.c | 13 ++++++++----- src/version.c | 2 ++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ex_getln.c b/src/ex_getln.c index 6ca707e432..8ebcc889c3 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -759,11 +759,14 @@ getcmdline(firstc, count, indent) #ifdef FEAT_CMDWIN if (c == cedit_key || c == K_CMDWIN) { - /* - * Open a window to edit the command line (and history). - */ - c = ex_window(); - some_key_typed = TRUE; + if (ex_normal_busy == 0 && got_int == FALSE) + { + /* + * Open a window to edit the command line (and history). + */ + c = ex_window(); + some_key_typed = TRUE; + } } # ifdef FEAT_DIGRAPHS else diff --git a/src/version.c b/src/version.c index 2a86184d9c..5d512a3cda 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 441, /**/ 440, /**/ From 92b569c25b9fbac6496315c4e69f3e8fc611d757 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 13:48:09 +0200 Subject: [PATCH 111/311] Update runtime files. --- runtime/doc/cmdline.txt | 4 +- runtime/doc/eval.txt | 3 +- runtime/doc/options.txt | 5 +- runtime/doc/pattern.txt | 4 +- runtime/doc/syntax.txt | 26 ++++++++- runtime/doc/tags | 4 +- runtime/doc/todo.txt | 44 ++++++++------- runtime/filetype.vim | 7 ++- runtime/ftplugin/vim.vim | 11 ++-- runtime/syntax/tex.vim | 113 +++++++++++++++++++++------------------ 10 files changed, 134 insertions(+), 87 deletions(-) diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index a31f7107f5..d3da61ceb7 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1,4 +1,4 @@ -*cmdline.txt* For Vim version 7.4. Last change: 2014 Aug 16 +*cmdline.txt* For Vim version 7.4. Last change: 2014 Sep 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -56,7 +56,7 @@ history tables: These are completely separate. Each history can only be accessed when entering the same type of line. Use the 'history' option to set the number of lines that are remembered -(default: 20). +(default: 50). Notes: - When you enter a command-line that is exactly the same as an older one, the old one is removed (to avoid repeated commands moving older commands out of diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index e5aa09c8a5..c0ec1a7da5 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Aug 29 +*eval.txt* For Vim version 7.4. Last change: 2014 Sep 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3346,6 +3346,7 @@ getcmdtype() *getcmdtype()* ? backward search command @ |input()| command - |:insert| or |:append| command + = |i_CTRL-R_=| Only works when editing the command line, thus requires use of |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping. Returns an empty string otherwise. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 2dcfa19e48..291ab833ee 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2014 Aug 09 +*options.txt* For Vim version 7.4. Last change: 2014 Sep 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3369,7 +3369,7 @@ A jump table for the options with a short description can be found at |Q_op|. NOTE: This option is reset when 'compatible' is set. *'grepformat'* *'gfm'* -'grepformat' 'gfm' string (default "%f:%l%m,%f %l%m") +'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m") global {not in Vi} Format to recognize for the ":grep" command output. @@ -7850,6 +7850,7 @@ A jump table for the options with a short description can be found at |Q_op|. fold options options options and mappings local to a window or buffer (not global values for local options) + localoptions same as "options" slash backslashes in file names replaced with forward slashes unix with Unix end-of-line format (single ), even when diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 205d2d8bf7..322811b7cf 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.4. Last change: 2014 Aug 29 +*pattern.txt* For Vim version 7.4. Last change: 2014 Sep 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -838,7 +838,7 @@ $ At end of pattern or in front of "\|", "\)" or "\n" ('magic' on): branch is used. Example: "end\ze\(if\|for\)" matches the "end" in "endif" and "endfor". - This cannot be followed by a multi. *E888* + This cannot be followed by a multi. |E888| {not in Vi} {not available when compiled without the |+syntax| feature} */\%^* *start-of-file* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index d47b09a5dd..5cd4bd5447 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2014 Aug 29 +*syntax.txt* For Vim version 7.4. Last change: 2014 Sep 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2975,6 +2975,7 @@ TEX *tex.vim* *ft-tex-syntax* *latex-syntax* Tex: Taking Advantage of Conceal Mode |tex-conceal| Tex: Selective Conceal Mode |g:tex_conceal| Tex: Controlling iskeyword |g:tex_isk| + Tex: Fine Subscript and Superscript Control |tex-supersub| *tex-folding* *g:tex_fold_enabled* Tex: Want Syntax Folding? ~ @@ -3068,6 +3069,7 @@ selectively to enable just some syntax highlighting: > < As an example, let g:tex_fast= "M" will allow math-associated highlighting but suppress all the other region-based syntax highlighting. +(also see: |g:tex_conceal| and |tex-supersub|) *tex-morecommands* *tex-package* Tex: Want To Highlight More Commands? ~ @@ -3169,6 +3171,28 @@ syntax highlighting script handles this with the following logic: * If g:tex_isk exists, then it will be used for the local 'iskeyword' * Else the local 'iskeyword' will be set to 48-57,a-z,A-Z,192-255 + *tex-supersub* *g:tex_superscripts* *g:tex_subscripts* + Tex: Fine Subscript and Superscript Control~ + + See |tex-conceal| for how to enable concealed character replacement. + + See |g:tex_conceal| for selectively concealing accents, bold/italic, + math, Greek, and superscripts/subscripts. + + One may exert fine control over which superscripts and subscripts one + wants syntax-based concealment for (see |:syn-cchar|). Since not all + fonts support all characters, one may override the + concealed-replacement lists; by default these lists are given by: > + + let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]" + let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]" +< + For example, I use Luxi Mono Bold; it doesn't support subscript + characters for "hklmnpst", so I put > + let g:tex_subscripts= "[0-9aeijoruvx,+-/().]" +< in ~/.vim/ftplugin/tex/tex.vim in order to avoid having inscrutable + utf-8 glyphs appear. + TF *tf.vim* *ft-tf-syntax* diff --git a/runtime/doc/tags b/runtime/doc/tags index ae78930886..a8047a68e4 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -4330,7 +4330,6 @@ E885 sign.txt /*E885* E886 starting.txt /*E886* E887 if_pyth.txt /*E887* E888 pattern.txt /*E888* -E888 pattern.txt /*E888* E89 message.txt /*E89* E90 message.txt /*E90* E91 options.txt /*E91* @@ -6082,6 +6081,8 @@ g:tex_isk syntax.txt /*g:tex_isk* g:tex_no_error syntax.txt /*g:tex_no_error* g:tex_nospell syntax.txt /*g:tex_nospell* g:tex_stylish syntax.txt /*g:tex_stylish* +g:tex_subscripts syntax.txt /*g:tex_subscripts* +g:tex_superscripts syntax.txt /*g:tex_superscripts* g:tex_verbspell syntax.txt /*g:tex_verbspell* g:var eval.txt /*g:var* g:vimball_home pi_vimball.txt /*g:vimball_home* @@ -8301,6 +8302,7 @@ tex-runon syntax.txt /*tex-runon* tex-slow syntax.txt /*tex-slow* tex-stopzone syntax.txt /*tex-stopzone* tex-style syntax.txt /*tex-style* +tex-supersub syntax.txt /*tex-supersub* tex-sync syntax.txt /*tex-sync* tex-verb syntax.txt /*tex-verb* tex.vim syntax.txt /*tex.vim* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 40caa2ed93..3dffe92e6d 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Aug 29 +*todo.txt* For Vim version 7.4. Last change: 2014 Sep 09 VIM REFERENCE MANUAL by Bram Moolenaar @@ -61,31 +61,24 @@ Breaks test_eval. Inefficient, can we only compute y_width when needed? Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) -Patch to fix typos in help files. (Dominique, 2014 Aug 9) - -Way to reproduce problem that characters are put on the screen twice in Insert -mode when using system(). (Jacob Niehus, 2014 Aug 9) -Related to setting TMODE_COOK. Perhaps we can omit that for system()? - Update for Romanian spell file. (Vanilla Ice, 2014 Aug 13) - -exepath() may return the wrong value. Patch by Yasuhiro Matsumoto, 2014 Aug -26. - -Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30) -Also fixes wrong result from executable(). -Update from Ken Takata, 2014 Jan 10. Newer 2014 Apr 3. +Still produces errors. +Add flag to ignore fifth argument of SFX. +Conversion from utf-8 to cp1250 can't be without errors. Patch to remove ETO_IGNORELANGUAGE, it causes Chinese characters not to show up. (Paul Moore, 2014 Jul 30) Should it depend on the Windows version? Waiting for feedback. No longer needed after including DirectX patch? +Related to issue 255? -Fix for ":set all&" not taking care of side effect. (Yukihiro Nakadaira, 2014 -Aug 28) +Problem with linebreak, adds a test that fails. (Nazri Ramliy, 2014 Sep 6) + +Patch to avoid problems with encoding conversion with diff.vim. +(Yasuhiro Matsumoto, 2014 Sep 1. Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug -14) +14, Aug 30) Make ":1close" close the first window. Make ":+1close" close the next window. Make ":-1close" close the previous window. @@ -93,9 +86,16 @@ Can't easily close the help window, like ":pc" closes the preview window and ":ccl" closes the quickfix window. Add ":hclose". (Chris Gaal) Patch for :helpclose, Christian Brabandt, 2010 Sep 6. +Patch to fix line formatting bug. (Christian Brabandt, 2014 Sep 7) + +Patch to fix ml_get error. (Christian Brabandt, 2014 Sep 7) + Patch by Marcin Szamotulski to add +cmd to buffer commands. (2014 Aug 18) +Patch to fix encoding of arguments when setting 'encoding'. (Yasuhiro +Matsumoto, 2014 Sep 4) + Patch to fix that system() with empty input fails. (Olaf Dabrunz, 2014 Aug 19) When using a visual selection of multiple words and doing CTRL-W_] it jumps to @@ -131,6 +131,9 @@ MS-Windows: Crash opening very long file name starting with "\\". Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21) +Patch to allow for a different icon on MS-Windows. (Yasuhiro Matsumoto, 2014 +Sep 7). + Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19) "hi link" does not respect groups with GUI settings only. (Mark Lodato, 2014 @@ -271,9 +274,6 @@ Include Haiku port? (Adrien Destugues, Siarzhuk Zharski, 2013 Oct 24) Updated spec ftplugin. (Matěj Cepl, 2013 Oct 16) -Some quickfix messages appear twice. (Gary Johnson, 2014 Feb 16) -Patch by Christian Brabandt, 2014 Feb 17. - Patch to right-align signs. (James Kolb (email james), 2013 Sep 23) Patch to handle integer overflow. (Aaron Burrow, 2013 Dec 12) @@ -1906,6 +1906,10 @@ restored. (Luc St-Louis) Patch to support horizontal scroll wheel in GTK. Untested. (Bjorn Winckler, 2010 Jun 30) +Add an option for a minimal text length before inserting a line break for +'textwidth'. Avoids very short lines when a very long word follows. +(Kartik Agaram) + At next release: - Build a huge version by default. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 896ccc1211..67d3a88288 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2014 Aug 29 +" Last Change: 2014 Sep 05 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -531,7 +531,7 @@ au BufNewFile,BufRead configure.in,configure.ac setf config au BufNewFile,BufRead *.cu setf cuda " Dockerfile -au BufNewFile,BufRead Dockerfile setf=dockerfile +au BufNewFile,BufRead Dockerfile setf dockerfile " WildPackets EtherPeek Decoder au BufNewFile,BufRead *.dcd setf dcd @@ -1104,6 +1104,9 @@ au BufNewFile,BufRead *.lou,*.lout setf lout " Lua au BufNewFile,BufRead *.lua setf lua +" Luarocks +au BufNewFile,BufRead *.rockspec setf lua + " Linden Scripting Language (Second Life) au BufNewFile,BufRead *.lsl setf lsl diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim index edba37b896..f355d2837d 100644 --- a/runtime/ftplugin/vim.vim +++ b/runtime/ftplugin/vim.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Vim " Maintainer: Bram Moolenaar -" Last Change: 2013 Jun 26 +" Last Change: 2014 Sep 07 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -62,9 +62,12 @@ if exists("loaded_matchit") \ '\:\:\:\,' . \ '\\)\@!\S:\,' . \ '(:)' - " Ignore ":syntax region" commands, the 'end' argument clobbers if-endif - let b:match_skip = 'getline(".") =~ "^\\s*sy\\%[ntax]\\s\\+region" || - \ synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string"' + " Ignore syntax region commands and settings, any 'en*' would clobber + " if-endif. + " - set spl=de,en + " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ … + let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") + \ =~? "comment\\|string\\|vimSynReg\\|vimSet"' endif let &cpo = s:cpo_save diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index 31114bc093..3f719e8244 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell -" Last Change: Mar 20, 2014 -" Version: 81 +" Last Change: Sep 09, 2014 +" Version: 82 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -88,6 +88,12 @@ if !exists("g:tex_conceal") else let s:tex_conceal= g:tex_conceal endif +if !exists("g:tex_superscripts") + let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]" +endif +if !exists("g:tex_subscripts") + let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]" +endif " Determine whether or not to use "*.sty" mode {{{1 " The user may override the normal determination by setting @@ -331,22 +337,22 @@ syn match texSpaceCodeChar "`\\\=.\(\^.\)\==\(\d\|\"\x\{1,6}\|`.\)" contained if s:tex_fast =~ 'p' if !exists("g:tex_nospell") || !g:tex_nospell if g:tex_fold_enabled && has("folding") - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell + syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup,@Spell syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup,@Spell syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup,@Spell - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell + syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup,@Spell syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup,@Spell syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@Spell syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell else - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell + syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell + syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell @@ -355,22 +361,22 @@ if s:tex_fast =~ 'p' endif else if g:tex_fold_enabled && has("folding") - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup + syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup + syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup else - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup + syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup + syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup @@ -620,7 +626,7 @@ if s:tex_fast =~ 'r' syn region texRefZone matchgroup=texStatement start="\\\(page\|eq\)ref{" end="}\|%stopzone\>" contains=@texRefGroup syn region texRefZone matchgroup=texStatement start="\\v\=ref{" end="}\|%stopzone\>" contains=@texRefGroup syn region texRefOption contained matchgroup=Delimiter start='\[' end=']' contains=@texRefGroup,texRefZone nextgroup=texRefOption,texCite - syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite + syn region texCite contained matchgroup=Delimiter start='{' end='}' contains=@texRefGroup,texRefZone,texCite endif syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite @@ -1045,8 +1051,11 @@ if has("conceal") && &enc == 'utf-8' syn region texSubscript matchgroup=Delimiter start='_{' skip="\\\\\|\\[{}]" end='}' contained concealends contains=texSpecialChar,texSubscripts,texStatement,texSubscript,texSuperscript,texMathMatcher endif fun! s:SuperSub(group,leader,pat,cchar) - exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar - exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s' + if a:pat =~ '^\\' || (a:leader == '\^' && a:pat =~ g:tex_superscripts) || (a:leader == '_' && a:pat =~ g:tex_subscripts) +" call Decho("SuperSub: group<".a:group."> leader<".a:leader."> pat<".a:pat."> cchar<".a:cchar.">") + exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar + exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s' + endif endfun call s:SuperSub('texSuperscript','\^','0','⁰') call s:SuperSub('texSuperscript','\^','1','¹') @@ -1170,44 +1179,44 @@ if has("conceal") && &enc == 'utf-8' let i= i + 1 endfor endfun - " \` \' \^ \" \~ \. \= \c \H \k \r \u \v - call s:Accents('a','à','á','â','ä','ã','ȧ','ā',' ',' ','ą','å','ă','ǎ') - call s:Accents('A','À','Á','Â','Ä','Ã','Ȧ','Ā',' ',' ','Ą','Å','Ă','Ǎ') - call s:Accents('c',' ','ć','ĉ',' ',' ','ċ',' ','ç',' ',' ',' ',' ','č') - call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ',' ','Ç',' ',' ',' ',' ','Č') - call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď') - call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď') - call s:Accents('e','è','é','ê','ë','ẽ','ė','ē','ȩ',' ','ę',' ','ĕ','ě') - call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ē','Ȩ',' ','Ę',' ','Ĕ','Ě') - call s:Accents('g',' ','ǵ','ĝ',' ',' ','ġ',' ','ģ',' ',' ',' ','ğ','ǧ') - call s:Accents('G',' ','Ǵ','Ĝ',' ',' ','Ġ',' ','Ģ',' ',' ',' ','Ğ','Ǧ') - call s:Accents('h',' ',' ','ĥ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ȟ') - call s:Accents('H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ȟ') - call s:Accents('i','ì','í','î','ï','ĩ','į','ī',' ',' ','į',' ','ĭ','ǐ') - call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ','Ī',' ',' ','Į',' ','Ĭ','Ǐ') - call s:Accents('J',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ǰ') - call s:Accents('k',' ',' ',' ',' ',' ',' ',' ','ķ',' ',' ',' ',' ','ǩ') - call s:Accents('K',' ',' ',' ',' ',' ',' ',' ','Ķ',' ',' ',' ',' ','Ǩ') - call s:Accents('l',' ','ĺ','ľ',' ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ') - call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ') - call s:Accents('n',' ','ń',' ',' ','ñ',' ',' ','ņ',' ',' ',' ',' ','ň') - call s:Accents('N',' ','Ń',' ',' ','Ñ',' ',' ','Ņ',' ',' ',' ',' ','Ň') - call s:Accents('o','ò','ó','ô','ö','õ','ȯ','ō',' ','ő','ǫ',' ','ŏ','ǒ') - call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ','Ō',' ','Ő','Ǫ',' ','Ŏ','Ǒ') - call s:Accents('r',' ','ŕ',' ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř') - call s:Accents('R',' ','Ŕ',' ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř') - call s:Accents('s',' ','ś','ŝ',' ',' ',' ',' ','ş',' ','ȿ',' ',' ','š') - call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ',' ','Ş',' ',' ',' ',' ','Š') - call s:Accents('t',' ',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť') - call s:Accents('T',' ',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť') - call s:Accents('u','ù','ú','û','ü','ũ',' ','ū',' ','ű','ų','ů','ŭ','ǔ') - call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ','Ū',' ','Ű','Ų','Ů','Ŭ','Ǔ') - call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ') - call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ') - call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ',' ') - call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ',' ') - call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ',' ','ž') - call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ',' ','Ž') + " \` \' \^ \" \~ \. \= \c \H \k \r \u \v + call s:Accents('a','à','á','â','ä','ã','ȧ','ā',' ',' ','ą','å','ă','ǎ') + call s:Accents('A','À','Á','Â','Ä','Ã','Ȧ','Ā',' ',' ','Ą','Å','Ă','Ǎ') + call s:Accents('c',' ','ć','ĉ',' ',' ','ċ',' ','ç',' ',' ',' ',' ','č') + call s:Accents('C',' ','Ć','Ĉ',' ',' ','Ċ',' ','Ç',' ',' ',' ',' ','Č') + call s:Accents('d',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ď') + call s:Accents('D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ď') + call s:Accents('e','è','é','ê','ë','ẽ','ė','ē','ȩ',' ','ę',' ','ĕ','ě') + call s:Accents('E','È','É','Ê','Ë','Ẽ','Ė','Ē','Ȩ',' ','Ę',' ','Ĕ','Ě') + call s:Accents('g',' ','ǵ','ĝ',' ',' ','ġ',' ','ģ',' ',' ',' ','ğ','ǧ') + call s:Accents('G',' ','Ǵ','Ĝ',' ',' ','Ġ',' ','Ģ',' ',' ',' ','Ğ','Ǧ') + call s:Accents('h',' ',' ','ĥ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ȟ') + call s:Accents('H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','Ȟ') + call s:Accents('i','ì','í','î','ï','ĩ','į','ī',' ',' ','į',' ','ĭ','ǐ') + call s:Accents('I','Ì','Í','Î','Ï','Ĩ','İ','Ī',' ',' ','Į',' ','Ĭ','Ǐ') + call s:Accents('J',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','ǰ') + call s:Accents('k',' ',' ',' ',' ',' ',' ',' ','ķ',' ',' ',' ',' ','ǩ') + call s:Accents('K',' ',' ',' ',' ',' ',' ',' ','Ķ',' ',' ',' ',' ','Ǩ') + call s:Accents('l',' ','ĺ','ľ',' ',' ',' ',' ','ļ',' ',' ',' ',' ','ľ') + call s:Accents('L',' ','Ĺ','Ľ',' ',' ',' ',' ','Ļ',' ',' ',' ',' ','Ľ') + call s:Accents('n',' ','ń',' ',' ','ñ',' ',' ','ņ',' ',' ',' ',' ','ň') + call s:Accents('N',' ','Ń',' ',' ','Ñ',' ',' ','Ņ',' ',' ',' ',' ','Ň') + call s:Accents('o','ò','ó','ô','ö','õ','ȯ','ō',' ','ő','ǫ',' ','ŏ','ǒ') + call s:Accents('O','Ò','Ó','Ô','Ö','Õ','Ȯ','Ō',' ','Ő','Ǫ',' ','Ŏ','Ǒ') + call s:Accents('r',' ','ŕ',' ',' ',' ',' ',' ','ŗ',' ',' ',' ',' ','ř') + call s:Accents('R',' ','Ŕ',' ',' ',' ',' ',' ','Ŗ',' ',' ',' ',' ','Ř') + call s:Accents('s',' ','ś','ŝ',' ',' ',' ',' ','ş',' ','ȿ',' ',' ','š') + call s:Accents('S',' ','Ś','Ŝ',' ',' ',' ',' ','Ş',' ',' ',' ',' ','Š') + call s:Accents('t',' ',' ',' ',' ',' ',' ',' ','ţ',' ',' ',' ',' ','ť') + call s:Accents('T',' ',' ',' ',' ',' ',' ',' ','Ţ',' ',' ',' ',' ','Ť') + call s:Accents('u','ù','ú','û','ü','ũ',' ','ū',' ','ű','ų','ů','ŭ','ǔ') + call s:Accents('U','Ù','Ú','Û','Ü','Ũ',' ','Ū',' ','Ű','Ų','Ů','Ŭ','Ǔ') + call s:Accents('w',' ',' ','ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ') + call s:Accents('W',' ',' ','Ŵ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ') + call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',' ',' ',' ',' ',' ',' ',' ',' ') + call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',' ',' ',' ',' ',' ',' ',' ',' ') + call s:Accents('z',' ','ź',' ',' ',' ','ż',' ',' ',' ',' ',' ',' ','ž') + call s:Accents('Z',' ','Ź',' ',' ',' ','Ż',' ',' ',' ',' ',' ',' ','Ž') call s:Accents('\\i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ',' ','ĭ',' ') " \` \' \^ \" \~ \. \= \c \H \k \r \u \v delfun s:Accents @@ -1252,7 +1261,7 @@ endif if did_tex_syntax_inits == 1 let did_tex_syntax_inits= 2 " TeX highlighting groups which should share similar highlighting - if !exists("s:tex_no_error") + if !exists("g:tex_no_error") if !exists("g:tex_no_math") HiLink texBadMath texError HiLink texMathDelimBad texError From 33e7e75fe122588699c5219b8d4730d2650e7a74 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 9 Sep 2014 18:11:49 +0200 Subject: [PATCH 112/311] updated for version 7.4.442 Problem: Using unitinialized variable. Solution: Pass the first window of the tabpage. --- src/eval.c | 8 ++++---- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/eval.c b/src/eval.c index 8303bd3759..dfcb586b10 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12071,7 +12071,7 @@ f_gettabvar(argvars, rettv) typval_T *argvars; typval_T *rettv; { - win_T *win, *oldcurwin; + win_T *oldcurwin; tabpage_T *tp, *oldtabpage; dictitem_T *v; char_u *varname; @@ -12084,9 +12084,9 @@ f_gettabvar(argvars, rettv) tp = find_tabpage((int)get_tv_number_chk(&argvars[0], NULL)); if (tp != NULL && varname != NULL) { - /* Set curwin to be our win, temporarily. Also set the tabpage, - * otherwise the window is not valid. */ - switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE); + /* Set tp to be our tabpage, temporarily. Also set the window to the + * first window in the tabpage, otherwise the window is not valid. */ + switch_win(&oldcurwin, &oldtabpage, tp->tp_firstwin, tp, TRUE); /* look up the variable */ /* Let gettabvar({nr}, "") return the "t:" dictionary. */ diff --git a/src/version.c b/src/version.c index 5d512a3cda..70b4087552 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 442, /**/ 441, /**/ From af2ddb5fdf0f82031ecbf9988a8eede317efe161 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 11 Sep 2014 17:50:09 +0200 Subject: [PATCH 113/311] updated for version 7.4.443 Problem: Error reported by ubsan when running test 72. Solution: Add type cast to unsigned. (Dominique Pelle) --- src/undo.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/undo.c b/src/undo.c index db6ea29ab7..24dcf0548e 100644 --- a/src/undo.c +++ b/src/undo.c @@ -1019,7 +1019,7 @@ undo_read_4c(bi) int n; undo_read(bi, buf, (size_t)4); - n = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; + n = ((unsigned)buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; return n; } #endif diff --git a/src/version.c b/src/version.c index 70b4087552..c04cb9bc3d 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 443, /**/ 442, /**/ From 4af83223beded6a0fb01afc4d26b548b3d778e69 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 15 Sep 2014 09:25:54 +0200 Subject: [PATCH 114/311] updated for version 7.4.444 Problem: Reversed question mark not recognized as punctuation. (Issue 258) Solution: Add the Supplemental Punctuation range. --- src/mbyte.c | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/mbyte.c b/src/mbyte.c index 10df894bec..44cbd5f82b 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -2537,6 +2537,7 @@ utf_class(c) {0x2900, 0x2998, 1}, /* arrows, brackets, etc. */ {0x29d8, 0x29db, 1}, {0x29fc, 0x29fd, 1}, + {0x2e00, 0x2e7f, 1}, /* supplemental punctuation */ {0x3000, 0x3000, 0}, /* ideographic space */ {0x3001, 0x3020, 1}, /* ideographic punctuation */ {0x3030, 0x3030, 1}, diff --git a/src/version.c b/src/version.c index c04cb9bc3d..a66046a216 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 444, /**/ 443, /**/ From e537487a5bc5cb3bc39fef6449ba7b74b021be3d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 19 Sep 2014 08:46:52 +0200 Subject: [PATCH 115/311] updated for version 7.4.445 Problem: Clipboard may be cleared on startup. Solution: Set clip_did_set_selection to -1 during startup. (Christian Brabandt) --- src/main.c | 9 +++++++++ src/ui.c | 4 ++-- src/version.c | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 73f6697ac6..fe75495828 100644 --- a/src/main.c +++ b/src/main.c @@ -958,8 +958,17 @@ vim_main2(int argc UNUSED, char **argv UNUSED) if (p_im) need_start_insertmode = TRUE; +#ifdef FEAT_CLIPBOARD + if (clip_unnamed) + /* do not overwrite system clipboard while starting up */ + clip_did_set_selection = -1; +#endif #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf); +# ifdef FEAT_CLIPBOARD + if (clip_did_set_selection < 0) + clip_did_set_selection = TRUE; +# endif TIME_MSG("VimEnter autocommands"); #endif diff --git a/src/ui.c b/src/ui.c index 21d92f0b7b..b268cd78d4 100644 --- a/src/ui.c +++ b/src/ui.c @@ -571,7 +571,7 @@ start_global_changes() { clip_unnamed_saved = clip_unnamed; - if (clip_did_set_selection) + if (clip_did_set_selection > 0) { clip_unnamed = FALSE; clip_did_set_selection = FALSE; @@ -584,7 +584,7 @@ start_global_changes() void end_global_changes() { - if (!clip_did_set_selection) + if (clip_did_set_selection == FALSE) /* not when -1 */ { clip_did_set_selection = TRUE; clip_unnamed = clip_unnamed_saved; diff --git a/src/version.c b/src/version.c index a66046a216..adff6dbd01 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 445, /**/ 444, /**/ From 0d4adebde3559db83502e3690a023b8839635087 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 19 Sep 2014 09:26:36 +0200 Subject: [PATCH 116/311] updated for version 7.4.446 Problem: In some situations, when setting up an environment to trigger an autocommand, the environment is not properly restored. Solution: Check the return value of switch_win() and call restore_win() always. (Daniel Hahler) --- src/eval.c | 93 ++++++++++++++++++++++++++------------------------- src/misc2.c | 3 +- src/version.c | 2 ++ src/window.c | 11 ++---- 4 files changed, 55 insertions(+), 54 deletions(-) diff --git a/src/eval.c b/src/eval.c index dfcb586b10..780d8834b0 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12086,15 +12086,17 @@ f_gettabvar(argvars, rettv) { /* Set tp to be our tabpage, temporarily. Also set the window to the * first window in the tabpage, otherwise the window is not valid. */ - switch_win(&oldcurwin, &oldtabpage, tp->tp_firstwin, tp, TRUE); - - /* look up the variable */ - /* Let gettabvar({nr}, "") return the "t:" dictionary. */ - v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE); - if (v != NULL) + if (switch_win(&oldcurwin, &oldtabpage, tp->tp_firstwin, tp, TRUE) + == OK) { - copy_tv(&v->di_tv, rettv); - done = TRUE; + /* look up the variable */ + /* Let gettabvar({nr}, "") return the "t:" dictionary. */ + v = find_var_in_ht(&tp->tp_vars->dv_hashtab, 't', varname, FALSE); + if (v != NULL) + { + copy_tv(&v->di_tv, rettv); + done = TRUE; + } } /* restore previous notion of curwin */ @@ -12233,22 +12235,24 @@ getwinvar(argvars, rettv, off) { /* Set curwin to be our win, temporarily. Also set the tabpage, * otherwise the window is not valid. */ - switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE); - - if (*varname == '&') /* window-local-option */ + if (switch_win(&oldcurwin, &oldtabpage, win, tp, TRUE) == OK) { - if (get_option_tv(&varname, rettv, 1) == OK) - done = TRUE; - } - else - { - /* Look up the variable. */ - /* Let getwinvar({nr}, "") return the "w:" dictionary. */ - v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', varname, FALSE); - if (v != NULL) + if (*varname == '&') /* window-local-option */ { - copy_tv(&v->di_tv, rettv); - done = TRUE; + if (get_option_tv(&varname, rettv, 1) == OK) + done = TRUE; + } + else + { + /* Look up the variable. */ + /* Let getwinvar({nr}, "") return the "w:" dictionary. */ + v = find_var_in_ht(&win->w_vars->dv_hashtab, 'w', + varname, FALSE); + if (v != NULL) + { + copy_tv(&v->di_tv, rettv); + done = TRUE; + } } } @@ -17252,34 +17256,33 @@ setwinvar(argvars, rettv, off) if (win != NULL && varname != NULL && varp != NULL) { #ifdef FEAT_WINDOWS - if (switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == FAIL) - return; + if (switch_win(&save_curwin, &save_curtab, win, tp, TRUE) == OK) #endif - - if (*varname == '&') { - long numval; - char_u *strval; - int error = FALSE; - - ++varname; - numval = get_tv_number_chk(varp, &error); - strval = get_tv_string_buf_chk(varp, nbuf); - if (!error && strval != NULL) - set_option_value(varname, numval, strval, OPT_LOCAL); - } - else - { - winvarname = alloc((unsigned)STRLEN(varname) + 3); - if (winvarname != NULL) + if (*varname == '&') { - STRCPY(winvarname, "w:"); - STRCPY(winvarname + 2, varname); - set_var(winvarname, varp, TRUE); - vim_free(winvarname); + long numval; + char_u *strval; + int error = FALSE; + + ++varname; + numval = get_tv_number_chk(varp, &error); + strval = get_tv_string_buf_chk(varp, nbuf); + if (!error && strval != NULL) + set_option_value(varname, numval, strval, OPT_LOCAL); + } + else + { + winvarname = alloc((unsigned)STRLEN(varname) + 3); + if (winvarname != NULL) + { + STRCPY(winvarname, "w:"); + STRCPY(winvarname + 2, varname); + set_var(winvarname, varp, TRUE); + vim_free(winvarname); + } } } - #ifdef FEAT_WINDOWS restore_win(save_curwin, save_curtab, TRUE); #endif diff --git a/src/misc2.c b/src/misc2.c index 1f8878f674..1fe0e87cf1 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -1040,7 +1040,8 @@ free_all_mem() entered = TRUE; # ifdef FEAT_AUTOCMD - block_autocmds(); /* don't want to trigger autocommands here */ + /* Don't want to trigger autocommands from here on. */ + block_autocmds(); # endif # ifdef FEAT_WINDOWS diff --git a/src/version.c b/src/version.c index adff6dbd01..53fcc8f0df 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 446, /**/ 445, /**/ diff --git a/src/window.c b/src/window.c index 5012427fae..0088e32648 100644 --- a/src/window.c +++ b/src/window.c @@ -1271,7 +1271,7 @@ win_init(newp, oldp, flags) } /* - * Initialize window "newp" from window"old". + * Initialize window "newp" from window "old". * Only the essential things are copied. */ static void @@ -6662,8 +6662,8 @@ restore_snapshot_rec(sn, fr) || defined(PROTO) /* * Set "win" to be the curwin and "tp" to be the current tab page. - * restore_win() MUST be called to undo. - * No autocommands will be executed. + * restore_win() MUST be called to undo, also when FAIL is returned. + * No autocommands will be executed until restore_win() is called. * When "no_display" is TRUE the display won't be affected, no redraw is * triggered, another tabpage access is limited. * Returns FAIL if switching to "win" failed. @@ -6696,12 +6696,7 @@ switch_win(save_curwin, save_curtab, win, tp, no_display) goto_tabpage_tp(tp, FALSE, FALSE); } if (!win_valid(win)) - { -# ifdef FEAT_AUTOCMD - unblock_autocmds(); -# endif return FAIL; - } curwin = win; curbuf = curwin->w_buffer; # endif From d182914397eba9a6b0fed1d240da2aeaa70fe333 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 19 Sep 2014 11:04:11 +0200 Subject: [PATCH 117/311] updated for version 7.4.447 Problem: Spell files from Hunspell may generate a lot of errors. Solution: Add the IGNOREEXTRA flag. --- runtime/doc/spell.txt | 11 +++++++++++ src/spell.c | 13 ++++++++++--- src/version.c | 2 ++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 3ffd8932e1..e1cc6a593c 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1058,6 +1058,9 @@ this text to start with a "#" so that mistakes don't go unnoticed. Example: SFX F 0 in [^i]n # Spion > Spionin ~ SFX F 0 nen in # Bauerin > Bauerinnen ~ +However, to avoid lots of errors in affix files written for Myspell, you can +add the IGNOREEXTRA flag. + Apparently Myspell allows an affix name to appear more than once. Since this might also be a mistake, Vim checks for an extra "S". The affix files for Myspell that use this feature apparently have this flag. Example: @@ -1111,6 +1114,14 @@ Specifically, the affix flags can be used for: - CIRCUMFIX, as explained just below. +IGNOREEXTRA *spell-IGNOREEXTRA* + +Normally Vim gives an error for an extra field that does not start with '#'. +This avoids errors going unnoticed. However, some files created for Myspell +or Hunspell may contain many entries with an extra field. Use the IGNOREEXTRA +flag to avoid lots of errors. + + CIRCUMFIX *spell-CIRCUMFIX* The CIRCUMFIX flag means a prefix and suffix must be added at the same time. diff --git a/src/spell.c b/src/spell.c index 50636421ea..1e52dfb26e 100644 --- a/src/spell.c +++ b/src/spell.c @@ -4841,6 +4841,7 @@ typedef struct afffile_S unsigned af_nosuggest; /* NOSUGGEST ID */ int af_pfxpostpone; /* postpone prefixes without chop string and without flags */ + int af_ignoreextra; /* IGNOREEXTRA present */ hashtab_T af_pref; /* hashtable for prefixes, affheader_T */ hashtab_T af_suff; /* hashtable for suffixes, affheader_T */ hashtab_T af_comp; /* hashtable for compound flags, compitem_T */ @@ -5605,6 +5606,10 @@ spell_read_aff(spin, fname) { aff->af_pfxpostpone = TRUE; } + else if (is_aff_rule(items, itemcnt, "IGNOREEXTRA", 1)) + { + aff->af_ignoreextra = TRUE; + } else if ((STRCMP(items[0], "PFX") == 0 || STRCMP(items[0], "SFX") == 0) && aff_todo == 0 @@ -5712,9 +5717,11 @@ spell_read_aff(spin, fname) int lasti = 5; /* Myspell allows extra text after the item, but that might - * mean mistakes go unnoticed. Require a comment-starter. - * Hunspell uses a "-" item. */ - if (itemcnt > lasti && *items[lasti] != '#' + * mean mistakes go unnoticed. Require a comment-starter, + * unless IGNOREEXTRA is used. Hunspell uses a "-" item. */ + if (itemcnt > lasti + && !aff->af_ignoreextra + && *items[lasti] != '#' && (STRCMP(items[lasti], "-") != 0 || itemcnt != lasti + 1)) smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); diff --git a/src/version.c b/src/version.c index 53fcc8f0df..4950539296 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 447, /**/ 446, /**/ From 50a373d7090903a2f9a76e5c6a8160db87df0a61 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 19 Sep 2014 11:13:53 +0200 Subject: [PATCH 118/311] updated for version 7.4.448 Problem: Using ETO_IGNORELANGUAGE causes problems. Solution: Remove this flag. (Paul Moore) --- src/gui_w32.c | 17 +++-------------- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/gui_w32.c b/src/gui_w32.c index 0368dda439..6948ab551c 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -535,10 +535,6 @@ static void dyn_imm_load(void); # define pImmSetConversionStatus ImmSetConversionStatus #endif -#ifndef ETO_IGNORELANGUAGE -# define ETO_IGNORELANGUAGE 0x1000 -#endif - /* multi monitor support */ typedef struct _MONITORINFOstruct { @@ -2500,12 +2496,6 @@ gui_mch_draw_string( padding[i] = gui.char_width; } - /* On NT, tell the font renderer not to "help" us with Hebrew and Arabic - * text. This doesn't work in 9x, so we have to deal with it manually on - * those systems. */ - if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT) - foptions |= ETO_IGNORELANGUAGE; - /* * We have to provide the padding argument because italic and bold versions * of fixed-width fonts are often one pixel or so wider than their normal @@ -2641,10 +2631,9 @@ gui_mch_draw_string( #endif { #ifdef FEAT_RIGHTLEFT - /* If we can't use ETO_IGNORELANGUAGE, we can't tell Windows not to - * mess up RL text, so we have to draw it character-by-character. - * Only do this if RL is on, since it's slow. */ - if (curwin->w_p_rl && !(foptions & ETO_IGNORELANGUAGE)) + /* Windows will mess up RL text, so we have to draw it character by + * character. Only do this if RL is on, since it's slow. */ + if (curwin->w_p_rl) RevOut(s_hdc, TEXT_X(col), TEXT_Y(row), foptions, pcliprect, (char *)text, len, padding); else diff --git a/src/version.c b/src/version.c index 4950539296..7007e884dd 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 448, /**/ 447, /**/ From 1d4775152d0c2bbabf79701a7f0542e9e8e073e1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 19 Sep 2014 14:39:34 +0200 Subject: [PATCH 119/311] updated for version 7.4.449 Problem: Can't easily close the help window. (Chris Gaal) Solution: Add ":helpclose". (Christian Brabandt) --- runtime/doc/helphelp.txt | 3 +++ runtime/doc/index.txt | 1 + src/ex_cmds.c | 18 ++++++++++++++++++ src/ex_cmds.h | 2 ++ src/proto/ex_cmds.pro | 1 + src/version.c | 2 ++ 6 files changed, 27 insertions(+) diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index 87f095e56d..e7d281a915 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -96,6 +96,9 @@ Help on help files *helphelp* find a tag in a file with the same language as the current file. See |help-translated|. + *:helpc* *:helpclose* +:helpc[lose] Close one help window. + *:helpg* *:helpgrep* :helpg[rep] {pattern}[@xx] Search all help text files and make a list of lines diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index cda17681fd..d16ad9a407 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1244,6 +1244,7 @@ tag command action ~ |:gvim| :gv[im] start the GUI |:hardcopy| :ha[rdcopy] send text to the printer |:help| :h[elp] open a help window +|:helpclose| :helpc[lose] close one help window |:helpfind| :helpf[ind] dialog to open a help window |:helpgrep| :helpg[rep] like ":grep" but searches help files |:helptags| :helpt[ags] generate help tags for a directory diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 2a81eb7398..4ae996c944 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5899,6 +5899,24 @@ erret: vim_free(tag); } +/* + * ":helpclose": Close the help window + */ + void +ex_helpclose(eap) + exarg_T *eap UNUSED; +{ + win_T *win; + + FOR_ALL_WINDOWS(win) + { + if (win->w_buffer->b_help) + { + win_close(win, FALSE); + break; + } + } +} #if defined(FEAT_MULTI_LANG) || defined(PROTO) /* diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 41d3a642d3..f3007c9347 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -417,6 +417,8 @@ EX(CMD_gvim, "gvim", ex_gui, BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN), EX(CMD_help, "help", ex_help, BANG|EXTRA|NOTRLCOM), +EX(CMD_helpclose, "helpclose", ex_helpclose, + RANGE|NOTADR|COUNT|TRLBAR), EX(CMD_helpfind, "helpfind", ex_helpfind, EXTRA|NOTRLCOM), EX(CMD_helpgrep, "helpgrep", ex_helpgrep, diff --git a/src/proto/ex_cmds.pro b/src/proto/ex_cmds.pro index a94f5d0486..8757637c0a 100644 --- a/src/proto/ex_cmds.pro +++ b/src/proto/ex_cmds.pro @@ -44,6 +44,7 @@ void write_viminfo_sub_string __ARGS((FILE *fp)); void free_old_sub __ARGS((void)); int prepare_tagpreview __ARGS((int undo_sync)); void ex_help __ARGS((exarg_T *eap)); +void ex_helpclose __ARGS((exarg_T *eap)); char_u *check_help_lang __ARGS((char_u *arg)); int help_heuristic __ARGS((char_u *matched_string, int offset, int wrong_case)); int find_help_tags __ARGS((char_u *arg, int *num_matches, char_u ***matches, int keep_lang)); diff --git a/src/version.c b/src/version.c index 7007e884dd..83dfeaa36d 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 449, /**/ 448, /**/ From 5b461c66f7101481918258e8dfe32adcc7502542 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 19 Sep 2014 15:07:26 +0200 Subject: [PATCH 120/311] updated for version 7.4.450 Problem: Not all commands that edit another buffer support the +cmd argument. Solution: Add the +cmd argument to relevant commands. (Marcin Szamotulski) --- runtime/doc/windows.txt | 59 ++++++++++++++++++++++++----------------- src/ex_cmds.h | 34 ++++++++++++------------ src/ex_docmd.c | 12 +++++++++ src/version.c | 2 ++ 4 files changed, 66 insertions(+), 41 deletions(-) diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 4ba28a3c08..00fe956dd4 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1042,36 +1042,41 @@ list of buffers. |unlisted-buffer| a number). Insert a backslash before a space in a buffer name. -:[N]b[uffer][!] [N] *:b* *:bu* *:buf* *:buffer* *E86* +:[N]b[uffer][!] [+cmd] [N] *:b* *:bu* *:buf* *:buffer* *E86* Edit buffer [N] from the buffer list. If [N] is not given, the current buffer remains being edited. See |:buffer-!| for [!]. This will also edit a buffer that is not in the buffer list, without setting the 'buflisted' flag. + Also see ||+cmd|. -:[N]b[uffer][!] {bufname} +:[N]b[uffer][!] [+cmd] {bufname} Edit buffer for {bufname} from the buffer list. See |:buffer-!| for [!]. This will also edit a buffer that is not in the buffer list, without setting the 'buflisted' flag. + Also see ||+cmd|. -:[N]sb[uffer] [N] *:sb* *:sbuffer* +:[N]sb[uffer] [+cmd] [N] *:sb* *:sbuffer* Split window and edit buffer [N] from the buffer list. If [N] is not given, the current buffer is edited. Respects the "useopen" setting of 'switchbuf' when splitting. This will also edit a buffer that is not in the buffer list, without setting the 'buflisted' flag. + Also see ||+cmd|. -:[N]sb[uffer] {bufname} +:[N]sb[uffer] [+cmd] {bufname} Split window and edit buffer for {bufname} from the buffer list. This will also edit a buffer that is not in the buffer list, without setting the 'buflisted' flag. Note: If what you want to do is split the buffer, make a copy under another name, you can do it this way: > :w foobar | sp # +< Also see ||+cmd|. -:[N]bn[ext][!] [N] *:bn* *:bnext* *E87* +:[N]bn[ext][!] [+cmd] [N] *:bn* *:bnext* *E87* Go to [N]th next buffer in buffer list. [N] defaults to one. Wraps around the end of the buffer list. See |:buffer-!| for [!]. + Also see ||+cmd|. If you are in a help buffer, this takes you to the next help buffer (if there is one). Similarly, if you are in a normal (non-help) buffer, this takes you to the next normal buffer. @@ -1079,55 +1084,61 @@ list of buffers. |unlisted-buffer| the way when you're browsing code/text buffers. The next three commands also work like this. + *:sbn* *:sbnext* -:[N]sbn[ext] [N] +:[N]sbn[ext] [+cmd] [N] Split window and go to [N]th next buffer in buffer list. Wraps around the end of the buffer list. Uses 'switchbuf' + Also see ||+cmd|. -:[N]bN[ext][!] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88* -:[N]bp[revious][!] [N] +:[N]bN[ext][!] [+cmd] [N] *:bN* *:bNext* *:bp* *:bprevious* *E88* +:[N]bp[revious][!] [+cmd] [N] Go to [N]th previous buffer in buffer list. [N] defaults to one. Wraps around the start of the buffer list. See |:buffer-!| for [!] and 'switchbuf'. + Also see ||+cmd|. -:[N]sbN[ext] [N] *:sbN* *:sbNext* *:sbp* *:sbprevious* -:[N]sbp[revious] [N] +:[N]sbN[ext] [+cmd] [N] *:sbN* *:sbNext* *:sbp* *:sbprevious* +:[N]sbp[revious] [+cmd] [N] Split window and go to [N]th previous buffer in buffer list. Wraps around the start of the buffer list. Uses 'switchbuf'. + Also see ||+cmd|. - *:br* *:brewind* -:br[ewind][!] Go to first buffer in buffer list. If the buffer list is +:br[ewind][!] [+cmd] *:br* *:brewind* + Go to first buffer in buffer list. If the buffer list is empty, go to the first unlisted buffer. See |:buffer-!| for [!]. - *:bf* *:bfirst* -:bf[irst] Same as ":brewind". +:bf[irst] [+cmd] *:bf* *:bfirst* + Same as |:brewind|. + Also see |+cmd|. - *:sbr* *:sbrewind* -:sbr[ewind] Split window and go to first buffer in buffer list. If the +:sbr[ewind] [+cmd] *:sbr* *:sbrewind* + Split window and go to first buffer in buffer list. If the buffer list is empty, go to the first unlisted buffer. Respects the 'switchbuf' option. + Also see |+cmd|. - *:sbf* *:sbfirst* -:sbf[irst] Same as ":sbrewind". +:sbf[irst] [+cmd] *:sbf* *:sbfirst* + Same as ":sbrewind". - *:bl* *:blast* -:bl[ast][!] Go to last buffer in buffer list. If the buffer list is +:bl[ast][!] [+cmd] *:bl* *:blast* + Go to last buffer in buffer list. If the buffer list is empty, go to the last unlisted buffer. See |:buffer-!| for [!]. - *:sbl* *:sblast* -:sbl[ast] Split window and go to last buffer in buffer list. If the +:sbl[ast] [+cmd] *:sbl* *:sblast* + Split window and go to last buffer in buffer list. If the buffer list is empty, go to the last unlisted buffer. Respects 'switchbuf' option. -:[N]bm[odified][!] [N] *:bm* *:bmodified* *E84* +:[N]bm[odified][!] [+cmd] [N] *:bm* *:bmodified* *E84* Go to [N]th next modified buffer. Note: this command also finds unlisted buffers. If there is no modified buffer the command fails. -:[N]sbm[odified] [N] *:sbm* *:sbmodified* +:[N]sbm[odified] [+cmd] [N] *:sbm* *:sbmodified* Split window and go to [N]th next modified buffer. Respects 'switchbuf' option. Note: this command also finds buffers not in the buffer list. diff --git a/src/ex_cmds.h b/src/ex_cmds.h index f3007c9347..56dfe8ea7c 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -132,9 +132,9 @@ EX(CMD_augroup, "augroup", ex_autocmd, EX(CMD_aunmenu, "aunmenu", ex_menu, EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), EX(CMD_buffer, "buffer", ex_buffer, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR), EX(CMD_bNext, "bNext", ex_bprevious, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), EX(CMD_ball, "ball", ex_buffer_all, RANGE|NOTADR|COUNT|TRLBAR), EX(CMD_badd, "badd", ex_edit, @@ -146,19 +146,19 @@ EX(CMD_behave, "behave", ex_behave, EX(CMD_belowright, "belowright", ex_wrongmodifier, NEEDARG|EXTRA|NOTRLCOM), EX(CMD_bfirst, "bfirst", ex_brewind, - BANG|RANGE|NOTADR|TRLBAR), + BANG|RANGE|NOTADR|EDITCMD|TRLBAR), EX(CMD_blast, "blast", ex_blast, - BANG|RANGE|NOTADR|TRLBAR), + BANG|RANGE|NOTADR|EDITCMD|TRLBAR), EX(CMD_bmodified, "bmodified", ex_bmodified, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), EX(CMD_bnext, "bnext", ex_bnext, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), EX(CMD_botright, "botright", ex_wrongmodifier, NEEDARG|EXTRA|NOTRLCOM), EX(CMD_bprevious, "bprevious", ex_bprevious, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), EX(CMD_brewind, "brewind", ex_brewind, - BANG|RANGE|NOTADR|TRLBAR), + BANG|RANGE|NOTADR|EDITCMD|TRLBAR), EX(CMD_break, "break", ex_break, TRLBAR|SBOXOK|CMDWIN), EX(CMD_breakadd, "breakadd", ex_breakadd, @@ -814,23 +814,23 @@ EX(CMD_sandbox, "sandbox", ex_wrongmodifier, EX(CMD_saveas, "saveas", ex_write, BANG|DFLALL|FILE1|ARGOPT|CMDWIN|TRLBAR), EX(CMD_sbuffer, "sbuffer", ex_buffer, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR), EX(CMD_sbNext, "sbNext", ex_bprevious, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), EX(CMD_sball, "sball", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), EX(CMD_sbfirst, "sbfirst", ex_brewind, - TRLBAR), + EDITCMD|TRLBAR), EX(CMD_sblast, "sblast", ex_blast, - TRLBAR), + EDITCMD|TRLBAR), EX(CMD_sbmodified, "sbmodified", ex_bmodified, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), EX(CMD_sbnext, "sbnext", ex_bnext, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), EX(CMD_sbprevious, "sbprevious", ex_bprevious, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), EX(CMD_sbrewind, "sbrewind", ex_brewind, - TRLBAR), + EDITCMD|TRLBAR), EX(CMD_scriptnames, "scriptnames", ex_scriptnames, TRLBAR|CMDWIN), EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding, diff --git a/src/ex_docmd.c b/src/ex_docmd.c index e90dfe5935..c957b5e735 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -5135,6 +5135,8 @@ ex_buffer(eap) goto_buffer(eap, DOBUF_CURRENT, FORWARD, 0); else goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } } @@ -5147,6 +5149,8 @@ ex_bmodified(eap) exarg_T *eap; { goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } /* @@ -5158,6 +5162,8 @@ ex_bnext(eap) exarg_T *eap; { goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } /* @@ -5171,6 +5177,8 @@ ex_bprevious(eap) exarg_T *eap; { goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } /* @@ -5184,6 +5192,8 @@ ex_brewind(eap) exarg_T *eap; { goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } /* @@ -5195,6 +5205,8 @@ ex_blast(eap) exarg_T *eap; { goto_buffer(eap, DOBUF_LAST, BACKWARD, 0); + if (eap->do_ecmd_cmd != NULL) + do_cmdline_cmd(eap->do_ecmd_cmd); } #endif diff --git a/src/version.c b/src/version.c index 83dfeaa36d..a6a10176df 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 450, /**/ 449, /**/ From 06892c22b11679b12c8a3226ca1e97a6b1d85ce8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 19 Sep 2014 15:45:23 +0200 Subject: [PATCH 121/311] updated for version 7.4.451 Problem: Calling system() with empty input gives an error for writing the temp file. Solution: Do not try writing if the string length is zero. (Olaf Dabrunz) --- src/eval.c | 5 ++++- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index 780d8834b0..8f62cb2e83 100644 --- a/src/eval.c +++ b/src/eval.c @@ -18638,13 +18638,16 @@ get_cmd_output_as_rettv(argvars, rettv, retlist) } else { + size_t len; + p = get_tv_string_buf_chk(&argvars[1], buf); if (p == NULL) { fclose(fd); goto errret; /* type error; errmsg already given */ } - if (fwrite(p, STRLEN(p), 1, fd) != 1) + len = STRLEN(p); + if (len > 0 && fwrite(p, len, 1, fd) != 1) err = TRUE; } if (fclose(fd) != 0) diff --git a/src/version.c b/src/version.c index a6a10176df..fa2ced9bc4 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 451, /**/ 450, /**/ From 1573f75cab76394d2e1f72c662e9d77e975934ee Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 19 Sep 2014 17:05:53 +0200 Subject: [PATCH 122/311] updated for version 7.4.452 Problem: Can't build with tiny features. (Tony Mechelynck) Solution: Use "return" instead of "break". --- src/ex_cmds.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 4ae996c944..afc215459c 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5900,7 +5900,7 @@ erret: } /* - * ":helpclose": Close the help window + * ":helpclose": Close one help window */ void ex_helpclose(eap) @@ -5913,7 +5913,7 @@ ex_helpclose(eap) if (win->w_buffer->b_help) { win_close(win, FALSE); - break; + return; } } } diff --git a/src/version.c b/src/version.c index fa2ced9bc4..902302e791 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 452, /**/ 451, /**/ From 22513da6ded775ed39826972d4dfcff9add0b2b7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 19 Sep 2014 17:23:26 +0200 Subject: [PATCH 123/311] updated for version 7.4.453 Problem: Still can't build with tiny features. Solution: Add #ifdef. --- src/ex_cmds.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index afc215459c..b8076fc37b 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5906,6 +5906,7 @@ erret: ex_helpclose(eap) exarg_T *eap UNUSED; { +#if defined(FEAT_WINDOWS) win_T *win; FOR_ALL_WINDOWS(win) @@ -5916,6 +5917,7 @@ ex_helpclose(eap) return; } } +#endif } #if defined(FEAT_MULTI_LANG) || defined(PROTO) diff --git a/src/version.c b/src/version.c index 902302e791..7727401dab 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 453, /**/ 452, /**/ From c33c6933048de6841e459fc8fac646f2a9e7ccc0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 19 Sep 2014 17:38:48 +0200 Subject: [PATCH 124/311] Updated runtime files. --- runtime/autoload/phpcomplete.vim | 12 +++--- runtime/doc/editing.txt | 7 +++- runtime/doc/helphelp.txt | 4 +- runtime/doc/index.txt | 2 +- runtime/doc/spell.txt | 2 +- runtime/doc/tags | 3 ++ runtime/doc/todo.txt | 58 +++++++++++---------------- runtime/indent/ada.vim | 2 +- runtime/indent/vim.vim | 33 +++++++++------- runtime/spell/ro/main.aap | 50 ++++++++++++++++------- runtime/spell/ro/ro_RO.diff | 68 ++++++++++++++------------------ runtime/syntax/php.vim | 13 +++--- runtime/syntax/sisu.vim | 34 ++++++++++------ 13 files changed, 155 insertions(+), 133 deletions(-) diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index c00e55cc1e..82ba894b2a 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2014 Jul 24 +" Last Change: 2014 Aug 10 " " OPTIONS: " @@ -94,9 +94,9 @@ function! phpcomplete#CompletePHP(findstart, base) " {{{ " Check if we are inside of PHP markup let pos = getpos('.') let phpbegin = searchpairpos('', 'bWn', - \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\|comment"') + \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"') let phpend = searchpairpos('', 'Wn', - \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\|comment"') + \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"') if phpbegin == [0,0] && phpend == [0,0] " We are outside of any PHP markup. Complete HTML @@ -803,7 +803,7 @@ function! phpcomplete#CompleteClassName(base, kinds, current_namespace, imports) endif let relative_name = namespace_part.tag.name " match base without the namespace part for namespaced base but not namespaced tags, for tagfiles with old ctags - if !has_key(tag, 'namespace') && index(kinds, tag.kind) != -1 && stridx(tag.name, base[len(namespace_part):]) == 0 + if !has_key(tag, 'namespace') && index(kinds, tag.kind) != -1 && stridx(tolower(tag.name), tolower(base[len(namespace_part):])) == 0 call add(no_namespace_matches, {'word': leading_slash.relative_name, 'kind': tag.kind, 'menu': tag.filename, 'info': tag.filename }) endif if has_key(tag, 'namespace') && index(kinds, tag.kind) != -1 && tag.namespace ==? namespace_for_class @@ -1607,6 +1607,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor for arg in args if arg =~# object.'\(,\|$\)' let classname_candidate = matchstr(arg, '\s*\zs'.class_name_pattern.'\ze\s\+'.object) + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, a:current_namespace, a:imports) break endif endfor @@ -1625,6 +1626,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor for param in docblock.params if param.name =~? object let classname_candidate = matchstr(param.type, class_name_pattern.'\(\[\]\)\?') + let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(classname_candidate, a:current_namespace, a:imports) break endif endfor @@ -1934,7 +1936,7 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam call search('{') let endline = line('.') - let content = join(getline(cfline, endline),"\n") + let content = join(getline(cfline, endline), "\n") " Catch extends if content =~? 'extends' let extends_class = matchstr(content, 'class\_s\+'.a:class_name.'\_s\+extends\_s\+\zs'.class_name_pattern.'\ze') diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index cbb9b90e5f..3ef8f05bc6 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.4. Last change: 2014 Aug 09 +*editing.txt* For Vim version 7.4. Last change: 2014 Sep 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -609,7 +609,10 @@ list of the current window. {not in Vi} :[count]arga[dd] {name} .. *:arga* *:argadd* *E479* - Add the {name}s to the argument list. +:[count]arga[dd] + Add the {name}s to the argument list. When {name} is + omitted at the current buffer name to the argument + list. If [count] is omitted, the {name}s are added just after the current entry in the argument list. Otherwise they are added after the [count]'th file. diff --git a/runtime/doc/helphelp.txt b/runtime/doc/helphelp.txt index e7d281a915..4ef436c5dc 100644 --- a/runtime/doc/helphelp.txt +++ b/runtime/doc/helphelp.txt @@ -1,4 +1,4 @@ -*helphelp.txt* For Vim version 7.4. Last change: 2012 Nov 28 +*helphelp.txt* For Vim version 7.4. Last change: 2014 Sep 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -97,7 +97,7 @@ Help on help files *helphelp* current file. See |help-translated|. *:helpc* *:helpclose* -:helpc[lose] Close one help window. +:helpc[lose] Close one help window, if there is one. *:helpg* *:helpgrep* :helpg[rep] {pattern}[@xx] diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index d16ad9a407..908b58680e 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.4. Last change: 2014 Mar 25 +*index.txt* For Vim version 7.4. Last change: 2014 Sep 19 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index e1cc6a593c..5a802a29ff 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 7.4. Last change: 2014 Jul 02 +*spell.txt* For Vim version 7.4. Last change: 2014 Sep 19 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/tags b/runtime/doc/tags index a8047a68e4..144b76038b 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2248,6 +2248,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :ha print.txt /*:ha* :hardcopy print.txt /*:hardcopy* :help helphelp.txt /*:help* +:helpc helphelp.txt /*:helpc* +:helpclose helphelp.txt /*:helpclose* :helpf helphelp.txt /*:helpf* :helpfind helphelp.txt /*:helpfind* :helpg helphelp.txt /*:helpg* @@ -7825,6 +7827,7 @@ spell-FLAG spell.txt /*spell-FLAG* spell-FOL spell.txt /*spell-FOL* spell-FORBIDDENWORD spell.txt /*spell-FORBIDDENWORD* spell-HOME spell.txt /*spell-HOME* +spell-IGNOREEXTRA spell.txt /*spell-IGNOREEXTRA* spell-KEEPCASE spell.txt /*spell-KEEPCASE* spell-KEY spell.txt /*spell-KEY* spell-LANG spell.txt /*spell-LANG* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 3dffe92e6d..ca957e360d 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Sep 09 +*todo.txt* For Vim version 7.4. Last change: 2014 Sep 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -61,42 +61,11 @@ Breaks test_eval. Inefficient, can we only compute y_width when needed? Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) -Update for Romanian spell file. (Vanilla Ice, 2014 Aug 13) -Still produces errors. -Add flag to ignore fifth argument of SFX. -Conversion from utf-8 to cp1250 can't be without errors. - -Patch to remove ETO_IGNORELANGUAGE, it causes Chinese characters not to show -up. (Paul Moore, 2014 Jul 30) -Should it depend on the Windows version? Waiting for feedback. -No longer needed after including DirectX patch? -Related to issue 255? - -Problem with linebreak, adds a test that fails. (Nazri Ramliy, 2014 Sep 6) - Patch to avoid problems with encoding conversion with diff.vim. (Yasuhiro Matsumoto, 2014 Sep 1. +Depends on current language, language of file can be different. -Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug -14, Aug 30) - Make ":1close" close the first window. - Make ":+1close" close the next window. - Make ":-1close" close the previous window. -Can't easily close the help window, like ":pc" closes the preview window and -":ccl" closes the quickfix window. Add ":hclose". (Chris Gaal) -Patch for :helpclose, Christian Brabandt, 2010 Sep 6. - -Patch to fix line formatting bug. (Christian Brabandt, 2014 Sep 7) - -Patch to fix ml_get error. (Christian Brabandt, 2014 Sep 7) - -Patch by Marcin Szamotulski to add +cmd to buffer commands. -(2014 Aug 18) - -Patch to fix encoding of arguments when setting 'encoding'. (Yasuhiro -Matsumoto, 2014 Sep 4) - -Patch to fix that system() with empty input fails. (Olaf Dabrunz, 2014 Aug 19) +Patch for C/C++ syntax string handling. (Brian Bi, 2014 Sep 13) When using a visual selection of multiple words and doing CTRL-W_] it jumps to the tag matching the word under the cursor, not the selected text. @@ -105,6 +74,9 @@ Patch by Christian, 2014 Aug 8. Completion for :buf does not use 'wildignorecase'. (Akshay H, 2014 May 31) +'backupcopy' should be global-local, so that some files can be written in a +different way. Patch by Christian, 2014 Sep 17. + Patch to handle list with some items locked. (ZyX, 2014 Aug 17) Prefer the second solution. @@ -113,6 +85,13 @@ Issue 252. Patch by Christian, 2014 Aug 26. ":cd C:\Windows\System32\drivers\etc*" does not work, even though the directory exists. (Sergio Gallelli, 2013 Dec 29) +Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug +14, Aug 30) + Make ":1close" close the first window. + Make ":+1close" close the next window. + Make ":-1close" close the previous window. +Doesn't look right, asked for updates. + Patch to add a special key name for K_CURSORHOLD. (Hirohito Higashi, 2014 Aug 10) @@ -129,6 +108,9 @@ inconsistent with the documentation. MS-Windows: Crash opening very long file name starting with "\\". (Christian Brock, 2012 Jun 29) +ml_updatechunk() is slow when retrying for another encoding. (John Little, +2014 Sep 11) + Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21) Patch to allow for a different icon on MS-Windows. (Yasuhiro Matsumoto, 2014 @@ -136,11 +118,16 @@ Sep 7). Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19) +Patch to make closed folds line up. (Charles Campbell, 2014 Sep 12) + "hi link" does not respect groups with GUI settings only. (Mark Lodato, 2014 Jun 8) No error for missing endwhile. (ZyX, 2014 Mar 20) +start_global_changes() plus end_global_changes() causes problem for +clip_unnamed_plus. (Jason Pleau, 2014 Sep 12) + Patch to add :arglocal and :arglists. (Marcin Szamotulski, 2014 Aug 6) PHP syntax is extremely slow. (Anhad Jai Singh, 2014 Jan 19) @@ -238,7 +225,8 @@ Patch to support sorting on floating point number. (Alex Jakushev, 2010 Oct Patch to support expression argument to sort() instead of a function name. Yasuhiro Matsumoto, 2013 May 31. -Or should we add a more general mechanism, like lambda functions? +Or should we add a more general mechanism, like a lambda() function? +Patch by Yasuhiro Matsumoto, 2014 Sep 16. VMS: Select() doesn't work properly, typing ESC may hang Vim. Use sys$qiow instead. (Samuel Ferencik, 2013 Sep 28) diff --git a/runtime/indent/ada.vim b/runtime/indent/ada.vim index 03fbaa3a18..5019f0b736 100644 --- a/runtime/indent/ada.vim +++ b/runtime/indent/ada.vim @@ -148,7 +148,7 @@ function s:StatementIndent( current_indent, prev_lnum ) " Get previous non-blank/non-comment-only line while 1 let line = substitute( getline(lnum), g:ada#Comment, '', '' ) - + if line !~ '^\s*$' && line !~ '^\s*#' break endif diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index 8c215733b3..ff4af027b4 100644 --- a/runtime/indent/vim.vim +++ b/runtime/indent/vim.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Vim script " Maintainer: Bram Moolenaar -" Last Change: 2012 Aug 02 +" Last Change: 2014 Sep 19 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -37,7 +37,8 @@ function GetVimIndentIntern() " If the current line doesn't start with '\' and below a line that starts " with '\', use the indent of the line above it. - if getline(v:lnum) !~ '^\s*\\' + let cur_text = getline(v:lnum) + if cur_text !~ '^\s*\\' while lnum > 0 && getline(lnum) =~ '^\s*\\' let lnum = lnum - 1 endwhile @@ -47,27 +48,30 @@ function GetVimIndentIntern() if lnum == 0 return 0 endif + let prev_text = getline(lnum) " Add a 'shiftwidth' after :if, :while, :try, :catch, :finally, :function " and :else. Add it three times for a line that starts with '\' after " a line that doesn't (or g:vim_indent_cont if it exists). let ind = indent(lnum) - if getline(v:lnum) =~ '^\s*\\' && v:lnum > 1 && getline(lnum) !~ '^\s*\\' + if cur_text =~ '^\s*\\' && v:lnum > 1 && prev_text !~ '^\s*\\' if exists("g:vim_indent_cont") let ind = ind + g:vim_indent_cont else let ind = ind + &sw * 3 endif - elseif getline(lnum) =~ '^\s*aug\%[roup]' && getline(lnum) !~ '^\s*aug\%[roup]\s*!\=\s\+END' + elseif prev_text =~ '^\s*aug\%[roup]' && prev_text !~ '^\s*aug\%[roup]\s*!\=\s\+END' let ind = ind + &sw else - let line = getline(lnum) - let i = match(line, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>') - if i >= 0 - let ind += &sw - if strpart(line, i, 1) == '|' && has('syntax_items') - \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$' - let ind -= &sw + " A line starting with :au does not increment/decrement indent. + if prev_text !~ '^\s*au\%[tocmd]' + let i = match(prev_text, '\(^\||\)\s*\(if\|wh\%[ile]\|for\|try\|cat\%[ch]\|fina\%[lly]\|fu\%[nction]\|el\%[seif]\)\>') + if i >= 0 + let ind += &sw + if strpart(prev_text, i, 1) == '|' && has('syntax_items') + \ && synIDattr(synID(lnum, i, 1), "name") =~ '\(Comment\|String\)$' + let ind -= &sw + endif endif endif endif @@ -75,9 +79,8 @@ function GetVimIndentIntern() " If the previous line contains an "end" after a pipe, but not in an ":au" " command. And not when there is a backslash before the pipe. " And when syntax HL is enabled avoid a match inside a string. - let line = getline(lnum) - let i = match(line, '[^\\]|\s*\(ene\@!\)') - if i > 0 && line !~ '^\s*au\%[tocmd]' + let i = match(prev_text, '[^\\]|\s*\(ene\@!\)') + if i > 0 && prev_text !~ '^\s*au\%[tocmd]' if !has('syntax_items') || synIDattr(synID(lnum, i + 2, 1), "name") !~ '\(Comment\|String\)$' let ind = ind - &sw endif @@ -86,7 +89,7 @@ function GetVimIndentIntern() " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, " :endfun, :else and :augroup END. - if getline(v:lnum) =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+END\)' + if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+END\)' let ind = ind - &sw endif diff --git a/runtime/spell/ro/main.aap b/runtime/spell/ro/main.aap index c07e2712cf..8f2379dc32 100644 --- a/runtime/spell/ro/main.aap +++ b/runtime/spell/ro/main.aap @@ -9,35 +9,43 @@ SPELLDIR = .. FILES = ro_RO.aff ro_RO.dic -all: $SPELLDIR/ro.iso-8859-2.spl $SPELLDIR/ro.utf-8.spl \ - $SPELLDIR/ro.cp1250.spl ../README_ro.txt - -$SPELLDIR/ro.iso-8859-2.spl : $FILES - :sys env LANG=ro_RO.ISO8859-2 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ro ro_RO" -c q +all: $SPELLDIR/ro.utf-8.spl \ + $SPELLDIR/ro.iso-8859-2.spl \ + $SPELLDIR/ro.cp1250.spl \ + ../README_ro.txt $SPELLDIR/ro.utf-8.spl : $FILES - :sys env LANG=ro_RO.UTF-8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ro ro_RO" -c q + :sys env LANG=ro_RO.utf8 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ro ro_RO" -c q +# Note: this generates conversion errors, because not all characters can be +# represented in iso-8859-2. +$SPELLDIR/ro.iso-8859-2.spl : $FILES + :sys env LANG=ro_RO.iso88592 $VIM -u NONE -e -c "mkspell! $SPELLDIR/ro ro_RO" -c q + +# Note: this generates conversion errors, because not all characters can be +# represented in cp1250. $SPELLDIR/ro.cp1250.spl : $FILES :sys $VIM -u NONE -e -c "set enc=cp1250" -c "mkspell! $SPELLDIR/ro ro_RO" -c q -../README_ro.txt: README_ro_RO.txt +../README_ro.txt: README :copy $source $target # # Fetching the files from OpenOffice.org. # -OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries -:attr {fetch = $OODIR/%file%} ro_RO.zip +#OODIR = http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries +OODIR = http://sourceforge.net/projects/rospell/files/Romanian%20dictionaries/dict-3.3.10 +ZIPFILE = ro_RO.3.3.10.zip +:attr {fetch = $OODIR/%file%} $ZIPFILE # The files don't depend on the .zip file so that we can delete it. # Only download the zip file if the targets don't exist. # This is a bit tricky, since the file name includes the date. ro_RO.aff ro_RO.dic: {buildcheck=} :assertpkg unzip patch - :fetch ro_RO.zip - :sys $UNZIP ro_RO.zip - :delete ro_RO.zip + :fetch $ZIPFILE + :sys $UNZIP $ZIPFILE + :delete $ZIPFILE @if not os.path.exists('ro_RO.orig.aff'): :copy ro_RO.aff ro_RO.orig.aff @if not os.path.exists('ro_RO.orig.dic'): @@ -60,12 +68,12 @@ diff: check: :assertpkg unzip diff - :fetch ro_RO.zip + :fetch $ZIPFILE :mkdir tmp :cd tmp @try: @import stat - :sys $UNZIP ../ro_RO.zip + :sys $UNZIP ../$ZIPFILE :sys {force} diff ../ro_RO.orig.aff ro_RO.aff >d @if os.stat('d')[stat.ST_SIZE] > 0: :copy ro_RO.aff ../ro_RO.new.aff @@ -75,7 +83,19 @@ check: @finally: :cd .. :delete {r}{f}{q} tmp - :delete ro_RO.zip + :delete $ZIPFILE +# Remove all the downloaded and generated files. +clean: + :delete ro_RO.aff + :delete ro_RO.dic + :delete ro_RO.orig.aff + :delete ro_RO.orig.dic + :delete ro_RO-ante1993.aff + :delete ro_RO-ante1993.dic + :delete COPYING.GPL + :delete COPYING.LGPL + :delete COPYING.MPL + :delete README # vim: set sts=4 sw=4 : diff --git a/runtime/spell/ro/ro_RO.diff b/runtime/spell/ro/ro_RO.diff index 5477030ab4..2c18228720 100644 --- a/runtime/spell/ro/ro_RO.diff +++ b/runtime/spell/ro/ro_RO.diff @@ -1,42 +1,34 @@ -*** ro_RO.orig.aff Wed Aug 31 20:34:38 2005 ---- ro_RO.aff Wed Aug 31 20:39:57 2005 +*** ro_RO.orig.aff 2014-08-29 16:29:21.162457824 +0200 +--- ro_RO.aff 2014-09-19 15:29:52.354413307 +0200 *************** -*** 3,4 **** ---- 3,8 ---- +*** 3,5 **** + TRY iaăâșțîertolncusmpdbgfzvhjxkwyqACDM +! KEY qwertyuiop|asdfghjkl|zxcvbnm -+ FOL -+ LOW -+ UPP -+ - PFX E Y 1 -*************** -*** 12,15 **** - SFX L 0 l u -! SFX L 0 le [^cg] i -! SFX L 0 i [cg] i - SFX L 0 le e ---- 16,19 ---- - SFX L 0 l u -! SFX L 0 le [^cg]i -! SFX L 0 i [cg]i - SFX L 0 le e -*************** -*** 18,20 **** - SFX U 0 a re -! SFX U 0 i [^i] ii - ---- 22,24 ---- - SFX U 0 a re -! SFX U 0 i [^i]ii +--- 3,9 ---- + TRY iaăâșțîertolncusmpdbgfzvhjxkwyqACDM +! # KEY qwertyuiop|asdfghjkl|zxcvbnm +! +! # ignore extra field (specifies type of word?) +! IGNOREEXTRA +! *************** -*** 38,41 **** - SFX I 0 ului [^ua] -! SFX I a ii [gc] a -! SFX I a ei [^cg] a - ---- 42,45 ---- - SFX I 0 ului [^ua] -! SFX I a ii [gc]a -! SFX I a ei [^cg]a - +*** 1546,1553 **** + SFX q 0 ilor . adj. m. pl. dat. +! SFX q 0 ă +! SFX q 0 a +! SFX q 0 ei +! SFX q 0 e +! SFX q 0 ele +! SFX q 0 elor + PFX q Y 1 +--- 1550,1557 ---- + SFX q 0 ilor . adj. m. pl. dat. +! SFX q 0 ă . +! SFX q 0 a . +! SFX q 0 ei . +! SFX q 0 e . +! SFX q 0 ele . +! SFX q 0 elor . + PFX q Y 1 diff --git a/runtime/syntax/php.vim b/runtime/syntax/php.vim index f27d923400..5ec5d5a393 100644 --- a/runtime/syntax/php.vim +++ b/runtime/syntax/php.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: php PHP 3/4/5 " Maintainer: Jason Woofenden -" Last Change: Aug 28, 2013 +" Last Change: Sep 18, 2014 " URL: https://gitorious.org/jasonwoof/vim-syntax/blobs/master/php.vim " Former Maintainers: Peter Hodge " Debian VIM Maintainers @@ -123,7 +123,11 @@ syn keyword phpEnvVar GATEWAY_INTERFACE SERVER_NAME SERVER_SOFTWARE SERVER_PROTO syn keyword phpIntVar GLOBALS PHP_ERRMSG PHP_SELF HTTP_GET_VARS HTTP_POST_VARS HTTP_COOKIE_VARS HTTP_POST_FILES HTTP_ENV_VARS HTTP_SERVER_VARS HTTP_SESSION_VARS HTTP_RAW_POST_DATA HTTP_STATE_VARS _GET _POST _COOKIE _FILES _SERVER _ENV _SERVER _REQUEST _SESSION contained " Constants -syn keyword phpCoreConstant PHP_VERSION PHP_OS DEFAULT_INCLUDE_PATH PEAR_INSTALL_DIR PEAR_EXTENSION_DIR PHP_EXTENSION_DIR PHP_BINDIR PHP_LIBDIR PHP_DATADIR PHP_SYSCONFDIR PHP_LOCALSTATEDIR PHP_CONFIG_FILE_PATH PHP_OUTPUT_HANDLER_START PHP_OUTPUT_HANDLER_CONT PHP_OUTPUT_HANDLER_END E_ERROR E_WARNING E_PARSE E_NOTICE E_CORE_ERROR E_CORE_WARNING E_COMPILE_ERROR E_COMPILE_WARNING E_USER_ERROR E_USER_WARNING E_USER_NOTICE E_ALL contained +syn keyword phpCoreConstant PHP_VERSION PHP_OS DEFAULT_INCLUDE_PATH PEAR_INSTALL_DIR PEAR_EXTENSION_DIR PHP_EXTENSION_DIR PHP_BINDIR PHP_LIBDIR PHP_DATADIR PHP_SYSCONFDIR PHP_LOCALSTATEDIR PHP_CONFIG_FILE_PATH PHP_OUTPUT_HANDLER_START PHP_OUTPUT_HANDLER_CONT PHP_OUTPUT_HANDLER_END contained + +" Predefined constants +" Generated by: curl -q http://php.net/manual/en/errorfunc.constants.php | grep -oP 'E_\w+' | sort -u +syn keyword phpCoreConstant E_ALL E_COMPILE_ERROR E_COMPILE_WARNING E_CORE_ERROR E_CORE_WARNING E_DEPRECATED E_ERROR E_NOTICE E_PARSE E_RECOVERABLE_ERROR E_STRICT E_USER_DEPRECATED E_USER_ERROR E_USER_NOTICE E_USER_WARNING E_WARNING contained syn case ignore @@ -502,11 +506,6 @@ syn keyword phpStructure trait " Some of these changes (highlighting isset/unset/echo etc) are not so " critical, but they make things more colourful. :-) -" highlight constant E_STRICT -syntax case match -syntax keyword phpCoreConstant E_STRICT contained -syntax case ignore - " different syntax highlighting for 'echo', 'print', 'switch', 'die' and 'list' keywords " to better indicate what they are. syntax keyword phpDefine echo print contained diff --git a/runtime/syntax/sisu.vim b/runtime/syntax/sisu.vim index 23d73254eb..0e0f2dbe0a 100644 --- a/runtime/syntax/sisu.vim +++ b/runtime/syntax/sisu.vim @@ -1,8 +1,9 @@ " SiSU Vim syntax file -" SiSU Maintainer: Ralph Amissah -" SiSU Markup: SiSU (sisu-4.0.9) -" Last Change: 2013-02-22 -" URL (sisu-4.1.0): +" SiSU Maintainer: Ralph Amissah +" SiSU Markup: SiSU (sisu-5.6.7) +" Last Change: 2014-09-14 +" URL: +" "(originally looked at Ruby Vim by Mirko Nasato) if version < 600 @@ -23,15 +24,14 @@ if !exists("sisu_no_identifiers") syn match sisu_break contains=@NoSpell " \\\\\( \|$\)\|
\|
" syn match sisu_control contains=@NoSpell "^\(-\\\\-\|=\\\\=\|-\.\.-\|<:p[bn]>\)\s*$" syn match sisu_control contains=@NoSpell "^<:\(bo\|---\)>\s*$" + syn match sisu_marktail contains=@NoSpell "^--[+~-]#\s*$" syn match sisu_marktail "[~-]#" syn match sisu_control "\"" syn match sisu_underline "\(^\| \)_[a-zA-Z0-9]\+_\([ .,]\|$\)" syn match sisu_number contains=@NoSpell "[0-9a-f]\{32\}\|[0-9a-f]\{64\}" syn match sisu_link contains=@NoSpell "\(_\?https\?://\|\.\.\/\)\S\+" syn match sisu_link " \*\~\S\+" - syn match sisu_action "^<:insert\d\+>" - syn match sisu_require contains=@NoSpell "^<<\s*[a-zA-Z0-9^._-]\+\.ss[it]$" - syn match sisu_require contains=@NoSpell "^<<{[a-zA-Z0-9^._-]\+\.ss[it]}$" + syn match sisu_require contains=@NoSpell "^<<\s*[a-zA-Z0-9^./_-]\+\.ss[it]$" syn match sisu_structure "^:A\~$" "% "Document Sub Headers: @@ -44,6 +44,8 @@ if !exists("sisu_no_identifiers") syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|lang_char\|institution\|nationality\|source\):\s" syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|language\|italics\|bold\|emphasis\|substitute\|omit\|plaintext_wrap\|texpdf_font_mono\|texpdf_font\|stamp\|promo\|ad\|manpage\|home_button_text\|home_button_image\|cover_image\|footer\):\s" syn match sisu_sub_header_notes "^\s\+:\(description\|abstract\|comment\|coverage\|relation\|source\|history\|type\|format\|prefix\|prefix_[ab]\|suffix\):\s" + syn match sisu_within_index_ignore "\S\+[:;]\(\s\+\|$\)" + syn match sisu_within_index "[:|;]\|+\d\+" "% "semantic markers: (ignore) syn match sisu_sem_marker ";{\|};[a-z._]*[a-z]" @@ -93,17 +95,25 @@ syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_ syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_make matchgroup=sisu_header start="^[@]make:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" "% "Headings: -syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-8]\|:\?[A-C]\)\~\(\S\+\|[^-]\)" end="$" +syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-4]\|:\?[A-D]\)\~\(\S\+\|[^-]\)" end="$" "% "Block Group Text: " table syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^table{.\+" end="}table" " table +syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^```\s\+table" end="^```\(\s\|$\)" syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n$" " block, group, poem, alt -syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(block\|group\|poem\|alt\){" end="^}\(block\|group\|poem\|alt\)" +syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(block\|group\|poem\|alt\){" end="^}\1" +syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^```\s\+\(block\|group\|poem\|alt\)" end="^```\(\s\|$\)" +" box +syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^box\(\.[a-z]\+\)\?{" end="^}box" +syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^```\s\+\box\(\.[a-z]\+\)\?" end="^```\(\s\|$\)" " code -syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="^code{" end="^}code" +syn region sisu_content_alt contains=sisu_error,@NoSpell matchgroup=sisu_contain start="^code\(\.[a-z][0-9a-z_]\+\)\?{" end="^}code" +syn region sisu_content_alt contains=sisu_error,@NoSpell matchgroup=sisu_contain start="^```\s\+code\(\.[a-z][0-9a-z_]\+\)\?" end="^```\(\s\|$\)" +" quote +syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_contain start="^```\s\+quote" end="^```\(\s\|$\)" "% "Endnotes: " regular endnote or asterisk or plus sign endnote @@ -138,7 +148,7 @@ syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endn "% "Font Face Curly Brackets: "syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_sem start="\S\+:{" end="}:[^<>,.!?:; ]\+" oneline " book index: -syn region sisu_index matchgroup=sisu_index_block start="^={" end="}" +syn region sisu_index contains=sisu_within_index_ignore,sisu_within_index matchgroup=sisu_index_block start="^={" end="}" " emphasis: syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*" " bold: @@ -246,6 +256,8 @@ hi def link sisu_index SpecialKey hi def link sisu_index_block Visual hi def link sisu_content_endnote Special hi def link sisu_control Delimiter +hi def link sisu_within_index Delimiter +hi def link sisu_within_index_ignore SpecialKey hi def link sisu_ocn Include hi def link sisu_number Number hi def link sisu_identifier Function From de3267602a9d3f3f86f068c1373df6fb223f8cde Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 23 Sep 2014 08:48:43 +0200 Subject: [PATCH 125/311] updated for version 7.4.454 Problem: When using a Visual selection of multiple words and doing CTRL-W_] it jumps to the tag matching the word under the cursor, not the selected text. (Patrick hemmer) Solution: Do not reset Visual mode. (idea by Christian Brabandt) --- src/version.c | 2 ++ src/window.c | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/version.c b/src/version.c index 7727401dab..1069c0b01a 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 454, /**/ 453, /**/ diff --git a/src/window.c b/src/window.c index 0088e32648..4bc2e6c412 100644 --- a/src/window.c +++ b/src/window.c @@ -479,14 +479,15 @@ newwindow: case ']': case Ctrl_RSB: CHECK_CMDWIN - reset_VIsual_and_resel(); /* stop Visual mode */ + /* keep Visual mode, can select words to use as a tag */ if (Prenum) postponed_split = Prenum; else postponed_split = -1; + g_do_tagpreview = 0; - /* Execute the command right here, required when - * "wincmd ]" was used in a function. */ + /* Execute the command right here, required when "wincmd ]" + * was used in a function. */ do_nv_ident(Ctrl_RSB, NUL); break; @@ -590,7 +591,7 @@ wingotofile: #endif case ']': case Ctrl_RSB: - reset_VIsual_and_resel(); /* stop Visual mode */ + /* keep Visual mode, can select words to use as a tag */ if (Prenum) postponed_split = Prenum; else From afedf9cef4677c93241beed1b75224da83b033a3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 23 Sep 2014 09:24:40 +0200 Subject: [PATCH 126/311] updated for version 7.4.455 Problem: Completion for :buf does not use 'wildignorecase'. (Akshay H) Solution: Pass the 'wildignorecase' flag around. --- src/buffer.c | 21 ++++++++++++--------- src/version.c | 2 ++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 5a9f8a786c..4fc50321ce 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -28,9 +28,9 @@ #include "vim.h" #if defined(FEAT_CMDL_COMPL) || defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) -static char_u *buflist_match __ARGS((regprog_T *prog, buf_T *buf)); +static char_u *buflist_match __ARGS((regprog_T *prog, buf_T *buf, int ignore_case)); # define HAVE_BUFLIST_MATCH -static char_u *fname_match __ARGS((regprog_T *prog, char_u *name)); +static char_u *fname_match __ARGS((regprog_T *prog, char_u *name, int ignore_case)); #endif static void buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options)); static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer)); @@ -2282,7 +2282,7 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only) #ifdef FEAT_DIFF && (!diffmode || diff_mode_buf(buf)) #endif - && buflist_match(prog, buf) != NULL) + && buflist_match(prog, buf, FALSE) != NULL) { if (curtab_only) { @@ -2396,7 +2396,7 @@ ExpandBufnames(pat, num_file, file, options) { if (!buf->b_p_bl) /* skip unlisted buffers */ continue; - p = buflist_match(prog, buf); + p = buflist_match(prog, buf, p_wic); if (p != NULL) { if (round == 1) @@ -2444,16 +2444,17 @@ ExpandBufnames(pat, num_file, file, options) * Check for a match on the file name for buffer "buf" with regprog "prog". */ static char_u * -buflist_match(prog, buf) +buflist_match(prog, buf, ignore_case) regprog_T *prog; buf_T *buf; + int ignore_case; /* when TRUE ignore case, when FALSE use 'fic' */ { char_u *match; /* First try the short file name, then the long file name. */ - match = fname_match(prog, buf->b_sfname); + match = fname_match(prog, buf->b_sfname, ignore_case); if (match == NULL) - match = fname_match(prog, buf->b_ffname); + match = fname_match(prog, buf->b_ffname, ignore_case); return match; } @@ -2463,9 +2464,10 @@ buflist_match(prog, buf) * Return "name" when there is a match, NULL when not. */ static char_u * -fname_match(prog, name) +fname_match(prog, name, ignore_case) regprog_T *prog; char_u *name; + int ignore_case; /* when TRUE ignore case, when FALSE use 'fic' */ { char_u *match = NULL; char_u *p; @@ -2474,7 +2476,8 @@ fname_match(prog, name) if (name != NULL) { regmatch.regprog = prog; - regmatch.rm_ic = p_fic; /* ignore case when 'fileignorecase' is set */ + /* Ignore case when 'fileignorecase' or the argument is set. */ + regmatch.rm_ic = p_fic || ignore_case; if (vim_regexec(®match, name, (colnr_T)0)) match = name; else diff --git a/src/version.c b/src/version.c index 1069c0b01a..9083083d1e 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 455, /**/ 454, /**/ From 0c649a60e49b6bec497cfac984ecab66c7e1761d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 23 Sep 2014 10:45:08 +0200 Subject: [PATCH 127/311] updated for version 7.4.456 Problem: 'backupcopy' is global, cannot write only some files in a different way. Solution: Make 'backupcopy' global-local. (Christian Brabandt) --- runtime/doc/options.txt | 2 +- src/buffer.c | 1 + src/fileio.c | 15 ++++++------ src/option.c | 53 ++++++++++++++++++++++++++++++++--------- src/option.h | 5 +++- src/proto/option.pro | 1 + src/structs.h | 4 +++- src/version.c | 2 ++ 8 files changed, 62 insertions(+), 21 deletions(-) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 291ab833ee..790e66c7b4 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -921,7 +921,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'backupcopy'* *'bkc'* 'backupcopy' 'bkc' string (Vi default for Unix: "yes", otherwise: "auto") - global + global or local to buffer |global-local| {not in Vi} When writing a file and a backup is made, this option tells how it's done. This is a comma separated list of words. diff --git a/src/buffer.c b/src/buffer.c index 4fc50321ce..9eb67164e9 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -2001,6 +2001,7 @@ free_buf_options(buf, free_p_ff) #ifdef FEAT_LISP clear_string_option(&buf->b_p_lw); #endif + clear_string_option(&buf->b_p_bkc); } /* diff --git a/src/fileio.c b/src/fileio.c index b9221ed400..c7e846b82a 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3149,6 +3149,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, int write_undo_file = FALSE; context_sha256_T sha_ctx; #endif + unsigned int bkc = get_bkc_value(buf); if (fname == NULL || *fname == NUL) /* safety check */ return FAIL; @@ -3647,10 +3648,10 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, struct stat st; #endif - if ((bkc_flags & BKC_YES) || append) /* "yes" */ + if ((bkc & BKC_YES) || append) /* "yes" */ backup_copy = TRUE; #if defined(UNIX) || defined(WIN32) - else if ((bkc_flags & BKC_AUTO)) /* "auto" */ + else if ((bkc & BKC_AUTO)) /* "auto" */ { int i; @@ -3738,7 +3739,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, /* * Break symlinks and/or hardlinks if we've been asked to. */ - if ((bkc_flags & BKC_BREAKSYMLINK) || (bkc_flags & BKC_BREAKHARDLINK)) + if ((bkc & BKC_BREAKSYMLINK) || (bkc & BKC_BREAKHARDLINK)) { # ifdef UNIX int lstat_res; @@ -3746,24 +3747,24 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, lstat_res = mch_lstat((char *)fname, &st); /* Symlinks. */ - if ((bkc_flags & BKC_BREAKSYMLINK) + if ((bkc & BKC_BREAKSYMLINK) && lstat_res == 0 && st.st_ino != st_old.st_ino) backup_copy = FALSE; /* Hardlinks. */ - if ((bkc_flags & BKC_BREAKHARDLINK) + if ((bkc & BKC_BREAKHARDLINK) && st_old.st_nlink > 1 && (lstat_res != 0 || st.st_ino == st_old.st_ino)) backup_copy = FALSE; # else # if defined(WIN32) /* Symlinks. */ - if ((bkc_flags & BKC_BREAKSYMLINK) && mch_is_symbolic_link(fname)) + if ((bkc & BKC_BREAKSYMLINK) && mch_is_symbolic_link(fname)) backup_copy = FALSE; /* Hardlinks. */ - if ((bkc_flags & BKC_BREAKHARDLINK) && mch_is_hard_link(fname)) + if ((bkc & BKC_BREAKHARDLINK) && mch_is_hard_link(fname)) backup_copy = FALSE; # endif # endif diff --git a/src/option.c b/src/option.c index 2007dee7db..af9fb506fc 100644 --- a/src/option.c +++ b/src/option.c @@ -56,6 +56,7 @@ */ #define PV_AI OPT_BUF(BV_AI) #define PV_AR OPT_BOTH(OPT_BUF(BV_AR)) +#define PV_BKC OPT_BOTH(OPT_BUF(BV_BKC)) #ifdef FEAT_QUICKFIX # define PV_BH OPT_BUF(BV_BH) # define PV_BT OPT_BUF(BV_BT) @@ -582,7 +583,7 @@ static struct vimoption (char_u *)&p_bk, PV_NONE, {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"backupcopy", "bkc", P_STRING|P_VIM|P_COMMA|P_NODUP, - (char_u *)&p_bkc, PV_NONE, + (char_u *)&p_bkc, PV_BKC, #ifdef UNIX {(char_u *)"yes", (char_u *)"auto"} #else @@ -5412,6 +5413,7 @@ check_buf_options(buf) #ifdef FEAT_LISP check_string_option(&buf->b_p_lw); #endif + check_string_option(&buf->b_p_bkc); } /* @@ -5729,16 +5731,25 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, } /* 'backupcopy' */ - else if (varp == &p_bkc) + else if (gvarp == &p_bkc) { - if (opt_strings_flags(p_bkc, p_bkc_values, &bkc_flags, TRUE) != OK) + char_u *bkc = p_bkc; + unsigned int *flags = &bkc_flags; + + if (opt_flags & OPT_LOCAL) + { + bkc = curbuf->b_p_bkc; + flags = &curbuf->b_bkc_flags; + } + + if (opt_strings_flags(bkc, p_bkc_values, flags, TRUE) != OK) errmsg = e_invarg; - if (((bkc_flags & BKC_AUTO) != 0) - + ((bkc_flags & BKC_YES) != 0) - + ((bkc_flags & BKC_NO) != 0) != 1) + if ((((int)*flags & BKC_AUTO) != 0) + + (((int)*flags & BKC_YES) != 0) + + (((int)*flags & BKC_NO) != 0) != 1) { /* Must have exactly one of "auto", "yes" and "no". */ - (void)opt_strings_flags(oldval, p_bkc_values, &bkc_flags, TRUE); + (void)opt_strings_flags(oldval, p_bkc_values, flags, TRUE); errmsg = e_invarg; } } @@ -9025,12 +9036,13 @@ get_option_value_strict(name, numval, stringval, opt_type, from) } /* - * Iterate over options. First argument is a pointer to a pointer to a structure - * inside options[] array, second is option type like in the above function. + * Iterate over options. First argument is a pointer to a pointer to a + * structure inside options[] array, second is option type like in the above + * function. * - * If first argument points to NULL it is assumed that iteration just started + * If first argument points to NULL it is assumed that iteration just started * and caller needs the very first value. - * If first argument points to the end marker function returns NULL and sets + * If first argument points to the end marker function returns NULL and sets * first argument to NULL. * * Returns full option name for current option on each call. @@ -9856,6 +9868,10 @@ unset_global_local_option(name, from) case PV_AR: buf->b_p_ar = -1; break; + case PV_BKC: + clear_string_option(&buf->b_p_bkc); + buf->b_bkc_flags = 0; + break; case PV_TAGS: clear_string_option(&buf->b_p_tags); break; @@ -9961,6 +9977,7 @@ get_varp_scope(p, opt_flags) #ifdef FEAT_LISP case PV_LW: return (char_u *)&(curbuf->b_p_lw); #endif + case PV_BKC: return (char_u *)&(curbuf->b_p_bkc); } return NULL; /* "cannot happen" */ } @@ -9993,6 +10010,8 @@ get_varp(p) ? (char_u *)&(curbuf->b_p_ar) : p->var; case PV_TAGS: return *curbuf->b_p_tags != NUL ? (char_u *)&(curbuf->b_p_tags) : p->var; + case PV_BKC: return *curbuf->b_p_bkc != NUL + ? (char_u *)&(curbuf->b_p_bkc) : p->var; #ifdef FEAT_FIND_ID case PV_DEF: return *curbuf->b_p_def != NUL ? (char_u *)&(curbuf->b_p_def) : p->var; @@ -10585,6 +10604,8 @@ buf_copy_options(buf, flags) * are not copied, start using the global value */ buf->b_p_ar = -1; buf->b_p_ul = NO_LOCAL_UNDOLEVEL; + buf->b_p_bkc = empty_option; + buf->b_bkc_flags = 0; #ifdef FEAT_QUICKFIX buf->b_p_gp = empty_option; buf->b_p_mp = empty_option; @@ -12052,3 +12073,13 @@ briopt_check(wp) return OK; } #endif + +/* + * Get the local or global value of 'backupcopy'. + */ + unsigned int +get_bkc_value(buf) + buf_T *buf; +{ + return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags; +} diff --git a/src/option.h b/src/option.h index 696d70d6a2..23cdecdf01 100644 --- a/src/option.h +++ b/src/option.h @@ -327,7 +327,7 @@ EXTERN char_u *p_bs; /* 'backspace' */ EXTERN char_u *p_bg; /* 'background' */ EXTERN int p_bk; /* 'backup' */ EXTERN char_u *p_bkc; /* 'backupcopy' */ -EXTERN unsigned bkc_flags; +EXTERN unsigned bkc_flags; /* flags from 'backupcopy' */ #ifdef IN_OPTION_C static char *(p_bkc_values[]) = {"yes", "auto", "no", "breaksymlink", "breakhardlink", NULL}; #endif @@ -918,6 +918,9 @@ enum , BV_AR #ifdef FEAT_QUICKFIX , BV_BH +#endif + , BV_BKC +#ifdef FEAT_QUICKFIX , BV_BT , BV_EFM , BV_GP diff --git a/src/proto/option.pro b/src/proto/option.pro index 3da74e62d0..2fe05aa048 100644 --- a/src/proto/option.pro +++ b/src/proto/option.pro @@ -62,4 +62,5 @@ int check_ff_value __ARGS((char_u *p)); long get_sw_value __ARGS((buf_T *buf)); long get_sts_value __ARGS((void)); void find_mps_values __ARGS((int *initc, int *findc, int *backwards, int switchit)); +unsigned int get_bkc_value __ARGS((buf_T *buf)); /* vim: set ft=c : */ diff --git a/src/structs.h b/src/structs.h index 441fcaa1c4..d24175320f 100644 --- a/src/structs.h +++ b/src/structs.h @@ -137,7 +137,7 @@ typedef struct #ifdef FEAT_LINEBREAK int wo_bri; # define w_p_bri w_onebuf_opt.wo_bri /* 'breakindent' */ - char_u *wo_briopt; + char_u *wo_briopt; # define w_p_briopt w_onebuf_opt.wo_briopt /* 'breakindentopt' */ #endif #ifdef FEAT_DIFF @@ -1537,6 +1537,8 @@ struct file_buffer int b_p_ai; /* 'autoindent' */ int b_p_ai_nopaste; /* b_p_ai saved for paste mode */ + char_u *b_p_bkc; /* 'backupcopy' */ + unsigned b_bkc_flags; /* flags for 'backupcopy' */ int b_p_ci; /* 'copyindent' */ int b_p_bin; /* 'binary' */ #ifdef FEAT_MBYTE diff --git a/src/version.c b/src/version.c index 9083083d1e..50639fd642 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 456, /**/ 455, /**/ From e9a9bf9193cd33188cd7fa807478a9314a51650d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 23 Sep 2014 11:49:46 +0200 Subject: [PATCH 128/311] updated for version 7.4.457 Problem: Using getchar() in an expression mapping may result in K_CURSORHOLD, which can't be recognized. Solution: Add the key. (Hirohito Higashi) --- src/misc2.c | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/misc2.c b/src/misc2.c index 1fe0e87cf1..d421a00bc0 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -2471,6 +2471,7 @@ static struct key_name_entry {K_SNR, (char_u *)"SNR"}, #endif {K_PLUG, (char_u *)"Plug"}, + {K_CURSORHOLD, (char_u *)"CursorHold"}, {0, NULL} }; diff --git a/src/version.c b/src/version.c index 50639fd642..bca37f54fa 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 457, /**/ 456, /**/ From 7849f7447ca4daee318881285156ad5b36fa57df Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 23 Sep 2014 13:37:56 +0200 Subject: [PATCH 129/311] updated for version 7.4.458 Problem: Issue 252: Cursor moves in a zero-height window. Solution: Check for zero height. (idea by Christian Brabandt) --- src/move.c | 12 ++++++++++++ src/version.c | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/move.c b/src/move.c index 42f778438f..2e0efeca3c 100644 --- a/src/move.c +++ b/src/move.c @@ -183,6 +183,18 @@ update_topline() if (!screen_valid(TRUE)) return; + /* If the window height is zero just use the cursor line. */ + if (curwin->w_height == 0) + { + curwin->w_topline = curwin->w_cursor.lnum; + curwin->w_botline = curwin->w_topline; + curwin->w_valid |= VALID_BOTLINE|VALID_BOTLINE_AP; +#ifdef FEAT_SCROLLBIND + curwin->w_scbind_pos = 1; +#endif + return; + } + check_cursor_moved(curwin); if (curwin->w_valid & VALID_TOPLINE) return; diff --git a/src/version.c b/src/version.c index bca37f54fa..867aa7c3fd 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 458, /**/ 457, /**/ From 75ec843bfcc81f5301a89c281742dc4578fbfc35 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 23 Sep 2014 16:53:41 +0200 Subject: [PATCH 130/311] updated for version 7.4.459 Problem: Can't change the icon after building Vim. Solution: Load the icon from a file on startup. (Yasuhiro Matsumoto) --- src/gui_w32.c | 8 ++++++++ src/os_mswin.c | 27 +++++++++++++++++++++++++++ src/os_win32.c | 3 ++- src/proto/os_mswin.pro | 1 + src/version.c | 2 ++ 5 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/gui_w32.c b/src/gui_w32.c index 6948ab551c..5e18e85175 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -1662,6 +1662,14 @@ gui_mch_init(void) if (s_textArea == NULL) return FAIL; + /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */ + { + HANDLE hIcon = NULL; + + if (mch_icon_load(&hIcon) == OK && hIcon != NULL) + SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, hIcon); + } + #ifdef FEAT_MENU s_menuBar = CreateMenu(); #endif diff --git a/src/os_mswin.c b/src/os_mswin.c index b5786800e4..8ad3695bd4 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -928,6 +928,33 @@ check_str_len(char_u *str) } # endif +/* + * Passed to do_in_runtimepath() to load a vim.ico file. + */ + static void +mch_icon_load_cb(char_u *fname, void *cookie) +{ + HANDLE *h = (HANDLE *)cookie; + + *h = LoadImage(NULL, + fname, + IMAGE_ICON, + 64, + 64, + LR_LOADFROMFILE | LR_LOADMAP3DCOLORS); +} + +/* + * Try loading an icon file from 'runtimepath'. + */ + int +mch_icon_load(iconp) + HANDLE *iconp; +{ + return do_in_runtimepath((char_u *)"bitmaps/vim.ico", + FALSE, mch_icon_load_cb, iconp); +} + int mch_libcall( char_u *libname, diff --git a/src/os_win32.c b/src/os_win32.c index 7192c51a03..21c3ee9f4e 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -2446,7 +2446,8 @@ SaveConsoleTitleAndIcon(void) return; /* Extract the first icon contained in the Vim executable. */ - g_hVimIcon = ExtractIcon(NULL, exe_name, 0); + if (mch_icon_load((HANDLE *)&g_hVimIcon) == FAIL || g_hVimIcon == NULL) + g_hVimIcon = ExtractIcon(NULL, exe_name, 0); if (g_hVimIcon != NULL) g_fCanChangeIcon = TRUE; } diff --git a/src/proto/os_mswin.pro b/src/proto/os_mswin.pro index 0d29979cf8..b56ee56568 100644 --- a/src/proto/os_mswin.pro +++ b/src/proto/os_mswin.pro @@ -21,6 +21,7 @@ int mch_has_wildcard __ARGS((char_u *p)); int mch_chdir __ARGS((char *path)); int can_end_termcap_mode __ARGS((int give_msg)); int mch_screenmode __ARGS((char_u *arg)); +int mch_icon_load __ARGS((HANDLE *iconp)); int mch_libcall __ARGS((char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result)); void DumpPutS __ARGS((const char *psz)); int mch_get_winpos __ARGS((int *x, int *y)); diff --git a/src/version.c b/src/version.c index 867aa7c3fd..a9f83a2038 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 459, /**/ 458, /**/ From f77b09dabc7bdaf32a00e9c0223c602cfff13ba1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 24 Sep 2014 08:26:44 +0200 Subject: [PATCH 131/311] updated for version 7.4.460 Problem: Can't build without the quickfix feature. (Erik Falor) Solution: Add a #ifdef. --- src/version.c | 2 ++ src/window.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/version.c b/src/version.c index a9f83a2038..4c5324a63d 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 460, /**/ 459, /**/ diff --git a/src/window.c b/src/window.c index 4bc2e6c412..5a2d8a42b5 100644 --- a/src/window.c +++ b/src/window.c @@ -484,7 +484,9 @@ newwindow: postponed_split = Prenum; else postponed_split = -1; +#ifdef FEAT_QUICKFIX g_do_tagpreview = 0; +#endif /* Execute the command right here, required when "wincmd ]" * was used in a function. */ From 192b08552132e4260fd9d3d4cba13b651655e0ad Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 27 Sep 2014 06:18:19 +0200 Subject: [PATCH 132/311] updated for version 7.4.461 Problem: MS-Windows: When collate is on the number of copies is too high. Solution: Only set the collated/uncollated count when collate is on. (Yasuhiro Matsumoto) --- src/os_mswin.c | 20 +++++++++++++------- src/version.c | 2 ++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/os_mswin.c b/src/os_mswin.c index 8ad3695bd4..9151aef414 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -1673,16 +1673,22 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) */ psettings->chars_per_line = prt_get_cpl(); psettings->lines_per_page = prt_get_lpp(); - psettings->n_collated_copies = (prt_dlg.Flags & PD_COLLATE) - ? prt_dlg.nCopies : 1; - psettings->n_uncollated_copies = (prt_dlg.Flags & PD_COLLATE) - ? 1 : prt_dlg.nCopies; + if (prt_dlg.Flags & PD_USEDEVMODECOPIESANDCOLLATE) + { + psettings->n_collated_copies = (prt_dlg.Flags & PD_COLLATE) + ? prt_dlg.nCopies : 1; + psettings->n_uncollated_copies = (prt_dlg.Flags & PD_COLLATE) + ? 1 : prt_dlg.nCopies; - if (psettings->n_collated_copies == 0) + if (psettings->n_collated_copies == 0) + psettings->n_collated_copies = 1; + + if (psettings->n_uncollated_copies == 0) + psettings->n_uncollated_copies = 1; + } else { psettings->n_collated_copies = 1; - - if (psettings->n_uncollated_copies == 0) psettings->n_uncollated_copies = 1; + } psettings->jobname = jobname; diff --git a/src/version.c b/src/version.c index 4c5324a63d..d0847ad7e5 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 461, /**/ 460, /**/ From 6326be0108d89c36c320469c19e30d38c7c5905f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 29 Sep 2014 12:15:18 +0200 Subject: [PATCH 133/311] updated for version 7.4.462 Problem: Setting the local value of 'backupcopy' empty gives an error. (Peter Mattern) Solution: When using an empty value set the flags to zero. (Hirohito Higashi) --- src/option.c | 22 ++++++++++++++-------- src/version.c | 2 ++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/option.c b/src/option.c index af9fb506fc..5e8e95a6d2 100644 --- a/src/option.c +++ b/src/option.c @@ -5742,15 +5742,21 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, flags = &curbuf->b_bkc_flags; } - if (opt_strings_flags(bkc, p_bkc_values, flags, TRUE) != OK) - errmsg = e_invarg; - if ((((int)*flags & BKC_AUTO) != 0) - + (((int)*flags & BKC_YES) != 0) - + (((int)*flags & BKC_NO) != 0) != 1) + if ((opt_flags & OPT_LOCAL) && *bkc == NUL) + /* make the local value empty: use the global value */ + *flags = 0; + else { - /* Must have exactly one of "auto", "yes" and "no". */ - (void)opt_strings_flags(oldval, p_bkc_values, flags, TRUE); - errmsg = e_invarg; + if (opt_strings_flags(bkc, p_bkc_values, flags, TRUE) != OK) + errmsg = e_invarg; + if ((((int)*flags & BKC_AUTO) != 0) + + (((int)*flags & BKC_YES) != 0) + + (((int)*flags & BKC_NO) != 0) != 1) + { + /* Must have exactly one of "auto", "yes" and "no". */ + (void)opt_strings_flags(oldval, p_bkc_values, flags, TRUE); + errmsg = e_invarg; + } } } diff --git a/src/version.c b/src/version.c index d0847ad7e5..579e0f9ebf 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 462, /**/ 461, /**/ From bf811eab137d772b52dc042cc486fc50cd6e614c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 29 Sep 2014 13:08:59 +0200 Subject: [PATCH 134/311] updated for version 7.4.463 Problem: Test 86 and 87 may hang on MS-Windows. Solution: Call inputrestore() after inputsave(). (Ken Takata) --- src/testdir/test86.in | 1 + src/testdir/test87.in | 1 + src/version.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/testdir/test86.in b/src/testdir/test86.in index b1692939a7..819ae9587d 100644 --- a/src/testdir/test86.in +++ b/src/testdir/test86.in @@ -1384,6 +1384,7 @@ EOF :debug silent! py test_keyboard_interrupt() :redir END :0 debuggreedy +:call inputrestore() :silent $put =output :unlet output :py del test_keyboard_interrupt diff --git a/src/testdir/test87.in b/src/testdir/test87.in index 9111a499bc..e24df41316 100644 --- a/src/testdir/test87.in +++ b/src/testdir/test87.in @@ -1361,6 +1361,7 @@ EOF :debug silent! py3 test_keyboard_interrupt() :redir END :0 debuggreedy +:call inputrestore() :silent $put =output :unlet output :py3 del test_keyboard_interrupt diff --git a/src/version.c b/src/version.c index 579e0f9ebf..2239524231 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 463, /**/ 462, /**/ From b938e29968bbcd11f5443eaab7b6389c4e510995 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 1 Oct 2014 20:41:41 +0200 Subject: [PATCH 135/311] Update runtime files. --- runtime/autoload/phpcomplete.vim | 5 ++- runtime/compiler/msvc.vim | 4 +- runtime/doc/autocmd.txt | 7 +++- runtime/doc/editing.txt | 4 +- runtime/doc/eval.txt | 4 +- runtime/doc/map.txt | 4 +- runtime/doc/netbeans.txt | 2 +- runtime/doc/options.txt | 3 +- runtime/doc/os_win32.txt | 8 +++- runtime/doc/syntax.txt | 10 ++--- runtime/doc/tags | 2 + runtime/doc/todo.txt | 68 +++++++++++++++++++++----------- runtime/doc/version7.txt | 2 +- runtime/doc/windows.txt | 13 +++--- runtime/syntax/c.vim | 68 +++++++++++++++++--------------- runtime/syntax/valgrind.vim | 6 ++- 16 files changed, 132 insertions(+), 78 deletions(-) diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index 82ba894b2a..b014b4cdcf 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2014 Aug 10 +" Last Change: 2014 Oct 02 " " OPTIONS: " @@ -2344,6 +2344,9 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{ endfor endif endif + if exists('no_namespace_candidate') + unlet no_namespace_candidate + endif endfor endif let i += 1 diff --git a/runtime/compiler/msvc.vim b/runtime/compiler/msvc.vim index 99fd35eb18..efe36c4da2 100644 --- a/runtime/compiler/msvc.vim +++ b/runtime/compiler/msvc.vim @@ -1,7 +1,7 @@ " Vim compiler file -" Compiler: Miscrosoft Visual C +" Compiler: Microsoft Visual C " Maintainer: Bram Moolenaar -" Last Change: 2005 Nov 30 +" Last Change: 2014 Sep 20 if exists("current_compiler") finish diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 03f95cac6d..fed1a48148 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 7.4. Last change: 2014 Aug 22 +*autocmd.txt* For Vim version 7.4. Last change: 2014 Sep 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -519,6 +519,11 @@ CursorHold When the user doesn't press a key for the time operator. While recording the CursorHold event is not triggered. |q| + ** + Internally the autocommand is triggered by the + key. In an expression mapping + |getchar()| may see this character. + Note: Interactive commands cannot be used for this event. There is no hit-enter prompt, the screen is updated directly (when needed). diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 3ef8f05bc6..add3bb0878 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1483,8 +1483,8 @@ Notes: - Pkzip uses the same encryption as 'cryptmethod' "zip", and US Govt has no objection to its export. Pkzip's public file APPNOTE.TXT describes this algorithm in detail. -- The implmentation of 'cryptmethod' "blowfish" has a flaw. It is possible to - crack the first 64 bytes of a file and in some circumstances more of the +- The implementation of 'cryptmethod' "blowfish" has a flaw. It is possible + to crack the first 64 bytes of a file and in some circumstances more of the file. Use of it is not recommended, but it's still the strongest method supported by Vim 7.3 and 7.4. The "zip" method is even weaker. - Vim originates from the Netherlands. That is where the sources come from. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index c0ec1a7da5..eb7fcbcaac 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Sep 09 +*eval.txt* For Vim version 7.4. Last change: 2014 Sep 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1751,7 +1751,7 @@ confirm( {msg} [, {choices} [, {default} [, {type}]]]) copy( {expr}) any make a shallow copy of {expr} cos( {expr}) Float cosine of {expr} cosh( {expr}) Float hyperbolic cosine of {expr} -count( {list}, {expr} [, {start} [, {ic}]]) +count( {list}, {expr} [, {ic} [, {start}]]) Number count how many {expr} are in {list} cscope_connection( [{num} , {dbpath} [, {prepend}]]) Number checks existence of cscope connection diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 3ac8e5db9d..5f1c4a6261 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.4. Last change: 2014 Jun 02 +*map.txt* For Vim version 7.4. Last change: 2014 Sep 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1283,6 +1283,8 @@ completion can be enabled: -complete=custom,{func} custom completion, defined via {func} -complete=customlist,{func} custom completion, defined via {func} +Note: That some completion methods might expand environment variables. + Custom completion *:command-completion-custom* *:command-completion-customlist* diff --git a/runtime/doc/netbeans.txt b/runtime/doc/netbeans.txt index e0ac2bf82a..82db022d03 100644 --- a/runtime/doc/netbeans.txt +++ b/runtime/doc/netbeans.txt @@ -470,7 +470,7 @@ raise Bring the editor to the foreground. New in version 2.1. removeAnno serNum - Remove a previously place annotation for this buffer. + Remove a previously placed annotation for this buffer. "serNum" is the same number used in addAnno. save Save the buffer when it was modified. The other side of the diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 790e66c7b4..b50711c698 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2014 Sep 09 +*options.txt* For Vim version 7.4. Last change: 2014 Sep 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4009,6 +4009,7 @@ A jump table for the options with a short description can be found at |Q_op|. When Vim was compiled with HAVE_X11 defined, the original icon will be restored if possible |X11|. See |X11-icon| for changing the icon on X11. + For MS-Windows the icon can be changed, see |windows-icon|. *'iconstring'* 'iconstring' string (default "") diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt index 80085a8ed0..9637d7e82a 100644 --- a/runtime/doc/os_win32.txt +++ b/runtime/doc/os_win32.txt @@ -1,4 +1,4 @@ -*os_win32.txt* For Vim version 7.4. Last change: 2014 Aug 29 +*os_win32.txt* For Vim version 7.4. Last change: 2014 Sep 25 VIM REFERENCE MANUAL by George Reilly @@ -367,4 +367,10 @@ Q. I use Vim under Win32s and NT. In NT, I can define the console to default to A. Edit SYSTEM.INI and add 'ScreenLines=50' to the [NonWindowsApp] section. DOS prompts and external DOS commands will now run in a 50-line window. + *windows-icon* +Q. I don't like the Vim icon, can I change it? +A. Yes, place your favorite icon in bitmaps/vim.ico in a directory of + 'runtimepath'. For example ~/vimfiles/bitmaps/vim.ico. + + vim:tw=78:fo=tcq2:ts=8:ft=help:norl: diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 5cd4bd5447..ee91a91acb 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2014 Sep 09 +*syntax.txt* For Vim version 7.4. Last change: 2014 Sep 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3799,7 +3799,7 @@ The 'foldnestmax' option limits the nesting of syntax folds. *:syn-contains* *E405* *E406* *E407* *E408* *E409* -contains={groupname},.. +contains={group-name},.. The "contains" argument is followed by a list of syntax group names. These groups will be allowed to begin inside the item (they may extend past the @@ -3852,13 +3852,13 @@ region where contained items do match. Note that this may also limit the area that is highlighted -containedin={groupname}... *:syn-containedin* +containedin={group-name}... *:syn-containedin* The "containedin" argument is followed by a list of syntax group names. The item will be allowed to begin inside these groups. This works as if the containing item has a "contains=" argument that includes this item. -The {groupname}... can be used just like for "contains", as explained above. +The {group-name}... can be used just like for "contains", as explained above. This is useful when adding a syntax item afterwards. An item can be told to be included inside an already existing item, without changing the definition @@ -3874,7 +3874,7 @@ keywords never contain another item, thus adding them to "containedin" won't work. -nextgroup={groupname},.. *:syn-nextgroup* +nextgroup={group-name},.. *:syn-nextgroup* The "nextgroup" argument is followed by a list of syntax group names, separated by commas (just like with "contains", so you can also use patterns). diff --git a/runtime/doc/tags b/runtime/doc/tags index 144b76038b..f8db6553e1 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -3134,6 +3134,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* intro.txt /** map.txt /** map.txt /** + autocmd.txt /** change.txt /** motion.txt /** @@ -8781,6 +8782,7 @@ window-variable eval.txt /*window-variable* windowid-variable eval.txt /*windowid-variable* windows windows.txt /*windows* windows-3.1 os_win32.txt /*windows-3.1* +windows-icon os_win32.txt /*windows-icon* windows-intro windows.txt /*windows-intro* windows-starting windows.txt /*windows-starting* windows.txt windows.txt /*windows.txt* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index ca957e360d..62bd2d5fc0 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Sep 19 +*todo.txt* For Vim version 7.4. Last change: 2014 Oct 02 VIM REFERENCE MANUAL by Bram Moolenaar @@ -58,6 +58,15 @@ Patch to make getregtype() return the right size for non-linux systems. (Yasuhiro Matsumoto, 2014 Jul 8) Breaks test_eval. Inefficient, can we only compute y_width when needed? +Patch to fix 'linebreak' when applying an operator. And fix the test not +actually testing. (Christian Brabandt, 2014 Sep 23) + +patch to fix issue 26. (Christian) + +Test 11 and 100 do not work properly on Windows. +Patch by Ken Takata (2014 Sep 25) +Alternative patch Oct 1. + Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) @@ -65,26 +74,15 @@ Patch to avoid problems with encoding conversion with diff.vim. (Yasuhiro Matsumoto, 2014 Sep 1. Depends on current language, language of file can be different. -Patch for C/C++ syntax string handling. (Brian Bi, 2014 Sep 13) - -When using a visual selection of multiple words and doing CTRL-W_] it jumps to -the tag matching the word under the cursor, not the selected text. -(Patrick hemmer) -Patch by Christian, 2014 Aug 8. - -Completion for :buf does not use 'wildignorecase'. (Akshay H, 2014 May 31) - -'backupcopy' should be global-local, so that some files can be written in a -different way. Patch by Christian, 2014 Sep 17. - -Patch to handle list with some items locked. (ZyX, 2014 Aug 17) -Prefer the second solution. - -Issue 252. Patch by Christian, 2014 Aug 26. +Add books from Steve Oualline to Vim website. (2014 Sep 25) ":cd C:\Windows\System32\drivers\etc*" does not work, even though the directory exists. (Sergio Gallelli, 2013 Dec 29) +Patch to have the fold and sign column and at the last line of the buffer. +(Marco Hinz, 2014 Sep 25) +Alternate suggestion: let all columns continue, also number column. + Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug 14, Aug 30) Make ":1close" close the first window. @@ -92,29 +90,53 @@ Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug Make ":-1close" close the previous window. Doesn't look right, asked for updates. -Patch to add a special key name for K_CURSORHOLD. (Hirohito Higashi, 2014 Aug -10) +Patch to handle multi-byte printer name on MS-Windows. (Yasuhiro Matsumoto, +2014 Sept 28) + +Two patches by Christian, 2014 Sep 29: +- Combination of precedes listchar and 'showbreak' doesn't work well. +- Moving cursor is off when 'nu' and 'sbr' are set. The entries added by matchaddpos() are returned by getmatches() but can't be set with setmatches(). (lcd47, 2014 Jun 29) +Patch to fix window title for a command window on MS-Windows. (Yasuhiro +Matsumoto, 2014 Sep 28) + +Patch to fix that 0x80 in abbreviation isn't handled correctly. +(Christian Brabandt, 2014 Oct 1) + +Patch to fix issue 57, on the issue. + +Patch for issue 101, maintainer unreachable. + +Remove restriction in NSIS installer that the end of the path must be "Vim". +(Tim Lebedkov, 2014 Sep 24) + Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) +'foldexpr' applies to help. (Paul Marshall, 2014 Sep 24) + Value returned by virtcol() changes depending on how lines wrap. This is inconsistent with the documentation. +On MS-Windows running tests with Mercurial has problems when the input files +are changed. (Ken Takata, Taro Muraoka, 2014 Sep 25) + MS-Windows: Crash opening very long file name starting with "\\". (Christian Brock, 2012 Jun 29) ml_updatechunk() is slow when retrying for another encoding. (John Little, 2014 Sep 11) -Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21) +Make comments in the test Makefile silent. (Kartik Agaram, 2014 Sep 24) -Patch to allow for a different icon on MS-Windows. (Yasuhiro Matsumoto, 2014 -Sep 7). +When in 'comments' "n:x" follows after three-part comment directly it repeats +any one-character from the previous line. (Kartik Agaram, 2014 Sep 19) + +Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21) Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19) @@ -165,6 +187,8 @@ from? Problem with upwards search on Windows (works OK on Linux). (Brett Stahlman, 2014 Jun 8) +Patch to load TCL dynamically. (Ken Takata, 2014 Sep 20) + Include a plugin manager with Vim? Neobundle seems to be the best currently. Long message about this from ZyX, 2014 Mar 23. And following replies. Also see http://vim-wiki.mawercer.de/wiki/topic/vim%20plugin%20managment.html diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index 833bf9e4ab..3e3e32b395 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -2039,7 +2039,7 @@ Removed the "COUNT" flag from ":argadd", to avoid ":argadd 1*" to be used like Avoid that $LANG is used for the menus when LC_MESSAGES is "en_US". Added backslashes before dashes in the vim.1 manual page to make them appear -as real dashes. (Pierr Habouzit) +as real dashes. (Pierre Habouzit) Where "gq" left the cursor depended on the value of 'formatprg'. Now "gq" always leaves the cursor at the last line of the formatted text. diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 00fe956dd4..0098e3e521 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 7.4. Last change: 2014 Mar 25 +*windows.txt* For Vim version 7.4. Last change: 2014 Sep 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -726,18 +726,21 @@ the buffer. The result is that all buffers will use the 'encoding' encoding CTRL-W ] *CTRL-W_]* *CTRL-W_CTRL-]* CTRL-W CTRL-] Split current window in two. Use identifier under cursor as a - tag and jump to it in the new upper window. Make new window N - high. + tag and jump to it in the new upper window. + In Visual mode uses the Visually selected text as a tag. + Make new window N high. *CTRL-W_g]* CTRL-W g ] Split current window in two. Use identifier under cursor as a tag and perform ":tselect" on it in the new upper window. + In Visual mode uses the Visually selected text as a tag. Make new window N high. *CTRL-W_g_CTRL-]* CTRL-W g CTRL-] Split current window in two. Use identifier under cursor as a - tag and perform ":tjump" on it in the new upper window. Make - new window N high. + tag and perform ":tjump" on it in the new upper window. + In Visual mode uses the Visually selected text as a tag. + Make new window N high. CTRL-W f *CTRL-W_f* *CTRL-W_CTRL-F* CTRL-W CTRL-F Split current window in two. Edit file name under cursor. diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index d991540488..2e54b8c42a 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar -" Last Change: 2014 May 26 +" Last Change: 2014 Sep 23 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -35,28 +35,37 @@ syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" if !exists("c_no_utf") syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)" endif -if exists("c_no_cformat") - syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend - " cCppString: same as cString, but ends at end of line - if !exists("cpp_no_cpp11") " ISO C++11 - syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell - else - syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell - endif - syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip - syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip -else + +if !exists("c_no_cformat") + " Highlight % items in strings. if !exists("c_no_c99") " ISO C99 syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained else syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained endif syn match cFormat display "%%" contained +endif + +" cCppString: same as cString, but ends at end of line +if s:ft ==# "cpp" && !exists("cpp_no_cpp11") + " ISO C++11 + syn region cString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend + syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell +elseif s:ft ==# "c" && !exists("c_no_c11") + " ISO C99 + syn region cString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend + syn region cCppString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell +else + " older C or C++ syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend - " cCppString: same as cString, but ends at end of line syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell endif +syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip +syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip + +syn cluster cStringGroup contains=cCppString,cCppOut2,cCppSkip + syn match cCharacter "L\='[^\\]'" syn match cCharacter "L'[^']*'" contains=cSpecial if exists("c_gnu") @@ -70,12 +79,9 @@ syn match cSpecialCharacter display "L\='\\\o\{1,3}'" syn match cSpecialCharacter display "'\\x\x\{1,2}'" syn match cSpecialCharacter display "L'\\x\x\+'" -if !exists("c_no_c11") " ISO C11 - if exists("c_no_cformat") - syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend - else - syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend - endif +if (s:ft ==# "c" && !exists("c_no_c11")) || (s:ft ==# "cpp" && !exists("cpp_no_cpp11")) + " ISO C11 or ISO C++ 11 + syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend syn match cCharacter "[Uu]'[^\\]'" syn match cCharacter "[Uu]'[^']*'" contains=cSpecial if exists("c_gnu") @@ -102,24 +108,24 @@ endif " This should be before cErrInParen to avoid problems with #define ({ xxx }) if exists("c_curly_error") syn match cCurlyError "}" - syn region cBlock start="{" end="}" contains=ALLBUT,cBadBlock,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell fold + syn region cBlock start="{" end="}" contains=ALLBUT,cBadBlock,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell fold else syn region cBlock start="{" end="}" transparent fold endif -"catch errors caused by wrong parenthesis and brackets -" also accept <% for {, %> for }, <: for [ and :> for ] (C99) +" Catch errors caused by wrong parenthesis and brackets. +" Also accept <% for {, %> for }, <: for [ and :> for ] (C99) " But avoid matching <::. syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserLabel,cBitField,cOctalZero,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom if exists("c_no_curly_error") if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" syn match cErrInParen display contained "^^<%\|^%>" else - syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" @@ -127,13 +133,13 @@ if exists("c_no_curly_error") endif elseif exists("c_no_bracket_error") if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" syn match cErrInParen display contained "<%\|%>" else - syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cCppString,@Spell + syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" @@ -141,19 +147,19 @@ elseif exists("c_no_bracket_error") endif else if s:ft ==# 'cpp' && !exists("cpp_no_cpp11") - syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell + syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell syn match cParenError display "[\])]" syn match cErrInParen display contained "<%\|%>" - syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell + syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell else - syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@Spell + syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell syn match cParenError display "[\])]" syn match cErrInParen display contained "[\]{}]\|<%\|%>" - syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,cCppString,@Spell + syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell endif " cCppBracket: same as cParen but ends at end-of-line; used in cDefine syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell @@ -376,7 +382,7 @@ syn region cPreProc start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\> " Highlight User Labels syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString if s:ft ==# 'c' || exists("cpp_no_cpp11") - syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell + syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell,@cStringGroup endif " Avoid matching foo::bar() in C++ by requiring that the next char is not ':' syn cluster cLabelGroup contains=cUserLabel diff --git a/runtime/syntax/valgrind.vim b/runtime/syntax/valgrind.vim index 48e9564acb..c247927c2f 100644 --- a/runtime/syntax/valgrind.vim +++ b/runtime/syntax/valgrind.vim @@ -2,9 +2,11 @@ " Language: Valgrind Memory Debugger Output " Maintainer: Roger Luethi " Program URL: http://devel-home.kde.org/~sewardj/ -" Last Change: 2012 Apr 30 +" Last Change: 2014 Oct 02 " " Notes: mostly based on strace.vim and xml.vim +" +" Contributors: Christoph Gysin " Quit when a syntax file was already loaded if exists("b:current_syntax") @@ -65,7 +67,7 @@ syn match valgrindAt "at\s\@=" contained syn match valgrindAddr "\(\W\)\@<=0x\x\+" contained syn match valgrindFunc "\(: \)\@<=\w\+" contained syn match valgrindBin "\((\(with\|\)in \)\@<=\S\+\()\)\@=" contained -syn match valgrindSrc "\((\)\@<=.*:\d\+\()\)\@=" contained +syn match valgrindSrc "\((\)\@<=[^)]*:\d\+\()\)\@=" contained " Define the default highlighting From 08cd0e2056b8c339b5cd5b9c8678e4cc71b33168 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 6 Oct 2014 13:10:09 +0200 Subject: [PATCH 136/311] updated for version 7.4.464 Problem: Compiler warning. Solution: Add type cast. (Ken Takata) --- src/gui_w32.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui_w32.c b/src/gui_w32.c index 5e18e85175..374ed47258 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -1667,7 +1667,7 @@ gui_mch_init(void) HANDLE hIcon = NULL; if (mch_icon_load(&hIcon) == OK && hIcon != NULL) - SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, hIcon); + SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); } #ifdef FEAT_MENU diff --git a/src/version.c b/src/version.c index 2239524231..dc9d25d589 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 464, /**/ 463, /**/ From f7c555f749deea91dc9b9c9fac0cab3d58fdc5c9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 7 Oct 2014 05:38:40 +0200 Subject: [PATCH 137/311] updated for version 7.4.465 Problem: Crash when expanding a very long string. Solution: Use wsncpy() instead of wcscpy(). (Ken Takata) --- src/os_win32.c | 5 +++-- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/os_win32.c b/src/os_win32.c index 21c3ee9f4e..eb66ed2d2b 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -2775,9 +2775,10 @@ fname_case( if (p != NULL) { char_u *q; - WCHAR buf[_MAX_PATH + 2]; + WCHAR buf[_MAX_PATH + 1]; - wcscpy(buf, p); + wcsncpy(buf, p, _MAX_PATH); + buf[_MAX_PATH] = L'\0'; vim_free(p); if (fname_casew(buf, (len > 0) ? _MAX_PATH : 0) == OK) diff --git a/src/version.c b/src/version.c index dc9d25d589..c502cdc4b8 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 465, /**/ 464, /**/ From b15fa864b5bc7317f2fc65a54f2c5a35c27950f5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 Oct 2014 05:44:37 +0200 Subject: [PATCH 138/311] updated for version 7.4.466 Problem: CTRL-W } does not open preview window. (Erik Falor) Solution: Don't set g_do_tagpreview for CTRL-W }. --- src/version.c | 2 ++ src/window.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/version.c b/src/version.c index c502cdc4b8..6417a491d8 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 466, /**/ 465, /**/ diff --git a/src/window.c b/src/window.c index 5a2d8a42b5..fda9199b2e 100644 --- a/src/window.c +++ b/src/window.c @@ -485,7 +485,8 @@ newwindow: else postponed_split = -1; #ifdef FEAT_QUICKFIX - g_do_tagpreview = 0; + if (nchar != '}') + g_do_tagpreview = 0; #endif /* Execute the command right here, required when "wincmd ]" From 56b0fd557490090ed2eb86897e40a495f7d293f6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 Oct 2014 08:24:43 +0200 Subject: [PATCH 139/311] updated for version 7.4.467 --- src/normal.c | 9 +++++++++ src/screen.c | 10 +++++++++- src/testdir/test_listlbr.in | 10 +++++++++- src/testdir/test_listlbr.ok | 4 ++++ src/version.c | 2 ++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/normal.c b/src/normal.c index a8d74117c7..8384d6ffea 100644 --- a/src/normal.c +++ b/src/normal.c @@ -1380,6 +1380,12 @@ do_pending_operator(cap, old_col, gui_yank) pos_T old_cursor; int empty_region_error; int restart_edit_save; +#ifdef FEAT_LINEBREAK + int lbr_saved = curwin->w_p_lbr; + + curwin->w_p_lbr = FALSE; /* avoid a problem with unwanted linebreaks in + * block mode */ +#endif /* The visual area is remembered for redo */ static int redo_VIsual_mode = NUL; /* 'v', 'V', or Ctrl-V */ @@ -2136,6 +2142,9 @@ do_pending_operator(cap, old_col, gui_yank) oap->block_mode = FALSE; clearop(oap); } +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = lbr_saved; +#endif } /* diff --git a/src/screen.c b/src/screen.c index 7a9311a453..fae2703f71 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1584,9 +1584,17 @@ win_update(wp) */ if (VIsual_mode == Ctrl_V) { - colnr_T fromc, toc; + colnr_T fromc, toc; +#if defined(FEAT_VIRTUALEDIT) && defined(FEAT_LINEBREAK) + int save_ve_flags = ve_flags; + if (curwin->w_p_lbr) + ve_flags = VE_ALL; +#endif getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc); +#if defined(FEAT_VIRTUALEDIT) && defined(FEAT_LINEBREAK) + ve_flags = save_ve_flags; +#endif ++toc; if (curwin->w_curswant == MAXCOL) toc = MAXCOL; diff --git a/src/testdir/test_listlbr.in b/src/testdir/test_listlbr.in index f155f85a4b..f6618c5a42 100644 --- a/src/testdir/test_listlbr.in +++ b/src/testdir/test_listlbr.in @@ -2,7 +2,7 @@ Test for linebreak and list option (non-utf8) STARTTEST :so small.vim -:if !exists("+linebreak") || !exists("+conceal") | e! test.ok | w! test.out | qa! | endif +:if !exists("+linebreak") || !has("conceal") | e! test.ok | w! test.out | qa! | endif :10new|:vsp|:vert resize 20 :put =\"\tabcdef hijklmn\tpqrstuvwxyz_1060ABCDEFGHIJKLMNOP \" :norm! zt @@ -56,6 +56,14 @@ STARTTEST :syn match All /.*/ contains=ConcealVar :let line=ScreenChar(winwidth(0)) :call DoRecordScreen() +:set cpo&vim linebreak +:let g:test ="Test 6: set linebreak with visual block mode" +:let line="REMOVE: this not" +:$put =line +:let line="REMOVE: aaaaaaaaaaaaa" +:$put =line +:1/^REMOVE: +0jf x:$put :%w! test.out :qa! ENDTEST diff --git a/src/testdir/test_listlbr.ok b/src/testdir/test_listlbr.ok index 9b8037f4d3..ee74667661 100644 --- a/src/testdir/test_listlbr.ok +++ b/src/testdir/test_listlbr.ok @@ -32,3 +32,7 @@ Sabbbbbb bla ~ ~ ~ +this not +aaaaaaaaaaaaa +REMOVE: +REMOVE: diff --git a/src/version.c b/src/version.c index 6417a491d8..5979660f43 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 467, /**/ 466, /**/ From 8261640073aa8e606634d9419a08fcc890b52665 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 Oct 2014 08:36:16 +0200 Subject: [PATCH 140/311] updated for version 7.4.468 Problem: Issue 26: CTRL-C does not interrupt after it was mapped and then unmapped. Solution: Reset mapped_ctrl_c. (Christian Brabandt) --- src/getchar.c | 5 ++++- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/getchar.c b/src/getchar.c index d646dc4c15..9edb767e1b 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -3707,6 +3707,9 @@ do_map(maptype, arg, mode, abbrev) { if (!did_it) retval = 2; /* no match */ + else if (*keys == Ctrl_C) + /* If CTRL-C has been unmapped, reuse it for Interrupting. */ + mapped_ctrl_c = FALSE; goto theend; } @@ -3739,7 +3742,7 @@ do_map(maptype, arg, mode, abbrev) goto theend; } - /* If CTRL-C has been mapped, don't always use it for Interrupting */ + /* If CTRL-C has been mapped, don't always use it for Interrupting. */ if (*keys == Ctrl_C) mapped_ctrl_c = TRUE; diff --git a/src/version.c b/src/version.c index 5979660f43..83887f67ec 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 468, /**/ 467, /**/ From 39631e52bb6753f2946ba33f9016fcc89e529ab3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 Oct 2014 09:48:30 +0200 Subject: [PATCH 141/311] updated for version 7.4.469 Problem: Can't build with MSVC. (Ken Takata) Solution: Move the assignment after the declarations. --- src/normal.c | 7 ++++--- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/normal.c b/src/normal.c index 8384d6ffea..0116d058ba 100644 --- a/src/normal.c +++ b/src/normal.c @@ -1382,9 +1382,6 @@ do_pending_operator(cap, old_col, gui_yank) int restart_edit_save; #ifdef FEAT_LINEBREAK int lbr_saved = curwin->w_p_lbr; - - curwin->w_p_lbr = FALSE; /* avoid a problem with unwanted linebreaks in - * block mode */ #endif /* The visual area is remembered for redo */ @@ -1396,6 +1393,10 @@ do_pending_operator(cap, old_col, gui_yank) int include_line_break = FALSE; #endif +#ifdef FEAT_LINEBREAK + curwin->w_p_lbr = FALSE; /* Avoid a problem with unwanted linebreaks in + * block mode. */ +#endif #if defined(FEAT_CLIPBOARD) /* * Yank the visual area into the GUI selection register before we operate diff --git a/src/version.c b/src/version.c index 83887f67ec..8d1e4a0dd9 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 469, /**/ 468, /**/ From 7a98ee201d9eea36ab21e1a51763de9289ed1ccc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 Oct 2014 10:37:06 +0200 Subject: [PATCH 142/311] updated for version 7.4.470 Problem: Test 11 and 100 do not work properly on Windows. Solution: Avoid using feedkeys(). (Ken Takata) --- src/testdir/Make_dos.mak | 2 +- src/testdir/test100.in | 4 ++-- src/testdir/test11.in | 6 +++--- src/version.c | 2 ++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index cd7aa4d487..38264f2eaf 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -63,7 +63,7 @@ win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) report fixff: -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=dos|upd" +q *.in *.ok -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=unix|upd" +q \ - dotest.in test60.ok test71.ok test74.ok + dotest.in test60.ok test71.ok test74.ok test100.ok report: @echo "" diff --git a/src/testdir/test100.in b/src/testdir/test100.in index e703f18199..7bd88fe9c9 100644 --- a/src/testdir/test100.in +++ b/src/testdir/test100.in @@ -16,7 +16,7 @@ STARTTEST :new one :0put ='ONE: expecting global undolevels: 5, local undolevels: -123456 (default)' :call FillBuffer() -:call feedkeys(":earlier 10\n", 't') +:earlier 10 :call UndoLevel() :set ff=unix :%w! test.out @@ -24,7 +24,7 @@ STARTTEST :0put ='TWO: expecting global undolevels: 5, local undolevels: 2 (first) then 10 (afterwards)' :setlocal ul=2 :call FillBuffer() -:call feedkeys(":earlier 10\n", 't') +:earlier 10 :call UndoLevel() :setlocal ul=10 :call UndoLevel() diff --git a/src/testdir/test11.in b/src/testdir/test11.in index 47de470a2d..9e9e257c1d 100644 --- a/src/testdir/test11.in +++ b/src/testdir/test11.in @@ -46,13 +46,13 @@ STARTTEST :w>>test.out " Append it to the output file :set shelltemp " need temp files here :au FilterReadPre *.out call rename(expand(""), expand("") . ".t") -:au FilterReadPre *.out exe '!sed s/e/E/ ' . shellescape(expand("")) . ".t >" . shellescape(expand("")) -:au FilterReadPre *.out exe '!rm ' . shellescape(expand("")) . '.t' +:au FilterReadPre *.out exe 'silent !sed s/e/E/ ' . shellescape(expand("")) . ".t >" . shellescape(expand("")) +:au FilterReadPre *.out exe 'silent !rm ' . shellescape(expand("")) . '.t' :au FilterReadPost *.out '[,']s/x/X/g :e! test.out " Edit the output file :23,$!cat :23,$s/\r$// " remove CR for when sed adds them -:au! FileReadPre *.gz exe '!gzip -d ' . shellescape(expand("")) +:au! FileReadPre *.gz exe 'silent !gzip -d ' . shellescape(expand("")) :au FileReadPre *.gz call rename(expand(":r"), expand("")) :au! FileReadPost *.gz '[,']s/l/L/ :$r Xtestfile.gz " Read compressed file diff --git a/src/version.c b/src/version.c index 8d1e4a0dd9..fca5cb6536 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 470, /**/ 469, /**/ From a2d5ff6700c12b417cb5ef70c83d5fc9a7f7edf2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 9 Oct 2014 12:05:56 +0200 Subject: [PATCH 143/311] updated for version 7.4.471 Problem: MS-Windows: When printer name contains multi-byte, the name is displayed as ???. Solution: Convert the printer name from the active codepage to 'encoding'. (Yasuhiro Matsumoto) --- src/os_mswin.c | 22 ++++++++++++++++++++++ src/version.c | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/os_mswin.c b/src/os_mswin.c index 9151aef414..dff0939764 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -1635,11 +1635,33 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) char_u *printer_name = (char_u *)devname + devname->wDeviceOffset; char_u *port_name = (char_u *)devname +devname->wOutputOffset; char_u *text = _("to %s on %s"); +#ifdef FEAT_MBYTE + char_u *printer_name_orig = printer_name; + char_u *port_name_orig = port_name; + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + char_u *to_free = NULL; + int maxlen; + + acp_to_enc(printer_name, STRLEN(printer_name), &to_free, &maxlen); + if (to_free != NULL) + printer_name = to_free; + acp_to_enc(port_name, STRLEN(port_name), &to_free, &maxlen); + if (to_free != NULL) + port_name = to_free; + } +#endif prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name) + STRLEN(text))); if (prt_name != NULL) wsprintf(prt_name, text, printer_name, port_name); +#ifdef FEAT_MBYTE + if (printer_name != printer_name_orig) + vim_free(printer_name); + if (port_name != port_name_orig) + vim_free(port_name); +#endif } GlobalUnlock(prt_dlg.hDevNames); diff --git a/src/version.c b/src/version.c index fca5cb6536..3be907b118 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 471, /**/ 470, /**/ From 52b7d64d17b332a13d5dedad7e7a08dd83f68aef Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 10 Oct 2014 10:28:46 +0200 Subject: [PATCH 144/311] updated for version 7.4.472 Problem: The "precedes" entry in 'listchar' will be drawn when 'showbreak is set and list is not. Solution: Only draw this character when 'list' is on. (Christian Brabandt) --- src/screen.c | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/screen.c b/src/screen.c index fae2703f71..36afc2dcda 100644 --- a/src/screen.c +++ b/src/screen.c @@ -4901,6 +4901,7 @@ win_line(wp, lnum, startrow, endrow, nochange) * special character (via 'listchars' option "precedes:". */ if (lcs_prec_todo != NUL + && wp->w_p_list && (wp->w_p_wrap ? wp->w_skipcol > 0 : wp->w_leftcol > 0) #ifdef FEAT_DIFF && filler_todo <= 0 diff --git a/src/version.c b/src/version.c index 3be907b118..f22d195a1b 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 472, /**/ 471, /**/ From 4a7f6d3af1434055f4ef33aa2270ac52cb785c79 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 10 Oct 2014 10:34:33 +0200 Subject: [PATCH 145/311] updated for version 7.4.473 Problem: Cursor movement is incorrect when there is a number column/sign/fold column and 'sbr' is displayed. Solution: Adjust the column for 'sbr'. (Christian Brabandt) --- src/charset.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/charset.c b/src/charset.c index fcc41ec334..006caa2a50 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1184,6 +1184,8 @@ win_lbr_chartabsize(wp, line, s, col, headp) { col -= W_WIDTH(wp); numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp)); + if (*p_sbr != NUL && col >= (colnr_T)STRLEN(p_sbr)) + col -= (colnr_T)STRLEN(p_sbr); if (numberextra > 0) col = col % numberextra; } diff --git a/src/version.c b/src/version.c index f22d195a1b..d7c4cc0999 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 473, /**/ 472, /**/ From 3714a93d4e294062630f7f4eb7828601365548cd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 Oct 2014 07:48:26 +0200 Subject: [PATCH 146/311] updated for version 7.4.474 Problem: AIX compiler can't handle // comment. Issue 265. Solution: Remove that line. --- src/regexp_nfa.c | 1 - src/version.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 6531d45fd1..37635662bc 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -4407,7 +4407,6 @@ skip_add: switch (state->c) { case NFA_MATCH: -// nfa_match = TRUE; break; case NFA_SPLIT: diff --git a/src/version.c b/src/version.c index d7c4cc0999..89088200df 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 474, /**/ 473, /**/ From be9e9e838bbcf16a1021c5c5ffb5f68d2ddcc4aa Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 11 Oct 2014 09:47:26 +0200 Subject: [PATCH 147/311] updated for version 7.4.475 Problem: Can't compile on a system where Xutf8SetWMProperties() is not in the X11 library. Issue 265. Solution: Add a configure check. --- src/auto/configure | 53 ++++++++++++++++++++++++++++++++++++---------- src/config.h.in | 3 +++ src/configure.in | 29 +++++++++++++------------ src/os_unix.c | 7 ++++-- src/version.c | 2 ++ 5 files changed, 68 insertions(+), 26 deletions(-) diff --git a/src/auto/configure b/src/auto/configure index b0fba306e6..f5195b2462 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -12732,16 +12732,15 @@ $as_echo "$vim_cv_memcpy_handles_overlap" >&6; } fi - -if test "$enable_multibyte" = "yes"; then +if test "x$with_x" = "xyes"; then cflags_save=$CFLAGS - ldflags_save=$LDFLAGS - if test "x$x_includes" != "xNONE" ; then - CFLAGS="$CFLAGS -I$x_includes" - LDFLAGS="$X_LIBS $LDFLAGS -lX11" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether X_LOCALE needed" >&5 + libs_save=$LIBS + LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS" + CFLAGS="$CFLAGS $X_CFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether X_LOCALE needed" >&5 $as_echo_n "checking whether X_LOCALE needed... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int @@ -12774,7 +12773,7 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - $as_echo "#define X_LOCALE 1" >>confdefs.h + $as_echo "#define X_LOCALE 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -12787,9 +12786,41 @@ else $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Xutf8SetWMProperties() can be used" >&5 +$as_echo_n "checking whether Xutf8SetWMProperties() can be used... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char Xutf8SetWMProperties (); +int +main () +{ +return Xutf8SetWMProperties (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define HAVE_XUTF8SETWMPROPERTIES 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$cflags_save - LDFLAGS=$ldflags_save + LIBS=$libs_save fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _xpg4_setrunelocale in -lxpg4" >&5 diff --git a/src/config.h.in b/src/config.h.in index 7f16e622aa..b8168a55f6 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -446,3 +446,6 @@ /* Define if we have AvailabilityMacros.h on Mac OS X */ #undef HAVE_AVAILABILITYMACROS_H + +/* Define if Xutf8SetWMProperties() is in an X library. */ +#undef HAVE_XUTF8SETWMPROPERTIES diff --git a/src/configure.in b/src/configure.in index 62785e171c..ff1f4824b4 100644 --- a/src/configure.in +++ b/src/configure.in @@ -3730,21 +3730,24 @@ fi dnl Check for multibyte locale functions dnl Find out if _Xsetlocale() is supported by libX11. dnl Check if X_LOCALE should be defined. - -if test "$enable_multibyte" = "yes"; then +if test "x$with_x" = "xyes"; then cflags_save=$CFLAGS - ldflags_save=$LDFLAGS - if test "x$x_includes" != "xNONE" ; then - CFLAGS="$CFLAGS -I$x_includes" - LDFLAGS="$X_LIBS $LDFLAGS -lX11" - AC_MSG_CHECKING(whether X_LOCALE needed) - AC_TRY_COMPILE([#include ],, - AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes) - AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)), - AC_MSG_RESULT(no)) - fi + libs_save=$LIBS + LIBS="$LIBS $X_LIBS $GUI_LIB_LOC $GUI_X_LIBS $X_PRE_LIBS $X_LIB $X_EXTRA_LIBS" + CFLAGS="$CFLAGS $X_CFLAGS" + + AC_MSG_CHECKING(whether X_LOCALE needed) + AC_TRY_COMPILE([#include ],, + AC_TRY_LINK_FUNC([_Xsetlocale], [AC_MSG_RESULT(yes) + AC_DEFINE(X_LOCALE)], AC_MSG_RESULT(no)), + AC_MSG_RESULT(no)) + + AC_MSG_CHECKING(whether Xutf8SetWMProperties() can be used) + AC_TRY_LINK_FUNC([Xutf8SetWMProperties], [AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_XUTF8SETWMPROPERTIES)], AC_MSG_RESULT(no)) + CFLAGS=$cflags_save - LDFLAGS=$ldflags_save + LIBS=$libs_save fi dnl Link with xpg4, it is said to make Korean locale working diff --git a/src/os_unix.c b/src/os_unix.c index b49afc3f8a..6209605cfa 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1960,9 +1960,12 @@ get_x11_thing(get_title, test_only) return retval; } -/* Are Xutf8 functions available? Avoid error from old compilers. */ +/* Xutf8 functions are not avaialble on older systems. Note that on some + * systems X_HAVE_UTF8_STRING may be defined in a header file but + * Xutf8SetWMProperties() is not in the X11 library. Configure checks for + * that and defines HAVE_XUTF8SETWMPROPERTIES. */ #if defined(X_HAVE_UTF8_STRING) && defined(FEAT_MBYTE) -# if X_HAVE_UTF8_STRING +# if X_HAVE_UTF8_STRING && HAVE_XUTF8SETWMPROPERTIES # define USE_UTF8_STRING # endif #endif diff --git a/src/version.c b/src/version.c index 89088200df..78c3baa2a1 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 475, /**/ 474, /**/ From 41200ff87998e83c87f4768ed416c10dd2917fba Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 15 Oct 2014 07:07:11 +0200 Subject: [PATCH 148/311] updated for version 7.4.476 Problem: MingW: compiling with "XPM=no" doesn't work. Solution: Check for the "no" value. (KF Leong) Also for Cygwin. (Ken Takata) --- src/Make_cyg.mak | 2 +- src/Make_ming.mak | 4 ++-- src/version.c | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index 4b9985f70a..abd35a6a42 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -485,7 +485,7 @@ USE_STDCPLUS = yes endif ############################## -ifdef XPM +ifneq ($(XPM),no) # Only allow XPM for a GUI build. DEFINES += -DFEAT_XPM_W32 INCLUDES += -I$(XPM)/include diff --git a/src/Make_ming.mak b/src/Make_ming.mak index 82988629ee..19b4c2fe3d 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -22,7 +22,7 @@ # http://www.matcode.com/mpress.htm # # Maintained by Ron Aaron et al. -# Updated 2012 Sep 5. +# Updated 2014 Oct 13. #>>>>> choose options: # set to yes for a debug build @@ -613,7 +613,7 @@ LIB += -ld2d1 -ldwrite USE_STDCPLUS = yes endif endif -ifdef XPM +ifneq ($(XPM),no) # Only allow XPM for a GUI build. ifeq (yes, $(GUI)) OBJ += $(OUTDIR)/xpm_w32.o diff --git a/src/version.c b/src/version.c index 78c3baa2a1..c4f560b07c 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 476, /**/ 475, /**/ From 4bb874492f76e7078f976a6bd5e95827cdf1183f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 15 Oct 2014 07:56:49 +0200 Subject: [PATCH 149/311] updated for version 7.4.477 Problem: When using ":%diffput" and the other file is empty an extra empty line remains. Solution: Set the buf_empty flag. --- src/diff.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/diff.c b/src/diff.c index 98b791a720..d324f99d87 100644 --- a/src/diff.c +++ b/src/diff.c @@ -2325,7 +2325,7 @@ ex_diffgetput(eap) end_skip = 0; } - buf_empty = FALSE; + buf_empty = bufempty(); added = 0; for (i = 0; i < count; ++i) { diff --git a/src/version.c b/src/version.c index c4f560b07c..d233c24e9a 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 477, /**/ 476, /**/ From df822ce5869c31411fac94e95cffb37d88a228d6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 15 Oct 2014 16:26:40 +0200 Subject: [PATCH 150/311] updated for version 7.4.478 Problem: Using byte length instead of character length for 'showbreak'. Solution: Compute the character length. (Marco Hinz) --- src/charset.c | 8 ++++++-- src/version.c | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/charset.c b/src/charset.c index 006caa2a50..918f9a5142 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1184,8 +1184,12 @@ win_lbr_chartabsize(wp, line, s, col, headp) { col -= W_WIDTH(wp); numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp)); - if (*p_sbr != NUL && col >= (colnr_T)STRLEN(p_sbr)) - col -= (colnr_T)STRLEN(p_sbr); + if (*p_sbr != NUL) + { + colnr_T sbrlen = (colnr_T)MB_CHARLEN(p_sbr); + if (col >= sbrlen) + col -= sbrlen; + } if (numberextra > 0) col = col % numberextra; } diff --git a/src/version.c b/src/version.c index d233c24e9a..fed16aa170 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 478, /**/ 477, /**/ From 642973908860da7abe0d9f228777df24088c67d4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 15 Oct 2014 17:50:10 +0200 Subject: [PATCH 151/311] updated for version 7.4.479 Problem: MS-Windows: The console title can be wrong. Solution: Take the encoding into account. When restoring the title use the right function. (Yasuhiro Matsumoto) --- src/os_mswin.c | 2 +- src/os_win32.c | 31 ++++++++++++++++++++++++++++++- src/version.c | 2 ++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/os_mswin.c b/src/os_mswin.c index dff0939764..dfd40af8de 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -344,7 +344,7 @@ mch_restore_title( int which) { #ifndef FEAT_GUI_MSWIN - mch_settitle((which & 1) ? g_szOrigTitle : NULL, NULL); + SetConsoleTitle(g_szOrigTitle); #endif } diff --git a/src/os_win32.c b/src/os_win32.c index eb66ed2d2b..a831ada54c 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -4648,6 +4648,35 @@ mch_call_shell( #ifdef FEAT_TITLE char szShellTitle[512]; +# ifdef FEAT_MBYTE + /* Change the title to reflect that we are in a subshell. */ + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + { + WCHAR szShellTitle[512]; + + if (GetConsoleTitleW(szShellTitle, + sizeof(szShellTitle)/sizeof(WCHAR) - 4) > 0) + { + if (cmd == NULL) + wcscat(szShellTitle, L" :sh"); + else + { + WCHAR *wn = enc_to_utf16(cmd, NULL); + + if (wn != NULL) + { + wcscat(szShellTitle, L" - !"); + if ((wcslen(szShellTitle) + wcslen(wn) < + sizeof(szShellTitle)/sizeof(WCHAR))) + wcscat(szShellTitle, wn); + SetConsoleTitleW(szShellTitle); + vim_free(wn); + goto didset; + } + } + } + } +#endif /* Change the title to reflect that we are in a subshell. */ if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0) { @@ -4659,7 +4688,7 @@ mch_call_shell( if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle))) strcat(szShellTitle, cmd); } - mch_settitle(szShellTitle, NULL); + SetConsoleTitle(szShellTitle); } #endif diff --git a/src/version.c b/src/version.c index fed16aa170..3388fafec6 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 479, /**/ 478, /**/ From f5e3496b01e48051ad738791455fe4ef89742fab Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 15 Oct 2014 17:51:52 +0200 Subject: [PATCH 152/311] Update runtime files and translations. --- runtime/doc/map.txt | 10 +- runtime/doc/todo.txt | 83 ++- runtime/filetype.vim | 8 +- runtime/lang/menu_chinese_gb.936.vim | 22 +- runtime/lang/menu_zh_cn.gb2312.vim | 8 +- runtime/lang/menu_zh_cn.utf-8.vim | 8 +- runtime/optwin.vim | 4 +- runtime/syntax/j.vim | 42 +- runtime/syntax/rst.vim | 13 +- runtime/tutor/tutor.ru | 1021 +++++++++++++++----------- runtime/tutor/tutor.ru.cp1251 | 1021 +++++++++++++++----------- runtime/tutor/tutor.ru.utf-8 | 1021 +++++++++++++++----------- src/po/ru.cp1251.po | 99 ++- src/po/ru.po | 99 ++- 14 files changed, 2055 insertions(+), 1404 deletions(-) diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 5f1c4a6261..1be2827c2c 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.4. Last change: 2014 Sep 30 +*map.txt* For Vim version 7.4. Last change: 2014 Oct 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -923,9 +923,11 @@ Examples: ({CURSOR} is where you type a non-keyword character) > < "test;;" is not expanded "test ;;" is expanded to "test " -To avoid the abbreviation in insert mode: Type part of the abbreviation, exit -insert mode with , re-enter insert mode with "a" and type the rest. Or -type CTRL-V before the character after the abbreviation. +To avoid the abbreviation in Insert mode: Type CTRL-V before the character +that would trigger the abbreviation. E.g. CTRL-V . Or type part of +the abbreviation, exit insert mode with , re-enter insert mode with "a" +and type the rest. + To avoid the abbreviation in Command-line mode: Type CTRL-V twice somewhere in the abbreviation to avoid it to be replaced. A CTRL-V in front of a normal character is mostly ignored otherwise. diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 62bd2d5fc0..daf5270e5a 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Oct 02 +*todo.txt* For Vim version 7.4. Last change: 2014 Oct 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -35,6 +35,8 @@ not be repeated below, unless there is extra information. -------------------- Known bugs and current work ----------------------- Regexp problems: +- The NFA engine does not implement the time limit passed to + nfa_regexec_multi() - Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@ -" Last Change: 2014 Sep 05 +" Last Change: 2014 Oct 09 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1151,7 +1151,7 @@ au BufNewFile,BufRead *.mv,*.mpl,*.mws setf maple au BufNewFile,BufRead *.map setf map " Markdown -au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,README.md setf markdown +au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,*.md setf markdown " Mason au BufNewFile,BufRead *.mason,*.mhtml,*.comp setf mason @@ -1243,8 +1243,8 @@ au BufNewFile,BufRead *.mod \ setf modsim3 | \ endif -" Modula 2 -au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.md,*.mi setf modula2 +" Modula 2 (.md removed in favor of Markdown) +au BufNewFile,BufRead *.m2,*.DEF,*.MOD,*.mi setf modula2 " Modula 3 (.m3, .i3, .mg, .ig) au BufNewFile,BufRead *.[mi][3g] setf modula3 diff --git a/runtime/lang/menu_chinese_gb.936.vim b/runtime/lang/menu_chinese_gb.936.vim index e636a42319..b3276b5365 100644 --- a/runtime/lang/menu_chinese_gb.936.vim +++ b/runtime/lang/menu_chinese_gb.936.vim @@ -1,6 +1,7 @@ -" Menu Translations: Simplified Chinese -" Translated By: Yuheng Xie -" Last Change: Tue Apr 18 22:00:00 2006 +" Menu Translations: Simplified Chinese +" Maintainer: Shun Bai +" Previous Maintainer: Yuheng Xie +" Last Change: 2014 Oct 15 " vim: ts=8 sw=8 noet @@ -90,13 +91,14 @@ menutrans Toggle\ &Right\ Scrollbar menutrans F&ile\ Settings ļ趨(&I) " Boolean options -menutrans Toggle\ Line\ &Numbering:set\ nu! /ʾк(&N):set\ nu! -menutrans Toggle\ &List\ Mode:set\ list! /\ list\ ģʽ(&L):set\ list! -menutrans Toggle\ Line\ &Wrap:set\ wrap! /(&W):set\ wrap! -menutrans Toggle\ W&rap\ at\ word:set\ lbr! /(&R):set\ lbr! -menutrans Toggle\ &expand-tab:set\ et! /չ\ tab(&E):set\ et! -menutrans Toggle\ &auto-indent:set\ ai! /Զ(&A):set\ ai! -menutrans Toggle\ &C-indenting:set\ cin! /\ C\ (&C):set\ cin! +menutrans Toggle\ Line\ &Numbering:set\ nu! /ʾк(&N):set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! /к(&V):set\ rnu! +menutrans Toggle\ &List\ Mode:set\ list! /\ list\ ģʽ(&L):set\ list! +menutrans Toggle\ Line\ &Wrap:set\ wrap! /(&W):set\ wrap! +menutrans Toggle\ W&rap\ at\ word:set\ lbr! /(&R):set\ lbr! +menutrans Toggle\ &expand-tab:set\ et! /չ\ tab(&E):set\ et! +menutrans Toggle\ &auto-indent:set\ ai! /Զ(&A):set\ ai! +menutrans Toggle\ &C-indenting:set\ cin! /\ C\ (&C):set\ cin! " other options menutrans &Shiftwidth (&S) diff --git a/runtime/lang/menu_zh_cn.gb2312.vim b/runtime/lang/menu_zh_cn.gb2312.vim index a12d94daf5..0df51885f0 100644 --- a/runtime/lang/menu_zh_cn.gb2312.vim +++ b/runtime/lang/menu_zh_cn.gb2312.vim @@ -1,6 +1,7 @@ -" Menu Translations: Simplified Chinese -" Translated By: Yuheng Xie -" Last Change: Tue Apr 18 22:00:00 2006 +" Menu Translations: Simplified Chinese +" Maintainer: Shun Bai +" Previous Maintainer: Yuheng Xie +" Last Change: 2014 Oct 15 " vim: ts=8 sw=8 noet @@ -94,6 +95,7 @@ menutrans F&ile\ Settings " Boolean options menutrans Toggle\ Line\ &Numbering:set\ nu! /ʾк(&N):set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! /к(&V):set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! /\ list\ ģʽ(&L):set\ list! menutrans Toggle\ Line\ &Wrap:set\ wrap! /(&W):set\ wrap! menutrans Toggle\ W&rap\ at\ word:set\ lbr! /(&R):set\ lbr! diff --git a/runtime/lang/menu_zh_cn.utf-8.vim b/runtime/lang/menu_zh_cn.utf-8.vim index 956363d29c..cb1288f63e 100644 --- a/runtime/lang/menu_zh_cn.utf-8.vim +++ b/runtime/lang/menu_zh_cn.utf-8.vim @@ -1,6 +1,7 @@ -" Menu Translations: Simplified Chinese -" Translated By: Yuheng Xie -" Last Change: Tue Apr 18 22:00:00 2006 +" Menu Translations: Simplified Chinese +" Maintainer: Shun Bai +" Previous Maintainer: Yuheng Xie +" Last Change: 2014 Oct 15 " vim: ts=8 sw=8 noet @@ -91,6 +92,7 @@ menutrans F&ile\ Settings 文件设定(&I) " Boolean options menutrans Toggle\ Line\ &Numbering:set\ nu! 开/关显示行号(&N):set\ nu! +menutrans Toggle\ relati&ve\ Line\ Numbering:set\ rnu! 开/关相对行号(&V):set\ rnu! menutrans Toggle\ &List\ Mode:set\ list! 开/关\ list\ 模式(&L):set\ list! menutrans Toggle\ Line\ &Wrap:set\ wrap! 开/关折行(&W):set\ wrap! menutrans Toggle\ W&rap\ at\ word:set\ lbr! 开/关整词折行(&R):set\ lbr! diff --git a/runtime/optwin.vim b/runtime/optwin.vim index b51d58bad6..35f99c537c 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar -" Last Change: 2014 Aug 06 +" Last Change: 2014 Oct 09 " If there already is an option window, jump to that one. if bufwinnr("option-window") > 0 @@ -728,6 +728,7 @@ call OptionG("km", &km) call Header("editing text") call append("$", "undolevels\tmaximum number of changes that can be undone") +call append("$", "\t(global or local to buffer)") call append("$", " \tset ul=" . &ul) call append("$", "undoreload\tmaximum number lines to save for undo on a buffer reload") call append("$", " \tset ur=" . &ur) @@ -977,6 +978,7 @@ call BinOptionG("bk", &bk) call append("$", "backupskip\tpatterns that specify for which files a backup is not made") call append("$", " \tset bsk=" . &bsk) call append("$", "backupcopy\twhether to make the backup as a copy or rename the existing file") +call append("$", "\t(global or local to buffer)") call append("$", " \tset bkc=" . &bkc) call append("$", "backupdir\tlist of directories to put backup files in") call OptionG("bdir", &bdir) diff --git a/runtime/syntax/j.vim b/runtime/syntax/j.vim index bde954506e..0cdd59b887 100644 --- a/runtime/syntax/j.vim +++ b/runtime/syntax/j.vim @@ -2,7 +2,7 @@ " Language: J " Maintainer: David Bürgin <676c7473@gmail.com> " URL: https://github.com/glts/vim-j -" Last Change: 2014-05-25 +" Last Change: 2014-10-05 if exists('b:current_syntax') finish @@ -12,7 +12,7 @@ let s:save_cpo = &cpo set cpo&vim syntax case match -syntax sync minlines=50 +syntax sync minlines=100 syntax cluster jStdlibItems contains=jStdlibNoun,jStdlibAdverb,jStdlibConjunction,jStdlibVerb syntax cluster jPrimitiveItems contains=jNoun,jAdverb,jConjunction,jVerb,jCopula @@ -30,26 +30,32 @@ syntax keyword jStdlibVerb AND Endian IFDEF Note OR XOR alpha17 alpha27 anddf an syntax match jStdlibNoun /\<\%(adverb\|conjunction\|dyad\|monad\|noun\|verb\)\>/ syntax match jStdlibVerb /\<\%(assert\|break\|do\)\>\.\@!/ -" Numbers. Matching J numbers is difficult. The regular expression used for -" the general case roughly embodies this grammar sketch: +" Numbers. Matching J numbers is difficult. In fact, the job cannot be done +" with regular expressions alone. Below is a sketch of the pattern used. It +" accepts most well-formed numbers and rejects most of the ill-formed ones. +" See http://www.jsoftware.com/help/dictionary/dcons.htm for reference. " -" BASE := /_?\d+(\.\d*)?([eE]_?\d+)?/ -" RATIONAL := BASE | BASE r BASE -" COMPLEX := BASE | BASE (j|a[dr]) BASE -" JNUMBER := RATIONAL | RATIONAL [px] RATIONAL | COMPLEX | COMPLEX [px] COMPLEX +" "double1" and "double2" patterns: +" (_?\d+(\.\d*)?|_\.\d+)([eE]_?\d+)? +" (_?\d+(\.\d*)?|_\.\d+|\.\d+)([eE]_?\d+)? " -" The grammar is implemented as shown in this pseudo-regexp: +" "rational1" and "rational2" patterns: +" \k(r\k)?|__? +" \k(r\k)?|__? " -" base rational complex remainder -" /\< B ( [r]B ([px]B([r]B)?)? | (j|a[dr])B ([px]B((j|a[dr])B)?)? | [px]B ((j|a[dr]|r)B)? )?/ +" "complex1" and "complex2" patterns: +" \k((j|a[dr])\k)? +" \k((j|a[dr])\k)? " -" All in all, a compromise between correctness and practicality had to be -" made. See http://www.jsoftware.com/help/dictionary/dcons.htm for reference. -syntax match jNumber /\<_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(r_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(r_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\=\)\|\%(\%(j\|a[dr]\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(j\|a[dr]\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\=\)\|\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(j\|a[dr]\|r\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\)\=/ -syntax match jNumber /\<_\=\d\+\%([eE]\d\+\)\=b_\=[0-9a-z]\+\%(\.[0-9a-z]\+\)\=/ -syntax match jNumber /\<__\=\>/ -syntax match jNumber /\<_\./ -syntax match jNumber /\<_\=\d\+x\>/ +" "basevalue" pattern: +" _?[0-9a-z]+(\.[0-9a-z]*)?|_?\.[0-9a-z]+ +" +" all numbers: +" \b\k([px]\k)?(b\k)?(?![0-9A-Za-z_.]) +syntax match jNumber /\<_\.[0-9A-Za-z_.]\@!/ +syntax match jNumber /\<_\=\d\+x[0-9A-Za-z_.]\@!/ +syntax match jNumber /\<\%(__\=r_\=\d\+\|_\=\d\+r__\=\)[0-9A-Za-z_.]\@!/ +syntax match jNumber /\<\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\%(\%(j\|a[dr]\)\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\)\=\%([px]\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\%(\%(j\|a[dr]\)\%(\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\%(r\%(_\=\d\+\%(\.\d*\)\=\|_\.\d\+\|\.\d\+\)\%([eE]_\=\d\+\)\=\)\=\|__\=\)\)\=\)\=\%(b\%(_\=[0-9a-z]\+\%(\.[0-9a-z]*\)\=\|_\=\.[0-9a-z]\+\)\)\=[0-9A-Za-z_.]\@!/ syntax region jString oneline start=/'/ skip=/''/ end=/'/ diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim index fce9e5dd3e..c1f25699e7 100644 --- a/runtime/syntax/rst.vim +++ b/runtime/syntax/rst.vim @@ -1,8 +1,8 @@ " Vim syntax file -" Language: reStructuredText documentation format -" Maintainer: Marshall Ward +" Language: reStructuredText documentation format +" Maintainer: Marshall Ward " Previous Maintainer: Nikolai Weibull -" Latest Revision: 2014-08-23 +" Latest Revision: 2014-10-03 if exists("b:current_syntax") finish @@ -150,12 +150,19 @@ endif for code in g:rst_syntax_code_list unlet! b:current_syntax + " guard against setting 'isk' option which might cause problems (issue #108) + let prior_isk = &l:iskeyword exe 'syn include @rst'.code.' syntax/'.code.'.vim' exe 'syn region rstDirective'.code.' matchgroup=rstDirective fold ' \.'start=#\%(sourcecode\|code\%(-block\)\=\)::\s\+'.code.'\_s*\n\ze\z(\s\+\)# ' \.'skip=#^$# ' \.'end=#^\z1\@!# contains=@NoSpell,@rst'.code exe 'syn cluster rstDirectives add=rstDirective'.code + " reset 'isk' setting, if it has been changed + if &l:iskeyword !=# prior_isk + let &l:iskeyword = prior_isk + endif + unlet! prior_isk endfor " TODO: Use better syncing. diff --git a/runtime/tutor/tutor.ru b/runtime/tutor/tutor.ru index 6fd74cf085..1194f60635 100644 --- a/runtime/tutor/tutor.ru +++ b/runtime/tutor/tutor.ru @@ -1,29 +1,32 @@ =============================================================================== -= VIM - 1.5 = += VIM -- 1.7 = =============================================================================== - Vim --- , , - , , - . , - Vim + + Vim -- , , + , , . + , + ̣ Vim . 25-30 - , . + , . - . , - ( "vimtutor", - ). + ! . + , ( + "vimtutor", ). , - . , , - . , - ! + . , , + . , + ! - , CapsLock - j , , 1.1 + , CapsLock , + j , , 1.1 . + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.1: + 1.1: + ** h,j,k,l , . ** ^ @@ -33,802 +36,972 @@ v 1. , . - 2. `' (j) . ----> , . + 2. `' (j) Σ . + , . 3. `' 1.2. -: , , - (Normal mode). - . +! , , + (Normal mode). + . + +! () + . , hjkl + , . -: () - . , hjkl - , . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.2: VIM + 1.2: VIM -!! ! , , + + !! ! , , !! - 1. ( , , + 1. ( , , (Normal mode)). 2. : :q! . + ( , :q! + .) + . ----> - . : - :wq + 3. , , + . : + vimtutor - 3. , , - . - vimtutor ru - : vim tutor.ru + 4. , , 1 3 + . ----> 'vim' vim, 'tutor.ru' --- , - . +! :q! . + . + + 5. 1.3. - 4. , , 1 3 - . - 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.3: - + 1.3: -- -** x, . ** +** x . ** - 1. , --->. + 1. , --->. 2. , , . - 3. x . + 3. x . - 4. 2--4 . + 4. 2 4 . ---> . - 5. , , 1.4. - -: , - . + 5. , , 1.4. +! , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.4: - + 1.4: -- - ** (Normal mode), i . ** + ** , i . ** - 1. , --->. + 1. , --->. 2. , , . - 3. i . + 3. i . 4. . - 2--4, . + 2 4, . ----> . +---> . ---> . - 5. , . - - + 5. , 1.5. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1 + 1.5: -- + + + ** , A . ** + + 1. , --->. + . + + 2. A . + + 3. + . + + 4. , ---> + 2 4 . + +---> + . +---> + . + + 5. , 1.6. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1.6: + + + ** :wq Vim. ** + + !! ! , , + !! + + 1. Vim, 1.2: :q! + , , + Σ. + + 2. : + vim tutor + `vim' -- Vim, `tutor' -- + . , . + + 3. , . + + 4. Vim : :wq + + 5. vimtutor 1, vimtutor + . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 + 1. , hjkl. - h () j () k () l () + h () j () k () l () - 2. Vim ( % ) : - vim _ + 2. Vim ( ) : + vim _ 3. Vim : - :q! . + :q! . : - :wq . + :wq . - 4. , : x + 4. , : x 5. , : - i + i + : + a -: (Normal mode) - . +! (Normal mode) + ף ۣ . - 2. + 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.1: + 2.1: - ** dw . ** + ** dw . ** 1. , . - 2. , , --->. + 2. , --->. 3. , . - 4. dw , . + 4. dw . -: dw . - - , . +! dw + . - ң , + . ---> . 5. 3 4, 2.2. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.2: + 2.2: - ** d$ . ** + ** d$ . ** 1. , . - 2. , , --->. + 2. , --->. - 3. ( . ). + 3. ( ). - 4. , d$ . + 4. d$ . ---> - . . - 5. , 2.3. - - - - + 5. , , 2.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.3: + 2.3: - `' d : + , , . + d : + + d - [] d d [] : - - (, =1). - d - . - - ( ). + d - . + - ( ). : - w - , . - e - , . + w - , . + e - , . $ - . ^ - . -: (Normal mode) - , - . - - +! (Normal mode) + , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.4: `-' + 2.4: - ** dd . ** + ** ģ + . ** - , - Vim , d . + 1. ---> . + + 2. 2w ң . + + 3. 3e ң . + + 4. 0 () . + + 5. 2 3 . + +---> . + + 6. 2.5. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.5: + + + ** ģ + . ** + + + : + d + + 1. ---> + . + + 2. d2w . + + 3. 1 2 + . + +---> . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.6: + + + ** dd . ** + + , Vi + d. 1. , . - 2. dd . - 3. . - 4. 2dd ( `--'), - . - 1) , - 2) , ! - 3) ``'', ``'' --- ! - 4) ! - 5) ... - 6) `' - 7) . + 2. dd . + + 3. ף . + + 4. 2dd . + +---> 1) , +---> 2) , ! +---> 3) ``'', ``'' --- ! +---> 4) ! +---> 5) ... +---> 6) `' +---> 7) . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.5: `' + 2.7: `' - ** u , U - . ** + ** u , U + . ** - 1. , , ---> + 1. , --->, . - 2. x . - 3. u () . - 4. , x . - 5. U , - . - 6. u U . - 7. CTRL-R ( CTRL - R) ( ). ----> `'. + 2. x . + + 3. u () . + + 4. , x . + + 5. U , + . + + 6. u U . + + 7. CTRL-R (.. CTRL + R) ( ). + +---> `'. 8. . 2. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2 + 2 - 1. : dw + 1. : dw - 2. : d$ + 2. : d$ - 3. : dd + 3. : dd - 4. : + 4. : 2w + + 5. : [] [] : - - + [] - , - , d - , w (), $ ( ), .. - 5. () : u ( u) - () : U ( U) + 6. : 0 + + 7. () : u ( u) + () : U ( U) : CTRL-R ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.1: + 3.1: - ** p . ** + ** p ̣ . ** - 1. . + 1. , --->. - 2. dd Vim'. + 2. dd ţ Vim'. 3. , - . + ̣ . - 4. p . + 4. p . - 5. 2--4, . - - ) . - ) , - ) - ) + 5. 2 4, . +---> ) . +---> ) , +---> ) +---> ) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.2: + 3.2: - ** r , . ** + ** r , . ** - 1. , , --->. + 1. , --->. 2. , . - 3. r , . + 3. r , . - 4. 2 3, . + 4. 2 3, . ---> 0 ! ---> - ! - 5. 3.2. - -: , , - . + 5. 3.3. +! , , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.3: + 3.3: - ** cw . ** + ** ce . ** - 1. , , --->. + 1. , --->. 2. `o' `'. - 3. cw ( , `'.) + 3. ce ( , `'). 4. ( , - .) + ). - 5. 3--4 . + 5. 3 4 . ---> . ---> . - , cw , -. - + , ce , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.4: c + 3.4: c -** , . ** + ** , . ** 1. , . - : + : - [] c c [] + [] c c [] 2. : w (), $ ( ) .. - 3. , , --->. + 3. , --->. 4. . - 5. c$ , + 5. c$ , , . ---> , . ----> c$ . +---> c$ . +! Backspace . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3 + 3 - 1. , , p . - ( , + 1. , ̣, p . + ̣ ( , ). - 2. r . + 2. r . - 3. - . , cw - , c$ . + 3. + . , ce + , c$ . 4. : - [] c c [] - - . - - - + [] c c [] + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4.1: + 4.1: - ** CTRL-g - . - SHIFT-G . ** + ** CTRL-g + . G (SHIFT-G) + . ** - : !! +! ! - 1. Ctrl g . - , . + 1. Ctrl g . + , . , 3. - 2. shift-G . + 2. Shift g . - 3. , shift-G. - , , Ctrl-g. - ( , .) - - 4. , 1--3. + 3. , Shift-G. + Σ , , Ctrl-g. + 4. , 1 3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4.2: + 4.2: - ** / . ** + + ** / . ** 1. (Normal mode) / . , , - : . + : . - 2. '' . , + 2. '' . , . - 3. , , n . - , Shift-N . + 3. , , n . + , Shift-N . - 4. , - ? / . + 4. , + ? / . ----> , - . + 5. , , Ctrl-O. + ( Ctrl o ). + . ң Ctrl-I . - "" `'; . +---> "" `'; . + +! , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4.3: - ** % ),] } . ** + ** % ), ] } . ** - 1. (, [ { , --->. + 1. (, [ { , --->. - 2. % . + 2. % . 3. . - 4. % . + 4. % . ---> ( , (, [ ] { } . )) -: ! - - - - - +! ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4.4: - ** :s///g '' ''. ** + ** :s///g '' ''. ** - 1. , , --->. + 1. , --->. - 2. :s// . , - . + 2. :s// . , + . - 3. :s///g , - . . + 3. :s///g , g + . + . ---> , , . 4. , - :#,#s///g #,# --- . - :%s///g . - + :#,#s///g #,# -- . + :%s///g . + :%s///gc + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4 - 1. Ctrl-g . - Shift-G . , Shift-G - . + 4 - 2. / - . - ? + + 1. Ctrl-g . + Shift-G . , Shift-G + . + gg . + + 2. / + . + ? . - n + n Shift-N . - 3. % , (,),[,],{, } + 3. % , (,),[,],{, } . 4. `' `' , - :s/old/new + :s/old/new `' `' , - :s/old/new/g + :s/old/new/g , - :#,#s/old/new/g + :#,#s/old/new/g `' `' , - :%s/old/new/g + :%s/old/new/g , 'c' - :%s/old/new/gc + :%s/old/new/gc + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5.1: + 5.1: - ** :! , . ** + ** :! , . ** - 1. : - . . + 1. : + . . - 2. ! ( ). + 2. ! ( ). , . - 3. ls ! . - , , - . :!dir , - . + 3. ls ! . + , , + . :!dir , ls + . ----> : . - ----> : , : , - . +! + . +! , : , + . . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5.2: -** , , :w _. ** + ** , ģ , + :w _. ** - 1. :!dir :!ls . - , . + 1. :!dir :!ls + . , . - 2. , , TEST. + 2. , ݣ , TEST. - 3. :w TEST ( TEST --- , .) + 3. :w TEST ( TEST -- , .) - 4. ( Vim) TEST. - , :!dir . + 4. ( Vim) TEST. + , :!dir :!ls + . ----> , Vim - TEST, , - . - - 5. , :!del TEST +! Vim TEST + (.. vim TEST ), + , . + 5. , MS-DOS :!del TEST + Unix :!rm TEST ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5.3: - ** , :#,# w _ ** + ** , v + ţ :w _ ** - 1. :!dir :!ls - , TEST. + 1. . - 2. Ctrl-g - to. ! + 2. v . , + . - 3. Ctrl-g. - ! + 3. : :'<,'> . - 4. :#,# w TEST , #,# --- - , (, ), TEST --- . - - 5. , :!dir , - . + 4. w TEST ( TEST -- , ݣ ). + , :'<,'>w TEST. + 5. Vim TEST. , + :!dir :!ls . , + . +! v . + . + - , , d. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5.4: + 5.4: - ** , :r FILENAME ** - 1. :!dir , , TEST - . + ** , :r _ ** - 2. . + 1. . -: 3 5.3. - , . +! 2 5.3. + . - 3. TEST, :r TEST , - TEST --- . + 2. TEST, :r TEST , TEST -- + . -: , - . + 3. , + , Σ 5.3: + TEST. - 4. , , - , 5.3, - . +! . , :r !ls + ls . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5 + 5 1. :! . : - :!dir --- . - :!del FILENAME --- FILENAME. - - 2. :w FILENAME - FILENAME. - - 3. :#,#w FILENAME # # FILENAME. - - 4. :r FILENAME FILENAME - . - - + (MS-DOS) (Unix) + :!dir :!ls -- . + :!del :!rm -- . + 2. :w _ Vim + . + 3. v :w _ + . + 4. :r _ + . + 5. :r !dir dir . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.1: + 6.1: - ** o - (Insert mode) ** + ** o + (Insert mode) ** - 1. , , --->. + 1. , --->. - 2. o ( ) , + 2. o ( ) , (Insert mode). - 3. ---> - . - ----> o . - - 4. , O, - o. . - , Shift-O, . + 3. - + . +---> o ģ . + 4. , O , + o . . +---> , ţ Shift-O. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6.2: - ** a , . ** - 1. , , ---> , - $ (Normal mode). + ** a , . ** - 2. a ( ) , + 1. , --->. + + 2. e c . + + 3. a ( ) , . ( A .) -: i , , - , , -, , , x , , - ! - - 3. . , - , , , - . - ----> ----> - . -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.3: - - - ** R , . ** - - 1. , , --->. - - 2. , - , ---> ( ''). - - 3. R , - , . - ----> , . ----> , R . - - 4. , , - . + 4. , . + (Insert mode). + 5. e ۣ + 3 4. +---> . +---> . +! a , i A , + , . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.4: + 6.3: -** , ** + ** R . ** + + 1. , --->, + xxx. + + 2. R + xxx. + + 3. . + Σ. + + 4. xxx. + +---> 123 xxx xxx. +---> 123 456 579. + +! , ģ + . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.4: - 1. '', : - / - , n + ** y p ** - 2. 'ic' ( ), : - :set ic + 1. , --->, `)'. - 3. '', : n - , n + 2. v + `'. - 4. 'hlsearch' 'incsearch': - :set hls is + 3. y . + + 4. j$ . + + 5. p . `' . + +---> ) . + ) + +! yw ( y w ) + . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.5: + + + ** ** + + 1. `', : / . + , n . + + 2. `ic' ( ), : :set ic + + 3. `', + : n + , `' `'. + + 4. `hlsearch' `incsearch': :set hls is 5. , : - / + / + 6. ޣ : :set noic +! : :nohlsearch + +! , + \ : /\c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6 + 6 - 1. o - . - O , - . + 1. o . + O . - 2. a , . - A - . - - 3. R , - . - - 4. ":set xxx" "xxx" + 2. a . + A . + 3. e . + 4. y , p -- . + 5. R . + 6. `:set xxx' `xxx', : + `ic' `ignorecase' + `is' `incsearch' + `hls' `hlsearch' + 7. `no' : :set noic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 7: + 7.1: - ** ** + + ** ** Vim . - : + ң : - ( ) - ( ) - :help + + . + CTRL-W CTRL-W . :q . - , - ":help". ( - ): - - :help w - :help c_): + :help w + :help c_CTRL-D + :help insert-index + :help user-manual ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 8: + 7.2: - ** Vim ** - Vim , Vi, - . , - "vimrc". + ** Vim ** - 1. "vimrc", - : + Vim , Vi, + . + `vimrc'. - :edit ~/.vimrc Unix - :edit $VIM/_vimrc MS-Windows + 1. `vimrc'. + : + :e ~/.vimrc Unix + :e $VIM/_vimrc MS-Windows - 2. "vimrc": + 2. `vimrc': + :r $VIMRUNTIME/vimrc_example.vim - :read $VIMRUNTIME/vimrc_example.vim - - 3. : - - :write + 3. `vimrc': + :w Vim . - , , "vimrc". + , , `vimrc'. + :help vimrc-intro ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Vim. , - Vim, , - . , Vim - . : ":help user-manual". + 7.3: + + + ** CTRL-D ** + + 1. , Vim : :set nocp + + 2. : :!ls :!dir + + 3. : :e + + 4. CTRL-D Vim `e'. + + 5. Vim `:edit'. + + 6. : :edit + + 7. Vim , . + +! . CTRL-D + . :help . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7 + + + 1. :help , . + + 2. :help cmd . + + 3. CTRL-W CTRL-W . + + 4. :q ( ). + + 5. `vimrc'. + + 6. : , CTRL-D + . . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Vim. + Vim, , ̣ . + ̣ , Vim . + : `:help user-manual'. : - Vim - Vi Improved - : Steve Oualline - : New Riders - Vim. . - . - See http://iccf-holland.org/click5.html + Vim - Vi Improved, : Steve Oualline, : New Riders + + Vim. . + . + . http://iccf-holland.org/click5.html Vi, Vim, : - Learning the Vi Editor - : Linda Lamb - : O'Reilly & Associates Inc. - , , - Vi. Vim. + Learning the Vi Editor, : Linda Lamb, + : O'Reilly & Associates Inc. - Michael C. Pierce Robert K. Ware, Colorado School - of Mines , Charles Smith, Colorado State + , ӣ, Vi. + Vim. + + Michael C. Pierce Robert K. Ware, Colorado School of + Mines , Charles Smith, Colorado State University. E-mail: bware@mines.colorado.edu. - Vim Bram Moolenaar. + Vim (Bram Moolenaar). + + : + , 2002. + ̣ , 2014. + + Translators: + Andrey Kiselev , 2002. + Sergey Alyoshin , 2014. - : , 2002. - Translator: Andrey Kiselev , 2002. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.ru.cp1251 b/runtime/tutor/tutor.ru.cp1251 index 024ca526b8..3cd051f3cc 100644 --- a/runtime/tutor/tutor.ru.cp1251 +++ b/runtime/tutor/tutor.ru.cp1251 @@ -1,29 +1,32 @@ =============================================================================== -= VIM - 1.5 = += VIM -- 1.7 = =============================================================================== - Vim --- , , - , , - . , - Vim + + Vim -- , , + , , . + , + Vim . 25-30 - , . + , . - . , - ( "vimtutor", - ). + ! . + , ( + "vimtutor", ). , - . , , - . , - ! + . , , + . , + ! - , CapsLock - j , , 1.1 + , CapsLock , + j , , 1.1 . + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.1: + 1.1: + ** h,j,k,l , . ** ^ @@ -33,802 +36,972 @@ v 1. , . - 2. `' (j) . ----> , . + 2. `' (j) . + , . 3. `' 1.2. -: , , - (Normal mode). - . +! , , + (Normal mode). + . + +! () + . , hjkl + , . -: () - . , hjkl - , . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.2: VIM + 1.2: VIM -!! ! , , + + !! ! , , !! - 1. ( , , + 1. ( , , (Normal mode)). 2. : :q! . + ( , :q! + .) + . ----> - . : - :wq + 3. , , + . : + vimtutor - 3. , , - . - vimtutor ru - : vim tutor.ru + 4. , , 1 3 + . ----> 'vim' vim, 'tutor.ru' --- , - . +! :q! . + . + + 5. 1.3. - 4. , , 1 3 - . - 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.3: - + 1.3: -- -** x, . ** +** x . ** - 1. , --->. + 1. , --->. 2. , , . - 3. x . + 3. x . - 4. 2--4 . + 4. 2 4 . ---> . - 5. , , 1.4. - -: , - . + 5. , , 1.4. +! , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1.4: - + 1.4: -- - ** (Normal mode), i . ** + ** , i . ** - 1. , --->. + 1. , --->. 2. , , . - 3. i . + 3. i . 4. . - 2--4, . + 2 4, . ----> . +---> . ---> . - 5. , . - - + 5. , 1.5. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 1 + 1.5: -- + + + ** , A . ** + + 1. , --->. + . + + 2. A . + + 3. + . + + 4. , ---> + 2 4 . + +---> + . +---> + . + + 5. , 1.6. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1.6: + + + ** :wq Vim. ** + + !! ! , , + !! + + 1. Vim, 1.2: :q! + , , + . + + 2. : + vim tutor + `vim' -- Vim, `tutor' -- + . , . + + 3. , . + + 4. Vim : :wq + + 5. vimtutor 1, vimtutor + . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 + 1. , hjkl. - h () j () k () l () + h () j () k () l () - 2. Vim ( % ) : - vim _ + 2. Vim ( ) : + vim _ 3. Vim : - :q! . + :q! . : - :wq . + :wq . - 4. , : x + 4. , : x 5. , : - i + i + : + a -: (Normal mode) - . +! (Normal mode) + . - 2. + 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.1: + 2.1: - ** dw . ** + ** dw . ** 1. , . - 2. , , --->. + 2. , --->. 3. , . - 4. dw , . + 4. dw . -: dw . - - , . +! dw + . - , + . ---> . 5. 3 4, 2.2. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.2: + 2.2: - ** d$ . ** + ** d$ . ** 1. , . - 2. , , --->. + 2. , --->. - 3. ( . ). + 3. ( ). - 4. , d$ . + 4. d$ . ---> - . . - 5. , 2.3. - - - - + 5. , , 2.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.3: + 2.3: - `' d : + , , . + d : + + d - [] d d [] : - - (, =1). - d - . - - ( ). + d - . + - ( ). : - w - , . - e - , . + w - , . + e - , . $ - . ^ - . -: (Normal mode) - , - . - - +! (Normal mode) + , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.4: `-' + 2.4: ר - ** dd . ** + ** + . ** - , - Vim , d . + 1. ---> . + + 2. 2w . + + 3. 3e . + + 4. 0 () . + + 5. 2 3 . + +---> . + + 6. 2.5. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.5: ר + + + ** + . ** + + + : + d + + 1. ---> + . + + 2. d2w . + + 3. 1 2 + . + +---> . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 2.6: + + + ** dd . ** + + , Vi + d. 1. , . - 2. dd . - 3. . - 4. 2dd ( `--'), - . - 1) , - 2) , ! - 3) ``'', ``'' --- ! - 4) ! - 5) ... - 6) `' - 7) . + 2. dd . + + 3. . + + 4. 2dd . + +---> 1) , +---> 2) , ! +---> 3) ``'', ``'' --- ! +---> 4) ! +---> 5) ... +---> 6) `' +---> 7) . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2.5: `' + 2.7: `' - ** u , U - . ** + ** u , U + . ** - 1. , , ---> + 1. , --->, . - 2. x . - 3. u () . - 4. , x . - 5. U , - . - 6. u U . - 7. CTRL-R ( CTRL - R) ( ). ----> `'. + 2. x . + + 3. u () . + + 4. , x . + + 5. U , + . + + 6. u U . + + 7. CTRL-R (.. CTRL + R) ( ). + +---> `'. 8. . 2. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 2 + 2 - 1. : dw + 1. : dw - 2. : d$ + 2. : d$ - 3. : dd + 3. : dd - 4. : + 4. : 2w + + 5. : [] [] : - - + [] - , - , d - , w (), $ ( ), .. - 5. () : u ( u) - () : U ( U) + 6. : 0 + + 7. () : u ( u) + () : U ( U) : CTRL-R ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.1: + 3.1: - ** p . ** + ** p . ** - 1. . + 1. , --->. - 2. dd Vim'. + 2. dd Vim'. 3. , - . + . - 4. p . + 4. p . - 5. 2--4, . - - ) . - ) , - ) - ) + 5. 2 4, . +---> ) . +---> ) , +---> ) +---> ) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.2: + 3.2: - ** r , . ** + ** r , . ** - 1. , , --->. + 1. , --->. 2. , . - 3. r , . + 3. r , . - 4. 2 3, . + 4. 2 3, . ---> 0 ! ---> - ! - 5. 3.2. - -: , , - . + 5. 3.3. +! , , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.3: + 3.3: - ** cw . ** + ** ce . ** - 1. , , --->. + 1. , --->. 2. `o' `'. - 3. cw ( , `'.) + 3. ce ( , `'). 4. ( , - .) + ). - 5. 3--4 . + 5. 3 4 . ---> . ---> . - , cw , -. - + , ce , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3.4: c + 3.4: c -** , . ** + ** , . ** 1. , . - : + Ÿ : - [] c c [] + [] c c [] 2. : w (), $ ( ) .. - 3. , , --->. + 3. , --->. 4. . - 5. c$ , + 5. c$ , , . ---> , . ----> c$ . +---> c$ . +! Backspace . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 3 + 3 - 1. , , p . - ( , + 1. , , p . + ( , ). - 2. r . + 2. r . - 3. - . , cw - , c$ . + 3. + . , ce + , c$ . 4. : - [] c c [] - - . - - - + [] c c [] + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4.1: + 4.1: - ** CTRL-g - . - SHIFT-G . ** + ** CTRL-g + . G (SHIFT-G) + . ** - : !! +! ! - 1. Ctrl g . - , . + 1. Ctrl g . + , . , 3. - 2. shift-G . + 2. Shift g . - 3. , shift-G. - , , Ctrl-g. - ( , .) - - 4. , 1--3. + 3. , Shift-G. + , , Ctrl-g. + 4. , 1 3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4.2: + 4.2: - ** / . ** + + ** / . ** 1. (Normal mode) / . , , - : . + : . - 2. '' . , + 2. '' . , . - 3. , , n . - , Shift-N . + 3. , , n . + , Shift-N . - 4. , - ? / . + 4. , + ? / . ----> , - . + 5. , , Ctrl-O. + ( Ctrl o ). + . Ctrl-I . - "" `'; . +---> "" `'; . + +! , + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4.3: - ** % ),] } . ** + ** % ), ] } . ** - 1. (, [ { , --->. + 1. (, [ { , --->. - 2. % . + 2. % . 3. . - 4. % . + 4. % . ---> ( , (, [ ] { } . )) -: ! - - - - - +! ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4.4: - ** :s///g '' ''. ** + ** :s///g '' ''. ** - 1. , , --->. + 1. , --->. - 2. :s// . , - . + 2. :s// . , + . - 3. :s///g , - . . + 3. :s///g , g + . + . ---> , , . 4. , - :#,#s///g #,# --- . - :%s///g . - + :#,#s///g #,# -- . + :%s///g . + :%s///gc + . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 4 - 1. Ctrl-g . - Shift-G . , Shift-G - . + 4 - 2. / - . - ? + + 1. Ctrl-g . + Shift-G . , Shift-G + . + gg . + + 2. / + Ш . + ? . - n + n Shift-N . - 3. % , (,),[,],{, } + 3. % , (,),[,],{, } . 4. `' `' , - :s/old/new + :s/old/new `' `' , - :s/old/new/g + :s/old/new/g , - :#,#s/old/new/g + :#,#s/old/new/g `' `' , - :%s/old/new/g + :%s/old/new/g , 'c' - :%s/old/new/gc + :%s/old/new/gc + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5.1: + 5.1: - ** :! , . ** + ** :! , . ** - 1. : - . . + 1. : + . . - 2. ! ( ). + 2. ! ( ). , . - 3. ls ! . - , , - . :!dir , - . + 3. ls ! . + , , + . :!dir , ls + . ----> : . - ----> : , : , - . +! + . +! , : , + . . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5.2: -** , , :w _. ** + ** , , + :w _. ** - 1. :!dir :!ls . - , . + 1. :!dir :!ls + . , . - 2. , , TEST. + 2. , , TEST. - 3. :w TEST ( TEST --- , .) + 3. :w TEST ( TEST -- , .) - 4. ( Vim) TEST. - , :!dir . + 4. ( Vim) TEST. + , :!dir :!ls + . ----> , Vim - TEST, , - . - - 5. , :!del TEST +! Vim TEST + (.. vim TEST ), + , . + 5. , MS-DOS :!del TEST + Unix :!rm TEST ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5.3: - ** , :#,# w _ ** + ** , v + :w _ ** - 1. :!dir :!ls - , TEST. + 1. . - 2. Ctrl-g - to. ! + 2. v . , + . - 3. Ctrl-g. - ! + 3. : :'<,'> . - 4. :#,# w TEST , #,# --- - , (, ), TEST --- . - - 5. , :!dir , - . + 4. w TEST ( TEST -- , ). + , :'<,'>w TEST. + 5. Vim TEST. , + :!dir :!ls . , + . +! v . + . + - , , d. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5.4: + 5.4: - ** , :r FILENAME ** - 1. :!dir , , TEST - . + ** , :r _ ** - 2. . + 1. . -: 3 5.3. - , . +! 2 5.3. + . - 3. TEST, :r TEST , - TEST --- . + 2. TEST, :r TEST , TEST -- + . -: , - . + 3. , + , 5.3: + TEST. - 4. , , - , 5.3, - . +! . , :r !ls + ls . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 5 + 5 1. :! . : - :!dir --- . - :!del FILENAME --- FILENAME. - - 2. :w FILENAME - FILENAME. - - 3. :#,#w FILENAME # # FILENAME. - - 4. :r FILENAME FILENAME - . - - + (MS-DOS) (Unix) + :!dir :!ls -- . + :!del :!rm -- . + 2. :w _ Vim + . + 3. v :w _ + . + 4. :r _ + . + 5. :r !dir dir . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.1: + 6.1: - ** o - (Insert mode) ** + ** o + (Insert mode) ** - 1. , , --->. + 1. , --->. - 2. o ( ) , + 2. o ( ) , (Insert mode). - 3. ---> - . - ----> o . - - 4. , O, - o. . - , Shift-O, . + 3. - + . +---> o . + 4. , O , + o . . +---> , Shift-O. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6.2: - ** a , . ** - 1. , , ---> , - $ (Normal mode). + ** a , . ** - 2. a ( ) , + 1. , --->. + + 2. e c . + + 3. a ( ) , . ( A .) -: i , , - , , -, , , x , , - ! - - 3. . , - , , , - . - ----> ----> - . -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.3: - - - ** R , . ** - - 1. , , --->. - - 2. , - , ---> ( ''). - - 3. R , - , . - ----> , . ----> , R . - - 4. , , - . + 4. , . + (Insert mode). + 5. e + 3 4. +---> . +---> . +! a , i A , + , . ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6.4: + 6.3: ٨ -** , ** + ** R . ** + + 1. , --->, + xxx. + + 2. R + xxx. + + 3. . + . + + 4. xxx. + +---> 123 xxx xxx. +---> 123 456 579. + +! , + . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.4: - 1. '', : - / - , n + ** y p ** - 2. 'ic' ( ), : - :set ic + 1. , --->, `)'. - 3. '', : n - , n + 2. v + `'. - 4. 'hlsearch' 'incsearch': - :set hls is + 3. y . + + 4. j$ . + + 5. p . `' . + +---> ) . + ) + +! yw ( y w ) + . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 6.5: + + + ** ** + + 1. `', : / . + , n . + + 2. `ic' ( ), : :set ic + + 3. `', + : n + , `' `'. + + 4. `hlsearch' `incsearch': :set hls is 5. , : - / + / + 6. : :set noic +! : :nohlsearch + +! , + \ : /\c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 6 + 6 - 1. o - . - O , - . + 1. o . + O . - 2. a , . - A - . - - 3. R , - . - - 4. ":set xxx" "xxx" + 2. a . + A . + 3. e . + 4. y , p -- . + 5. R . + 6. `:set xxx' `xxx', : + `ic' `ignorecase' + `is' `incsearch' + `hls' `hlsearch' + 7. `no' : :set noic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 7: + 7.1: - ** ** + + ** ** Vim . - : + : - ( ) - ( ) - :help + + . + CTRL-W CTRL-W . :q . - , - ":help". ( - ): - - :help w - :help c_): + :help w + :help c_CTRL-D + :help insert-index + :help user-manual ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - 8: + 7.2: - ** Vim ** - Vim , Vi, - . , - "vimrc". + ** Vim ** - 1. "vimrc", - : + Vim , Vi, + . + `vimrc'. - :edit ~/.vimrc Unix - :edit $VIM/_vimrc MS-Windows + 1. `vimrc'. + : + :e ~/.vimrc Unix + :e $VIM/_vimrc MS-Windows - 2. "vimrc": + 2. `vimrc': + :r $VIMRUNTIME/vimrc_example.vim - :read $VIMRUNTIME/vimrc_example.vim - - 3. : - - :write + 3. `vimrc': + :w Vim . - , , "vimrc". + , , `vimrc'. + :help vimrc-intro ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Vim. , - Vim, , - . , Vim - . : ":help user-manual". + 7.3: + + + ** CTRL-D ** + + 1. , Vim : :set nocp + + 2. : :!ls :!dir + + 3. : :e + + 4. CTRL-D Vim `e'. + + 5. Vim `:edit'. + + 6. : :edit + + 7. Vim , . + +! . CTRL-D + . :help . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 7 + + + 1. :help , . + + 2. :help cmd . + + 3. CTRL-W CTRL-W . + + 4. :q ( ). + + 5. `vimrc'. + + 6. : , CTRL-D + . . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Vim. + Vim, , . + , Vim . + : `:help user-manual'. : - Vim - Vi Improved - : Steve Oualline - : New Riders - Vim. . - . - See http://iccf-holland.org/click5.html + Vim - Vi Improved, : Steve Oualline, : New Riders + + Vim. . + . + . http://iccf-holland.org/click5.html Vi, Vim, : - Learning the Vi Editor - : Linda Lamb - : O'Reilly & Associates Inc. - , , - Vi. Vim. + Learning the Vi Editor, : Linda Lamb, + : O'Reilly & Associates Inc. - Michael C. Pierce Robert K. Ware, Colorado School - of Mines , Charles Smith, Colorado State + , , Vi. + Vim. + + Michael C. Pierce Robert K. Ware, Colorado School of + Mines , Charles Smith, Colorado State University. E-mail: bware@mines.colorado.edu. - Vim Bram Moolenaar. + Vim (Bram Moolenaar). + + : + , 2002. + , 2014. + + Translators: + Andrey Kiselev , 2002. + Sergey Alyoshin , 2014. - : , 2002. - Translator: Andrey Kiselev , 2002. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/runtime/tutor/tutor.ru.utf-8 b/runtime/tutor/tutor.ru.utf-8 index c12de27d80..69a237ea79 100644 --- a/runtime/tutor/tutor.ru.utf-8 +++ b/runtime/tutor/tutor.ru.utf-8 @@ -1,29 +1,32 @@ =============================================================================== -= Д о б р о п о ж а л о в а т ь в у ч е б н и к VIM - Версия 1.5 = += Д о б р о п о ж а л о в а т ь в у ч е б н и к VIM -- версия 1.7 = =============================================================================== - Vim --- это очень мощный редактор, имеющий множество команд, слишком - много для того, чтобы их все можно было описать в таком учебнике, как - этот. Этот учебник призван объяснить достаточное число команд для того, - чтобы Вы могли с легкостью использовать Vim в качестве редактора общего + + Vim -- это очень мощный редактор, имеющий множество команд, слишком много + для того, чтобы их все можно было описать в таком учебнике, как этот. + Этот учебник призван объяснить достаточное число команд для того, чтобы + вы могли с лёгкостью использовать Vim в качестве редактора общего назначения. Вам потребуется приблизительно 25-30 минут на освоение данного учебника в - зависимости от того, сколько времени Вы потратите на эксперименты. + зависимости от того, сколько времени вы потратите на эксперименты. - Команды в уроках будут модифицировать текст. Создайте копию этого файла, - чтобы попрактиковаться на ней (если Вы запустили "vimtutor", то это уже - копия). + Внимание! Командами в уроках вы будете изменять этот текст. Создайте + копию этого файла, чтобы попрактиковаться на ней (если вы запустили + "vimtutor", то это уже копия). Важно помнить, что этот учебник предназначен для обучения в процессе - использования. Это означает, что Вы должны запускать команды для того, - чтобы как следует их изучить. Если Вы просто прочитаете текст, то - забудете команды! + использования. Это означает, что вы должны запускать команды для того, + чтобы как следует их изучить. Если вы просто прочитаете этот текст, то + не запомните команды! - Теперь убедитесь в том, что клавиша CapsLock не включена и нажмите - клавишу j несколько раз, так, чтобы Урок 1.1 полностью поместился на + Теперь убедитесь в том, что клавиша CapsLock не включена, и нажмите + клавишу j несколько раз, так, чтобы Урок 1.1 полностью поместился на экране. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 1.1: ПЕРЕМЕЩЕНИЕ КУРСОРА + Урок 1.1: ПЕРЕМЕЩЕНИЕ КУРСОРА + ** Для перемещения курсора нажмите клавиши h,j,k,l так, как показано ниже. ** ^ @@ -33,802 +36,972 @@ v 1. Подвигайте курсор по экрану, пока не почувствуете себя уверенно. - 2. Надавите клавишу `вниз' (j) пока она не начнет повторяться. ----> Теперь Вы знаете, как перейти к следующему уроку. + 2. Надавите клавишу `вниз' (j) пока она не начнёт повторяться. + Теперь вы знаете, как перейти к следующему уроку. 3. Используя клавишу `вниз' перейдите к Уроку 1.2. -Замечание: Если вы пока не уверены в том, что набираете, нажмите для - перехода в обычный режим (Normal mode). После этого перенаберите - требуемую команду. +Замечание! Если вы пока не уверены в том, что набираете, нажмите для + перехода в обычный режим (Normal mode). После этого перенаберите + требуемую команду. + +Замечание! Обычные клавиши управления курсором (стрелки) также должны + работать. Однако, клавиши hjkl позволят вам перемещаться + значительно быстрее, как только вы научитесь ими пользоваться. -Замечание: Обычные клавиши управления курсором (стрелки) также должны - работать. Однако, клавиши hjkl позволят Вам перемещаться - значительно быстрее, как только Вы научитесь ими пользоваться. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 1.2: ЗАПУСК И ЗАВЕРШЕНИЕ РАБОТЫ С VIM + Урок 1.2: ЗАВЕРШЕНИЕ РАБОТЫ С VIM -!! ВНИМАНИЕ! Прежде, чем выполнять любой из описанных ниже шагов, прочтите + + !! ВНИМАНИЕ! Прежде, чем выполнять любой из описанных ниже шагов, прочтите урок целиком !! - 1. Нажмите клавишу (для того, чтобы удостовериться, что Вы в обычном + 1. Нажмите клавишу (для того, чтобы удостовериться, что вы в обычном режиме (Normal mode)). 2. Наберите: :q! . + (Это означает, что вы должны набрать три символа :q! и нажать клавишу + ввод.) Это позволит вам выйти из редактора БЕЗ СОХРАНЕНИЯ любых сделанных + изменений. ----> Это позволит Вам выйти из редактора БЕЗ СОХРАНЕНИЯ любых сделанных - изменений. Если Вы хотите сохранить изменения и выйти: - :wq + 3. Когда вы увидите приглашение командной оболочки, наберите команду, + которая привела вас в этот учебник. Это может быть: + vimtutor - 3. Когда Вы увидите приглашение командной оболочки, наберите команду, - которая привела Вас в этот учебник. Это может быть - vimtutor ru - Обычно можно использовать: vim tutor.ru + 4. Если вы уверены в том, что запомнили эти шаги, выполните шаги от 1 до 3 + чтобы выйти снова запустить редактор. ----> 'vim' позволяет запустить редактор vim, 'tutor.ru' --- это файл, который - Вы будете редактировать. +Замечание! :q! отбрасывает любые сделанные вами изменения. Через + несколько уроков вы узнаете как сохранять изменения в файл. + + 5. Переместите курсор вниз к Уроку 1.3. - 4. Если Вы уверены в том, что запомнили эти шаги, выполните шаги от 1 до 3 - чтобы выйти снова запустить редактор. Затем переместите курсор вниз к - Уроку 1.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 1.3: РЕДАКТИРОВАНИЕ ТЕКСТА - УДАЛЕНИЕ + Урок 1.3: РЕДАКТИРОВАНИЕ ТЕКСТА -- УДАЛЕНИЕ -** Находясь в обычном режиме нажмите x, чтобы удалить символ под курсором. ** +** Находясь в обычном режиме нажмите x для удаления символа под курсором. ** - 1. Переместите курсор к строке внизу, помеченной --->. + 1. Переместите курсор к строке ниже, помеченной --->. 2. Для исправления ошибок, переместите курсор, пока он не окажется над удаляемым символом. - 3. Нажмите клавишу x для удаления требуемого символа. + 3. Нажмите клавишу x для удаления требуемого символа. - 4. Повторите шаги 2--4 пока строка не будет исправлена. + 4. Повторите шаги со 2 по 4 пока строка не будет исправлена. ---> От тттопота копытт пппыль ппо ппполю леттитт. - 5. Теперь, когда строка откорректирована, переходите к уроку 1.4. - -ЗАМЕЧАНИЕ: В ходе освоения этого учебника не пытайтесь запоминать, учите - в процессе использования. + 5. Теперь, когда строка откорректирована, переходите к Уроку 1.4. +Замечание! В ходе освоения этого учебника не пытайтесь запоминать, учите + в процессе использования. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 1.4: РЕДАКТИРОВАНИЕ ТЕКСТА - ВСТАВКА + Урок 1.4: РЕДАКТИРОВАНИЕ ТЕКСТА -- ВСТАВКА - ** Находясь в обычном режиме (Normal mode), нажмите i для вставки текста. ** + ** Находясь в обычном режиме, нажмите i для вставки текста. ** - 1. Переместите курсор к первой строке внизу, помеченной --->. + 1. Переместите курсор к первой строке ниже, помеченной --->. 2. Для того, чтобы сделать первую строку идентичной второй, поместите курсор на символ ПЕРЕД которым следует вставить текст. - 3. Нажмите i и наберите требуемые добавления. + 3. Нажмите i и наберите требуемые добавления. 4. После исправления всех ошибок нажмите для возврата в обычный режим. - Повторите шаги 2--4, пока фраза не будет исправлена полностью. + Повторите шаги со 2 по 4, пока фраза не будет исправлена полностью. ----> Часть текста в строке беследно . +---> Часть текста в строке бесследно . ---> Часть текста в этой строке бесследно пропала. - 5. Когда освоите вставку текста, переходите дальше к Резюме. - - + 5. Когда освоите вставку текста, переходите к Уроку 1.5. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 1 + Урок 1.5: РЕДАКТИРОВАНИЕ ТЕКСТА -- ДОБАВЛЕНИЕ + + + ** Находясь в обычном режиме, нажмите A для добавления текста. ** + + 1. Переместите курсор к первой строке ниже, помеченной --->. + Не имеет значения на каком символе расположен курсор на этой строке. + + 2. Нажмите A и наберите требуемые добавления. + + 3. После добавления требуемого текста нажмите для возврата в обычный + режим. + + 4. Переместите курсор на следующую строку, помеченную ---> и повторите шаги + со 2 по 4 для исправления этой строки. + +---> Часть текста в этой строке бессле + Часть текста в этой строке бесследно пропала. +---> Здесь также не достаёт час + Здесь также не достаёт части текста. + + 5. Когда освоите добавление текста, переходите к Уроку 1.6. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 1.6: РЕДАКТИРОВАНИЕ ФАЙЛА + + + ** Используйте :wq для сохранения файла и выхода из Vim. ** + + !! ВНИМАНИЕ! Прежде, чем выполнять любой из описанных ниже шагов, прочтите + урок целиком !! + + 1. Выйдите из Vim, как вы это узнали в Уроке 1.2: :q! + Или, если у вас есть доступ к другому терминалу, можете сделать следующее + в нём. + + 2. По приглашению командной оболочки введите следующую команду: + vim tutor + `vim' -- команда для запуска редактора Vim, а `tutor' -- имя файла для + редактирования. Используете имя файла, который можно изменять. + + 3. Вставляйте и удаляйте текст, как вы научились в предыдущих уроках. + + 4. Сохраните файл с изменениями и выйдите из Vim выполнив: :wq + + 5. Если вы вышли из vimtutor на шаге 1, перезапустите vimtutor и переходите + к следующему Резюме. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + РЕЗЮМЕ УРОКА 1 + 1. Курсор перемещается либо клавишами со стрелками, либо клавишами hjkl. - h (влево) j (вниз) k (вверх) l (вправо) + h (влево) j (вниз) k (вверх) l (вправо) - 2. Для запуска Vim (из приглашения % командной оболочки) наберите: - vim ИМЯ_ФАЙЛА + 2. Для запуска Vim (из приглашения командной оболочки) наберите: + vim ИМЯ_ФАЙЛА 3. Для завершения работы с Vim наберите: - :q! чтобы отказаться от сохранения изменений. + :q! чтобы отказаться от сохранения изменений. Или наберите: - :wq чтобы сохранить изменения. + :wq чтобы сохранить изменения. - 4. Для удаления символа под курсором в обычном режиме, наберите: x + 4. Для удаления символа под курсором в обычном режиме, нажмите: x 5. Чтобы вставить текст перед курсором в обычном режиме, наберите: - i вводите текст + i вводите вставляемый текст + Чтобы добавить текст после курсора: + a вводите добавляемый текст -ЗАМЕЧАНИЕ: Нажатие переместит Вас в обычный режим (Normal mode) либо - прервет нежелательную и частично завершенную команду. +Замечание! Нажатие переместит вас в обычный режим (Normal mode) либо + прервёт нежелательную и частично завершённую команду. -Теперь переходим к Уроку 2. +Теперь переходите к Уроку 2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 2.1: КОМАНДЫ УДАЛЕНИЯ + Урок 2.1: КОМАНДЫ УДАЛЕНИЯ - ** Наберите dw для удаления участка текста до конца слова. ** + ** Наберите dw для удаления участка текста до конца слова. ** 1. Нажмите , чтобы перейти в обычный режим. - 2. Переместите курсор вниз, к строке, помеченной --->. + 2. Переместите курсор вниз, к строке помеченной --->. 3. Переместите курсор в начало слова, которое следует удалить. - 4. Наберите dw , чтобы удалить это слово. + 4. Наберите dw для удаления этого слова. -ЗАМЕЧАНИЕ: Во время набора буквы dw появятся в последней строке экрана. Если - Вы что-то наберете неправильно, нажмите и начните сначала. +Замечание! Во время набора буквы dw появятся справа в самой нижней строке + экрана. Если вы что-то наберёте неправильно, нажмите и начните + сначала. ---> Несколько слов рафинад в этом предложении автокран излишни. 5. Повторите шаги 3 и 4, пока не исправите все ошибки и переходите к Уроку 2.2. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 2.2: ДОПОЛНИТЕЛЬНЫЕ КОМАНДЫ УДАЛЕНИЯ + Урок 2.2: ДОПОЛНИТЕЛЬНЫЕ КОМАНДЫ УДАЛЕНИЯ - ** Наберите d$ для удаления текста до конца строки. ** + ** Наберите d$ для удаления текста до конца строки. ** 1. Нажмите , чтобы перейти в обычный режим. - 2. Переместите курсор вниз, к строке, помеченной --->. + 2. Переместите курсор вниз, к строке помеченной --->. - 3. Переместите курсор к концу правильной строки (ПОСЛЕ первой . ). + 3. Переместите курсор к концу правильной строки (ПОСЛЕ первой точки). - 4. Чтобы удалить остаток строки, наберите d$ . + 4. Наберите d$ для удаления остатка строки. ---> Кто-то набрал окончание этой строки дважды. окончание этой строки дважды. - 5.Чтобы лучше разобраться в этом, переходите к Уроку 2.3. - - - - + 5. Чтобы лучше разобраться в том, как это происходит, переходите к Уроку 2.3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 2.3: КОМАНДЫ И ОБЪЕКТЫ + Урок 2.3: КОМАНДЫ И ОБЪЕКТЫ - Формат команды `удаление' d таков: + Многие команды, изменяющие текст, состоят из оператора и объекта. Формат + команды удаления с оператором d следующий: + + d объект - [число] d объект ИЛИ d [число] объект Здесь: - число - сколько раз исполнить команду (необязательно, по умолчанию=1). - d - команда удаления. - объект - с чем команда должна быть выполнена (перечислено ниже). + d - оператор удаления. + объект - над чем должна быть выполнена команда (перечислено ниже). Краткий список объектов: - w - от курсора до конца слова, включая завершающий пробел. - e - от курсора до конца слова, НЕ включая завершающий пробел. + w - от курсора до конца слова, включая последующий пробел. + e - от курсора до конца слова, НЕ включая последующий пробел. $ - от курсора до конца строки. ^ - от курсора до начала строки. -ЗАМЕЧАНИЕ: Простое нажатие на символ объекта в обычном режиме (Normal mode) - без дополнительных команд передвинет курсор так, как указано в - списке объектов. - - +Замечание! Простое нажатие на символ объекта в обычном режиме (Normal mode) + без предварительного оператора переместит курсор так, как указано + в списке объектов. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 2.4: ИСКЛЮЧЕНИЕ ИЗ ПРАВИЛА `КОМАНДА-ОБЪЕКТ' + Урок 2.4: ИСПОЛЬЗОВАНИЕ СЧЁТЧИКА ДЛЯ ПЕРЕМЕЩЕНИЯ - ** Наберите dd для удаления всей строки. ** + ** Ввод числа перед оператором перемещения приведёт к его повторению + заданное количество раз. ** - Вследствие частого применения операции удаления всей строки, разработчики - Vim решили, что для этого проще всего просто набрать d дважды. + 1. Переместите курсор к началу строки отмеченной ---> ниже. + + 2. Наберите 2w для перемещения курсора вперёд к началу второго слова. + + 3. Наберите 3e для перемещения курсора вперёд к концу третьего слова. + + 4. Наберите 0 (нуль) для перемещения к началу строки. + + 5. Повторите шаги 2 и 3 с различными числами. + +---> Обычная строка из слов для вашего перемещения по ней. + + 6. Переходите к Уроку 2.5. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.5: ИСПОЛЬЗОВАНИЕ СЧЁТЧИКА ДЛЯ УДАЛЕНИЯ + + + ** Ввод числа перед оператором приведёт к его повторению + заданное количество раз. ** + + Добавьте число перед перед объектом в комбинацию оператора удаления и + перемещения указанную выше для удаления указанного количества объектов: + d число объект + + 1. Переместите курсор к первому слову из прописных букв в отмеченной ---> + строке ниже. + + 2. Наберите d2w для удаления двух слов из прописных букв. + + 3. Повторите шаги 1 и 2 с другими числами для удаления последовательных слов + из прописных букв одной командой. + +---> эта АБВ ГД строка ЕЖЗИ КЛ МНО из слов П РС ТУФ очищена. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 2.6: ОПЕРАЦИИ СО СТРОКАМИ + + + ** Наберите dd для удаления целой строки. ** + + В связи с частой необходимостью удаления целой строки, создатели Vi решили + для упрощения сделать возможным удаление строки набором двух d. 1. Переместите курсор вниз, ко второй строке фразы. - 2. Наберите dd для удаления строки. - 3. Теперь переместитесь к четвертой строке. - 4. Наберите 2dd (вспомните правило `число-команда-объект'), чтобы удалить - две строки. - 1) Летом я хожу на стадион, - 2) О, как внезапно кончился диван! - 3) Я болею за ``Зенит'', ``Зенит'' --- чемпион! - 4) Печально я гляжу на наше поколение! - 5) Его грядущее иль пусто иль темно... - 6) Я сижу на скамейке в ложе `Б' - 7) И играю на большой жестяной трубе. + 2. Наберите dd для удаления строки. + + 3. Теперь переместитесь к четвёртой строке. + + 4. Наберите 2dd для удаления двух строк. + +---> 1) Летом я хожу на стадион, +---> 2) О, как внезапно кончился диван! +---> 3) Я болею за ``Зенит'', ``Зенит'' --- чемпион! +---> 4) Печально я гляжу на наше поколение! +---> 5) Его грядущее иль пусто иль темно... +---> 6) Я сижу на скамейке в ложе `Б' +---> 7) И играю на большой жестяной трубе. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 2.5: КОМАНДА `ОТКАТ' + Урок 2.7: КОМАНДА `ОТМЕНА' - ** Нажмите u для отмены результата работы предыдущей команды, U для отмены - исправлений во всей строке. ** + ** Нажмите u для отмены результата работы предыдущей команды, U для отмены + исправлений во всей строке. ** - 1. Переместите курсор вниз, к строке, помеченной ---> и установите его на + 1. Переместите курсор вниз, к строке помеченной --->, и установите его на первую ошибку. - 2. Нажмите x для удаления первого неправильного символа. - 3. Теперь нажмите u для отмены (отката) последней выполненной команды. - 4. Исправьте все ошибки в строке, используя команду x . - 5. Теперь нажмите заглавную U для того, чтобы вернуть всю строку в исходное - состояние. - 6. Нажмите u несколько раз для отмены команды U и предыдущих команд. - 7. Нажмите теперь CTRL-R (удерживайте клавишу CTRL нажатой в момент нажатия - R) несколько раз для возврата команд (откат отката). ----> Испрравьте оошибки в этойй строке и вернитте их сс помощьью `отката'. + 2. Нажмите x для удаления первого неправильного символа. + + 3. Теперь нажмите u для отмены (отката) последней выполненной команды. + + 4. Исправьте все ошибки в строке, используя команду x . + + 5. Теперь нажмите заглавную U для того, чтобы вернуть всю строку + в исходное состояние. + + 6. Нажмите u несколько раз для отмены команды U и предыдущих команд. + + 7. Нажмите теперь CTRL-R (т.е. удерживайте клавишу CTRL нажатой в момент + нажатия клавиши R) несколько раз для возврата команд (откат отката). + +---> Испрравьте оошибки в этойй строке и вернитте их сс помощьью `отмены'. 8. Это были очень полезные команды. Далее переходите к Резюме Урока 2. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 2 + РЕЗЮМЕ УРОКА 2 - 1. Для удаления текста от курсора до конца слова наберите: dw + 1. Для удаления текста от курсора до конца слова наберите: dw - 2. Для удаления текста от курсора до конца строки наберите: d$ + 2. Для удаления текста от курсора до конца строки наберите: d$ - 3. Для удаления всей строки наберите: dd + 3. Для удаления всей строки наберите: dd - 4. Формат команды в обычном режиме имеет вид: + 4. Для повтора перемещения введите количество перед командой: 2w + + 5. Формат команды в обычном режиме имеет вид: [число] команда объект ИЛИ команда [число] объект где: - число - сколько раз повторить выполнение команды + [число] - сколько раз повторить выполнение команды, опционально команда - что выполнить, например d для удаления объект - на что должна воздействовать команда, например w (слово), $ (до конца строки), и т.д. - 5. Для отмены (отката) предшествующих действий наберите: u (строчная u) - Для отмены (отката) всех изменений в строке наберите: U (прописная U) + 6. Для перехода к началу строки используйте нуль: 0 + + 7. Для отмены (отката) предшествующих действий наберите: u (строчная u) + Для отмены (отката) всех изменений в строке наберите: U (прописная U) Для отмены отката наберите: CTRL-R ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 3.1: КОМАНДА ВСТАВКИ + Урок 3.1: КОМАНДА ВСТАВКИ - ** Наберите p для вставки последнего удаленного текста после курсора. ** + ** Наберите p для вставки последнего удалённого текста после курсора. ** - 1. Переместите курсор вниз к последней строке из набора. + 1. Переместите курсор вниз, к строке помеченной --->. - 2. Наберите dd для удаления строки и ее сохранения в буфере Vim'а. + 2. Наберите dd для удаления строки и её сохранения в буфере Vim'а. 3. Переместите курсор к строке НАД тем местом, куда следует вставить - удаленную строку. + удалённую строку. - 4. Находясь в обычном режиме наберите p для замены строки. + 4. Находясь в обычном режиме наберите p для вставки строки ниже курсора. - 5. Повторите шаги 2--4, пока не расставите все строки в нужном порядке. - - г) И лучше выдумать не мог. - б) Когда не в шутку занемог, - в) Он уважать себя заставил - а) Мой дядя самых честных правил + 5. Повторите шаги со 2 по 4, пока не расставите все строки в нужном порядке. +---> г) И лучше выдумать не мог. +---> б) Когда не в шутку занемог, +---> в) Он уважать себя заставил +---> а) Мой дядя самых честных правил ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 3.2: КОМАНДА ЗАМЕНЫ + Урок 3.2: КОМАНДА ЗАМЕНЫ - ** Наберите r и символ, заменяющий символ под курсором. ** + ** Наберите r и символ, заменяющий символ под курсором. ** - 1. Переместите курсор вниз, к строке, помеченной --->. + 1. Переместите курсор вниз, к строке помеченной --->. 2. Установите курсор так, чтобы он находился над первой ошибкой. - 3. Наберите r и затем символ, исправляющий ошибку. + 3. Наберите r и затем символ, исправляющий ошибку. - 4. Повторите шаги 2 и 3, пока первая строка не будет исправлена. + 4. Повторите шаги 2 и 3, пока первая строка не будет исправлена как вторая. ---> В момегт набтра этой чтроки кое0кто с трудом попвдал по клваишам! ---> В момент набора этой строки кое-кто с трудом попадал по клавишам! - 5. Теперь переходите к Уроку 3.2. - -ЗАМЕЧАНИЕ: Помните, что вы должны учиться в процессе работы, а не просто - запоминая. + 5. Теперь переходите к Уроку 3.3. +Замечание! Помните, что вы должны учиться в процессе работы, а не просто + запоминая. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 3.3: КОМАНДА ИЗМЕНЕНИЯ + Урок 3.3: КОМАНДА ИЗМЕНЕНИЯ - ** Для изменения части слова наберите cw . ** + ** Для изменения конечной части слова наберите ce . ** - 1. Переместите курсор вниз, к строке, помеченной --->. + 1. Переместите курсор вниз, к строке помеченной --->. 2. Расположите курсор над буквой `o' в слове `сола'. - 3. Наберите cw и исправьте слово (в данном случае, наберите `лов'.) + 3. Наберите ce и исправьте слово (в данном случае, наберите `лов'). 4. Нажмите и переходите к следующей ошибке (к первому символу, который - надо изменить.) + надо изменить). - 5. Повторите шаги 3--4 пока первое предложение не станет идентичным второму. + 5. Повторите шаги 3 и 4 пока первое предложение не станет идентичным второму. ---> Несколько сола в эьгц строке тпгшцбь редалзкуюиесвх. ---> Несколько слов в этой строке требуют редактирования. -Обратите внимание, что cw не только заменяет слово, но и переводит вас в режим -вставки. - + Обратите внимание, что ce не только удаляет слово, но и переводит вас в + режим вставки. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 3.4: ПРОДОЛЖАЕМ ИЗМЕНЯТЬ С КОМАНДОЙ c + Урок 3.4: ПРОДОЛЖАЕМ ИЗМЕНЯТЬ С КОМАНДОЙ c -** Команда замены используется с теми же объектами, что и команда удаления. ** + ** Команда замены используется с теми же объектами, что и команда удаления. ** 1. Команда изменения применяется таким же образом, как и команда удаления. - Ее формат таков: + Её формат таков: - [число] c объект ИЛИ c [число] объект + [число] c объект ИЛИ c [число] объект 2. Объекты также совпадают: w (слово), $ (конец строки) и т.п. - 3. Переместите курсор вниз, к строке, помеченной --->. + 3. Переместите курсор вниз, к строке помеченной --->. 4. Перейдите к первой ошибке. - 5. Наберите c$ и отредактируйте первую строку так, чтобы она совпадала со + 5. Наберите c$ и отредактируйте первую строку так, чтобы она совпадала со второй, после чего нажмите . ---> Конец этой строки нуждается в помощи, чтобы стать похожим на второй. ----> Конец этой строки нуждается в помощи команды c$ . +---> Конец этой строки нуждается в помощи команды c$ . +Замечание! Клавиша Backspace может использоваться для исправления при наборе. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 3 + РЕЗЮМЕ УРОКА 3 - 1. Для вставки текста, который только что был удален, наберите p . Эта - команда вставит удаленный текст ПОСЛЕ курсора (если была удалена строка, + 1. Для вставки текста, который только что был удалён, наберите p . Эта + команда вставит удалённый текст ПОСЛЕ курсора (если была удалена строка, то она будет помещена в строке под курсором). - 2. Для замены символа под курсором наберите r и затем заменяющий символ. + 2. Для замены символа под курсором наберите r и затем заменяющий символ. - 3. Команда изменения позволяет Вам изменить указанный объект от курсора до - конца этого объекта. Например, наберите cw для замены от курсора до - конца слова, c$ для изменения до конца строки. + 3. Команда изменения позволяет вам изменить указанный объект от курсора до + окончания перемещения. Например, наберите ce для замены от курсора до + конца слова, c$ для изменения до конца строки. 4. Формат команды изменения таков: - [число] c объект ИЛИ c [число] объект - -Теперь отправляйтесь к следующему уроку. - - - + [число] c объект ИЛИ c [число] объект +Теперь переходите к следующему уроку. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 4.1: ИНФОРМАЦИЯ О ФАЙЛЕ И РАСПОЛОЖЕНИЕ В НЕМ + Урок 4.1: ИНФОРМАЦИЯ О ФАЙЛЕ И РАСПОЛОЖЕНИИ В НЕМ - ** Наберите CTRL-g чтобы увидеть Ваше месторасположение в файле и информацию - о нем. - Наберите SHIFT-G для перемещения к заданной строке в файле. ** + ** Наберите CTRL-g чтобы увидеть ваше месторасположение в файле и + информацию о файле. Наберите G (SHIFT-G) для перемещения к заданной + строке в файле. ** - Замечание: Прочитайте весь урок прежде чем выполнять любые команды!! +Замечание! Прочитайте весь урок прежде чем выполнять любые команды! - 1. Удерживая клавишу Ctrl нажмите g . Внизу экрана появится строка статуса с - именем файла и номером строки, в которой Вы находитесь. Запомните номер + 1. Удерживая клавишу Ctrl нажмите g . Внизу экрана появится строка статуса + с именем файла и номером строки, в которой вы находитесь. Запомните номер строки, он потребуется на Шаге 3. - 2. Нажмите shift-G для перемещения к концу файла. + 2. Удерживая клавишу Shift нажмите g для перемещения к концу файла. - 3. Наберите номер строки, в которой вы находились и затем shift-G. Это - вернет Вас к строке, в которой Вы были, когда в первый раз нажали Ctrl-g. - (Когда Вы будете набирать цифры, они НЕ отобразятся на экране.) - - 4. Если Вы запомнили все вышесказанное, выполните шаги 1--3. + 3. Наберите номер строки, в которой вы находились и затем Shift-G. Это + вернёт вас к строке, в которой вы были, когда в первый раз нажали Ctrl-g. + 4. Если вы запомнили все вышесказанное, выполните шаги с 1 по 3. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 4.2: КОМАНДА ПОИСКА + Урок 4.2: КОМАНДА ПОИСКА - ** Наберите / и затем введите искомую фразу. ** + + ** Наберите / и затем введите искомую фразу. ** 1. В обычном режиме (Normal mode) наберите символ / . Обратите внимание, что он вместе с курсором появится внизу экрана, как это происходит с - командой : . + командой : . - 2. Теперь наберите 'ошшшибка' . Это то слово, которое Вы будете + 2. Теперь наберите 'ошшшибка' . Это то слово, которое вы будете искать. - 3. Для того, чтобы повторить поиск, просто нажмите n . - Для поиска этой фразы в обратном направлении, нажмите Shift-N . + 3. Для того, чтобы повторить поиск, просто нажмите n . + Для поиска этой же фразы в обратном направлении, нажмите Shift-N . - 4. Если Вы желаете сразу искать в обратном направлении, используйте - команду ? вместо / . + 4. Если вы желаете сразу искать в обратном направлении, используйте + команду ? вместо / . ----> Когда Вы при поиске достигнете конца файла, поиск будет продолжен с - начала. + 5. Для того, чтобы вернуться туда, откуда вы начали поиск нажмите Ctrl-O. + (Удерживая нажатой клавишу Ctrl нажмите o ). Повторите несколько раз + для дальнейшего перехода. Для перехода вперёд используйте Ctrl-I . - "ошшшибка" это не способ произнесения слова `ошибка'; ошшшибка это ошибка. +---> "ошшшибка" это не способ написания слова `ошибка'; ошшшибка это ошибка. + +Замечание! Если при поиске будет достигнут конц файла, то поиск будет продолжен + с начала. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Урок 4.3: ПОИСК ПАРНЫХ СКОБОК - ** Наберите % для поиска парных ),] или } . ** + ** Наберите % для поиска парных ), ] или } . ** - 1. Поместите курсор над любой из (, [ или { в строке внизу, помеченной --->. + 1. Поместите курсор над любой из (, [ или { в строке ниже, помеченной --->. - 2. Теперь наберите символ % . + 2. Теперь наберите символ % . 3. Курсор должен перескочить на парную скобку. - 4. Наберите % для возврата курсора назад к первой скобке. + 4. Наберите % для возврата курсора назад к первой скобке. ---> Это ( строка, содержащая такие (, такие [ ] и такие { } скобки. )) -Замечание: Это очень удобно при отладке программ с пропущенными скобками! - - - - - +Замечание! Это очень удобно при отладке программ с пропущенными скобками! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Урок 4.4: СПОСОБ ИСПРАВЛЕНИЯ ОШИБОК - ** Наберите :s/было/стало/g для замены 'было' на 'стало'. ** + ** Наберите :s/было/стало/g для замены 'было' на 'стало'. ** - 1. Переместите курсор вниз, к строке, помеченной --->. + 1. Переместите курсор вниз, к строке помеченной --->. - 2. Наберите :s/уводю/увожу . Обратите внимание на то, что эта команда - заменит только первое найденное вхождение в строке. + 2. Наберите :s/уводю/увожу . Обратите внимание на то, что эта + команда заменит только первое найденное вхождение в строке. - 3. Теперь наберите :s/уводю/увожу/g , означающее подстановку глобально во - всей строке. Это заменит все найденные в строке вхождения. + 3. Теперь наберите :s/уводю/увожу/g , добавленная в конце g означает + подстановку глобально во всей строке. Это заменит все найденные в строке + вхождения. ---> Я уводю к отверженным селеньям, я уводю сквозь вековечный стон, я уводю к забытым поколеньям. 4. Для замены всех вхождений последовательности символов между двумя строками, - наберите :#,#s/было/стало/g где #,# --- номера этих строк. - Наберите :%s/было/стало/g для замены всех вхождений во всем файле. - + наберите :#,#s/было/стало/g где #,# -- номера этих строк. + Наберите :%s/было/стало/g для замены всех вхождений во всем файле. + Наберите :%s/было/стало/gc для поиска всех вхождений во всем файле и + запроса подтверждения замены. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 4 - 1. Ctrl-g показывает ваше положение в файле и информацию о нем. - Shift-G перемещает Вас в конец файла. Номер, за которым следует Shift-G - позволяет перейти к строке с этим номером. + РЕЗЮМЕ УРОКА 4 - 2. Нажатие / и затем ввод строки позволяет произвести поиск этой строки - ВПЕРЕД по тексту. - Нажатие ? и затем ввод строки позволяет произвести поиск этой строки + + 1. Ctrl-g показывает ваше положение в файле и информацию о нем. + Shift-G перемещает вас в конец файла. Номер, за которым следует Shift-G + позволяет перейти к строке с этим номером. + gg перемещает вас к первой строке файла. + + 2. Нажатие / и затем ввод строки позволяет произвести поиск этой строки + ВПЕРЁД по тексту. + Нажатие ? и затем ввод строки позволяет произвести поиск этой строки НАЗАД по тексту. - После поиска наберите n для перехода к следующему вхождению искомой + После поиска наберите n для перехода к следующему вхождению искомой строки в том же направлении или Shift-N для перехода в противоположном направлении. - 3. Нажатие % , когда курсор находится на (,),[,],{, или } позволяет найти + 3. Нажатие % , когда курсор находится на (,),[,],{, или } позволяет найти парную скобку. 4. Для подстановки `стало' вместо первого `было' в строке, наберите - :s/old/new + :s/old/new Для подстановки `стало' вместо всех `было' в строке, наберите - :s/old/new/g + :s/old/new/g Для замены в интервале между двумя строками, наберите - :#,#s/old/new/g + :#,#s/old/new/g Для замены всех вхождений `было' на `стало' в файле, наберите - :%s/old/new/g + :%s/old/new/g Чтобы редактор каждый раз запрашивал подтверждение, добавьте 'c' - :%s/old/new/gc + :%s/old/new/gc + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 5.1: КАК ВЫПОЛНИТЬ ВНЕШНЮЮ КОМАНДУ + Урок 5.1: КАК ВЫПОЛНИТЬ ВНЕШНЮЮ КОМАНДУ - ** Наберите :! и затем внешнюю команду, которую следует выполнить. ** + ** Наберите :! и затем внешнюю команду, которую следует выполнить. ** - 1. Наберите уже знакомую Вам команду : для установки курсора в командную - строку редактора. Это позволит Вам ввести команду. + 1. Наберите уже знакомую вам команду : для установки курсора в командную + строку редактора. Это позволит вам ввести команду. - 2. Теперь наберите символ ! (восклицательный знак). Теперь можно исполнить + 2. Теперь наберите символ ! (восклицательный знак). Это позволит выполнить внешнюю команду, используя командную оболочку. - 3. Для примера наберите ls после ! и нажмите . Эта команда выведет - список файлов в текущем каталоге, точно также, как если бы Вы ввели эту - команду в приглашении оболочки. Или попробуйте :!dir , если предыдущая - команда не сработала. + 3. Для примера наберите ls после ! и нажмите . Команда выведет + список файлов в текущем каталоге, точно также, как если бы вы ввели эту + команду в приглашении оболочки. Или попробуйте :!dir , если команда ls + не сработала. ----> Замечание: Таким способом можно выполнить любую внешнюю команду. - ----> Замечание: Все команды, начинающиеся с : , должны завершаться нажатием - . +Замечание! Таким способом можно выполнить любую внешнюю команду с указанием + аргументов. +Замечание! Все команды, начинающиеся с : , должны завершаться нажатием + . Далее на это не всегда будет обращаться особое внимание. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Урок 5.2: КАК ЗАПИСАТЬ ФАЙЛ -** Для сохранения изменений, произведенных в файле, наберите :w ИМЯ_ФАЙЛА. ** + ** Для сохранения изменений, произведённых в файле, + наберите :w ИМЯ_ФАЙЛА. ** - 1. Наберите :!dir или :!ls для получения списка файлов в текущем каталоге. - Как Вам уже известно, Вы должны нажать после ввода этих команд. + 1. Наберите :!dir или :!ls для получения списка файлов в текущем + каталоге. Как вам уже известно, после ввода команды надо нажать . - 2. Придумайте название для файла, которое еще не существует, например TEST. + 2. Придумайте название для файла, которое ещё не существует, например TEST. - 3. Теперь наберите :w TEST (где TEST --- это имя файла, придуманное Вами.) + 3. Теперь наберите :w TEST (где TEST -- это имя файла, придуманное вами.) - 4. Эта команда сохранит весь файл (Учебник по Vim) под именем TEST. Чтобы - удостовериться в этом, снова наберите :!dir и просмотрите каталог. + 4. Команда сохранит весь этот файл (Учебник по Vim) под именем TEST. Чтобы + удостовериться в этом, снова наберите :!dir или :!ls и просмотрите + каталог. ----> Заметьте, что если Вы выйдете из Vim и затем запустите его снова с - файлом TEST, этот файл будет точной копией учебника в тот момент, когда - Вы его сохранили. - - 5. Теперь удалите этот файл, набрав :!del TEST +Замечание! Если вы выйдете из Vim и затем запустите его снова с файлом TEST + (т.е. выполните vim TEST ), этот файл будет точной копией учебника + в тот момент, когда вы его сохранили. + 5. Теперь удалите этот файл, набрав для MS-DOS :!del TEST + для Unix :!rm TEST ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Урок 5.3: ВЫБОРОЧНОЕ СОХРАНЕНИЕ - ** Для сохранения части файла, наберите :#,# w ИМЯ_ФАЙЛА ** + ** Для сохранения части файла, наберите v выберите часть + и сохраните её :w ИМЯ_ФАЙЛА ** - 1. Еще раз наберите :!dir или :!ls для получения списка файлов в текущем - каталоге и выберите подходящее имя, например TEST. + 1. Переместите курсор к этой строке. - 2. Переместите курсор к началу этой страницы и нажмите Ctrl-g для нахождения - номера строкиto. ЗАПОМНИТЕ ЭТОТ НОМЕР! + 2. Нажмите v и переместите курсор ниже к пятому шагу. Обратите внимание, + что текст подсвечен. - 3. Теперь переместитесь в конец страницы и вновь наберите Ctrl-g. ЗАПОМНИТЕ - И ЭТОТ НОМЕР ТОЖЕ! + 3. Нажмите : и внизу экрана появится :'<,'> . - 4. Для сохранения ТОЛЬКО ЧАСТИ файла наберите :#,# w TEST , где #,# --- это - номера, которые Вы запомнили (начало, конец), а TEST --- имя вашего файла. - - 5. Как и прежде, убедитесь в наличии этого файла командой :!dir , но НЕ - УДАЛЯЙТЕ его. + 4. Введите w TEST (где TEST -- имя файла, который ещё не существует). + До нажатия , проверьте что внизу экрана написано :'<,'>w TEST. + 5. Vim запишет выбранные строки в файл TEST. Как и прежде, убедитесь в + наличии этого файла командой :!dir или :!ls . НЕ УДАЛЯЙТЕ этот файл, он + потребуется в следующем уроке. +Замечание! Нажатие v начинает визуальный выбор. Вы можете перемещать курсор + для изменения выбора. Затем для выбранного фрагмента можно выполнить + какой-то оператор, например, удалить нажатием d. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 5.4: ЧТЕНИЕ И ОБЪЕДИНЕНИЕ ФАЙЛОВ + Урок 5.4: ЧТЕНИЕ И ОБЪЕДИНЕНИЕ ФАЙЛОВ - ** Для вставки содержимого файла, наберите :r FILENAME ** - 1. Наберите :!dir для того, чтобы убедиться в том, что файл TEST все еще - существует. + ** Для вставки содержимого из файла, наберите :r ИМЯ_ФАЙЛА ** - 2. Установите курсор в верхней части этой страницы. + 1. Установите курсор над этой строкой. -Замечание: После выполнения шага 3 Вы увидите Урок 5.3. После этого - перемещайтесь ВНИЗ, снова к этому уроку. +Замечание! После выполнения Шага 2 вы увидите текст из Урока 5.3. Переместитесь + ВНИЗ по тексту до этого урока. - 3. Теперь прочитайте Ваш файл TEST, используя команду :r TEST , где - TEST --- это имя файла. + 2. Теперь прочитайте ваш файл TEST, используя команду :r TEST , где TEST -- + это имя файла. -Замечание: Прочитанный Вами файл будет вставлен в том месте, где находится - курсор. + 3. Для проверки что содержимое файла было вставлено, переместитесь по тексту + и удостоверьтесь, что теперь в нём две копии Урока 5.3: исходная и из + файла TEST. - 4. Чтобы убедиться в том, что файл прочитан, переместитесь немного назад по - тексту и заметьте, что теперь существуют две копии Урока 5.3, исходная - и полученная из файла. +Замечание! Вставить можно и вывод внешней команды. Например, :r !ls прочитает + вывод команды ls и вставит его ниже курсора. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 5 + РЕЗЮМЕ УРОКА 5 1. :!команда исполняет внешнюю команду. Некоторые полезные примеры: - :!dir --- выводит список файлов в каталоге. - :!del FILENAME --- удаляет файл FILENAME. - - 2. :w FILENAME записывает текущий редактируемый файл на диск - под именем FILENAME. - - 3. :#,#w FILENAME сохраняет строки от # до # в файл FILENAME. - - 4. :r FILENAME считывает с диска файл FILENAME и помещает его в текущий - файл следом за позицией курсора. - - + (MS-DOS) (Unix) + :!dir :!ls -- вывести список файлов в каталоге. + :!del ИМЯ :!rm ИМЯ -- удалить файл по имени. + 2. :w ИМЯ_ФАЙЛА записывает текущий редактируемый в Vim файл на диск под + указанным именем. + 3. v перемещение :w ИМЯ_ФАЙЛА сохраняет визуально выбранные строки в файл + с указанным именем. + 4. :r ИМЯ_ФАЙЛА считывает с диска файл с указанным именем и помещает его + ниже курсора. + 5. :r !dir читает вывод команды dir и помещает его ниже курсора. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 6.1: КОМАНДА СОЗДАНИЯ + Урок 6.1: КОМАНДА СОЗДАНИЯ - ** Наберите o чтобы создать пустую строку под курсором и перейти в режим - вставки (Insert mode) ** + ** Наберите o чтобы создать пустую строку под курсором и перейти в режим + вставки (Insert mode) ** - 1. Переместите курсор вниз, к строке, помеченной --->. + 1. Переместите курсор вниз, к строке помеченной --->. - 2. Наберите o (в нижнем регистре) для того, чтобы создать пустую строку + 2. Наберите o (в нижнем регистре) для того, чтобы создать пустую строку НИЖЕ курсора и перейти в режим вставки (Insert mode). - 3. Теперь скопируйте помеченную ---> строку и нажмите для выхода из - режима вставки. - ----> После нажатия o курсор перейдет на новую пустую строку в режиме вставки. - - 4. Для создания строки ВЫШЕ курсора, просто наберите заглавную O, вместо - строчной o. Попробуйте проделать это с нижеследующей строкой. -Создайте новую строку над этой, нажав Shift-O, поместив курсор на эту строку. + 3. Теперь наберите какой-нибудь текст и нажмите для выхода из режима + вставки. +---> После нажатия o курсор перейдёт на новую пустую строку в режиме вставки. + 4. Для создания строки ВЫШЕ курсора, просто наберите заглавную O , вместо + строчной o . Попробуйте проделать это с нижеследующей строкой. +---> Создайте новую строку над этой, поместив на неё курсор и нажав Shift-O. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Урок 6.2: КОМАНДА ДОБАВЛЕНИЯ - ** Наберите a , чтобы вставить текст ПОСЛЕ курсора. ** - 1. Переместите курсор вниз, в конец первой строки, помеченной ---> , - набрав $ в обычном режиме (Normal mode). + ** Наберите a , чтобы вставить текст ПОСЛЕ курсора. ** - 2. Наберите a (в нижнем регистре) для добавления текста ПОСЛЕ символа, + 1. Переместите курсор вниз, в начало первой строки помеченной --->. + + 2. Набирайте e пока курсор не переместиться на конец cтро . + + 3. Наберите a (в нижнем регистре) для добавления текста ПОСЛЕ символа, находящегося под курсором. (Заглавная A позволяет добавить в конец строки.) -Замечание: Это позволяет избежать нажатия i , последнего символа, текста для - вставки, , курсор-вправо, и, наконец, x , просто для того, - чтобы добавить тест в конец строки! - - 3. Теперь завершите первую строку. Заметьте также, что добавление это в - точности то же самое, что и режим вставки, за исключением позиции, в - которую будет вставлен текст. - ----> Эта строчка позволит Вам попрактиковаться ----> Эта строчка позволит Вам попрактиковаться в добавлении текста в конец - строки. -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 6.3: ЕЩЕ ОДИН СПОСОБ ЗАМЕНЫ - - - ** Наберите заглавную R для замены более, чем одного символа. ** - - 1. Переместите курсор вниз, к строке, помеченной --->. - - 2. Расположите курсор в начале первого слова, отличающегося от - соответствующего в следующей строке, помеченной ---> (слово 'последней'). - - 3. Теперь наберите R и замените остаток текста в первой строке, набрав - поверх старого текста так, чтобы обе строки стали одинаковыми. - ----> Первую строку можно сравнять с последней, используя клавиши. ----> Первую строку можно сравнять с второй, используя R и набрав новый текст. - - 4. Обратите внимание, что при нажатии для завершения, любой - не измененный текст сохранится. + 4. Допишите слово так, как показано в строке ниже. Нажмите для выхода + из режима вставки (Insert mode). + 5. Используйте e для перехода к концу следующего незавершённого слова и + повторите шаги 3 и 4. +---> Эта стро позволит вам попрактиков в добавле текста. +---> Эта строчка позволит вам попрактиковаться в добавлении текста. +Замечание! a , i и A переводят в один и тот же режим вставки, различие + только в том, где вставляются символы. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 6.4: УСТАНОВКА ПАРАМЕТРОВ + Урок 6.3: ЕЩЁ ОДИН СПОСОБ ЗАМЕНЫ -** Установим параметры так, чтобы игнорировать регистр при поиске или замене ** + ** Наберите заглавную R для замены более чем одного символа. ** + + 1. Переместите курсор вниз, к первой строке помеченной --->, и в начало + первого слова xxx. + + 2. Теперь нажмите R и введите число указанный ниже во второй строке чтобы + заменить xxx. + + 3. Нажмите для выхода из режима замены. Заметьте что остаток строки + не был изменён. + + 4. Повторите эти шаги для замены оставшихся xxx. + +---> Добавление 123 к xxx даёт xxx. +---> Добавление 123 к 456 даёт 579. + +Замечание! Режим замены похож на режим вставки, но каждый введённый символ + удаляет существующий. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.4: КОПИРОВАНИЕ И ВСТАВКА ТЕКСТА - 1. Поищите слово 'игнорировать', набрав: - /игнорировать - Повторите поиск несколько раз, нажимая клавишу n + ** Используйте команду y для копирования и p для вставки ** - 2. Включите параметр 'ic' (Игнорировать регистр), набрав: - :set ic + 1. Переместите курсор вниз, к первой строке помеченной --->, и после `а)'. - 3. Теперь снова сделайте поиск слова 'игнорировать', нажав: n - Повторите поиск несколько раз, нажимая клавишу n + 2. Переключитесь в режим визуального выбора нажав v и переместите курсор + перед словом `первый'. - 4. Включите параметры 'hlsearch' и 'incsearch': - :set hls is + 3. Введите y для копирования подсвеченного текста. + + 4. Переместите курсор в конец следующей строки комбинацией j$ . + + 5. Нажмите p для вставки текста. Затем введите `второй' и нажмите . + +---> а) Этот элемент первый. + б) + +Замечание! Также возможно использовать yw (команду y с оператором w ) для + копирования одного слова. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Урок 6.5: УСТАНОВКА ПАРАМЕТРОВ + + + ** Установка параметра для игнорирования регистра при поиске или замене ** + + 1. Найдите слово `игнорировать', набрав: /игнорировать . + Повторите поиск несколько раз, нажимая клавишу n . + + 2. Установите параметр `ic' (игнорировать регистр), набрав: :set ic + + 3. Теперь снова несколько раз сделайте поиск слова `игнорировать', + нажимая: n + Заметьте, что теперь находятся `Игнорировать' и `ИГНОРИРОВАТЬ'. + + 4. Установите параметры `hlsearch' и `incsearch': :set hls is 5. Теперь опять введите команду поиска и посмотрите, что получится: - /игнорировать + /игнорировать + 6. Для возвращения учёта регистра при поиске наберите: :set noic +Замечание! Для отключения подсветки совпадений наберите: :nohlsearch + +Замечание! Если вы хотите игнорировать регистр только для одного поиска, + используйте \с в команде поиска: /игнорировать\c ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - РЕЗЮМЕ УРОКА 6 + РЕЗЮМЕ УРОКА 6 - 1. Нажатие o создает строку НИЖЕ курсора и перемещает курсор в нее в режиме - вставки. - Нажатие заглавной O создает строку ВЫШЕ строки, в которой находится - курсор. + 1. Нажмите o для создания строки НИЖЕ курсора и перехода в режим вставки. + Нажмите O для создания строки ВЫШЕ курсора. - 2. Наберите a для вставки текста ПОСЛЕ символа, на котором находится курсор. - Нажатие заглавной A автоматически перемещает Вас для добавления текста - в конец строки. - - 3. Нажатие заглавной R переводит Вас в режим замены до тех пор, пока не - будет нажата клавиша для завершения. - - 4. Набрав ":set xxx" вы сможете включить параметр "xxx" + 2. Нажмите a для вставки текста ПОСЛЕ курсора. + Нажмите A для вставки текста в конец строки. + 3. Команда e подводит курсор к концу слова. + 4. Команда y копирует текст, p -- вставляет скопированный текст. + 5. Нажатие заглавной R переводит в режим замены до нажатия клавиши . + 6. Наберите `:set xxx' для включения параметра `xxx', некоторые параметры: + `ic' `ignorecase' игнорирование регистра при поиске + `is' `incsearch' отображение частичных совпадений при поиске + `hls' `hlsearch' подсветка всех совпадений при поиске + 7. Добавьте `no' перед параметром для его отключения: :set noic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 7: КОМАНДЫ ПОЛУЧЕНИЯ ВСТРОЕННОЙ СПРАВКИ + Урок 7.1: ВСТРОЕННАЯ СПРАВКА - ** Используйте встроенную справочную систему ** + + ** Используйте встроенную справочную систему ** Vim обладает мощной встроенной справочной системой. Для начала попробуйте - один из трех вариантов: + один из трёх вариантов: - нажмите клавишу (если таковая имеется на клавиатуре) - нажмите клавишу (если таковая имеется на клавиатуре) - наберите :help + Прочитайте текст в окне справки для получения представления о том как + работает справка. + Нажмите CTRL-W CTRL-W для перехода от окна к окну. Наберите :q чтобы закрыть окно справки. - Вы можете найти справку для любого понятия или команды, просто задав - соответствующий аргумент команде ":help". Попробуйте следующее (не забудьте - нажать ): - - :help w - :help c_): + :help w + :help c_CTRL-D + :help insert-index + :help user-manual ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Урок 8: СОЗДАНИЕ СТАРТОВОГО СКРИПТА + Урок 7.2: СОЗДАНИЕ СТАРТОВОГО СЦЕНАРИЯ - ** Включим возможности Vim ** - Vim имеет намного больше возможностей, чем Vi, однако большинствао из них - выключены по умолчанию. Для того, чтобы начать использовать новые - возможности Вам следует создать файл "vimrc". + ** Включим возможности Vim ** - 1. Отредактируйте файл "vimrc", его расположение зависит от используемой - системы: + Vim имеет намного больше возможностей, чем Vi, но большинство из них по + умолчанию выключены. Для использования больших возможностей вам следует + создать файл `vimrc'. - :edit ~/.vimrc для Unix - :edit $VIM/_vimrc для MS-Windows + 1. Отредактируйте новый файл `vimrc'. Его расположение зависит от + используемой системы: + :e ~/.vimrc для Unix + :e $VIM/_vimrc для MS-Windows - 2. Теперь прочитайте пример файла "vimrc": + 2. Теперь прочитайте пример файла `vimrc': + :r $VIMRUNTIME/vimrc_example.vim - :read $VIMRUNTIME/vimrc_example.vim - - 3. Запишите файл: - - :write + 3. Запишите созданный вами новый файл `vimrc': + :w Теперь при следующем запуске Vim будет включена подсветка синтаксиса. Все - настройки, предпочитаемые Вами, могут быть добавлены в файл "vimrc". + настройки, предпочитаемые вами, могут быть добавлены в файл `vimrc'. + Для дальнейшей информации наберите :help vimrc-intro ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - На этом завершается Учебник Vim. Он был предназначен для того, чтобы дать - общее представление о редакторе Vim, достаточное для того, чтобы с легкостью - использовать его. Учебник далек от полноты, поскольку Vim имеет очень много - команд. Прочитайте теперь руководство пользователя: ":help user-manual". + Урок 7.3: ДОПОЛНЕНИЕ + + + ** Командную строку можно дополнить нажав CTRL-D и ** + + 1. Удостоверьтесь, что Vim не в режиме совместимости: :set nocp + + 2. Посмотрите какие файлы есть в каталоге: :!ls или :!dir + + 3. Наберите начало команды: :e + + 4. Нажмите CTRL-D и Vim отобразит список команд начинающихся на `e'. + + 5. Нажмите и Vim дополнит название команды до `:edit'. + + 6. Теперь добавьте пробел и начало существующего имени файла: :edit ФАЙ + + 7. Нажмите и Vim дополнит имя файла, если оно уникальное. + +Замечание! Дополнение работает для многих команд. Попробуйте нажать CTRL-D и + . Это особенно полезно для команды :help . + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + РЕЗЮМЕ УРОКА 7 + + + 1. Наберите :help или нажмите , или для открытия окна справки. + + 2. Наберите :help cmd для поиска справки по команде. + + 3. Нажмите CTRL-W CTRL-W для перехода к другому окну. + + 4. Наберите :q для закрытия окна справки (если оно активно). + + 5. Для хранения ваших настроек создайте стартовый сценарий `vimrc'. + + 6. При наборе : команды, нажмите CTRL-D для отображения возможных + дополнений. Нажмите для использования дополнения. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + На этом завершается Учебник Vim. Он был предназначен дать общее представление + о редакторе Vim, достаточное для того, чтобы с лёгкостью использовать его. + Учебник далёк от полноты, поскольку Vim имеет очень много команд. Прочитайте + теперь руководство пользователя: `:help user-manual'. Для дальнейшего чтения рекомендуется книга: - Vim - Vi Improved - Автор: Steve Oualline - Издатель: New Riders - Эта книга полностью посвящена Vim. Особенно полезна новичкам. Содержит - множество примеров и иллюстраций. - Взгляните на See http://iccf-holland.org/click5.html + Vim - Vi Improved, автор: Steve Oualline, издатель: New Riders + + Эта книга полностью посвящена Vim. Особенно полезна она будет новичкам. + Содержит множество примеров и иллюстраций. + См. http://iccf-holland.org/click5.html Следующая книга более почтенного возраста и посвящена больше Vi, чем Vim, однако также рекомендуется: - Learning the Vi Editor - Автор: Linda Lamb - Издатель: O'Reilly & Associates Inc. - Это хорошая книга для того, чтобы узнать все, что только можно проделывать с - Vi. Шестое издание также включает информацию о Vim. + Learning the Vi Editor, автор: Linda Lamb, + издатель: O'Reilly & Associates Inc. - Этот учебник был написан Michael C. Pierce и Robert K. Ware, Colorado School - of Mines с использованием идей, предложенных Charles Smith, Colorado State + Это хорошая книга, чтобы узнать всё, что только можно сделать в Vi. Шестое + издание также включает информацию о Vim. + + Этот учебник написал Michael C. Pierce и Robert K. Ware, Colorado School of + Mines с использованием идей, которые предложил Charles Smith, Colorado State University. E-mail: bware@mines.colorado.edu. - Доработано для Vim Bram Moolenaar. + Доработано для Vim Брамом Моленаром (Bram Moolenaar). + + Перевод: + Андрей Киселев , 2002. + Сергей Алёшин , 2014. + + Translators: + Andrey Kiselev , 2002. + Sergey Alyoshin , 2014. - Перевод: Андрей Киселев , 2002. - Translator: Andrey Kiselev , 2002. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/po/ru.cp1251.po b/src/po/ru.cp1251.po index 8205c813db..6582507ebd 100644 --- a/src/po/ru.cp1251.po +++ b/src/po/ru.cp1251.po @@ -7,10 +7,10 @@ # msgid "" msgstr "" -"Project-Id-Version: vim_7.4_ru\n" +"Project-Id-Version: vim_ru\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-24 12:18+0400\n" -"PO-Revision-Date: 2014-03-24 12:18 +0400\n" +"POT-Creation-Date: 2014-10-10 11:52+0400\n" +"PO-Revision-Date: 2014-10-10 12:00+0400\n" "Last-Translator: Sergey Alyoshin \n" "Language-Team: \n" "Language: Russian\n" @@ -203,6 +203,21 @@ msgstr " msgid " line=%ld id=%d name=%s" msgstr " =%ld id=%d =%s" +msgid "E821: File is encrypted with unknown method" +msgstr "E821: " + +msgid "Enter encryption key: " +msgstr " : " + +msgid "Enter same key again: " +msgstr " : " + +msgid "Keys don't match!" +msgstr " !" + +msgid "[crypted]" +msgstr "[]" + #, c-format msgid "E96: Can not diff more than %ld buffers" msgstr "E96: %ld " @@ -659,9 +674,16 @@ msgstr "E258: msgid "sort() argument" msgstr " sort()" +msgid "uniq() argument" +msgstr " uniq()" + msgid "E702: Sort compare function failed" msgstr "E702: " +msgid "E882: Uniq compare function failed" +msgstr "" +"E882: " + msgid "(Invalid)" msgstr "()" @@ -759,10 +781,12 @@ msgid "E129: Function name required" msgstr "E129: " #, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "" -"E128: " -": %s" +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: : %s" #, c-format msgid "E131: Cannot delete function %s: It is in use" @@ -880,6 +904,10 @@ msgstr "E138: msgid "Writing viminfo file \"%s\"" msgstr " viminfo \"%s\"" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: viminfo %s!" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" @@ -1080,6 +1108,10 @@ msgstr "E158: msgid "E157: Invalid sign ID: %ld" msgstr "E157: ID : %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: %s" + msgid " (NOT FOUND)" msgstr " ( )" @@ -1663,12 +1695,6 @@ msgstr "[ msgid "[converted]" msgstr "[]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ %ld]" @@ -1689,9 +1715,6 @@ msgstr " msgid "can't read output of 'charconvert'" msgstr " 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: " - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: acwrite" @@ -2654,6 +2677,13 @@ msgstr "" "E263: , " "Python" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: , " +"Python site." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Python" @@ -4068,15 +4098,6 @@ msgstr "E548: msgid "E549: Illegal percentage" msgstr "E549: " -msgid "Enter encryption key: " -msgstr " : " - -msgid "Enter same key again: " -msgstr " : " - -msgid "Keys don't match!" -msgstr " !" - msgid "E854: path too long for completion" msgstr "E854: " @@ -4248,6 +4269,13 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: " +"" + #, c-format msgid "%ld Cols; " msgstr ": %ld; " @@ -4565,6 +4593,19 @@ msgstr "" "\n" " " +msgid "Could not set security context " +msgstr " " + +msgid " for " +msgstr " " + +#. no enough size OR unexpected error +msgid "Could not get security context " +msgstr " " + +msgid ". Removing it!\n" +msgstr ". !\n" + msgid "" "\n" "Cannot execute shell " @@ -4834,6 +4875,10 @@ msgstr "E554: msgid "External submatches:\n" msgstr " :\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (. ) %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " @@ -6232,6 +6277,9 @@ msgstr "E446: msgid "E447: Can't find file \"%s\" in path" msgstr "E447: \"%s\" " +msgid "List or number required" +msgstr " " + #, c-format msgid "E370: Could not load library %s" msgstr "E370: %s" @@ -6888,3 +6936,4 @@ msgid "" msgstr "" " : sys.path \n" " vim.VIM_SPECIAL_PATH sys.path" + diff --git a/src/po/ru.po b/src/po/ru.po index 1d7f16deb0..2c15b757b7 100644 --- a/src/po/ru.po +++ b/src/po/ru.po @@ -7,10 +7,10 @@ # msgid "" msgstr "" -"Project-Id-Version: vim_7.4_ru\n" +"Project-Id-Version: vim_ru\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-24 12:18+0400\n" -"PO-Revision-Date: 2014-03-24 12:18 +0400\n" +"POT-Creation-Date: 2014-10-10 11:52+0400\n" +"PO-Revision-Date: 2014-10-10 12:00+0400\n" "Last-Translator: Sergey Alyoshin \n" "Language-Team: \n" "Language: Russian\n" @@ -203,6 +203,21 @@ msgstr "Значки для %s:" msgid " line=%ld id=%d name=%s" msgstr " строка=%ld id=%d имя=%s" +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Файл зашифрован неизвестным методом" + +msgid "Enter encryption key: " +msgstr "Введите пароль для шифрования: " + +msgid "Enter same key again: " +msgstr "Повторите ввод пароля: " + +msgid "Keys don't match!" +msgstr "Введённые пароли не совпадают!" + +msgid "[crypted]" +msgstr "[зашифровано]" + #, c-format msgid "E96: Can not diff more than %ld buffers" msgstr "E96: Следить за отличиями можно не более чем в %ld буферах" @@ -659,9 +674,16 @@ msgstr "E258: Не могу ответить клиенту" msgid "sort() argument" msgstr "параметра sort()" +msgid "uniq() argument" +msgstr "параметра uniq()" + msgid "E702: Sort compare function failed" msgstr "E702: Неудачное завершение функции сравнения при сортировке" +msgid "E882: Uniq compare function failed" +msgstr "" +"E882: Неудачное завершение функции сравнения при проверке единственности" + msgid "(Invalid)" msgstr "(Неправильно)" @@ -759,10 +781,12 @@ msgid "E129: Function name required" msgstr "E129: Требуется имя функции" #, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "" -"E128: Имя функции должно начинаться с заглавной буквы или содержать " -"двоеточие: %s" +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Имя функции должно начинаться с заглавной буквы или \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Имя функции не может содержать двоеточие: %s" #, c-format msgid "E131: Cannot delete function %s: It is in use" @@ -880,6 +904,10 @@ msgstr "E138: Невозможно записать файл viminfo %s!" msgid "Writing viminfo file \"%s\"" msgstr "Запись файла viminfo \"%s\"" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Невозможно переименовать файл viminfo в %s!" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" @@ -1080,6 +1108,10 @@ msgstr "E158: Неправильное имя буфера: %s" msgid "E157: Invalid sign ID: %ld" msgstr "E157: Неправильный ID значка: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Невозможно изменить значок %s" + msgid " (NOT FOUND)" msgstr " (НЕ НАЙДЕНО)" @@ -1663,12 +1695,6 @@ msgstr "[БЕЗ преобразований]" msgid "[converted]" msgstr "[перекодировано]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[зашифровано]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ОШИБКА ПРЕОБРАЗОВАНИЯ в строке %ld]" @@ -1689,9 +1715,6 @@ msgstr "Преобразование с помощью 'charconvert' не вып msgid "can't read output of 'charconvert'" msgstr "невозможно прочитать вывод 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: Файл зашифрован неизвестным методом" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Нет подходящих автокоманд для буфера acwrite" @@ -2654,6 +2677,13 @@ msgstr "" "E263: К сожалению эта команда не работает, поскольку не загружена библиотека " "Python" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: К сожалению эта команда не работает, поскольку не загружен модуль " +"Python site." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Невозможно выполнить рекурсивный вызов Python" @@ -4068,15 +4098,6 @@ msgstr "E548: Требуется ввести цифру" msgid "E549: Illegal percentage" msgstr "E549: Недопустимое значение процентов" -msgid "Enter encryption key: " -msgstr "Введите пароль для шифрования: " - -msgid "Enter same key again: " -msgstr "Повторите ввод пароля: " - -msgid "Keys don't match!" -msgstr "Введённые пароли не совпадают!" - msgid "E854: path too long for completion" msgstr "E854: слишком большой путь для автодополнения" @@ -4248,6 +4269,13 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Неизвестный тип регистра %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: шаблон поиска и регистр выражения не могут содержать двух или более " +"строк" + #, c-format msgid "%ld Cols; " msgstr "Колонок: %ld; " @@ -4565,6 +4593,19 @@ msgstr "" "\n" "Невозможно установить контекст безопасности для " +msgid "Could not set security context " +msgstr "Невозможно установить контекст безопасности " + +msgid " for " +msgstr " для " + +#. no enough size OR unexpected error +msgid "Could not get security context " +msgstr "Невозможно получить контекст безопасности " + +msgid ". Removing it!\n" +msgstr ". Будет удалён!\n" + msgid "" "\n" "Cannot execute shell " @@ -4834,6 +4875,10 @@ msgstr "E554: Синтаксическая ошибка в %s{...}" msgid "External submatches:\n" msgstr "Внешние подсоответствия:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (рег. выражение НКА) невозможно повторить %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " @@ -6232,6 +6277,9 @@ msgstr "E446: Нет имени файла в позиции курсора" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Файл \"%s\" не найден по известным путям" +msgid "List or number required" +msgstr "Требуется список или число" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: Невозможно загрузить библиотеку %s" @@ -6888,3 +6936,4 @@ msgid "" msgstr "" "Ошибка при установке пути: sys.path не является списком\n" "Следует добавить vim.VIM_SPECIAL_PATH в sys.path" + From 1818e826c7ed867b062ac35f251a694da98169a5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 16 Oct 2014 11:16:37 +0200 Subject: [PATCH 153/311] updated for version 7.4.480 Problem: MS-Windows: Can't build. Solution: Remove goto, use a flag instead. --- src/os_win32.c | 32 +++++++++++++++++--------------- src/version.c | 2 ++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/os_win32.c b/src/os_win32.c index a831ada54c..c03b963c4f 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -4646,9 +4646,10 @@ mch_call_shell( int x = 0; int tmode = cur_tmode; #ifdef FEAT_TITLE - char szShellTitle[512]; - + char szShellTitle[512]; # ifdef FEAT_MBYTE + int did_set_title = FALSE; + /* Change the title to reflect that we are in a subshell. */ if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { @@ -4671,25 +4672,26 @@ mch_call_shell( wcscat(szShellTitle, wn); SetConsoleTitleW(szShellTitle); vim_free(wn); - goto didset; + did_set_title = TRUE; } } } } -#endif - /* Change the title to reflect that we are in a subshell. */ - if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0) - { - if (cmd == NULL) - strcat(szShellTitle, " :sh"); - else + if (!did_set_title) +# endif + /* Change the title to reflect that we are in a subshell. */ + if (GetConsoleTitle(szShellTitle, sizeof(szShellTitle) - 4) > 0) { - strcat(szShellTitle, " - !"); - if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle))) - strcat(szShellTitle, cmd); + if (cmd == NULL) + strcat(szShellTitle, " :sh"); + else + { + strcat(szShellTitle, " - !"); + if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle))) + strcat(szShellTitle, cmd); + } + SetConsoleTitle(szShellTitle); } - SetConsoleTitle(szShellTitle); - } #endif out_flush(); diff --git a/src/version.c b/src/version.c index 3388fafec6..01fdef61c7 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 480, /**/ 479, /**/ From 1803e7b50c8a4285d25b087158b3077ce61007f4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 16 Oct 2014 15:35:36 +0200 Subject: [PATCH 154/311] updated for version 7.4.481 Problem: Compiler warning on MS-Windows. Solution: Add type casts. (Ken Takata) --- src/os_mswin.c | 5 +++-- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/os_mswin.c b/src/os_mswin.c index dfd40af8de..0dfd7d6091 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -1644,10 +1644,11 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) char_u *to_free = NULL; int maxlen; - acp_to_enc(printer_name, STRLEN(printer_name), &to_free, &maxlen); + acp_to_enc(printer_name, (int)STRLEN(printer_name), &to_free, + &maxlen); if (to_free != NULL) printer_name = to_free; - acp_to_enc(port_name, STRLEN(port_name), &to_free, &maxlen); + acp_to_enc(port_name, (int)STRLEN(port_name), &to_free, &maxlen); if (to_free != NULL) port_name = to_free; } diff --git a/src/version.c b/src/version.c index 01fdef61c7..7923a4d936 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 481, /**/ 480, /**/ From b06bb5e4f19f00a1a3e1c09daa55ca19e9ee5b43 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 21 Oct 2014 10:15:17 +0200 Subject: [PATCH 155/311] updated for version 7.4.482 Problem: When 'balloonexpr' results in a list, the text has a trailing newline. (Lcd) Solution: Remove one trailing newline. --- src/gui_beval.c | 11 +++++++++++ src/version.c | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/gui_beval.c b/src/gui_beval.c index ae78456607..b3e51fb843 100644 --- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -30,6 +30,7 @@ general_beval_cb(beval, state) long winnr = 0; char_u *bexpr; buf_T *save_curbuf; + size_t len; # ifdef FEAT_WINDOWS win_T *cw; # endif @@ -83,6 +84,16 @@ general_beval_cb(beval, state) vim_free(result); result = eval_to_string(bexpr, NULL, TRUE); + /* Remove one trailing newline, it is added when the result was a + * list and it's hardly every useful. If the user really wants a + * trailing newline he can add two and one remains. */ + if (result != NULL) + { + len = STRLEN(result); + if (len > 0 && result[len - 1] == NL) + result[len - 1] = NUL; + } + if (use_sandbox) --sandbox; --textlock; diff --git a/src/version.c b/src/version.c index 7923a4d936..7540f8ddc4 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 482, /**/ 481, /**/ From 2bd88902885c0d7aa2251d7eeb97174aefe51622 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 21 Oct 2014 12:22:17 +0200 Subject: [PATCH 156/311] updated for version 7.4.483 Problem: A 0x80 byte is not handled correctly in abbreviations. Solution: Unescape special characters. Add a test. (Christian Brabandt) --- src/getchar.c | 16 +++++++++++++++- src/testdir/Make_amiga.mak | 1 + src/testdir/Make_dos.mak | 1 + src/testdir/Make_ming.mak | 1 + src/testdir/Make_os2.mak | 1 + src/testdir/Make_vms.mms | 1 + src/testdir/Makefile | 1 + src/testdir/test_mapping.in | 15 +++++++++++++++ src/testdir/test_mapping.ok | 2 ++ src/version.c | 2 ++ 10 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 src/testdir/test_mapping.in create mode 100644 src/testdir/test_mapping.ok diff --git a/src/getchar.c b/src/getchar.c index 9edb767e1b..cc93a7dd81 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -4443,6 +4443,7 @@ check_abbr(c, ptr, col, mincol) #endif int is_id = TRUE; int vim_abbr; + int qlen; /* length of q, CSI/K_SPECIAL unescaped */ if (typebuf.tb_no_abbr_cnt) /* abbrev. are not recursive */ return FALSE; @@ -4520,6 +4521,19 @@ check_abbr(c, ptr, col, mincol) #else mp = first_abbr; #endif + qlen = mp->m_keylen; + if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL) + { + char_u *q = vim_strsave(mp->m_keys); + + /* might have CSI escaped mp->m_keys */ + if (q != NULL) + { + vim_unescape_csi(q); + qlen = STRLEN(q); + vim_free(q); + } + } for ( ; mp; #ifdef FEAT_LOCALMAP mp->m_next == NULL ? (mp = mp2, mp2 = NULL) : @@ -4528,7 +4542,7 @@ check_abbr(c, ptr, col, mincol) { /* find entries with right mode and keys */ if ( (mp->m_mode & State) - && mp->m_keylen == len + && qlen == len && !STRNCMP(mp->m_keys, ptr, (size_t)len)) break; } diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 5012812448..c0df2c1b56 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -43,6 +43,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_insertcount.out \ test_listlbr.out \ test_listlbr_utf8.out \ + test_mapping.out \ test_options.out \ test_qf_title.out \ test_utf8.out diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 38264f2eaf..91500439fd 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -42,6 +42,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_insertcount.out \ test_listlbr.out \ test_listlbr_utf8.out \ + test_mapping.out \ test_options.out \ test_qf_title.out \ test_utf8.out diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 782f89d646..247c0f259d 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -62,6 +62,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_insertcount.out \ test_listlbr.out \ test_listlbr_utf8.out \ + test_mapping.out \ test_options.out \ test_qf_title.out \ test_utf8.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index d3e833793a..cfade3f7f7 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -44,6 +44,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_insertcount.out \ test_listlbr.out \ test_listlbr_utf8.out \ + test_mapping.out \ test_options.out \ test_qf_title.out \ test_utf8.out diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 3c7afc346d..6483b7ce3a 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -103,6 +103,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test_insertcount.out \ test_listlbr.out \ test_listlbr_utf8.out \ + test_mapping.out \ test_options.out \ test_qf_title.out \ test_utf8.out diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 59fe011696..41f25cfbd1 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -40,6 +40,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test_insertcount.out \ test_listlbr.out \ test_listlbr_utf8.out \ + test_mapping.out \ test_options.out \ test_qf_title.out \ test_utf8.out diff --git a/src/testdir/test_mapping.in b/src/testdir/test_mapping.in new file mode 100644 index 0000000000..55dac09bed --- /dev/null +++ b/src/testdir/test_mapping.in @@ -0,0 +1,15 @@ +Test for mappings and abbreviations + +STARTTEST +:so small.vim +:so mbyte.vim +: " abbreviations with р (0x80) should work +:inoreab чкпр vim +GAчкпр + +:/^test/,$w! test.out +:qa! +ENDTEST + +test starts here: + diff --git a/src/testdir/test_mapping.ok b/src/testdir/test_mapping.ok new file mode 100644 index 0000000000..abdaea6a36 --- /dev/null +++ b/src/testdir/test_mapping.ok @@ -0,0 +1,2 @@ +test starts here: +vim diff --git a/src/version.c b/src/version.c index 7540f8ddc4..7d1a1914b6 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 483, /**/ 482, /**/ From ba8d999735910aa99e6f72d9b7fd4f961100a808 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 21 Oct 2014 14:17:09 +0200 Subject: [PATCH 157/311] updated for version 7.4.484 Problem: Compiler warning on MS-Windows. (Ken Takata) Solution: Add type cast. --- src/getchar.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/getchar.c b/src/getchar.c index cc93a7dd81..cafa660c43 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -4530,7 +4530,7 @@ check_abbr(c, ptr, col, mincol) if (q != NULL) { vim_unescape_csi(q); - qlen = STRLEN(q); + qlen = (int)STRLEN(q); vim_free(q); } } diff --git a/src/version.c b/src/version.c index 7d1a1914b6..e0efbb6c35 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 484, /**/ 483, /**/ From aef4e67ceb4cf54757beee20110bc425356f8180 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 21 Oct 2014 15:35:31 +0200 Subject: [PATCH 158/311] updated for version 7.4.485 Problem: Abbreviations don't work. (Toothpik) Solution: Move the length computation inside the for loop. Compare against the unescaped key. --- src/getchar.c | 36 ++++++++++++++++++++---------------- src/version.c | 2 ++ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/getchar.c b/src/getchar.c index cafa660c43..c9ee4d0510 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -4443,7 +4443,6 @@ check_abbr(c, ptr, col, mincol) #endif int is_id = TRUE; int vim_abbr; - int qlen; /* length of q, CSI/K_SPECIAL unescaped */ if (typebuf.tb_no_abbr_cnt) /* abbrev. are not recursive */ return FALSE; @@ -4521,29 +4520,34 @@ check_abbr(c, ptr, col, mincol) #else mp = first_abbr; #endif - qlen = mp->m_keylen; - if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL) - { - char_u *q = vim_strsave(mp->m_keys); - - /* might have CSI escaped mp->m_keys */ - if (q != NULL) - { - vim_unescape_csi(q); - qlen = (int)STRLEN(q); - vim_free(q); - } - } for ( ; mp; #ifdef FEAT_LOCALMAP mp->m_next == NULL ? (mp = mp2, mp2 = NULL) : #endif (mp = mp->m_next)) { + int qlen = mp->m_keylen; + char_u *q = mp->m_keys; + int match; + + if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL) + { + /* might have CSI escaped mp->m_keys */ + q = vim_strsave(mp->m_keys); + if (q != NULL) + { + vim_unescape_csi(q); + qlen = (int)STRLEN(q); + } + } + /* find entries with right mode and keys */ - if ( (mp->m_mode & State) + match = (mp->m_mode & State) && qlen == len - && !STRNCMP(mp->m_keys, ptr, (size_t)len)) + && !STRNCMP(q, ptr, (size_t)len); + if (q != mp->m_keys) + vim_free(q); + if (match) break; } if (mp != NULL) diff --git a/src/version.c b/src/version.c index e0efbb6c35..774480c004 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 485, /**/ 484, /**/ From 0f230c715418b264f580273ca0b330508a3e363c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 21 Oct 2014 16:01:58 +0200 Subject: [PATCH 159/311] updated for version 7.4.486 Problem: Check for writing to a yank register is wrong. Solution: Negate the check. (Zyx). Also clean up the #ifdefs. --- src/ex_cmds.h | 2 -- src/ex_docmd.c | 59 ++++++++++++++++---------------------------------- src/version.c | 2 ++ 3 files changed, 21 insertions(+), 42 deletions(-) diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 56dfe8ea7c..93c77764a0 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -1153,8 +1153,6 @@ EX(CMD_tilde, "~", do_sub, #endif }; -#define USER_CMDIDX(idx) ((int)(idx) < 0) - #ifndef DO_DECLARE_EXCMD typedef enum CMD_index cmdidx_T; diff --git a/src/ex_docmd.c b/src/ex_docmd.c index c957b5e735..15ce34247c 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -49,10 +49,15 @@ static void ex_delcommand __ARGS((exarg_T *eap)); static char_u *get_user_command_name __ARGS((int idx)); # endif +/* Wether a command index indicates a user command. */ +# define IS_USER_CMDIDX(idx) ((int)(idx) < 0) + #else # define ex_command ex_ni # define ex_comclear ex_ni # define ex_delcommand ex_ni +/* Wether a command index indicates a user command. */ +# define IS_USER_CMDIDX(idx) (FALSE) #endif #ifdef FEAT_EVAL @@ -2190,11 +2195,8 @@ do_one_cmd(cmdlinep, sourcing, goto doend; } - ni = ( -#ifdef FEAT_USR_CMDS - !USER_CMDIDX(ea.cmdidx) && -#endif - (cmdnames[ea.cmdidx].cmd_func == ex_ni + ni = (!IS_USER_CMDIDX(ea.cmdidx) + && (cmdnames[ea.cmdidx].cmd_func == ex_ni #ifdef HAVE_EX_SCRIPT_NI || cmdnames[ea.cmdidx].cmd_func == ex_script_ni #endif @@ -2229,9 +2231,7 @@ do_one_cmd(cmdlinep, sourcing, /* * 5. parse arguments */ -#ifdef FEAT_USR_CMDS - if (!USER_CMDIDX(ea.cmdidx)) -#endif + if (!IS_USER_CMDIDX(ea.cmdidx)) ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; if (!ea.skip) @@ -2252,10 +2252,7 @@ do_one_cmd(cmdlinep, sourcing, } if (text_locked() && !(ea.argt & CMDWIN) -# ifdef FEAT_USR_CMDS - && !USER_CMDIDX(ea.cmdidx) -# endif - ) + && !IS_USER_CMDIDX(ea.cmdidx)) { /* Command not allowed when editing the command line. */ #ifdef FEAT_CMDWIN @@ -2273,9 +2270,7 @@ do_one_cmd(cmdlinep, sourcing, if (!(ea.argt & CMDWIN) && ea.cmdidx != CMD_edit && ea.cmdidx != CMD_checktime -# ifdef FEAT_USR_CMDS - && !USER_CMDIDX(ea.cmdidx) -# endif + && !IS_USER_CMDIDX(ea.cmdidx) && curbuf_locked()) goto doend; #endif @@ -2468,10 +2463,8 @@ do_one_cmd(cmdlinep, sourcing, /* accept numbered register only when no count allowed (:put) */ if ( (ea.argt & REGSTR) && *ea.arg != NUL -#ifdef FEAT_USR_CMDS - /* Do not allow register = for user commands */ - && (!USER_CMDIDX(ea.cmdidx) || *ea.arg != '=') -#endif + /* Do not allow register = for user commands */ + && (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=') && !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg))) { #ifndef FEAT_CLIPBOARD @@ -2482,14 +2475,8 @@ do_one_cmd(cmdlinep, sourcing, goto doend; } #endif - if ( -#ifdef FEAT_USR_CMDS - valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put - && USER_CMDIDX(ea.cmdidx))) -#else - valid_yank_reg(*ea.arg, ea.cmdidx != CMD_put) -#endif - ) + if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put + && !IS_USER_CMDIDX(ea.cmdidx)))) { ea.regname = *ea.arg++; #ifdef FEAT_EVAL @@ -2663,10 +2650,7 @@ do_one_cmd(cmdlinep, sourcing, * number. Don't do this for a user command. */ if ((ea.argt & BUFNAME) && *ea.arg != NUL && ea.addr_count == 0 -# ifdef FEAT_USR_CMDS - && !USER_CMDIDX(ea.cmdidx) -# endif - ) + && !IS_USER_CMDIDX(ea.cmdidx)) { /* * :bdelete, :bwipeout and :bunload take several arguments, separated @@ -2704,7 +2688,7 @@ do_one_cmd(cmdlinep, sourcing, #endif #ifdef FEAT_USR_CMDS - if (USER_CMDIDX(ea.cmdidx)) + if (IS_USER_CMDIDX(ea.cmdidx)) { /* * Execute a user-defined command. @@ -2763,11 +2747,8 @@ doend: } #ifdef FEAT_EVAL do_errthrow(cstack, - (ea.cmdidx != CMD_SIZE -# ifdef FEAT_USR_CMDS - && !USER_CMDIDX(ea.cmdidx) -# endif - ) ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL); + (ea.cmdidx != CMD_SIZE && !IS_USER_CMDIDX(ea.cmdidx)) + ? cmdnames[(int)ea.cmdidx].cmd_name : (char_u *)NULL); #endif if (verbose_save >= 0) @@ -3361,9 +3342,7 @@ set_one_cmd_context(xp, buff) /* * 5. parse arguments */ -#ifdef FEAT_USR_CMDS - if (!USER_CMDIDX(ea.cmdidx)) -#endif + if (!IS_USER_CMDIDX(ea.cmdidx)) ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; arg = skipwhite(p); diff --git a/src/version.c b/src/version.c index 774480c004..c470959c68 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 486, /**/ 485, /**/ From 00306983c11ca656c2ae47163a4636bb743271a9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 21 Oct 2014 16:57:15 +0200 Subject: [PATCH 160/311] updated for version 7.4.487 Problem: ":sign jump" may use another window even though the file is already edited in the current window. Solution: First check if the file is in the current window. (James McCoy) --- src/testdir/Make_amiga.mak | 2 ++ src/testdir/Make_dos.mak | 1 + src/testdir/Make_ming.mak | 1 + src/testdir/Make_os2.mak | 1 + src/testdir/Make_vms.mms | 1 + src/testdir/Makefile | 1 + src/version.c | 2 ++ src/window.c | 30 +++++++++++------------------- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index c0df2c1b56..58316fc7f2 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -46,6 +46,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_mapping.out \ test_options.out \ test_qf_title.out \ + test_signs.out \ test_utf8.out .SUFFIXES: .in .out @@ -179,4 +180,5 @@ test_listlbr.out: test_listlbr.in test_listlbr_utf8.out: test_listlbr_utf8.in test_options.out: test_options.in test_qf_title.out: test_qf_title.in +test_signs.out: test_signs.in test_utf8.out: test_utf8.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 91500439fd..abcabce03e 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -45,6 +45,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_mapping.out \ test_options.out \ test_qf_title.out \ + test_signs.out \ test_utf8.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 247c0f259d..2a124b1b83 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -65,6 +65,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_mapping.out \ test_options.out \ test_qf_title.out \ + test_signs.out \ test_utf8.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index cfade3f7f7..5f3dc13930 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -47,6 +47,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_mapping.out \ test_options.out \ test_qf_title.out \ + test_signs.out \ test_utf8.out .SUFFIXES: .in .out diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 6483b7ce3a..e105376baf 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -106,6 +106,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test_mapping.out \ test_options.out \ test_qf_title.out \ + test_signs.out \ test_utf8.out # Known problems: diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 41f25cfbd1..6b3bf9b7e1 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -43,6 +43,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test_mapping.out \ test_options.out \ test_qf_title.out \ + test_signs.out \ test_utf8.out SCRIPTS_GUI = test16.out diff --git a/src/version.c b/src/version.c index c470959c68..b6f750cdcc 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 487, /**/ 486, /**/ diff --git a/src/window.c b/src/window.c index fda9199b2e..b975a61420 100644 --- a/src/window.c +++ b/src/window.c @@ -4407,20 +4407,19 @@ win_enter_ext(wp, undo_sync, curwin_invalid, trigger_enter_autocmds, trigger_lea buf_jump_open_win(buf) buf_T *buf; { -# ifdef FEAT_WINDOWS - win_T *wp; + win_T *wp = NULL; - for (wp = firstwin; wp != NULL; wp = wp->w_next) - if (wp->w_buffer == buf) - break; + if (curwin->w_buffer == buf) + wp = curwin; +# ifdef FEAT_WINDOWS + else + for (wp = firstwin; wp != NULL; wp = wp->w_next) + if (wp->w_buffer == buf) + break; if (wp != NULL) win_enter(wp, FALSE); - return wp; -# else - if (curwin->w_buffer == buf) - return curwin; - return NULL; # endif + return wp; } /* @@ -4432,12 +4431,10 @@ buf_jump_open_win(buf) buf_jump_open_tab(buf) buf_T *buf; { + win_T *wp = buf_jump_open_win(buf); # ifdef FEAT_WINDOWS - win_T *wp; tabpage_T *tp; - /* First try the current tab page. */ - wp = buf_jump_open_win(buf); if (wp != NULL) return wp; @@ -4455,13 +4452,8 @@ buf_jump_open_tab(buf) break; } } - - return wp; -# else - if (curwin->w_buffer == buf) - return curwin; - return NULL; # endif + return wp; } #endif From a21af63439f5442c76922845a6af5c5820548dd9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 21 Oct 2014 18:36:31 +0200 Subject: [PATCH 161/311] Add the missing test files. --- src/testdir/test_signs.in | 22 ++++++++++++++++++++++ src/testdir/test_signs.ok | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 src/testdir/test_signs.in create mode 100644 src/testdir/test_signs.ok diff --git a/src/testdir/test_signs.in b/src/testdir/test_signs.in new file mode 100644 index 0000000000..a2f15e9323 --- /dev/null +++ b/src/testdir/test_signs.in @@ -0,0 +1,22 @@ +Tests for signs +STARTTEST +:so small.vim +:if !has("signs") +: e! test.ok +: wq! test.out +:endif +:" +:sign define JumpSign text=x +:exe 'sign place 42 line=2 name=JumpSign buffer=' . bufnr('') +:" Split the window to the bottom to verify :sign-jump will stay in the current +:" window if the buffer is displayed there +:bot split +:exe 'sign jump 42 buffer=' . bufnr('') +:call append(line('$'), winnr()) +:$-1,$w! test.out +ENDTEST + +STARTTEST +:qa! +ENDTEST + diff --git a/src/testdir/test_signs.ok b/src/testdir/test_signs.ok new file mode 100644 index 0000000000..1f8c977ecc --- /dev/null +++ b/src/testdir/test_signs.ok @@ -0,0 +1,2 @@ + +2 From 879383f4035707ffcc514090fc4514ec8cafea9f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 22 Oct 2014 18:09:01 +0200 Subject: [PATCH 162/311] updated for version 7.4.488 Problem: test_mapping fails for some people. Solution: Set the 'encoding' option. (Ken Takata) --- src/testdir/test_mapping.in | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/testdir/test_mapping.in b/src/testdir/test_mapping.in index 55dac09bed..e2572772c1 100644 --- a/src/testdir/test_mapping.in +++ b/src/testdir/test_mapping.in @@ -3,6 +3,7 @@ Test for mappings and abbreviations STARTTEST :so small.vim :so mbyte.vim +:set encoding=utf-8 : " abbreviations with р (0x80) should work :inoreab чкпр vim GAчкпр diff --git a/src/version.c b/src/version.c index b6f750cdcc..e720782c79 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 488, /**/ 487, /**/ From 4cc0539ace36042da206d870e8426ad3ae1b638b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 31 Oct 2014 09:42:01 +0100 Subject: [PATCH 163/311] updated for version 7.4.489 Problem: Cursor movement still wrong when 'lbr' is set and there is a number column. (Hirohito Higashi) Solution: Add correction for number column. (Hiroyuki Takagi) --- src/charset.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/charset.c b/src/charset.c index 918f9a5142..e9745c09a2 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1184,6 +1184,8 @@ win_lbr_chartabsize(wp, line, s, col, headp) { col -= W_WIDTH(wp); numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp)); + if (numberextra > 0) + col %= numberextra; if (*p_sbr != NUL) { colnr_T sbrlen = (colnr_T)MB_CHARLEN(p_sbr); diff --git a/src/version.c b/src/version.c index e720782c79..1ef081855a 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 489, /**/ 488, /**/ From 10ec03b3820c60b38b6c6dbd0e3311fd32908d8c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 31 Oct 2014 10:54:25 +0100 Subject: [PATCH 164/311] updated for version 7.4.490 Problem: Cannot specify the buffer to use for "do" and "dp", making them useless for three-way diff. Solution: Use the count as the buffer number. (James McCoy) --- src/diff.c | 12 ++++++++++-- src/normal.c | 4 ++-- src/proto/diff.pro | 2 +- src/version.c | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/diff.c b/src/diff.c index d324f99d87..caee6e5a53 100644 --- a/src/diff.c +++ b/src/diff.c @@ -2107,12 +2107,20 @@ diff_infold(wp, lnum) * "dp" and "do" commands. */ void -nv_diffgetput(put) +nv_diffgetput(put, count) int put; + long count; { exarg_T ea; + char_u buf[30]; - ea.arg = (char_u *)""; + if (count == 0) + ea.arg = (char_u *)""; + else + { + vim_snprintf((char *)buf, 30, "%ld", count); + ea.arg = buf; + } if (put) ea.cmdidx = CMD_diffput; else diff --git a/src/normal.c b/src/normal.c index 0116d058ba..bd5bacd59a 100644 --- a/src/normal.c +++ b/src/normal.c @@ -9284,7 +9284,7 @@ nv_put(cap) if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'p') { clearop(cap->oap); - nv_diffgetput(TRUE); + nv_diffgetput(TRUE, cap->opcount); } else #endif @@ -9407,7 +9407,7 @@ nv_open(cap) if (cap->oap->op_type == OP_DELETE && cap->cmdchar == 'o') { clearop(cap->oap); - nv_diffgetput(FALSE); + nv_diffgetput(FALSE, cap->opcount); } else #endif diff --git a/src/proto/diff.pro b/src/proto/diff.pro index 18c42651fd..3234fde1a6 100644 --- a/src/proto/diff.pro +++ b/src/proto/diff.pro @@ -18,7 +18,7 @@ int diffopt_changed __ARGS((void)); int diffopt_horizontal __ARGS((void)); int diff_find_change __ARGS((win_T *wp, linenr_T lnum, int *startp, int *endp)); int diff_infold __ARGS((win_T *wp, linenr_T lnum)); -void nv_diffgetput __ARGS((int put)); +void nv_diffgetput __ARGS((int put, long count)); void ex_diffgetput __ARGS((exarg_T *eap)); int diff_mode_buf __ARGS((buf_T *buf)); int diff_move_to __ARGS((int dir, long count)); diff --git a/src/version.c b/src/version.c index 1ef081855a..3fc09c83c5 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 490, /**/ 489, /**/ From 73d711c2148fa5165429eb3eb974b2a13a17e407 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 31 Oct 2014 12:45:52 +0100 Subject: [PATCH 165/311] updated for version 7.4.491 Problem: When winrestview() has a negative "topline" value there are display errors. Solution: Correct a negative value to 1. (Hirohito Higashi) --- src/eval.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index 8f62cb2e83..f5aa7e919e 100644 --- a/src/eval.c +++ b/src/eval.c @@ -19576,7 +19576,7 @@ f_winrestview(argvars, rettv) # endif changed_window_setting(); - if (curwin->w_topline == 0) + if (curwin->w_topline <= 0) curwin->w_topline = 1; if (curwin->w_topline > curbuf->b_ml.ml_line_count) curwin->w_topline = curbuf->b_ml.ml_line_count; diff --git a/src/version.c b/src/version.c index 3fc09c83c5..71258da12d 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 491, /**/ 490, /**/ From c1154c2167443d057debc21c57079dc362655214 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 31 Oct 2014 16:20:36 +0100 Subject: [PATCH 166/311] updated for version 7.4.492 Problem: In Insert mode, after inserting a newline that inserts a comment leader, CTRL-O moves to the right. (ZyX) Issue 57. Solution: Correct the condition for moving the cursor back to the NUL. (Christian Brabandt) --- src/edit.c | 8 ++++++-- src/testdir/test4.in | 3 +++ src/testdir/test4.ok | 3 +++ src/version.c | 2 ++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/edit.c b/src/edit.c index 8243890c52..ee63daa1c7 100644 --- a/src/edit.c +++ b/src/edit.c @@ -6916,8 +6916,12 @@ stop_insert(end_insert_pos, esc, nomove) } 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 */ + else + { + tpos.col++; + if (cc != NUL && gchar_pos(&tpos) == NUL) + ++curwin->w_cursor.col; /* put cursor back on the NUL */ + } /* may have started Visual mode, adjust the position for * deleted characters. */ diff --git a/src/testdir/test4.in b/src/testdir/test4.in index 4aa2fe5a86..b8bd9fc9cf 100644 --- a/src/testdir/test4.in +++ b/src/testdir/test4.in @@ -17,6 +17,9 @@ othis should be auto-indented G?this is a othis should be in column 1:wq " append text without autoindent to Xxx G:r Xxx " include Xxx in the current file +:set fo+=r " issue #57 do not move cursor on when autoindent is set +Go# abcdef2hi +d0o# abcdef2hid0 :?startstart?,$w! test.out :qa! ENDTEST diff --git a/src/testdir/test4.ok b/src/testdir/test4.ok index dffecda4d2..d032e4c319 100644 --- a/src/testdir/test4.ok +++ b/src/testdir/test4.ok @@ -15,3 +15,6 @@ vim: set noai : this is a test this should be in column 1 end of test file Xxx +# abc +def +def diff --git a/src/version.c b/src/version.c index 71258da12d..69538140c1 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 492, /**/ 491, /**/ From 9bd07d7556814d0c6cc4f97a0f0c99d71df4d2ea Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 31 Oct 2014 16:51:36 +0100 Subject: [PATCH 167/311] updated for version 7.4.493 Problem: A TextChanged autocommand is triggered when saving a file. (William Gardner) Solution: Update last_changedtick after calling unchanged(). (Christian Brabandt) --- src/fileio.c | 7 +++++++ src/version.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/fileio.c b/src/fileio.c index c7e846b82a..0843d04296 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4877,6 +4877,13 @@ restore_backup: ) { unchanged(buf, TRUE); +#ifdef FEAT_AUTOCMD + /* buf->b_changedtick is always incremented in unchanged() but that + * should not trigger a TextChanged event. */ + if (last_changedtick + 1 == buf->b_changedtick + && last_changedtick_buf == buf) + last_changedtick = buf->b_changedtick; +#endif u_unchanged(buf); u_update_save_nr(buf); } diff --git a/src/version.c b/src/version.c index 69538140c1..378818e66d 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 493, /**/ 492, /**/ From d2073aba9ae701e7e088a5c34355e9fafbfa190e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 06:53:23 +0100 Subject: [PATCH 168/311] updated for version 7.4.494 Problem: Cursor shape is wrong after a CompleteDone autocommand. Solution: Update the cursor and mouse shape after ":normal" restores the state. (Jacob Niehus) --- src/ex_docmd.c | 9 ++++++++- src/version.c | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 15ce34247c..35e44f0f3c 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -9526,8 +9526,15 @@ ex_normal(eap) msg_didout |= save_msg_didout; /* don't reset msg_didout now */ /* Restore the state (needed when called from a function executed for - * 'indentexpr'). */ + * 'indentexpr'). Update the mouse and cursor, they may have changed. */ State = save_State; +#ifdef FEAT_MOUSE + setmouse(); +#endif +#ifdef CURSOR_SHAPE + ui_cursor_shape(); /* may show different cursor shape */ +#endif + #ifdef FEAT_MBYTE vim_free(arg); #endif diff --git a/src/version.c b/src/version.c index 378818e66d..ec0e667e2f 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 494, /**/ 493, /**/ From e7303693cecc24900eeb234e3a8ca7aaa6c0edd7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 10:43:21 +0100 Subject: [PATCH 169/311] updated for version 7.4.495 Problem: XPM isn't used correctly in the Cygwin Makefile. Solution: Include the rules like in Make_ming.mak. (Ken Takata) --- src/Make_cyg.mak | 21 ++++++++++++++++++++- src/version.c | 2 ++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index abd35a6a42..ff40548df9 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -485,13 +485,32 @@ USE_STDCPLUS = yes endif ############################## +ifndef XPM +ifeq ($(ARCH),i386) +XPM = xpm/x86 +endif +ifeq ($(ARCH),i486) +XPM = xpm/x86 +endif +ifeq ($(ARCH),i586) +XPM = xpm/x86 +endif +ifeq ($(ARCH),i686) +XPM = xpm/x86 +endif +ifeq ($(ARCH),x86-64) +XPM = xpm/x64 +endif +endif +ifdef XPM ifneq ($(XPM),no) # Only allow XPM for a GUI build. DEFINES += -DFEAT_XPM_W32 -INCLUDES += -I$(XPM)/include +INCLUDES += -I$(XPM)/include -I$(XPM)/../include EXTRA_OBJS += $(OUTDIR)/xpm_w32.o EXTRA_LIBS += -L$(XPM)/lib -lXpm endif +endif ############################## EXE = gvim$(DEBUG_SUFFIX).exe diff --git a/src/version.c b/src/version.c index ec0e667e2f..4b75a58a51 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 495, /**/ 494, /**/ From f63bcb612120c615ce101ed6383f2d4a2dfe1720 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 10:53:32 +0100 Subject: [PATCH 170/311] updated for version 7.4.496 Problem: Many lines are both in Make_cyg.mak and Make_ming.mak Solution: Move the common parts to one file. (Ken Takata) --- Filelist | 1 + src/INSTALLpc.txt | 25 +- src/Make_cyg.mak | 776 ++------------------------------------ src/Make_cyg_ming.mak | 847 ++++++++++++++++++++++++++++++++++++++++++ src/Make_ming.mak | 817 +--------------------------------------- src/Make_mvc.mak | 15 +- src/version.c | 2 + 7 files changed, 928 insertions(+), 1555 deletions(-) create mode 100644 src/Make_cyg_ming.mak diff --git a/Filelist b/Filelist index dd09b840ca..fd145bd16a 100644 --- a/Filelist +++ b/Filelist @@ -277,6 +277,7 @@ SRC_DOS = \ src/Make_bc3.mak \ src/Make_bc5.mak \ src/Make_cyg.mak \ + src/Make_cyg_ming.mak \ src/Make_djg.mak \ src/Make_ivc.mak \ src/Make_dvc.mak \ diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt index 370c208eec..24fb4f0aad 100644 --- a/src/INSTALLpc.txt +++ b/src/INSTALLpc.txt @@ -228,11 +228,15 @@ at: http://www.mingw.org/ +or you can use 'MinGW-w64' compiler. + + http://mingw-w64.sourceforge.net/ + Once you have downloaded the compiler binaries, unpack them on your hard disk somewhere, and put them on your PATH. If you are on Win95/98 you can edit your AUTOEXEC.BAT file with a line like: - set PATH=C:\GCC-2.95.2\BIN;%PATH% + set PATH=C:\MinGW\bin;%PATH% or on NT/2000/XP, go to the Control Panel, (Performance and Maintenance), System, Advanced, and edit the environment from there. @@ -240,10 +244,10 @@ System, Advanced, and edit the environment from there. Test if gcc is on your path. From a CMD (or COMMAND on '95/98) window: C:\> gcc --version - 2.95.2 + gcc (GCC) 4.8.1 - C:\> make --version - GNU Make version 3.77 (...etc...) + C:\> mingw32-make --version + GNU Make 3.82.90 (...etc...) Now you are ready to rock 'n' roll. Unpack the vim sources (look on www.vim.org for exactly which version of the vim files you need). @@ -255,7 +259,7 @@ Change directory to 'vim\src': and you type: - make -f Make_ming.mak gvim.exe + mingw32-make -f Make_ming.mak gvim.exe After churning for a while, you will end up with 'gvim.exe' in the 'vim\src' directory. @@ -264,7 +268,7 @@ You should not need to do *any* editing of any files to get vim compiled this way. If, for some reason, you want the console-mode-only version of vim (this is NOT recommended on Win32, especially on '95/'98!!!), you can use: - make -f Make_ming.mak GUI=no vim.exe + mingw32-make -f Make_ming.mak GUI=no vim.exe If you are dismayed by how big the EXE is, I strongly recommend you get 'UPX' (also free!) and compress the file (typical compression is 50%). UPX can be @@ -291,8 +295,7 @@ You need to uncomment lines in Make_ming.mak to have NLS defined. Use Make_cyg.mak with Cygwin's GCC. See http://users.skynet.be/antoine.mechelynck/vim/compile.htm -The Cygnus one many not fully work yet. -With Cygnus gcc you can use the Unix Makefile instead (you need to get the +With Cygnus gcc you should use the Unix Makefile instead (you need to get the Unix archive then). Then you get a Cygwin application (feels like Vim is running on Unix), while with Make_cyg.mak you get a Windows application (like with the other makefiles). @@ -316,9 +319,9 @@ your Linux (or other unix) box. To do this, you need to follow a few steps: http://www.mingw.org/wiki/LinuxCrossMinGW http://www.libsdl.org/extras/win32/cross/README.txt 2) Get and unpack both the Unix sources and the extra archive - 3) in 'Make_ming.mak', set 'CROSS' to 'yes' instead of 'no'. - Make further changes to 'Make_ming.mak' as you wish. - If your cross-compiler prefix differs from the predefined value, + 3) in 'Make_cyg_ming.mak', set 'CROSS' to 'yes' instead of 'no'. + Make further changes to 'Make_cyg_ming.mak' and 'Make_ming.mak' as you + wish. If your cross-compiler prefix differs from the predefined value, set 'CROSS_COMPILE' corresponding. 4) make -f Make_ming.mak gvim.exe diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index ff40548df9..828666ce0a 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -1,754 +1,52 @@ # -# Makefile for VIM on Win32, using Cygnus gcc -# Updated by Dan Sharp. -# Last Change: 2014 Aug 10 +# Makefile for VIM on Win32, using MinGW cross compiler on Cygwin # # Also read INSTALLpc.txt! # # This compiles Vim as a Windows application. If you want Vim to run as a # Cygwin application use the Makefile (just like on Unix). # -# GUI no or yes: set to yes if you want the GUI version (yes) -# DIRECTX no or yes: set to yes if you want use DirectWrite (no) -# PERL define to path to Perl dir to get Perl support (not defined) -# PERL_VER define to version of Perl being used (56) -# DYNAMIC_PERL no or yes: set to yes to load the Perl DLL dynamically (yes) -# PYTHON define to path to Python dir to get PYTHON support (not defined) -# PYTHON_VER define to version of Python being used (22) -# DYNAMIC_PYTHON no or yes: use yes to load the Python DLL dynamically (yes) -# PYTHON3 define to path to Python3 dir to get PYTHON3 support (not defined) -# PYTHON3_VER define to version of Python3 being used (22) -# DYNAMIC_PYTHON3 no or yes: use yes to load the Python3 DLL dynamically (yes) -# TCL define to path to TCL dir to get TCL support (not defined) -# TCL_VER define to version of TCL being used (83) -# DYNAMIC_TCL no or yes: use yes to load the TCL DLL dynamically (yes) -# RUBY define to path to Ruby dir to get Ruby support (not defined) -# RUBY_VER define to version of Ruby being used (16) -# RUBY_VER_LONG same, but in format with dot. (1.6) -# You must set RUBY_VER_LONG when changing RUBY_VER. -# You must set RUBY_API_VER version to RUBY_VER_LONG. -# Don't set ruby API version to RUBY_VER like 191. -# DYNAMIC_RUBY no or yes: use yes to load the Ruby DLL dynamically (yes) -# MZSCHEME define to path to MzScheme dir to get MZSCHEME support (not defined) -# MZSCHEME_VER define to version of MzScheme being used (209_000) -# DYNAMIC_MZSCHEME no or yes: use yes to load the MzScheme DLLs dynamically (yes) -# MZSCHEME_DLLS path to MzScheme DLLs (libmzgc and libmzsch), for "static" build. -# MZSCHEME_USE_RACKET define to use "racket" instead of "mzsch". -# LUA define to path to Lua dir to get Lua support (not defined) -# LUA_VER define to version of Lua being used (51) -# DYNAMIC_LUA no or yes: use yes to load the Lua DLL dynamically (yes) -# GETTEXT no or yes: set to yes for dynamic gettext support (yes) -# ICONV no or yes: set to yes for dynamic iconv support (yes) -# MBYTE no or yes: set to yes to include multibyte support (yes) -# IME no or yes: set to yes to include IME support (yes) -# DYNAMIC_IME no or yes: set to yes to load imm32.dll dynamically (yes) -# OLE no or yes: set to yes to make OLE gvim (no) -# DEBUG no or yes: set to yes if you wish a DEBUGging build (no) -# CPUNR No longer supported, use ARCH. -# ARCH i386 through pentium4: select -march argument to compile with -# (i386) -# USEDLL no or yes: set to yes to use the Runtime library DLL (no) -# For USEDLL=yes the cygwin1.dll is required to run Vim. -# For "no" the mingw-gcc-g++ package or the mingw64-i686-gcc-g++ -# package is required to compile Vim. Or set CC to gcc-3 and add -# -L/lib/w32api to EXTRA_LIBS. -# POSTSCRIPT no or yes: set to yes for PostScript printing (no) -# FEATURES TINY, SMALL, NORMAL, BIG or HUGE (BIG) -# WINVER Lowest Win32 version to support. (0x0500) -# CSCOPE no or yes: to include cscope interface support (yes) -# OPTIMIZE SPACE, SPEED, or MAXSPEED: set optimization level (MAXSPEED) -# NETBEANS no or yes: to include netbeans interface support (yes when GUI -# is yes) -# NBDEBUG no or yes: to include netbeans interface debugging support (no) -# XPM define to path to XPM dir to get XPM image support (not defined) -#>>>>> choose options: -ifndef GUI -GUI=yes -endif - -ifndef FEATURES -FEATURES = BIG -endif - -ifndef GETTEXT -GETTEXT = yes -endif - -ifndef ICONV -ICONV = yes -endif - -ifndef MBYTE -MBYTE = yes -endif - -ifndef IME -IME = yes -endif - -ifndef ARCH -ARCH = i386 -endif - -ifndef DIRECTX -DIRECTX = no -endif - -ifndef WINVER -WINVER = 0x0500 -endif - -ifndef CSCOPE -CSCOPE = yes -endif - -ifndef NETBEANS -ifeq ($(GUI),yes) -NETBEANS = yes -endif -endif - -ifndef OPTIMIZE -OPTIMIZE = MAXSPEED -endif +# The old Make_cyg.mak (maintained by Dan Sharp et al.) was merged into +# Make_cyg_ming.mak. Note: USEDLL option was removed. +# This file contains Cygwin specific settings. Common settings are contained +# in Make_cyg_ming.mak. +# +# Last updated by Ken Takata. +# Last Change: 2014 Oct 21 -# Link against the shared version of libstdc++ by default. Set -# STATIC_STDCPLUS to "yes" to link against static version instead. -ifndef STATIC_STDCPLUS -STATIC_STDCPLUS=no -endif +# uncomment 'PERL' if you want a perl-enabled version +#PERL=/cygdrive/c/perl -### See feature.h for a list of optionals. -### Any other defines can be included here. +# uncomment 'LUA' if you want a Lua-enabled version +#LUA=/cygdrive/c/lua -DEFINES = -DWIN32 -DHAVE_PATHDEF -DFEAT_$(FEATURES) \ - -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) -ifeq ($(ARCH),x86-64) -DEFINES+=-DMS_WIN64 -endif -INCLUDES = -march=$(ARCH) -Iproto +# uncomment 'MZSCHEME' if you want a MzScheme-enabled version +#MZSCHEME=/cygdrive/d/plt -#>>>>> name of the compiler and linker, name of lib directory -ifeq (yes, $(USEDLL)) -# CROSS_COMPILE is used for the gvimext DLL. +# uncomment 'PYTHON' if you want a python-enabled version +#PYTHON=/cygdrive/c/python20 + +# uncomment 'PYTHON3' if you want a python3-enabled version +#PYTHON3=/cygdrive/c/python31 + +# uncomment 'TCL' if you want a Tcl-enabled version +#TCL=/cygdrive/c/tcl + +# uncomment 'RUBY' if you want a Ruby-enabled version +#RUBY=/cygdribe/c/ruby + + +# Use MinGW(-w64) cross compiler. +# There are three MinGW packages in Cygwin: +# 32-bit: mingw-gcc-g++ and mingw64-i686-gcc-g++ +# 64-bit: mingw64-x86_64-gcc-g++ +# You may also need to set 'ARCH' in Make_cyg_ming.mak. CROSS_COMPILE = i686-pc-mingw32- -CC = gcc -RC = windres -else -# i686-pc-mingw32-gcc, i686-w64-mingw32-gcc or gcc-3 can be used. -CROSS_COMPILE = i686-pc-mingw32- -CC = $(CROSS_COMPILE)gcc -RC = $(CROSS_COMPILE)windres -endif +#CROSS_COMPILE = i686-w64-mingw32- +#CROSS_COMPILE = x86_64-w64-mingw32- -############################## -# DYNAMIC_PERL=yes and no both work -############################## -ifdef PERL -DEFINES += -DFEAT_PERL -INCLUDES += -I$(PERL)/lib/CORE -EXTRA_OBJS += $(OUTDIR)/if_perl.o - -ifndef DYNAMIC_PERL -DYNAMIC_PERL = yes -endif - -ifndef PERL_VER -PERL_VER = 56 -endif - -ifeq (yes, $(DYNAMIC_PERL)) -DEFINES += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\" -else -EXTRA_LIBS += -L$(PERL)/lib/CORE -lperl$(PERL_VER) -endif -endif - -############################## -# DYNAMIC_PYTHON=yes works. -# DYNAMIC_PYTHON=no does not (unresolved externals on link). -############################## -ifdef PYTHON -DEFINES += -DFEAT_PYTHON -EXTRA_OBJS += $(OUTDIR)/if_python.o - -ifndef DYNAMIC_PYTHON -DYNAMIC_PYTHON = yes -endif - -ifndef PYTHON_VER -PYTHON_VER = 22 -endif - -ifeq (yes, $(DYNAMIC_PYTHON)) -DEFINES += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" -else -EXTRA_LIBS += $(PYTHON)/libs/python$(PYTHON_VER).lib -endif -endif - -############################## -# DYNAMIC_PYTHON3=yes works. -# DYNAMIC_PYTHON3=no does not (unresolved externals on link). -############################## -ifdef PYTHON3 -DEFINES += -DFEAT_PYTHON3 -EXTRA_OBJS += $(OUTDIR)/if_python3.o - -ifndef DYNAMIC_PYTHON3 -DYNAMIC_PYTHON3 = yes -endif - -ifndef PYTHON3_VER -PYTHON3_VER = 31 -endif - -ifeq (yes, $(DYNAMIC_PYTHON3)) -DEFINES += -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python$(PYTHON3_VER).dll\" -else -EXTRA_LIBS += $(PYTHON3)/libs/python$(PYTHON3_VER).lib -endif -endif - -############################## -# DYNAMIC_RUBY=yes works. -# DYNAMIC_RUBY=no does not (process exits). -############################## -ifdef RUBY - -ifndef DYNAMIC_RUBY -DYNAMIC_RUBY=yes -endif -# Set default value -ifndef RUBY_VER -RUBY_VER = 16 -endif -ifndef RUBY_VER_LONG -RUBY_VER_LONG = 1.6 -endif -ifndef RUBY_API_VER -RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG)) -endif - -ifndef RUBY_PLATFORM -ifeq ($(RUBY_VER), 16) -RUBY_PLATFORM = i586-mswin32 -else -ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),) -RUBY_PLATFORM = i386-mingw32 -else -ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),) -RUBY_PLATFORM = x64-mingw32 -else -RUBY_PLATFORM = i386-mswin32 -endif -endif -endif -endif - -ifndef RUBY_INSTALL_NAME -ifeq ($(RUBY_VER), 16) -RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER) -else -ifeq ($(ARCH),x86-64) -RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER) -else -RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER) -endif -endif -endif - -ifeq (19, $(word 1,$(sort 19 $(RUBY_VER)))) -RUBY_19_OR_LATER = 1 -endif - -DEFINES += -DFEAT_RUBY -ifneq ($(findstring w64-mingw32,$(CC)),) -# A workaround for mingw-w64 -DEFINES += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE -endif -INCLUDES += -I$(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM) -ifdef RUBY_19_OR_LATER -INCLUDES += -I$(RUBY)/include/ruby-$(RUBY_VER_LONG) -I$(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM) -endif -EXTRA_OBJS += $(OUTDIR)/if_ruby.o - -ifeq (yes, $(DYNAMIC_RUBY)) -DEFINES += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -DEFINES += -DDYNAMIC_RUBY_VER=$(RUBY_VER) -else -EXTRA_LIBS += $(RUBY)/lib/$(RUBY_INSTALL_NAME) -endif -endif - -############################## -# DYNAMIC_MZSCHEME=yes works -# DYNAMIC_MZSCHEME=no works too -############################## -ifdef MZSCHEME -DEFINES += -DFEAT_MZSCHEME -INCLUDES += -I$(MZSCHEME)/include -EXTRA_OBJS += $(OUTDIR)/if_mzsch.o - -ifndef DYNAMIC_MZSCHEME -DYNAMIC_MZSCHEME = yes -endif - -ifndef MZSCHEME_VER -MZSCHEME_VER = 209_000 -endif - -ifndef MZSCHEME_PRECISE_GC -MZSCHEME_PRECISE_GC=no -endif - -# for version 4.x we need to generate byte-code for Scheme base -ifndef MZSCHEME_GENERATE_BASE -MZSCHEME_GENERATE_BASE=no -endif - -ifndef MZSCHEME_USE_RACKET -MZSCHEME_MAIN_LIB=mzsch -else -MZSCHEME_MAIN_LIB=racket -endif - -ifeq (yes, $(DYNAMIC_MZSCHEME)) -DEFINES += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" -else -ifndef MZSCHEME_DLLS -MZSCHEME_DLLS = $(MZSCHEME) -endif -ifeq (yes,$(MZSCHEME_PRECISE_GC)) -MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -else -MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER) -endif -EXTRA_LIBS += -L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)/lib $(MZSCHEME_LIB) -endif -ifeq (yes,$(MZSCHEME_GENERATE_BASE)) -DEFINES += -DINCLUDE_MZSCHEME_BASE -MZ_EXTRA_DEP += mzscheme_base.c -endif -ifeq (yes,$(MZSCHEME_PRECISE_GC)) -DEFINES += -DMZ_PRECISE_GC -endif -endif - -############################## -# DYNAMIC_TCL=yes and no both work. -############################## -ifdef TCL -DEFINES += -DFEAT_TCL -INCLUDES += -I$(TCL)/include -EXTRA_OBJS += $(OUTDIR)/if_tcl.o - -ifndef DYNAMIC_TCL -DYNAMIC_TCL = yes -endif - -ifndef TCL_VER -TCL_VER = 83 -endif - -ifeq (yes, $(DYNAMIC_TCL)) -DEFINES += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\" -EXTRA_LIBS += $(TCL)/lib/tclstub$(TCL_VER).lib -else -EXTRA_LIBS += $(TCL)/lib/tcl$(TCL_VER).lib -endif -endif - -############################## -# DYNAMIC_LUA=yes works. -# DYNAMIC_LUA=no does not (unresolved externals on link). -############################## -ifdef LUA -DEFINES += -DFEAT_LUA -INCLUDES += -I$(LUA)/include -EXTRA_OBJS += $(OUTDIR)/if_lua.o - -ifndef DYNAMIC_LUA -DYNAMIC_LUA = yes -endif - -ifndef LUA_VER -LUA_VER = 51 -endif - -ifeq (yes, $(DYNAMIC_LUA)) -DEFINES += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\" -else -EXTRA_LIBS += $(LUA)/lib/lua$(LUA_VER).lib -endif -endif - -############################## -ifeq (yes, $(GETTEXT)) -DEFINES += -DDYNAMIC_GETTEXT -endif - -############################## -ifeq (yes, $(ICONV)) -DEFINES += -DDYNAMIC_ICONV -endif - -############################## -ifeq (yes, $(MBYTE)) -DEFINES += -DFEAT_MBYTE -endif - -############################## -ifeq (yes, $(IME)) -DEFINES += -DFEAT_MBYTE_IME - -ifndef DYNAMIC_IME -DYNAMIC_IME = yes -endif - -ifeq (yes, $(DYNAMIC_IME)) -DEFINES += -DDYNAMIC_IME -else -EXTRA_LIBS += -limm32 -endif -endif - -############################## -ifeq (yes, $(DEBUG)) -DEFINES += -DDEBUG -INCLUDES += -g -fstack-check -DEBUG_SUFFIX = d -else - -ifeq ($(OPTIMIZE), SIZE) -OPTFLAG = -Os -else -ifeq ($(OPTIMIZE), MAXSPEED) -OPTFLAG = -O3 -fomit-frame-pointer -freg-struct-return -else -OPTFLAG = -O2 -endif -endif - -# A bug in the GCC <= 3.2 optimizer can cause a crash. The -# following option removes the problem optimization. -OPTFLAG += -fno-strength-reduce - -INCLUDES += -s - -endif - -############################## -# USEDLL=yes will build a Cygwin32 executable that relies on cygwin1.dll. -# USEDLL=no will build a Mingw32 executable with no extra dll dependencies. -############################## -ifeq (yes, $(USEDLL)) -DEFINES += -D_MAX_PATH=256 -D__CYGWIN__ -endif - -############################## -ifeq (yes, $(POSTSCRIPT)) -DEFINES += -DMSWINPS -endif - -############################## -ifeq (yes, $(CSCOPE)) -DEFINES += -DFEAT_CSCOPE -EXTRA_OBJS += $(OUTDIR)/if_cscope.o -endif - -############################## -ifeq ($(GUI),yes) - -############################## -ifeq (yes, $(NETBEANS)) -# Only allow NETBEANS for a GUI build. -DEFINES += -DFEAT_NETBEANS_INTG -EXTRA_OBJS += $(OUTDIR)/netbeans.o -EXTRA_LIBS += -lwsock32 - -ifeq (yes, $(NBDEBUG)) -DEFINES += -DNBDEBUG -NBDEBUG_DEP = nbdebug.h nbdebug.c -endif - -endif - -############################## -ifeq (yes, $(DIRECTX)) -# Only allow DIRECTX for a GUI build. -DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -EXTRA_OBJS += $(OUTDIR)/gui_dwrite.o -EXTRA_LIBS += -ld2d1 -ldwrite -USE_STDCPLUS = yes -endif - -############################## -ifndef XPM -ifeq ($(ARCH),i386) -XPM = xpm/x86 -endif -ifeq ($(ARCH),i486) -XPM = xpm/x86 -endif -ifeq ($(ARCH),i586) -XPM = xpm/x86 -endif -ifeq ($(ARCH),i686) -XPM = xpm/x86 -endif -ifeq ($(ARCH),x86-64) -XPM = xpm/x64 -endif -endif -ifdef XPM -ifneq ($(XPM),no) -# Only allow XPM for a GUI build. -DEFINES += -DFEAT_XPM_W32 -INCLUDES += -I$(XPM)/include -I$(XPM)/../include -EXTRA_OBJS += $(OUTDIR)/xpm_w32.o -EXTRA_LIBS += -L$(XPM)/lib -lXpm -endif -endif - -############################## -EXE = gvim$(DEBUG_SUFFIX).exe -OUTDIR = gobj$(DEBUG_SUFFIX) -DEFINES += -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -EXTRA_OBJS += $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o -EXTRA_LIBS += -mwindows -lcomctl32 -lversion -else -EXE = vim$(DEBUG_SUFFIX).exe -OUTDIR = obj$(DEBUG_SUFFIX) -LIBS += -luser32 -lgdi32 -lcomdlg32 -endif - -############################## -ifeq (yes, $(OLE)) -DEFINES += -DFEAT_OLE -EXTRA_OBJS += $(OUTDIR)/if_ole.o -EXTRA_LIBS += -loleaut32 -USE_STDCPLUS = yes -endif - -############################## -ifneq (sh.exe, $(SHELL)) -DEL = rm -MKDIR = mkdir -p -DIRSLASH = / -else -DEL = del -MKDIR = mkdir -DIRSLASH = \\ -endif - -############################## -ifeq (yes, $(USE_STDCPLUS)) -ifeq (yes, $(STATIC_STDCPLUS)) -EXTRA_LIBS += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -else -EXTRA_LIBS += -lstdc++ -endif -endif - -#>>>>> end of choices -########################################################################### - -INCL = vim.h globals.h option.h keymap.h macros.h ascii.h term.h os_win32.h \ - structs.h version.h - -CFLAGS = $(OPTFLAG) $(DEFINES) $(INCLUDES) - -RCFLAGS = -O coff $(DEFINES) - -OBJ = \ - $(OUTDIR)/blowfish.o \ - $(OUTDIR)/buffer.o \ - $(OUTDIR)/charset.o \ - $(OUTDIR)/crypt.o \ - $(OUTDIR)/crypt_zip.o \ - $(OUTDIR)/diff.o \ - $(OUTDIR)/digraph.o \ - $(OUTDIR)/edit.o \ - $(OUTDIR)/eval.o \ - $(OUTDIR)/ex_cmds.o \ - $(OUTDIR)/ex_cmds2.o \ - $(OUTDIR)/ex_docmd.o \ - $(OUTDIR)/ex_eval.o \ - $(OUTDIR)/ex_getln.o \ - $(OUTDIR)/fileio.o \ - $(OUTDIR)/fold.o \ - $(OUTDIR)/getchar.o \ - $(OUTDIR)/hardcopy.o \ - $(OUTDIR)/hashtab.o \ - $(OUTDIR)/main.o \ - $(OUTDIR)/mark.o \ - $(OUTDIR)/memfile.o \ - $(OUTDIR)/memline.o \ - $(OUTDIR)/menu.o \ - $(OUTDIR)/message.o \ - $(OUTDIR)/misc1.o \ - $(OUTDIR)/misc2.o \ - $(OUTDIR)/move.o \ - $(OUTDIR)/mbyte.o \ - $(OUTDIR)/normal.o \ - $(OUTDIR)/ops.o \ - $(OUTDIR)/option.o \ - $(OUTDIR)/os_win32.o \ - $(OUTDIR)/os_mswin.o \ - $(OUTDIR)/winclip.o \ - $(OUTDIR)/pathdef.o \ - $(OUTDIR)/popupmnu.o \ - $(OUTDIR)/quickfix.o \ - $(OUTDIR)/regexp.o \ - $(OUTDIR)/screen.o \ - $(OUTDIR)/search.o \ - $(OUTDIR)/sha256.o \ - $(OUTDIR)/spell.o \ - $(OUTDIR)/syntax.o \ - $(OUTDIR)/tag.o \ - $(OUTDIR)/term.o \ - $(OUTDIR)/ui.o \ - $(OUTDIR)/undo.o \ - $(OUTDIR)/version.o \ - $(OUTDIR)/vimrc.o \ - $(OUTDIR)/window.o \ - $(EXTRA_OBJS) - -all: $(EXE) xxd/xxd.exe vimrun.exe install.exe uninstal.exe GvimExt/gvimext.dll - -# According to the Cygwin doc 1.2 FAQ, kernel32 should not be specified for -# linking unless calling ld directly. -# See /usr/doc/cygwin-doc-1.2/html/faq_toc.html#TOC93 for more information. -$(EXE): $(OUTDIR) $(OBJ) - $(CC) $(CFLAGS) -o $(EXE) $(OBJ) $(LIBS) -luuid -lole32 $(EXTRA_LIBS) - -xxd/xxd.exe: xxd/xxd.c - $(MAKE) -C xxd -f Make_cyg.mak CC=$(CC) USEDLL=$(USEDLL) - -GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h - $(MAKE) -C GvimExt -f Make_cyg.mak CROSS_COMPILE=$(CROSS_COMPILE) - -vimrun.exe: vimrun.c - $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIBS) - -install.exe: dosinst.c - $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIBS) -luuid -lole32 - -uninstal.exe: uninstal.c - $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIBS) - -$(OUTDIR): - $(MKDIR) $(OUTDIR) - -tags: - command /c ctags *.c $(INCL) - -clean: - -$(DEL) $(OUTDIR)$(DIRSLASH)*.o - -rmdir $(OUTDIR) - -$(DEL) $(EXE) vimrun.exe install.exe uninstal.exe -ifdef PERL - -$(DEL) if_perl.c -endif -ifdef MZSCHEME - -$(DEL) mzscheme_base.c -endif - -$(DEL) pathdef.c - $(MAKE) -C xxd -f Make_cyg.mak clean - $(MAKE) -C GvimExt -f Make_cyg.mak clean - -distclean: clean - -$(DEL) obj$(DIRSLASH)*.o - -rmdir obj - -$(DEL) gobj$(DIRSLASH)*.o - -rmdir gobj - -$(DEL) objd$(DIRSLASH)*.o - -rmdir objd - -$(DEL) gobjd$(DIRSLASH)*.o - -rmdir gobjd - -$(DEL) *.exe - -########################################################################### - -$(OUTDIR)/%.o : %.c $(INCL) - $(CC) -c $(CFLAGS) $< -o $@ - -$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h - $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o - -$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h - $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o - -$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL) - $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o - -$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h - $(CC) -c $(CFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o - -$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h - $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o - -$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) - $(CC) -c $(CFLAGS) if_ole.cpp -o $(OUTDIR)/if_ole.o - -$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL) - $(CC) -c $(CFLAGS) -I$(PYTHON)/include $< -o $@ - -$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL) - $(CC) -c $(CFLAGS) -I$(PYTHON3)/include $< -o $@ - -if_perl.c: if_perl.xs typemap - $(PERL)/bin/perl `cygpath -d $(PERL)/lib/ExtUtils/xsubpp` \ - -prototypes -typemap \ - `cygpath -d $(PERL)/lib/ExtUtils/typemap` if_perl.xs > $@ - -$(OUTDIR)/if_perl.o: if_perl.c $(INCL) -ifeq (yes, $(USEDLL)) - $(CC) -c $(CFLAGS) -I/usr/include/mingw -D__MINGW32__ if_perl.c -o $(OUTDIR)/if_perl.o -endif - -$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL) -ifeq (16, $(RUBY_VER)) - $(CC) -c $(CFLAGS) -U_WIN32 if_ruby.c -o $(OUTDIR)/if_ruby.o -endif - -$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_DEP) - $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o - -$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL) - $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o - -$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP) - $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o - -$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h - $(RC) $(RCFLAGS) vim.rc -o $(OUTDIR)/vimrc.o - -mzscheme_base.c: - $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base - -pathdef.c: $(INCL) -ifneq (sh.exe, $(SHELL)) - @echo creating pathdef.c - @echo '/* pathdef.c */' > pathdef.c - @echo '#include "vim.h"' >> pathdef.c - @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c - @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c - @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c - @echo 'char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)";' >> pathdef.c - @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c - @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c -else - @echo creating pathdef.c - @echo /* pathdef.c */ > pathdef.c - @echo #include "vim.h" >> pathdef.c - @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c - @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c - @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c - @echo char_u *all_lflags = (char_u *)"$(CC) -s -o $(EXE) $(LIBS) -luuid -lole32 $(EXTRA_LIBS)"; >> pathdef.c - @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c - @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c -endif +# Do not change this. +UNDER_CYGWIN = yes +include Make_cyg_ming.mak diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak new file mode 100644 index 0000000000..e4764c52bf --- /dev/null +++ b/src/Make_cyg_ming.mak @@ -0,0 +1,847 @@ +# Makefile for VIM on Win32 (Cygwin and MinGW) +# +# This file contains common part for Cygwin and MinGW and it is included +# from Make_cyg.mak and Make_ming.mak. +# +# Info at http://www.mingw.org +# Alternative x86 and 64-builds: http://mingw-w64.sourceforge.net +# Also requires GNU make, which you can download from the same sites. +# Get missing libraries from http://gnuwin32.sf.net. +# +# Tested on Win32 NT 4 and Win95. +# +# To make everything, just 'make -f Make_ming.mak'. +# To make just e.g. gvim.exe, 'make -f Make_ming.mak gvim.exe'. +# After a run, you can 'make -f Make_ming.mak clean' to clean up. +# +# NOTE: Sometimes 'GNU Make' will stop after building vimrun.exe -- I think +# it's just run out of memory or something. Run again, and it will continue +# with 'xxd'. +# +# "make upx" makes *compressed* versions of the 32 bit GUI and console EXEs, +# using the excellent UPX compressor: +# http://upx.sourceforge.net/ +# "make mpress" uses the MPRESS compressor for 32- and 64-bit EXEs: +# http://www.matcode.com/mpress.htm +# +# Maintained by Ron Aaron et al. +# Updated 2014 Oct 13. + +#>>>>> choose options: +# set to yes for a debug build +DEBUG=no +# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization +OPTIMIZE=MAXSPEED +# set to yes to make gvim, no for vim +GUI=yes +# set to yes if you want to use DirectWrite (DirectX) +# MinGW-w64 is needed, and ARCH should be set to i686 or x86-64. +DIRECTX=no +# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE] +# Set to TINY to make minimal version (few features). +FEATURES=BIG +# Set to one of i386, i486, i586, i686 as the minimum target processor. +# For amd64/x64 architecture set ARCH=x86-64 . +ARCH=i386 +# Set to yes to cross-compile from unix; no=native Windows (and Cygwin). +CROSS=no +# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'. +#ICONV="." +ICONV=yes +GETTEXT=yes +# Set to yes to include multibyte support. +MBYTE=yes +# Set to yes to include IME support. +IME=yes +DYNAMIC_IME=yes +# Set to yes to enable writing a postscript file with :hardcopy. +POSTSCRIPT=no +# Set to yes to enable OLE support. +OLE=no +# Set the default $(WINVER) to make it work with pre-Win2k. +ifndef WINVER +WINVER = 0x0500 +endif +# Set to yes to enable Cscope support. +CSCOPE=yes +# Set to yes to enable Netbeans support. +NETBEANS=$(GUI) + + +# Link against the shared version of libstdc++ by default. Set +# STATIC_STDCPLUS to "yes" to link against static version instead. +ifndef STATIC_STDCPLUS +STATIC_STDCPLUS=no +endif + +# If the user doesn't want gettext, undefine it. +ifeq (no, $(GETTEXT)) +GETTEXT= +endif +# Added by E.F. Amatria 2001 Feb 23 +# Uncomment the first line and one of the following three if you want Native Language +# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by +# Franco Bez . It may be found at +# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html +# Tested with mingw32 with GCC-2.95.2 on Win98 +# Updated 2001 Jun 9 +#GETTEXT=c:/gettext.win32.msvcrt +#STATIC_GETTEXT=USE_STATIC_GETTEXT +#DYNAMIC_GETTEXT=USE_GETTEXT_DLL +#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL +SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o +# Alternatively, if you uncomment the two following lines, you get a "safe" version +# without linking the safe_gettext_dll.o object file. +#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT +#GETTEXT_DYNAMIC=gnu_gettext.dll +INTLPATH=$(GETTEXT)/lib/mingw32 +INTLLIB=gnu_gettext + +# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext +# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/ +# uncomment the following, but I can't build a static version with them, ?-(| +#GETTEXT=c:/gettext-0.10.37-20010430 +#STATIC_GETTEXT=USE_STATIC_GETTEXT +#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT +#INTLPATH=$(GETTEXT)/lib +#INTLLIB=intl + +# Perl interface: +# PERL=[Path to Perl directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_PERL=yes (to load the Perl DLL dynamically) +# PERL_VER=[Perl version, eg 56, 58, 510] (default is 56) +ifdef PERL +ifndef PERL_VER +PERL_VER=56 +endif +ifndef DYNAMIC_PERL +DYNAMIC_PERL=yes +endif +# on Linux, for cross-compile, it's here: +#PERLLIB=/home/ron/ActivePerl/lib +# on NT, it's here: +PERLEXE=$(PERL)/bin/perl +PERLLIB=$(PERL)/lib +PERLLIBS=$(PERLLIB)/Core +ifeq ($(UNDER_CYGWIN),yes) +PERLTYPEMAP:=$(shell cygpath -m $(PERLLIB)/ExtUtils/typemap) +XSUBPPTRY:=$(shell cygpath -m $(PERLLIB)/ExtUtils/xsubpp) +else +PERLTYPEMAP=$(PERLLIB)/ExtUtils/typemap +XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp +endif +XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'") +ifeq "$(XSUBPP_EXISTS)" "" +XSUBPP=$(PERLEXE) "$(XSUBPPTRY)" +else +XSUBPP=xsubpp +endif +endif + +# Lua interface: +# LUA=[Path to Lua directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_LUA=yes (to load the Lua DLL dynamically) +# LUA_VER=[Lua version, eg 51, 52] (default is 51) +ifdef LUA +ifndef DYNAMIC_LUA +DYNAMIC_LUA=yes +endif + +ifndef LUA_VER +LUA_VER=51 +endif + +ifeq (no,$(DYNAMIC_LUA)) +LUA_LIB = -L$(LUA)/lib -llua +endif + +endif + +# MzScheme interface: +# MZSCHEME=[Path to MzScheme directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_MZSCHEME=yes (to load the MzScheme DLL dynamically) +# MZSCHEME_VER=[MzScheme version] (default is 205_000) +# MZSCHEME_DEBUG=no +ifdef MZSCHEME +ifndef DYNAMIC_MZSCHEME +DYNAMIC_MZSCHEME=yes +endif + +ifndef MZSCHEME_VER +MZSCHEME_VER=205_000 +endif + +ifndef MZSCHEME_PRECISE_GC +MZSCHEME_PRECISE_GC=no +endif + +# for version 4.x we need to generate byte-code for Scheme base +ifndef MZSCHEME_GENERATE_BASE +MZSCHEME_GENERATE_BASE=no +endif + +ifndef MZSCHEME_USE_RACKET +MZSCHEME_MAIN_LIB=mzsch +else +MZSCHEME_MAIN_LIB=racket +endif + +ifeq (no,$(DYNAMIC_MZSCHEME)) +ifeq (yes,$(MZSCHEME_PRECISE_GC)) +MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) +else +MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER) +endif +# the modern MinGW can dynamically link to dlls directly. +# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll +ifndef MZSCHEME_DLLS +MZSCHEME_DLLS=$(MZSCHEME) +endif +MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib +endif + +endif + +# Python interface: +# PYTHON=[Path to Python directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_PYTHON=yes (to load the Python DLL dynamically) +# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 22) +ifdef PYTHON +ifndef DYNAMIC_PYTHON +DYNAMIC_PYTHON=yes +endif + +ifndef PYTHON_VER +PYTHON_VER=22 +endif + +ifeq (no,$(DYNAMIC_PYTHON)) +PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER) +endif +# my include files are in 'win32inc' on Linux, and 'include' in the standard +# NT distro (ActiveState) +ifeq ($(CROSS),no) +PYTHONINC=-I $(PYTHON)/include +else +PYTHONINC=-I $(PYTHON)/win32inc +endif +endif + +# Python3 interface: +# PYTHON3=[Path to Python3 directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_PYTHON3=yes (to load the Python3 DLL dynamically) +# PYTHON3_VER=[Python3 version, eg 31, 32] (default is 31) +ifdef PYTHON3 +ifndef DYNAMIC_PYTHON3 +DYNAMIC_PYTHON3=yes +endif + +ifndef PYTHON3_VER +PYTHON3_VER=31 +endif + +ifeq (no,$(DYNAMIC_PYTHON3)) +PYTHON3LIB=-L$(PYTHON3)/libs -lPYTHON$(PYTHON3_VER) +endif + +ifeq ($(CROSS),no) +PYTHON3INC=-I $(PYTHON3)/include +else +PYTHON3INC=-I $(PYTHON3)/win32inc +endif +endif + +# TCL interface: +# TCL=[Path to TCL directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_TCL=yes (to load the TCL DLL dynamically) +# TCL_VER=[TCL version, eg 83, 84] (default is 83) +ifdef TCL +ifndef DYNAMIC_TCL +DYNAMIC_TCL=yes +endif +ifndef TCL_VER +TCL_VER = 83 +endif +TCLINC += -I$(TCL)/include +endif + + +# Ruby interface: +# RUBY=[Path to Ruby directory] (Set inside Make_cyg.mak or Make_ming.mak) +# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically) +# RUBY_VER=[Ruby version, eg 18, 19, 20] (default is 18) +# RUBY_VER_LONG=[Ruby version, eg 1.8, 1.9.1, 2.0.0] (default is 1.8) +# You must set RUBY_VER_LONG when changing RUBY_VER. +# RUBY_API_VER is derived from RUBY_VER_LONG. +# Note: If you use Ruby 1.9.3, set as follows: +# RUBY_VER=19 +# RUBY_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.) +ifdef RUBY +ifndef DYNAMIC_RUBY +DYNAMIC_RUBY=yes +endif +# Set default value +ifndef RUBY_VER +RUBY_VER = 18 +endif +ifndef RUBY_VER_LONG +RUBY_VER_LONG = 1.8 +endif +ifndef RUBY_API_VER +RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG)) +endif + +ifndef RUBY_PLATFORM +ifeq ($(RUBY_VER), 16) +RUBY_PLATFORM = i586-mswin32 +else +ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),) +RUBY_PLATFORM = i386-mingw32 +else +ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),) +RUBY_PLATFORM = x64-mingw32 +else +RUBY_PLATFORM = i386-mswin32 +endif +endif +endif +endif + +ifndef RUBY_INSTALL_NAME +ifeq ($(RUBY_VER), 16) +RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER) +else +ifeq ($(ARCH),x86-64) +RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER) +else +RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER) +endif +endif +endif + +ifeq (19, $(word 1,$(sort 19 $(RUBY_VER)))) +RUBY_19_OR_LATER = 1 +endif + +RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM) +ifdef RUBY_19_OR_LATER +RUBYINC += -I $(RUBY)/include/ruby-$(RUBY_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM) +endif +ifeq (no, $(DYNAMIC_RUBY)) +RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME) +endif + +endif # RUBY + +# See feature.h for a list of options. +# Any other defines can be included here. +DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD +DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \ + -DHAVE_PATHDEF -DFEAT_$(FEATURES) +ifeq ($(ARCH),x86-64) +DEFINES+=-DMS_WIN64 +endif +ifeq ($(CROSS),yes) +# cross-compiler prefix: +ifndef CROSS_COMPILE +CROSS_COMPILE = i586-pc-mingw32msvc- +endif +DEL = rm +MKDIR = mkdir -p +DIRSLASH = / +else +# normal (Windows) compilation: +ifndef CROSS_COMPILE +CROSS_COMPILE = +endif +ifneq (sh.exe, $(SHELL)) +DEL = rm +MKDIR = mkdir -p +DIRSLASH = / +else +DEL = del +MKDIR = mkdir +DIRSLASH = \\ +endif +endif +CC := $(CROSS_COMPILE)gcc +CXX := $(CROSS_COMPILE)g++ +WINDRES := $(CROSS_COMPILE)windres +WINDRES_CC = $(CC) + +#>>>>> end of choices +########################################################################### + +CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall +WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED +EXTRA_LIBS = + +ifdef GETTEXT +DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H +GETTEXTINCLUDE = $(GETTEXT)/include +GETTEXTLIB = $(INTLPATH) +ifeq (yes, $(GETTEXT)) +DEFINES += -DDYNAMIC_GETTEXT +else +ifdef DYNAMIC_GETTEXT +DEFINES += -D$(DYNAMIC_GETTEXT) +ifdef GETTEXT_DYNAMIC +DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\" +endif +endif +endif +endif + +ifdef PERL +CFLAGS += -I$(PERLLIBS) -DFEAT_PERL +ifeq (yes, $(DYNAMIC_PERL)) +CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\" +EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER) +endif +endif + +ifdef LUA +CFLAGS += -I$(LUA)/include -I$(LUA) -DFEAT_LUA +ifeq (yes, $(DYNAMIC_LUA)) +CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\" +endif +endif + +ifdef MZSCHEME +CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\" +ifeq (yes, $(DYNAMIC_MZSCHEME)) +CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" +endif +ifeq (yes, "$(MZSCHEME_DEBUG)") +CFLAGS += -DMZSCHEME_FORCE_GC +endif +endif + +ifdef RUBY +CFLAGS += -DFEAT_RUBY $(RUBYINC) +ifeq (yes, $(DYNAMIC_RUBY)) +CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" +CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER) +endif +ifneq ($(findstring w64-mingw32,$(CC)),) +# A workaround for MinGW-w64 +CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE +endif +endif + +ifdef PYTHON +CFLAGS += -DFEAT_PYTHON +ifeq (yes, $(DYNAMIC_PYTHON)) +CFLAGS += -DDYNAMIC_PYTHON +endif +endif + +ifdef PYTHON3 +CFLAGS += -DFEAT_PYTHON3 +ifeq (yes, $(DYNAMIC_PYTHON3)) +CFLAGS += -DDYNAMIC_PYTHON3 +endif +endif + +ifdef TCL +CFLAGS += -DFEAT_TCL $(TCLINC) +ifeq (yes, $(DYNAMIC_TCL)) +CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\" +endif +endif + +ifeq ($(POSTSCRIPT),yes) +DEFINES += -DMSWINPS +endif + +ifeq (yes, $(OLE)) +DEFINES += -DFEAT_OLE +endif + +ifeq ($(CSCOPE),yes) +DEFINES += -DFEAT_CSCOPE +endif + +ifeq ($(NETBEANS),yes) +# Only allow NETBEANS for a GUI build. +ifeq (yes, $(GUI)) +DEFINES += -DFEAT_NETBEANS_INTG + +ifeq ($(NBDEBUG), yes) +DEFINES += -DNBDEBUG +NBDEBUG_INCL = nbdebug.h +NBDEBUG_SRC = nbdebug.c +endif +endif +endif + +# DirectWrite (DirectX) +ifeq ($(DIRECTX),yes) +# Only allow DirectWrite for a GUI build. +ifeq (yes, $(GUI)) +DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX +endif +endif + +# Only allow XPM for a GUI build. +ifeq (yes, $(GUI)) + +ifndef XPM +ifeq ($(ARCH),i386) +XPM = xpm/x86 +endif +ifeq ($(ARCH),i486) +XPM = xpm/x86 +endif +ifeq ($(ARCH),i586) +XPM = xpm/x86 +endif +ifeq ($(ARCH),i686) +XPM = xpm/x86 +endif +ifeq ($(ARCH),x86-64) +XPM = xpm/x64 +endif +endif +ifdef XPM +ifneq ($(XPM),no) +CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include +endif +endif + +endif + +ifeq ($(DEBUG),yes) +CFLAGS += -g -fstack-check +DEBUG_SUFFIX=d +else +ifeq ($(OPTIMIZE), SIZE) +CFLAGS += -Os +else +ifeq ($(OPTIMIZE), MAXSPEED) +CFLAGS += -O3 +CFLAGS += -fomit-frame-pointer -freg-struct-return +else # SPEED +CFLAGS += -O2 +endif +endif +CFLAGS += -s +endif + +LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion +GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o +OBJ = \ + $(OUTDIR)/blowfish.o \ + $(OUTDIR)/buffer.o \ + $(OUTDIR)/charset.o \ + $(OUTDIR)/crypt.o \ + $(OUTDIR)/crypt_zip.o \ + $(OUTDIR)/diff.o \ + $(OUTDIR)/digraph.o \ + $(OUTDIR)/edit.o \ + $(OUTDIR)/eval.o \ + $(OUTDIR)/ex_cmds.o \ + $(OUTDIR)/ex_cmds2.o \ + $(OUTDIR)/ex_docmd.o \ + $(OUTDIR)/ex_eval.o \ + $(OUTDIR)/ex_getln.o \ + $(OUTDIR)/fileio.o \ + $(OUTDIR)/fold.o \ + $(OUTDIR)/getchar.o \ + $(OUTDIR)/hardcopy.o \ + $(OUTDIR)/hashtab.o \ + $(OUTDIR)/main.o \ + $(OUTDIR)/mark.o \ + $(OUTDIR)/memfile.o \ + $(OUTDIR)/memline.o \ + $(OUTDIR)/menu.o \ + $(OUTDIR)/message.o \ + $(OUTDIR)/misc1.o \ + $(OUTDIR)/misc2.o \ + $(OUTDIR)/move.o \ + $(OUTDIR)/mbyte.o \ + $(OUTDIR)/normal.o \ + $(OUTDIR)/ops.o \ + $(OUTDIR)/option.o \ + $(OUTDIR)/os_win32.o \ + $(OUTDIR)/os_mswin.o \ + $(OUTDIR)/winclip.o \ + $(OUTDIR)/pathdef.o \ + $(OUTDIR)/popupmnu.o \ + $(OUTDIR)/quickfix.o \ + $(OUTDIR)/regexp.o \ + $(OUTDIR)/screen.o \ + $(OUTDIR)/search.o \ + $(OUTDIR)/sha256.o \ + $(OUTDIR)/spell.o \ + $(OUTDIR)/syntax.o \ + $(OUTDIR)/tag.o \ + $(OUTDIR)/term.o \ + $(OUTDIR)/ui.o \ + $(OUTDIR)/undo.o \ + $(OUTDIR)/version.o \ + $(OUTDIR)/vimrc.o \ + $(OUTDIR)/window.o + +ifdef PERL +OBJ += $(OUTDIR)/if_perl.o +endif +ifdef LUA +OBJ += $(OUTDIR)/if_lua.o +endif +ifdef MZSCHEME +OBJ += $(OUTDIR)/if_mzsch.o +MZSCHEME_INCL = if_mzsch.h +ifeq (yes,$(MZSCHEME_GENERATE_BASE)) +CFLAGS += -DINCLUDE_MZSCHEME_BASE +MZ_EXTRA_DEP += mzscheme_base.c +endif +ifeq (yes,$(MZSCHEME_PRECISE_GC)) +CFLAGS += -DMZ_PRECISE_GC +endif +endif +ifdef PYTHON +OBJ += $(OUTDIR)/if_python.o +endif +ifdef PYTHON3 +OBJ += $(OUTDIR)/if_python3.o +endif +ifdef RUBY +OBJ += $(OUTDIR)/if_ruby.o +endif +ifdef TCL +OBJ += $(OUTDIR)/if_tcl.o +endif +ifeq ($(CSCOPE),yes) +OBJ += $(OUTDIR)/if_cscope.o +endif +ifeq ($(NETBEANS),yes) +# Only allow NETBEANS for a GUI build. +ifeq (yes, $(GUI)) +OBJ += $(OUTDIR)/netbeans.o +LIB += -lwsock32 +endif +endif +ifeq ($(DIRECTX),yes) +# Only allow DIRECTX for a GUI build. +ifeq (yes, $(GUI)) +OBJ += $(OUTDIR)/gui_dwrite.o +LIB += -ld2d1 -ldwrite +USE_STDCPLUS = yes +endif +endif +ifneq ($(XPM),no) +# Only allow XPM for a GUI build. +ifeq (yes, $(GUI)) +OBJ += $(OUTDIR)/xpm_w32.o +# You'll need libXpm.a from http://gnuwin32.sf.net +LIB += -L$(XPM)/lib -lXpm +endif +endif + + +ifdef MZSCHEME +MZSCHEME_SUFFIX = Z +endif + +ifeq ($(GUI),yes) +TARGET := gvim$(DEBUG_SUFFIX).exe +DEFINES += $(DEF_GUI) +OBJ += $(GUIOBJ) +LFLAGS += -mwindows +OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) +else +TARGET := vim$(DEBUG_SUFFIX).exe +OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) +endif + +ifdef GETTEXT +ifneq (yes, $(GETTEXT)) +CFLAGS += -I$(GETTEXTINCLUDE) +ifndef STATIC_GETTEXT +LIB += -L$(GETTEXTLIB) -l$(INTLLIB) +ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT)) +OBJ+=$(SAFE_GETTEXT_DLL_OBJ) +endif +else +LIB += -L$(GETTEXTLIB) -lintl +endif +endif +endif + +ifdef PERL +ifeq (no, $(DYNAMIC_PERL)) +LIB += -L$(PERLLIBS) -lperl$(PERL_VER) +endif +endif + +ifdef TCL +LIB += -L$(TCL)/lib +ifeq (yes, $(DYNAMIC_TCL)) +LIB += -ltclstub$(TCL_VER) +else +LIB += -ltcl$(TCL_VER) +endif +endif + +ifeq (yes, $(OLE)) +LIB += -loleaut32 +OBJ += $(OUTDIR)/if_ole.o +USE_STDCPLUS = yes +endif + +ifeq (yes, $(MBYTE)) +DEFINES += -DFEAT_MBYTE +endif + +ifeq (yes, $(IME)) +DEFINES += -DFEAT_MBYTE_IME +ifeq (yes, $(DYNAMIC_IME)) +DEFINES += -DDYNAMIC_IME +else +LIB += -limm32 +endif +endif + +ifdef ICONV +ifneq (yes, $(ICONV)) +LIB += -L$(ICONV) +CFLAGS += -I$(ICONV) +endif +DEFINES+=-DDYNAMIC_ICONV +endif + +ifeq (yes, $(USE_STDCPLUS)) +ifeq (yes, $(STATIC_STDCPLUS)) +LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic +else +LIB += -lstdc++ +endif +endif + +all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll + +vimrun.exe: vimrun.c + $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB) + +install.exe: dosinst.c + $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid + +uninstal.exe: uninstal.c + $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB) + +$(TARGET): $(OUTDIR) $(OBJ) + $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB) + +upx: exes + upx gvim.exe + upx vim.exe + +mpress: exes + mpress gvim.exe + mpress vim.exe + +xxd/xxd.exe: xxd/xxd.c + $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)' + +GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h + $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS) + +clean: + -$(DEL) $(OUTDIR)$(DIRSLASH)*.o + -$(DEL) $(OUTDIR)$(DIRSLASH)*.res + -rmdir $(OUTDIR) + -$(DEL) *.exe + -$(DEL) pathdef.c +ifdef PERL + -$(DEL) if_perl.c +endif +ifdef MZSCHEME + -$(DEL) mzscheme_base.c +endif + $(MAKE) -C GvimExt -f Make_ming.mak clean + $(MAKE) -C xxd -f Make_ming.mak clean + +########################################################################### +INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \ + structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \ + gui.h + +$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL) + $(CC) -c $(CFLAGS) $(PYTHONINC) -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" $< -o $@ + +$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL) + $(CC) -c $(CFLAGS) $(PYTHON3INC) -DDYNAMIC_PYTHON3_DLL=\"PYTHON$(PYTHON3_VER).dll\" $< -o $@ + +$(OUTDIR)/%.o : %.c $(INCL) + $(CC) -c $(CFLAGS) $< -o $@ + +$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h + $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \ + --input-format=rc --output-format=coff -i vim.rc -o $@ + +$(OUTDIR): + $(MKDIR) $(OUTDIR) + +$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h + $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o + +$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h + $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o + +$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL) + $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o + +$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h + $(CC) -c $(CFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o + +$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h + $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o + +# Remove -D__IID_DEFINED__ for newer versions of the w32api +$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) + $(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp + +$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL) +ifeq (16, $(RUBY)) + $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c +endif + +if_perl.c: if_perl.xs typemap + $(XSUBPP) -prototypes -typemap \ + "$(PERLTYPEMAP)" if_perl.xs > $@ + +$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC) + $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o + +$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL) + $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o + +$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP) + $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o + +mzscheme_base.c: + $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base + +pathdef.c: $(INCL) +ifneq (sh.exe, $(SHELL)) + @echo creating pathdef.c + @echo '/* pathdef.c */' > pathdef.c + @echo '#include "vim.h"' >> pathdef.c + @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c + @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c + @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c + @echo 'char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)";' >> pathdef.c + @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c + @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c +else + @echo creating pathdef.c + @echo /* pathdef.c */ > pathdef.c + @echo #include "vim.h" >> pathdef.c + @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c + @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c + @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c + @echo char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)"; >> pathdef.c + @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c + @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c +endif diff --git a/src/Make_ming.mak b/src/Make_ming.mak index 19b4c2fe3d..9ed1a7000a 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -1,193 +1,27 @@ -# Makefile for VIM on Win32 # -# Info at http://www.mingw.org -# Alternative x86 and 64-builds: http://mingw-w64.sourceforge.net -# Also requires GNU make, which you can download from the same sites. -# Get missing libraries from http://gnuwin32.sf.net. +# Makefile for VIM on Win32, using MinGW # -# Tested on Win32 NT 4 and Win95. +# Also read INSTALLpc.txt! # -# To make everything, just 'make -f Make_ming.mak'. -# To make just e.g. gvim.exe, 'make -f Make_ming.mak gvim.exe'. -# After a run, you can 'make -f Make_ming.mak clean' to clean up. +# The old Make_ming.mak (maintained by Ron Aaron et al.) was merged into +# Make_cyg_ming.mak. +# This file contains MinGW specific settings. Common settings are contained +# in Make_cyg_ming.mak. # -# NOTE: Sometimes 'GNU Make' will stop after building vimrun.exe -- I think -# it's just run out of memory or something. Run again, and it will continue -# with 'xxd'. -# -# "make upx" makes *compressed* versions of the 32 bit GUI and console EXEs, -# using the excellent UPX compressor: -# http://upx.sourceforge.net/ -# "make mpress" uses the MPRESS compressor for 32- and 64-bit EXEs: -# http://www.matcode.com/mpress.htm -# -# Maintained by Ron Aaron et al. -# Updated 2014 Oct 13. +# Last updated by Ken Takata. +# Last Change: 2014 Oct 21 -#>>>>> choose options: -# set to yes for a debug build -DEBUG=no -# set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization -OPTIMIZE=MAXSPEED -# set to yes to make gvim, no for vim -GUI=yes -# set to yes if you want to use DirectWrite (DirectX) -DIRECTX=no -# FEATURES=[TINY | SMALL | NORMAL | BIG | HUGE] -# Set to TINY to make minimal version (few features). -FEATURES=BIG -# Set to one of i386, i486, i586, i686 as the minimum target processor. -# For amd64/x64 architecture set ARCH=x86-64 . -ARCH=i386 -# Set to yes to cross-compile from unix; no=native Windows. -CROSS=no -# Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'. -#ICONV="." -ICONV=yes -GETTEXT=yes -# Set to yes to include multibyte support. -MBYTE=yes -# Set to yes to include IME support. -IME=yes -DYNAMIC_IME=yes -# Set to yes to enable writing a postscript file with :hardcopy. -POSTSCRIPT=no -# Set to yes to enable OLE support. -OLE=no -# Set the default $(WINVER) to make it work with pre-Win2k. -ifndef WINVER -WINVER = 0x0500 -endif -# Set to yes to enable Cscope support. -CSCOPE=yes -# Set to yes to enable Netbeans support. -NETBEANS=$(GUI) - - -# Link against the shared version of libstdc++ by default. Set -# STATIC_STDCPLUS to "yes" to link against static version instead. -ifndef STATIC_STDCPLUS -STATIC_STDCPLUS=no -endif - -# If the user doesn't want gettext, undefine it. -ifeq (no, $(GETTEXT)) -GETTEXT= -endif -# Added by E.F. Amatria 2001 Feb 23 -# Uncomment the first line and one of the following three if you want Native Language -# Support. You'll need gnu_gettext.win32, a MINGW32 Windows PORT of gettext by -# Franco Bez . It may be found at -# http://home.a-city.de/franco.bez/gettext/gettext_win32_en.html -# Tested with mingw32 with GCC-2.95.2 on Win98 -# Updated 2001 Jun 9 -#GETTEXT=c:/gettext.win32.msvcrt -#STATIC_GETTEXT=USE_STATIC_GETTEXT -#DYNAMIC_GETTEXT=USE_GETTEXT_DLL -#DYNAMIC_GETTEXT=USE_SAFE_GETTEXT_DLL -SAFE_GETTEXT_DLL_OBJ = $(GETTEXT)/src/safe_gettext_dll/safe_gettext_dll.o -# Alternatively, if you uncomment the two following lines, you get a "safe" version -# without linking the safe_gettext_dll.o object file. -#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT -#GETTEXT_DYNAMIC=gnu_gettext.dll -INTLPATH=$(GETTEXT)/lib/mingw32 -INTLLIB=gnu_gettext - -# If you are using gettext-0.10.35 from http://sourceforge.net/projects/gettext -# or gettext-0.10.37 from http://sourceforge.net/projects/mingwrep/ -# uncomment the following, but I can't build a static version with them, ?-(| -#GETTEXT=c:/gettext-0.10.37-20010430 -#STATIC_GETTEXT=USE_STATIC_GETTEXT -#DYNAMIC_GETTEXT=DYNAMIC_GETTEXT -#INTLPATH=$(GETTEXT)/lib -#INTLLIB=intl # uncomment 'PERL' if you want a perl-enabled version -#PERL=C:/perl -ifdef PERL -ifndef PERL_VER -PERL_VER=56 -endif -ifndef DYNAMIC_PERL -DYNAMIC_PERL=yes -endif -# on Linux, for cross-compile, it's here: -#PERLLIB=/home/ron/ActivePerl/lib -# on NT, it's here: -PERLLIB=$(PERL)/lib -PERLLIBS=$(PERLLIB)/Core -XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp -XSUBPP_EXISTS=$(shell perl -e "print 1 unless -e '$(XSUBPPTRY)'") -ifeq "$(XSUBPP_EXISTS)" "" -XSUBPP=perl $(XSUBPPTRY) -else -XSUBPP=xsubpp -endif -endif +#PERL=c:/perl # uncomment 'LUA' if you want a Lua-enabled version -#LUA=/usr/local -ifdef LUA -ifndef DYNAMIC_LUA -DYNAMIC_LUA=yes -endif - -ifndef LUA_VER -LUA_VER=51 -endif - -ifeq (no,$(DYNAMIC_LUA)) -LUA_LIB = -L$(LUA)/lib -llua -endif - -endif +#LUA=c:/lua # uncomment 'MZSCHEME' if you want a MzScheme-enabled version #MZSCHEME=d:/plt -ifdef MZSCHEME -ifndef DYNAMIC_MZSCHEME -DYNAMIC_MZSCHEME=yes -endif -ifndef MZSCHEME_VER -MZSCHEME_VER=205_000 -endif - -ifndef MZSCHEME_PRECISE_GC -MZSCHEME_PRECISE_GC=no -endif - -# for version 4.x we need to generate byte-code for Scheme base -ifndef MZSCHEME_GENERATE_BASE -MZSCHEME_GENERATE_BASE=no -endif - -ifndef MZSCHEME_USE_RACKET -MZSCHEME_MAIN_LIB=mzsch -else -MZSCHEME_MAIN_LIB=racket -endif - -ifeq (no,$(DYNAMIC_MZSCHEME)) -ifeq (yes,$(MZSCHEME_PRECISE_GC)) -MZSCHEME_LIB=-l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -else -MZSCHEME_LIB = -l$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER) -lmzgc$(MZSCHEME_VER) -endif -# the modern MinGW can dynamically link to dlls directly. -# point MZSCHEME_DLLS to where you put libmzschXXXXXXX.dll and libgcXXXXXXX.dll -ifndef MZSCHEME_DLLS -MZSCHEME_DLLS=$(MZSCHEME) -endif -MZSCHEME_LIBDIR=-L$(MZSCHEME_DLLS) -L$(MZSCHEME_DLLS)\lib -endif - -endif - -# Python support -- works with the ActiveState python 2.0 release (and others -# too, probably) -# -# uncomment 'PYTHON' to make python-enabled version +# uncomment 'PYTHON' if you want a python-enabled version # Put the path to the python distro here. If cross compiling from Linux, you # will also need to convert the header files to unix instead of dos format: # for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil @@ -200,631 +34,16 @@ endif # on my NT box, it's here: #PYTHON=c:/python20 -ifdef PYTHON -ifndef DYNAMIC_PYTHON -DYNAMIC_PYTHON=yes -endif +# uncomment 'PYTHON3' if you want a python3-enabled version +#PYTHON3=c:/python31 -ifndef PYTHON_VER -PYTHON_VER=22 -endif - -ifeq (no,$(DYNAMIC_PYTHON)) -PYTHONLIB=-L$(PYTHON)/libs -lpython$(PYTHON_VER) -endif -# my include files are in 'win32inc' on Linux, and 'include' in the standard -# NT distro (ActiveState) -ifeq ($(CROSS),no) -PYTHONINC=-I $(PYTHON)/include -else -PYTHONINC=-I $(PYTHON)/win32inc -endif -endif - -#PYTHON3: See comment for Python 2 above - -ifdef PYTHON3 -ifndef DYNAMIC_PYTHON3 -DYNAMIC_PYTHON3=yes -endif - -ifndef PYTHON3_VER -PYTHON3_VER=31 -endif - -ifeq (no,$(DYNAMIC_PYTHON3)) -PYTHON3LIB=-L$(PYTHON3)/libs -lPYTHON$(PYTHON3_VER) -endif - -ifeq ($(CROSS),no) -PYTHON3INC=-I $(PYTHON3)/include -else -PYTHON3INC=-I $(PYTHON3)/win32inc -endif -endif - -# TCL interface: -# TCL=[Path to TCL directory] -# DYNAMIC_TCL=yes (to load the TCL DLL dynamically) -# TCL_VER=[TCL version, eg 83, 84] (default is 83) +# uncomment 'TCL' if you want a Tcl-enabled version #TCL=c:/tcl -ifdef TCL -ifndef DYNAMIC_TCL -DYNAMIC_TCL=yes -endif -ifndef TCL_VER -TCL_VER = 83 -endif -TCLINC += -I$(TCL)/include -endif - -# Ruby interface: -# RUBY=[Path to Ruby directory] -# DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically) -# RUBY_VER=[Ruby version, eg 16, 17] (default is 16) -# RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.6) -# You must set RUBY_VER_LONG when changing RUBY_VER. -# You must set RUBY_API_VER version to RUBY_VER_LONG. -# Don't set ruby API version to RUBY_VER like 191. +# uncomment 'RUBY' if you want a Ruby-enabled version #RUBY=c:/ruby -ifdef RUBY -ifndef DYNAMIC_RUBY -DYNAMIC_RUBY=yes -endif -# Set default value -ifndef RUBY_VER -RUBY_VER = 16 -endif -ifndef RUBY_VER_LONG -RUBY_VER_LONG = 1.6 -endif -ifndef RUBY_API_VER -RUBY_API_VER = $(subst .,,$(RUBY_VER_LONG)) -endif -ifndef RUBY_PLATFORM -ifeq ($(RUBY_VER), 16) -RUBY_PLATFORM = i586-mswin32 -else -ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/i386-mingw32),) -RUBY_PLATFORM = i386-mingw32 -else -ifneq ($(wildcard $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/x64-mingw32),) -RUBY_PLATFORM = x64-mingw32 -else -RUBY_PLATFORM = i386-mswin32 -endif -endif -endif -endif -ifndef RUBY_INSTALL_NAME -ifeq ($(RUBY_VER), 16) -RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_API_VER) -else -ifeq ($(ARCH),x86-64) -RUBY_INSTALL_NAME = x64-msvcrt-ruby$(RUBY_API_VER) -else -RUBY_INSTALL_NAME = msvcrt-ruby$(RUBY_API_VER) -endif -endif -endif - -ifeq (19, $(word 1,$(sort 19 $(RUBY_VER)))) -RUBY_19_OR_LATER = 1 -endif - -RUBYINC = -I $(RUBY)/lib/ruby/$(RUBY_VER_LONG)/$(RUBY_PLATFORM) -ifdef RUBY_19_OR_LATER -RUBYINC += -I $(RUBY)/include/ruby-$(RUBY_VER_LONG) -I $(RUBY)/include/ruby-$(RUBY_VER_LONG)/$(RUBY_PLATFORM) -endif -ifeq (no, $(DYNAMIC_RUBY)) -RUBYLIB = -L$(RUBY)/lib -l$(RUBY_INSTALL_NAME) -endif - -endif # RUBY - -# See feature.h for a list of options. -# Any other defines can be included here. -DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD -DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \ - -DHAVE_PATHDEF -DFEAT_$(FEATURES) -ifeq ($(ARCH),x86-64) -DEFINES+=-DMS_WIN64 -endif -ifeq ($(CROSS),yes) -# cross-compiler prefix: -CROSS_COMPILE = i586-pc-mingw32msvc- -DEL = rm -MKDIR = mkdir -p -DIRSLASH = / -else -# normal (Windows) compilation: -CROSS_COMPILE = -ifneq (sh.exe, $(SHELL)) -DEL = rm -MKDIR = mkdir -p -DIRSLASH = / -else -DEL = del -MKDIR = mkdir -DIRSLASH = \\ -endif -endif -CC := $(CROSS_COMPILE)gcc -WINDRES := $(CROSS_COMPILE)windres -WINDRES_CC = $(CC) - -#>>>>> end of choices -########################################################################### - -CFLAGS = -Iproto $(DEFINES) -pipe -w -march=$(ARCH) -Wall -WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED -EXTRA_LIBS = - -ifdef GETTEXT -DEFINES += -DHAVE_GETTEXT -DHAVE_LOCALE_H -GETTEXTINCLUDE = $(GETTEXT)/include -GETTEXTLIB = $(INTLPATH) -ifeq (yes, $(GETTEXT)) -DEFINES += -DDYNAMIC_GETTEXT -else -ifdef DYNAMIC_GETTEXT -DEFINES += -D$(DYNAMIC_GETTEXT) -ifdef GETTEXT_DYNAMIC -DEFINES += -DGETTEXT_DYNAMIC -DGETTEXT_DLL=\"$(GETTEXT_DYNAMIC)\" -endif -endif -endif -endif - -ifdef PERL -CFLAGS += -I$(PERLLIBS) -DFEAT_PERL -ifeq (yes, $(DYNAMIC_PERL)) -CFLAGS += -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl$(PERL_VER).dll\" -EXTRA_LIBS += -L$(PERLLIBS) -lperl$(PERL_VER) -endif -endif - -ifdef LUA -CFLAGS += -I$(LUA)/include -DFEAT_LUA -ifeq (yes, $(DYNAMIC_LUA)) -CFLAGS += -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua$(LUA_VER).dll\" -endif -endif - -ifdef MZSCHEME -CFLAGS += -I$(MZSCHEME)/include -DFEAT_MZSCHEME -DMZSCHEME_COLLECTS=\"$(MZSCHEME)/collects\" -ifeq (yes, $(DYNAMIC_MZSCHEME)) -CFLAGS += -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"lib$(MZSCHEME_MAIN_LIB)$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\" -endif -ifeq (yes, "$(MZSCHEME_DEBUG)") -CFLAGS += -DMZSCHEME_FORCE_GC -endif -endif - -ifdef RUBY -CFLAGS += -DFEAT_RUBY $(RUBYINC) -ifeq (yes, $(DYNAMIC_RUBY)) -CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER) -endif -endif - -ifdef PYTHON -CFLAGS += -DFEAT_PYTHON -ifeq (yes, $(DYNAMIC_PYTHON)) -CFLAGS += -DDYNAMIC_PYTHON -endif -endif - -ifdef PYTHON3 -CFLAGS += -DFEAT_PYTHON3 -ifeq (yes, $(DYNAMIC_PYTHON3)) -CFLAGS += -DDYNAMIC_PYTHON3 -endif -endif - -ifdef TCL -CFLAGS += -DFEAT_TCL $(TCLINC) -ifeq (yes, $(DYNAMIC_TCL)) -CFLAGS += -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl$(TCL_VER).dll\" -endif -endif - -ifeq ($(POSTSCRIPT),yes) -DEFINES += -DMSWINPS -endif - -ifeq (yes, $(OLE)) -DEFINES += -DFEAT_OLE -endif - -ifeq ($(CSCOPE),yes) -DEFINES += -DFEAT_CSCOPE -endif - -ifeq ($(NETBEANS),yes) -# Only allow NETBEANS for a GUI build. -ifeq (yes, $(GUI)) -DEFINES += -DFEAT_NETBEANS_INTG - -ifeq ($(NBDEBUG), yes) -DEFINES += -DNBDEBUG -NBDEBUG_INCL = nbdebug.h -NBDEBUG_SRC = nbdebug.c -endif -endif -endif - -# DirectWrite (DirectX) -ifeq ($(DIRECTX),yes) -# Only allow DirectWrite for a GUI build. -ifeq (yes, $(GUI)) -DEFINES += -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -endif -endif - -# Only allow XPM for a GUI build. -ifeq (yes, $(GUI)) - -ifndef XPM -ifeq ($(ARCH),i386) -XPM = xpm/x86 -endif -ifeq ($(ARCH),i486) -XPM = xpm/x86 -endif -ifeq ($(ARCH),i586) -XPM = xpm/x86 -endif -ifeq ($(ARCH),i686) -XPM = xpm/x86 -endif -ifeq ($(ARCH),x86-64) -XPM = xpm/x64 -endif -endif -ifdef XPM -ifneq ($(XPM),no) -CFLAGS += -DFEAT_XPM_W32 -I $(XPM)/include -I $(XPM)/../include -endif -endif - -endif - -ifeq ($(DEBUG),yes) -CFLAGS += -g -fstack-check -DEBUG_SUFFIX=d -else -ifeq ($(OPTIMIZE), SIZE) -CFLAGS += -Os -else -ifeq ($(OPTIMIZE), MAXSPEED) -CFLAGS += -O3 -CFLAGS += -fomit-frame-pointer -freg-struct-return -else # SPEED -CFLAGS += -O2 -endif -endif -CFLAGS += -s -endif - -LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lversion -GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o $(OUTDIR)/os_w32exe.o -OBJ = \ - $(OUTDIR)/blowfish.o \ - $(OUTDIR)/buffer.o \ - $(OUTDIR)/charset.o \ - $(OUTDIR)/crypt.o \ - $(OUTDIR)/crypt_zip.o \ - $(OUTDIR)/diff.o \ - $(OUTDIR)/digraph.o \ - $(OUTDIR)/edit.o \ - $(OUTDIR)/eval.o \ - $(OUTDIR)/ex_cmds.o \ - $(OUTDIR)/ex_cmds2.o \ - $(OUTDIR)/ex_docmd.o \ - $(OUTDIR)/ex_eval.o \ - $(OUTDIR)/ex_getln.o \ - $(OUTDIR)/fileio.o \ - $(OUTDIR)/fold.o \ - $(OUTDIR)/getchar.o \ - $(OUTDIR)/hardcopy.o \ - $(OUTDIR)/hashtab.o \ - $(OUTDIR)/main.o \ - $(OUTDIR)/mark.o \ - $(OUTDIR)/memfile.o \ - $(OUTDIR)/memline.o \ - $(OUTDIR)/menu.o \ - $(OUTDIR)/message.o \ - $(OUTDIR)/misc1.o \ - $(OUTDIR)/misc2.o \ - $(OUTDIR)/move.o \ - $(OUTDIR)/mbyte.o \ - $(OUTDIR)/normal.o \ - $(OUTDIR)/ops.o \ - $(OUTDIR)/option.o \ - $(OUTDIR)/os_win32.o \ - $(OUTDIR)/os_mswin.o \ - $(OUTDIR)/winclip.o \ - $(OUTDIR)/pathdef.o \ - $(OUTDIR)/popupmnu.o \ - $(OUTDIR)/quickfix.o \ - $(OUTDIR)/regexp.o \ - $(OUTDIR)/screen.o \ - $(OUTDIR)/search.o \ - $(OUTDIR)/sha256.o \ - $(OUTDIR)/spell.o \ - $(OUTDIR)/syntax.o \ - $(OUTDIR)/tag.o \ - $(OUTDIR)/term.o \ - $(OUTDIR)/ui.o \ - $(OUTDIR)/undo.o \ - $(OUTDIR)/version.o \ - $(OUTDIR)/vimrc.o \ - $(OUTDIR)/window.o - -ifdef PERL -OBJ += $(OUTDIR)/if_perl.o -endif -ifdef LUA -OBJ += $(OUTDIR)/if_lua.o -endif -ifdef MZSCHEME -OBJ += $(OUTDIR)/if_mzsch.o -MZSCHEME_INCL = if_mzsch.h -ifeq (yes,$(MZSCHEME_GENERATE_BASE)) -CFLAGS += -DINCLUDE_MZSCHEME_BASE -MZ_EXTRA_DEP += mzscheme_base.c -endif -ifeq (yes,$(MZSCHEME_PRECISE_GC)) -CFLAGS += -DMZ_PRECISE_GC -endif -endif -ifdef PYTHON -OBJ += $(OUTDIR)/if_python.o -endif -ifdef PYTHON3 -OBJ += $(OUTDIR)/if_python3.o -endif -ifdef RUBY -OBJ += $(OUTDIR)/if_ruby.o -endif -ifdef TCL -OBJ += $(OUTDIR)/if_tcl.o -endif -ifeq ($(CSCOPE),yes) -OBJ += $(OUTDIR)/if_cscope.o -endif -ifeq ($(NETBEANS),yes) -# Only allow NETBEANS for a GUI build. -ifeq (yes, $(GUI)) -OBJ += $(OUTDIR)/netbeans.o -LIB += -lwsock32 -endif -endif -ifeq ($(DIRECTX),yes) -# Only allow DIRECTX for a GUI build. -ifeq (yes, $(GUI)) -OBJ += $(OUTDIR)/gui_dwrite.o -LIB += -ld2d1 -ldwrite -USE_STDCPLUS = yes -endif -endif -ifneq ($(XPM),no) -# Only allow XPM for a GUI build. -ifeq (yes, $(GUI)) -OBJ += $(OUTDIR)/xpm_w32.o -# You'll need libXpm.a from http://gnuwin32.sf.net -LIB += -L$(XPM)/lib -lXpm -endif -endif - - -ifdef MZSCHEME -MZSCHEME_SUFFIX = Z -endif - -ifeq ($(GUI),yes) -TARGET := gvim$(DEBUG_SUFFIX).exe -DEFINES += $(DEF_GUI) -OBJ += $(GUIOBJ) -LFLAGS += -mwindows -OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) -else -TARGET := vim$(DEBUG_SUFFIX).exe -OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) -endif - -ifdef GETTEXT -ifneq (yes, $(GETTEXT)) -CFLAGS += -I$(GETTEXTINCLUDE) -ifndef STATIC_GETTEXT -LIB += -L$(GETTEXTLIB) -l$(INTLLIB) -ifeq (USE_SAFE_GETTEXT_DLL, $(DYNAMIC_GETTEXT)) -OBJ+=$(SAFE_GETTEXT_DLL_OBJ) -endif -else -LIB += -L$(GETTEXTLIB) -lintl -endif -endif -endif - -ifdef PERL -ifeq (no, $(DYNAMIC_PERL)) -LIB += -L$(PERLLIBS) -lperl$(PERL_VER) -endif -endif - -ifdef TCL -LIB += -L$(TCL)/lib -ifeq (yes, $(DYNAMIC_TCL)) -LIB += -ltclstub$(TCL_VER) -else -LIB += -ltcl$(TCL_VER) -endif -endif - -ifeq (yes, $(OLE)) -LIB += -loleaut32 -OBJ += $(OUTDIR)/if_ole.o -USE_STDCPLUS = yes -endif - -ifeq (yes, $(MBYTE)) -DEFINES += -DFEAT_MBYTE -endif - -ifeq (yes, $(IME)) -DEFINES += -DFEAT_MBYTE_IME -ifeq (yes, $(DYNAMIC_IME)) -DEFINES += -DDYNAMIC_IME -else -LIB += -limm32 -endif -endif - -ifdef ICONV -ifneq (yes, $(ICONV)) -LIB += -L$(ICONV) -CFLAGS += -I$(ICONV) -endif -DEFINES+=-DDYNAMIC_ICONV -endif - -ifeq (yes, $(USE_STDCPLUS)) -ifeq (yes, $(STATIC_STDCPLUS)) -LIB += -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -else -LIB += -lstdc++ -endif -endif - -all: $(TARGET) vimrun.exe xxd/xxd.exe install.exe uninstal.exe GvimExt/gvimext.dll - -vimrun.exe: vimrun.c - $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB) - -install.exe: dosinst.c - $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid - -uninstal.exe: uninstal.c - $(CC) $(CFLAGS) -o uninstal.exe uninstal.c $(LIB) - -$(TARGET): $(OUTDIR) $(OBJ) - $(CC) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB) - -upx: exes - upx gvim.exe - upx vim.exe - -mpress: exes - mpress gvim.exe - mpress vim.exe - -xxd/xxd.exe: xxd/xxd.c - $(MAKE) -C xxd -f Make_ming.mak CC=$(CC) - -GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h - $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) - -clean: - -$(DEL) $(OUTDIR)$(DIRSLASH)*.o - -$(DEL) $(OUTDIR)$(DIRSLASH)*.res - -rmdir $(OUTDIR) - -$(DEL) *.exe - -$(DEL) pathdef.c -ifdef PERL - -$(DEL) if_perl.c -endif -ifdef MZSCHEME - -$(DEL) mzscheme_base.c -endif - $(MAKE) -C GvimExt -f Make_ming.mak clean - $(MAKE) -C xxd -f Make_ming.mak clean - -########################################################################### -INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \ - structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \ - gui.h - -$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL) - $(CC) -c $(CFLAGS) $(PYTHONINC) -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\" $< -o $@ - -$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL) - $(CC) -c $(CFLAGS) $(PYTHON3INC) -DDYNAMIC_PYTHON3_DLL=\"PYTHON$(PYTHON3_VER).dll\" $< -o $@ - -$(OUTDIR)/%.o : %.c $(INCL) - $(CC) -c $(CFLAGS) $< -o $@ - -$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h - $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \ - --input-format=rc --output-format=coff -i vim.rc -o $@ - -$(OUTDIR): - $(MKDIR) $(OUTDIR) - -$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h - $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o - -$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h - $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o - -$(OUTDIR)/gui_w32.o: gui_w32.c gui_w48.c $(INCL) - $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o - -$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h - $(CC) -c $(CFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o - -$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h - $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o - -# Remove -D__IID_DEFINED__ for newer versions of the w32api -$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) - $(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp - -$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL) -ifeq (16, $(RUBY)) - $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c -endif - -if_perl.c: if_perl.xs typemap - $(XSUBPP) -prototypes -typemap \ - $(PERLLIB)/ExtUtils/typemap if_perl.xs > $@ - -$(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC) - $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o - -$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL) - $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o - -$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP) - $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o - -mzscheme_base.c: - $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base - -pathdef.c: $(INCL) -ifneq (sh.exe, $(SHELL)) - @echo creating pathdef.c - @echo '/* pathdef.c */' > pathdef.c - @echo '#include "vim.h"' >> pathdef.c - @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> pathdef.c - @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> pathdef.c - @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> pathdef.c - @echo 'char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)";' >> pathdef.c - @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> pathdef.c - @echo 'char_u *compiled_sys = (char_u *)"$(USERDOMAIN)";' >> pathdef.c -else - @echo creating pathdef.c - @echo /* pathdef.c */ > pathdef.c - @echo #include "vim.h" >> pathdef.c - @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> pathdef.c - @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> pathdef.c - @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> pathdef.c - @echo char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)"; >> pathdef.c - @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c - @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c -endif +# Do not change this. +UNDER_CYGWIN = no +include Make_cyg_ming.mak diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 31bcd68440..f7517574cb 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -50,13 +50,14 @@ # Perl interface: # PERL=[Path to Perl directory] # DYNAMIC_PERL=yes (to load the Perl DLL dynamically) -# PERL_VER=[Perl version, in the form 55 (5.005), 56 (5.6.x), etc] +# PERL_VER=[Perl version, in the form 55 (5.005), 56 (5.6.x), +# 510 (5.10.x), etc] # (default is 56) # # Python interface: # PYTHON=[Path to Python directory] # DYNAMIC_PYTHON=yes (to load the Python DLL dynamically) -# PYTHON_VER=[Python version, eg 15, 20] (default is 22) +# PYTHON_VER=[Python version, eg 22, 23, ..., 27] (default is 22) # # Python3 interface: # PYTHON3=[Path to Python3 directory] @@ -66,11 +67,13 @@ # Ruby interface: # RUBY=[Path to Ruby directory] # DYNAMIC_RUBY=yes (to load the Ruby DLL dynamically) -# RUBY_VER=[Ruby version, eg 16, 17] (default is 18) -# RUBY_VER_LONG=[Ruby version, eg 1.6, 1.7] (default is 1.8) +# RUBY_VER=[Ruby version, eg 18, 19, 20] (default is 18) +# RUBY_VER_LONG=[Ruby version, eg 1.8, 1.9.1, 2.0.0] (default is 1.8) # You must set RUBY_VER_LONG when change RUBY_VER. -# You must set RUBY_API_VER to RUBY_VER_LONG. -# Don't set ruby API version to RUBY_VER like 191. +# RUBY_API_VER is derived from RUBY_VER_LONG. +# Note: If you use Ruby 1.9.3, set as follows: +# RUBY_VER=19 +# RUBY_VER_LONG=1.9.1 (not 1.9.3, because the API version is 1.9.1.) # # Tcl interface: # TCL=[Path to Tcl directory] diff --git a/src/version.c b/src/version.c index 4b75a58a51..c399dd60a7 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 496, /**/ 495, /**/ From e87e3dde01bc7aec1996ef75c7cad8de4c1029bb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 11:27:36 +0100 Subject: [PATCH 171/311] updated for version 7.4.497 Problem: With some regexp patterns the NFA engine uses many states and becomes very slow. To the user it looks like Vim freezes. Solution: When the number of states reaches a limit fall back to the old engine. (Christian Brabandt) --- Filelist | 3 + runtime/doc/options.txt | 4 + src/Makefile | 3 + src/regexp.c | 138 ++++++++++++++++++++++++------ src/regexp.h | 26 ++++-- src/regexp_nfa.c | 35 +++++--- src/testdir/Make_dos.mak | 9 ++ src/testdir/Make_ming.mak | 11 +++ src/testdir/Make_os2.mak | 11 +++ src/testdir/Makefile | 15 +++- src/testdir/bench_re_freeze.in | 13 +++ src/testdir/bench_re_freeze.vim | 13 +++ src/testdir/samples/re.freeze.txt | 6 ++ src/version.c | 2 + 14 files changed, 244 insertions(+), 45 deletions(-) create mode 100644 src/testdir/bench_re_freeze.in create mode 100644 src/testdir/bench_re_freeze.vim create mode 100644 src/testdir/samples/re.freeze.txt diff --git a/Filelist b/Filelist index fd145bd16a..d8d9ecb59c 100644 --- a/Filelist +++ b/Filelist @@ -102,6 +102,9 @@ SRC_ALL = \ src/testdir/pythonx/topmodule/submodule/subsubmodule/subsubsubmodule.py \ src/testdir/python_after/*.py \ src/testdir/python_before/*.py \ + src/testdir/bench*.in \ + src/testdir/bench*.vim \ + src/testdir/samples.*.txt \ src/proto.h \ src/proto/blowfish.pro \ src/proto/buffer.pro \ diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index b50711c698..534ef449f8 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5626,6 +5626,10 @@ A jump table for the options with a short description can be found at |Q_op|. Note that when using the NFA engine and the pattern contains something that is not supported the pattern will not match. This is only useful for debugging the regexp engine. + Using automatic selection enables Vim to switch the engine, if the + default engine becomes too costly. E.g., when the NFA engine uses too + many states. This should prevent Vim from hanging on a combination of + a complex pattern with long text. *'relativenumber'* *'rnu'* *'norelativenumber'* *'nornu'* 'relativenumber' 'rnu' boolean (default off) diff --git a/src/Makefile b/src/Makefile index 64691a39bc..cfdca44fcd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1879,6 +1879,9 @@ test check: cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) $(MAKE) -f Makefile unittest +benchmark: + cd testdir; $(MAKE) -f Makefile benchmark VIMPROG=../$(VIMTARGET) SCRIPTSOURCE=../$(SCRIPTSOURCE) + unittesttargets: $(MAKE) -f Makefile $(UNITTEST_TARGETS) diff --git a/src/regexp.c b/src/regexp.c index f19e139710..6e5655a995 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -8011,13 +8011,10 @@ static regengine_T bt_regengine = bt_regcomp, bt_regfree, bt_regexec_nl, - bt_regexec_multi -#ifdef DEBUG - ,(char_u *)"" -#endif + bt_regexec_multi, + (char_u *)"" }; - #include "regexp_nfa.c" static regengine_T nfa_regengine = @@ -8025,18 +8022,14 @@ static regengine_T nfa_regengine = nfa_regcomp, nfa_regfree, nfa_regexec_nl, - nfa_regexec_multi -#ifdef DEBUG - ,(char_u *)"" -#endif + nfa_regexec_multi, + (char_u *)"" }; /* Which regexp engine to use? Needed for vim_regcomp(). * Must match with 'regexpengine'. */ static int regexp_engine = 0; -#define AUTOMATIC_ENGINE 0 -#define BACKTRACKING_ENGINE 1 -#define NFA_ENGINE 2 + #ifdef DEBUG static char_u regname[][30] = { "AUTOMATIC Regexp Engine", @@ -8083,10 +8076,8 @@ vim_regcomp(expr_arg, re_flags) regexp_engine = AUTOMATIC_ENGINE; } } -#ifdef DEBUG bt_regengine.expr = expr; nfa_regengine.expr = expr; -#endif /* * First try the NFA engine, unless backtracking was requested. @@ -8096,7 +8087,8 @@ vim_regcomp(expr_arg, re_flags) else prog = bt_regengine.regcomp(expr, re_flags); - if (prog == NULL) /* error compiling regexp with initial engine */ + /* Check for error compiling regexp with initial engine. */ + if (prog == NULL) { #ifdef BT_REGEXP_DEBUG_LOG if (regexp_engine != BACKTRACKING_ENGINE) /* debugging log for NFA */ @@ -8114,13 +8106,27 @@ vim_regcomp(expr_arg, re_flags) } #endif /* - * If the NFA engine failed, the backtracking engine won't work either. + * If the NFA engine failed, try the backtracking engine. + * Disabled for now, both engines fail on the same patterns. + * Re-enable when regcomp() fails when the pattern would work better + * with the other engine. * if (regexp_engine == AUTOMATIC_ENGINE) + { prog = bt_regengine.regcomp(expr, re_flags); + regexp_engine == BACKTRACKING_ENGINE; + } */ } + if (prog != NULL) + { + /* Store the info needed to call regcomp() again when the engine turns + * out to be very slow when executing it. */ + prog->re_engine = regexp_engine; + prog->re_flags = re_flags; + } + return prog; } @@ -8135,20 +8141,75 @@ vim_regfree(prog) prog->engine->regfree(prog); } +#ifdef FEAT_EVAL +static void report_re_switch __ARGS((char_u *pat)); + + static void +report_re_switch(pat) + char_u *pat; +{ + if (p_verbose > 0) + { + verbose_enter(); + MSG_PUTS(_("Switching to backtracking RE engine for pattern: ")); + MSG_PUTS(pat); + verbose_leave(); + } +} +#endif + +static int vim_regexec_both __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, int nl)); + /* * Match a regexp against a string. * "rmp->regprog" is a compiled regexp as returned by vim_regcomp(). * Uses curbuf for line count and 'iskeyword'. + * When "nl" is TRUE consider a "\n" in "line" to be a line break. * * Return TRUE if there is a match, FALSE if not. */ + static int +vim_regexec_both(rmp, line, col, nl) + regmatch_T *rmp; + char_u *line; /* string to match against */ + colnr_T col; /* column to start looking for match */ + int nl; +{ + int result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl); + + /* NFA engine aborted because it's very slow. */ + if (rmp->regprog->re_engine == AUTOMATIC_ENGINE + && result == NFA_TOO_EXPENSIVE) + { + int save_p_re = p_re; + int re_flags = rmp->regprog->re_flags; + char_u *pat = vim_strsave(((nfa_regprog_T *)rmp->regprog)->pattern); + + p_re = BACKTRACKING_ENGINE; + vim_regfree(rmp->regprog); + if (pat != NULL) + { +#ifdef FEAT_EVAL + report_re_switch(pat); +#endif + rmp->regprog = vim_regcomp(pat, re_flags); + if (rmp->regprog != NULL) + result = rmp->regprog->engine->regexec_nl(rmp, line, col, nl); + vim_free(pat); + } + + p_re = save_p_re; + } + return result; +} + int vim_regexec(rmp, line, col) - regmatch_T *rmp; - char_u *line; /* string to match against */ - colnr_T col; /* column to start looking for match */ + regmatch_T *rmp; + char_u *line; + colnr_T col; { - return rmp->regprog->engine->regexec_nl(rmp, line, col, FALSE); + return vim_regexec_both(rmp, line, col, FALSE); } #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \ @@ -8158,11 +8219,11 @@ vim_regexec(rmp, line, col) */ int vim_regexec_nl(rmp, line, col) - regmatch_T *rmp; - char_u *line; - colnr_T col; + regmatch_T *rmp; + char_u *line; + colnr_T col; { - return rmp->regprog->engine->regexec_nl(rmp, line, col, TRUE); + return vim_regexec_both(rmp, line, col, TRUE); } #endif @@ -8183,5 +8244,32 @@ vim_regexec_multi(rmp, win, buf, lnum, col, tm) colnr_T col; /* column to start looking for match */ proftime_T *tm; /* timeout limit or NULL */ { - return rmp->regprog->engine->regexec_multi(rmp, win, buf, lnum, col, tm); + int result = rmp->regprog->engine->regexec_multi( + rmp, win, buf, lnum, col, tm); + + /* NFA engine aborted because it's very slow. */ + if (rmp->regprog->re_engine == AUTOMATIC_ENGINE + && result == NFA_TOO_EXPENSIVE) + { + int save_p_re = p_re; + int re_flags = rmp->regprog->re_flags; + char_u *pat = vim_strsave(((nfa_regprog_T *)rmp->regprog)->pattern); + + p_re = BACKTRACKING_ENGINE; + vim_regfree(rmp->regprog); + if (pat != NULL) + { +#ifdef FEAT_EVAL + report_re_switch(pat); +#endif + rmp->regprog = vim_regcomp(pat, re_flags); + if (rmp->regprog != NULL) + result = rmp->regprog->engine->regexec_multi( + rmp, win, buf, lnum, col, tm); + vim_free(pat); + } + p_re = save_p_re; + } + + return result; } diff --git a/src/regexp.h b/src/regexp.h index cd619daf41..6617cd2372 100644 --- a/src/regexp.h +++ b/src/regexp.h @@ -27,6 +27,18 @@ */ #define NFA_MAX_BRACES 20 +/* + * In the NFA engine: how many states are allowed + */ +#define NFA_MAX_STATES 100000 +#define NFA_TOO_EXPENSIVE -1 + +/* Which regexp engine to use? Needed for vim_regcomp(). + * Must match with 'regexpengine'. */ +#define AUTOMATIC_ENGINE 0 +#define BACKTRACKING_ENGINE 1 +#define NFA_ENGINE 2 + typedef struct regengine regengine_T; /* @@ -38,6 +50,8 @@ typedef struct regprog { regengine_T *engine; unsigned regflags; + unsigned re_engine; /* automatic, backtracking or nfa engine */ + unsigned re_flags; /* second argument for vim_regcomp() */ } regprog_T; /* @@ -47,9 +61,11 @@ typedef struct regprog */ typedef struct { - /* These two members implement regprog_T */ + /* These four members implement regprog_T */ regengine_T *engine; unsigned regflags; + unsigned re_engine; + unsigned re_flags; /* second argument for vim_regcomp() */ int regstart; char_u reganch; @@ -81,9 +97,11 @@ struct nfa_state */ typedef struct { - /* These two members implement regprog_T */ + /* These three members implement regprog_T */ regengine_T *engine; unsigned regflags; + unsigned re_engine; + unsigned re_flags; /* second argument for vim_regcomp() */ nfa_state_T *start; /* points into state[] */ @@ -96,9 +114,7 @@ typedef struct #ifdef FEAT_SYN_HL int reghasz; #endif -#ifdef DEBUG char_u *pattern; -#endif int nsubexp; /* number of () */ int nstate; nfa_state_T state[1]; /* actually longer.. */ @@ -151,9 +167,7 @@ struct regengine void (*regfree)(regprog_T *); int (*regexec_nl)(regmatch_T*, char_u*, colnr_T, int); long (*regexec_multi)(regmmatch_T*, win_T*, buf_T*, linenr_T, colnr_T, proftime_T*); -#ifdef DEBUG char_u *expr; -#endif }; #endif /* _REGEXP_H */ diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 37635662bc..91316094b5 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -5522,6 +5522,13 @@ nfa_regmatch(prog, start, submatch, m) nextlist->n = 0; /* clear nextlist */ nextlist->has_pim = FALSE; ++nfa_listid; + if (prog->re_engine == AUTOMATIC_ENGINE && nfa_listid >= NFA_MAX_STATES) + { + /* too many states, retry with old engine */ + nfa_match = NFA_TOO_EXPENSIVE; + goto theend; + } + thislist->id = nfa_listid; nextlist->id = nfa_listid + 1; @@ -5704,6 +5711,11 @@ nfa_regmatch(prog, start, submatch, m) */ result = recursive_regmatch(t->state, NULL, prog, submatch, m, &listids); + if (result == NFA_TOO_EXPENSIVE) + { + nfa_match = result; + goto theend; + } /* for \@! and \@state, NULL, prog, submatch, m, &listids); + if (result == NFA_TOO_EXPENSIVE) + { + nfa_match = result; + goto theend; + } if (result) { int bytelen; @@ -6760,6 +6777,7 @@ nfa_regtry(prog, col) int i; regsubs_T subs, m; nfa_state_T *start = prog->start; + int result; #ifdef ENABLE_LOG FILE *f; #endif @@ -6791,8 +6809,11 @@ nfa_regtry(prog, col) clear_sub(&m.synt); #endif - if (nfa_regmatch(prog, start, &subs, &m) == FALSE) + result = nfa_regmatch(prog, start, &subs, &m); + if (result == FALSE) return 0; + else if (result == NFA_TOO_EXPENSIVE) + return result; cleanup_subexpr(); if (REG_MULTI) @@ -6929,9 +6950,7 @@ nfa_regexec_both(line, startcol) nfa_nsubexpr = prog->nsubexp; nfa_listid = 1; nfa_alt_listid = 2; -#ifdef DEBUG nfa_regengine.expr = prog->pattern; -#endif if (prog->reganch && col > 0) return 0L; @@ -6979,9 +6998,7 @@ nfa_regexec_both(line, startcol) retval = nfa_regtry(prog, col); -#ifdef DEBUG nfa_regengine.expr = NULL; -#endif theend: return retval; @@ -7003,9 +7020,7 @@ nfa_regcomp(expr, re_flags) if (expr == NULL) return NULL; -#ifdef DEBUG nfa_regengine.expr = expr; -#endif init_class_tab(); @@ -7082,10 +7097,8 @@ nfa_regcomp(expr, re_flags) /* Remember whether this pattern has any \z specials in it. */ prog->reghasz = re_has_z; #endif -#ifdef DEBUG prog->pattern = vim_strsave(expr); nfa_regengine.expr = NULL; -#endif out: vim_free(post_start); @@ -7099,9 +7112,7 @@ fail: #ifdef ENABLE_LOG nfa_postfix_dump(expr, FAIL); #endif -#ifdef DEBUG nfa_regengine.expr = NULL; -#endif goto out; } @@ -7115,9 +7126,7 @@ nfa_regfree(prog) if (prog != NULL) { vim_free(((nfa_regprog_T *)prog)->match_text); -#ifdef DEBUG vim_free(((nfa_regprog_T *)prog)->pattern); -#endif vim_free(prog); } } diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index abcabce03e..07c6831f0e 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -87,6 +87,7 @@ clean: -if exist Xfind rd /s /q Xfind -if exist viminfo del viminfo -del test.log + -if exists benchmark.out del benchmark.out .in.out: -if exist $*.failed del $*.failed @@ -103,3 +104,11 @@ clean: nolog: -del test.log + +benchmark: + bench_re_freeze.out + +bench_re_freeze.out: bench_re_freeze.vim + -if exist benchmark.out del benchmark.out + $(VIMPROG) -u dos.vim -U NONE --noplugin $*.in + @IF EXIST benchmark.out ( type benchmark.out ) diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 2a124b1b83..d2995a50b6 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -12,11 +12,13 @@ ifneq (sh.exe, $(SHELL)) DEL = rm -f MV = mv CP = cp +CAT = cat DIRSLASH = / else DEL = del MV = rename CP = copy +CAT = type DIRSLASH = \\ endif @@ -72,6 +74,8 @@ SCRIPTS32 = test50.out test70.out SCRIPTS_GUI = test16.out +SCRIPTS_BENCH = bench_re_freeze.out + .SUFFIXES: .in .out vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32) @@ -80,6 +84,8 @@ vimall: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS_GUI) $(SCRIPTS32) nongui: fixff $(SCRIPTS16) $(SCRIPTS) echo ALL DONE +benchmark: $(SCRIPTS_BENCH) + small: echo ALL DONE @@ -114,3 +120,8 @@ clean: -$(DEL) X* -$(DEL) test.ok -$(DEL) viminfo + +bench_re_freeze.out: bench_re_freeze.vim + -$(DEL) benchmark.out + $(VIMPROG) -u dos.vim -U NONE --noplugin $*.in + $(CAT) benchmark.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index 5f3dc13930..3b6b4071d5 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -50,6 +50,8 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_signs.out \ test_utf8.out +SCRIPTS_BENCH = bench_re_freeze.out + .SUFFIXES: .in .out all: /tmp $(SCRIPTS) @@ -57,6 +59,8 @@ all: /tmp $(SCRIPTS) $(SCRIPTS): $(VIMPROG) +benchmark: $(SCRIPTS_BENCH) + clean: -rm -rf *.out Xdotest test.ok tiny.vim small.vim mbyte.vim viminfo @@ -75,3 +79,10 @@ clean: # Create a directory for temp files /tmp: -mkdir /tmp + +bench_re_freeze.out: bench_re_freeze.vim + -del $*.failed test.ok benchmark.out + copy $*.ok test.ok + $(VIMPROG) -u os2.vim --noplugin -s dotest.in $*.in + type benchmark.out + diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 6b3bf9b7e1..1f5095e55b 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -48,12 +48,16 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ SCRIPTS_GUI = test16.out +SCRIPTS_BENCH = bench_re_freeze.out + .SUFFIXES: .in .out nongui: nolog $(SCRIPTS) report gui: nolog $(SCRIPTS) $(SCRIPTS_GUI) report +benchmark: $(SCRIPTS_BENCH) + report: @echo @echo 'Test results:' @@ -65,7 +69,7 @@ report: $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG) RM_ON_RUN = test.out X* viminfo -RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok +RM_ON_START = tiny.vim small.vim mbyte.vim mzscheme.vim lua.vim test.ok benchmark.out RUN_VIM = VIMRUNTIME=$(SCRIPTSOURCE); export VIMRUNTIME; $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in clean: @@ -120,5 +124,14 @@ test49.out: test49.vim test60.out: test60.vim +bench_re_freeze.out: bench_re_freeze.vim + -rm -rf benchmark.out $(RM_ON_RUN) + # Sleep a moment to avoid that the xterm title is messed up. + # 200 msec is sufficient, but only modern sleep supports a fraction of + # a second, fall back to a second if it fails. + @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1" + -$(RUN_VIM) $*.in + @/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi" + nolog: -rm -f test.log diff --git a/src/testdir/bench_re_freeze.in b/src/testdir/bench_re_freeze.in new file mode 100644 index 0000000000..7b1bfa3459 --- /dev/null +++ b/src/testdir/bench_re_freeze.in @@ -0,0 +1,13 @@ +Test for Benchmarking RE engine + +STARTTEST +:so small.vim +:if !has("reltime") | qa! | endif +:set nocp cpo&vim +:so bench_re_freeze.vim +:call Measure('samples/re.freeze.txt', '\s\+\%#\@55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 + diff --git a/src/version.c b/src/version.c index c399dd60a7..f0fd5a38cb 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 497, /**/ 496, /**/ From 3e6fd3f75c32f467e098cc41e26811d75d6c13b5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 12:46:09 +0100 Subject: [PATCH 172/311] updated for version 7.4.498 Problem: Typo in DOS makefile. Solution: Change exists to exist. (Ken Takata) --- src/testdir/Make_dos.mak | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 07c6831f0e..7fd2763605 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -87,7 +87,7 @@ clean: -if exist Xfind rd /s /q Xfind -if exist viminfo del viminfo -del test.log - -if exists benchmark.out del benchmark.out + -if exist benchmark.out del benchmark.out .in.out: -if exist $*.failed del $*.failed diff --git a/src/version.c b/src/version.c index f0fd5a38cb..ae1a56b5b5 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 498, /**/ 497, /**/ From ca0322907be29aa430b68938e50909670b01fcfe Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 13:03:44 +0100 Subject: [PATCH 173/311] updated for version 7.4.499 Problem: substitute() can be slow with long strings. Solution: Store a pointer to the end, instead of calling strlen() every time. (Ozaki Kiichi) --- src/eval.c | 4 +++- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index f5aa7e919e..ecc5e3a572 100644 --- a/src/eval.c +++ b/src/eval.c @@ -25076,6 +25076,7 @@ do_string_sub(str, pat, sub, flags) int i; int do_all; char_u *tail; + char_u *end; garray_T ga; char_u *ret; char_u *save_cpo; @@ -25094,6 +25095,7 @@ do_string_sub(str, pat, sub, flags) if (regmatch.regprog != NULL) { tail = str; + end = str + STRLEN(str); while (vim_regexec_nl(®match, str, (colnr_T)(tail - str))) { /* Skip empty match except for first match. */ @@ -25120,7 +25122,7 @@ do_string_sub(str, pat, sub, flags) * - The text after the match. */ sublen = vim_regsub(®match, sub, tail, FALSE, TRUE, FALSE); - if (ga_grow(&ga, (int)(STRLEN(tail) + sublen - + if (ga_grow(&ga, (int)((end - tail) + sublen - (regmatch.endp[0] - regmatch.startp[0]))) == FAIL) { ga_clear(&ga); diff --git a/src/version.c b/src/version.c index ae1a56b5b5..9008518e23 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 499, /**/ 498, /**/ From e33b25d213dafd28131f75cb10670496a8950b8d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 13:39:28 +0100 Subject: [PATCH 174/311] updated for version 7.4.500 Problem: Test 72 still fails once in a while. Solution: Don't set 'fileformat' to unix, reset it. (Ken Takata) --- src/testdir/test72.in | 5 ++--- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/testdir/test72.in b/src/testdir/test72.in index 87c25d4863..a407eea4e4 100644 --- a/src/testdir/test72.in +++ b/src/testdir/test72.in @@ -8,7 +8,6 @@ STARTTEST :" Test 'undofile': first a simple one-line change. :set nocompatible viminfo+=nviminfo visualbell :set ul=100 undofile nomore -:set ff=unix :e! Xtestfile ggdGithis is one line:set ul=100 :s/one/ONE/ @@ -83,7 +82,7 @@ uu:w >>test.out :" With encryption, cryptmethod=blowfish :e! Xtestfile rubbish -:set undofile cm=blowfish +:set undofile cm=blowfish ff& ggdGijan feb mar @@ -109,7 +108,7 @@ u:.w >>test.out :" With encryption, cryptmethod=blowfish2 :e! Xtestfile rubbish -:set undofile cm=blowfish2 +:set undofile cm=blowfish2 ff& ggdGijan feb mar diff --git a/src/version.c b/src/version.c index 9008518e23..7f27975a43 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 500, /**/ 499, /**/ From 9786daf8de1c881feabfd98a6160e2b153423544 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 14:02:17 +0100 Subject: [PATCH 175/311] Update runtime files. --- runtime/autoload/gzip.vim | 8 +++-- runtime/doc/diff.txt | 16 +++++---- runtime/doc/options.txt | 7 ++-- runtime/doc/quickref.txt | 9 +++-- runtime/doc/repeat.txt | 5 ++- runtime/doc/tags | 1 + runtime/doc/todo.txt | 66 ++++++++++++++++++++++++------------- runtime/doc/usr_25.txt | 4 +-- runtime/filetype.vim | 5 ++- runtime/syntax/registry.vim | 11 ++++--- 10 files changed, 89 insertions(+), 43 deletions(-) diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim index 1245fdddc9..a6b4605b06 100644 --- a/runtime/autoload/gzip.vim +++ b/runtime/autoload/gzip.vim @@ -1,6 +1,6 @@ " Vim autoload file for editing compressed files. " Maintainer: Bram Moolenaar -" Last Change: 2008 Jul 04 +" Last Change: 2014 Nov 05 " These functions are used by the gzip plugin. @@ -120,6 +120,8 @@ fun gzip#read(cmd) silent! exe "bwipe " . tmp_esc silent! exe "bwipe " . tmpe_esc endif + " Store the OK flag, so that we can use it when writing. + let b:uncompressOk = ok " Restore saved option values. let &pm = pm_save @@ -146,8 +148,10 @@ endfun " After writing compressed file: Compress written file with "cmd" fun gzip#write(cmd) + if exists('b:uncompressOk') && !b:uncompressOk + echomsg "Not compressing file because uncompress failed; reset b:uncompressOk to compress anyway" " don't do anything if the cmd is not supported - if s:check(a:cmd) + elseif s:check(a:cmd) " Rename the file before compressing it. let nm = resolve(expand("")) let nmt = s:tempname(nm) diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 0ee5878341..be17b0c731 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -1,4 +1,4 @@ -*diff.txt* For Vim version 7.4. Last change: 2014 May 20 +*diff.txt* For Vim version 7.4. Last change: 2014 Oct 31 VIM REFERENCE MANUAL by Bram Moolenaar @@ -266,13 +266,17 @@ that the buffers will be equal within the specified range. See below for [range]. *do* -do Same as ":diffget" without argument or range. The "o" stands - for "obtain" ("dg" can't be used, it could be the start of - "dgg"!). Note: this doesn't work in Visual mode. +[count]do Same as ":diffget" without range. The "o" stands for "obtain" + ("dg" can't be used, it could be the start of "dgg"!). Note: + this doesn't work in Visual mode. + If you give a [count], it is used as the [bufspec] argument + for ":diffget". *dp* -dp Same as ":diffput" without argument or range. - Note: this doesn't work in Visual mode. +[count]dp Same as ":diffput" without range. Note: this doesn't work in + Visual mode. + If you give a [count], it is used as the [bufspec] argument + for ":diffput". When no [range] is given, the diff at the cursor position or just above it is diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 534ef449f8..ccf92991f7 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2014 Sep 23 +*options.txt* For Vim version 7.4. Last change: 2014 Nov 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2221,7 +2221,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'cryptmethod'* *'cm'* -'cryptmethod' string (default "zip") +'cryptmethod' 'cm' string (default "zip") global or local to buffer |global-local| {not in Vi} Method used for encryption when the buffer is written to a file: @@ -7748,6 +7748,9 @@ A jump table for the options with a short description can be found at |Q_op|. current buffer: > setlocal ul=-1 < This helps when you run out of memory for a single change. + + The local value is set to -123456 when the global value is to be used. + Also see |clear-undo|. *'undoreload'* *'ur'* diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index 096921f003..727f6ac4b0 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 7.4. Last change: 2014 Aug 06 +*quickref.txt* For Vim version 7.4. Last change: 2014 Oct 22 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1313,11 +1313,16 @@ Context-sensitive completion on the command-line: |CTRL-W_R| CTRL-W R rotate windows upwards |CTRL-W_x| CTRL-W x exchange current window with next one -|CTRL-W_=| CTRL-W = make all windows equal height +|CTRL-W_=| CTRL-W = make all windows equal height & width |CTRL-W_-| CTRL-W - decrease current window height |CTRL-W_+| CTRL-W + increase current window height |CTRL-W__| CTRL-W _ set current window height (default: very high) + +|CTRL-W_<| CTRL-W < decrease current window width +|CTRL-W_>| CTRL-W > increase current window width +|CTRL-W_bar| CTRL-W | set current window width (default: + widest possible) ------------------------------------------------------------------------------ *Q_bu* Buffer list commands diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 4b28e8617b..edeef6655e 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.4. Last change: 2014 Mar 25 +*repeat.txt* For Vim version 7.4. Last change: 2014 Oct 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -64,6 +64,9 @@ replacement string. For the definition of a pattern, see |pattern|. +NOTE [cmd] may contain a range; see |collapse| and |edit-paragraph-join| for +examples. + The global commands work by first scanning through the [range] lines and marking each line where a match occurs (for a multi-line pattern, only the start of the match matters). diff --git a/runtime/doc/tags b/runtime/doc/tags index f8db6553e1..460be9044e 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -5473,6 +5473,7 @@ edit-dialogs editing.txt /*edit-dialogs* edit-files editing.txt /*edit-files* edit-intro editing.txt /*edit-intro* edit-no-break usr_25.txt /*edit-no-break* +edit-paragraph-join usr_25.txt /*edit-paragraph-join* editing.txt editing.txt /*editing.txt* efm-%> quickfix.txt /*efm-%>* efm-entries quickfix.txt /*efm-entries* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index daf5270e5a..32b1f901c3 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Oct 15 +*todo.txt* For Vim version 7.4. Last change: 2014 Nov 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -44,6 +44,7 @@ Regexp problems: 2013 Dec 11) - Using \@> and \?. (Brett Stahlman, 2013 Dec 21) Remark from Marcin Szamotulski Remark from Brett 2014 Jan 6 and 7. +- Difference in NFA and old engine. (Brett Stahlman, 2014 Nov 5) - Bug when using \>. (Ramel, 2014 Feb 2) (Aaron Bohannon, 2014 Feb 13) - NFA regexp doesn't handle \% :map gj -TURNING A PARAGRAPH INTO ONE LINE +TURNING A PARAGRAPH INTO ONE LINE *edit-paragraph-join* If you want to import text into a program like MS-Word, each paragraph should be a single line. If your paragraphs are currently separated with empty diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 67d1674537..508f19820b 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2014 Oct 09 +" Last Change: 2014 Nov 05 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -782,6 +782,9 @@ au BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig au BufNewFile,BufRead *.git/modules/*/COMMIT_EDITMSG setf gitcommit au BufNewFile,BufRead *.git/modules/*/config setf gitconfig au BufNewFile,BufRead */.config/git/config setf gitconfig +if !empty($XDG_CONFIG_HOME) + au BufNewFile,BufRead $XDG_CONFIG_HOME/git/config setf gitconfig +endif au BufNewFile,BufRead git-rebase-todo setf gitrebase au BufNewFile,BufRead .msg.[0-9]* \ if getline(1) =~ '^From.*# This line is ignored.$' | diff --git a/runtime/syntax/registry.vim b/runtime/syntax/registry.vim index e9ff8fcaba..4524247a08 100644 --- a/runtime/syntax/registry.vim +++ b/runtime/syntax/registry.vim @@ -1,8 +1,9 @@ " Vim syntax file " Language: Windows Registry export with regedit (*.reg) -" Maintainer: Dominique Stphan (dominique@mggen.com) -" URL: http://www.mggen.com/vim/syntax/registry.zip -" Last change: 2004 Apr 23 +" Maintainer: Dominique Stéphan (dominique@mggen.com) +" URL: http://www.mggen.com/vim/syntax/registry.zip (doesn't work) +" Last change: 2014 Oct 31 +" Included patch from Alexander A. Ulitin " clear any unwanted syntax defs " For version 5.x: Clear all syntax items @@ -17,7 +18,7 @@ endif syn case ignore " Head of regedit .reg files, it's REGEDIT4 on Win9#/NT -syn match registryHead "^REGEDIT[0-9]*$" +syn match registryHead "^REGEDIT[0-9]*\s*$\|^Windows Registry Editor Version \d*\.\d*\s*$" " Comment syn match registryComment "^;.*$" @@ -58,7 +59,7 @@ syn region registryRemove start="\[\-" end="\]" contains=registryHKEY,registryGU " Subkey syn match registrySubKey "^\".*\"=" " Default value -syn match registrySubKey "^\@=" +syn match registrySubKey "^@=" " Numbers From 7473f375f47f8b1a78f92ed69e1d9a8a94017b4d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 14:04:18 +0100 Subject: [PATCH 176/311] updated for version 7.4.501 Problem: Typo in file pattern. Solution: Insert a slash and remove a dot. --- Filelist | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Filelist b/Filelist index d8d9ecb59c..522375472a 100644 --- a/Filelist +++ b/Filelist @@ -104,7 +104,7 @@ SRC_ALL = \ src/testdir/python_before/*.py \ src/testdir/bench*.in \ src/testdir/bench*.vim \ - src/testdir/samples.*.txt \ + src/testdir/samples/*.txt \ src/proto.h \ src/proto/blowfish.pro \ src/proto/buffer.pro \ diff --git a/src/version.c b/src/version.c index 7f27975a43..3c48dc4334 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 501, /**/ 500, /**/ From 24ff04ef61f7c7ada77713cecf7cce4e13465225 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 14:44:52 +0100 Subject: [PATCH 177/311] updated for version 7.4.502 Problem: Language mapping also applies to mapped characters. Solution: Add the 'langnoremap' option, when on 'langmap' does not apply to mapped characters. (Christian Brabandt) --- runtime/doc/options.txt | 12 ++++++++++++ runtime/vimrc_example.vim | 9 ++++++++- src/macros.h | 15 ++++++++++++--- src/option.c | 7 +++++++ src/option.h | 1 + src/version.c | 2 ++ 6 files changed, 42 insertions(+), 4 deletions(-) diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index ccf92991f7..525a08cdbe 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4589,6 +4589,18 @@ A jump table for the options with a short description can be found at |Q_op|. :source $VIMRUNTIME/menu.vim < Warning: This deletes all menus that you defined yourself! + *'langnoremap'* *'lnr'* +'langnoremap' 'lnr' boolean (default off) + global + {not in Vi} + {only available when compiled with the |+langmap| + feature} + When on, setting 'langmap' does not apply to characters resulting from + a mapping. This basically means, if you noticed that setting + 'langmap' disables some of your mappings, try setting this option. + This option defaults to off for backwards compatibility. Set it on if + that works for you to avoid mappings to break. + *'laststatus'* *'ls'* 'laststatus' 'ls' number (default 1) global diff --git a/runtime/vimrc_example.vim b/runtime/vimrc_example.vim index 27a5cfc222..215fd24658 100644 --- a/runtime/vimrc_example.vim +++ b/runtime/vimrc_example.vim @@ -1,7 +1,7 @@ " An example for a vimrc file. " " Maintainer: Bram Moolenaar -" Last change: 2014 Feb 05 +" Last change: 2014 Nov 05 " " To use it, copy it to " for Unix and OS/2: ~/.vimrc @@ -95,3 +95,10 @@ if !exists(":DiffOrig") command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis \ | wincmd p | diffthis endif + +if has('langmap') && exists('+langnoremap') + " Prevent that the langmap option applies to characters that result from a + " mapping. If unset (default), this may break plugins (but it's backward + " compatible). + set langnoremap +endif diff --git a/src/macros.h b/src/macros.h index 2706a02524..01207d91b3 100644 --- a/src/macros.h +++ b/src/macros.h @@ -128,13 +128,18 @@ * Adjust chars in a language according to 'langmap' option. * NOTE that there is no noticeable overhead if 'langmap' is not set. * When set the overhead for characters < 256 is small. - * Don't apply 'langmap' if the character comes from the Stuff buffer. + * Don't apply 'langmap' if the character comes from the Stuff buffer or from + * a mapping and the langnoremap option was set. * The do-while is just to ignore a ';' after the macro. */ # ifdef FEAT_MBYTE # define LANGMAP_ADJUST(c, condition) \ do { \ - if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \ + if (*p_langmap \ + && (condition) \ + && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \ + && !KeyStuffed \ + && (c) >= 0) \ { \ if ((c) < 256) \ c = langmap_mapchar[c]; \ @@ -145,7 +150,11 @@ # else # define LANGMAP_ADJUST(c, condition) \ do { \ - if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \ + if (*p_langmap \ + && (condition) \ + && (!p_lnr || (p_lnr && typebuf_maplen() == 0)) \ + && !KeyStuffed \ + && (c) >= 0 && (c) < 256) \ c = langmap_mapchar[c]; \ } while (0) # endif diff --git a/src/option.c b/src/option.c index 5e8e95a6d2..6841d42d6c 100644 --- a/src/option.c +++ b/src/option.c @@ -1691,6 +1691,13 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, + {"langnoremap", "lnr", P_BOOL|P_VI_DEF, +#ifdef FEAT_LANGMAP + (char_u *)&p_lnr, PV_NONE, +#else + (char_u *)NULL, PV_NONE, +#endif + {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, {"laststatus", "ls", P_NUM|P_VI_DEF|P_RALL, #ifdef FEAT_WINDOWS (char_u *)&p_ls, PV_NONE, diff --git a/src/option.h b/src/option.h index 23cdecdf01..b031466768 100644 --- a/src/option.h +++ b/src/option.h @@ -576,6 +576,7 @@ EXTERN char_u *p_kp; /* 'keywordprg' */ EXTERN char_u *p_km; /* 'keymodel' */ #ifdef FEAT_LANGMAP EXTERN char_u *p_langmap; /* 'langmap'*/ +EXTERN int p_lnr; /* 'langnoremap' */ #endif #if defined(FEAT_MENU) && defined(FEAT_MULTI_LANG) EXTERN char_u *p_lm; /* 'langmenu' */ diff --git a/src/version.c b/src/version.c index 3c48dc4334..7bc7153f77 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 502, /**/ 501, /**/ From 1b2ff0358437b563cb3cbc0ea3a2b931dd60c835 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 15:06:01 +0100 Subject: [PATCH 178/311] updated for version 7.4.503 Problem: Cannot append a list of lines to a file. Solution: Add the append option to writefile(). (Yasuhiro Matsumoto) --- runtime/doc/eval.txt | 14 ++++++++++---- src/Makefile | 4 ++++ src/eval.c | 14 ++++++++++---- src/testdir/test_writefile.in | 18 ++++++++++++++++++ src/testdir/test_writefile.ok | 5 +++++ src/version.c | 2 ++ 6 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 src/testdir/test_writefile.in create mode 100644 src/testdir/test_writefile.ok diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index eb7fcbcaac..4e349a6e08 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2041,7 +2041,7 @@ winrestcmd() String returns command to restore window sizes winrestview( {dict}) none restore view of current window winsaveview() Dict save view of current window winwidth( {nr}) Number width of window {nr} -writefile( {list}, {fname} [, {binary}]) +writefile( {list}, {fname} [, {flags}]) Number write list of lines to file {fname} xor( {expr}, {expr}) Number bitwise XOR @@ -6555,14 +6555,20 @@ winwidth({nr}) *winwidth()* :endif < *writefile()* -writefile({list}, {fname} [, {binary}]) +writefile({list}, {fname} [, {flags}]) Write |List| {list} to file {fname}. Each list item is separated with a NL. Each list item must be a String or Number. - When {binary} is equal to "b" binary mode is used: There will + When {flags} contains "b" then binary mode is used: There will not be a NL after the last list item. An empty item at the end does cause the last line in the file to end in a NL. - All NL characters are replaced with a NUL character. + + When {flags} contains "a" then append mode is used, lines are + append to the file: > + :call writefile(["foo"], "event.log", "a") + :call writefile(["bar"], "event.log", "a") +> +< All NL characters are replaced with a NUL character. Inserting CR characters needs to be done before passing {list} to writefile(). An existing file is overwritten, if possible. diff --git a/src/Makefile b/src/Makefile index cfdca44fcd..39e2de99f9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1899,8 +1899,12 @@ test1 test2 test3 test4 test5 test6 test7 test8 test9 \ test_insertcount \ test_listlbr \ test_listlbr_utf8 \ + test_mapping \ test_options \ test_qf_title \ + test_signs \ + test_utf8 \ + test_writefile \ test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \ test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \ test30 test31 test32 test33 test34 test35 test36 test37 test38 test39 \ diff --git a/src/eval.c b/src/eval.c index ecc5e3a572..ba456f2bc2 100644 --- a/src/eval.c +++ b/src/eval.c @@ -19689,6 +19689,7 @@ f_writefile(argvars, rettv) typval_T *rettv; { int binary = FALSE; + int append = FALSE; char_u *fname; FILE *fd; int ret = 0; @@ -19704,14 +19705,19 @@ f_writefile(argvars, rettv) if (argvars[0].vval.v_list == NULL) return; - if (argvars[2].v_type != VAR_UNKNOWN - && STRCMP(get_tv_string(&argvars[2]), "b") == 0) - binary = TRUE; + if (argvars[2].v_type != VAR_UNKNOWN) + { + if (vim_strchr(get_tv_string(&argvars[2]), 'b') != NULL) + binary = TRUE; + if (vim_strchr(get_tv_string(&argvars[2]), 'a') != NULL) + append = TRUE; + } /* Always open the file in binary mode, library functions have a mind of * their own about CR-LF conversion. */ fname = get_tv_string(&argvars[1]); - if (*fname == NUL || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL) + if (*fname == NUL || (fd = mch_fopen((char *)fname, + append ? APPENDBIN : WRITEBIN)) == NULL) { EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("") : fname); ret = -1; diff --git a/src/testdir/test_writefile.in b/src/testdir/test_writefile.in new file mode 100644 index 0000000000..f2dc7d50bb --- /dev/null +++ b/src/testdir/test_writefile.in @@ -0,0 +1,18 @@ +Tests for writefile() + +STARTTEST +:source small.vim +:%delete _ +:let f = tempname() +:call writefile(["over","written"], f, "b") +:call writefile(["hello","world"], f, "b") +:call writefile(["!", "good"], f, "a") +:call writefile(["morning"], f, "ab") +:call writefile(["", "vimmers"], f, "ab") +:bwipeout! +:$put =readfile(f) +:1 delete _ +:w! test.out +:qa! +ENDTEST + diff --git a/src/testdir/test_writefile.ok b/src/testdir/test_writefile.ok new file mode 100644 index 0000000000..dfb6a2b29c --- /dev/null +++ b/src/testdir/test_writefile.ok @@ -0,0 +1,5 @@ +hello +world! +good +morning +vimmers diff --git a/src/version.c b/src/version.c index 7bc7153f77..f9c0ece552 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 503, /**/ 502, /**/ From a61cb831fd4eccb230f0ce7fa729525781445b01 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 15:18:17 +0100 Subject: [PATCH 179/311] updated for version 7.4.504 Problem: Restriction of the MS-Windows installer that the path must end in "Vim" prevents installing more than one version. Solution: Remove the restriction. (Tim Lebedkov) --- nsis/gvim.nsi | 9 ++------- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/nsis/gvim.nsi b/nsis/gvim.nsi index 7b69e7d9cb..a2d20bf829 100644 --- a/nsis/gvim.nsi +++ b/nsis/gvim.nsi @@ -1,6 +1,6 @@ # NSIS file to create a self-installing exe for Vim. # It requires NSIS version 2.0 or later. -# Last Change: 2010 Jul 30 +# Last Change: 2014 Nov 5 # WARNING: if you make changes to this script, look out for $0 to be valid, # because uninstall deletes most files in $0. @@ -38,7 +38,7 @@ SetDatablockOptimize on RequestExecutionLevel highest ComponentText "This will install Vim ${VER_MAJOR}.${VER_MINOR} on your computer." -DirText "Choose a directory to install Vim (must end in 'vim')" +DirText "Choose a directory to install Vim (should contain 'vim')" Icon icons\vim_16c.ico # NSIS2 uses a different strategy with six different images in a strip... #EnabledBitmap icons\enabled.bmp @@ -135,11 +135,6 @@ FunctionEnd # We only accept the directory if it ends in "vim". Using .onVerifyInstDir has # the disadvantage that the browse dialog is difficult to use. Function CheckInstallDir - StrCpy $0 $INSTDIR 3 -3 - StrCmp $0 "vim" PathGood - MessageBox MB_OK "The path must end in 'vim'." - Abort - PathGood: FunctionEnd Function .onInstSuccess diff --git a/src/version.c b/src/version.c index f9c0ece552..4bbc221552 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 504, /**/ 503, /**/ From 4c261f5c9a47183b79f0f64c8c28fb056ac6493f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 15:36:03 +0100 Subject: [PATCH 180/311] updated for version 7.4.505 Problem: On MS-Windows when 'encoding' is a double-byte encoding a file name longer than MAX_PATH bytes but shorter than that in characters causes problems. Solution: Fail on file names longer than MAX_PATH bytes. (Ken Takata) --- src/os_win32.c | 14 ++++++++++++++ src/version.c | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/os_win32.c b/src/os_win32.c index c03b963c4f..fcfafa01e8 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -6139,6 +6139,13 @@ mch_open(char *name, int flags, int mode) } # endif + /* open() can open a file which name is longer than _MAX_PATH bytes + * and shorter than _MAX_PATH characters successfully, but sometimes it + * causes unexpected error in another part. We make it an error explicitly + * here. */ + if (strlen(name) >= _MAX_PATH) + return -1; + return open(name, flags, mode); } @@ -6188,6 +6195,13 @@ mch_fopen(char *name, char *mode) * the _wfopen() fails for missing wide functions. */ } + /* fopen() can open a file which name is longer than _MAX_PATH bytes + * and shorter than _MAX_PATH characters successfully, but sometimes it + * causes unexpected error in another part. We make it an error explicitly + * here. */ + if (strlen(name) >= _MAX_PATH) + return NULL; + return fopen(name, mode); } #endif diff --git a/src/version.c b/src/version.c index 4bbc221552..178a7845f2 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 505, /**/ 504, /**/ From bf00058a7ff530b5496419d84cf7533e3ab72f2a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 5 Nov 2014 16:33:24 +0100 Subject: [PATCH 181/311] updated for version 7.4.506 Problem: MS-Windows: Cannot open a file with 259 characters. Solution: Fix off-by-one error. (Ken Takata) --- src/os_mswin.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/os_mswin.c b/src/os_mswin.c index 0dfd7d6091..b50b86c888 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -411,7 +411,7 @@ mch_FullName( * - convert the result from UCS2 to 'encoding'. */ wname = enc_to_utf16(fname, NULL); - if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH - 1) != NULL) + if (wname != NULL && _wfullpath(wbuf, wname, MAX_PATH) != NULL) { cname = utf16_to_enc((short_u *)wbuf, NULL); if (cname != NULL) diff --git a/src/version.c b/src/version.c index 178a7845f2..deaa7b556d 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 506, /**/ 505, /**/ From 6908df97d1aeb35e40807cc87bdd2bda02029144 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 6 Nov 2014 07:03:01 +0100 Subject: [PATCH 182/311] updated for version 7.4.507 Problem: Building with MingW and Perl. Solution: Remove quotes. (Ken Takata) --- src/Make_cyg_ming.mak | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index e4764c52bf..455750e33b 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -132,7 +132,7 @@ XSUBPPTRY=$(PERLLIB)/ExtUtils/xsubpp endif XSUBPP_EXISTS=$(shell $(PERLEXE) -e "print 1 unless -e '$(XSUBPPTRY)'") ifeq "$(XSUBPP_EXISTS)" "" -XSUBPP=$(PERLEXE) "$(XSUBPPTRY)" +XSUBPP=$(PERLEXE) $(XSUBPPTRY) else XSUBPP=xsubpp endif @@ -809,7 +809,7 @@ endif if_perl.c: if_perl.xs typemap $(XSUBPP) -prototypes -typemap \ - "$(PERLTYPEMAP)" if_perl.xs > $@ + $(PERLTYPEMAP) if_perl.xs > $@ $(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC) $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o diff --git a/src/version.c b/src/version.c index deaa7b556d..329bcd2aa8 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 507, /**/ 506, /**/ From 9ce94fc6ccf6b3c8bc86b6cebb1a067d68562fe5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 12 Nov 2014 10:07:53 +0100 Subject: [PATCH 183/311] updated for version 7.4.508 Problem: When generating ja.sjis.po the header is not correctly adjusted. Solution: Check for the right header string. (Ken Takata) --- src/po/sjiscorr.c | 3 +-- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/po/sjiscorr.c b/src/po/sjiscorr.c index fec4740c04..b8f7e632ad 100644 --- a/src/po/sjiscorr.c +++ b/src/po/sjiscorr.c @@ -23,9 +23,8 @@ main(argc, argv) fputs("charset=cp932", stdout); p += 12; } - else if (strncmp(p, "ja.po - Japanese message file", 29) == 0) + else if (strncmp(p, "# Original translations", 23) == 0) { - fputs("ja.sjis.po - Japanese message file for Vim (version 6.x)\n", stdout); fputs("# generated from ja.po, DO NOT EDIT", stdout); while (p[1] != '\n') ++p; diff --git a/src/version.c b/src/version.c index 329bcd2aa8..76ab14690d 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 508, /**/ 507, /**/ From 1abf903ea9a731d9daf14f23a4427df0632fa62a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 12 Nov 2014 12:15:42 +0100 Subject: [PATCH 184/311] updated for version 7.4.509 Problem: Users are not aware their encryption is weak. Solution: Give a warning when prompting for the key. --- src/crypt.c | 20 ++++++++++++++++++++ src/ex_docmd.c | 1 + src/fileio.c | 1 + src/main.c | 1 + src/proto/crypt.pro | 2 ++ src/version.c | 2 ++ 6 files changed, 27 insertions(+) diff --git a/src/crypt.c b/src/crypt.c index c54e15c4af..f25a2c4a9d 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -503,6 +503,26 @@ crypt_free_key(key) } } +/* + * Check the crypt method and give a warning if it's outdated. + */ + void +crypt_check_method(method) + int method; +{ + if (method < CRYPT_M_BF2) + { + msg_scroll = TRUE; + MSG(_("Warning: Using a weak encryption method; see :help 'cm'")); + } +} + + void +crypt_check_current_method() +{ + crypt_check_method(crypt_get_method_nr(curbuf)); +} + /* * Ask the user for a crypt key. * When "store" is TRUE, the new key is stored in the 'key' option, and the diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 35e44f0f3c..e90a36ecc6 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -11524,6 +11524,7 @@ ex_match(eap) ex_X(eap) exarg_T *eap UNUSED; { + crypt_check_current_method(); (void)crypt_get_key(TRUE, TRUE); } #endif diff --git a/src/fileio.c b/src/fileio.c index 0843d04296..a978ec241d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2958,6 +2958,7 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask) * Happens when retrying to detect encoding. */ smsg((char_u *)_(need_key_msg), fname); msg_scroll = TRUE; + crypt_check_method(method); cryptkey = crypt_get_key(newfile, FALSE); *did_ask = TRUE; diff --git a/src/main.c b/src/main.c index fe75495828..1814385197 100644 --- a/src/main.c +++ b/src/main.c @@ -854,6 +854,7 @@ vim_main2(int argc UNUSED, char **argv UNUSED) #ifdef FEAT_CRYPT if (params.ask_for_key) { + crypt_check_current_method(); (void)crypt_get_key(TRUE, TRUE); TIME_MSG("getting crypt key"); } diff --git a/src/proto/crypt.pro b/src/proto/crypt.pro index d61df718bd..7b29026a1d 100644 --- a/src/proto/crypt.pro +++ b/src/proto/crypt.pro @@ -19,6 +19,8 @@ void crypt_decode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u void crypt_encode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len)); void crypt_decode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len)); void crypt_free_key __ARGS((char_u *key)); +void crypt_check_method __ARGS((int method)); +void crypt_check_current_method __ARGS((void)); char_u *crypt_get_key __ARGS((int store, int twice)); void crypt_append_msg __ARGS((buf_T *buf)); /* vim: set ft=c : */ diff --git a/src/version.c b/src/version.c index 76ab14690d..06c4016bec 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 509, /**/ 508, /**/ From 8f48fcfacd9ea23fb1d00ca6cd6765f09b3a1537 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 12 Nov 2014 12:45:21 +0100 Subject: [PATCH 185/311] updated for version 7.4.510 Problem: "-fwrapv" argument breaks use of cproto. Solution: Remove the alphabetic arguments in a drastic way. --- src/Makefile | 7 +++---- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index 39e2de99f9..6bf8c1737d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1779,13 +1779,12 @@ update-po: proto: $(PRO_AUTO) $(PRO_MANUAL) # Filter out arguments that cproto doesn't support. -# Don't pass "-pthread" to cproto, it sees it as a list of individual flags. -# Don't pass "-fstack-protector" to cproto, for the same reason. -# Don't pass "-g" to cproto. +# Don't pass "-pthread", "-fwrapv" and similar arguments to cproto, it sees +# them as a list of individual flags. # The -E"gcc -E" argument must be separate to avoid problems with shell # quoting. CPROTO = cproto $(PROTO_FLAGS) -DPROTO \ - `echo '$(LINT_CFLAGS)' | sed -e 's/-pthread//g' -e 's/-fstack-protector//g' -e 's/\ -g\ / /g'` + `echo '$(LINT_CFLAGS)' | sed -e 's/ -[a-z-]\+//g'` ### Would be nice if this would work for "normal" make. ### Currently it only works for (Free)BSD make. diff --git a/src/version.c b/src/version.c index 06c4016bec..89272be506 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 510, /**/ 509, /**/ From eecf4a7ceb15b55ccb071591d0091642d90e29a7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 12 Nov 2014 13:05:04 +0100 Subject: [PATCH 186/311] updated for version 7.4.511 Problem: Generating proto for if_ruby.c uses type not defined elsewhere. Solution: Do not generate a prototype for rb_gc_writebarrier_unprotect_promoted() --- src/if_ruby.c | 3 ++- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/if_ruby.c b/src/if_ruby.c index 06465bd5a7..9301b72927 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -418,7 +418,8 @@ VALUE rb_num2ulong(VALUE x) # endif # endif -# if defined(USE_RGENGC) && USE_RGENGC + /* Do not generate a prototype here, VALUE isn't always defined. */ +# if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO) void rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj) { return dll_rb_gc_writebarrier_unprotect_promoted(obj); diff --git a/src/version.c b/src/version.c index 89272be506..f2b1ca7c5a 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 511, /**/ 510, /**/ From c0f1ecaab64e2ca4a7eed5179ab5be8ca3a2a186 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 12 Nov 2014 13:10:48 +0100 Subject: [PATCH 187/311] updated for version 7.4.512 Problem: Cannot generate prototypes for Win32 files and VMS. Solution: Add typedefs and #ifdef --- src/gui_w32.c | 4 +++- src/os_vms.c | 2 +- src/os_win32.c | 2 ++ src/version.c | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui_w32.c b/src/gui_w32.c index 374ed47258..b81a74df96 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -29,12 +29,14 @@ # include "gui_dwrite.h" #endif -#if defined(FEAT_DIRECTX) || defined(PROTO) +#if defined(FEAT_DIRECTX) static DWriteContext *s_dwc = NULL; static int s_directx_enabled = 0; static int s_directx_load_attempted = 0; # define IS_ENABLE_DIRECTX() (s_directx_enabled && s_dwc != NULL) +#endif +#if defined(FEAT_DIRECTX) || defined(PROTO) int directx_enabled(void) { diff --git a/src/os_vms.c b/src/os_vms.c index 55876b27fe..12eceedd0c 100644 --- a/src/os_vms.c +++ b/src/os_vms.c @@ -12,7 +12,7 @@ #include "vim.h" /* define _generic_64 for use in time functions */ -#ifndef VAX +#if !defined(VAX) && !defined(PROTO) # include #else /* based on Alpha's gen64def.h; the file is absent on VAX */ diff --git a/src/os_win32.c b/src/os_win32.c index fcfafa01e8..939563805a 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -135,6 +135,8 @@ typedef int BY_HANDLE_FILE_INFORMATION; typedef int SE_OBJECT_TYPE; typedef int PSNSECINFO; typedef int PSNSECINFOW; +typedef int STARTUPINFO; +typedef int PROCESS_INFORMATION; #endif #ifndef FEAT_GUI_W32 diff --git a/src/version.c b/src/version.c index f2b1ca7c5a..2aaef3cc8a 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 512, /**/ 511, /**/ From a9b56036904e84ba4f9056522df96d40f5d3f11d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 12 Nov 2014 15:49:16 +0100 Subject: [PATCH 188/311] updated for version 7.4.513 Problem: Crash because reference count is wrong for list returned by getreg(). Solution: Increment the reference count. (Kimmy Lindvall) --- src/eval.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/eval.c b/src/eval.c index ba456f2bc2..ea24a9c37f 100644 --- a/src/eval.c +++ b/src/eval.c @@ -12008,6 +12008,8 @@ f_getreg(argvars, rettv) rettv->v_type = VAR_LIST; rettv->vval.v_list = (list_T *)get_reg_contents(regname, (arg2 ? GREG_EXPR_SRC : 0) | GREG_LIST); + if (rettv->vval.v_list != NULL) + ++rettv->vval.v_list->lv_refcount; } else { diff --git a/src/version.c b/src/version.c index 2aaef3cc8a..df18f5e962 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 513, /**/ 512, /**/ From bab90a6ff031051d11cb90ec9ae51d294081d615 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 12 Nov 2014 15:59:25 +0100 Subject: [PATCH 189/311] updated for version 7.4.514 Problem: Memory access error. (Dominique Pelle) Solution: Update tpos. (Christian Brabandt) --- src/edit.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/edit.c b/src/edit.c index ee63daa1c7..13faafeb78 100644 --- a/src/edit.c +++ b/src/edit.c @@ -6918,6 +6918,8 @@ stop_insert(end_insert_pos, esc, nomove) curwin->w_cursor = tpos; else { + /* reset tpos, could have been invalidated in the loop above */ + tpos = curwin->w_cursor; tpos.col++; if (cc != NUL && gchar_pos(&tpos) == NUL) ++curwin->w_cursor.col; /* put cursor back on the NUL */ diff --git a/src/version.c b/src/version.c index df18f5e962..5ca2f2723c 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 514, /**/ 513, /**/ From 6ff29e233d21907501fd1d0be31826bab794a08e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 12 Nov 2014 16:28:16 +0100 Subject: [PATCH 190/311] updated for version 7.4.515 Problem: In a help buffer the global 'foldmethod' is used. (Paul Marshall) Solution: Reset 'foldmethod' when starting to edit a help file. Move the code to a separate function. --- src/ex_cmds.c | 130 +++++++++++++++++++++++++++----------------------- src/version.c | 2 + 2 files changed, 72 insertions(+), 60 deletions(-) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index b8076fc37b..1114f85345 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -34,6 +34,7 @@ static int _RTLENTRYF #endif help_compare __ARGS((const void *s1, const void *s2)); +static void prepare_help_buffer __ARGS((void)); /* * ":ascii" and "ga". @@ -3531,71 +3532,15 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) oldbuf = (flags & ECMD_OLDBUF); } +#ifdef FEAT_AUTOCMD + buf = curbuf; +#endif if ((flags & ECMD_SET_HELP) || keep_help_flag) { - char_u *p; - - curbuf->b_help = TRUE; -#ifdef FEAT_QUICKFIX - set_string_option_direct((char_u *)"buftype", -1, - (char_u *)"help", OPT_FREE|OPT_LOCAL, 0); -#endif - - /* - * Always set these options after jumping to a help tag, because the - * user may have an autocommand that gets in the way. - * Accept all ASCII chars for keywords, except ' ', '*', '"', '|', and - * latin1 word characters (for translated help files). - * Only set it when needed, buf_init_chartab() is some work. - */ - p = -#ifdef EBCDIC - (char_u *)"65-255,^*,^|,^\""; -#else - (char_u *)"!-~,^*,^|,^\",192-255"; -#endif - if (STRCMP(curbuf->b_p_isk, p) != 0) - { - set_string_option_direct((char_u *)"isk", -1, p, - OPT_FREE|OPT_LOCAL, 0); - check_buf_options(curbuf); - (void)buf_init_chartab(curbuf, FALSE); - } - - curbuf->b_p_ts = 8; /* 'tabstop' is 8 */ - curwin->w_p_list = FALSE; /* no list mode */ - - curbuf->b_p_ma = FALSE; /* not modifiable */ - curbuf->b_p_bin = FALSE; /* reset 'bin' before reading file */ - curwin->w_p_nu = 0; /* no line numbers */ - curwin->w_p_rnu = 0; /* no relative line numbers */ - RESET_BINDING(curwin); /* no scroll or cursor binding */ -#ifdef FEAT_ARABIC - curwin->w_p_arab = FALSE; /* no arabic mode */ -#endif -#ifdef FEAT_RIGHTLEFT - curwin->w_p_rl = FALSE; /* help window is left-to-right */ -#endif -#ifdef FEAT_FOLDING - curwin->w_p_fen = FALSE; /* No folding in the help window */ -#endif -#ifdef FEAT_DIFF - curwin->w_p_diff = FALSE; /* No 'diff' */ -#endif -#ifdef FEAT_SPELL - curwin->w_p_spell = FALSE; /* No spell checking */ -#endif - -#ifdef FEAT_AUTOCMD - buf = curbuf; -#endif - set_buflisted(FALSE); + prepare_help_buffer(); } else { -#ifdef FEAT_AUTOCMD - buf = curbuf; -#endif /* Don't make a buffer listed if it's a help buffer. Useful when * using CTRL-O to go back to a help file. */ if (!curbuf->b_help) @@ -6221,6 +6166,71 @@ find_help_tags(arg, num_matches, matches, keep_lang) return OK; } +/* + * Called when starting to edit a buffer for a help file. + */ + static void +prepare_help_buffer() +{ + char_u *p; + + curbuf->b_help = TRUE; +#ifdef FEAT_QUICKFIX + set_string_option_direct((char_u *)"buftype", -1, + (char_u *)"help", OPT_FREE|OPT_LOCAL, 0); +#endif + + /* + * Always set these options after jumping to a help tag, because the + * user may have an autocommand that gets in the way. + * Accept all ASCII chars for keywords, except ' ', '*', '"', '|', and + * latin1 word characters (for translated help files). + * Only set it when needed, buf_init_chartab() is some work. + */ + p = +#ifdef EBCDIC + (char_u *)"65-255,^*,^|,^\""; +#else + (char_u *)"!-~,^*,^|,^\",192-255"; +#endif + if (STRCMP(curbuf->b_p_isk, p) != 0) + { + set_string_option_direct((char_u *)"isk", -1, p, OPT_FREE|OPT_LOCAL, 0); + check_buf_options(curbuf); + (void)buf_init_chartab(curbuf, FALSE); + } + + /* Don't use the global foldmethod.*/ + set_string_option_direct((char_u *)"fdm", -1, (char_u *)"manual", + OPT_FREE|OPT_LOCAL, 0); + + curbuf->b_p_ts = 8; /* 'tabstop' is 8 */ + curwin->w_p_list = FALSE; /* no list mode */ + + curbuf->b_p_ma = FALSE; /* not modifiable */ + curbuf->b_p_bin = FALSE; /* reset 'bin' before reading file */ + curwin->w_p_nu = 0; /* no line numbers */ + curwin->w_p_rnu = 0; /* no relative line numbers */ + RESET_BINDING(curwin); /* no scroll or cursor binding */ +#ifdef FEAT_ARABIC + curwin->w_p_arab = FALSE; /* no arabic mode */ +#endif +#ifdef FEAT_RIGHTLEFT + curwin->w_p_rl = FALSE; /* help window is left-to-right */ +#endif +#ifdef FEAT_FOLDING + curwin->w_p_fen = FALSE; /* No folding in the help window */ +#endif +#ifdef FEAT_DIFF + curwin->w_p_diff = FALSE; /* No 'diff' */ +#endif +#ifdef FEAT_SPELL + curwin->w_p_spell = FALSE; /* No spell checking */ +#endif + + set_buflisted(FALSE); +} + /* * After reading a help file: May cleanup a help buffer when syntax * highlighting is not used. diff --git a/src/version.c b/src/version.c index 5ca2f2723c..2f524c85d6 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 515, /**/ 514, /**/ From c3e5d9a0dfaece52f210c3cd204de74f4cc0b4ee Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 12 Nov 2014 17:09:06 +0100 Subject: [PATCH 191/311] updated for version 7.4.516 Problem: Completing a function name containing a # does not work. Issue 253. Solution: Recognize the # character. (Christian Brabandt) --- src/eval.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/eval.c b/src/eval.c index ea24a9c37f..1b1072cd80 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3368,11 +3368,11 @@ set_context_for_expression(xp, arg, cmdidx) got_eq = TRUE; xp->xp_context = EXPAND_EXPRESSION; } - else if (c == '<' + else if ((c == '<' || c == '#') && xp->xp_context == EXPAND_FUNCTIONS && vim_strchr(xp->xp_pattern, '(') == NULL) { - /* Function name can start with "" */ + /* Function name can start with "" and contain '#'. */ break; } else if (cmdidx != CMD_let || got_eq) diff --git a/src/version.c b/src/version.c index 2f524c85d6..826679ef38 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 516, /**/ 515, /**/ From 431416e9cf0de35c350bceef678178d528b069e4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 13 Nov 2014 11:25:38 +0100 Subject: [PATCH 192/311] Update runtime files. --- runtime/doc/editing.txt | 12 +++++------ runtime/doc/eval.txt | 4 ++-- runtime/doc/options.txt | 2 ++ runtime/doc/tags | 2 ++ runtime/doc/todo.txt | 43 ++++++++++++++++++++-------------------- runtime/ftplugin/man.vim | 6 ++++-- runtime/indent/lua.vim | 4 ++-- runtime/syntax/diff.vim | 4 ++-- 8 files changed, 41 insertions(+), 36 deletions(-) diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index add3bb0878..b02f8faec2 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.4. Last change: 2014 Sep 19 +*editing.txt* For Vim version 7.4. Last change: 2014 Nov 12 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1415,13 +1415,11 @@ Do this before writing the file. When reading an encrypted file it will be set automatically to the method used when that file was written. You can change 'cryptmethod' before writing that file to change the method. -To set the default method, used for new files, use one of these in your -|vimrc| file: > - set cm=zip +To set the default method, used for new files, use this in your |vimrc| +file: > set cm=blowfish2 -Use the first one if you need to be compatible with Vim 7.2 and older. Using -"blowfish2" is highly recommended if you can use a Vim version that supports -it. +Using "blowfish2" is highly recommended. Only use another method if you +must use an older Vim version that does not support it. The message given for reading and writing a file will show "[crypted]" when using zip, "[blowfish]" when using blowfish, etc. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 4e349a6e08..f21e051b6e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Sep 27 +*eval.txt* For Vim version 7.4. Last change: 2014 Nov 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4851,7 +4851,7 @@ readfile({fname} [, {binary} [, {max}]]) separated with CR will result in a single long line (unless a NL appears somewhere). All NUL characters are replaced with a NL character. - When {binary} is equal to "b" binary mode is used: + When {binary/append} is contains "b" binary mode is used: - When the last line ends in a NL an extra empty list item is added. - No CR characters are removed. diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 525a08cdbe..72459b0fc5 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4534,6 +4534,8 @@ A jump table for the options with a short description can be found at |Q_op|. be able to execute Normal mode commands. This is the opposite of the 'keymap' option, where characters are mapped in Insert mode. + Also consider setting 'langnoremap' to avoid 'langmap' applies to + characters resulting from a mapping. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. diff --git a/runtime/doc/tags b/runtime/doc/tags index 460be9044e..9a23ce4cf9 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -392,6 +392,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'kp' options.txt /*'kp'* 'langmap' options.txt /*'langmap'* 'langmenu' options.txt /*'langmenu'* +'langnoremap' options.txt /*'langnoremap'* 'laststatus' options.txt /*'laststatus'* 'lazyredraw' options.txt /*'lazyredraw'* 'lbr' options.txt /*'lbr'* @@ -405,6 +406,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* 'listchars' options.txt /*'listchars'* 'lm' options.txt /*'lm'* 'lmap' options.txt /*'lmap'* +'lnr' options.txt /*'lnr'* 'loadplugins' options.txt /*'loadplugins'* 'lpl' options.txt /*'lpl'* 'ls' options.txt /*'ls'* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 32b1f901c3..aa44d481d9 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Nov 05 +*todo.txt* For Vim version 7.4. Last change: 2014 Nov 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,6 +34,8 @@ not be repeated below, unless there is extra information. *known-bugs* -------------------- Known bugs and current work ----------------------- +Add langnoremap in quickref.txt and optwin.vim. + Regexp problems: - The NFA engine does not implement the time limit passed to nfa_regexec_multi() @@ -73,6 +75,7 @@ Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug Make ":+1close" close the next window. Make ":-1close" close the previous window. Doesn't look right, asked for updates. +Update 2014 Nov 8. Replied with suggestions. C macro with number highlighted wrong. (Dominique Pelle, 2014 Oct 23) @@ -81,30 +84,12 @@ set with setmatches(). (lcd47, 2014 Jun 29) Gvim: when both Tab and CTRL-I are mapped, use CTRL-I not for Tab. -Patch to add 'langnoremap'. (Christian Brabandt, 2014 Oct 15) -Update Oct 20. - -Patch to add append mode to writefile(). (Yasuhiro Matsumoto, 2014 Nov 1) - -Remove restriction in NSIS installer that the end of the path must be "Vim". -(Tim Lebedkov, 2014 Sep 24) Again Oct 12. Now on issue 272. - -Fix that on MS-Windows MAX_PATH in bytes causes problems for file names -between MAX_PATH and double that for double-byte encodings. (Ken Takata, 2014 -Oct 15) - -Another problem with MAX_PATH, off-by-one. (Ken Takata, 2014 Oct 21) - Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) -'foldexpr' applies to help. (Paul Marshall, 2014 Sep 24) - Patch to fix issue 203. (Christian Brabandt, 2014 Oct 8) -Patch to fix issue 253. (Christian Brabandt, 2014 Oct 8) - Patch to fix issue 78. (Christian Brabandt, 2014 Oct 8) Patch to fix leak in map() with error. (Christian Brabandt, 2014 Oct 11) @@ -113,9 +98,20 @@ Patch to fix incsearch for "2/pattern/e". Change behavior of v:hlsearch? Patch from Christian, 2014 Oct 22. +MS-Windows: When editing a file with a leading space, writing it uses the +wrong name. (Aram, 2014 Nov 7) Vim 7.4. + +patch to remove FEAT_OSFILETYPE from fileio.c. (Christian, 2014 Nov 12) + Value returned by virtcol() changes depending on how lines wrap. This is inconsistent with the documentation. +Fix for wrong formatting if 'linebreak' is set. (Christian Brabandt, 2014 Nov +12) + +Patch to support hex values for setting option value. +(Zyx, 2015 Nov 6) + On MS-Windows running tests with Mercurial has problems when the input files are changed. (Ken Takata, Taro Muraoka, 2014 Sep 25) Update Nov 5. @@ -123,6 +119,9 @@ Update Nov 5. MS-Windows: Crash opening very long file name starting with "\\". (Christian Brock, 2012 Jun 29) +Problem using diff syntax with cp932 encoding. Idea from Yasuhiro Matsumoto, +patch from Ken Takata (2014 Nov 6) + ml_updatechunk() is slow when retrying for another encoding. (John Little, 2014 Sep 11) @@ -161,8 +160,10 @@ Patch from Jacob, Nov 2. "hi link" does not respect groups with GUI settings only. (Mark Lodato, 2014 Jun 8) -Patch to switch to the BT regexp engine when the NFA engine uses many states. -(Christian Brabandt, 2014 Oct 3) +Bug: Autocompleting ":tag/pat" replaces "/pat" with a match but does not +insert a space. (Micha Mos, 2014 Nov 7) + +Patch to add the :bvimgrep command. (Christian Brabandt, 2014 Nov 12) Patch to add argument to :cquit. (Thinca, 2014 Oct 12) diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index c6e1e9d4f7..11b2b0a665 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: man " Maintainer: SungHyun Nam -" Last Change: 2013 Jul 17 +" Last Change: 2014 Nov 12 " To make the ":Man" command available before editing a manual page, source " this script from your startup vimrc file. @@ -63,7 +63,9 @@ endtry func PreGetPage(cnt) if a:cnt == 0 let old_isk = &iskeyword - setl iskeyword+=(,) + if &ft == 'man' + setl iskeyword+=(,) + endif let str = expand("") let &l:iskeyword = old_isk let page = substitute(str, '(*\(\k\+\).*', '\1', '') diff --git a/runtime/indent/lua.vim b/runtime/indent/lua.vim index 21b02f1549..5f049d4585 100644 --- a/runtime/indent/lua.vim +++ b/runtime/indent/lua.vim @@ -2,7 +2,7 @@ " Language: Lua script " Maintainer: Marcus Aurelius Farias " First Author: Max Ischenko -" Last Change: 2007 Jul 23 +" Last Change: 2014 Nov 12 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -54,7 +54,7 @@ function! GetLuaIndent() " Subtract a 'shiftwidth' on end, else (and elseif), until and '}' " This is the part that requires 'indentkeys'. - let midx = match(getline(v:lnum), '^\s*\%(end\|else\|until\|}\)') + let midx = match(getline(v:lnum), '^\s*\%(end\>\|else\>\|until\>\|}\)') if midx != -1 && synIDattr(synID(v:lnum, midx + 1, 1), "name") != "luaComment" let ind = ind - &shiftwidth endif diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim index aa5be3f6fe..a0005140b2 100644 --- a/runtime/syntax/diff.vim +++ b/runtime/syntax/diff.vim @@ -2,7 +2,7 @@ " Language: Diff (context or unified) " Maintainer: Bram Moolenaar " Translations by Jakson Alves de Aquino. -" Last Change: 2013 Oct 06 +" Last Change: 2014 Nov 12 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -125,7 +125,7 @@ syn match diffIdentical "^םיהז םניה .*-ו .* םיצבקה$" syn match diffDiffer "^הזמ הז םינוש `.*'-ו `.*' םיצבקה$" syn match diffBDiffer "^הזמ הז םינוש `.*'-ו `.*' םיירניב םיצבק$" syn match diffIsA "^.* .*-ל .* .* תוושהל ןתינ אל$" -syn match diffNoEOL "^\\ ץבוקה ףוסב השדח-הרוש ות רסח" +syn match diffNoEOL "^\\ ץבוקה ףוסב השד.-הרוש ות רס." syn match diffCommon "^.*-ו .* :תוהז תויקית-תת$" " hr From b015e6375c505fdf24690ae0a43b07a36735b881 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 13 Nov 2014 11:26:09 +0100 Subject: [PATCH 193/311] Update translations. --- src/po/eo.po | 203 +++++++++----- src/po/fr.po | 640 +++++++++++++++++++++++++++++--------------- src/po/ja.sjis.po | 2 +- src/po/uk.cp1251.po | 153 ++++++++--- src/po/uk.po | 153 ++++++++--- 5 files changed, 787 insertions(+), 364 deletions(-) diff --git a/src/po/eo.po b/src/po/eo.po index 580c7ac797..2070991af7 100644 --- a/src/po/eo.po +++ b/src/po/eo.po @@ -23,8 +23,8 @@ msgid "" msgstr "" "Project-Id-Version: Vim(Esperanto)\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-03-21 23:15+0100\n" -"PO-Revision-Date: 2014-03-21 23:16+0100\n" +"POT-Creation-Date: 2014-11-05 21:12+0100\n" +"PO-Revision-Date: 2014-11-05 21:12+0100\n" "Last-Translator: Dominique PELLÉ \n" "Language-Team: \n" "Language: eo\n" @@ -42,10 +42,10 @@ msgid "E817: Blowfish big/little endian use wrong" msgstr "E817: Misuzo de pezkomenca/pezfina en blowfish" msgid "E818: sha256 test failed" -msgstr "E818: Testo de sha256 fiaskis" +msgstr "E818: Testo de sha256 malsukcesis" msgid "E819: Blowfish test failed" -msgstr "E819: Testo de blowfish fiaskis" +msgstr "E819: Testo de blowfish malsukcesis" msgid "[Location List]" msgstr "[Listo de lokoj]" @@ -219,6 +219,21 @@ msgstr "Emfazaj simbolaĵoj de %s:" msgid " line=%ld id=%d name=%s" msgstr " linio=%ld id=%d nomo=%s" +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Dosiero estas ĉifrata per nekonata metodo" + +msgid "Enter encryption key: " +msgstr "Tajpu la ŝlosilon de ĉifrado: " + +msgid "Enter same key again: " +msgstr "Tajpu la ŝlosilon denove: " + +msgid "Keys don't match!" +msgstr "Ŝlosiloj ne kongruas!" + +msgid "[crypted]" +msgstr "[ĉifrita]" + #, c-format msgid "E96: Can not diff more than %ld buffers" msgstr "E96: Ne eblas dosierdiferenci pli ol %ld bufrojn" @@ -676,8 +691,14 @@ msgstr "E258: Ne eblas sendi al kliento" msgid "sort() argument" msgstr "argumento de sort()" +msgid "uniq() argument" +msgstr "argumento de uniq()" + msgid "E702: Sort compare function failed" -msgstr "E702: Ordiga funkcio fiaskis" +msgstr "E702: Ordiga funkcio malsukcesis" + +msgid "E882: Uniq compare function failed" +msgstr "E882: kompara funkcio de uniq() malsukcesis" msgid "(Invalid)" msgstr "(Nevalida)" @@ -774,8 +795,12 @@ msgid "E129: Function name required" msgstr "E129: Nomo de funkcio bezonata" #, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: Nomo de funkcio devas eki per majusklo aŭ enhavi dupunkton: %s" +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "E128: Nomo de funkcio devas eki per majusklo aŭ per \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Nomo de funkcio ne povas enhavi dupunkton: %s" #, c-format msgid "E131: Cannot delete function %s: It is in use" @@ -877,7 +902,7 @@ msgid " oldfiles" msgstr " malnovaj dosieroj" msgid " FAILED" -msgstr " FIASKIS" +msgstr " MALSUKCESIS" #. avoid a wait_return for this message, it's annoying #, c-format @@ -892,6 +917,10 @@ msgstr "E138: Ne eblas skribi dosieron viminfo %s!" msgid "Writing viminfo file \"%s\"" msgstr "Skribas dosieron viminfo \"%s\"" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Ne eblas renomi dosieron viminfo al %s!" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" @@ -1093,6 +1122,10 @@ msgstr "E158: Nevalida nomo de bufro: %s" msgid "E157: Invalid sign ID: %ld" msgstr "E157: Nevalida identigilo de simbolo: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Ne eblas ŝanĝi simbolon %s" + msgid " (NOT FOUND)" msgstr " (NETROVITA)" @@ -1679,12 +1712,6 @@ msgstr "[NE konvertita]" msgid "[converted]" msgstr "[konvertita]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[ĉifrita]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ERARO DE KONVERTO en linio %ld]" @@ -1700,14 +1727,11 @@ msgid "Can't find temp file for conversion" msgstr "Ne eblas trovi provizoran dosieron por konverti" msgid "Conversion with 'charconvert' failed" -msgstr "Konverto kun 'charconvert' fiaskis" +msgstr "Konverto kun 'charconvert' malsukcesis" msgid "can't read output of 'charconvert'" msgstr "ne eblas legi la eligon de 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: Dosiero estas ĉifrata per nekonata metodo" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Neniu kongrua aŭtokomando por la bufro acwrite" @@ -1764,21 +1788,22 @@ msgstr "E212: Ne eblas malfermi la dosieron por skribi" # AM: fsync: ne traduku (nomo de C-komando) msgid "E667: Fsync failed" -msgstr "E667: Fsync fiaskis" +msgstr "E667: Fsync malsukcesis" msgid "E512: Close failed" -msgstr "E512: Fermo fiaskis" +msgstr "E512: Fermo malsukcesis" msgid "E513: write error, conversion failed (make 'fenc' empty to override)" -msgstr "E513: skriberaro, konverto fiaskis (igu 'fenc' malplena por transpasi)" +msgstr "" +"E513: skriberaro, konverto malsukcesis (igu 'fenc' malplena por transpasi)" #, c-format msgid "" "E513: write error, conversion failed in line %ld (make 'fenc' empty to " "override)" msgstr "" -"E513: skriberaro, konverto fiaskis en linio %ld (igu 'fenc' malplena por " -"transpasi)" +"E513: skriberaro, konverto malsukcesis en linio %ld (igu 'fenc' malplena " +"por transpasi)" msgid "E514: write error (file system full?)" msgstr "E514: skriberaro (ĉu plena dosiersistemo?)" @@ -2052,10 +2077,10 @@ msgid "E228: makemap: Illegal mode" msgstr "E228: makemap: Nevalida reĝimo" msgid "E851: Failed to create a new process for the GUI" -msgstr "E851: Ne sukcesis krei novan procezon por la grafika interfaco" +msgstr "E851: Malsukcesis krei novan procezon por la grafika interfaco" msgid "E852: The child process failed to start the GUI" -msgstr "E852: La ida procezo ne sukcesis startigi la grafikan interfacon" +msgstr "E852: La ida procezo malsukcesis startigi la grafikan interfacon" msgid "E229: Cannot start the GUI" msgstr "E229: Ne eblas lanĉi la grafikan interfacon" @@ -2414,7 +2439,7 @@ msgid "Sending to printer..." msgstr "Sendas al presilo..." msgid "E365: Failed to print PostScript file" -msgstr "E365: Presado de PostSkripta dosiero fiaskis" +msgstr "E365: Presado de PostSkripta dosiero malsukcesis" msgid "Print job sent." msgstr "Laboro de presado sendita." @@ -2479,16 +2504,16 @@ msgid "E622: Could not fork for cscope" msgstr "E622: Ne eblis forki cscope" msgid "cs_create_connection setpgid failed" -msgstr "plenumo de cs_create_connection-setgpid fiaskis" +msgstr "plenumo de cs_create_connection-setgpid malsukcesis" msgid "cs_create_connection exec failed" -msgstr "plenumo de cs_create_connection fiaskis" +msgstr "plenumo de cs_create_connection malsukcesis" msgid "cs_create_connection: fdopen for to_fp failed" -msgstr "cs_create_connection: fdopen de to_fp fiaskis" +msgstr "cs_create_connection: fdopen de to_fp malsukcesis" msgid "cs_create_connection: fdopen for fr_fp failed" -msgstr "cs_create_connection: fdopen de fr_fp fiaskis" +msgstr "cs_create_connection: fdopen de fr_fp malsukcesis" msgid "E623: Could not spawn cscope process" msgstr "E623: Ne eblis naskigi procezon cscope" @@ -2655,6 +2680,13 @@ msgstr "" "E263: Bedaŭrinde tiu komando estas malŝaltita: la biblioteko de Pitono ne " "ŝargeblis." +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887` Bedaŭrinde tiu komando estas malŝaltita: la biblioteko de Pitono ne " +"ŝargeblis." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Ne eblas alvoki Pitonon rekursie" @@ -2860,7 +2892,7 @@ msgid "Unable to register a command server name" msgstr "Ne eblas registri nomon de komanda servilo" msgid "E248: Failed to send command to the destination program" -msgstr "E248: Sendo de komando al cela programo fiaskis" +msgstr "E248: Sendo de komando al cela programo malsukcesis" #, c-format msgid "E573: Invalid server id used: %s" @@ -2911,7 +2943,7 @@ msgid "Cannot open for script output: \"" msgstr "Ne eblas malfermi por eligo de skripto: \"" msgid "Vim: Error: Failure to start gvim from NetBeans\n" -msgstr "Vim: Eraro: Fiaskis lanĉi gvim el NetBeans\n" +msgstr "Vim: Eraro: malsukcesis lanĉi gvim el NetBeans\n" msgid "Vim: Warning: Output is not to a terminal\n" msgstr "Vim: Averto: Eligo ne estas al terminalo\n" @@ -3280,21 +3312,21 @@ msgstr "Neniu ekrano" #. Failed to send, abort. msgid ": Send failed.\n" -msgstr ": Sendo fiaskis.\n" +msgstr ": Sendo malsukcesis.\n" #. Let vim start normally. msgid ": Send failed. Trying to execute locally\n" -msgstr ": Sendo fiaskis. Provo de loka plenumo\n" +msgstr ": Sendo malsukcesis. Provo de loka plenumo\n" #, c-format msgid "%d of %d edited" msgstr "%d de %d redaktita(j)" msgid "No display: Send expression failed.\n" -msgstr "Neniu ekrano: Sendado de esprimo fiaskis.\n" +msgstr "Neniu ekrano: Sendado de esprimo malsukcesis.\n" msgid ": Send expression failed.\n" -msgstr ": Sendado de esprimo fiaskis.\n" +msgstr ": Sendado de esprimo malsukcesis.\n" msgid "No marks set" msgstr "Neniu marko" @@ -3359,10 +3391,10 @@ msgid "E284: Cannot set IC values" msgstr "E284: Ne eblas agordi valorojn de IC" msgid "E285: Failed to create input context" -msgstr "E285: Ne eblis krei enigan kuntekston" +msgstr "E285: Kreado de eniga kunteksto malsukcesis" msgid "E286: Failed to open input method" -msgstr "E286: Ne eblis malfermi enigan metodon" +msgstr "E286: Malfermo de eniga metodo malsukcesis" msgid "E287: Warning: Could not set destroy callback to IM" msgstr "E287: Averto: Ne eblis agordi detruan reagfunkcion al IM" @@ -3689,7 +3721,7 @@ msgid "File preserved" msgstr "Dosiero konservita" msgid "E314: Preserve failed" -msgstr "E314: Konservo fiaskis" +msgstr "E314: Konservo malsukcesis" #, c-format msgid "E315: ml_get: invalid lnum: %ld" @@ -3967,7 +3999,7 @@ msgid "E766: Insufficient arguments for printf()" msgstr "E766: Ne sufiĉaj argumentoj por printf()" msgid "E807: Expected Float argument for printf()" -msgstr "E807: Atendis Glitpunktnombron kiel argumento de printf()" +msgstr "E807: Atendis Glitpunktnombron kiel argumenton de printf()" msgid "E767: Too many arguments to printf()" msgstr "E767: Tro da argumentoj al printf()" @@ -4052,15 +4084,6 @@ msgstr "E548: cifero atendata" msgid "E549: Illegal percentage" msgstr "E549: Nevalida procento" -msgid "Enter encryption key: " -msgstr "Tajpu la ŝlosilon de ĉifrado: " - -msgid "Enter same key again: " -msgstr "Tajpu la ŝlosilon denove: " - -msgid "Keys don't match!" -msgstr "Ŝlosiloj ne kongruas!" - msgid "E854: path too long for completion" msgstr "E854: tro longa vojo por kompletigo" @@ -4232,6 +4255,12 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Nekonata tipo de reĝistro %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: serĉa ŝablono kaj esprima reĝistro ne povas enhavi du aŭ pliajn liniojn" + #, c-format msgid "%ld Cols; " msgstr "%ld Kolumnoj; " @@ -4368,7 +4397,7 @@ msgid "E541: too many items" msgstr "E541: tro da elementoj" msgid "E542: unbalanced groups" -msgstr "E542: misekvilibritaj grupoj" +msgstr "E542: misekvilibraj grupoj" msgid "E590: A preview window already exists" msgstr "E590: Antaŭvida fenestro jam ekzistas" @@ -4486,10 +4515,10 @@ msgid "Message" msgstr "Mesaĝo" msgid "'columns' is not 80, cannot execute external commands" -msgstr "'columns' ne estas 80, ne eblas plenumi eksternajn komandojn" +msgstr "'columns' ne estas 80, ne eblas plenumi eksterajn komandojn" msgid "E237: Printer selection failed" -msgstr "E237: Elekto de presilo fiaskis" +msgstr "E237: Elekto de presilo malsukcesis" #, c-format msgid "to %s on %s" @@ -4527,7 +4556,7 @@ msgstr "" "Vim: Alvenis X eraro\n" msgid "Testing the X display failed" -msgstr "Testo de la vidigo X fiaskis" +msgstr "Testo de la vidigo X malsukcesis" msgid "Opening the X display timed out" msgstr "Tempolimo okazis dum malfermo de vidigo X" @@ -4546,6 +4575,19 @@ msgstr "" "\n" "Ne povis ŝalti kuntekston de sekureco por " +msgid "Could not set security context " +msgstr "Ne povis akiri kuntekston de sekureco " + +msgid " for " +msgstr " por " + +#. no enough size OR unexpected error +msgid "Could not get security context " +msgstr "Ne povis akiri kuntekston de sekureco " + +msgid ". Removing it!\n" +msgstr ". Ĝi estas foriganta!\n" + msgid "" "\n" "Cannot execute shell " @@ -4596,7 +4638,7 @@ msgid "dlerror = \"%s\"" msgstr "dlerror = \"%s\"" msgid "Opening the X display failed" -msgstr "Malfermo de vidigo X fiaskis" +msgstr "Malfermo de vidigo X malsukcesis" msgid "XSMP handling save-yourself request" msgstr "XSMP: traktado de peto konservi-mem" @@ -4605,11 +4647,11 @@ msgid "XSMP opening connection" msgstr "XSMP: malfermo de konekto" msgid "XSMP ICE connection watch failed" -msgstr "XSMP: kontrolo de konekto ICE fiaskis" +msgstr "XSMP: kontrolo de konekto ICE malsukcesis" #, c-format msgid "XSMP SmcOpenConnection failed: %s" -msgstr "XSMP: SmcOpenConnection fiaskis: %s" +msgstr "XSMP: SmcOpenConnection malsukcesis: %s" msgid "At line" msgstr "Ĉe linio" @@ -4816,6 +4858,10 @@ msgstr "E554: Sintaksa eraro en %s{...}" msgid "External submatches:\n" msgstr "Eksteraj subkongruoj:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA-regulesprimo) ne eblas ripeti %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " @@ -4823,6 +4869,9 @@ msgstr "" "E864: \\%#= povas nur esti sekvita de 0, 1, aŭ 2. La aŭtomata motoro de " "regulesprimo estos uzata " +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Ŝangota al malavanca motoro de regulesprimo por ŝablono: " + msgid "E865: (NFA) Regexp end encountered prematurely" msgstr "E865: (NFA) Trovis finon de regulesprimo tro frue" @@ -5547,7 +5596,7 @@ msgstr "E412: Ne sufiĉaj argumentoj: \":highlight link %s\"" #, c-format msgid "E413: Too many arguments: \":highlight link %s\"" -msgstr "E413: Tro argumentoj: \":highlight link %s\"" +msgstr "E413: Tro da argumentoj: \":highlight link %s\"" msgid "E414: group has settings, highlight link ignored" msgstr "E414: grupo havas agordojn, ligilo de emfazo ignorita" @@ -5788,7 +5837,7 @@ msgstr "E832: Ne ĉifrata dosiero havas ĉifratan malfaran dosieron: %s" #, c-format msgid "E826: Undo file decryption failed: %s" -msgstr "E826: Malĉifrado de malfara dosiero fiaskis: %s" +msgstr "E826: Malĉifrado de malfara dosiero malsukcesis: %s" #, c-format msgid "E827: Undo file is encrypted: %s" @@ -6228,6 +6277,9 @@ msgstr "E446: Neniu dosiernomo sub la kursoro" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Ne eblas trovi dosieron \"%s\" en serĉvojo" +msgid "List or number required" +msgstr "Listo aŭ nombro bezonata" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: Ne eblis ŝargi bibliotekon %s" @@ -6314,7 +6366,7 @@ msgid "E13: File exists (add ! to override)" msgstr "E13: Dosiero ekzistas (aldonu ! por transpasi)" msgid "E472: Command failed" -msgstr "E472: La komando fiaskis" +msgstr "E472: La komando malsukcesis" #, c-format msgid "E234: Unknown fontset: %s" @@ -6360,7 +6412,7 @@ msgstr "E17: \"%s\" estas dosierujo" #, c-format msgid "E364: Library call failed for \"%s()\"" -msgstr "E364: Alvoko al biblioteko fiaskis por \"%s()\"" +msgstr "E364: Alvoko al biblioteko malsukcesis por \"%s()\"" #, c-format msgid "E448: Could not load library function %s" @@ -6630,7 +6682,7 @@ msgstr "listo estas ŝlosita" #, c-format msgid "failed to add key '%s' to dictionary" -msgstr "aldono de ŝlosilo '%s' al vortaro fiaskis" +msgstr "aldono de ŝlosilo '%s' al vortaro malsukcesis" #, c-format msgid "index must be int or slice, not %s" @@ -6676,7 +6728,7 @@ msgid "E264: Python: Error initialising I/O objects" msgstr "E264: Pitono: Eraro de pravalorizo de eneligaj objektoj" msgid "failed to change directory" -msgstr "ne povis ŝanĝi dosierujon" +msgstr "malsukcesis ŝanĝi dosierujon" #, c-format msgid "expected 3-tuple as imp.find_module() result, but got %s" @@ -6715,7 +6767,7 @@ msgstr "indekso de listo ekster limoj" #. No more suitable format specifications in python-2.3 #, c-format msgid "internal error: failed to get vim list item %d" -msgstr "interna eraro: obteno de vim-a listero %d fiaskis" +msgstr "interna eraro: obteno de vim-a listero %d malsukcesis" msgid "slice step cannot be zero" msgstr "paŝo de sekco ne povas esti nul" @@ -6732,14 +6784,14 @@ msgid "internal error: not enough list items" msgstr "interna eraro: ne sufiĉaj listeroj" msgid "internal error: failed to add item to list" -msgstr "interna eraro: aldono de listero fiaskis" +msgstr "interna eraro: aldono de listero malsukcesis" #, c-format msgid "attempt to assign sequence of size %d to extended slice of size %d" msgstr "provis valorizi sekvencon kun %d eroj al etendita sekco kun %d eroj" msgid "failed to add item to list" -msgstr "aldono de listero fiaskis" +msgstr "aldono de listero malsukcesis" msgid "cannot delete vim.List attributes" msgstr "ne eblas forviŝi atributojn de 'vim.List'" @@ -6760,10 +6812,10 @@ msgstr "konstruilo de funkcio ne akceptas ŝlosilvortajn argumentojn" #, c-format msgid "failed to run function %s" -msgstr "fiaskis ruli funkcion %s" +msgstr "malsukcesis ruli funkcion %s" msgid "unable to get option value" -msgstr "fiaskis akiri valoron de opcio" +msgstr "malsukcesis akiri valoron de opcio" msgid "internal error: unknown option type" msgstr "interna eraro: nekonata tipo de opcio" @@ -6801,7 +6853,7 @@ msgid "attempt to refer to deleted buffer" msgstr "provo de referenco al forviŝita bufro" msgid "failed to rename buffer" -msgstr "ne povis renomi bufron" +msgstr "malsukcesis renomi bufron" msgid "mark name must be a single character" msgstr "nomo de marko devas esti unuopa signo" @@ -6812,14 +6864,14 @@ msgstr "atendis objekton vim.Buffer, sed ricevis %s" #, c-format msgid "failed to switch to buffer %d" -msgstr "ne povis salti al la bufro %d" +msgstr "salto al la bufro %d malsukcesis" #, c-format msgid "expected vim.Window object, but got %s" msgstr "atendis objekton vim.window, sed ricevis %s" msgid "failed to find window in the current tab page" -msgstr "ne povis trovi vindozon en la nuna langeto" +msgstr "malsukcesis trovi vindozon en la nuna langeto" msgid "did not switch to the specified window" msgstr "ne saltis al la specifita vindozo" @@ -6832,13 +6884,13 @@ msgid "did not switch to the specified tab page" msgstr "ne saltis al la specifita langeto" msgid "failed to run the code" -msgstr "fiaskis ruli la kodon" +msgstr "malsukcesis ruli la kodon" msgid "E858: Eval did not return a valid python object" msgstr "E858: Eval ne revenis kun valida python-objekto" msgid "E859: Failed to convert returned python object to vim value" -msgstr "E859: Konverto de revena python-objekto al vim-valoro fiaskis" +msgstr "E859: Konverto de revena python-objekto al vim-valoro malsukcesis" #, c-format msgid "unable to convert %s to vim dictionary" @@ -6860,7 +6912,7 @@ msgid "" "- append vim.path_hook to sys.path_hooks\n" "- append vim.VIM_SPECIAL_PATH to sys.path\n" msgstr "" -"Fiaskis valorizi sys.path_hooks: sys.path_hooks ne estas listo\n" +"Valorizo de sys.path_hooks malsukcesis: sys.path_hooks ne estas listo\n" "Vi nun devas fari tion:\n" "- postaldoni vim.path_hook al sys.path_hooks\n" "- postaldoni vim.VIM_SPECIAL_PATH al sys.path\n" @@ -6869,5 +6921,8 @@ msgid "" "Failed to set path: sys.path is not a list\n" "You should now append vim.VIM_SPECIAL_PATH to sys.path" msgstr "" -"Ne povis agordi serĉvojon: sys.path ne estas listo\n" +"Agordo de serĉvojo malsukcesis: sys.path ne estas listo\n" "Vi nun devas aldoni vim.VIM_SPECIAL_PATH al sys.path" + +#~ msgid "[blowfish]" +#~ msgstr "[blowfish]" diff --git a/src/po/fr.po b/src/po/fr.po index fe466b301f..0ae8327cf7 100644 --- a/src/po/fr.po +++ b/src/po/fr.po @@ -6,7 +6,7 @@ # FIRST AUTHOR DindinX 2000. # SECOND AUTHOR Adrien Beau 2002, 2003. # THIRD AUTHOR David Blanchet 2006, 2008. -# FOURTH AUTHOR Dominique Pell 2008, 2013. +# FOURTH AUTHOR Dominique Pell 2008, 2014. # # Latest translation available at: # http://dominique.pelle.free.fr/vim-fr.php @@ -15,8 +15,8 @@ msgid "" msgstr "" "Project-Id-Version: Vim(Franais)\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-05-27 04:55+0200\n" -"PO-Revision-Date: 2013-05-27 10:22+0200\n" +"POT-Creation-Date: 2014-11-05 21:12+0100\n" +"PO-Revision-Date: 2014-11-05 21:23+0100\n" "Last-Translator: Dominique Pell \n" "Language-Team: \n" "Language: fr\n" @@ -90,6 +90,9 @@ msgstr "1 tampon a msgid "%d buffers wiped out" msgstr "%d tampons ont t dtruits" +msgid "E90: Cannot unload last buffer" +msgstr "E90: Impossible de dcharger le dernier tampon" + # AB - La version franaise est meilleure que la version anglaise. msgid "E84: No modified buffer found" msgstr "E84: Aucun tampon n'est modifi" @@ -115,9 +118,6 @@ msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "" "E89: Le tampon %ld n'a pas t enregistr (ajoutez ! pour passer outre)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: Impossible de dcharger le dernier tampon" - msgid "W14: Warning: List of file names overflow" msgstr "W14: Alerte : La liste des noms de fichier dborde" @@ -156,6 +156,9 @@ msgstr "[Nouveau fichier]" msgid "[Read errors]" msgstr "[Erreurs de lecture]" +msgid "[RO]" +msgstr "[RO]" + # AB - La version courte, "[RO]", devrait-elle tre traduite par "[LS]" ? # Il faudrait faire un sondage auprs des utilisateurs francophones. msgid "[readonly]" @@ -230,6 +233,21 @@ msgstr "Symboles dans %s :" msgid " line=%ld id=%d name=%s" msgstr " ligne=%ld id=%d nom=%s" +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Le fichier est chiffr avec une mthode inconnue" + +msgid "Enter encryption key: " +msgstr "Tapez la cl de chiffrement : " + +msgid "Enter same key again: " +msgstr "Tapez la cl nouveau : " + +msgid "Keys don't match!" +msgstr "Les cls ne correspondent pas !" + +msgid "[crypted]" +msgstr "[chiffr]" + # AB - Je n'ai pas trouv de traduction satisfaisante au verbe "diff". Comme # Vim fait en pratique appel au programme "diff" pour evaluer les # diffrences entre fichiers, "to diff" a t traduit par "utiliser diff" @@ -491,6 +509,9 @@ msgstr "E130: Fonction inconnue : %s" msgid "E461: Illegal variable name: %s" msgstr "E461: Nom de variable invalide : %s" +msgid "E806: using Float as a String" +msgstr "E806: Utilisation d'un Flottant comme une Chane" + # DB - todo : trouver mieux que "destinations". msgid "E687: Less targets than List items" msgstr "E687: Moins de destinations que d'lments dans la Liste" @@ -662,13 +683,13 @@ msgstr "E785: complete() n'est utilisable que dans le mode Insertion" msgid "&Ok" msgstr "&Ok" -msgid "extend() argument" -msgstr "argument de extend()" - #, c-format msgid "E737: Key already exists: %s" msgstr "E737: un mappage existe dj pour %s" +msgid "extend() argument" +msgstr "argument de extend()" + msgid "map() argument" msgstr "argument de map()" @@ -742,9 +763,15 @@ msgstr "E258: La r msgid "sort() argument" msgstr "argument de sort()" +msgid "uniq() argument" +msgstr "argument de uniq()" + msgid "E702: Sort compare function failed" msgstr "E702: La fonction de comparaison de sort() a chou" +msgid "E882: Uniq compare function failed" +msgstr "E882: La fonction de comparaison de uniq() a chou" + msgid "(Invalid)" msgstr "(Invalide)" @@ -772,9 +799,6 @@ msgstr "E730: Utilisation d'une Liste comme une Cha msgid "E731: using Dictionary as a String" msgstr "E731: Utilisation d'un Dictionnaire comme une Chane" -msgid "E806: using Float as a String" -msgstr "E806: Utilisation d'un Flottant comme une Chane" - # DB : On doit pouvoir trouver nettement mieux que a. #, c-format msgid "E706: Variable type mismatch for: %s" @@ -848,8 +872,15 @@ msgid "E129: Function name required" msgstr "E129: Nom de fonction requis" #, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" -msgstr "E128: La fonction %s ne commence pas par une majuscule ou contient ':'" +msgid "E128: Function name must start with a capital or \"s:\": %s" +msgstr "" +"E128: Le nom de la fonction doit commencer par une majuscule ou \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "" +"E884: Le nom de la fonction ne peut pas contenir le caractre deux-points : " +"%s" # AB - Il est difficile de crer une version franaise qui fasse moins de 80 # caractres de long, nom de la fonction compris : "It is in use" est une @@ -1013,6 +1044,10 @@ msgstr "E138: Impossible d' msgid "Writing viminfo file \"%s\"" msgstr "criture du fichier viminfo \"%s\"" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Impossible de renommer viminfo en %s" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" @@ -1267,6 +1302,10 @@ msgstr "E158: Le tampon %s est introuvable" msgid "E157: Invalid sign ID: %ld" msgstr "E157: Le symbole %ld est introuvable" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Impossible de changer le symbole %s" + msgid " (NOT FOUND)" msgstr " (INTROUVABLE)" @@ -1856,9 +1895,6 @@ msgstr "[socket]" msgid "[character special]" msgstr "[caractre spcial]" -msgid "[RO]" -msgstr "[RO]" - msgid "[CR missing]" msgstr "[CR manquant]" @@ -1871,12 +1907,6 @@ msgstr "[NON converti]" msgid "[converted]" msgstr "[converti]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[chiffr]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ERREUR DE CONVERSION la ligne %ld]" @@ -1898,9 +1928,6 @@ msgstr "La conversion avec 'charconvert' a msgid "can't read output of 'charconvert'" msgstr "Impossible de lire la sortie de 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: Le fichier est chiffr avec une mthode inconnue" - msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Pas d'autocommande correspondante pour le tampon acwrite" @@ -2490,32 +2517,28 @@ msgid "Font '%s' is not fixed-width" msgstr "La police '%s' n'a pas une largeur fixe" #, c-format -msgid "E253: Fontset name: %s\n" -msgstr "E253: Nom du jeu de polices : %s\n" +msgid "E253: Fontset name: %s" +msgstr "E253: Nom du jeu de polices : %s" #, c-format -msgid "Font0: %s\n" -msgstr "Font0: %s\n" +msgid "Font0: %s" +msgstr "Font0: %s" #, c-format -msgid "Font1: %s\n" -msgstr "Font1: %s\n" +msgid "Font1: %s" +msgstr "Font1: %s" #, c-format -msgid "Font%ld width is not twice that of font0\n" -msgstr "La largeur de Font%ld n'est pas le double de celle de Font0\n" +msgid "Font%ld width is not twice that of font0" +msgstr "La largeur de Font%ld n'est pas le double de celle de Font0" #, c-format -msgid "Font0 width: %ld\n" -msgstr "Largeur de Font0 : %ld\n" +msgid "Font0 width: %ld" +msgstr "Largeur de Font0 : %ld" #, c-format -msgid "" -"Font1 width: %ld\n" -"\n" -msgstr "" -"Largeur de Font1 : %ld\n" -"\n" +msgid "Font1 width: %ld" +msgstr "Largeur de Font1 : %ld" # DB - todo : Pas certain de mon coup, ici... msgid "Invalid font specification" @@ -2709,6 +2732,9 @@ msgstr "E566: Impossible de cr msgid "E622: Could not fork for cscope" msgstr "E622: Impossible de forker pour cscope" +msgid "cs_create_connection setpgid failed" +msgstr "cs_create_connection setpgid a chou" + msgid "cs_create_connection exec failed" msgstr "exec de cs_create_connection a chou" @@ -2879,9 +2905,6 @@ msgstr "non autoris msgid "E836: This Vim cannot execute :python after using :py3" msgstr "E836: Vim ne peut pas excuter :python aprs avoir utilis :py3" -msgid "only string keys are allowed" -msgstr "seule une chaine est autorise comme cl" - msgid "" "E263: Sorry, this command is disabled, the Python library could not be " "loaded." @@ -2889,15 +2912,19 @@ msgstr "" "E263: Dsol, commande dsactive : la bibliothque Python n'a pas pu tre " "charge." +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Dsol, commande dsactive : la bibliothque Python n'a pas pu tre " +"charge." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Impossible d'invoquer Python rcursivement" msgid "E837: This Vim cannot execute :py3 after using :python" msgstr "E837: Vim ne peut pas excuter :py3 aprs avoir utilis :python" -msgid "index must be int or slice" -msgstr "index doit tre int ou slice" - msgid "E265: $_ must be an instance of String" msgstr "E265: $_ doit tre une instance de chane (String)" @@ -4249,13 +4276,6 @@ msgstr " (Interrompu)" msgid "Beep!" msgstr "Bip !" -msgid "Vim: preserving files...\n" -msgstr "Vim : prservation des fichiers...\n" - -#. close all memfiles, without deleting -msgid "Vim: Finished.\n" -msgstr "Vim : Fini.\n" - msgid "ERROR: " msgstr "ERREUR : " @@ -4305,15 +4325,6 @@ msgstr "E548: chiffre attendu" msgid "E549: Illegal percentage" msgstr "E549: Pourcentage non autoris" -msgid "Enter encryption key: " -msgstr "Tapez la cl de chiffrement : " - -msgid "Enter same key again: " -msgstr "Tapez la cl nouveau : " - -msgid "Keys don't match!" -msgstr "Les cls ne correspondent pas !" - msgid "E854: path too long for completion" msgstr "E854: chemin trop long pour compltement" @@ -4488,6 +4499,13 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Type de registre %d inconnu" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: le motif de recherche et le registre d'expression ne peuvent pas " +"contenir deux lignes ou plus" + #, c-format msgid "%ld Cols; " msgstr "%ld Colonnes ; " @@ -4777,17 +4795,6 @@ msgstr "E244: Jeu de caract msgid "E245: Illegal char '%c' in font name \"%s\"" msgstr "E245: Caractre '%c' invalide dans le nom de fonte \"%s\"" -msgid "Vim: Double signal, exiting\n" -msgstr "Vim : Double signal, sortie\n" - -#, c-format -msgid "Vim: Caught deadly signal %s\n" -msgstr "Vim : Signal mortel %s intercept\n" - -#, c-format -msgid "Vim: Caught deadly signal\n" -msgstr "Vim : Signal mortel intercept\n" - #, c-format msgid "Opening the X display took %ld msec" msgstr "L'ouverture du display X a pris %ld ms" @@ -4819,6 +4826,19 @@ msgstr "" "\n" "Impossible de modifier le contexte de scurit pour " +msgid "Could not set security context " +msgstr "Impossible d'initialiser le contexte de scurit " + +msgid " for " +msgstr " pour " + +#. no enough size OR unexpected error +msgid "Could not get security context " +msgstr "Impossible d'obtenir le contexte de scurit " + +msgid ". Removing it!\n" +msgstr ". Suppression !\n" + msgid "" "\n" "Cannot execute shell " @@ -5017,6 +5037,20 @@ msgstr "E54: %s( ouvrante non ferm msgid "E55: Unmatched %s)" msgstr "E55: %s) fermante non ouverte" +msgid "E66: \\z( not allowed here" +msgstr "E66: \\z( n'est pas autoris ici" + +msgid "E67: \\z1 et al. not allowed here" +msgstr "E67: \\z1 et co. ne sont pas autoriss ici" + +#, c-format +msgid "E69: Missing ] after %s%%[" +msgstr "E69: ']' manquant aprs %s%%[" + +#, c-format +msgid "E70: Empty %s%%[]" +msgstr "E70: %s%%[] vide" + msgid "E339: Pattern too long" msgstr "E339: Motif trop long" @@ -5056,23 +5090,9 @@ msgstr "E64: %s%c ne suit aucun atome" msgid "E65: Illegal back reference" msgstr "E65: post-rfrence invalide" -msgid "E66: \\z( not allowed here" -msgstr "E66: \\z( n'est pas autoris ici" - -msgid "E67: \\z1 et al. not allowed here" -msgstr "E67: \\z1 et co. ne sont pas autoriss ici" - msgid "E68: Invalid character after \\z" msgstr "E68: Caractre invalide aprs \\z" -#, c-format -msgid "E69: Missing ] after %s%%[" -msgstr "E69: ']' manquant aprs %s%%[" - -#, c-format -msgid "E70: Empty %s%%[]" -msgstr "E70: %s%%[] vide" - #, c-format msgid "E678: Invalid character after %s%%[dxouU]" msgstr "E678: Caractre invalide aprs %s%%[dxouU]" @@ -5088,6 +5108,10 @@ msgstr "E554: Erreur de syntaxe dans %s{...}" msgid "External submatches:\n" msgstr "Sous-correspondances externes :\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (regexp NFA) %s ne peut pas tre rpt" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " @@ -5095,17 +5119,28 @@ msgstr "" "E864: \\%#= peut tre suivi uniquement de 0, 1 ou 2. Le moteur automatique " "sera utilis " -#, c-format -msgid "E866: (NFA regexp) Misplaced %c" -msgstr "E866: (regexp NFA) %c au mauvais endroit" +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Moteur RE avec backtracking utilis pour le motif : " msgid "E865: (NFA) Regexp end encountered prematurely" msgstr "E865: (NFA) Fin de regexp rencontre prmaturment" +#, c-format +msgid "E866: (NFA regexp) Misplaced %c" +msgstr "E866: (regexp NFA) %c au mauvais endroit" + +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (regexp NFA) Classe de caractre invalide : %ld" + #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" msgstr "E867: (NFA) Oprateur inconnu '\\z%c'" +#, c-format +msgid "E867: (NFA) Unknown operator '\\%%%c'" +msgstr "E867: (NFA) Oprateur inconnu '\\%%%c'" + #. should never happen msgid "E868: Error building NFA with equivalence class!" msgstr "E868: Erreur lors de la construction du NFA avec classe d'quivalence" @@ -5117,12 +5152,17 @@ msgstr "E869: (NFA) Op msgid "E870: (NFA regexp) Error reading repetition limits" msgstr "E870: (regexp NFA) Erreur la lecture des limites de rptition" +#. Can't have a multi follow a multi. msgid "E871: (NFA regexp) Can't have a multi follow a multi !" msgstr "E871: (regexp NFA) Un multi ne peut pas suivre un multi !" +#. Too many `(' msgid "E872: (NFA regexp) Too many '('" msgstr "E872: (regexp NFA) Trop de '('" +msgid "E879: (NFA regexp) Too many \\z(" +msgstr "E879: (regexp NFA) Trop de \\z(" + msgid "E873: (NFA regexp) proper termination error" msgstr "E873: (NFA regexp) erreur de terminaison" @@ -5139,18 +5179,9 @@ msgstr "" msgid "E876: (NFA regexp) Not enough space to store the whole NFA " msgstr "E876: (regexp NFA) Pas assez de mmoire pour stocker le NFA" -msgid "E999: (NFA regexp internal error) Should not process NOT node !" +msgid "E878: (NFA) Could not allocate memory for branch traversal!" msgstr "" -"E999: (erreur interne du regexp NFA) Un noeud 'NOT' ne devrait pas tre " -"trait !" - -#. should not be here :P -msgid "E877: (NFA regexp) Invalid character class " -msgstr "E877: (regexp NFA) Classe de caractre invalide " - -#, c-format -msgid "(NFA) COULD NOT OPEN %s !" -msgstr "(NFA) IMPOSSIBLE D'OUVRIR %s !" +"E878: (NFA) Impossible d'allouer la mmoire pour parcourir les branches !" msgid "" "Could not open temporary log file for writing, displaying on stderr ... " @@ -5158,9 +5189,9 @@ msgstr "" "Impossible d'ouvrir le fichier de log temporaire en criture, affichage sur " "stderr ... " -msgid "E878: (NFA) Could not allocate memory for branch traversal!" -msgstr "" -"E878: (NFA) Impossible d'allouer la mmoire pour parcourir les branches!" +#, c-format +msgid "(NFA) COULD NOT OPEN %s !" +msgstr "(NFA) IMPOSSIBLE D'OUVRIR %s !" msgid "Could not open temporary log file for writing " msgstr "Impossible d'ouvrir le fichier de log en criture" @@ -5607,12 +5638,12 @@ msgid "E765: 'spellfile' does not have %ld entries" msgstr "E765: 'spellfile' n'a pas %ld entres" #, c-format -msgid "Word removed from %s" -msgstr "Mot retir de %s" +msgid "Word '%.*s' removed from %s" +msgstr "Mot '%.*s' retir de %s" #, c-format -msgid "Word added to %s" -msgstr "Mot ajout dans %s" +msgid "Word '%.*s' added to %s" +msgstr "Mot '%.*s' ajout dans %s" msgid "E763: Word characters differ between spell files" msgstr "" @@ -5668,6 +5699,9 @@ msgstr "E782: Erreur lors de la lecture de fichier de suggestions : %s" msgid "E783: duplicate char in MAP entry" msgstr "E783: caractres dupliqu dans l'entre MAP" +msgid "No Syntax items defined for this buffer" +msgstr "Aucun lment de syntaxe dfini pour ce tampon" + #, c-format msgid "E390: Illegal argument: %s" msgstr "E390: Argument invalide : %s" @@ -5676,9 +5710,6 @@ msgstr "E390: Argument invalide : %s" msgid "E391: No such syntax cluster: %s" msgstr "E391: Aucune grappe de syntaxe %s" -msgid "No Syntax items defined for this buffer" -msgstr "Aucun lment de syntaxe dfini pour ce tampon" - msgid "syncing on C-style comments" msgstr "synchronisation sur les commentaires de type C" @@ -5808,6 +5839,11 @@ msgstr "E409: Nom de groupe inconnu : %s" msgid "E410: Invalid :syntax subcommand: %s" msgstr "E410: Sous-commande de :syntax invalide : %s" +msgid "" +" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN" +msgstr "" +" TOTAL NOMBRE MATCH PLUS LENT MOYEN NOM MOTIF" + msgid "E679: recursive loop loading syncolor.vim" msgstr "E679: boucle rcursive lors du chargement de syncolor.vim" @@ -6005,8 +6041,8 @@ msgstr "CUT_BUFFER0 utilis #. This happens when the FileChangedRO autocommand changes the #. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: Le nombre de lignes a t chang inopinment" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Le nombre de lignes a t chang inopinment" # DB - Question O/N. #. must display the prompt @@ -6501,6 +6537,9 @@ msgstr "E446: Aucun nom de fichier sous le curseur" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Le fichier \"%s\" est introuvable dans 'path'" +msgid "List or number required" +msgstr "Liste ou nombre requis" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: Impossible de charger la bibliothque %s" @@ -6737,6 +6776,9 @@ msgstr "E485: Impossible de lire le fichier %s" msgid "E37: No write since last change (add ! to override)" msgstr "E37: Modifications non enregistres (ajoutez ! pour passer outre)" +msgid "E37: No write since last change" +msgstr "E37: Modifications non enregistres" + msgid "E38: Null argument" msgstr "E38: Argument null" @@ -6897,153 +6939,216 @@ msgstr "La recherche a atteint le BAS, et continue en HAUT" msgid "Need encryption key for \"%s\"" msgstr "Besoin de la cl de chiffrement pour \"%s\"" -msgid "can't delete OutputObject attributes" -msgstr "impossible d'effacer les attributs d'OutputObject" - -msgid "softspace must be an integer" -msgstr "softspace doit tre un nombre entier" - -msgid "invalid attribute" -msgstr "attribut invalide" - -msgid "writelines() requires list of strings" -msgstr "writelines() requiert une liste de chanes" - -msgid "E264: Python: Error initialising I/O objects" -msgstr "E264: Python : Erreur d'initialisation des objets d'E/S" - msgid "empty keys are not allowed" msgstr "les cls vides ne sont pas autorises" -msgid "Cannot delete DictionaryObject attributes" -msgstr "Impossible d'effacer les attributs de DictionaryObject" - -msgid "Cannot modify fixed dictionary" -msgstr "Impossible de modifier un dictionnaire fixe" - -msgid "Cannot set this attribute" -msgstr "Impossible d'initialiser cet attribut" - -msgid "dict is locked" +msgid "dictionary is locked" msgstr "dictionnaire est verrouill" -msgid "failed to add key to dictionary" -msgstr "l'ajout de cl au dictionnaire a chou" - -msgid "list index out of range" -msgstr "index de liste hors limites" - -msgid "internal error: failed to get vim list item" -msgstr "erreur interne : accs un lment de liste a chou" - msgid "list is locked" msgstr "liste verrouille" -msgid "Failed to add item to list" -msgstr "Ajout la liste a chou" +#, c-format +msgid "failed to add key '%s' to dictionary" +msgstr "l'ajout de cl '%s' au dictionnaire a chou" -msgid "internal error: no vim list item" -msgstr "erreur interne : pas d'lment de liste vim" +#, c-format +msgid "index must be int or slice, not %s" +msgstr "index doit tre int ou slice, et non %s" -msgid "can only assign lists to slice" -msgstr "seules des tranches peuvent tre assignes aux listes" +#, c-format +msgid "expected str() or unicode() instance, but got %s" +msgstr "attendu instance de str() ou unicode(), mais reu %s" + +#, c-format +msgid "expected bytes() or str() instance, but got %s" +msgstr "attendu instance de bytes() ou str(), mais reu %s" + +#, c-format +msgid "" +"expected int(), long() or something supporting coercing to long(), but got %s" +msgstr "" +"attendu int(), long() ou quelque chose qui peut tre transform en long(), " +"mais reu %s" + +#, c-format +msgid "expected int() or something supporting coercing to int(), but got %s" +msgstr "" +"attendu int() ou quelque chose qui peut tre transform en int(), mais reu " +"%s" + +msgid "value is too large to fit into C int type" +msgstr "valeur trop grande pour tre stocke dans le type C int" + +msgid "value is too small to fit into C int type" +msgstr "valeur trop petite pour tre stocke dans le type C int" + +msgid "number must be greater than zero" +msgstr "le nombre doit tre plus grand que zro" + +msgid "number must be greater or equal to zero" +msgstr "le nombre doit tre plus grand ou gal zro" + +msgid "can't delete OutputObject attributes" +msgstr "impossible d'effacer les attributs d'OutputObject" + +#, c-format +msgid "invalid attribute: %s" +msgstr "attribut invalide : %s" + +msgid "E264: Python: Error initialising I/O objects" +msgstr "E264: Python : Erreur d'initialisation des objets d'E/S" + +msgid "failed to change directory" +msgstr "changement de rpertoire a chou" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got %s" +msgstr "attendu un 3-tuple comme rsultat de imp.find_module(), mais reu %s" + +#, c-format +msgid "expected 3-tuple as imp.find_module() result, but got tuple of size %d" +msgstr "" +"attendu un 3-tuple comme rsultat de imp.find_module(), mais reu un tuple " +"de taille %d" + +msgid "internal error: imp.find_module returned tuple with NULL" +msgstr "erreur interne : imp.find_module a retourn un tuple contenant NULL" + +msgid "cannot delete vim.Dictionary attributes" +msgstr "impossible d'effacer les attributs de vim.Dictionary" + +msgid "cannot modify fixed dictionary" +msgstr "impossible de modifier un dictionnaire fixe" + +#, c-format +msgid "cannot set attribute %s" +msgstr "impossible d'initialiser l'attribut %s" + +msgid "hashtab changed during iteration" +msgstr "la table de hachage a t change pendant une itration" + +#, c-format +msgid "expected sequence element of size 2, but got sequence of size %d" +msgstr "" +"attendu une squence d'lments de taille 2, mais reu une squence de " +"taille %d" + +msgid "list constructor does not accept keyword arguments" +msgstr "le constructeur de liste n'accepte pas les arguments nomms" + +msgid "list index out of range" +msgstr "index de liste hors limites" + +#. No more suitable format specifications in python-2.3 +#, c-format +msgid "internal error: failed to get vim list item %d" +msgstr "erreur interne : accs un lment %d de liste a chou" + +msgid "slice step cannot be zero" +msgstr "le pas du dcoupage en tranche ne peut pas tre zro" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "" +"tentative d'assigner une squence de taille plus grande que %d un " +"dcoupage en tranche tendu " + +#, c-format +msgid "internal error: no vim list item %d" +msgstr "erreur interne : pas d'lment %d de liste vim" + +msgid "internal error: not enough list items" +msgstr "erreur interne : pas assez d'lments de liste" msgid "internal error: failed to add item to list" msgstr "erreur interne : ajout d'lment la liste a chou" -msgid "can only concatenate with lists" -msgstr "on ne peut que concatner avec des listes" +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +"tentative d'assigner une squence de taille %d un dcoupage en tranche " +"tendu de taille %d" -msgid "cannot delete vim.dictionary attributes" -msgstr "impossible d'effacer les attributs de vim.dictionary" +msgid "failed to add item to list" +msgstr "ajout la liste a chou" + +msgid "cannot delete vim.List attributes" +msgstr "impossible d'effacer les attributs de vim.List" msgid "cannot modify fixed list" msgstr "impossible de modifier une liste fixe" -msgid "cannot set this attribute" -msgstr "impossible d'initialiser cet attribut" +#, c-format +msgid "unnamed function %s does not exist" +msgstr "la fonction sans nom %s n'existe pas" -msgid "'self' argument must be a dictionary" -msgstr "l'argument 'self' doit tre un dictionnaire" +#, c-format +msgid "function %s does not exist" +msgstr "la fonction %s n'existe pas" -msgid "failed to run function" -msgstr "excution de la fonction a chou" +msgid "function constructor does not accept keyword arguments" +msgstr "le constructeur de fonction n'accepte pas les arguments nomms" + +#, c-format +msgid "failed to run function %s" +msgstr "excution de la fonction %s a chou" msgid "unable to get option value" msgstr "impossible d'obtenir la valeur d'une option" -msgid "unable to unset global option" -msgstr "impossible de dsactiver une option globale" +msgid "internal error: unknown option type" +msgstr "erreur interne : type d'option inconnu" -msgid "unable to unset option without global value" -msgstr "impossible de dsactiver une option sans une valeur globale" +msgid "problem while switching windows" +msgstr "problme lors du changement de fentres" -msgid "object must be integer" -msgstr "objet doit tre un nombre entier" +#, c-format +msgid "unable to unset global option %s" +msgstr "impossible de dsactiver une option globale %s" -msgid "object must be string" -msgstr "objet doit tre de type string" +#, c-format +msgid "unable to unset option %s which does not have global value" +msgstr "impossible de dsactiver l'option %s qui n'a pas de valeur globale" msgid "attempt to refer to deleted tab page" msgstr "tentative de rfrencer un onglet effac" -#, c-format -msgid "" -msgstr "" - -#, c-format -msgid "" -msgstr "" - -#, c-format -msgid "" -msgstr "" - msgid "no such tab page" msgstr "cet onglet n'existe pas" msgid "attempt to refer to deleted window" msgstr "tentative de rfrencer une fentre efface" -msgid "readonly attribute" -msgstr "attribut en lecture seule" +msgid "readonly attribute: buffer" +msgstr "attribut en lecture seule : tampon" msgid "cursor position outside buffer" msgstr "curseur positionn en dehors du tampon" -#, c-format -msgid "" -msgstr "" - -#, c-format -msgid "" -msgstr "" - -#, c-format -msgid "" -msgstr "" - msgid "no such window" msgstr "Cette fentre n'existe pas" msgid "attempt to refer to deleted buffer" msgstr "tentative de rfrencer un tampon effac" +msgid "failed to rename buffer" +msgstr "impossible de renommer le tampon" + +msgid "mark name must be a single character" +msgstr "le nom de marque doit tre un seul caractre" + #, c-format -msgid "" -msgstr "" +msgid "expected vim.Buffer object, but got %s" +msgstr "attendu un objet objet vim.Buffer, mais reu %s" -msgid "key must be integer" -msgstr "la cl doit tre un nombre entier" +#, c-format +msgid "failed to switch to buffer %d" +msgstr "impossible de se dplacer au tampon %d" -msgid "expected vim.buffer object" -msgstr "objet vim.buffer attendu" - -msgid "failed to switch to given buffer" -msgstr "impossible de se dplacer au tampon donn" - -msgid "expected vim.window object" -msgstr "objet vim.window attendu" +#, c-format +msgid "expected vim.Window object, but got %s" +msgstr "attendu un objet vim.Window, mais reu %s" msgid "failed to find window in the current tab page" msgstr "impossible de trouver une fentre dans l'onglet courant" @@ -7051,8 +7156,9 @@ msgstr "impossible de trouver une fen msgid "did not switch to the specified window" msgstr "ne s'est pas dplac la fentre spcifie" -msgid "expected vim.tabpage object" -msgstr "objet vim.tabpage attendu" +#, c-format +msgid "expected vim.TabPage object, but got %s" +msgstr "attendu un objet vim.TabPage, mais reu %s" msgid "did not switch to the specified tab page" msgstr "impossible de se dplacer l'onglet spcifi" @@ -7066,15 +7172,115 @@ msgstr "E858: Eval n'a pas retourn msgid "E859: Failed to convert returned python object to vim value" msgstr "E859: Conversion d'objet python une valeur de vim a chou" -msgid "unable to convert to vim structure" -msgstr "conversion une structure vim impossible" +#, c-format +msgid "unable to convert %s to vim dictionary" +msgstr "impossible de convertir %s un dictionnaire vim" -msgid "NULL reference passed" -msgstr "rfrence NULL passe" +#, c-format +msgid "unable to convert %s to vim structure" +msgstr "impossible de convertir %s une structure de vim" + +msgid "internal error: NULL reference passed" +msgstr "erreur interne : rfrence NULL passe" msgid "internal error: invalid value type" msgstr "erreur interne : type de valeur invalide" +msgid "" +"Failed to set path hook: sys.path_hooks is not a list\n" +"You should now do the following:\n" +"- append vim.path_hook to sys.path_hooks\n" +"- append vim.VIM_SPECIAL_PATH to sys.path\n" +msgstr "" +"Impossible d'initialiser sys.path_hook qui n'est pas un liste\n" +"Vous devez maintenant :\n" +"- ajouter vim.path_hook sys.path_hooks\n" +"- ajouter vim.VIM_SPECIAL_PATH sys.path\n" + +msgid "" +"Failed to set path: sys.path is not a list\n" +"You should now append vim.VIM_SPECIAL_PATH to sys.path" +msgstr "" +"Impossible d'initialiser le chemin : sys.math n'est pas une liste\n" +"Vous devez maintenant ajouter vim.VIM_SPECIAL_PATH sys.path" + +#~ msgid "[blowfish]" +#~ msgstr "[blowfish]" + +#~ msgid "only string keys are allowed" +#~ msgstr "seule une chaine est autorise comme cl" + +#~ msgid "Vim: preserving files...\n" +#~ msgstr "Vim : prservation des fichiers...\n" + +#~ msgid "Vim: Finished.\n" +#~ msgstr "Vim : Fini.\n" + +#~ msgid "Vim: Double signal, exiting\n" +#~ msgstr "Vim : Double signal, sortie\n" + +#~ msgid "Vim: Caught deadly signal %s\n" +#~ msgstr "Vim : Signal mortel %s intercept\n" + +#~ msgid "Vim: Caught deadly signal\n" +#~ msgstr "Vim : Signal mortel intercept\n" + +#~ msgid "E999: (NFA regexp internal error) Should not process NOT node !" +#~ msgstr "" +#~ "E999: (erreur interne du regexp NFA) Un noeud 'NOT' ne devrait pas tre " +#~ "trait !" + +#~ msgid "softspace must be an integer" +#~ msgstr "softspace doit tre un nombre entier" + +#~ msgid "writelines() requires list of strings" +#~ msgstr "writelines() requiert une liste de chanes" + +#~ msgid "Cannot delete DictionaryObject attributes" +#~ msgstr "Impossible d'effacer les attributs de DictionaryObject" + +#~ msgid "Cannot set this attribute" +#~ msgstr "Impossible d'initialiser cet attribut" + +#~ msgid "can only assign lists to slice" +#~ msgstr "seules des tranches peuvent tre assignes aux listes" + +#~ msgid "can only concatenate with lists" +#~ msgstr "on ne peut que concatner avec des listes" + +#~ msgid "'self' argument must be a dictionary" +#~ msgstr "l'argument 'self' doit tre un dictionnaire" + +#~ msgid "object must be integer" +#~ msgstr "objet doit tre un nombre entier" + +#~ msgid "object must be string" +#~ msgstr "objet doit tre de type string" + +#~ msgid "" +#~ msgstr "" + +#~ msgid "" +#~ msgstr "" + +#~ msgid "" +#~ msgstr "" + +#~ msgid "" +#~ msgstr "" + +#~ msgid "" +#~ msgstr "" + +#~ msgid "" +#~ msgstr "" + +#~ msgid "" +#~ msgstr "" + +#~ msgid "key must be integer" +#~ msgstr "la cl doit tre un nombre entier" + #~ msgid "E860: Eval did not return a valid python 3 object" #~ msgstr "E860: Eval n'a pas retourn un object python 3 valid" diff --git a/src/po/ja.sjis.po b/src/po/ja.sjis.po index e9c392d8a3..8d7e7cf5bb 100644 --- a/src/po/ja.sjis.po +++ b/src/po/ja.sjis.po @@ -8,7 +8,7 @@ # Copyright (C) 2001-13 MURAOKA Taro # THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. # -# Original translations. +# generated from ja.po, DO NOT EDIT # msgid "" msgstr "" diff --git a/src/po/uk.cp1251.po b/src/po/uk.cp1251.po index e97aaf1caf..e3f8df0cac 100644 --- a/src/po/uk.cp1251.po +++ b/src/po/uk.cp1251.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: vim 7.4\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-29 09:05+0300\n" +"POT-Creation-Date: 2014-11-08 08:23+0200\n" "PO-Revision-Date: 2010-06-18 21:53+0300\n" "Last-Translator: \n" "Language-Team: Bohdan Vlasyuk \n" @@ -81,6 +81,9 @@ msgstr " msgid "%d buffers wiped out" msgstr " %d ()" +msgid "E90: Cannot unload last buffer" +msgstr "E90: " + msgid "E84: No modified buffer found" msgstr "E84: " @@ -102,9 +105,6 @@ msgstr "E88: msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "E89: %ld (! )" -msgid "E90: Cannot unload last buffer" -msgstr "E90: " - msgid "W14: Warning: List of file names overflow" msgstr "W14: : " @@ -204,6 +204,21 @@ msgstr " msgid " line=%ld id=%d name=%s" msgstr " =%ld id=%d =%s" +msgid "E821: File is encrypted with unknown method" +msgstr "E821: " + +msgid "Enter encryption key: " +msgstr " : " + +msgid "Enter same key again: " +msgstr " : " + +msgid "Keys don't match!" +msgstr " !" + +msgid "[crypted]" +msgstr "[]" + #, c-format msgid "E96: Can not diff more than %ld buffers" msgstr "E96: %ld ()" @@ -683,9 +698,17 @@ msgstr "E258: msgid "sort() argument" msgstr " sort()" +# msgstr "E14: " +msgid "uniq() argument" +msgstr " unique()" + # msgstr "E364: " msgid "E702: Sort compare function failed" -msgstr "E702: " +msgstr "E702: sort" + +# msgstr "E364: " +msgid "E882: Uniq compare function failed" +msgstr "E882: uniq" msgid "(Invalid)" msgstr "()" @@ -783,9 +806,13 @@ msgid "E129: Function name required" msgstr "E129: " #, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" +msgid "E128: Function name must start with a capital or \"s:\": %s" msgstr "" -"E128: : %s" +"E128: \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: : %s" #, c-format msgid "E131: Cannot delete function %s: It is in use" @@ -1036,6 +1063,10 @@ msgstr "E138: msgid "Writing viminfo file \"%s\"" msgstr " viminfo %s" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: viminfo %s!" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" @@ -1233,6 +1264,10 @@ msgstr "E158: msgid "E157: Invalid sign ID: %ld" msgstr "E157: ID : %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: %s" + msgid " (NOT FOUND)" msgstr " ( )" @@ -1707,12 +1742,6 @@ msgstr "[ msgid "[converted]" msgstr "[]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ ֲ %ld]" @@ -1733,9 +1762,6 @@ msgstr " msgid "can't read output of 'charconvert'" msgstr " 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: " - # msgstr "E217: " msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: " @@ -2710,6 +2736,13 @@ msgstr "" msgid "E836: This Vim cannot execute :python after using :py3" msgstr "E836: Python: :py :py3 " +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: , , Python " +"." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Python" @@ -4130,15 +4163,6 @@ msgstr "E548: msgid "E549: Illegal percentage" msgstr "E549: " -msgid "Enter encryption key: " -msgstr " : " - -msgid "Enter same key again: " -msgstr " : " - -msgid "Keys don't match!" -msgstr " !" - msgid "E854: path too long for completion" msgstr "E854: " @@ -4316,6 +4340,13 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: " +"" + #, c-format msgid "%ld Cols; " msgstr ".: %ld; " @@ -4638,6 +4669,19 @@ msgstr "" "\n" " " +msgid "Could not set security context " +msgstr " " + +msgid " for " +msgstr " " + +#. no enough size OR unexpected error +msgid "Could not get security context " +msgstr " " + +msgid ". Removing it!\n" +msgstr ". !\n" + msgid "" "\n" "Cannot execute shell " @@ -4923,18 +4967,30 @@ msgstr "E554: msgid "External submatches:\n" msgstr " -:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA regexp) %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " msgstr "" -"E864: \\%#= 0, 1, or 2. " +"E864: \\%#= 0, 1, or 2. " +" " + +msgid "Switching to backtracking RE engine for pattern: " +msgstr " : " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) " #, c-format msgid "E866: (NFA regexp) Misplaced %c" msgstr "E866: (NFA regexp) %c" -msgid "E865: (NFA) Regexp end encountered prematurely" -msgstr "E865: (NFA) " +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA regexp) : %ld" #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" @@ -4988,7 +5044,8 @@ msgstr "E878: (NFA) msgid "" "Could not open temporary log file for writing, displaying on stderr ... " msgstr "" -" , stderr ... " +" , " +"stderr ... " #, c-format msgid "(NFA) COULD NOT OPEN %s !" @@ -5871,8 +5928,8 @@ msgstr " #. This happens when the FileChangedRO autocommand changes the #. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: ʳ " +msgid "E881: Line count changed unexpectedly" +msgstr "E881: ʳ " #. must display the prompt msgid "No undo possible; continue anyway" @@ -6368,6 +6425,10 @@ msgstr "E446: msgid "E447: Can't find file \"%s\" in path" msgstr "E447: %s " +# msgstr "E396: " +msgid "List or number required" +msgstr " " + #, c-format msgid "E370: Could not load library %s" msgstr "E370: %s" @@ -6622,6 +6683,9 @@ msgstr "E485: msgid "E37: No write since last change (add ! to override)" msgstr "E37: (! )" +msgid "E37: No write since last change" +msgstr "E37: " + msgid "E38: Null argument" msgstr "E38: ³ " @@ -6812,7 +6876,8 @@ msgstr " msgid "" "expected int(), long() or something supporting coercing to long(), but got %s" msgstr "" -" int(), long() , long(), %s" +" int(), long() , long(), " +"%s" #, c-format msgid "expected int() or something supporting coercing to int(), but got %s" @@ -6824,7 +6889,7 @@ msgstr " msgid "value is too small to fit into C int type" msgstr " , C int" -msgid "number must be greater then zero" +msgid "number must be greater than zero" msgstr " , " msgid "number must be greater or equal to zero" @@ -6870,7 +6935,8 @@ msgstr " #, c-format msgid "expected sequence element of size 2, but got sequence of size %d" -msgstr " 2, %d" +msgstr "" +" 2, %d" msgid "list constructor does not accept keyword arguments" msgstr " " @@ -6883,16 +6949,31 @@ msgstr " msgid "internal error: failed to get vim list item %d" msgstr " : vim %d" -msgid "failed to add item to list" -msgstr " " +msgid "slice step cannot be zero" +msgstr " " + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr " , %d, " #, c-format msgid "internal error: no vim list item %d" msgstr " : vim %d" +msgid "internal error: not enough list items" +msgstr " : " + msgid "internal error: failed to add item to list" msgstr " : " +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +" %d %d" + +msgid "failed to add item to list" +msgstr " " + msgid "cannot delete vim.List attributes" msgstr " vim.List" diff --git a/src/po/uk.po b/src/po/uk.po index 0c74293955..3ac0c4b442 100644 --- a/src/po/uk.po +++ b/src/po/uk.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: vim 7.4\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-09-29 09:05+0300\n" +"POT-Creation-Date: 2014-11-08 08:23+0200\n" "PO-Revision-Date: 2010-06-18 21:53+0300\n" "Last-Translator: Анатолій Сахнік \n" "Language-Team: Bohdan Vlasyuk \n" @@ -81,6 +81,9 @@ msgstr "Витерто один буфер" msgid "%d buffers wiped out" msgstr "Витерто %d буфери(ів)" +msgid "E90: Cannot unload last buffer" +msgstr "E90: Не можу вивантажити останній буфер" + msgid "E84: No modified buffer found" msgstr "E84: Жоден буфер не змінено" @@ -102,9 +105,6 @@ msgstr "E88: Це вже найперший буфер" msgid "E89: No write since last change for buffer %ld (add ! to override)" msgstr "E89: Буфер %ld має зміни (! щоб не зважати)" -msgid "E90: Cannot unload last buffer" -msgstr "E90: Не можу вивантажити останній буфер" - msgid "W14: Warning: List of file names overflow" msgstr "W14: Обережно: Список назв файлів переповнено" @@ -204,6 +204,21 @@ msgstr "Позначки для %s:" msgid " line=%ld id=%d name=%s" msgstr " рядок=%ld id=%d назва=%s" +msgid "E821: File is encrypted with unknown method" +msgstr "E821: Файл зашифровано невідомим методом" + +msgid "Enter encryption key: " +msgstr "Вкажіть ключ шифру: " + +msgid "Enter same key again: " +msgstr "Повторіть ключ: " + +msgid "Keys don't match!" +msgstr "Ключі не однакові!" + +msgid "[crypted]" +msgstr "[зашифровано]" + #, c-format msgid "E96: Can not diff more than %ld buffers" msgstr "E96: Не можна порівнювати понад %ld буфери(ів)" @@ -683,9 +698,17 @@ msgstr "E258: Не вдалося надіслати клієнту" msgid "sort() argument" msgstr "аргумент sort()" +# msgstr "E14: " +msgid "uniq() argument" +msgstr "аргумент unique()" + # msgstr "E364: " msgid "E702: Sort compare function failed" -msgstr "E702: Помилка у функції порівняння" +msgstr "E702: Помилка у функції порівняння sort" + +# msgstr "E364: " +msgid "E882: Uniq compare function failed" +msgstr "E882: Помилка у функції порівняння uniq" msgid "(Invalid)" msgstr "(Неможливо)" @@ -783,9 +806,13 @@ msgid "E129: Function name required" msgstr "E129: Не вказано назву функції" #, c-format -msgid "E128: Function name must start with a capital or contain a colon: %s" +msgid "E128: Function name must start with a capital or \"s:\": %s" msgstr "" -"E128: Назва функції має починатися з великої літери або містити двокрапку: %s" +"E128: Назва функції має починатися з великої літери або \"s:\": %s" + +#, c-format +msgid "E884: Function name cannot contain a colon: %s" +msgstr "E884: Назва функції не може мати двокрапку: %s" #, c-format msgid "E131: Cannot delete function %s: It is in use" @@ -1036,6 +1063,10 @@ msgstr "E138: Не вдалося записати файл viminfo %s!" msgid "Writing viminfo file \"%s\"" msgstr "Записується файл viminfo «%s»" +#, c-format +msgid "E886: Can't rename viminfo file to %s!" +msgstr "E886: Не вдалося перейменувати файл viminfo у %s!" + #. Write the info: #, c-format msgid "# This viminfo file was generated by Vim %s.\n" @@ -1233,6 +1264,10 @@ msgstr "E158: Некоректна назва буфера: %s" msgid "E157: Invalid sign ID: %ld" msgstr "E157: Неправильний ID надпису: %ld" +#, c-format +msgid "E885: Not possible to change sign %s" +msgstr "E885: Неможливо змінити знак %s" + msgid " (NOT FOUND)" msgstr " (НЕ ЗНАЙДЕНО)" @@ -1707,12 +1742,6 @@ msgstr "[НЕ конвертовано]" msgid "[converted]" msgstr "[конвертовано]" -msgid "[blowfish]" -msgstr "[blowfish]" - -msgid "[crypted]" -msgstr "[зашифровано]" - #, c-format msgid "[CONVERSION ERROR in line %ld]" msgstr "[ПОМИЛКА КОНВЕРТАЦІЇ у рядку %ld]" @@ -1733,9 +1762,6 @@ msgstr "Конвертація з 'charconvert' не вдалася" msgid "can't read output of 'charconvert'" msgstr "не вдалося прочитати вивід 'charconvert'" -msgid "E821: File is encrypted with unknown method" -msgstr "E821: Файл зашифровано невідомим методом" - # msgstr "E217: " msgid "E676: No matching autocommands for acwrite buffer" msgstr "E676: Немає відповідних автокоманд" @@ -2710,6 +2736,13 @@ msgstr "" msgid "E836: This Vim cannot execute :python after using :py3" msgstr "E836: Python: Не можна використати :py і :py3 в одному сеансі" +msgid "" +"E887: Sorry, this command is disabled, the Python's site module could not be " +"loaded." +msgstr "" +"E887: Вибачте, ця команда вимкнена, місцева бібліотека Python не може бути " +"завантажена." + msgid "E659: Cannot invoke Python recursively" msgstr "E659: Не можна рекурсивно викликати Python" @@ -4130,15 +4163,6 @@ msgstr "E548: Потрібна цифра" msgid "E549: Illegal percentage" msgstr "E549: Неправильний відсоток" -msgid "Enter encryption key: " -msgstr "Вкажіть ключ шифру: " - -msgid "Enter same key again: " -msgstr "Повторіть ключ: " - -msgid "Keys don't match!" -msgstr "Ключі не однакові!" - msgid "E854: path too long for completion" msgstr "E854: шлях занадто довгий для доповнення" @@ -4316,6 +4340,13 @@ msgstr "" msgid "E574: Unknown register type %d" msgstr "E574: Невідомий тип регістру %d" +msgid "" +"E883: search pattern and expression register may not contain two or more " +"lines" +msgstr "" +"E883: шаблон пошуку і регістровий вираз не можуть містити два чи більше " +"рядків" + #, c-format msgid "%ld Cols; " msgstr "довж.: %ld; " @@ -4638,6 +4669,19 @@ msgstr "" "\n" "Не вдалося встановити контекст безпеки для " +msgid "Could not set security context " +msgstr "Не вдалося встановити контекст безпеки " + +msgid " for " +msgstr " для " + +#. no enough size OR unexpected error +msgid "Could not get security context " +msgstr "Не вдалося отримати контекст безпеки " + +msgid ". Removing it!\n" +msgstr ". Знищуємо його!\n" + msgid "" "\n" "Cannot execute shell " @@ -4923,18 +4967,30 @@ msgstr "E554: Синтаксична помилка в %s{...}" msgid "External submatches:\n" msgstr "Зовнішні під-збіги:\n" +#, c-format +msgid "E888: (NFA regexp) cannot repeat %s" +msgstr "E888: (NFA regexp) не можна повторити %s" + msgid "" "E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be " "used " msgstr "" -"E864: після \\%#= може бути тільки 0, 1, or 2. Буде використано автоматичний механізм " +"E864: після \\%#= може бути тільки 0, 1, or 2. Буде використано автоматичний " +"механізм " + +msgid "Switching to backtracking RE engine for pattern: " +msgstr "Перемикаємося до пошуку з поверненням для шаблона: " + +msgid "E865: (NFA) Regexp end encountered prematurely" +msgstr "E865: (NFA) Зарано трапився кінець регулярного виразу" #, c-format msgid "E866: (NFA regexp) Misplaced %c" msgstr "E866: (NFA regexp) Не на місці %c" -msgid "E865: (NFA) Regexp end encountered prematurely" -msgstr "E865: (NFA) Зарано трапився кінець регулярного виразу" +#, c-format +msgid "E877: (NFA regexp) Invalid character class: %ld" +msgstr "E877: (NFA regexp) Неправильний клас символу: %ld" #, c-format msgid "E867: (NFA) Unknown operator '\\z%c'" @@ -4988,7 +5044,8 @@ msgstr "E878: (NFA) Не вдалося отримати пам’ять для msgid "" "Could not open temporary log file for writing, displaying on stderr ... " msgstr "" -"Не вдалося відкрити тимчасовий файл журналу для запису, показується на stderr ... " +"Не вдалося відкрити тимчасовий файл журналу для запису, показується на " +"stderr ... " #, c-format msgid "(NFA) COULD NOT OPEN %s !" @@ -5871,8 +5928,8 @@ msgstr "Використано CUT_BUFFER0 замість порожнього #. This happens when the FileChangedRO autocommand changes the #. * file in a way it becomes shorter. -msgid "E834: Line count changed unexpectedly" -msgstr "E834: Кількість рядків несподівано змінилася" +msgid "E881: Line count changed unexpectedly" +msgstr "E881: Кількість рядків несподівано змінилася" #. must display the prompt msgid "No undo possible; continue anyway" @@ -6368,6 +6425,10 @@ msgstr "E446: Немає назви файлу над курсором" msgid "E447: Can't find file \"%s\" in path" msgstr "E447: Файл «%s» не знайдено у шляху пошуку" +# msgstr "E396: " +msgid "List or number required" +msgstr "Потрібен список чи число" + #, c-format msgid "E370: Could not load library %s" msgstr "E370: Не вдалося завантажити бібліотеку %s" @@ -6622,6 +6683,9 @@ msgstr "E485: Не вдалося прочитати файл %s" msgid "E37: No write since last change (add ! to override)" msgstr "E37: Зміни не було записано (! щоб не зважати)" +msgid "E37: No write since last change" +msgstr "E37: Не записано попередні зміни" + msgid "E38: Null argument" msgstr "E38: Відсутній аргумент" @@ -6812,7 +6876,8 @@ msgstr "очікувався екземпляр bytes() чи str(), але от msgid "" "expected int(), long() or something supporting coercing to long(), but got %s" msgstr "" -"очікувався int(), long() чи щось, що може бути вміщене long(), але отримано %s" +"очікувався int(), long() чи щось, що може бути вміщене long(), але отримано " +"%s" #, c-format msgid "expected int() or something supporting coercing to int(), but got %s" @@ -6824,7 +6889,7 @@ msgstr "значення завелике, щоб вміститися у тип msgid "value is too small to fit into C int type" msgstr "значення замале, щоб вміститися у тип C int" -msgid "number must be greater then zero" +msgid "number must be greater than zero" msgstr "число має бути більше, ніж нуль" msgid "number must be greater or equal to zero" @@ -6870,7 +6935,8 @@ msgstr "хеш-таблиця змінилася під час перебира #, c-format msgid "expected sequence element of size 2, but got sequence of size %d" -msgstr "очікувалась послідовність розміром 2, але отримано послідовність розміру %d" +msgstr "" +"очікувалась послідовність розміром 2, але отримано послідовність розміру %d" msgid "list constructor does not accept keyword arguments" msgstr "списковий конструктор не приймає іменовані аргументи" @@ -6883,16 +6949,31 @@ msgstr "індекс списку за межами" msgid "internal error: failed to get vim list item %d" msgstr "внутрішня помилка: не вдалося отримати елемент списку vim %d" -msgid "failed to add item to list" -msgstr "не вдалося додати елемент до списку" +msgid "slice step cannot be zero" +msgstr "крок зрізу не може бути нуль" + +#, c-format +msgid "attempt to assign sequence of size greater than %d to extended slice" +msgstr "спроба призначити послідовність розміру більше, ніж %d, у розширений зріз" #, c-format msgid "internal error: no vim list item %d" msgstr "внутрішня помилка: немає елемента списку vim %d" +msgid "internal error: not enough list items" +msgstr "внутрішня помилка: бракує елементів у списку" + msgid "internal error: failed to add item to list" msgstr "внутрішня помилка: не вдалося додати елемент до списку" +#, c-format +msgid "attempt to assign sequence of size %d to extended slice of size %d" +msgstr "" +"спроба призначити послідовність розміром %d у розширений зріз розміру %d" + +msgid "failed to add item to list" +msgstr "не вдалося додати елемент до списку" + msgid "cannot delete vim.List attributes" msgstr "не вдалося знищити атрибути vim.List" From a5eea8d64d06132ccf0305b4c99492f56c7242b9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 19 Nov 2014 10:21:57 +0100 Subject: [PATCH 194/311] updated for version 7.4.517 Problem: With a wrapping line the cursor may not end up in the right place. (Nazri Ramliy) Solution: Adjust n_extra for a Tab that wraps. (Christian Brabandt) --- src/screen.c | 4 ++++ src/version.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/screen.c b/src/screen.c index 36afc2dcda..e11bdc3775 100644 --- a/src/screen.c +++ b/src/screen.c @@ -4456,6 +4456,10 @@ win_line(wp, lnum, startrow, endrow, nochange) /* TODO: is passing p for start of the line OK? */ n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol, NULL) - 1; + if (c == TAB && n_extra + col > W_WIDTH(wp)) + n_extra = (int)wp->w_buffer->b_p_ts + - vcol % (int)wp->w_buffer->b_p_ts - 1; + c_extra = ' '; if (vim_iswhite(c)) { diff --git a/src/version.c b/src/version.c index 826679ef38..ae9fbad89d 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 517, /**/ 516, /**/ From c11a1603793b93542d7d28c137853d715888dfa9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 19 Nov 2014 10:40:08 +0100 Subject: [PATCH 195/311] updated for version 7.4.518 Problem: Using status line height in width computations. Solution: Use one instead. (Hirohito Higashi) --- src/version.c | 2 ++ src/window.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/version.c b/src/version.c index ae9fbad89d..910ffaab94 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 518, /**/ 517, /**/ diff --git a/src/window.c b/src/window.c index b975a61420..6490fd3868 100644 --- a/src/window.c +++ b/src/window.c @@ -796,7 +796,7 @@ win_split_ins(size, flags, new_wp, dir) if (frp->fr_win != oldwin && frp->fr_win != NULL && (frp->fr_win->w_width > new_size || frp->fr_win->w_width > oldwin->w_width - - new_size - STATUS_HEIGHT)) + - new_size - 1)) { do_equal = TRUE; break; From a3750a19fc877399ac864a2fcfb8ca97384c56bd Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 19 Nov 2014 13:38:07 +0100 Subject: [PATCH 196/311] updated for version 7.4.519 Problem: Crash when using syntax highlighting. Solution: When regprog is freed and replaced, store the result. --- src/buffer.c | 48 ++++++++++++++++++++++---------------------- src/ex_cmds2.c | 5 +---- src/fileio.c | 17 ++++++++++------ src/os_unix.c | 6 +----- src/proto/fileio.pro | 1 - src/proto/regexp.pro | 1 + src/regexp.c | 26 ++++++++++++++++++++++++ src/spell.c | 28 +++++++++++--------------- src/syntax.c | 28 ++++++++++++++++++-------- src/version.c | 2 ++ 10 files changed, 98 insertions(+), 64 deletions(-) diff --git a/src/buffer.c b/src/buffer.c index 9eb67164e9..37182e146c 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -28,9 +28,9 @@ #include "vim.h" #if defined(FEAT_CMDL_COMPL) || defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL) -static char_u *buflist_match __ARGS((regprog_T *prog, buf_T *buf, int ignore_case)); +static char_u *buflist_match __ARGS((regmatch_T *rmp, buf_T *buf, int ignore_case)); # define HAVE_BUFLIST_MATCH -static char_u *fname_match __ARGS((regprog_T *prog, char_u *name, int ignore_case)); +static char_u *fname_match __ARGS((regmatch_T *rmp, char_u *name, int ignore_case)); #endif static void buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options)); static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer)); @@ -2220,7 +2220,6 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only) int curtab_only; /* find buffers in current tab only */ { buf_T *buf; - regprog_T *prog; int match = -1; int find_listed; char_u *pat; @@ -2265,14 +2264,16 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only) { for (attempt = 0; attempt <= 3; ++attempt) { + regmatch_T regmatch; + /* may add '^' and '$' */ if (toggledollar) *patend = (attempt < 2) ? NUL : '$'; /* add/remove '$' */ p = pat; if (*p == '^' && !(attempt & 1)) /* add/remove '^' */ ++p; - prog = vim_regcomp(p, p_magic ? RE_MAGIC : 0); - if (prog == NULL) + regmatch.regprog = vim_regcomp(p, p_magic ? RE_MAGIC : 0); + if (regmatch.regprog == NULL) { vim_free(pat); return -1; @@ -2283,7 +2284,7 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only) #ifdef FEAT_DIFF && (!diffmode || diff_mode_buf(buf)) #endif - && buflist_match(prog, buf, FALSE) != NULL) + && buflist_match(®match, buf, FALSE) != NULL) { if (curtab_only) { @@ -2310,7 +2311,7 @@ buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only) match = buf->b_fnum; /* remember first match */ } - vim_regfree(prog); + vim_regfree(regmatch.regprog); if (match >= 0) /* found one match */ break; } @@ -2352,7 +2353,6 @@ ExpandBufnames(pat, num_file, file, options) int round; char_u *p; int attempt; - regprog_T *prog; char_u *patc; *num_file = 0; /* return values in case of FAIL */ @@ -2376,10 +2376,12 @@ ExpandBufnames(pat, num_file, file, options) */ for (attempt = 0; attempt <= 1; ++attempt) { + regmatch_T regmatch; + if (attempt > 0 && patc == pat) break; /* there was no anchor, no need to try again */ - prog = vim_regcomp(patc + attempt * 11, RE_MAGIC); - if (prog == NULL) + regmatch.regprog = vim_regcomp(patc + attempt * 11, RE_MAGIC); + if (regmatch.regprog == NULL) { if (patc != pat) vim_free(patc); @@ -2397,7 +2399,7 @@ ExpandBufnames(pat, num_file, file, options) { if (!buf->b_p_bl) /* skip unlisted buffers */ continue; - p = buflist_match(prog, buf, p_wic); + p = buflist_match(®match, buf, p_wic); if (p != NULL) { if (round == 1) @@ -2419,14 +2421,14 @@ ExpandBufnames(pat, num_file, file, options) *file = (char_u **)alloc((unsigned)(count * sizeof(char_u *))); if (*file == NULL) { - vim_regfree(prog); + vim_regfree(regmatch.regprog); if (patc != pat) vim_free(patc); return FAIL; } } } - vim_regfree(prog); + vim_regfree(regmatch.regprog); if (count) /* match(es) found, break here */ break; } @@ -2445,17 +2447,17 @@ ExpandBufnames(pat, num_file, file, options) * Check for a match on the file name for buffer "buf" with regprog "prog". */ static char_u * -buflist_match(prog, buf, ignore_case) - regprog_T *prog; +buflist_match(rmp, buf, ignore_case) + regmatch_T *rmp; buf_T *buf; int ignore_case; /* when TRUE ignore case, when FALSE use 'fic' */ { char_u *match; /* First try the short file name, then the long file name. */ - match = fname_match(prog, buf->b_sfname, ignore_case); + match = fname_match(rmp, buf->b_sfname, ignore_case); if (match == NULL) - match = fname_match(prog, buf->b_ffname, ignore_case); + match = fname_match(rmp, buf->b_ffname, ignore_case); return match; } @@ -2465,27 +2467,25 @@ buflist_match(prog, buf, ignore_case) * Return "name" when there is a match, NULL when not. */ static char_u * -fname_match(prog, name, ignore_case) - regprog_T *prog; +fname_match(rmp, name, ignore_case) + regmatch_T *rmp; char_u *name; int ignore_case; /* when TRUE ignore case, when FALSE use 'fic' */ { char_u *match = NULL; char_u *p; - regmatch_T regmatch; if (name != NULL) { - regmatch.regprog = prog; /* Ignore case when 'fileignorecase' or the argument is set. */ - regmatch.rm_ic = p_fic || ignore_case; - if (vim_regexec(®match, name, (colnr_T)0)) + rmp->rm_ic = p_fic || ignore_case; + if (vim_regexec(rmp, name, (colnr_T)0)) match = name; else { /* Replace $(HOME) with '~' and try matching again. */ p = home_replace_save(NULL, name); - if (p != NULL && vim_regexec(®match, p, (colnr_T)0)) + if (p != NULL && vim_regexec(rmp, p, (colnr_T)0)) match = name; vim_free(p); } diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 908552d580..4614deab80 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -739,7 +739,6 @@ debuggy_find(file, fname, after, gap, fp) struct debuggy *bp; int i; linenr_T lnum = 0; - regmatch_T regmatch; char_u *name = fname; int prev_got_int; @@ -771,8 +770,6 @@ debuggy_find(file, fname, after, gap, fp) #endif (bp->dbg_lnum > after && (lnum == 0 || bp->dbg_lnum < lnum))))) { - regmatch.regprog = bp->dbg_prog; - regmatch.rm_ic = FALSE; /* * Save the value of got_int and reset it. We don't want a * previous interruption cancel matching, only hitting CTRL-C @@ -780,7 +777,7 @@ debuggy_find(file, fname, after, gap, fp) */ prev_got_int = got_int; got_int = FALSE; - if (vim_regexec(®match, name, (colnr_T)0)) + if (vim_regexec_prog(&bp->dbg_prog, FALSE, name, (colnr_T)0)) { lnum = bp->dbg_lnum; if (fp != NULL) diff --git a/src/fileio.c b/src/fileio.c index a978ec241d..0af3627f8e 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -7772,6 +7772,9 @@ static int au_get_grouparg __ARGS((char_u **argp)); static int do_autocmd_event __ARGS((event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group)); static int apply_autocmds_group __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap)); static void auto_next_pat __ARGS((AutoPatCmd *apc, int stop_at_last)); +#if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) +static int match_file_pat __ARGS((char_u *pattern, regprog_T **prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs)); +#endif static event_T last_event; @@ -9640,7 +9643,7 @@ auto_next_pat(apc, stop_at_last) { /* execution-condition */ if (ap->buflocal_nr == 0 - ? (match_file_pat(NULL, ap->reg_prog, apc->fname, + ? (match_file_pat(NULL, &ap->reg_prog, apc->fname, apc->sfname, apc->tail, ap->allow_dirs)) : ap->buflocal_nr == apc->arg_bufnr) { @@ -9774,7 +9777,7 @@ has_autocmd(event, sfname, buf) for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next) if (ap->pat != NULL && ap->cmds != NULL && (ap->buflocal_nr == 0 - ? match_file_pat(NULL, ap->reg_prog, + ? match_file_pat(NULL, &ap->reg_prog, fname, sfname, tail, ap->allow_dirs) : buf != NULL && ap->buflocal_nr == buf->b_fnum )) @@ -10035,10 +10038,10 @@ aucmd_restbuf(aco) * Used for autocommands and 'wildignore'. * Returns TRUE if there is a match, FALSE otherwise. */ - int + static int match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs) char_u *pattern; /* pattern to match with */ - regprog_T *prog; /* pre-compiled regprog or NULL */ + regprog_T **prog; /* pre-compiled regprog or NULL */ char_u *fname; /* full path of file name */ char_u *sfname; /* short file name or NULL */ char_u *tail; /* tail of path */ @@ -10093,7 +10096,7 @@ match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs) #endif { if (prog != NULL) - regmatch.regprog = prog; + regmatch.regprog = *prog; else regmatch.regprog = vim_regcomp(pattern, RE_MAGIC); } @@ -10119,7 +10122,9 @@ match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs) || (!allow_dirs && vim_regexec(®match, tail, (colnr_T)0))))) result = TRUE; - if (prog == NULL) + if (prog != NULL) + *prog = regmatch.regprog; + else vim_regfree(regmatch.regprog); return result; } diff --git a/src/os_unix.c b/src/os_unix.c index 6209605cfa..8cd6b14eb7 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1610,8 +1610,6 @@ x_IOerror_handler(dpy) static int x_connect_to_server() { - regmatch_T regmatch; - #if defined(FEAT_CLIENTSERVER) if (x_force_connect) return TRUE; @@ -1622,9 +1620,7 @@ x_connect_to_server() /* Check for a match with "exclude:" from 'clipboard'. */ if (clip_exclude_prog != NULL) { - regmatch.rm_ic = FALSE; /* Don't ignore case */ - regmatch.regprog = clip_exclude_prog; - if (vim_regexec(®match, T_NAME, (colnr_T)0)) + if (vim_regexec_prog(&clip_exclude_prog, FALSE, T_NAME, (colnr_T)0)) return FALSE; } return TRUE; diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro index 5b71d0aadc..45e7b38727 100644 --- a/src/proto/fileio.pro +++ b/src/proto/fileio.pro @@ -59,7 +59,6 @@ char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd) char_u *get_event_name __ARGS((expand_T *xp, int idx)); int autocmd_supported __ARGS((char_u *name)); int au_exists __ARGS((char_u *arg)); -int match_file_pat __ARGS((char_u *pattern, regprog_T *prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs)); int match_file_list __ARGS((char_u *list, char_u *sfname, char_u *ffname)); char_u *file_pat_to_reg_pat __ARGS((char_u *pat, char_u *pat_end, char *allow_dirs, int no_bslash)); long read_eintr __ARGS((int fd, void *buf, size_t bufsize)); diff --git a/src/proto/regexp.pro b/src/proto/regexp.pro index a42c5944a8..099121eaef 100644 --- a/src/proto/regexp.pro +++ b/src/proto/regexp.pro @@ -13,6 +13,7 @@ char_u *reg_submatch __ARGS((int no)); list_T *reg_submatch_list __ARGS((int no)); regprog_T *vim_regcomp __ARGS((char_u *expr_arg, int re_flags)); void vim_regfree __ARGS((regprog_T *prog)); +int vim_regexec_prog __ARGS((regprog_T **prog, int ignore_case, char_u *line, colnr_T col)); int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col)); int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col)); long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm)); diff --git a/src/regexp.c b/src/regexp.c index 6e5655a995..fe28dc6845 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -8163,6 +8163,7 @@ static int vim_regexec_both __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, /* * Match a regexp against a string. * "rmp->regprog" is a compiled regexp as returned by vim_regcomp(). + * Note: "rmp->regprog" may be freed and changed. * Uses curbuf for line count and 'iskeyword'. * When "nl" is TRUE consider a "\n" in "line" to be a line break. * @@ -8203,6 +8204,29 @@ vim_regexec_both(rmp, line, col, nl) return result; } +/* + * Note: "*prog" may be freed and changed. + */ + int +vim_regexec_prog(prog, ignore_case, line, col) + regprog_T **prog; + int ignore_case; + char_u *line; + colnr_T col; +{ + int r; + regmatch_T regmatch; + + regmatch.regprog = *prog; + regmatch.rm_ic = ignore_case; + r = vim_regexec_both(®match, line, col, FALSE); + *prog = regmatch.regprog; + return r; +} + +/* + * Note: "rmp->regprog" may be freed and changed. + */ int vim_regexec(rmp, line, col) regmatch_T *rmp; @@ -8216,6 +8240,7 @@ vim_regexec(rmp, line, col) || defined(FIND_REPLACE_DIALOG) || defined(PROTO) /* * Like vim_regexec(), but consider a "\n" in "line" to be a line break. + * Note: "rmp->regprog" may be freed and changed. */ int vim_regexec_nl(rmp, line, col) @@ -8230,6 +8255,7 @@ vim_regexec_nl(rmp, line, col) /* * Match a regexp against multiple lines. * "rmp->regprog" is a compiled regexp as returned by vim_regcomp(). + * Note: "rmp->regprog" may be freed and changed. * Uses curbuf for line count and 'iskeyword'. * * Return zero if there is no match. Return number of lines contained in the diff --git a/src/spell.c b/src/spell.c index 1e52dfb26e..9d7f933a26 100644 --- a/src/spell.c +++ b/src/spell.c @@ -1154,11 +1154,14 @@ spell_check(wp, ptr, attrp, capcol, docount) if (capcol != NULL && wp->w_s->b_cap_prog != NULL) { regmatch_T regmatch; + int r; /* Check for end of sentence. */ regmatch.regprog = wp->w_s->b_cap_prog; regmatch.rm_ic = FALSE; - if (vim_regexec(®match, ptr, 0)) + r = vim_regexec(®match, ptr, 0); + wp->w_s->b_cap_prog = regmatch.regprog; + if (r) *capcol = (int)(regmatch.endp[0] - ptr); } @@ -1786,7 +1789,6 @@ can_compound(slang, word, flags) char_u *word; char_u *flags; { - regmatch_T regmatch; #ifdef FEAT_MBYTE char_u uflags[MAXWLEN * 2]; int i; @@ -1808,9 +1810,7 @@ can_compound(slang, word, flags) else #endif p = flags; - regmatch.regprog = slang->sl_compprog; - regmatch.rm_ic = FALSE; - if (!vim_regexec(®match, p, 0)) + if (!vim_regexec_prog(&slang->sl_compprog, FALSE, p, 0)) return FALSE; /* Count the number of syllables. This may be slow, do it last. If there @@ -1930,8 +1930,7 @@ valid_word_prefix(totprefcnt, arridx, flags, word, slang, cond_req) { int prefcnt; int pidx; - regprog_T *rp; - regmatch_T regmatch; + regprog_T **rp; int prefid; prefid = (unsigned)flags >> 24; @@ -1950,12 +1949,10 @@ valid_word_prefix(totprefcnt, arridx, flags, word, slang, cond_req) /* Check the condition, if there is one. The condition index is * stored in the two bytes above the prefix ID byte. */ - rp = slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff]; - if (rp != NULL) + rp = &slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff]; + if (*rp != NULL) { - regmatch.regprog = rp; - regmatch.rm_ic = FALSE; - if (!vim_regexec(®match, word, 0)) + if (!vim_regexec_prog(rp, FALSE, word, 0)) continue; } else if (cond_req) @@ -6903,7 +6900,6 @@ store_aff_word(spin, word, afflist, affile, ht, xht, condit, flags, hashitem_T *hi; affheader_T *ah; affentry_T *ae; - regmatch_T regmatch; char_u newword[MAXWLEN]; int retval = OK; int i, j; @@ -6944,15 +6940,14 @@ store_aff_word(spin, word, afflist, affile, ht, xht, condit, flags, * When a previously added affix had CIRCUMFIX this one * must have it too, if it had not then this one must not * have one either. */ - regmatch.regprog = ae->ae_prog; - regmatch.rm_ic = FALSE; if ((xht != NULL || !affile->af_pfxpostpone || ae->ae_chop != NULL || ae->ae_flags != NULL) && (ae->ae_chop == NULL || STRLEN(ae->ae_chop) < wordlen) && (ae->ae_prog == NULL - || vim_regexec(®match, word, (colnr_T)0)) + || vim_regexec_prog(&ae->ae_prog, FALSE, + word, (colnr_T)0)) && (((condit & CONDIT_CFIX) == 0) == ((condit & CONDIT_AFF) == 0 || ae->ae_flags == NULL @@ -10478,6 +10473,7 @@ check_need_cap(lnum, col) break; } } + curwin->w_s->b_cap_prog = regmatch.regprog; } vim_free(line_copy); diff --git a/src/syntax.c b/src/syntax.c index a935810181..fcd20c8ace 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -992,13 +992,16 @@ syn_match_linecont(lnum) linenr_T lnum; { regmmatch_T regmatch; + int r; if (syn_block->b_syn_linecont_prog != NULL) { regmatch.rmm_ic = syn_block->b_syn_linecont_ic; regmatch.regprog = syn_block->b_syn_linecont_prog; - return syn_regexec(®match, lnum, (colnr_T)0, + r = syn_regexec(®match, lnum, (colnr_T)0, IF_SYN_TIME(&syn_block->b_syn_linecont_time)); + syn_block->b_syn_linecont_prog = regmatch.regprog; + return r; } return FALSE; } @@ -2075,6 +2078,8 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) cur_si->si_cont_list, &spp->sp_syn, spp->sp_flags & HL_CONTAINED)))) { + int r; + /* If we already tried matching in this line, and * there isn't a match before next_match_col, skip * this item. */ @@ -2089,10 +2094,12 @@ syn_current_attr(syncing, displaying, can_spell, keep_state) regmatch.rmm_ic = spp->sp_ic; regmatch.regprog = spp->sp_prog; - if (!syn_regexec(®match, + r = syn_regexec(®match, current_lnum, (colnr_T)lc_col, - IF_SYN_TIME(&spp->sp_time))) + IF_SYN_TIME(&spp->sp_time)); + spp->sp_prog = regmatch.regprog; + if (!r) { /* no match in this line, try another one */ spp->sp_startcol = MAXCOL; @@ -2963,6 +2970,7 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, for (idx = start_idx; idx < syn_block->b_syn_patterns.ga_len; ++idx) { int lc_col = matchcol; + int r; spp = &(SYN_ITEMS(syn_block)[idx]); if (spp->sp_type != SPTYPE_END) /* past last END pattern */ @@ -2973,8 +2981,10 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, regmatch.rmm_ic = spp->sp_ic; regmatch.regprog = spp->sp_prog; - if (syn_regexec(®match, startpos->lnum, lc_col, - IF_SYN_TIME(&spp->sp_time))) + r = syn_regexec(®match, startpos->lnum, lc_col, + IF_SYN_TIME(&spp->sp_time)); + spp->sp_prog = regmatch.regprog; + if (r) { if (best_idx == -1 || regmatch.startpos[0].col < best_regmatch.startpos[0].col) @@ -3000,14 +3010,16 @@ find_endpos(idx, startpos, m_endpos, hl_endpos, flagsp, end_endpos, if (spp_skip != NULL) { int lc_col = matchcol - spp_skip->sp_offsets[SPO_LC_OFF]; + int r; if (lc_col < 0) lc_col = 0; regmatch.rmm_ic = spp_skip->sp_ic; regmatch.regprog = spp_skip->sp_prog; - if (syn_regexec(®match, startpos->lnum, lc_col, - IF_SYN_TIME(&spp_skip->sp_time)) - && regmatch.startpos[0].col + r = syn_regexec(®match, startpos->lnum, lc_col, + IF_SYN_TIME(&spp_skip->sp_time)); + spp_skip->sp_prog = regmatch.regprog; + if (r && regmatch.startpos[0].col <= best_regmatch.startpos[0].col) { /* Add offset to skip pattern match */ diff --git a/src/version.c b/src/version.c index 910ffaab94..88a57b9d70 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 519, /**/ 518, /**/ From 007e3f10bb49c384552c4ee9043f1bbc439fdc11 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 19 Nov 2014 14:05:55 +0100 Subject: [PATCH 197/311] updated for version 7.4.520 Problem: Sun PCK locale is not recognzed. Solution: Add PCK in the table. (Keiichi Oono) --- src/mbyte.c | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/mbyte.c b/src/mbyte.c index 44cbd5f82b..0531f18116 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -405,6 +405,7 @@ enc_alias_table[] = {"unix-jis", IDX_EUC_JP}, {"ujis", IDX_EUC_JP}, {"shift-jis", IDX_SJIS}, + {"pck", IDX_SJIS}, /* Sun: PCK */ {"euckr", IDX_EUC_KR}, {"5601", IDX_EUC_KR}, /* Sun: KS C 5601 */ {"euccn", IDX_EUC_CN}, diff --git a/src/version.c b/src/version.c index 88a57b9d70..20cafae107 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 520, /**/ 519, /**/ From 87d02d0d320c3af26c96b0e91d2e5f52ca467eee Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 19 Nov 2014 14:35:39 +0100 Subject: [PATCH 198/311] updated for version 7.4.521 Problem: When using "vep" a mark is moved to the next line. (Maxi Padulo, Issue 283) Solution: Decrement the line number. (Christian Brabandt) --- src/ops.c | 3 +++ src/version.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/ops.c b/src/ops.c index 86408a4944..edc84a07aa 100644 --- a/src/ops.c +++ b/src/ops.c @@ -3831,6 +3831,9 @@ do_put(regname, dir, count, flags) lnum++; } while (VIsual_active && lnum <= curbuf->b_visual.vi_end.lnum); + if (VIsual_active) /* reset lnum to the last visual line */ + lnum--; + curbuf->b_op_end = curwin->w_cursor; /* For "CTRL-O p" in Insert mode, put cursor after last char */ if (totlen && (restart_edit != 0 || (flags & PUT_CURSEND))) diff --git a/src/version.c b/src/version.c index 20cafae107..758c686355 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 521, /**/ 520, /**/ From eb5c37d8d792e4d2353e7c7feeceaec82d2bf94c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 19 Nov 2014 15:03:28 +0100 Subject: [PATCH 199/311] updated for version 7.4.522 Problem: Specifying wrong buffer size for GetLongPathName(). Solution: Use the actual size. (Ken Takata) --- src/eval.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index 1b1072cd80..c7cc0089d3 100644 --- a/src/eval.c +++ b/src/eval.c @@ -24762,7 +24762,7 @@ repeat: p = alloc(_MAX_PATH + 1); if (p != NULL) { - if (GetLongPathName(*fnamep, p, MAXPATHL)) + if (GetLongPathName(*fnamep, p, _MAX_PATH)) { vim_free(*bufp); *bufp = *fnamep = p; diff --git a/src/version.c b/src/version.c index 758c686355..7a86692d7c 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 522, /**/ 521, /**/ From ba78ebb61ce115c2fa51158214596b40cfb739df Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 19 Nov 2014 15:48:46 +0100 Subject: [PATCH 200/311] updated for version 7.4.523 Problem: When the X11 server is stopped and restarted, while Vim is kept in the background, copy/paste no longer works. (Issue 203) Solution: Setup the clipboard again. (Christian Brabandt) --- src/os_unix.c | 21 +++++++++++++++++++++ src/version.c | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/os_unix.c b/src/os_unix.c index 8cd6b14eb7..0813cae73c 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1586,12 +1586,15 @@ x_IOerror_check(dpy) * An X IO Error handler, used to catch terminal errors. */ static int x_IOerror_handler __ARGS((Display *dpy)); +static void may_restore_clipboard __ARGS((void)); +static int xterm_dpy_was_reset = FALSE; static int x_IOerror_handler(dpy) Display *dpy UNUSED; { xterm_dpy = NULL; + xterm_dpy_was_reset = TRUE; x11_window = 0; x11_display = NULL; xterm_Shell = (Widget)0; @@ -1602,6 +1605,22 @@ x_IOerror_handler(dpy) return 0; /* avoid the compiler complains about missing return value */ # endif } + +/* + * If the X11 connection was lost try to restore it. + * Helps when the X11 server was stopped and restarted while Vim was inactive + * (e.g. though tmux). + */ + static void +may_restore_clipboard() +{ + if (xterm_dpy_was_reset) + { + xterm_dpy_was_reset = FALSE; + setup_term_clip(); + get_x11_title(FALSE); + } +} #endif /* @@ -5274,6 +5293,7 @@ RealWaitForChar(fd, msec, check_for_gpm) } # endif # ifdef FEAT_XCLIPBOARD + may_restore_clipboard(); if (xterm_Shell != (Widget)0) { xterm_idx = nfd; @@ -5426,6 +5446,7 @@ select_eintr: } # endif # ifdef FEAT_XCLIPBOARD + may_restore_clipboard(); if (xterm_Shell != (Widget)0) { FD_SET(ConnectionNumber(xterm_dpy), &rfds); diff --git a/src/version.c b/src/version.c index 7a86692d7c..cc3bb24356 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 523, /**/ 522, /**/ From 4e3fcc7cab52f8cd2d26992fe4b84742e2237564 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 19 Nov 2014 15:54:17 +0100 Subject: [PATCH 201/311] Update runtime files. --- runtime/doc/editing.txt | 11 +++++++---- runtime/doc/eval.txt | 9 +++++---- runtime/doc/quickref.txt | 3 ++- runtime/doc/todo.txt | 42 +++++++++++++++++++++------------------- runtime/optwin.vim | 8 +++++--- runtime/syntax/c.vim | 8 +++----- 6 files changed, 44 insertions(+), 37 deletions(-) diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index b02f8faec2..a71cbc0047 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.4. Last change: 2014 Nov 12 +*editing.txt* For Vim version 7.4. Last change: 2014 Nov 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1080,9 +1080,12 @@ The names can be in upper- or lowercase. the last file in the argument list has not been edited. See |:confirm| and 'confirm'. {not in Vi} -:q[uit]! Quit without writing, also when visible buffers have - changes. Does not exit when there are changed hidden - buffers. Use ":qall!" to exit always. +:q[uit]! Quit without writing, also when currently visible + buffers have changes. Does not exit when this is the + last window and there are is a changed hidden buffer. + In this case, the first changed hidden buffer becomes + the current buffer. + Use ":qall!" to exit always. :cq[uit] Quit always, without writing, and return an error code. See |:cq|. Used for Manx's QuickFix mode (see diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index f21e051b6e..829d4eea8d 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Nov 05 +*eval.txt* For Vim version 7.4. Last change: 2014 Nov 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1755,8 +1755,8 @@ count( {list}, {expr} [, {ic} [, {start}]]) Number count how many {expr} are in {list} cscope_connection( [{num} , {dbpath} [, {prepend}]]) Number checks existence of cscope connection -cursor( {lnum}, {col} [, {coladd}]) - Number move cursor to {lnum}, {col}, {coladd} +cursor( {lnum}, {col} [, {off}]) + Number move cursor to {lnum}, {col}, {off} cursor( {list}) Number move cursor to position in {list} deepcopy( {expr} [, {noref}]) any make a full copy of {expr} delete( {fname}) Number delete file {fname} @@ -2623,6 +2623,7 @@ cursor({list}) If {col} is zero, the cursor will stay in the current column. If {curswant} is given it is used to set the preferred column for vertical movement. Otherwise {col} is used. + When 'virtualedit' is used {off} specifies the offset in screen columns from the start of the character. E.g., a position within a or after the last character. @@ -4851,7 +4852,7 @@ readfile({fname} [, {binary} [, {max}]]) separated with CR will result in a single long line (unless a NL appears somewhere). All NUL characters are replaced with a NL character. - When {binary/append} is contains "b" binary mode is used: + When {binary/append} contains "b" binary mode is used: - When the last line ends in a NL an extra empty list item is added. - No CR characters are removed. diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index 727f6ac4b0..695d7ceb4f 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -1,4 +1,4 @@ -*quickref.txt* For Vim version 7.4. Last change: 2014 Oct 22 +*quickref.txt* For Vim version 7.4. Last change: 2014 Nov 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -764,6 +764,7 @@ Short explanation of each option: *option-list* 'keywordprg' 'kp' program to use for the "K" command 'langmap' 'lmap' alphabetic characters for other language mode 'langmenu' 'lm' language to be used for the menus +'langnoremap' 'lnr' do not apply 'langmap' to mapped characters 'laststatus' 'ls' tells when last window has status lines 'lazyredraw' 'lz' don't redraw while executing macros 'linebreak' 'lbr' wrap long lines at a blank diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index aa44d481d9..2957b29491 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Nov 13 +*todo.txt* For Vim version 7.4. Last change: 2014 Nov 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,8 +34,6 @@ not be repeated below, unless there is extra information. *known-bugs* -------------------- Known bugs and current work ----------------------- -Add langnoremap in quickref.txt and optwin.vim. - Regexp problems: - The NFA engine does not implement the time limit passed to nfa_regexec_multi() @@ -77,8 +75,6 @@ Patch by Marcin Szamotulski to add count to :close (2014 Aug 10, update Aug Doesn't look right, asked for updates. Update 2014 Nov 8. Replied with suggestions. -C macro with number highlighted wrong. (Dominique Pelle, 2014 Oct 23) - The entries added by matchaddpos() are returned by getmatches() but can't be set with setmatches(). (lcd47, 2014 Jun 29) @@ -88,14 +84,19 @@ Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) -Patch to fix issue 203. (Christian Brabandt, 2014 Oct 8) - Patch to fix issue 78. (Christian Brabandt, 2014 Oct 8) Patch to fix leak in map() with error. (Christian Brabandt, 2014 Oct 11) Patch to fix incsearch for "2/pattern/e". +Patch to fix memory leak in :hardcopy. (Christian Brabandt, 2014 Nov 16) + +Patch to fix warnings in if_ruby.c. (Ken Takata, 2014 Nov 17) + +Patch to make test 63 pass when in a B&W terminal. (Christian Brabandt, 2014 +Nov 15) Other patch (better) on Nov 17. + Change behavior of v:hlsearch? Patch from Christian, 2014 Oct 22. MS-Windows: When editing a file with a leading space, writing it uses the @@ -106,14 +107,16 @@ patch to remove FEAT_OSFILETYPE from fileio.c. (Christian, 2014 Nov 12) Value returned by virtcol() changes depending on how lines wrap. This is inconsistent with the documentation. -Fix for wrong formatting if 'linebreak' is set. (Christian Brabandt, 2014 Nov -12) +Patch to fix relatie numbers. (Christian Brabandt, 2014 Nov 17) + +Patch to fix wrong formatting if 'linebreak' is set. (Christian Brabandt, 2014 +Nov 12) Patch to support hex values for setting option value. (Zyx, 2015 Nov 6) -On MS-Windows running tests with Mercurial has problems when the input files -are changed. (Ken Takata, Taro Muraoka, 2014 Sep 25) +On MS-Windows running tests with Mercurial has problems when the fileformat of +the input files are changed. (Ken Takata, Taro Muraoka, 2014 Sep 25) Update Nov 5. MS-Windows: Crash opening very long file name starting with "\\". @@ -140,6 +143,10 @@ lines. (Marco Hinz, 2014 Nov 2) Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19) +Plugins need to make a lot of effort, lots of mappings, to know what happened +before pressing the key that triggers a plugin action. How about keeping the +last N pressed keys, so that they do not need to be mapped? + Can assign to s:type when a function s:type has been defined. Also the other way around: define a function while a variable with that name was already defined. @@ -152,6 +159,10 @@ Patch for building a 32bit Vim with 64bit MingW compiler. Delete old code in os_msdos.c, mch_FullName(). +Redo only remembers the last change. Could use "{count}g." to redo an older +change. How does the user know which change? At least have a way to list +them: ":repeats". + Using "." to repeat an Ex command puts that command in history. Probably should not happen. If the command is the result of a mapping it's not put in history either. (Jacob Niehus, 2014 Nov 2) @@ -289,12 +300,8 @@ Patch to add v:completed_item. (Shougo Matsu, 2013 Nov 29). Patch to get MSVC version in a nicer way. (Ken Takata, 2014 Jul 24) -Patch to make test 100 work on MS-Windows. (Taro Muraoka, 2013 Dec 12) - Patch to define macros for hardcoded values. (Elias Diem, 2013 Dec 14) -Perl: support for Activestate perl 5.18: Issue 170. - Several syntax file match "^\s*" which may get underlined if that's in the highlight group. Add a "\zs" after it? @@ -439,9 +446,6 @@ Update by Daniel Hahler, 2014 Jul 4, Aug 14, Oct 14, Oct 15. Patch to make fold updates much faster. (Christian Brabandt, 2012 Dec) -MS-Windows: Patch to make tests copy files to avoid changing the fileformat of -the files under version control. (Taro Muraoka, 2013 Jul 5) - Issue 54: document behavior of -complete, also expands arg. - Add regex for 'paragraphs' and 'sections': 'parare' and 'sectre'. Combine @@ -1560,8 +1564,6 @@ Changes for Win32 makefile. (Mike Williams, 2007 Jan 22, Alexei Alexandrov, Win32: Can't complete shell command names. Why is setting xp_context in set_one_cmd_context() inside #ifndef BACKSLASH_IN_FILENAME? -Win32: Patch for convert_filterW(). (Taro Muraoka, 2007 Mar 2) - Win32: Patch for cscope external command. (Mike Williams, 2007 Aug 7) Win32: XPM support only works with path without spaces. Patch by Mathias diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 35f99c537c..55353ce669 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar -" Last Change: 2014 Oct 09 +" Last Change: 2014 Nov 19 " If there already is an option window, jump to that one. if bufwinnr("option-window") > 0 @@ -149,7 +149,7 @@ setlocal ts=15 tw=0 noro buftype=nofile call append(0, '" Each "set" line shows the current value of an option (on the left).') call append(1, '" Hit on a "set" line to execute it.') call append(2, '" A boolean option will be toggled.') -call append(3, '" For other options you can edit the value.') +call append(3, '" For other options you can edit the value before hitting .') call append(4, '" Hit on a help line to open a help window on this option.') call append(5, '" Hit on an index line to jump there.') call append(6, '" Hit on a "set" line to refresh it.') @@ -1194,8 +1194,10 @@ if has("keymap") call OptionL("kmp") endif if has("langmap") - call append("$", "langmap\ttranslate characters for Normal mode") + call append("$", "langmap\tlist of characters that are translated in Normal mode") call OptionG("lmap", &lmap) + call append("$", "langnoremap\tdon't apply 'langmap' to mapped characters") + call BinOptionG("lnr", &lnr) endif if has("xim") call append("$", "imdisable\twhen set never use IM; overrules following IM options") diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index 2e54b8c42a..128e1a2a4a 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar -" Last Change: 2014 Sep 23 +" Last Change: 2014 Nov 13 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -61,10 +61,9 @@ else syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell endif -syn region cCppOut2 contained start="0" end="^\s*\(%:\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=cSpaceError,cCppSkip syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip -syn cluster cStringGroup contains=cCppString,cCppOut2,cCppSkip +syn cluster cStringGroup contains=cCppString,cCppSkip syn match cCharacter "L\='[^\\]'" syn match cCharacter "L'[^']*'" contains=cSpecial @@ -462,8 +461,7 @@ hi def link cTodo Todo hi def link cBadContinuation Error hi def link cCppOutSkip cCppOutIf2 hi def link cCppInElse2 cCppOutIf2 -hi def link cCppOutIf2 cCppOut2 " Old syntax group for #if 0 body -hi def link cCppOut2 cCppOut " Old syntax group for #if of #if 0 +hi def link cCppOutIf2 cCppOut hi def link cCppOut Comment let b:current_syntax = "c" From 07ee0bc96e8594da37624cce00f95b94b399c766 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 19 Nov 2014 16:33:16 +0100 Subject: [PATCH 202/311] updated for version 7.4.524 Problem: When using ":ownsyntax" spell checking is messed up. (Issue 78) Solution: Use the window-local option values. (Christian Brabandt) --- src/option.c | 9 +++++---- src/syntax.c | 3 +-- src/version.c | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/option.c b/src/option.c index 6841d42d6c..a97dae6262 100644 --- a/src/option.c +++ b/src/option.c @@ -6706,15 +6706,16 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, #ifdef FEAT_SPELL /* When 'spelllang' or 'spellfile' is set and there is a window for this * buffer in which 'spell' is set load the wordlists. */ - else if (varp == &(curbuf->b_s.b_p_spl) || varp == &(curbuf->b_s.b_p_spf)) + else if (varp == &(curwin->w_s->b_p_spl) + || varp == &(curwin->w_s->b_p_spf)) { win_T *wp; int l; - if (varp == &(curbuf->b_s.b_p_spf)) + if (varp == &(curwin->w_s->b_p_spf)) { - l = (int)STRLEN(curbuf->b_s.b_p_spf); - if (l > 0 && (l < 4 || STRCMP(curbuf->b_s.b_p_spf + l - 4, + l = (int)STRLEN(curwin->w_s->b_p_spf); + if (l > 0 && (l < 4 || STRCMP(curwin->w_s->b_p_spf + l - 4, ".add") != 0)) errmsg = e_invarg; } diff --git a/src/syntax.c b/src/syntax.c index fcd20c8ace..4f6ef924b4 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -6304,11 +6304,10 @@ ex_ownsyntax(eap) curwin->w_s = (synblock_T *)alloc(sizeof(synblock_T)); memset(curwin->w_s, 0, sizeof(synblock_T)); #ifdef FEAT_SPELL + /* TODO: keep the spell checking as it was. */ curwin->w_p_spell = FALSE; /* No spell checking */ clear_string_option(&curwin->w_s->b_p_spc); clear_string_option(&curwin->w_s->b_p_spf); - vim_regfree(curwin->w_s->b_cap_prog); - curwin->w_s->b_cap_prog = NULL; clear_string_option(&curwin->w_s->b_p_spl); #endif } diff --git a/src/version.c b/src/version.c index cc3bb24356..890a49bf0b 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 524, /**/ 523, /**/ From d7d6255579d2f05dfff5c0d8278c33fc67fe5e69 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 19 Nov 2014 17:04:48 +0100 Subject: [PATCH 203/311] updated for version 7.4.525 Problem: map() leaks memory when there is an error in the expression. Solution: Call clear_tv(). (Christian Brabandt) --- src/eval.c | 9 ++++++--- src/version.c | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/eval.c b/src/eval.c index c7cc0089d3..840e1e8f82 100644 --- a/src/eval.c +++ b/src/eval.c @@ -10720,18 +10720,20 @@ filter_map(argvars, rettv, map) { if (!HASHITEM_EMPTY(hi)) { + int r; + --todo; di = HI2DI(hi); if (tv_check_lock(di->di_tv.v_lock, (char_u *)_(arg_errmsg))) break; vimvars[VV_KEY].vv_str = vim_strsave(di->di_key); - if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL - || did_emsg) + r = filter_map_one(&di->di_tv, expr, map, &rem); + clear_tv(&vimvars[VV_KEY].vv_tv); + if (r == FAIL || did_emsg) break; if (!map && rem) dictitem_remove(d, di); - clear_tv(&vimvars[VV_KEY].vv_tv); } } hash_unlock(ht); @@ -10782,6 +10784,7 @@ filter_map_one(tv, expr, map, remp) if (*s != NUL) /* check for trailing chars after expr */ { EMSG2(_(e_invexpr2), s); + clear_tv(&rettv); goto theend; } if (map) diff --git a/src/version.c b/src/version.c index 890a49bf0b..f65867c43f 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 525, /**/ 524, /**/ From 6e849492c452459897d8ce74252e220c92deeff5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 20 Nov 2014 20:07:05 +0100 Subject: [PATCH 204/311] updated for version 7.4.526 Problem: matchstr() fails on long text. Daniel Hahler) Solution: Return NFA_TOO_EXPENSIVE from regexec_nl(). (Christian Brabandt) --- src/regexp.c | 25 +++++++++++++------------ src/version.c | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/regexp.c b/src/regexp.c index fe28dc6845..d36ac49bb6 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -3739,7 +3739,7 @@ static int bt_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, in * Uses curbuf for line count and 'iskeyword'. * if "line_lbr" is TRUE consider a "\n" in "line" to be a line break. * - * Return TRUE if there is a match, FALSE if not. + * Returns 0 for failure, number of lines contained in the match otherwise. */ static int bt_regexec_nl(rmp, line, col, line_lbr) @@ -3759,7 +3759,8 @@ bt_regexec_nl(rmp, line, col, line_lbr) ireg_icombine = FALSE; #endif ireg_maxcol = 0; - return (bt_regexec_both(line, col, NULL) != 0); + + return bt_regexec_both(line, col, NULL); } static long bt_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm)); @@ -3781,8 +3782,6 @@ bt_regexec_multi(rmp, win, buf, lnum, col, tm) colnr_T col; /* column to start looking for match */ proftime_T *tm; /* timeout limit or NULL */ { - long r; - reg_match = NULL; reg_mmatch = rmp; reg_buf = buf; @@ -3796,14 +3795,13 @@ bt_regexec_multi(rmp, win, buf, lnum, col, tm) #endif ireg_maxcol = rmp->rmm_maxcol; - r = bt_regexec_both(NULL, col, tm); - - return r; + return bt_regexec_both(NULL, col, tm); } /* * Match a regexp against a string ("line" points to the string) or multiple * lines ("line" is NULL, use reg_getline()). + * Returns 0 for failure, number of lines contained in the match otherwise. */ static long bt_regexec_both(line, col, tm) @@ -3811,9 +3809,9 @@ bt_regexec_both(line, col, tm) colnr_T col; /* column to start looking for match */ proftime_T *tm UNUSED; /* timeout limit or NULL */ { - bt_regprog_T *prog; - char_u *s; - long retval = 0L; + bt_regprog_T *prog; + char_u *s; + long retval = 0L; /* Create "regstack" and "backpos" if they are not allocated yet. * We allocate *_INITIAL amount of bytes first and then set the grow size @@ -8201,11 +8199,12 @@ vim_regexec_both(rmp, line, col, nl) p_re = save_p_re; } - return result; + return result > 0; } /* * Note: "*prog" may be freed and changed. + * Return TRUE if there is a match, FALSE if not. */ int vim_regexec_prog(prog, ignore_case, line, col) @@ -8226,6 +8225,7 @@ vim_regexec_prog(prog, ignore_case, line, col) /* * Note: "rmp->regprog" may be freed and changed. + * Return TRUE if there is a match, FALSE if not. */ int vim_regexec(rmp, line, col) @@ -8241,6 +8241,7 @@ vim_regexec(rmp, line, col) /* * Like vim_regexec(), but consider a "\n" in "line" to be a line break. * Note: "rmp->regprog" may be freed and changed. + * Return TRUE if there is a match, FALSE if not. */ int vim_regexec_nl(rmp, line, col) @@ -8297,5 +8298,5 @@ vim_regexec_multi(rmp, win, buf, lnum, col, tm) p_re = save_p_re; } - return result; + return result <= 0 ? 0 : result; } diff --git a/src/version.c b/src/version.c index f65867c43f..80e2d35ac8 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 526, /**/ 525, /**/ From 1316a73ba545b80692403f9aab59f22f847c469f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Nov 2014 12:57:49 +0100 Subject: [PATCH 205/311] updated for version 7.4.527 Problem: Still confusing regexp failure and NFA_TOO_EXPENSIVE. Solution: NFA changes equivalent of 7.4.526. --- src/regexp_nfa.c | 10 +++++----- src/version.c | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 91316094b5..8e069f3519 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -6767,7 +6767,7 @@ theend: /* * Try match of "prog" with at regline["col"]. - * Returns 0 for failure, number of lines contained in the match otherwise. + * Returns <= 0 for failure, number of lines contained in the match otherwise. */ static long nfa_regtry(prog, col) @@ -6897,7 +6897,7 @@ nfa_regtry(prog, col) * Match a regexp against a string ("line" points to the string) or multiple * lines ("line" is NULL, use reg_getline()). * - * Returns 0 for failure, number of lines contained in the match otherwise. + * Returns <= 0 for failure, number of lines contained in the match otherwise. */ static long nfa_regexec_both(line, startcol) @@ -7137,7 +7137,7 @@ nfa_regfree(prog) * Uses curbuf for line count and 'iskeyword'. * If "line_lbr" is TRUE consider a "\n" in "line" to be a line break. * - * Return TRUE if there is a match, FALSE if not. + * Returns <= 0 for failure, number of lines contained in the match otherwise. */ static int nfa_regexec_nl(rmp, line, col, line_lbr) @@ -7157,7 +7157,7 @@ nfa_regexec_nl(rmp, line, col, line_lbr) ireg_icombine = FALSE; #endif ireg_maxcol = 0; - return (nfa_regexec_both(line, col) != 0); + return nfa_regexec_both(line, col); } @@ -7166,7 +7166,7 @@ nfa_regexec_nl(rmp, line, col, line_lbr) * "rmp->regprog" is a compiled regexp as returned by vim_regcomp(). * Uses curbuf for line count and 'iskeyword'. * - * Return zero if there is no match. Return number of lines contained in the + * Return <= 0 if there is no match. Return number of lines contained in the * match otherwise. * * Note: the body is the same as bt_regexec() except for nfa_regexec_both() diff --git a/src/version.c b/src/version.c index 80e2d35ac8..a3adca86a4 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 527, /**/ 526, /**/ From b9d92bb8d5e8bc440d4cb3c0f1a22598ce281f80 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 10:37:10 +0100 Subject: [PATCH 206/311] updated for version 7.4.528 Problem: Crash when using matchadd() (Yasuhiro Matsumoto) Solution: Copy the match regprog. --- src/screen.c | 10 ++++++++++ src/version.c | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/screen.c b/src/screen.c index e11bdc3775..d395138628 100644 --- a/src/screen.c +++ b/src/screen.c @@ -7588,6 +7588,12 @@ next_search_hl(win, shl, lnum, mincol, cur) shl->lnum = lnum; if (shl->rm.regprog != NULL) { + /* Remember whether shl->rm is using a copy of the regprog in + * cur->match. */ + int regprog_is_copy = (shl != &search_hl && cur != NULL + && shl == &cur->hl + && cur->match.regprog == cur->hl.rm.regprog); + nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol, #ifdef FEAT_RELTIME @@ -7596,6 +7602,10 @@ next_search_hl(win, shl, lnum, mincol, cur) NULL #endif ); + /* Copy the regprog, in case it got freed and recompiled. */ + if (regprog_is_copy) + cur->match.regprog = cur->hl.rm.regprog; + if (called_emsg || got_int) { /* Error while handling regexp: stop using this regexp. */ diff --git a/src/version.c b/src/version.c index a3adca86a4..c674ce1917 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 528, /**/ 527, /**/ From ebaf80d5c0056e1d7c8858e92fda52f2359216de Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 11:09:13 +0100 Subject: [PATCH 207/311] updated for version 7.4.529 Problem: No test for what 7.4.517 fixes. Solution: Adjust the tests for breakindent. (Christian Brabandt) --- src/testdir/test_breakindent.in | 38 ++++++++++++++++++++------------- src/testdir/test_breakindent.ok | 8 ++++++- src/version.c | 2 ++ 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/testdir/test_breakindent.in b/src/testdir/test_breakindent.in index 150c9430db..a255457b2e 100644 --- a/src/testdir/test_breakindent.in +++ b/src/testdir/test_breakindent.in @@ -6,18 +6,18 @@ STARTTEST :10new|:vsp|:vert resize 20 :put =\"\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP\" :set ts=4 sw=4 sts=4 breakindent -:fu! ScreenChar(width) +:fu! ScreenChar(line, width) : let c='' : for i in range(1,a:width) -: let c.=nr2char(screenchar(line('.'), i)) +: let c.=nr2char(screenchar(a:line, i)) : endfor : let c.="\n" : for i in range(1,a:width) -: let c.=nr2char(screenchar(line('.')+1, i)) +: let c.=nr2char(screenchar(a:line+1, i)) : endfor : let c.="\n" : for i in range(1,a:width) -: let c.=nr2char(screenchar(line('.')+2, i)) +: let c.=nr2char(screenchar(a:line+2, i)) : endfor : return c :endfu @@ -29,43 +29,43 @@ STARTTEST :endfu :set briopt=min:0 :let g:test="Test 1: Simple breakindent" -:let line1=ScreenChar(8) +:let line1=ScreenChar(line('.'),8) :call DoRecordScreen() :let g:test="Test 2: Simple breakindent + sbr=>>" :set sbr=>> -:let line1=ScreenChar(8) +:let line1=ScreenChar(line('.'),8) :call DoRecordScreen() :let g:test ="Test 3: Simple breakindent + briopt:sbr" :set briopt=sbr,min:0 sbr=++ -:let line1=ScreenChar(8) +:let line1=ScreenChar(line('.'),8) :call DoRecordScreen() :let g:test ="Test 4: Simple breakindent + min width: 18" :set sbr= briopt=min:18 -:let line1=ScreenChar(8) +:let line1=ScreenChar(line('.'),8) :call DoRecordScreen() :let g:test =" Test 5: Simple breakindent + shift by 2" :set briopt=shift:2,min:0 -:let line1=ScreenChar(8) +:let line1=ScreenChar(line('.'),8) :call DoRecordScreen() :let g:test=" Test 6: Simple breakindent + shift by -1" :set briopt=shift:-1,min:0 -:let line1=ScreenChar(8) +:let line1=ScreenChar(line('.'),8) :call DoRecordScreen() :let g:test=" Test 7: breakindent + shift by +1 + nu + sbr=? briopt:sbr" :set briopt=shift:1,sbr,min:0 nu sbr=? nuw=4 -:let line1=ScreenChar(10) +:let line1=ScreenChar(line('.'),10) :call DoRecordScreen() :let g:test=" Test 8: breakindent + shift:1 + nu + sbr=# list briopt:sbr" :set briopt=shift:1,sbr,min:0 nu sbr=# list -:let line1=ScreenChar(10) +:let line1=ScreenChar(line('.'),10) :call DoRecordScreen() :let g:test=" Test 9: breakindent + shift by +1 + 'nu' + sbr=# list" :set briopt-=sbr -:let line1=ScreenChar(10) +:let line1=ScreenChar(line('.'),10) :call DoRecordScreen() :let g:test=" Test 10: breakindent + shift by +1 + 'nu' + sbr=~ cpo+=n" :set cpo+=n sbr=~ nu nuw=4 nolist briopt=sbr,min:0 -:let line1=ScreenChar(10) +:let line1=ScreenChar(line('.'),10) :call DoRecordScreen() :wincmd p :let g:test="\n Test 11: strdisplaywidth when breakindent is on" @@ -74,6 +74,14 @@ STARTTEST :let width = strlen(text[1:])+indent(2)*4+strlen(&sbr)*3 " text wraps 3 times :$put =g:test :$put =printf(\"strdisplaywidth: %d == calculated: %d\", strdisplaywidth(text), width) +:let g:str="\t\t\t\t\t{" +:let g:test=" Test 12: breakindent + long indent" +:wincmd p +:set all& breakindent linebreak briopt=min:10 nu numberwidth=3 ts=4 +:$put =g:str +zt:let line1=ScreenChar(1,10) +:wincmd p +:call DoRecordScreen() :" :" Test, that the string " a\tb\tc\td\te" is correctly :" displayed in a 20 column wide window (see bug report @@ -87,7 +95,7 @@ fbgjyl:let line1 = @0 :?^\s*z fygjyl:let line2 = @0 :quit! -:$put ='Test 12: breakindent with wrapping Tab' +:$put ='Test 13: breakindent with wrapping Tab' :$put =line1 :$put =line2 :" diff --git a/src/testdir/test_breakindent.ok b/src/testdir/test_breakindent.ok index d89d424fb3..e50265ecdd 100644 --- a/src/testdir/test_breakindent.ok +++ b/src/testdir/test_breakindent.ok @@ -53,6 +53,12 @@ Test 4: Simple breakindent + min width: 18 Test 11: strdisplaywidth when breakindent is on strdisplaywidth: 46 == calculated: 64 -Test 12: breakindent with wrapping Tab + { + + Test 12: breakindent + long indent +56 + +~ +Test 13: breakindent with wrapping Tab d w diff --git a/src/version.c b/src/version.c index c674ce1917..2496defc2a 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 529, /**/ 528, /**/ From 0046856d17ee120526c0870737b59898b336cd84 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 13:22:48 +0100 Subject: [PATCH 208/311] updated for version 7.4.530 Problem: Many commands take a count or range that is not using line numbers. Solution: For each command specify what kind of count it uses. For windows, buffers and arguments have "$" and "." have a relevant meaning. (Marcin Szamotulski) --- runtime/doc/tabpage.txt | 49 +- runtime/doc/windows.txt | 83 +- src/Makefile | 5 +- src/ex_cmds.h | 1583 ++++++++++++++++++++++++------------ src/ex_docmd.c | 602 ++++++++++---- src/testdir/Make_amiga.mak | 4 + src/testdir/Make_dos.mak | 2 + src/testdir/Make_ming.mak | 2 + src/testdir/Make_os2.mak | 2 + src/testdir/Make_vms.mms | 10 +- src/testdir/Makefile | 2 + src/version.c | 2 + src/window.c | 18 +- 13 files changed, 1662 insertions(+), 702 deletions(-) diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index 3c7ad9fe28..b795dbe552 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -61,16 +61,25 @@ In the GUI tab pages line you can use the right mouse button to open menu. :[count]tabe[dit] *:tabe* *:tabedit* *:tabnew* :[count]tabnew Open a new tab page with an empty window, after the current - tab page. For [count] see |:tab| below. + tab page. If [count] is given the new tab page appears after + the tab page [count] otherwise the new tab page will appear + after the current one. > + :tabnew " opens tabpage after the current one + :.tabnew " as above + :+tabnew " opens tabpage after the next tab page + " note: it is one further than :tabnew + :-tabnew " opens tabpage before the current one + :0tabnew " opens tabpage before the first one + :$tabnew " opens tabpage after the last one :[count]tabe[dit] [++opt] [+cmd] {file} :[count]tabnew [++opt] [+cmd] {file} Open a new tab page and edit {file}, like with |:edit|. - For [count] see |:tab| below. + For [count] see |:tabnew| above. :[count]tabf[ind] [++opt] [+cmd] {file} *:tabf* *:tabfind* Open a new tab page and edit {file} in 'path', like with - |:find|. For [count] see |:tab| below. + |:find|. For [count] see |:tabnew| above. {not available when the |+file_in_path| feature was disabled at compile time} @@ -110,12 +119,18 @@ something else. - When 'hidden' is not set, [!] is not used, a buffer has changes, and there is no other window on this buffer. Changes to the buffer are not written and won't get lost, so - this is a "safe" command. + this is a "safe" command. > + :tabclose " close the current tab page +:{count}tabc[lose][!] :tabc[lose][!] {count} Close tab page {count}. Fails in the same way as `:tabclose` - above. - + above. > + :-tabclose " close the previous tab page + :+tabclose " close the next tab page + :1tabclose " close the first tab page + :$tabclose " close the last tab page +< *:tabo* *:tabonly* :tabo[nly][!] Close all other tab pages. When the 'hidden' option is set, all buffers in closed windows @@ -124,7 +139,17 @@ something else. modified buffers are written. Otherwise, windows that have buffers that are modified are not removed, unless the [!] is given, then they become hidden. But modified buffers are - never abandoned, so changes cannot get lost. + never abandoned, so changes cannot get lost. > + :tabonly " close all tab pages except the current + +:{count}tabo[nly][!] + Close all tab pages except the {count}th one. > + :.tabonly " one + :-tabonly " close all tab pages except the previous + " one + :+tabonly " close all tab pages except the next one + :1tabonly " close all tab pages except the first one + :$tabonly " close all tab pages except the last one SWITCHING TO ANOTHER TAB PAGE: @@ -176,7 +201,15 @@ REORDERING TAB PAGES: :[N]tabm[ove] Move the current tab page to after tab page N. Use zero to make the current tab page the first one. Without N the tab - page is made the last one. + page is made the last one. > + :-tabmove " move the tab page to the left + :tabmove " move the tab page to the right + :.tabmove " as above + :+tabmove " as above + :0tabmove " move the tab page to the begining of the tab + " list + :$tabmove " move the tab page to the end of the tab list +< :tabm[ove] +[N] :tabm[ove] -[N] diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 0098e3e521..d116c9f6c5 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -263,28 +263,56 @@ left of the Vim window. Closing a window ---------------- +:q[uit] +:{count}q[uit] CTRL-W q *CTRL-W_q* CTRL-W CTRL-Q *CTRL-W_CTRL-Q* -:q[uit] Quit current window. When quitting the last window (not - counting a help window), exit Vim. + Without {count}: Quit the current window. If {count} is + given quit the {count} window. + + When quitting the last window (not counting a help window), + exit Vim. + When 'hidden' is set, and there is only one window for the - current buffer, it becomes hidden. - When 'hidden' is not set, and there is only one window for the - current buffer, and the buffer was changed, the command fails. - (Note: CTRL-Q does not work on all terminals) + current buffer, it becomes hidden. When 'hidden' is not set, + and there is only one window for the current buffer, and the + buffer was changed, the command fails. + + (Note: CTRL-Q does not + work on all terminals). If [count] is greater than + the last window number the last window will be closed: > + :1quit " quit the first window + :$quit " quit the last window + :9quit " quit the last window + " if there are less than 9 windows opened + :-quit " quit the previews window + :+quit " quit the next window + :+2quit " will also work as expected +< +:q[uit]! +:{count}q[uit]! + Without {count}: Quit the current window. If {count} is + given quit the {count} window. -:q[uit]! Quit current window. If this was the last window for a buffer, - any changes to that buffer are lost. When quitting the last - window (not counting help windows), exit Vim. The contents of - the buffer are lost, even when 'hidden' is set. + If this was the last window for a buffer, any changes to that + buffer are lost. When quitting the last window (not counting + help windows), exit Vim. The contents of the buffer are lost, + even when 'hidden' is set. +:clo[se][!] +:{count}clo[se][!] CTRL-W c *CTRL-W_c* *:clo* *:close* -:clo[se][!] Close current window. When the 'hidden' option is set, or - when the buffer was changed and the [!] is used, the buffer - becomes hidden (unless there is another window editing it). + Without {count}: Close the current window. If {count} is + given close the {count} window. + + When the 'hidden' option is set, or when the buffer was + changed and the [!] is used, the buffer becomes hidden (unless + there is another window editing it). + When there is only one window in the current tab page and there is another tab page, this closes the current tab page. |tab-page|. + This command fails when: *E444* - There is only one window on the screen. - When 'hidden' is not set, [!] is not used, the buffer has @@ -298,14 +326,19 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C* command. *:hide* -:hid[e] Quit current window, unless it is the last window on the - screen. The buffer becomes hidden (unless there is another - window editing it or 'bufhidden' is "unload" or "delete"). - If the window is the last one in the current tab page the tab - page is closed. |tab-page| - The value of 'hidden' is irrelevant for this command. - Changes to the buffer are not written and won't get lost, so - this is a "safe" command. +:hid[e] +:{count}hid[e] + Quit the current window, unless it is the last window on the + screen. For {count} see |:quit| command. + + The buffer becomes hidden (unless there is another window + editing it or 'bufhidden' is "unload" or "delete"). If the + window is the last one in the current tab page the tab page is + closed. |tab-page| + + The value of 'hidden' is irrelevant for this command. Changes + to the buffer are not written and won't get lost, so this is a + "safe" command. :hid[e] {cmd} Execute {cmd} with 'hidden' is set. The previous value of 'hidden' is restored after {cmd} has been executed. @@ -314,12 +347,16 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C* < This will edit "Makefile", and hide the current buffer if it has any changes. +:on[ly][!] +:{count}on[ly][!] CTRL-W o *CTRL-W_o* *E445* CTRL-W CTRL-O *CTRL-W_CTRL-O* *:on* *:only* -:on[ly][!] Make the current window the only one on the screen. All other - windows are closed. + Make the current window the only one on the screen. All other + windows are closed. For {count} see |:quit| command. + When the 'hidden' option is set, all buffers in closed windows become hidden. + When 'hidden' is not set, and the 'autowrite' option is set, modified buffers are written. Otherwise, windows that have buffers that are modified are not removed, unless the [!] is diff --git a/src/Makefile b/src/Makefile index 6bf8c1737d..13fe70b1ad 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1890,10 +1890,12 @@ unittest unittests: $(UNITTEST_TARGETS) done # Run individual test, assuming that Vim was already compiled. -test1 test2 test3 test4 test5 test6 test7 test8 test9 \ +test1 \ + test_argument_count \ test_autoformat_join \ test_breakindent \ test_changelist \ + test_close_count \ test_eval \ test_insertcount \ test_listlbr \ @@ -1904,6 +1906,7 @@ test1 test2 test3 test4 test5 test6 test7 test8 test9 \ test_signs \ test_utf8 \ test_writefile \ + test2 test3 test4 test5 test6 test7 test8 test9 \ test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \ test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \ test30 test31 test32 test33 test34 test35 test36 test37 test38 test39 \ diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 93c77764a0..5574ea7bc2 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -58,6 +58,14 @@ #define WORD1 (EXTRA | NOSPC) /* one extra word allowed */ #define FILE1 (FILES | NOSPC) /* 1 file allowed, defaults to current file */ +/* values for cmd_addr_type */ +#define ADDR_LINES 0 +#define ADDR_WINDOWS 1 +#define ADDR_ARGUMENTS 2 +#define ADDR_LOADED_BUFFERS 3 +#define ADDR_UNLOADED_BUFFERS 4 +#define ADDR_TABS 5 + #ifndef DO_DECLARE_EXCMD typedef struct exarg exarg_T; #endif @@ -74,7 +82,7 @@ typedef struct exarg exarg_T; # undef EX /* just in case */ #endif #ifdef DO_DECLARE_EXCMD -# define EX(a, b, c, d) {(char_u *)b, c, (long_u)(d)} +# define EX(a, b, c, d, e) {(char_u *)b, c, (long_u)(d), e} typedef void (*ex_func_T) __ARGS((exarg_T *eap)); @@ -83,1064 +91,1588 @@ static struct cmdname char_u *cmd_name; /* name of the command */ ex_func_T cmd_func; /* function for this command */ long_u cmd_argt; /* flags declared above */ + int cmd_addr_type; /* flag for address type */ } # if defined(FEAT_GUI_W16) _far # endif cmdnames[] = #else -# define EX(a, b, c, d) a +# define EX(a, b, c, d, e) a enum CMD_index #endif { EX(CMD_append, "append", ex_append, - BANG|RANGE|ZEROR|TRLBAR|CMDWIN|MODIFY), + BANG|RANGE|ZEROR|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_abbreviate, "abbreviate", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_abclear, "abclear", ex_abclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_aboveleft, "aboveleft", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_all, "all", ex_all, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_amenu, "amenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_anoremenu, "anoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_args, "args", ex_args, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR), + BANG|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_argadd, "argadd", ex_argadd, - BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|TRLBAR), + BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|TRLBAR, + ADDR_ARGUMENTS), EX(CMD_argdelete, "argdelete", ex_argdelete, - BANG|RANGE|NOTADR|FILES|TRLBAR), + BANG|RANGE|NOTADR|FILES|TRLBAR, + ADDR_ARGUMENTS), EX(CMD_argdo, "argdo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM), + BANG|NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_argedit, "argedit", ex_argedit, - BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_ARGUMENTS), EX(CMD_argglobal, "argglobal", ex_args, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR), + BANG|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_arglocal, "arglocal", ex_args, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR), + BANG|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_argument, "argument", ex_argument, - BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR, + ADDR_ARGUMENTS), EX(CMD_ascii, "ascii", do_ascii, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_autocmd, "autocmd", ex_autocmd, - BANG|EXTRA|NOTRLCOM|USECTRLV|CMDWIN), + BANG|EXTRA|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_augroup, "augroup", ex_autocmd, - BANG|WORD1|TRLBAR|CMDWIN), + BANG|WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_aunmenu, "aunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_buffer, "buffer", ex_buffer, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR, + ADDR_UNLOADED_BUFFERS), EX(CMD_bNext, "bNext", ex_bprevious, - BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_ball, "ball", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_badd, "badd", ex_edit, - NEEDARG|FILE1|EDITCMD|TRLBAR|CMDWIN), + NEEDARG|FILE1|EDITCMD|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_bdelete, "bdelete", ex_bunload, - BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR, + ADDR_LOADED_BUFFERS), EX(CMD_behave, "behave", ex_behave, - NEEDARG|WORD1|TRLBAR|CMDWIN), + NEEDARG|WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_belowright, "belowright", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_bfirst, "bfirst", ex_brewind, - BANG|RANGE|NOTADR|EDITCMD|TRLBAR), + BANG|RANGE|NOTADR|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_blast, "blast", ex_blast, - BANG|RANGE|NOTADR|EDITCMD|TRLBAR), + BANG|RANGE|NOTADR|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_bmodified, "bmodified", ex_bmodified, - BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_bnext, "bnext", ex_bnext, - BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_botright, "botright", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_bprevious, "bprevious", ex_bprevious, - BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_brewind, "brewind", ex_brewind, - BANG|RANGE|NOTADR|EDITCMD|TRLBAR), + BANG|RANGE|NOTADR|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_break, "break", ex_break, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_breakadd, "breakadd", ex_breakadd, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_breakdel, "breakdel", ex_breakdel, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_breaklist, "breaklist", ex_breaklist, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_browse, "browse", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM|CMDWIN), + NEEDARG|EXTRA|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_buffers, "buffers", buflist_list, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_bufdo, "bufdo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM), + BANG|NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_bunload, "bunload", ex_bunload, - BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR, + ADDR_LOADED_BUFFERS), EX(CMD_bwipeout, "bwipeout", ex_bunload, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR, + ADDR_UNLOADED_BUFFERS), EX(CMD_change, "change", ex_change, - BANG|WHOLEFOLD|RANGE|COUNT|TRLBAR|CMDWIN|MODIFY), + BANG|WHOLEFOLD|RANGE|COUNT|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_cNext, "cNext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cNfile, "cNfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cabbrev, "cabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cabclear, "cabclear", ex_abclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_caddbuffer, "caddbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), + RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), EX(CMD_caddexpr, "caddexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), + NEEDARG|WORD1|NOTRLCOM|TRLBAR, + ADDR_LINES), EX(CMD_caddfile, "caddfile", ex_cfile, - TRLBAR|FILE1), + TRLBAR|FILE1, + ADDR_LINES), EX(CMD_call, "call", ex_call, - RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_catch, "catch", ex_catch, - EXTRA|SBOXOK|CMDWIN), + EXTRA|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_cbuffer, "cbuffer", ex_cbuffer, - BANG|RANGE|NOTADR|WORD1|TRLBAR), + BANG|RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), EX(CMD_cc, "cc", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cclose, "cclose", ex_cclose, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_cd, "cd", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_center, "center", ex_align, - TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), + TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_cexpr, "cexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG), + NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cfile, "cfile", ex_cfile, - TRLBAR|FILE1|BANG), + TRLBAR|FILE1|BANG, + ADDR_LINES), EX(CMD_cfirst, "cfirst", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cgetfile, "cgetfile", ex_cfile, - TRLBAR|FILE1), + TRLBAR|FILE1, + ADDR_LINES), EX(CMD_cgetbuffer, "cgetbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), + RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), EX(CMD_cgetexpr, "cgetexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), + NEEDARG|WORD1|NOTRLCOM|TRLBAR, + ADDR_LINES), EX(CMD_chdir, "chdir", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_changes, "changes", ex_changes, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_checkpath, "checkpath", ex_checkpath, - TRLBAR|BANG|CMDWIN), + TRLBAR|BANG|CMDWIN, + ADDR_LINES), EX(CMD_checktime, "checktime", ex_checktime, - RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR), + RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR, + ADDR_LINES), EX(CMD_clist, "clist", qf_list, - BANG|EXTRA|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_clast, "clast", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_close, "close", ex_close, - BANG|TRLBAR|CMDWIN), + BANG|RANGE|NOTADR|COUNT|TRLBAR|CMDWIN, + ADDR_WINDOWS), EX(CMD_cmap, "cmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cmapclear, "cmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_cmenu, "cmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cnext, "cnext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cnewer, "cnewer", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_cnfile, "cnfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cnoremap, "cnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cnoreabbrev, "cnoreabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cnoremenu, "cnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_copy, "copy", ex_copymove, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_colder, "colder", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_colorscheme, "colorscheme", ex_colorscheme, - WORD1|TRLBAR|CMDWIN), + WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_command, "command", ex_command, - EXTRA|BANG|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|BANG|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_comclear, "comclear", ex_comclear, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_compiler, "compiler", ex_compiler, - BANG|TRLBAR|WORD1|CMDWIN), + BANG|TRLBAR|WORD1|CMDWIN, + ADDR_LINES), EX(CMD_continue, "continue", ex_continue, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_confirm, "confirm", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM|CMDWIN), + NEEDARG|EXTRA|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_copen, "copen", ex_copen, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_cprevious, "cprevious", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cpfile, "cpfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cquit, "cquit", ex_cquit, - TRLBAR|BANG), + TRLBAR|BANG, + ADDR_LINES), EX(CMD_crewind, "crewind", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_cscope, "cscope", do_cscope, - EXTRA|NOTRLCOM|XFILE), + EXTRA|NOTRLCOM|XFILE, + ADDR_LINES), EX(CMD_cstag, "cstag", do_cstag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_cunmap, "cunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cunabbrev, "cunabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cunmenu, "cunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_cwindow, "cwindow", ex_cwindow, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_delete, "delete", ex_operators, - RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_delmarks, "delmarks", ex_delmarks, - BANG|EXTRA|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_debug, "debug", ex_debug, - NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_debuggreedy, "debuggreedy", ex_debuggreedy, - RANGE|NOTADR|ZEROR|TRLBAR|CMDWIN), + RANGE|NOTADR|ZEROR|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_delcommand, "delcommand", ex_delcommand, - NEEDARG|WORD1|TRLBAR|CMDWIN), + NEEDARG|WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_delfunction, "delfunction", ex_delfunction, - NEEDARG|WORD1|CMDWIN), + NEEDARG|WORD1|CMDWIN, + ADDR_LINES), EX(CMD_display, "display", ex_display, - EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_diffupdate, "diffupdate", ex_diffupdate, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_diffget, "diffget", ex_diffgetput, - RANGE|EXTRA|TRLBAR|MODIFY), + RANGE|EXTRA|TRLBAR|MODIFY, + ADDR_LINES), EX(CMD_diffoff, "diffoff", ex_diffoff, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_diffpatch, "diffpatch", ex_diffpatch, - EXTRA|FILE1|TRLBAR|MODIFY), + EXTRA|FILE1|TRLBAR|MODIFY, + ADDR_LINES), EX(CMD_diffput, "diffput", ex_diffgetput, - RANGE|EXTRA|TRLBAR), + RANGE|EXTRA|TRLBAR, + ADDR_LINES), EX(CMD_diffsplit, "diffsplit", ex_diffsplit, - EXTRA|FILE1|TRLBAR), + EXTRA|FILE1|TRLBAR, + ADDR_LINES), EX(CMD_diffthis, "diffthis", ex_diffthis, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_digraphs, "digraphs", ex_digraphs, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_djump, "djump", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA, + ADDR_LINES), EX(CMD_dlist, "dlist", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_doautocmd, "doautocmd", ex_doautocmd, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_doautoall, "doautoall", ex_doautoall, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_drop, "drop", ex_drop, - FILES|EDITCMD|NEEDARG|ARGOPT|TRLBAR), + FILES|EDITCMD|NEEDARG|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_dsearch, "dsearch", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_dsplit, "dsplit", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA, + ADDR_LINES), EX(CMD_edit, "edit", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_earlier, "earlier", ex_later, - TRLBAR|EXTRA|NOSPC|CMDWIN), + TRLBAR|EXTRA|NOSPC|CMDWIN, + ADDR_LINES), EX(CMD_echo, "echo", ex_echo, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_echoerr, "echoerr", ex_execute, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_echohl, "echohl", ex_echohl, - EXTRA|TRLBAR|SBOXOK|CMDWIN), + EXTRA|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_echomsg, "echomsg", ex_execute, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_echon, "echon", ex_echo, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_else, "else", ex_else, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_elseif, "elseif", ex_else, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_emenu, "emenu", ex_emenu, - NEEDARG|EXTRA|TRLBAR|NOTRLCOM|RANGE|NOTADR|CMDWIN), + NEEDARG|EXTRA|TRLBAR|NOTRLCOM|RANGE|NOTADR|CMDWIN, + ADDR_LINES), EX(CMD_endif, "endif", ex_endif, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_endfunction, "endfunction", ex_endfunction, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_endfor, "endfor", ex_endwhile, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_endtry, "endtry", ex_endtry, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_endwhile, "endwhile", ex_endwhile, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_enew, "enew", ex_edit, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_ex, "ex", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_execute, "execute", ex_execute, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_exit, "exit", ex_exit, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_exusage, "exusage", ex_exusage, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_file, "file", ex_file, - RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR), + RANGE|NOTADR|ZEROR|BANG|FILE1|TRLBAR, + ADDR_LINES), EX(CMD_files, "files", buflist_list, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_filetype, "filetype", ex_filetype, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_find, "find", ex_find, - RANGE|NOTADR|BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + RANGE|NOTADR|BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_finally, "finally", ex_finally, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_finish, "finish", ex_finish, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_first, "first", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_fixdel, "fixdel", do_fixdel, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_fold, "fold", ex_fold, - RANGE|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN), + RANGE|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_foldclose, "foldclose", ex_foldopen, - RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN), + RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_folddoopen, "folddoopen", ex_folddo, - RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM), + RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_folddoclosed, "folddoclosed", ex_folddo, - RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM), + RANGE|DFLALL|NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_foldopen, "foldopen", ex_foldopen, - RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN), + RANGE|BANG|WHOLEFOLD|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_for, "for", ex_while, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_function, "function", ex_function, - EXTRA|BANG|CMDWIN), + EXTRA|BANG|CMDWIN, + ADDR_LINES), EX(CMD_global, "global", ex_global, - RANGE|WHOLEFOLD|BANG|EXTRA|DFLALL|SBOXOK|CMDWIN), + RANGE|WHOLEFOLD|BANG|EXTRA|DFLALL|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_goto, "goto", ex_goto, - RANGE|NOTADR|COUNT|TRLBAR|SBOXOK|CMDWIN), + RANGE|NOTADR|COUNT|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_grep, "grep", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_grepadd, "grepadd", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_gui, "gui", ex_gui, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN), + BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_gvim, "gvim", ex_gui, - BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN), + BANG|FILES|EDITCMD|ARGOPT|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_help, "help", ex_help, - BANG|EXTRA|NOTRLCOM), + BANG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_helpclose, "helpclose", ex_helpclose, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_helpfind, "helpfind", ex_helpfind, - EXTRA|NOTRLCOM), + EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_helpgrep, "helpgrep", ex_helpgrep, - EXTRA|NOTRLCOM|NEEDARG), + EXTRA|NOTRLCOM|NEEDARG, + ADDR_LINES), EX(CMD_helptags, "helptags", ex_helptags, - NEEDARG|FILES|TRLBAR|CMDWIN), + NEEDARG|FILES|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_hardcopy, "hardcopy", ex_hardcopy, - RANGE|COUNT|EXTRA|TRLBAR|DFLALL|BANG), + RANGE|COUNT|EXTRA|TRLBAR|DFLALL|BANG, + ADDR_LINES), EX(CMD_highlight, "highlight", ex_highlight, - BANG|EXTRA|TRLBAR|SBOXOK|CMDWIN), + BANG|EXTRA|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_hide, "hide", ex_hide, - BANG|EXTRA|NOTRLCOM), + BANG|RANGE|NOTADR|COUNT|EXTRA|NOTRLCOM, + ADDR_WINDOWS), EX(CMD_history, "history", ex_history, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_insert, "insert", ex_append, - BANG|RANGE|TRLBAR|CMDWIN|MODIFY), + BANG|RANGE|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_iabbrev, "iabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_iabclear, "iabclear", ex_abclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_if, "if", ex_if, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_ijump, "ijump", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA, + ADDR_LINES), EX(CMD_ilist, "ilist", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_imap, "imap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_imapclear, "imapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_imenu, "imenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_inoremap, "inoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_inoreabbrev, "inoreabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_inoremenu, "inoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_intro, "intro", ex_intro, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_isearch, "isearch", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_isplit, "isplit", ex_findpat, - BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA), + BANG|RANGE|DFLALL|WHOLEFOLD|EXTRA, + ADDR_LINES), EX(CMD_iunmap, "iunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_iunabbrev, "iunabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_iunmenu, "iunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_join, "join", ex_join, - BANG|RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY), + BANG|RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_jumps, "jumps", ex_jumps, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_k, "k", ex_mark, - RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN), + RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_keepmarks, "keepmarks", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_keepjumps, "keepjumps", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_keeppatterns, "keeppatterns", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_keepalt, "keepalt", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_list, "list", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lNext, "lNext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lNfile, "lNfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_last, "last", ex_last, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_language, "language", ex_language, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_laddexpr, "laddexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), + NEEDARG|WORD1|NOTRLCOM|TRLBAR, + ADDR_LINES), EX(CMD_laddbuffer, "laddbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), + RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), EX(CMD_laddfile, "laddfile", ex_cfile, - TRLBAR|FILE1), + TRLBAR|FILE1, + ADDR_LINES), EX(CMD_later, "later", ex_later, - TRLBAR|EXTRA|NOSPC|CMDWIN), + TRLBAR|EXTRA|NOSPC|CMDWIN, + ADDR_LINES), EX(CMD_lbuffer, "lbuffer", ex_cbuffer, - BANG|RANGE|NOTADR|WORD1|TRLBAR), + BANG|RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), EX(CMD_lcd, "lcd", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lchdir, "lchdir", ex_cd, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lclose, "lclose", ex_cclose, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_lcscope, "lcscope", do_cscope, - EXTRA|NOTRLCOM|XFILE), + EXTRA|NOTRLCOM|XFILE, + ADDR_LINES), EX(CMD_left, "left", ex_align, - TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), + TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_leftabove, "leftabove", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_let, "let", ex_let, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_lexpr, "lexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG), + NEEDARG|WORD1|NOTRLCOM|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lfile, "lfile", ex_cfile, - TRLBAR|FILE1|BANG), + TRLBAR|FILE1|BANG, + ADDR_LINES), EX(CMD_lfirst, "lfirst", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lgetfile, "lgetfile", ex_cfile, - TRLBAR|FILE1), + TRLBAR|FILE1, + ADDR_LINES), EX(CMD_lgetbuffer, "lgetbuffer", ex_cbuffer, - RANGE|NOTADR|WORD1|TRLBAR), + RANGE|NOTADR|WORD1|TRLBAR, + ADDR_LINES), EX(CMD_lgetexpr, "lgetexpr", ex_cexpr, - NEEDARG|WORD1|NOTRLCOM|TRLBAR), + NEEDARG|WORD1|NOTRLCOM|TRLBAR, + ADDR_LINES), EX(CMD_lgrep, "lgrep", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_lgrepadd, "lgrepadd", ex_make, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_lhelpgrep, "lhelpgrep", ex_helpgrep, - EXTRA|NOTRLCOM|NEEDARG), + EXTRA|NOTRLCOM|NEEDARG, + ADDR_LINES), EX(CMD_ll, "ll", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_llast, "llast", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_llist, "llist", qf_list, - BANG|EXTRA|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lmap, "lmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_lmapclear, "lmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lmake, "lmake", ex_make, - BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_lnoremap, "lnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_lnext, "lnext", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lnewer, "lnewer", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_lnfile, "lnfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_loadview, "loadview", ex_loadview, - FILE1|TRLBAR), + FILE1|TRLBAR, + ADDR_LINES), EX(CMD_loadkeymap, "loadkeymap", ex_loadkeymap, - CMDWIN), + CMDWIN, + ADDR_LINES), EX(CMD_lockmarks, "lockmarks", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_lockvar, "lockvar", ex_lockvar, - BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN), + BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_lolder, "lolder", qf_age, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_lopen, "lopen", ex_copen, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_lprevious, "lprevious", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lpfile, "lpfile", ex_cnext, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_lrewind, "lrewind", ex_cc, - RANGE|NOTADR|COUNT|TRLBAR|BANG), + RANGE|NOTADR|COUNT|TRLBAR|BANG, + ADDR_LINES), EX(CMD_ltag, "ltag", ex_tag, - NOTADR|TRLBAR|BANG|WORD1), + NOTADR|TRLBAR|BANG|WORD1, + ADDR_LINES), EX(CMD_lunmap, "lunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_lua, "lua", ex_lua, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_luado, "luado", ex_luado, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_luafile, "luafile", ex_luafile, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_lvimgrep, "lvimgrep", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_lvimgrepadd, "lvimgrepadd", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_lwindow, "lwindow", ex_cwindow, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_ls, "ls", buflist_list, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_move, "move", ex_copymove, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_mark, "mark", ex_mark, - RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN), + RANGE|WORD1|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_make, "make", ex_make, - BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + BANG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_map, "map", ex_map, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_mapclear, "mapclear", ex_mapclear, - EXTRA|BANG|TRLBAR|CMDWIN), + EXTRA|BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_marks, "marks", do_marks, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_match, "match", ex_match, - RANGE|NOTADR|EXTRA|CMDWIN), + RANGE|NOTADR|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_menu, "menu", ex_menu, - RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_menutranslate, "menutranslate", ex_menutranslate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_messages, "messages", ex_messages, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_mkexrc, "mkexrc", ex_mkrc, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_mksession, "mksession", ex_mkrc, - BANG|FILE1|TRLBAR), + BANG|FILE1|TRLBAR, + ADDR_LINES), EX(CMD_mkspell, "mkspell", ex_mkspell, - BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_mkvimrc, "mkvimrc", ex_mkrc, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_mkview, "mkview", ex_mkrc, - BANG|FILE1|TRLBAR), + BANG|FILE1|TRLBAR, + ADDR_LINES), EX(CMD_mode, "mode", ex_mode, - WORD1|TRLBAR|CMDWIN), + WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_mzscheme, "mzscheme", ex_mzscheme, - RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN|SBOXOK), + RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN|SBOXOK, + ADDR_LINES), EX(CMD_mzfile, "mzfile", ex_mzfile, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_next, "next", ex_next, - RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR), + RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_nbkey, "nbkey", ex_nbkey, - EXTRA|NOTADR|NEEDARG), + EXTRA|NOTADR|NEEDARG, + ADDR_LINES), EX(CMD_nbclose, "nbclose", ex_nbclose, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_nbstart, "nbstart", ex_nbstart, - WORD1|TRLBAR|CMDWIN), + WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_new, "new", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_nmap, "nmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_nmapclear, "nmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_nmenu, "nmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_nnoremap, "nnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_nnoremenu, "nnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_noremap, "noremap", ex_map, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_noautocmd, "noautocmd", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_nohlsearch, "nohlsearch", ex_nohlsearch, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_noreabbrev, "noreabbrev", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_noremenu, "noremenu", ex_menu, - RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_noswapfile, "noswapfile", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_normal, "normal", ex_normal, - RANGE|BANG|EXTRA|NEEDARG|NOTRLCOM|USECTRLV|SBOXOK|CMDWIN), + RANGE|BANG|EXTRA|NEEDARG|NOTRLCOM|USECTRLV|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_number, "number", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_nunmap, "nunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_nunmenu, "nunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_open, "open", ex_open, - RANGE|BANG|EXTRA), + RANGE|BANG|EXTRA, + ADDR_LINES), EX(CMD_oldfiles, "oldfiles", ex_oldfiles, - BANG|TRLBAR|SBOXOK|CMDWIN), + BANG|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_omap, "omap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_omapclear, "omapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_omenu, "omenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_only, "only", ex_only, - BANG|TRLBAR), + BANG|NOTADR|RANGE|COUNT|TRLBAR, + ADDR_WINDOWS), EX(CMD_onoremap, "onoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_onoremenu, "onoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_options, "options", ex_options, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_ounmap, "ounmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_ounmenu, "ounmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_ownsyntax, "ownsyntax", ex_ownsyntax, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_print, "print", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK, + ADDR_LINES), EX(CMD_pclose, "pclose", ex_pclose, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_perl, "perl", ex_perl, - RANGE|EXTRA|DFLALL|NEEDARG|SBOXOK|CMDWIN), + RANGE|EXTRA|DFLALL|NEEDARG|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_perldo, "perldo", ex_perldo, - RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN), + RANGE|EXTRA|DFLALL|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_pedit, "pedit", ex_pedit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_pop, "pop", ex_tag, - RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_popup, "popup", ex_popup, - NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN), + NEEDARG|EXTRA|BANG|TRLBAR|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_ppop, "ppop", ex_ptag, - RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|COUNT|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_preserve, "preserve", ex_preserve, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_previous, "previous", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_promptfind, "promptfind", gui_mch_find_dialog, - EXTRA|NOTRLCOM|CMDWIN), + EXTRA|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_promptrepl, "promptrepl", gui_mch_replace_dialog, - EXTRA|NOTRLCOM|CMDWIN), + EXTRA|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_profile, "profile", ex_profile, - BANG|EXTRA|TRLBAR|CMDWIN), + BANG|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_profdel, "profdel", ex_breakdel, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_psearch, "psearch", ex_psearch, - BANG|RANGE|WHOLEFOLD|DFLALL|EXTRA), + BANG|RANGE|WHOLEFOLD|DFLALL|EXTRA, + ADDR_LINES), EX(CMD_ptag, "ptag", ex_ptag, - RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptNext, "ptNext", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptfirst, "ptfirst", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptjump, "ptjump", ex_ptag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_ptlast, "ptlast", ex_ptag, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_ptnext, "ptnext", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptprevious, "ptprevious", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptrewind, "ptrewind", ex_ptag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_ptselect, "ptselect", ex_ptag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_put, "put", ex_put, - RANGE|WHOLEFOLD|BANG|REGSTR|TRLBAR|ZEROR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|BANG|REGSTR|TRLBAR|ZEROR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_pwd, "pwd", ex_pwd, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_python, "python", ex_python, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_pydo, "pydo", ex_pydo, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_pyfile, "pyfile", ex_pyfile, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_py3, "py3", ex_py3, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_py3do, "py3do", ex_py3do, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_python3, "python3", ex_py3, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_py3file, "py3file", ex_py3file, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_quit, "quit", ex_quit, - BANG|TRLBAR|CMDWIN), + BANG|RANGE|COUNT|NOTADR|TRLBAR|CMDWIN, + ADDR_WINDOWS), EX(CMD_quitall, "quitall", ex_quit_all, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_qall, "qall", ex_quit_all, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_read, "read", ex_read, - BANG|RANGE|WHOLEFOLD|FILE1|ARGOPT|TRLBAR|ZEROR|CMDWIN|MODIFY), + BANG|RANGE|WHOLEFOLD|FILE1|ARGOPT|TRLBAR|ZEROR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_recover, "recover", ex_recover, - BANG|FILE1|TRLBAR), + BANG|FILE1|TRLBAR, + ADDR_LINES), EX(CMD_redo, "redo", ex_redo, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_redir, "redir", ex_redir, - BANG|FILES|TRLBAR|CMDWIN), + BANG|FILES|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_redraw, "redraw", ex_redraw, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_redrawstatus, "redrawstatus", ex_redrawstatus, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_registers, "registers", ex_display, - EXTRA|NOTRLCOM|TRLBAR|CMDWIN), + EXTRA|NOTRLCOM|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_resize, "resize", ex_resize, - RANGE|NOTADR|TRLBAR|WORD1), + RANGE|NOTADR|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_retab, "retab", ex_retab, - TRLBAR|RANGE|WHOLEFOLD|DFLALL|BANG|WORD1|CMDWIN|MODIFY), + TRLBAR|RANGE|WHOLEFOLD|DFLALL|BANG|WORD1|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_return, "return", ex_return, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_rewind, "rewind", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_right, "right", ex_align, - TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), + TRLBAR|RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_rightbelow, "rightbelow", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_runtime, "runtime", ex_runtime, - BANG|NEEDARG|FILES|TRLBAR|SBOXOK|CMDWIN), + BANG|NEEDARG|FILES|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_ruby, "ruby", ex_ruby, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_rubydo, "rubydo", ex_rubydo, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_rubyfile, "rubyfile", ex_rubyfile, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_rundo, "rundo", ex_rundo, - NEEDARG|FILE1), + NEEDARG|FILE1, + ADDR_LINES), EX(CMD_rviminfo, "rviminfo", ex_viminfo, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_substitute, "substitute", do_sub, - RANGE|WHOLEFOLD|EXTRA|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_sNext, "sNext", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_sargument, "sargument", ex_argument, - BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|EXTRA|EDITCMD|ARGOPT|TRLBAR, + ADDR_ARGUMENTS), EX(CMD_sall, "sall", ex_all, - BANG|RANGE|NOTADR|COUNT|TRLBAR), + BANG|RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_sandbox, "sandbox", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_saveas, "saveas", ex_write, - BANG|DFLALL|FILE1|ARGOPT|CMDWIN|TRLBAR), + BANG|DFLALL|FILE1|ARGOPT|CMDWIN|TRLBAR, + ADDR_LINES), EX(CMD_sbuffer, "sbuffer", ex_buffer, - BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR), + BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR, + ADDR_UNLOADED_BUFFERS), EX(CMD_sbNext, "sbNext", ex_bprevious, - RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sball, "sball", ex_buffer_all, - RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sbfirst, "sbfirst", ex_brewind, - EDITCMD|TRLBAR), + EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sblast, "sblast", ex_blast, - EDITCMD|TRLBAR), + EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sbmodified, "sbmodified", ex_bmodified, - RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sbnext, "sbnext", ex_bnext, - RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sbprevious, "sbprevious", ex_bprevious, - RANGE|NOTADR|COUNT|EDITCMD|TRLBAR), + RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_sbrewind, "sbrewind", ex_brewind, - EDITCMD|TRLBAR), + EDITCMD|TRLBAR, + ADDR_LINES), EX(CMD_scriptnames, "scriptnames", ex_scriptnames, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_scriptencoding, "scriptencoding", ex_scriptencoding, - WORD1|TRLBAR|CMDWIN), + WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_scscope, "scscope", do_scscope, - EXTRA|NOTRLCOM), + EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_set, "set", ex_set, - TRLBAR|EXTRA|CMDWIN|SBOXOK), + TRLBAR|EXTRA|CMDWIN|SBOXOK, + ADDR_LINES), EX(CMD_setfiletype, "setfiletype", ex_setfiletype, - TRLBAR|EXTRA|NEEDARG|CMDWIN), + TRLBAR|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_setglobal, "setglobal", ex_set, - TRLBAR|EXTRA|CMDWIN|SBOXOK), + TRLBAR|EXTRA|CMDWIN|SBOXOK, + ADDR_LINES), EX(CMD_setlocal, "setlocal", ex_set, - TRLBAR|EXTRA|CMDWIN|SBOXOK), + TRLBAR|EXTRA|CMDWIN|SBOXOK, + ADDR_LINES), EX(CMD_sfind, "sfind", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_sfirst, "sfirst", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_shell, "shell", ex_shell, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_simalt, "simalt", ex_simalt, - NEEDARG|WORD1|TRLBAR|CMDWIN), + NEEDARG|WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_sign, "sign", ex_sign, - NEEDARG|RANGE|NOTADR|EXTRA|CMDWIN), + NEEDARG|RANGE|NOTADR|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_silent, "silent", ex_wrongmodifier, - NEEDARG|EXTRA|BANG|NOTRLCOM|SBOXOK|CMDWIN), + NEEDARG|EXTRA|BANG|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_sleep, "sleep", ex_sleep, - RANGE|NOTADR|COUNT|EXTRA|TRLBAR|CMDWIN), + RANGE|NOTADR|COUNT|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_slast, "slast", ex_last, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_smagic, "smagic", ex_submagic, - RANGE|WHOLEFOLD|EXTRA|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_smap, "smap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_smapclear, "smapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_smenu, "smenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_snext, "snext", ex_next, - RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR), + RANGE|NOTADR|BANG|FILES|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_sniff, "sniff", ex_sniff, - EXTRA|TRLBAR), + EXTRA|TRLBAR, + ADDR_LINES), EX(CMD_snomagic, "snomagic", ex_submagic, - RANGE|WHOLEFOLD|EXTRA|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|CMDWIN, + ADDR_LINES), EX(CMD_snoremap, "snoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_snoremenu, "snoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_source, "source", ex_source, - BANG|FILE1|TRLBAR|SBOXOK|CMDWIN), + BANG|FILE1|TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_sort, "sort", ex_sort, - RANGE|DFLALL|WHOLEFOLD|BANG|EXTRA|NOTRLCOM|MODIFY), + RANGE|DFLALL|WHOLEFOLD|BANG|EXTRA|NOTRLCOM|MODIFY, + ADDR_LINES), EX(CMD_split, "split", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_spellgood, "spellgood", ex_spell, - BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR, + ADDR_LINES), EX(CMD_spelldump, "spelldump", ex_spelldump, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_spellinfo, "spellinfo", ex_spellinfo, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_spellrepall, "spellrepall", ex_spellrepall, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_spellundo, "spellundo", ex_spell, - BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR, + ADDR_LINES), EX(CMD_spellwrong, "spellwrong", ex_spell, - BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR), + BANG|RANGE|NOTADR|NEEDARG|EXTRA|TRLBAR, + ADDR_LINES), EX(CMD_sprevious, "sprevious", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_srewind, "srewind", ex_rewind, - EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_stop, "stop", ex_stop, - TRLBAR|BANG|CMDWIN), + TRLBAR|BANG|CMDWIN, + ADDR_LINES), EX(CMD_stag, "stag", ex_stag, - RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_startinsert, "startinsert", ex_startinsert, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_startgreplace, "startgreplace", ex_startinsert, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_startreplace, "startreplace", ex_startinsert, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_stopinsert, "stopinsert", ex_stopinsert, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_stjump, "stjump", ex_stag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_stselect, "stselect", ex_stag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_sunhide, "sunhide", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_sunmap, "sunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_sunmenu, "sunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_suspend, "suspend", ex_stop, - TRLBAR|BANG|CMDWIN), + TRLBAR|BANG|CMDWIN, + ADDR_LINES), EX(CMD_sview, "sview", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_swapname, "swapname", ex_swapname, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_syntax, "syntax", ex_syntax, - EXTRA|NOTRLCOM|CMDWIN), + EXTRA|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_syntime, "syntime", ex_syntime, - NEEDARG|WORD1|TRLBAR|CMDWIN), + NEEDARG|WORD1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_syncbind, "syncbind", ex_syncbind, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_t, "t", ex_copymove, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_tNext, "tNext", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_tag, "tag", ex_tag, - RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_tags, "tags", do_tags, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_tab, "tab", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_tabclose, "tabclose", ex_tabclose, - RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN), + RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN, + ADDR_TABS), EX(CMD_tabdo, "tabdo", ex_listdo, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_tabedit, "tabedit", ex_splitview, - BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR, + ADDR_TABS), EX(CMD_tabfind, "tabfind", ex_splitview, - BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|NEEDARG|TRLBAR), + BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|NEEDARG|TRLBAR, + ADDR_TABS), EX(CMD_tabfirst, "tabfirst", ex_tabnext, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_tabmove, "tabmove", ex_tabmove, - RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR), + RANGE|NOTADR|ZEROR|EXTRA|NOSPC|TRLBAR, + ADDR_TABS), EX(CMD_tablast, "tablast", ex_tabnext, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_tabnext, "tabnext", ex_tabnext, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_tabnew, "tabnew", ex_splitview, - BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR, + ADDR_TABS), EX(CMD_tabonly, "tabonly", ex_tabonly, - BANG|TRLBAR|CMDWIN), + BANG|RANGE|NOTADR|TRLBAR|CMDWIN, + ADDR_TABS), EX(CMD_tabprevious, "tabprevious", ex_tabnext, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_tabNext, "tabNext", ex_tabnext, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_tabrewind, "tabrewind", ex_tabnext, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_tabs, "tabs", ex_tabs, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_tcl, "tcl", ex_tcl, - RANGE|EXTRA|NEEDARG|CMDWIN), + RANGE|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_tcldo, "tcldo", ex_tcldo, - RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN), + RANGE|DFLALL|EXTRA|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_tclfile, "tclfile", ex_tclfile, - RANGE|FILE1|NEEDARG|CMDWIN), + RANGE|FILE1|NEEDARG|CMDWIN, + ADDR_LINES), EX(CMD_tearoff, "tearoff", ex_tearoff, - NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN), + NEEDARG|EXTRA|TRLBAR|NOTRLCOM|CMDWIN, + ADDR_LINES), EX(CMD_tfirst, "tfirst", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_throw, "throw", ex_throw, - EXTRA|NEEDARG|SBOXOK|CMDWIN), + EXTRA|NEEDARG|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_tjump, "tjump", ex_tag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_tlast, "tlast", ex_tag, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_tmenu, "tmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_tnext, "tnext", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_topleft, "topleft", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_tprevious, "tprevious", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_trewind, "trewind", ex_tag, - RANGE|NOTADR|BANG|TRLBAR|ZEROR), + RANGE|NOTADR|BANG|TRLBAR|ZEROR, + ADDR_LINES), EX(CMD_try, "try", ex_try, - TRLBAR|SBOXOK|CMDWIN), + TRLBAR|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_tselect, "tselect", ex_tag, - BANG|TRLBAR|WORD1), + BANG|TRLBAR|WORD1, + ADDR_LINES), EX(CMD_tunmenu, "tunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_undo, "undo", ex_undo, - RANGE|NOTADR|COUNT|ZEROR|TRLBAR|CMDWIN), + RANGE|NOTADR|COUNT|ZEROR|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_undojoin, "undojoin", ex_undojoin, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_undolist, "undolist", ex_undolist, - TRLBAR|CMDWIN), + TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_unabbreviate, "unabbreviate", ex_abbreviate, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_unhide, "unhide", ex_buffer_all, - RANGE|NOTADR|COUNT|TRLBAR), + RANGE|NOTADR|COUNT|TRLBAR, + ADDR_LINES), EX(CMD_unlet, "unlet", ex_unlet, - BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN), + BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_unlockvar, "unlockvar", ex_lockvar, - BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN), + BANG|EXTRA|NEEDARG|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_unmap, "unmap", ex_unmap, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_unmenu, "unmenu", ex_menu, - BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + BANG|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_unsilent, "unsilent", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_update, "update", ex_update, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR), + RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR, + ADDR_LINES), EX(CMD_vglobal, "vglobal", ex_global, - RANGE|WHOLEFOLD|EXTRA|DFLALL|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|DFLALL|CMDWIN, + ADDR_LINES), EX(CMD_version, "version", ex_version, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_verbose, "verbose", ex_wrongmodifier, - NEEDARG|RANGE|NOTADR|EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + NEEDARG|RANGE|NOTADR|EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_vertical, "vertical", ex_wrongmodifier, - NEEDARG|EXTRA|NOTRLCOM), + NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_visual, "visual", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_view, "view", ex_edit, - BANG|FILE1|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_vimgrep, "vimgrep", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_vimgrepadd, "vimgrepadd", ex_vimgrep, - RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE), + RANGE|NOTADR|BANG|NEEDARG|EXTRA|NOTRLCOM|TRLBAR|XFILE, + ADDR_LINES), EX(CMD_viusage, "viusage", ex_viusage, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_vmap, "vmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_vmapclear, "vmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_vmenu, "vmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_vnoremap, "vnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_vnew, "vnew", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_vnoremenu, "vnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_vsplit, "vsplit", ex_splitview, - BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR), + BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_vunmap, "vunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_vunmenu, "vunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_write, "write", ex_write, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_wNext, "wNext", ex_wnext, - RANGE|WHOLEFOLD|NOTADR|BANG|FILE1|ARGOPT|TRLBAR), + RANGE|WHOLEFOLD|NOTADR|BANG|FILE1|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_wall, "wall", do_wqall, - BANG|TRLBAR|CMDWIN), + BANG|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_while, "while", ex_while, - EXTRA|NOTRLCOM|SBOXOK|CMDWIN), + EXTRA|NOTRLCOM|SBOXOK|CMDWIN, + ADDR_LINES), EX(CMD_winsize, "winsize", ex_winsize, - EXTRA|NEEDARG|TRLBAR), + EXTRA|NEEDARG|TRLBAR, + ADDR_LINES), EX(CMD_wincmd, "wincmd", ex_wincmd, - NEEDARG|WORD1|RANGE|NOTADR), + NEEDARG|WORD1|RANGE|NOTADR, + ADDR_LINES), EX(CMD_windo, "windo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM), + BANG|NEEDARG|EXTRA|NOTRLCOM, + ADDR_LINES), EX(CMD_winpos, "winpos", ex_winpos, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_wnext, "wnext", ex_wnext, - RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR), + RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_wprevious, "wprevious", ex_wnext, - RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR), + RANGE|NOTADR|BANG|FILE1|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_wq, "wq", ex_exit, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR), + RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR, + ADDR_LINES), EX(CMD_wqall, "wqall", do_wqall, - BANG|FILE1|ARGOPT|DFLALL|TRLBAR), + BANG|FILE1|ARGOPT|DFLALL|TRLBAR, + ADDR_LINES), EX(CMD_wsverb, "wsverb", ex_wsverb, - EXTRA|NOTADR|NEEDARG), + EXTRA|NOTADR|NEEDARG, + ADDR_LINES), EX(CMD_wundo, "wundo", ex_wundo, - BANG|NEEDARG|FILE1), + BANG|NEEDARG|FILE1, + ADDR_LINES), EX(CMD_wviminfo, "wviminfo", ex_viminfo, - BANG|FILE1|TRLBAR|CMDWIN), + BANG|FILE1|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_xit, "xit", ex_exit, - RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|BANG|FILE1|ARGOPT|DFLALL|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_xall, "xall", do_wqall, - BANG|TRLBAR), + BANG|TRLBAR, + ADDR_LINES), EX(CMD_xmap, "xmap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_xmapclear, "xmapclear", ex_mapclear, - EXTRA|TRLBAR|CMDWIN), + EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_xmenu, "xmenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_xnoremap, "xnoremap", ex_map, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_xnoremenu, "xnoremenu", ex_menu, - RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + RANGE|NOTADR|ZEROR|EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_xunmap, "xunmap", ex_unmap, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_xunmenu, "xunmenu", ex_menu, - EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), + EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN, + ADDR_LINES), EX(CMD_yank, "yank", ex_operators, - RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|REGSTR|COUNT|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_z, "z", ex_z, - RANGE|WHOLEFOLD|EXTRA|EXFLAGS|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|EXFLAGS|TRLBAR|CMDWIN, + ADDR_LINES), /* commands that don't start with a lowercase letter */ EX(CMD_bang, "!", ex_bang, - RANGE|WHOLEFOLD|BANG|FILES|CMDWIN), + RANGE|WHOLEFOLD|BANG|FILES|CMDWIN, + ADDR_LINES), EX(CMD_pound, "#", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_and, "&", do_sub, - RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_star, "*", ex_at, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_lshift, "<", ex_operators, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_equal, "=", ex_equal, - RANGE|TRLBAR|DFLALL|EXFLAGS|CMDWIN), + RANGE|TRLBAR|DFLALL|EXFLAGS|CMDWIN, + ADDR_LINES), EX(CMD_rshift, ">", ex_operators, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|MODIFY, + ADDR_LINES), EX(CMD_at, "@", ex_at, - RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|EXTRA|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_Next, "Next", ex_previous, - EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR), + EXTRA|RANGE|NOTADR|COUNT|BANG|EDITCMD|ARGOPT|TRLBAR, + ADDR_LINES), EX(CMD_Print, "Print", ex_print, - RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN), + RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN, + ADDR_LINES), EX(CMD_X, "X", ex_X, - TRLBAR), + TRLBAR, + ADDR_LINES), EX(CMD_tilde, "~", do_sub, - RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY), + RANGE|WHOLEFOLD|EXTRA|CMDWIN|MODIFY, + ADDR_LINES), #ifndef DO_DECLARE_EXCMD #ifdef FEAT_USR_CMDS @@ -1172,6 +1704,7 @@ struct exarg int addr_count; /* the number of addresses given */ linenr_T line1; /* the first line number */ linenr_T line2; /* the second line number or count */ + int addr_type; /* type of the count/range */ int flags; /* extra flags after count: EXFLAG_ */ char_u *do_ecmd_cmd; /* +command arg to be used in edited file */ linenr_T do_ecmd_lnum; /* the line number in an edited file */ diff --git a/src/ex_docmd.c b/src/ex_docmd.c index e90a36ecc6..7b25cdb8fe 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -60,6 +60,7 @@ static char_u *get_user_command_name __ARGS((int idx)); # define IS_USER_CMDIDX(idx) (FALSE) #endif +static int compute_buffer_local_count __ARGS((int addr_type, int lnum, int local)); #ifdef FEAT_EVAL static char_u *do_one_cmd __ARGS((char_u **, int, struct condstack *, char_u *(*fgetline)(int, void *, int), void *cookie)); #else @@ -133,7 +134,7 @@ static int getargopt __ARGS((exarg_T *eap)); #endif static int check_more __ARGS((int, int)); -static linenr_T get_address __ARGS((char_u **, int skip, int to_other_file)); +static linenr_T get_address __ARGS((char_u **, int addr_type, int skip, int to_other_file)); static void get_flags __ARGS((exarg_T *eap)); #if !defined(FEAT_PERL) \ || !defined(FEAT_PYTHON) || !defined(FEAT_PYTHON3) \ @@ -1680,6 +1681,39 @@ getline_cookie(fgetline, cookie) } #endif + +/* + * Helper function to apply an offset for buffer commands, i.e. ":bdelete", + * ":bwipeout", etc. + * Returns the buffer number. + */ + static int +compute_buffer_local_count(addr_type, lnum, offset) + int addr_type; + int lnum; + int offset; +{ + buf_T *buf; + int count = offset; + + buf = firstbuf; + while (buf->b_next != NULL && buf->b_fnum < lnum) + buf = buf->b_next; + while (count != 0) + { + count += (count < 0) ? 1 : -1; + if (buf->b_prev == NULL) + break; + buf = (count < 0) ? buf->b_prev : buf->b_next; + if (addr_type == ADDR_LOADED_BUFFERS) + /* skip over unloaded buffers */ + while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL) + buf = (count < 0) ? buf->b_prev : buf->b_next; + } + return buf->b_fnum; +} + + /* * Execute one Ex command. * @@ -1687,10 +1721,10 @@ getline_cookie(fgetline, cookie) * * 1. skip comment lines and leading space * 2. handle command modifiers - * 3. parse range - * 4. parse command - * 5. parse arguments - * 6. switch on command name + * 3. parse command + * 4. parse range + * 6. parse arguments + * 7. switch on command name * * Note: "fgetline" can be NULL. * @@ -1730,6 +1764,9 @@ do_one_cmd(cmdlinep, sourcing, #endif cmdmod_T save_cmdmod; int ni; /* set when Not Implemented */ + win_T *wp; + tabpage_T *tp; + char_u *cmd; vim_memset(&ea, 0, sizeof(ea)); ea.line1 = 1; @@ -1769,7 +1806,7 @@ do_one_cmd(cmdlinep, sourcing, for (;;) { /* - * 1. skip comment lines and leading white space and colons + * 1. Skip comment lines and leading white space and colons. */ while (*ea.cmd == ' ' || *ea.cmd == '\t' || *ea.cmd == ':') ++ea.cmd; @@ -1794,7 +1831,7 @@ do_one_cmd(cmdlinep, sourcing, } /* - * 2. handle command modifiers. + * 2. Handle command modifiers. */ p = ea.cmd; if (VIM_ISDIGIT(*ea.cmd)) @@ -2003,7 +2040,18 @@ do_one_cmd(cmdlinep, sourcing, #endif /* - * 3. parse a range specifier of the form: addr [,addr] [;addr] .. + * 3. Skip over the range to find the command. Let "p" point to after it. + * + * We need the command to know what kind of range it uses. + */ + cmd = ea.cmd; + ea.cmd = skip_range(ea.cmd, NULL); + if (*ea.cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL) + ea.cmd = skipwhite(ea.cmd + 1); + p = find_command(&ea, NULL); + +/* + * 4. parse a range specifier of the form: addr [,addr] [;addr] .. * * where 'addr' is: * @@ -2019,13 +2067,52 @@ do_one_cmd(cmdlinep, sourcing, * is equal to the lower. */ + if (ea.cmdidx != CMD_SIZE) + ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type; + else + ea.addr_type = ADDR_LINES; + ea.cmd = cmd; + /* repeat for all ',' or ';' separated addresses */ for (;;) { ea.line1 = ea.line2; - ea.line2 = curwin->w_cursor.lnum; /* default is current line number */ + switch (ea.addr_type) + { + case ADDR_LINES: + /* default is current line number */ + ea.line2 = curwin->w_cursor.lnum; + break; + case ADDR_WINDOWS: + lnum = 0; + for (wp = firstwin; wp != NULL; wp = wp->w_next) + { + lnum++; + if (wp == curwin) + break; + } + ea.line2 = lnum; + break; + case ADDR_ARGUMENTS: + ea.line2 = curwin->w_arg_idx + 1; + break; + case ADDR_LOADED_BUFFERS: + case ADDR_UNLOADED_BUFFERS: + ea.line2 = curbuf->b_fnum; + break; + case ADDR_TABS: + lnum = 0; + for(tp = first_tabpage; tp != NULL; tp = tp->tp_next) + { + lnum++; + if (tp == curtab) + break; + } + ea.line2 = lnum; + break; + } ea.cmd = skipwhite(ea.cmd); - lnum = get_address(&ea.cmd, ea.skip, ea.addr_count == 0); + lnum = get_address(&ea.cmd, ea.addr_type, ea.skip, ea.addr_count == 0); if (ea.cmd == NULL) /* error detected */ goto doend; if (lnum == MAXLNUM) @@ -2033,8 +2120,24 @@ do_one_cmd(cmdlinep, sourcing, if (*ea.cmd == '%') /* '%' - all lines */ { ++ea.cmd; - ea.line1 = 1; - ea.line2 = curbuf->b_ml.ml_line_count; + switch (ea.addr_type) + { + case ADDR_LINES: + ea.line1 = 1; + ea.line2 = curbuf->b_ml.ml_line_count; + break; + case ADDR_WINDOWS: + case ADDR_LOADED_BUFFERS: + case ADDR_UNLOADED_BUFFERS: + case ADDR_TABS: + errormsg = (char_u *)_(e_invrange); + goto doend; + break; + case ADDR_ARGUMENTS: + ea.line1 = 1; + ea.line2 = ARGCOUNT; + break; + } ++ea.addr_count; } /* '*' - visual area */ @@ -2042,6 +2145,12 @@ do_one_cmd(cmdlinep, sourcing, { pos_T *fp; + if (ea.addr_type != ADDR_LINES) + { + errormsg = (char_u *)_(e_invrange); + goto doend; + } + ++ea.cmd; if (!ea.skip) { @@ -2084,7 +2193,7 @@ do_one_cmd(cmdlinep, sourcing, check_cursor_lnum(); /* - * 4. parse command + * 5. Parse the command. */ /* @@ -2098,8 +2207,8 @@ do_one_cmd(cmdlinep, sourcing, * If we got a line, but no command, then go to the line. * If we find a '|' or '\n' we set ea.nextcmd. */ - if (*ea.cmd == NUL || *ea.cmd == '"' || - (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL) + if (*ea.cmd == NUL || *ea.cmd == '"' + || (ea.nextcmd = check_nextcmd(ea.cmd)) != NULL) { /* * strange vi behaviour: @@ -2145,9 +2254,6 @@ do_one_cmd(cmdlinep, sourcing, goto doend; } - /* Find the command and let "p" point to after it. */ - p = find_command(&ea, NULL); - #ifdef FEAT_AUTOCMD /* If this looks like an undefined user command and there are CmdUndefined * autocommands defined, trigger the matching autocommands. */ @@ -2229,7 +2335,7 @@ do_one_cmd(cmdlinep, sourcing, ea.forceit = FALSE; /* - * 5. parse arguments + * 5. Parse arguments. */ if (!IS_USER_CMDIDX(ea.cmdidx)) ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; @@ -2676,7 +2782,7 @@ do_one_cmd(cmdlinep, sourcing, #endif /* - * 6. switch on command name + * 6. Switch on command name. * * The "ea" structure holds the arguments that can be used. */ @@ -4082,8 +4188,9 @@ skip_range(cmd, ctx) * Return MAXLNUM when no Ex address was found. */ static linenr_T -get_address(ptr, skip, to_other_file) +get_address(ptr, addr_type, skip, to_other_file) char_u **ptr; + int addr_type; /* flag: one of ADDR_LINES, ... */ int skip; /* only skip the address, don't use it */ int to_other_file; /* flag: may jump to other file */ { @@ -4094,6 +4201,8 @@ get_address(ptr, skip, to_other_file) pos_T pos; pos_T *fp; linenr_T lnum; + win_T *wp; + tabpage_T *tp; cmd = skipwhite(*ptr); lnum = MAXLNUM; @@ -4102,137 +4211,204 @@ get_address(ptr, skip, to_other_file) switch (*cmd) { case '.': /* '.' - Cursor position */ - ++cmd; + ++cmd; + switch (addr_type) + { + case ADDR_LINES: lnum = curwin->w_cursor.lnum; break; + case ADDR_WINDOWS: + lnum = 0; + for (wp = firstwin; wp != NULL; wp = wp->w_next) + { + lnum++; + if (wp == curwin) + break; + } + break; + case ADDR_ARGUMENTS: + lnum = curwin->w_arg_idx + 1; + break; + case ADDR_LOADED_BUFFERS: + case ADDR_UNLOADED_BUFFERS: + lnum = curbuf->b_fnum; + break; + case ADDR_TABS: + lnum = 0; + for(tp = first_tabpage; tp != NULL; tp = tp->tp_next) + { + lnum++; + if (tp == curtab) + break; + } + break; + } + break; case '$': /* '$' - last line */ - ++cmd; + ++cmd; + switch (addr_type) + { + case ADDR_LINES: lnum = curbuf->b_ml.ml_line_count; break; + case ADDR_WINDOWS: + lnum = 0; + for (wp = firstwin; wp != NULL; wp = wp->w_next) + lnum++; + break; + case ADDR_ARGUMENTS: + lnum = ARGCOUNT; + break; + case ADDR_LOADED_BUFFERS: + case ADDR_UNLOADED_BUFFERS: + lnum = lastbuf->b_fnum; + break; + case ADDR_TABS: + lnum = 0; + for(tp = first_tabpage; tp != NULL; tp = tp->tp_next) + lnum++; + break; + } + break; case '\'': /* ''' - mark */ - if (*++cmd == NUL) + if (*++cmd == NUL) + { + cmd = NULL; + goto error; + } + if (addr_type != ADDR_LINES) + { + EMSG(_(e_invaddr)); + goto error; + } + if (skip) + ++cmd; + else + { + /* Only accept a mark in another file when it is + * used by itself: ":'M". */ + fp = getmark(*cmd, to_other_file && cmd[1] == NUL); + ++cmd; + if (fp == (pos_T *)-1) + /* Jumped to another file. */ + lnum = curwin->w_cursor.lnum; + else + { + if (check_mark(fp) == FAIL) { cmd = NULL; goto error; } - if (skip) - ++cmd; - else - { - /* Only accept a mark in another file when it is - * used by itself: ":'M". */ - fp = getmark(*cmd, to_other_file && cmd[1] == NUL); - ++cmd; - if (fp == (pos_T *)-1) - /* Jumped to another file. */ - lnum = curwin->w_cursor.lnum; - else - { - if (check_mark(fp) == FAIL) - { - cmd = NULL; - goto error; - } - lnum = fp->lnum; - } - } - break; + lnum = fp->lnum; + } + } + break; case '/': case '?': /* '/' or '?' - search */ - c = *cmd++; - if (skip) /* skip "/pat/" */ - { - cmd = skip_regexp(cmd, c, (int)p_magic, NULL); - if (*cmd == c) - ++cmd; - } - else - { - pos = curwin->w_cursor; /* save curwin->w_cursor */ - /* - * When '/' or '?' follows another address, start - * from there. - */ - if (lnum != MAXLNUM) - curwin->w_cursor.lnum = lnum; - /* - * Start a forward search at the end of the line. - * Start a backward search at the start of the line. - * This makes sure we never match in the current - * line, and can match anywhere in the - * next/previous line. - */ - if (c == '/') - curwin->w_cursor.col = MAXCOL; - else - curwin->w_cursor.col = 0; - searchcmdlen = 0; - if (!do_search(NULL, c, cmd, 1L, - SEARCH_HIS | SEARCH_MSG, NULL)) - { - curwin->w_cursor = pos; - cmd = NULL; - goto error; - } - lnum = curwin->w_cursor.lnum; - curwin->w_cursor = pos; - /* adjust command string pointer */ - cmd += searchcmdlen; - } - break; + c = *cmd++; + if (addr_type != ADDR_LINES) + { + EMSG(_(e_invaddr)); + goto error; + } + if (skip) /* skip "/pat/" */ + { + cmd = skip_regexp(cmd, c, (int)p_magic, NULL); + if (*cmd == c) + ++cmd; + } + else + { + pos = curwin->w_cursor; /* save curwin->w_cursor */ + /* + * When '/' or '?' follows another address, start + * from there. + */ + if (lnum != MAXLNUM) + curwin->w_cursor.lnum = lnum; + /* + * Start a forward search at the end of the line. + * Start a backward search at the start of the line. + * This makes sure we never match in the current + * line, and can match anywhere in the + * next/previous line. + */ + if (c == '/') + curwin->w_cursor.col = MAXCOL; + else + curwin->w_cursor.col = 0; + searchcmdlen = 0; + if (!do_search(NULL, c, cmd, 1L, + SEARCH_HIS | SEARCH_MSG, NULL)) + { + curwin->w_cursor = pos; + cmd = NULL; + goto error; + } + lnum = curwin->w_cursor.lnum; + curwin->w_cursor = pos; + /* adjust command string pointer */ + cmd += searchcmdlen; + } + break; case '\\': /* "\?", "\/" or "\&", repeat search */ - ++cmd; - if (*cmd == '&') - i = RE_SUBST; - else if (*cmd == '?' || *cmd == '/') - i = RE_SEARCH; - else - { - EMSG(_(e_backslash)); - cmd = NULL; - goto error; - } + ++cmd; + if (addr_type != ADDR_LINES) + { + EMSG(_(e_invaddr)); + goto error; + } + if (*cmd == '&') + i = RE_SUBST; + else if (*cmd == '?' || *cmd == '/') + i = RE_SEARCH; + else + { + EMSG(_(e_backslash)); + cmd = NULL; + goto error; + } - if (!skip) - { - /* - * When search follows another address, start from - * there. - */ - if (lnum != MAXLNUM) - pos.lnum = lnum; - else - pos.lnum = curwin->w_cursor.lnum; + if (!skip) + { + /* + * When search follows another address, start from + * there. + */ + if (lnum != MAXLNUM) + pos.lnum = lnum; + else + pos.lnum = curwin->w_cursor.lnum; - /* - * Start the search just like for the above - * do_search(). - */ - if (*cmd != '?') - pos.col = MAXCOL; - else - pos.col = 0; - if (searchit(curwin, curbuf, &pos, - *cmd == '?' ? BACKWARD : FORWARD, - (char_u *)"", 1L, SEARCH_MSG, - i, (linenr_T)0, NULL) != FAIL) - lnum = pos.lnum; - else - { - cmd = NULL; - goto error; - } - } - ++cmd; - break; + /* + * Start the search just like for the above + * do_search(). + */ + if (*cmd != '?') + pos.col = MAXCOL; + else + pos.col = 0; + if (searchit(curwin, curbuf, &pos, + *cmd == '?' ? BACKWARD : FORWARD, + (char_u *)"", 1L, SEARCH_MSG, + i, (linenr_T)0, NULL) != FAIL) + lnum = pos.lnum; + else + { + cmd = NULL; + goto error; + } + } + ++cmd; + break; default: - if (VIM_ISDIGIT(*cmd)) /* absolute line number */ - lnum = getdigits(&cmd); + if (VIM_ISDIGIT(*cmd)) /* absolute line number */ + lnum = getdigits(&cmd); } for (;;) @@ -4242,7 +4418,40 @@ get_address(ptr, skip, to_other_file) break; if (lnum == MAXLNUM) - lnum = curwin->w_cursor.lnum; /* "+1" is same as ".+1" */ + { + switch (addr_type) + { + case ADDR_LINES: + lnum = curwin->w_cursor.lnum; /* "+1" is same as ".+1" */ + break; + case ADDR_WINDOWS: + lnum = 0; + for (wp = firstwin; wp != NULL; wp = wp->w_next) + { + lnum++; + if (wp == curwin) + break; + } + break; + case ADDR_ARGUMENTS: + lnum = curwin->w_arg_idx + 1; + break; + case ADDR_LOADED_BUFFERS: + case ADDR_UNLOADED_BUFFERS: + lnum = curbuf->b_fnum; + break; + case ADDR_TABS: + lnum = 0; + for(tp = first_tabpage; tp != NULL; tp = tp->tp_next) + { + lnum++; + if (tp == curtab) + break; + } + break; + } + } + if (VIM_ISDIGIT(*cmd)) i = '+'; /* "number" is same as "+number" */ else @@ -4251,10 +4460,59 @@ get_address(ptr, skip, to_other_file) n = 1; else n = getdigits(&cmd); - if (i == '-') + if (addr_type == ADDR_LOADED_BUFFERS + || addr_type == ADDR_UNLOADED_BUFFERS) + lnum = compute_buffer_local_count(addr_type, lnum, n); + else if (i == '-') lnum -= n; else lnum += n; + + switch (addr_type) + { + case ADDR_LINES: + break; + case ADDR_ARGUMENTS: + if (lnum < 0) + lnum = 0; + else if (lnum >= ARGCOUNT) + lnum = ARGCOUNT; + break; + case ADDR_TABS: + if (lnum < 0) + { + lnum = 0; + break; + } + c = 0; + for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + c++; + if (lnum >= c) + lnum = c; + break; + case ADDR_WINDOWS: + if (lnum < 0) + { + lnum = 0; + break; + } + c = 0; + for (wp = firstwin; wp != NULL; wp = wp->w_next) + c++; + if (lnum > c) + lnum = c; + break; + case ADDR_LOADED_BUFFERS: + case ADDR_UNLOADED_BUFFERS: + if (lnum < firstbuf->b_fnum) + { + lnum = firstbuf->b_fnum; + break; + } + if (lnum > lastbuf->b_fnum) + lnum = lastbuf->b_fnum; + break; + } } } while (*cmd == '/' || *cmd == '?'); @@ -6556,6 +6814,10 @@ not_exiting() ex_quit(eap) exarg_T *eap; { + win_T *wp; + buf_T *buf; + int wnr; + #ifdef FEAT_CMDWIN if (cmdwin_type != 0) { @@ -6569,11 +6831,28 @@ ex_quit(eap) text_locked_msg(); return; } + if (eap->addr_count > 0) + { + wnr = eap->line2; + for (wp = firstwin; --wnr > 0; ) + { + if (wp->w_next == NULL) + break; + else + wp = wp->w_next; + } + buf = wp->w_buffer; + } + else + { + wp = curwin; + buf = curbuf; + } #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); /* Refuse to quit when locked or when the buffer in the last window is * being closed (can only happen in autocommands). */ - if (curbuf_locked() || (curbuf->b_nwindows == 1 && curbuf->b_closing)) + if (curbuf_locked() || (buf->b_nwindows == 1 && buf->b_closing)) return; #endif @@ -6606,7 +6885,7 @@ ex_quit(eap) need_mouse_correct = TRUE; # endif /* close window; may free buffer */ - win_close(curwin, !P_HID(curwin->w_buffer) || eap->forceit); + win_close(wp, !P_HID(wp->w_buffer) || eap->forceit); #endif } } @@ -6668,6 +6947,8 @@ ex_quit_all(eap) ex_close(eap) exarg_T *eap; { + win_T *win; + int winnr = 0; # ifdef FEAT_CMDWIN if (cmdwin_type != 0) cmdwin_result = Ctrl_C; @@ -6678,7 +6959,21 @@ ex_close(eap) && !curbuf_locked() #endif ) - ex_win_close(eap->forceit, curwin, NULL); + { + if (eap->addr_count == 0) + ex_win_close(eap->forceit, curwin, NULL); + else { + for (win = firstwin; win != NULL; win = win->w_next) + { + winnr++; + if (winnr == eap->line2) + break; + } + if (win == NULL) + win = lastwin; + ex_win_close(eap->forceit, win, NULL); + } + } } # ifdef FEAT_QUICKFIX @@ -6804,6 +7099,8 @@ ex_tabonly(eap) MSG(_("Already only one tab page")); else { + if (eap->addr_count > 0) + goto_tabpage(eap->line2); /* Repeat this up to a 1000 times, because autocommands may mess * up the lists. */ for (done = 0; done < 1000; ++done) @@ -6882,9 +7179,23 @@ tabpage_close_other(tp, forceit) ex_only(eap) exarg_T *eap; { + win_T *wp; + int wnr; # ifdef FEAT_GUI need_mouse_correct = TRUE; # endif + if (eap->addr_count > 0) + { + wnr = eap->line2; + for (wp = firstwin; --wnr > 0; ) + { + if (wp->w_next == NULL) + break; + else + wp = wp->w_next; + } + win_goto(wp); + } close_others(TRUE, eap->forceit); } @@ -6906,6 +7217,9 @@ ex_all(eap) ex_hide(eap) exarg_T *eap; { + win_T *win; + int winnr = 0; + if (*eap->arg != NUL && check_nextcmd(eap->arg) == NULL) eap->errmsg = e_invarg; else @@ -6918,7 +7232,19 @@ ex_hide(eap) # ifdef FEAT_GUI need_mouse_correct = TRUE; # endif - win_close(curwin, FALSE); /* don't free buffer */ + if (eap->addr_count == 0) + win_close(curwin, FALSE); /* don't free buffer */ + else { + for (win = firstwin; win != NULL; win = win->w_next) + { + winnr++; + if (winnr == eap->line2) + break; + } + if (win == NULL) + win = lastwin; + win_close(win, FALSE); + } } #endif } @@ -8652,7 +8978,7 @@ ex_copymove(eap) { long n; - n = get_address(&eap->arg, FALSE, FALSE); + n = get_address(&eap->arg, eap->addr_type, FALSE, FALSE); if (eap->arg == NULL) /* error detected */ { eap->nextcmd = NULL; diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 58316fc7f2..a2e5db3b87 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -36,9 +36,11 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test94.out test95.out test96.out test97.out test98.out \ test99.out test100.out test101.out test102.out test103.out \ test104.out test105.out test106.out test107.out \ + test_argument_count.out \ test_autoformat_join.out \ test_breakindent.out \ test_changelist.out \ + test_close_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ @@ -171,9 +173,11 @@ test104.out: test104.in test105.out: test105.in test106.out: test106.in test107.out: test107.in +test_argument_count.out: test_argument_count.in test_autoformat_join.out: test_autoformat_join.in test_breakindent.out: test_breakindent.in test_changelist.out: test_changelist.in +test_close_count.out: test_close_count.in test_eval.out: test_eval.in test_insertcount.out: test_insertcount.in test_listlbr.out: test_listlbr.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 7fd2763605..d2e070ba0c 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -35,9 +35,11 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test94.out test95.out test96.out test98.out test99.out \ test100.out test101.out test102.out test103.out test104.out \ test105.out test106.out test107.out\ + test_argument_count.out \ test_autoformat_join.out \ test_breakindent.out \ test_changelist.out \ + test_close_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index d2995a50b6..4a99cb915d 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -57,9 +57,11 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test94.out test95.out test96.out test98.out test99.out \ test100.out test101.out test102.out test103.out test104.out \ test105.out test106.out test107.out \ + test_argument_count.out \ test_autoformat_join.out \ test_breakindent.out \ test_changelist.out \ + test_close_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index 3b6b4071d5..7a2571b499 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -37,9 +37,11 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test94.out test95.out test96.out test98.out test99.out \ test100.out test101.out test102.out test103.out test104.out \ test105.out test106.out test107.out \ + test_argument_count.out \ test_autoformat_join.out \ test_breakindent.out \ test_changelist.out \ + test_close_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index e105376baf..93aa874019 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # -# Last change: 2014 Aug 16 +# Last change: 2014 Nov 27 # # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # Edit the lines in the Configuration section below to select. @@ -45,7 +45,7 @@ # It fails because VMS does not support this feature yet. # WANT_MZSCH = YES -# Comment out if you have ODS-5 file system +# Comment out if you have ODS-5 file system # HAVE_ODS5 = YES # Comment out if you have gzip on your system @@ -54,10 +54,10 @@ # Comment out if you have GNU compatible diff on your system # HAVE_GDIFF = YES -# Comment out if you have GNU compatible cksum on your system +# Comment out if you have GNU compatible cksum on your system # HAVE_CKSUM = YES -# Comment out if you have ICONV support +# Comment out if you have ICONV support # HAVE_ICONV = YES # Comment out if you have LUA support @@ -96,9 +96,11 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test95.out test96.out test98.out test99.out \ test100.out test101.out test103.out test104.out \ test105.out test106.out test107.out \ + test_argument_count.out \ test_autoformat_join.out \ test_breakindent.out \ test_changelist.out \ + test_close_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 1f5095e55b..aa0ef1ff1f 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -33,9 +33,11 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test94.out test95.out test96.out test97.out test98.out \ test99.out test100.out test101.out test102.out test103.out \ test104.out test105.out test106.out test107.out \ + test_argument_count.out \ test_autoformat_join.out \ test_breakindent.out \ test_changelist.out \ + test_close_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ diff --git a/src/version.c b/src/version.c index 2496defc2a..d94dc3ca89 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 530, /**/ 529, /**/ diff --git a/src/window.c b/src/window.c index 6490fd3868..92fcbbe710 100644 --- a/src/window.c +++ b/src/window.c @@ -199,14 +199,22 @@ newwindow: case Ctrl_Q: case 'q': reset_VIsual_and_resel(); /* stop Visual mode */ - do_cmdline_cmd((char_u *)"quit"); + STRCPY(cbuf, "quit"); + if (Prenum) + vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 5, + "%ld", Prenum); + do_cmdline_cmd(cbuf); break; /* close current window */ case Ctrl_C: case 'c': reset_VIsual_and_resel(); /* stop Visual mode */ - do_cmdline_cmd((char_u *)"close"); + STRCPY(cbuf, "close"); + if (Prenum) + vim_snprintf((char *)cbuf + 5, sizeof(cbuf) - 5, + "%ld", Prenum); + do_cmdline_cmd(cbuf); break; #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) @@ -235,7 +243,11 @@ newwindow: case 'o': CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */ - do_cmdline_cmd((char_u *)"only"); + STRCPY(cbuf, "only"); + if (Prenum > 0) + vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 4, + "%ld", Prenum); + do_cmdline_cmd(cbuf); break; /* cursor to next window with wrap around */ From 19be1a9edba916712343cffe384eea2066ef39b0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 13:38:11 +0100 Subject: [PATCH 209/311] updated for version 7.4.531 Problem: Comments about parsing an Ex command are wrong. Solution: Correct the steop numbers. --- src/ex_docmd.c | 19 ++++++++----------- src/version.c | 2 ++ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 7b25cdb8fe..a0030281a4 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1721,8 +1721,9 @@ compute_buffer_local_count(addr_type, lnum, offset) * * 1. skip comment lines and leading space * 2. handle command modifiers - * 3. parse command + * 3. find the command * 4. parse range + * 5. Parse the command. * 6. parse arguments * 7. switch on command name * @@ -2335,7 +2336,7 @@ do_one_cmd(cmdlinep, sourcing, ea.forceit = FALSE; /* - * 5. Parse arguments. + * 6. Parse arguments. */ if (!IS_USER_CMDIDX(ea.cmdidx)) ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; @@ -2782,7 +2783,7 @@ do_one_cmd(cmdlinep, sourcing, #endif /* - * 6. Switch on command name. + * 7. Switch on command name. * * The "ea" structure holds the arguments that can be used. */ @@ -3319,7 +3320,7 @@ set_one_cmd_context(xp, buff) ea.argt = 0; /* - * 2. skip comment lines and leading space, colons or bars + * 1. skip comment lines and leading space, colons or bars */ for (cmd = buff; vim_strchr((char_u *)" \t:|", *cmd) != NULL; cmd++) ; @@ -3334,13 +3335,9 @@ set_one_cmd_context(xp, buff) } /* - * 3. parse a range specifier of the form: addr [,addr] [;addr] .. + * 3. Skip over the range to find the command. */ cmd = skip_range(cmd, &xp->xp_context); - -/* - * 4. parse command - */ xp->xp_pattern = cmd; if (*cmd == NUL) return NULL; @@ -3446,7 +3443,7 @@ set_one_cmd_context(xp, buff) } /* - * 5. parse arguments + * 6. parse arguments */ if (!IS_USER_CMDIDX(ea.cmdidx)) ea.argt = (long)cmdnames[(int)ea.cmdidx].cmd_argt; @@ -3682,7 +3679,7 @@ set_one_cmd_context(xp, buff) } /* - * 6. switch on command name + * 6. Switch on command name. */ switch (ea.cmdidx) { diff --git a/src/version.c b/src/version.c index d94dc3ca89..38acd5da2d 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 531, /**/ 530, /**/ From a7cc9f1d8edd4719498df826ed86f28c9d591936 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 14:29:56 +0100 Subject: [PATCH 210/311] updated for version 7.4.532 Problem: When using 'incsearch' "2/pattern/e" highlights the first match. Solution: Move the code to set extra_col inside the loop for count. (Ozaki Kiichi) --- src/search.c | 46 ++++++++++++++++++++++++---------------------- src/version.c | 2 ++ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/search.c b/src/search.c index 283e77867e..047a733972 100644 --- a/src/search.c +++ b/src/search.c @@ -552,6 +552,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) int match_ok; long nmatched; int submatch = 0; + int first_match = TRUE; int save_called_emsg = called_emsg; #ifdef FEAT_SEARCH_EXTRA int break_loop = FALSE; @@ -565,33 +566,33 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) return FAIL; } - /* When not accepting a match at the start position set "extra_col" to a - * non-zero value. Don't do that when starting at MAXCOL, since MAXCOL + - * 1 is zero. */ - if ((options & SEARCH_START) || pos->col == MAXCOL) - extra_col = 0; -#ifdef FEAT_MBYTE - /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */ - else if (dir != BACKWARD && has_mbyte - && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count - && pos->col < MAXCOL - 2) - { - ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col; - if (*ptr == NUL) - extra_col = 1; - else - extra_col = (*mb_ptr2len)(ptr); - } -#endif - else - extra_col = 1; - /* * find the string */ called_emsg = FALSE; do /* loop for count */ { + /* When not accepting a match at the start position set "extra_col" to + * a non-zero value. Don't do that when starting at MAXCOL, since + * MAXCOL + 1 is zero. */ + if ((options & SEARCH_START) || pos->col == MAXCOL) + extra_col = 0; +#ifdef FEAT_MBYTE + /* Watch out for the "col" being MAXCOL - 2, used in a closed fold. */ + else if (dir != BACKWARD && has_mbyte + && pos->lnum >= 1 && pos->lnum <= buf->b_ml.ml_line_count + && pos->col < MAXCOL - 2) + { + ptr = ml_get_buf(buf, pos->lnum, FALSE) + pos->col; + if (*ptr == NUL) + extra_col = 1; + else + extra_col = (*mb_ptr2len)(ptr); + } +#endif + else + extra_col = 1; + start_pos = *pos; /* remember start pos for detecting no match */ found = 0; /* default: not found */ at_first_line = TRUE; /* default: start in first line */ @@ -677,7 +678,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) * otherwise "/$" will get stuck on end of line. */ while (matchpos.lnum == 0 - && ((options & SEARCH_END) + && ((options & SEARCH_END) && first_match ? (nmatched == 1 && (int)endpos.col - 1 < (int)start_pos.col + extra_col) @@ -908,6 +909,7 @@ searchit(win, buf, pos, dir, pat, count, options, pat_use, stop_lnum, tm) pos->coladd = 0; #endif found = 1; + first_match = FALSE; /* Set variables used for 'incsearch' highlighting. */ search_match_lines = endpos.lnum - matchpos.lnum; diff --git a/src/version.c b/src/version.c index 38acd5da2d..fd7c414692 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 532, /**/ 531, /**/ From 214305f7dc7d0a0ff605d06ecacaaed78317bc91 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 14:37:57 +0100 Subject: [PATCH 211/311] updated for version 7.4.533 Problem: ":hardcopy" leaks memory in case of errors. Solution: Free memory in all code paths. (Christian Brabandt) --- src/hardcopy.c | 34 +++++++++++++++++----------------- src/version.c | 2 ++ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/hardcopy.c b/src/hardcopy.c index 1df2fda72a..1e795e6b57 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -2960,12 +2960,12 @@ mch_print_begin(psettings) if (!prt_find_resource("prolog", res_prolog)) { EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\"")); - return FALSE; + goto theend; } if (!prt_open_resource(res_prolog)) - return FALSE; + goto theend; if (!prt_check_resource(res_prolog, PRT_PROLOG_VERSION)) - return FALSE; + goto theend; #ifdef FEAT_MBYTE if (prt_out_mbyte) { @@ -2973,12 +2973,12 @@ mch_print_begin(psettings) if (!prt_find_resource("cidfont", res_cidfont)) { EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\"")); - return FALSE; + goto theend; } if (!prt_open_resource(res_cidfont)) - return FALSE; + goto theend; if (!prt_check_resource(res_cidfont, PRT_CID_PROLOG_VERSION)) - return FALSE; + goto theend; } #endif @@ -3012,12 +3012,12 @@ mch_print_begin(psettings) { EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), p_encoding); - return FALSE; + goto theend; } } } if (!prt_open_resource(res_encoding)) - return FALSE; + goto theend; /* For the moment there are no checks on encoding resource files to * perform */ #ifdef FEAT_MBYTE @@ -3034,10 +3034,10 @@ mch_print_begin(psettings) { EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), prt_ascii_encoding); - return FALSE; + goto theend; } if (!prt_open_resource(res_encoding)) - return FALSE; + goto theend; /* For the moment there are no checks on encoding resource files to * perform */ } @@ -3050,7 +3050,7 @@ mch_print_begin(psettings) { EMSG2(_("E620: Unable to convert to print encoding \"%s\""), p_encoding); - return FALSE; + goto theend; } prt_do_conv = TRUE; } @@ -3063,10 +3063,10 @@ mch_print_begin(psettings) { EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), prt_cmap); - return FALSE; + goto theend; } if (!prt_open_resource(res_cmap)) - return FALSE; + goto theend; } #endif @@ -3140,15 +3140,15 @@ mch_print_begin(psettings) /* Add required procsets - NOTE: order is important! */ if (!prt_add_resource(res_prolog)) - return FALSE; + goto theend; #ifdef FEAT_MBYTE if (prt_out_mbyte) { /* Add CID font procset, and any user supplied CMap */ if (!prt_add_resource(res_cidfont)) - return FALSE; + goto theend; if (prt_custom_cmap && !prt_add_resource(res_cmap)) - return FALSE; + goto theend; } #endif @@ -3158,7 +3158,7 @@ mch_print_begin(psettings) /* There will be only one Roman font encoding to be included in the PS * file. */ if (!prt_add_resource(res_encoding)) - return FALSE; + goto theend; prt_dsc_noarg("EndProlog"); diff --git a/src/version.c b/src/version.c index fd7c414692..f9c2804ea4 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 533, /**/ 532, /**/ From b94bdc727531138afcf9b33655202dfc8f9cdf35 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 14:44:08 +0100 Subject: [PATCH 212/311] updated for version 7.4.534 Problem: Warnings when compiling if_ruby.c. Solution: Avoid the warnings. (Ken Takata) --- src/if_ruby.c | 11 ++++++----- src/version.c | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/if_ruby.c b/src/if_ruby.c index 9301b72927..eb6141fbc3 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -96,11 +96,11 @@ # define rb_num2int rb_num2int_stub #endif -# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21 +#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21 /* Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses * rb_gc_writebarrier_unprotect_promoted if USE_RGENGC */ -# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub -# endif +# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub +#endif #include #ifdef RUBY19_OR_LATER @@ -422,7 +422,7 @@ VALUE rb_num2ulong(VALUE x) # if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO) void rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj) { - return dll_rb_gc_writebarrier_unprotect_promoted(obj); + dll_rb_gc_writebarrier_unprotect_promoted(obj); } # endif @@ -763,7 +763,8 @@ static int ensure_ruby_initialized(void) /* suggested by Ariya Mizutani */ int argc = 1; char *argv[] = {"gvim.exe"}; - NtInitialize(&argc, &argv); + char **argvp = argv; + NtInitialize(&argc, &argvp); #endif { #if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK) diff --git a/src/version.c b/src/version.c index f9c2804ea4..5162178c05 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 534, /**/ 533, /**/ From d4f98b1be8a4b51a9b9578e660f27fb200177cd3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 14:46:22 +0100 Subject: [PATCH 213/311] Add files added by patch 7.4.530 to the repository. --- src/testdir/test_argument_count.in | 47 +++++++++ src/testdir/test_argument_count.ok | 13 +++ src/testdir/test_close_count.in | 156 +++++++++++++++++++++++++++++ src/testdir/test_close_count.ok | 23 +++++ 4 files changed, 239 insertions(+) create mode 100644 src/testdir/test_argument_count.in create mode 100644 src/testdir/test_argument_count.ok create mode 100644 src/testdir/test_close_count.in create mode 100644 src/testdir/test_close_count.ok diff --git a/src/testdir/test_argument_count.in b/src/testdir/test_argument_count.in new file mode 100644 index 0000000000..f45e52a3e6 --- /dev/null +++ b/src/testdir/test_argument_count.in @@ -0,0 +1,47 @@ +Tests for :[count]argument! and :[count]argdelete vim: set ft=vim : + +STARTTEST +:%argd +:argadd a b c d +:set hidden +:let buffers = [] +:augroup TEST +:au BufEnter * call add(buffers, expand('%:t')) +:augroup END +:$argu +:$-argu +:-argu +:1argu +:+2argu +:augroup TEST +:au! +:augroup END +:let arglists = [] +:.argd +:call add(arglists, argv()) +:-argd +:call add(arglists, argv()) +:$argd +:call add(arglists, argv()) +:1arga c +:1arga b +:$argu +:+arga d +:$arga x +:call add(arglists, argv()) +:$-10arga Y +:call add(arglists, argv()) +:%argd +:call add(arglists, argv()) +:arga a b c d e f +:2,$-argd +:call add(arglists, argv()) +:e! test.out +:call append(0, buffers) +:let lnr = line('$') +:call append(lnr, map(copy(arglists), 'join(v:val, " ")')) +:w +:qa! +ENDTEST + + diff --git a/src/testdir/test_argument_count.ok b/src/testdir/test_argument_count.ok new file mode 100644 index 0000000000..f591bf2614 --- /dev/null +++ b/src/testdir/test_argument_count.ok @@ -0,0 +1,13 @@ +d +c +b +a +c + +a b d +a d +a +a b c d x +Y a b c d x + +a f diff --git a/src/testdir/test_close_count.in b/src/testdir/test_close_count.in new file mode 100644 index 0000000000..288945c696 --- /dev/null +++ b/src/testdir/test_close_count.in @@ -0,0 +1,156 @@ +Tests for :[count]close! and :[count]hide vim: set ft=vim : + +STARTTEST +:let tests = [] +:so tiny.vim +:for i in range(5) +:new +:endfor +:4wincmd w +:close! +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:1close! +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:$close! +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:1wincmd w +:2close! +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:1wincmd w +:new +:new +:2wincmd w +:-2close! +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:2wincmd w +:+1close! +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:e! test.out +:call append(0, map(copy(tests), 'join(v:val, " ")')) +:w +:only! +:b1 +ENDTEST + +STARTTEST +:let tests = [] +:so tiny.vim +:for i in range(5) +:new +:endfor +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:4wincmd w +:.hide +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:1hide +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:9hide +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:1wincmd w +:2hide +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:1wincmd w +:new +:new +:3wincmd w +:-hide +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:2wincmd w +:+hide +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:e! test.out +:call append(line('$'), map(copy(tests), 'join(v:val, " ")')) +Go +:w +:only! +:b1 +ENDTEST + +STARTTEST +:let tests = [] +:so tiny.vim +:set hidden +:for i in range(5) +:new +:endfor +:1wincmd w +:$ hide +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:$-1 close! +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:1wincmd w +:.+close! +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:e! test.out +:call append(line('$'), map(copy(tests), 'join(v:val, " ")')) +Go +:w +:only! +:b1 +ENDTEST + +STARTTEST +:let tests = [] +:so tiny.vim +:set hidden +:for i in range(5) +:new +:endfor +:4wincmd w +c +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +1c +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +9c +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:1wincmd w +2c +:let buffers = [] +:windo call add(buffers, bufnr('%')) +:call add(tests, buffers) +:only! +:e! test.out +:call append(line('$'), map(copy(tests), 'join(v:val, " ")')) +:w +:qa! +ENDTEST + + diff --git a/src/testdir/test_close_count.ok b/src/testdir/test_close_count.ok new file mode 100644 index 0000000000..1cee870487 --- /dev/null +++ b/src/testdir/test_close_count.ok @@ -0,0 +1,23 @@ +6 5 4 2 1 +5 4 2 1 +5 4 2 +5 2 +7 5 2 +7 5 + +13 12 11 10 9 1 +13 12 11 9 1 +12 11 9 1 +12 11 9 +12 9 +15 12 9 +15 12 + +20 19 18 17 16 +20 19 18 16 +20 18 16 + +25 24 23 21 1 +24 23 21 1 +24 23 21 +24 21 From 0f2c1c29852fed1a86f12672f62d7af771f48c56 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 15:33:02 +0100 Subject: [PATCH 214/311] updated for version 7.4.535 Problem: Can't build with tiny features. Solution: Add #ifdefs and skip a test. --- src/ex_docmd.c | 156 ++++++++++++++--------------- src/testdir/test_argument_count.in | 1 + src/version.c | 2 + 3 files changed, 81 insertions(+), 78 deletions(-) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index a0030281a4..4ce9e926ab 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1713,6 +1713,53 @@ compute_buffer_local_count(addr_type, lnum, offset) return buf->b_fnum; } +#ifdef FEAT_WINDOWS +static int current_win_nr __ARGS((win_T *win)); +static int current_tab_nr __ARGS((tabpage_T *tab)); + + static int +current_win_nr(win) + win_T *win; +{ + win_T *wp; + int nr = 0; + + for (wp = firstwin; wp != NULL; wp = wp->w_next) + { + ++nr; + if (wp == win) + break; + } + return nr; +} + + static int +current_tab_nr(tab) + tabpage_T *tab; +{ + tabpage_T *tp; + int nr = 0; + + for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + { + ++nr; + if (tp == tab) + break; + } + return nr; +} + +# define CURRENT_WIN_NR current_win_nr(curwin) +# define LAST_WIN_NR current_win_nr(NULL) +# define CURRENT_TAB_NR current_tab_nr(curtab) +# define LAST_TAB_NR current_tab_nr(NULL) +#else +# define CURRENT_WIN_NR 1 +# define LAST_WIN_NR 1 +# define CURRENT_TAB_NR 1 +# define LAST_TAB_NR 1 +#endif + /* * Execute one Ex command. @@ -1765,8 +1812,6 @@ do_one_cmd(cmdlinep, sourcing, #endif cmdmod_T save_cmdmod; int ni; /* set when Not Implemented */ - win_T *wp; - tabpage_T *tp; char_u *cmd; vim_memset(&ea, 0, sizeof(ea)); @@ -2085,13 +2130,7 @@ do_one_cmd(cmdlinep, sourcing, ea.line2 = curwin->w_cursor.lnum; break; case ADDR_WINDOWS: - lnum = 0; - for (wp = firstwin; wp != NULL; wp = wp->w_next) - { - lnum++; - if (wp == curwin) - break; - } + lnum = CURRENT_WIN_NR; ea.line2 = lnum; break; case ADDR_ARGUMENTS: @@ -2102,13 +2141,7 @@ do_one_cmd(cmdlinep, sourcing, ea.line2 = curbuf->b_fnum; break; case ADDR_TABS: - lnum = 0; - for(tp = first_tabpage; tp != NULL; tp = tp->tp_next) - { - lnum++; - if (tp == curtab) - break; - } + lnum = CURRENT_TAB_NR; ea.line2 = lnum; break; } @@ -4198,8 +4231,6 @@ get_address(ptr, addr_type, skip, to_other_file) pos_T pos; pos_T *fp; linenr_T lnum; - win_T *wp; - tabpage_T *tp; cmd = skipwhite(*ptr); lnum = MAXLNUM; @@ -4215,13 +4246,7 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = curwin->w_cursor.lnum; break; case ADDR_WINDOWS: - lnum = 0; - for (wp = firstwin; wp != NULL; wp = wp->w_next) - { - lnum++; - if (wp == curwin) - break; - } + lnum = CURRENT_WIN_NR; break; case ADDR_ARGUMENTS: lnum = curwin->w_arg_idx + 1; @@ -4231,13 +4256,7 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = curbuf->b_fnum; break; case ADDR_TABS: - lnum = 0; - for(tp = first_tabpage; tp != NULL; tp = tp->tp_next) - { - lnum++; - if (tp == curtab) - break; - } + lnum = CURRENT_TAB_NR; break; } break; @@ -4250,9 +4269,7 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = curbuf->b_ml.ml_line_count; break; case ADDR_WINDOWS: - lnum = 0; - for (wp = firstwin; wp != NULL; wp = wp->w_next) - lnum++; + lnum = LAST_WIN_NR; break; case ADDR_ARGUMENTS: lnum = ARGCOUNT; @@ -4262,9 +4279,7 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = lastbuf->b_fnum; break; case ADDR_TABS: - lnum = 0; - for(tp = first_tabpage; tp != NULL; tp = tp->tp_next) - lnum++; + lnum = LAST_TAB_NR; break; } break; @@ -4419,16 +4434,11 @@ get_address(ptr, addr_type, skip, to_other_file) switch (addr_type) { case ADDR_LINES: - lnum = curwin->w_cursor.lnum; /* "+1" is same as ".+1" */ + /* "+1" is same as ".+1" */ + lnum = curwin->w_cursor.lnum; break; case ADDR_WINDOWS: - lnum = 0; - for (wp = firstwin; wp != NULL; wp = wp->w_next) - { - lnum++; - if (wp == curwin) - break; - } + lnum = CURRENT_WIN_NR; break; case ADDR_ARGUMENTS: lnum = curwin->w_arg_idx + 1; @@ -4438,13 +4448,7 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = curbuf->b_fnum; break; case ADDR_TABS: - lnum = 0; - for(tp = first_tabpage; tp != NULL; tp = tp->tp_next) - { - lnum++; - if (tp == curtab) - break; - } + lnum = CURRENT_TAB_NR; break; } } @@ -4481,9 +4485,7 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = 0; break; } - c = 0; - for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) - c++; + c = LAST_TAB_NR; if (lnum >= c) lnum = c; break; @@ -4493,9 +4495,7 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = 0; break; } - c = 0; - for (wp = firstwin; wp != NULL; wp = wp->w_next) - c++; + c = LAST_WIN_NR; if (lnum > c) lnum = c; break; @@ -6805,15 +6805,15 @@ not_exiting() } /* - * ":quit": quit current window, quit Vim if closed the last window. + * ":quit": quit current window, quit Vim if the last window is closed. */ static void ex_quit(eap) exarg_T *eap; { +#if defined(FEAT_WINDOWS) || defined(FEAT_AUTOCMD) win_T *wp; - buf_T *buf; - int wnr; +#endif #ifdef FEAT_CMDWIN if (cmdwin_type != 0) @@ -6828,28 +6828,27 @@ ex_quit(eap) text_locked_msg(); return; } +#ifdef FEAT_WINDOWS if (eap->addr_count > 0) { - wnr = eap->line2; - for (wp = firstwin; --wnr > 0; ) - { - if (wp->w_next == NULL) + int wnr = eap->line2; + + for (wp = firstwin; wp->w_next != NULL; wp = wp->w_next) + if (--wnr <= 0) break; - else - wp = wp->w_next; - } - buf = wp->w_buffer; } else - { +#endif +#if defined(FEAT_WINDOWS) || defined(FEAT_AUTOCMD) wp = curwin; - buf = curbuf; - } +#endif + #ifdef FEAT_AUTOCMD apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf); /* Refuse to quit when locked or when the buffer in the last window is * being closed (can only happen in autocommands). */ - if (curbuf_locked() || (buf->b_nwindows == 1 && buf->b_closing)) + if (curbuf_locked() || (wp->w_buffer->b_nwindows == 1 + && wp->w_buffer->b_closing)) return; #endif @@ -7214,9 +7213,6 @@ ex_all(eap) ex_hide(eap) exarg_T *eap; { - win_T *win; - int winnr = 0; - if (*eap->arg != NUL && check_nextcmd(eap->arg) == NULL) eap->errmsg = e_invarg; else @@ -7231,7 +7227,11 @@ ex_hide(eap) # endif if (eap->addr_count == 0) win_close(curwin, FALSE); /* don't free buffer */ - else { + else + { + int winnr = 0; + win_T *win; + for (win = firstwin; win != NULL; win = win->w_next) { winnr++; diff --git a/src/testdir/test_argument_count.in b/src/testdir/test_argument_count.in index f45e52a3e6..cdac0308e7 100644 --- a/src/testdir/test_argument_count.in +++ b/src/testdir/test_argument_count.in @@ -1,6 +1,7 @@ Tests for :[count]argument! and :[count]argdelete vim: set ft=vim : STARTTEST +:so small.vim :%argd :argadd a b c d :set hidden diff --git a/src/version.c b/src/version.c index 5162178c05..6ce2f04fb3 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 535, /**/ 534, /**/ From fd1aa7aa02dc9c3356e1a1d84fd33d2059e291a5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 15:57:11 +0100 Subject: [PATCH 215/311] updated for version 7.4.536 Problem: Test 63 fails when using a black&white terminal. Solution: Add attributes for a non-color terminal. (Christian Brabandt) --- src/testdir/test63.in | 6 +++--- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/testdir/test63.in b/src/testdir/test63.in index a161d6745c..1f073a78a6 100644 --- a/src/testdir/test63.in +++ b/src/testdir/test63.in @@ -7,9 +7,9 @@ STARTTEST :" --- Check that "matcharg()" returns the correct group and pattern if a match :" --- is defined. :let @r = "*** Test 1: " -:highlight MyGroup1 ctermbg=red guibg=red -:highlight MyGroup2 ctermbg=green guibg=green -:highlight MyGroup3 ctermbg=blue guibg=blue +:highlight MyGroup1 term=bold ctermbg=red guibg=red +:highlight MyGroup2 term=italic ctermbg=green guibg=green +:highlight MyGroup3 term=underline ctermbg=blue guibg=blue :match MyGroup1 /TODO/ :2match MyGroup2 /FIXME/ :3match MyGroup3 /XXX/ diff --git a/src/version.c b/src/version.c index 6ce2f04fb3..5915f95eb8 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 536, /**/ 535, /**/ From 8788d7059e18a4739b1f6953c4aa695af24b584a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 27 Nov 2014 16:14:49 +0100 Subject: [PATCH 216/311] updated for version 7.4.537 Problem: Value of v:hlsearch reflects an internal variable. Solution: Make the value reflect whether search highlighting is actually displayed. (Christian Brabandt) --- runtime/doc/eval.txt | 8 ++++---- src/testdir/test101.in | 3 +++ src/testdir/test101.ok | 1 + src/version.c | 2 ++ src/vim.h | 4 ++-- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 829d4eea8d..7b3b9589b8 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1457,10 +1457,10 @@ v:foldstart Used for 'foldtext': first line of closed fold. Read-only in the |sandbox|. |fold-foldtext| *v:hlsearch* *hlsearch-variable* -v:hlsearch Variable that determines whether search highlighting is on. - Makes sense only if 'hlsearch' is enabled which requires - |+extra_search|. Setting this variable to zero acts the like - |:nohlsearch| command, setting it to one acts like > +v:hlsearch Variable that indicates whether search highlighting is on. + Setting it makes sense only if 'hlsearch' is enabled which + requires |+extra_search|. Setting this variable to zero acts + the like |:nohlsearch| command, setting it to one acts like > let &hlsearch = &hlsearch < *v:insertmode* *insertmode-variable* diff --git a/src/testdir/test101.in b/src/testdir/test101.in index 04c934f2c5..31fc334393 100644 --- a/src/testdir/test101.in +++ b/src/testdir/test101.in @@ -25,6 +25,9 @@ n:AddR :AddR / :AddR +:set nohls +/ +:AddR :let r1=r[0][0] :" I guess it is not guaranteed that screenattr outputs always the same character :call map(r, 'v:val[1].":".(v:val[0]==r1?"highlighted":"not highlighted")') diff --git a/src/testdir/test101.ok b/src/testdir/test101.ok index 3ed7436cf7..f063b85dea 100644 --- a/src/testdir/test101.ok +++ b/src/testdir/test101.ok @@ -8,4 +8,5 @@ start: 1:highlighted 0:not highlighted 1:highlighted +0:not highlighted Vim(let):E706: diff --git a/src/version.c b/src/version.c index 5915f95eb8..1f7000f019 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 537, /**/ 536, /**/ diff --git a/src/vim.h b/src/vim.h index 2a6d9a0445..7f3e393d53 100644 --- a/src/vim.h +++ b/src/vim.h @@ -1998,7 +1998,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */ #ifndef FEAT_VIRTUALEDIT # define getvvcol(w, p, s, c, e) getvcol(w, p, s, c, e) -# define virtual_active() 0 +# define virtual_active() FALSE # define virtual_op FALSE #endif @@ -2277,7 +2277,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */ #define AUTOLOAD_CHAR '#' #ifdef FEAT_EVAL -# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag); set_vim_var_nr(VV_HLSEARCH, !no_hlsearch) +# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag); set_vim_var_nr(VV_HLSEARCH, !no_hlsearch && p_hls) #else # define SET_NO_HLSEARCH(flag) no_hlsearch = (flag) #endif From 7ef835664cf84b5704fecdf7a1575b02da8eefde Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 30 Nov 2014 10:34:23 +0100 Subject: [PATCH 217/311] updated for version 7.4.538 Problem: Tests fail with small features plus Python. Solution: Disallow weird combination of options. Do not set "fdm" when folding is disabled. --- src/auto/configure | 12 ++++++++++++ src/configure.in | 12 ++++++++++++ src/ex_cmds.c | 2 ++ src/feature.h | 7 ------- src/option.c | 1 + src/version.c | 2 ++ 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/auto/configure b/src/auto/configure index f5195b2462..ddc5c1e039 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -5728,6 +5728,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_pythoninterp" >&5 $as_echo "$enable_pythoninterp" >&6; } if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5 + fi + for ac_prog in python2 python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -6044,6 +6048,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_python3interp" >&5 $as_echo "$enable_python3interp" >&6; } if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + as_fn_error $? "cannot use Python with tiny or small features" "$LINENO" 5 + fi + for ac_prog in python3 python do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -6929,6 +6937,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_rubyinterp" >&5 $as_echo "$enable_rubyinterp" >&6; } if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + as_fn_error $? "cannot use Ruby with tiny or small features" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --with-ruby-command argument" >&5 $as_echo_n "checking --with-ruby-command argument... " >&6; } diff --git a/src/configure.in b/src/configure.in index ff1f4824b4..033138c115 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1041,6 +1041,10 @@ AC_ARG_ENABLE(pythoninterp, [enable_pythoninterp="no"]) AC_MSG_RESULT($enable_pythoninterp) if test "$enable_pythoninterp" = "yes" -o "$enable_pythoninterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_ERROR([cannot use Python with tiny or small features]) + fi + dnl -- find the python executable AC_PATH_PROGS(vi_cv_path_python, python2 python) if test "X$vi_cv_path_python" != "X"; then @@ -1243,6 +1247,10 @@ AC_ARG_ENABLE(python3interp, [enable_python3interp="no"]) AC_MSG_RESULT($enable_python3interp) if test "$enable_python3interp" = "yes" -o "$enable_python3interp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_ERROR([cannot use Python with tiny or small features]) + fi + dnl -- find the python3 executable AC_PATH_PROGS(vi_cv_path_python3, python3 python) if test "X$vi_cv_path_python3" != "X"; then @@ -1720,6 +1728,10 @@ AC_ARG_ENABLE(rubyinterp, [enable_rubyinterp="no"]) AC_MSG_RESULT($enable_rubyinterp) if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then + if test "x$features" = "xtiny" -o "x$features" = "xsmall"; then + AC_MSG_ERROR([cannot use Ruby with tiny or small features]) + fi + AC_MSG_CHECKING(--with-ruby-command argument) AC_SUBST(vi_cv_path_ruby) AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)], diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 1114f85345..86dab4797d 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -6200,9 +6200,11 @@ prepare_help_buffer() (void)buf_init_chartab(curbuf, FALSE); } +#ifdef FEAT_FOLDING /* Don't use the global foldmethod.*/ set_string_option_direct((char_u *)"fdm", -1, (char_u *)"manual", OPT_FREE|OPT_LOCAL, 0); +#endif curbuf->b_p_ts = 8; /* 'tabstop' is 8 */ curwin->w_p_list = FALSE; /* no list mode */ diff --git a/src/feature.h b/src/feature.h index 917179401b..01f611e381 100644 --- a/src/feature.h +++ b/src/feature.h @@ -384,13 +384,6 @@ # endif #endif -/* - * +python and +python3 require FEAT_EVAL. - */ -#if !defined(FEAT_EVAL) && (defined(FEAT_PYTHON3) || defined(FEAT_PYTHON)) -# define FEAT_EVAL -#endif - /* * +profile Profiling for functions and scripts. */ diff --git a/src/option.c b/src/option.c index a97dae6262..3195fa8d90 100644 --- a/src/option.c +++ b/src/option.c @@ -5575,6 +5575,7 @@ set_string_option_direct(name, opt_idx, val, opt_flags, set_sid) if (idx < 0) /* not found (should not happen) */ { EMSG2(_(e_intern2), "set_string_option_direct()"); + EMSG2(_("For option %s"), name); return; } } diff --git a/src/version.c b/src/version.c index 1f7000f019..9545d00935 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 538, /**/ 537, /**/ From 7b9be6bba799315e83b524baac3fe359557cc6f0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 30 Nov 2014 11:50:16 +0100 Subject: [PATCH 218/311] updated for version 7.4.539 Problem: Crash when computing buffer count. Problem with range for user commands. Line range wrong in Visual area. Solution: Avoid segfault in compute_buffer_local_count(). Check for CMD_USER when checking type of range. (Marcin Szamotulski) --- runtime/doc/windows.txt | 12 +++++++-- src/ex_docmd.c | 55 ++++++++++++++++++++++++++++++----------- src/version.c | 2 ++ 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index d116c9f6c5..2830a04b84 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1029,7 +1029,11 @@ list of buffers. |unlisted-buffer| Actually, the buffer isn't completely deleted, it is removed from the buffer list |unlisted-buffer| and option values, variables and mappings/abbreviations for the buffer are - cleared. + cleared. Examples: > + :.,$-bdelete " delete buffers from the current one to + " last but one + :%bdelete " delete all buffers +< :bdelete[!] {bufname} *E93* *E94* Like ":bdelete[!] [N]", but buffer given by name. Note that a @@ -1053,7 +1057,11 @@ list of buffers. |unlisted-buffer| Like |:bdelete|, but really delete the buffer. Everything related to the buffer is lost. All marks in this buffer become invalid, option settings are lost, etc. Don't use this - unless you know what you are doing. + unless you know what you are doing. Examples: > + :.+,$bwipeout " wipe out all buffers after the current + " one + :%bwipeout " wipe out all buffers +< :[N]bun[load][!] *:bun* *:bunload* *E515* :bun[load][!] [N] diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 4ce9e926ab..b926027f26 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1694,6 +1694,7 @@ compute_buffer_local_count(addr_type, lnum, offset) int offset; { buf_T *buf; + buf_T *nextbuf; int count = offset; buf = firstbuf; @@ -1701,15 +1702,30 @@ compute_buffer_local_count(addr_type, lnum, offset) buf = buf->b_next; while (count != 0) { - count += (count < 0) ? 1 : -1; - if (buf->b_prev == NULL) + count += (offset < 0) ? 1 : -1; + nextbuf = (offset < 0) ? buf->b_prev : buf->b_next; + if (nextbuf == NULL) break; - buf = (count < 0) ? buf->b_prev : buf->b_next; + buf = nextbuf; if (addr_type == ADDR_LOADED_BUFFERS) /* skip over unloaded buffers */ - while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL) - buf = (count < 0) ? buf->b_prev : buf->b_next; + while (buf->b_ml.ml_mfp == NULL) + { + nextbuf = (offset < 0) ? buf->b_prev : buf->b_next; + if (nextbuf == NULL) + break; + buf = nextbuf; + } } + /* we might have gone too far, last buffer is not loadedd */ + if (addr_type == ADDR_LOADED_BUFFERS) + while (buf->b_ml.ml_mfp == NULL) + { + nextbuf = (offset >= 0) ? buf->b_prev : buf->b_next; + if (nextbuf == NULL) + break; + buf = nextbuf; + } return buf->b_fnum; } @@ -2113,7 +2129,7 @@ do_one_cmd(cmdlinep, sourcing, * is equal to the lower. */ - if (ea.cmdidx != CMD_SIZE) + if (ea.cmdidx != CMD_USER && ea.cmdidx != CMD_SIZE) ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type; else ea.addr_type = ADDR_LINES; @@ -2153,6 +2169,7 @@ do_one_cmd(cmdlinep, sourcing, { if (*ea.cmd == '%') /* '%' - all lines */ { + buf_T *buf; ++ea.cmd; switch (ea.addr_type) { @@ -2160,9 +2177,21 @@ do_one_cmd(cmdlinep, sourcing, ea.line1 = 1; ea.line2 = curbuf->b_ml.ml_line_count; break; - case ADDR_WINDOWS: case ADDR_LOADED_BUFFERS: + buf = firstbuf; + while (buf->b_next != NULL && buf->b_ml.ml_mfp == NULL) + buf = buf->b_next; + ea.line1 = buf->b_fnum; + buf = lastbuf; + while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL) + buf = buf->b_prev; + ea.line2 = buf->b_fnum; + break; case ADDR_UNLOADED_BUFFERS: + ea.line1 = firstbuf->b_fnum; + ea.line2 = lastbuf->b_fnum; + break; + case ADDR_WINDOWS: case ADDR_TABS: errormsg = (char_u *)_(e_invrange); goto doend; @@ -4463,7 +4492,7 @@ get_address(ptr, addr_type, skip, to_other_file) n = getdigits(&cmd); if (addr_type == ADDR_LOADED_BUFFERS || addr_type == ADDR_UNLOADED_BUFFERS) - lnum = compute_buffer_local_count(addr_type, lnum, n); + lnum = compute_buffer_local_count(addr_type, lnum, (i == '-') ? -1 * n : n); else if (i == '-') lnum -= n; else @@ -4485,9 +4514,8 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = 0; break; } - c = LAST_TAB_NR; - if (lnum >= c) - lnum = c; + if (lnum >= LAST_TAB_NR) + lnum = LAST_TAB_NR; break; case ADDR_WINDOWS: if (lnum < 0) @@ -4495,9 +4523,8 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = 0; break; } - c = LAST_WIN_NR; - if (lnum > c) - lnum = c; + if (lnum >= LAST_WIN_NR) + lnum = LAST_WIN_NR; break; case ADDR_LOADED_BUFFERS: case ADDR_UNLOADED_BUFFERS: diff --git a/src/version.c b/src/version.c index 9545d00935..9e9e80281f 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 539, /**/ 538, /**/ From f08b58578c7cb6607974662d738a10afef1113f5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 30 Nov 2014 19:51:06 +0100 Subject: [PATCH 219/311] updated for version 7.4.540 Problem: Cannot build with tiny and small features. (Taro Muraoka) Solution: Add #ifdef around CMD_USER. --- src/ex_docmd.c | 6 +++++- src/version.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index b926027f26..607dbd9eec 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2129,7 +2129,11 @@ do_one_cmd(cmdlinep, sourcing, * is equal to the lower. */ - if (ea.cmdidx != CMD_USER && ea.cmdidx != CMD_SIZE) + if (ea.cmdidx != CMD_SIZE +#ifdef FEAT_USR_CMDS + && ea.cmdidx != CMD_USER +#endif + ) ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type; else ea.addr_type = ADDR_LINES; diff --git a/src/version.c b/src/version.c index 9e9e80281f..57b5d76421 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 540, /**/ 539, /**/ From c0e38f84e5a1e3a8f61b2580b1af40cd4ddd889e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 6 Dec 2014 20:33:00 +0100 Subject: [PATCH 220/311] Update runtime files. --- runtime/autoload/phpcomplete.vim | 74 ++++++++++++++++++++---- runtime/doc/editing.txt | 25 +++++--- runtime/doc/eval.txt | 15 ++++- runtime/doc/indent.txt | 2 +- runtime/doc/syntax.txt | 3 +- runtime/doc/tabpage.txt | 2 +- runtime/doc/todo.txt | 97 ++++++++++++++++++++++---------- runtime/doc/windows.txt | 17 +++--- runtime/filetype.vim | 6 +- runtime/indent/php.vim | 87 +++++++++++++++++----------- runtime/macros/editexisting.vim | 4 +- runtime/syntax/zimbu.vim | 64 +++++++++++++++------ 12 files changed, 277 insertions(+), 119 deletions(-) diff --git a/runtime/autoload/phpcomplete.vim b/runtime/autoload/phpcomplete.vim index b014b4cdcf..5ddad88873 100644 --- a/runtime/autoload/phpcomplete.vim +++ b/runtime/autoload/phpcomplete.vim @@ -3,7 +3,7 @@ " Maintainer: Dávid Szabó ( complex857 AT gmail DOT com ) " Previous Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl ) " URL: https://github.com/shawncplus/phpcomplete.vim -" Last Change: 2014 Oct 02 +" Last Change: 2014 Dec 01 " " OPTIONS: " @@ -1172,11 +1172,11 @@ function! phpcomplete#GetCurrentInstruction(line_number, col_number, phpbegin) " " break if we are on a "naked" stop_char (operators, colon, openparent...) if index(stop_chars, current_char) != -1 let do_break = 1 - " dont break does not look like a "->" + " dont break if it does look like a "->" if (prev_char == '-' && current_char == '>') || (current_char == '-' && next_char == '>') let do_break = 0 endif - " dont break if its looks like a "::" + " dont break if it does look like a "::" if (prev_char == ':' && current_char == ':') || (current_char == ':' && next_char == ':') let do_break = 0 endif @@ -1356,8 +1356,12 @@ function! phpcomplete#GetCallChainReturnType(classname_candidate, class_candidat endif " make @return self, static, $this the same way " (not exactly what php means by these) - if returnclass == 'self' || returnclass == 'static' || returnclass == '$this' - let classname_candidate = a:classname_candidate + if returnclass == 'self' || returnclass == 'static' || returnclass == '$this' || returnclass == 'self[]' || returnclass == 'static[]' || returnclass == '$this[]' + if returnclass =~ '\[\]$' + let classname_candidate = a:classname_candidate.'[]' + else + let classname_candidate = a:classname_candidate + endif let class_candidate_namespace = a:class_candidate_namespace else let [classname_candidate, class_candidate_namespace] = phpcomplete#ExpandClassName(returnclass, fullnamespace, a:imports) @@ -1527,7 +1531,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor let function_boundary = phpcomplete#GetCurrentFunctionBoundaries() let search_end_line = max([1, function_boundary[0][0]]) " -1 makes us ignore the current line (where the completion was invoked - let lines = reverse(getline(search_end_line, line('.') - 1)) + let lines = reverse(getline(search_end_line, a:start_line - 1)) " check Constant lookup let constant_object = matchstr(a:context, '\zs'.class_name_pattern.'\ze::') @@ -1638,9 +1642,32 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " assignment for the variable in question with a variable on the right hand side if line =~# '^\s*'.object.'\s*=&\?\s*'.variable_name_pattern - let tailing_semicolon = match(line, ';\s*$') - let tailing_semicolon = tailing_semicolon != -1 ? tailing_semicolon : strlen(getline(a:start_line - i)) - let prev_context = phpcomplete#GetCurrentInstruction(a:start_line - i, tailing_semicolon - 1, b:phpbegin) + + " try to find the next non-comment or string ";" char + let start_col = match(line, '^\s*'.object.'\C\s*=\zs&\?\s*'.variable_name_pattern) + let filelines = reverse(lines) + let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col]) + let chars_read = 1 + " read while end of the file + while char != 'EOF' && chars_read < 1000 + let last_pos = pos + let [pos, char] = s:getNextCharWithPos(filelines, pos) + let chars_read += 1 + " we got a candidate + if char == ';' + let synIDName = synIDattr(synID(pos[0] + 1, pos[1] + 1, 0), 'name') + " it's not a comment or string, end search + if synIDName !~? 'comment\|string' + break + endif + endif + endwhile + + let prev_context = phpcomplete#GetCurrentInstruction(last_pos[0] + 1, last_pos[1], b:phpbegin) + if prev_context == '' + " cannot get previous context give up + return + endif let prev_class = phpcomplete#GetClassName(a:start_line - i, prev_context, a:current_namespace, a:imports) if stridx(prev_class, '\') != -1 @@ -1656,9 +1683,32 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor " assignment for the variable in question with a function on the right hand side if line =~# '^\s*'.object.'\s*=&\?\s*'.function_invocation_pattern - let tailing_semicolon = match(line, ';\s*$') - let tailing_semicolon = tailing_semicolon != -1 ? tailing_semicolon : strlen(getline(a:start_line - i)) - let prev_context = phpcomplete#GetCurrentInstruction(a:start_line - i, tailing_semicolon - 1, b:phpbegin) + + " try to find the next non-comment or string ";" char + let start_col = match(line, '\C^\s*'.object.'\s*=\zs&\?\s*'.function_invocation_pattern) + let filelines = reverse(lines) + let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col]) + let chars_read = 1 + " read while end of the file + while char != 'EOF' && chars_read < 1000 + let last_pos = pos + let [pos, char] = s:getNextCharWithPos(filelines, pos) + let chars_read += 1 + " we got a candidate + if char == ';' + let synIDName = synIDattr(synID(pos[0] + 1, pos[1] + 1, 0), 'name') + " it's not a comment or string, end search + if synIDName !~? 'comment\|string' + break + endif + endif + endwhile + + let prev_context = phpcomplete#GetCurrentInstruction(last_pos[0] + 1, last_pos[1], b:phpbegin) + if prev_context == '' + " cannot get previous context give up + return + endif let function_name = matchstr(prev_context, '^'.function_invocation_pattern.'\ze') let function_name = matchstr(function_name, '^\zs.\+\ze\s*($') " strip the trailing ( diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index a71cbc0047..71f2f8c25c 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.4. Last change: 2014 Nov 19 +*editing.txt* For Vim version 7.4. Last change: 2014 Dec 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -611,7 +611,7 @@ list of the current window. :[count]arga[dd] {name} .. *:arga* *:argadd* *E479* :[count]arga[dd] Add the {name}s to the argument list. When {name} is - omitted at the current buffer name to the argument + omitted add the current buffer name to the argument list. If [count] is omitted, the {name}s are added just after the current entry in the argument list. @@ -622,7 +622,8 @@ list of the current window. :argadd x a b x c :0argadd x x a b c :1argadd x a x b c - :99argadd x a b c x + :$argadd x a b c x + :+2argadd y a b c x y There is no check for duplicates, it is possible to add a file to the argument list twice. The currently edited file is not changed. @@ -644,11 +645,19 @@ list of the current window. < {not in Vi} {not available when compiled without the |+listcmds| feature} -:{range}argd[elete] Delete the {range} files from the argument list. +:[range]argd[elete] Delete the {range} files from the argument list. + Example: > + :10,$argdel +< Deletes arguments 10 and further, keeping 1-9. > + :$argd +< Deletes just the last one. > + :argd + :.argd +< Deletes the current argument. > + :%argd +< Removes all the files from the arglist. When the last number in the range is too high, up to - the last argument is deleted. Example: > - :10,1000argdel -< Deletes arguments 10 and further, keeping 1-9. + the last argument is deleted. {not in Vi} {not available when compiled without the |+listcmds| feature} @@ -1082,7 +1091,7 @@ The names can be in upper- or lowercase. :q[uit]! Quit without writing, also when currently visible buffers have changes. Does not exit when this is the - last window and there are is a changed hidden buffer. + last window and there is a changed hidden buffer. In this case, the first changed hidden buffer becomes the current buffer. Use ":qall!" to exit always. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 7b3b9589b8..21df37f301 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Nov 15 +*eval.txt* For Vim version 7.4. Last change: 2014 Nov 27 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3305,6 +3305,17 @@ getchar([expr]) *getchar()* : endif : endwhile :endfunction +< + You may also receive syntetic characters, such as + ||. Often you will want to ignore this and get + another character: > + :function GetKey() + : let c = getchar() + : while c == "\" + : let c = getchar() + : endwhile + : return c + :endfunction getcharmod() *getcharmod()* The result is a Number which is the state of the modifiers for @@ -3515,7 +3526,7 @@ getpos({expr}) Get the position for {expr}. For possible values of {expr} This can be used to save and restore the position of a mark: > let save_a_mark = getpos("'a") ... - call setpos(''a', save_a_mark + call setpos("'a", save_a_mark) < Also see |getcurpos()| and |setpos()|. diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index fc16b1a7e7..3f61e28651 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -1,4 +1,4 @@ -*indent.txt* For Vim version 7.4. Last change: 2014 Apr 23 +*indent.txt* For Vim version 7.4. Last change: 2014 Dec 06 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index ee91a91acb..efb7bda661 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2014 Sep 27 +*syntax.txt* For Vim version 7.4. Last change: 2014 Nov 19 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5065,6 +5065,7 @@ This will set the "w:current_syntax" variable to "foo". The value of restoring "b:current_syntax", since the syntax files do set "b:current_syntax". The value set by the syntax file is assigned to "w:current_syntax". +Note: This resets the 'spell', 'spellcapcheck' and 'spellfile' options. Once a window has its own syntax, syntax commands executed from other windows on the same buffer (including :syntax clear) have no effect. Conversely, diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index b795dbe552..47e1a4b674 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -1,4 +1,4 @@ -*tabpage.txt* For Vim version 7.4. Last change: 2012 Aug 08 +*tabpage.txt* For Vim version 7.4. Last change: 2014 Nov 27 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 2957b29491..04f9a44b95 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Nov 19 +*todo.txt* For Vim version 7.4. Last change: 2014 Dec 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,9 +34,23 @@ not be repeated below, unless there is extra information. *known-bugs* -------------------- Known bugs and current work ----------------------- +Patch to fix list range assign crash. (Yukihiro Nakadaira, 2014 Dec 1) + +Patch to fix range with user command. (Marcin Szamotulski, 2014 Dec 2) +Update Dec 6, with support for user commands. + +When window number in Ex range is too high, give an error? +Only when backwards compatible. + +:s/\n// doesn't change anything. Since 7.4.232? (Eliseo Martínez, 2014 Nov +28) Patch on Issue 287 + +Using vim_snprintf() in window.c can be in a function. + Regexp problems: - The NFA engine does not implement the time limit passed to nfa_regexec_multi() +- Very slow with a long line and Ruby highlighting. (John Whitley, 2014 Dec 4) - Bug with pattern: '\vblock (\d+)\.\n.*\d+%(\1)@ + (Note: CTRL-Q does not work on all terminals). + + If [count] is greater than the last window number the last + window will be closed: > :1quit " quit the first window :$quit " quit the last window :9quit " quit the last window " if there are less than 9 windows opened :-quit " quit the previews window :+quit " quit the next window - :+2quit " will also work as expected + :+2quit " quit the second next window < :q[uit]! :{count}q[uit]! @@ -332,9 +333,9 @@ CTRL-W CTRL-C *CTRL-W_CTRL-C* screen. For {count} see |:quit| command. The buffer becomes hidden (unless there is another window - editing it or 'bufhidden' is "unload" or "delete"). If the - window is the last one in the current tab page the tab page is - closed. |tab-page| + editing it or 'bufhidden' is "unload", "delete" or "wipe"). + If the window is the last one in the current tab page the tab + page is closed. |tab-page| The value of 'hidden' is irrelevant for this command. Changes to the buffer are not written and won't get lost, so this is a diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 508f19820b..e55642d142 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2014 Nov 05 +" Last Change: 2014 Dec 06 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1856,7 +1856,7 @@ au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. " Gentoo ebuilds are actually bash scripts -au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,*.bash,*.ebuild call SetFileTypeSH("bash") +au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,.bash_aliases*,*.bash,*.ebuild call SetFileTypeSH("bash") au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh") au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1)) @@ -2502,6 +2502,8 @@ au BufNewFile,BufRead */etc/yum.conf setf dosini " Zimbu au BufNewFile,BufRead *.zu setf zimbu +" Zimbu Templates +au BufNewFile,BufRead *.zut setf zimbutempl " Zope " dtml (zope dynamic template markup language), pt (zope page template), diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index b83a1923ed..1bffa7f195 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -3,8 +3,8 @@ " Author: John Wellesz " URL: http://www.2072productions.com/vim/indent/php.vim " Home: https://github.com/2072/PHP-Indenting-for-VIm -" Last Change: 2014 April 3rd -" Version: 1.49 +" Last Change: 2014 November 26th +" Version: 1.57 " " " Type :help php-indent for available options @@ -48,7 +48,7 @@ endif let b:did_indent = 1 -let php_sync_method = 0 +let g:php_sync_method = 0 @@ -112,7 +112,7 @@ setlocal nocindent setlocal nolisp setlocal indentexpr=GetPhpIndent() -setlocal indentkeys=0{,0},0),:,!^F,o,O,e,*,=?>,=,=?>,=\|\%(}\s*\)\?else\>\|do\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|trait\>\|use\>\|interface\>\|abstract\>\|final\>\|try\>\|\%(}\s*\)\=catch\>\|\%(}\s*\)\=finally\>\)' -let s:functionDecl = '\\%(\s\+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\)\=\s*(.*' +let s:functionDecl = '\\%(\s\+'.s:PHP_validVariable.'\)\=\s*(.*' let s:endline= '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' -let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\)'.s:endline.'\)\|^[^''"`]*[''"`]$' + + +let s:terminated = '\%(\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|^\s*'.s:PHP_validVariable.':\)'.s:endline.'\)\|^[^''"`]*[''"`]$' let s:PHP_startindenttag = '\)\@!\|]*>\%(.*<\/script>\)\@!' @@ -140,7 +143,7 @@ let s:PHP_startindenttag = '\)\@!\|]*>\%(.*<\/script>\)\@!' let s:escapeDebugStops = 0 function! DebugPrintReturn(scriptLine) - if ! s:escapeDebugStops + if ! s:escapeDebugStops echo "debug:" . a:scriptLine let c = getchar() if c == "\" @@ -158,8 +161,6 @@ function! GetLastRealCodeLNum(startline) " {{{ let lnum = b:GetLastRealCodeLNum_ADD endif - let old_lnum = lnum - while lnum > 1 let lnum = prevnonblank(lnum) let lastline = getline(lnum) @@ -217,7 +218,7 @@ function! GetLastRealCodeLNum(startline) " {{{ let lnum=0 endif - if b:InPHPcode_and_script && !b:InPHPcode + if b:InPHPcode_and_script && 1 > b:InPHPcode let b:InPHPcode_and_script = 0 endif @@ -237,7 +238,7 @@ endfun function! Skippmatch() " {{{ let synname = synIDattr(synID(line("."), col("."), 0), "name") - if synname == "Delimiter" || synname == "phpRegionDelimiter" || synname =~# "^phpParent" || synname == "phpArrayParens" || synname =~# '^php\%(Block\|Brace\)' || synname == "javaScriptBraces" || synname =~# "^phpComment" && b:UserIsTypingComment + if synname == "Delimiter" || synname == "phpRegionDelimiter" || synname =~# "^phpParent" || synname == "phpArrayParens" || synname =~# '^php\%(Block\|Brace\)' || synname == "javaScriptBraces" || synname =~# '^php\%(Doc\)\?Comment' && b:UserIsTypingComment return 0 else return 1 @@ -249,7 +250,7 @@ function! FindOpenBracket(lnum, blockStarter) " {{{ let line = searchpair('{', '', '}', 'bW', 'Skippmatch()') if a:blockStarter == 1 - while line > 1 + while line > 1 let linec = getline(line) if linec =~ s:terminated || linec =~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline @@ -310,7 +311,6 @@ let s:defaultORcase = '^\s*\%(default\|case\).*:' function! FindTheSwitchIndent (lnum) " {{{ - let test = GetLastRealCodeLNum(a:lnum - 1) if test <= 1 @@ -353,7 +353,7 @@ function! IslinePHP (lnum, tofind) " {{{ if synname == 'phpStringSingle' || synname == 'phpStringDouble' || synname == 'phpBacktick' if cline !~ '^\s*[''"`]' - return "" + return "SpecStringEntrails" else return synname end @@ -372,7 +372,7 @@ if ! s:autoresetoptions endif function! ResetPhpOptions() - if ! b:optionsset && &filetype == "php" + if ! b:optionsset && &filetype =~ "php" if b:PHP_autoformatcomment setlocal comments=s1:/*,mb:*,ex:*/,://,:# @@ -418,7 +418,7 @@ function! GetPhpIndent() let b:PHP_indentinghuge = 0 let b:PHP_CurrentIndentLevel = b:PHP_default_indenting endif - let b:PHP_lastindented = v:lnum + let real_PHP_lastindented = v:lnum let b:PHP_LastIndentedWasComment=0 let b:PHP_InsideMultilineComment=0 let b:PHP_indentbeforelast = 0 @@ -430,9 +430,12 @@ function! GetPhpIndent() elseif v:lnum > b:PHP_lastindented let real_PHP_lastindented = b:PHP_lastindented - let b:PHP_lastindented = v:lnum + else + let real_PHP_lastindented = v:lnum endif + let b:PHP_lastindented = v:lnum + if !b:InPHPcode_checked " {{{ One time check let b:InPHPcode_checked = 1 @@ -443,11 +446,15 @@ function! GetPhpIndent() endif if synname!="" - if synname != "phpHereDoc" && synname != "phpHereDocDelimiter" + if synname == "SpecStringEntrails" + let b:InPHPcode = -1 " thumb down + let b:UserIsTypingComment = 0 + let b:InPHPcode_tofind = "" + elseif synname != "phpHereDoc" && synname != "phpHereDocDelimiter" let b:InPHPcode = 1 let b:InPHPcode_tofind = "" - if synname =~# "^phpComment" + if synname =~# '^php\%(Doc\)\?Comment' let b:UserIsTypingComment = 1 else let b:UserIsTypingComment = 0 @@ -483,9 +490,16 @@ function! GetPhpIndent() if b:InPHPcode_tofind!="" if cline =~? b:InPHPcode_tofind - let b:InPHPcode = 1 let b:InPHPcode_tofind = "" let b:UserIsTypingComment = 0 + + if b:InPHPcode == -1 + let b:InPHPcode = 1 + return -1 + end + + let b:InPHPcode = 1 + if cline =~ '\*/' call cursor(v:lnum, 1) if cline !~ '^\*/' @@ -510,7 +524,7 @@ function! GetPhpIndent() endif endif - if b:InPHPcode + if 1 == b:InPHPcode if !b:InPHPcode_and_script && last_line =~ '\%(\%(.*')=~"Delimiter" if cline !~? s:PHP_startindenttag @@ -520,8 +534,8 @@ function! GetPhpIndent() let b:InPHPcode_and_script = 1 endif - elseif last_line =~ '^[^''"`]\+[''"`]$' " a string identifier with nothing after it and no other string identifier before - let b:InPHPcode = 0 + elseif last_line =~ '^[^''"`]\+[''"`]$' + let b:InPHPcode = -1 let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '') elseif last_line =~? '<<<''\=\a\w*''\=$' let b:InPHPcode = 0 @@ -538,7 +552,7 @@ function! GetPhpIndent() endif " }}} - if !b:InPHPcode && !b:InPHPcode_and_script + if 1 > b:InPHPcode && !b:InPHPcode_and_script return -1 endif @@ -568,7 +582,7 @@ function! GetPhpIndent() endif endif - if !b:PHP_InsideMultilineComment && cline =~ '^\s*/\*' && cline !~ '\*/\s*$' + if !b:PHP_InsideMultilineComment && cline =~ '^\s*/\*\%(.*\*/\)\@!' if getline(v:lnum + 1) !~ '^\s*\*' return -1 endif @@ -669,17 +683,17 @@ function! GetPhpIndent() endwhile elseif last_line =~# unstated && cline !~ '^\s*);\='.endline - let ind = ind + &sw " we indent one level further when the preceding line is not stated + let ind = ind + &sw return ind + addSpecial - elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated " Added || last_line =~ '^)' on 2007-12-30 (array indenting problem broke other things) + elseif (ind != b:PHP_default_indenting || last_line =~ '^[)\]]' ) && last_line =~ terminated let previous_line = last_line let last_line_num = lnum let LastLineClosed = 1 let isSingleLineBlock = 0 while 1 - if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline " XXX + if ! isSingleLineBlock && previous_line =~ '^\s*}\|;\s*}'.endline call cursor(last_line_num, 1) if previous_line !~ '^}' @@ -740,14 +754,19 @@ function! GetPhpIndent() endif endif - let plinnum = GetLastRealCodeLNum(lnum - 1) + if (last_line !~ '^\s*}\%(}}\)\@!') + let plinnum = GetLastRealCodeLNum(lnum - 1) + else + let plinnum = GetLastRealCodeLNum(FindOpenBracket(lnum, 1) - 1) + endif + let AntepenultimateLine = getline(plinnum) let last_line = substitute(last_line,"\\(//\\|#\\)\\(\\(\\([^\"']*\\([\"']\\)[^\"']*\\5\\)\\+[^\"']*$\\)\\|\\([^\"']*$\\)\\)",'','') if ind == b:PHP_default_indenting - if last_line =~ terminated + if last_line =~ terminated && last_line !~# s:defaultORcase let LastLineClosed = 1 endif endif @@ -755,10 +774,10 @@ function! GetPhpIndent() if !LastLineClosed - if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(]'.endline + if last_line =~# '[{(\[]'.endline || last_line =~? '\h\w*\s*(.*,$' && AntepenultimateLine !~ '[,(\[]'.endline let dontIndent = 0 - if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline + if last_line =~ '\S\+\s*{'.endline && last_line !~ '^\s*)\s*{'.endline && last_line !~ '^\s*\%(' . s:blockstart . '\)\|'. s:functionDecl . s:endline let dontIndent = 1 endif @@ -774,7 +793,7 @@ function! GetPhpIndent() elseif last_line =~ '\S\+\s*),'.endline call cursor(lnum, 1) - call search('),'.endline, 'W') " line never begins with ) so no need for 'c' flag + call search('),'.endline, 'W') let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()') if openedparent != lnum let ind = indent(openedparent) @@ -784,7 +803,7 @@ function! GetPhpIndent() let ind = ind + &sw - elseif AntepenultimateLine =~ '\%(;\%(\s*\%(?>\|}\)\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . s:defaultORcase + elseif AntepenultimateLine =~ '{'.endline || AntepenultimateLine =~ terminated || AntepenultimateLine =~# s:defaultORcase let ind = ind + &sw endif diff --git a/runtime/macros/editexisting.vim b/runtime/macros/editexisting.vim index c18f22569f..3530e29dc4 100644 --- a/runtime/macros/editexisting.vim +++ b/runtime/macros/editexisting.vim @@ -1,6 +1,6 @@ " Vim Plugin: Edit the file with an existing Vim if possible " Maintainer: Bram Moolenaar -" Last Change: 2013 Feb 24 +" Last Change: 2014 Dec 06 " This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32) " $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you @@ -112,7 +112,7 @@ func! EditExisting(fname, command) endif if a:command != '' - exe "normal " . a:command + exe "normal! " . a:command endif redraw diff --git a/runtime/syntax/zimbu.vim b/runtime/syntax/zimbu.vim index c859a2f815..1a7a485e6f 100644 --- a/runtime/syntax/zimbu.vim +++ b/runtime/syntax/zimbu.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Zimbu " Maintainer: Bram Moolenaar -" Last Change: 2012 Jun 01 +" Last Change: 2014 Nov 23 if exists("b:current_syntax") finish @@ -12,7 +12,10 @@ syn include @Ccode syntax/c.vim syn keyword zimbuTodo TODO FIXME XXX contained syn match zimbuNoBar "|" contained syn match zimbuParam "|[^| ]\+|" contained contains=zimbuNoBar -syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,@Spell +syn match zimbuNoBacktick "`" contained +syn match zimbuCode "`[^`]\+`" contained contains=zimbuNoBacktick +syn match zimbuComment "#.*$" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell +syn match zimbuComment "/\*.\{-}\*/" contains=zimbuTodo,zimbuParam,zimbuCode,@Spell syn match zimbuChar "'\\\=.'" @@ -28,27 +31,32 @@ syn keyword zimbuBasicType fixed1 fixed2 fixed3 fixed4 fixed5 fixed6 syn keyword zimbuBasicType fixed7 fixed8 fixed9 fixed10 fixed11 fixed12 syn keyword zimbuBasicType fixed13 fixed14 fixed15 -syn keyword zimbuCompType string stringval cstring varstring -syn keyword zimbuCompType bytes varbytes -syn keyword zimbuCompType tuple array list dict multiDict set multiSet +syn keyword zimbuCompType string varString +syn keyword zimbuCompType byteString varByteString +syn keyword zimbuCompType tuple array list dict dictList set callback +syn keyword zimbuCompType sortedList multiDict multiDictList multiSet syn keyword zimbuCompType complex complex32 complex64 complex80 complex128 syn keyword zimbuCompType proc func def thread evalThread lock cond pipe -syn keyword zimbuType VAR ANY USE GET +syn keyword zimbuType VAR dyn type USE GET syn match zimbuType "IO.File" syn match zimbuType "IO.Stat" -syn keyword zimbuStatement IF ELSE ELSEIF WHILE REPEAT FOR IN TO STEP +syn keyword zimbuStatement IF ELSE ELSEIF IFNIL WHILE REPEAT FOR IN TO STEP syn keyword zimbuStatement DO UNTIL SWITCH WITH syn keyword zimbuStatement TRY CATCH FINALLY syn keyword zimbuStatement GENERATE_IF GENERATE_ELSE GENERATE_ELSEIF +syn keyword zimbuStatement GENERATE_ERROR +syn keyword zimbuStatement BUILD_IF BUILD_ELSE BUILD_ELSEIF syn keyword zimbuStatement CASE DEFAULT FINAL ABSTRACT VIRTUAL DEFINE REPLACE syn keyword zimbuStatement IMPLEMENTS EXTENDS PARENT LOCAL -syn keyword zimbuStatement PART ALIAS CONNECT WRAP +syn keyword zimbuStatement PART ALIAS TYPE CONNECT WRAP syn keyword zimbuStatement BREAK CONTINUE PROCEED -syn keyword zimbuStatement RETURN EXIT THROW +syn keyword zimbuStatement RETURN EXIT THROW DEFER syn keyword zimbuStatement IMPORT AS OPTIONS MAIN -syn keyword zimbuStatement INTERFACE MODULE ENUM BITS SHARED +syn keyword zimbuStatement INTERFACE PIECE INCLUDE MODULE ENUM BITS +syn keyword zimbuStatement SHARED STATIC +syn keyword zimbuStatement LAMBDA syn match zimbuStatement "\<\(FUNC\|PROC\|DEF\)\>" syn match zimbuStatement "\" syn match zimbuStatement "}" @@ -61,10 +69,13 @@ syn match zimbuAttribute "@default\>" syn match zimbuAttribute "@define\>" syn match zimbuAttribute "@replace\>" syn match zimbuAttribute "@final\>" +syn match zimbuAttribute "@primitive\>" +syn match zimbuAttribute "@notOnExit\>" syn match zimbuAttribute "@private\>" syn match zimbuAttribute "@protected\>" syn match zimbuAttribute "@public\>" +syn match zimbuAttribute "@local\>" syn match zimbuAttribute "@file\>" syn match zimbuAttribute "@directory\>" syn match zimbuAttribute "@read=private\>" @@ -78,15 +89,22 @@ syn match zimbuAttribute "@items=public\>" syn match zimbuAttribute "@items=file\>" syn match zimbuAttribute "@items=directory\>" -syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET +syn keyword zimbuMethod NEW EQUAL COPY COMPARE SIZE GET SET INIT EARLYINIT syn keyword zimbuOperator IS ISNOT ISA ISNOTA -syn keyword zimbuModule ARG CHECK E IO PROTO SYS HTTP ZC ZWT TIME THREAD +syn keyword zimbuModule ARG CHECK E GC IO LOG PROTO SYS HTTP ZC ZWT T TIME THREAD -syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+ +syn match zimbuImport "\.\zsPROTO" +syn match zimbuImport "\.\zsCHEADER" + +"syn match zimbuString +"\([^"\\]\|\\.\)*\("\|$\)+ contains=zimbuStringExpr +syn region zimbuString start=+"+ skip=+[^"\\]\|\\.+ end=+"\|$+ contains=zimbuStringExpr syn match zimbuString +R"\([^"]\|""\)*\("\|$\)+ -syn region zimbuString start=+'''+ end=+'''+ +syn region zimbuLongString start=+''"+ end=+"''+ +syn match zimbuStringExpr +\\([^)]*)+hs=s+2,he=e-1 contained contains=zimbuString,zimbuParenPairOuter +syn region zimbuParenPairOuter start=+(+ms=s+1 end=+)+me=e-1 contained contains=zimbuString,zimbuParenPair +syn region zimbuParenPair start=+(+ end=+)+ contained contains=zimbuString,zimbuParenPair syn keyword zimbuFixed TRUE FALSE NIL THIS THISTYPE FAIL OK syn keyword zimbuError NULL @@ -97,12 +115,18 @@ syn match zimbuSpaceError display excludenl "\S\s\+$"ms=s+1 syn match zimbuSpaceError display " \+\t" syn match zimbuSpaceError display "\t\+ " -syn match zimbuUses contained "uses([a-zA-Z_ ,]*)" +syn match zimbuUses contained "\ Date: Sat, 6 Dec 2014 21:18:33 +0100 Subject: [PATCH 221/311] updated for version 7.4.541 Problem: Crash when doing a range assign. Solution: Check for NULL poiter. (Yukihiro Nakadaira) --- src/eval.c | 2 +- src/testdir/test55.in | 5 +++++ src/testdir/test55.ok | 1 + src/version.c | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index 840e1e8f82..5c584dead5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2951,7 +2951,7 @@ set_var_lval(lp, endp, rettv, copy, op) /* * Check whether any of the list items is locked */ - for (ri = rettv->vval.v_list->lv_first; ri != NULL; ) + for (ri = rettv->vval.v_list->lv_first; ri != NULL && ll_li != NULL; ) { if (tv_check_lock(ll_li->li_tv.v_lock, lp->ll_name)) return; diff --git a/src/testdir/test55.in b/src/testdir/test55.in index 140cb7c0e5..c4e82d429c 100644 --- a/src/testdir/test55.in +++ b/src/testdir/test55.in @@ -401,6 +401,11 @@ let l = [0, 1, 2, 3] : $put =v:exception[:15] . v:exception[-1:-1] :endtry :$put =string(d) +:" +:" test for range assign +:let l = [0] +:let l[:] = [1, 2] +:$put =string(l) :endfun :" :call Test(1, 2, [3, 4], {5: 6}) " This may take a while diff --git a/src/testdir/test55.ok b/src/testdir/test55.ok index e8560de401..ba029b2898 100644 --- a/src/testdir/test55.ok +++ b/src/testdir/test55.ok @@ -129,6 +129,7 @@ caught a:000[3] {'a': {'b': 'B'}} Vim(call):E737: a {'a': {'b': 'B'}} +[1, 2] Vim(foldopen):E490: diff --git a/src/version.c b/src/version.c index 57b5d76421..451b837dc3 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 541, /**/ 540, /**/ From 0385d2fd10e38160a3ba46e7f82d536e06a6f21a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 8 Dec 2014 01:16:44 +0100 Subject: [PATCH 222/311] updated for version 7.4.542 Problem: Using a range for window and buffer commands has a few problems. Cannot specify the type of range for a user command. Solution: Add the -addr argument for user commands. Fix problems. (Marcin Szamotulski) --- runtime/doc/map.txt | 13 ++ src/Makefile | 1 + src/ex_cmds.h | 8 +- src/ex_docmd.c | 214 ++++++++++++++++++++++++++---- src/ex_getln.c | 1 + src/proto/ex_docmd.pro | 4 +- src/testdir/Make_amiga.mak | 2 + src/testdir/Make_dos.mak | 1 + src/testdir/Make_ming.mak | 1 + src/testdir/Make_os2.mak | 1 + src/testdir/Make_vms.mms | 3 +- src/testdir/Makefile | 1 + src/testdir/test_command_count.in | 50 +++++++ src/testdir/test_command_count.ok | 17 +++ src/version.c | 2 + src/vim.h | 1 + 16 files changed, 291 insertions(+), 29 deletions(-) create mode 100644 src/testdir/test_command_count.in create mode 100644 src/testdir/test_command_count.ok diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 1be2827c2c..281aa8b142 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1358,6 +1358,19 @@ Possible attributes are: Note that -range=N and -count=N are mutually exclusive - only one should be specified. + *E889* *:command-addr* +It is possible that the special characters in the range like ., $ or % which +by default correspond to the current line, last line and the whole buffer, +relate to arguments, (loaded) buffers, windows or tab pages. + +Possible values are: + -addr=lines Range of lines (this is the default) + -addr=arguments Range for arguments + -addr=buffers Range for buffers (also not loaded buffers) + -addr=loaded_buffers Range for loaded buffers + -addr=windows Range for windows + -addr=tabs Range for tab pages + Special cases *:command-bang* *:command-bar* *:command-register* *:command-buffer* There are some special cases as well: diff --git a/src/Makefile b/src/Makefile index 13fe70b1ad..5a5518d435 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1896,6 +1896,7 @@ test1 \ test_breakindent \ test_changelist \ test_close_count \ + test_command_count \ test_eval \ test_insertcount \ test_listlbr \ diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 5574ea7bc2..fc6a8ac0fa 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -63,7 +63,7 @@ #define ADDR_WINDOWS 1 #define ADDR_ARGUMENTS 2 #define ADDR_LOADED_BUFFERS 3 -#define ADDR_UNLOADED_BUFFERS 4 +#define ADDR_BUFFERS 4 #define ADDR_TABS 5 #ifndef DO_DECLARE_EXCMD @@ -161,7 +161,7 @@ EX(CMD_aunmenu, "aunmenu", ex_menu, ADDR_LINES), EX(CMD_buffer, "buffer", ex_buffer, BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR, - ADDR_UNLOADED_BUFFERS), + ADDR_BUFFERS), EX(CMD_bNext, "bNext", ex_bprevious, BANG|RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, ADDR_LINES), @@ -227,7 +227,7 @@ EX(CMD_bunload, "bunload", ex_bunload, ADDR_LOADED_BUFFERS), EX(CMD_bwipeout, "bwipeout", ex_bunload, BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|TRLBAR, - ADDR_UNLOADED_BUFFERS), + ADDR_BUFFERS), EX(CMD_change, "change", ex_change, BANG|WHOLEFOLD|RANGE|COUNT|TRLBAR|CMDWIN|MODIFY, ADDR_LINES), @@ -1184,7 +1184,7 @@ EX(CMD_saveas, "saveas", ex_write, ADDR_LINES), EX(CMD_sbuffer, "sbuffer", ex_buffer, BANG|RANGE|NOTADR|BUFNAME|BUFUNL|COUNT|EXTRA|EDITCMD|TRLBAR, - ADDR_UNLOADED_BUFFERS), + ADDR_BUFFERS), EX(CMD_sbNext, "sbNext", ex_bprevious, RANGE|NOTADR|COUNT|EDITCMD|TRLBAR, ADDR_LINES), diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 607dbd9eec..0c8123cbc0 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -27,6 +27,7 @@ typedef struct ucmd char_u *uc_rep; /* The command's replacement string */ long uc_def; /* The default value for a range/count */ int uc_compl; /* completion type */ + int uc_addr_type; /* The command's address type */ # ifdef FEAT_EVAL scid_T uc_scriptID; /* SID where the command was defined */ # ifdef FEAT_CMDL_COMPL @@ -2136,7 +2137,11 @@ do_one_cmd(cmdlinep, sourcing, ) ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type; else +#ifdef FEAT_USR_CMDS + if (ea.cmdidx != CMD_USER) +#endif ea.addr_type = ADDR_LINES; + /* ea.addr_type for user commands is set by find_ucmd */ ea.cmd = cmd; /* repeat for all ',' or ';' separated addresses */ @@ -2157,7 +2162,7 @@ do_one_cmd(cmdlinep, sourcing, ea.line2 = curwin->w_arg_idx + 1; break; case ADDR_LOADED_BUFFERS: - case ADDR_UNLOADED_BUFFERS: + case ADDR_BUFFERS: ea.line2 = curbuf->b_fnum; break; case ADDR_TABS: @@ -2191,18 +2196,34 @@ do_one_cmd(cmdlinep, sourcing, buf = buf->b_prev; ea.line2 = buf->b_fnum; break; - case ADDR_UNLOADED_BUFFERS: + case ADDR_BUFFERS: ea.line1 = firstbuf->b_fnum; ea.line2 = lastbuf->b_fnum; break; case ADDR_WINDOWS: case ADDR_TABS: - errormsg = (char_u *)_(e_invrange); - goto doend; + if (IS_USER_CMDIDX(ea.cmdidx)) + { + ea.line1 = 1; + ea.line2 = ea.addr_type == ADDR_WINDOWS + ? LAST_WIN_NR : LAST_TAB_NR; + } + else + { + /* there is no Vim command which uses '%' and + * ADDR_WINDOWS or ADDR_TABS */ + errormsg = (char_u *)_(e_invrange); + goto doend; + } break; case ADDR_ARGUMENTS: - ea.line1 = 1; - ea.line2 = ARGCOUNT; + if (ARGCOUNT == 0) + ea.line1 = ea.line2 = 0; + else + { + ea.line1 = 1; + ea.line2 = ARGCOUNT; + } break; } ++ea.addr_count; @@ -2629,8 +2650,41 @@ do_one_cmd(cmdlinep, sourcing, if ((ea.argt & DFLALL) && ea.addr_count == 0) { + buf_T *buf; + ea.line1 = 1; - ea.line2 = curbuf->b_ml.ml_line_count; + switch (ea.addr_type) + { + case ADDR_LINES: + ea.line2 = curbuf->b_ml.ml_line_count; + break; + case ADDR_LOADED_BUFFERS: + buf = firstbuf; + while (buf->b_next != NULL && buf->b_ml.ml_mfp == NULL) + buf = buf->b_next; + ea.line1 = buf->b_fnum; + buf = lastbuf; + while (buf->b_prev != NULL && buf->b_ml.ml_mfp == NULL) + buf = buf->b_prev; + ea.line2 = buf->b_fnum; + break; + case ADDR_BUFFERS: + ea.line1 = firstbuf->b_fnum; + ea.line2 = lastbuf->b_fnum; + break; + case ADDR_WINDOWS: + ea.line2 = LAST_WIN_NR; + break; + case ADDR_TABS: + ea.line2 = LAST_TAB_NR; + break; + case ADDR_ARGUMENTS: + if (ARGCOUNT == 0) + ea.line1 = ea.line2 = 0; + else + ea.line2 = ARGCOUNT; + break; + } } /* accept numbered register only when no count allowed (:put) */ @@ -3211,6 +3265,7 @@ find_ucmd(eap, p, full, xp, compl) eap->cmdidx = CMD_USER_BUF; eap->argt = (long)uc->uc_argt; eap->useridx = j; + eap->addr_type = uc->uc_addr_type; # ifdef FEAT_CMDL_COMPL if (compl != NULL) @@ -3839,7 +3894,7 @@ set_one_cmd_context(xp, buff) return NULL; } - /* For the -complete and -nargs attributes, we complete + /* For the -complete, -nargs and -addr attributes, we complete * their arguments as well. */ if (STRNICMP(arg, "complete", p - arg) == 0) @@ -3854,6 +3909,12 @@ set_one_cmd_context(xp, buff) xp->xp_pattern = p + 1; return NULL; } + else if (STRNICMP(arg, "addr", p - arg) == 0) + { + xp->xp_context = EXPAND_USER_ADDR_TYPE; + xp->xp_pattern = p + 1; + return NULL; + } return NULL; } arg = skipwhite(p); @@ -4264,6 +4325,7 @@ get_address(ptr, addr_type, skip, to_other_file) pos_T pos; pos_T *fp; linenr_T lnum; + buf_T *buf; cmd = skipwhite(*ptr); lnum = MAXLNUM; @@ -4285,7 +4347,7 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = curwin->w_arg_idx + 1; break; case ADDR_LOADED_BUFFERS: - case ADDR_UNLOADED_BUFFERS: + case ADDR_BUFFERS: lnum = curbuf->b_fnum; break; case ADDR_TABS: @@ -4308,7 +4370,16 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = ARGCOUNT; break; case ADDR_LOADED_BUFFERS: - case ADDR_UNLOADED_BUFFERS: + buf = lastbuf; + while (buf->b_ml.ml_mfp == NULL) + { + if (buf->b_prev == NULL) + break; + buf = buf->b_prev; + } + lnum = buf->b_fnum; + break; + case ADDR_BUFFERS: lnum = lastbuf->b_fnum; break; case ADDR_TABS: @@ -4477,7 +4548,7 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = curwin->w_arg_idx + 1; break; case ADDR_LOADED_BUFFERS: - case ADDR_UNLOADED_BUFFERS: + case ADDR_BUFFERS: lnum = curbuf->b_fnum; break; case ADDR_TABS: @@ -4495,7 +4566,7 @@ get_address(ptr, addr_type, skip, to_other_file) else n = getdigits(&cmd); if (addr_type == ADDR_LOADED_BUFFERS - || addr_type == ADDR_UNLOADED_BUFFERS) + || addr_type == ADDR_BUFFERS) lnum = compute_buffer_local_count(addr_type, lnum, (i == '-') ? -1 * n : n); else if (i == '-') lnum -= n; @@ -4531,7 +4602,7 @@ get_address(ptr, addr_type, skip, to_other_file) lnum = LAST_WIN_NR; break; case ADDR_LOADED_BUFFERS: - case ADDR_UNLOADED_BUFFERS: + case ADDR_BUFFERS: if (lnum < firstbuf->b_fnum) { lnum = firstbuf->b_fnum; @@ -5585,14 +5656,14 @@ get_command_name(xp, idx) #endif #if defined(FEAT_USR_CMDS) || defined(PROTO) -static int uc_add_command __ARGS((char_u *name, size_t name_len, char_u *rep, long argt, long def, int flags, int compl, char_u *compl_arg, int force)); +static int uc_add_command __ARGS((char_u *name, size_t name_len, char_u *rep, long argt, long def, int flags, int compl, char_u *compl_arg, int addr_type, int force)); static void uc_list __ARGS((char_u *name, size_t name_len)); -static int uc_scan_attr __ARGS((char_u *attr, size_t len, long *argt, long *def, int *flags, int *compl, char_u **compl_arg)); +static int uc_scan_attr __ARGS((char_u *attr, size_t len, long *argt, long *def, int *flags, int *compl, char_u **compl_arg, int* attr_type_arg)); static char_u *uc_split_args __ARGS((char_u *arg, size_t *lenp)); static size_t uc_check_code __ARGS((char_u *code, size_t len, char_u *buf, ucmd_T *cmd, exarg_T *eap, char_u **split_buf, size_t *split_len)); static int -uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force) +uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, addr_type, force) char_u *name; size_t name_len; char_u *rep; @@ -5601,6 +5672,7 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force) int flags; int compl; char_u *compl_arg; + int addr_type; int force; { ucmd_T *cmd = NULL; @@ -5695,6 +5767,7 @@ uc_add_command(name, name_len, rep, argt, def, flags, compl, compl_arg, force) cmd->uc_compl_arg = compl_arg; # endif #endif + cmd->uc_addr_type = addr_type; return OK; @@ -5707,6 +5780,23 @@ fail: } #endif +#if defined(FEAT_USR_CMDS) +static struct +{ + int expand; + char *name; +} addr_type_complete[] = +{ + {ADDR_ARGUMENTS, "arguments"}, + {ADDR_LINES, "lines"}, + {ADDR_LOADED_BUFFERS, "loaded_buffers"}, + {ADDR_TABS, "tabs"}, + {ADDR_BUFFERS, "buffers"}, + {ADDR_WINDOWS, "windows"}, + {-1, NULL} +}; +#endif + #if defined(FEAT_USR_CMDS) || defined(FEAT_EVAL) || defined(PROTO) /* * List of names for completion for ":command" with the EXPAND_ flag. @@ -5794,7 +5884,7 @@ uc_list(name, name_len) /* Put out the title first time */ if (!found) - MSG_PUTS_TITLE(_("\n Name Args Range Complete Definition")); + MSG_PUTS_TITLE(_("\n Name Args Address Complete Definition")); found = TRUE; msg_putchar('\n'); if (got_int) @@ -5855,6 +5945,20 @@ uc_list(name, name_len) IObuff[len++] = ' '; } while (len < 11); + /* Address Type */ + for (j = 0; addr_type_complete[j].expand != -1; ++j) + if (addr_type_complete[j].expand != ADDR_LINES + && addr_type_complete[j].expand == cmd->uc_addr_type) + { + STRCPY(IObuff + len, addr_type_complete[j].name); + len += (int)STRLEN(IObuff + len); + break; + } + + do { + IObuff[len++] = ' '; + } while (len < 21); + /* Completion */ for (j = 0; command_complete[j].expand != 0; ++j) if (command_complete[j].expand == cmd->uc_compl) @@ -5866,7 +5970,7 @@ uc_list(name, name_len) do { IObuff[len++] = ' '; - } while (len < 21); + } while (len < 35); IObuff[len] = '\0'; msg_outtrans(IObuff); @@ -5906,7 +6010,7 @@ uc_fun_cmd() } static int -uc_scan_attr(attr, len, argt, def, flags, compl, compl_arg) +uc_scan_attr(attr, len, argt, def, flags, compl, compl_arg, addr_type_arg) char_u *attr; size_t len; long *argt; @@ -5914,6 +6018,7 @@ uc_scan_attr(attr, len, argt, def, flags, compl, compl_arg) int *flags; int *compl; char_u **compl_arg; + int *addr_type_arg; { char_u *p; @@ -6032,6 +6137,20 @@ invalid_count: == FAIL) return FAIL; } + else if (STRNICMP(attr, "addr", attrlen) == 0) + { + *argt |= RANGE; + if (val == NULL) + { + EMSG(_("E179: argument required for -addr")); + return FAIL; + } + if (parse_addr_type_arg(val, (int)vallen, argt, addr_type_arg) + == FAIL) + return FAIL; + if (addr_type_arg != ADDR_LINES) + *argt |= (ZEROR | NOTADR) ; + } else { char_u ch = attr[len]; @@ -6060,6 +6179,7 @@ ex_command(eap) int flags = 0; int compl = EXPAND_NOTHING; char_u *compl_arg = NULL; + int addr_type_arg = ADDR_LINES; int has_attr = (eap->arg[0] == '-'); int name_len; @@ -6070,7 +6190,7 @@ ex_command(eap) { ++p; end = skiptowhite(p); - if (uc_scan_attr(p, end - p, &argt, &def, &flags, &compl, &compl_arg) + if (uc_scan_attr(p, end - p, &argt, &def, &flags, &compl, &compl_arg, &addr_type_arg) == FAIL) return; p = skipwhite(end); @@ -6111,7 +6231,7 @@ ex_command(eap) } else uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg, - eap->forceit); + addr_type_arg, eap->forceit); } /* @@ -6651,6 +6771,17 @@ get_user_commands(xp, idx) return NULL; } +/* + * Function given to ExpandGeneric() to obtain the list of user address type names. + */ + char_u * +get_user_cmd_addr_type(xp, idx) + expand_T *xp UNUSED; + int idx; +{ + return (char_u *)addr_type_complete[idx].name; +} + /* * Function given to ExpandGeneric() to obtain the list of user command * attributes. @@ -6661,8 +6792,8 @@ get_user_cmd_flags(xp, idx) int idx; { static char *user_cmd_flags[] = - {"bang", "bar", "buffer", "complete", "count", - "nargs", "range", "register"}; + {"addr", "bang", "bar", "buffer", "complete", + "count", "nargs", "range", "register"}; if (idx >= (int)(sizeof(user_cmd_flags) / sizeof(user_cmd_flags[0]))) return NULL; @@ -6696,6 +6827,43 @@ get_user_cmd_complete(xp, idx) } # endif /* FEAT_CMDL_COMPL */ +/* + * Parse address type argument + */ + int +parse_addr_type_arg(value, vallen, argt, addr_type_arg) + char_u *value; + int vallen; + long *argt; + int *addr_type_arg; +{ + int i, a, b; + for (i = 0; addr_type_complete[i].expand != -1; ++i) + { + a = (int)STRLEN(addr_type_complete[i].name) == vallen; + b = STRNCMP(value, addr_type_complete[i].name, vallen) == 0; + if (a && b) + { + *addr_type_arg = addr_type_complete[i].expand; + break; + } + } + + if (addr_type_complete[i].expand == -1) + { + char_u *err = value; + for (i=0; err[i] == NUL || !vim_iswhite(err[i]); i++); + err[i] = NUL; + EMSG2(_("E180: Invalid address type value: %s"), err); + return FAIL; + } + + if (*addr_type_arg != ADDR_LINES) + *argt |= NOTADR; + + return OK; +} + #endif /* FEAT_USR_CMDS */ #if defined(FEAT_USR_CMDS) || defined(FEAT_EVAL) || defined(PROTO) diff --git a/src/ex_getln.c b/src/ex_getln.c index 8ebcc889c3..d8db15abf6 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4697,6 +4697,7 @@ ExpandFromContext(xp, pat, num_file, file, options) #endif #ifdef FEAT_USR_CMDS {EXPAND_USER_COMMANDS, get_user_commands, FALSE, TRUE}, + {EXPAND_USER_ADDR_TYPE, get_user_cmd_addr_type, FALSE, TRUE}, {EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE}, {EXPAND_USER_NARGS, get_user_cmd_nargs, FALSE, TRUE}, {EXPAND_USER_COMPLETE, get_user_cmd_complete, FALSE, TRUE}, diff --git a/src/proto/ex_docmd.pro b/src/proto/ex_docmd.pro index ebc54c9deb..a998480eaf 100644 --- a/src/proto/ex_docmd.pro +++ b/src/proto/ex_docmd.pro @@ -19,9 +19,11 @@ char_u *get_command_name __ARGS((expand_T *xp, int idx)); void ex_comclear __ARGS((exarg_T *eap)); void uc_clear __ARGS((garray_T *gap)); char_u *get_user_commands __ARGS((expand_T *xp, int idx)); +char_u *get_user_cmd_addr_type __ARGS((expand_T *xp, int idx)); char_u *get_user_cmd_flags __ARGS((expand_T *xp, int idx)); char_u *get_user_cmd_nargs __ARGS((expand_T *xp, int idx)); char_u *get_user_cmd_complete __ARGS((expand_T *xp, int idx)); +int parse_addr_type_arg __ARGS((char_u *value, int vallen, long *argt, int *addr_type_arg)); int parse_compl_arg __ARGS((char_u *value, int vallen, int *complp, long *argt, char_u **compl_arg)); void not_exiting __ARGS((void)); void tabpage_close __ARGS((int forceit)); @@ -43,6 +45,7 @@ void free_cd_dir __ARGS((void)); void post_chdir __ARGS((int local)); void ex_cd __ARGS((exarg_T *eap)); void do_sleep __ARGS((long msec)); +void ex_may_print __ARGS((exarg_T *eap)); int vim_mkdir_emsg __ARGS((char_u *name, int prot)); FILE *open_exfile __ARGS((char_u *fname, int forceit, char *mode)); void update_topline_cursor __ARGS((void)); @@ -54,5 +57,4 @@ int put_eol __ARGS((FILE *fd)); int put_line __ARGS((FILE *fd, char *s)); void dialog_msg __ARGS((char_u *buff, char *format, char_u *fname)); char_u *get_behave_arg __ARGS((expand_T *xp, int idx)); -void ex_may_print __ARGS((exarg_T *eap)); /* vim: set ft=c : */ diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index a2e5db3b87..9ce3578588 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -41,6 +41,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_breakindent.out \ test_changelist.out \ test_close_count.out \ + test_command_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ @@ -178,6 +179,7 @@ test_autoformat_join.out: test_autoformat_join.in test_breakindent.out: test_breakindent.in test_changelist.out: test_changelist.in test_close_count.out: test_close_count.in +test_command_count.out: test_command_count.in test_eval.out: test_eval.in test_insertcount.out: test_insertcount.in test_listlbr.out: test_listlbr.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index d2e070ba0c..b1b5b19dbd 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -40,6 +40,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_breakindent.out \ test_changelist.out \ test_close_count.out \ + test_command_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 4a99cb915d..28a3640c56 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -62,6 +62,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_breakindent.out \ test_changelist.out \ test_close_count.out \ + test_command_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index 7a2571b499..a01dedf834 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -42,6 +42,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_breakindent.out \ test_changelist.out \ test_close_count.out \ + test_command_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 93aa874019..8eecd51a2a 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # -# Last change: 2014 Nov 27 +# Last change: 2014 Dec 08 # # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # Edit the lines in the Configuration section below to select. @@ -101,6 +101,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test_breakindent.out \ test_changelist.out \ test_close_count.out \ + test_command_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ diff --git a/src/testdir/Makefile b/src/testdir/Makefile index aa0ef1ff1f..8f9e33c6ee 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -38,6 +38,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test_breakindent.out \ test_changelist.out \ test_close_count.out \ + test_command_count.out \ test_eval.out \ test_insertcount.out \ test_listlbr.out \ diff --git a/src/testdir/test_command_count.in b/src/testdir/test_command_count.in new file mode 100644 index 0000000000..cca178e5cf --- /dev/null +++ b/src/testdir/test_command_count.in @@ -0,0 +1,50 @@ +Test for user command counts vim: set ft=vim : + +STARTTEST +:let g:lines = [] +:so tiny.vim +:com -range RangeLines :call add(g:lines, 'Rangeg:Lines '..' '.) +:com -range -addr=arguments RangeArguments :call add(g:lines, 'RangeArguments '..' '.) +:com -range=% -addr=arguments RangeArgumentsAll :call add(g:lines, 'RangeArgumentsAll '..' '.) +:com -range -addr=loaded_buffers RangeLoadedBuffers :call add(g:lines, 'RangeLoadedBuffers '..' '.) +:com -range=% -addr=loaded_buffers RangeLoadedBuffersAll :call add(g:lines, 'RangeLoadedBuffersAll '..' '.) +:com -range -addr=buffers RangeBuffers :call add(g:lines, 'RangeBuffers '..' '.) +:com -range=% -addr=buffers RangeBuffersAll :call add(g:lines, 'RangeBuffersAll '..' '.) +:com -range -addr=windows RangeWindows :call add(g:lines, 'RangeWindows '..' '.) +:com -range=% -addr=windows RangeWindowsAll :call add(g:lines, 'RangeWindowsAll '..' '.) +:com -range -addr=tabs RangeTabs :call add(g:lines, 'RangeTabs '..' '.) +:com -range=% -addr=tabs RangeTabsAll :call add(g:lines, 'RangeTabsAll '..' '.) +:set hidden +:arga a b c d +:argdo echo "loading buffers" +:argu 3 +:.-,$-RangeArguments +:%RangeArguments +:RangeArgumentsAll +:N +:.RangeArguments +:split|split|split|split +:3wincmd w +:.,$RangeWindows +:%RangeWindows +:RangeWindowsAll +:only +:blast|bd +:.,$RangeLoadedBuffers +:%RangeLoadedBuffers +:RangeLoadedBuffersAll +:.,$RangeBuffers +:%RangeBuffers +:RangeBuffersAll +:tabe|tabe|tabe|tabe +:normal 2gt +:.,$RangeTabs +:%RangeTabs +:RangeTabsAll +:1tabonly +:e! test.out +:call append(0, g:lines) +:w|qa! +ENDTEST + + diff --git a/src/testdir/test_command_count.ok b/src/testdir/test_command_count.ok new file mode 100644 index 0000000000..11e88b3903 --- /dev/null +++ b/src/testdir/test_command_count.ok @@ -0,0 +1,17 @@ +RangeArguments 2 4 +RangeArguments 1 5 +RangeArgumentsAll 1 5 +RangeArguments 2 2 +RangeWindows 3 5 +RangeWindows 1 5 +RangeWindowsAll 1 5 +RangeLoadedBuffers 2 4 +RangeLoadedBuffers 1 4 +RangeLoadedBuffersAll 1 4 +RangeBuffers 2 5 +RangeBuffers 1 5 +RangeBuffersAll 1 5 +RangeTabs 2 5 +RangeTabs 1 5 +RangeTabsAll 1 5 + diff --git a/src/version.c b/src/version.c index 451b837dc3..3f439802cc 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 542, /**/ 541, /**/ diff --git a/src/vim.h b/src/vim.h index 7f3e393d53..ea53e00cd5 100644 --- a/src/vim.h +++ b/src/vim.h @@ -798,6 +798,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); #define EXPAND_HISTORY 41 #define EXPAND_USER 42 #define EXPAND_SYNTIME 43 +#define EXPAND_USER_ADDR_TYPE 44 /* Values for exmode_active (0 is no exmode) */ #define EXMODE_NORMAL 1 From 806804a9830e3cf2c38ffbaaabaa0bcd5c65be63 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 00:17:11 +0100 Subject: [PATCH 223/311] =?UTF-8?q?updated=20for=20version=207.4.543=20Pro?= =?UTF-8?q?blem:=20=20=20=20Since=20patch=207.4.232=20"1,3s/\n//"=20joins?= =?UTF-8?q?=20two=20lines=20instead=20of=20three.=20=09=20=20=20=20(Eliseo?= =?UTF-8?q?=20Mart=C3=ADnez)=20=20Issue=20287=20Solution:=20=20=20Correct?= =?UTF-8?q?=20the=20line=20count.=20(Christian=20Brabandt)=20=09=20=20=20?= =?UTF-8?q?=20Also=20set=20the=20last=20used=20search=20pattern.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ex_cmds.c | 27 +++++++++++++++++++++++---- src/proto/search.pro | 1 + src/search.c | 3 +-- src/version.c | 2 ++ 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 86dab4797d..8195eb71b8 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -4408,6 +4408,8 @@ do_sub(eap) && (*cmd == NUL || (cmd[1] == NUL && (*cmd == 'g' || *cmd == 'l' || *cmd == 'p' || *cmd == '#')))) { + linenr_T joined_lines_count; + curwin->w_cursor.lnum = eap->line1; if (*cmd == 'l') eap->flags = EXFLAG_LIST; @@ -4416,10 +4418,27 @@ do_sub(eap) else if (*cmd == 'p') eap->flags = EXFLAG_PRINT; - (void)do_join(eap->line2 - eap->line1 + 1, FALSE, TRUE, FALSE, TRUE); - sub_nlines = sub_nsubs = eap->line2 - eap->line1 + 1; - (void)do_sub_msg(FALSE); - ex_may_print(eap); + /* The number of lines joined is the number of lines in the range plus + * one. One less when the last line is included. */ + joined_lines_count = eap->line2 - eap->line1 + 1; + if (eap->line2 < curbuf->b_ml.ml_line_count) + ++joined_lines_count; + if (joined_lines_count > 1) + { + (void)do_join(joined_lines_count, FALSE, TRUE, FALSE, TRUE); + sub_nsubs = joined_lines_count - 1; + sub_nlines = 1; + (void)do_sub_msg(FALSE); + ex_may_print(eap); + } + + if (!cmdmod.keeppatterns) + save_re_pat(RE_SUBST, pat, p_magic); +#ifdef FEAT_CMDHIST + /* put pattern in history */ + add_to_history(HIST_SEARCH, pat, TRUE, NUL); +#endif + return; } diff --git a/src/proto/search.pro b/src/proto/search.pro index f94fb69ab2..07f608789d 100644 --- a/src/proto/search.pro +++ b/src/proto/search.pro @@ -2,6 +2,7 @@ int search_regcomp __ARGS((char_u *pat, int pat_save, int pat_use, int options, regmmatch_T *regmatch)); char_u *get_search_pat __ARGS((void)); char_u *reverse_text __ARGS((char_u *s)); +void save_re_pat __ARGS((int idx, char_u *pat, int magic)); void save_search_patterns __ARGS((void)); void restore_search_patterns __ARGS((void)); void free_search_patterns __ARGS((void)); diff --git a/src/search.c b/src/search.c index 047a733972..b64b8f6ce7 100644 --- a/src/search.c +++ b/src/search.c @@ -12,7 +12,6 @@ #include "vim.h" -static void save_re_pat __ARGS((int idx, char_u *pat, int magic)); #ifdef FEAT_EVAL static void set_vv_searchforward __ARGS((void)); static int first_submatch __ARGS((regmmatch_T *rp)); @@ -272,7 +271,7 @@ reverse_text(s) } #endif - static void + void save_re_pat(idx, pat, magic) int idx; char_u *pat; diff --git a/src/version.c b/src/version.c index 3f439802cc..fe317d0532 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 543, /**/ 542, /**/ From 702b5d4a9430286c0daf85daa86da690504ac947 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 00:20:14 +0100 Subject: [PATCH 224/311] updated for version 7.4.544 Problem: Warnings for unused arguments when compiling with a combination of features. Solution: Add "UNUSED". --- src/if_cscope.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/if_cscope.c b/src/if_cscope.c index 09982e6477..ab31a03519 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -1131,8 +1131,8 @@ cs_find_common(opt, pat, forceit, verbose, use_ll, cmdline) char *pat; int forceit; int verbose; - int use_ll; - char_u *cmdline; + int use_ll UNUSED; + char_u *cmdline UNUSED; { int i; char *cmd; diff --git a/src/version.c b/src/version.c index fe317d0532..ba5f6b3bf0 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 544, /**/ 543, /**/ From 8288d3c2ba601259de1380f980d239605348b770 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 00:36:39 +0100 Subject: [PATCH 225/311] updated for version 7.4.545 Problem: Highlighting for multi-line matches is not correct. Solution: Stop highlight at the end of the match. (Hirohito Higashi) --- src/screen.c | 8 +++++++- src/version.c | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/screen.c b/src/screen.c index d395138628..e7b8e78d78 100644 --- a/src/screen.c +++ b/src/screen.c @@ -3864,9 +3864,15 @@ win_line(wp, lnum, startrow, endrow, nochange) && v >= (long)shl->startcol && v < (long)shl->endcol) { +#ifdef FEAT_MBYTE + int tmp_col = v + MB_PTR2LEN(ptr); + + if (shl->endcol < tmp_col) + shl->endcol = tmp_col; +#endif shl->attr_cur = shl->attr; } - else if (v >= (long)shl->endcol && shl->lnum == lnum) + else if (v == (long)shl->endcol) { shl->attr_cur = 0; next_search_hl(wp, shl, lnum, (colnr_T)v, cur); diff --git a/src/version.c b/src/version.c index ba5f6b3bf0..1d63121acd 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 545, /**/ 544, /**/ From 5af72cf5d57dc856da5d5f38609e8bf18ff82af7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 00:58:09 +0100 Subject: [PATCH 226/311] updated for version 7.4.546 Problem: Repeated use of vim_snprintf() with a number. Solution: Move these vim_snprintf() calls into a function. --- src/version.c | 2 ++ src/window.c | 35 +++++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/version.c b/src/version.c index 1d63121acd..94ba992cb5 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 546, /**/ 545, /**/ diff --git a/src/window.c b/src/window.c index 92fcbbe710..79c97d8a9e 100644 --- a/src/window.c +++ b/src/window.c @@ -11,6 +11,7 @@ static int path_is_url __ARGS((char_u *p)); #if defined(FEAT_WINDOWS) || defined(PROTO) +static void cmd_with_count __ARGS((char *cmd, char_u *bufp, size_t bufsize, long Prenum)); static void win_init __ARGS((win_T *newp, win_T *oldp, int flags)); static void win_init_some __ARGS((win_T *newp, win_T *oldp)); static void frame_comp_pos __ARGS((frame_T *topfrp, int *row, int *col)); @@ -167,10 +168,7 @@ do_window(nchar, Prenum, xchar) case '^': CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */ - STRCPY(cbuf, "split #"); - if (Prenum) - vim_snprintf((char *)cbuf + 7, sizeof(cbuf) - 7, - "%ld", Prenum); + cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); break; @@ -199,10 +197,7 @@ newwindow: case Ctrl_Q: case 'q': reset_VIsual_and_resel(); /* stop Visual mode */ - STRCPY(cbuf, "quit"); - if (Prenum) - vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 5, - "%ld", Prenum); + cmd_with_count("quit", cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); break; @@ -210,10 +205,7 @@ newwindow: case Ctrl_C: case 'c': reset_VIsual_and_resel(); /* stop Visual mode */ - STRCPY(cbuf, "close"); - if (Prenum) - vim_snprintf((char *)cbuf + 5, sizeof(cbuf) - 5, - "%ld", Prenum); + cmd_with_count("close", cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); break; @@ -243,10 +235,7 @@ newwindow: case 'o': CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */ - STRCPY(cbuf, "only"); - if (Prenum > 0) - vim_snprintf((char *)cbuf + 4, sizeof(cbuf) - 4, - "%ld", Prenum); + cmd_with_count("only", cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); break; @@ -635,6 +624,20 @@ wingotofile: } } + static void +cmd_with_count(cmd, bufp, bufsize, Prenum) + char *cmd; + char_u *bufp; + size_t bufsize; + long Prenum; +{ + size_t len = STRLEN(cmd); + + STRCPY(bufp, cmd); + if (Prenum > 0) + vim_snprintf((char *)bufp + len, bufsize - len, "%ld", Prenum); +} + /* * split the current window, implements CTRL-W s and :split * From 8d3929369a42cfc5b7d950b713d31c3684ce9a45 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 17:11:33 +0100 Subject: [PATCH 227/311] updated for version 7.4.547 Problem: Using "vit" does not select a multi-byte character at the end correctly. Solution: Advance the cursor over the multi-byte character. (Christian Brabandt) --- src/search.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/search.c b/src/search.c index b64b8f6ce7..e22109817d 100644 --- a/src/search.c +++ b/src/search.c @@ -3932,7 +3932,7 @@ again: if (lt(end_pos, start_pos)) curwin->w_cursor = start_pos; else if (*p_sel == 'e') - ++curwin->w_cursor.col; + inc_cursor(); VIsual = start_pos; VIsual_mode = 'v'; redraw_curbuf_later(INVERTED); /* update the inversion */ diff --git a/src/version.c b/src/version.c index 94ba992cb5..7abbfb5915 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 547, /**/ 546, /**/ From 15062cbf0fb4382170f16fb8e0c6f409468486cb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 17:50:09 +0100 Subject: [PATCH 228/311] updated for version 7.4.548 Problem: Function name not recognized correctly when inside a function. Solution: Don't check for an alpha character. --- src/Make_cyg_ming.mak | 4 ++++ src/version.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index 455750e33b..1f55a9e6ab 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -366,7 +366,11 @@ endif endif CC := $(CROSS_COMPILE)gcc CXX := $(CROSS_COMPILE)g++ +ifeq ($(UNDER_CYGWIN),yes) WINDRES := $(CROSS_COMPILE)windres +else +WINDRES := windres +endif WINDRES_CC = $(CC) #>>>>> end of choices diff --git a/src/version.c b/src/version.c index 7abbfb5915..05a9875534 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 548, /**/ 547, /**/ From 711438aa5856d9f0dc1a8c14d8b633b2368f8a20 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 18:00:55 +0100 Subject: [PATCH 229/311] updated for version 7.4.549 Problem: Function name not recognized correctly when inside a function. Solution: Don't check for an alpha character. --- src/eval.c | 11 ++++------- src/testdir/Make_amiga.mak | 3 +++ src/testdir/Make_dos.mak | 1 + src/testdir/Make_ming.mak | 1 + src/testdir/Make_os2.mak | 1 + src/testdir/Make_vms.mms | 3 ++- src/testdir/Makefile | 1 + src/version.c | 2 ++ 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/eval.c b/src/eval.c index 5c584dead5..fbe824eec1 100644 --- a/src/eval.c +++ b/src/eval.c @@ -22283,14 +22283,11 @@ ex_function(eap) if (*p == '!') p = skipwhite(p + 1); p += eval_fname_script(p); - if (ASCII_ISALPHA(*p)) + vim_free(trans_function_name(&p, TRUE, 0, NULL)); + if (*skipwhite(p) == '(') { - vim_free(trans_function_name(&p, TRUE, 0, NULL)); - if (*skipwhite(p) == '(') - { - ++nesting; - indent += 2; - } + ++nesting; + indent += 2; } } diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index 9ce3578588..c8becc7a7d 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -47,6 +47,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_mapping.out \ + test_nested_function.out \ test_options.out \ test_qf_title.out \ test_signs.out \ @@ -184,6 +185,8 @@ test_eval.out: test_eval.in test_insertcount.out: test_insertcount.in test_listlbr.out: test_listlbr.in test_listlbr_utf8.out: test_listlbr_utf8.in +test_mapping.out: test_mapping.in +test_nested_function.out: test_nested_function.in test_options.out: test_options.in test_qf_title.out: test_qf_title.in test_signs.out: test_signs.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index b1b5b19dbd..57f85ea67b 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -46,6 +46,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_mapping.out \ + test_nested_function.out \ test_options.out \ test_qf_title.out \ test_signs.out \ diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 28a3640c56..5718d46018 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -68,6 +68,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_mapping.out \ + test_nested_function.out \ test_options.out \ test_qf_title.out \ test_signs.out \ diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index a01dedf834..1ba2dfe946 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -48,6 +48,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_mapping.out \ + test_nested_function.out \ test_options.out \ test_qf_title.out \ test_signs.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 8eecd51a2a..9fecf9fa63 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # -# Last change: 2014 Dec 08 +# Last change: 2014 Dec 13 # # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64. # Edit the lines in the Configuration section below to select. @@ -107,6 +107,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_mapping.out \ + test_nested_function.out \ test_options.out \ test_qf_title.out \ test_signs.out \ diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 8f9e33c6ee..e76a72b009 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -44,6 +44,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test_listlbr.out \ test_listlbr_utf8.out \ test_mapping.out \ + test_nested_function.out \ test_options.out \ test_qf_title.out \ test_signs.out \ diff --git a/src/version.c b/src/version.c index 05a9875534..1c6bbbda66 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 549, /**/ 548, /**/ From 26a278bb118d1871d9e932a4137360b70f2f18ec Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 18:03:10 +0100 Subject: [PATCH 230/311] Add new files for 7.4.549. --- src/testdir/test_nested_function.in | 34 +++++++++++++++++++++++++++++ src/testdir/test_nested_function.ok | 6 +++++ 2 files changed, 40 insertions(+) create mode 100644 src/testdir/test_nested_function.in create mode 100644 src/testdir/test_nested_function.ok diff --git a/src/testdir/test_nested_function.in b/src/testdir/test_nested_function.in new file mode 100644 index 0000000000..534164a50b --- /dev/null +++ b/src/testdir/test_nested_function.in @@ -0,0 +1,34 @@ +Tests for Nested function vim: set ft=vim : + +STARTTEST +:so small.vim +:fu! NestedFunc() +: fu! Func1() +: $put ='Func1' +: endfunction +: call Func1() +: fu! s:func2() +: $put ='s:func2' +: endfunction +: call s:func2() +: fu! s:_func3() +: $put ='s:_func3' +: endfunction +: call s:_func3() +: let fn = 'Func4' +: fu! {fn}() +: $put ='Func4' +: endfunction +: call {fn}() +: let fn = 'func5' +: fu! s:{fn}() +: $put ='s:func5' +: endfunction +: call s:{fn}() +:endfunction +:call NestedFunc() +:/^result:/,$w! test.out +:qa! +ENDTEST + +result: diff --git a/src/testdir/test_nested_function.ok b/src/testdir/test_nested_function.ok new file mode 100644 index 0000000000..c1fd19afe8 --- /dev/null +++ b/src/testdir/test_nested_function.ok @@ -0,0 +1,6 @@ +result: +Func1 +s:func2 +s:_func3 +Func4 +s:func5 From b3b601fb08ab90cc8ce35ad132b08d5d2a7d8cb3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 18:09:57 +0100 Subject: [PATCH 231/311] updated for version 7.4.550 Problem: curs_rows() function is always called with the second argument false. Solution: Remove the argument. (Christian Brabandt) validate_botline_win() can then also be removed. --- src/move.c | 26 ++++---------------------- src/version.c | 2 ++ 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/move.c b/src/move.c index 2e0efeca3c..e84f3d57e6 100644 --- a/src/move.c +++ b/src/move.c @@ -23,8 +23,7 @@ static void comp_botline __ARGS((win_T *wp)); static void redraw_for_cursorline __ARGS((win_T *wp)); static int scrolljump_value __ARGS((void)); static int check_top_offset __ARGS((void)); -static void curs_rows __ARGS((win_T *wp, int do_botline)); -static void validate_botline_win __ARGS((win_T *wp)); +static void curs_rows __ARGS((win_T *wp)); static void validate_cheight __ARGS((void)); typedef struct @@ -608,17 +607,6 @@ validate_botline() comp_botline(curwin); } -/* - * Make sure the value of wp->w_botline is valid. - */ - static void -validate_botline_win(wp) - win_T *wp; -{ - if (!(wp->w_valid & VALID_BOTLINE)) - comp_botline(wp); -} - /* * Mark curwin->w_botline as invalid (because of some change in the buffer). */ @@ -678,20 +666,17 @@ validate_cline_row() update_topline(); check_cursor_moved(curwin); if (!(curwin->w_valid & VALID_CROW)) - curs_rows(curwin, FALSE); + curs_rows(curwin); } #endif /* * Compute wp->w_cline_row and wp->w_cline_height, based on the current value * of wp->w_topline. - * - * Returns OK when cursor is in the window, FAIL when it isn't. */ static void -curs_rows(wp, do_botline) +curs_rows(wp) win_T *wp; - int do_botline; /* also compute w_botline */ { linenr_T lnum; int i; @@ -810,9 +795,6 @@ curs_rows(wp, do_botline) redraw_for_cursorline(curwin); wp->w_valid |= VALID_CROW|VALID_CHEIGHT; - /* validate botline too, if update_screen doesn't do it */ - if (do_botline && all_invalid) - validate_botline_win(wp); } /* @@ -986,7 +968,7 @@ curs_columns(may_scroll) * Next make sure that w_cline_row is valid. */ if (!(curwin->w_valid & VALID_CROW)) - curs_rows(curwin, FALSE); + curs_rows(curwin); /* * Compute the number of virtual columns. diff --git a/src/version.c b/src/version.c index 1c6bbbda66..32fb731575 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 550, /**/ 549, /**/ From 59bc549474da1da89d19603946a4b86aa4eed065 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 19:00:22 +0100 Subject: [PATCH 232/311] updated for version 7.4.551 Problem: "ygn" may yank too much. (Fritzophrenic) Issue 295. Solution: Check the width of the next match. (Christian Brabandt) --- src/search.c | 27 +++++++++++++++++++++------ src/testdir/test53.in | 7 +++++++ src/testdir/test53.ok | 6 ++++++ src/version.c | 2 ++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/search.c b/src/search.c index e22109817d..3276a77b7a 100644 --- a/src/search.c +++ b/src/search.c @@ -4441,12 +4441,11 @@ current_quote(oap, count, include, quotechar) #endif /* FEAT_TEXTOBJ */ -static int is_one_char __ARGS((char_u *pattern)); +static int is_one_char __ARGS((char_u *pattern, int move)); /* * Find next search match under cursor, cursor at end. * Used while an operator is pending, and in Visual mode. - * TODO: redo only works when used in operator pending mode */ int current_search(count, forward) @@ -4491,7 +4490,7 @@ current_search(count, forward) orig_pos = pos = start_pos = curwin->w_cursor; /* Is the pattern is zero-width? */ - one_char = is_one_char(spats[last_idx].pat); + one_char = is_one_char(spats[last_idx].pat, TRUE); if (one_char == -1) { p_ws = old_p_ws; @@ -4550,6 +4549,10 @@ current_search(count, forward) start_pos = pos; flags = forward ? SEARCH_END : 0; + /* Check again from the current cursor position, + * since the next match might actually by only one char wide */ + one_char = is_one_char(spats[last_idx].pat, FALSE); + /* move to match, except for zero-width matches, in which case, we are * already on the next match */ if (!one_char) @@ -4599,26 +4602,38 @@ current_search(count, forward) /* * Check if the pattern is one character or zero-width. + * If move is TRUE, check from the beginning of the buffer, else from the + * current cursor position. * Returns TRUE, FALSE or -1 for failure. */ static int -is_one_char(pattern) +is_one_char(pattern, move) char_u *pattern; + int move; { regmmatch_T regmatch; int nmatched = 0; int result = -1; pos_T pos; int save_called_emsg = called_emsg; + int flag = 0; if (search_regcomp(pattern, RE_SEARCH, RE_SEARCH, SEARCH_KEEP, ®match) == FAIL) return -1; /* move to match */ - clearpos(&pos); + if (move) + clearpos(&pos) + else + { + pos = curwin->w_cursor; + /* accept a match at the cursor position */ + flag = SEARCH_START; + } + if (searchit(curwin, curbuf, &pos, FORWARD, spats[last_idx].pat, 1, - SEARCH_KEEP, RE_SEARCH, 0, NULL) != FAIL) + SEARCH_KEEP + flag, RE_SEARCH, 0, NULL) != FAIL) { /* Zero-width pattern should match somewhere, then we can check if * start and end are in the same position. */ diff --git a/src/testdir/test53.in b/src/testdir/test53.in index 011c9ae39d..8ca9c9ed29 100644 --- a/src/testdir/test53.in +++ b/src/testdir/test53.in @@ -79,6 +79,8 @@ ggdgn. :" test repeating gUgn /^Depp gggUgn. +gg/a:0\@!\zs\d\+ +nygnop :/^start:/,/^end:/wq! test.out ENDTEST @@ -108,6 +110,11 @@ delete first and last chars uniquepattern uniquepattern my very excellent mother just served us nachos for (i=0; i<=10; i++) +a:10 + +a:1 + +a:20 Y text Y diff --git a/src/testdir/test53.ok b/src/testdir/test53.ok index d7ffa6bc51..0c0b9ded16 100644 --- a/src/testdir/test53.ok +++ b/src/testdir/test53.ok @@ -49,6 +49,12 @@ elete first and last char uniquepattern my very excellent mongoose just served us nachos for (j=0; i<=10; i++) +a:10 + +a:1 +1 + +a:20 text Y diff --git a/src/version.c b/src/version.c index 32fb731575..6408d57077 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 551, /**/ 550, /**/ From 82af09a9e2cece4873f51af9a93487c56f9881f2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 21:43:54 +0100 Subject: [PATCH 233/311] updated for version 7.4.552 Problem: Langmap applies to Insert mode expression mappings. Solution: Check for Insert mode. (Daniel Hahler) --- src/getchar.c | 2 +- src/testdir/test_mapping.in | 9 +++++++++ src/testdir/test_mapping.ok | 2 ++ src/version.c | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/getchar.c b/src/getchar.c index c9ee4d0510..174cfa892f 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -2145,7 +2145,7 @@ vgetorpeek(advance) nolmaplen = 2; else { - LANGMAP_ADJUST(c1, TRUE); + LANGMAP_ADJUST(c1, (State & INSERT) == 0); nolmaplen = 0; } #endif diff --git a/src/testdir/test_mapping.in b/src/testdir/test_mapping.in index e2572772c1..5f895a46f2 100644 --- a/src/testdir/test_mapping.in +++ b/src/testdir/test_mapping.in @@ -8,6 +8,15 @@ STARTTEST :inoreab чкпр vim GAчкпр  + +: " langmap should not get remapped in insert mode +:inoremap { FAIL_ilangmap +:set langmap=+{ langnoremap +o+ +: " expr mapping with langmap +:inoremap { "FAIL_iexplangmap" +o+ + :/^test/,$w! test.out :qa! ENDTEST diff --git a/src/testdir/test_mapping.ok b/src/testdir/test_mapping.ok index abdaea6a36..8d94976582 100644 --- a/src/testdir/test_mapping.ok +++ b/src/testdir/test_mapping.ok @@ -1,2 +1,4 @@ test starts here: vim ++ ++ diff --git a/src/version.c b/src/version.c index 6408d57077..e8d75252fa 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 552, /**/ 551, /**/ From 48f0e5e403009f342d05ee11db5d554683321845 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 13 Dec 2014 22:27:49 +0100 Subject: [PATCH 234/311] Updated runtime files. --- runtime/doc/eval.txt | 10 +++++++- runtime/doc/map.txt | 2 +- runtime/doc/tags | 2 ++ runtime/doc/todo.txt | 57 +++++++++++++++++++++++++----------------- runtime/indent/vim.vim | 4 +-- 5 files changed, 48 insertions(+), 27 deletions(-) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 21df37f301..69ab0a641b 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2014 Nov 27 +*eval.txt* For Vim version 7.4. Last change: 2014 Dec 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2395,6 +2395,10 @@ col({expr}) The result is a Number, which is the byte index of the column number of bytes in the cursor line plus one) 'x position of mark x (if the mark is not set, 0 is returned) + v In Visual mode: the start of the Visual area (the + cursor is the end). When not in Visual mode + returns the cursor position. Differs from |'<| in + that it's updated right away. Additionally {expr} can be [lnum, col]: a |List| with the line and column number. Most useful when the column is "$", to get the last column of a specific line. When "lnum" or "col" is @@ -6418,6 +6422,10 @@ virtcol({expr}) *virtcol()* plus one) 'x position of mark x (if the mark is not set, 0 is returned) + v In Visual mode: the start of the Visual area (the + cursor is the end). When not in Visual mode + returns the cursor position. Differs from |'<| in + that it's updated right away. Note that only marks in the current file can be used. Examples: > virtcol(".") with text "foo^Lbar", with cursor on the "^L", returns 5 diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 281aa8b142..fb041c6a5e 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.4. Last change: 2014 Oct 03 +*map.txt* For Vim version 7.4. Last change: 2014 Dec 08 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/tags b/runtime/doc/tags index 9a23ce4cf9..ae7e22f7d8 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2057,6 +2057,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :comc map.txt /*:comc* :comclear map.txt /*:comclear* :command map.txt /*:command* +:command-addr map.txt /*:command-addr* :command-bang map.txt /*:command-bang* :command-bar map.txt /*:command-bar* :command-buffer map.txt /*:command-buffer* @@ -4335,6 +4336,7 @@ E885 sign.txt /*E885* E886 starting.txt /*E886* E887 if_pyth.txt /*E887* E888 pattern.txt /*E888* +E889 map.txt /*E889* E89 message.txt /*E89* E90 message.txt /*E90* E91 options.txt /*E91* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 04f9a44b95..d114d36c59 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Dec 06 +*todo.txt* For Vim version 7.4. Last change: 2014 Dec 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -34,19 +34,6 @@ not be repeated below, unless there is extra information. *known-bugs* -------------------- Known bugs and current work ----------------------- -Patch to fix list range assign crash. (Yukihiro Nakadaira, 2014 Dec 1) - -Patch to fix range with user command. (Marcin Szamotulski, 2014 Dec 2) -Update Dec 6, with support for user commands. - -When window number in Ex range is too high, give an error? -Only when backwards compatible. - -:s/\n// doesn't change anything. Since 7.4.232? (Eliseo Martínez, 2014 Nov -28) Patch on Issue 287 - -Using vim_snprintf() in window.c can be in a function. - Regexp problems: - The NFA engine does not implement the time limit passed to nfa_regexec_multi() @@ -78,35 +65,41 @@ Breaks test_eval. Inefficient, can we only compute y_width when needed? Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) -Patch to fix recognizing function name. (Ozaki Kiichi, 2014 Nov 28) - ":cd C:\Windows\System32\drivers\etc*" does not work, even though the directory exists. (Sergio Gallelli, 2013 Dec 29) -The entries added by matchaddpos() are returned by getmatches() but can't be -set with setmatches(). (lcd47, 2014 Jun 29) - Gvim: when both Tab and CTRL-I are mapped, use CTRL-I not for Tab. Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) -Change behavior of v:hlsearch? Patch from Christian, 2014 Oct 22. +When window number in Ex range is too high, should give an error: + :3close " fails if there are only 2 windows. +Patch from Marcin Szamotulski, 2014 Dec 13. Patch to recover from X server restart: hint on Issue 203 (2014 Nov 21 18:44) +Insert a block with virtualedit set does not work correctly. +Patch by James McCoy, 2014 Dec 10. + MS-Windows: When editing a file with a leading space, writing it uses the wrong name. (Aram, 2014 Nov 7) Vim 7.4. Add LessCss support. (Jenoma / Alessandro Vioni, 2014 Nov 24) Now with updated license, Nov 24. +Memory leak using :wviminfo. Issue 296. With Patch by Christian. + patch to remove FEAT_OSFILETYPE from fileio.c. (Christian, 2014 Nov 12) Value returned by virtcol() changes depending on how lines wrap. This is inconsistent with the documentation. +Patch to also support range for :argdo, :bufdo, etc. +(Marcin Szamotulski, 2014 Dec 7) +Asked for tests. + Ukrainian vimtutor. (Issue 288) Regenerate the Unicode tables in mbyte.c. @@ -115,11 +108,19 @@ Diff from ZyX, 2014 Dec 6. Patch to fix relative numbers. (Christian Brabandt, 2014 Nov 17) Update Nov 26. +Patch to fix that getcurpos() returns a negative number, instead of MAXCOL. +(Hirohito Higashi, 2014 Dec 8) + Patch to fix wrong formatting if 'linebreak' is set. (Christian Brabandt, 2014 Nov 12) Patch to avoid recognizing polkit as hog files. (Issue 292) +Patch 7.4.468 changed how CTRL-C is handled. It does not take care of mapping +CTRL-C in different modes. (Ingo Karkat, 2014 Dec 12) +Patch from Christian Brabandt, 2014 Dec 13. +Needs to be improved. + Patch to support hex values for setting option value. (Zyx, 2015 Nov 6) @@ -150,6 +151,9 @@ Just remove one trailing newline. (lcd, 2014 Oct 17) Make comments in the test Makefile silent. (Kartik Agaram, 2014 Sep 24) +Patch to add GUI colors to the terminal, when it supports it. (ZyX, 2013 Jan +26, update 2013 Dec 14, another 2014 Nov 22) + Result of systemlist() does not show whether text ended in line break. (Bjorn Linse, 2014 Nov 27) @@ -161,6 +165,9 @@ Syntax highlighting slow (hangs) in SASS file. (Niek Bosch, 2013 Aug 21) Patch to add the EndOfBuffer highlight group, used instead of NonText for "~" lines. (Marco Hinz, 2014 Nov 2) +Patch for fixing a problem of the combination of conceal and linebreak. +(Christian Brabandt, 2014 Dec 11) + Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19) Plugins need to make a lot of effort, lots of mappings, to know what happened @@ -182,6 +189,7 @@ was already defined. (Yasuhiro Matsumoto, 2014 Nov 3) Patch to make closed folds line up. (Charles Campbell, 2014 Sep 12) +Remark from Roland Eggner: does it cause crashes? (2014 Dec 12) Patch for building a 32bit Vim with 64bit MingW compiler. (Michael Soyka, 2014 Oct 15) @@ -213,6 +221,9 @@ No error for missing endwhile. (ZyX, 2014 Mar 20) start_global_changes() plus end_global_changes() causes problem for clip_unnamed_plus. (Jason Pleau, 2014 Sep 12) +The entries added by matchaddpos() are returned by getmatches() but can't be +set with setmatches(). (lcd47, 2014 Jun 29) + Patch to add :arglocal and :arglists. (Marcin Szamotulski, 2014 Aug 6) PHP syntax is extremely slow. (Anhad Jai Singh, 2014 Jan 19) @@ -472,6 +483,9 @@ optional. (2013 Jul 12) Dialog is too big on Linux too. (David Fishburn, 2013 Sep 2) +Patch to check whether a buffer is quickfix or a location list. +(Yasuhiro Matsumoto, 2014 Dec 9) + Patch to allow setting w:quickfix_title via setqflist() and setloclist() functions. (Christian Brabandt, 2013 May 8, update May 21) Patch to add getlocstack() / setlocstack(). (Christian Brabandt, 2013 May 14) @@ -915,9 +929,6 @@ names, shell commands and the like. (Kikuchan, 2010 Oct 14) Assume the system converts between the actual encoding of the filesystem to the system encoding (usually utf-8). -Patch to add GUI colors to the terminal, when it supports it. (ZyX, 2013 Jan -26, update 2013 Dec 14, another 2014 Nov 22) - Problem producing tags file when hebrew.frx is present. It has a BOM. Results in E670. (Tony Mechelynck, 2010 May 2) diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index ff4af027b4..7511325af4 100644 --- a/runtime/indent/vim.vim +++ b/runtime/indent/vim.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Vim script " Maintainer: Bram Moolenaar -" Last Change: 2014 Sep 19 +" Last Change: 2014 Dec 12 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -89,7 +89,7 @@ function GetVimIndentIntern() " Subtract a 'shiftwidth' on a :endif, :endwhile, :catch, :finally, :endtry, " :endfun, :else and :augroup END. - if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+END\)' + if cur_text =~ '^\s*\(ene\@!\|cat\|fina\|el\|aug\%[roup]\s*!\=\s\+[eE][nN][dD]\)' let ind = ind - &sw endif From 2c460f1f51182320c844d8e154a385e689f0543e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Dec 2014 11:36:14 +0100 Subject: [PATCH 235/311] updated for version 7.4.553 Problem: Various small issues. Solution: Fix those issues. --- src/INSTALL | 2 +- src/Make_vms.mms | 6 +++--- src/ex_cmds.h | 2 +- src/gui.h | 2 +- src/message.c | 4 ++-- src/os_unix.c | 2 +- src/proto/eval.pro | 2 +- src/proto/misc1.pro | 2 +- src/proto/ops.pro | 2 +- src/proto/os_vms.pro | 3 ++- src/proto/screen.pro | 2 +- src/testdir/test39.in | 4 ++++ src/version.c | 2 ++ 13 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/INSTALL b/src/INSTALL index aa4b6e341c..54297d198e 100644 --- a/src/INSTALL +++ b/src/INSTALL @@ -316,7 +316,7 @@ directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. - If you have to use a `make' that does not supports the `VPATH' + If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another diff --git a/src/Make_vms.mms b/src/Make_vms.mms index 4d19bcb2ee..f19b688585 100644 --- a/src/Make_vms.mms +++ b/src/Make_vms.mms @@ -2,7 +2,7 @@ # Makefile for Vim on OpenVMS # # Maintainer: Zoltan Arpadffy -# Last change: 2014 Feb 24 +# Last change: 2014 Aug 10 # # This has script been tested on VMS 6.2 to 8.2 on DEC Alpha, VAX and IA64 # with MMS and MMK @@ -309,7 +309,7 @@ ALL_CFLAGS_VER = /def=($(MODEL_DEF)$(DEFS)$(DEBUG_DEF)$(PERL_DEF)$(PYTHON_DEF) - ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) \ $(PERL_LIB) $(PYTHON_LIB) $(TCL_LIB) $(SNIFF_LIB) $(RUBY_LIB) -SRC = blowfish.c buffer.c charset.c diff.c digraph.c edit.c eval.c ex_cmds.c ex_cmds2.c \ +SRC = blowfish.c buffer.c charset.c crypt.c, crypt_zip.c diff.c digraph.c edit.c eval.c ex_cmds.c ex_cmds2.c \ ex_docmd.c ex_eval.c ex_getln.c if_xcmdsrv.c fileio.c fold.c getchar.c \ hardcopy.c hashtab.c main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \ misc2.c move.c normal.c ops.c option.c popupmnu.c quickfix.c regexp.c search.c sha256.c\ @@ -318,7 +318,7 @@ SRC = blowfish.c buffer.c charset.c diff.c digraph.c edit.c eval.c ex_cmds.c ex_ $(GUI_SRC) $(PERL_SRC) $(PYTHON_SRC) $(TCL_SRC) $(SNIFF_SRC) \ $(RUBY_SRC) $(HANGULIN_SRC) $(MZSCH_SRC) -OBJ = blowfish.obj buffer.obj charset.obj diff.obj digraph.obj edit.obj eval.obj \ +OBJ = blowfish.obj buffer.obj charset.obj crypt.obj, crypt_zip.obj diff.obj digraph.obj edit.obj eval.obj \ ex_cmds.obj ex_cmds2.obj ex_docmd.obj ex_eval.obj ex_getln.obj \ if_xcmdsrv.obj fileio.obj fold.obj getchar.obj hardcopy.obj hashtab.obj main.obj mark.obj \ menu.obj memfile.obj memline.obj message.obj misc1.obj misc2.obj \ diff --git a/src/ex_cmds.h b/src/ex_cmds.h index fc6a8ac0fa..95a22898be 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -63,7 +63,7 @@ #define ADDR_WINDOWS 1 #define ADDR_ARGUMENTS 2 #define ADDR_LOADED_BUFFERS 3 -#define ADDR_BUFFERS 4 +#define ADDR_BUFFERS 4 #define ADDR_TABS 5 #ifndef DO_DECLARE_EXCMD diff --git a/src/gui.h b/src/gui.h index 89476c934e..b2fdc6d8fa 100644 --- a/src/gui.h +++ b/src/gui.h @@ -41,7 +41,7 @@ # include # include # if !(defined (TARGET_API_MAC_CARBON) && (TARGET_API_MAC_CARBON)) -# include +# include # endif # include /*# include */ diff --git a/src/message.c b/src/message.c index 8508f6dfd7..b6eaddc0c0 100644 --- a/src/message.c +++ b/src/message.c @@ -4030,11 +4030,11 @@ tv_float(tvs, idxp) * pointer for resulting string argument if "str_m" is zero (as per ISO C99). * * The return value is the number of characters which would be generated - * for the given input, excluding the trailing null. If this value + * for the given input, excluding the trailing NUL. If this value * is greater or equal to "str_m", not all characters from the result * have been stored in str, output bytes beyond the ("str_m"-1) -th character * are discarded. If "str_m" is greater than zero it is guaranteed - * the resulting string will be null-terminated. + * the resulting string will be NUL-terminated. */ /* diff --git a/src/os_unix.c b/src/os_unix.c index 0813cae73c..ff8834527f 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1609,7 +1609,7 @@ x_IOerror_handler(dpy) /* * If the X11 connection was lost try to restore it. * Helps when the X11 server was stopped and restarted while Vim was inactive - * (e.g. though tmux). + * (e.g. through tmux). */ static void may_restore_clipboard() diff --git a/src/proto/eval.pro b/src/proto/eval.pro index 517d9e71af..b264365fe1 100644 --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -59,8 +59,8 @@ int list_append_tv __ARGS((list_T *l, typval_T *tv)); int list_append_dict __ARGS((list_T *list, dict_T *dict)); int list_append_string __ARGS((list_T *l, char_u *str, int len)); int list_insert_tv __ARGS((list_T *l, typval_T *tv, listitem_T *item)); -void vimlist_remove __ARGS((list_T *l, listitem_T *item, listitem_T *item2)); void list_insert __ARGS((list_T *l, listitem_T *ni, listitem_T *item)); +void vimlist_remove __ARGS((list_T *l, listitem_T *item, listitem_T *item2)); int garbage_collect __ARGS((void)); void set_ref_in_ht __ARGS((hashtab_T *ht, int copyID)); void set_ref_in_list __ARGS((list_T *l, int copyID)); diff --git a/src/proto/misc1.pro b/src/proto/misc1.pro index 274c7af46f..5df81c9280 100644 --- a/src/proto/misc1.pro +++ b/src/proto/misc1.pro @@ -5,7 +5,7 @@ int get_indent_buf __ARGS((buf_T *buf, linenr_T lnum)); int get_indent_str __ARGS((char_u *ptr, int ts, int list)); int set_indent __ARGS((int size, int flags)); int get_number_indent __ARGS((linenr_T lnum)); -int get_breakindent_win __ARGS((win_T *wp, char_u *ptr)); +int get_breakindent_win __ARGS((win_T *wp, char_u *line)); int open_line __ARGS((int dir, int flags, int second_line_indent)); int get_leader_len __ARGS((char_u *line, char_u **flags, int backward, int include_space)); int get_last_leader_offset __ARGS((char_u *line, char_u **flags)); diff --git a/src/proto/ops.pro b/src/proto/ops.pro index fe40151cd4..c1a1b455ef 100644 --- a/src/proto/ops.pro +++ b/src/proto/ops.pro @@ -55,8 +55,8 @@ void dnd_yank_drag_data __ARGS((char_u *str, long len)); char_u get_reg_type __ARGS((int regname, long *reglen)); char_u *get_reg_contents __ARGS((int regname, int flags)); void write_reg_contents __ARGS((int name, char_u *str, int maxlen, int must_append)); -void write_reg_contents_ex __ARGS((int name, char_u *str, int maxlen, int must_append, int yank_type, long block_len)); void write_reg_contents_lst __ARGS((int name, char_u **strings, int maxlen, int must_append, int yank_type, long block_len)); +void write_reg_contents_ex __ARGS((int name, char_u *str, int maxlen, int must_append, int yank_type, long block_len)); void clear_oparg __ARGS((oparg_T *oap)); void cursor_pos_info __ARGS((void)); /* vim: set ft=c : */ diff --git a/src/proto/os_vms.pro b/src/proto/os_vms.pro index 6408455e46..cc0f1d9130 100644 --- a/src/proto/os_vms.pro +++ b/src/proto/os_vms.pro @@ -5,11 +5,12 @@ void mch_set_shellsize __ARGS((void)); char_u *mch_getenv __ARGS((char_u *lognam)); int mch_setenv __ARGS((char *var, char *value, int x)); int vms_sys __ARGS((char *cmd, char *out, char *inp)); +char *vms_tolower __ARGS((char *name)); int vms_sys_status __ARGS((int status)); int vms_read __ARGS((char *inbuf, size_t nbytes)); -char *vms_tolower __ARGS((char *name)); int mch_expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags)); int mch_expandpath __ARGS((garray_T *gap, char_u *path, int flags)); void *vms_fixfilename __ARGS((void *instring)); void vms_remove_version __ARGS((void *fname)); +int RealWaitForChar __ARGS((int fd, long msec, int *check_for_gpm)); /* vim: set ft=c : */ diff --git a/src/proto/screen.pro b/src/proto/screen.pro index 31f97d5444..a4df6269f2 100644 --- a/src/proto/screen.pro +++ b/src/proto/screen.pro @@ -26,7 +26,7 @@ int get_keymap_str __ARGS((win_T *wp, char_u *buf, int len)); void screen_putchar __ARGS((int c, int row, int col, int attr)); void screen_getbytes __ARGS((int row, int col, char_u *bytes, int *attrp)); void screen_puts __ARGS((char_u *text, int row, int col, int attr)); -void screen_puts_len __ARGS((char_u *text, int len, int row, int col, int attr)); +void screen_puts_len __ARGS((char_u *text, int textlen, int row, int col, int attr)); void screen_stop_highlight __ARGS((void)); void reset_cterm_colors __ARGS((void)); void screen_draw_rectangle __ARGS((int row, int col, int height, int width, int invert)); diff --git a/src/testdir/test39.in b/src/testdir/test39.in index 7d1c672522..410dea61ae 100644 --- a/src/testdir/test39.in +++ b/src/testdir/test39.in @@ -85,6 +85,10 @@ bbbb cccc dddd +yaaa + +bbb + A23 4567 diff --git a/src/version.c b/src/version.c index e8d75252fa..eb867138fd 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 553, /**/ 552, /**/ From f4dcc7c0b54c94f2ee2d6667325aae61860328c1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Dec 2014 11:41:10 +0100 Subject: [PATCH 236/311] updated for version 7.4.554 Problem: Missing part of patch 7.4.519. Solution: Copy back regprog after calling vim_regexec. --- src/quickfix.c | 6 +++++- src/version.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/quickfix.c b/src/quickfix.c index c8954cc531..abb4a6ecf3 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -592,6 +592,8 @@ qf_init_ext(qi, efile, buf, tv, errorformat, newlist, lnumfirst, lnumlast, restofline: for ( ; fmt_ptr != NULL; fmt_ptr = fmt_ptr->next) { + int r; + idx = fmt_ptr->prefix; if (multiscan && vim_strchr((char_u *)"OPQ", idx) == NULL) continue; @@ -607,7 +609,9 @@ restofline: tail = NULL; regmatch.regprog = fmt_ptr->prog; - if (vim_regexec(®match, IObuff, (colnr_T)0)) + r = vim_regexec(®match, IObuff, (colnr_T)0); + fmt_ptr->prog = regmatch.regprog; + if (r) { if ((idx == 'C' || idx == 'Z') && !multiline) continue; diff --git a/src/version.c b/src/version.c index eb867138fd..cd7bfb1291 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 554, /**/ 553, /**/ From caf51c2977fba8e35ace9bcb2c063b5279ce5748 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Dec 2014 11:42:46 +0100 Subject: [PATCH 237/311] updated for version 7.4.555 Problem: test_close_count may fail for some combination of features. Solution: Require normal features. --- src/testdir/test_close_count.in | 5 +---- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/testdir/test_close_count.in b/src/testdir/test_close_count.in index 288945c696..8a4e090ed5 100644 --- a/src/testdir/test_close_count.in +++ b/src/testdir/test_close_count.in @@ -1,8 +1,8 @@ Tests for :[count]close! and :[count]hide vim: set ft=vim : STARTTEST +:so small.vim :let tests = [] -:so tiny.vim :for i in range(5) :new :endfor @@ -46,7 +46,6 @@ ENDTEST STARTTEST :let tests = [] -:so tiny.vim :for i in range(5) :new :endfor @@ -94,7 +93,6 @@ ENDTEST STARTTEST :let tests = [] -:so tiny.vim :set hidden :for i in range(5) :new @@ -123,7 +121,6 @@ ENDTEST STARTTEST :let tests = [] -:so tiny.vim :set hidden :for i in range(5) :new diff --git a/src/version.c b/src/version.c index cd7bfb1291..0c8b39a0ec 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 555, /**/ 554, /**/ From cbc79a48643ff93096b52626f3af122156b05945 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Dec 2014 11:46:09 +0100 Subject: [PATCH 238/311] updated for version 7.4.556 Problem: Failed commands in Python interface not handled correctly. Solution: Restore window and buffer on failure. --- src/if_py_both.h | 9 +++++++-- src/version.c | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index 5044afbeff..206d2987a5 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -3172,6 +3172,7 @@ set_option_value_for( if (switch_win(&save_curwin, &save_curtab, (win_T *)from, win_find_tabpage((win_T *)from), FALSE) == FAIL) { + restore_win(save_curwin, save_curtab, TRUE); if (VimTryEnd()) return -1; PyErr_SET_VIM(N_("problem while switching windows")); @@ -4032,9 +4033,13 @@ switch_to_win_for_buf( win_T *wp; tabpage_T *tp; - if (find_win_for_buf(buf, &wp, &tp) == FAIL - || switch_win(save_curwinp, save_curtabp, wp, tp, TRUE) == FAIL) + if (find_win_for_buf(buf, &wp, &tp) == FAIL) switch_buffer(save_curbufp, buf); + else if (switch_win(save_curwinp, save_curtabp, wp, tp, TRUE) == FAIL) + { + restore_win(*save_curwinp, *save_curtabp, TRUE); + switch_buffer(save_curbufp, buf); + } } static void diff --git a/src/version.c b/src/version.c index 0c8b39a0ec..017bff6d59 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 556, /**/ 555, /**/ From 52df7d75393c3d5b2f0197a4d692876f1fe2c7c2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Dec 2014 11:47:56 +0100 Subject: [PATCH 239/311] updated for version 7.4.557 Problem: One more small issue. Solution: Update function proto. --- src/proto/window.pro | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/proto/window.pro b/src/proto/window.pro index 2d33c17576..b89cf085a0 100644 --- a/src/proto/window.pro +++ b/src/proto/window.pro @@ -75,7 +75,7 @@ void restore_win __ARGS((win_T *save_curwin, tabpage_T *save_curtab, int no_disp void switch_buffer __ARGS((buf_T **save_curbuf, buf_T *buf)); void restore_buffer __ARGS((buf_T *save_curbuf)); int win_hasvertsplit __ARGS((void)); -int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos)); +int match_add __ARGS((win_T *wp, char_u *grp, char_u *pat, int prio, int id, list_T *pos_list)); int match_delete __ARGS((win_T *wp, int id, int perr)); void clear_matches __ARGS((win_T *wp)); matchitem_T *get_match __ARGS((win_T *wp, int id)); diff --git a/src/version.c b/src/version.c index 017bff6d59..514193a93a 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 557, /**/ 556, /**/ From 9c70d8b25fe77c4f82fcbc2362d7a13f3ad52c52 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Dec 2014 14:59:31 +0100 Subject: [PATCH 240/311] updated for version 7.4.558 Problem: When the X server restarts Vim may get stuck. Solution: Destroy the application context and create it again. (Issue 203) --- src/os_unix.c | 11 +++++++++++ src/version.c | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/os_unix.c b/src/os_unix.c index ff8834527f..bcf11ddc76 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1617,6 +1617,17 @@ may_restore_clipboard() if (xterm_dpy_was_reset) { xterm_dpy_was_reset = FALSE; + +# ifndef LESSTIF_VERSION + /* This has been reported to avoid Vim getting stuck. */ + if (app_context != (XtAppContext)NULL) + { + XtDestroyApplicationContext(app_context); + app_context = (XtAppContext)NULL; + x11_display = NULL; /* freed by XtDestroyApplicationContext() */ + } +# endif + setup_term_clip(); get_x11_title(FALSE); } diff --git a/src/version.c b/src/version.c index 514193a93a..4efee6ae8c 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 558, /**/ 557, /**/ From d8a3e0ae8608927966b7252899cb805ec8a736bc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 17 Dec 2014 15:35:42 +0100 Subject: [PATCH 241/311] updated for version 7.4.559 Problem: Appending a block in the middle of a tab does not work correctly when virtualedit is set. Solution: Decrement spaces and count, don't reset them. (James McCoy) --- src/ops.c | 12 ++++++------ src/testdir/test39.in | 9 ++++++--- src/testdir/test39.ok | Bin 514 -> 584 bytes src/version.c | 2 ++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ops.c b/src/ops.c index edc84a07aa..0db8c2d25c 100644 --- a/src/ops.c +++ b/src/ops.c @@ -612,20 +612,20 @@ block_insert(oap, s, b_insert, bdp) #ifdef FEAT_MBYTE if (has_mbyte && spaces > 0) { + int off; + /* Avoid starting halfway a multi-byte character. */ if (b_insert) { - int off = (*mb_head_off)(oldp, oldp + offset + spaces); - spaces -= off; - count -= off; + off = (*mb_head_off)(oldp, oldp + offset + spaces); } else { - int off = (*mb_off_next)(oldp, oldp + offset); + off = (*mb_off_next)(oldp, oldp + offset); offset += off; - spaces = 0; - count = 0; } + spaces -= off; + count -= off; } #endif diff --git a/src/testdir/test39.in b/src/testdir/test39.in index 410dea61ae..c4e46fff26 100644 --- a/src/testdir/test39.in +++ b/src/testdir/test39.in @@ -38,11 +38,14 @@ G$khhhhhkkcmno /^C23$/ :exe ":norm! l\j$hhAab\" :.,/^$/w >> test.out -:" Test for Visual block insert when virtualedit=all -:set ve=all +:" Test for Visual block insert when virtualedit=all and utf-8 encoding +:set ve=all enc=utf-8 :/\t\tline :exe ":norm! 07l\jjIx\" -:set ve= +:.,/^$/w >> test.out +:" Test for Visual block append when virtualedit=all +:exe ":norm! 012l\jjAx\" +:set ve= enc=latin1 :.,/^$/w >> test.out :" gUe must uppercase a whole word, also when changes to SS Gothe youtueuu endYpk0wgUe diff --git a/src/testdir/test39.ok b/src/testdir/test39.ok index d8e901563af492e50b8f70c470fee5678644dc0c..5c517e2223d5c830ca8297b7c8ec71d180777d82 100644 GIT binary patch delta 75 lcmZo-Il;1lkI`NM0xG~1h|I~%OEu)eDr|%)Jei&GHvnM#5FP*k delta 11 ScmX@X(!{cXk8yGc;}-xH Date: Wed, 17 Dec 2014 18:00:49 +0100 Subject: [PATCH 242/311] updated for version 7.4.560 Problem: Memory leak using :wviminfo. Issue 296. Solution: Free memory when needed. (idea by Christian Brabandt) --- src/ops.c | 64 ++++++++++++++++++++++++++++++++++++++------------- src/version.c | 2 ++ 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/ops.c b/src/ops.c index 0db8c2d25c..0c3d11b87f 100644 --- a/src/ops.c +++ b/src/ops.c @@ -5663,6 +5663,8 @@ read_viminfo_register(virp, force) int set_prev = FALSE; char_u *str; char_u **array = NULL; + int new_type; + colnr_T new_width; /* We only get here (hopefully) if line[0] == '"' */ str = virp->vir_line + 1; @@ -5695,21 +5697,25 @@ read_viminfo_register(virp, force) limit = 100; /* Optimized for registers containing <= 100 lines */ if (do_it) { + /* + * Build the new register in array[]. + * y_array is kept as-is until done. + * The "do_it" flag is reset when something is wrong, in which case + * array[] needs to be freed. + */ if (set_prev) y_previous = y_current; - vim_free(y_current->y_array); - array = y_current->y_array = - (char_u **)alloc((unsigned)(limit * sizeof(char_u *))); + array = (char_u **)alloc((unsigned)(limit * sizeof(char_u *))); str = skipwhite(skiptowhite(str)); if (STRNCMP(str, "CHAR", 4) == 0) - y_current->y_type = MCHAR; + new_type = MCHAR; else if (STRNCMP(str, "BLOCK", 5) == 0) - y_current->y_type = MBLOCK; + new_type = MBLOCK; else - y_current->y_type = MLINE; + new_type = MLINE; /* get the block width; if it's missing we get a zero, which is OK */ str = skipwhite(skiptowhite(str)); - y_current->y_width = getdigits(&str); + new_width = getdigits(&str); } while (!(eof = viminfo_readline(virp)) @@ -5717,40 +5723,66 @@ read_viminfo_register(virp, force) { if (do_it) { - if (size >= limit) + if (size == limit) { - y_current->y_array = (char_u **) + char_u **new_array = (char_u **) alloc((unsigned)(limit * 2 * sizeof(char_u *))); + + if (new_array == NULL) + { + do_it = FALSE; + break; + } for (i = 0; i < limit; i++) - y_current->y_array[i] = array[i]; + new_array[i] = array[i]; vim_free(array); + array = new_array; limit *= 2; - array = y_current->y_array; } str = viminfo_readstring(virp, 1, TRUE); if (str != NULL) array[size++] = str; else + /* error, don't store the result */ do_it = FALSE; } } if (do_it) { + /* free y_array[] */ + for (i = 0; i < y_current->y_size; i++) + vim_free(y_current->y_array[i]); + vim_free(y_current->y_array); + + y_current->y_type = new_type; + y_current->y_width = new_width; + y_current->y_size = size; if (size == 0) { - vim_free(array); y_current->y_array = NULL; } - else if (size < limit) + else { + /* Move the lines from array[] to y_array[]. */ y_current->y_array = (char_u **)alloc((unsigned)(size * sizeof(char_u *))); for (i = 0; i < size; i++) - y_current->y_array[i] = array[i]; - vim_free(array); + { + if (y_current->y_array == NULL) + vim_free(array[i]); + else + y_current->y_array[i] = array[i]; + } } - y_current->y_size = size; } + else + { + /* Free array[] if it was filled. */ + for (i = 0; i < size; i++) + vim_free(array[i]); + } + vim_free(array); + return eof; } diff --git a/src/version.c b/src/version.c index e2ac04052e..2ca9502d14 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 560, /**/ 559, /**/ From cc6870ba8925b986f5e22c69645eb9c8e330146c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 7 Jan 2015 10:15:45 +0100 Subject: [PATCH 243/311] updated for version 7.4.561 Problem: Ex range handling is wrong for buffer-local user commands. Solution: Check for CMD_USER_BUF. (Marcin Szamotulski) --- src/ex_docmd.c | 3 ++- src/testdir/test_command_count.in | 8 +++++++- src/testdir/test_command_count.ok | 2 ++ src/version.c | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 0c8123cbc0..b37c6ed8cc 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2133,12 +2133,13 @@ do_one_cmd(cmdlinep, sourcing, if (ea.cmdidx != CMD_SIZE #ifdef FEAT_USR_CMDS && ea.cmdidx != CMD_USER + && ea.cmdidx != CMD_USER_BUF #endif ) ea.addr_type = cmdnames[(int)ea.cmdidx].cmd_addr_type; else #ifdef FEAT_USR_CMDS - if (ea.cmdidx != CMD_USER) + if (ea.cmdidx != CMD_USER && ea.cmdidx != CMD_USER_BUF) #endif ea.addr_type = ADDR_LINES; /* ea.addr_type for user commands is set by find_ucmd */ diff --git a/src/testdir/test_command_count.in b/src/testdir/test_command_count.in index cca178e5cf..c71ae5a386 100644 --- a/src/testdir/test_command_count.in +++ b/src/testdir/test_command_count.in @@ -3,7 +3,7 @@ Test for user command counts vim: set ft=vim : STARTTEST :let g:lines = [] :so tiny.vim -:com -range RangeLines :call add(g:lines, 'Rangeg:Lines '..' '.) +:com -range=% RangeLines :call add(g:lines, 'RangeLines '..' '.) :com -range -addr=arguments RangeArguments :call add(g:lines, 'RangeArguments '..' '.) :com -range=% -addr=arguments RangeArgumentsAll :call add(g:lines, 'RangeArgumentsAll '..' '.) :com -range -addr=loaded_buffers RangeLoadedBuffers :call add(g:lines, 'RangeLoadedBuffers '..' '.) @@ -42,6 +42,12 @@ STARTTEST :%RangeTabs :RangeTabsAll :1tabonly +:s/\n/\r\r\r\r\r/ +:2ma< +:$-ma> +:'<,'>RangeLines +:com -range=% -buffer LocalRangeLines :call add(g:lines, 'LocalRangeLines '..' '.) +:'<,'>LocalRangeLines :e! test.out :call append(0, g:lines) :w|qa! diff --git a/src/testdir/test_command_count.ok b/src/testdir/test_command_count.ok index 11e88b3903..693a22d63f 100644 --- a/src/testdir/test_command_count.ok +++ b/src/testdir/test_command_count.ok @@ -14,4 +14,6 @@ RangeBuffersAll 1 5 RangeTabs 2 5 RangeTabs 1 5 RangeTabsAll 1 5 +RangeLines 2 5 +LocalRangeLines 2 5 diff --git a/src/version.c b/src/version.c index 2ca9502d14..9d06ab33f4 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 561, /**/ 560, /**/ From 2c26956d46112654c5aeea991fa8459e47a3a129 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 7 Jan 2015 10:31:52 +0100 Subject: [PATCH 244/311] updated for version 7.4.562 Problem: Segfault with wide screen and error in 'rulerformat'. (Ingo Karkat) Solution: Check there is enough space. (Christian Brabandt) --- src/buffer.c | 2 ++ src/screen.c | 3 ++- src/version.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/buffer.c b/src/buffer.c index 37182e146c..0d14706063 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4409,6 +4409,8 @@ get_rel_pos(wp, buf, buflen) long above; /* number of lines above window */ long below; /* number of lines below window */ + if (buflen < 3) /* need at least 3 chars for writing */ + return; above = wp->w_topline - 1; #ifdef FEAT_DIFF above += diff_check_fill(wp, wp->w_topline) - wp->w_topfill; diff --git a/src/screen.c b/src/screen.c index e7b8e78d78..290dd1bd3d 100644 --- a/src/screen.c +++ b/src/screen.c @@ -10588,7 +10588,8 @@ win_redr_ruler(wp, always) this_ru_col = (WITH_WIDTH(width) + 1) / 2; if (this_ru_col + o < WITH_WIDTH(width)) { - while (this_ru_col + o < WITH_WIDTH(width)) + /* need at least 3 chars left for get_rel_pos() + NUL */ + while (this_ru_col + o < WITH_WIDTH(width) && RULER_BUF_LEN > i + 4) { #ifdef FEAT_MBYTE if (has_mbyte) diff --git a/src/version.c b/src/version.c index 9d06ab33f4..5c7dbd91ff 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 562, /**/ 561, /**/ From fa5e30248e41ffe051952a45cad0c96da0242453 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 7 Jan 2015 11:02:52 +0100 Subject: [PATCH 245/311] updated for version 7.4.563 Problem: No test for replacing on a tab in Virtual replace mode. Solution: Add a test. (Elias Diem) --- src/testdir/test48.in | 5 +++++ src/testdir/test48.ok | 1 + src/version.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/testdir/test48.in b/src/testdir/test48.in index 48f4abbf75..d480f8cc18 100644 --- a/src/testdir/test48.in +++ b/src/testdir/test48.in @@ -44,6 +44,10 @@ $4lDi<-- 'D' should be intact /^"r" $5lrxa<-- should be 'x' :" +:" Test "r" on a tab +:" Note that for this test, 'ts' must be 8 (the default). +^5lrxA<-- should be ' x ' +:" :" Test to make sure 'x' can delete control characters :set display=uhex ^xxxxxxi[This line should contain only the text between the brackets.] @@ -72,6 +76,7 @@ this is a test this is a test this is a test "r" +"r" ab sd abcv6efi.him0kl diff --git a/src/testdir/test48.ok b/src/testdir/test48.ok index 334cb5a29c..14cd9b12ec 100644 --- a/src/testdir/test48.ok +++ b/src/testdir/test48.ok @@ -12,6 +12,7 @@ this is a test this is a test this is a test "r" x<-- should be 'x' +"r" x <-- should be ' x ' [This line should contain only the text between the brackets.] v i m <-- should show the name of a noted text editor 6 . 0 <-- and its version number diff --git a/src/version.c b/src/version.c index 5c7dbd91ff..4d127143df 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 563, /**/ 562, /**/ From 9b31194b8b150fef94e16e88bcaf470ff9c9ede5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 7 Jan 2015 11:43:39 +0100 Subject: [PATCH 246/311] updated for version 7.4.564 Problem: FEAT_OSFILETYPE is used even though it's never defined. Solution: Remove the code. (Christian Brabandt) --- src/fileio.c | 109 +++----------------------------------------------- src/version.c | 2 + 2 files changed, 8 insertions(+), 103 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index 0af3627f8e..0fa0fc8e09 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -10049,57 +10049,12 @@ match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs) { regmatch_T regmatch; int result = FALSE; -#ifdef FEAT_OSFILETYPE - int no_pattern = FALSE; /* TRUE if check is filetype only */ - char_u *type_start; - char_u c; - int match = FALSE; -#endif regmatch.rm_ic = p_fic; /* ignore case if 'fileignorecase' is set */ -#ifdef FEAT_OSFILETYPE - if (*pattern == '<') - { - /* There is a filetype condition specified with this pattern. - * Check the filetype matches first. If not, don't bother with the - * pattern (set regprog to NULL). - * Always use magic for the regexp. - */ - - for (type_start = pattern + 1; (c = *pattern); pattern++) - { - if ((c == ';' || c == '>') && match == FALSE) - { - *pattern = NUL; /* Terminate the string */ - /* TODO: match with 'filetype' of buffer that "fname" comes - * from. */ - match = mch_check_filetype(fname, type_start); - *pattern = c; /* Restore the terminator */ - type_start = pattern + 1; - } - if (c == '>') - break; - } - - /* (c should never be NUL, but check anyway) */ - if (match == FALSE || c == NUL) - regmatch.regprog = NULL; /* Doesn't match - don't check pat. */ - else if (*pattern == NUL) - { - regmatch.regprog = NULL; /* Vim will try to free regprog later */ - no_pattern = TRUE; /* Always matches - don't check pat. */ - } - else - regmatch.regprog = vim_regcomp(pattern + 1, RE_MAGIC); - } + if (prog != NULL) + regmatch.regprog = *prog; else -#endif - { - if (prog != NULL) - regmatch.regprog = *prog; - else - regmatch.regprog = vim_regcomp(pattern, RE_MAGIC); - } + regmatch.regprog = vim_regcomp(pattern, RE_MAGIC); /* * Try for a match with the pattern with: @@ -10107,19 +10062,12 @@ match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs) * 2. the short file name, when the pattern has a '/'. * 3. the tail of the file name, when the pattern has no '/'. */ - if ( -#ifdef FEAT_OSFILETYPE - /* If the check is for a filetype only and we don't care - * about the path then skip all the regexp stuff. - */ - no_pattern || -#endif - (regmatch.regprog != NULL + if (regmatch.regprog != NULL && ((allow_dirs && (vim_regexec(®match, fname, (colnr_T)0) || (sfname != NULL && vim_regexec(®match, sfname, (colnr_T)0)))) - || (!allow_dirs && vim_regexec(®match, tail, (colnr_T)0))))) + || (!allow_dirs && vim_regexec(®match, tail, (colnr_T)0)))) result = TRUE; if (prog != NULL) @@ -10176,9 +10124,6 @@ match_file_list(list, sfname, ffname) * allow_dirs, otherwise FALSE is put there -- webb. * Handle backslashes before special characters, like "\*" and "\ ". * - * If FEAT_OSFILETYPE defined then pass initial through unchanged. Eg: - * 'myfile' becomes '^myfile$' -- leonard. - * * Returns NULL when out of memory. */ char_u * @@ -10188,54 +10133,19 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) char *allow_dirs; /* Result passed back out in here */ int no_bslash UNUSED; /* Don't use a backward slash as pathsep */ { - int size; + int size = 2; /* '^' at start, '$' at end */ char_u *endp; char_u *reg_pat; char_u *p; int i; int nested = 0; int add_dollar = TRUE; -#ifdef FEAT_OSFILETYPE - int check_length = 0; -#endif if (allow_dirs != NULL) *allow_dirs = FALSE; if (pat_end == NULL) pat_end = pat + STRLEN(pat); -#ifdef FEAT_OSFILETYPE - /* Find out how much of the string is the filetype check */ - if (*pat == '<') - { - /* Count chars until the next '>' */ - for (p = pat + 1; p < pat_end && *p != '>'; p++) - ; - if (p < pat_end) - { - /* Pattern is of the form <.*>.* */ - check_length = p - pat + 1; - if (p + 1 >= pat_end) - { - /* The 'pattern' is a filetype check ONLY */ - reg_pat = (char_u *)alloc(check_length + 1); - if (reg_pat != NULL) - { - mch_memmove(reg_pat, pat, (size_t)check_length); - reg_pat[check_length] = NUL; - } - return reg_pat; - } - } - /* else: there was no closing '>' - assume it was a normal pattern */ - - } - pat += check_length; - size = 2 + check_length; -#else - size = 2; /* '^' at start, '$' at end */ -#endif - for (p = pat; p < pat_end; p++) { switch (*p) @@ -10270,14 +10180,7 @@ file_pat_to_reg_pat(pat, pat_end, allow_dirs, no_bslash) if (reg_pat == NULL) return NULL; -#ifdef FEAT_OSFILETYPE - /* Copy the type check in to the start. */ - if (check_length) - mch_memmove(reg_pat, pat - check_length, (size_t)check_length); - i = check_length; -#else i = 0; -#endif if (pat[0] == '*') while (pat[0] == '*' && pat < pat_end - 1) diff --git a/src/version.c b/src/version.c index 4d127143df..7c6b49d4e8 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 564, /**/ 563, /**/ From 72860383964e0ec63111491c2d4e94f932e34331 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 7 Jan 2015 12:57:17 +0100 Subject: [PATCH 247/311] updated for version 7.4.565 Problem: Ranges for arguments, buffers, tabs, etc. are not checked to be valid but limited to the maximum. This can cause the wrong thing to happen. Solution: Give an error for an invalid value. (Marcin Szamotulski) Use windows range for ":wincmd". --- src/ex_cmds.h | 2 +- src/ex_docmd.c | 108 ++++++++++++++++------------- src/testdir/test62.in | 2 +- src/testdir/test_argument_count.in | 3 +- src/testdir/test_argument_count.ok | 4 +- src/testdir/test_close_count.in | 4 +- src/testdir/test_command_count.in | 42 ++++++++++- src/testdir/test_command_count.ok | 11 +++ src/version.c | 2 + 9 files changed, 120 insertions(+), 58 deletions(-) diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 95a22898be..6396d60c25 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -1574,7 +1574,7 @@ EX(CMD_winsize, "winsize", ex_winsize, ADDR_LINES), EX(CMD_wincmd, "wincmd", ex_wincmd, NEEDARG|WORD1|RANGE|NOTADR, - ADDR_LINES), + ADDR_WINDOWS), EX(CMD_windo, "windo", ex_listdo, BANG|NEEDARG|EXTRA|NOTRLCOM, ADDR_LINES), diff --git a/src/ex_docmd.c b/src/ex_docmd.c index b37c6ed8cc..3276abfdbc 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -2161,6 +2161,8 @@ do_one_cmd(cmdlinep, sourcing, break; case ADDR_ARGUMENTS: ea.line2 = curwin->w_arg_idx + 1; + if (ea.line2 > ARGCOUNT) + ea.line2 = ARGCOUNT; break; case ADDR_LOADED_BUFFERS: case ADDR_BUFFERS: @@ -3110,7 +3112,7 @@ find_command(eap, full) * Exceptions: * - the 'k' command can directly be followed by any character. * - the 's' command can be followed directly by 'c', 'g', 'i', 'I' or 'r' - * but :sre[wind] is another command, as are :scrip[tnames], + * but :sre[wind] is another command, as are :scr[iptnames], * :scs[cope], :sim[alt], :sig[ns] and :sil[ent]. * - the "d" command can directly be followed by 'l' or 'p' flag. */ @@ -4573,46 +4575,6 @@ get_address(ptr, addr_type, skip, to_other_file) lnum -= n; else lnum += n; - - switch (addr_type) - { - case ADDR_LINES: - break; - case ADDR_ARGUMENTS: - if (lnum < 0) - lnum = 0; - else if (lnum >= ARGCOUNT) - lnum = ARGCOUNT; - break; - case ADDR_TABS: - if (lnum < 0) - { - lnum = 0; - break; - } - if (lnum >= LAST_TAB_NR) - lnum = LAST_TAB_NR; - break; - case ADDR_WINDOWS: - if (lnum < 0) - { - lnum = 0; - break; - } - if (lnum >= LAST_WIN_NR) - lnum = LAST_WIN_NR; - break; - case ADDR_LOADED_BUFFERS: - case ADDR_BUFFERS: - if (lnum < firstbuf->b_fnum) - { - lnum = firstbuf->b_fnum; - break; - } - if (lnum > lastbuf->b_fnum) - lnum = lastbuf->b_fnum; - break; - } } } while (*cmd == '/' || *cmd == '?'); @@ -4675,17 +4637,65 @@ ex_script_ni(eap) invalid_range(eap) exarg_T *eap; { + buf_T *buf; if ( eap->line1 < 0 || eap->line2 < 0 - || eap->line1 > eap->line2 - || ((eap->argt & RANGE) - && !(eap->argt & NOTADR) - && eap->line2 > curbuf->b_ml.ml_line_count -#ifdef FEAT_DIFF - + (eap->cmdidx == CMD_diffget) -#endif - )) + || eap->line1 > eap->line2) return (char_u *)_(e_invrange); + + if (eap->argt & RANGE) + { + switch(eap->addr_type) + { + case ADDR_LINES: + if (!(eap->argt & NOTADR) + && eap->line2 > curbuf->b_ml.ml_line_count +#ifdef FEAT_DIFF + + (eap->cmdidx == CMD_diffget) +#endif + ) + return (char_u *)_(e_invrange); + break; + case ADDR_ARGUMENTS: + if (eap->line2 > ARGCOUNT + (!ARGCOUNT)) // add 1 if ARCOUNT is 0 + return (char_u *)_(e_invrange); + break; + case ADDR_BUFFERS: + if (eap->line1 < firstbuf->b_fnum + || eap->line2 > lastbuf->b_fnum) + return (char_u *)_(e_invrange); + break; + case ADDR_LOADED_BUFFERS: + buf = firstbuf; + while (buf->b_ml.ml_mfp == NULL) + { + if (buf->b_next == NULL) + return (char_u *)_(e_invrange); + buf = buf->b_next; + } + if (eap->line1 < buf->b_fnum) + return (char_u *)_(e_invrange); + buf = lastbuf; + while (buf->b_ml.ml_mfp == NULL) + { + if (buf->b_prev == NULL) + return (char_u *)_(e_invrange); + buf = buf->b_prev; + } + if (eap->line2 > buf->b_fnum) + return (char_u *)_(e_invrange); + break; + case ADDR_WINDOWS: + if (eap->line1 < 1 + || eap->line2 > LAST_WIN_NR) + return (char_u *)_(e_invrange); + break; + case ADDR_TABS: + if (eap->line2 > LAST_TAB_NR) + return (char_u *)_(e_invrange); + break; + } + } return NULL; } diff --git a/src/testdir/test62.in b/src/testdir/test62.in index 93d968b33e..c201fe7137 100644 --- a/src/testdir/test62.in +++ b/src/testdir/test62.in @@ -13,7 +13,7 @@ STARTTEST :" Open three tab pages and use ":tabdo" :0tabnew :1tabnew -:888tabnew +:$tabnew :tabdo call append(line('$'), 'this is tab page ' . tabpagenr()) :tabclose! 2 :tabrewind diff --git a/src/testdir/test_argument_count.in b/src/testdir/test_argument_count.in index cdac0308e7..db7eadb726 100644 --- a/src/testdir/test_argument_count.in +++ b/src/testdir/test_argument_count.in @@ -27,10 +27,9 @@ STARTTEST :1arga c :1arga b :$argu -:+arga d :$arga x :call add(arglists, argv()) -:$-10arga Y +:0arga Y :call add(arglists, argv()) :%argd :call add(arglists, argv()) diff --git a/src/testdir/test_argument_count.ok b/src/testdir/test_argument_count.ok index f591bf2614..f51562620d 100644 --- a/src/testdir/test_argument_count.ok +++ b/src/testdir/test_argument_count.ok @@ -7,7 +7,7 @@ c a b d a d a -a b c d x -Y a b c d x +a b c x +Y a b c x a f diff --git a/src/testdir/test_close_count.in b/src/testdir/test_close_count.in index 8a4e090ed5..f07da99b0f 100644 --- a/src/testdir/test_close_count.in +++ b/src/testdir/test_close_count.in @@ -28,7 +28,7 @@ STARTTEST :new :new :2wincmd w -:-2close! +:-1close! :let buffers = [] :windo call add(buffers, bufnr('%')) :call add(tests, buffers) @@ -61,7 +61,7 @@ STARTTEST :let buffers = [] :windo call add(buffers, bufnr('%')) :call add(tests, buffers) -:9hide +:$hide :let buffers = [] :windo call add(buffers, bufnr('%')) :call add(tests, buffers) diff --git a/src/testdir/test_command_count.in b/src/testdir/test_command_count.in index c71ae5a386..e7dadd2bed 100644 --- a/src/testdir/test_command_count.in +++ b/src/testdir/test_command_count.in @@ -1,8 +1,8 @@ Test for user command counts vim: set ft=vim : STARTTEST -:let g:lines = [] :so tiny.vim +:let g:lines = [] :com -range=% RangeLines :call add(g:lines, 'RangeLines '..' '.) :com -range -addr=arguments RangeArguments :call add(g:lines, 'RangeArguments '..' '.) :com -range=% -addr=arguments RangeArgumentsAll :call add(g:lines, 'RangeArgumentsAll '..' '.) @@ -48,6 +48,46 @@ STARTTEST :'<,'>RangeLines :com -range=% -buffer LocalRangeLines :call add(g:lines, 'LocalRangeLines '..' '.) :'<,'>LocalRangeLines +:b1 +ENDTEST + +STARTTEST +:call add(g:lines, '') +:%argd +:arga a b c d +:let v:errmsg = '' +:5argu +:call add(g:lines, '5argu ' . v:errmsg) +:$argu +:call add(g:lines, '4argu ' . expand('%:t')) +:let v:errmsg = '' +:1argu +:call add(g:lines, '1argu ' . expand('%:t')) +:let v:errmsg = '' +:100b +:call add(g:lines, '100b ' . v:errmsg) +:split|split|split|split +:let v:errmsg = '' +:0close +:call add(g:lines, '0close ' . v:errmsg) +:$wincmd w +:$close +:call add(g:lines, '$close ' . winnr()) +:let v:errmsg = '' +:$+close +:call add(g:lines, '$+close ' . v:errmsg) +:$tabe +:call add(g:lines, '$tabe ' . tabpagenr()) +:let v:errmsg = '' +:$+tabe +:call add(g:lines, '$+tabe ' . v:errmsg) +:only! +:e x +:0tabm +:normal 1gt +:call add(g:lines, '0tabm ' . expand('%:t')) +:tabonly! +:only! :e! test.out :call append(0, g:lines) :w|qa! diff --git a/src/testdir/test_command_count.ok b/src/testdir/test_command_count.ok index 693a22d63f..6e85f29d94 100644 --- a/src/testdir/test_command_count.ok +++ b/src/testdir/test_command_count.ok @@ -17,3 +17,14 @@ RangeTabsAll 1 5 RangeLines 2 5 LocalRangeLines 2 5 +5argu E16: Invalid range +4argu d +1argu a +100b E16: Invalid range +0close E16: Invalid range +$close 4 +$+close E16: Invalid range +$tabe 2 +$+tabe E16: Invalid range +0tabm x + diff --git a/src/version.c b/src/version.c index 7c6b49d4e8..835afbbf02 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 565, /**/ 564, /**/ From f70c63c289965817c14dcb569af8495a2cd99e55 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 7 Jan 2015 13:54:21 +0100 Subject: [PATCH 248/311] updated for version 7.4.566 Problem: :argdo, :bufdo, :windo and :tabdo don't take a range. Solution: Support the range. (Marcin Szamotulski) --- runtime/doc/editing.txt | 9 ++++---- runtime/doc/tabpage.txt | 12 ++++++---- runtime/doc/windows.txt | 11 +++++---- src/ex_cmds.h | 16 ++++++------- src/ex_cmds2.c | 38 +++++++++++++++++++++++++++---- src/testdir/test_command_count.in | 34 +++++++++++++++++++++++++++ src/testdir/test_command_count.ok | 5 ++++ src/version.c | 2 ++ 8 files changed, 102 insertions(+), 25 deletions(-) diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 71f2f8c25c..4b8e536df5 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.4. Last change: 2014 Dec 05 +*editing.txt* For Vim version 7.4. Last change: 2015 Jan 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -832,8 +832,9 @@ current window. The two windows then share this list, until one of them uses USING THE ARGUMENT LIST *:argdo* -:argdo[!] {cmd} Execute {cmd} for each file in the argument list. - It works like doing this: > +:[range]argdo[!] {cmd} Execute {cmd} for each file in the argument list or + if [range] is specified only for arguments in that + range. It works like doing this: > :rewind :{cmd} :next @@ -1391,7 +1392,7 @@ reveal it to others. The 'viminfo' file is not encrypted. You could do this to edit very secret text: > :set noundofile viminfo= :noswapfile edit secrets.txt -Keep in mind that without a swap file you risk loosing your work in a crash. +Keep in mind that without a swap file you risk losing your work in a crash. WARNING: If you make a typo when entering the key and then write the file and exit, the text will be lost! diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index 47e1a4b674..2d44fe2ff5 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -1,4 +1,4 @@ -*tabpage.txt* For Vim version 7.4. Last change: 2014 Nov 27 +*tabpage.txt* For Vim version 7.4. Last change: 2015 Jan 04 VIM REFERENCE MANUAL by Bram Moolenaar @@ -206,7 +206,7 @@ REORDERING TAB PAGES: :tabmove " move the tab page to the right :.tabmove " as above :+tabmove " as above - :0tabmove " move the tab page to the begining of the tab + :0tabmove " move the tab page to the beginning of the tab " list :$tabmove " move the tab page to the end of the tab list < @@ -224,8 +224,10 @@ clarification what +N means in this context see |[range]|. LOOPING OVER TAB PAGES: *:tabd* *:tabdo* -:tabd[o] {cmd} Execute {cmd} in each tab page. - It works like doing this: > +:[range]tabd[o] {cmd} + Execute {cmd} in each tab page or if [range] is given only in + tab pages which tab page number is in the [range]. It works + like doing this: > :tabfirst :{cmd} :tabnext @@ -271,8 +273,8 @@ window on the same buffer and then edit another buffer. Thus ":tabnew" triggers: WinLeave leave current window TabLeave leave current tab page - TabEnter enter new tab page WinEnter enter window in new tab page + TabEnter enter new tab page BufLeave leave current buffer BufEnter enter new empty buffer diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 67925b864a..532cca3e50 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -698,8 +698,9 @@ can also get to them with the buffer list commands, like ":bnext". 8. Do a command in all buffers or windows *list-repeat* *:windo* -:windo {cmd} Execute {cmd} in each window. - It works like doing this: > +:[range]windo {cmd} Execute {cmd} in each window or if [range] is given + only in windows for which the window number lies in + the [range]. It works like doing this: > CTRL-W t :{cmd} CTRL-W w @@ -717,8 +718,10 @@ can also get to them with the buffer list commands, like ":bnext". Also see |:tabdo|, |:argdo| and |:bufdo|. *:bufdo* -:bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list. - It works like doing this: > +:[range]bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list or if + [range] is given only for buffers for which their + buffer numer is in the [range]. It works like doing + this: > :bfirst :{cmd} :bnext diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 6396d60c25..50e82521a6 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -133,8 +133,8 @@ EX(CMD_argdelete, "argdelete", ex_argdelete, BANG|RANGE|NOTADR|FILES|TRLBAR, ADDR_ARGUMENTS), EX(CMD_argdo, "argdo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM, - ADDR_LINES), + BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_ARGUMENTS), EX(CMD_argedit, "argedit", ex_argedit, BANG|NEEDARG|RANGE|NOTADR|FILE1|EDITCMD|ARGOPT|TRLBAR, ADDR_ARGUMENTS), @@ -220,8 +220,8 @@ EX(CMD_buffers, "buffers", buflist_list, BANG|TRLBAR|CMDWIN, ADDR_LINES), EX(CMD_bufdo, "bufdo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM, - ADDR_LINES), + BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_BUFFERS), EX(CMD_bunload, "bunload", ex_bunload, BANG|RANGE|NOTADR|BUFNAME|COUNT|EXTRA|TRLBAR, ADDR_LOADED_BUFFERS), @@ -1384,8 +1384,8 @@ EX(CMD_tabclose, "tabclose", ex_tabclose, RANGE|NOTADR|COUNT|BANG|TRLBAR|CMDWIN, ADDR_TABS), EX(CMD_tabdo, "tabdo", ex_listdo, - NEEDARG|EXTRA|NOTRLCOM, - ADDR_LINES), + NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_TABS), EX(CMD_tabedit, "tabedit", ex_splitview, BANG|FILE1|RANGE|NOTADR|ZEROR|EDITCMD|ARGOPT|TRLBAR, ADDR_TABS), @@ -1576,8 +1576,8 @@ EX(CMD_wincmd, "wincmd", ex_wincmd, NEEDARG|WORD1|RANGE|NOTADR, ADDR_WINDOWS), EX(CMD_windo, "windo", ex_listdo, - BANG|NEEDARG|EXTRA|NOTRLCOM, - ADDR_LINES), + BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL, + ADDR_WINDOWS), EX(CMD_winpos, "winpos", ex_winpos, EXTRA|TRLBAR|CMDWIN, ADDR_LINES), diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 4614deab80..48badeb93f 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -2472,15 +2472,36 @@ ex_listdo(eap) | (eap->forceit ? CCGD_FORCEIT : 0) | CCGD_EXCMD)) { - /* start at the first argument/window/buffer */ i = 0; + /* start at the eap->line1 argument/window/buffer */ #ifdef FEAT_WINDOWS wp = firstwin; tp = first_tabpage; #endif + switch (eap->cmdidx) + { +#ifdef FEAT_WINDOWS + case CMD_windo: + for ( ; wp != NULL && i + 1 < eap->line1; wp = wp->w_next) + i++; + break; + case CMD_tabdo: + for( ; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next) + i++; + break; +#endif + case CMD_argdo: + i = eap->line1 - 1; + break; + case CMD_bufdo: + i = eap->line1; + break; + default: + break; + } /* set pcmark now */ if (eap->cmdidx == CMD_bufdo) - goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); + goto_buffer(eap, DOBUF_FIRST, FORWARD, i); else setpcmark(); listcmd_busy = TRUE; /* avoids setting pcmark below */ @@ -2506,7 +2527,6 @@ ex_listdo(eap) } if (curwin->w_arg_idx != i) break; - ++i; } #ifdef FEAT_WINDOWS else if (eap->cmdidx == CMD_windo) @@ -2541,6 +2561,8 @@ ex_listdo(eap) } } + ++i; + /* execute the command */ do_cmdline(eap->arg, eap->getline, eap->cookie, DOCMD_VERBOSE + DOCMD_NOWAIT); @@ -2548,7 +2570,7 @@ ex_listdo(eap) if (eap->cmdidx == CMD_bufdo) { /* Done? */ - if (next_fnum < 0) + if (next_fnum < 0 || next_fnum > eap->line2) break; /* Check if the buffer still exists. */ for (buf = firstbuf; buf != NULL; buf = buf->b_next) @@ -2579,6 +2601,14 @@ ex_listdo(eap) do_check_scrollbind(TRUE); #endif } + +#ifdef FEAT_WINDOWS + if (eap->cmdidx == CMD_windo || eap->cmdidx == CMD_tabdo) + if (i+1 > eap->line2) + break; +#endif + if (eap->cmdidx == CMD_argdo && i >= eap->line2) + break; } listcmd_busy = FALSE; } diff --git a/src/testdir/test_command_count.in b/src/testdir/test_command_count.in index e7dadd2bed..16daad0b2d 100644 --- a/src/testdir/test_command_count.in +++ b/src/testdir/test_command_count.in @@ -90,6 +90,40 @@ STARTTEST :only! :e! test.out :call append(0, g:lines) +:unlet g:lines +:w|bd +:se hidden +:b1 +ENDTEST + +STARTTEST +:only! +:let g:lines = [] +:%argd +:arga a b c d e f +:3argu +:let args = '' +:.,$-argdo let args .= ' '.expand('%') +:call add(g:lines, 'argdo:' . args) +:split|split|split|split +:2wincmd w +:let windows = '' +:.,$-windo let windows .= ' '.winnr() +:call add(g:lines, 'windo:'. windows) +:b2 +:let buffers = '' +:.,$-bufdo let buffers .= ' '.bufnr('%') +:call add(g:lines, 'bufdo:' . buffers) +:let buffers = '' +:3,7bufdo let buffers .= ' '.bufnr('%') +:call add(g:lines, 'bufdo:' . buffers) +:tabe|tabe|tabe|tabe +:normal! 2gt +:let tabpages = '' +:.,$-tabdo let tabpages .= ' '.tabpagenr() +:call add(g:lines, 'tabdo:' . tabpages) +:e! test.out +:call append('$', g:lines) :w|qa! ENDTEST diff --git a/src/testdir/test_command_count.ok b/src/testdir/test_command_count.ok index 6e85f29d94..a936715b36 100644 --- a/src/testdir/test_command_count.ok +++ b/src/testdir/test_command_count.ok @@ -28,3 +28,8 @@ $tabe 2 $+tabe E16: Invalid range 0tabm x +argdo: c d e +windo: 2 3 4 +bufdo: 2 3 4 5 6 7 8 9 10 12 +bufdo: 3 4 5 6 7 +tabdo: 2 3 4 diff --git a/src/version.c b/src/version.c index 835afbbf02..6339bcb724 100644 --- a/src/version.c +++ b/src/version.c @@ -741,6 +741,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 566, /**/ 565, /**/ From 5637fda070b8384e3c51d8ce0167cb8e83b4984f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 7 Jan 2015 13:57:10 +0100 Subject: [PATCH 249/311] Update runtime files. --- runtime/autoload/netrw.vim | 2486 ++++++++++++++++---------- runtime/autoload/netrwSettings.vim | 9 +- runtime/autoload/netrw_gitignore.vim | 13 +- runtime/doc/gui_w32.txt | 5 +- runtime/doc/index.txt | 4 +- runtime/doc/options.txt | 4 +- runtime/doc/pi_netrw.txt | 766 +++++--- runtime/doc/repeat.txt | 6 +- runtime/doc/syntax.txt | 10 +- runtime/doc/tags | 21 +- runtime/doc/todo.txt | 73 +- runtime/filetype.vim | 5 +- runtime/ftplugin/less.vim | 20 + runtime/ftplugin/man.vim | 6 +- runtime/ftplugin/matlab.vim | 14 +- runtime/indent/less.vim | 13 + runtime/plugin/netrwPlugin.vim | 44 +- runtime/syntax/diff.vim | 7 +- runtime/syntax/html.vim | 7 +- runtime/syntax/less.vim | 79 + runtime/syntax/netrw.vim | 16 +- runtime/syntax/r.vim | 54 +- runtime/tutor/tutor.uk.utf-8 | 976 ++++++++++ 23 files changed, 3343 insertions(+), 1295 deletions(-) create mode 100644 runtime/ftplugin/less.vim create mode 100644 runtime/indent/less.vim create mode 100644 runtime/syntax/less.vim create mode 100644 runtime/tutor/tutor.uk.utf-8 diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index d8d1857099..42439a57d3 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,7 +1,7 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: May 13, 2014 -" Version: 152 +" Date: Jan 05, 2015 +" Version: 153 " Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1 @@ -29,7 +29,7 @@ if v:version < 704 || !has("patch213") let s:needpatch213= 1 finish endif -let g:loaded_netrw = "v152" +let g:loaded_netrw = "v153" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -51,7 +51,10 @@ setl cpo&vim " 0=note = s:NOTE " 1=warning = s:WARNING " 2=error = s:ERROR -" Apr 16, 2014 : max errnum currently is 97 +" Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number) +" netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number) +" (this function can optionally take a list of messages) +" May 15, 2014 : max errnum currently is 98 fun! netrw#ErrorMsg(level,msg,errnum) " call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow) @@ -84,18 +87,31 @@ fun! netrw#ErrorMsg(level,msg,errnum) exe bufwinnr("NetrwMessage")."wincmd w" " call Decho("setl ma noro") setl ma noro - keepj call setline(line("$")+1,level.a:msg) - keepj $ + if type(a:msg) == 3 + for msg in a:msg + NetrwKeepj call setline(line("$")+1,level.msg) + endfor + else + NetrwKeepj call setline(line("$")+1,level.a:msg) + endif + NetrwKeepj $ else " call Decho("create a NetrwMessage buffer window") bo 1split sil! call s:NetrwEnew() - sil! keepj call s:NetrwSafeOptions() + sil! NetrwKeepj call s:NetrwSafeOptions() setl bt=nofile - keepj file NetrwMessage + NetrwKeepj file NetrwMessage " call Decho("setl ma noro") setl ma noro - call setline(line("$"),level.a:msg) + if type(a:msg) == 3 + for msg in a:msg + NetrwKeepj call setline(line("$")+1,level.msg) + endfor + else + NetrwKeepj call setline(line("$"),level.a:msg) + endif + NetrwKeepj $ endif " call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr()) if &fo !~ '[ta]' @@ -118,7 +134,15 @@ fun! netrw#ErrorMsg(level,msg,errnum) elseif a:level == s:ERROR echohl Error endif - echomsg level.a:msg + + if type(a:msg) == 3 + for msg in a:msg + echomsg level.msg + endfor + else + echomsg level.a:msg + endif + " call Decho("echomsg ***netrw*** ".a:msg) echohl None endif @@ -127,7 +151,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) endfun " --------------------------------------------------------------------- -" NetrwInit: initializes variables if they haven't been defined {{{2 +" s:NetrwInit: initializes variables if they haven't been defined {{{2 " Loosely, varname = value. fun s:NetrwInit(varname,value) " call Decho("varname<".a:varname."> value=".a:value) @@ -175,6 +199,13 @@ if !exists("g:netrw_fetch_cmd") let g:netrw_fetch_cmd = "" endif endif +if !exists("g:netrw_file_cmd") + if executable("elinks") + call s:NetrwInit("g:netrw_file_cmd","elinks") + elseif executable("links") + call s:NetrwInit("g:netrw_file_cmd","links") + endif +endif if !exists("g:netrw_ftp_cmd") let g:netrw_ftp_cmd = "ftp" endif @@ -203,6 +234,7 @@ if !exists("g:netrw_http_cmd") endif endif call s:NetrwInit("g:netrw_http_put_cmd","curl -T") +call s:NetrwInit("g:netrw_keepj","keepj") call s:NetrwInit("g:netrw_rcp_cmd" , "rcp") call s:NetrwInit("g:netrw_rsync_cmd", "rsync") if !exists("g:netrw_scp_cmd") @@ -300,12 +332,20 @@ if !exists("g:netrw_list_cmd") " provide a pscp-based listing command let g:netrw_scp_cmd ="pscp -i C:\\private.ppk" endif - let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:" + if exists("g:netrw_list_cmd_options") + let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME: ".g:netrw_list_cmd_options + else + let g:netrw_list_cmd= g:netrw_scp_cmd." -ls USEPORT HOSTNAME:" + endif elseif executable(g:netrw_ssh_cmd) " provide a scp-based default listing command - let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" + if exists("g:netrw_list_cmd_options") + let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa ".g:netrw_list_cmd_options + else + let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" + endif else -" call Decho("g:netrw_ssh_cmd." is not executable") +" call Decho(g:netrw_ssh_cmd." is not executable") let g:netrw_list_cmd= "" endif endif @@ -331,6 +371,19 @@ if !exists("g:netrw_localcopycmd") let g:netrw_localcopycmd= "" endif endif +if !exists("g:netrw_localcopydircmd") + if has("win32") || has("win95") || has("win64") || has("win16") + if g:netrw_cygwin + let g:netrw_localcopydircmd= "cp -R" + else + let g:netrw_localcopycmd= expand("$COMSPEC")." /c xcopy /e /c /h /i /k" + endif + elseif has("unix") || has("macunix") + let g:netrw_localcopydircmd= "cp -R" + else + let g:netrw_localcopycmd= "" + endif +endif if exists("g:netrw_local_mkdir") let g:netrw_localmkdir= g:netrw_local_mkdir call netrw#ErrorMsg(s:NOTE,"g:netrw_local_mkdir is deprecated in favor of g:netrw_localmkdir",87) @@ -399,6 +452,7 @@ else endif call s:NetrwInit("g:netrw_preview" , 0) call s:NetrwInit("g:netrw_scpport" , "-P") +call s:NetrwInit("g:netrw_servername" , "NETRWSERVER") call s:NetrwInit("g:netrw_sshport" , "-p") call s:NetrwInit("g:netrw_rename_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mv") call s:NetrwInit("g:netrw_rm_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm") @@ -407,16 +461,20 @@ call s:NetrwInit("g:netrw_rmf_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm " Default values - q-s ---------- {{{3 call s:NetrwInit("g:netrw_quickhelp",0) let s:QuickHelp= ["-:go up dir D:delete R:rename s:sort-by x:special", - \ "%:create new file d:create new directory", - \ "o:split&open v:vert-split&open", - \ "i:style qf:file info O:obtain r:reverse p:preview", - \ "mf:mark file mt:set target mm:move mc:copy", - \ "-bookmarks- mb:make mB:delete qb:list gb:go to", - \ "-history- qb:list u:go up U:go down", - \ "-targets- mt:target Tb:use bookmark Th:use history"] + \ "(create new) %:file d:directory", + \ "(windows split&open) o:horz v:vert p:preview", + \ "i:style qf:file info O:obtain r:reverse", + \ "(marks) mf:mark file mt:set target mm:move mc:copy", + \ "(bookmarks) mb:make mB:delete qb:list gb:go to", + \ "(history) qb:list u:go up U:go down", + \ "(targets) mt:target Tb:use bookmark Th:use history"] " g:netrw_sepchr: picking a character that doesn't appear in filenames that can be used to separate priority from filename call s:NetrwInit("g:netrw_sepchr" , (&enc == "euc-jp")? "\" : "\") -call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil keepj " : "keepj ") +if !exists("g:netrw_keepj") || g:netrw_keepj == "keepj" + call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil keepj " : "keepj ") +else + call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "sil " : " ") +endif call s:NetrwInit("g:netrw_sort_by" , "name") " alternatives: date , size call s:NetrwInit("g:netrw_sort_options" , "") call s:NetrwInit("g:netrw_sort_direction", "normal") " alternative: reverse (z y x ...) @@ -488,6 +546,13 @@ if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists( endif au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif +if g:netrw_keepj =~ "keepj" + com! -nargs=* NetrwKeepj keepj +else + let g:netrw_keepj= "" + com! -nargs=* NetrwKeepj +endif + " ============================== " Netrw Utility Functions: {{{1 " ============================== @@ -525,7 +590,7 @@ if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_ " if v:version < 700 |call Decho("did not load netrw#BalloonHelp(): vim version ".v:version." < 700 -")|endif " if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval") |endif " if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled") |endif -" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on=".g:syntax_on) |endif +" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on n/a") |endif " if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists") |endif endif @@ -655,7 +720,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " else " Decho " call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6") endif - keepj norm! 0 + NetrwKeepj norm! 0 if a:0 > 0 " call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">") @@ -751,7 +816,6 @@ fun! netrw#Explore(indx,dosplit,style,...) endif if dirname =~ '^scp://' || dirname =~ '^ftp://' call netrw#Nread(2,dirname) - "call s:NetrwBrowse(0,dirname) else if dirname == "" let dirname= getcwd() @@ -778,9 +842,9 @@ fun! netrw#Explore(indx,dosplit,style,...) " --------------------------------------------------------------------- " Jan 24, 2013: not sure why the following was present. See P08-Ingelrest " if has("win32") || has("win95") || has("win64") || has("win16") -" keepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') +" NetrwKeepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') " else -" keepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') +" NetrwKeepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') " endif " --------------------------------------------------------------------- @@ -811,7 +875,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " Nexplore " call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")") if !exists("w:netrw_explore_list") " sanity check - keepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or improperly; see help for netrw-starstar",40) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or improperly; see help for netrw-starstar",40) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar @@ -836,7 +900,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " Pexplore " call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")") if !exists("w:netrw_explore_list") " sanity check - keepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or improperly; see help for netrw-starstar",41) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or improperly; see help for netrw-starstar",41) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar @@ -861,7 +925,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " Explore -- initialize " build list of files to Explore with Nexplore/Pexplore " call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")") - keepj keepalt call s:NetrwClearExplore() + NetrwKeepj keepalt call s:NetrwClearExplore() let w:netrw_explore_indx= 0 if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() @@ -874,7 +938,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls) " call Decho("....pattern<".pattern.">") try - exe "keepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" + exe "NetrwKeepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" catch /^Vim\%((\a\+)\)\=:E480/ keepalt call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) " call Dret("netrw#Explore : unable to find pattern<".pattern.">") @@ -888,7 +952,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)") " call Decho("....pattern<".pattern.">") try - exe "sil keepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" + exe "sil NetrwKeepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" catch /^Vim\%((\a\+)\)\=:E480/ keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif @@ -927,7 +991,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen) if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') - keepalt keepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) + keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) if has("clipboard") sil! let @* = keepregstar sil! let @+ = keepregstar @@ -947,7 +1011,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")") let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 let w:netrw_explore_indx= indx - keepalt keepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) + keepalt NetrwKeepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) endif exe "let dirfile= w:netrw_explore_list[".indx."]" @@ -961,20 +1025,20 @@ fun! netrw#Explore(indx,dosplit,style,...) let w:netrw_liststyle= g:netrw_liststyle endif if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST - keepalt keepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") + keepalt NetrwKeepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") else - keepalt keepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") + keepalt NetrwKeepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") endif let w:netrw_explore_mtchcnt = indx + 1 let w:netrw_explore_bufnr = bufnr("%") let w:netrw_explore_line = line(".") - keepalt keepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') + keepalt NetrwKeepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') " call Decho("....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) else " call Decho("..your vim does not have +path_extra") if !exists("g:netrw_quiet") - keepalt keepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) + keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) endif if has("clipboard") sil! let @* = keepregstar @@ -993,9 +1057,9 @@ fun! netrw#Explore(indx,dosplit,style,...) endif let newdir= dirname if !exists("b:netrw_curdir") - keepj call netrw#LocalBrowseCheck(getcwd()) + NetrwKeepj call netrw#LocalBrowseCheck(getcwd()) else - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) endif endif @@ -1057,50 +1121,99 @@ endfun " --------------------------------------------------------------------- " netrw#Lexplore: toggle Explorer window, keeping it on the left of the current tab {{{2 -fun! netrw#Lexplore(...) -" call Dfunc("netrw#Lexplore() a:0=".a:0) +fun! netrw#Lexplore(count,rightside,...) +" call Dfunc("netrw#Lexplore(count=".a:count."rightside=".a:rightside.",...) a:0=".a:0." ft=".&ft) + let curwin= winnr() + if a:0 > 0 && a:1 != "" " if a netrw window is already on the left-side of the tab " and a directory has been specified, explore with that " directory. - let lexwinnr= winnr() + let a1 = expand(a:1) +" call Decho("a:1<".a:1."> curwin#".curwin) exe "1wincmd w" if &ft == "netrw" - exe "Explore ".fnameescape(a:1) - exe lexwinnr."wincmd w" +" call Decho("exe Explore ".fnameescape(a:1)) + exe "Explore ".fnameescape(a1) + exe curwin."wincmd w" + if exists("t:netrw_lexposn") +" call Decho("forgetting t:netrw_lexposn") + unlet t:netrw_lexposn + endif +" call Dret("netrw#Lexplore") + return endif - exe lexwinnr."wincmd w" -" call Dret("netrw#Lexplore") - return + exe curwin."wincmd w" + else + let a1= "" endif if exists("t:netrw_lexbufnr") - " close down netrw explorer window + " check if t:netrw_lexbufnr refers to a netrw window let lexwinnr = bufwinnr(t:netrw_lexbufnr) - if lexwinnr != -1 - let curwin = winnr() - exe lexwinnr."wincmd w" - close - exe curwin."wincmd w" + else + let lexwinnr= 0 + endif + + if lexwinnr > 0 + " close down netrw explorer window +" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window") + exe lexwinnr."wincmd w" + let g:netrw_winsize = -winwidth(0) + let t:netrw_lexposn = netrw#SavePosn() +" call Decho("saving t:netrw_lexposn") + close + if lexwinnr < curwin + let curwin= curwin - 1 endif + exe curwin."wincmd w" unlet t:netrw_lexbufnr else " open netrw explorer window +" call Decho("t:netrw_lexbufnr: open netrw explorer window") exe "1wincmd w" let keep_altv = g:netrw_altv let g:netrw_altv = 0 - if a:0 > 0 && a:1 != "" - exe "Vexplore ".fnameescape(a:1) - else - Vexplore . + if a:count != 0 + let netrw_winsize = g:netrw_winsize + let g:netrw_winsize = a:count endif + let curfile= expand("%") +" call Decho("curfile<".curfile.">") + exe (a:rightside? "botright" : "topleft")." vertical ".((g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize) . " new" + if a:0 > 0 && a1 != "" +" call Decho("case 1: Explore ".a1) + exe "Explore ".fnameescape(a1) + elseif curfile =~ '^\a\+://' +" call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','','')) + exe "Explore ".substitute(curfile,'[^/\\]*$','','') + else +" call Decho("case 3: Explore .") + Explore . + endif + if a:count != 0 + let g:netrw_winsize = netrw_winsize + endif + setlocal winfixwidth let g:netrw_altv = keep_altv let t:netrw_lexbufnr = bufnr("%") + if exists("t:netrw_lexposn") +" call Decho("restoring to t:netrw_lexposn") + call netrw#RestorePosn(t:netrw_lexposn) + unlet t:netrw_lexposn + endif endif + + " set up default window for editing via if exists("g:netrw_chgwin") && g:netrw_chgwin == -1 - let g:netrw_chgwin= 2 + if a:rightside + let g:netrw_chgwin= 1 + else + let g:netrw_chgwin= 2 + endif endif + " call Dret("netrw#Lexplore") endfun @@ -1261,17 +1374,16 @@ fun! netrw#Obtain(islocal,fname,...) let path= "" endif let filelist= join(map(deepcopy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)')) -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) elseif b:netrw_method == 2 " obtain file using ftp + .netrc " call Decho("obtain via ftp+.netrc (method #2)") - call s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() + call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode + NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$')) endif @@ -1281,7 +1393,7 @@ fun! netrw#Obtain(islocal,fname,...) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$')) endif for fname in fnamelist @@ -1289,11 +1401,9 @@ fun! netrw#Obtain(islocal,fname,...) " call Decho("filter input: ".getline('$')) endfor if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) else -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' @@ -1306,53 +1416,53 @@ fun! netrw#Obtain(islocal,fname,...) elseif b:netrw_method == 3 " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc) " call Decho("obtain via ftp+mipf (method #3)") - call s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() + call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port " call Decho("filter input: ".getline('$')) else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine " call Decho("filter input: ".getline('$')) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid + NetrwKeepj put =g:netrw_uid " call Decho("filter input: ".getline('$')) if exists("s:netrw_passwd") && s:netrw_passwd != "" - keepj put ='\"'.s:netrw_passwd.'\"' + NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif " call Decho("filter input: ".getline('$')) elseif exists("s:netrw_passwd") - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' " call Decho("filter input: ".getline('$')) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode + NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$')) endif if exists("b:netrw_fname") && b:netrw_fname != "" - keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') + NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') " call Decho("filter input: ".getline('$')) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$')) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$')) endif for fname in fnamelist - keepj call setline(line("$")+1,'get "'.fname.'"') + NetrwKeepj call setline(line("$")+1,'get "'.fname.'"') endfor " call Decho("filter input: ".getline('$')) @@ -1360,14 +1470,13 @@ fun! netrw#Obtain(islocal,fname,...) " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" " call Decho("error<".getline(1).">") if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,getline(1),5) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),5) endif endif @@ -1379,8 +1488,7 @@ fun! netrw#Obtain(islocal,fname,...) else let localfile= a:fname endif -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1).shellescape(localfile)." ".shellescape(tgtdir)) - exe s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1).shellescape(localfile)." ".shellescape(tgtdir) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1).shellescape(localfile)." ".shellescape(tgtdir)) elseif !exists("b:netrw_method") || b:netrw_method < 0 " probably a badly formed url; protocol not recognized @@ -1390,7 +1498,7 @@ fun! netrw#Obtain(islocal,fname,...) else " protocol recognized but not supported for Obtain (yet?) if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"current protocol not supported for obtaining file",97) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"current protocol not supported for obtaining file",97) endif " call Dret("netrw#Obtain : current protocol not supported for obtaining file") return @@ -1398,7 +1506,7 @@ fun! netrw#Obtain(islocal,fname,...) " restore status line if type(a:fname) == 1 && exists("s:netrw_users_stl") - keepj call s:SetupNetrwStatusLine(s:netrw_users_stl) + NetrwKeepj call s:SetupNetrwStatusLine(s:netrw_users_stl) endif endif @@ -1440,7 +1548,7 @@ fun! s:NetrwOptionRestore(vt) if !exists("{a:vt}netrw_optionsave") if exists("s:nbcd_curpos_{bufnr('%')}") " call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") - keepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) + NetrwKeepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) " call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) " call Decho("unlet s:nbcd_curpos_".bufnr('%')) unlet s:nbcd_curpos_{bufnr('%')} @@ -1481,7 +1589,9 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_cpokeep") |let &l:cpo = {a:vt}netrw_cpokeep |unlet {a:vt}netrw_cpokeep |endif if exists("{a:vt}netrw_diffkeep") |let &l:diff = {a:vt}netrw_diffkeep |unlet {a:vt}netrw_diffkeep |endif if exists("{a:vt}netrw_fenkeep") |let &l:fen = {a:vt}netrw_fenkeep |unlet {a:vt}netrw_fenkeep |endif - if exists("{a:vt}netrw_ffkeep") |let &l:ff = {a:vt}netrw_ffkeep |unlet {a:vt}netrw_ffkeep |endif + if exists("g:netrw_ffkep") && g:netrw_ffkeep + if exists("{a:vt}netrw_ffkeep") |let &l:ff = {a:vt}netrw_ffkeep |unlet {a:vt}netrw_ffkeep |endif + endif if exists("{a:vt}netrw_fokeep") |let &l:fo = {a:vt}netrw_fokeep |unlet {a:vt}netrw_fokeep |endif if exists("{a:vt}netrw_gdkeep") |let &l:gd = {a:vt}netrw_gdkeep |unlet {a:vt}netrw_gdkeep |endif if exists("{a:vt}netrw_hidkeep") |let &l:hidden = {a:vt}netrw_hidkeep |unlet {a:vt}netrw_hidkeep |endif @@ -1535,7 +1645,7 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif if exists("s:nbcd_curpos_{bufnr('%')}") " call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") - keepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) + NetrwKeepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) " call Decho("unlet s:nbcd_curpos_".bufnr('%')) if exists("s:nbcd_curpos_".bufnr('%')) unlet s:nbcd_curpos_{bufnr('%')} @@ -1599,7 +1709,7 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_cpokeep = &l:cpo let {a:vt}netrw_diffkeep = &l:diff let {a:vt}netrw_fenkeep = &l:fen - if !exists("g:netrw_ffkeep") || g:netrw_ffkeep == 1 + if !exists("g:netrw_ffkeep") || g:netrw_ffkeep let {a:vt}netrw_ffkeep = &l:ff endif let {a:vt}netrw_fokeep = &l:fo " formatoptions @@ -1686,10 +1796,10 @@ fun! s:NetrwSafeOptions() " call Decho("ft<".&ft."> ei=".&ei) if &ft == "netrw" " call Decho("do any netrw FileType autocmds (doau FileType netrw)") - sil! keepalt keepj doau FileType netrw + sil! keepalt NetrwKeepj doau FileType netrw endif -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">") " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) " call Dret("s:NetrwSafeOptions") endfun @@ -1744,6 +1854,10 @@ fun! netrw#NetRead(mode,...) call s:NetrwOptionSave("w:") call s:NetrwSafeOptions() call s:RestoreCursorline() + " NetrwSafeOptions sets a buffer up for a netrw listing, which includes buflisting off. + " However, this setting is not wanted for a remote editing session. The buffer should be "nofile", still. + setl bl +" call Decho("(netrw#NetRead) buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh) " NetRead: interpret mode into a readcmd {{{3 if a:mode == 0 " read remote file before current line @@ -1790,6 +1904,7 @@ fun! netrw#NetRead(mode,...) echomsg ':Nread fetch://machine/path uses fetch' echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>' echomsg ':Nread http://[user@]machine/path uses http wget' + echomsg ':Nread file:///path uses elinks' echomsg ':Nread https://[user@]machine/path uses http wget' echomsg ':Nread rcp://[user@]machine/path uses rcp' echomsg ':Nread rsync://machine[:port]/path uses rsync' @@ -1841,7 +1956,7 @@ fun! netrw#NetRead(mode,...) " call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">") if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^https\=://' " call Decho("yes, choice matches '^.*[\/]$'") - keepj call s:NetrwBrowse(0,choice) + NetrwKeepj call s:NetrwBrowse(0,choice) " call Dret("netrw#NetRead :3 getcwd<".getcwd().">") return endif @@ -1875,8 +1990,7 @@ fun! netrw#NetRead(mode,...) let uid_machine = g:netrw_machine endif endif -" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -1885,29 +1999,27 @@ fun! netrw#NetRead(mode,...) elseif b:netrw_method == 2 " read with ftp + <.netrc> " call Decho("read via ftp+.netrc (method #2)") let netrw_fname= b:netrw_fname - keepj call s:SaveBufVars()|new|keepj call s:RestoreBufVars() + NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix - keepj put =g:netrw_ftpmode + NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline(line("$"))) if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline(line("$"))) endif call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile) " call Decho("filter input: ".getline(line("$"))) if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) else -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' let debugkeep = &debug setl debug=msg - keepj call netrw#ErrorMsg(s:ERROR,getline(1),4) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),4) let &debug = debugkeep endif call s:SaveBufVars() @@ -1926,49 +2038,48 @@ fun! netrw#NetRead(mode,...) " Construct execution string (four lines) which will be passed through filter " call Decho("read via ftp+mipf (method #3)") let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) - keepj call s:SaveBufVars()|new|keepj call s:RestoreBufVars() + NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port " call Decho("filter input: ".getline('.')) else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine " call Decho("filter input: ".getline('.')) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid + NetrwKeepj put =g:netrw_uid " call Decho("filter input: ".getline('.')) if exists("s:netrw_passwd") - keepj put ='\"'.s:netrw_passwd.'\"' + NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif " call Decho("filter input: ".getline('.')) elseif exists("s:netrw_passwd") - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' " call Decho("filter input: ".getline('.')) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode + NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('.')) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('.')) endif - keepj put ='get \"'.netrw_fname.'\" '.tmpfile + NetrwKeepj put ='get \"'.netrw_fname.'\" '.tmpfile " call Decho("filter input: ".getline('.')) " perform ftp: " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" " call Decho("error<".getline(1).">") @@ -1989,8 +2100,14 @@ fun! netrw#NetRead(mode,...) else let useport= "" endif -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) + " 'C' in 'C:\path\to\file' is handled as hostname on windows. + " This is workaround to avoid mis-handle windows local-path: + if g:netrw_scp_cmd =~ '^scp' && (has("win32") || has("win95") || has("win64") || has("win16")) + let tmpfile_get = substitute(tr(tmpfile, '\', '/'), '^\(\a\):[/\\]\(.*\)$', '/\1/\2', '') + else + let tmpfile_get = tmpfile + endif + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile_get,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2010,11 +2127,9 @@ fun! netrw#NetRead(mode,...) " using g:netrw_http_cmd (usually elinks, links, curl, wget, or fetch) " call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)") if exists("g:netrw_http_xcmd") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)) else -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)) endif let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) @@ -2025,11 +2140,10 @@ fun! netrw#NetRead(mode,...) let netrw_tag = substitute(b:netrw_fname,"^.*#","","") " call Decho("netrw_html<".netrw_html.">") " call Decho("netrw_tag <".netrw_tag.">") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.netrw_html,1)) - exe s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.netrw_html,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.netrw_html,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) " call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') - exe 'keepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" + exe 'NetrwKeepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" endif let b:netrw_lastfile = choice " call Decho("setl ro") @@ -2046,28 +2160,26 @@ fun! netrw#NetRead(mode,...) return endif if g:netrw_dav_cmd =~ "curl" -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1)) else " Construct execution string (four lines) which will be passed through filter let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) new setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine endif if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != "" - keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd + NetrwKeepj put ='user '.g:netrw_uid.' '.s:netrw_passwd endif - keepj put ='get '.netrw_fname.' '.tmpfile - keepj put ='quit' + NetrwKeepj put ='get '.netrw_fname.' '.tmpfile + NetrwKeepj put ='quit' " perform cadaver operation: - keepj norm! 1Gdd -" call Decho("executing: %!".g:netrw_dav_cmd) - exe s:netrw_silentxfer."%!".g:netrw_dav_cmd + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd) bd! endif let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) @@ -2077,8 +2189,7 @@ fun! netrw#NetRead(mode,...) " NetRead: (rsync) NetRead Method #7 {{{3 elseif b:netrw_method == 7 " call Decho("read via rsync (method #7)") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2089,7 +2200,7 @@ fun! netrw#NetRead(mode,...) " call Decho("read via fetch (method #8)") if g:netrw_fetch_cmd == "" if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) endif " call Dret("NetRead") return @@ -2102,11 +2213,9 @@ fun! netrw#NetRead(mode,...) " call Decho("read via fetch for ".netrw_option) if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != "" -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) else -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) endif let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) @@ -2118,11 +2227,18 @@ fun! netrw#NetRead(mode,...) " NetRead: (sftp) NetRead Method #9 {{{3 elseif b:netrw_method == 9 " call Decho("read via sftp (method #9)") -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) - exe s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice + "......................................... + " NetRead: (file) NetRead Method #10 {{{3 + elseif b:netrw_method == 10 && exists("g:netrw_file_cmd") +" " call Decho("read via ".b:netrw_file_cmd." (method #10)") + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_file_cmd." ".shellescape(b:netrw_fname,1)." ".tmpfile) + let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) + let b:netrw_lastfile = choice + "......................................... " NetRead: Complain {{{3 else @@ -2138,9 +2254,9 @@ fun! netrw#NetRead(mode,...) endif if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' && tmpfile !~ '.tar.xz$' && tmpfile !~ '.txz' " call Decho("cleanup by deleting tmpfile<".tmpfile.">") - keepj call s:NetrwDelete(tmpfile) + NetrwKeepj call s:NetrwDelete(tmpfile) endif - keepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionRestore("w:") " call Dret("netrw#NetRead :5 getcwd<".getcwd().">") endfun @@ -2175,16 +2291,16 @@ fun! netrw#NetWrite(...) range " (line numbers don't really make sense for that). " Also supports the writing of tar and zip files. " call Decho("(write entire file) sil exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) - exe "sil keepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) + exe "sil NetrwKeepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) elseif g:netrw_cygwin " write (selected portion of) file to temporary let cygtmpfile= substitute(tmpfile,g:netrw_cygdrive.'/\(.\)','\1:','') " call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)) - exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile) + exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile) else " write (selected portion of) file to temporary " call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) - exe "sil keepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) + exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) endif if curbufname == "" @@ -2251,7 +2367,7 @@ fun! netrw#NetWrite(...) range " call Decho("choice<" . choice . "> ichoice=".ichoice) " Determine method of write (ftp, rcp, etc) {{{4 - keepj call s:NetrwMethod(choice) + NetrwKeepj call s:NetrwMethod(choice) if !exists("b:netrw_method") || b:netrw_method < 0 " call Dfunc("netrw#NetWrite : unsupported method") return @@ -2282,8 +2398,7 @@ fun! netrw#NetWrite(...) range let uid_machine = g:netrw_machine endif endif -" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... @@ -2300,26 +2415,24 @@ fun! netrw#NetWrite(...) range " call Decho("filter input window#".winnr()) setl ff=unix - keepj put =g:netrw_ftpmode + NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$')) if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline("$")) endif - keepj call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"') + NetrwKeepj call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"') " call Decho("filter input: ".getline("$")) if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) else " call Decho("filter input window#".winnr()) -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,getline(1),14) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),14) endif let mod=1 endif @@ -2347,32 +2460,32 @@ fun! netrw#NetWrite(...) range setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port " call Decho("filter input: ".getline('.')) else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine " call Decho("filter input: ".getline('.')) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid + NetrwKeepj put =g:netrw_uid " call Decho("filter input: ".getline('.')) if exists("s:netrw_passwd") && s:netrw_passwd != "" - keepj put ='\"'.s:netrw_passwd.'\"' + NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif " call Decho("filter input: ".getline('.')) elseif exists("s:netrw_passwd") && s:netrw_passwd != "" - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' " call Decho("filter input: ".getline('.')) endif endif - keepj put =g:netrw_ftpmode + NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$')) if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline("$")) endif - keepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' + NetrwKeepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' " call Decho("filter input: ".getline('.')) " save choice/id/password for future use let b:netrw_lastfile = choice @@ -2381,9 +2494,8 @@ fun! netrw#NetWrite(...) range " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" if !exists("g:netrw_quiet") @@ -2407,8 +2519,7 @@ fun! netrw#NetWrite(...) range else let useport= "" endif -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... @@ -2418,8 +2529,7 @@ fun! netrw#NetWrite(...) range let curl= substitute(g:netrw_http_put_cmd,'\s\+.*$',"","") if executable(curl) let url= g:netrw_choice -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".shellescape(tmpfile,1)." ".shellescape(url,1) ) - exe s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".shellescape(tmpfile,1)." ".shellescape(url,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".shellescape(tmpfile,1)." ".shellescape(url,1) ) elseif !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd".">".",16) endif @@ -2440,19 +2550,18 @@ fun! netrw#NetWrite(...) range setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine endif if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != "" - keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd + NetrwKeepj put ='user '.g:netrw_uid.' '.s:netrw_passwd endif - keepj put ='put '.tmpfile.' '.netrw_fname + NetrwKeepj put ='put '.tmpfile.' '.netrw_fname " perform cadaver operation: - keepj norm! 1Gdd -" call Decho("executing: %!".g:netrw_dav_cmd) - exe s:netrw_silentxfer."%!".g:netrw_dav_cmd + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd) " remove enew buffer (quietly) let filtbuf= bufnr("%") @@ -2466,8 +2575,7 @@ fun! netrw#NetWrite(...) range " NetWrite: (rsync) NetWrite Method #7 {{{3 elseif b:netrw_method == 7 " call Decho("write via rsync (method #7)") -" call Decho("executing: !".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) - exe s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... @@ -2490,9 +2598,8 @@ fun! netrw#NetWrite(...) range setl ff=unix call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname) " call Decho("filter input: ".getline('.')) -" call Decho("executing: %!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1)) let sftpcmd= substitute(g:netrw_sftp_cmd,"%TEMPFILE%",escape(tmpfile,'\'),"g") - exe s:netrw_silentxfer."%!".sftpcmd.' '.shellescape(uid_machine,1) + call s:NetrwExe(s:netrw_silentxfer."%!".sftpcmd.' '.shellescape(uid_machine,1)) let filtbuf= bufnr("%") exe curbuf."b!" let &l:bh = bhkeep @@ -2670,12 +2777,12 @@ fun! s:NetrwGetFile(readcmd, tfile, method) call tar#Browse(tfile) else " call Decho("edit temporary file") - e! + NetrwKeepj e! endif " rename buffer back to remote filename " call Decho("exe sil! keepalt file ".fnameescape(rfile)) - exe "sil! keepj keepalt file ".fnameescape(rfile) + exe "sil! NetrwKeepj keepalt file ".fnameescape(rfile) " Detect filetype of local version of remote file. " Note that isk must not include a "/" for scripts.vim @@ -2690,7 +2797,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) elseif !&ma " attempting to read a file after the current line in the file, but the buffer is not modifiable - keepj call netrw#ErrorMsg(s:WARNING,"attempt to read<".a:tfile."> into a non-modifiable buffer!",94) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"attempt to read<".a:tfile."> into a non-modifiable buffer!",94) " call Dret("NetrwGetFile : attempt to read<".a:tfile."> into a non-modifiable buffer!") return @@ -2700,7 +2807,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) let curline = line(".") let lastline= line("$") " call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline) - exe "keepj ".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile) + exe "NetrwKeepj ".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile) let line1= curline + 1 let line2= line("$") - lastline + 1 @@ -2708,7 +2815,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " not readable " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Decho("tfile<".a:tfile."> not readable") - keepj call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9) " call Dret("NetrwGetFile : tfile<".a:tfile."> not readable") return endif @@ -2716,14 +2823,14 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " User-provided (ie. optional) fix-it-up command if exists("*NetReadFixup") " call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") - keepj call NetReadFixup(a:method, line1, line2) + NetrwKeepj call NetReadFixup(a:method, line1, line2) " else " Decho " call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")") endif if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu " update the Buffers menu - keepj call s:UpdateBuffersMenu() + NetrwKeepj call s:UpdateBuffersMenu() endif " call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile)) @@ -2749,6 +2856,7 @@ endfun " 7: rsync " 8: fetch " 9: sftp +" 10: file " g:netrw_machine= hostname " b:netrw_fname = filename " g:netrw_port = optional port number (for ftp) @@ -2799,11 +2907,9 @@ fun! s:NetrwMethod(choice) " rsyncurm : rsync://host[:port]/path Use rsync " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http) " sftpurm : sftp://[user@]host/filename Use scp + " fileurm : file://[user@]host/filename Use elinks or links let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$' let mf = '^\(\S\+\)\s\+\(\S\+\)$' -" let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' -" let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$' -" let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' let ftpurm = '^ftp://\(\([^/]*\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' let rcpurm = '^rcp://\%(\([^/]*\)@\)\=\([^/]\{-}\)/\(.*\)$' let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$' @@ -2813,6 +2919,7 @@ fun! s:NetrwMethod(choice) let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$' let fetchurm = '^fetch://\(\([^/]*\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$' let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' + let fileurm = '^file\=://\(.*\)$' " call Decho("determine method:") " Determine Method @@ -2969,6 +3076,13 @@ fun! s:NetrwMethod(choice) let g:netrw_uid= userid endif + " Method#10: file://user@hostname/...path-to-file {{{3 + elseif match(a:choice,fileurm) == 0 && exists("g:netrw_file_cmd") +" call Decho("http[s]://...") + let b:netrw_method = 10 + let b:netrw_fname = substitute(a:choice,fileurm,'\1',"") +" call Decho('\1<'.substitute(a:choice,fileurm,'\1',"").">") + " Cannot Determine Method {{{3 else if !exists("g:netrw_quiet") @@ -3023,7 +3137,7 @@ if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp if method == 3 " ftp (no <.netrc>) let fourblanklines= line2 - 3 if fourblanklines >= line1 - exe "sil keepj ".fourblanklines.",".line2."g/^\s*$/d" + exe "sil NetrwKeepj ".fourblanklines.",".line2."g/^\s*$/d" call histdel("/",-1) endif endif @@ -3163,9 +3277,9 @@ endfun " 0: (user: ) bookmark current directory " 1: (user: ) change to the bookmarked directory " 2: (user: ) list bookmarks -" 3: (browsing) record current directory history -" 4: (user: ) go up (previous) bookmark -" 5: (user: ) go down (next) bookmark +" 3: (browsing) records current directory history +" 4: (user: ) go up (previous) directory, using history +" 5: (user: ) go down (next) directory, using history " 6: (user: ) delete bookmark fun! s:NetrwBookHistHandler(chg,curdir) " call Dfunc("s:NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhist_cnt." histmax=".g:netrw_dirhistmax) @@ -3174,26 +3288,26 @@ fun! s:NetrwBookHistHandler(chg,curdir) return endif - let ykeep= @@ + let ykeep = @@ + let curbufnr = bufnr("%") + if a:chg == 0 " bookmark the current directory " call Decho("(user: ) bookmark the current directory") - if !exists("g:netrw_bookmarklist") - let g:netrw_bookmarklist= [] + if exists("s:netrwmarkfilelist_{curbufnr}") + call s:NetrwBookmark(0) + echo "bookmarked marked files" + else + call s:MakeBookmark(a:curdir) + echo "bookmarked the current directory" endif - if index(g:netrw_bookmarklist,a:curdir) == -1 - " curdir not currently in g:netrw_bookmarklist, so include it - call add(g:netrw_bookmarklist,a:curdir) - call sort(g:netrw_bookmarklist) - endif - echo "bookmarked the current directory" elseif a:chg == 1 " change to the bookmarked directory " call Decho("(user: <".v:count."gb>) change to the bookmarked directory") if exists("g:netrw_bookmarklist[v:count-1]") " call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist)) - exe "keepj e ".fnameescape(g:netrw_bookmarklist[v:count-1]) + exe "NetrwKeepj e ".fnameescape(g:netrw_bookmarklist[v:count-1]) else echomsg "Sorry, bookmark#".v:count." doesn't exist!" endif @@ -3267,13 +3381,13 @@ fun! s:NetrwBookHistHandler(chg,curdir) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") setl ma noro " call Decho("setl ma noro") - sil! keepj %d + sil! NetrwKeepj %d setl nomod " call Decho("setl nomod") " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") endif " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) - exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) + exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + v:count1 ) % g:netrw_dirhistmax @@ -3293,14 +3407,14 @@ fun! s:NetrwBookHistHandler(chg,curdir) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") " call Decho("setl ma noro") setl ma noro - sil! keepj %d + sil! NetrwKeepj %d " call Decho("removed all lines from buffer (%d)") " call Decho("setl nomod") setl nomod " call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") endif " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) - exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) + exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax if g:netrw_dirhist_cnt < 0 @@ -3314,17 +3428,17 @@ fun! s:NetrwBookHistHandler(chg,curdir) endif elseif a:chg == 6 - " delete the v:count'th bookmark -" call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">") - let savefile= s:NetrwHome()."/.netrwbook" - if filereadable(savefile) -" call Decho("merge bookmarks (active and file)") - keepj call s:NetrwBookHistSave() " done here to merge bookmarks first -" call Decho("bookmark delete savefile<".savefile.">") - keepj call delete(savefile) - endif + if exists("s:netrwmarkfilelist_{curbufnr}") + call s:NetrwBookmark(1) + echo "removed marked files from bookmarks" + else + " delete the v:count'th bookmark +" call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">") + call s:MergeBookmarks() " call Decho("remove g:netrw_bookmarklist[".(v:count-1)."]") - keepj call remove(g:netrw_bookmarklist,v:count-1) + NetrwKeepj call remove(g:netrw_bookmarklist,v:count-1) + echo "removed current directory from bookmarks" + endif " call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist)) endif call s:NetrwBookmarkMenu() @@ -3335,6 +3449,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwBookHistRead: this function reads bookmarks and history {{{2 +" Will source the history file (.netrwhist) only if the g:netrw_disthistmax is > 0. " Sister function: s:NetrwBookHistSave() fun! s:NetrwBookHistRead() " call Dfunc("s:NetrwBookHistRead()") @@ -3348,13 +3463,13 @@ fun! s:NetrwBookHistRead() let savefile= home."/.netrwbook" if filereadable(savefile) " call Decho("sourcing .netrwbook") - exe "keepalt keepj so ".savefile + exe "keepalt NetrwKeepj so ".savefile endif if g:netrw_dirhistmax > 0 let savefile= home."/.netrwhist" if filereadable(savefile) " call Decho("sourcing .netrwhist") - exe "keepalt keepj so ".savefile + exe "keepalt NetrwKeepj so ".savefile endif let s:netrw_initbookhist= 1 au VimLeave * call s:NetrwBookHistSave() @@ -3369,6 +3484,8 @@ endfun " Sister function: s:NetrwBookHistRead() " I used to do this via viminfo but that appears to " be unreliable for long-term storage +" If g:netrw_dirhistmax is <= 0, no history or bookmarks +" will be saved. fun! s:NetrwBookHistSave() " call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax) if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 @@ -3383,7 +3500,7 @@ fun! s:NetrwBookHistSave() setl nocin noai noci magic nospell nohid wig= noaw setl ma noro write if exists("+acd") | setl noacd | endif - sil! keepj keepalt %d + sil! NetrwKeepj keepalt %d " save .netrwhist -- no attempt to merge sil! keepalt file .netrwhist @@ -3397,21 +3514,20 @@ fun! s:NetrwBookHistSave() endwhile exe "sil! w! ".savefile - sil keepj %d + sil NetrwKeepj %d if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] " merge and write .netrwbook let savefile= s:NetrwHome()."/.netrwbook" if filereadable(savefile) let booklist= deepcopy(g:netrw_bookmarklist) - exe "sil keepj keepalt so ".savefile + exe "sil NetrwKeepj keepalt so ".savefile for bdm in booklist if index(g:netrw_bookmarklist,bdm) == -1 call add(g:netrw_bookmarklist,bdm) endif endfor call sort(g:netrw_bookmarklist) - exe "sil! w! ".savefile endif " construct and save .netrwbook @@ -3436,12 +3552,18 @@ fun! s:NetrwBrowse(islocal,dirname) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) " call Dredir("ls!") - " s:NetrwBrowse: initialize history {{{3 - if !exists("s:netrw_initbookhist") - keepj call s:NetrwBookHistRead() + " save alternate-file's filename if w:netrw_rexlocal doesn't exist + " This is useful when one edits a local file, then :e ., then :Rex + if a:islocal && !exists("w:netrw_rexfile") && bufname("#") != "" + let w:netrw_rexfile= bufname("#") endif - " s:NetrwBrowse: simplify the dirname (especially for ".."s in dirnames) {{{3 + " s:NetrwBrowse : initialize history {{{3 + if !exists("s:netrw_initbookhist") + NetrwKeepj call s:NetrwBookHistRead() + endif + + " s:NetrwBrowse : simplify the dirname (especially for ".."s in dirnames) {{{3 if a:dirname !~ '^\a\+://' let dirname= simplify(a:dirname) else @@ -3455,77 +3577,83 @@ fun! s:NetrwBrowse(islocal,dirname) return endif - " s:NetrwBrowse: sanity checks: {{{3 + " s:NetrwBrowse : sanity checks: {{{3 if !exists("*shellescape") - keepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69) " call Dret("s:NetrwBrowse : missing shellescape()") return endif if !exists("*fnameescape") - keepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing fnameescape()",70) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing fnameescape()",70) " call Dret("s:NetrwBrowse : missing fnameescape()") return endif - " s:NetrwBrowse: save options: {{{3 + " s:NetrwBrowse : save options: {{{3 call s:NetrwOptionSave("w:") - " s:NetrwBrowse: re-instate any marked files {{{3 + " s:NetrwBrowse : re-instate any marked files {{{3 if exists("s:netrwmarkfilelist_{bufnr('%')}") " call Decho("clearing marked files") exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" endif if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep - " s:NetrwBrowse: set up "safe" options for local directory/file {{{3 + " s:NetrwBrowse : set up "safe" options for local directory/file {{{3 " call Decho("handle w:netrw_acdkeep:") -" call Decho("keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") +" call Decho("NetrwKeepj lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") call s:NetrwLcd(dirname) call s:NetrwSafeOptions() " call Decho("getcwd<".getcwd().">") elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' - " s:NetrwBrowse: looks like a remote regular file, attempt transfer {{{3 -" call Decho("attempt transfer as regular file<".dirname.">") - - " remove any filetype indicator from end of dirname, except for the - " "this is a directory" indicator (/). - " There shouldn't be one of those here, anyway. - let path= substitute(dirname,'[*=@|]\r\=$','','e') -" call Decho("new path<".path.">") - call s:RemotePathAnalysis(dirname) - - " s:NetrwBrowse: remote-read the requested file into current buffer {{{3 - keepj mark ' - call s:NetrwEnew(dirname) - call s:NetrwSafeOptions() - setl ma noro -" call Decho("setl ma noro") - let b:netrw_curdir = dirname - let url = s:method."://".s:user.s:machine.(s:port ? ":".s:port : "")."/".s:path -" call Decho("exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")") - exe "sil! keepj keepalt file ".fnameescape(url) - exe "sil! keepj keepalt doau BufReadPre ".fnameescape(s:fname) - sil call netrw#NetRead(2,url) - " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error -" call Decho("url<".url.">") -" call Decho("s:path<".s:path.">") -" call Decho("s:fname<".s:fname.">") - if s:path =~ '.bz2' - exe "sil keepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.bz2$','','')) - elseif s:path =~ '.gz' - exe "sil keepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.gz$','','')) - elseif s:path =~ '.gz' - exe "sil keepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.txz$','','')) + " s:NetrwBrowse : remote regular file handler {{{3 +" call Decho("handle remote regular file: dirname<".dirname.">") + if bufname(dirname) != "" +" call Decho("edit buf#".bufname(dirname)." in win#".winnr()) + exe "NetrwKeepj b ".bufname(dirname) else - exe "sil keepj keepalt doau BufReadPost ".fnameescape(s:fname) + " attempt transfer of remote regular file +" call Decho("attempt transfer as regular file<".dirname.">") + + " remove any filetype indicator from end of dirname, except for the + " "this is a directory" indicator (/). + " There shouldn't be one of those here, anyway. + let path= substitute(dirname,'[*=@|]\r\=$','','e') +" call Decho("new path<".path.">") + call s:RemotePathAnalysis(dirname) + + " s:NetrwBrowse : remote-read the requested file into current buffer {{{3 + call s:NetrwEnew(dirname) + call s:NetrwSafeOptions() + setl ma noro +" call Decho("setl ma noro") + let b:netrw_curdir = dirname + let url = s:method."://".((s:user == "")? "" : s:user."@").s:machine.(s:port ? ":".s:port : "")."/".s:path +" call Decho("exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")") + exe "sil! NetrwKeepj keepalt file ".fnameescape(url) + exe "sil! NetrwKeepj keepalt doau BufReadPre ".fnameescape(s:fname) + sil call netrw#NetRead(2,url) + " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error +" call Decho("url<".url.">") +" call Decho("s:path<".s:path.">") +" call Decho("s:fname<".s:fname.">") + if s:path =~ '.bz2' + exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.bz2$','','')) + elseif s:path =~ '.gz' + exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.gz$','','')) + elseif s:path =~ '.gz' + exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.txz$','','')) + else + exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(s:fname) + endif endif - " s:NetrwBrowse: save certain window-oriented variables into buffer-oriented variables {{{3 + " s:NetrwBrowse : save certain window-oriented variables into buffer-oriented variables {{{3 call s:SetBufWinVars() call s:NetrwOptionRestore("w:") " call Decho("setl ma nomod") - setl ma nomod + setl ma nomod noro " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("s:NetrwBrowse : file<".s:fname.">") @@ -3541,9 +3669,11 @@ fun! s:NetrwBrowse(islocal,dirname) let s:last_sort_by = g:netrw_sort_by " set up menu {{{3 - keepj call s:NetrwMenu(1) + NetrwKeepj call s:NetrwMenu(1) " get/set-up buffer {{{3 +" call Decho("saving position across a buffer refresh") + let svpos = netrw#SavePosn() let reusing= s:NetrwGetBuffer(a:islocal,dirname) " maintain markfile highlighting if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" @@ -3559,7 +3689,7 @@ fun! s:NetrwBrowse(islocal,dirname) " call Decho("setl noma nomod nowrap") setl noma nomod nowrap " call Decho("(set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Dret("s:NetrwBrowse : re-using buffer") +" call Dret("s:NetrwBrowse : re-using not-cleared buffer") return endif @@ -3631,9 +3761,9 @@ fun! s:NetrwBrowse(islocal,dirname) let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' if dirname !~ dirpat if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) endif - keepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionRestore("w:") " call Decho("setl noma nomod nowrap") setl noma nomod nowrap " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") @@ -3647,9 +3777,9 @@ fun! s:NetrwBrowse(islocal,dirname) " ----------------------- " Directory Listing: {{{3 " ----------------------- - keepj call s:NetrwMaps(a:islocal) - keepj call s:NetrwCommands(a:islocal) - keepj call s:PerformListing(a:islocal) + NetrwKeepj call s:NetrwMaps(a:islocal) + NetrwKeepj call s:NetrwCommands(a:islocal) + NetrwKeepj call s:PerformListing(a:islocal) if v:version >= 700 && has("balloon_eval") && &beval == 0 && &l:bexpr == "" && !exists("g:netrw_nobeval") let &l:bexpr= "netrw#BalloonHelp()" " call Decho("set up balloon help: l:bexpr=".&l:bexpr) @@ -3657,6 +3787,12 @@ fun! s:NetrwBrowse(islocal,dirname) endif call s:NetrwOptionRestore("w:") + " restore position and jumplist entry + if !reusing +" call Decho("restoring position across buffer refresh") + call netrw#RestorePosn(svpos) + endif + " The s:LocalBrowseRefresh() function is called by an autocmd " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow, medium speed). " However, s:NetrwBrowse() causes the FocusGained event to fire the firstt time. @@ -3738,7 +3874,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) exe "sil! noswapfile keepalt b ".w:netrw_treebufnr let &ei= eikeep setl ma - sil! keepj %d + sil! NetrwKeepj %d " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) " call Dret("s:NetrwGetBuffer 0 : bufnum#".w:netrw_treebufnr."") return 0 @@ -3819,7 +3955,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " get enew buffer and name it -or- re-use buffer {{{3 " call Decho(" get enew buffer and name it OR re-use buffer") - sil! keepj keepalt mark ' + sil! NetrwKeepj keepalt mark ' if bufnum < 0 || !bufexists(bufnum) " call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)") call s:NetrwEnew(dirname) @@ -3843,8 +3979,8 @@ fun! s:NetrwGetBuffer(islocal,dirname) nnoremap ]] :sil call TreeListMove(']') " call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr) else -" let v:errmsg= "" " Decho - let escdirname= fnameescape(dirname) +" let v:errmsg = "" " Decho + let escdirname = fnameescape(dirname) " call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">") " call Decho(' exe sil! keepalt file '.escdirname) " let v:errmsg= "" " Decho @@ -3869,25 +4005,30 @@ fun! s:NetrwGetBuffer(islocal,dirname) exe "sil! keepalt file ".fnameescape(getcwd()) endif let &ei= eikeep + if line("$") <= 1 - keepj call s:NetrwListSettings(a:islocal) + NetrwKeepj call s:NetrwListSettings(a:islocal) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) " call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but its empty, so refresh it") return 0 + elseif g:netrw_fastbrowse == 0 || (a:islocal && g:netrw_fastbrowse == 1) - keepj call s:NetrwListSettings(a:islocal) - sil keepj %d +" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse." a:islocal=".a:islocal.": clear buffer") + NetrwKeepj call s:NetrwListSettings(a:islocal) + sil NetrwKeepj %d " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) " call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but refreshing due to g:netrw_fastbrowse=".g:netrw_fastbrowse) return 0 + elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " call Decho("--re-use tree listing--") " call Decho(" clear buffer<".expand("%")."> with :%d") - sil keepj %d - keepj call s:NetrwListSettings(a:islocal) + sil NetrwKeepj %d + NetrwKeepj call s:NetrwListSettings(a:islocal) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) " call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") return 0 + else " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) " call Dret("s:NetrwGetBuffer 1 : buf#".bufnr("%")) @@ -3902,14 +4043,14 @@ fun! s:NetrwGetBuffer(islocal,dirname) " fast 2 H H " call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--") let fname= expand("%") - keepj call s:NetrwListSettings(a:islocal) + NetrwKeepj call s:NetrwListSettings(a:islocal) " call Decho("exe sil! keepalt file ".fnameescape(fname)) - exe "sil! keepj keepalt file ".fnameescape(fname) + exe "sil! NetrwKeepj keepalt file ".fnameescape(fname) " delete all lines from buffer {{{3 " call Decho("--delete all lines from buffer--") " call Decho(" clear buffer<".expand("%")."> with :%d") - sil! keepalt keepj %d + sil! keepalt NetrwKeepj %d " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) " call Dret("s:NetrwGetBuffer 0 : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")) @@ -3936,7 +4077,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwGetWord: it gets the directory/file named under the cursor {{{2 fun! s:NetrwGetWord() -" call Dfunc("s:NetrwGetWord() line#".line(".")." liststyle=".g:netrw_liststyle." virtcol=".virtcol(".")) +" call Dfunc("s:NetrwGetWord() line#".line(".")." liststyle=".s:ShowStyle()." virtcol=".virtcol(".")) call s:UseBufWinVars() " insure that w:netrw_liststyle is set up @@ -3946,18 +4087,18 @@ fun! s:NetrwGetWord() else let w:netrw_liststyle= s:THINLIST endif -" call Decho("w:netrw_liststyle=".w:netrw_liststyle) +" "call Decho("w:netrw_liststyle=".w:netrw_liststyle) endif if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt " Active Banner support -" call Decho("active banner handling") - keepj norm! 0 +" "call Decho("active banner handling") + NetrwKeepj norm! 0 let dirname= "./" let curline= getline('.') if curline =~ '"\s*Sorted by\s' - keepj norm s + NetrwKeepj norm s let s:netrw_skipbrowse= 1 echo 'Pressing "s" also works' @@ -3966,67 +4107,67 @@ fun! s:NetrwGetWord() echo 'Press "S" to edit sorting sequence' elseif curline =~ '"\s*Quick Help:' - keepj norm ? + NetrwKeepj norm ? let s:netrw_skipbrowse= 1 - echo 'Pressing "?" also works' elseif curline =~ '"\s*\%(Hiding\|Showing\):' - keepj norm a + NetrwKeepj norm a let s:netrw_skipbrowse= 1 echo 'Pressing "a" also works' elseif line("$") > w:netrw_bannercnt - exe 'sil keepj '.w:netrw_bannercnt + exe 'sil NetrwKeepj '.w:netrw_bannercnt endif elseif w:netrw_liststyle == s:THINLIST -" call Decho("thin column handling") - keepj norm! 0 - let dirname= getline('.') +" "call Decho("thin column handling") + NetrwKeepj norm! 0 + let dirname= substitute(getline('.'),'\t -->.*$','','') elseif w:netrw_liststyle == s:LONGLIST -" call Decho("long column handling") - keepj norm! 0 +" "call Decho("long column handling") + NetrwKeepj norm! 0 let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e') elseif w:netrw_liststyle == s:TREELIST -" call Decho("treelist handling") +" "call Decho("treelist handling") let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e') + let dirname= substitute(dirname,'\t -->.*$','','') else -" call Decho("obtain word from wide listing") +" "call Decho("obtain word from wide listing") let dirname= getline('.') if !exists("b:netrw_cpf") let b:netrw_cpf= 0 - exe 'sil keepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' call histdel("/",-1) -" call Decho("computed cpf=".b:netrw_cpf) +" "call Decho("computed cpf=".b:netrw_cpf) endif -" call Decho("buf#".bufnr("%")."<".bufname("%").">") +" "call Decho("buf#".bufnr("%")."<".bufname("%").">") let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf -" call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt) -" call Decho("1: dirname<".dirname.">") +" "call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt) +" "call Decho("1: dirname<".dirname.">") if filestart == 0 - keepj norm! 0ma + NetrwKeepj norm! 0ma else call cursor(line("."),filestart+1) - keepj norm! ma + NetrwKeepj norm! ma endif let rega= @a let eofname= filestart + b:netrw_cpf + 1 if eofname <= col("$") call cursor(line("."),filestart+b:netrw_cpf+1) - keepj norm! "ay`a + NetrwKeepj norm! "ay`a else - keepj norm! "ay$ + NetrwKeepj norm! "ay$ endif let dirname = @a let @a = rega -" call Decho("2: dirname<".dirname.">") +" "call Decho("2: dirname<".dirname.">") let dirname= substitute(dirname,'\s\+$','','e') -" call Decho("3: dirname<".dirname.">") +" "call Decho("3: dirname<".dirname.">") endif " symlinks are indicated by a trailing "@". Remove it before further processing. @@ -4101,7 +4242,7 @@ fun! s:NetrwListStyle(islocal) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') else - keepj call netrw#ErrorMsg(s:WARNING,"bad value for g:netrw_liststyle (=".w:netrw_liststyle.")",46) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"bad value for g:netrw_liststyle (=".w:netrw_liststyle.")",46) let g:netrw_liststyle = s:THINLIST let w:netrw_liststyle = g:netrw_liststyle let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') @@ -4111,7 +4252,7 @@ fun! s:NetrwListStyle(islocal) " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh " call Decho("clear buffer<".expand("%")."> with :%d") - sil! keepj %d + sil! NetrwKeepj %d " following prevents tree listing buffer from being marked "modified" " call Decho("setl nomod") setl nomod @@ -4119,11 +4260,11 @@ fun! s:NetrwListStyle(islocal) " refresh the listing " call Decho("refresh the listing") - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call s:NetrwCursor() + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call s:NetrwCursor() " restore position; keep cursor on the filename - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call netrw#RestorePosn(svpos) let @@= ykeep " call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : "")) @@ -4144,16 +4285,86 @@ fun! s:NetrwBannerCtrl(islocal) " keep cursor on the filename let fname= s:NetrwGetWord() - sil keepj $ + sil NetrwKeepj $ let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') " call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A')) if result <= 0 && exists("w:netrw_bannercnt") - exe "keepj ".w:netrw_bannercnt + exe "NetrwKeepj ".w:netrw_bannercnt endif let @@= ykeep " call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner) endfun +" --------------------------------------------------------------------- +" s:NetrwBookmark: supports :NetrwMB[!] [file]s {{{2 +" +" No bang: enters files/directories into Netrw's bookmark system +" No argument and in netrw buffer: +" if there are marked files: bookmark marked files +" otherwise : bookmark file/directory under cursor +" No argument and not in netrw buffer: bookmarks current open file +" Has arguments: globs them individually and bookmarks them +" +" With bang: deletes files/directories from Netrw's bookmark system +fun! s:NetrwBookmark(del,...) +" call Dfunc("s:NetrwBookmark(del=".a:del.",...) a:0=".a:0) + if a:0 == 0 + if &ft == "netrw" + let curbufnr = bufnr("%") + + if exists("s:netrwmarkfilelist_{curbufnr}") + " for every filename in the marked list +" call Decho("bookmark every filename in marked list") + let svpos = netrw#SavePosn() + let islocal= expand("%") !~ '^\a\+://' + for fname in s:netrwmarkfilelist_{curbufnr} + if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif + endfor + let curdir = exists("b:netrw_curdir")? b:netrw_curdir : getcwd() + call s:NetrwUnmarkList(curbufnr,curdir) + NetrwKeepj call s:NetrwRefresh(islocal,s:NetrwBrowseChgDir(islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) + else + let fname= s:NetrwGetWord() + if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif + endif + + else + " bookmark currently open file +" call Decho("bookmark currently open file") + let fname= expand("%") + if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif + endif + + else + " bookmark specified files + " attempts to infer if working remote or local + " by deciding if the current file begins with an url + " Globbing cannot be done remotely. + let islocal= expand("%") !~ '^\a\+://' +" call Decho("bookmark specified file".((a:0>1)? "s" : "")) + let i = 1 + while i <= a:0 + if islocal + let mbfiles= glob(a:{i},0,1) + else + let mbfiles= [a:{i}] + endif +" call Decho("mbfiles".string(mbfiles)) + for mbfile in mbfiles +" call Decho("mbfile<".mbfile.">") + if a:del|call s:DeleteBookmark(mbfile)|else|call s:MakeBookmark(mbfile)|endif + endfor + let i= i + 1 + endwhile + endif + + " update the menu + call s:NetrwBookmarkMenu() + +" call Dret("s:NetrwBookmark") +endfun + " --------------------------------------------------------------------- " s:NetrwBookmarkMenu: Uses menu priorities {{{2 " .2.[cnt] for bookmarks, and @@ -4241,8 +4452,8 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " NetrwBrowseChgDir: save options and initialize {{{3 " call Decho("saving options") - keepj call s:NetrwOptionSave("s:") - keepj call s:NetrwSafeOptions() + NetrwKeepj call s:NetrwOptionSave("s:") + NetrwKeepj call s:NetrwSafeOptions() let nbcd_curpos = netrw#SavePosn() let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos " call Decho("setting s:nbcd_curpos_".bufnr('%')." to SavePosn") @@ -4257,6 +4468,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("dirname<".dirname.">") " ignore s when done in the banner +" call Decho('ignore s when done in banner (g:netrw_banner='.g:netrw_banner.")") if g:netrw_banner " call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#")) if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt @@ -4265,10 +4477,10 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let g:netrw_quickhelp= (g:netrw_quickhelp + 1)%len(s:QuickHelp) " call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") setl ma noro nowrap - keepj call setline(line('.'),'" Quick Help: :help '.s:QuickHelp[g:netrw_quickhelp]) + NetrwKeepj call setline(line('.'),'" Quick Help: :help '.s:QuickHelp[g:netrw_quickhelp]) setl noma nomod nowrap - keepj call netrw#RestorePosn(nbcd_curpos) - keepj call s:NetrwOptionRestore("s:") + NetrwKeepj call netrw#RestorePosn(nbcd_curpos) + NetrwKeepj call s:NetrwOptionRestore("s:") " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") endif endif @@ -4291,8 +4503,9 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let dirname= dirname.'/' " call Decho("adjusting dirname<".dirname.">") endif +" call Decho("newdir<".newdir."> !~ dirpat<".dirpat.">? ".((newdir !~ dirpat)? "yes" : "no")) - if newdir !~ dirpat + if newdir !~ dirpat && !(a:islocal && isdirectory(newdir)) " ------------------------------ " NetrwBrowseChgDir: edit a file {{{3 " ------------------------------ @@ -4308,7 +4521,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' " call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">") " call Decho("edit-a-file: newdir<".newdir.">") - let dirname= s:NetrwTreeDir() + let dirname= s:NetrwTreeDir(a:islocal) if dirname =~ '/$' let dirname= dirname.newdir else @@ -4322,29 +4535,40 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let dirname= s:ComposePath(dirname,newdir) endif " call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")") - " this lets NetrwBrowseX avoid the edit + " this lets netrw#BrowseX avoid the edit if a:0 < 1 " call Decho("edit-a-file: set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) - keepj call s:NetrwOptionRestore("s:") + NetrwKeepj call s:NetrwOptionRestore("s:") if !exists("s:didsplit") -" call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".g:netrw_browse_split." win#".winnr()) - if g:netrw_browse_split == 1 +" call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr()) + if type(g:netrw_browse_split) == 3 + " open file in server + " Note that g:netrw_browse_split is a List: [servername,tabnr,winnr] +" call Decho("edit-a-file: open file in server") + call s:NetrwServerEdit(a:islocal,dirname) +" call Dret("s:NetrwBrowseChgDir") + return + elseif g:netrw_browse_split == 1 " horizontally splitting the window first +" call Decho("edit-a-file: horizontally splitting window prior to edit") keepalt new if !&ea keepalt wincmd _ endif elseif g:netrw_browse_split == 2 " vertically splitting the window first +" call Decho("edit-a-file: vertically splitting window prior to edit") keepalt rightb vert new if !&ea keepalt wincmd | endif elseif g:netrw_browse_split == 3 " open file in new tab +" call Decho("edit-a-file: opening new tab prior to edit") keepalt tabnew elseif g:netrw_browse_split == 4 " act like "P" (ie. open previous window) +" call Decho("edit-a-file: use previous window for edit") if s:NetrwPrevWinOpen(2) == 3 let @@= ykeep " call Dret("s:NetrwBrowseChgDir") @@ -4356,15 +4580,16 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) call s:NetrwMenu(0) " optional change to window if g:netrw_chgwin >= 1 +" call Decho("edit-a-file: changing window to #".g:netrw_chgwin) if winnr("$")+1 == g:netrw_chgwin " if g:netrw_chgwin is set to one more than the last window, then " vertically split the last window to make that window available. let curwin= winnr() - exe "keepj keepalt ".g:netrw_chgwin."wincmd ".winnr("$") + exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".winnr("$") vs - exe "keepj keepalt ".g:netrw_chgwin."wincmd ".curwin + exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin endif - exe "keepj keepalt ".g:netrw_chgwin."wincmd w" + exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd w" endif endif endif @@ -4377,13 +4602,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " some like c-^ to return to the last edited file " others like c-^ to return to the netrw buffer if exists("g:netrw_altfile") && g:netrw_altfile - exe "keepj keepalt e! ".fnameescape(dirname) + exe "NetrwKeepj keepalt e! ".fnameescape(dirname) else - exe "keepj e! ".fnameescape(dirname) + exe "NetrwKeepj e! ".fnameescape(dirname) endif -" call Decho("after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) +" call Decho("edit-a-file: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) call s:NetrwCursor() -" call Decho("COMBAK#1: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) if &hidden || &bufhidden == "hide" " file came from vim's hidden storage. Don't "restore" options with it. let dorestore= 0 @@ -4392,7 +4616,6 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("edit-a-file: remote file: NetrwBrowse will edit it") endif let dolockout= 1 -" call Decho("COMBAK#2: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) " handle g:Netrw_funcref -- call external-to-netrw functions " This code will handle g:Netrw_funcref as an individual function reference @@ -4402,12 +4625,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("edit-a-file: handle optional Funcrefs") if type(g:Netrw_funcref) == 2 " call Decho("edit-a-file: handling a g:Netrw_funcref") - keepj call g:Netrw_funcref() + NetrwKeepj call g:Netrw_funcref() elseif type(g:Netrw_funcref) == 3 " call Decho("edit-a-file: handling a list of g:Netrw_funcrefs") for Fncref in g:Netrw_funcref if type(FncRef) == 2 - keepj call FncRef() + NetrwKeepj call FncRef() endif endfor endif @@ -4419,16 +4642,16 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " NetrwBrowseChgDir: just go to the new directory spec {{{3 " ---------------------------------------------------- " call Decho('goto-newdir: case "just go to new directory spec": newdir<'.newdir.'>') - let dirname = newdir - keepj call s:SetRexDir(a:islocal,dirname) - keepj call s:NetrwOptionRestore("s:") + let dirname = newdir + NetrwKeepj call s:SetRexDir(a:islocal,dirname) + NetrwKeepj call s:NetrwOptionRestore("s:") elseif newdir == './' " --------------------------------------------- " NetrwBrowseChgDir: refresh the directory list {{{3 " --------------------------------------------- " call Decho('refresh-dirlist: case "refresh directory listing": newdir == "./"') - keepj call s:SetRexDir(a:islocal,dirname) + NetrwKeepj call s:SetRexDir(a:islocal,dirname) elseif newdir == '../' " -------------------------------------- @@ -4441,7 +4664,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("go-up: clear buffer<".expand("%")."> with :%d") " call Decho("go-up: setl noro ma") setl noro ma - keepj %d + NetrwKeepj %d endif if has("amiga") @@ -4483,7 +4706,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif " call Decho("go-up: unix: dirname<".dirname."> (go up one dir)") endif - keepj call s:SetRexDir(a:islocal,dirname) + NetrwKeepj call s:SetRexDir(a:islocal,dirname) elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " -------------------------------------- @@ -4495,14 +4718,15 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) setl noro ma if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")) " call Decho("tree-list: clear buffer<".expand("%")."> with :%d") - keepj %d + NetrwKeepj %d endif - let treedir = s:NetrwTreeDir() + let treedir = s:NetrwTreeDir(a:islocal) let s:treecurpos = nbcd_curpos - let haskey= 0 + let haskey = 0 " call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">") " search treedict for tree dir as-is +" call Decho("search treedict for tree dir as-is") if has_key(w:netrw_treedict,treedir) " call Decho('tree-list: ....searched for treedir<'.treedir.'> : found it!') let haskey= 1 @@ -4511,6 +4735,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif " search treedict for treedir with a / appended +" call Decho("search treedict for treedir with a / appended") if !haskey && treedir !~ '/$' if has_key(w:netrw_treedict,treedir."/") let treedir= treedir."/" @@ -4522,6 +4747,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif " search treedict for treedir with any trailing / elided +" call Decho("search treedict for treedir with any trailing / elided") if !haskey && treedir =~ '/$' let treedir= substitute(treedir,'/$','','') if has_key(w:netrw_treedict,treedir) @@ -4532,6 +4758,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif endif +" call Decho("haskey=".haskey) if haskey " close tree listing for selected subdirectory " call Decho("tree-list: closing selected subdirectory<".dirname.">") @@ -4543,8 +4770,10 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " go down one directory let dirname= substitute(treedir,'/*$','/','') " call Decho("tree-list: go down one dir: treedir<".treedir.">") +" call Decho("tree-list: ... : dirname<".dirname.">") endif - keepj call s:SetRexDir(a:islocal,dirname) + NetrwKeepj call s:SetRexDir(a:islocal,dirname) +" call Decho("setting s:treeforceredraw to true") let s:treeforceredraw = 1 else @@ -4553,22 +4782,20 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " ---------------------------------------- let dirname = s:ComposePath(dirname,newdir) " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") - keepj call s:SetRexDir(a:islocal,dirname) + NetrwKeepj call s:SetRexDir(a:islocal,dirname) endif " -------------------------------------- " NetrwBrowseChgDir: Restore and Cleanup {{{3 " -------------------------------------- -" call Decho("COMBAK#3: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) if dorestore " dorestore is zero'd when a local file was hidden or bufhidden; " in such a case, we want to keep whatever settings it may have. " call Decho("doing option restore (dorestore=".dorestore.")") - keepj call s:NetrwOptionRestore("s:") + NetrwKeepj call s:NetrwOptionRestore("s:") " else " Decho " call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod) endif -" call Decho("COMBAK#4: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) if dolockout && dorestore " call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname)) if filewritable(dirname) @@ -4583,7 +4810,6 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") endif endif -" call Decho("COMBAK#5: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) let @@= ykeep " call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">") @@ -4596,9 +4822,18 @@ endfun " for tree, keeps cursor on current filename fun! s:NetrwBrowseUpDir(islocal) " call Dfunc("s:NetrwBrowseUpDir(islocal=".a:islocal.")") + if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt-1 + " this test needed because occasionally this function seems to be incorrectly called + " when multiple leftmouse clicks are taken when atop the one line help in the banner. + " I'm allowing the very bottom line to permit a "-" exit so that one may escape empty + " directories. +" call Dret("s:NetrwBrowseUpDir : cursor not in file area") + return + endif + norm! 0 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") -" call Decho("ftp + treestyle") +" call Decho("case: treestyle") let curline= getline(".") let swwline= winline() - 1 if exists("w:netrw_treetop") @@ -4611,19 +4846,19 @@ fun! s:NetrwBrowseUpDir(islocal) endif if !search('\c^'.s:treedepthstring.curline,'cw') if !search('\c^'.curline,'cw') - sil! keepj 1 + sil! NetrwKeepj 1 endif endif - exe "sil! keepj norm! z\" + exe "sil! NetrwKeepj norm! z\" while winline() < swwline let curwinline= winline() - exe "sil! keepj norm! \" + exe "sil! NetrwKeepj norm! \" if curwinline == winline() break endif endwhile else -" call Decho("ftp + not treestyle") +" call Decho("case: not treestyle") if a:islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../')) else @@ -4640,15 +4875,26 @@ fun! s:NetrwBrowseUpDir(islocal) endfun " --------------------------------------------------------------------- -" s:NetrwBrowseX: (implements "x") executes a special "viewer" script or program for the {{{2 +" netrw#BrowseX: (implements "x") executes a special "viewer" script or program for the {{{2 " given filename; typically this means given their extension. " 0=local, 1=remote -fun! netrw#NetrwBrowseX(fname,remote) -" call Dfunc("NetrwBrowseX(fname<".a:fname."> remote=".a:remote.")") +fun! netrw#BrowseX(fname,remote) +" call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.")") + + " if its really just a directory, then do a "gf" instead + if a:fname =~ '/$' + norm! gf +" call Dret("netrw#BrowseX : did gf instead") + endif + let ykeep = @@ let screenposn = netrw#SavePosn() + " need to save and restore aw setting as gx can invoke this function from non-netrw buffers + let awkeep = &aw + set noaw + " special core dump handler if a:fname =~ '/core\(\.\d\+\)\=$' if exists("g:Netrw_corehandler") @@ -4667,7 +4913,8 @@ fun! netrw#NetrwBrowseX(fname,remote) endif call netrw#RestorePosn(screenposn) let @@= ykeep -" call Dret("NetrwBrowseX : coredump handler invoked") + let &aw= awkeep +" call Dret("netrw#BrowseX : coredump handler invoked") return endif endif @@ -4680,21 +4927,6 @@ fun! netrw#NetrwBrowseX(fname,remote) endif " call Decho("exten<".exten.">") - " seems kde systems often have gnome-open due to dependencies, even though - " gnome-open's subsidiary display tools are largely absent. Kde systems - " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) - if !exists("s:haskdeinit") - if has("unix") && executable("ps") && !has("win32unix") - let s:haskdeinit= system("ps -e") =~ 'kdeinit' - if v:shell_error - let s:haskdeinit = 0 - endif - else - let s:haskdeinit= 0 - endif -" call Decho("setting s:haskdeinit=".s:haskdeinit) - endif - if a:remote == 1 " create a local copy " call Decho("remote: a:remote=".a:remote.": create a local copy of <".a:fname.">") @@ -4769,18 +5001,15 @@ fun! netrw#NetrwBrowseX(fname,remote) elseif exists("g:netrw_browsex_viewer") && executable(viewer) " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") -" call Decho("exe sil !".viewer." ".viewopt.shellescape(fname,1).redir) - exe "sil !".viewer." ".viewopt.shellescape(fname,1).redir + call s:NetrwExe("sil !".viewer." ".viewopt.shellescape(fname,1).redir) let ret= v:shell_error elseif has("win32") || has("win64") " call Decho("windows") if executable("start") -" call Decho('exe sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) - exe 'sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) + call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) elseif executable("rundll32") -" call Decho('exe sil !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) - exe 'sil !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) + call s:NetrwExe('sil! !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif @@ -4791,33 +5020,30 @@ fun! netrw#NetrwBrowseX(fname,remote) let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g') " call Decho("cygwin: winfname<".shellescape(winfname,1).">") if executable("start") -" call Decho('exe sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) - exe 'sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1) + call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) elseif executable("rundll32") -" call Decho('exe sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) - exe 'sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1) + call s:NetrwExe('sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) + elseif executable("cygstart") + call s:NetrwExe('sil !cygstart '.shellescape(fname,1)) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif call inputsave()|call input("Press to continue")|call inputrestore() let ret= v:shell_error - elseif has("unix") && executable("xdg-open") && !s:haskdeinit + elseif has("unix") && executable("xdg-open") && !s:CheckIfKde() " call Decho("unix and xdg-open") -" call Decho("exe sil !xdg-open ".shellescape(fname,1)." ".redir) - exe "sil !xdg-open ".shellescape(fname,1).redir + call s:NetrwExe("sil !xdg-open ".shellescape(fname,1).redir) let ret= v:shell_error - elseif has("unix") && executable("kfmclient") && s:haskdeinit + elseif has("unix") && executable("kfmclient") && s:CheckIfKde() " call Decho("unix and kfmclient") -" call Decho("exe sil !kfmclient exec ".shellescape(fname,1)." ".redir) - exe "sil !kfmclient exec ".shellescape(fname,1)." ".redir + call s:NetrwExe("sil !kfmclient exec ".shellescape(fname,1)." ".redir) let ret= v:shell_error elseif has("macunix") && executable("open") " call Decho("macunix and open") -" call Decho("exe sil !open ".shellescape(fname,1)." ".redir) - exe "sil !open ".shellescape(fname,1)." ".redir + call s:NetrwExe("sil !open ".shellescape(fname,1)." ".redir) let ret= v:shell_error else @@ -4848,13 +5074,39 @@ fun! netrw#NetrwBrowseX(fname,remote) if g:netrw_use_noswf setl noswf endif - exe "sil! keepj norm! \" + exe "sil! NetrwKeepj norm! \" " redraw! endif call netrw#RestorePosn(screenposn) - let @@= ykeep + let @@ = ykeep + let &aw= awkeep -" call Dret("NetrwBrowseX") +" call Dret("netrw#BrowseX") +endfun + +" --------------------------------------------------------------------- +" netrw#BrowseXVis: used by gx in visual mode to select a file for browsing {{{2 +fun! netrw#BrowseXVis() +" call Dfunc("netrw#BrowseXVis()") + let atkeep = @@ + norm! gvy +" call Decho("@@<".@@.">") + call netrw#BrowseX(@@,netrw#CheckIfRemote()) + let @@ = atkeep +" call Dret("netrw#BrowseXVis") +endfun + +" --------------------------------------------------------------------- +" netrw#CheckIfRemote: returns 1 if current file looks like an url, 0 else {{{2 +fun! netrw#CheckIfRemote() +" call Dfunc("netrw#CheckIfRemote()") + if expand("%") =~ '^\a\+://' +" call Dret("netrw#CheckIfRemote 1") + return 1 + else +" call Dret("netrw#CheckIfRemote 0") + return 0 + endif endfun " --------------------------------------------------------------------- @@ -4870,15 +5122,40 @@ fun! s:NetrwChgPerm(islocal,curdir) " call Decho("chgperm<".chgperm.">") call system(chgperm) if v:shell_error != 0 - keepj call netrw#ErrorMsg(1,"changing permission on file<".expand("")."> seems to have failed",75) + NetrwKeepj call netrw#ErrorMsg(1,"changing permission on file<".expand("")."> seems to have failed",75) endif if a:islocal - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) endif let @@= ykeep " call Dret("s:NetrwChgPerm") endfun +" --------------------------------------------------------------------- +" s:CheckIfKde: checks if kdeinit is running {{{2 +" Returns 0: kdeinit not running +" 1: kdeinit is running +fun! s:CheckIfKde() +" call Dfunc("s:CheckIfKde()") + " seems kde systems often have gnome-open due to dependencies, even though + " gnome-open's subsidiary display tools are largely absent. Kde systems + " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) + if !exists("s:haskdeinit") + if has("unix") && executable("ps") && !has("win32unix") + let s:haskdeinit= system("ps -e") =~ '\") endif endfor - keepj call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) + NetrwKeepj call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) let g:netrw_hide= 1 else " switch between show-all/show-not-hidden/show-hidden let g:netrw_hide=(g:netrw_hide+1)%3 - exe "keepj norm! 0" + exe "NetrwKeepj norm! 0" if g:netrw_hide && g:netrw_list_hide == "" - keepj call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your hiding list is empty!",49) let @@= ykeep " call Dret("NetrwHide") return endif endif - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) let @@= ykeep " call Dret("NetrwHide") endfun @@ -5034,8 +5311,8 @@ fun! s:NetrwHidden(islocal) endif " refresh screen and return to saved position - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) let @@= ykeep " call Dret("s:NetrwHidden") endfun @@ -5101,28 +5378,152 @@ fun! s:NetrwLeftmouse(islocal) " call Dret("s:NetrwLeftmouse : detected a status bar leftmouse click") return endif - " NOTE: following test is preventing leftmouse selection/deselection of directories and files in treelist mode (Dec 04, 2013) + " Dec 04, 2013: following test prevents leftmouse selection/deselection of directories and files in treelist mode " Windows are separated by vertical separator bars - but the mouse seems to be doing what it should when dragging that bar - " without this test. -" if v:mouse_col != col('.') -" let @@= ykeep -" call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click") -" return -" endif + " without this test when its disabled. + " May 26, 2014: edit file, :Lex, resize window -- causes refresh. Reinstated a modified test. See if problems develop. +" call Decho("v:mouse_col=".v:mouse_col." col#".col('.')." virtcol#".virtcol('.')." col($)#".col("$")." virtcol($)#".virtcol("$")) + if v:mouse_col > virtcol('.') + let @@= ykeep +" call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click") + return + endif if a:islocal if exists("b:netrw_curdir") - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) endif else if exists("b:netrw_curdir") - keepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) + NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) endif endif let @@= ykeep " call Dret("s:NetrwLeftmouse") endfun +" --------------------------------------------------------------------- +" s:NetrwServerEdit: edit file in a server gvim, usually NETRWSERVER (implements ){{{2 +" a:islocal=0 : not used, remote +" a:islocal=1 : no used, local +" a:islocal=2 : used, remote +" a:islocal=3 : used, local +fun! s:NetrwServerEdit(islocal,fname) +" call Dfunc("s:NetrwServerEdit(islocal=".a:islocal.",fname<".a:fname.">)") + let islocal = a:islocal%2 " =0: remote =1: local + let ctrlr = a:islocal >= 2 " =0: not used =1: used + + if (islocal && isdirectory(a:fname)) || (!islocal && a:fname =~ '/$') + " handle directories in the local window -- not in the remote vim server + " user must have closed the NETRWSERVER window. Treat as a normal editing from netrw. + let g:netrw_browse_split= 0 + if exists("s:netrw_browse_split_".winnr()) + let g:netrw_browse_split= s:netrw_browse_split_{winnr()} + unlet s:netrw_browse_split_{winnr()} + endif + call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname)) +" call Dret("s:NetrwServerEdit") + return + endif + + if has("clientserver") && executable("gvim") +" call Decho("has clientserver and gvim") + + if exists("g:netrw_browse_split") && type(g:netrw_browse_split) == 3 +" call Decho("g:netrw_browse_split=".string(g:netrw_browse_split)) + let srvrname = g:netrw_browse_split[0] + let tabnum = g:netrw_browse_split[1] + let winnum = g:netrw_browse_split[2] + + if serverlist() !~ '\<'.srvrname.'\>' +" call Decho("server not available; ctrlr=".ctrlr) + + if !ctrlr + " user must have closed the server window and the user did not use , but + " used something like . +" call Decho("user must have closed server AND did not use ctrl-r") + if exists("g:netrw_browse_split") + unlet g:netrw_browse_split + endif + let g:netrw_browse_split= 0 + if exists("s:netrw_browse_split_".winnr()) + let g:netrw_browse_split= s:netrw_browse_split_{winnr()} + endif + call s:NetrwBrowseChgDir(islocal,a:fname) +" call Dret("s:NetrwServerEdit") + return + + elseif has("win32") && executable("start") + " start up remote netrw server under windows +" call Decho("starting up gvim server<".srvrname."> for windows") + call system("start gvim --servername ".srvrname) + + else + " start up remote netrw server under linux +" call Decho("starting up gvim server<".srvrname.">") + call system("gvim --servername ".srvrname) + endif + endif + +" call Decho("srvrname<".srvrname."> tabnum=".tabnum." winnum=".winnum." server-editing<".a:fname.">") + call remote_send(srvrname,":tabn ".tabnum."\") + call remote_send(srvrname,":".winnum."wincmd w\") + call remote_send(srvrname,":e ".fnameescape(a:fname)."\") + + else + + if serverlist() !~ '\<'.g:netrw_servername.'\>' + + if !ctrlr +" call Decho("server<".g:netrw_servername."> not available and ctrl-r not used") + if exists("g:netrw_browse_split") + unlet g:netrw_browse_split + endif + let g:netrw_browse_split= 0 + call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,a:fname)) +" call Dret("s:NetrwServerEdit") + return + + else +" call Decho("server<".g:netrw_servername."> not available but ctrl-r used") + if has("win32") && executable("start") + " start up remote netrw server under windows +" call Decho("starting up gvim server<".g:netrw_servername."> for windows") + call system("start gvim --servername ".g:netrw_servername) + else + " start up remote netrw server under linux +" call Decho("starting up gvim server<".g:netrw_servername.">") + call system("gvim --servername ".g:netrw_servername) + endif + endif + endif + + while 1 + try +" call Decho("remote-send: e ".a:fname) + call remote_send(g:netrw_servername,":e ".fnameescape(a:fname)."\") + break + catch /^Vim\%((\a\+)\)\=:E241/ + sleep 200m + endtry + endwhile + + if exists("g:netrw_browse_split") + if type(g:netrw_browse_split) != 3 + let s:netrw_browse_split_{winnr()}= g:netrw_browse_split + endif + unlet g:netrw_browse_split + endif + let g:netrw_browse_split= [g:netrw_servername,1,1] + endif + + else + call netrw#ErrorMsg(s:ERROR,"you need a gui-capable vim and client-server to use ",98) + endif + +" call Dret("s:NetrwServerEdit") +endfun + " --------------------------------------------------------------------- " s:NetrwSLeftmouse: marks the file under the cursor. May be dragged to select additional files {{{2 fun! s:NetrwSLeftmouse(islocal) @@ -5177,7 +5578,7 @@ endfun " s:NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2 " separated patterns given in g:netrw_list_hide fun! s:NetrwListHide() -" call Dfunc("NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") +" call Dfunc("s:NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") let ykeep= @@ " find a character not in the "hide" string to use as a separator for :g and :v commands @@ -5200,23 +5601,23 @@ fun! s:NetrwListHide() " Prune the list by hiding any files which match if g:netrw_hide == 1 " call Decho("hiding<".hide."> listhide<".listhide.">") - exe 'sil! keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' elseif g:netrw_hide == 2 " call Decho("showing<".hide."> listhide<".listhide.">") - exe 'sil! keepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' endif endwhile if g:netrw_hide == 2 - exe 'sil! keepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' - exe 'sil! keepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' endif " remove any blank lines that have somehow remained. " This seems to happen under Windows. - exe 'sil! keepj 1,$g@^\s*$@d' + exe 'sil! NetrwKeepj 1,$g@^\s*$@d' let @@= ykeep -" call Dret("NetrwListHide") +" call Dret("s:NetrwListHide") endfun " --------------------------------------------------------------------- @@ -5236,7 +5637,7 @@ fun! s:NetrwHideEdit(islocal) " call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">") " refresh the listing - sil keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) + sil NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) " restore cursor position call netrw#RestorePosn(svpos) @@ -5258,8 +5659,8 @@ fun! s:NetSortSequence(islocal) " refresh the listing let g:netrw_sort_sequence= newsortseq - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) let @@= ykeep " call Dret("NetSortSequence") @@ -5267,6 +5668,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwMakeDir: this function makes a directory (both local and remote) {{{2 +" implements the "d" mapping. fun! s:NetrwMakeDir(usrhost) " call Dfunc("s:NetrwMakeDir(usrhost<".a:usrhost.">)") @@ -5294,7 +5696,7 @@ fun! s:NetrwMakeDir(usrhost) " call Decho("fullnewdir<".fullnewdir.">") if isdirectory(fullnewdir) if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) endif let @@= ykeep " call Dret("s:NetrwMakeDir : directory<".newdirname."> exists previously") @@ -5302,7 +5704,7 @@ fun! s:NetrwMakeDir(usrhost) endif if s:FileReadable(fullnewdir) if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a file!",25) endif let @@= ykeep " call Dret("s:NetrwMakeDir : file<".newdirname."> exists previously") @@ -5321,8 +5723,7 @@ fun! s:NetrwMakeDir(usrhost) let netrw_origdir= s:NetrwGetcwd(1) call s:NetrwLcd(b:netrw_curdir) " call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">") -" call Decho("exe sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) - exe "sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1) + call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) if v:shell_error != 0 let @@= ykeep call netrw#ErrorMsg(s:ERROR,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) @@ -5351,15 +5752,14 @@ fun! s:NetrwMakeDir(usrhost) " call Decho("remote mkdir") let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd) let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname -" call Decho("exe sil! !".mkdircmd." ".shellescape(newdirname,1)) - exe "sil! !".mkdircmd." ".shellescape(newdirname,1) + call s:NetrwExe("sil! !".mkdircmd." ".shellescape(newdirname,1)) if v:shell_error == 0 " refresh listing let svpos= netrw#SavePosn() - keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) elseif !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to make directory<".newdirname.">",27) endif " redraw! @@ -5374,8 +5774,8 @@ fun! s:NetrwMakeDir(usrhost) let remotepath= "" endif call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"') - keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) elseif b:netrw_method == 3 " Remote mkdir: using ftp + machine, id, passwd, and fname (ie. no .netrc) @@ -5388,8 +5788,8 @@ fun! s:NetrwMakeDir(usrhost) let remotepath= "" endif call s:NetrwRemoteFtpCmd(remotepath,g:netrw_remote_mkdir.' "'.newdirname.'"') - keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) endif let @@= ykeep @@ -5452,6 +5852,7 @@ fun! s:NetrwMaps(islocal) nnoremap C :call NetrwSetChgwin() nnoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) nnoremap :call TreeSqueezeDir(1) + nnoremap :call NetrwServerEdit(3,NetrwGetWord()) nnoremap d :call NetrwMakeDir("") nnoremap - :call NetrwBrowseUpDir(1) nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) @@ -5477,8 +5878,9 @@ fun! s:NetrwMaps(islocal) nnoremap mt :call NetrwMarkFileTgt(1) nnoremap mT :call NetrwMarkFileTag(1) nnoremap mu :call NetrwUnMarkFile(1) - nnoremap mx :call NetrwMarkFileExe(1) - nnoremap mX :call NetrwMarkFileVimCmd(1) + nnoremap mv :call NetrwMarkFileVimCmd(1) + nnoremap mx :call NetrwMarkFileExe(1,0) + nnoremap mX :call NetrwMarkFileExe(1,1) nnoremap mz :call NetrwMarkFileCompress(1) nnoremap O :call NetrwObtain(1) nnoremap o :call NetrwSplit(3) @@ -5496,11 +5898,11 @@ fun! s:NetrwMaps(islocal) nnoremap u :call NetrwBookHistHandler(4,expand("%")) nnoremap U :call NetrwBookHistHandler(5,expand("%")) nnoremap v :call NetrwSplit(5) - nnoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" + nnoremap x :call netrw#BrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" nnoremap X :call NetrwLocalExecute(expand(""))" " local insert-mode maps inoremap a :call NetrwHide(1) - inoremap c :exe "keepjumps lcd ".fnameescape(b:netrw_curdir) + inoremap c :exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir) inoremap c :call NetrwLcd(b:netrw_curdir) inoremap C :call NetrwSetChgwin() inoremap % :call NetrwOpenFile(1) @@ -5528,8 +5930,9 @@ fun! s:NetrwMaps(islocal) inoremap mT :call NetrwMarkFileTag(1) inoremap mt :call NetrwMarkFileTgt(1) inoremap mu :call NetrwUnMarkFile(1) - inoremap mx :call NetrwMarkFileExe(1) - inoremap mX :call NetrwMarkFileVimCmd(1) + inoremap mv :call NetrwMarkFileVimCmd(1) + inoremap mx :call NetrwMarkFileExe(1,0) + inoremap mX :call NetrwMarkFileExe(1,1) inoremap mz :call NetrwMarkFileCompress(1) inoremap O :call NetrwObtain(1) inoremap o :call NetrwSplit(3) @@ -5547,7 +5950,7 @@ fun! s:NetrwMaps(islocal) inoremap u :call NetrwBookHistHandler(4,expand("%")) inoremap U :call NetrwBookHistHandler(5,expand("%")) inoremap v :call NetrwSplit(5) - inoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" + inoremap x :call netrw#BrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" if !hasmapto('NetrwHideEdit') nmap NetrwHideEdit imap NetrwHideEdit @@ -5608,6 +6011,7 @@ fun! s:NetrwMaps(islocal) nnoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) nnoremap :call TreeSqueezeDir(0) nnoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) + nnoremap :call NetrwServerEdit(2,NetrwGetWord()) nnoremap - :call NetrwBrowseUpDir(0) nnoremap a :call NetrwHide(0) nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) @@ -5625,8 +6029,9 @@ fun! s:NetrwMaps(islocal) nnoremap mt :call NetrwMarkFileTgt(0) nnoremap mT :call NetrwMarkFileTag(0) nnoremap mu :call NetrwUnMarkFile(0) - nnoremap mx :call NetrwMarkFileExe(0) - nnoremap mX :call NetrwMarkFileVimCmd(0) + nnoremap mv :call NetrwMarkFileVimCmd(0) + nnoremap mx :call NetrwMarkFileExe(0,0) + nnoremap mX :call NetrwMarkFileExe(0,1) nnoremap mz :call NetrwMarkFileCompress(0) nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) nnoremap gd :call NetrwForceChgDir(0,NetrwGetWord()) @@ -5653,7 +6058,7 @@ fun! s:NetrwMaps(islocal) nnoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) nnoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) nnoremap v :call NetrwSplit(2) - nnoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) + nnoremap x :call netrw#BrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) nnoremap % :call NetrwOpenFile(0) " remote insert-mode maps inoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) @@ -5675,8 +6080,10 @@ fun! s:NetrwMaps(islocal) inoremap mt :call NetrwMarkFileTgt(0) inoremap mT :call NetrwMarkFileTag(0) inoremap mu :call NetrwUnMarkFile(0) - inoremap mx :call NetrwMarkFileExe(0) - inoremap mX :call NetrwMarkFileVimCmd(0) + nnoremap mv :call NetrwMarkFileVimCmd(1) + inoremap mx :call NetrwMarkFileExe(0,0) + inoremap mX :call NetrwMarkFileExe(0,1) + inoremap mv :call NetrwMarkFileVimCmd(0) inoremap mz :call NetrwMarkFileCompress(0) inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) inoremap gh :call NetrwHidden(0) @@ -5701,7 +6108,7 @@ fun! s:NetrwMaps(islocal) inoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) inoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) inoremap v :call NetrwSplit(2) - inoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) + inoremap x :call netrw#BrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) inoremap % :call NetrwOpenFile(0) if !hasmapto('NetrwHideEdit') nmap NetrwHideEdit @@ -5714,7 +6121,7 @@ fun! s:NetrwMaps(islocal) endif let mapsafepath = escape(s:path, s:netrw_map_escape) - let mapsafeusermach = escape(s:user.s:machine, s:netrw_map_escape) + let mapsafeusermach = escape(((s:user == "")? "" : s:user."@").s:machine, s:netrw_map_escape) nnoremap NetrwRefresh :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) if g:netrw_mousemaps == 1 @@ -5755,23 +6162,31 @@ fun! s:NetrwMaps(islocal) inoremap :he netrw-quickhelp endif - keepj call s:SetRexDir(a:islocal,b:netrw_curdir) + NetrwKeepj call s:SetRexDir(a:islocal,b:netrw_curdir) " call Dret("s:NetrwMaps") endfun " --------------------------------------------------------------------- -" s:NetrwCommands: sets up commands available only in the netrw buffer windows {{{2 +" s:NetrwCommands: sets up commands {{{2 +" If -buffer, the command is only available from within netrw buffers +" Otherwise, the command is available from any window, so long as netrw +" has been used at least once in the session. fun! s:NetrwCommands(islocal) " call Dfunc("s:NetrwCommands(islocal=".a:islocal.")") + com! -nargs=* -complete=file -bang NetrwMB call s:NetrwBookmark(0,) + com! -nargs=* NetrwC call s:NetrwSetChgwin() com! Rexplore if exists("w:netrw_rexlocal")|call s:NetrwRexplore(w:netrw_rexlocal,exists("w:netrw_rexdir")? w:netrw_rexdir : ".")|else|call netrw#ErrorMsg(s:WARNING,"not a former netrw window",79)|endif if a:islocal - com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(1,) + com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(1,) else - com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(0,) + com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(0,) endif - com! -buffer -nargs=? -complete=file MT call s:NetrwMarkTarget() + com! -buffer -nargs=? -complete=file MT call s:NetrwMarkTarget() + " the following two commands are intended to be used for testing only, so I'm not advertising them in the manual + com! -buffer -nargs=0 CRL call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + com! -buffer -nargs=0 CRR call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) " call Dret("s:NetrwCommands") endfun @@ -5964,7 +6379,7 @@ fun! s:NetrwMarkFileCompress(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileCompress") return endif @@ -5992,10 +6407,10 @@ fun! s:NetrwMarkFileCompress(islocal) if a:islocal call system(exe." ".fname) else - keepj call s:RemoteSystem(exe." ".fname) + NetrwKeepj call s:RemoteSystem(exe." ".fname) endif else - keepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) endif endif unlet sfx @@ -6007,13 +6422,13 @@ fun! s:NetrwMarkFileCompress(islocal) call system(netrw#WinPath(g:netrw_compress)." ".shellescape(s:ComposePath(b:netrw_curdir,fname))) else " fname not a compressed file, so compress it - keepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname)) + NetrwKeepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname)) endif endfor " for every file in the marked list call s:NetrwUnmarkList(curbufnr,curdir) - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) endif " call Dret("s:NetrwMarkFileCompress") endfun @@ -6037,14 +6452,14 @@ fun! s:NetrwMarkFileCopy(islocal,...) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileCopy") return endif " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) if !exists("s:netrwmftgt") - keepj call netrw#ErrorMsg(s:ERROR,"your marked file target is empty! (:help netrw-mt)",67) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif @@ -6063,14 +6478,17 @@ fun! s:NetrwMarkFileCopy(islocal,...) if simplify(s:netrwmftgt) == simplify(b:netrw_curdir) if len(s:netrwmarkfilelist_{bufnr('%')}) == 1 " only one marked file +" call Decho("case: only one marked file") let args = shellescape(b:netrw_curdir."/".s:netrwmarkfilelist_{bufnr('%')}[0]) let oldname = s:netrwmarkfilelist_{bufnr('%')}[0] elseif a:0 == 1 +" call Decho("case: handling one input argument") " this happens when the next case was used to recursively call s:NetrwMarkFileCopy() let args = shellescape(b:netrw_curdir."/".a:1) let oldname = a:1 else " copy multiple marked files inside the same directory +" call Decho("case: handling a multiple marked files") let s:recursive= 1 for oldname in s:netrwmarkfilelist_{bufnr("%")} let ret= s:NetrwMarkFileCopy(a:islocal,oldname) @@ -6101,18 +6519,34 @@ fun! s:NetrwMarkFileCopy(islocal,...) let args= substitute(args,'/','\\','g') let tgt = substitute(tgt, '/','\\','g') endif + if args =~ "'"|let args= substitute(args,"'\\(.*\\)'",'\1','')|endif + if tgt =~ "'"|let tgt = substitute(tgt,"'\\(.*\\)'",'\1','') |endif + if isdirectory(args) +" call Decho("args<".args."> is a directory") + let copycmd= g:netrw_localcopydircmd +" call Decho("using copydircmd<".copycmd.">") + if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) + " window's xcopy doesn't copy a directory to a target properly. Instead, it copies a directory's + " contents to a target. One must append the source directory name to the target to get xcopy to + " do the right thing. + let tgt= tgt.'\'.substitute(a:1,'^.*[\\/]','','') +" call Decho("modified tgt for xcopy") + endif + else + let copycmd= g:netrw_localcopycmd + endif if g:netrw_localcopycmd =~ '\s' - let copycmd = substitute(g:netrw_localcopycmd,'\s.*$','','') - let copycmdargs = substitute(g:netrw_localcopycmd,'^.\{-}\(\s.*\)$','\1','') + let copycmd = substitute(copycmd,'\s.*$','','') + let copycmdargs = substitute(copycmd,'^.\{-}\(\s.*\)$','\1','') let copycmd = netrw#WinPath(copycmd).copycmdargs else - let copycmd = netrw#WinPath(g:netrw_localcopycmd) + let copycmd = netrw#WinPath(copycmd) endif " call Decho("args <".args.">") " call Decho("tgt <".tgt.">") " call Decho("copycmd<".copycmd.">") -" call Decho("system(".copycmd." ".args." ".tgt.")") - call system(copycmd." ".args." ".tgt) +" call Decho("system(".copycmd." '".args."' '".tgt."')") + call system(copycmd." '".args."' '".tgt."'") if v:shell_error != 0 call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80) " call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt)) @@ -6122,12 +6556,12 @@ fun! s:NetrwMarkFileCopy(islocal,...) elseif a:islocal && !s:netrwmftgt_islocal " Copy marked files, local directory to remote directory " call Decho("copy from local to remote") - keepj call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) + NetrwKeepj call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) elseif !a:islocal && s:netrwmftgt_islocal " Copy marked files, remote directory to local directory " call Decho("copy from remote to local") - keepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) + NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) elseif !a:islocal && !s:netrwmftgt_islocal " Copy marked files, remote directory to remote directory @@ -6140,7 +6574,7 @@ fun! s:NetrwMarkFileCopy(islocal,...) if exists("*mkdir") call mkdir(tmpdir) else - exe "sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1) + call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) " call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1) ) @@ -6149,15 +6583,15 @@ fun! s:NetrwMarkFileCopy(islocal,...) endif if isdirectory(tmpdir) call s:NetrwLcd(tmpdir) - keepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir) + NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir) let localfiles= map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),'substitute(v:val,"^.*/","","")') - keepj call s:NetrwUpload(localfiles,s:netrwmftgt) + NetrwKeepj call s:NetrwUpload(localfiles,s:netrwmftgt) if getcwd() == tmpdir for fname in s:netrwmarkfilelist_{bufnr('%')} - keepj call s:NetrwDelete(fname) + NetrwKeepj call s:NetrwDelete(fname) endfor call s:NetrwLcd(curdir) - exe "sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1) + call s:NetrwExe("sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80) " call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1) ) @@ -6183,10 +6617,10 @@ fun! s:NetrwMarkFileCopy(islocal,...) call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) endif if a:islocal - keepj call s:NetrwRefreshDir(a:islocal,curdir) + NetrwKeepj call s:NetrwRefreshDir(a:islocal,curdir) endif if g:netrw_fastbrowse <= 1 - keepj call s:LocalBrowseRefresh() + NetrwKeepj call s:LocalBrowseRefresh() endif " call Dret("s:NetrwMarkFileCopy 1") @@ -6204,7 +6638,7 @@ fun! s:NetrwMarkFileDiff(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileDiff") return endif @@ -6217,13 +6651,13 @@ fun! s:NetrwMarkFileDiff(islocal) let cnt= cnt + 1 if cnt == 1 " call Decho("diffthis: fname<".fname.">") - exe "e ".fnameescape(fname) + exe "NetrwKeepj e ".fnameescape(fname) diffthis elseif cnt == 2 || cnt == 3 vsplit wincmd l " call Decho("diffthis: ".fname) - exe "e ".fnameescape(fname) + exe "NetrwKeepj e ".fnameescape(fname) diffthis else break @@ -6246,7 +6680,7 @@ fun! s:NetrwMarkFileEdit(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileEdit") return endif @@ -6298,72 +6732,106 @@ fun! s:NetrwMarkFileQFEL(islocal,qfel) endfun " --------------------------------------------------------------------- -" s:NetrwMarkFileExe: (invoked by mx) execute arbitrary system command on marked files, one at a time {{{2 -" Uses the local marked-file list. -fun! s:NetrwMarkFileExe(islocal) -" call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.")") +" s:NetrwMarkFileExe: (invoked by mx and mX) execute arbitrary system command on marked files {{{2 +" mx enbloc=0: Uses the local marked-file list, applies command to each file individually +" mX enbloc=1: Uses the global marked-file list, applies command to entire list +fun! s:NetrwMarkFileExe(islocal,enbloc) +" call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.",enbloc=".a:enbloc.")") let svpos = netrw#SavePosn() let curdir = b:netrw_curdir let curbufnr = bufnr("%") - " sanity check - if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileExe") - return - endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if a:enbloc == 0 + " individually apply command to files, one at a time + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileExe") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) - if exists("s:netrwmarkfilelist_{curbufnr}") - " get the command - call inputsave() - let cmd= input("Enter command: ","","file") - call inputrestore() -" call Decho("cmd<".cmd.">") - if cmd == "" -" " call Dret("s:NetrwMarkFileExe : early exit, empty command") - return - endif - - " apply command to marked files. Substitute: filename -> % - " If no %, then append a space and the filename to the command - for fname in s:netrwmarkfilelist_{curbufnr} - if a:islocal - if g:netrw_keepdir - let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname))) + if exists("s:netrwmarkfilelist_{curbufnr}") + " get the command + call inputsave() + let cmd= input("Enter command: ","","file") + call inputrestore() +" call Decho("cmd<".cmd.">") + if cmd == "" +" call Dret("s:NetrwMarkFileExe : early exit, empty command") + return endif - else - let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname)) - endif - if cmd =~ '%' - let xcmd= substitute(cmd,'%',fname,'g') - else - let xcmd= cmd.' '.fname - endif - if a:islocal -" call Decho("local: xcmd<".xcmd.">") - let ret= system(xcmd) - else -" call Decho("remote: xcmd<".xcmd.">") - let ret= s:RemoteSystem(xcmd) - endif - if v:shell_error < 0 - keepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54) - break - else - echo ret - endif - endfor + + " apply command to marked files, individually. Substitute: filename -> % + " If no %, then append a space and the filename to the command + for fname in s:netrwmarkfilelist_{curbufnr} + if a:islocal + if g:netrw_keepdir + let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname))) + endif + else + let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname)) + endif + if cmd =~ '%' + let xcmd= substitute(cmd,'%',fname,'g') + else + let xcmd= cmd.' '.fname + endif + if a:islocal +" call Decho("local: xcmd<".xcmd.">") + let ret= system(xcmd) + else +" call Decho("remote: xcmd<".xcmd.">") + let ret= s:RemoteSystem(xcmd) + endif + if v:shell_error < 0 + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54) + break + else + echo ret + endif + endfor " unmark marked file list call s:NetrwUnmarkList(curbufnr,curdir) " refresh the listing - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) else - keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif + + else " apply command to global list of files, en bloc + + call inputsave() + let cmd= input("Enter command: ","","file") + call inputrestore() +" call Decho("cmd<".cmd.">") + if cmd == "" +" call Dret("s:NetrwMarkFileExe : early exit, empty command") + return + endif + if cmd =~ '%' + let cmd= substitute(cmd,'%',join(map(s:netrwmarkfilelist,'shellescape(v:val)'),' '),'g') + else + let cmd= cmd.' '.join(map(s:netrwmarkfilelist,'shellescape(v:val)'),' ') + endif + if a:islocal + call system(cmd) + if v:shell_error < 0 + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"command<".xcmd."> failed, aborting",54) + endif + else + let ret= s:RemoteSystem(cmd) + endif + call s:NetrwUnmarkAll() + + " refresh the listing + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) + + endif " call Dret("s:NetrwMarkFileExe") endfun @@ -6416,17 +6884,17 @@ fun! s:NetrwMarkHideSfx(islocal) endfor " refresh the listing - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) else - keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif " call Dret("s:NetrwMarkHideSfx") endfun " --------------------------------------------------------------------- -" s:NetrwMarkFileVimCmd: (invoked by mX) execute arbitrary vim command on marked files, one at a time {{{2 +" s:NetrwMarkFileVimCmd: (invoked by mv) execute arbitrary vim command on marked files, one at a time {{{2 " Uses the local marked-file list. fun! s:NetrwMarkFileVimCmd(islocal) " call Dfunc("s:NetrwMarkFileVimCmd(islocal=".a:islocal.")") @@ -6436,7 +6904,7 @@ fun! s:NetrwMarkFileVimCmd(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileVimCmd") return endif @@ -6459,13 +6927,13 @@ fun! s:NetrwMarkFileVimCmd(islocal) " call Decho("fname<".fname.">") if a:islocal 1split - exe "sil! keepalt e ".fnameescape(fname) + exe "sil! NetrwKeepj keepalt e ".fnameescape(fname) " call Decho("local<".fname.">: exe ".cmd) exe cmd exe "sil! keepalt wq!" else " call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET") - echo "sorry, \"mX\" not supported yet for remote files" + echo "sorry, \"mv\" not supported yet for remote files" endif endfor @@ -6473,10 +6941,10 @@ fun! s:NetrwMarkFileVimCmd(islocal) call s:NetrwUnmarkList(curbufnr,curdir) " refresh the listing - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) else - keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif " call Dret("s:NetrwMarkFileVimCmd") @@ -6530,10 +6998,10 @@ fun! s:NetrwMarkHideSfx(islocal) endfor " refresh the listing - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) else - keepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif " call Dret("s:NetrwMarkHideSfx") @@ -6575,16 +7043,16 @@ fun! s:NetrwMarkFileGrep(islocal) " use vimgrep for both local and remote " call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist) try - exe "keepj noautocmd vimgrep".patbang." ".pat." ".netrwmarkfilelist + exe "NetrwKeepj noautocmd vimgrep".patbang." ".pat." ".netrwmarkfilelist catch /^Vim\%((\a\+)\)\=:E480/ - keepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pat.">",76) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pat.">",76) " call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pat.">") return endtry echo "(use :cn, :cp to navigate, :Rex to return)" 2match none - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call netrw#RestorePosn(svpos) if exists("nonisi") " original, user-supplied pattern did not begin with a character from isident @@ -6609,14 +7077,14 @@ fun! s:NetrwMarkFileMove(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileMove") return endif " call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) if !exists("s:netrwmftgt") - keepj call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) + NetrwKeepj call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif @@ -6666,7 +7134,7 @@ fun! s:NetrwMarkFileMove(islocal) " call Decho("move from local to remote") " call Decho("copy") let mflist= s:netrwmarkfilelist_{bufnr("%")} - keepj call s:NetrwMarkFileCopy(a:islocal) + NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) " call Decho("remove") for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') @@ -6679,7 +7147,7 @@ fun! s:NetrwMarkFileMove(islocal) " call Decho("move from remote to local") " call Decho("copy") let mflist= s:netrwmarkfilelist_{bufnr("%")} - keepj call s:NetrwMarkFileCopy(a:islocal) + NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) " call Decho("remove") for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') @@ -6692,7 +7160,7 @@ fun! s:NetrwMarkFileMove(islocal) " call Decho("move from remote to remote") " call Decho("copy") let mflist= s:netrwmarkfilelist_{bufnr("%")} - keepj call s:NetrwMarkFileCopy(a:islocal) + NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) " call Decho("remove") for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') @@ -6712,15 +7180,15 @@ fun! s:NetrwMarkFileMove(islocal) " refresh buffers if !s:netrwmftgt_islocal " call Decho("refresh netrwmftgt<".s:netrwmftgt.">") - keepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) + NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) endif if a:islocal " call Decho("refresh b:netrw_curdir<".b:netrw_curdir.">") - keepj call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) + NetrwKeepj call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) endif if g:netrw_fastbrowse <= 1 " call Decho("since g:netrw_fastbrowse=".g:netrw_fastbrowse.", perform shell cmd refresh") - keepj call s:LocalBrowseRefresh() + NetrwKeepj call s:LocalBrowseRefresh() endif " call Dret("s:NetrwMarkFileMove") @@ -6735,7 +7203,7 @@ fun! s:NetrwMarkFilePrint(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFilePrint") return endif @@ -6755,7 +7223,7 @@ fun! s:NetrwMarkFilePrint(islocal) 1split " the autocmds will handle both local and remote files " call Decho("exe sil e ".escape(fname,' ')) - exe "sil e ".fnameescape(fname) + exe "sil NetrwKeepj e ".fnameescape(fname) " call Decho("hardcopy") hardcopy q @@ -6788,7 +7256,7 @@ fun! s:NetrwMarkFileRegexp(islocal) " mark the list of files for fname in filelist " call Decho("fname<".fname.">") - keepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) + NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) endfor else @@ -6797,38 +7265,38 @@ fun! s:NetrwMarkFileRegexp(islocal) " convert displayed listing into a filelist let eikeep = &ei let areg = @a - sil keepj %y a + sil NetrwKeepj %y a setl ei=all ma " call Decho("setl ei=all ma") 1split - keepj call s:NetrwEnew() - keepj call s:NetrwSafeOptions() - sil keepj norm! "ap - keepj 2 + NetrwKeepj call s:NetrwEnew() + NetrwKeepj call s:NetrwSafeOptions() + sil NetrwKeepj norm! "ap + NetrwKeepj 2 let bannercnt= search('^" =====','W') - exe "sil keepj 1,".bannercnt."d" + exe "sil NetrwKeepj 1,".bannercnt."d" setl bt=nofile if g:netrw_liststyle == s:LONGLIST - sil keepj %s/\s\{2,}\S.*$//e + sil NetrwKeepj %s/\s\{2,}\S.*$//e call histdel("/",-1) elseif g:netrw_liststyle == s:WIDELIST - sil keepj %s/\s\{2,}/\r/ge + sil NetrwKeepj %s/\s\{2,}/\r/ge call histdel("/",-1) elseif g:netrw_liststyle == s:TREELIST - exe 'sil keepj %s/^'.s:treedepthstring.' //e' - sil! keepj g/^ .*$/d + exe 'sil NetrwKeepj %s/^'.s:treedepthstring.' //e' + sil! NetrwKeepj g/^ .*$/d call histdel("/",-1) call histdel("/",-1) endif " convert regexp into the more usual glob-style format let regexp= substitute(regexp,'\*','.*','g') " call Decho("regexp<".regexp.">") - exe "sil! keepj v/".escape(regexp,'/')."/d" + exe "sil! NetrwKeepj v/".escape(regexp,'/')."/d" call histdel("/",-1) let filelist= getline(1,line("$")) q! for filename in filelist - keepj call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','','')) + NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','','')) endfor unlet filelist let @a = areg @@ -6848,7 +7316,7 @@ fun! s:NetrwMarkFileSource(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileSource") return endif @@ -6885,7 +7353,7 @@ fun! s:NetrwMarkFileTag(islocal) " sanity check if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) - keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) + NetrwKeepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileTag") return endif @@ -6908,10 +7376,10 @@ fun! s:NetrwMarkFileTag(islocal) call netrw#Obtain(a:islocal,"tags") let curdir= b:netrw_curdir 1split - e tags + NetrwKeepj e tags let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','') " call Decho("curdir<".curdir."> path<".path.">") - exe 'keepj %s/\t\(\S\+\)\t/\t'.escape(path,"/\n\r\\").'\1\t/e' + exe 'NetrwKeepj %s/\t\(\S\+\)\t/\t'.escape(path,"/\n\r\\").'\1\t/e' call histdel("/",-1) wq! endif @@ -6990,7 +7458,7 @@ fun! s:NetrwMarkFileTgt(islocal) call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) call netrw#RestorePosn(svpos) if !hadtgt - sil! keepj norm! j + sil! NetrwKeepj norm! j endif " call Dret("s:NetrwMarkFileTgt : netrwmftgt<".(exists("s:netrwmftgt")? s:netrwmftgt : "").">") @@ -7011,7 +7479,7 @@ fun! s:NetrwOpenFile(islocal) endif let g:netrw_quiet = 1 if b:netrw_curdir =~ '/$' - exe "e ".fnameescape(b:netrw_curdir.fname) + exe "NetrwKeepj e ".fnameescape(b:netrw_curdir.fname) else exe "e ".fnameescape(b:netrw_curdir."/".fname) endif @@ -7022,7 +7490,7 @@ fun! s:NetrwOpenFile(islocal) endif endif else - exe "e ".fnameescape(fname) + exe "NetrwKeepj e ".fnameescape(fname) endif let @@= ykeep " call Dret("s:NetrwOpenFile") @@ -7149,6 +7617,7 @@ fun! s:NetrwMenu(domenu) exe 'sil! menu '.g:NetrwMenuPriority.'.11.2 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Preview\ File/Directoryp p' exe 'sil! menu '.g:NetrwMenuPriority.'.11.3 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Previous\ WindowP P' exe 'sil! menu '.g:NetrwMenuPriority.'.11.4 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Windowo o' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Tabt t' exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Vertical\ Windowv v' exe 'sil! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore ' exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only):Explore\ */ :Explore */' @@ -7249,7 +7718,7 @@ fun! s:NetrwPrevWinOpen(islocal) let lastwinnr = winnr("$") let curword = s:NetrwGetWord() let choice = 0 - let s:treedir = s:NetrwTreeDir() + let s:treedir = s:NetrwTreeDir(a:islocal) let curdir = s:treedir " call Decho("winnr($)#".lastwinnr." curword<".curword.">") @@ -7258,10 +7727,12 @@ fun! s:NetrwPrevWinOpen(islocal) " if only one window, open a new one first " call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")") if g:netrw_preview + " vertically split preview window let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize " call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s") exe (g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s" else + " horizontally split preview window let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" @@ -7270,7 +7741,7 @@ fun! s:NetrwPrevWinOpen(islocal) " call Decho("did split") else - keepj call s:SaveBufVars() + NetrwKeepj call s:SaveBufVars() let eikeep= &ei setl ei=all wincmd p @@ -7284,7 +7755,7 @@ fun! s:NetrwPrevWinOpen(islocal) let prevbufname = bufname("%") let prevmod = &mod let bnrcnt = 0 - keepj call s:RestoreBufVars() + NetrwKeepj call s:RestoreBufVars() " call Decho("after wincmd p: win#".winnr()." win($)#".winnr("$")." origwin#".origwin." &mod=".&mod." bufname(%)<".bufname("%")."> prevbufnr=".prevbufnr) " if the previous window's buffer has been changed (ie. its modified flag is set), @@ -7376,7 +7847,7 @@ fun! s:NetrwUpload(fname,tgt,...) " call Decho("handle uploading a single file via NetWrite") 1split " call Decho("exe e ".fnameescape(a:fname)) - exe "e ".fnameescape(a:fname) + exe "NetrwKeepj e ".fnameescape(a:fname) " call Decho("now locally editing<".expand("%").">, has ".line("$")." lines") if a:tgt =~ '/$' let wfname= substitute(a:fname,'^.*/','','') @@ -7404,8 +7875,7 @@ fun! s:NetrwUpload(fname,tgt,...) endif let machine = substitute(a:tgt,'^scp://\([^/:]\+\).*$','\1','') let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','') -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1)) call s:NetrwLcd(curdir) elseif a:tgt =~ '^ftp:' @@ -7414,41 +7884,39 @@ fun! s:NetrwUpload(fname,tgt,...) if b:netrw_method == 2 " handle uploading a list of files via ftp+.netrc let netrw_fname = b:netrw_fname - sil keepj new + sil NetrwKeepj new " call Decho("filter input window#".winnr()) - keepj put =g:netrw_ftpmode + NetrwKeepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$')) if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$')) endif - keepj call setline(line("$")+1,'lcd "'.fromdir.'"') + NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"') " call Decho("filter input: ".getline('$')) if tgtdir == "" let tgtdir= '/' endif - keepj call setline(line("$")+1,'cd "'.tgtdir.'"') + NetrwKeepj call setline(line("$")+1,'cd "'.tgtdir.'"') " call Decho("filter input: ".getline('$')) for fname in a:fname - keepj call setline(line("$")+1,'put "'.fname.'"') + NetrwKeepj call setline(line("$")+1,'put "'.fname.'"') " call Decho("filter input: ".getline('$')) endfor if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: ".s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) else " call Decho("filter input window#".winnr()) -" call Decho("executing: ".s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - sil keepj g/Local directory now/d + sil NetrwKeepj g/Local directory now/d call histdel("/",-1) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' call netrw#ErrorMsg(s:ERROR,getline(1),14) @@ -7459,47 +7927,47 @@ fun! s:NetrwUpload(fname,tgt,...) elseif b:netrw_method == 3 " upload with ftp + machine, id, passwd, and fname (ie. no .netrc) let netrw_fname= b:netrw_fname - keepj call s:SaveBufVars()|sil keepj new|keepj call s:RestoreBufVars() + NetrwKeepj call s:SaveBufVars()|sil NetrwKeepj new|NetrwKeepj call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port " call Decho("filter input: ".getline('$')) else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine " call Decho("filter input: ".getline('$')) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid + NetrwKeepj put =g:netrw_uid " call Decho("filter input: ".getline('$')) if exists("s:netrw_passwd") - keepj call setline(line("$")+1,'"'.s:netrw_passwd.'"') + NetrwKeepj call setline(line("$")+1,'"'.s:netrw_passwd.'"') endif " call Decho("filter input: ".getline('$')) elseif exists("s:netrw_passwd") - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' " call Decho("filter input: ".getline('$')) endif endif - keepj call setline(line("$")+1,'lcd "'.fromdir.'"') + NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"') " call Decho("filter input: ".getline('$')) if exists("b:netrw_fname") && b:netrw_fname != "" - keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') + NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') " call Decho("filter input: ".getline('$')) endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('$')) endif for fname in a:fname - keepj call setline(line("$")+1,'put "'.fname.'"') + NetrwKeepj call setline(line("$")+1,'put "'.fname.'"') " call Decho("filter input: ".getline('$')) endfor @@ -7507,11 +7975,10 @@ fun! s:NetrwUpload(fname,tgt,...) " -i : turns off interactive prompting from ftp " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: ".s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + NetrwKeepj norm! 1Gdd + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) - sil keepj g/Local directory now/d + sil NetrwKeepj g/Local directory now/d call histdel("/",-1) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' let debugkeep= &debug @@ -7539,8 +8006,8 @@ endfun fun! s:NetrwPreview(path) range " call Dfunc("NetrwPreview(path<".a:path.">)") let ykeep= @@ - keepj call s:NetrwOptionSave("s:") - keepj call s:NetrwSafeOptions() + NetrwKeepj call s:NetrwOptionSave("s:") + NetrwKeepj call s:NetrwSafeOptions() if has("quickfix") if !isdirectory(a:path) if g:netrw_preview && !g:netrw_alto @@ -7553,12 +8020,12 @@ fun! s:NetrwPreview(path) range let &pvh= pvhkeep endif elseif !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"sorry, cannot preview a directory such as <".a:path.">",38) endif elseif !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39) endif - keepj call s:NetrwOptionRestore("s:") + NetrwKeepj call s:NetrwOptionRestore("s:") let @@= ykeep " call Dret("NetrwPreview") endfun @@ -7566,7 +8033,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwRefresh: {{{2 fun! s:NetrwRefresh(islocal,dirname) -" call Dfunc("NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") hide=".g:netrw_hide." sortdir=".g:netrw_sort_direction) +" call Dfunc("s:NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") hide=".g:netrw_hide." sortdir=".g:netrw_sort_direction) " at the current time (Mar 19, 2007) all calls to NetrwRefresh() call NetrwBrowseChgDir() first. setl ma noro " call Decho("setl ma noro") @@ -7577,15 +8044,15 @@ fun! s:NetrwRefresh(islocal,dirname) let screenposn = netrw#SavePosn() " call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">") " call Decho("clearing buffer prior to refresh") - sil! keepj %d + sil! NetrwKeepj %d if a:islocal - keepj call netrw#LocalBrowseCheck(a:dirname) + NetrwKeepj call netrw#LocalBrowseCheck(a:dirname) else - keepj call s:NetrwBrowse(a:islocal,a:dirname) + NetrwKeepj call s:NetrwBrowse(a:islocal,a:dirname) endif " restore position - keepj call netrw#RestorePosn(screenposn) + NetrwKeepj call netrw#RestorePosn(screenposn) " restore file marks if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" @@ -7598,7 +8065,7 @@ fun! s:NetrwRefresh(islocal,dirname) " restore let @@= ykeep -" call Dret("NetrwRefresh") +" call Dret("s:NetrwRefresh") endfun " --------------------------------------------------------------------- @@ -7618,7 +8085,7 @@ fun! s:NetrwRefreshDir(islocal,dirname) let curwin= winnr() " call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")") exe tgtwin."wincmd w" - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) exe curwin."wincmd w" elseif bufnr(a:dirname) > 0 @@ -7629,7 +8096,7 @@ fun! s:NetrwRefreshDir(islocal,dirname) elseif g:netrw_fastbrowse <= 1 " call Decho("medium-speed mode: refresh local buffers only") - keepj call s:LocalBrowseRefresh() + NetrwKeepj call s:LocalBrowseRefresh() endif " call Dret("s:NetrwRefreshDir") endfun @@ -7639,14 +8106,21 @@ endfun " window number to do its editing in. " Supports [count]C where the count, if present, is used to specify " a window to use for editing via the mapping. -fun! s:NetrwSetChgwin() +fun! s:NetrwSetChgwin(...) " call Dfunc("s:NetrwSetChgwin() v:count=".v:count) - if v:count > 0 + if a:0 > 0 +" call Decho("a:1<".a:1.">") + if a:1 == "" " :NetrwC win# + let g:netrw_chgwin= winnr() + else " :NetrwC + let g:netrw_chgwin= a:1 + endif + elseif v:count > 0 " [count]C let g:netrw_chgwin= v:count - else + else " C let g:netrw_chgwin= winnr() endif -" call Dret("s:NetrwSetChgwin") +" call Dret("s:NetrwSetChgwin : g:netrw_chgwin=".g:netrw_chgwin) endfun " --------------------------------------------------------------------- @@ -7696,18 +8170,18 @@ fun! s:NetrwSetSort() if seq == '*' let starpriority= spriority else - exe 'sil keepj '.w:netrw_bannercnt.',$g/'.seq.'/s/^/'.spriority.'/' + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/'.seq.'/s/^/'.spriority.'/' call histdel("/",-1) " sometimes multiple sorting patterns will match the same file or directory. " The following substitute is intended to remove the excess matches. - exe 'sil keepj '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e' - keepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e' + NetrwKeepj call histdel("/",-1) endif let priority = priority + 1 endwhile if exists("starpriority") - exe 'sil keepj '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/e' - keepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/e' + NetrwKeepj call histdel("/",-1) endif " Following line associated with priority -- items that satisfy a priority @@ -7716,8 +8190,8 @@ fun! s:NetrwSetSort() " priority pattern needs to be retained. So, at this point, these excess " priority prefixes need to be removed, but not directories that happen to " be just digits themselves. - exe 'sil keepj '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e' - keepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e' + NetrwKeepj call histdel("/",-1) let @@= ykeep " call Dret("SetSort") @@ -7758,13 +8232,13 @@ endfun " s:NetrwSortStyle: change sorting style (name - time - size) and refresh display {{{2 fun! s:NetrwSortStyle(islocal) " call Dfunc("s:NetrwSortStyle(islocal=".a:islocal.") netrw_sort_by<".g:netrw_sort_by.">") - keepj call s:NetrwSaveWordPosn() + NetrwKeepj call s:NetrwSaveWordPosn() let svpos= netrw#SavePosn() let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name' - keepj norm! 0 - keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj norm! 0 + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) " call Dret("s:NetrwSortStyle : netrw_sort_by<".g:netrw_sort_by.">") endfun @@ -7790,8 +8264,8 @@ fun! s:NetrwSplit(mode) " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" let s:didsplit= 1 - keepj call s:RestoreWinVars() - keepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) unlet s:didsplit elseif a:mode == 1 @@ -7800,8 +8274,8 @@ fun! s:NetrwSplit(mode) " call Decho("tabnew") tabnew let s:didsplit= 1 - keepj call s:RestoreWinVars() - keepj call s:NetrwBrowse(0,newdir) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call s:NetrwBrowse(0,newdir) unlet s:didsplit elseif a:mode == 2 @@ -7811,8 +8285,8 @@ fun! s:NetrwSplit(mode) " call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v") exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" let s:didsplit= 1 - keepj call s:RestoreWinVars() - keepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,s:NetrwGetWord())) unlet s:didsplit elseif a:mode == 3 @@ -7822,8 +8296,8 @@ fun! s:NetrwSplit(mode) " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" let s:didsplit= 1 - keepj call s:RestoreWinVars() - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) unlet s:didsplit elseif a:mode == 4 @@ -7833,23 +8307,23 @@ fun! s:NetrwSplit(mode) let netrw_winnr = winnr() let netrw_line = line(".") let netrw_col = virtcol(".") - keepj norm! H0 + NetrwKeepj norm! H0 let netrw_hline = line(".") setl ei=all - exe "keepj norm! ".netrw_hline."G0z\" - exe "keepj norm! ".netrw_line."G0".netrw_col."\" + exe "NetrwKeepj norm! ".netrw_hline."G0z\" + exe "NetrwKeepj norm! ".netrw_line."G0".netrw_col."\" let &ei= eikeep - let netrw_curdir= s:NetrwTreeDir() + let netrw_curdir= s:NetrwTreeDir(0) " call Decho("tabnew") tabnew let b:netrw_curdir = netrw_curdir let s:didsplit = 1 - keepj call s:RestoreWinVars() - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,cursorword)) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,cursorword)) if &ft == "netrw" setl ei=all - exe "keepj norm! ".netrw_hline."G0z\" - exe "keepj norm! ".netrw_line."G0".netrw_col."\" + exe "NetrwKeepj norm! ".netrw_hline."G0z\" + exe "NetrwKeepj norm! ".netrw_line."G0".netrw_col."\" let &ei= eikeep endif unlet s:didsplit @@ -7861,12 +8335,13 @@ fun! s:NetrwSplit(mode) " call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v") exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" let s:didsplit= 1 - keepj call s:RestoreWinVars() - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + NetrwKeepj call s:RestoreWinVars() + NetrwKeepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) + "call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) unlet s:didsplit else - keepj call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"(NetrwSplit) unsupported mode=".a:mode,45) endif let @@= ykeep @@ -7926,8 +8401,8 @@ endfun " --------------------------------------------------------------------- " s:NetrwTreeDir: determine tree directory given current cursor position {{{2 " (full path directory with trailing slash returned) -fun! s:NetrwTreeDir() -" call Dfunc("s:NetrwTreeDir() getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) +fun! s:NetrwTreeDir(islocal) +" call Dfunc("s:NetrwTreeDir(islocal=".a:islocal.") getline(".line(".").")"."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) if exists("s:treedir") " s:NetrwPrevWinOpen opens a "previous" window -- and thus needs to and does call s:NetrwTreeDir early @@ -7948,7 +8423,8 @@ fun! s:NetrwTreeDir() " call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">") " extract tree directory if on a line specifying a subdirectory (ie. ends with "/") - if getline('.') =~ '/$' + let curline= substitute(getline('.'),"\t -->.*$",'','') + if curline =~ '/$' " call Decho("extract tree subdirectory from current line") let treedir= substitute(getline('.'),'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') " call Decho("treedir<".treedir.">") @@ -7958,24 +8434,38 @@ fun! s:NetrwTreeDir() endif " detect user attempting to close treeroot -" call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") -" call Decho("getline(".line(".").")<".getline('.').'> '.((getline('.') =~ '^'.s:treedepthstring)? '=~' : '!~').' ^'.s:treedepthstring) - if getline('.') !~ '^'.s:treedepthstring && getline('.') != '..' -" call Decho("user may have attempted to close treeroot") +" call Decho("check if user is attempting to close treeroot") +" call Decho(".win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") +" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~ '^'.s:treedepthstring)? '=~' : '!~').' ^'.s:treedepthstring) + if curline !~ '^'.s:treedepthstring && getline('.') != '..' +" call Decho(".user may have attempted to close treeroot") " now force a refresh -" call Decho("clear buffer<".expand("%")."> with :%d") - sil! keepj %d +" call Decho(".force refresh: clear buffer<".expand("%")."> with :%d") + sil! NetrwKeepj %d " call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") return b:netrw_curdir " else " Decho -" call Decho("user did not attempt to close treeroot") +" call Decho(".user did not attempt to close treeroot") endif - let treedir = s:NetrwTreePath(w:netrw_treetop) +" call Decho("islocal=".a:islocal." curline<".curline.">") +" call Decho("after subst<".substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)$','\1','').">") + let potentialdir= substitute(curline,'^'.s:treedepthstring.'* \(.*\)@$','\1','') +" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir)) + + if a:islocal && curline =~ '@$' && isdirectory(potentialdir) + let newdir = w:netrw_treetop.'/'.potentialdir + let treedir = s:NetrwTreePath(newdir) + let w:netrw_treetop = newdir +" call Decho("newdir <".newdir.">") + else + let treedir = s:NetrwTreePath(w:netrw_treetop) + endif endif " sanity maintenance: keep those //s away... let treedir= substitute(treedir,'//$','/','') +" call Decho("treedir<".treedir.">") " call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") return treedir @@ -8022,13 +8512,13 @@ fun! s:NetrwTreeDisplay(dir,depth) " call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">") if entry =~ '/$' && has_key(w:netrw_treedict,direntry) " call Decho("<".direntry."> is a key in treedict - display subtree for it") - keepj call s:NetrwTreeDisplay(direntry,depth) + NetrwKeepj call s:NetrwTreeDisplay(direntry,depth) elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') " call Decho("<".direntry."/> is a key in treedict - display subtree for it") - keepj call s:NetrwTreeDisplay(direntry.'/',depth) + NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth) else " call Decho("<".entry."> is not a key in treedict (no subtree)") - sil! keepj call setline(line("$")+1,depth.entry) + sil! NetrwKeepj call setline(line("$")+1,depth.entry) endif endfor @@ -8062,10 +8552,10 @@ fun! s:NetrwTreeListing(dirname) " update the directory listing for the current directory " call Decho("updating dictionary with ".a:dirname.":[..directory listing..]") " call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$")) - exe "sil! keepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d' + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d' let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$")) " call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname])) - exe "sil! keepj ".w:netrw_bannercnt.",$d" + exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d" " if past banner, record word if exists("w:netrw_bannercnt") && line(".") > w:netrw_bannercnt @@ -8077,7 +8567,7 @@ fun! s:NetrwTreeListing(dirname) " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") " display from treetop on down - keepj call s:NetrwTreeDisplay(w:netrw_treetop,"") + NetrwKeepj call s:NetrwTreeDisplay(w:netrw_treetop,"") " call Decho("s:NetrwTreeDisplay) setl noma nomod ro") " remove any blank line remaining as line#1 (happens in treelisting mode with banner suppressed) @@ -8145,8 +8635,8 @@ fun! s:NetrwWideListing() " call Decho("setl ma noro") let b:netrw_cpf= 0 if line("$") >= w:netrw_bannercnt - exe 'sil keepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' - keepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' + NetrwKeepj call histdel("/",-1) else " call Dret("NetrwWideListing") return @@ -8162,8 +8652,8 @@ fun! s:NetrwWideListing() " call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl) " make wide display - exe 'sil keepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'s",submatch(0)),"\\")/' - keepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'s",submatch(0)),"\\")/' + NetrwKeepj call histdel("/",-1) let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl let newcolstart = w:netrw_bannercnt + fpc let newcolend = newcolstart + fpc - 1 @@ -8176,20 +8666,20 @@ fun! s:NetrwWideListing() let newcolqty= newcolend - newcolstart exe newcolstart if newcolqty == 0 - exe "sil! keepj norm! 0\$hx".w:netrw_bannercnt."G$p" + exe "sil! NetrwKeepj norm! 0\$hx".w:netrw_bannercnt."G$p" else - exe "sil! keepj norm! 0\".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p' + exe "sil! NetrwKeepj norm! 0\".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p' endif - exe "sil! keepj ".newcolstart.','.newcolend.'d' - exe 'sil! keepj '.w:netrw_bannercnt + exe "sil! NetrwKeepj ".newcolstart.','.newcolend.'d' + exe 'sil! NetrwKeepj '.w:netrw_bannercnt endwhile if has("clipboard") sil! let @*= keepregstar endif - exe "sil! keepj ".w:netrw_bannercnt.',$s/\s\+$//e' - keepj call histdel("/",-1) - exe "nmap w /^\\\\|\\s\\s\\zs\\S/\" - exe "nmap b ?^\\\\|\\s\\s\\zs\\S?\" + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/\s\+$//e' + NetrwKeepj call histdel("/",-1) + exe 'nno w :call search(''^.\\|\s\s\zs\S'',''W'')'."\" + exe 'nno b :call search(''^.\\|\s\s\zs\S'',''bW'')'."\" " call Decho("NetrwWideListing) setl noma nomod ro") exe "setl ".g:netrw_bufsettings " call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") @@ -8213,18 +8703,10 @@ fun! s:PerformListing(islocal) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)") " set up syntax highlighting {{{3 -" call Decho("set up syntax highlighting") - if has("syntax") - if !exists("g:syntax_on") || !g:syntax_on -" call Decho("but g:syntax_on".(exists("g:syntax_on")? "=".g:syntax_on : "")) - setl ft= - elseif &ft != "netrw" -" call Decho("setl ft=netrw") - setl ft=netrw - endif - endif +" call Decho("set up syntax highlighting (ie. setl ft=netrw)") + sil! setl ft=netrw - keepj call s:NetrwSafeOptions() + NetrwKeepj call s:NetrwSafeOptions() setl noro ma " call Decho("setl noro ma bh=".&bh) @@ -8236,26 +8718,26 @@ fun! s:PerformListing(islocal) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh for tree listings " call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d") - sil! keepj %d + sil! NetrwKeepj %d endif " save current directory on directory history list - keepj call s:NetrwBookHistHandler(3,b:netrw_curdir) + NetrwKeepj call s:NetrwBookHistHandler(3,b:netrw_curdir) " Set up the banner {{{3 if g:netrw_banner " call Decho("set up banner") - keepj call setline(1,'" ============================================================================') - keepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') + NetrwKeepj call setline(1,'" ============================================================================') + NetrwKeepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') if exists("g:netrw_bannerbackslash") && g:netrw_bannerbackslash - keepj call setline(3,'" '.substitute(b:netrw_curdir,'/','\\','g')) + NetrwKeepj call setline(3,'" '.substitute(b:netrw_curdir,'/','\\','g')) else - keepj call setline(3,'" '.b:netrw_curdir) + NetrwKeepj call setline(3,'" '.b:netrw_curdir) endif let w:netrw_bannercnt= 3 - keepj exe "sil! keepj ".w:netrw_bannercnt + NetrwKeepj exe "sil! NetrwKeepj ".w:netrw_bannercnt else - keepj 1 + NetrwKeepj 1 let w:netrw_bannercnt= 1 endif " call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." win#".winnr()) @@ -8271,16 +8753,16 @@ fun! s:PerformListing(islocal) if g:netrw_sort_by =~ "^n" " call Decho("directories will be sorted by name") " sorted by name - keepj put ='\" Sorted by '.sortby - keepj put ='\" Sort sequence: '.g:netrw_sort_sequence + NetrwKeepj put ='\" Sorted by '.sortby + NetrwKeepj put ='\" Sort sequence: '.g:netrw_sort_sequence let w:netrw_bannercnt= w:netrw_bannercnt + 2 else " call Decho("directories will be sorted by size or time") " sorted by size or date - keepj put ='\" Sorted by '.sortby + NetrwKeepj put ='\" Sorted by '.sortby let w:netrw_bannercnt= w:netrw_bannercnt + 1 endif - exe "sil! keepj ".w:netrw_bannercnt + exe "sil! NetrwKeepj ".w:netrw_bannercnt " else " Decho " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") endif @@ -8289,17 +8771,17 @@ fun! s:PerformListing(islocal) if g:netrw_banner if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") " call Decho("show copy/move target<".s:netrwmftgt.">") - keepj put ='' + NetrwKeepj put ='' if s:netrwmftgt_islocal - sil! keepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') + sil! NetrwKeepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') else - sil! keepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (remote)') + sil! NetrwKeepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (remote)') endif let w:netrw_bannercnt= w:netrw_bannercnt + 1 else " call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt") endif - exe "sil! keepj ".w:netrw_bannercnt + exe "sil! NetrwKeepj ".w:netrw_bannercnt endif " Hiding... -or- Showing... {{{3 @@ -8307,20 +8789,20 @@ fun! s:PerformListing(islocal) " call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)") if g:netrw_list_hide != "" && g:netrw_hide if g:netrw_hide == 1 - keepj put ='\" Hiding: '.g:netrw_list_hide + NetrwKeepj put ='\" Hiding: '.g:netrw_list_hide else - keepj put ='\" Showing: '.g:netrw_list_hide + NetrwKeepj put ='\" Showing: '.g:netrw_list_hide endif let w:netrw_bannercnt= w:netrw_bannercnt + 1 endif - exe "keepjumps ".w:netrw_bannercnt + exe "NetrwKeepj ".w:netrw_bannercnt " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") let quickhelp = g:netrw_quickhelp%len(s:QuickHelp) " call Decho("quickhelp =".quickhelp) - keepj put ='\" Quick Help: :help '.s:QuickHelp[quickhelp] + NetrwKeepj put ='\" Quick Help: :help '.s:QuickHelp[quickhelp] " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") - keepj put ='\" ==============================================================================' + NetrwKeepj put ='\" ==============================================================================' let w:netrw_bannercnt= w:netrw_bannercnt + 2 " else " Decho " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") @@ -8329,7 +8811,7 @@ fun! s:PerformListing(islocal) " bannercnt should index the line just after the banner if g:netrw_banner let w:netrw_bannercnt= w:netrw_bannercnt + 1 - exe "sil! keepj ".w:netrw_bannercnt + exe "sil! NetrwKeepj ".w:netrw_bannercnt " call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) " else " Decho " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") @@ -8338,9 +8820,9 @@ fun! s:PerformListing(islocal) " get list of files " call Decho("Get list of files - islocal=".a:islocal) if a:islocal - keepj call s:LocalListing() + NetrwKeepj call s:LocalListing() else " remote - keepj let badresult= s:NetrwRemoteListing() + NetrwKeepj let badresult= s:NetrwRemoteListing() if badresult " call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") " call Dret("s:PerformListing : error detected by NetrwRemoteListing") @@ -8359,49 +8841,49 @@ fun! s:PerformListing(islocal) " call Decho("manipulate directory listing (hide)") " call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") if g:netrw_hide && g:netrw_list_hide != "" - keepj call s:NetrwListHide() + NetrwKeepj call s:NetrwListHide() endif if !g:netrw_banner || line("$") >= w:netrw_bannercnt " call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">") if g:netrw_sort_by =~ "^n" " sort by name - keepj call s:NetrwSetSort() + NetrwKeepj call s:NetrwSetSort() if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")") if g:netrw_sort_direction =~ 'n' " normal direction sorting - exe 'sil keepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else " reverse direction sorting - exe 'sil keepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options endif endif " remove priority pattern prefix " call Decho("remove priority pattern prefix") - exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' - keepj call histdel("/",-1) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' + NetrwKeepj call histdel("/",-1) elseif a:islocal if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction) if g:netrw_sort_direction =~ 'n' -" call Decho('exe sil keepjumps '.w:netrw_bannercnt.',$sort') - exe 'sil! keepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options +" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort') + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else -" call Decho('exe sil keepjumps '.w:netrw_bannercnt.',$sort!') - exe 'sil! keepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options +" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort!') + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options endif - exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e' - keepj call histdel("/",-1) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e' + NetrwKeepj call histdel("/",-1) endif endif elseif g:netrw_sort_direction =~ 'r' " call Decho('(s:PerformListing) reverse the sorted listing') if !g:netrw_banner || w:netrw_bannercnt < line('$') - exe 'sil! keepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt call histdel("/",-1) endif endif @@ -8411,16 +8893,21 @@ fun! s:PerformListing(islocal) " convert to wide/tree listing {{{3 " call Decho("modify display if wide/tree listing style") " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#1)") - keepj call s:NetrwWideListing() + NetrwKeepj call s:NetrwWideListing() " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#2)") - keepj call s:NetrwTreeListing(b:netrw_curdir) + NetrwKeepj call s:NetrwTreeListing(b:netrw_curdir) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#3)") + " resolve symbolic links if local and (thin or tree) + if a:islocal && (w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:TREELIST) + g/@$/call s:ShowLink() + endif + if exists("w:netrw_bannercnt") && (line("$") > w:netrw_bannercnt || !g:netrw_banner) " place cursor on the top-left corner of the file listing " call Decho("place cursor on top-left corner of file listing") - exe 'sil! keepj '.w:netrw_bannercnt - sil! keepj norm! 0 + exe 'sil! NetrwKeepj '.w:netrw_bannercnt + sil! NetrwKeepj norm! 0 endif " record previous current directory @@ -8429,9 +8916,9 @@ fun! s:PerformListing(islocal) " save certain window-oriented variables into buffer-oriented variables {{{3 " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#4)") - keepj call s:SetBufWinVars() + NetrwKeepj call s:SetBufWinVars() " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#5)") - keepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionRestore("w:") " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#6)") " set display to netrw display settings @@ -8445,7 +8932,7 @@ fun! s:PerformListing(islocal) if exists("s:treecurpos") " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#8)") - keepj call netrw#RestorePosn(s:treecurpos) + NetrwKeepj call netrw#RestorePosn(s:treecurpos) unlet s:treecurpos endif @@ -8526,27 +9013,27 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " clear off any older non-banner lines " {{{3 " note that w:netrw_bannercnt indexes the line after the banner -" call Decho('exe sil! keepjumps '.w:netrw_bannercnt.",$d (clear off old non-banner lines)") - exe "sil! keepjumps ".w:netrw_bannercnt.",$d" +" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d (clear off old non-banner lines)") + exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d" "......................................... if w:netrw_method == 2 || w:netrw_method == 5 " {{{3 " ftp + <.netrc>: Method #2 if a:path != "" - keepj put ='cd \"'.a:path.'\"' + NetrwKeepj put ='cd \"'.a:path.'\"' endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('.')) endif - keepj call setline(line("$")+1,a:listcmd) -" exe "keepjumps ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' + NetrwKeepj call setline(line("$")+1,a:listcmd) +" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' if exists("g:netrw_port") && g:netrw_port != "" " call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer." keepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) else " call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer." keepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) + exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) endif "......................................... @@ -8554,9 +9041,9 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " ftp + machine,id,passwd,filename: Method #3 setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port + NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port else - keepj put ='open '.g:netrw_machine + NetrwKeepj put ='open '.g:netrw_machine endif " handle userid and password @@ -8567,23 +9054,23 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid + NetrwKeepj put =g:netrw_uid if exists("s:netrw_passwd") && s:netrw_passwd != "" - keepj put ='\"'.s:netrw_passwd.'\"' + NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif elseif exists("s:netrw_passwd") - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' endif endif if a:path != "" - keepj put ='cd \"'.a:path.'\"' + NetrwKeepj put ='cd \"'.a:path.'\"' endif if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd + NetrwKeepj put =g:netrw_ftpextracmd " call Decho("filter input: ".getline('.')) endif - keepj call setline(line("$")+1,a:listcmd) + NetrwKeepj call setline(line("$")+1,a:listcmd) " perform ftp: " -i : turns off interactive prompting from ftp @@ -8591,11 +9078,10 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " -n win32: quit being obnoxious about password if exists("w:netrw_bannercnt") " exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options + call s:NetrwExe(s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " else " Decho " call Decho("WARNING: w:netrw_bannercnt doesn't exist!") -" g/^./call Decho("SKIPPING ftp#".line(".").": ".getline(".")) " COMBAK +" g/^./call Decho("SKIPPING ftp#".line(".").": ".getline(".")) endif "......................................... @@ -8611,34 +9097,34 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) "......................................... else " {{{3 - keepj call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . bufname("%") . ">",23) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . bufname("%") . ">",23) endif " cleanup for Windows " {{{3 if has("win32") || has("win95") || has("win64") || has("win16") - sil! keepj %s/\r$//e - keepj call histdel("/",-1) + sil! NetrwKeepj %s/\r$//e + NetrwKeepj call histdel("/",-1) endif if a:listcmd == "dir" " infer directory/link based on the file permission string - sil! keepj g/d\%([-r][-w][-x]\)\{3}/keepj s@$@/@e - sil! keepj g/l\%([-r][-w][-x]\)\{3}/keepj s/$/@/e - keepj call histdel("/",-1) - keepj call histdel("/",-1) + sil! NetrwKeepj g/d\%([-r][-w][-x]\)\{3}/NetrwKeepj s@$@/@e + sil! NetrwKeepj g/l\%([-r][-w][-x]\)\{3}/NetrwKeepj s/$/@/e + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST - exe "sil! keepj ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e' - keepj call histdel("/",-1) + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e' + NetrwKeepj call histdel("/",-1) endif endif " ftp's listing doesn't seem to include ./ or ../ " {{{3 if !search('^\.\/$\|\s\.\/$','wn') - exe 'keepj '.w:netrw_bannercnt - keepj put ='./' + exe 'NetrwKeepj '.w:netrw_bannercnt + NetrwKeepj put ='./' endif if !search('^\.\.\/$\|\s\.\.\/$','wn') - exe 'keepj '.w:netrw_bannercnt - keepj put ='../' + exe 'NetrwKeepj '.w:netrw_bannercnt + NetrwKeepj put ='../' endif " restore settings " {{{3 @@ -8677,13 +9163,13 @@ fun! s:NetrwRemoteListing() " call Decho("g:netrw_list_cmd<",(exists("g:netrw_list_cmd")? 'n/a' : "-empty-").">") if !exists("g:netrw_quiet") if g:netrw_list_cmd == "" - keepj call netrw#ErrorMsg(s:ERROR,"your g:netrw_list_cmd is empty; perhaps ".g:netrw_ssh_cmd." is not executable on your system",47) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your g:netrw_list_cmd is empty; perhaps ".g:netrw_ssh_cmd." is not executable on your system",47) else - keepj call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ".g:netrw_list_cmd,19) endif endif - keepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionRestore("w:") " call Dret("s:NetrwRemoteListing -1") return -1 endif " (remote handling sanity check) @@ -8706,7 +9192,7 @@ fun! s:NetrwRemoteListing() endif " call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)") call s:NetrwRemoteFtpCmd(s:path,listcmd) -" exe "sil! keepalt keepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."))' +" exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."))' " report on missing file or directory messages if search('[Nn]o such file or directory\|Failed to change directory') @@ -8716,7 +9202,7 @@ fun! s:NetrwRemoteListing() exe w:netrw_bannercnt.",$d" setl noma endif - keepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionRestore("w:") call netrw#ErrorMsg(s:WARNING,mesg,96) " call Dret("s:NetrwRemoteListing : -1") return -1 @@ -8725,41 +9211,41 @@ fun! s:NetrwRemoteListing() if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST " shorten the listing " call Decho("generate short listing") - exe "sil! keepalt keepj ".w:netrw_bannercnt + exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt " cleanup if g:netrw_ftp_browse_reject != "" - exe "sil! keepalt keepj g/".g:netrw_ftp_browse_reject."/keepj d" - keepj call histdel("/",-1) + exe "sil! keepalt NetrwKeepj g/".g:netrw_ftp_browse_reject."/NetrwKeepj d" + NetrwKeepj call histdel("/",-1) endif - sil! keepj %s/\r$//e - keepj call histdel("/",-1) + sil! NetrwKeepj %s/\r$//e + NetrwKeepj call histdel("/",-1) " if there's no ../ listed, then put ../ in let line1= line(".") - exe "sil! keepj ".w:netrw_bannercnt + exe "sil! NetrwKeepj ".w:netrw_bannercnt let line2= search('\.\.\/\%(\s\|$\)','cnW') " call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt) if line2 == 0 " call Decho("netrw is putting ../ into listing") - sil! keepj put='../' + sil! NetrwKeepj put='../' endif - exe "sil! keepj ".line1 - sil! keepj norm! 0 + exe "sil! NetrwKeepj ".line1 + sil! NetrwKeepj norm! 0 " call Decho("line1=".line1." line2=".line2." line(.)=".line(".")) if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup " call Decho("M$ ftp cleanup") - exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(\|\d\+\)\s\+//' - keepj call histdel("/",-1) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(\|\d\+\)\s\+//' + NetrwKeepj call histdel("/",-1) else " normal ftp cleanup " call Decho("normal ftp cleanup") - exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' - exe "sil! keepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' - exe "sil! keepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' - keepj call histdel("/",-1) - keepj call histdel("/",-1) - keepj call histdel("/",-1) + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' + exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) endif endif @@ -8769,35 +9255,35 @@ fun! s:NetrwRemoteListing() let listcmd= s:MakeSshCmd(g:netrw_list_cmd) " call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)") if g:netrw_scp_cmd =~ '^pscp' -" call Decho("1: exe sil r! ".shellescape(listcmd.s:path, 1)) - exe "sil! keepj r! ".listcmd.shellescape(s:path, 1) +" call Decho("1: exe r! ".shellescape(listcmd.s:path, 1)) + exe "NetrwKeepj r! ".listcmd.shellescape(s:path, 1) " remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like - sil! keepj g/^Listing directory/keepj d - sil! keepj g/^d[-rwx][-rwx][-rwx]/keepj s+$+/+e - sil! keepj g/^l[-rwx][-rwx][-rwx]/keepj s+$+@+e - keepj call histdel("/",-1) - keepj call histdel("/",-1) - keepj call histdel("/",-1) + sil! NetrwKeepj g/^Listing directory/NetrwKeepj d + sil! NetrwKeepj g/^d[-rwx][-rwx][-rwx]/NetrwKeepj s+$+/+e + sil! NetrwKeepj g/^l[-rwx][-rwx][-rwx]/NetrwKeepj s+$+@+e + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) if g:netrw_liststyle != s:LONGLIST - sil! keepj g/^[dlsp-][-rwx][-rwx][-rwx]/keepj s/^.*\s\(\S\+\)$/\1/e - keepj call histdel("/",-1) + sil! NetrwKeepj g/^[dlsp-][-rwx][-rwx][-rwx]/NetrwKeepj s/^.*\s\(\S\+\)$/\1/e + NetrwKeepj call histdel("/",-1) endif else if s:path == "" -" call Decho("2: exe sil r! ".listcmd) - exe "sil! keepj keepalt r! ".listcmd +" call Decho("2: exe r! ".listcmd) + exe "NetrwKeepj keepalt r! ".listcmd else -" call Decho("3: exe sil r! ".listcmd.' '.shellescape(fnameescape(s:path),1)) - exe "sil! keepj keepalt r! ".listcmd.' '.shellescape(fnameescape(s:path),1) +" call Decho("3: exe r! ".listcmd.' '.shellescape(fnameescape(s:path),1)) + exe "NetrwKeepj keepalt r! ".listcmd.' '.shellescape(fnameescape(s:path),1) " call Decho("listcmd<".listcmd."> path<".s:path.">") endif endif " cleanup if g:netrw_ssh_browse_reject != "" -" call Decho("cleanup: exe sil! g/".g:netrw_ssh_browse_reject."/keepjumps d") - exe "sil! g/".g:netrw_ssh_browse_reject."/keepj d" - keepj call histdel("/",-1) +" call Decho("cleanup: exe sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d") + exe "sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d" + NetrwKeepj call histdel("/",-1) endif endif @@ -8807,40 +9293,40 @@ fun! s:NetrwRemoteListing() if s:method == "ftp" " cleanup - exe "sil! keepj ".w:netrw_bannercnt + exe "sil! NetrwKeepj ".w:netrw_bannercnt while getline('.') =~ g:netrw_ftp_browse_reject - sil! keepj d + sil! NetrwKeepj d endwhile " if there's no ../ listed, then put ../ in let line1= line(".") - sil! keepj 1 - sil! keepj call search('^\.\.\/\%(\s\|$\)','W') + sil! NetrwKeepj 1 + sil! NetrwKeepj call search('^\.\.\/\%(\s\|$\)','W') let line2= line(".") if line2 == 0 if b:netrw_curdir != '/' - exe 'sil! keepj '.w:netrw_bannercnt."put='../'" + exe 'sil! NetrwKeepj '.w:netrw_bannercnt."put='../'" endif endif - exe "sil! keepj ".line1 - sil! keepj norm! 0 + exe "sil! NetrwKeepj ".line1 + sil! NetrwKeepj norm! 0 endif if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup " call Decho("M$ ftp site listing cleanup") - exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\(\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(\|\d\+\)\s\+\)\(\w.*\)$/\2\t\1/' + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(\|\d\+\)\s\+\)\(\w.*\)$/\2\t\1/' elseif exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") " call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$")) - exe 'sil keepj '.w:netrw_bannercnt.',$s/ -> .*$//e' - exe 'sil keepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e' - exe 'sil keepj '.w:netrw_bannercnt - keepj call histdel("/",-1) - keepj call histdel("/",-1) - keepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/ -> .*$//e' + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e' + exe 'sil NetrwKeepj '.w:netrw_bannercnt + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) + NetrwKeepj call histdel("/",-1) endif endif " if exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") " Decho -" exe "keepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."))' +" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."))' " endif " Decho " call Dret("s:NetrwRemoteListing 0") @@ -8877,7 +9363,7 @@ fun! s:NetrwRemoteRm(usrhost,path) range " remove multiple files and directories while ctr <= a:lastline - exe "keepj ".ctr + exe "NetrwKeepj ".ctr let ok= s:NetrwRemoteRmFile(a:path,s:NetrwGetWord(),all) if ok =~ 'q\%[uit]' break @@ -8890,8 +9376,8 @@ fun! s:NetrwRemoteRm(usrhost,path) range " refresh the (remote) directory listing " call Decho("refresh remote directory listing") - keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) " call Dret("s:NetrwRemoteRm") endfun @@ -8931,14 +9417,14 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) if path =~ '^\a\+://' let path= substitute(path,'^\a\+://[^/]\+/','','') endif - sil! keepj .,$d + sil! NetrwKeepj .,$d call s:NetrwRemoteFtpCmd(path,"delete ".'"'.a:rmfile.'"') else " call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">") let netrw_rm_cmd= s:MakeSshCmd(g:netrw_rm_cmd) " call Decho("netrw_rm_cmd<".netrw_rm_cmd.">") if !exists("b:netrw_curdir") - keepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) let ok="q" else let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') @@ -8953,7 +9439,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) " call Decho("call system(".netrw_rm_cmd.")") let ret= system(netrw_rm_cmd) if ret != 0 - keepj call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif " call Decho("returned=".ret." errcode=".v:shell_error) endif @@ -8980,7 +9466,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) if all || ok =~ 'y\%[es]' || ok == "" if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - keepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) + NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) else let rmfile = substitute(a:path.a:rmfile,'/$','','') let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.shellescape(netrw#WinPath(rmfile)) @@ -8996,7 +9482,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) " call Decho("returned=".ret." errcode=".v:shell_error) if v:shell_error != 0 && !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22) endif endif endif @@ -9040,7 +9526,7 @@ fun! s:NetrwRemoteRename(usrhost,path) range endif if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) - keepj call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) + NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) else let oldname= shellescape(a:path.oldname) let newname= shellescape(a:path.newname) @@ -9055,7 +9541,7 @@ fun! s:NetrwRemoteRename(usrhost,path) range " attempt to rename files/directories while ctr <= a:lastline - exe "keepj ".ctr + exe "NetrwKeepj ".ctr let oldname= s:NetrwGetWord() " call Decho("oldname<".oldname.">") @@ -9078,8 +9564,8 @@ fun! s:NetrwRemoteRename(usrhost,path) range endif " refresh the directory - keepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) " call Dret("NetrwRemoteRename") endfun @@ -9127,10 +9613,10 @@ fun! netrw#FileUrlRead(fname) " call Decho("fname2396<".fname2396.">") " call Decho("plainfname<".plainfname.">") exe "sil doau BufReadPre ".fname2396e - exe 'keepj r '.plainfname + exe 'NetrwKeepj r '.plainfname exe 'sil! bdelete '.plainfname exe 'keepalt file! '.plainfname - keepj 1d + NetrwKeepj 1d " call Decho("setl nomod") setl nomod " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") @@ -9152,26 +9638,28 @@ fun! netrw#LocalBrowseCheck(dirname) " call Decho("isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : ""))) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) " call Dredir("ls!","ls!") + norm! m` let ykeep= @@ if isdirectory(a:dirname) " call Decho("is-directory ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")." ft<".&ft."> g:netrw_fastbrowse=".g:netrw_fastbrowse) let svposn= netrw#SavePosn() + if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) || g:netrw_fastbrowse <= 1 " call Decho("case 1 : ft=".&ft) - sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) - keepalt call netrw#RestorePosn(svposn) + sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) + NetrwKeepj keepalt call netrw#RestorePosn(svposn) elseif &ft == "netrw" && line("$") == 1 " call Decho("case 2 (ft≡netrw && line($)≡1)") - sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) - keepalt call netrw#RestorePosn(svposn) + sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) + NetrwKeepj keepalt call netrw#RestorePosn(svposn) elseif exists("s:treeforceredraw") " call Decho("case 3 (treeforceredraw)") unlet s:treeforceredraw - sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) - keepalt call netrw#RestorePosn(svposn) + sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) + NetrwKeepj keepalt call netrw#RestorePosn(svposn) endif " call Dret("netrw#LocalBrowseCheck") @@ -9257,7 +9745,7 @@ fun! s:LocalBrowseRefresh() let g:netrw_quickhelp= g:netrw_quickhelp - 1 endif " call Decho("#3: quickhelp=".g:netrw_quickhelp) - keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) + NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) endif let ibl= ibl + 1 endfor @@ -9353,7 +9841,7 @@ fun! s:LocalListing() let dirnamelen = strlen(b:netrw_curdir) let filelist = glob(s:ComposePath(dirname,"*"),0,1) let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1) -" call Decho("filelist=".filelist) +" call Decho("filelist=".string(filelist)) if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16")) " call Decho("filelist=".string(filelist)) @@ -9446,29 +9934,29 @@ fun! s:LocalListing() " call Decho("getftime(".filename.")=".getftime(filename)) let t = getftime(filename) let ft = strpart("000000000000000000",1,18-strlen(t)).t -" call Decho("exe keepjumps put ='".ft.'/'.filename."'") +" call Decho("exe NetrwKeepj put ='".ft.'/'.filename."'") let ftpfile= ft.'/'.pfile - sil! keepj put=ftpfile + sil! NetrwKeepj put=ftpfile elseif g:netrw_sort_by =~ "^s" " sort by size (handles file sizes up to 1 quintillion bytes, US) " call Decho("getfsize(".filename.")=".getfsize(filename)) let sz = getfsize(filename) let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz -" call Decho("exe keepj put ='".fsz.'/'.filename."'") +" call Decho("exe NetrwKeepj put ='".fsz.'/'.filename."'") let fszpfile= fsz.'/'.pfile - sil! keepj put =fszpfile + sil! NetrwKeepj put =fszpfile else " sort by name -" call Decho("exe keepjumps put ='".pfile."'") - sil! keepj put=pfile +" call Decho("exe NetrwKeepj put ='".pfile."'") + sil! NetrwKeepj put=pfile endif endfor " cleanup any windows mess at end-of-line - sil! keepj g/^$/d - sil! keepj %s/\r$//e + sil! NetrwKeepj g/^$/d + sil! NetrwKeepj %s/\r$//e call histdel("/",-1) " call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1)) exe "setl ts=".(g:netrw_maxfilenamelen+1) @@ -9505,7 +9993,7 @@ fun! s:NetrwLocalExecute(cmd) endfun " --------------------------------------------------------------------- -" s:NetrwLocalRename: rename a remote file or directory {{{2 +" s:NetrwLocalRename: rename a local file or directory {{{2 fun! s:NetrwLocalRename(path) range " call Dfunc("NetrwLocalRename(path<".a:path.">)") @@ -9540,7 +10028,7 @@ fun! s:NetrwLocalRename(path) range " attempt to rename files/directories while ctr <= a:lastline - exe "keepj ".ctr + exe "NetrwKeepj ".ctr " sanity checks if line(".") < w:netrw_bannercnt @@ -9553,7 +10041,7 @@ fun! s:NetrwLocalRename(path) range continue endif - keepj norm! 0 + NetrwKeepj norm! 0 let oldname= s:ComposePath(a:path,curword) " call Decho("oldname<".oldname.">") @@ -9570,8 +10058,8 @@ fun! s:NetrwLocalRename(path) range " refresh the directory " call Decho("refresh the directory listing") - keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) let @@= ykeep " call Dret("NetrwLocalRename") @@ -9608,7 +10096,7 @@ fun! s:NetrwLocalRm(path) range let ctr = a:firstline while ctr <= a:lastline - exe "keepj ".ctr + exe "NetrwKeepj ".ctr " sanity checks if line(".") < w:netrw_bannercnt @@ -9633,8 +10121,8 @@ fun! s:NetrwLocalRm(path) range " refresh the directory " call Decho("bufname<".bufname("%").">") if bufname("%") != "NetrwMessage" - keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) - keepj call netrw#RestorePosn(svpos) + NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) endif let @@= ykeep @@ -9649,7 +10137,7 @@ fun! s:NetrwLocalRmFile(path,fname,all) let all= a:all let ok = "" - keepj norm! 0 + NetrwKeepj norm! 0 let rmfile= s:ComposePath(a:path,a:fname) " call Decho("rmfile<".rmfile.">") @@ -9745,7 +10233,7 @@ fun! netrw#Access(ilist) endfun " ------------------------------------------------------------------------ -" netrw#RestorePosn: restores the cursor and file position as saved by NetrwSavePosn() {{{2 +" netrw#RestorePosn: restores the cursor and file position as saved by netrw#SavePosn() {{{2 fun! netrw#RestorePosn(...) " call Dfunc("netrw#RestorePosn() a:0=".a:0." winnr=".(exists("w:netrw_winnr")? w:netrw_winnr : -1)." line=".(exists("w:netrw_line")? w:netrw_line : -1)." col=".(exists("w:netrw_col")? w:netrw_col : -1)." hline=".(exists("w:netrw_hline")? w:netrw_hline : -1)) let eikeep= &ei @@ -9759,60 +10247,60 @@ fun! netrw#RestorePosn(...) if a:0 > 0 exe "keepj ".a:1 endif -" call Decho("a:1 = ".((a:0 > 0)? a:1 : 'n/a')) -" call Decho("liststyle = ".(exists("liststyle")? liststyle : 'n/a'). " w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) +" "call Decho("a:1 = ".((a:0 > 0)? a:1 : 'n/a')) +" "call Decho("liststyle = ".(exists("liststyle")? liststyle : 'n/a'). " w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) if exists("liststyle") && exists("w:netrw_liststyle") && liststyle != w:netrw_liststyle let usesrch= 1 else let usesrch= 0 endif -" call Decho("winh = ".(exists("w:netrw_winh")? w:netrw_winh : -1)) -" call Decho("winw = ".(exists("w:netrw_winw")? w:netrw_winw : -1)) -" call Decho("cur winheight=".winheight(0)." winwidth=".winwidth(0)) -" call Decho("w:netrw_winfile = ".(exists("w:netrw_winfile")? w:netrw_winfile : 'n/a')) +" "call Decho("winh = ".(exists("w:netrw_winh")? w:netrw_winh : -1)) +" "call Decho("winw = ".(exists("w:netrw_winw")? w:netrw_winw : -1)) +" "call Decho("cur winheight=".winheight(0)." winwidth=".winwidth(0)) +" "call Decho("w:netrw_winfile = ".(exists("w:netrw_winfile")? w:netrw_winfile : 'n/a')) " restore window if exists("w:netrw_winnr") -" call Decho("restore window: exe sil! ".w:netrw_winnr."wincmd w") +" "call Decho("restore window: exe sil! ".w:netrw_winnr."wincmd w") exe "sil! ".w:netrw_winnr."wincmd w" endif - if v:shell_error == 0 +" if v:shell_error == 0 " as suggested by Bram M: redraw on no error " allows protocol error messages to remain visible " redraw! - endif +" endif " restore top-of-screen line if exists("w:netrw_hline") -" call Decho("restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z") +" "call Decho("restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z") exe "keepj norm! ".w:netrw_hline."G0z\" endif " restore position " when the window's height x width has changed, the line,col is no longer useful if w:netrw_winh == winheight(0) && w:netrw_winw == winwidth(0) && exists("w:netrw_line") && exists("w:netrw_col") && !usesrch -" call Decho("using posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|") +" "call Decho("using posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|") exe "keepj norm! ".w:netrw_line."G0".w:netrw_col."\" elseif exists("w:netrw_winfile") if !search('\<'.escape(w:netrw_winfile,g:netrw_fname_escape),'cw') if exists("w:netrw_bannercnt") -" call Decho("using bannercnt: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">") +" "call Decho("using bannercnt: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">") exe "keepj ".w:netrw_bannercnt norm! 0 else " go to upper left corner -" call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">") +" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">") keepj 1 norm! 0 endif else -" call Decho("used search: w:netrw_winfile<".w:netrw_winfile.">") +" "call Decho("used search: w:netrw_winfile<".w:netrw_winfile.">") endif else -" call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)) +" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)) keepj 1 norm! 0 endif @@ -9838,22 +10326,22 @@ fun! netrw#SavePosn() let w:netrw_winnr= winnr() let w:netrw_line = line(".") let w:netrw_col = virtcol(".") -" call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col) +" "call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col) " save filename under cursor -" call Decho("line#".line(".")." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')) +" "call Decho("line#".line(".")." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')) if exists("w:netrw_bannercnt") && line(".") >= w:netrw_bannercnt && &ft == "netrw" - let winfile = "|let w:netrw_winfile='".s:NetrwGetWord()."'" + let winfile = "|let w:netrw_winfile=\"".fnameescape(s:NetrwGetWord())."\"" else let winfile= "" endif -" call Decho("winfile<".winfile.">") +" "call Decho("winfile<".winfile.">") if exists("w:netrw_liststyle") let liststyle = "|let liststyle=".w:netrw_liststyle else let liststyle= "" endif -" call Decho("liststyle=".liststyle) +" "call Decho("liststyle=".liststyle) " Save top-of-screen line keepj norm! H0 @@ -9950,6 +10438,33 @@ fun! s:ComposePath(base,subdir) return ret endfun +" --------------------------------------------------------------------- +" s:DeleteBookmark: deletes a file/directory from Netrw's bookmark system {{{2 +" Related Functions: s:MakeBookmark() s:NetrwBookHistHandler() s:NetrwBookmark() +fun! s:DeleteBookmark(fname) +" call Dfunc("s:DeleteBookmark(fname<".a:fname.">)") + call s:MergeBookmarks() + + if exists("g:netrw_bookmarklist") + let indx= index(g:netrw_bookmarklist,a:fname) + if indx == -1 + let indx= 0 + while indx < len(g:netrw_bookmarklist) + if g:netrw_bookmarklist[indx] =~ a:fname + call remove(g:netrw_bookmarklist,indx) + let indx= indx - 1 + endif + let indx= indx + 1 + endwhile + else + " remove exact match + call remove(g:netrw_bookmarklist,indx) + endif + endif + +" call Dret("s:DeleteBookmark") +endfun + " --------------------------------------------------------------------- " s:FileReadable: o/s independent filereadable {{{2 fun! s:FileReadable(fname) @@ -9983,13 +10498,13 @@ fun! s:GetTempfile(fname) " sanity check -- does the temporary file's directory exist? if !isdirectory(substitute(tmpfile,'[^/]\+$','','e')) " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") - keepj call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2) " call Dret("s:GetTempfile getcwd<".getcwd().">") return "" endif " let netrw#NetSource() know about the tmpfile - let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#NetrwBrowseX() + let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#BrowseX() " call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">") " o/s dependencies @@ -10056,6 +10571,45 @@ fun! s:MakeSshCmd(sshcmd) return sshcmd endfun +" --------------------------------------------------------------------- +" s:MakeBookmark: enters a bookmark into Netrw's bookmark system {{{2 +fun! s:MakeBookmark(fname) +" call Dfunc("s:MakeBookmark(fname<".a:fname.">)") + + if !exists("g:netrw_bookmarklist") + let g:netrw_bookmarklist= [] + endif + + if index(g:netrw_bookmarklist,a:fname) == -1 + " curdir not currently in g:netrw_bookmarklist, so include it + if isdirectory(a:fname) && a:fname !~ '/$' + call add(g:netrw_bookmarklist,a:fname.'/') + elseif a:fname !~ '/' + call add(g:netrw_bookmarklist,getcwd()."/".a:fname) + else + call add(g:netrw_bookmarklist,a:fname) + endif + call sort(g:netrw_bookmarklist) + endif + +" call Dret("s:MakeBookmark") +endfun + +" --------------------------------------------------------------------- +" s:MergeBookmarks: merge current bookmarks with saved bookmarks {{{2 +fun! s:MergeBookmarks() +" call Dfunc("s:MergeBookmarks()") + " get bookmarks from .netrwbook file + let savefile= s:NetrwHome()."/.netrwbook" + if filereadable(savefile) +" call Decho("merge bookmarks (active and file)") + NetrwKeepj call s:NetrwBookHistSave() +" call Decho("bookmark delete savefile<".savefile.">") + NetrwKeepj call delete(savefile) + endif +" call Dret("s:MergeBookmarks") +endfun + " --------------------------------------------------------------------- " s:NetrwBMShow: {{{2 fun! s:NetrwBMShow() @@ -10069,7 +10623,7 @@ fun! s:NetrwBMShow() if bmshowfuncs != [] let bmshowfunc = substitute(bmshowfuncs[0],'^.*:\(call.*BMShow()\).*$','\1','') if bmshowfunc =~ '^call.*BMShow()' - exe "sil! keepj ".bmshowfunc + exe "sil! NetrwKeepj ".bmshowfunc endif endif endif @@ -10176,7 +10730,7 @@ fun! s:NetrwDelete(path) let result= delete(path) endif if result < 0 - keepj call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71) + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71) endif " call Dret("s:NetrwDelete ".result) @@ -10208,13 +10762,13 @@ fun! s:NetrwEnew(...) if exists("b:netrw_option") |let netrw_option = b:netrw_option |endif if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif - keepj call s:NetrwOptionRestore("w:") -" call Decho("generate a buffer with keepjumps keepalt enew!") + NetrwKeepj call s:NetrwOptionRestore("w:") +" call Decho("generate a buffer with NetrwKeepj keepalt enew!") let netrw_keepdiff= &l:diff - noswapfile keepj keepalt enew! + noswapfile NetrwKeepj keepalt enew! let &l:diff= netrw_keepdiff " call Decho("bufnr($)=".bufnr("$")." winnr($)=".winnr("$")) - keepj call s:NetrwOptionSave("w:") + NetrwKeepj call s:NetrwOptionSave("w:") " copy function-local-variables to buffer variable equivalents " call Decho("copy function-local variables back to buffer netrw variables") @@ -10252,6 +10806,22 @@ fun! s:NetrwEnew(...) " call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#")."> bh=".&bh." win#".winnr()." winnr($)#".winnr("$")) endfun +" --------------------------------------------------------------------- +" s:NetrwExe: executes a string using "!" {{{2 +fun! s:NetrwExe(cmd) +" call Dfunc("s:NetrwExe(a:cmd)") + if has("win32") && &shell !~? 'cmd' && !g:netrw_cygwin + let savedShell=[&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] + set shell& shellcmdflag& shellxquote& shellxescape& + set shellquote& shellpipe& shellredir& shellslash& + exe a:cmd + let [&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] = savedShell + else + exe a:cmd + endif +" call Dret("s:NetrwExe") +endfun + " --------------------------------------------------------------------- " s:NetrwInsureWinVars: insure that a netrw buffer has its w: variables in spite of a wincmd v or s {{{2 fun! s:NetrwInsureWinVars() @@ -10286,7 +10856,7 @@ fun! s:NetrwLcd(newdir) " call Dfunc("s:NetrwLcd(newdir<".a:newdir.">)") try - exe 'keepj sil lcd '.fnameescape(a:newdir) + exe 'NetrwKeepj sil lcd '.fnameescape(a:newdir) catch /^Vim\%((\a\+)\)\=:E344/ " Vim's lcd fails with E344 when attempting to go above the 'root' of a Windows share. " Therefore, detect if a Windows share is present, and if E344 occurs, just settle at @@ -10296,7 +10866,7 @@ fun! s:NetrwLcd(newdir) if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin if a:newdir =~ '^\\\\\w\+' || a:newdir =~ '^//\w\+' let dirname = '\' - exe 'keepj sil lcd '.fnameescape(dirname) + exe 'NetrwKeepj sil lcd '.fnameescape(dirname) endif endif catch /^Vim\%((\a\+)\)\=:E472/ @@ -10388,9 +10958,9 @@ endfun fun! s:RemoteSystem(cmd) " call Dfunc("s:RemoteSystem(cmd<".a:cmd.">)") if !executable(g:netrw_ssh_cmd) - keepj call netrw#ErrorMsg(s:ERROR,"g:netrw_ssh_cmd<".g:netrw_ssh_cmd."> is not executable!",52) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"g:netrw_ssh_cmd<".g:netrw_ssh_cmd."> is not executable!",52) elseif !exists("b:netrw_curdir") - keepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) + NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) else let cmd = s:MakeSshCmd(g:netrw_ssh_cmd." USEPORT HOSTNAME") let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') @@ -10447,13 +11017,21 @@ fun! s:NetrwRexplore(islocal,dirname) " call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">") if &ft == "netrw" && exists("w:netrw_rexfile") && w:netrw_rexfile != "" + " a :Rex while in a netrw buffer means: edit the file in w:netrw_rexfile " call Decho("in netrw buffer, will edit file<".w:netrw_rexfile.">") - exe "e ".w:netrw_rexfile + exe "NetrwKeepj e ".w:netrw_rexfile unlet w:netrw_rexfile " call Dret("s:NetrwRexplore returning from netrw to buf#".bufnr("%")."<".bufname("%")."> (ft=".&ft.")") return +" else " Decho +" call Decho("treating as not-netrw-buffer: ft=".&ft.((&ft == "netrw")? " == netrw" : "!= netrw")) +" call Decho("treating as not-netrw-buffer: w:netrw_rexfile<".((exists("w:netrw_rexfile"))? w:netrw_rexfile : 'n/a').">") endif + " --------------------------- + " :Rex issued while in a file + " --------------------------- + " record current file so :Rex can return to it from netrw let w:netrw_rexfile= expand("%") @@ -10463,16 +11041,26 @@ fun! s:NetrwRexplore(islocal,dirname) endif " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) if w:netrw_rexlocal - keepj call netrw#LocalBrowseCheck(w:netrw_rexdir) - else + if g:netrw_keepj =~ "keepj" + keepj call netrw#LocalBrowseCheck(w:netrw_rexdir) + else + call netrw#LocalBrowseCheck(w:netrw_rexdir) + endif + elseif g:netrw_keepj =~ "keepj" keepj call s:NetrwBrowse(0,w:netrw_rexdir) + else + call s:NetrwBrowse(0,w:netrw_rexdir) endif if exists("s:initbeval") setl beval endif if exists("s:rexposn_".bufnr("%")) " call Decho("restore posn, then unlet s:rexposn_".bufnr('%')) - keepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) + if g:netrw_keepj =~ "keepj" + keepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) + else + call netrw#RestorePosn(s:rexposn_{bufnr('%')}) + endif unlet s:rexposn_{bufnr('%')} else " call Decho("s:rexposn_".bufnr('%')." doesn't exist") @@ -10558,6 +11146,54 @@ fun! s:SetRexDir(islocal,dirname) " call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname) endfun +" --------------------------------------------------------------------- +" s:ShowLink: used to modify thin and tree listings to show links {{{2 +fun! s:ShowLink() +" " call Dfunc("s:ShowLink()") +" " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">") +" " call Decho(printf("line#%4d: %s",line("."),getline("."))) + if exists("b:netrw_curdir") + norm! $?\a + let fname = b:netrw_curdir.'/'.s:NetrwGetWord() + let resname = resolve(fname) + if resname =~ '^\M'.b:netrw_curdir + let dirlen = strlen(b:netrw_curdir) + let resname = strpart(resname,dirlen+1) +" " call Decho("resname<".resname."> (b:netrw_curdir elided)") +" " else " Decho +" " call Decho("resname<".fname.">") + endif + let modline = getline(".")."\t --> ".resname +" " call Decho("fname <".fname.">") +" " call Decho("modline<".modline.">") + setl noro ma + call setline(".",modline) + setl ro noma nomod + endif +" " call Dret("s:ShowLink".((exists("fname")? ' : '.fname : 'n/a'))) +endfun + +" --------------------------------------------------------------------- +" s:ShowStyle: {{{2 +fun! s:ShowStyle() + if !exists("w:netrw_liststyle") + let liststyle= g:netrw_liststyle + else + let liststyle= w:netrw_liststyle + endif + if liststyle == s:THINLIST + return s:THINLIST.":thin" + elseif liststyle == s:LONGLIST + return s:LONGLIST.":long" + elseif liststyle == s:WIDELIST + return s:WIDELIST.":wide" + elseif liststyle == s:TREELIST + return s:TREELIST.":tree" + else + return 'n/a' + endif +endfun + " --------------------------------------------------------------------- " s:Strlen: this function returns the length of a string, even if its using multi-byte characters. {{{2 " Solution from Nicolai Weibull, vim docs (:help strlen()), @@ -10593,7 +11229,7 @@ fun! s:Strlen(x) call setline(line("."),a:x) let ret= virtcol("$") - 1 d - keepj norm! k + NetrwKeepj norm! k let &l:mod= modkeep else @@ -10622,17 +11258,17 @@ fun! s:TreeListMove(dir) if curline !~ '/$' " call Decho('regfile') if a:dir == '[' && prvline != '' - keepj norm! 0 + NetrwKeepj norm! 0 let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from regular file " call Decho("regfile srch back: ".nl) elseif a:dir == ']' && nxtline != '' - keepj norm! $ + NetrwKeepj norm! $ let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from regular file " call Decho("regfile srch fwd: ".nl) endif elseif a:dir == '[' && prvline != '' - keepj norm! 0 + NetrwKeepj norm! 0 let curline= line(".") let nl = search('^'.curindent.'[^'.s:treedepthstring.']','bWe') " search backwards From directory, same indentation " call Decho("dir srch back ind: ".nl) @@ -10644,7 +11280,7 @@ fun! s:TreeListMove(dir) endif elseif a:dir == ']' && nxtline != '' - keepj norm! $ + NetrwKeepj norm! $ let curline = line(".") let nl = search('^'.curindent.'[^'.s:treedepthstring.']','We') " search forwards from directory, same indentation " call Decho("dir srch fwd ind: ".nl) @@ -10672,7 +11308,7 @@ fun! s:UpdateBuffersMenu() sil emenu Buffers.Refresh\ menu catch /^Vim\%((\a\+)\)\=:E/ let v:errmsg= "" - sil keepj call s:NetrwBMShow() + sil NetrwKeepj call s:NetrwBMShow() endtry endif " call Dret("s:UpdateBuffersMenu") diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim index 541ee65ccb..4639909ee8 100644 --- a/runtime/autoload/netrwSettings.vim +++ b/runtime/autoload/netrwSettings.vim @@ -1,7 +1,7 @@ " netrwSettings.vim: makes netrw settings simpler -" Date: Aug 27, 2013 +" Date: Dec 30, 2014 " Maintainer: Charles E Campbell -" Version: 14 +" Version: 15 " Copyright: Copyright (C) 1999-2007 Charles E. Campbell {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright @@ -19,7 +19,7 @@ if exists("g:loaded_netrwSettings") || &cp finish endif -let g:loaded_netrwSettings = "v14" +let g:loaded_netrwSettings = "v15" if v:version < 700 echohl WarningMsg echo "***warning*** this version of netrwSettings needs vim 7.0" @@ -31,7 +31,7 @@ endif " NetrwSettings: {{{1 fun! netrwSettings#NetrwSettings() " this call is here largely just to insure that netrw has been loaded - call netrw#NetrwSavePosn() + call netrw#SavePosn() if !exists("g:loaded_netrw") echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None return @@ -177,6 +177,7 @@ fun! netrwSettings#NetrwSettings() put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction put = 'let g:netrw_sort_options = '.g:netrw_sort_options put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence + put = 'let g:netrw_servername = '.g:netrw_servername put = 'let g:netrw_special_syntax = '.g:netrw_special_syntax put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd diff --git a/runtime/autoload/netrw_gitignore.vim b/runtime/autoload/netrw_gitignore.vim index 0de902cbb4..da3f50bca0 100644 --- a/runtime/autoload/netrw_gitignore.vim +++ b/runtime/autoload/netrw_gitignore.vim @@ -61,9 +61,16 @@ function! netrw_gitignore#Hide(...) " convert gitignore patterns to Netrw/Vim regex patterns let escaped_lines = [] for line in gitignore_lines - let escaped = line - let escaped = substitute(escaped, '\.', '\\.', 'g') - let escaped = substitute(escaped, '*', '.*', 'g') + let escaped = line + let escaped = substitute(escaped, '\*\*', '*', 'g') + let escaped = substitute(escaped, '\.', '\\.', 'g') + let escaped = substitute(escaped, '\$', '\\$', 'g') + let escaped = substitute(escaped, '*', '.*', 'g') + " correction: dot, dollar and asterisks chars shouldn't be escaped when + " within regex matching groups. + let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\.', '\.', 'g') + let escaped = substitute(escaped, '\(\[[^]]*\)\zs\\\$', '\$', 'g') + let escaped = substitute(escaped, '\(\[[^]]*\)\zs\.\*', '*', 'g') let escaped_lines = add(escaped_lines, escaped) endfor diff --git a/runtime/doc/gui_w32.txt b/runtime/doc/gui_w32.txt index fbe3f35e74..5674bbad07 100644 --- a/runtime/doc/gui_w32.txt +++ b/runtime/doc/gui_w32.txt @@ -1,4 +1,4 @@ -*gui_w32.txt* For Vim version 7.4. Last change: 2012 Aug 04 +*gui_w32.txt* For Vim version 7.4. Last change: 2014 Dec 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -452,9 +452,10 @@ detailed elsewhere: see |'mouse'|, |win32-hidden-menus|. You can drag and drop one or more files into the Vim window, where they will be opened as normal. See |drag-n-drop|. - *:simalt* *:si* + *:simalt* *:sim* :sim[alt] {key} simulate pressing {key} while holding Alt pressed. {not in Vi} {only for Win32 versions} + Note: ":si" means ":s" with the "i" flag. Normally, Vim takes control of all Alt- combinations, to increase the number of possible mappings. This clashes with the standard use of Alt as the diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 908b58680e..1e0134d68f 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -1,4 +1,4 @@ -*index.txt* For Vim version 7.4. Last change: 2014 Sep 19 +*index.txt* For Vim version 7.4. Last change: 2015 Jan 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1465,7 +1465,7 @@ tag command action ~ buffer list |:sbrewind| :sbr[ewind] split window and go to first file in the buffer list -|:scriptnames| :scrip[tnames] list names of all sourced Vim scripts +|:scriptnames| :scr[iptnames] list names of all sourced Vim scripts |:scriptencoding| :scripte[ncoding] encoding used in sourced Vim script |:scscope| :scs[cope] split window and execute cscope command |:set| :se[t] show or set options diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 72459b0fc5..d62bb4e8e1 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.4. Last change: 2014 Nov 05 +*options.txt* For Vim version 7.4. Last change: 2014 Dec 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -730,8 +730,6 @@ A jump table for the options with a short description can be found at |Q_op|. open a file, switch buffers, delete a buffer or open/close a window. It will change to the directory containing the file which was opened or selected. - This option is provided for backward compatibility with the Vim - released with Sun ONE Studio 4 Enterprise Edition. Note: When this option is on some plugins may not work. *'arabic'* *'arab'* *'noarabic'* *'noarab'* diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 32f576af6a..5e629aaf42 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 7.4. Last change: 2014 May 13 +*pi_netrw.txt* For Vim version 7.4. Last change: 2015 Jan 05 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -6,7 +6,7 @@ Author: Charles E. Campbell (remove NOSPAM from Campbell's email first) -Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright* +Copyright: Copyright (C) 1999-2015 Charles E Campbell *netrw-copyright* The VIM LICENSE applies to the files in this package, including netrw.vim, pi_netrw.txt, netrwFileHandlers.vim, netrwSettings.vim, and syntax/netrw.vim. Like anything else that's free, netrw.vim and its @@ -18,9 +18,10 @@ Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright* software. Use at your own risk! + *netrw* *dav* *ftp* *netrw-file* *rcp* *scp* *davs* *http* *netrw.vim* *rsync* *sftp* - *fetch* *netrw* *network* + *fetch* *network* ============================================================================== 1. Contents *netrw-contents* {{{1 @@ -57,7 +58,7 @@ Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright* Changing To A Bookmarked Directory..................|netrw-gb| Changing To A Predecessor Directory.................|netrw-u| Changing To A Successor Directory...................|netrw-U| - Customizing Browsing With A User Function...........|netrw-x| + Customizing Browsing With A Special Handler.........|netrw-x| Deleting Bookmarks..................................|netrw-mB| Deleting Files Or Directories.......................|netrw-D| Directory Exploring Commands........................|netrw-explore| @@ -76,7 +77,9 @@ Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright* Unmarking Files.....................................|netrw-mF| Marking Files By QuickFix List......................|netrw-qF| Marking Files By Regular Expression.................|netrw-mr| - Marked Files: Arbitrary Command.....................|netrw-mx| + Marked Files: Arbitrary Shell Command...............|netrw-mx| + Marked Files: Arbitrary Shell Command, En Bloc......|netrw-mX| + Marked Files: Arbitrary Vim Command.................|netrw-mv| Marked Files: Compression And Decompression.........|netrw-mz| Marked Files: Copying...............................|netrw-mc| Marked Files: Diff..................................|netrw-md| @@ -209,6 +212,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 rsync: *g:netrw_rsync_cmd* = "rsync -a" scp: *g:netrw_scp_cmd* = "scp -q" sftp: *g:netrw_sftp_cmd* = "sftp" + file: *g:netrw_file_cmd* = "elinks" or "links" *g:netrw_http_xcmd* : the option string for http://... protocols are specified via this variable and may be independently overridden. By @@ -346,7 +350,7 @@ settings are described below, in |netrw-browser-options|, and in per-buffer basis (supports plain :Nw ) *g:netrw_bufsettings* the settings that netrw buffers have - (default) noma nomod nonu nowrap ro nobl + (default) noma nomod nonu nowrap ro nobl *g:netrw_chgwin* specifies a window number where subsequent file edits will take place. (also see |netrw-C|) @@ -399,18 +403,26 @@ settings are described below, in |netrw-browser-options|, and in be available (see |netrw-gx|) *g:netrw_uid* (ftp) user-id, retained on a per-vim-session basis - *s:netrw_passwd* (ftp) password, retained on a per-vim-session basis + *s:netrw_passwd* (ftp) password, retained on a per-vim-session basis *g:netrw_preview* =0 (default) preview window shown in a horizontally split window =1 preview window shown in a vertically split window. Also affects the "previous window" (see |netrw-P|) in the same way. + The |g:netrw_alto| variable may be used to provide + additional splitting control: + g:netrw_preview g:netrw_alto result + 0 0 |:aboveleft| + 0 1 |:belowright| + 1 0 |:topleft| + 1 1 |:botright| + To control sizing, see |g:netrw_winsize| *g:netrw_scpport* = "-P" : option to use to set port for scp *g:netrw_sshport* = "-p" : option to use to set port for ssh - *g:netrw_sepchr* =\0xff + *g:netrw_sepchr* =\0xff =\0x01 for enc == euc-jp (and perhaps it should be for others, too, please let me know) Separates priority codes from filenames internally. @@ -430,7 +442,7 @@ settings are described below, in |netrw-browser-options|, and in lines that o/s's ftp "provides" on transfers =0 force normal ftp behavior (no trailing line removal) - *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also + *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also permits network browsing to use ls with time and size sorting (default if windows) =0 assume Windows' scp accepts windows-style paths @@ -681,6 +693,16 @@ your <.vimrc> customization file: > filetype plugin indent on endif < +By also including the following lines in your .vimrc, one may have netrw +immediately activate when using [g]vim without any filenames, showing the +current directory: > + + " Augroup VimStartup: + augroup VimStartup + au! + au VimEnter * if expand("%") == "" | e . | endif + augroup END +< ============================================================================== 6. Transparent Remote File Editing *netrw-transparent* {{{1 @@ -838,7 +860,7 @@ variables listed below, and may be modified by the user. g:netrw_http_cmd var ="fetch -o" if fetch is available g:netrw_http_cmd var ="wget -O" else if wget is available g:netrw_http_put_cmd var ="curl -T" - g:netrw_list_cmd var ="ssh USEPORT HOSTNAME ls -Fa" + |g:netrw_list_cmd| var ="ssh USEPORT HOSTNAME ls -Fa" g:netrw_rcp_cmd var ="rcp" g:netrw_rsync_cmd var ="rsync -a" g:netrw_scp_cmd var ="scp -q" @@ -1042,6 +1064,9 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 < Causes Netrw to issue help Netrw will enter the directory or read the file |netrw-cr| Netrw will attempt to remove the file/directory |netrw-del| + Edit file hiding list |netrw-ctrl-h| + Causes Netrw to refresh the directory listing |netrw-ctrl-l| + Browse using a gvim server |netrw-ctrl-r| - Makes Netrw go up one directory |netrw--| a Toggles between normal display, |netrw-a| hiding (suppress display of files matching g:netrw_list_hide) @@ -1051,23 +1076,27 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 d Make a directory |netrw-d| D Attempt to remove the file(s)/directory(ies) |netrw-D| gb Go to previous bookmarked directory |netrw-gb| + gd Force treatment as directory |netrw-gd| + gf Force treatment as file |netrw-gf| gh Quick hide/unhide of dot-files |netrw-gh| - Edit file hiding list |netrw-ctrl-h| i Cycle between thin, long, wide, and tree listings |netrw-i| - Causes Netrw to refresh the directory listing |netrw-ctrl-l| mb Bookmark current directory |netrw-mb| mc Copy marked files to marked-file target directory |netrw-mc| md Apply diff to marked files (up to 3) |netrw-md| me Place marked files on arg list and edit them |netrw-me| mf Mark a file |netrw-mf| + mF Unmark files |netrw-mF| + mg Apply vimgrep to marked files |netrw-mg| mh Toggle marked file suffices' presence on hiding list |netrw-mh| mm Move marked files to marked-file target directory |netrw-mm| mp Print marked files |netrw-mp| - mr Mark files satisfying a shell-style |regexp| |netrw-mr| + mr Mark files using a shell-style |regexp| |netrw-mr| mt Current browsing directory becomes markfile target |netrw-mt| mT Apply ctags to marked files |netrw-mT| mu Unmark all marked files |netrw-mu| + mv Apply arbitrary vim command to marked files |netrw-mv| mx Apply arbitrary shell command to marked files |netrw-mx| + mX Apply arbitrary shell command to marked files en bloc|netrw-mX| mz Compress/decompress marked files |netrw-mz| o Enter the file/directory under the cursor in a new |netrw-o| browser window. A horizontal split is used. @@ -1076,6 +1105,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 P Browse in the previously used window |netrw-P| qb List bookmarked directories and history |netrw-qb| qf Display information on file |netrw-qf| + qF Mark files using a quickfix list |netrw-qF| r Reverse sorting order |netrw-r| R Rename the designed file(s)/directory(ies) |netrw-R| s Select sorting style: by name, time, or file size |netrw-s| @@ -1099,7 +1129,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 mouse <2-leftmouse> (gvim only) when: * in a netrw-selected file, AND - * |g:netrw_retmap| == 1 AND + * |g:netrw_retmap| == 1 AND * the user doesn't already have a <2-leftmouse> mapping defined before netrw is autoloaded, then a double clicked leftmouse button will return @@ -1117,7 +1147,7 @@ QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2 :Ntree....................................................|netrw-ntree| :Explore[!] [dir] Explore directory of current file......|netrw-explore| :Hexplore[!] [dir] Horizontal Split & Explore.............|netrw-explore| - :Lexplore [dir] Left Explorer Toggle...................|netrw-explore| + :Lexplore[!] [dir] Left Explorer Toggle...................|netrw-explore| :Nexplore[!] [dir] Vertical Split & Explore...............|netrw-explore| :Pexplore[!] [dir] Vertical Split & Explore...............|netrw-explore| :Rexplore Return to Explorer.....................|netrw-explore| @@ -1125,19 +1155,45 @@ QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2 :Texplore[!] [dir] Tab & Explore..........................|netrw-explore| :Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore| -BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2 +BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2 -One may easily "bookmark" a directory by using > +One may easily "bookmark" the currently browsed directory by using > mb < + *.netrwbook* Bookmarks are retained in between sessions in a $HOME/.netrwbook file, and are kept in sorted order. +If there are marked files and/or directories, mb will add them to the bookmark +list. + +*netrw-:NetrwMB* +Addtionally, one may use :NetrwMB to bookmark files or directories. > + + :NetrwMB[!] [files/directories] + +< No bang: enters files/directories into Netrw's bookmark system + + No argument and in netrw buffer: + if there are marked files: bookmark marked files + otherwise : bookmark file/directory under cursor + No argument and not in netrw buffer: bookmarks current open file + Has arguments: globs them individually and bookmarks them + + With bang: deletes files/directories from Netrw's bookmark system + +The :NetrwMB command is available outside of netrw buffers (once netrw has been +invoked in the session). + +The file ".netrwbook" holds bookmarks when netrw (and vim) is not active. By +default, its stored on the first directory on the user's |'runtimepath'|. + Related Topics: |netrw-gb| how to return (go) to a bookmark |netrw-mB| how to delete bookmarks |netrw-qb| how to list bookmarks + |g:netrw_home| controls where .netrwbook is kept BROWSING *netrw-cr* {{{2 @@ -1163,7 +1219,7 @@ horizontally or vertically, respectively. When the option is set to three, a When using the gui (gvim), one may select a file by pressing the button. In addition, if - *|g:netrw_retmap| == 1 AND (its default value is 0) + * |g:netrw_retmap| == 1 AND (its default value is 0) * in a netrw-selected file, AND * the user doesn't already have a <2-leftmouse> mapping defined before netrw is loaded @@ -1181,19 +1237,20 @@ The price for such re-use is that when changes are made (such as new files are introduced into a directory), the listing may become out-of-date. One may always refresh directory listing buffers by pressing ctrl-L (see |netrw-ctrl-l|). - *:netrw-s-cr* Squeezing the Current Tree-Listing Directory~ When the tree listing style is enabled (see |netrw-i|) and one is using gvim, then the mapping may be used to squeeze (close) the directory currently containing the cursor. - -Related topics: |netrw-o| |netrw-p| |netrw-P| |netrw-t| |netrw-v| -Associated setting variables: |g:netrw_browse_split| |g:netrw_fastbrowse| - |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd| - |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_cmd| - |g:netrw_ssh_browse_reject| |g:netrw_use_noswf| +Related topics: + |netrw-ctrl-r| |netrw-o| |netrw-p| + |netrw-P| |netrw-t| |netrw-v| +Associated setting variables: + |g:netrw_browse_split| |g:netrw_fastbrowse| + |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd| + |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_browse_reject| + |g:netrw_ssh_cmd| |g:netrw_use_noswf| BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* {{{2 @@ -1207,12 +1264,14 @@ cursor at the top. Associated setting variables: |g:netrw_alto| |g:netrw_winsize| -Related Actions |netrw-cr| |netrw-p| |netrw-t| |netrw-v| +Related topics: + |netrw-ctrl-r| |netrw-o| |netrw-p| + |netrw-P| |netrw-t| |netrw-v| Associated setting variables: |g:netrw_alto| control above/below splitting |g:netrw_winsize| control initial sizing -BROWSING WITH A NEW TAB *netrw-t* +BROWSING WITH A NEW TAB *netrw-t* {{{2 Normally one enters a file or directory using the . The "t" map allows one to open a new window holding the new directory listing or file in @@ -1220,7 +1279,9 @@ a new tab. If you'd like to have the new listing in a background tab, use |gT|. -Related Actions |netrw-cr| |netrw-o| |netrw-p| |netrw-v| +Related topics: + |netrw-ctrl-r| |netrw-o| |netrw-p| + |netrw-P| |netrw-t| |netrw-v| Associated setting variables: |g:netrw_winsize| control initial sizing @@ -1236,13 +1297,30 @@ cursor at the left. There is only one tree listing buffer; using "v" on a displayed subdirectory will split the screen, but the same buffer will be shown twice. -Related Actions: |netrw-cr| |netrw-o| |netrw-t| |netrw-v| +Related topics: + |netrw-ctrl-r| |netrw-o| |netrw-p| + |netrw-P| |netrw-t| |netrw-v| Associated setting variables: |g:netrw_altv| control right/left splitting |g:netrw_winsize| control initial sizing -CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2 +BROWSING USING A GVIM SERVER *netrw-ctrl-r* {{{2 + +One may keep a browsing gvim separate from the gvim being used to edit. +Use the map on a file (not a directory) in the netrw browser, and it +will use a gvim server (see |g:netrw_servername|). Subsequent use of +(see |netrw-cr|) will re-use that server for editing files. + +Related topics: + |netrw-ctrl-r| |netrw-o| |netrw-p| + |netrw-P| |netrw-t| |netrw-v| +Associated setting variables: + |g:netrw_servername| : sets name of server + |g:netrw_browse_split| : controls how will open files + + +CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2 The "i" map cycles between the thin, long, wide, and tree listing formats. @@ -1267,7 +1345,7 @@ name. One may make a preferred listing style your default; see |g:netrw_liststyle|. As an example, by putting the following line in your .vimrc, > - let g:netrw_liststyle= 4 + let g:netrw_liststyle= 3 the tree style will become your default listing style. One typical way to use the netrw tree display is to: > @@ -1321,8 +1399,15 @@ The "u" map also accepts counts to go back in the history several slots. For your convenience, |netrw-qb| lists the history number which can be re-used in that count. + *.netrwhist* See |g:netrw_dirhistmax| for how to control the quantity of history stack -slots. +slots. The file ".netrwhist" holds history when netrw (and vim) is not +active. By default, its stored on the first directory on the user's +|'runtimepath'|. + +Related Topics: + |netrw-U| changing to a successor directory + |g:netrw_home| controls where .netrwhist is kept CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2 @@ -1337,7 +1422,7 @@ See |g:netrw_dirhistmax| for how to control the quantity of history stack slots. -CHANGING TREE TOP *netrw-ntree* *:Ntree* +CHANGING TREE TOP *netrw-ntree* *:Ntree* {{{2 One may specify a new tree top for tree listings using > @@ -1348,7 +1433,7 @@ information is elided). With a "dirname", the specified directory name is used. -NETRW CLEAN *netrw-clean* *:NetrwClean* +NETRW CLEAN *netrw-clean* *:NetrwClean* {{{2 With :NetrwClean one may easily remove netrw from one's home directory; more precisely, from the first directory on your |'runtimepath'|. @@ -1361,17 +1446,16 @@ that the removal is in fact what you want to do. If netrw doesn't have permission to remove a file, it will issue an error message. *netrw-gx* -CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* *netrw-handler* {{{2 +CUSTOMIZING BROWSING WITH A SPECIAL HANDLER *netrw-x* *netrw-handler* {{{2 (also see |netrw_filehandler|) Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are -best seen with a special handler (ie. a tool provided with your computer). -Netrw allows one to invoke such special handlers by: > +best seen with a special handler (ie. a tool provided with your computer's +operating system). Netrw allows one to invoke such special handlers by: > * when Exploring, hit the "x" key * when editing, hit gx with the cursor atop the special filename -< (not available if the |g:netrw_nogx| variable exists) - +< (latter not available if the |g:netrw_nogx| variable exists) Netrw determines which special handler by the following method: * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to @@ -1379,14 +1463,14 @@ Netrw determines which special handler by the following method: :let g:netrw_browsex_viewer= "kfmclient exec" < or > - :let g:netrw_browsex_viewer= "gnome-open" + :let g:netrw_browsex_viewer= "xdg-open" < - If g:netrw_browsex_viewer == '-', then netrwFileHandler() will be - invoked first (see |netrw_filehandler|). + If g:netrw_browsex_viewer == '-', then netrwFileHandlers#Invoke() will be + used instead (see |netrw_filehandler|). * for Windows 32 or 64, the url and FileProtocolHandler dlls are used. * for Gnome (with gnome-open): gnome-open is used. - * for KDE (with kfmclient) : kfmclient is used. + * for KDE (with kfmclient) : kfmclient is used * for Mac OS X : open is used. * otherwise the netrwFileHandler plugin is used. @@ -1395,17 +1479,31 @@ appropriate application to use to "handle" these files. Such things as OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript (*.ps, *.eps) can be handled. +The gx mapping extends to all buffers; apply "gx" while atop a word and netrw +will apply a special handler to it (like "x" works when in a netrw buffer). +One may also use visual mode (see |visual-start|) to select the text that the +special handler will use. Normally gx uses expand("") to pick up the +text under the cursor; one may change what |expand()| uses via the +|g:netrw_gx| variable. Alternatively, one may select the text to be used by +gx via first making a visual selection (see |visual-block|). + +Associated setting variables: + |g:netrw_gx| control how gx picks up the text under the cursor + |g:netrw_nogx| prevent gx map while editing + *netrw_filehandler* -The "x" map applies a function to a file, based on its extension. Of course, -the handler function must exist for it to be called! +When |g:netrw_browsex_viewer| exists and is "-", then netrw will attempt to +handle the special file with a vim function. The "x" map applies a function +to a file, based on its extension. Of course, the handler function must exist +for it to be called! > - Ex. mypgm.html x -> - NFH_html("scp://user@host/some/path/mypgm.html") -< -Users may write their own netrw File Handler functions to support more -suffixes with special handling. See for -examples on how to make file handler functions. As an example: > + Ex. mypgm.html x -> NFH_html("scp://user@host/some/path/mypgm.html") + +< Users may write their own netrw File Handler functions to + support more suffixes with special handling. See + for examples on how to make + file handler functions. As an example: > " NFH_suffix(filename) fun! NFH_suffix(filename) @@ -1439,7 +1537,14 @@ DELETING BOOKMARKS *netrw-mB* {{{2 To delete a bookmark, use > {cnt}mB -< + +If there are marked files, then mB will remove them from the +bookmark list. + +Alternatively, one may use :NetrwMB! (see |netrw-:NetrwMB|). > + + :NetrwMB! [files/directories] + Related Topics: |netrw-gb| how to return (go) to a bookmark |netrw-mb| how to make a bookmark @@ -1498,11 +1603,11 @@ DIRECTORY EXPLORATION COMMANDS {{{2 :[N]Explore[!] [dir]... Explore directory of current file *:Explore* :[N]Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore* - :Rexplore ... Return to/from Explorer *:Rexplore* + :[N]Lexplore[!] [dir]... Left Explorer Toggle *:Lexplore* :[N]Sexplore[!] [dir]... Split&Explore current file's directory *:Sexplore* - :Texplore [dir]... Tab & Explore *:Texplore* :[N]Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore* - :Lexplore [dir]... Left Explorer Toggle *:Lexplore* + :Texplore [dir]... Tab & Explore *:Texplore* + :Rexplore ... Return to/from Explorer *:Rexplore* Used with :Explore **/pattern : (also see |netrw-starstar|) :Nexplore............. go to next matching file *:Nexplore* @@ -1511,54 +1616,73 @@ DIRECTORY EXPLORATION COMMANDS {{{2 *netrw-:Explore* :Explore will open the local-directory browser on the current file's directory (or on directory [dir] if specified). The window will be - split only if the file has been modified, otherwise the browsing - window will take over that window. Normally the splitting is taken - horizontally. + split only if the file has been modified and |'hidden'| is not set, + otherwise the browsing window will take over that window. Normally + the splitting is taken horizontally. Also see: |netrw-:Rexplore| :Explore! is like :Explore, but will use vertical splitting. - *netrw-:Lexplore* -:Lexplore [dir] toggles an Explorer window on the left hand side - of the current tab It will open a netrw window on the current - directory if [dir] is omitted; a :Lexplore [dir] will show - the specified directory in the left-hand side browser display - no matter from which window the command is issued. By default, - :Lexplore will change an uninitialized |g:netrw_chgwin| to 2; - edits will thus be preferentially made in window#2. - Also see: |netrw-C|| |g:netrw_chgwin| |g:netrw_winsize| - |netrw-p| |netrw-P|| |g:netrw_browse_split| - *netrw-:Sexplore* -:Sexplore will always split the window before invoking the local-directory - browser. As with Explore, the splitting is normally done - horizontally. -:Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically. + *netrw-:Hexplore* :Hexplore [dir] does an :Explore with |:belowright| horizontal splitting. :Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting. - *netrw-:Vexplore* -:Vexplore [dir] does an :Explore with |:leftabove| vertical splitting. -:Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting. + + *netrw-:Lexplore* +:[N]Lexplore [dir] toggles a full height Explorer window on the left hand side + of the current tab. It will open a netrw window on the current + directory if [dir] is omitted; a :Lexplore [dir] will show the + specified directory in the left-hand side browser display no matter + from which window the command is issued. By default, :Lexplore will + change an uninitialized |g:netrw_chgwin| to 2; edits will thus + preferentially be made in window#2. + The [N] specifies a |g:netrw_winsize| just for the new :Lexplore + window. + Those who like this method often also like tree style displays; + see |g:netrw_liststyle|. + + Also see: |netrw-C| |g:netrw_chgwin| |g:netrw_winsize| + |netrw-p| |netrw-P| |g:netrw_browse_split| + +:[N]Lexplore! is like :Lexplore, except that the full-height Explorer window + will open on the right hand side, and an uninitialized |g:netrw_chgwin| + will be set to 1. + + *netrw-:Sexplore* +:[N]Sexplore will always split the window before invoking the local-directory + browser. As with Explore, the splitting is normally done + horizontally. +:[N]Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically. + *netrw-:Texplore* :Texplore [dir] does a |:tabnew| before generating the browser window -By default, these commands use the current file's directory. However, one may -explicitly provide a directory (path) to use. + *netrw-:Vexplore* +:[N]Vexplore [dir] does an :Explore with |:leftabove| vertical splitting. +:[N]Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting. -The [N] will override |g:netrw_winsize| to specify the quantity of rows and/or -columns the new explorer window should have. +The optional parameters are: -Otherwise, the |g:netrw_winsize| variable, if it has been specified by the -user, is used to control the quantity of rows and/or columns new explorer -windows should have. + [N]: This parameter will override |g:netrw_winsize| to specify the quantity of + rows and/or columns the new explorer window should have. + Otherwise, the |g:netrw_winsize| variable, if it has been specified by the + user, is used to control the quantity of rows and/or columns new + explorer windows should have. + [dir]: By default, these explorer commands use the current file's directory. + However, one may explicitly provide a directory (path) to use instead; + ie. > + + :Explore /some/path +< *netrw-:Rexplore* -:Rexplore This command is a little different from the others as it doesn't - necessarily open an Explorer window. +:Rexplore This command is a little different from the other Explore commands + as it doesn't necessarily open an Explorer window. Return to Explorer~ - When one edits a file, for example by pressing when the - cursor is atop a file in a netrw browser window, :Rexplore will - return the display to that of the last netrw browser display - in that window. + When one edits a file using netrw which can occur, for example, + when pressing while the cursor is atop a filename in a netrw + browser window, a :Rexplore issued while editing that file will + return the display to that of the last netrw browser display in + that window. Return from Explorer~ Conversely, when one is editing a directory, issuing a :Rexplore @@ -1571,11 +1695,11 @@ windows should have. Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize| -*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat* -EXPLORING WITH STARS AND PATTERNS +*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat* *netrw-grep* +EXPLORING WITH STARS AND PATTERNS {{{2 When Explore, Sexplore, Hexplore, or Vexplore are used with one of the -following four styles, Explore generates a list of files which satisfy +following four patterns Explore generates a list of files which satisfy the request. > */filepat files in current directory which satisfy filepat @@ -1597,7 +1721,7 @@ will clear the explore list. If your console or gui produces recognizable shift-up or shift-down sequences, then you'll likely find using shift-downarrow and shift-uparrow convenient. -They're mapped by netrw: +They're mapped by netrw as follows: == Nexplore, and == Pexplore. @@ -1678,7 +1802,7 @@ Related topics: |netrw-s| |netrw-S| Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options| -EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* +EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* {{{2 Pressing X while the cursor is atop an executable file will yield a prompt using the filename asking for any arguments. Upon pressing a [return], netrw @@ -1769,18 +1893,19 @@ Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh| Netrw provides a helper function 'netrw_gitignore#Hide()' that, when used with |g:netrw_list_hide| automatically hides all git-ignored files. -'netrw_gitignore#Hide' searches for patterns in the following files: +'netrw_gitignore#Hide' searches for patterns in the following files: > + './.gitignore' './.git/info/exclude' global gitignore file: `git config --global core.excludesfile` system gitignore file: `git config --system core.excludesfile` - +< Files that do not exist, are ignored. Git-ignore patterns are taken from existing files, and converted to patterns for hiding files. For example, if you had '*.log' in your '.gitignore' file, it would be converted to '.*\.log'. -To use this function, simply assign it's output to |g:netrw_list_hide| option. +To use this function, simply assign its output to |g:netrw_list_hide| option. > Example: let g:netrw_list_hide= netrw_gitignore#Hide() Git-ignored files are hidden in Netrw. @@ -1790,7 +1915,7 @@ To use this function, simply assign it's output to |g:netrw_list_hide| option. Example: g:netrw_list_hide= netrw_gitignore#Hide() . '.*\.swp$' Combining 'netrw_gitignore#Hide' with custom patterns. - +< IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2 @@ -1926,7 +2051,7 @@ Associated setting variable: |g:netrw_keepdir| MARKING FILES *netrw-:MF* *netrw-mf* {{{2 (also see |netrw-mr|) -Netrw has several ways of marking files: +Netrw provides several ways to mark files: * One may mark files with the cursor atop a filename and then pressing "mf". @@ -1949,6 +2074,8 @@ The following netrw maps make use of marked files: |netrw-a| Hide marked files/directories |netrw-D| Delete marked files/directories + |netrw-mb| Append marked files to bookmarks + |netrw-mB| Delete marked files from bookmarks |netrw-mc| Copy marked files to target |netrw-md| Apply vimdiff to marked files |netrw-me| Edit marked files @@ -1958,7 +2085,9 @@ The following netrw maps make use of marked files: |netrw-mp| Print marked files |netrw-mt| Set target for |netrw-mm| and |netrw-mc| |netrw-mT| Generate tags using marked files + |netrw-mv| Apply vim command to marked files |netrw-mx| Apply shell command to marked files + |netrw-mX| Apply shell command to marked files, en bloc |netrw-mz| Compress/Decompress marked files |netrw-O| Obtain marked files |netrw-R| Rename marked files @@ -1982,13 +2111,13 @@ If the mouse is enabled and works with your vim, you may use to mark one or more files. You may mark multiple files by dragging the shifted leftmouse. (see |netrw-mouse|) -*markfilelist* *global_markfilelist* *local_markfilelist* + *markfilelist* *global_markfilelist* *local_markfilelist* All marked files are entered onto the global marked file list; there is only -one such list. In addition, every netrw buffer also has its own local marked -file list; since netrw buffers are associated with specific directories, this -means that each directory has its own local marked file list. The various -commands which operate on marked files use one or the other of the marked file -lists. +one such list. In addition, every netrw buffer also has its own buffer-local +marked file list; since netrw buffers are associated with specific +directories, this means that each directory has its own local marked file +list. The various commands which operate on marked files use one or the other +of the marked file lists. Known Problem: if one is using tree mode (|g:netrw_liststyle|) and several directories have files with the same name, then marking such a file will @@ -2004,7 +2133,7 @@ This command will unmark all files in the current buffer. One may also use mf (|netrw-mf|) on a specific file to unmark just that file. -MARKING FILES BY QUICKFIX LIST *netrw-qF* +MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2 (also see |netrw-mf|) One may convert the |quickfix-error-lists| into a marked file list using @@ -2024,7 +2153,20 @@ future I may make it possible to use |regexp|s instead of glob()-style expressions (yet-another-option). -MARKED FILES: ARBITRARY COMMAND *netrw-mx* {{{2 +MARKED FILES, ARBITRARY VIM COMMAND *netrw-mv* {{{2 + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the local marked-file list) + +The "mv" map causes netrw execute an arbitrary vim command on each file +on the local marked file list, individually: + + * 1split + * sil! keepalt e file + * run vim command + * sil! keepalt wq! + + +MARKED FILES, ARBITRARY SHELL COMMAND *netrw-mx* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked-file list) @@ -2033,6 +2175,37 @@ command to be applied to all marked files. All "%"s in the command will be substituted with the name of each marked file in turn. If no "%"s are in the command, then the command will be followed by a space and a marked filename. +Example: + (mark files) + mx + Enter command: cat + + The result is a series of shell commands: + cat 'file1' + cat 'file2' + ... + + +MARKED FILES, ARBITRARY SHELL COMMAND, EN BLOC *netrw-mX* {{{2 + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the global marked-file list) + +Upon activation of the 'mX' map, netrw will query the user for some (external) +command to be applied to all marked files on the global marked file list. The +"en bloc" means that one command will be executed on all the files at once: > + + command files + +It is useful, for example, to select files and make a tarball: + + (mark files) + mX + Enter command: tar cf mynewtarball.tar + +The command that will be run in this example: + + tar cf mynewtarball.tar 'file1' 'file2' ... + MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) @@ -2046,6 +2219,10 @@ that's "gzip". For decompression, netrw provides a |Dictionary| of suffices and their associated decompressing utilities; see |g:netrw_decompress|. +Remember that one can mark multiple files by regular expression +(see |netrw-mr|); this is particularly useful to facilitate compressing and +decompressing a large number of files. + Associated setting variables: |g:netrw_compress| |g:netrw_decompress| MARKED FILES: COPYING *netrw-mc* {{{2 @@ -2056,7 +2233,16 @@ Select a target directory with mt (|netrw-mt|). Then change directory, select file(s) (see |netrw-mf|), and press "mc". The copy is done from the current window (where one does the mf) to the target. -Associated setting variable: |g:netrw_localcopycmd| |g:netrw_ssh_cmd| +If one does not have a target directory set with |netrw-mt|, then netrw +will query you for a directory to copy to. + +One may also copy directories and their contents (local only) to a target +directory. + +Associated setting variables: + |g:netrw_localcopycmd| + |g:netrw_localcopydircmd| + |g:netrw_ssh_cmd| MARKED FILES: DIFF *netrw-md* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) @@ -2090,7 +2276,7 @@ Thus, one may use > mr ...file-pattern mg ..contents-pattern to have a marked file list satisfying the file-pattern but containing the -desried contents-pattern. +desired contents-pattern. MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) @@ -2148,7 +2334,7 @@ Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|): * Also, if the cursor is in the banner, then the netrw window's currently displayed directory is used for the copy/move-to target. Unless the target already is the current directory. In which case, - remove the target. + typing "mf" clears the target. * However, if the cursor is atop a directory name, then that directory is used for the copy/move-to target @@ -2157,9 +2343,9 @@ Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|): This command uses ||, so spaces in the directory name are permitted without escaping. -There is only one copy/move-to target per vim session; ie. the target is a -script variable (see |s:var|) and is shared between all netrw windows (in an -instance of vim). +There is only one copy/move-to target at a time in a vim session; ie. the +target is a script variable (see |s:var|) and is shared between all netrw +windows (in an instance of vim). When using menus and gvim, netrw provides a "Targets" entry which allows one to pick a target from the list of bookmarks and history. @@ -2196,7 +2382,7 @@ edit the desired file and go to the tag. Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd| -MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2 +MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2 Sets the marked file copy/move-to target. @@ -2214,7 +2400,7 @@ Related topics: Moving files to target.............................|netrw-mm| -MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2 +MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2 Sets the marked file copy/move-to target. @@ -2269,15 +2455,13 @@ your browsing preferences. (see also: |netrw-settings|) *g:netrw_banner* enable/suppress the banner =0: suppress the banner =1: banner is enabled (default) - NOTE: suppressing the banner is a new feature - which may cause problems. *g:netrw_bannerbackslash* if this variable exists and is not zero, the banner will be displayed with backslashes rather than forward slashes. *g:netrw_browse_split* when browsing, will open the file by: - =0: re-using the same window + =0: re-using the same window (default) =1: horizontally splitting the window first =2: vertically splitting the window first =3: open file in new tab @@ -2285,10 +2469,19 @@ your browsing preferences. (see also: |netrw-settings|) Note that |g:netrw_preview| may be used to get vertical splitting instead of horizontal splitting. + =[servername,tab-number,window-number] + Given a |List| such as this, a remote server + named by the "servername" will be used for + editing. It will also use the specified tab + and window numbers to perform editing + (see |clientserver|, |netrw-ctrl-r|) + This option does not affect |:Lexplore| + windows. Related topics: - |netrw-cr| |netrw-C| - |g:netrw_alto| |g:netrw_altv| + |g:netrw_alto| |g:netrw_altv| + |netrw-C| |netrw-cr| + |netrw-ctrl-r| *g:netrw_browsex_viewer* specify user's preference for a viewer: > "kfmclient exec" @@ -2321,7 +2514,7 @@ your browsing preferences. (see also: |netrw-settings|) tags *g:netrw_cursor* = 2 (default) - This option controls the use of the + This option controls the use of the |'cursorline'| (cul) and |'cursorcolumn'| (cuc) settings by netrw: @@ -2385,7 +2578,7 @@ your browsing preferences. (see also: |netrw-settings|) versus speed. *g:netrw_ffkeep* (default: doesn't exist) - If this variable exists and is zero, then + If this variable exists and is zero, then netrw will not do a save and restore for |'fileformat'|. @@ -2428,6 +2621,11 @@ your browsing preferences. (see also: |netrw-settings|) These characters in directory names are escaped before applying glob() + *g:netrw_gx* ="" + This option controls how gx (|netrw-gx|) picks + up the text under the cursor. See |expand()| + for possibilities. + *g:netrw_hide* Controlled by the "a" map (see |netrw-a|) =0 : show all =1 : show not-hidden files @@ -2447,10 +2645,22 @@ your browsing preferences. (see also: |netrw-settings|) The current browsing directory is contained in b:netrw_curdir (also see |netrw-c|) + *g:netrw_keepj* ="keepj" (default) netrw attempts to keep the + |:jumps| table unaffected. + ="" netrw will not use |:keepjumps| with + exceptions only for the + saving/restoration of position. + *g:netrw_list_cmd* command for listing remote directories default: (if ssh is executable) "ssh HOSTNAME ls -FLa" + *g:netrw_list_cmd_options* If this variable exists, then its contents are + appended to the g:netrw_list_cmd. For + example, use "2>/dev/null" to get rid of banner + messages on unix systems. + + *g:netrw_liststyle* Set the default listing style: = 0: thin listing (one file per line) = 1: long listing (one file per line with time @@ -2468,7 +2678,7 @@ your browsing preferences. (see also: |netrw-settings|) Examples: let g:netrw_list_hide= '.*\.swp$' - let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$' + let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$' default: "" *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin @@ -2476,6 +2686,11 @@ your browsing preferences. (see also: |netrw-settings|) Copies marked files (|netrw-mf|) to target directory (|netrw-mt|, |netrw-mc|) + *g:netrw_localcopydircmd* ="cp -R" Linux/Unix/MacOS/Cygwin + ="xcopy /e /c /h/ /i /k" Windows + Copies directories to target directory. + (|netrw-mc|, |netrw-mt|) + *g:netrw_localmkdir* command for making a local directory default: "mkdir" @@ -2499,7 +2714,7 @@ your browsing preferences. (see also: |netrw-settings|) default: "ssh USEPORT HOSTNAME mkdir" *g:netrw_mousemaps* =1 (default) enables mouse buttons while - browsing to: + browsing to: leftmouse : open file/directory shift-leftmouse : mark file middlemouse : same as P @@ -2543,6 +2758,10 @@ your browsing preferences. (see also: |netrw-settings|) *g:netrw_rmf_cmd* command for removing remote softlinks default: "ssh USEPORT HOSTNAME rm -f" + *g:netrw_servername* use this variable to provide a name for + |netrw-ctrl-r| to use for its server. + default: "NETRWSERVER" + *g:netrw_sort_by* sort by "name", "time", or "size" default: "name" @@ -2731,7 +2950,7 @@ Related topics: directory, see |g:netrw_keepdir|. *netrw-createfile* -OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* +OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* {{{2 To open a new file in netrw's current directory, press "%". This map will query the user for a new filename; an empty file by that name will @@ -2744,9 +2963,9 @@ PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2 One may use a preview window by using the "p" key when the cursor is atop the desired filename to be previewed. The display will then split to show both -the browser (where the cursor will remain) and the file (see |:pedit|). -By default, the split will be taken horizontally; one may use vertical -splitting if one has set |g:netrw_preview| first. +the browser (where the cursor will remain) and the file (see |:pedit|). By +default, the split will be taken horizontally; one may use vertical splitting +if one has set |g:netrw_preview| first. An interesting set of netrw settings is: > @@ -2755,6 +2974,7 @@ An interesting set of netrw settings is: > let g:netrw_winsize = 30 These will: + 1. Make vertical splitting the default for previewing files 2. Make the default listing style "tree" 3. When a vertical preview window is opened, the directory listing @@ -2817,6 +3037,17 @@ If there are marked files: (see |netrw-mf|) Marked files will be renamed (moved). You will be queried as above in order to specify where you want the file/directory to be moved. + If you answer a renaming query with a "s/frompattern/topattern/", then + subsequent files on the marked file list will be renamed by taking each + name, applying that substitute, and renaming each file to the result. + As an example : > + + mr [query: reply with *.c] + R [query: reply with s/^\(.*\)\.c$/\1.cpp/] +< + This example will mark all *.c files and then rename them to *.cpp + files. + WARNING:~ Note that moving files is a dangerous operation; copies are safer. That's @@ -2843,17 +3074,24 @@ Related topics: |netrw-r| |netrw-S| Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence| -SETTING EDITING WINDOW *netrw-C* {{{2 +SETTING EDITING WINDOW *netrw-C* *netrw-:NetrwC* {{{2 -One may select a netrw window for editing with the "C" mapping, or by setting -g:netrw_chgwin to the selected window number. Subsequent selection of a file -to edit (|netrw-cr|) will use that window. +One may select a netrw window for editing with the "C" mapping, using the +:NetrwC [win#] command, or by setting g:netrw_chgwin to the selected window +number. Subsequent selection of a file to edit (|netrw-cr|) will use that +window. * C by itself, will select the current window for editing via |netrw-cr| * [count]C the count will be used as the window number to be used for editing via |netrw-cr|. + + * :NetrwC will set |g:netrw_chgwin| to the current window + + * :NetrwC win# will set |g:netrw_chgwin| to the specified window + number + Using > let g:netrw_chgwin= -1 will restore the default editing behavior (ie. use the current window). @@ -3107,7 +3345,7 @@ Associated setting variables: |g:netrw_chgwin| "let g:netrw_scp_cmd = "d:\\dev\\putty\\PSCP.exe" < *netrw-p14* - P14. I'd would like to speed up writes using Nwrite and scp/ssh + P14. I would like to speed up writes using Nwrite and scp/ssh style connections. How? (Thomer M. Gil) Try using ssh's ControlMaster and ControlPath (see the ssh_config @@ -3155,15 +3393,66 @@ Associated setting variables: |g:netrw_chgwin| directory. Start if from your $HOME or another writable directory. + *netrw-p17* + P17. Netrw is closing buffers on its own. + What steps will reproduce the problem? + 1. :Explore, navigate directories, open a file + 2. :Explore, open another file + 3. Buffer opened in step 1 will be closed. o + What is the expected output? What do you see instead? + I expect both buffers to exist, but only the last one does. + + (Lance) Problem is caused by "set autochdir" in .vimrc. + (drchip) I am able to duplicate this problem with |'acd'| set. + It appears that the buffers are not exactly closed; + a ":ls!" will show them (although ":ls" does not). + + *netrw-P18* + P18. How to locally edit a file that's only available via + another server accessible via ssh? + See http://stackoverflow.com/questions/12469645/ + "Using Vim to Remotely Edit A File on ServerB Only + Accessible From ServerA" + ============================================================================== 11. Debugging Netrw Itself *netrw-debug* {{{1 -The script is typically available as something like: +Step 1: check that the problem you've encountered hasn't already been resolved +by obtaining a copy of the latest (often developmental) netrw at: + + http://www.drchip.org/astronaut/vim/index.html#NETRW + +The script is typically installed on systems as something like: > /usr/local/share/vim/vim7x/plugin/netrwPlugin.vim /usr/local/share/vim/vim7x/autoload/netrw.vim + (see output of :echo &rtp) < -which is loaded automatically at startup (assuming :set nocp). +which is loaded automatically at startup (assuming :set nocp). If you +installed a new netrw, then it will be located at > + + $HOME/.vim/plugin/netrwPlugin.vim + $HOME/.vim/autoload/netrw.vim +< +Step 2: assuming that you've installed the latest version of netrw, +check that your problem is really due to netrw. Create a file +called netrw.vimrc with the following contents: > + + set nocp + so $HOME/.vim/plugin/netrwPlugin.vim +< +Then run netrw as follows: > + + vim -u netrw.vimrc --noplugins [some path here] +< +Perform whatever netrw commands you need to, and check that the problem is +still present. This procedure sidesteps any issues due to personal .vimrc +settings and other plugins. If the problem does not appear, then you need +to determine what setting in your .vimrc is causing the conflict with netrw +or which plugin. + +Step 3: If the problem still is present, then get a debugging trace from +netrw: 1. Get the script, available as: @@ -3192,7 +3481,8 @@ which is loaded automatically at startup (assuming :set nocp). 3. Then bring up vim and attempt to evoke the problem by doing a transfer or doing some browsing. A set of messages should appear concerning the steps that took in attempting to - read/write your file over the network in a separate tab. + read/write your file over the network in a separate tab or + server vim window. To save the file, use > @@ -3207,14 +3497,82 @@ which is loaded automatically at startup (assuming :set nocp). debugging trace is due to which command. Please send that information to 's maintainer along - with the o/s you're using and vim version you're using + with the o/s you're using and the vim version that you're using (see |:version|) > NdrOchip at ScampbellPfamily.AbizM - NOSPAM < ============================================================================== 12. History *netrw-history* {{{1 - v152: Apr 08, 2014 * uses the |'noswapfile'| option (requires + v153: May 13, 2014 * added another |g:netrw_ffkeep| usage {{{2 + May 14, 2014 * changed s:PerformListing() so that it + always sets ft=netrw for netrw buffers + (ie. even when syntax highlighting is + off, not available, etc) + May 16, 2014 * introduced the |netrw-ctrl-r| functionality + May 17, 2014 * introduced the |netrw-:NetrwMB| functionality + * mb and mB (|netrw-mb|, |netrw-mB|) will + add/remove marked files from bookmark list + May 20, 2014 * (Enno Nagel) reported that :Lex + wasn't working. Fixed. + May 26, 2014 * restored test to prevent leftmouse window + resizing from causing refresh. + (see s:NetrwLeftmouse()) + * fixed problem where a refresh caused cursor + to go just under the banner instead of + staying put + May 28, 2014 * (László Bimba) provided a patch for opening + the |:Lexplore| window 100% high, optionally + on the right, and will work with remote + files. + May 29, 2014 * implemented :NetrwC (see |netrw-:NetrwC|) + Jun 01, 2014 * Removed some "silent"s from commands used + to implemented scp://... and pscp://... + directory listing. Permits request for + password to appear. + Jun 05, 2014 * (Enno Nagel) reported that user maps "/" + caused problems with "b" and "w", which + are mapped (for wide listings only) to + skip over files rather than just words. + Jun 10, 2014 * |g:netrw_gx| introduced to allow users to + override default "" with the gx + (|netrw-gx|) map + Jun 11, 2014 * gx (|netrw-gx|), with |'autowrite'| set, + will write modified files. s:NetrwBrowseX() + will now save, turn off, and restore the + |'autowrite'| setting. + Jun 13, 2014 * added visual map for gx use + Jun 15, 2014 * (Enno Nagel) reported that with having hls + set and wide listing style in use, that the + b and w maps caused unwanted highlighting. + Jul 05, 2014 * |netrw-mv| and |netrw-mX| commands included + Jul 09, 2014 * |g:netrw_keepj| included, allowing optional + keepj + Jul 09, 2014 * fixing bugs due to previous update + Jul 21, 2014 * (Bruno Sutic) provided an updated + netrw_gitignore.vim + Jul 30, 2014 * (Yavuz Yetim) reported that editing two + remote files of the same name caused the + second instance to have a "temporary" + name. Fixed: now they use the same buffer. + Sep 18, 2014 * (Yasuhiro Matsumoto) provided a patch which + allows scp and windows local paths to work. + Oct 07, 2014 * gx (see |netrw-gx|) when atop a directory, + will now do |gf| instead + Nov 06, 2014 * For cygwin: cygstart will be available for + netrw#BrowseX() to use if its executable. + Nov 07, 2014 * Began support for file://... urls. Will use + |g:netrw_file_cmd| (typically elinks or links) + Dec 02, 2014 * began work on having mc (|netrw-mc|) copy + directories. Works for linux machines, + cygwin+vim, but not for windows+gvim. + Dec 02, 2014 * in tree mode, netrw was not opening + directories via symbolic links. + Dec 02, 2014 * added resolved link information to + thin and tree modes + Dec 30, 2014 * (issue#231) |:ls| was not showing + remote-file buffers reliably. Fixed. + v152: Apr 08, 2014 * uses the |'noswapfile'| option (requires {{{2 vim 7.4 with patch 213) * (Enno Nagel) turn |'rnu'| off in netrw buffers. @@ -3240,7 +3598,7 @@ which is loaded automatically at startup (assuming :set nocp). chgwin window. May 09, 2014 * SavePosn was "saving filename under cursor" from a non-netrw window when using :Rex. - v151: Jan 22, 2014 * extended :Rexplore to return to buffer + v151: Jan 22, 2014 * extended :Rexplore to return to buffer {{{2 prior to Explore or editing a directory * (Ken Takata) netrw gave error when clipboard was disabled. Sol'n: Placed @@ -3287,7 +3645,7 @@ which is loaded automatically at startup (assuming :set nocp). and it also handles Window's shares * Fixed |netrw-d| command when applied with ftp * https: support included for netrw#NetRead() - v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to + v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to {{{2 return to the netrw directory listing Jul 13, 2013 * (Jonas Diemer) suggested changing a to . @@ -3342,7 +3700,7 @@ which is loaded automatically at startup (assuming :set nocp). style, with a previous window open, that the wrong directory was being used to open a file. Fixed. (P21) - v149: Apr 18, 2013 * in wide listing format, now have maps for + v149: Apr 18, 2013 * in wide listing format, now have maps for {{{2 w and b to move to next/previous file Apr 26, 2013 * one may now copy files in the same directory; netrw will issue requests for @@ -3356,133 +3714,9 @@ which is loaded automatically at startup (assuming :set nocp). requested by Paul Domaskis. Jul 03, 2013 * Explore now avoids splitting when a buffer will be hidden. - v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct + v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct {{{2 choice of listing style, hiding style, and sorting style - v147: Nov 24, 2012 * (James McCoy) Even with g:netrw_dirhistmax - at zero, the .vim/ directory would be - created to support history/bookmarks. I've - gone over netrw to suppress history and - bookmarking when g:netrw_dirhistmax is zero. - For instance, the menus will display - (disabled) when attempts to use - bookmarks/history are made. - Nov 29, 2012 * (Kim Jang-hwan) reported that with - g:Align_xstrlen set to 3 that the cursor was - moved (linewise) after invocation. This - problem also afflicted netrw. - (see |g:netrw_xstrlen|) Fixed. - Jan 21, 2013 * (mattn) provided a patch to insert some - endifs needed with the code implementing - |netrw-O|. - Jan 24, 2013 * (John Szakmeister) found that remote file - editing resulted in filetype options being - overwritten by NetrwOptionRestore(). I - moved filetype detect from NetrwGetFile() - to NetrwOptionRestore. - Feb 17, 2013 * (Yukhiro Nakadaira) provided a patch - correcting some syntax errors. - Feb 28, 2013 * (Ingo Karkat) provided a patch preventing - receipt of an |E95| when revisiting a - file://... style url. - Mar 18, 2013 * (Gary Johnson) pointed out that changing - cedit to caused problems with visincr; - the cedit setting is now bypassed in netrw too. - Apr 02, 2013 * (Paul Domaskis) reported an undefined - variable error (s:didstarstar) was - occurring. It is now defined at - initialization. - * included additional sanity checking for the - marked file functions. - * included |netrw-qF| and special "j" option - handling for |netrw-mg| - Apr 12, 2013 * |netrw-u| and |netrw-U| now handle counts - * the former mapping for "T" has been removed; - in its place are new maps, |netrw-Tb| and |netrw-Th|. - * the menu now supports a "Targets" entry for - easier target selection. (see |netrw-mt|) - * (Paul Domaskis) reported some problems with - moving/copying files under Windows' gvim - (ie. not cygwin). Fixed. - * (Paul Mueller) provided a patch to get - start and rundll working via |netrw-gx| - by bypassing the user's |'shellslash'| option. - v146: Oct 20, 2012 * (David Kotchan) reported that under Windows, - directories named with unusual characters - such as "#" or "$" were not being listed - properly. - * (Kenny Lee) reported that the buffer list - was being populated by netrw buffers. - Netrw will now |:bwipe| netrw buffers - upon editing a file if g:netrw_fastbrowse - is zero and its not in tree listing style. - * fixed a bug with s:NetrwInit() that - prevented initialization with |Lists| and - |Dictionaries|. - * |netrw-mu| now unmarks marked-file lists - v145: Apr 05, 2012 * moved some command from a g:netrw_local_... - format to g:netwr_local... format - * included some NOTE level messages about - commands that aren't executable - * |g:netrw_errorlvl| (default: NOTE=0) - option introduced - May 18, 2012 * (Ilya Dogolazky) a scenario where a - |g:netrw_fastbrowse| of zero did not - have a local directory refreshed fixed. - Jul 10, 2012 * (Donatas) |netrw-gb| wasn't working due - to an incorrectly used variable. - Aug 09, 2012 * (Bart Baker) netrw was doubling - of entries after a split. - * (code by Takahiro Yoshihara) implemented - |g:netrw_dynamic_maxfilenamelen| - Aug 31, 2012 * (Andrew Wong) netrw refresh overwriting - the yank buffer. - v144: Mar 12, 2012 * when |CTRL-W_s| or |CTRL-W_v| are used, - or their wincmd equivalents, on a netrw - buffer, the netrw's w: variables were - not copied over. Fixed. - Mar 13, 2012 * nbcd_curpos_{bufnr('%')} was commented - out, and was mistakenly used during - RestorePosn. Unfortunately, I'm not - sure why it was commented out, so this - "fix" may re-introduce an earlier problem. - Mar 21, 2012 * included s:rexposn internally to make - :Rex return the cursor to the same pos'n - upon restoration of netrw buffer - Mar 27, 2012 * (sjbesse) s:NetrwGetFile() needs to remove - "/" from the netrw buffer's usual |'isk'| - in order to allow "filetype detect" to work - properly for scripts. - v143: Jun 01, 2011 * |g:netrw_winsize| will accept a negative - number; the absolute value of it will then - be used to specify lines/columns instead of - a percentage. - Jul 05, 2011 * the "d" map now supports mkdir via ftp - See |netrw-d| and |g:netrw_remote_mkdir| - Jul 11, 2011 * Changed Explore!, Sexplore!, and Vexplore - to use a percentage of |winwidth()| instead - of a percentage of |winheight()|. - Jul 11, 2011 * included support for https://... I'm just - beginning to test this, however. - Aug 01, 2011 * changed RestoreOptions to also restore - cursor position in netrw buffers. - Aug 12, 2011 * added a note about "%" to the balloon - Aug 30, 2011 * if |g:netrw_nobeval| exists, then balloon - evaluation is suppressed. - Aug 31, 2011 * (Benjamin R Haskell) provided a patch that - implements non-standard port handling for - files opened via the remote browser. - Aug 31, 2011 * Fixed a **//pattern Explorer bug - Sep 15, 2011 * (reported by Francesco Campana) netrw - now permits the "@" to be part of the - user id (if there's an @ that appears - to the right). - Nov 21, 2011 * New option: |g:netrw_ftp_options| - Dec 07, 2011 * (James Sinclair) provided a fix handling - attempts to use a uid and password when - they weren't defined. This affected - NetWrite (NetRead already had that fix). - ============================================================================== 13. Todo *netrw-todo* {{{1 diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index edeef6655e..01be75accd 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.4. Last change: 2014 Oct 29 +*repeat.txt* For Vim version 7.4. Last change: 2015 Jan 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -235,8 +235,8 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. command is ignored. {not in Vi} - *:scrip* *:scriptnames* -:scrip[tnames] List all sourced script names, in the order they were + *:scr* *:scriptnames* +:scr[iptnames] List all sourced script names, in the order they were first sourced. The number is used for the script ID ||. {not in Vi} {not available when compiled without the diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index efb7bda661..c4964bcf3f 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2014 Nov 19 +*syntax.txt* For Vim version 7.4. Last change: 2015 Jan 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1128,6 +1128,14 @@ to standard by placing this in your vimrc file: > :let enforce_freedesktop_standard = 1 +DIFF *diff.vim* + +The diff highlighting normally finds translated headers. This can be slow if +there are very long lines in the file. To disable translations: > + + :let diff_translations = 0 + + DIRCOLORS *dircolors.vim* *ft-dircolors-syntax* The dircolors utility highlighting definition has one option. It exists to diff --git a/runtime/doc/tags b/runtime/doc/tags index ae7e22f7d8..027df9ac5e 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -1398,6 +1398,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* .dic spell.txt /*.dic* .exrc starting.txt /*.exrc* .gvimrc gui.txt /*.gvimrc* +.netrwbook pi_netrw.txt /*.netrwbook* +.netrwhist pi_netrw.txt /*.netrwhist* .vimrc starting.txt /*.vimrc* / pattern.txt /*\/* /$ pattern.txt /*\/$* @@ -2726,7 +2728,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :sbr windows.txt /*:sbr* :sbrewind windows.txt /*:sbrewind* :sbuffer windows.txt /*:sbuffer* -:scrip repeat.txt /*:scrip* +:scr repeat.txt /*:scr* :scripte repeat.txt /*:scripte* :scriptencoding repeat.txt /*:scriptencoding* :scriptnames repeat.txt /*:scriptnames* @@ -2761,7 +2763,6 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :sfirst windows.txt /*:sfirst* :sh various.txt /*:sh* :shell various.txt /*:shell* -:si gui_w32.txt /*:si* :sig sign.txt /*:sig* :sign sign.txt /*:sign* :sign-define sign.txt /*:sign-define* @@ -2774,6 +2775,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :sign-unplace sign.txt /*:sign-unplace* :sil various.txt /*:sil* :silent various.txt /*:silent* +:sim gui_w32.txt /*:sim* :simalt gui_w32.txt /*:simalt* :sl various.txt /*:sl* :sla windows.txt /*:sla* @@ -5415,6 +5417,7 @@ diff-options diff.txt /*diff-options* diff-original-file diff.txt /*diff-original-file* diff-patchexpr diff.txt /*diff-patchexpr* diff.txt diff.txt /*diff.txt* +diff.vim syntax.txt /*diff.vim* diff_filler() eval.txt /*diff_filler()* diff_hlID() eval.txt /*diff_hlID()* digraph digraph.txt /*digraph* @@ -6008,6 +6011,7 @@ g:netrw_errorlvl pi_netrw.txt /*g:netrw_errorlvl* g:netrw_fastbrowse pi_netrw.txt /*g:netrw_fastbrowse* g:netrw_fetch_cmd pi_netrw.txt /*g:netrw_fetch_cmd* g:netrw_ffkeep pi_netrw.txt /*g:netrw_ffkeep* +g:netrw_file_cmd pi_netrw.txt /*g:netrw_file_cmd* g:netrw_fname_escape pi_netrw.txt /*g:netrw_fname_escape* g:netrw_ftp pi_netrw.txt /*g:netrw_ftp* g:netrw_ftp_browse_reject pi_netrw.txt /*g:netrw_ftp_browse_reject* @@ -6019,6 +6023,7 @@ g:netrw_ftp_timelist_cmd pi_netrw.txt /*g:netrw_ftp_timelist_cmd* g:netrw_ftpextracmd pi_netrw.txt /*g:netrw_ftpextracmd* g:netrw_ftpmode pi_netrw.txt /*g:netrw_ftpmode* g:netrw_glob_escape pi_netrw.txt /*g:netrw_glob_escape* +g:netrw_gx pi_netrw.txt /*g:netrw_gx* g:netrw_hide pi_netrw.txt /*g:netrw_hide* g:netrw_home pi_netrw.txt /*g:netrw_home* g:netrw_http_cmd pi_netrw.txt /*g:netrw_http_cmd* @@ -6026,10 +6031,13 @@ g:netrw_http_put_cmd pi_netrw.txt /*g:netrw_http_put_cmd* g:netrw_http_xcmd pi_netrw.txt /*g:netrw_http_xcmd* g:netrw_ignorenetrc pi_netrw.txt /*g:netrw_ignorenetrc* g:netrw_keepdir pi_netrw.txt /*g:netrw_keepdir* +g:netrw_keepj pi_netrw.txt /*g:netrw_keepj* g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd* +g:netrw_list_cmd_options pi_netrw.txt /*g:netrw_list_cmd_options* g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide* g:netrw_liststyle pi_netrw.txt /*g:netrw_liststyle* g:netrw_localcopycmd pi_netrw.txt /*g:netrw_localcopycmd* +g:netrw_localcopydircmd pi_netrw.txt /*g:netrw_localcopydircmd* g:netrw_localmkdir pi_netrw.txt /*g:netrw_localmkdir* g:netrw_localmovecmd pi_netrw.txt /*g:netrw_localmovecmd* g:netrw_localrmdir pi_netrw.txt /*g:netrw_localrmdir* @@ -6050,6 +6058,7 @@ g:netrw_rsync_cmd pi_netrw.txt /*g:netrw_rsync_cmd* g:netrw_scp_cmd pi_netrw.txt /*g:netrw_scp_cmd* g:netrw_scpport pi_netrw.txt /*g:netrw_scpport* g:netrw_sepchr pi_netrw.txt /*g:netrw_sepchr* +g:netrw_servername pi_netrw.txt /*g:netrw_servername* g:netrw_sftp_cmd pi_netrw.txt /*g:netrw_sftp_cmd* g:netrw_silent pi_netrw.txt /*g:netrw_silent* g:netrw_sort_by pi_netrw.txt /*g:netrw_sort_by* @@ -6998,6 +7007,8 @@ netrw-:Hexplore pi_netrw.txt /*netrw-:Hexplore* netrw-:Lexplore pi_netrw.txt /*netrw-:Lexplore* netrw-:MF pi_netrw.txt /*netrw-:MF* netrw-:MT pi_netrw.txt /*netrw-:MT* +netrw-:NetrwC pi_netrw.txt /*netrw-:NetrwC* +netrw-:NetrwMB pi_netrw.txt /*netrw-:NetrwMB* netrw-:Rexplore pi_netrw.txt /*netrw-:Rexplore* netrw-:Sexplore pi_netrw.txt /*netrw-:Sexplore* netrw-:Texplore pi_netrw.txt /*netrw-:Texplore* @@ -7006,6 +7017,7 @@ netrw-C pi_netrw.txt /*netrw-C* netrw-D pi_netrw.txt /*netrw-D* netrw-O pi_netrw.txt /*netrw-O* netrw-P pi_netrw.txt /*netrw-P* +netrw-P18 pi_netrw.txt /*netrw-P18* netrw-R pi_netrw.txt /*netrw-R* netrw-S pi_netrw.txt /*netrw-S* netrw-Tb pi_netrw.txt /*netrw-Tb* @@ -7035,6 +7047,7 @@ netrw-createfile pi_netrw.txt /*netrw-createfile* netrw-credits pi_netrw.txt /*netrw-credits* netrw-ctrl-h pi_netrw.txt /*netrw-ctrl-h* netrw-ctrl-l pi_netrw.txt /*netrw-ctrl-l* +netrw-ctrl-r pi_netrw.txt /*netrw-ctrl-r* netrw-ctrl_l pi_netrw.txt /*netrw-ctrl_l* netrw-curdir pi_netrw.txt /*netrw-curdir* netrw-d pi_netrw.txt /*netrw-d* @@ -7061,6 +7074,7 @@ netrw-gf pi_netrw.txt /*netrw-gf* netrw-gh pi_netrw.txt /*netrw-gh* netrw-gitignore pi_netrw.txt /*netrw-gitignore* netrw-gp pi_netrw.txt /*netrw-gp* +netrw-grep pi_netrw.txt /*netrw-grep* netrw-gx pi_netrw.txt /*netrw-gx* netrw-handler pi_netrw.txt /*netrw-handler* netrw-help pi_netrw.txt /*netrw-help* @@ -7082,6 +7096,7 @@ netrw-login pi_netrw.txt /*netrw-login* netrw-mB pi_netrw.txt /*netrw-mB* netrw-mF pi_netrw.txt /*netrw-mF* netrw-mT pi_netrw.txt /*netrw-mT* +netrw-mX pi_netrw.txt /*netrw-mX* netrw-mb pi_netrw.txt /*netrw-mb* netrw-mc pi_netrw.txt /*netrw-mc* netrw-md pi_netrw.txt /*netrw-md* @@ -7099,6 +7114,7 @@ netrw-mr pi_netrw.txt /*netrw-mr* netrw-ms pi_netrw.txt /*netrw-ms* netrw-mt pi_netrw.txt /*netrw-mt* netrw-mu pi_netrw.txt /*netrw-mu* +netrw-mv pi_netrw.txt /*netrw-mv* netrw-mx pi_netrw.txt /*netrw-mx* netrw-mz pi_netrw.txt /*netrw-mz* netrw-netrc pi_netrw.txt /*netrw-netrc* @@ -7118,6 +7134,7 @@ netrw-p13 pi_netrw.txt /*netrw-p13* netrw-p14 pi_netrw.txt /*netrw-p14* netrw-p15 pi_netrw.txt /*netrw-p15* netrw-p16 pi_netrw.txt /*netrw-p16* +netrw-p17 pi_netrw.txt /*netrw-p17* netrw-p2 pi_netrw.txt /*netrw-p2* netrw-p3 pi_netrw.txt /*netrw-p3* netrw-p4 pi_netrw.txt /*netrw-p4* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index d114d36c59..f0d6668be2 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2014 Dec 14 +*todo.txt* For Vim version 7.4. Last change: 2015 Jan 07 VIM REFERENCE MANUAL by Bram Moolenaar @@ -54,6 +54,7 @@ Regexp problems: - Using back reference before the capturing group sometimes works with the old engine, can we do this with the new engine? E.g. with "/\%(<\1>\)\@<=.*\%(<\/\(\w\+\)>\)\@=" matching text inside HTML tags. +- Diff highlighting can be very slow. (Issue 309) Still using freed memory after using setloclist(). (lcd, 2014 Jul 23) More info Jul 24. Not clear why. @@ -65,41 +66,24 @@ Breaks test_eval. Inefficient, can we only compute y_width when needed? Problem that a previous silent ":throw" causes a following try/catch not to work. (ZyX, 2013 Sep 28) +Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) + ":cd C:\Windows\System32\drivers\etc*" does not work, even though the directory exists. (Sergio Gallelli, 2013 Dec 29) Gvim: when both Tab and CTRL-I are mapped, use CTRL-I not for Tab. -Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) - Python: ":py raw_input('prompt')" doesn't work. (Manu Hack) -When window number in Ex range is too high, should give an error: - :3close " fails if there are only 2 windows. -Patch from Marcin Szamotulski, 2014 Dec 13. - -Patch to recover from X server restart: hint on Issue 203 (2014 Nov 21 18:44) - -Insert a block with virtualedit set does not work correctly. -Patch by James McCoy, 2014 Dec 10. - MS-Windows: When editing a file with a leading space, writing it uses the wrong name. (Aram, 2014 Nov 7) Vim 7.4. -Add LessCss support. (Jenoma / Alessandro Vioni, 2014 Nov 24) -Now with updated license, Nov 24. - -Memory leak using :wviminfo. Issue 296. With Patch by Christian. - -patch to remove FEAT_OSFILETYPE from fileio.c. (Christian, 2014 Nov 12) +Patch to fix unnecessary redraw of vertical separators. +(Thiago Padilha, 2015 Jan 5, second version) Value returned by virtcol() changes depending on how lines wrap. This is inconsistent with the documentation. -Patch to also support range for :argdo, :bufdo, etc. -(Marcin Szamotulski, 2014 Dec 7) -Asked for tests. - Ukrainian vimtutor. (Issue 288) Regenerate the Unicode tables in mbyte.c. @@ -108,19 +92,30 @@ Diff from ZyX, 2014 Dec 6. Patch to fix relative numbers. (Christian Brabandt, 2014 Nov 17) Update Nov 26. +Patch to improve config.vim syntax. Issue 305. Maintainer last update was in +2008. + Patch to fix that getcurpos() returns a negative number, instead of MAXCOL. (Hirohito Higashi, 2014 Dec 8) +Better greek spell checking. Issue 299. + Patch to fix wrong formatting if 'linebreak' is set. (Christian Brabandt, 2014 Nov 12) Patch to avoid recognizing polkit as hog files. (Issue 292) +":0argedit foo" puts new argument in second place instead of first. +Patch from Ingo Karkat, 2014 Dec 19. + Patch 7.4.468 changed how CTRL-C is handled. It does not take care of mapping CTRL-C in different modes. (Ingo Karkat, 2014 Dec 12) Patch from Christian Brabandt, 2014 Dec 13. Needs to be improved. +Patch for greek characters on MS-Windows console. (Yasuhiro Matsumoto, 2014 +Dec 17) + Patch to support hex values for setting option value. (Zyx, 2015 Nov 6) @@ -131,6 +126,16 @@ Update Nov 5. MS-Windows: Crash opening very long file name starting with "\\". (Christian Brock, 2012 Jun 29) +Patch for this from Marcin Szamotulski, 2014 Dec 28: +8 Make the # register writable, so that it can be restored after jumping + around in windows. + +Using CTRL-L while popup menu is visible behaves like CTRL-P, which is wrong. +Patch by Yasuhiro Matsumoto, 2015 Jan 5. +Is this right? Comment from Amadeus Demarzi. +Another patch from Christian, Jan 6. +Comment from Hirohito Higashi, Jan 6. + Cursorline background color not mixed with character highlight. Patch by Yasuhiro Matsumoto, 2014 Dec 3. @@ -143,9 +148,19 @@ ml_updatechunk() is slow when retrying for another encoding. (John Little, Patch to add a different escape sequence for replace mode. (Omar Sandoval, 2014 Nov 30) +Calling setreg() with an empty list doesn't work. +Patch by Yasuhiro Matsumoto, 2014 Dec 14. + +Extended file attributes lost on write (backupcopy=no). Issue 306. + +Window height computed incorrectly when Vim is minimized. +Patch to fix this. (Ingo Karkat, 2014 Dec 19) + Patch to allow values greater than 255 for ctermfg/ctermbg on Windows. (Yasuhiro Matsumoto, 2014 Dec 5) +Mixup of highlighting when there is a match and SpellBad. (ZyX, 2015 Jan 1) + When 'balloonexpr' returns a list the result has a trailing newline. Just remove one trailing newline. (lcd, 2014 Oct 17) @@ -190,6 +205,10 @@ was already defined. Patch to make closed folds line up. (Charles Campbell, 2014 Sep 12) Remark from Roland Eggner: does it cause crashes? (2014 Dec 12) +Updated patch by Roland Eggner, Dec 16 +Updated patch from Charles, Dec 29. + +Patch to open folds for 'incsearch'. (Christian Brabandt, 2015 Jan 6) Patch for building a 32bit Vim with 64bit MingW compiler. (Michael Soyka, 2014 Oct 15) @@ -200,6 +219,8 @@ Redo only remembers the last change. Could use "{count}g." to redo an older change. How does the user know which change? At least have a way to list them: ":repeats". +Patch for glob(), adding slash to normal files. (Ingo Karkat, 2014 Dec 22) + Using "." to repeat an Ex command puts that command in history. Probably should not happen. If the command is the result of a mapping it's not put in history either. (Jacob Niehus, 2014 Nov 2) @@ -233,6 +254,9 @@ Spell files use a latin single quote. Unicode also has another single quote: New OpenOffice spell files support this with ICONV. But they are not compatible with Vim spell files. The old files can no longer be downloaded. +Patch to make FocusGained and FocusLost work in modern terminals. (Hayaki +Saito, 2013 Apr 24) + Win32: patch to use 64 bit stat() if possible. (Ken Takata, 2014 May 12) More tests May 14. Update May 29. Update Aug 10. @@ -567,9 +591,6 @@ Patch to improve equivalence classes in regexp patterns. Patch with suggestions for starting.txt. (Tony Mechelynck, 2012 Oct 24) But use Gnome instead of GTK? -Patch to make FocusGained and FocusLost work in modern terminals. (Hayaki -Saito, 2013 Apr 24) - Should be possible to enable/disable matchparen per window or buffer. Add a check for b:no_match_paren in Highlight_matching_Pair() (Marcin Szamotulski, 2012 Nov 8) @@ -5076,8 +5097,6 @@ Argument list: Registers: 8 Don't display empty registers with ":display". (Etienne) -8 Make the # register writable, so that it can be restored after jumping - around in windows. 8 Add put command that overwrites existing text. Should also work for blocks. Useful to move text around in a table. Works like using "R ^R r" for every line. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index e55642d142..019345baf7 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2014 Dec 06 +" Last Change: 2015 Jan 07 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1052,6 +1052,9 @@ au BufNewFile,BufRead *.ldif setf ldif " Ld loader au BufNewFile,BufRead *.ld setf ld +" Less +au BufNewFile,BufRead *.less setf less + " Lex au BufNewFile,BufRead *.lex,*.l,*.lxx,*.l++ setf lex diff --git a/runtime/ftplugin/less.vim b/runtime/ftplugin/less.vim new file mode 100644 index 0000000000..637e9d292e --- /dev/null +++ b/runtime/ftplugin/less.vim @@ -0,0 +1,20 @@ +" Vim filetype plugin +" Language: less +" Maintainer: Alessandro Vioni +" URL: https://github.com/genoma/vim-less +" Last Change: 2014 November 24 + +" 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 cms< def< inc< inex< ofu< sua<" + +setlocal formatoptions-=t formatoptions+=croql + +setlocal comments=:// commentstring=//\ %s + +setlocal omnifunc=csscomplete#CompleteCSS +setlocal suffixesadd=.less diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim index 11b2b0a665..28b7e245b6 100644 --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: man " Maintainer: SungHyun Nam -" Last Change: 2014 Nov 12 +" Last Change: 2014 Dec 29 " To make the ":Man" command available before editing a manual page, source " this script from your startup vimrc file. @@ -159,10 +159,10 @@ func GetPage(...) silent exec "r!/usr/bin/man ".s:GetCmdArg(sect, page)." | col -b" " Remove blank lines from top and bottom. while getline(1) =~ '^\s*$' - silent norm ggdd + silent keepj norm ggdd endwhile while getline('$') =~ '^\s*$' - silent norm Gdd + silent keepj norm Gdd endwhile 1 setl ft=man nomod diff --git a/runtime/ftplugin/matlab.vim b/runtime/ftplugin/matlab.vim index 6bfb3d7618..205111c3c2 100644 --- a/runtime/ftplugin/matlab.vim +++ b/runtime/ftplugin/matlab.vim @@ -1,7 +1,10 @@ " Vim filetype plugin file " Language: matlab " Maintainer: Jake Wasserman -" Last Changed: 2006 Jan 12 +" Last Changed: 2014 Dec 30 + +" Contributors: +" Charles Campbell if exists("b:did_ftplugin") finish @@ -12,10 +15,11 @@ let s:save_cpo = &cpo set cpo-=C if exists("loaded_matchit") - let s:conditionalEnd = '\(([^()]*\)\@!\\([^()]*)\)\@!' - let b:match_words = '\\|\\|\\|\:' . - \ s:conditionalEnd . ',\:\:\:' . - \ s:conditionalEnd + let s:conditionalEnd = '\%(([^()]*\)\@!\\%([^()]*)\)\@!' + let b:match_words= + \ '\<\%(if\|switch\|for\|while\)\>:\<\%(elseif\|case\|break\|continue\|else\|otherwise\)\>:'.s:conditionalEnd.','. + \ '\:\:\' + unlet s:conditionalEnd endif setlocal suffixesadd=.m diff --git a/runtime/indent/less.vim b/runtime/indent/less.vim new file mode 100644 index 0000000000..82bf2d87fc --- /dev/null +++ b/runtime/indent/less.vim @@ -0,0 +1,13 @@ +" Vim indent file +" Language: less +" Maintainer: Alessandro Vioni +" URL: https://github.com/genoma/vim-less +" Last Change: 2014 November 24 + +if exists("b:did_indent") + finish +endif + +runtime! indent/css.vim + +" vim:set sw=2: diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index e3e79ddea8..cad4d31a04 100644 --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -1,6 +1,6 @@ " netrwPlugin.vim: Handles file transfer and remote directory listing across a network " PLUGIN SECTION -" Date: Jan 22, 2014 +" Date: Nov 07, 2014 " Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1 @@ -20,7 +20,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v152" +let g:loaded_netrwPlugin = "v153" if v:version < 702 echohl WarningMsg echo "***warning*** you need vim version 7.2 for this version of netrw" @@ -54,15 +54,15 @@ augroup END " Network Browsing Reading Writing: {{{2 augroup Network au! - au BufReadCmd file://* call netrw#FileUrlRead(expand("")) - au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand(""))|call netrw#Nread(2,expand(""))|exe "sil doau BufReadPost ".fnameescape(expand("")) - au FileReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand(""))|call netrw#Nread(1,expand(""))|exe "sil doau FileReadPost ".fnameescape(expand("")) - au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand(""))|exe 'Nwrite '.fnameescape(expand(""))|exe "sil doau BufWritePost ".fnameescape(expand("")) - au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand(""))|exe "'[,']".'Nwrite '.fnameescape(expand(""))|exe "sil doau FileWritePost ".fnameescape(expand("")) - try - au SourceCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("")) - catch /^Vim\%((\a\+)\)\=:E216/ - au SourcePre ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("")) + au BufReadCmd file://* call netrw#FileUrlRead(expand("")) + au BufReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand(""))|call netrw#Nread(2,expand(""))|exe "sil doau BufReadPost ".fnameescape(expand("")) + au FileReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand(""))|call netrw#Nread(1,expand(""))|exe "sil doau FileReadPost ".fnameescape(expand("")) + au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand(""))|exe 'Nwrite '.fnameescape(expand(""))|exe "sil doau BufWritePost ".fnameescape(expand("")) + au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand(""))|exe "'[,']".'Nwrite '.fnameescape(expand(""))|exe "sil doau FileWritePost ".fnameescape(expand("")) + try + au SourceCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("")) + catch /^Vim\%((\a\+)\)\=:E216/ + au SourcePre ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("")) endtry augroup END @@ -81,18 +81,26 @@ com! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(,0,6 ,) com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,) com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,) -com! -nargs=* -bar -complete=dir Lexplore call netrw#Lexplore() +com! -nargs=* -bar -bang -count=0 -complete=dir Lexplore call netrw#Lexplore(,0,) " Commands: NetrwSettings {{{2 com! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings() com! -bang NetrwClean call netrw#Clean(0) " Maps: -if !exists("g:netrw_nogx") && maparg('gx','n') == "" - if !hasmapto('NetrwBrowseX') - nmap gx NetrwBrowseX +if !exists("g:netrw_nogx") + if maparg('gx','n') == "" + if !hasmapto('NetrwBrowseX') + nmap gx NetrwBrowseX + endif + nno NetrwBrowseX :call netrw#BrowseX(expand((exists("g:netrw_gx")? g:netrw_gx : '')),netrw#CheckIfRemote()) + endif + if maparg('gx','v') == "" + if !hasmapto('NetrwBrowseXVis') + vmap gx NetrwBrowseXVis + endif + vno NetrwBrowseXVis :call netrw#BrowseXVis() endif - nno NetrwBrowseX :call netrw#NetrwBrowseX(expand(""),0) endif " --------------------------------------------------------------------- @@ -119,7 +127,7 @@ fun! s:LocalBrowse(dirname) " call Decho("(LocalBrowse) dirname<".a:dirname."> (isdirectory, amiga)") if a:dirname != '' && isdirectory(a:dirname) sil! call netrw#LocalBrowseCheck(a:dirname) - if exists("w:netrw_bannercnt") + if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt exe w:netrw_bannercnt endif endif @@ -128,7 +136,7 @@ fun! s:LocalBrowse(dirname) " call Decho("(LocalBrowse) dirname<".a:dirname."> ft=".&ft." (isdirectory, not amiga)") " call Dredir("LocalBrowse ft last set: ","verbose set ft") sil! call netrw#LocalBrowseCheck(a:dirname) - if exists("w:netrw_bannercnt") + if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt exe w:netrw_bannercnt endif diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim index a0005140b2..ff69c5860b 100644 --- a/runtime/syntax/diff.vim +++ b/runtime/syntax/diff.vim @@ -2,7 +2,7 @@ " Language: Diff (context or unified) " Maintainer: Bram Moolenaar " Translations by Jakson Alves de Aquino. -" Last Change: 2014 Nov 12 +" Last Change: 2015 Jan 07 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -18,6 +18,9 @@ syn match diffIsA "^File .* is a .* while file .* is a .*" syn match diffNoEOL "^\\ No newline at end of file .*" syn match diffCommon "^Common subdirectories: .*" +" Disable the translations by setting diff_translations to zero. +if !exists("diff_translations") || diff_translations + " ca syn match diffOnly "^Només a .*" syn match diffIdentical "^Els fitxers .* i .* són idèntics$" @@ -320,6 +323,8 @@ syn match diffIsA "^檔案 .* 是.*而檔案 .* 是.*" syn match diffNoEOL "^\\ 檔案末沒有 newline 字元" syn match diffCommon "^.* 和 .* 有共同的副目錄$" +endif + syn match diffRemoved "^-.*" syn match diffRemoved "^<.*" diff --git a/runtime/syntax/html.vim b/runtime/syntax/html.vim index d59126dede..ab1f9b3c13 100644 --- a/runtime/syntax/html.vim +++ b/runtime/syntax/html.vim @@ -2,7 +2,8 @@ " Language: HTML " Maintainer: Claudio Fleiner " URL: http://www.fleiner.com/vim/syntax/html.vim -" Last Change: 2012 Oct 05 +" Last Change: 2015 Jan 07 +" included patch from David Felix " Please check :help html.vim for some comments and a description of the options @@ -168,7 +169,7 @@ if main_syntax != 'java' || exists("java_javascript") " JAVA SCRIPT syn include @htmlJavaScript syntax/javascript.vim unlet b:current_syntax - syn region javaScript start=+]*>+ keepend end=++me=s-1 contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc + syn region javaScript start=+]*>+ keepend end=+]*>+me=s-1 contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc syn region htmlScriptTag contained start=++ fold contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent HtmlHiLink htmlScriptTag htmlTag @@ -193,7 +194,7 @@ if main_syntax != 'java' || exists("java_vb") " VB SCRIPT syn include @htmlVbScript syntax/vb.vim unlet b:current_syntax - syn region javaScript start=++me=s-1 contains=@htmlVbScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc + syn region javaScript start=+