From 987aab512fbae7a5720dcafe9da60c39bf0e1da0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 23 Mar 2012 14:16:23 +0100 Subject: [PATCH 01/45] updated for version 7.3.476 Problem: When selecting a block, using "$" to include the end of each line and using "A" and typing a backspace strange things happen. (Yuangchen Xie) Solution: Avoid using a negative length. (Christian Brabandt) --- src/ops.c | 3 ++- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ops.c b/src/ops.c index 1ddff28824..146c990c68 100644 --- a/src/ops.c +++ b/src/ops.c @@ -2602,7 +2602,8 @@ op_insert(oap, count1) firstline = ml_get(oap->start.lnum) + bd.textcol; if (oap->op_type == OP_APPEND) firstline += bd.textlen; - if ((ins_len = (long)STRLEN(firstline) - pre_textlen) > 0) + if (pre_textlen >= 0 + && (ins_len = (long)STRLEN(firstline) - pre_textlen) > 0) { ins_text = vim_strnsave(firstline, (int)ins_len); if (ins_text != NULL) diff --git a/src/version.c b/src/version.c index b514a5b6db..f6250cdab6 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 476, /**/ 475, /**/ From 815f9e32e0ed0f75ede50e93e0398b91256bfdd9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 23 Mar 2012 14:16:23 +0100 Subject: [PATCH 02/45] Added tag v7-3-476 for changeset fb2c5a51dac7 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index d2b7e2d307..04c177723e 100644 --- a/.hgtags +++ b/.hgtags @@ -1812,3 +1812,4 @@ e61c3b09ae86a8a448ad2d028df6fa6b9778666b v7-3-469 7f1bce9c9b79d4ebbf798d6122612934d55d70d9 v7-3-473 7613c9ab083f3e9262be5a21fe086921b757da4c v7-3-474 36160830a5e8d0e3b4174aa7d98363623468b77c v7-3-475 +fb2c5a51dac7f1dbce6a0f35808927ac206c7f47 v7-3-476 From d628634cc11ae5dca4f39bdb4c3d2b894a2876c7 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 23 Mar 2012 15:18:24 +0100 Subject: [PATCH 03/45] updated for version 7.3.477 Problem: Using ":echo" to output enough lines to scroll, then using "j" and "k" at the more prompt, displays the command on top of the output. (Marcin Szamotulski) Solution: Put the output below the command. (Christian Brabandt) --- src/eval.c | 5 +++++ src/version.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/eval.c b/src/eval.c index 1056422655..13e520b6db 100644 --- a/src/eval.c +++ b/src/eval.c @@ -20492,7 +20492,12 @@ ex_echo(eap) /* Call msg_start() after eval1(), evaluating the expression * may cause a message to appear. */ if (eap->cmdidx == CMD_echo) + { + /* Put the output below the command, makes scrolling back + * at more prompt work. */ + msg_didout = TRUE; msg_start(); + } } else if (eap->cmdidx == CMD_echo) msg_puts_attr((char_u *)" ", echo_attr); diff --git a/src/version.c b/src/version.c index f6250cdab6..170784c983 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 477, /**/ 476, /**/ From a76d1ccca250b2285d7f3b9dcfa26239b08b4983 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 23 Mar 2012 15:18:24 +0100 Subject: [PATCH 04/45] Added tag v7-3-477 for changeset 62dc0d69ab11 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 04c177723e..0d56c4bcc7 100644 --- a/.hgtags +++ b/.hgtags @@ -1813,3 +1813,4 @@ e61c3b09ae86a8a448ad2d028df6fa6b9778666b v7-3-469 7613c9ab083f3e9262be5a21fe086921b757da4c v7-3-474 36160830a5e8d0e3b4174aa7d98363623468b77c v7-3-475 fb2c5a51dac7f1dbce6a0f35808927ac206c7f47 v7-3-476 +62dc0d69ab11d5b5a67c6139a0dd3e2618d2c2a1 v7-3-477 From 599d82c3a49d729d736b9b153a6011b55f6f6a1f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 23 Mar 2012 15:37:02 +0100 Subject: [PATCH 05/45] updated for version 7.3.478 Problem: Memory leak using the ':rv!' command when reading dictionary or list global variables i.e. with 'viminfo' containing !. Solution: Free the typeval. (Dominique Pelle) --- src/eval.c | 1 + src/version.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/eval.c b/src/eval.c index 13e520b6db..bfb72b1fc0 100644 --- a/src/eval.c +++ b/src/eval.c @@ -22976,6 +22976,7 @@ read_viminfo_varlist(virp, writing) { vim_free(tv.vval.v_string); tv = *etv; + vim_free(etv); } } diff --git a/src/version.c b/src/version.c index 170784c983..b1b1a524b1 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 478, /**/ 477, /**/ From 7fb6ae658386621b1997bf12289443984ae6bdcb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 23 Mar 2012 15:37:02 +0100 Subject: [PATCH 06/45] Added tag v7-3-478 for changeset 754db4059212 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0d56c4bcc7..e5a3777218 100644 --- a/.hgtags +++ b/.hgtags @@ -1814,3 +1814,4 @@ e61c3b09ae86a8a448ad2d028df6fa6b9778666b v7-3-469 36160830a5e8d0e3b4174aa7d98363623468b77c v7-3-475 fb2c5a51dac7f1dbce6a0f35808927ac206c7f47 v7-3-476 62dc0d69ab11d5b5a67c6139a0dd3e2618d2c2a1 v7-3-477 +754db405921292fc57dbdaa85e62af333dce5912 v7-3-478 From fd75bcf5444dd1900d984633f96a922ac82e8fa0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 23 Mar 2012 16:25:17 +0100 Subject: [PATCH 07/45] updated for version 7.3.479 Problem: When 'cursorline' is set the line number highlighting can't be set separately. Solution: Add "CursorLineNr". (Howard Buchholz) --- src/option.c | 4 ++-- src/screen.c | 6 ++++-- src/syntax.c | 4 ++++ src/version.c | 2 ++ src/vim.h | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/option.c b/src/option.c index b71830f743..67d0bc7067 100644 --- a/src/option.c +++ b/src/option.c @@ -460,9 +460,9 @@ struct vimoption #if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \ || defined(FEAT_VERTSPLIT) || defined(FEAT_CLIPBOARD) \ || defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) || defined(FEAT_CONCEAL) -# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn" +# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn" #else -# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill" +# define HIGHLIGHT_INIT "8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill" #endif /* diff --git a/src/screen.c b/src/screen.c index 97d636d700..fd74707e00 100644 --- a/src/screen.c +++ b/src/screen.c @@ -3501,9 +3501,11 @@ win_line(wp, lnum, startrow, endrow, nochange) char_attr = hl_attr(HLF_N); #ifdef FEAT_SYN_HL /* When 'cursorline' is set highlight the line number of - * the current line differently. */ + * the current line differently. + * TODO: Can we use CursorLine instead of CursorLineNr + * when CursorLineNr isn't set? */ if (wp->w_p_cul && lnum == wp->w_cursor.lnum) - char_attr = hl_combine_attr(hl_attr(HLF_CUL), char_attr); + char_attr = hl_attr(HLF_CLN); #endif } } diff --git a/src/syntax.c b/src/syntax.c index 7b045680d7..b5bffc31ad 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -6538,6 +6538,8 @@ static char *(highlight_init_light[]) = "Directory term=bold ctermfg=DarkBlue guifg=Blue"), CENT("LineNr term=underline ctermfg=Brown", "LineNr term=underline ctermfg=Brown guifg=Brown"), + CENT("CursorLineNr term=bold ctermfg=Brown", + "CursorLineNr term=bold ctermfg=Brown gui=bold guifg=Brown"), CENT("MoreMsg term=bold ctermfg=DarkGreen", "MoreMsg term=bold ctermfg=DarkGreen gui=bold guifg=SeaGreen"), CENT("Question term=standout ctermfg=DarkGreen", @@ -6626,6 +6628,8 @@ static char *(highlight_init_dark[]) = "Directory term=bold ctermfg=LightCyan guifg=Cyan"), CENT("LineNr term=underline ctermfg=Yellow", "LineNr term=underline ctermfg=Yellow guifg=Yellow"), + CENT("CursorLineNr term=bold ctermfg=Yellow", + "CursorLineNr term=bold ctermfg=Yellow gui=bold guifg=Yellow"), CENT("MoreMsg term=bold ctermfg=LightGreen", "MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen"), CENT("Question term=standout ctermfg=LightGreen", diff --git a/src/version.c b/src/version.c index b1b1a524b1..883fec138c 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 479, /**/ 478, /**/ diff --git a/src/vim.h b/src/vim.h index be182287d2..b67702b581 100644 --- a/src/vim.h +++ b/src/vim.h @@ -1318,6 +1318,7 @@ typedef enum , HLF_M /* "--More--" message */ , HLF_CM /* Mode (e.g., "-- INSERT --") */ , HLF_N /* line number for ":number" and ":#" commands */ + , HLF_CLN /* current line number */ , HLF_R /* return to continue message and yes/no questions */ , HLF_S /* status lines */ , HLF_SNC /* status lines of not-current windows */ @@ -1355,7 +1356,7 @@ typedef enum /* The HL_FLAGS must be in the same order as the HLF_ enums! * When changing this also adjust the default for 'highlight'. */ #define HL_FLAGS {'8', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \ - 'n', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \ + 'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \ 'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \ 'B', 'P', 'R', 'L', \ '+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o'} From 1037e6d4c53695fd9f0eb95a95669415d21bda1a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 23 Mar 2012 16:25:17 +0100 Subject: [PATCH 08/45] Added tag v7-3-479 for changeset 3db4282d5e6b --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e5a3777218..dafe5879af 100644 --- a/.hgtags +++ b/.hgtags @@ -1815,3 +1815,4 @@ e61c3b09ae86a8a448ad2d028df6fa6b9778666b v7-3-469 fb2c5a51dac7f1dbce6a0f35808927ac206c7f47 v7-3-476 62dc0d69ab11d5b5a67c6139a0dd3e2618d2c2a1 v7-3-477 754db405921292fc57dbdaa85e62af333dce5912 v7-3-478 +3db4282d5e6bb74a5c1094f35a81472d5a98f313 v7-3-479 From 7a1354bc1ffc8c0bae16827c29a73c4161b425fc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 23 Mar 2012 18:39:18 +0100 Subject: [PATCH 09/45] updated for version 7.3.480 Problem: When using ":qa" and there is a changed buffer picking the buffer to jump to is not very good. Solution: Consider current and other tab pages. (Hirohito Higashi) --- src/ex_cmds2.c | 103 ++++++++++++++++++++++++++++++++++++++----------- src/version.c | 2 + 2 files changed, 82 insertions(+), 23 deletions(-) diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 4e480ecafa..2bce6dfdc1 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -1569,6 +1569,26 @@ can_abandon(buf, forceit) || forceit); } +static void add_bufnum __ARGS((int *bufnrs, int *bufnump, int nr)); + +/* + * Add a buffer number to "bufnrs", unless it's already there. + */ + static void +add_bufnum(bufnrs, bufnump, nr) + int *bufnrs; + int *bufnump; + int nr; +{ + int i; + + for (i = 0; i < *bufnump; ++i) + if (bufnrs[i] == nr) + return; + bufnrs[*bufnump] = nr; + *bufnump = *bufnump + 1; +} + /* * Return TRUE if any buffer was changed and cannot be abandoned. * That changed buffer becomes the current buffer. @@ -1577,32 +1597,64 @@ can_abandon(buf, forceit) check_changed_any(hidden) int hidden; /* Only check hidden buffers */ { + int ret = FALSE; buf_T *buf; int save; + int i; + int bufnum = 0; + int bufcount = 0; + int *bufnrs; #ifdef FEAT_WINDOWS + tabpage_T *tp; win_T *wp; #endif - for (;;) - { - /* check curbuf first: if it was changed we can't abandon it */ - if (!hidden && curbufIsChanged()) - buf = curbuf; - else - { - for (buf = firstbuf; buf != NULL; buf = buf->b_next) - if ((!hidden || buf->b_nwindows == 0) && bufIsChanged(buf)) - break; - } - if (buf == NULL) /* No buffers changed */ - return FALSE; + for (buf = firstbuf; buf != NULL; buf = buf->b_next) + ++bufcount; - /* Try auto-writing the buffer. If this fails but the buffer no - * longer exists it's not changed, that's OK. */ - if (check_changed(buf, p_awa, TRUE, FALSE, TRUE) && buf_valid(buf)) - break; /* didn't save - still changes */ + if (bufcount == 0) + return FALSE; + + bufnrs = (int *)alloc(sizeof(int) * bufcount); + if (bufnrs == NULL) + return FALSE; + + /* curbuf */ + bufnrs[bufnum++] = curbuf->b_fnum; +#ifdef FEAT_WINDOWS + /* buf in curtab */ + FOR_ALL_WINDOWS(wp) + if (wp->w_buffer != curbuf) + add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); + + /* buf in other tab */ + for (tp = first_tabpage; tp != NULL; tp = tp->tp_next) + if (tp != curtab) + for (wp = tp->tp_firstwin; wp != NULL; wp = wp->w_next) + add_bufnum(bufnrs, &bufnum, wp->w_buffer->b_fnum); +#endif + /* any other buf */ + for (buf = firstbuf; buf != NULL; buf = buf->b_next) + add_bufnum(bufnrs, &bufnum, buf->b_fnum); + + for (i = 0; i < bufnum; ++i) + { + buf = buflist_findnr(bufnrs[i]); + if (buf == NULL) + continue; + if ((!hidden || buf->b_nwindows == 0) && bufIsChanged(buf)) + { + /* Try auto-writing the buffer. If this fails but the buffer no + * longer exists it's not changed, that's OK. */ + if (check_changed(buf, p_awa, TRUE, FALSE, TRUE) && buf_valid(buf)) + break; /* didn't save - still changes */ + } } + if (i >= bufnum) + goto theend; + + ret = TRUE; exiting = FALSE; #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) /* @@ -1635,24 +1687,29 @@ check_changed_any(hidden) #ifdef FEAT_WINDOWS /* Try to find a window that contains the buffer. */ if (buf != curbuf) - for (wp = firstwin; wp != NULL; wp = wp->w_next) + FOR_ALL_TAB_WINDOWS(tp, wp) if (wp->w_buffer == buf) { - win_goto(wp); + goto_tabpage_win(tp, wp); # ifdef FEAT_AUTOCMD /* Paranoia: did autocms wipe out the buffer with changes? */ if (!buf_valid(buf)) - return TRUE; + { + goto theend; + } # endif - break; + goto buf_found; } +buf_found: #endif /* Open the changed buffer in the current window. */ if (buf != curbuf) set_curbuf(buf, DOBUF_GOTO); - return TRUE; +theend: + vim_free(bufnrs); + return ret; } /* @@ -3274,7 +3331,7 @@ ex_scriptnames(eap) home_replace(NULL, SCRIPT_ITEM(i).sn_name, NameBuff, MAXPATHL, TRUE); smsg((char_u *)"%3d: %s", i, NameBuff); - } + } } # if defined(BACKSLASH_IN_FILENAME) || defined(PROTO) diff --git a/src/version.c b/src/version.c index 883fec138c..2598aeba9e 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 480, /**/ 479, /**/ From 905b82b3ea19c7dc7d225475d1c5d7a7598c8186 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 23 Mar 2012 18:39:18 +0100 Subject: [PATCH 10/45] Added tag v7-3-480 for changeset b35844f3eb49 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index dafe5879af..af6f0eedd4 100644 --- a/.hgtags +++ b/.hgtags @@ -1816,3 +1816,4 @@ fb2c5a51dac7f1dbce6a0f35808927ac206c7f47 v7-3-476 62dc0d69ab11d5b5a67c6139a0dd3e2618d2c2a1 v7-3-477 754db405921292fc57dbdaa85e62af333dce5912 v7-3-478 3db4282d5e6bb74a5c1094f35a81472d5a98f313 v7-3-479 +b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 From a1e0900cd9053c5cdd058d901b8fbeb0e109d84c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 12:59:57 +0200 Subject: [PATCH 11/45] updated for version 7.3.481 Problem: Changing 'virtualedit' in an operator function to "all" does not have the desired effect. (Aaron Bohannon) Solution: Save, reset and restore virtual_op when executing an operator function. --- src/normal.c | 8 ++++++++ src/version.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/normal.c b/src/normal.c index aa470e4f75..a7301162bd 100644 --- a/src/normal.c +++ b/src/normal.c @@ -2279,6 +2279,7 @@ op_function(oap) { #ifdef FEAT_EVAL char_u *(argv[1]); + int save_virtual_op = virtual_op; if (*p_opfunc == NUL) EMSG(_("E774: 'operatorfunc' is empty")); @@ -2297,7 +2298,14 @@ op_function(oap) argv[0] = (char_u *)"line"; else argv[0] = (char_u *)"char"; + + /* Reset virtual_op so that 'virtualedit' can be changed in the + * function. */ + virtual_op = MAYBE; + (void)call_func_retnr(p_opfunc, 1, argv, FALSE); + + virtual_op = save_virtual_op; } #else EMSG(_("E775: Eval feature not available")); diff --git a/src/version.c b/src/version.c index 2598aeba9e..a1bd77c933 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 481, /**/ 480, /**/ From fe39c169b5213963d85080a000c9fe110e3d646d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 12:59:57 +0200 Subject: [PATCH 12/45] Added tag v7-3-481 for changeset 8e21ac7f2d6e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index af6f0eedd4..05c180081c 100644 --- a/.hgtags +++ b/.hgtags @@ -1817,3 +1817,4 @@ fb2c5a51dac7f1dbce6a0f35808927ac206c7f47 v7-3-476 754db405921292fc57dbdaa85e62af333dce5912 v7-3-478 3db4282d5e6bb74a5c1094f35a81472d5a98f313 v7-3-479 b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 +8e21ac7f2d6e9f269b057939dda58d3a31beb894 v7-3-481 From bc3542bf0d3999b4271404c84cb205349c964991 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 14:19:50 +0200 Subject: [PATCH 13/45] updated for version 7.3.482 Problem: With 'cursorbind' set moving up/down does not always keep the same column. Solution: Set curswant appropriately. (Gary Johnson) --- src/move.c | 4 ++++ src/version.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/move.c b/src/move.c index fb033933ca..21a74b8adc 100644 --- a/src/move.c +++ b/src/move.c @@ -2847,6 +2847,8 @@ do_check_cursorbind() # ifdef FEAT_VIRTUALEDIT colnr_T coladd = curwin->w_cursor.coladd; # endif + colnr_T curswant = curwin->w_curswant; + int set_curswant = curwin->w_set_curswant; win_T *old_curwin = curwin; buf_T *old_curbuf = curbuf; int restart_edit_save; @@ -2881,6 +2883,8 @@ do_check_cursorbind() # ifdef FEAT_VIRTUALEDIT curwin->w_cursor.coladd = coladd; # endif + curwin->w_curswant = curswant; + curwin->w_set_curswant = set_curswant; /* Make sure the cursor is in a valid position. Temporarily set * "restart_edit" to allow the cursor to be beyond the EOL. */ diff --git a/src/version.c b/src/version.c index a1bd77c933..b9df08512c 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 482, /**/ 481, /**/ From 0b8d1d60dbfa2354c25ee7d6eb2b5996a6a94731 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 14:19:51 +0200 Subject: [PATCH 14/45] Added tag v7-3-482 for changeset 3229335d0c4e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 05c180081c..cda048ed65 100644 --- a/.hgtags +++ b/.hgtags @@ -1818,3 +1818,4 @@ fb2c5a51dac7f1dbce6a0f35808927ac206c7f47 v7-3-476 3db4282d5e6bb74a5c1094f35a81472d5a98f313 v7-3-479 b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 8e21ac7f2d6e9f269b057939dda58d3a31beb894 v7-3-481 +3229335d0c4e6cd7e91e6e61d791d7dff7d3082d v7-3-482 From 4c09c4df7b120e87cbadc3efb3294986e12d8346 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 16:49:29 +0200 Subject: [PATCH 15/45] updated for version 7.3.483 Problem: More prompt shows up too often. Solution: Instead of adding a line break, only start a new line in the message history. (Christian Brabandt) --- src/eval.c | 7 ++++--- src/message.c | 10 ++++++++++ src/proto/message.pro | 1 + src/version.c | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/eval.c b/src/eval.c index bfb72b1fc0..bf0363ab51 100644 --- a/src/eval.c +++ b/src/eval.c @@ -20493,9 +20493,10 @@ ex_echo(eap) * may cause a message to appear. */ if (eap->cmdidx == CMD_echo) { - /* Put the output below the command, makes scrolling back - * at more prompt work. */ - msg_didout = TRUE; + /* Mark the saved text as finishing the line, so that what + * follows is displayed on a new line when scrolling back + * at the more prompt. */ + msg_sb_eol(); msg_start(); } } diff --git a/src/message.c b/src/message.c index c9b6a28463..b9cc93fa1c 100644 --- a/src/message.c +++ b/src/message.c @@ -2347,6 +2347,16 @@ msg_sb_start(mps) return mp; } +/* + * Mark the last message chunk as finishing the line. + */ + void +msg_sb_eol() +{ + if (last_msgchunk != NULL) + last_msgchunk->sb_eol = TRUE; +} + /* * Display a screen line from previously displayed text at row "row". * Returns a pointer to the text for the next line (can be NULL). diff --git a/src/proto/message.pro b/src/proto/message.pro index a12f1200c7..f67b8e0313 100644 --- a/src/proto/message.pro +++ b/src/proto/message.pro @@ -45,6 +45,7 @@ void msg_puts_attr __ARGS((char_u *s, int attr)); void may_clear_sb_text __ARGS((void)); void clear_sb_text __ARGS((void)); void show_sb_text __ARGS((void)); +void msg_sb_eol __ARGS((void)); int msg_use_printf __ARGS((void)); void mch_errmsg __ARGS((char *str)); void mch_msg __ARGS((char *str)); diff --git a/src/version.c b/src/version.c index b9df08512c..988eb192ee 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 483, /**/ 482, /**/ From 21902fd2d067154588bf006052c5dede23acedc8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 16:49:29 +0200 Subject: [PATCH 16/45] Added tag v7-3-483 for changeset 19040069b8bf --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index cda048ed65..39069636c8 100644 --- a/.hgtags +++ b/.hgtags @@ -1819,3 +1819,4 @@ fb2c5a51dac7f1dbce6a0f35808927ac206c7f47 v7-3-476 b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 8e21ac7f2d6e9f269b057939dda58d3a31beb894 v7-3-481 3229335d0c4e6cd7e91e6e61d791d7dff7d3082d v7-3-482 +19040069b8bf1818db44396a150acb54f47c3a96 v7-3-483 From 8308a5d5b8040a3e94ca1f82877b9f1379279a77 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 17:10:31 +0200 Subject: [PATCH 17/45] updated for version 7.3.484 Problem: The -E and --echo-wid command line arguments are not mentioned in "vim --help". Solution: Add the help lines. (Dominique Pelle) --- src/main.c | 2 ++ src/version.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/main.c b/src/main.c index d9f8df4b45..1a7e7b1feb 100644 --- a/src/main.c +++ b/src/main.c @@ -3181,6 +3181,7 @@ usage() #endif main_msg(_("-v\t\t\tVi mode (like \"vi\")")); main_msg(_("-e\t\t\tEx mode (like \"ex\")")); + main_msg(_("-E\t\t\tImproved Ex mode")); main_msg(_("-s\t\t\tSilent (batch) mode (only for \"ex\")")); #ifdef FEAT_DIFF main_msg(_("-d\t\t\tDiff mode (like \"vimdiff\")")); @@ -3304,6 +3305,7 @@ usage() main_msg(_("-display \tRun vim on (also: --display)")); main_msg(_("--role \tSet a unique role to identify the main window")); main_msg(_("--socketid \tOpen Vim inside another GTK widget")); + main_msg(_("--echo-wid\t\tMake gvim echo the Window ID on stdout")); #endif #ifdef FEAT_GUI_W32 main_msg(_("-P \tOpen Vim inside parent application")); diff --git a/src/version.c b/src/version.c index 988eb192ee..f9a1391fd6 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 484, /**/ 483, /**/ From a50ca505c0683ff2e4555b4e8731ba6d9ea4c475 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 17:10:31 +0200 Subject: [PATCH 18/45] Added tag v7-3-484 for changeset 00fa605e7d7b --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 39069636c8..a33624f49f 100644 --- a/.hgtags +++ b/.hgtags @@ -1820,3 +1820,4 @@ b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 8e21ac7f2d6e9f269b057939dda58d3a31beb894 v7-3-481 3229335d0c4e6cd7e91e6e61d791d7dff7d3082d v7-3-482 19040069b8bf1818db44396a150acb54f47c3a96 v7-3-483 +00fa605e7d7ba7d522c627a93de6e2f5017d2884 v7-3-484 From 103d0a3aa60235c9531e823126f04027c729ee1e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 17:17:48 +0200 Subject: [PATCH 19/45] updated for version 7.3.485 Problem: When building Vim LDFLAGS isn't passed on to building xxd. Solution: Pass the LDFLAGS value. (James McCoy) --- src/Makefile | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 754739f08d..8197b120d2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1720,7 +1720,7 @@ $(VIMTARGET): auto/config.mk objects $(OBJ) version.c version.h sh $(srcdir)/link.sh xxd/xxd$(EXEEXT): xxd/xxd.c - cd xxd; CC="$(CC)" CFLAGS="$(CPPFLAGS) $(CFLAGS)" \ + cd xxd; CC="$(CC)" CFLAGS="$(CPPFLAGS) $(CFLAGS)" LDFLAGS="$(LDFLAGS)" \ $(MAKE) -f Makefile # Build the language specific files if they were unpacked. diff --git a/src/version.c b/src/version.c index f9a1391fd6..2009133189 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 485, /**/ 484, /**/ From 4b59ee99d78ae952408a4a5ee84b3daa857504bb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 17:17:48 +0200 Subject: [PATCH 20/45] Added tag v7-3-485 for changeset 94374e0b6267 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index a33624f49f..3126ec8874 100644 --- a/.hgtags +++ b/.hgtags @@ -1821,3 +1821,4 @@ b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 3229335d0c4e6cd7e91e6e61d791d7dff7d3082d v7-3-482 19040069b8bf1818db44396a150acb54f47c3a96 v7-3-483 00fa605e7d7ba7d522c627a93de6e2f5017d2884 v7-3-484 +94374e0b6267d8983a73a22166888c2282ee793d v7-3-485 From e19e870c55b5ba3561e57a4abd6feb5e8b6b3614 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 17:43:11 +0200 Subject: [PATCH 21/45] updated for version 7.3.486 Problem: Build error with mingw64 on Windows 7. Solution: Avoid the step of going through vimres.res. (Guopeng Wen) --- src/Make_ming.mak | 8 +++----- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Make_ming.mak b/src/Make_ming.mak index 64c3db8349..ca50d371dd 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -681,11 +681,9 @@ $(OUTDIR)/if_python3.o : if_python3.c $(INCL) $(OUTDIR)/%.o : %.c $(INCL) $(CC) -c $(CFLAGS) $< -o $@ -$(OUTDIR)/vimres.res: vim.rc version.h gui_w32_rc.h - $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) vim.rc $(OUTDIR)/vimres.res - -$(OUTDIR)/vimrc.o: $(OUTDIR)/vimres.res - $(WINDRES) $(WINDRES_FLAGS) $(OUTDIR)/vimres.res $(OUTDIR)/vimrc.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) diff --git a/src/version.c b/src/version.c index 2009133189..efa29f6197 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 486, /**/ 485, /**/ From 15075aefa1cc591e6d3ae804a6c2f9fd5d1e3d85 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 17:43:11 +0200 Subject: [PATCH 22/45] Added tag v7-3-486 for changeset 08a37c57af47 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 3126ec8874..cef5171f76 100644 --- a/.hgtags +++ b/.hgtags @@ -1822,3 +1822,4 @@ b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 19040069b8bf1818db44396a150acb54f47c3a96 v7-3-483 00fa605e7d7ba7d522c627a93de6e2f5017d2884 v7-3-484 94374e0b6267d8983a73a22166888c2282ee793d v7-3-485 +08a37c57af479b54fa327bedc0ef31c42dd96f63 v7-3-486 From d85115d17566c6352f923f8e9f49c7a62080a31b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 19:59:04 +0200 Subject: [PATCH 23/45] updated for version 7.3.487 Problem: When setting 'timeoutlen' or 'ttimeoutlen' the column for vertical movement is reset unnecessarily. Solution: Do not set w_set_curswant for every option. Add a test for this. (Kana Natsuno) Add the P_CURSWANT flag for options. --- src/option.c | 85 ++++++++++++++------------------------ src/testdir/Make_amiga.mak | 3 +- src/testdir/Make_dos.mak | 3 +- src/testdir/Make_ming.mak | 3 +- src/testdir/Make_os2.mak | 2 +- src/testdir/Make_vms.mms | 4 +- src/testdir/Makefile | 3 +- src/testdir/test84.in | 35 ++++++++++++++++ src/testdir/test84.ok | 3 ++ src/version.c | 2 + 10 files changed, 83 insertions(+), 60 deletions(-) create mode 100644 src/testdir/test84.in create mode 100644 src/testdir/test84.ok diff --git a/src/option.c b/src/option.c index 67d0bc7067..9acb270f1e 100644 --- a/src/option.c +++ b/src/option.c @@ -433,17 +433,19 @@ struct vimoption #define P_RCLR 0x7000 /* clear and redraw all */ #define P_COMMA 0x8000 /* comma separated list */ -#define P_NODUP 0x10000L/* don't allow duplicate strings */ -#define P_FLAGLIST 0x20000L/* list of single-char flags */ +#define P_NODUP 0x10000L /* don't allow duplicate strings */ +#define P_FLAGLIST 0x20000L /* list of single-char flags */ -#define P_SECURE 0x40000L/* cannot change in modeline or secure mode */ -#define P_GETTEXT 0x80000L/* expand default value with _() */ -#define P_NOGLOB 0x100000L/* do not use local value for global vimrc */ -#define P_NFNAME 0x200000L/* only normal file name chars allowed */ -#define P_INSECURE 0x400000L/* option was set from a modeline */ -#define P_PRI_MKRC 0x800000L/* priority for :mkvimrc (setting option has +#define P_SECURE 0x40000L /* cannot change in modeline or secure mode */ +#define P_GETTEXT 0x80000L /* expand default value with _() */ +#define P_NOGLOB 0x100000L /* do not use local value for global vimrc */ +#define P_NFNAME 0x200000L /* only normal file name chars allowed */ +#define P_INSECURE 0x400000L /* option was set from a modeline */ +#define P_PRI_MKRC 0x800000L /* priority for :mkvimrc (setting option has side effects) */ -#define P_NO_ML 0x1000000L/* not allowed in modeline */ +#define P_NO_ML 0x1000000L /* not allowed in modeline */ +#define P_CURSWANT 0x2000000L /* update curswant required; not needed when + * there is a redraw flag */ #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255" @@ -479,7 +481,7 @@ static struct vimoption #endif options[] = { - {"aleph", "al", P_NUM|P_VI_DEF, + {"aleph", "al", P_NUM|P_VI_DEF|P_CURSWANT, #ifdef FEAT_RIGHTLEFT (char_u *)&p_aleph, PV_NONE, #else @@ -501,7 +503,7 @@ static struct vimoption {(char_u *)FALSE, (char_u *)FALSE} #endif SCRIPTID_INIT}, - {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM, + {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM|P_CURSWANT, #ifdef FEAT_ARABIC (char_u *)VAR_WIN, PV_ARAB, #else @@ -778,7 +780,7 @@ static struct vimoption {"columns", "co", P_NUM|P_NODEFAULT|P_NO_MKRC|P_VI_DEF|P_RCLR, (char_u *)&Columns, PV_NONE, {(char_u *)80L, (char_u *)0L} SCRIPTID_INIT}, - {"comments", "com", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP, + {"comments", "com", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_NODUP|P_CURSWANT, #ifdef FEAT_COMMENTS (char_u *)&p_com, PV_COM, {(char_u *)"s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-", @@ -788,7 +790,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"commentstring", "cms", P_STRING|P_ALLOCED|P_VI_DEF, + {"commentstring", "cms", P_STRING|P_ALLOCED|P_VI_DEF|P_CURSWANT, #ifdef FEAT_FOLDING (char_u *)&p_cms, PV_CMS, {(char_u *)"/*%s*/", (char_u *)0L} @@ -953,7 +955,7 @@ static struct vimoption {"debug", NULL, P_STRING|P_VI_DEF, (char_u *)&p_debug, PV_NONE, {(char_u *)"", (char_u *)0L} SCRIPTID_INIT}, - {"define", "def", P_STRING|P_ALLOCED|P_VI_DEF, + {"define", "def", P_STRING|P_ALLOCED|P_VI_DEF|P_CURSWANT, #ifdef FEAT_FIND_ID (char_u *)&p_def, PV_DEF, {(char_u *)"^\\s*#\\s*define", (char_u *)0L} @@ -983,7 +985,7 @@ static struct vimoption (char_u *)NULL, PV_NONE, #endif {(char_u *)FALSE, (char_u *)0L} SCRIPTID_INIT}, - {"diffexpr", "dex", P_STRING|P_VI_DEF|P_SECURE, + {"diffexpr", "dex", P_STRING|P_VI_DEF|P_SECURE|P_CURSWANT, #if defined(FEAT_DIFF) && defined(FEAT_EVAL) (char_u *)&p_dex, PV_NONE, {(char_u *)"", (char_u *)0L} @@ -1099,7 +1101,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC, + {"fileformat", "ff", P_STRING|P_ALLOCED|P_VI_DEF|P_RSTAT|P_NO_MKRC|P_CURSWANT, (char_u *)&p_ff, PV_FF, {(char_u *)DFLT_FF, (char_u *)0L} SCRIPTID_INIT}, {"fileformats", "ffs", P_STRING|P_VIM|P_COMMA|P_NODUP, @@ -1159,7 +1161,7 @@ static struct vimoption {"foldlevel", "fdl", P_NUM|P_VI_DEF|P_RWIN, (char_u *)VAR_WIN, PV_FDL, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, - {"foldlevelstart","fdls", P_NUM|P_VI_DEF, + {"foldlevelstart","fdls", P_NUM|P_VI_DEF|P_CURSWANT, (char_u *)&p_fdls, PV_NONE, {(char_u *)-1L, (char_u *)0L} SCRIPTID_INIT}, {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF| @@ -1176,7 +1178,7 @@ static struct vimoption {"foldnestmax", "fdn", P_NUM|P_VI_DEF|P_RWIN, (char_u *)VAR_WIN, PV_FDN, {(char_u *)20L, (char_u *)0L} SCRIPTID_INIT}, - {"foldopen", "fdo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, + {"foldopen", "fdo", P_STRING|P_VI_DEF|P_COMMA|P_NODUP|P_CURSWANT, (char_u *)&p_fdo, PV_NONE, {(char_u *)"block,hor,mark,percent,quickfix,search,tag,undo", (char_u *)0L} SCRIPTID_INIT}, @@ -1741,7 +1743,7 @@ static struct vimoption {"matchtime", "mat", P_NUM|P_VI_DEF, (char_u *)&p_mat, PV_NONE, {(char_u *)5L, (char_u *)0L} SCRIPTID_INIT}, - {"maxcombine", "mco", P_NUM|P_VI_DEF, + {"maxcombine", "mco", P_NUM|P_VI_DEF|P_CURSWANT, #ifdef FEAT_MBYTE (char_u *)&p_mco, PV_NONE, #else @@ -2710,7 +2712,7 @@ static struct vimoption {(char_u *)0L, (char_u *)0L} #endif SCRIPTID_INIT}, - {"virtualedit", "ve", P_STRING|P_COMMA|P_NODUP|P_VI_DEF|P_VIM, + {"virtualedit", "ve", P_STRING|P_COMMA|P_NODUP|P_VI_DEF|P_VIM|P_CURSWANT, #ifdef FEAT_VIRTUALEDIT (char_u *)&p_ve, PV_NONE, {(char_u *)"", (char_u *)""} @@ -7064,8 +7066,10 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf, } #endif - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */ + if (curwin->w_curswant != MAXCOL + && (options[opt_idx].flags & (P_CURSWANT | P_RCLR)) != 0) + curwin->w_set_curswant = TRUE; + #ifdef FEAT_GUI /* check redraw when it's not a GUI option or the GUI is active. */ if (!redraw_gui_only || gui.in_use) @@ -7587,9 +7591,6 @@ set_bool_option(opt_idx, varp, value, opt_flags) || (int *)varp == &curwin->w_p_nu || (int *)varp == &curwin->w_p_rnu) { - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; - /* If 'number' is set, reset 'relativenumber'. */ /* If 'relativenumber' is set, reset 'number'. */ if ((int *)varp == &curwin->w_p_nu && curwin->w_p_nu) @@ -7834,8 +7835,6 @@ set_bool_option(opt_idx, varp, value, opt_flags) { if (curwin->w_p_wrap) curwin->w_leftcol = 0; - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; } #ifdef FEAT_WINDOWS @@ -8062,31 +8061,8 @@ set_bool_option(opt_idx, varp, value, opt_flags) curbuf->b_p_imsearch = B_IMODE_USE_INSERT; # endif } - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; } - else if ((int *)varp == &p_arshape) - { - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; - } -#endif - -#ifdef FEAT_LINEBREAK - if ((int *)varp == &curwin->w_p_lbr) - { - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; - } -#endif - -#ifdef FEAT_RIGHTLEFT - if ((int *)varp == &curwin->w_p_rl) - { - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; - } #endif /* @@ -8096,7 +8072,9 @@ set_bool_option(opt_idx, varp, value, opt_flags) options[opt_idx].flags |= P_WAS_SET; comp_col(); /* in case 'ruler' or 'showcmd' changed */ - + if (curwin->w_curswant != MAXCOL + && (options[opt_idx].flags & (P_CURSWANT | P_RCLR)) != 0) + curwin->w_set_curswant = TRUE; check_redraw(options[opt_idx].flags); return NULL; @@ -8611,8 +8589,9 @@ set_num_option(opt_idx, varp, value, errbuf, errbuflen, opt_flags) options[opt_idx].flags |= P_WAS_SET; comp_col(); /* in case 'columns' or 'ls' changed */ - if (curwin->w_curswant != MAXCOL) - curwin->w_set_curswant = TRUE; /* in case 'tabstop' changed */ + if (curwin->w_curswant != MAXCOL + && (options[opt_idx].flags & (P_CURSWANT | P_RCLR)) != 0) + curwin->w_set_curswant = TRUE; check_redraw(options[opt_idx].flags); return errmsg; diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index ba261ab6ae..b01d49b85b 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -29,7 +29,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test66.out test67.out test68.out test69.out test70.out \ test71.out test72.out test73.out test74.out test75.out \ test76.out test77.out test78.out test79.out test80.out \ - test81.out test82.out test83.out + test81.out test82.out test83.out test84.out .SUFFIXES: .in .out @@ -132,3 +132,4 @@ test80.out: test80.in test81.out: test81.in test82.out: test82.in test83.out: test83.in +test84.out: test84.in diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 9d0817354d..d322504a80 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -29,7 +29,8 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test42.out test52.out test65.out test66.out test67.out \ test68.out test69.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ - test79.out test80.out test81.out test82.out test83.out + test79.out test80.out test81.out test82.out test83.out \ + test84.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 5f9dbdd0db..0a680c5003 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -49,7 +49,8 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test42.out test52.out test65.out test66.out test67.out \ test68.out test69.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ - test79.out test80.out test81.out test82.out test83.out + test79.out test80.out test81.out test82.out test83.out \ + test84.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index 363bede3ca..9cef9aa263 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -29,7 +29,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test66.out test67.out test68.out test69.out test70.out \ test71.out test72.out test73.out test74.out test75.out \ test76.out test77.out test78.out test79.out test80.out \ - test81.out test82.out test83.out + test81.out test82.out test83.out test84.out .SUFFIXES: .in .out diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 4e6ae6370d..4e961cff08 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # -# Last change: 2011 Jul 15 +# Last change: 2012 Mar 28 # # 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. @@ -76,7 +76,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ test66.out test67.out test68.out test69.out \ test71.out test72.out test74.out test75.out test76.out \ test77.out test78.out test79.out test80.out test81.out \ - test82.out test83.out + test82.out test83.out test84.out # Known problems: # Test 30: a problem around mac format - unknown reason diff --git a/src/testdir/Makefile b/src/testdir/Makefile index a1cc22db78..405ebd4148 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -26,7 +26,8 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test64.out test65.out test66.out test67.out test68.out \ test69.out test70.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ - test79.out test80.out test81.out test82.out test83.out + test79.out test80.out test81.out test82.out test83.out \ + test84.out SCRIPTS_GUI = test16.out diff --git a/src/testdir/test84.in b/src/testdir/test84.in new file mode 100644 index 0000000000..25482db54c --- /dev/null +++ b/src/testdir/test84.in @@ -0,0 +1,35 @@ +Tests for curswant not changing when setting an option + +STARTTEST +:so small.vim +:/^start target options$/+1,/^end target options$/-1 yank +:let target_option_names = split(@0) +:function TestCurswant(option_name) +: normal! ggf8j +: let curswant_before = winsaveview().curswant +: execute 'let' '&'.a:option_name '=' '&'.a:option_name +: let curswant_after = winsaveview().curswant +: return [a:option_name, curswant_before, curswant_after] +:endfunction +: +:new +:put =['1234567890', '12345'] +:1 delete _ +:let result = [] +:for option_name in target_option_names +: call add(result, TestCurswant(option_name)) +:endfor +: +:new +:put =map(copy(result), 'join(v:val, '' '')') +:1 delete _ +:write test.out +: +:qall! +ENDTEST + +start target options + tabstop + timeoutlen + ttimeoutlen +end target options diff --git a/src/testdir/test84.ok b/src/testdir/test84.ok new file mode 100644 index 0000000000..8b8e4ee824 --- /dev/null +++ b/src/testdir/test84.ok @@ -0,0 +1,3 @@ +tabstop 7 4 +timeoutlen 7 7 +ttimeoutlen 7 7 diff --git a/src/version.c b/src/version.c index efa29f6197..ba2b030451 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 487, /**/ 486, /**/ From f1861181b22052d1efe406c8d455503d5a9a7c9c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 19:59:04 +0200 Subject: [PATCH 24/45] Added tag v7-3-487 for changeset 21219ffc9790 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index cef5171f76..be726dd658 100644 --- a/.hgtags +++ b/.hgtags @@ -1823,3 +1823,4 @@ b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 00fa605e7d7ba7d522c627a93de6e2f5017d2884 v7-3-484 94374e0b6267d8983a73a22166888c2282ee793d v7-3-485 08a37c57af479b54fa327bedc0ef31c42dd96f63 v7-3-486 +21219ffc97903684349f1fcc843eb61838877874 v7-3-487 From a904962cdd38af14a790962f03e14e19b3ac8d13 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Mar 2012 20:51:51 +0200 Subject: [PATCH 25/45] Updated runtime files. --- runtime/doc/editing.txt | 8 +- runtime/doc/eval.txt | 11 +- runtime/doc/options.txt | 19 ++- runtime/doc/repeat.txt | 8 +- runtime/doc/starting.txt | 5 +- runtime/doc/syntax.txt | 10 +- runtime/doc/todo.txt | 26 ++-- runtime/doc/usr_41.txt | 4 +- runtime/filetype.vim | 8 +- runtime/ftplugin/falcon.vim | 6 +- runtime/ftplugin/kwt.vim | 10 +- runtime/ftplugin/vim.vim | 6 +- runtime/indent/dtd.vim | 1 + runtime/indent/tex.vim | 155 +++++++++++++++--------- runtime/macros/matchit.vim | 1 + runtime/syntax/sh.vim | 5 +- src/VisVim/README_VisVim.txt | 8 +- src/po/nl.po | 222 ++++++++++++++++++++--------------- 18 files changed, 315 insertions(+), 198 deletions(-) diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 17a8ca3839..977a94dce2 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.3. Last change: 2011 Feb 26 +*editing.txt* For Vim version 7.3. Last change: 2012 Mar 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1159,8 +1159,10 @@ MULTIPLE WINDOWS AND BUFFERS *window-exit* *:confirm* *:conf* :conf[irm] {command} Execute {command}, and use a dialog when an operation has to be confirmed. Can be used on the - ":q", ":qa" and ":w" commands (the latter to over-ride - a read-only setting). + |:q|, |:qa| and |:w| commands (the latter to override + a read-only setting), and any other command that can + fail in such a way, such as |:only|, |:buffer|, + |:bdelete|, etc. Examples: > :confirm w foo diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index ce4c41b7ee..cb0dbc01ce 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.3. Last change: 2012 Mar 07 +*eval.txt* For Vim version 7.3. Last change: 2012 Mar 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3473,7 +3473,8 @@ glob({expr} [, {nosuf} [, {list}]]) *glob()* matches, they are separated by characters. If the expansion fails, the result is an empty String or List. - A name for a non-existing file is not included. + A name for a non-existing file is not included. A symbolic + link is only included if it points to an existing file. For most systems backticks can be used to get files names from any external command. Example: > @@ -5779,9 +5780,9 @@ tabpagebuflist([{arg}]) *tabpagebuflist()* omitted the current tab page is used. When {arg} is invalid the number zero is returned. To get a list of all buffers in all tabs use this: > - tablist = [] + let buflist = [] for i in range(tabpagenr('$')) - call extend(tablist, tabpagebuflist(i + 1)) + call extend(buflist, tabpagebuflist(i + 1)) endfor < Note that a buffer may appear in more than one window. @@ -6003,7 +6004,7 @@ virtcol({expr}) *virtcol()* would be of unlimited width. When there is a at the position, the returned Number will be the column at the end of the . For example, for a in column 1, with 'ts' - set to 8, it returns 8. + set to 8, it returns 8. |conceal| is ignored. For the byte position use |col()|. For the use of {expr} see |col()|. When 'virtualedit' is used {expr} can be [lnum, col, off], where diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 23ac10a61f..2c79617b27 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1,4 +1,4 @@ -*options.txt* For Vim version 7.3. Last change: 2012 Feb 22 +*options.txt* For Vim version 7.3. Last change: 2012 Mar 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3772,9 +3772,10 @@ A jump table for the options with a short description can be found at |Q_op|. 'highlight' 'hl' string (default (as a single string): "8:SpecialKey,@:NonText,d:Directory, e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg, - M:ModeMsg,n:LineNr,r:Question, - s:StatusLine,S:StatusLineNC,c:VertSplit, - t:Title,v:Visual,w:WarningMsg,W:WildMenu, + M:ModeMsg,n:LineNr,N:CursorLineNr, + r:Question,s:StatusLine,S:StatusLineNC, + c:VertSplit, t:Title,v:Visual, + w:WarningMsg,W:WildMenu, f:Folded,F:FoldColumn,A:DiffAdd, C:DiffChange,D:DiffDelete,T:DiffText, >:SignColumn,B:SpellBad,P:SpellCap, @@ -3800,6 +3801,7 @@ A jump table for the options with a short description can be found at |Q_op|. |hl-ModeMsg| M Mode (e.g., "-- INSERT --") |hl-LineNr| n line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + |hl-CursorLineNr| N like n for when 'cursorline' is set. |hl-Question| r |hit-enter| prompt and yes/no questions |hl-StatusLine| s status line of current window |status-line| |hl-StatusLineNC| S status lines of not-current windows @@ -5078,7 +5080,8 @@ A jump table for the options with a short description can be found at |Q_op|. number. When a long, wrapped line doesn't start with the first character, '-' characters are put before the number. - See |hl-LineNr| for the highlighting used for the number. + See |hl-LineNr| and |hl-CursorLineNr| for the highlighting used for + the number. When setting this option, 'relativenumber' is reset. *'numberwidth'* *'nuw'* @@ -5477,7 +5480,8 @@ A jump table for the options with a short description can be found at |Q_op|. number. When a long, wrapped line doesn't start with the first character, '-' characters are put before the number. - See |hl-LineNr| for the highlighting used for the number. + See |hl-LineNr| and |hl-CursorLineNr| for the highlighting used for + the number. When setting this option, 'number' is reset. *'remap'* *'noremap'* @@ -6563,6 +6567,9 @@ A jump table for the options with a short description can be found at |Q_op|. evaluated and the result is used as the option value. Example: > :set statusline=%!MyStatusLine() < The result can contain %{} items that will be evaluated too. + Note that the "%!" expression is evaluated in the context of the + current window and buffer, while %{} items are evaluated in the + context of the window that the statusline belongs to. When there is error while evaluating the option then it will be made empty to avoid further errors. Otherwise screen updating would loop. diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index eec13c0e23..9a97321eb4 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -1,4 +1,4 @@ -*repeat.txt* For Vim version 7.3. Last change: 2011 Jan 06 +*repeat.txt* For Vim version 7.3. Last change: 2012 Mar 23 VIM REFERENCE MANUAL by Bram Moolenaar @@ -109,7 +109,7 @@ q Stops recording. (Implementation note: The 'q' that it was the result of a mapping) {Vi: no recording} *@* -@{0-9a-z".=*} Execute the contents of register {0-9a-z".=*} [count] +@{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} [count] times. Note that register '%' (name of the current file) and '#' (name of the alternate file) cannot be used. @@ -123,8 +123,8 @@ q Stops recording. (Implementation note: The 'q' that *@@* *E748* @@ Repeat the previous @{0-9a-z":*} [count] times. -:[addr]*{0-9a-z".=} *:@* *:star* -:[addr]@{0-9a-z".=*} Execute the contents of register {0-9a-z".=*} as an Ex +:[addr]*{0-9a-z".=+} *:@* *:star* +:[addr]@{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} as an Ex command. First set cursor at line [addr] (default is current line). When the last line in the register does not have a it will be added automatically when diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index e390e4c8a6..84dc78b312 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 7.3. Last change: 2011 Jul 22 +*starting.txt* For Vim version 7.3. Last change: 2012 Mar 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -248,7 +248,8 @@ a slash. Thus "-R" means recovery and "-/R" readonly. {not in Vi} *-g* --g Start Vim in GUI mode. See |gui|. {not in Vi} +-g Start Vim in GUI mode. See |gui|. For the opposite see |-v|. + {not in Vi} *-v* -v Start Ex in Vi mode. Only makes a difference when the diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index e480968f90..4bd181aca0 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.3. Last change: 2012 Feb 11 +*syntax.txt* For Vim version 7.3. Last change: 2012 Mar 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -199,7 +199,8 @@ REPLACING AN EXISTING SYNTAX FILE *mysyntaxfile-replace* If you don't like a distributed syntax file, or you have downloaded a new version, follow the same steps as for |mysyntaxfile| above. Just make sure that you write the syntax file in a directory that is early in 'runtimepath'. -Vim will only load the first syntax file found. +Vim will only load the first syntax file found, assuming that it sets +b:current_syntax. NAMING CONVENTIONS *group-name* *{group-name}* *E669* *W18* @@ -754,7 +755,8 @@ c_no_ansi don't do standard ANSI types and constants c_ansi_typedefs ... but do standard ANSI types c_ansi_constants ... but do standard ANSI constants c_no_utf don't highlight \u and \U in strings -c_syntax_for_h use C syntax for *.h files, instead of C++ +c_syntax_for_h for *.h files use C syntax instead of C++ and use objc + syntax instead of objcpp c_no_if0 don't highlight "#if 0" blocks as comments c_no_cformat don't highlight %-formats in strings c_no_c99 don't highlight C99 standard items @@ -4421,6 +4423,8 @@ IncSearch 'incsearch' highlighting; also used for the text replaced with *hl-LineNr* LineNr Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + *hl-CursorLineNr* +CursorLineNr Like LineNr when 'cursorline' is set for the cursor line. *hl-MatchParen* MatchParen The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt| diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 4b8ff6e034..0ddf7cc704 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.3. Last change: 2012 Mar 07 +*todo.txt* For Vim version 7.3. Last change: 2012 Mar 28 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 ----------------------- +Go through list of maintainers that didn't respond. (Thilo Six, Mar 19) + Go through more coverity reports. Discussion about canonicalization of Hebrew. (Ron Aaron, 2011 April 10) @@ -63,11 +65,8 @@ Win32: When the taskbar is at the top of the screen creating the tabbar causes the window to move unnecessarily. (William E. Skeith III, 2012 Jan 12) Patch: 2012 Jan 13 Needs more work (2012 Feb 2) -Patch to highlight cursor line number. (Howard Buchholz (lhb), 2011 Oct 18) - URXVT: - will get stuck if byte sequence does not containe expected semicolon. -- Patch for urxvt mouse support after shell command. (Issue 31) - Use urxvt mouse support also in xterm. Explanations: http://www.midnight-commander.org/ticket/2662 @@ -79,15 +78,6 @@ When exiting with unsaved changes, selecting an existing file in the file dialog, there is no dialog to ask whether the existing file should be overwritten. (Felipe G. Nievinski, 2011 Dec 22) -Patch for improved ":qa" behavior. (Hirohito Higashi, 2012 Feb 18) - -Recognize objcpp. (Austin Ziegler, 2012 Feb 15) - -7 Setting an option always sets "w_set_curswant", while this is only - required for a few options. Only do it for those options to avoid the - side effect. -Patch by Kana Natsuno, 2011 Nov 12. - Using Ctrl-] in a mapping does not expand abbreviations. Patch by Christian Brabandt, 2012 Mar 2. @@ -99,8 +89,6 @@ Patch for option in 'cino' to specify more indent for continued conditions. (Lech Lorens, 2011 Nov 27) Isn't this already possible? Update 2012 Feb 15. -Patch for using objcpp file type for headers files. Issue 44. - Docs fix for v:register. (Ingo Karkat, 2011 Sep 26, 27) v:register doesn't work exactly as expected. (David Fishburn, 2011 Sep 20) @@ -123,6 +111,9 @@ Matsumoto, 2012 Jan 30) Patch to add completion for :history command. (Dominique Pelle, 2012 Feb 26) +Patch for 'backupcopy' default behavior for symlinks on Windows. (David Pope, +2012 Mar 21) + Use a count before "v" and "V" to select that many characters or lines? (Kikyous) @@ -195,6 +186,9 @@ Sep 17) Asked for feedback from others. Win32: Cannot cd into a directory that starts with a space. (Andy Wokula, 2012 Jan 19) +Win32: default for 'backupcopy' is wrong for a symbolic link. (mklink one +two). (Benjamin Fritz, 2012 Mar 15) + Need to escape $HOME on Windows? (ZyX, 2011 Jul 21) "2" in 'formatopions' not working in comments. (Christian Corneliussen, 2011 @@ -511,6 +505,8 @@ path. Test 51 fails when language set to German. (Marco, 2011 Jan 9) Dominique can't reproduc it. +'ambiwidth' should be global-local. + ":function f(x) keepjumps" creates a function where every command is executed like it has ":keepjumps" before it. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 0e85688d06..77f7d1c350 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 7.3. Last change: 2011 Dec 15 +*usr_41.txt* For Vim version 7.3. Last change: 2012 Mar 16 VIM USER MANUAL - by Bram Moolenaar @@ -1710,6 +1710,7 @@ make the script work for most people. It is done like this: > 12 set cpo&vim .. 42 let &cpo = s:save_cpo + 43 unlet s:save_cpo We first store the old value of 'cpoptions' in the s:save_cpo variable. At the end of the plugin this value is restored. @@ -1956,6 +1957,7 @@ Here is the resulting complete example: > 40 endif 41 42 let &cpo = s:save_cpo + 43 unlet s:save_cpo Line 33 wasn't explained yet. It applies the new correction to the word under the cursor. The |:normal| command is used to use the new abbreviation. Note diff --git a/runtime/filetype.vim b/runtime/filetype.vim index b9773b7148..83d07bc102 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: 2012 Feb 24 +" Last Change: 2012 Mar 28 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -367,7 +367,11 @@ au BufNewFile,BufRead *.h call s:FTheader() func! s:FTheader() if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1 - setf objc + if exists("g:c_syntax_for_h") + setf objc + else + setf objcpp + endif elseif exists("g:c_syntax_for_h") setf c elseif exists("g:ch_syntax_for_h") diff --git a/runtime/ftplugin/falcon.vim b/runtime/ftplugin/falcon.vim index 776db8013a..2e1e7fafb6 100644 --- a/runtime/ftplugin/falcon.vim +++ b/runtime/ftplugin/falcon.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Falcon " Author: Steven Oliver -" Copyright: Copyright (c) 2009, 2010, 2011 Steven Oliver +" Copyright: Copyright (c) 2009, 2010, 2011, 2012 Steven Oliver " License: You may redistribute this under the same terms as Vim itself " -------------------------------------------------------------------------- " GetLatestVimScripts: 2762 1 :AutoInstall: falcon.vim @@ -40,6 +40,10 @@ if has("gui_win32") && !exists("b:browsefilter") \ "All Files (*.*)\t*.*\n" endif +let b:undo_ftplugin = "setlocal tabstop< shiftwidth< expandtab< fileencoding<" + \ . " suffixesadd< comments<" + \ . "| unlet! b:browsefiler" + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/kwt.vim b/runtime/ftplugin/kwt.vim index 6d4b8fdbf6..05b40d4e29 100644 --- a/runtime/ftplugin/kwt.vim +++ b/runtime/ftplugin/kwt.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Kimwitu++ " Maintainer: Michael Piefel -" Last Change: 10 December 2011 +" Last Change: 10 March 2012 " Behaves almost like C++ runtime! ftplugin/cpp.vim ftplugin/cpp_*.vim ftplugin/cpp/*.vim @@ -20,5 +20,13 @@ endif " Set the errorformat for the Kimwitu++ compiler set efm+=kc%.%#:\ error\ at\ %f:%l:\ %m +if exists("b:undo_ftplugin") + let b:undo_ftplugin = b:undo_ftplugin . " | setlocal efm<" + \ . "| unlet! b:browsefiler" +else + let b:undo_ftplugin = "setlocal efm<" + \ . "| unlet! b:browsefiler" +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim index de8a047982..5feb152712 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: 2009 Jan 22 +" Last Change: 2012 Mar 21 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -21,6 +21,10 @@ let b:undo_ftplugin = "setl fo< isk< com< tw< commentstring<" " and insert the comment leader when hitting or using "o". setlocal fo-=t fo+=croql +" To make syntax highlighting of 'vimVar's work correctly we need the colon to +" be part of keywords. This needs to be done prior to the 'isk+=#' below. +setlocal isk+=: + " To allow tag lookup via CTRL-] for autoload functions, '#' must be a " keyword character. E.g., for netrw#Nread(). setlocal isk+=# diff --git a/runtime/indent/dtd.vim b/runtime/indent/dtd.vim index 4350dfbe2f..88c0c5129e 100644 --- a/runtime/indent/dtd.vim +++ b/runtime/indent/dtd.vim @@ -322,3 +322,4 @@ function GetDTDIndent() endfunction let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/tex.vim b/runtime/indent/tex.vim index dcfbccdbe5..8e2a5daa8c 100644 --- a/runtime/indent/tex.vim +++ b/runtime/indent/tex.vim @@ -1,33 +1,54 @@ " Vim indent file " Language: LaTeX -" Maintainer: Zhou YiChao +" Maintainer: Zhou YiChao " Created: Sat, 16 Feb 2002 16:50:19 +0100 -" Last Change: 2011 Dec 24 -" Last Update: 25th Sep 2002, by LH : +" Last Change: 2012 Mar 18 19:19:50 +" Version: 0.7 +" Please email me if you found something we can do. Bug report and +" feature request is welcome. + +" Last Update: {{{ +" 25th Sep 2002, by LH : " (*) better support for the option " (*) use some regex instead of several '||'. " Oct 9th, 2003, by JT: " (*) don't change indentation of lines starting with '%' -" 2005/06/15, Moshe Kaminsky +" 2005/06/15, Moshe Kaminsky " (*) New variables: " g:tex_items, g:tex_itemize_env, g:tex_noindent_env -" 2011/3/6, by Zhou YiChao +" 2011/3/6, by Zhou YiChao " (*) Don't change indentation of lines starting with '%' " I don't see any code with '%' and it doesn't work properly " so I add some code. " (*) New features: Add smartindent-like indent for "{}" and "[]". " (*) New variables: g:tex_indent_brace -" 2011/9/25, by Zhou Yichao +" 2011/9/25, by Zhou Yichao " (*) Bug fix: smartindent-like indent for "[]" " (*) New features: Align with "&". -" (*) New variable: g:tex_indent_and -" 2011/10/23 by Zhou Yichao +" (*) New variable: g:tex_indent_and. +" 2011/10/23 by Zhou Yichao " (*) Bug fix: improve the smartindent-like indent for "{}" and " "[]". -" -" Version: 0.62 +" 2012/02/27 by Zhou Yichao +" (*) Bug fix: support default folding marker. +" (*) Indent with "&" is not very handy. Make it not enable by +" default. +" 2012/03/06 by Zhou Yichao +" (*) Modify "&" behavior and make it default again. Now "&" +" won't align when there are more then one "&" in the previous +" line. +" (*) Add indent "\left(" and "\right)" +" (*) Trust user when in "verbatim" and "lstlisting" +" 2012/03/11 by Zhou Yichao +" (*) Modify "&" so that only indent when current line start with +" "&". +" 2012/03/12 by Zhou Yichao +" (*) Modify indentkeys. +" 2012/03/18 by Zhou Yichao +" (*) Add &cpo +" }}} -" Options: {{{ +" Document: {{{ " " To set the following options (ok, currently it's just one), add a line like " let g:tex_indent_items = 1 @@ -37,42 +58,42 @@ " " If this variable is unset or non-zero, it will use smartindent-like style " for "{}" and "[]" -" +" " * g:tex_indent_items " " If this variable is set, item-environments are indented like Emacs does " it, i.e., continuation lines are indented with a shiftwidth. -" +" " NOTE: I've already set the variable below; delete the corresponding line " if you don't like this behaviour. " " Per default, it is unset. -" +" " set unset " ---------------------------------------------------------------- -" \begin{itemize} \begin{itemize} +" \begin{itemize} \begin{itemize} " \item blablabla \item blablabla -" bla bla bla bla bla bla +" bla bla bla bla bla bla " \item blablabla \item blablabla -" bla bla bla bla bla bla -" \end{itemize} \end{itemize} +" bla bla bla bla bla bla +" \end{itemize} \end{itemize} " " " * g:tex_items " -" A list of tokens to be considered as commands for the beginning of an item -" command. The tokens should be separated with '\|'. The initial '\' should +" A list of tokens to be considered as commands for the beginning of an item +" command. The tokens should be separated with '\|'. The initial '\' should " be escaped. The default is '\\bibitem\|\\item'. " " * g:tex_itemize_env -" -" A list of environment names, separated with '\|', where the items (item -" commands matching g:tex_items) may appear. The default is +" +" A list of environment names, separated with '\|', where the items (item +" commands matching g:tex_items) may appear. The default is " 'itemize\|description\|enumerate\|thebibliography'. " " * g:tex_noindent_env " -" A list of environment names. separated with '\|', where no indentation is +" A list of environment names. separated with '\|', where no indentation is " required. The default is 'document\|verbatim'. " " * g:tex_indent_and @@ -82,14 +103,24 @@ " Note that this feature need to search back some line, so vim may become " a little slow. " -" }}} +" }}} + +" Only define the function once +if exists("*GetTeXIndent") + finish +endif if exists("b:did_indent") finish endif + +let s:cpo_save = &cpo +set cpo&vim + +" Define global variable {{{ + let b:did_indent = 1 -" Delete the next line to avoid the special indention of items if !exists("g:tex_indent_items") let g:tex_indent_items = 1 endif @@ -104,31 +135,30 @@ if g:tex_indent_items let g:tex_itemize_env = 'itemize\|description\|enumerate\|thebibliography' endif if !exists('g:tex_items') - let g:tex_items = '\\bibitem\|\\item' + let g:tex_items = '\\bibitem\|\\item' endif else let g:tex_items = '' endif -if !exists("g:tex_noindent_env") - let g:tex_noindent_env = 'document\|verbatim\|lstlisting' +if !exists("g:tex_indent_paretheses") + let g:tex_indent_paretheses = 1 endif +if !exists("g:tex_noindent_env") + let g:tex_noindent_env = 'document\|verbatim\|lstlisting' +endif "}}} + +" VIM Setting " {{{ setlocal autoindent setlocal nosmartindent setlocal indentexpr=GetTeXIndent() -exec 'setlocal indentkeys+=},],\&' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g') -let g:tex_items = '^\s*' . g:tex_items +setlocal indentkeys& +exec 'setlocal indentkeys+=[,(,{,),},],\&' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g') +let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '') +" }}} - -" Only define the function once -if exists("*GetTeXIndent") | finish -endif - -let s:cpo_save = &cpo -set cpo&vim - -function GetTeXIndent() +function GetTeXIndent() " {{{ " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) @@ -139,16 +169,25 @@ function GetTeXIndent() " At the start of the file use zero indent. if lnum == 0 - return 0 + return 0 endif - let line = getline(lnum) " last line - let cline = getline(v:lnum) " current line + let line = substitute(getline(lnum), '%.*', ' ','g') " last line + let cline = substitute(getline(v:lnum), '%.*', ' ', 'g') " current line + " We are in verbatim, so do what our user what. + if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone" + if empty(cline) + return indent(lnum) + else + return indent(v:lnum) + end + endif + " You want to align with "&" if g:tex_indent_and - " Align with last line if last line has a "&" - if stridx(cline, "&") != -1 && stridx(line, "&") != -1 + " Align only when current line start with "&" + if line =~ '&.*\\\\' && cline =~ '^\s*&' return indent(v:lnum) + stridx(line, "&") - stridx(cline, "&") endif @@ -161,7 +200,7 @@ function GetTeXIndent() if lnum == 0 - return 0 + return 0 endif let ind = indent(lnum) @@ -173,12 +212,10 @@ function GetTeXIndent() " Add a 'shiftwidth' after beginning of environments. " Don't add it for \begin{document} and \begin{verbatim} - ""if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim' + ""if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim' " LH modification : \begin does not always start a line " ZYC modification : \end after \begin won't cause wrong indent anymore if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env - \ && line !~ '\\begin{.\{-}}.*\\end{.*}' - let ind = ind + &sw if g:tex_indent_items @@ -189,9 +226,8 @@ function GetTeXIndent() endif endif - " Subtract a 'shiftwidth' when an environment ends - if cline =~ '^\s*\\end' && cline !~ g:tex_noindent_env + if cline =~ '\\end{.*}' && cline !~ g:tex_noindent_env if g:tex_indent_items " Remove another sw for item-environments @@ -204,23 +240,26 @@ function GetTeXIndent() endif if g:tex_indent_brace - " Add a 'shiftwidth' after a "{" or "[". let sum1 = 0 for i in range(0, strlen(line)-1) - if line[i] == "}" || line[i] == "]" + if line[i] == "}" || line[i] == "]" || + \ strpart(line, i, 7) == '\right)' let sum1 = max([0, sum1-1]) endif - if line[i] == "{" || line[i] == "[" + if line[i] == "{" || line[i] == "[" || + \ strpart(line, i, 6) == '\left(' let sum1 += 1 endif endfor let sum2 = 0 for i in reverse(range(0, strlen(cline)-1)) - if cline[i] == "{" || cline[i] == "[" + if cline[i] == "{" || cline[i] == "[" || + \ strpart(cline, i, 6) == '\left(' let sum2 = max([0, sum2-1]) endif - if cline[i] == "}" || cline[i] == "]" + if cline[i] == "}" || cline[i] == "]" || + \ strpart(cline, i, 7) == '\right)' let sum2 += 1 endif endfor @@ -228,6 +267,8 @@ function GetTeXIndent() let ind += (sum1 - sum2) * &sw endif + if g:tex_indent_paretheses + endif " Special treatment for 'item' " ---------------------------- @@ -247,7 +288,7 @@ function GetTeXIndent() endif return ind -endfunction +endfunction "}}} let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/macros/matchit.vim b/runtime/macros/matchit.vim index 549c26cf31..03dae6a2f7 100644 --- a/runtime/macros/matchit.vim +++ b/runtime/macros/matchit.vim @@ -808,5 +808,6 @@ fun! s:ParseSkip(str) endfun let &cpo = s:save_cpo +unlet s:save_cpo " vim:sts=2:sw=2: diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 1497499c59..355e8eb918 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -2,8 +2,8 @@ " Language: shell (sh) Korn shell (ksh) bash (sh) " Maintainer: Dr. Charles E. Campbell, Jr. " Previous Maintainer: Lennart Schultz -" Last Change: Dec 09, 2011 -" Version: 121 +" Last Change: Mar 19, 2012 +" Version: 122 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " For options and settings, please use: :help ft-sh-syntax " This file includes many ideas from ?ric Brunet (eric.brunet@ens.fr) @@ -263,6 +263,7 @@ syn match shEscape contained '\\.' contains=@shCommandSubList if exists("b:is_kornshell") || exists("b:is_bash") syn region shCommandSub matchgroup=shCmdSubRegion start="\$(" skip='\\\\\|\\.' end=")" contains=@shCommandSubList syn region shArithmetic matchgroup=shArithRegion start="\$((" skip='\\\\\|\\.' end="))" contains=@shArithList + syn region shArithmetic matchgroup=shArithRegion start="\$\[" skip='\\\\\|\\.' end="\]" contains=@shArithList syn match shSkipInitWS contained "^\s\+" elseif !exists("g:sh_no_error") syn region shCommandSub matchgroup=Error start="\$(" end=")" contains=@shCommandSubList diff --git a/src/VisVim/README_VisVim.txt b/src/VisVim/README_VisVim.txt index 31c7299db7..abb690459a 100644 --- a/src/VisVim/README_VisVim.txt +++ b/src/VisVim/README_VisVim.txt @@ -17,12 +17,16 @@ own window. VisVim is based upon VisEmacs by Christopher Payne (Copyright (C) Christopher Payne 1997). -Author: Heiko Erhardt +Author: Heiko Erhardt Based upon: VisEmacs by Christopher Payne Version: 1.0 Created: 23 Oct 1997 Date: 23 Oct 1997 +VisVim was originally GNU GPL licensed, as stated below. On March 21 2012 +Heiko Erhardt declared this work to be relicensed under the Vim license, as +stated in ../../runtime/doc/uganda.txt (or ":help uganda" in Vim). + VisVim is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) @@ -318,5 +322,5 @@ Known Problems Have fun! Heiko Erhardt -Heiko.Erhardt@munich.netsurf.de +heiko.erhardt@gmx.net diff --git a/src/po/nl.po b/src/po/nl.po index 048388aeae..23dc99e97a 100644 --- a/src/po/nl.po +++ b/src/po/nl.po @@ -9,12 +9,12 @@ msgstr "" "Project-Id-Version: vim 7.3\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2011-05-29 07:43+0200\n" -"PO-Revision-Date: 2012-02-25 18:01+0100\n" -"Last-Translator: Erwin Poeze \n" +"PO-Revision-Date: 2012-03-28 08:07+0200\n" +"Last-Translator: YOUR NAME \n" "Language-Team: Dutch \n" "Language: nl\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" @@ -105,12 +105,12 @@ msgstr "E87: kan niet voorbij het laatste buffer komen" #: buffer.c:1021 msgid "E88: Cannot go before first buffer" -msgstr "E88: kan niet voor het eerste buffer komen" +msgstr "E88: kan niet vóór het eerste buffer komen" #: buffer.c:1063 #, c-format msgid "E89: No write since last change for buffer %ld (add ! to override)" -msgstr "E89: niets opgeslagen sinds laatste wijziging van buffer %ld (voeg ! toe om dit te negeren)" +msgstr "E89: niets opgeslagen sinds laatste wijziging van buffer %ld (voeg ! toe om te forceren)" #: buffer.c:1080 msgid "E90: Cannot unload last buffer" @@ -209,7 +209,7 @@ msgstr "Alles" #: buffer.c:4188 msgid "Bot" -msgstr "Bod" +msgstr "Bodem" #: buffer.c:4191 msgid "Top" @@ -1657,11 +1657,11 @@ msgstr "Gegroet, Vim-gebruiker!" #: ex_docmd.c:6492 msgid "E784: Cannot close last tab page" -msgstr "E784: laatste tab-pagina kan niet afgesloten worden" +msgstr "E784: laatste tabpagina kan niet afgesloten worden" #: ex_docmd.c:6534 msgid "Already only one tab page" -msgstr "Reeds beperkt tot één tab-pagina" +msgstr "Reeds beperkt tot één tabpagina" #: ex_docmd.c:7221 msgid "Edit File in new window" @@ -1670,7 +1670,7 @@ msgstr "Bestand in nieuw venster bewerken" #: ex_docmd.c:7347 #, c-format msgid "Tab page %d" -msgstr "Tab-pagina %d" +msgstr "Tabpagina %d" #: ex_docmd.c:7739 msgid "No swap file" @@ -1694,7 +1694,7 @@ msgstr "E187: onbekend" #: ex_docmd.c:8128 msgid "E465: :winsize requires two number arguments" -msgstr "E465: :winsize vereist twee getalsargumenten" +msgstr "E465: :winsize vereist twee getallen als argument" #: ex_docmd.c:8190 #, c-format @@ -1703,11 +1703,11 @@ msgstr "Vensterpositie: X %d, Y %d" #: ex_docmd.c:8195 msgid "E188: Obtaining window position not implemented for this platform" -msgstr "E188: verkrijgen van vensterpositie is voor dit platform niet geïmplementeerd" +msgstr "E188: verkrijgen van vensterpositie is voor dit platform niet geïmplementeerd" #: ex_docmd.c:8205 msgid "E466: :winpos requires two number arguments" -msgstr "E466: :winpos vereist twee getalsargumenten" +msgstr "E466: :winpos vereist twee getallen als argument" #: ex_docmd.c:8565 msgid "Save Redirection" @@ -3873,7 +3873,7 @@ msgstr "-unregister\t\tgvim afmelden voor OLE" #: main.c:3101 msgid "-g\t\t\tRun using GUI (like \"gvim\")" -msgstr "-g\t\t\tmet GUI opstarten (zoals \"gvim\")" +msgstr "-g\t\t\tMet GUI opstarten (zoals \"gvim\")" #: main.c:3102 msgid "-f or --nofork\tForeground: Don't fork when starting GUI" @@ -3913,7 +3913,7 @@ msgstr "-m\t\t\tAanpassingen (bestanden opslaan) niet toegestaan" #: main.c:3114 msgid "-M\t\t\tModifications in text not allowed" -msgstr "-M\t\t\tTektuele aanpassingen niet toegestaan" +msgstr "-M\t\t\tTekstuele aanpassingen niet toegestaan" #: main.c:3115 msgid "-b\t\t\tBinary mode" @@ -3933,51 +3933,51 @@ msgstr "-N\t\t\tNiet volledig met Vi uitwisselbaar: 'nocompatible'" #: main.c:3121 msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" -msgstr "-V[N][fname]\t\twees uitbundig [niveau N] [schrijf berichten naar fname]" +msgstr "-V[N][fname]\t\tWees uitbundig [niveau N] [schrijf berichten naar fname]" #: main.c:3123 msgid "-D\t\t\tDebugging mode" -msgstr "-D\t\t\tfoutopspoormodus" +msgstr "-D\t\t\tFoutopspoormodus" #: main.c:3125 msgid "-n\t\t\tNo swap file, use memory only" -msgstr "-n\t\t\tgeen wisselbestand, alleen geheugen gebruiken" +msgstr "-n\t\t\tGeen wisselbestand, alleen geheugen gebruiken" #: main.c:3126 msgid "-r\t\t\tList swap files and exit" -msgstr "-r\t\t\twisselbestanden tonen en stoppen" +msgstr "-r\t\t\tWisselbestanden tonen en stoppen" #: main.c:3127 msgid "-r (with file name)\tRecover crashed session" -msgstr "-r (met bestandsnaam)\therstel ontspoorde sessie" +msgstr "-r (bestandsnaam)\tHerstel ontspoorde sessie" #: main.c:3128 msgid "-L\t\t\tSame as -r" -msgstr "-L\t\t\tgelijk aan -r" +msgstr "-L\t\t\tGelijk aan -r" #: main.c:3130 msgid "-f\t\t\tDon't use newcli to open window" -msgstr "-f\t\t\tgebruik geen newcli om venster te openen" +msgstr "-f\t\t\tGebruik geen newcli om venster te openen" #: main.c:3131 msgid "-dev \t\tUse for I/O" -msgstr "-dev \t\tgebruik voor in- en uitvoer" +msgstr "-dev \t\tGebruik voor in- en uitvoer" #: main.c:3134 msgid "-A\t\t\tstart in Arabic mode" -msgstr "" +msgstr "-A\t\t\tIn Arabische modus starten" #: main.c:3137 msgid "-H\t\t\tStart in Hebrew mode" -msgstr "" +msgstr "-H\t\t\tIn Hebrewsche modus starten" #: main.c:3140 msgid "-F\t\t\tStart in Farsi mode" -msgstr "" +msgstr "-F\t\t\tIn Perzische modus starten" #: main.c:3142 msgid "-T \tSet terminal type to " -msgstr "" +msgstr "-T \tTerminalsoort op instellen" #: main.c:3143 msgid "-u \t\tUse instead of any .vimrc" @@ -3997,27 +3997,27 @@ msgstr "-p[N]\t\tN tabpagina's openen (standaard: 1 per bestand)" #: main.c:3150 msgid "-o[N]\t\tOpen N windows (default: one for each file)" -msgstr "" +msgstr "-o[N]\t\tN vensters openen (standaard: 1 per bestand)" #: main.c:3151 msgid "-O[N]\t\tLike -o but split vertically" -msgstr "" +msgstr "-O[N]\t\tGelijk aan -o maar vertikaal gesplitst" #: main.c:3153 msgid "+\t\t\tStart at end of file" -msgstr "" +msgstr "+\t\t\tAan einde van bestand beginnen" #: main.c:3154 msgid "+\t\tStart at line " -msgstr "" +msgstr "+\t\tOp regel beginnen" #: main.c:3155 msgid "--cmd \tExecute before loading any vimrc file" -msgstr "" +msgstr "--cmd \tOpdracht uitvoeren voor enige vimrc-bestand" #: main.c:3156 msgid "-c \t\tExecute after loading the first file" -msgstr "" +msgstr "-c \t\tOpdracht uitvoeren na eerste bestand" #: main.c:3157 msgid "-S \t\tSource file after loading the first file" @@ -4552,124 +4552,139 @@ msgid "" "You may want to delete the .swp file now.\n" "\n" msgstr "" +"\n" +"Het .swp-bestand kan nu verwijderd worden.\n" +"\n" #. use msg() to start the scrolling properly #: memline.c:1462 msgid "Swap files found:" -msgstr "" +msgstr "Gevonden wisselbestanden:" #: memline.c:1649 msgid " In current directory:\n" -msgstr "" +msgstr " In huidige map:\n" #: memline.c:1651 msgid " Using specified name:\n" -msgstr "" +msgstr " Gebruikt opgegeven naam:\n" #: memline.c:1655 msgid " In directory " -msgstr "" +msgstr " In map " #: memline.c:1673 msgid " -- none --\n" -msgstr "" +msgstr " -- geen --\n" #: memline.c:1748 msgid " owned by: " -msgstr "" +msgstr " eigenaar: " #: memline.c:1750 msgid " dated: " -msgstr "" +msgstr " datum: " #: memline.c:1754 #: memline.c:3794 msgid " dated: " -msgstr "" +msgstr " datum: " #: memline.c:1773 msgid " [from Vim version 3.0]" -msgstr "" +msgstr " [van Vim-versie 3.0]" #: memline.c:1777 msgid " [does not look like a Vim swap file]" -msgstr "" +msgstr " [lijkt geen Vvim-wisselbestand te zijn]" #: memline.c:1781 msgid " file name: " -msgstr "" +msgstr " bestandsnaam: " #: memline.c:1787 msgid "" "\n" " modified: " msgstr "" +"\n" +" bewerkt: " #: memline.c:1788 msgid "YES" -msgstr "" +msgstr "JA" #: memline.c:1788 msgid "no" -msgstr "" +msgstr "nee" #: memline.c:1792 msgid "" "\n" " user name: " msgstr "" +"\n" +" gebruikersnaam: " #: memline.c:1799 msgid " host name: " -msgstr "" +msgstr " host-naam:" #: memline.c:1801 msgid "" "\n" " host name: " msgstr "" +"\n" +" host-naam: " #: memline.c:1807 msgid "" "\n" " process ID: " msgstr "" +"\n" +" proces-id: " #: memline.c:1813 msgid " (still running)" -msgstr "" +msgstr " (nog actief)" #: memline.c:1825 msgid "" "\n" " [not usable with this version of Vim]" msgstr "" +"\n" +" [onbruikbaar met deze versie van Vim]" #: memline.c:1828 msgid "" "\n" " [not usable on this computer]" msgstr "" +"\n" +" [onbruikbaar op deze computer]" #: memline.c:1833 msgid " [cannot be read]" -msgstr "" +msgstr " [lezen is onmogelijk]" #: memline.c:1837 msgid " [cannot be opened]" -msgstr "" +msgstr " [openen is onmogelijk]" #: memline.c:2027 msgid "E313: Cannot preserve, there is no swap file" -msgstr "" +msgstr "E313: kan niet worden behouden, want er is geen wisselbestand" #: memline.c:2080 msgid "File preserved" -msgstr "" +msgstr "Bestand behouden" #: memline.c:2082 msgid "E314: Preserve failed" -msgstr "" +msgstr "E314: behouden is mislukt" #: memline.c:2159 #, c-format @@ -4735,25 +4750,27 @@ msgstr "" #: memline.c:3595 #, c-format msgid "E773: Symlink loop for \"%s\"" -msgstr "" +msgstr "E773: Symbolische koppelingslus voor \"%s\"" #: memline.c:3784 msgid "E325: ATTENTION" -msgstr "" +msgstr "E325: OPGELET" #: memline.c:3785 msgid "" "\n" "Found a swap file by the name \"" msgstr "" +"\n" +"Er is een wisselbestand aangetroffen met de naam \"" #: memline.c:3789 msgid "While opening file \"" -msgstr "" +msgstr "bij het openen van bestand \"" #: memline.c:3802 msgid " NEWER than swap file!\n" -msgstr "" +msgstr " NIEUWER dan het wisselbestand!\n" #. Some of these messages are long to allow translation to #. * other languages. @@ -4764,30 +4781,38 @@ msgid "" " If this is the case, be careful not to end up with two\n" " different instances of the same file when making changes.\n" msgstr "" +"\n" +"(1) Mogelijk wordt dit bestand met een ander programma bewerkt.\n" +" Als dit het geval is, pas dan op niet met twee verschillende\n" +" versies van hetzelfde bestand te eindigen bij het bewerken.\n" #: memline.c:3807 msgid " Quit, or continue with caution.\n" -msgstr "" +msgstr " Stop of ga aandachtig verder.\n" #: memline.c:3808 msgid "" "\n" "(2) An edit session for this file crashed.\n" msgstr "" +"\n" +"(2) Een sessie waarin dit bestand werd bewerkt is onverhoeds gestopt.\n" #: memline.c:3809 msgid " If this is the case, use \":recover\" or \"vim -r " -msgstr "" +msgstr " Als dit het geval is, gebruikt dan \":recover\" of \"vim -r " #: memline.c:3811 msgid "" "\"\n" " to recover the changes (see \":help recovery\").\n" msgstr "" +"\"\n" +" om de aanpassingen te herstellen (zie \":help recovery\").\n" #: memline.c:3812 msgid " If you did this already, delete the swap file \"" -msgstr "" +msgstr " Als dit al gedaan is, verwijder dan het wisselbestand \"" #: memline.c:3814 msgid "" @@ -4795,7 +4820,7 @@ msgid "" " to avoid this message.\n" msgstr "" "\"\n" -" om dit bericht te verkomen.\n" +" om dit bericht te voorkomen.\n" #: memline.c:4233 #: memline.c:4237 @@ -4823,6 +4848,11 @@ msgid "" "&Quit\n" "&Abort" msgstr "" +"Alleen-lezen &openen\n" +"Toch b&ewerken\n" +"He&rstellen\n" +"&Stoppen\n" +"&Afbreken" #: memline.c:4251 msgid "" @@ -4833,28 +4863,34 @@ msgid "" "&Quit\n" "&Abort" msgstr "" +"Alleen-lezen &openen\n" +"Toch b&ewerken\n" +"He&rstellen\n" +"Verwij&deren\n" +"&Stoppen\n" +"&Afbreken" #: memline.c:4322 msgid "E326: Too many swap files found" -msgstr "" +msgstr "E326: teveel wisselbestanden aangetroffen" #: menu.c:67 msgid "E327: Part of menu-item path is not sub-menu" -msgstr "" +msgstr "E327: deel van menu-itempad is geen submenu" #: menu.c:68 msgid "E328: Menu only exists in another mode" -msgstr "" +msgstr "E328: menu bestaat alleen in andere modus" #: menu.c:69 #, c-format msgid "E329: No menu \"%s\"" -msgstr "" +msgstr "E329: geen menu \"%s\"" #. Only a mnemonic or accelerator is not valid. #: menu.c:480 msgid "E792: Empty menu name" -msgstr "" +msgstr "E792: menunaam is leeg" #: menu.c:498 msgid "E330: Menu path must not lead to a sub-menu" @@ -5203,7 +5239,7 @@ msgstr "E663: einde van wijzigingslijst" #: normal.c:8854 msgid "Type :quit to exit Vim" -msgstr "Typ :quit om Vim te verlaten" +msgstr "Typ :quit om Vim te verlaten" #: ops.c:293 #, c-format @@ -7571,7 +7607,7 @@ msgid "Running in Vi compatible mode" msgstr "wordt uitgevoerd in Vi compatible-modus" #: version.c:1119 -msgid "type :set nocp for Vim defaults" +msgid "type :set nocp for Vim defaults" msgstr "typ :set nocp voor standaardinstellingen van Vim" #: version.c:1120 @@ -7851,11 +7887,11 @@ msgstr "" #: globals.h:1430 msgid "E19: Mark has invalid line number" -msgstr "" +msgstr "E19: markering heeft een ongeldig regelnummer" #: globals.h:1431 msgid "E20: Mark not set" -msgstr "" +msgstr "E20: Markering is niet ingesteld" #: globals.h:1432 msgid "E21: Cannot make changes, 'modifiable' is off" @@ -7863,7 +7899,7 @@ msgstr "E21: kan geen veranderingen maken, 'modifiable' is uitgeschakeld" #: globals.h:1433 msgid "E22: Scripts nested too deep" -msgstr "" +msgstr "E22: scripts " #: globals.h:1434 msgid "E23: No alternate file" @@ -7912,7 +7948,7 @@ msgstr "" #: globals.h:1455 msgid "E479: No match" -msgstr "" +msgstr "E479: geen overeenkomst" #: globals.h:1456 #, c-format @@ -7946,51 +7982,51 @@ msgstr "E36: onvoldoende ruimte" #: globals.h:1466 #, c-format msgid "E247: no registered server named \"%s\"" -msgstr "" +msgstr "E247: \"%s\" niet gevonden als geregistreerde server" #: globals.h:1468 #, c-format msgid "E482: Can't create file %s" -msgstr "" +msgstr "E482: aanmaken bestand %s is mislukt" #: globals.h:1469 msgid "E483: Can't get temp file name" -msgstr "" +msgstr "E483: bepalen naam tijdelijk bestand is mislukt" #: globals.h:1470 #, c-format msgid "E484: Can't open file %s" -msgstr "" +msgstr "E484: openen bestand %s is mislukt" #: globals.h:1471 #, c-format msgid "E485: Can't read file %s" -msgstr "" +msgstr "E485: lezen bestand %s is mislukt" #: globals.h:1472 msgid "E37: No write since last change (add ! to override)" -msgstr "E37: niets opgeslagen sinds laatste wijziging (voeg ! toe om dit te negeren)" +msgstr "E37: niets opgeslagen sinds laatste wijziging (voeg ! toe om te forceren)" #: globals.h:1473 msgid "E38: Null argument" -msgstr "" +msgstr "E38: leeg argument (null)" #: globals.h:1475 msgid "E39: Number expected" -msgstr "" +msgstr "E39: getal verwacht" #: globals.h:1478 #, c-format msgid "E40: Can't open errorfile %s" -msgstr "" +msgstr "E40: openen foutenbestand %s is mislukt" #: globals.h:1481 msgid "E233: cannot open display" -msgstr "" +msgstr "E233: openen scherm is mislukt" #: globals.h:1483 msgid "E41: Out of memory!" -msgstr "" +msgstr "E41: te weinig geheugen!" #: globals.h:1485 msgid "Pattern not found" @@ -8053,7 +8089,7 @@ msgstr "E523: hier niet toegestaan" #: globals.h:1513 msgid "E359: Screen mode setting not supported" -msgstr "" +msgstr "E359: instelling schermmodus niet ondersteund" #: globals.h:1515 msgid "E49: Invalid scroll size" @@ -8101,39 +8137,39 @@ msgstr "E78: onbekende markering" #: globals.h:1528 msgid "E79: Cannot expand wildcards" -msgstr "" +msgstr "E79: vervangen jokertekens is mislukt" #: globals.h:1530 msgid "E591: 'winheight' cannot be smaller than 'winminheight'" -msgstr "" +msgstr "E591: 'winheight' kan niet kleiner zijn dan 'winminheight'" #: globals.h:1532 msgid "E592: 'winwidth' cannot be smaller than 'winminwidth'" -msgstr "" +msgstr "E592: 'winwidth' kan niet kleiner zijn dan 'winminwidth'" #: globals.h:1535 msgid "E80: Error while writing" -msgstr "" +msgstr "E80: opslaan is mislukt" #: globals.h:1536 msgid "Zero count" -msgstr "" +msgstr "Aantal is nul" #: globals.h:1538 msgid "E81: Using not in a script context" -msgstr "" +msgstr "E81: wordt buiten de scriptcontext gebruikt" #: globals.h:1541 msgid "E449: Invalid expression received" -msgstr "" +msgstr "E449: ontvangen expressie is ongeldig" #: globals.h:1544 msgid "E463: Region is guarded, cannot modify" -msgstr "" +msgstr "E463: Regio is bescherm en kan niet worden veranderd" #: globals.h:1545 msgid "E744: NetBeans does not allow changes in read-only files" -msgstr "" +msgstr "E744: NetBeans staat geen veranderingen in alleen-lezenbestanden toe" #: globals.h:1547 #, c-format @@ -8142,7 +8178,7 @@ msgstr "E685: interne fout: %s" #: globals.h:1548 msgid "E363: pattern uses more memory than 'maxmempattern'" -msgstr "" +msgstr "E363: patroon gebruikt meer geheugen dan 'maxmempattern'" #: globals.h:1549 msgid "E749: empty buffer" From 63439ee2b7a1f71e2c35c97e1e324d9ddaf38712 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 16:05:05 +0200 Subject: [PATCH 26/45] updated for version 7.3.488 Problem: ":help!" in a help file does not work as document. Solution: When in a help file don't give an error message. (thinca) --- src/ex_cmds.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 661fba6c72..2f0f1f4d33 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -5546,7 +5546,7 @@ ex_help(eap) } arg = eap->arg; - if (eap->forceit && *arg == NUL) + if (eap->forceit && *arg == NUL && !curbuf->b_help) { EMSG(_("E478: Don't panic!")); return; diff --git a/src/version.c b/src/version.c index ba2b030451..8bcdd3075f 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 488, /**/ 487, /**/ From c8f86bce908528d3529970647c4dcec1603c1f3f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 16:05:05 +0200 Subject: [PATCH 27/45] Added tag v7-3-488 for changeset 8691bdcdbf66 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index be726dd658..d4da6ed20b 100644 --- a/.hgtags +++ b/.hgtags @@ -1824,3 +1824,4 @@ b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 94374e0b6267d8983a73a22166888c2282ee793d v7-3-485 08a37c57af479b54fa327bedc0ef31c42dd96f63 v7-3-486 21219ffc97903684349f1fcc843eb61838877874 v7-3-487 +8691bdcdbf66733c7ec1ef8161da1d4ef49dce66 v7-3-488 From 5c345052ca3bca03e3eb8b978da6b9c3fc42e43c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 16:07:06 +0200 Subject: [PATCH 28/45] updated for version 7.3.489 Problem: CTRL-] in Insert mode does not expand abbreviation when used in a mapping. (Yichao Zhou) Solution: Special case using CTRL-]. (Christian Brabandt) --- src/edit.c | 7 +++++-- src/getchar.c | 5 +++-- src/version.c | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/edit.c b/src/edit.c index e95ddddc25..c8320a6e23 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1455,13 +1455,16 @@ normalchar: Insstart_blank_vcol = get_nolist_virtcol(); } - if (vim_iswordc(c) || !echeck_abbr( + /* Insert a normal character and check for abbreviations on a + * special character. Let CTRL-] expand abbreviations without + * inserting it. */ + if (vim_iswordc(c) || (!echeck_abbr( #ifdef FEAT_MBYTE /* Add ABBR_OFF for characters above 0x100, this is * what check_abbr() expects. */ (has_mbyte && c >= 0x100) ? (c + ABBR_OFF) : #endif - c)) + c) && c != Ctrl_RSB)) { insert_special(c, FALSE, FALSE); #ifdef FEAT_RIGHTLEFT diff --git a/src/getchar.c b/src/getchar.c index dc7d768476..606d9a2c6f 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -4352,8 +4352,9 @@ check_abbr(c, ptr, col, mincol) if (typebuf.tb_no_abbr_cnt) /* abbrev. are not recursive */ return FALSE; - if ((KeyNoremap & (RM_NONE|RM_SCRIPT)) != 0) - /* no remapping implies no abbreviation */ + + /* no remapping implies no abbreviation, except for CTRL-] */ + if ((KeyNoremap & (RM_NONE|RM_SCRIPT)) != 0 && c != Ctrl_RSB) return FALSE; /* diff --git a/src/version.c b/src/version.c index 8bcdd3075f..d012d99090 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 489, /**/ 488, /**/ From 3f32e5b02361f1e1bca9a6c54648751f69ef05a2 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 16:07:06 +0200 Subject: [PATCH 29/45] Added tag v7-3-489 for changeset c1a6e1745cb5 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index d4da6ed20b..aa9de115e2 100644 --- a/.hgtags +++ b/.hgtags @@ -1825,3 +1825,4 @@ b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 08a37c57af479b54fa327bedc0ef31c42dd96f63 v7-3-486 21219ffc97903684349f1fcc843eb61838877874 v7-3-487 8691bdcdbf66733c7ec1ef8161da1d4ef49dce66 v7-3-488 +c1a6e1745cb521f863e63670e6c22c1c682ab4b1 v7-3-489 From c74e68a4d1042f7017763bc102f5b41d9708065a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 16:54:08 +0200 Subject: [PATCH 30/45] updated for version 7.3.490 Problem: Member confusion in Lua interface. Solution: Fix it. Add luaeval(). (Taro Muraoka, Luis Carvalho) --- runtime/doc/if_lua.txt | 134 ++++- src/eval.c | 27 + src/if_lua.c | 1157 ++++++++++++++++++++++++++++++---------- src/proto/if_lua.pro | 2 + src/version.c | 2 + 5 files changed, 1034 insertions(+), 288 deletions(-) diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index 65148224c2..718a229ebf 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -1,4 +1,4 @@ -*if_lua.txt* For Vim version 7.3. Last change: 2010 Jul 22 +*if_lua.txt* For Vim version 7.3. Last change: 2012 Jan 16 VIM REFERENCE MANUAL by Luis Carvalho @@ -8,8 +8,11 @@ The Lua Interface to Vim *lua* *Lua* 1. Commands |lua-commands| 2. The vim module |lua-vim| -3. Buffer userdata |lua-buffer| -4. Window userdata |lua-window| +3. List userdata |lua-list| +4. Dict userdata |lua-dict| +5. Buffer userdata |lua-buffer| +6. Window userdata |lua-window| +7. The luaeval function |lua-luaeval| {Vi does not have any of these commands} @@ -88,11 +91,9 @@ Examples: All these commands execute a Lua chunk from either the command line (:lua and :luado) or a file (:luafile) with the given line [range]. Similarly to the Lua interpreter, each chunk has its own scope and so only global variables are -shared between command calls. Lua default libraries "table", "string", "math", -and "package" are available, "io" and "debug" are not, and "os" is restricted -to functions "date", "clock", "time", "difftime", and "getenv". In addition, -Lua "print" function has its output redirected to the Vim message area, with -arguments separated by a white space instead of a tab. +shared between command calls. All Lua default libraries are available. In +addition, Lua "print" function has its output redirected to the Vim message +area, with arguments separated by a white space instead of a tab. Lua uses the "vim" module (see |lua-vim|) to issue commands to Vim and manage buffers (|lua-buffer|) and windows (|lua-window|). However, @@ -108,9 +109,9 @@ input range are stored in "vim.firstline" and "vim.lastline" respectively. The module also includes routines for buffer, window, and current line queries, Vim evaluation and command execution, and others. - vim.isbuffer(value) Returns 'true' (boolean, not string) if - "value" is a buffer userdata and 'false' - otherwise (see |lua-buffer|). + vim.list() Returns an empty list (see |List|). + + vim.dict() Returns an empty dictionary (see |Dictionary|). vim.buffer([arg]) If "arg" is a number, returns buffer with number "arg" in the buffer list or, if "arg" @@ -121,16 +122,21 @@ Vim evaluation and command execution, and others. 'true' returns the first buffer in the buffer list or else the current buffer. - vim.iswindow(value) Returns 'true' (boolean, not string) if - "value" is a window userdata and - 'false' otherwise (see |lua-window|). - vim.window([arg]) If "arg" is a number, returns window with number "arg" or 'nil' (nil value, not string) if not found. Otherwise, if "toboolean(arg)" is 'true' returns the first window or else the current window. + vim.type({arg}) Returns the type of {arg}. It is equivalent to + Lua's "type" function, but returns "list", + "dict", "buffer", or "window" if {arg} is a + list, dictionary, buffer, or window, + respectively. Examples: > + :lua l = vim.list() + :lua print(type(l), vim.type(l)) + :" userdata list +< vim.command({cmd}) Executes the vim (ex-mode) command {cmd}. Examples: > :lua vim.command"set tw=60" @@ -141,7 +147,7 @@ Vim evaluation and command execution, and others. Vim strings and numbers are directly converted to Lua strings and numbers respectively. Vim lists and dictionaries are converted to Lua - tables (lists become integer-keyed tables). + userdata (see |lua-list| and |lua-dict|). Examples: > :lua tw = vim.eval"&tw" :lua print(vim.eval"{'a': 'one'}".a) @@ -157,7 +163,72 @@ Vim evaluation and command execution, and others. ============================================================================== -3. Buffer userdata *lua-buffer* +3. List userdata *lua-list* + +List userdata represent vim lists, and the interface tries to follow closely +Vim's syntax for lists. Since lists are objects, changes in list references in +Lua are reflected in Vim and vice-versa. A list "l" has the following +properties and methods: + +Properties +---------- + o "#l" is the number of items in list "l", equivalent to "len(l)" + in Vim. + o "l[k]" returns the k-th item in "l"; "l" is zero-indexed, as in Vim. + To modify the k-th item, simply do "l[k] = newitem"; in + particular, "l[k] = nil" removes the k-th item from "l". + o "l()" returns an iterator for "l". + +Methods +------- + o "l:add(item)" appends "item" to the end of "l". + o "l:insert(item[, pos])" inserts "item" at (optional) + position "pos" in the list. The default value for "pos" is 0. + +Examples: +> + :let l = [1, 'item'] + :lua l = vim.eval('l') -- same 'l' + :lua l:add(vim.list()) + :lua l[0] = math.pi + :echo l[0] " 3.141593 + :lua l[0] = nil -- remove first item + :lua l:insert(true, 1) + :lua print(l, #l, l[0], l[1], l[-1]) + :lua for item in l() do print(item) end +< + +============================================================================== +4. Dict userdata *lua-dict* + +Similarly to list userdata, dict userdata represent vim dictionaries; since +dictionaries are also objects, references are kept between Lua and Vim. A dict +"d" has the following properties: + +Properties +---------- + o "#d" is the number of items in dict "d", equivalent to "len(d)" + in Vim. + o "d.key" or "d['key']" returns the value at entry "key" in "d". + To modify the entry at this key, simply do "d.key = newvalue"; in + particular, "d.key = nil" removes the entry from "d". + o "d()" returns an iterator for "d" and is equivalent to "items(d)" in + Vim. + +Examples: +> + :let d = {'n':10} + :lua d = vim.eval('d') -- same 'd' + :lua print(d, d.n, #d) + :let d.self = d + :lua for k, v in d() do print(d, k, v) end + :lua d.x = math.pi + :lua d.self = nil -- remove entry + :echo d +< + +============================================================================== +5. Buffer userdata *lua-buffer* Buffer userdata represent vim buffers. A buffer userdata "b" has the following properties and methods: @@ -209,7 +280,7 @@ Examples: < ============================================================================== -4. Window userdata *lua-window* +6. Window userdata *lua-window* Window objects represent vim windows. A window userdata "w" has the following properties and methods: @@ -241,4 +312,29 @@ Examples: < ============================================================================== - vim:tw=78:ts=8:ft=help:norl: +7. The luaeval function *lua-luaeval* + +The (dual) equivalent of "vim.eval" for passing Lua values to Vim is +"luaeval". "luaeval" takes an expression string and an optional argument and +returns the result of the expression. It is semantically equivalent in Lua to: +> + local chunkheader = "local _A = select(1, ...) return " + function luaeval (expstr, arg) + local chunk = assert(loadstring(chunkheader .. expstr, "luaeval")) + return chunk(arg) -- return typval + end +< +Note that "_A" receives the argument to "luaeval". Examples: > + + :echo luaeval('math.pi') + :lua a = vim.list():add('newlist') + :let a = luaeval('a') + :echo a[0] " 'newlist' + :function Rand(x,y) " random uniform between x and y + : return luaeval('(_A.y-_A.x)*math.random()+_A.x', {'x':a:x,'y':a:y}) + : endfunction + :echo Rand(1,10) + + +============================================================================== + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/src/eval.c b/src/eval.c index bf0363ab51..d460a83be9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -622,6 +622,9 @@ static void f_localtime __ARGS((typval_T *argvars, typval_T *rettv)); static void f_log __ARGS((typval_T *argvars, typval_T *rettv)); static void f_log10 __ARGS((typval_T *argvars, typval_T *rettv)); #endif +#ifdef FEAT_LUA +static void f_luaeval __ARGS((typval_T *argvars, typval_T *rettv)); +#endif static void f_map __ARGS((typval_T *argvars, typval_T *rettv)); static void f_maparg __ARGS((typval_T *argvars, typval_T *rettv)); static void f_mapcheck __ARGS((typval_T *argvars, typval_T *rettv)); @@ -6777,6 +6780,10 @@ garbage_collect() /* v: vars */ set_ref_in_ht(&vimvarht, copyID); +#ifdef FEAT_LUA + set_ref_in_lua(copyID); +#endif + /* * 2. Free lists and dictionaries that are not referenced. */ @@ -7945,6 +7952,9 @@ static struct fst #ifdef FEAT_FLOAT {"log", 1, 1, f_log}, {"log10", 1, 1, f_log10}, +#endif +#ifdef FEAT_LUA + {"luaeval", 1, 2, f_luaeval}, #endif {"map", 2, 2, f_map}, {"maparg", 1, 4, f_maparg}, @@ -13626,6 +13636,23 @@ f_log10(argvars, rettv) } #endif +#ifdef FEAT_LUA +/* + * "luaeval()" function + */ + static void +f_luaeval(argvars, rettv) + typval_T *argvars; + typval_T *rettv; +{ + char_u *str; + char_u buf[NUMBUFLEN]; + + str = get_tv_string_buf(&argvars[0], buf); + do_luaeval(str, argvars + 1, rettv); +} +#endif + /* * "map()" function */ diff --git a/src/if_lua.c b/src/if_lua.c index 0a7ba46e86..da88aab780 100644 --- a/src/if_lua.c +++ b/src/if_lua.c @@ -1,4 +1,4 @@ -/* vi:set ts=8 sts=4 sw=4: +/* vi:set ts=8 sts=4 sw=4 noet: * * VIM - Vi IMproved by Bram Moolenaar * @@ -21,15 +21,33 @@ #define LUAVIM_CHUNKNAME "vim chunk" #define LUAVIM_NAME "vim" +#define LUAVIM_EVALNAME "luaeval" +#define LUAVIM_EVALHEADER "local _A=select(1,...) return " typedef buf_T *luaV_Buffer; typedef win_T *luaV_Window; +typedef dict_T *luaV_Dict; +typedef list_T *luaV_List; typedef void (*msgfunc_T)(char_u *); +static const char LUAVIM_DICT[] = "dict"; +static const char LUAVIM_LIST[] = "list"; static const char LUAVIM_BUFFER[] = "buffer"; static const char LUAVIM_WINDOW[] = "window"; static const char LUAVIM_FREE[] = "luaV_free"; +static const char LUAVIM_LUAEVAL[] = "luaV_luaeval"; +static const char LUAVIM_SETREF[] = "luaV_setref"; +/* most functions are closures with a cache table as first upvalue; + * get/setudata manage references to vim userdata in cache table through + * object pointers (light userdata) */ +#define luaV_getudata(L, v) \ + lua_pushlightuserdata((L), (void *) (v)); \ + lua_rawget((L), lua_upvalueindex(1)) +#define luaV_setudata(L, v) \ + lua_pushlightuserdata((L), (void *) (v)); \ + lua_pushvalue((L), -2); \ + lua_rawset((L), lua_upvalueindex(1)) #define luaV_getfield(L, s) \ lua_pushlightuserdata((L), (void *)(s)); \ lua_rawget((L), LUA_REGISTRYINDEX) @@ -38,6 +56,15 @@ static const char LUAVIM_FREE[] = "luaV_free"; #define luaV_msg(L) luaV_msgfunc((L), (msgfunc_T) msg) #define luaV_emsg(L) luaV_msgfunc((L), (msgfunc_T) emsg) +static luaV_List *luaV_pushlist (lua_State *L, list_T *lis); +static luaV_Dict *luaV_pushdict (lua_State *L, dict_T *dic); + +#if LUA_VERSION_NUM <= 501 +#define luaV_openlib(L, l, n) luaL_openlib(L, NULL, l, n) +#define luaL_typeerror luaL_typerror +#else +#define luaV_openlib luaL_setfuncs +#endif #ifdef DYNAMIC_LUA @@ -54,32 +81,54 @@ static const char LUAVIM_FREE[] = "luaV_free"; #endif /* lauxlib */ +#if LUA_VERSION_NUM <= 501 #define luaL_register dll_luaL_register +#define luaL_prepbuffer dll_luaL_prepbuffer +#define luaL_openlib dll_luaL_openlib #define luaL_typerror dll_luaL_typerror +#define luaL_loadfile dll_luaL_loadfile +#define luaL_loadbuffer dll_luaL_loadbuffer +#else +#define luaL_prepbuffsize dll_luaL_prepbuffsize +#define luaL_setfuncs dll_luaL_setfuncs +#define luaL_loadfilex dll_luaL_loadfilex +#define luaL_loadbufferx dll_luaL_loadbufferx +#define luaL_argerror dll_luaL_argerror +#endif #define luaL_checklstring dll_luaL_checklstring #define luaL_checkinteger dll_luaL_checkinteger #define luaL_optinteger dll_luaL_optinteger #define luaL_checktype dll_luaL_checktype #define luaL_error dll_luaL_error -#define luaL_loadfile dll_luaL_loadfile -#define luaL_loadbuffer dll_luaL_loadbuffer #define luaL_newstate dll_luaL_newstate #define luaL_buffinit dll_luaL_buffinit -#define luaL_prepbuffer dll_luaL_prepbuffer #define luaL_addlstring dll_luaL_addlstring #define luaL_pushresult dll_luaL_pushresult /* lua */ +#if LUA_VERSION_NUM <= 501 +#define lua_tonumber dll_lua_tonumber +#define lua_tointeger dll_lua_tointeger +#define lua_call dll_lua_call +#define lua_pcall dll_lua_pcall +#else +#define lua_tonumberx dll_lua_tonumberx +#define lua_tointegerx dll_lua_tointegerx +#define lua_callk dll_lua_callk +#define lua_pcallk dll_lua_pcallk +#define lua_getglobal dll_lua_getglobal +#define lua_setglobal dll_lua_setglobal +#define lua_typename dll_lua_typename +#endif #define lua_close dll_lua_close #define lua_gettop dll_lua_gettop #define lua_settop dll_lua_settop #define lua_pushvalue dll_lua_pushvalue #define lua_replace dll_lua_replace +#define lua_remove dll_lua_remove #define lua_isnumber dll_lua_isnumber #define lua_isstring dll_lua_isstring #define lua_type dll_lua_type #define lua_rawequal dll_lua_rawequal -#define lua_tonumber dll_lua_tonumber -#define lua_tointeger dll_lua_tointeger #define lua_toboolean dll_lua_toboolean #define lua_tolstring dll_lua_tolstring #define lua_touserdata dll_lua_touserdata @@ -94,16 +143,14 @@ static const char LUAVIM_FREE[] = "luaV_free"; #define lua_pushlightuserdata dll_lua_pushlightuserdata #define lua_getfield dll_lua_getfield #define lua_rawget dll_lua_rawget +#define lua_rawgeti dll_lua_rawgeti #define lua_createtable dll_lua_createtable #define lua_newuserdata dll_lua_newuserdata #define lua_getmetatable dll_lua_getmetatable #define lua_setfield dll_lua_setfield #define lua_rawset dll_lua_rawset #define lua_rawseti dll_lua_rawseti -#define lua_remove dll_lua_remove #define lua_setmetatable dll_lua_setmetatable -#define lua_call dll_lua_call -#define lua_pcall dll_lua_pcall /* libs */ #define luaopen_base dll_luaopen_base #define luaopen_table dll_luaopen_table @@ -116,32 +163,56 @@ static const char LUAVIM_FREE[] = "luaV_free"; #define luaL_openlibs dll_luaL_openlibs /* lauxlib */ +#if LUA_VERSION_NUM <= 501 void (*dll_luaL_register) (lua_State *L, const char *libname, const luaL_Reg *l); +char *(*dll_luaL_prepbuffer) (luaL_Buffer *B); +void (*dll_luaL_openlib) (lua_State *L, const char *libname, const luaL_Reg *l, int nup); int (*dll_luaL_typerror) (lua_State *L, int narg, const char *tname); +int (*dll_luaL_loadfile) (lua_State *L, const char *filename); +int (*dll_luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, const char *name); +#else +char *(*dll_luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); +void (*dll_luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); +int (*dll_luaL_loadfilex) (lua_State *L, const char *filename, const char *mode); +int (*dll_luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode); +int (*dll_luaL_argerror) (lua_State *L, int numarg, const char *extramsg); +#endif const char *(*dll_luaL_checklstring) (lua_State *L, int numArg, size_t *l); lua_Integer (*dll_luaL_checkinteger) (lua_State *L, int numArg); lua_Integer (*dll_luaL_optinteger) (lua_State *L, int nArg, lua_Integer def); void (*dll_luaL_checktype) (lua_State *L, int narg, int t); int (*dll_luaL_error) (lua_State *L, const char *fmt, ...); -int (*dll_luaL_loadfile) (lua_State *L, const char *filename); -int (*dll_luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, const char *name); lua_State *(*dll_luaL_newstate) (void); void (*dll_luaL_buffinit) (lua_State *L, luaL_Buffer *B); -char *(*dll_luaL_prepbuffer) (luaL_Buffer *B); void (*dll_luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); void (*dll_luaL_pushresult) (luaL_Buffer *B); /* lua */ +#if LUA_VERSION_NUM <= 501 +lua_Number (*dll_lua_tonumber) (lua_State *L, int idx); +lua_Integer (*dll_lua_tointeger) (lua_State *L, int idx); +void (*dll_lua_call) (lua_State *L, int nargs, int nresults); +int (*dll_lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); +#else +lua_Number (*dll_lua_tonumberx) (lua_State *L, int idx, int *isnum); +lua_Integer (*dll_lua_tointegerx) (lua_State *L, int idx, int *isnum); +void (*dll_lua_callk) (lua_State *L, int nargs, int nresults, int ctx, + lua_CFunction k); +int (*dll_lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, + int ctx, lua_CFunction k); +void (*dll_lua_getglobal) (lua_State *L, const char *var); +void (*dll_lua_setglobal) (lua_State *L, const char *var); +const char *(*dll_lua_typename) (lua_State *L, int tp); +#endif void (*dll_lua_close) (lua_State *L); int (*dll_lua_gettop) (lua_State *L); void (*dll_lua_settop) (lua_State *L, int idx); void (*dll_lua_pushvalue) (lua_State *L, int idx); void (*dll_lua_replace) (lua_State *L, int idx); +void (*dll_lua_remove) (lua_State *L, int idx); int (*dll_lua_isnumber) (lua_State *L, int idx); int (*dll_lua_isstring) (lua_State *L, int idx); int (*dll_lua_type) (lua_State *L, int idx); int (*dll_lua_rawequal) (lua_State *L, int idx1, int idx2); -lua_Number (*dll_lua_tonumber) (lua_State *L, int idx); -lua_Integer (*dll_lua_tointeger) (lua_State *L, int idx); int (*dll_lua_toboolean) (lua_State *L, int idx); const char *(*dll_lua_tolstring) (lua_State *L, int idx, size_t *len); void *(*dll_lua_touserdata) (lua_State *L, int idx); @@ -156,16 +227,14 @@ void (*dll_lua_pushboolean) (lua_State *L, int b); void (*dll_lua_pushlightuserdata) (lua_State *L, void *p); void (*dll_lua_getfield) (lua_State *L, int idx, const char *k); void (*dll_lua_rawget) (lua_State *L, int idx); +void (*dll_lua_rawgeti) (lua_State *L, int idx, int n); void (*dll_lua_createtable) (lua_State *L, int narr, int nrec); void *(*dll_lua_newuserdata) (lua_State *L, size_t sz); int (*dll_lua_getmetatable) (lua_State *L, int objindex); void (*dll_lua_setfield) (lua_State *L, int idx, const char *k); void (*dll_lua_rawset) (lua_State *L, int idx); void (*dll_lua_rawseti) (lua_State *L, int idx, int n); -void (*dll_lua_remove) (lua_State *L, int idx); int (*dll_lua_setmetatable) (lua_State *L, int objindex); -void (*dll_lua_call) (lua_State *L, int nargs, int nresults); -int (*dll_lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc); /* libs */ int (*dll_luaopen_base) (lua_State *L); int (*dll_luaopen_table) (lua_State *L); @@ -185,32 +254,54 @@ typedef struct { static const luaV_Reg luaV_dll[] = { /* lauxlib */ +#if LUA_VERSION_NUM <= 501 {"luaL_register", (luaV_function) &dll_luaL_register}, + {"luaL_prepbuffer", (luaV_function) &dll_luaL_prepbuffer}, + {"luaL_openlib", (luaV_function) &dll_luaL_openlib}, {"luaL_typerror", (luaV_function) &dll_luaL_typerror}, + {"luaL_loadfile", (luaV_function) &dll_luaL_loadfile}, + {"luaL_loadbuffer", (luaV_function) &dll_luaL_loadbuffer}, +#else + {"luaL_prepbuffsize", (luaV_function) &dll_luaL_prepbuffsize}, + {"luaL_setfuncs", (luaV_function) &dll_luaL_setfuncs}, + {"luaL_loadfilex", (luaV_function) &dll_luaL_loadfilex}, + {"luaL_loadbufferx", (luaV_function) &dll_luaL_loadbufferx}, + {"luaL_argerror", (luaV_function) &dll_luaL_argerror}, +#endif {"luaL_checklstring", (luaV_function) &dll_luaL_checklstring}, {"luaL_checkinteger", (luaV_function) &dll_luaL_checkinteger}, {"luaL_optinteger", (luaV_function) &dll_luaL_optinteger}, {"luaL_checktype", (luaV_function) &dll_luaL_checktype}, {"luaL_error", (luaV_function) &dll_luaL_error}, - {"luaL_loadfile", (luaV_function) &dll_luaL_loadfile}, - {"luaL_loadbuffer", (luaV_function) &dll_luaL_loadbuffer}, {"luaL_newstate", (luaV_function) &dll_luaL_newstate}, {"luaL_buffinit", (luaV_function) &dll_luaL_buffinit}, - {"luaL_prepbuffer", (luaV_function) &dll_luaL_prepbuffer}, {"luaL_addlstring", (luaV_function) &dll_luaL_addlstring}, {"luaL_pushresult", (luaV_function) &dll_luaL_pushresult}, /* lua */ +#if LUA_VERSION_NUM <= 501 + {"lua_tonumber", (luaV_function) &dll_lua_tonumber}, + {"lua_tointeger", (luaV_function) &dll_lua_tointeger}, + {"lua_call", (luaV_function) &dll_lua_call}, + {"lua_pcall", (luaV_function) &dll_lua_pcall}, +#else + {"lua_tonumberx", (luaV_function) &dll_lua_tonumberx}, + {"lua_tointegerx", (luaV_function) &dll_lua_tointegerx}, + {"lua_callk", (luaV_function) &dll_lua_callk}, + {"lua_pcallk", (luaV_function) &dll_lua_pcallk}, + {"lua_getglobal", (luaV_function) &dll_lua_getglobal}, + {"lua_setglobal", (luaV_function) &dll_lua_setglobal}, + {"lua_typename", (luaV_function) &dll_lua_typename}, +#endif {"lua_close", (luaV_function) &dll_lua_close}, {"lua_gettop", (luaV_function) &dll_lua_gettop}, {"lua_settop", (luaV_function) &dll_lua_settop}, {"lua_pushvalue", (luaV_function) &dll_lua_pushvalue}, {"lua_replace", (luaV_function) &dll_lua_replace}, + {"lua_remove", (luaV_function) &dll_lua_remove}, {"lua_isnumber", (luaV_function) &dll_lua_isnumber}, {"lua_isstring", (luaV_function) &dll_lua_isstring}, {"lua_type", (luaV_function) &dll_lua_type}, {"lua_rawequal", (luaV_function) &dll_lua_rawequal}, - {"lua_tonumber", (luaV_function) &dll_lua_tonumber}, - {"lua_tointeger", (luaV_function) &dll_lua_tointeger}, {"lua_toboolean", (luaV_function) &dll_lua_toboolean}, {"lua_tolstring", (luaV_function) &dll_lua_tolstring}, {"lua_touserdata", (luaV_function) &dll_lua_touserdata}, @@ -225,16 +316,14 @@ static const luaV_Reg luaV_dll[] = { {"lua_pushlightuserdata", (luaV_function) &dll_lua_pushlightuserdata}, {"lua_getfield", (luaV_function) &dll_lua_getfield}, {"lua_rawget", (luaV_function) &dll_lua_rawget}, + {"lua_rawgeti", (luaV_function) &dll_lua_rawgeti}, {"lua_createtable", (luaV_function) &dll_lua_createtable}, {"lua_newuserdata", (luaV_function) &dll_lua_newuserdata}, {"lua_getmetatable", (luaV_function) &dll_lua_getmetatable}, {"lua_setfield", (luaV_function) &dll_lua_setfield}, {"lua_rawset", (luaV_function) &dll_lua_rawset}, {"lua_rawseti", (luaV_function) &dll_lua_rawseti}, - {"lua_remove", (luaV_function) &dll_lua_remove}, {"lua_setmetatable", (luaV_function) &dll_lua_setmetatable}, - {"lua_call", (luaV_function) &dll_lua_call}, - {"lua_pcall", (luaV_function) &dll_lua_pcall}, /* libs */ {"luaopen_base", (luaV_function) &dll_luaopen_base}, {"luaopen_table", (luaV_function) &dll_luaopen_table}, @@ -294,6 +383,16 @@ lua_enabled(int verbose) #endif /* DYNAMIC_LUA */ +#if LUA_VERSION_NUM > 501 + static int +luaL_typeerror (lua_State *L, int narg, const char *tname) +{ + const char *msg = lua_pushfstring(L, "%s expected, got %s", + tname, luaL_typename(L, narg)); + return luaL_argerror(L, narg, msg); +} +#endif + /* ======= Internal ======= */ @@ -326,18 +425,36 @@ luaV_toudata(lua_State *L, int ud, const char *tname) return NULL; } + static void * +luaV_checkcache(lua_State *L, void *p) +{ + luaV_getudata(L, p); + if (lua_isnil(L, -1)) luaL_error(L, "invalid object"); + lua_pop(L, 1); + return p; +} + +#define luaV_unbox(L,luatyp,ud) (*((luatyp *) lua_touserdata((L),(ud)))) + +#define luaV_checkvalid(L,luatyp,ud) \ + luaV_checkcache((L), (void *) luaV_unbox((L),luatyp,(ud))) + static void * luaV_checkudata(lua_State *L, int ud, const char *tname) { void *p = luaV_toudata(L, ud, tname); - if (p == NULL) luaL_typerror(L, ud, tname); + if (p == NULL) luaL_typeerror(L, ud, tname); return p; } static void luaV_pushtypval(lua_State *L, typval_T *tv) { - if (tv == NULL) luaL_error(L, "null type"); + if (tv == NULL) + { + lua_pushnil(L); + return; + } switch (tv->v_type) { case VAR_STRING: @@ -351,68 +468,70 @@ luaV_pushtypval(lua_State *L, typval_T *tv) lua_pushnumber(L, (lua_Number) tv->vval.v_float); break; #endif - case VAR_LIST: { - list_T *l = tv->vval.v_list; - - if (l != NULL) - { - /* check cache */ - lua_pushlightuserdata(L, (void *) l); - lua_rawget(L, LUA_ENVIRONINDEX); - if (lua_isnil(L, -1)) /* not interned? */ - { - listitem_T *li; - int n = 0; - lua_pop(L, 1); /* nil */ - lua_newtable(L); - lua_pushlightuserdata(L, (void *) l); - lua_pushvalue(L, -2); - lua_rawset(L, LUA_ENVIRONINDEX); - for (li = l->lv_first; li != NULL; li = li->li_next) - { - luaV_pushtypval(L, &li->li_tv); - lua_rawseti(L, -2, ++n); - } - } - } - else lua_pushnil(L); + case VAR_LIST: + luaV_pushlist(L, tv->vval.v_list); break; - } - case VAR_DICT: { - dict_T *d = tv->vval.v_dict; + case VAR_DICT: + luaV_pushdict(L, tv->vval.v_dict); + break; + default: + lua_pushnil(L); + } +} - if (d != NULL) +/* converts lua value at 'pos' to typval 'tv' */ + static void +luaV_totypval (lua_State *L, int pos, typval_T *tv) +{ + switch(lua_type(L, pos)) { + case LUA_TBOOLEAN: + tv->v_type = VAR_NUMBER; + tv->vval.v_number = (varnumber_T) lua_toboolean(L, pos); + break; + case LUA_TSTRING: + tv->v_type = VAR_STRING; + tv->vval.v_string = vim_strsave((char_u *) lua_tostring(L, pos)); + break; + case LUA_TNUMBER: +#ifdef FEAT_FLOAT + tv->v_type = VAR_FLOAT; + tv->vval.v_float = (float_T) lua_tonumber(L, pos); +#else + tv->v_type = VAR_NUMBER; + tv->vval.v_number = (varnumber_T) lua_tointeger(L, pos); +#endif + break; + case LUA_TUSERDATA: { + void *p = lua_touserdata(L, pos); + if (lua_getmetatable(L, pos)) /* has metatable? */ { - /* check cache */ - lua_pushlightuserdata(L, (void *) d); - lua_rawget(L, LUA_ENVIRONINDEX); - if (lua_isnil(L, -1)) /* not interned? */ + /* check list */ + luaV_getfield(L, LUAVIM_LIST); + if (lua_rawequal(L, -1, -2)) { - hashtab_T *ht = &d->dv_hashtab; - hashitem_T *hi; - int n = ht->ht_used; /* remaining items */ - lua_pop(L, 1); /* nil */ - lua_newtable(L); - lua_pushlightuserdata(L, (void *) d); - lua_pushvalue(L, -2); - lua_rawset(L, LUA_ENVIRONINDEX); - for (hi = ht->ht_array; n > 0; hi++) - { - if (!HASHITEM_EMPTY(hi)) - { - dictitem_T *di = dict_lookup(hi); - luaV_pushtypval(L, &di->di_tv); - lua_setfield(L, -2, (char *) hi->hi_key); - n--; - } - } + tv->v_type = VAR_LIST; + tv->vval.v_list = *((luaV_List *) p); + ++tv->vval.v_list->lv_refcount; + lua_pop(L, 2); /* MTs */ + return; } + /* check dict */ + luaV_getfield(L, LUAVIM_DICT); + if (lua_rawequal(L, -1, -3)) + { + tv->v_type = VAR_DICT; + tv->vval.v_dict = *((luaV_Dict *) p); + ++tv->vval.v_dict->dv_refcount; + lua_pop(L, 3); /* MTs */ + return; + } + lua_pop(L, 3); /* MTs */ } - else lua_pushnil(L); break; } default: - luaL_error(L, "invalid type"); + tv->v_type = VAR_NUMBER; + tv->vval.v_number = 0; } } @@ -481,89 +600,508 @@ luaV_msgfunc(lua_State *L, msgfunc_T mf) lua_pop(L, 2); /* original and modified strings */ } - -/* ======= Buffer type ======= */ - - static luaV_Buffer * -luaV_newbuffer(lua_State *L, buf_T *buf) -{ - luaV_Buffer *b = (luaV_Buffer *) lua_newuserdata(L, sizeof(luaV_Buffer)); - *b = buf; - lua_pushlightuserdata(L, (void *) buf); - lua_pushvalue(L, -2); - lua_rawset(L, LUA_ENVIRONINDEX); /* env[buf] = udata */ - /* to avoid GC, store as key in env */ - lua_pushvalue(L, -1); - lua_pushboolean(L, 1); - lua_rawset(L, LUA_ENVIRONINDEX); /* env[udata] = true */ - /* set metatable */ - luaV_getfield(L, LUAVIM_BUFFER); - lua_setmetatable(L, -2); - return b; -} - - static luaV_Buffer * -luaV_pushbuffer (lua_State *L, buf_T *buf) -{ - luaV_Buffer *b = NULL; - if (buf == NULL) - lua_pushnil(L); - else { - lua_pushlightuserdata(L, (void *) buf); - lua_rawget(L, LUA_ENVIRONINDEX); - if (lua_isnil(L, -1)) /* not interned? */ - { - lua_pop(L, 1); - b = luaV_newbuffer(L, buf); - } - else - b = (luaV_Buffer *) lua_touserdata(L, -1); +#define luaV_newtype(typ,tname,luatyp,luatname) \ + static luatyp * \ + luaV_new##tname (lua_State *L, typ *obj) \ + { \ + luatyp *o = (luatyp *) lua_newuserdata(L, sizeof(luatyp)); \ + *o = obj; \ + luaV_setudata(L, obj); /* cache[obj] = udata */ \ + luaV_getfield(L, luatname); \ + lua_setmetatable(L, -2); \ + return o; \ } - return b; + +#define luaV_pushtype(typ,tname,luatyp) \ + static luatyp * \ + luaV_push##tname (lua_State *L, typ *obj) \ + { \ + luatyp *o = NULL; \ + if (obj == NULL) \ + lua_pushnil(L); \ + else { \ + luaV_getudata(L, obj); \ + if (lua_isnil(L, -1)) /* not interned? */ \ + { \ + lua_pop(L, 1); \ + o = luaV_new##tname(L, obj); \ + } \ + else \ + o = (luatyp *) lua_touserdata(L, -1); \ + } \ + return o; \ + } + +#define luaV_type_tostring(tname,luatname) \ + static int \ + luaV_##tname##_tostring (lua_State *L) \ + { \ + lua_pushfstring(L, "%s: %p", luatname, lua_touserdata(L, 1)); \ + return 1; \ + } + + +/* adapted from eval.c */ + +#define listitem_alloc() (listitem_T *)alloc(sizeof(listitem_T)) + + static listitem_T * +list_find (list_T *l, long n) +{ + listitem_T *li; + if (l == NULL || n < -l->lv_len || n >= l->lv_len) + return NULL; + if (n < 0) /* search backward? */ + for (li = l->lv_last; n < -1; li = li->li_prev) + n++; + else /* search forward */ + for (li = l->lv_first; n > 0; li = li->li_next) + n--; + return li; } -/* Buffer metamethods */ + static void +list_remove (list_T *l, listitem_T *li) +{ + listwatch_T *lw; + --l->lv_len; + /* fix watchers */ + for (lw = l->lv_watch; lw != NULL; lw = lw->lw_next) + if (lw->lw_item == li) + lw->lw_item = li->li_next; + /* fix list pointers */ + if (li->li_next == NULL) /* last? */ + l->lv_last = li->li_prev; + else + li->li_next->li_prev = li->li_prev; + if (li->li_prev == NULL) /* first? */ + l->lv_first = li->li_next; + else + li->li_prev->li_next = li->li_next; + l->lv_idx_item = NULL; +} + + static void +list_append(list_T *l, listitem_T *item) +{ + if (l->lv_last == NULL) /* empty list? */ + l->lv_first = item; + else + l->lv_last->li_next = item; + item->li_prev = l->lv_last; + item->li_next = NULL; + l->lv_last = item; + ++l->lv_len; +} static int -luaV_buffer_tostring(lua_State *L) +list_insert_tv(list_T *l, typval_T *tv, listitem_T *item) { - lua_pushfstring(L, "%s: %p", LUAVIM_BUFFER, lua_touserdata(L, 1)); + listitem_T *ni = listitem_alloc(); + + if (ni == NULL) + return FAIL; + copy_tv(tv, &ni->li_tv); + if (item == NULL) + list_append(l, ni); + else + { + ni->li_prev = item->li_prev; + ni->li_next = item; + if (item->li_prev == NULL) + { + l->lv_first = ni; + ++l->lv_idx; + } + else + { + item->li_prev->li_next = ni; + l->lv_idx_item = NULL; + } + item->li_prev = ni; + ++l->lv_len; + } + return OK; +} + +/* set references */ + +static void set_ref_in_tv (typval_T *tv, int copyID); + + static void +set_ref_in_dict(dict_T *d, int copyID) +{ + hashtab_T *ht = &d->dv_hashtab; + int n = ht->ht_used; + hashitem_T *hi; + for (hi = ht->ht_array; n > 0; ++hi) + if (!HASHITEM_EMPTY(hi)) + { + dictitem_T *di = dict_lookup(hi); + set_ref_in_tv(&di->di_tv, copyID); + --n; + } +} + + static void +set_ref_in_list(list_T *l, int copyID) +{ + listitem_T *li; + for (li = l->lv_first; li != NULL; li = li->li_next) + set_ref_in_tv(&li->li_tv, copyID); +} + + static void +set_ref_in_tv(typval_T *tv, int copyID) +{ + if (tv->v_type == VAR_LIST) + { + list_T *l = tv->vval.v_list; + if (l != NULL && l->lv_copyID != copyID) + { + l->lv_copyID = copyID; + set_ref_in_list(l, copyID); + } + } + else if (tv->v_type == VAR_DICT) + { + dict_T *d = tv->vval.v_dict; + if (d != NULL && d->dv_copyID != copyID) + { + d->dv_copyID = copyID; + set_ref_in_dict(d, copyID); + } + } +} + + +/* ======= List type ======= */ + + static luaV_List * +luaV_newlist (lua_State *L, list_T *lis) +{ + luaV_List *l = (luaV_List *) lua_newuserdata(L, sizeof(luaV_List)); + *l = lis; + lis->lv_refcount++; /* reference in Lua */ + luaV_setudata(L, lis); /* cache[lis] = udata */ + luaV_getfield(L, LUAVIM_LIST); + lua_setmetatable(L, -2); + return l; +} + +luaV_pushtype(list_T, list, luaV_List) +luaV_type_tostring(list, LUAVIM_LIST) + + static int +luaV_list_gc (lua_State *L) +{ + list_unref(luaV_unbox(L, luaV_List, 1)); + return 0; +} + + static int +luaV_list_len (lua_State *L) +{ + list_T *l = luaV_unbox(L, luaV_List, 1); + lua_pushinteger(L, (l == NULL) ? 0 : (int) l->lv_len); return 1; } + static int +luaV_list_iter (lua_State *L) +{ + listitem_T *li = (listitem_T *) lua_touserdata(L, lua_upvalueindex(2)); + if (li == NULL) return 0; + luaV_pushtypval(L, &li->li_tv); + lua_pushlightuserdata(L, (void *) li->li_next); + lua_replace(L, lua_upvalueindex(2)); + return 1; +} + + static int +luaV_list_call (lua_State *L) +{ + list_T *l = luaV_unbox(L, luaV_List, 1); + lua_pushvalue(L, lua_upvalueindex(1)); /* pass cache table along */ + lua_pushlightuserdata(L, (void *) l->lv_first); + lua_pushcclosure(L, luaV_list_iter, 2); + return 1; +} + + static int +luaV_list_index (lua_State *L) +{ + list_T *l = luaV_unbox(L, luaV_List, 1); + if (lua_isnumber(L, 2)) /* list item? */ + { + listitem_T *li = list_find(l, (long) luaL_checkinteger(L, 2)); + if (li == NULL) + lua_pushnil(L); + else + luaV_pushtypval(L, &li->li_tv); + } + else if (lua_isstring(L, 2)) /* method? */ + { + const char *s = lua_tostring(L, 2); + if (strncmp(s, "add", 3) == 0 + || strncmp(s, "insert", 6) == 0 + || strncmp(s, "extend", 6) == 0) + { + lua_getmetatable(L, 1); + lua_getfield(L, -1, s); + } + else + lua_pushnil(L); + } + else + lua_pushnil(L); + return 1; +} + + static int +luaV_list_newindex (lua_State *L) +{ + list_T *l = luaV_unbox(L, luaV_List, 1); + long n = (long) luaL_checkinteger(L, 2); + listitem_T *li; + if (l->lv_lock) + luaL_error(L, "list is locked"); + li = list_find(l, n); + if (li == NULL) return 0; + if (lua_isnil(L, 3)) /* remove? */ + { + list_remove(l, li); + clear_tv(&li->li_tv); + vim_free(li); + } + else + { + typval_T v; + luaV_totypval(L, 3, &v); + clear_tv(&li->li_tv); + copy_tv(&v, &li->li_tv); + } + return 0; +} + + static int +luaV_list_add (lua_State *L) +{ + luaV_List *lis = luaV_checkudata(L, 1, LUAVIM_LIST); + list_T *l = (list_T *) luaV_checkcache(L, (void *) *lis); + listitem_T *li; + if (l->lv_lock) + luaL_error(L, "list is locked"); + li = listitem_alloc(); + if (li != NULL) + { + typval_T v; + lua_settop(L, 2); + luaV_totypval(L, 2, &v); + copy_tv(&v, &li->li_tv); + list_append(l, li); + } + lua_settop(L, 1); + return 1; +} + + static int +luaV_list_insert (lua_State *L) +{ + luaV_List *lis = luaV_checkudata(L, 1, LUAVIM_LIST); + list_T *l = (list_T *) luaV_checkcache(L, (void *) *lis); + long pos = luaL_optlong(L, 3, 0); + listitem_T *li = NULL; + typval_T v; + if (l->lv_lock) + luaL_error(L, "list is locked"); + if (pos < l->lv_len) + { + li = list_find(l, pos); + if (li == NULL) + luaL_error(L, "invalid position"); + } + lua_settop(L, 2); + luaV_totypval(L, 2, &v); + list_insert_tv(l, &v, li); + lua_settop(L, 1); + return 1; +} + +static const luaL_Reg luaV_List_mt[] = { + {"__tostring", luaV_list_tostring}, + {"__gc", luaV_list_gc}, + {"__len", luaV_list_len}, + {"__call", luaV_list_call}, + {"__index", luaV_list_index}, + {"__newindex", luaV_list_newindex}, + {"add", luaV_list_add}, + {"insert", luaV_list_insert}, + {NULL, NULL} +}; + + +/* ======= Dict type ======= */ + + static luaV_Dict * +luaV_newdict (lua_State *L, dict_T *dic) +{ + luaV_Dict *d = (luaV_Dict *) lua_newuserdata(L, sizeof(luaV_Dict)); + *d = dic; + dic->dv_refcount++; /* reference in Lua */ + luaV_setudata(L, dic); /* cache[dic] = udata */ + luaV_getfield(L, LUAVIM_DICT); + lua_setmetatable(L, -2); + return d; +} + +luaV_pushtype(dict_T, dict, luaV_Dict) +luaV_type_tostring(dict, LUAVIM_DICT) + + static int +luaV_dict_gc (lua_State *L) +{ + dict_unref(luaV_unbox(L, luaV_Dict, 1)); + return 0; +} + + static int +luaV_dict_len (lua_State *L) +{ + dict_T *d = luaV_unbox(L, luaV_Dict, 1); + lua_pushinteger(L, (d == NULL) ? 0 : (int) d->dv_hashtab.ht_used); + return 1; +} + + static int +luaV_dict_iter (lua_State *L) +{ + hashitem_T *hi = (hashitem_T *) lua_touserdata(L, lua_upvalueindex(2)); + int n = lua_tointeger(L, lua_upvalueindex(3)); + dictitem_T *di; + if (n <= 0) return 0; + while (HASHITEM_EMPTY(hi)) hi++; + di = dict_lookup(hi); + lua_pushstring(L, (char *) hi->hi_key); + luaV_pushtypval(L, &di->di_tv); + lua_pushlightuserdata(L, (void *) (hi + 1)); + lua_replace(L, lua_upvalueindex(2)); + lua_pushinteger(L, n - 1); + lua_replace(L, lua_upvalueindex(3)); + return 2; +} + + static int +luaV_dict_call (lua_State *L) +{ + dict_T *d = luaV_unbox(L, luaV_Dict, 1); + hashtab_T *ht = &d->dv_hashtab; + lua_pushvalue(L, lua_upvalueindex(1)); /* pass cache table along */ + lua_pushlightuserdata(L, (void *) ht->ht_array); + lua_pushinteger(L, ht->ht_used); /* # remaining items */ + lua_pushcclosure(L, luaV_dict_iter, 3); + return 1; +} + + static int +luaV_dict_index (lua_State *L) +{ + dict_T *d = luaV_unbox(L, luaV_Dict, 1); + char_u *key = (char_u *) luaL_checkstring(L, 2); + dictitem_T *di = dict_find(d, key, -1); + if (di == NULL) + lua_pushnil(L); + else + luaV_pushtypval(L, &di->di_tv); + return 1; +} + + static int +luaV_dict_newindex (lua_State *L) +{ + dict_T *d = luaV_unbox(L, luaV_Dict, 1); + char_u *key = (char_u *) luaL_checkstring(L, 2); + dictitem_T *di; + if (d->dv_lock) + luaL_error(L, "dict is locked"); + di = dict_find(d, key, -1); + if (di == NULL) /* non-existing key? */ + { + if (lua_isnil(L, 3)) return 0; + di = dictitem_alloc(key); + if (di == NULL) return 0; + if (dict_add(d, di) == FAIL) + { + vim_free(di); + return 0; + } + } + else + clear_tv(&di->di_tv); + if (lua_isnil(L, 3)) /* remove? */ + { + hashitem_T *hi = hash_find(&d->dv_hashtab, di->di_key); + hash_remove(&d->dv_hashtab, hi); + dictitem_free(di); + } + else { + typval_T v; + luaV_totypval(L, 3, &v); + copy_tv(&v, &di->di_tv); + } + return 0; +} + +static const luaL_Reg luaV_Dict_mt[] = { + {"__tostring", luaV_dict_tostring}, + {"__gc", luaV_dict_gc}, + {"__len", luaV_dict_len}, + {"__call", luaV_dict_call}, + {"__index", luaV_dict_index}, + {"__newindex", luaV_dict_newindex}, + {NULL, NULL} +}; + + +/* ======= Buffer type ======= */ + +luaV_newtype(buf_T, buffer, luaV_Buffer, LUAVIM_BUFFER) +luaV_pushtype(buf_T, buffer, luaV_Buffer) +luaV_type_tostring(buffer, LUAVIM_BUFFER) + static int luaV_buffer_len(lua_State *L) { - luaV_Buffer *b = lua_touserdata(L, 1); - lua_pushinteger(L, (*b)->b_ml.ml_line_count); + buf_T *b = (buf_T *) luaV_checkvalid(L, luaV_Buffer, 1); + lua_pushinteger(L, b->b_ml.ml_line_count); return 1; } static int luaV_buffer_call(lua_State *L) { - luaV_Buffer *b = (luaV_Buffer *) lua_touserdata(L, 1); + buf_T *b = (buf_T *) luaV_checkvalid(L, luaV_Buffer, 1); lua_settop(L, 1); - set_curbuf(*b, DOBUF_SPLIT); + set_curbuf(b, DOBUF_SPLIT); return 1; } static int luaV_buffer_index(lua_State *L) { - luaV_Buffer *b = (luaV_Buffer *) lua_touserdata(L, 1); + buf_T *b = (buf_T *) luaV_checkvalid(L, luaV_Buffer, 1); linenr_T n = (linenr_T) lua_tointeger(L, 2); - if (n > 0 && n <= (*b)->b_ml.ml_line_count) - luaV_pushline(L, *b, n); + if (n > 0 && n <= b->b_ml.ml_line_count) + luaV_pushline(L, b, n); else if (lua_isstring(L, 2)) { const char *s = lua_tostring(L, 2); if (strncmp(s, "name", 4) == 0) - lua_pushstring(L, (char *) (*b)->b_sfname); + lua_pushstring(L, (char *) b->b_sfname); else if (strncmp(s, "fname", 5) == 0) - lua_pushstring(L, (char *) (*b)->b_ffname); + lua_pushstring(L, (char *) b->b_ffname); else if (strncmp(s, "number", 6) == 0) - lua_pushinteger(L, (*b)->b_fnum); + lua_pushinteger(L, b->b_fnum); /* methods */ else if (strncmp(s, "insert", 6) == 0 || strncmp(s, "next", 4) == 0 @@ -584,17 +1122,17 @@ luaV_buffer_index(lua_State *L) static int luaV_buffer_newindex(lua_State *L) { - luaV_Buffer *b = (luaV_Buffer *) lua_touserdata(L, 1); + buf_T *b = (buf_T *) luaV_checkvalid(L, luaV_Buffer, 1); linenr_T n = (linenr_T) luaL_checkinteger(L, 2); #ifdef HAVE_SANDBOX luaV_checksandbox(L); #endif - if (n < 1 || n > (*b)->b_ml.ml_line_count) + if (n < 1 || n > b->b_ml.ml_line_count) luaL_error(L, "invalid line number"); if (lua_isnil(L, 3)) /* delete line */ { buf_T *buf = curbuf; - curbuf = *b; + curbuf = b; if (u_savedel(n, 1L) == FAIL) { curbuf = buf; @@ -607,7 +1145,7 @@ luaV_buffer_newindex(lua_State *L) } else { deleted_lines_mark(n, 1L); - if (*b == curwin->w_buffer) /* fix cursor in current window? */ + if (b == curwin->w_buffer) /* fix cursor in current window? */ { if (curwin->w_cursor.lnum >= n) { @@ -627,7 +1165,7 @@ luaV_buffer_newindex(lua_State *L) else if (lua_isstring(L, 3)) /* update line */ { buf_T *buf = curbuf; - curbuf = *b; + curbuf = b; if (u_savesub(n) == FAIL) { curbuf = buf; @@ -640,7 +1178,7 @@ luaV_buffer_newindex(lua_State *L) } else changed_bytes(n, 0); curbuf = buf; - if (*b == curwin->w_buffer) + if (b == curwin->w_buffer) check_cursor_col(); } else @@ -651,8 +1189,9 @@ luaV_buffer_newindex(lua_State *L) static int luaV_buffer_insert(lua_State *L) { - luaV_Buffer *b = luaV_checkudata(L, 1, LUAVIM_BUFFER); - linenr_T last = (*b)->b_ml.ml_line_count; + luaV_Buffer *lb = luaV_checkudata(L, 1, LUAVIM_BUFFER); + buf_T *b = (buf_T *) luaV_checkcache(L, (void *) *lb); + linenr_T last = b->b_ml.ml_line_count; linenr_T n = (linenr_T) luaL_optinteger(L, 3, last); buf_T *buf; luaL_checktype(L, 2, LUA_TSTRING); @@ -664,7 +1203,7 @@ luaV_buffer_insert(lua_State *L) if (n > last) n = last; /* insert */ buf = curbuf; - curbuf = *b; + curbuf = b; if (u_save(n, n + 1) == FAIL) { curbuf = buf; @@ -686,7 +1225,8 @@ luaV_buffer_insert(lua_State *L) luaV_buffer_next(lua_State *L) { luaV_Buffer *b = luaV_checkudata(L, 1, LUAVIM_BUFFER); - luaV_pushbuffer(L, (*b)->b_next); + buf_T *buf = (buf_T *) luaV_checkcache(L, (void *) *b); + luaV_pushbuffer(L, buf->b_next); return 1; } @@ -694,7 +1234,8 @@ luaV_buffer_next(lua_State *L) luaV_buffer_previous(lua_State *L) { luaV_Buffer *b = luaV_checkudata(L, 1, LUAVIM_BUFFER); - luaV_pushbuffer(L, (*b)->b_prev); + buf_T *buf = (buf_T *) luaV_checkcache(L, (void *) *b); + luaV_pushbuffer(L, buf->b_prev); return 1; } @@ -702,8 +1243,7 @@ luaV_buffer_previous(lua_State *L) luaV_buffer_isvalid(lua_State *L) { luaV_Buffer *b = luaV_checkudata(L, 1, LUAVIM_BUFFER); - lua_pushlightuserdata(L, (void *) (*b)); - lua_rawget(L, LUA_ENVIRONINDEX); + luaV_getudata(L, *b); lua_pushboolean(L, !lua_isnil(L, -1)); return 1; } @@ -724,78 +1264,36 @@ static const luaL_Reg luaV_Buffer_mt[] = { /* ======= Window type ======= */ - static luaV_Window * -luaV_newwindow(lua_State *L, win_T *win) -{ - luaV_Window *w = (luaV_Window *) lua_newuserdata(L, sizeof(luaV_Window)); - *w = win; - lua_pushlightuserdata(L, (void *) win); - lua_pushvalue(L, -2); - lua_rawset(L, LUA_ENVIRONINDEX); /* env[win] = udata */ - /* to avoid GC, store as key in env */ - lua_pushvalue(L, -1); - lua_pushboolean(L, 1); - lua_rawset(L, LUA_ENVIRONINDEX); /* env[udata] = true */ - /* set metatable */ - luaV_getfield(L, LUAVIM_WINDOW); - lua_setmetatable(L, -2); - return w; -} - - static luaV_Window * -luaV_pushwindow(lua_State *L, win_T *win) -{ - luaV_Window *w = NULL; - if (win == NULL) - lua_pushnil(L); - else { - lua_pushlightuserdata(L, (void *) win); - lua_rawget(L, LUA_ENVIRONINDEX); - if (lua_isnil(L, -1)) /* not interned? */ - { - lua_pop(L, 1); - w = luaV_newwindow(L, win); - } - else w = (luaV_Window *) lua_touserdata(L, -1); - } - return w; -} - -/* Window metamethods */ - - static int -luaV_window_tostring(lua_State *L) -{ - lua_pushfstring(L, "%s: %p", LUAVIM_WINDOW, lua_touserdata(L, 1)); - return 1; -} +luaV_newtype(win_T, window, luaV_Window, LUAVIM_WINDOW) +luaV_pushtype(win_T, window, luaV_Window) +luaV_type_tostring(window, LUAVIM_WINDOW) static int luaV_window_call(lua_State *L) { - luaV_Window *w = (luaV_Window *) lua_touserdata(L, 1); + win_T *w = (win_T *) luaV_checkvalid(L, luaV_Window, 1); lua_settop(L, 1); - win_goto(*w); + win_goto(w); return 1; } static int luaV_window_index(lua_State *L) { - luaV_Window *w = (luaV_Window *) lua_touserdata(L, 1); + win_T *w = (win_T *) luaV_checkvalid(L, luaV_Window, 1); const char *s = luaL_checkstring(L, 2); if (strncmp(s, "buffer", 6) == 0) - luaV_pushbuffer(L, (*w)->w_buffer); + luaV_pushbuffer(L, w->w_buffer); else if (strncmp(s, "line", 4) == 0) - lua_pushinteger(L, (*w)->w_cursor.lnum); + lua_pushinteger(L, w->w_cursor.lnum); else if (strncmp(s, "col", 3) == 0) - lua_pushinteger(L, (*w)->w_cursor.col + 1); + lua_pushinteger(L, w->w_cursor.col + 1); #ifdef FEAT_VERTSPLIT else if (strncmp(s, "width", 5) == 0) - lua_pushinteger(L, W_WIDTH((*w))); + lua_pushinteger(L, W_WIDTH(w)); #endif else if (strncmp(s, "height", 6) == 0) - lua_pushinteger(L, (*w)->w_height); + lua_pushinteger(L, w->w_height); /* methods */ else if (strncmp(s, "next", 4) == 0 || strncmp(s, "previous", 8) == 0 @@ -812,7 +1310,7 @@ luaV_window_index(lua_State *L) static int luaV_window_newindex (lua_State *L) { - luaV_Window *w = (luaV_Window *) lua_touserdata(L, 1); + win_T *w = (win_T *) luaV_checkvalid(L, luaV_Window, 1); const char *s = luaL_checkstring(L, 2); int v = luaL_checkinteger(L, 3); if (strncmp(s, "line", 4) == 0) @@ -820,9 +1318,9 @@ luaV_window_newindex (lua_State *L) #ifdef HAVE_SANDBOX luaV_checksandbox(L); #endif - if (v < 1 || v > (*w)->w_buffer->b_ml.ml_line_count) + if (v < 1 || v > w->w_buffer->b_ml.ml_line_count) luaL_error(L, "line out of range"); - (*w)->w_cursor.lnum = v; + w->w_cursor.lnum = v; update_screen(VALID); } else if (strncmp(s, "col", 3) == 0) @@ -830,7 +1328,7 @@ luaV_window_newindex (lua_State *L) #ifdef HAVE_SANDBOX luaV_checksandbox(L); #endif - (*w)->w_cursor.col = v - 1; + w->w_cursor.col = v - 1; update_screen(VALID); } #ifdef FEAT_VERTSPLIT @@ -840,7 +1338,7 @@ luaV_window_newindex (lua_State *L) #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif - curwin = *w; + curwin = w; win_setwidth(v); curwin = win; } @@ -851,7 +1349,7 @@ luaV_window_newindex (lua_State *L) #ifdef FEAT_GUI need_mouse_correct = TRUE; #endif - curwin = *w; + curwin = w; win_setheight(v); curwin = win; } @@ -864,7 +1362,8 @@ luaV_window_newindex (lua_State *L) luaV_window_next(lua_State *L) { luaV_Window *w = luaV_checkudata(L, 1, LUAVIM_WINDOW); - luaV_pushwindow(L, (*w)->w_next); + win_T *win = (win_T *) luaV_checkcache(L, (void *) *w); + luaV_pushwindow(L, win->w_next); return 1; } @@ -872,7 +1371,8 @@ luaV_window_next(lua_State *L) luaV_window_previous(lua_State *L) { luaV_Window *w = luaV_checkudata(L, 1, LUAVIM_WINDOW); - luaV_pushwindow(L, (*w)->w_prev); + win_T *win = (win_T *) luaV_checkcache(L, (void *) *w); + luaV_pushwindow(L, win->w_prev); return 1; } @@ -880,8 +1380,7 @@ luaV_window_previous(lua_State *L) luaV_window_isvalid(lua_State *L) { luaV_Window *w = luaV_checkudata(L, 1, LUAVIM_WINDOW); - lua_pushlightuserdata(L, (void *) (*w)); - lua_rawget(L, LUA_ENVIRONINDEX); + luaV_getudata(L, *w); lua_pushboolean(L, !lua_isnil(L, -1)); return 1; } @@ -982,6 +1481,28 @@ luaV_line(lua_State *L) return 1; } + static int +luaV_list(lua_State *L) +{ + list_T *l = list_alloc(); + if (l == NULL) + lua_pushnil(L); + else + luaV_newlist(L, l); + return 1; +} + + static int +luaV_dict(lua_State *L) +{ + dict_T *d = dict_alloc(); + if (d == NULL) + lua_pushnil(L); + else + luaV_newdict(L, d); + return 1; +} + static int luaV_buffer(lua_State *L) { @@ -1008,15 +1529,10 @@ luaV_buffer(lua_State *L) break; } } - if (buf == NULL) /* not found? */ - lua_pushnil(L); - else - luaV_pushbuffer(L, buf); } - else { + else buf = (lua_toboolean(L, 1)) ? firstbuf : curbuf; /* first buffer? */ - luaV_pushbuffer(L, buf); - } + luaV_pushbuffer(L, buf); return 1; } @@ -1029,15 +1545,10 @@ luaV_window(lua_State *L) int n = lua_tointeger(L, 1); for (win = firstwin; win != NULL; win = win->w_next, n--) if (n == 1) break; - if (win == NULL) /* not found? */ - lua_pushnil(L); - else - luaV_pushwindow(L, win); } - else { + else win = (lua_toboolean(L, 1)) ? firstwin : curwin; /* first window? */ - luaV_pushwindow(L, win); - } + luaV_pushwindow(L, win); return 1; } @@ -1054,33 +1565,42 @@ luaV_open(lua_State *L) } static int -luaV_isbuffer(lua_State *L) +luaV_type(lua_State *L) { - lua_pushboolean(L, luaV_toudata(L, 1, LUAVIM_BUFFER) != NULL); - return 1; -} - - static int -luaV_iswindow(lua_State *L) -{ - lua_pushboolean(L, luaV_toudata(L, 1, LUAVIM_WINDOW) != NULL); - return 1; -} - -/* for freeing buffer and window objects; lightuserdata as arg */ - static int -luaV_free(lua_State *L) -{ - lua_pushvalue(L, 1); /* lightudata */ - lua_rawget(L, LUA_ENVIRONINDEX); - if (!lua_isnil(L, -1)) + luaL_checkany(L, 1); + if (lua_type(L, 1) == LUA_TUSERDATA) /* check vim udata? */ { - lua_pushnil(L); - lua_rawset(L, LUA_ENVIRONINDEX); /* env[udata] = nil */ - lua_pushnil(L); - lua_rawset(L, LUA_ENVIRONINDEX); /* env[lightudata] = nil */ + lua_settop(L, 1); + if (lua_getmetatable(L, 1)) + { + luaV_getfield(L, LUAVIM_LIST); + if (lua_rawequal(L, -1, 2)) + { + lua_pushstring(L, "list"); + return 1; + } + luaV_getfield(L, LUAVIM_DICT); + if (lua_rawequal(L, -1, 2)) + { + lua_pushstring(L, "dict"); + return 1; + } + luaV_getfield(L, LUAVIM_BUFFER); + if (lua_rawequal(L, -1, 2)) + { + lua_pushstring(L, "buffer"); + return 1; + } + luaV_getfield(L, LUAVIM_WINDOW); + if (lua_rawequal(L, -1, 2)) + { + lua_pushstring(L, "window"); + return 1; + } + } } - return 0; + lua_pushstring(L, luaL_typename(L, 1)); /* fallback */ + return 1; } static const luaL_Reg luaV_module[] = { @@ -1088,24 +1608,88 @@ static const luaL_Reg luaV_module[] = { {"eval", luaV_eval}, {"beep", luaV_beep}, {"line", luaV_line}, + {"list", luaV_list}, + {"dict", luaV_dict}, {"buffer", luaV_buffer}, {"window", luaV_window}, {"open", luaV_open}, - {"isbuffer", luaV_isbuffer}, - {"iswindow", luaV_iswindow}, + {"type", luaV_type}, {NULL, NULL} }; +/* for freeing list, dict, buffer and window objects; lightuserdata as arg */ + static int +luaV_free(lua_State *L) +{ + lua_pushnil(L); + luaV_setudata(L, lua_touserdata(L, 1)); + return 0; +} + + static int +luaV_luaeval (lua_State *L) +{ + luaL_Buffer b; + size_t l; + const char *str = lua_tolstring(L, 1, &l); + typval_T *arg = (typval_T *) lua_touserdata(L, 2); + typval_T *rettv = (typval_T *) lua_touserdata(L, 3); + luaL_buffinit(L, &b); + luaL_addlstring(&b, LUAVIM_EVALHEADER, sizeof(LUAVIM_EVALHEADER) - 1); + luaL_addlstring(&b, str, l); + luaL_pushresult(&b); + str = lua_tolstring(L, -1, &l); + if (luaL_loadbuffer(L, str, l, LUAVIM_EVALNAME)) /* compile error? */ + { + luaV_emsg(L); + return 0; + } + luaV_pushtypval(L, arg); + if (lua_pcall(L, 1, 1, 0)) /* running error? */ + { + luaV_emsg(L); + return 0; + } + luaV_totypval(L, -1, rettv); + return 0; +} + + static int +luaV_setref (lua_State *L) +{ + int copyID = lua_tointeger(L, 1); + typval_T tv; + luaV_getfield(L, LUAVIM_LIST); + luaV_getfield(L, LUAVIM_DICT); + lua_pushnil(L); + while (lua_next(L, lua_upvalueindex(1)) != 0) /* traverse cache table */ + { + lua_getmetatable(L, -1); + if (lua_rawequal(L, -1, 2)) /* list? */ + { + tv.v_type = VAR_LIST; + tv.vval.v_list = (list_T *) lua_touserdata(L, 4); /* key */ + } + else if (lua_rawequal(L, -1, 3)) /* dict? */ + { + tv.v_type = VAR_DICT; + tv.vval.v_dict = (dict_T *) lua_touserdata(L, 4); /* key */ + } + lua_pop(L, 2); /* metatable and value */ + set_ref_in_tv(&tv, copyID); + } + return 0; +} + static int luaopen_vim(lua_State *L) { - /* set environment */ + /* set cache table */ lua_newtable(L); lua_newtable(L); - lua_pushliteral(L, "v"); + lua_pushstring(L, "v"); lua_setfield(L, -2, "__mode"); - lua_setmetatable(L, -2); - lua_replace(L, LUA_ENVIRONINDEX); + lua_setmetatable(L, -2); /* cache is weak-valued */ /* print */ lua_pushcfunction(L, luaV_print); lua_setglobal(L, "print"); @@ -1116,14 +1700,36 @@ luaopen_vim(lua_State *L) lua_pop(L, 1); /* free */ lua_pushlightuserdata(L, (void *) LUAVIM_FREE); - lua_pushcfunction(L, luaV_free); + lua_pushvalue(L, 1); /* cache table */ + lua_pushcclosure(L, luaV_free, 1); + lua_rawset(L, LUA_REGISTRYINDEX); + /* luaeval */ + lua_pushlightuserdata(L, (void *) LUAVIM_LUAEVAL); + lua_pushvalue(L, 1); /* cache table */ + lua_pushcclosure(L, luaV_luaeval, 1); + lua_rawset(L, LUA_REGISTRYINDEX); + /* setref */ + lua_pushlightuserdata(L, (void *) LUAVIM_SETREF); + lua_pushvalue(L, 1); /* cache table */ + lua_pushcclosure(L, luaV_setref, 1); lua_rawset(L, LUA_REGISTRYINDEX); /* register */ + luaV_newmetatable(L, LUAVIM_LIST); + lua_pushvalue(L, 1); + luaV_openlib(L, luaV_List_mt, 1); + luaV_newmetatable(L, LUAVIM_DICT); + lua_pushvalue(L, 1); + luaV_openlib(L, luaV_Dict_mt, 1); luaV_newmetatable(L, LUAVIM_BUFFER); - luaL_register(L, NULL, luaV_Buffer_mt); + lua_pushvalue(L, 1); /* cache table */ + luaV_openlib(L, luaV_Buffer_mt, 1); luaV_newmetatable(L, LUAVIM_WINDOW); - luaL_register(L, NULL, luaV_Window_mt); - luaL_register(L, LUAVIM_NAME, luaV_module); + lua_pushvalue(L, 1); /* cache table */ + luaV_openlib(L, luaV_Window_mt, 1); + lua_newtable(L); /* vim table */ + lua_pushvalue(L, 1); /* cache table */ + luaV_openlib(L, luaV_module, 1); + lua_setglobal(L, LUAVIM_NAME); return 0; } @@ -1154,7 +1760,7 @@ luaV_setrange(lua_State *L, int line1, int line2) static lua_State *L = NULL; static int -lua_is_open(void) +lua_isopen(void) { return L != NULL; } @@ -1162,7 +1768,7 @@ lua_is_open(void) static int lua_init(void) { - if (L == NULL) + if (!lua_isopen()) { #ifdef DYNAMIC_LUA if (!lua_enabled(TRUE)) @@ -1179,7 +1785,7 @@ lua_init(void) void lua_end(void) { - if (L != NULL) + if (lua_isopen()) { lua_close(L); L = NULL; @@ -1273,23 +1879,36 @@ ex_luafile(exarg_T *eap) } } -/* buffer */ +#define luaV_freetype(typ,tname) \ + void \ + lua_##tname##_free(typ *o) \ + { \ + if (!lua_isopen()) return; \ + luaV_getfield(L, LUAVIM_FREE); \ + lua_pushlightuserdata(L, (void *) o); \ + lua_call(L, 1, 0); \ + } + +luaV_freetype(buf_T, buffer) +luaV_freetype(win_T, window) + void -lua_buffer_free(buf_T *buf) +do_luaeval (char_u *str, typval_T *arg, typval_T *rettv) { - if (!lua_is_open()) return; - luaV_getfield(L, LUAVIM_FREE); - lua_pushlightuserdata(L, (void *) buf); - lua_call(L, 1, 0); + lua_init(); + luaV_getfield(L, LUAVIM_LUAEVAL); + lua_pushstring(L, (char *) str); + lua_pushlightuserdata(L, (void *) arg); + lua_pushlightuserdata(L, (void *) rettv); + lua_call(L, 3, 0); } -/* window */ void -lua_window_free(win_T *win) +set_ref_in_lua (int copyID) { - if (!lua_is_open()) return; - luaV_getfield(L, LUAVIM_FREE); - lua_pushlightuserdata(L, (void *) win); + if (!lua_isopen()) return; + luaV_getfield(L, LUAVIM_SETREF); + lua_pushinteger(L, copyID); lua_call(L, 1, 0); } diff --git a/src/proto/if_lua.pro b/src/proto/if_lua.pro index 3bac4cce8a..8db66a693e 100644 --- a/src/proto/if_lua.pro +++ b/src/proto/if_lua.pro @@ -6,4 +6,6 @@ void ex_luado __ARGS((exarg_T *eap)); void ex_luafile __ARGS((exarg_T *eap)); void lua_buffer_free __ARGS((buf_T *buf)); void lua_window_free __ARGS((win_T *win)); +void do_luaeval __ARGS((char_u *str, typval_T *arg, typval_T *rettv)); +void set_ref_in_lua __ARGS((int copyID)); /* vim: set ft=c : */ diff --git a/src/version.c b/src/version.c index d012d99090..a835ea5078 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 490, /**/ 489, /**/ From d1999064d34d66fb7097a56b076490444efb6cc3 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 16:54:08 +0200 Subject: [PATCH 31/45] Added tag v7-3-490 for changeset b067b8b81be9 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index aa9de115e2..b96dc4fd04 100644 --- a/.hgtags +++ b/.hgtags @@ -1826,3 +1826,4 @@ b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 21219ffc97903684349f1fcc843eb61838877874 v7-3-487 8691bdcdbf66733c7ec1ef8161da1d4ef49dce66 v7-3-488 c1a6e1745cb521f863e63670e6c22c1c682ab4b1 v7-3-489 +b067b8b81be9c2839df75824da2e88da24b07b54 v7-3-490 From 3fe23b30c927a0be5cbe08d94bbc5581a502a2c8 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 16:56:52 +0200 Subject: [PATCH 32/45] updated for version 7.3.491 Problem: No tests for Lua. Solution: Add some simple tests for Lua. (Luis Carvalho) --- src/testdir/Make_amiga.mak | 1 + src/testdir/Make_dos.mak | 2 +- src/testdir/Make_ming.mak | 2 +- src/testdir/Make_os2.mak | 1 + src/testdir/Make_vms.mms | 3 ++- src/testdir/Makefile | 2 +- src/testdir/test1.in | 8 ++++++++ src/testdir/test85.in | 42 ++++++++++++++++++++++++++++++++++++++ src/testdir/test85.ok | 5 +++++ src/version.c | 2 ++ 10 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 src/testdir/test85.in create mode 100644 src/testdir/test85.ok diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak index b01d49b85b..a512cd9c91 100644 --- a/src/testdir/Make_amiga.mak +++ b/src/testdir/Make_amiga.mak @@ -13,6 +13,7 @@ VIMPROG = /vim # test25 uses symbolic link # test27 can't edit file with "*" # test52 only for Win32 +# test85 no Lua interface SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test7.out test8.out test9.out \ diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index d322504a80..4498c1c81e 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -30,7 +30,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test68.out test69.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ test79.out test80.out test81.out test82.out test83.out \ - test84.out + test84.out test85.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 0a680c5003..4aee8cdef8 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -50,7 +50,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \ test68.out test69.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ test79.out test80.out test81.out test82.out test83.out \ - test84.out + test84.out test85.out SCRIPTS32 = test50.out test70.out diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak index 9cef9aa263..64d853225c 100644 --- a/src/testdir/Make_os2.mak +++ b/src/testdir/Make_os2.mak @@ -13,6 +13,7 @@ VIMPROG = ../vim.exe # test25 uses symbolic link # test27 can't edit file with "*" in file name # test52 only for Win32 +# test85 no Lua interface SCRIPTS = test1.out test3.out test4.out test5.out test6.out \ test7.out test8.out test9.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index 4e961cff08..dfc4a7b84b 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -4,7 +4,7 @@ # Authors: Zoltan Arpadffy, # Sandor Kopanyi, # -# Last change: 2012 Mar 28 +# Last change: 2012 Apr 05 # # 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. @@ -89,6 +89,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \ # with too many dots). # # Test 72: unknown reason +# Test 85: no Lua interface .IFDEF WANT_GUI SCRIPT_GUI = test16.out diff --git a/src/testdir/Makefile b/src/testdir/Makefile index 405ebd4148..0fb8051751 100644 --- a/src/testdir/Makefile +++ b/src/testdir/Makefile @@ -27,7 +27,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \ test69.out test70.out test71.out test72.out test73.out \ test74.out test75.out test76.out test77.out test78.out \ test79.out test80.out test81.out test82.out test83.out \ - test84.out + test84.out test85.out SCRIPTS_GUI = test16.out diff --git a/src/testdir/test1.in b/src/testdir/test1.in index a3b58418a4..c175fa590e 100644 --- a/src/testdir/test1.in +++ b/src/testdir/test1.in @@ -15,6 +15,7 @@ If Vim was not compiled with the +multi_byte feature, the mbyte.vim script will be set like small.vim above. mbyte.vim is sourced by tests that require the +multi_byte feature. Similar logic is applied to the +mzscheme feature, using mzscheme.vim. +Similar logic is applied to the +lua feature, using lua.vim. STARTTEST :" Write a single line to test.out to check if testing works at all. @@ -28,10 +29,17 @@ w! test.out qa! :w! mbyte.vim :w! mzscheme.vim +:w! lua.vim +:" :" If +multi_byte feature supported, make mbyte.vim empty. :if has("multi_byte") | sp another | w! mbyte.vim | q | endif +:" :" If +mzscheme feature supported, make mzscheme.vim empty. :if has("mzscheme") | sp another | w! mzscheme.vim | q | endif +:" +:" If +lua feature supported, make lua.vim empty. +:if has("lua") | sp another | w! lua.vim | q | endif +:" :" If +eval feature supported quit here, leaving tiny.vim and small.vim empty. :" Otherwise write small.vim to skip the test. :if 1 | q! | endif diff --git a/src/testdir/test85.in b/src/testdir/test85.in new file mode 100644 index 0000000000..a4c30d0f99 --- /dev/null +++ b/src/testdir/test85.in @@ -0,0 +1,42 @@ +Test for Lua interface and luaeval() function + +STARTTEST +:so small.vim +:so lua.vim +:set nocompatible viminfo+=nviminfo +:lua l = vim.list():add"item0":add"dictionary with list OK":add"item2" +:lua h = vim.dict(); h.list = l +:call garbagecollect() +/^1 +:" change buffer contents +:lua curbuf = vim.buffer() +:lua curline = vim.eval"line('.')" +:lua curbuf[curline] = "1 changed line 1" +:" scalar test +:let tmp_string = luaeval('"string"') +:let tmp_1000 = luaeval('1000') +:if printf("%s%.0f", tmp_string, tmp_1000) == "string1000" +:let scalar_res = "OK" +:else +:let scalar_res = "FAILED" +:endif +:call append(search("^1"), "scalar test " . scalar_res) +:" dictionary containing a list +:let tmp = luaeval("h").list[1] +:/^2/put =tmp +:" circular list (at the same time test lists containing lists) +:lua l[2] = l +:let l2 = luaeval("h").list +:if l2[2] == l2 +:let res = "OK" +:else +:let res = "FAILED" +:endif +:call setline(search("^3"), "circular test " . res) +:?^1?,$w! test.out +:qa! +ENDTEST + +1 line 1 +2 line 2 +3 line 3 diff --git a/src/testdir/test85.ok b/src/testdir/test85.ok new file mode 100644 index 0000000000..f8d2d3158c --- /dev/null +++ b/src/testdir/test85.ok @@ -0,0 +1,5 @@ +1 changed line 1 +scalar test OK +2 line 2 +dictionary with list OK +circular test OK diff --git a/src/version.c b/src/version.c index a835ea5078..029b24024a 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 491, /**/ 490, /**/ From a26aaad74ca4aaa329ddfe378c06702a5e09f4c1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 16:56:52 +0200 Subject: [PATCH 33/45] Added tag v7-3-491 for changeset e070b34fe35e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b96dc4fd04..b3fc5af6e0 100644 --- a/.hgtags +++ b/.hgtags @@ -1827,3 +1827,4 @@ b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 8691bdcdbf66733c7ec1ef8161da1d4ef49dce66 v7-3-488 c1a6e1745cb521f863e63670e6c22c1c682ab4b1 v7-3-489 b067b8b81be9c2839df75824da2e88da24b07b54 v7-3-490 +e070b34fe35e6e8c40ec31a08196dd81353db4e5 v7-3-491 From 0a0e4c9e44bff40d531223824d2dabe475e1f711 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 17:17:42 +0200 Subject: [PATCH 34/45] updated for version 7.3.492 Problem: Can't indent conditions separately from function arguments. Solution: Add the 'k' flag in 'cino. (Lech Lorens) --- runtime/doc/indent.txt | 20 +++- src/misc1.c | 97 ++++++++++++++++++- src/testdir/test3.in | 214 +++++++++++++++++++++++++++++++++++++++++ src/testdir/test3.ok | 186 +++++++++++++++++++++++++++++++++++ src/version.c | 2 + 5 files changed, 513 insertions(+), 6 deletions(-) diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index 9a4aaa79af..ce02178d70 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -459,6 +459,22 @@ The examples below assume a 'shiftwidth' of 4. argument); argument); a_short_line(argument, a_short_line(argument, argument); argument); +< + *cino-k* + kN When in unclosed parentheses which follow "if", "for" or + "while" and N is non-zero, overrides the behaviour defined by + "(N": causes the indent to be N characters relative to the outer + context (i.e. the line where "if", "for" or "while" is). Has + no effect on deeper levels of nesting. Affects flags like "wN" + only for the "if", "for" and "while" conditions. If 0, defaults + to behaviour defined by the "(N" flag. (default: 0). + + cino=(0 cino=(0,ks > + if (condition1 if (condition1 + && condition2) && condition2) + action(); action(); + function(argument1 function(argument1 + && argument2); && argument2); < *cino-m* mN When N is non-zero, line up a line starting with a closing @@ -530,14 +546,14 @@ The examples below assume a 'shiftwidth' of 4. *cino-#* #N When N is non-zero recognize shell/Perl comments, starting with - '#'. Default N is zero: don't recognizes '#' comments. Note + '#'. Default N is zero: don't recognize '#' comments. Note that lines starting with # will still be seen as preprocessor lines. The defaults, spelled out in full, are: cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,l0,b0,gs,hs,N0,ps,ts,is,+s, - c3,C0,/0,(2s,us,U0,w0,W0,m0,j0,J0,)20,*70,#0 + c3,C0,/0,(2s,us,U0,w0,W0,k0,m0,j0,J0,)20,*70,#0 Vim puts a line in column 1 if: - It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'. diff --git a/src/misc1.c b/src/misc1.c index cc29239086..ddb8889331 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -5770,6 +5770,52 @@ cin_iswhileofdo(p, lnum, ind_maxparen) /* XXX */ return retval; } +/* + * Check whether in "p" there is an "if", "for" or "while" before offset. + * Return 0 if there is none. + * Otherwise return !0 and update "*poffset" to point to the place where the + * string was found. + */ + static int +cin_is_if_for_while_before_offset(line, offset, poffset) + char_u *line; + size_t offset; + int *poffset; +{ + + if (offset-- < 2) + return 0; + while (offset > 2 && vim_iswhite(line[offset])) + --offset; + + offset -= 1; + if (!STRNCMP(line + offset, "if", 2)) + goto probablyFound; + + if (offset >= 1) + { + offset -= 1; + if (!STRNCMP(line + offset, "for", 3)) + goto probablyFound; + + if (offset >= 2) + { + offset -= 2; + if (!STRNCMP(line + offset, "while", 5)) + goto probablyFound; + } + } + + return 0; +probablyFound: + if (!offset || !vim_isIDc(line[offset - 1])) + { + *poffset = offset; + return 1; + } + return 0; +} + /* * Return TRUE if we are at the end of a do-while. * do @@ -6124,7 +6170,7 @@ find_start_brace(ind_maxcomment) /* XXX */ /* * Find the matching '(', failing if it is in a comment. - * Return NULL of no match found. + * Return NULL if no match found. */ static pos_T * find_match_paren(ind_maxparen, ind_maxcomment) /* XXX */ @@ -6393,6 +6439,12 @@ get_c_indent() */ int ind_cpp_namespace = 0; + /* + * handle continuation lines containing conditions of if(), for() and + * while() + */ + int ind_if_for_while = 0; + pos_T cur_curpos; int amount; int scope_amount; @@ -6437,6 +6489,7 @@ get_c_indent() int cont_amount = 0; /* amount for continuation line */ int original_line_islabel; int added_to_amount = 0; + int is_if_for_while = 0; for (options = curbuf->b_p_cino; *options; ) { @@ -6509,6 +6562,7 @@ get_c_indent() case 'l': ind_keep_case_label = n; break; case '#': ind_hash_comment = n; break; case 'N': ind_cpp_namespace = n; break; + case 'k': ind_if_for_while = n; break; } if (*options == ',') ++options; @@ -6812,6 +6866,35 @@ get_c_indent() if (amount == -1) { int ignore_paren_col = 0; + int is_if_for_while = 0; + + if (ind_if_for_while) + { + /* Look for the outermost opening parenthesis on this line + * and check whether it belongs to an "if", "for" or "while". */ + + pos_T cursor_save = curwin->w_cursor; + pos_T outermost; + char_u *line; + int look_col; + + trypos = &our_paren_pos; + do { + outermost = *trypos; + curwin->w_cursor.lnum = outermost.lnum; + curwin->w_cursor.col = outermost.col; + + trypos = find_match_paren(ind_maxparen, ind_maxcomment); + } while (trypos && trypos->lnum == outermost.lnum); + + curwin->w_cursor = cursor_save; + + line = ml_get(outermost.lnum); + + is_if_for_while = + cin_is_if_for_while_before_offset(line, outermost.col, + &outermost.col); + } amount = skip_label(our_paren_pos.lnum, &look, ind_maxcomment); look = skipwhite(look); @@ -6836,7 +6919,7 @@ get_c_indent() curwin->w_cursor.lnum = save_lnum; look = ml_get(our_paren_pos.lnum) + look_col; } - if (theline[0] == ')' || ind_unclosed == 0 + if (theline[0] == ')' || (ind_unclosed == 0 && is_if_for_while == 0) || (!ind_unclosed_noignore && *look == '(' && ignore_paren_col == 0)) { @@ -6907,7 +6990,8 @@ get_c_indent() { /* Line up with the start of the matching paren line. */ } - else if (ind_unclosed == 0 || (!ind_unclosed_noignore + else if ((ind_unclosed == 0 && is_if_for_while == 0) + || (!ind_unclosed_noignore && *look == '(' && ignore_paren_col == 0)) { if (cur_amount != MAXCOL) @@ -6943,7 +7027,12 @@ get_c_indent() if (find_match_paren(ind_maxparen, ind_maxcomment) != NULL) amount += ind_unclosed2; else - amount += ind_unclosed; + { + if (is_if_for_while) + amount += ind_if_for_while; + else + amount += ind_unclosed; + } } /* * For a line starting with ')' use the minimum of the two diff --git a/src/testdir/test3.in b/src/testdir/test3.in index 808d03191a..67fc131de0 100644 --- a/src/testdir/test3.in +++ b/src/testdir/test3.in @@ -1573,6 +1573,220 @@ void func(void) baz(); } +STARTTEST +:set cino=k2s,(0 +2kdd3j=][ +ENDTEST + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + + if ( c1 + && ( c2 + || c3)) + foo; + func( c1 + && ( c2 + || c3)) + foo; +} + +STARTTEST +:set cino=k2s,(s +2kdd3j=][ +ENDTEST + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + + if ( c1 + && ( c2 + || c3)) + foo; + func( c1 + && ( c2 + || c3)) + foo; +} + +STARTTEST +:set cino=k2s,(s,U1 +2kdd3j=][ +ENDTEST + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + if (c123456789 + && (c22345 + || c3)) + printf("foo\n"); + + c = c1 && + ( + c2 || + c3 + ) && c4; +} + +STARTTEST +:set cino=k2s,(0,W4 +2kdd3j=][ +ENDTEST + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + if (c123456789 + && (c22345 + || c3)) + printf("foo\n"); + + if ( c1 + && ( c2 + || c3)) + foo; + + a_long_line( + argument, + argument); + a_short_line(argument, + argument); +} + +STARTTEST +:set cino=k2s,u2 +2kdd3j=][ +ENDTEST + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + if (c123456789 + && (c22345 + || c3)) + printf("foo\n"); +} + +STARTTEST +:set cino=k2s,(0,w1 +2kdd3j=][ +ENDTEST + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + if (c123456789 + && (c22345 + || c3)) + printf("foo\n"); + + if ( c1 + && ( c2 + || c3)) + foo; + func( c1 + && ( c2 + || c3)) + foo; +} + +STARTTEST +:set cino=k2,(s +2kdd3j=][ +ENDTEST + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } +} + STARTTEST :set cino=N-s /^NAMESPACESTART diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok index 828166435c..72cb75f1bb 100644 --- a/src/testdir/test3.ok +++ b/src/testdir/test3.ok @@ -1411,6 +1411,192 @@ void func(void) } +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + + if ( c1 + && ( c2 + || c3)) + foo; + func( c1 + && ( c2 + || c3)) + foo; +} + + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + + if ( c1 + && ( c2 + || c3)) + foo; + func( c1 + && ( c2 + || c3)) + foo; +} + + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + if (c123456789 + && (c22345 + || c3)) + printf("foo\n"); + + c = c1 && + ( + c2 || + c3 + ) && c4; +} + + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + if (c123456789 + && (c22345 + || c3)) + printf("foo\n"); + + if ( c1 + && ( c2 + || c3)) + foo; + + a_long_line( + argument, + argument); + a_short_line(argument, + argument); +} + + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + if (c123456789 + && (c22345 + || c3)) + printf("foo\n"); +} + + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } + if (c123456789 + && (c22345 + || c3)) + printf("foo\n"); + + if ( c1 + && ( c2 + || c3)) + foo; + func( c1 + && ( c2 + || c3)) + foo; +} + + +void func(void) +{ + if (condition1 + && condition2) + action(); + function(argument1 + && argument2); + + if (c1 && (c2 || + c3)) + foo; + if (c1 && + (c2 || c3)) + { + } +} + + NAMESPACESTART /* valid namespaces with normal indent */ namespace diff --git a/src/version.c b/src/version.c index 029b24024a..25cbb18418 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 492, /**/ 491, /**/ From 4b3743556ec71261e364f903365b62fc8fe279bf Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 17:17:42 +0200 Subject: [PATCH 35/45] Added tag v7-3-492 for changeset 214c7ec1c8f9 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b3fc5af6e0..c9bd3315b8 100644 --- a/.hgtags +++ b/.hgtags @@ -1828,3 +1828,4 @@ b35844f3eb49bb84101fdb276e3e69b0b8f7813f v7-3-480 c1a6e1745cb521f863e63670e6c22c1c682ab4b1 v7-3-489 b067b8b81be9c2839df75824da2e88da24b07b54 v7-3-490 e070b34fe35e6e8c40ec31a08196dd81353db4e5 v7-3-491 +214c7ec1c8f995664d5684da8cbeaaa86850468f v7-3-492 From c7584731a9d8315ee3eab3181a43c3c9bfc115a1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Apr 2012 17:33:26 +0200 Subject: [PATCH 36/45] Updated runtime files. --- runtime/autoload/netrw.vim | 795 +++++++++++------- runtime/autoload/netrwFileHandlers.vim | 11 +- runtime/doc/editing.txt | 4 +- runtime/doc/eval.txt | 9 +- runtime/doc/insert.txt | 9 +- runtime/doc/pi_netrw.txt | 1061 ++++-------------------- runtime/doc/syntax.txt | 14 +- runtime/doc/todo.txt | 23 +- runtime/filetype.vim | 5 +- runtime/plugin/netrwPlugin.vim | 2 +- 10 files changed, 699 insertions(+), 1234 deletions(-) diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 2c85bf8d45..3165933452 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: Sep 26, 2011 -" Version: 143 +" Date: Apr 05, 2012 +" Version: 145 " Maintainer: Charles E Campbell, Jr " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 1999-2010 Charles E. Campbell, Jr. {{{1 @@ -22,7 +22,7 @@ if &cp || exists("g:loaded_netrw") finish endif -let g:loaded_netrw = "v143" +let g:loaded_netrw = "v145" if v:version < 702 echohl WarningMsg echo "***warning*** this version of netrw needs vim 7.2" @@ -42,7 +42,7 @@ if v:version < 700 endif let s:keepcpo= &cpo -setlocal cpo&vim +set cpo&vim "DechoTabOn "call Decho("doing autoload/netrw.vim version ".g:loaded_netrw) @@ -50,6 +50,86 @@ setlocal cpo&vim " Netrw Variables: {{{1 " ====================== +" --------------------------------------------------------------------- +" netrw#ErrorMsg: {{{2 +" 0=note = s:NOTE +" 1=warning = s:WARNING +" 2=error = s:ERROR +" Apr 05, 2012 : max errnum currently is 88 +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) + + if a:level < g:netrw_errorlvl + call Dret("netrw#ErrorMsg : suppressing level=".a:level." since g;netrw_errorlvl=".g:netrw_errorlvl) + return + endif + + if a:level == 1 + let level= "**warning** (netrw) " + elseif a:level == 2 + let level= "**error** (netrw) " + else + let level= "**note** (netrw) " + endif +" call Decho("level=".level) + + if g:netrw_use_errorwindow + " (default) netrw creates a one-line window to show error/warning + " messages (reliably displayed) + + " record current window number for NetrwRestorePosn()'s benefit + let s:winBeforeErr= winnr() +" call Decho("s:winBeforeErr=".s:winBeforeErr) + + " getting messages out reliably is just plain difficult! + " This attempt splits the current window, creating a one line window. + if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0 +" call Decho("write to NetrwMessage buffer") + exe bufwinnr("NetrwMessage")."wincmd w" +" call Decho("setl ma noro") + setl ma noro + keepj call setline(line("$")+1,level.a:msg) + keepj $ + else +" call Decho("create a NetrwMessage buffer window") + bo 1split + sil! call s:NetrwEnew() + sil! keepj call s:NetrwSafeOptions() + setl bt=nofile + keepj file NetrwMessage +" call Decho("setlocal ma noro") + setl ma noro + call setline(line("$"),level.a:msg) + endif +" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr()) + if &fo !~ '[ta]' + syn clear + syn match netrwMesgNote "^\*\*note\*\*" + syn match netrwMesgWarning "^\*\*warning\*\*" + syn match netrwMesgError "^\*\*error\*\*" + hi link netrwMesgWarning WarningMsg + hi link netrwMesgError Error + endif +" call Decho("(ErrorMsg) setl noma ro bh=wipe") + setl noma ro bh=wipe + + else + " (optional) netrw will show messages using echomsg. Even if the + " message doesn't appear, at least it'll be recallable via :messages +" redraw! + if a:level == s:WARNING + echohl WarningMsg + elseif a:level == s:ERROR + echohl Error + endif + echomsg level.a:msg +" call Decho("echomsg ***netrw*** ".a:msg) + echohl None + endif + +" call Dret("netrw#ErrorMsg") +endfun + " --------------------------------------------------------------------- " NetrwInit: initializes variables if they haven't been defined {{{2 " Loosely, varname = value. @@ -100,6 +180,9 @@ if !exists("g:netrw_ftp_cmd") let g:netrw_ftp_cmd = "ftp" endif let s:netrw_ftp_cmd= g:netrw_ftp_cmd +if !exists("g:netrw_ftp_options") + let g:netrw_ftp_options= "-i -n" +endif if !exists("g:netrw_http_cmd") if executable("elinks") let g:netrw_http_cmd = "elinks" @@ -171,6 +254,7 @@ let s:netrw_usercuc = &cursorcolumn call s:NetrwInit("g:netrw_dirhist_cnt" , 0) call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" }') call s:NetrwInit("g:netrw_dirhistmax" , 10) +call s:NetrwInit("g:netrw_errorlvl" , s:NOTE) call s:NetrwInit("g:netrw_fastbrowse" , 1) call s:NetrwInit("g:netrw_ftp_browse_reject", '^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$') if !exists("g:netrw_ftp_list_cmd") @@ -212,6 +296,10 @@ if !exists("g:netrw_list_cmd") endif call s:NetrwInit("g:netrw_list_hide","") " Default values - lh-lz ---------- {{{3 +if exists("g:netrw_local_copycmd") + let g:netrw_localcopycmd= g:netrw_local_copycmd" + call netrw#ErrorMsg(s:NOTE,"g:netrw_local_copycmd is deprecated in favor of g:netrw_localcopycmd",84) +endif if !exists("g:netrw_localcopycmd") if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin @@ -224,9 +312,24 @@ if !exists("g:netrw_localcopycmd") else let g:netrw_localcopycmd= "" endif + if !executable(g:netrw_localcopycmd) + call netrw#ErrorMsg(s:NOTE,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) + 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) +endif +call s:NetrwInit("g:netrw_localmkdir","mkdir") +if !executable(g:netrw_localmkdir) + call netrw#ErrorMsg(s:NOTE,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) +endif endif -call s:NetrwInit("g:netrw_local_mkdir","mkdir") call s:NetrwInit("g:netrw_remote_mkdir","mkdir") +if exists("g:netrw_local_movecmd") + let g:netrw_localmovecmd= g:netrw_local_movecmd" + call netrw#ErrorMsg(s:NOTE,"g:netrw_local_movecmd is deprecated in favor of g:netrw_localmovecmd",88) +endif if !exists("g:netrw_localmovecmd") if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin @@ -239,8 +342,18 @@ if !exists("g:netrw_localmovecmd") else let g:netrw_localmovecmd= "" endif + if !executable(g:netrw_localmkdir) + call netrw#ErrorMsg(s:NOTE,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",81) + endif +endif +call s:NetrwInit("g:netrw_localrmdir", "rmdir") +if exists("g:netrw_local_rmdir") + let g:netrw_localrmdir= g:netrw_local_rmdir" + call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86) +endif +if !executable(g:netrw_localrmdir) + call netrw#ErrorMsg(s:NOTE,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",82) endif -call s:NetrwInit("g:netrw_local_rmdir", "rmdir") call s:NetrwInit("g:netrw_liststyle" , s:THINLIST) " sanity checks if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST @@ -293,6 +406,8 @@ call s:NetrwInit("g:netrw_xstrlen",0) call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.") call s:NetrwInit("g:netrw_win95ftp",1) call s:NetrwInit("g:netrw_winsize",50) +if g:netrw_winsize == 0|let g:netrw_winsize= -1|endif +if g:netrw_winsize > 100|let g:netrw_winsize= 100|endif " --------------------------------------------------------------------- " Default values for netrw's script variables: {{{2 call s:NetrwInit("g:netrw_fname_escape",' ?&;%') @@ -315,10 +430,12 @@ call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\\"") " ====================== if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") let s:initbeval = &beval +" let s:initbexpr = &l:bexpr let &l:bexpr = "netrw#NetrwBalloonHelp()" set beval au BufWinEnter,WinEnter * if &ft == "netrw"|set beval|else|let &beval= s:initbeval|endif endif +au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif " ============================== " Netrw Utility Functions: {{{1 @@ -360,8 +477,8 @@ endif " vt: normally its "w:" or "s:" (a variable type) fun! s:NetrwOptionSave(vt) " call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")) - " call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist")) + if !exists("{a:vt}netrw_optionsave") let {a:vt}netrw_optionsave= 1 else @@ -371,6 +488,7 @@ fun! s:NetrwOptionSave(vt) " call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff) " Save current settings and current directory +" call Decho("saving current settings and current directory") let s:yykeep = @@ if exists("&l:acd")|let {a:vt}netrw_acdkeep = &l:acd|endif let {a:vt}netrw_aikeep = &l:ai @@ -411,6 +529,7 @@ fun! s:NetrwOptionSave(vt) endif " save a few selected netrw-related variables +" call Decho("saving a few selected netrw-related variables") if g:netrw_keepdir let {a:vt}netrw_dirkeep = getcwd() endif @@ -420,22 +539,24 @@ fun! s:NetrwOptionSave(vt) if &go =~# 'a' | sil! let {a:vt}netrw_regstar = @* | endif sil! let {a:vt}netrw_regslash= @/ -" call Dret("s:NetrwOptionSave : win#".winnr()." buf#".bufnr("%")) +" call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun " ------------------------------------------------------------------------ " s:NetrwOptionRestore: restore options {{{2 fun! s:NetrwOptionRestore(vt) -" call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")." winnr($)=".winnr("$")) +" call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) if !exists("{a:vt}netrw_optionsave") if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring previous position") +" call Decho("(NetrwOptionRestore) restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") keepj call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')}) -" unlet s:nbcd_curpos_{bufnr('%')} +" call Decho("(NetrwOptionRestore) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) +" call Decho("(NetrwOptionRestore) unlet s:nbcd_curpos_".bufnr('%')) + unlet s:nbcd_curpos_{bufnr('%')} else -" call Decho("no previous position") +" call Decho("(NetrwOptionRestore) no previous position") endif -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) +" call Decho("(NetrwOptionRestore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") return endif @@ -443,7 +564,7 @@ fun! s:NetrwOptionRestore(vt) if exists("&acd") if exists("{a:vt}netrw_acdkeep") -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) +" call Decho("(NetrwOptionRestore) g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) let curdir = getcwd() let &l:acd = {a:vt}netrw_acdkeep unlet {a:vt}netrw_acdkeep @@ -515,18 +636,19 @@ fun! s:NetrwOptionRestore(vt) if exists("{a:vt}netrw_regstar") |sil! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif 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") +" call Decho("(NetrwOptionRestore) restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") keepj call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')}) -" unlet s:nbcd_curpos_{bufnr('%')} +" call Decho("(NetrwOptionRestore) unlet s:nbcd_curpos_".bufnr('%')) + unlet s:nbcd_curpos_{bufnr('%')} else " call Decho("no previous position") endif -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) -" call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) -" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist")) -" call Dret("s:NetrwOptionRestore : win#".winnr()." buf#".bufnr("%")) +" call Decho("(NetrwOptionRestore) g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) +" call Decho("(NetrwOptionRestore) fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) +" call Decho("(NetrwOptionRestore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(NetrwOptionRestore) diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist")) +" call Dret("s:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun " --------------------------------------------------------------------- @@ -542,7 +664,8 @@ fun! s:NetrwSafeOptions() setlocal nocin setlocal cino= setlocal com= - setlocal cpo-=aA + setlocal cpo-=a + setlocal cpo-=A setlocal fo=nroql2 setlocal nohid setlocal noim @@ -834,14 +957,18 @@ fun! netrw#NetRead(mode,...) " call Decho("filter input: ".getline('.')) endif - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('.')) - keepj put ='\"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) - else - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) + if exists("g:netrw_uid" && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid +" call Decho("filter input: ".getline('.')) + if exists("s:netrw_passwd") + keepj put ='\"'.s:netrw_passwd.'\"' + endif +" call Decho("filter input: ".getline('.')) + elseif exists("s:netrw_passwd") + keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('.')) + endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" @@ -860,8 +987,8 @@ fun! netrw#NetRead(mode,...) " -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." -i -n") - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i -n" +" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) + exe 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).">") @@ -925,7 +1052,8 @@ fun! netrw#NetRead(mode,...) exe 'keepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" endif let b:netrw_lastfile = choice - setlocal ro +" call Decho("(NetRead) setl ro") + setl ro "......................................... " NetRead: (dav) NetRead Method #6 {{{3 @@ -950,7 +1078,9 @@ fun! netrw#NetRead(mode,...) else keepj put ='open '.g:netrw_machine endif - keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd + if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != "" + keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd + endif keepj put ='get '.netrw_fname.' '.tmpfile keepj put ='quit' @@ -982,6 +1112,7 @@ fun! netrw#NetRead(mode,...) keepj call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) endif " call Dret("NetRead") + return endif if exists("g:netrw_option") && g:netrw_option == ":https\=" let netrw_option= "http" @@ -1000,7 +1131,8 @@ fun! netrw#NetRead(mode,...) let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice - setlocal ro +" call Decho("(NetRead) setl ro") + setl ro "......................................... " NetRead: (sftp) NetRead Method #9 {{{3 @@ -1241,14 +1373,18 @@ fun! netrw#NetWrite(...) range keepj put ='open '.g:netrw_machine " call Decho("filter input: ".getline('.')) endif - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('.')) - keepj put ='\"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) - else - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) + if exists("g:netrw_uid") && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid +" call Decho("filter input: ".getline('.')) + if exists("s:netrw_passwd") && s:netrw_passwd != "" + keepj 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.'\"' +" call Decho("filter input: ".getline('.')) + endif endif keepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$')) @@ -1266,8 +1402,8 @@ fun! netrw#NetWrite(...) range " -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." -i -n") - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i -n" +" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) + exe 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") @@ -1323,7 +1459,7 @@ fun! netrw#NetWrite(...) range else keepj put ='open '.g:netrw_machine endif - if exists("g:netrw_uid") && exists("s:netrw_passwd") + if exists("g:netrw_uid") && exists("s:netrw_passwd") && g:netrw_uid != "" keepj put ='user '.g:netrw_uid.' '.s:netrw_passwd endif keepj put ='put '.tmpfile.' '.netrw_fname @@ -1396,9 +1532,12 @@ fun! netrw#NetWrite(...) range if a:firstline == 1 && a:lastline == line("$") " restore modifiability; usually equivalent to set nomod let &mod= mod +" call Decho("(NetWrite) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") elseif !exists("leavemod") " indicate that the buffer has not been modified since last written +" call Decho("(NetWrite) set nomod") set nomod +" call Decho("(NetWrite) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") endif " call Dret("netrw#NetWrite") @@ -1454,7 +1593,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " readcmd=='t': simply do nothing if a:readcmd == 't' -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) +" call Decho("(NetrwGetFile) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("NetrwGetFile : skip read of <".a:tfile.">") return endif @@ -1508,7 +1647,15 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " rename buffer back to remote filename " call Decho("exe sil! keepalt file ".fnameescape(rfile)) exe "sil! keepj keepalt file ".fnameescape(rfile) + + " detect filetype of local version of remote file + " Note that isk must not include a "/" for scripts.vim + " to process this detection correctly. +" call Decho("detect filetype of local version of remote file") + let iskkeep= &isk + set isk-=/ filetype detect + let &isk= iskkeep " call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") let line1 = 1 let line2 = line("$") @@ -1525,7 +1672,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) else " not readable -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) +" call Decho("(NetrwGetFile) 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) " call Dret("NetrwGetFile : tfile<".a:tfile."> not readable") @@ -1550,7 +1697,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " make sure file is being displayed " redraw! -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) +" call Decho("(NetrwGetFile) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("NetrwGetFile") endfun @@ -1690,8 +1837,11 @@ fun! s:NetrwMethod(choice) if userid != "" let g:netrw_uid= userid endif + if curmachine != g:netrw_machine - if exists("s:netrw_passwd") + if exists("s:netwr_hup[".g:netrw_machine."]") + call NetUserPass("ftp:".g:netrw_machine) + elseif exists("s:netrw_passwd") " if there's a change in hostname, require password re-entry unlet s:netrw_passwd endif @@ -1699,10 +1849,15 @@ fun! s:NetrwMethod(choice) unlet netrw_port endif endif + if exists("g:netrw_uid") && exists("s:netrw_passwd") let b:netrw_method = 3 else - if (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~ '-[sS]:' + let host= substitute(g:netrw_machine,'\..*$','','') + if exists("s:netrw_hup[host]") + call NetUserPass("ftp:".host) + + elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~ '-[sS]:' " call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">") " call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">") if g:netrw_ftp_cmd =~ '-[sS]:\S*MACHINE\>' @@ -1742,6 +1897,7 @@ fun! s:NetrwMethod(choice) let g:netrw_uid = substitute(a:choice,mipf,'\2',"") let s:netrw_passwd = substitute(a:choice,mipf,'\3',"") let b:netrw_fname = substitute(a:choice,mipf,'\4',"") + call NetUserPass(g:netrw_machine,g:netrw_uid,s:netrw_passwd) " Method#3: Issue an ftp: "hostname [path/]filename" {{{3 elseif match(a:choice,mf) == 0 @@ -1844,33 +2000,89 @@ endif " --------------------------------------------------------------------- " NetUserPass: set username and password for subsequent ftp transfer {{{2 -" Usage: :call NetUserPass() -- will prompt for userid and password -" :call NetUserPass("uid") -- will prompt for password -" :call NetUserPass("uid","password") -- sets global userid and password +" Usage: :call NetUserPass() -- will prompt for userid and password +" :call NetUserPass("uid") -- will prompt for password +" :call NetUserPass("uid","password") -- sets global userid and password +" :call NetUserPass("ftp:host") -- looks up userid and password using hup dictionary +" :call NetUserPass("host","uid","password") -- sets hup dictionary with host, userid, password fun! NetUserPass(...) - " get/set userid +" call Dfunc("NetUserPass() a:0=".a:0) + + if !exists('s:netrw_hup') + let s:netrw_hup= {} + endif + if a:0 == 0 -" call Dfunc("NetUserPass(a:0<".a:0.">)") if !exists("g:netrw_uid") || g:netrw_uid == "" - " via prompt + " get uid via prompt let g:netrw_uid= input('Enter username: ') endif - else " from command line -" call Dfunc("NetUserPass(a:1<".a:1.">)") - let g:netrw_uid= a:1 - endif - - " get password - if a:0 <= 1 " via prompt -" call Decho("a:0=".a:0." case <=1:") + " get password via prompt let s:netrw_passwd= inputsecret("Enter Password: ") - else " from command line -" call Decho("a:0=".a:0." case >1: a:2<".a:2.">") - let s:netrw_passwd=a:2 + + " set up hup database + let host = substitute(g:netrw_machine,'\..*$','','') + if !exists('s:netrw_hup[host]') + let s:netrw_hup[host]= {} + endif + let s:netrw_hup[host].uid = g:netrw_uid + let s:netrw_hup[host].passwd = s:netrw_passwd + + elseif a:0 == 1 + + if a:1 =~ '^ftp:' + " access userid and password from hup (host-user-passwd) dictionary + let host = substitute(a:1,'^ftp:','','') + let host = substitute(host,'\..*','','') + if exists("s:netrw_hup[host]") + let g:netrw_uid = s:netrw_hup[host].uid + let s:netrw_passwd = s:netrw_hup[host].passwd +" call Decho("get s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">") +" call Decho("get s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">") + else + let g:netrw_uid = input("Enter UserId: ") + let s:netrw_passwd = inputsecret("Enter Password: ") + endif + else + " set userid, prompt for password +" call Decho("set g:netrw_uid= <".a:1.">") + if exists("g:netrw_machine") + let host= substitute(g:netrw_machine,'\..*$','','') + endif + let g:netrw_uid = a:1 + let s:netrw_passwd = inputsecret("Enter Password: ") + endif + +" call Decho("host<".host.">") + if exists("host") + if !exists('s:netrw_hup[host]') + let s:netrw_hup[host]= {} + endif + let s:netrw_hup[host].uid = g:netrw_uid + let s:netrw_hup[host].passwd = s:netrw_passwd + endif + + elseif a:0 == 2 + let g:netrw_uid = a:1 + let s:netrw_passwd = a:2 + + elseif a:0 == 3 + " enter hostname, user-id, and password into the hup dictionary + let host = substitute(a:1,'^\a\+:','','') + let host = substitute(host,'\..*$','','') + if !exists('s:netrw_hup[host]') + let s:netrw_hup[host]= {} + endif + let s:netrw_hup[host].uid = a:2 + let s:netrw_hup[host].passwd = a:3 + let g:netrw_uid = s:netrw_hup[host].uid + let s:netrw_passwd = s:netrw_hup[host].passwd +" call Decho("set s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">") +" call Decho("set s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">") endif -" call Dret("NetUserPass") +" call Dret("NetUserPass : uid<".g:netrw_uid."> passwd<".s:netrw_passwd.">") endfun " =========================================== @@ -1884,7 +2096,7 @@ fun! s:NetrwMaps(islocal) " set up Rexplore and [ 2-leftmouse-click -or- c-leftmouse ] " call Decho("set up Rexplore command") - com! Rexplore call s:NetrwRexplore(w:netrw_rexlocal,exists("w:netrw_rexdir")? w:netrw_rexdir : ".") + 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 g:netrw_mousemaps && g:netrw_retmap " call Decho("set up Rexplore 2-leftmouse") if !hasmapto("NetrwReturn") @@ -2309,11 +2521,12 @@ fun! s:NetrwBookHistHandler(chg,curdir) if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") " call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") - setlocal ma noro -" call Decho("setlocal ma noro") + setl ma noro +" call Decho("(NetrwBookHistHandler) setl ma noro") sil! keepj %d - setlocal nomod -" call Decho("setlocal nomod") + setl nomod +" call Decho("(NetrwBookHistHandler) setl nomod") +" call Decho("(NetrwBookHistHandler) 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}) @@ -2334,12 +2547,13 @@ fun! s:NetrwBookHistHandler(chg,curdir) if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") " call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") - setlocal ma noro -" call Decho("setlocal ma noro") +" call Decho("(NetrwBookHistHandler) setl ma noro") + setl ma noro sil! keepj %d -" call Decho("removed all lines from buffer (%d)") - setlocal nomod -" call Decho("setlocal nomod") +" call Decho("removed all lines from buffer (%d)") +" call Decho("(NetrwBookHistHandler) 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}) @@ -2409,7 +2623,7 @@ fun! s:NetrwBookHistSave() let savefile= s:NetrwHome()."/.netrwhist" 1split call s:NetrwEnew() - setlocal cino= com= cpo-=aA fo=nroql2 tw=0 report=10000 noswf + setlocal cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf setlocal nocin noai noci magic nospell nohid wig= noaw setlocal ma noro write if exists("&acd") | setlocal noacd | endif @@ -2463,7 +2677,7 @@ endfun fun! s:NetrwBrowse(islocal,dirname) if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr()) -" call Decho("tab#".tabpagenr()." win#".winnr()) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) " call Dredir("ls!") if !exists("s:netrw_initbookhist") keepj call s:NetrwBookHistRead() @@ -2478,7 +2692,7 @@ fun! s:NetrwBrowse(islocal,dirname) if exists("s:netrw_skipbrowse") unlet s:netrw_skipbrowse -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) +" call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("s:NetrwBrowse : s:netrw_skipbrowse=".s:netrw_skipbrowse) return endif @@ -2539,9 +2753,10 @@ fun! s:NetrwBrowse(islocal,dirname) " save certain window-oriented variables into buffer-oriented variables {{{3 call s:SetBufWinVars() call s:NetrwOptionRestore("w:") - setlocal ma nomod +" call Decho("setl ma nomod") + setl ma nomod +" call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) " call Dret("s:NetrwBrowse : file<".s:fname.">") return endif @@ -2570,8 +2785,9 @@ fun! s:NetrwBrowse(islocal,dirname) endif if reusing call s:NetrwOptionRestore("w:") - setlocal noma nomod nowrap -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) +" call Decho("(NetrwBrowse) 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") return endif @@ -2620,9 +2836,10 @@ fun! s:NetrwBrowse(islocal,dirname) let b:netrw_curdir= w:netrw_prvdir else call s:NetrwOptionRestore("w:") - setlocal noma nomod nowrap +" call Decho("(NetrwBrowse) setl noma nomod nowrap") + setl noma nomod nowrap +" call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") let b:netrw_curdir= dirname -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) " call Dret("s:NetrwBrowse : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") return endif @@ -2659,8 +2876,9 @@ fun! s:NetrwBrowse(islocal,dirname) keepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) endif keepj call s:NetrwOptionRestore("w:") - setlocal noma nomod nowrap -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) +" call Decho("(NetrwBrowse) setl noma nomod nowrap") + setl noma nomod nowrap +" call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("s:NetrwBrowse : badly formatted dirname<".dirname.">") return endif @@ -2688,7 +2906,7 @@ fun! s:NetrwBrowse(islocal,dirname) " and skips the refresh and sets s:locbrowseshellcmd to zero. Oct 13, 2008 let s:locbrowseshellcmd= 1 -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) +" call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("s:NetrwBrowse : did PerformListing ft<".&ft.">") return endfun @@ -2909,7 +3127,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho(" clear buffer<".expand("%")."> with :%d") sil! keepalt keepj %d -" call Dret("s:NetrwGetBuffer 0 : buf#".bufnr("%")) +" call Dret("s:NetrwGetBuffer 0 : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) return 0 endfun @@ -3105,10 +3323,12 @@ fun! s:NetrwListStyle(islocal) " call Decho("clear buffer<".expand("%")."> with :%d") sil! keepj %d " following prevents tree listing buffer from being marked "modified" - setlocal nomod +" call Decho("(NetrwListStyle) setl nomod") + setl nomod +" call Decho("(NetrwListStyle) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " refresh the listing -" call Decho("refresh the listing") +" call Decho("(NetrwListStyle) refresh the listing") let svpos= netrw#NetrwSavePosn() keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) keepj call netrw#NetrwRestorePosn(svpos) @@ -3224,7 +3444,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " Don't try to change-directory: this can happen, for example, when netrw#ErrorMsg has been called " and the current window is the NetrwMessage window. " call Decho("(NetrwBrowseChgDir) b:netrw_curdir doesn't exist!") -" call Decho("getcwd<".getcwd().">") +" call Decho("(NetrwBrowseChgDir) getcwd<".getcwd().">") " call Dredir("ls!") " call Dret("s:NetrwBrowseChgDir") return @@ -3234,6 +3454,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) keepj call s:NetrwSafeOptions() let nbcd_curpos = netrw#NetrwSavePosn() let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos +" call Decho("(NetrwBrowseChgDir) setting s:nbcd_curpos_".bufnr('%')." to SavePosn") if (has("win32") || has("win95") || has("win64") || has("win16")) let dirname = substitute(b:netrw_curdir,'\\','/','ge') else @@ -3248,7 +3469,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) else let dirpat= '[\/]$' endif -" call Decho("dirname<".dirname."> dirpat<".dirpat.">") +" call Decho("(NetrwBrowseChgDir) dirname<".dirname."> dirpat<".dirpat.">") if dirname !~ dirpat " apparently vim is "recognizing" that it is in a directory and @@ -3261,7 +3482,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " ------------ " edit a file: " ------------ -" call Decho('case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") +" call Decho('(NetrwBrowseChgDir) case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") + + " save position for benefit of Rexplore + let s:rexposn_{bufnr("%")}= netrw#NetrwSavePosn() + +" call Decho("(NetrwBrowseChgDir) setting s:rexposn_".bufnr("%")." to SavePosn") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' let dirname= s:NetrwTreeDir() if dirname =~ '/$' @@ -3269,17 +3495,17 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) else let dirname= s:NetrwTreeDir()."/".newdir endif -" call Decho("dirname<".dirname.">") -" call Decho("tree listing") +" call Decho("(NetrwBrowseChgDir) dirname<".dirname.">") +" call Decho("(NetrwBrowseChgDir) tree listing") elseif newdir =~ '^\(/\|\a:\)' let dirname= newdir else let dirname= s:ComposePath(dirname,newdir) endif -" call Decho("handling a file: dirname<".dirname."> (a:0=".a:0.")") +" call Decho("(NetrwBrowseChgDir) handling a file: dirname<".dirname."> (a:0=".a:0.")") " this lets NetrwBrowseX avoid the edit if a:0 < 1 -" call Decho("set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) +" call Decho("(NetrwBrowseChgDir) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) keepj call s:NetrwOptionRestore("s:") if !exists("s:didsplit") if g:netrw_browse_split == 1 @@ -3301,7 +3527,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif else " handling a file, didn't split, so remove menu -" call Decho("handling a file+didn't split, so remove menu") +" call Decho("(NetrwBrowseChgDir) handling a file+didn't split, so remove menu") call s:NetrwMenu(0) " optional change to window if g:netrw_chgwin >= 1 @@ -3313,10 +3539,10 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " the point where netrw actually edits the (local) file " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will if a:islocal -" call Decho("edit local file: exe e! ".fnameescape(dirname)) +" call Decho("(NetrwBrowseChgDir) edit local file: exe e! ".fnameescape(dirname)) exe "e! ".fnameescape(dirname) else -" call Decho("remote file: NetrwBrowse will edit it") +" call Decho("(NetrwBrowseChgDir) remote file: NetrwBrowse will edit it") endif let dolockout= 1 @@ -3325,12 +3551,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " or as a list of function references. It will ignore anything that's not " a function reference. See :help Funcref for information about function references. if exists("g:Netrw_funcref") -" call Decho("handle optional Funcrefs") +" call Decho("(NetrwBrowseChgDir) handle optional Funcrefs") if type(g:Netrw_funcref) == 2 -" call Decho("handling a g:Netrw_funcref") +" call Decho("(NetrwBrowseChgDir) handling a g:Netrw_funcref") keepj call g:Netrw_funcref() elseif type(g:Netrw_funcref) == 3 -" call Decho("handling a list of g:Netrw_funcrefs") +" call Decho("(NetrwBrowseChgDir) handling a list of g:Netrw_funcrefs") for Fncref in g:Netrw_funcref if type(FncRef) == 2 keepj call FncRef() @@ -3344,7 +3570,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " --------------------------------- " just go to the new directory spec " --------------------------------- -" call Decho('case "just go to new directory spec": newdir<'.newdir.'>') +" call Decho('(NetrwBrowseChgDir) case "just go to new directory spec": newdir<'.newdir.'>') let dirname= newdir keepj call s:SetRexDir(a:islocal,dirname) keepj call s:NetrwOptionRestore("s:") @@ -3353,37 +3579,37 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " -------------------------- " refresh the directory list " -------------------------- -" call Decho('case "refresh directory listing": newdir == "./"') +" call Decho('(NetrwBrowseChgDir) case "refresh directory listing": newdir == "./"') keepj call s:SetRexDir(a:islocal,dirname) elseif newdir == '../' " ------------------- " go up one directory " ------------------- -" call Decho('case "go up one directory": newdir == "../"') +" call Decho('(NetrwBrowseChgDir) case "go up one directory": newdir == "../"') if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh -" call Decho("clear buffer<".expand("%")."> with :%d") - setlocal noro ma -" call Decho("setlocal noro ma") +" call Decho("(NetrwBrowseChgDir) clear buffer<".expand("%")."> with :%d") +" call Decho("(NetrwBrowseChgDir) setl noro ma") + setl noro ma keepj %d endif if has("amiga") " amiga -" call Decho('case "go up one directory": newdir == "../" and amiga') +" call Decho('(NetrwBrowseChgDir) case "go up one directory": newdir == "../" and amiga') if a:islocal let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','') let dirname= substitute(dirname,'/$','','') else let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','') endif -" call Decho("amiga: dirname<".dirname."> (go up one dir)") +" call Decho("(NetrwBrowseChgDir) amiga: dirname<".dirname."> (go up one dir)") else " unix or cygwin -" call Decho('case "go up one directory": newdir == "../" and unix or cygwin') +" call Decho('(NetrwBrowseChgDir) case "go up one directory": newdir == "../" and unix or cygwin') if a:islocal let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') if dirname == "" @@ -3392,40 +3618,40 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) else let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') endif -" call Decho("unix: dirname<".dirname."> (go up one dir)") +" call Decho("(NetrwBrowseChgDir) unix: dirname<".dirname."> (go up one dir)") endif keepj call s:SetRexDir(a:islocal,dirname) elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") -" call Decho('case liststyle is TREELIST and w:netrw_treedict exists') +" call Decho('(NetrwBrowseChgDir) case liststyle is TREELIST and w:netrw_treedict exists') " force a refresh (for TREELIST, wait for NetrwTreeDir() to force the refresh) - setlocal noro ma -" call Decho("setlocal noro ma") +" call Decho("(NetrwBrowseChgDir) setl noro ma") + setl noro ma if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")) -" call Decho("clear buffer<".expand("%")."> with :%d") +" call Decho("(NetrwBrowseChgDir) clear buffer<".expand("%")."> with :%d") keepj %d endif let treedir = s:NetrwTreeDir() let s:treecurpos = nbcd_curpos let haskey= 0 -" call Decho("w:netrw_treedict<".string(w:netrw_treedict).">") +" call Decho("(NetrwBrowseChgDir) w:netrw_treedict<".string(w:netrw_treedict).">") " search treedict for tree dir as-is if has_key(w:netrw_treedict,treedir) -" call Decho('....searched for treedir<'.treedir.'> : found it!') +" call Decho('(NetrwBrowseChgDir) ....searched for treedir<'.treedir.'> : found it!') let haskey= 1 else -" call Decho('....searched for treedir<'.treedir.'> : not found') +" call Decho('(NetrwBrowseChgDir) ....searched for treedir<'.treedir.'> : not found') endif " search treedict for treedir with a / appended if !haskey && treedir !~ '/$' if has_key(w:netrw_treedict,treedir."/") let treedir= treedir."/" -" call Decho('....searched.for treedir<'.treedir.'> found it!') +" call Decho('(NetrwBrowseChgDir) ....searched.for treedir<'.treedir.'> found it!') let haskey = 1 else -" call Decho('....searched for treedir<'.treedir.'/> : not found') +" call Decho('(NetrwBrowseChgDir) ....searched for treedir<'.treedir.'/> : not found') endif endif @@ -3433,24 +3659,24 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !haskey && treedir =~ '/$' let treedir= substitute(treedir,'/$','','') if has_key(w:netrw_treedict,treedir) -" call Decho('....searched.for treedir<'.treedir.'> found it!') +" call Decho('(NetrwBrowseChgDir) ....searched.for treedir<'.treedir.'> found it!') let haskey = 1 else -" call Decho('....searched for treedir<'.treedir.'> : not found') +" call Decho('(NetrwBrowseChgDir) ....searched for treedir<'.treedir.'> : not found') endif endif if haskey " close tree listing for selected subdirectory -" call Decho("closing selected subdirectory<".dirname.">") +" call Decho("(NetrwBrowseChgDir) closing selected subdirectory<".dirname.">") call remove(w:netrw_treedict,treedir) -" call Decho("removed entry<".treedir."> from treedict") -" call Decho("yielding treedict<".string(w:netrw_treedict).">") +" call Decho("(NetrwBrowseChgDir) removed entry<".treedir."> from treedict") +" call Decho("(NetrwBrowseChgDir) yielding treedict<".string(w:netrw_treedict).">") let dirname= w:netrw_treetop else " go down one directory let dirname= substitute(treedir,'/*$','/','') -" call Decho("go down one dir: treedir<".treedir.">") +" call Decho("(NetrwBrowseChgDir) go down one dir: treedir<".treedir.">") endif keepj call s:SetRexDir(a:islocal,dirname) let s:treeforceredraw = 1 @@ -3458,21 +3684,24 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) else " go down one directory let dirname= s:ComposePath(dirname,newdir) -" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") +" call Decho("(NetrwBrowseChgDir) go down one dir: dirname<".dirname."> newdir<".newdir.">") keepj call s:SetRexDir(a:islocal,dirname) endif keepj call s:NetrwOptionRestore("s:") if dolockout -" call Decho("filewritable(dirname<".dirname.">)=".filewritable(dirname)) +" call Decho("(NetrwBrowseChgDir) filewritable(dirname<".dirname.">)=".filewritable(dirname)) if filewritable(dirname) -" call Decho("doing modification lockout settings: ma nomod noro") - setlocal ma nomod noro +" call Decho("(NetrwBrowseChgDir) doing modification lockout settings: ma nomod noro") +" call Decho("(NetrwBrowseChgDir) setl ma nomod noro") + setl ma nomod noro +" call Decho("(NetrwBrowseChgDir) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") else -" call Decho("doing modification lockout settings: ma nomod ro") - setlocal ma nomod ro +" call Decho("(NetrwBrowseChgDir) doing modification lockout settings: ma nomod ro") +" call Decho("(NetrwBrowseChgDir) setl ma nomod noro") + setl ma nomod ro +" call Decho("(NetrwBrowseChgDir) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") endif -" call Decho("setlocal ma nomod noro") endif " call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">") @@ -3726,7 +3955,7 @@ endfun " == 4: Vexplore style == 5: Vexplore! " == 6: Texplore fun! netrw#Explore(indx,dosplit,style,...) -" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." a:0=".a:0) +" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")) if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") @@ -3890,6 +4119,7 @@ fun! netrw#Explore(indx,dosplit,style,...) if dirname == ""|let dirname= getcwd()|endif " call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)") call netrw#LocalBrowseCheck(dirname) +" call Decho("win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endif " call Decho("curdir<".curdir.">") @@ -4491,8 +4721,8 @@ fun! s:NetrwMakeDir(usrhost) let netrw_origdir= s:NetrwGetcwd(1) exe 'keepj lcd '.fnameescape(b:netrw_curdir) " call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">") -" call Decho("exe sil! !".g:netrw_local_mkdir.' '.shellescape(newdirname,1)) - exe "sil! !".g:netrw_local_mkdir.' '.shellescape(newdirname,1) +" call Decho("exe sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) + exe "sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1) if !g:netrw_keepdir exe 'keepj lcd '.fnameescape(netrw_origdir) " call Decho("netrw_keepdir=".g:netrw_keepdir.": keepjumps lcd ".fnameescape(netrw_origdir)." getcwd<".getcwd().">") @@ -4766,7 +4996,7 @@ fun! s:NetrwMarkFileCopy(islocal) if exists("*mkdir") call mkdir(tmpdir) else - exe "sil! !".g:netrw_local_mkdir.' '.shellescape(tmpdir,1) + exe "sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1) endif if isdirectory(tmpdir) exe "keepj lcd ".fnameescape(tmpdir) @@ -4778,7 +5008,7 @@ fun! s:NetrwMarkFileCopy(islocal) keepj call s:NetrwDelete(fname) endfor exe "keepj lcd ".fnameescape(curdir) - exe "sil !".g:netrw_local_rmdir." ".shellescape(tmpdir,1) + exe "sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1) else exe "keepj lcd ".fnameescape(curdir) endif @@ -5659,6 +5889,7 @@ fun! s:NetrwMenu(domenu) endif endif " call Dret("NetrwMenu") + return endif endfun @@ -5812,14 +6043,18 @@ fun! netrw#NetrwObtain(islocal,fname,...) " call Decho("filter input: ".getline('$')) endif - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) - keepj put ='\"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) - else - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) + if exists("g:netrw_uid") && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid +" call Decho("filter input: ".getline('$')) + if exists("s:netrw_passwd") && s:netrw_passwd != "" + keepj put ='\"'.s:netrw_passwd.'\"' + endif +" call Decho("filter input: ".getline('$')) + elseif exists("s:netrw_passwd") + keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('$')) + endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" @@ -5851,8 +6086,8 @@ fun! netrw#NetrwObtain(islocal,fname,...) " -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." -i -n") - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i -n" +" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) + exe 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).">") @@ -5959,7 +6194,9 @@ fun! s:NetrwPrevWinOpen(islocal) elseif choice == 2 " No -- don't worry about changed file, just browse anyway - setlocal nomod +" call Decho("(NetrwPrevWinOpen) setl nomod") + setl nomod +" call Decho("(NetrwPrevWinOpen) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") keepj call netrw#ErrorMsg(s:WARNING,bufname." changes to ".bufname." abandoned",31) wincmd p @@ -6112,14 +6349,18 @@ fun! s:NetrwUpload(fname,tgt,...) " call Decho("filter input: ".getline('$')) endif - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) - keepj call setline(line("$")+1,'"'.s:netrw_passwd.'"') -" call Decho("filter input: ".getline('$')) - else - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) + if exists("g:netrw_uid") && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid +" call Decho("filter input: ".getline('$')) + if exists("s:netrw_passwd") + keepj 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.'\"' +" call Decho("filter input: ".getline('$')) + endif endif keepj call setline(line("$")+1,'lcd "'.fromdir.'"') @@ -6145,8 +6386,8 @@ fun! s:NetrwUpload(fname,tgt,...) " -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." -i -n") - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i -n" +" 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 " 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 call histdel("/",-1) @@ -6621,6 +6862,7 @@ fun! s:NetrwTreeListing(dirname) keepj call s:NetrwTreeDisplay(w:netrw_treetop,"") " call Dret("NetrwTreeListing : bufname<".expand("%").">") + return endif endfun @@ -6677,8 +6919,11 @@ fun! s:NetrwWideListing() sil! let @*= keepregstar exe "sil! keepj ".w:netrw_bannercnt.',$s/\s\+$//e' keepj call histdel("/",-1) - setlocal noma nomod ro +" call Decho("NetrwWideListing) setl noma nomod ro") + setl noma nomod ro +" call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("NetrwWideListing") + return endif endfun @@ -6804,6 +7049,9 @@ fun! s:PerformListing(islocal) " call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") " manipulate the directory listing (hide, sort) {{{3 + if !exists("w:netrw_bannercnt") + let w:netrw_bannercnt= 0 + endif if !g:netrw_banner || line("$") >= w:netrw_bannercnt " call Decho("manipulate directory listing (hide)") " call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") @@ -7324,11 +7572,21 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) keepj put ='open '.g:netrw_machine endif - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid - keepj put ='\"'.s:netrw_passwd.'\"' - else - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + " handle userid and password + let host= substitute(g:netrw_machine,'\..*$','','') +" call Decho("host<".host.">") + if exists("s:netrw_hup") && exists("s:netrw_hup[host]") + call NetUserPass("ftp:".host) + endif + if exists("g:netrw_uid") && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid + if exists("s:netrw_passwd") && s:netrw_passwd != "" + keepj put ='\"'.s:netrw_passwd.'\"' + endif + elseif exists("s:netrw_passwd") + keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' + endif endif if a:path != "" @@ -7345,8 +7603,8 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password " exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i -n") - exe s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i -n" +" 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 "......................................... else @@ -7493,10 +7751,8 @@ endfun " s:LocalListing: does the job of "ls" for local directories {{{2 fun! s:LocalListing() " call Dfunc("s:LocalListing()") -" call Decho("&ma=".&ma) -" call Decho("&mod=".&mod) -" call Decho("&ro=".&ro) -" call Decho("bufname(%)<".bufname("%").">") +" call Decho("(LocalListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(LocalListing) tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) " if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist") |endif " if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist")|endif @@ -7505,51 +7761,51 @@ fun! s:LocalListing() let dirname = b:netrw_curdir let dirnamelen = s:Strlen(b:netrw_curdir) let filelist = glob(s:ComposePath(fnameescape(dirname),"*")) -" call Decho("glob(dirname<".dirname."/*>)=".filelist) +" call Decho("(LocalListing) glob(dirname<".dirname."/*>)=".filelist) if filelist != "" let filelist= filelist."\n" endif let filelist= filelist.glob(s:ComposePath(fnameescape(dirname),".*")) -" call Decho("glob(dirname<".dirname."/.*>)=".filelist) +" call Decho("(LocalListing) glob(dirname<".dirname."/.*>)=".filelist) " Coding choice: either elide ./ if present " or include ./ if not present if filelist =~ '[\\/]\.[\\/]\=\(\n\|$\)' " elide /path/. from glob() entries if present -" call Decho("elide /path/. from glob entries if present") +" call Decho("(LocalListing) elide /path/. from glob entries if present") let filelist = substitute(filelist,'\n','\t','g') let filelist = substitute(filelist,'^[^\t]\+[/\\]\.\t','','') let filelist = substitute(filelist,'[^\t]\+[/\\]\.$','','') let filelist = substitute(filelist,'\t\zs[^\t]\+[/\\]\.\t','','') let filelist = substitute(filelist,'\t','\n','g') endif -" call Decho("filelist<".filelist.">") +" call Decho("(LocalListing) filelist<".filelist.">") if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)' " include ../ in the glob() entry if its missing -" call Decho("forcibly tacking on ..") +" call Decho("(LocalListing) forcibly tacking on ..") let filelist= filelist."\n".s:ComposePath(b:netrw_curdir,"../") -" call Decho("filelist<".filelist.">") +" call Decho("(LocalListing) filelist<".filelist.">") endif if b:netrw_curdir == '/' " remove .. from filelist when current directory is root directory -" call Decho("remove .. from filelist") +" call Decho("(LocalListing) remove .. from filelist") let filelist= substitute(filelist,'/\.\.\n','','') endif " remove multiple contiguous newlines let filelist= substitute(filelist,'\n\{2,}','\n','ge') if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) " change all \s to /s -" call Decho('change all \s to /s') +" call Decho('(LocalListing) change all \s to /s') let filelist= substitute(filelist,'\','/','g') else " escape all \s to \\ -" call Decho('escape all \s to \\') +" call Decho('(LocalListing) escape all \s to \\') let filelist= substitute(filelist,'\','\\','g') endif -" call Decho("(before while) dirname<".dirname.">") -" call Decho("(before while) dirnamelen<".dirnamelen.">") -" call Decho("(before while) filelist<".filelist.">") +" call Decho("(LocalListing) (before while) dirname<".dirname.">") +" call Decho("(LocalListing) (before while) dirnamelen<".dirnamelen.">") +" call Decho("(LocalListing) (before while) filelist<".filelist.">") while filelist != "" if filelist =~ '\n' @@ -7560,34 +7816,34 @@ fun! s:LocalListing() let filelist = "" endif " call Decho(" ") -" call Decho("(while) filelist<".filelist.">") -" call Decho("(while) filename<".filename.">") +" call Decho("(LocalListing) (while) filelist<".filelist.">") +" call Decho("(LocalListing) (while) filename<".filename.">") if getftype(filename) == "link" " indicate a symbolic link -" call Decho("indicate <".filename."> is a symbolic link with trailing @") +" call Decho("(LocalListing) indicate <".filename."> is a symbolic link with trailing @") let pfile= filename."@" elseif getftype(filename) == "socket" " indicate a socket -" call Decho("indicate <".filename."> is a socket with trailing =") +" call Decho("(LocalListing) indicate <".filename."> is a socket with trailing =") let pfile= filename."=" elseif getftype(filename) == "fifo" " indicate a fifo -" call Decho("indicate <".filename."> is a fifo with trailing |") +" call Decho("(LocalListing) indicate <".filename."> is a fifo with trailing |") let pfile= filename."|" elseif isdirectory(filename) " indicate a directory -" call Decho("indicate <".filename."> is a directory with trailing /") +" call Decho("(LocalListing) indicate <".filename."> is a directory with trailing /") let pfile= filename."/" elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(filename) if (has("win32") || has("win95") || has("win64") || has("win16")) if filename =~ '\.[eE][xX][eE]$' || filename =~ '\.[cC][oO][mM]$' || filename =~ '\.[bB][aA][tT]$' " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *") +" call Decho("(LocalListing) indicate <".filename."> is executable with trailing *") let pfile= filename."*" else " normal file @@ -7595,7 +7851,7 @@ fun! s:LocalListing() endif elseif executable(filename) " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *") +" call Decho("(LocalListing) indicate <".filename."> is executable with trailing *") let pfile= filename."*" else " normal file @@ -7606,22 +7862,22 @@ fun! s:LocalListing() " normal file let pfile= filename endif -" call Decho("pfile<".pfile."> (after *@/ appending)") +" call Decho("(LocalListing) pfile<".pfile."> (after *@/ appending)") if pfile =~ '//$' let pfile= substitute(pfile,'//$','/','e') -" call Decho("change // to /: pfile<".pfile.">") +" call Decho("(LocalListing) change // to /: pfile<".pfile.">") endif let pfile= strpart(pfile,dirnamelen) let pfile= substitute(pfile,'^[/\\]','','e') -" call Decho("filename<".filename.">") -" call Decho("pfile <".pfile.">") +" call Decho("(LocalListing) filename<".filename.">") +" call Decho("(LocalListing) pfile <".pfile.">") if w:netrw_liststyle == s:LONGLIST let sz = getfsize(filename) let fsz = strpart(" ",1,15-strlen(sz)).sz let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) -" call Decho("sz=".sz." fsz=".fsz) +" call Decho("(LocalListing) sz=".sz." fsz=".fsz) endif if g:netrw_sort_by =~ "^t" @@ -7629,22 +7885,22 @@ 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("(LocalListing) exe keepjumps put ='".ft.'/'.filename."'") let ftpfile= ft.'/'.pfile sil! keepj 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)) +" call Decho("(LocalListing) getfsize(".filename.")=".getfsize(filename)) let sz = getfsize(filename) let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz -" call Decho("exe keepjumps put ='".fsz.'/'.filename."'") +" call Decho("(LocalListing) exe keepj put ='".fsz.'/'.filename."'") let fszpfile= fsz.'/'.pfile sil! keepj put =fszpfile else " sort by name -" call Decho("exe keepjumps put ='".pfile."'") +" call Decho("(LocalListing) exe keepjumps put ='".pfile."'") sil! keepj put=pfile endif endwhile @@ -7654,7 +7910,7 @@ fun! s:LocalListing() sil! keepj %s/\r$//e call histdel("/",-1) exe "setl ts=".g:netrw_maxfilenamelen -" call Decho("setl ts=".g:netrw_maxfilenamelen) +" call Decho("(LocalListing) setl ts=".g:netrw_maxfilenamelen) " call Dret("s:LocalListing") endfun @@ -7836,8 +8092,8 @@ fun! s:NetrwLocalRmFile(path,fname,all) let rmfile= substitute(rmfile,'[\/]$','','e') if all || ok =~ 'y\%[es]' || ok == "" -" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_local_rmdir.') '.shellescape(rmfile).')') - call system(netrw#WinPath(g:netrw_local_rmdir).' '.shellescape(rmfile)) +" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.shellescape(rmfile).')') + call system(netrw#WinPath(g:netrw_localrmdir).' '.shellescape(rmfile)) " call Decho("v:shell_error=".v:shell_error) if v:shell_error != 0 @@ -8039,7 +8295,9 @@ fun! netrw#FileUrlRead(fname) exe 'keepj r '.plainfname exe 'file! '.plainfname keepj 1d +" call Decho("(FileUrlRead) setl nomod") setl nomod +" call Decho("(FileUrlRead) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("netrw#FileUrlRead") exe "sil doau BufReadPost ".fname2396e endfun @@ -8047,80 +8305,6 @@ endfun " --------------------------------------------------------------------- " Support Functions: {{{1 -" --------------------------------------------------------------------- -" netrw#ErrorMsg: {{{2 -" 0=note = s:NOTE -" 1=warning = s:WARNING -" 2=error = s:ERROR -" Apr 18, 2011 : max errnum currently is 78 -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) - - if a:level == 1 - let level= "**warning** (netrw) " - elseif a:level == 2 - let level= "**error** (netrw) " - else - let level= "**note** (netrw) " - endif -" call Decho("level=".level) - - if g:netrw_use_errorwindow - " (default) netrw creates a one-line window to show error/warning - " messages (reliably displayed) - - " record current window number for NetrwRestorePosn()'s benefit - let s:winBeforeErr= winnr() -" call Decho("s:winBeforeErr=".s:winBeforeErr) - - " getting messages out reliably is just plain difficult! - " This attempt splits the current window, creating a one line window. - if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0 -" call Decho("write to NetrwMessage buffer") - exe bufwinnr("NetrwMessage")."wincmd w" -" call Decho("setl ma noro") - setl ma noro - keepj call setline(line("$")+1,level.a:msg) - keepj $ - else -" call Decho("create a NetrwMessage buffer window") - bo 1split - call s:NetrwEnew() - keepj call s:NetrwSafeOptions() - setl bt=nofile - keepj file NetrwMessage -" call Decho("setlocal ma noro") - setl ma noro - call setline(line("$"),level.a:msg) - endif -" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr()) - if &fo !~ '[ta]' - syn clear - syn match netrwMesgNote "^\*\*note\*\*" - syn match netrwMesgWarning "^\*\*warning\*\*" - syn match netrwMesgError "^\*\*error\*\*" - hi link netrwMesgWarning WarningMsg - hi link netrwMesgError Error - endif - setl noma ro bh=wipe - - else - " (optional) netrw will show messages using echomsg. Even if the - " message doesn't appear, at least it'll be recallable via :messages -" redraw! - if a:level == s:WARNING - echohl WarningMsg - elseif a:level == s:ERROR - echohl Error - endif - echomsg level.a:msg -" call Decho("echomsg ***netrw*** ".a:msg) - echohl None - endif - -" call Dret("netrw#ErrorMsg") -endfun - " --------------------------------------------------------------------- " netrw#NetrwRestorePosn: restores the cursor and file position as saved by NetrwSavePosn() {{{2 fun! netrw#NetrwRestorePosn(...) @@ -8198,7 +8382,7 @@ endfun fun! s:ComposePath(base,subdir) " call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)") - if(has("amiga")) + if has("amiga") " call Decho("amiga") let ec = a:base[s:Strlen(a:base)-1] if ec != '/' && ec != ':' @@ -8283,7 +8467,7 @@ 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) +" call Decho("(GetTempfile) 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) " call Dret("s:GetTempfile getcwd<".getcwd().">") return "" @@ -8331,7 +8515,7 @@ fun! s:GetTempfile(fname) endif endif -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) +" call Decho("(GetTempFile) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("s:GetTempfile <".tmpfile.">") return tmpfile endfun @@ -8553,6 +8737,34 @@ fun! s:NetrwEnew(...) " call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#").">") endfun +" --------------------------------------------------------------------- +" s:NetrwInsureWinVars: insure that a netrw buffer has its w: variables in spite of a wincmd v or s {{{2 +fun! s:NetrwInsureWinVars() +" call Dfunc("s:NetrwInsureWinVars()") + if !exists("w:netrw_liststyle") + let curbuf = bufnr("%") + let curwin = winnr() + let iwin = 1 + while iwin <= winnr("$") + exe iwin."wincmd w" + if winnr() != curwin && bufnr("%") == curbuf && exists("w:netrw_liststyle") + " looks like ctrl-w_s or ctrl-w_v was used to split a netrw buffer + let winvars= w: + break + endif + let iwin= iwin + 1 + endwhile + exe curbuf."wincmd w" + if exists("winvars") +" call Decho("copying w#".iwin." window variables to w#".curwin) + for k in keys(winvars) + let w:{k}= winvars[k] + endfor + endif + endif +" call Dret("s:NetrwInsureWinVars") +endfun + " ------------------------------------------------------------------------ " s:NetrwSaveWordPosn: used to keep cursor on same word after refresh, {{{2 " changed sorting, etc. Also see s:NetrwRestoreWordPosn(). @@ -8672,7 +8884,7 @@ endfun fun! s:NetrwRexplore(islocal,dirname) " call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir.">") if !exists("w:netrw_rexlocal") - " call Dret("s:NetrwRexplore() w:netrw_rexlocal doesn't exist") +" " call Dret("s:NetrwRexplore() w:netrw_rexlocal doesn't exist") return endif if w:netrw_rexlocal @@ -8683,9 +8895,12 @@ fun! s:NetrwRexplore(islocal,dirname) if exists("s:initbeval") set beval endif - if exists("s:nbcd_curpos_{bufnr('%')}") - keepj call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')}) -" unlet s:nbcd_curpos_{bufnr('%')} + if exists("s:rexposn_".bufnr("%")) +" call Decho("(NetrwRexplore) restore posn, then unlet s:rexposn_".bufnr('%')) + keepj call netrw#NetrwRestorePosn(s:rexposn_{bufnr('%')}) + unlet s:rexposn_{bufnr('%')} + else +" call Decho("(NetrwRexplore) s:rexposn_".bufnr('%')." doesn't exist") endif if exists("s:explore_match") exe "2match netrwMarkFile /".s:explore_match."/" diff --git a/runtime/autoload/netrwFileHandlers.vim b/runtime/autoload/netrwFileHandlers.vim index 1515b0098b..b11e3cfbf4 100644 --- a/runtime/autoload/netrwFileHandlers.vim +++ b/runtime/autoload/netrwFileHandlers.vim @@ -1,9 +1,9 @@ " netrwFileHandlers: contains various extension-based file handlers for " netrw's browsers' x command ("eXecute launcher") " Author: Charles E. Campbell, Jr. -" Date: Sep 30, 2008 -" Version: 10 -" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1 +" Date: Mar 14, 2012 +" Version: 11a +" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -20,7 +20,7 @@ if exists("g:loaded_netrwFileHandlers") || &cp finish endif -let g:loaded_netrwFileHandlers= "v10" +let g:loaded_netrwFileHandlers= "v11a" if v:version < 702 echohl WarningMsg echo "***warning*** this version of netrwFileHandlers needs vim 7.2" @@ -64,7 +64,7 @@ fun! netrwFileHandlers#Invoke(exten,fname) " call Decho("let ret= netrwFileHandlers#NFH_".a:exten.'("'.fname.'")') exe "let ret= s:NFH_".a:exten.'("'.fname.'")' endif - + " call Dret("netrwFileHandlers#Invoke 0 : ret=".ret) return 0 endfun @@ -356,6 +356,7 @@ fun! s:NFH_obj(obj) endfun let &cpo= s:keepcpo +unlet s:keepcpo " --------------------------------------------------------------------- " Modelines: {{{1 " vim: fdm=marker diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 977a94dce2..828de15018 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1,4 +1,4 @@ -*editing.txt* For Vim version 7.3. Last change: 2012 Mar 23 +*editing.txt* For Vim version 7.3. Last change: 2012 Apr 03 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1641,6 +1641,6 @@ There are three different types of searching: Note that completion for ":find", ":sfind", and ":tabfind" commands do not currently work with 'path' items that contain a url or use the double star - (/usr/**2) or upward search (;) notations. > + with depth limiter (/usr/**2) or upward search (;) notations. vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index cb0dbc01ce..321995ec2e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.3. Last change: 2012 Mar 28 +*eval.txt* For Vim version 7.3. Last change: 2012 Apr 01 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3229,7 +3229,8 @@ getcmdpos() *getcmdpos()* Return the position of the cursor in the command line as a byte count. The first column is 1. Only works when editing the command line, thus requires use of - |c_CTRL-\_e| or |c_CTRL-R_=|. Returns 0 otherwise. + |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping. + Returns 0 otherwise. Also see |getcmdtype()|, |setcmdpos()| and |getcmdline()|. getcmdtype() *getcmdtype()* @@ -3242,8 +3243,8 @@ getcmdtype() *getcmdtype()* @ |input()| command - |:insert| or |:append| command Only works when editing the command line, thus requires use of - |c_CTRL-\_e| or |c_CTRL-R_=|. Returns an empty string - otherwise. + |c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping. + Returns an empty string otherwise. Also see |getcmdpos()|, |setcmdpos()| and |getcmdline()|. *getcwd()* diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 924e8a458e..030f0de271 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1,4 +1,4 @@ -*insert.txt* For Vim version 7.3. Last change: 2012 Jan 26 +*insert.txt* For Vim version 7.3. Last change: 2012 Apr 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -398,7 +398,12 @@ An example for using CTRL-G u: > This redefines the backspace key to start a new undo sequence. You can now undo the effect of the backspace key, without changing what you typed before -that, with CTRL-O u. +that, with CTRL-O u. Another example: > + + :inoremap u + +This breaks undo at each line break. It also expands abbreviations before +this. Using CTRL-O splits undo: the text typed before and after it is undone separately. If you want to avoid this (e.g., in a mapping) you might be able diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 1d4a09f3dc..142f08f16f 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 7.3. Last change: 2012 Jan 26 +*pi_netrw.txt* For Vim version 7.3. Last change: 2012 Apr 05 ----------------------------------------------------- NETRW REFERENCE MANUAL by Charles E. Campbell, Jr. @@ -6,17 +6,16 @@ Author: Charles E. Campbell, Jr. (remove NOSPAM from Campbell's email first) -Copyright: Copyright (C) 1999-2011 Charles E Campbell, Jr *netrw-copyright* - Permission is hereby granted to use and distribute this code, with - or without modifications, provided that this copyright notice is - copied with it. Like anything else that's free, netrw.vim, - netrwPlugin.vim, netrwFileHandlers.vim, netrwSettings.vim, - syntax/netrw.vim, and pi_netrw.txt are provided *as is* and comes - with no warranty of any kind, either expressed or implied. No - guarantees of merchantability. No guarantees of suitability for - any purpose. By using this plugin, you agree that in no event will - the copyright holder be liable for any damages resulting from the - use of this software. +Copyright: Copyright (C) 1999-2012 Charles E Campbell, Jr *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 + associated files are provided *as is* and comes with no warranty of + any kind, either expressed or implied. No guarantees of + merchantability. No guarantees of suitability for any purpose. By + using this plugin, you agree that in no event will the copyright + holder be liable for any damages resulting from the use of this + software. Use at your own risk! *dav* *ftp* *netrw-file* *rcp* *scp* @@ -43,7 +42,7 @@ Copyright: Copyright (C) 1999-2011 Charles E Campbell, Jr *netrw-copyright* 5. Activation...........................................|netrw-activate| 6. Transparent Remote File Editing......................|netrw-transparent| 7. Ex Commands..........................................|netrw-ex| -8. Variables and Options................................|netrw-settings| +8. Variables and Options................................|netrw-variables| 9. Browsing.............................................|netrw-browse| Introduction To Browsing...........................|netrw-intro-browse| Quick Reference: Maps..............................|netrw-browse-maps| @@ -141,6 +140,16 @@ and has lines resembling > ... default login USERID password "PASSWORD" < +Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: > + + let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE' +< +Netrw will substitute the host's machine name for MACHINE from the url it is +attempting to open, and so one may specify > + userid + password +for each site in a separate file in c:\Users\Myself\. + Now about browsing -- when you just want to look around before editing a file. For browsing on your current host, just "edit" a directory: > @@ -309,7 +318,12 @@ CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass* {{{2 :call NetUserPass("uid","password") -- sets global uid and password NETRW VARIABLES AND SETTINGS *netrw-variables* {{{2 -(also see: |netrw-browser-var| |netrw-protocol| |netrw-settings|) + (Also see: + |netrw-browser-var| : netrw browser option variables + |netrw-protocol| : file transfer protocol option variables + |netrw-settings| : additional file transfer options + |netrw-browser-options| : these options affect browsing directories + ) Netrw provides a lot of variables which allow you to customize netrw to your preferences. One way to look at them is via the command :NetrwSettings (see @@ -318,96 +332,102 @@ settings are described below, in |netrw-browser-options|, and in |netrw-externapp|: *b:netrw_lastfile* last file Network-read/written retained on a - per-buffer basis (supports plain :Nw ) + 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 file edits will take - place. (also see |netrw-C|) - (default) not defined + place. (also see |netrw-C|) + (default) not defined *g:Netrw_funcref* specifies a function (or functions) to be called when - netrw edits a file. The file is first edited, and - then the function reference (|Funcref|) is called. - This variable may also hold a |List| of Funcrefs. - (default) not defined. (the capital in g:Netrw... - is required by its holding a function reference) + netrw edits a file. The file is first edited, and + then the function reference (|Funcref|) is called. + This variable may also hold a |List| of Funcrefs. + (default) not defined. (the capital in g:Netrw... + is required by its holding a function reference) > Example: place in .vimrc; affects all file opening fun! MyFuncRef() endfun let g:Netrw_funcref= function("MyFuncRef") < - *g:netrw_ftp* if it doesn't exist, use default ftp - =0 use default ftp (uid password) - =1 use alternate ftp method (user uid password) - If you're having trouble with ftp, try changing the - value of this variable to see if the alternate ftp - method works for your setup. + *g:netrw_ftp* if it doesn't exist, use default ftp + =0 use default ftp (uid password) + =1 use alternate ftp method (user uid password) + If you're having trouble with ftp, try changing the + value of this variable to see if the alternate ftp + method works for your setup. + + *g:netrw_ftp_options* Chosen by default, these options are supposed to turn + interactive prompting off and to restrain ftp from + attempting auto-login upon initial connection. + However, it appears that not all ftp implementations + support this (ex. ncftp). + ="-i -n" *g:netrw_ftpextracmd* default: doesn't exist - If this variable exists, then any string it contains - will be placed into the commands set to your ftp - client. As an example: - ="passive" + If this variable exists, then any string it contains + will be placed into the commands set to your ftp + client. As an example: + ="passive" *g:netrw_ftpmode* ="binary" (default) - ="ascii" + ="ascii" *g:netrw_ignorenetrc* =0 (default for linux, cygwin) - =1 If you have a <.netrc> file but it doesn't work and - you want it ignored, then set this variable as - shown. (default for Windows + cmd.exe) + =1 If you have a <.netrc> file but it doesn't work and + you want it ignored, then set this variable as + shown. (default for Windows + cmd.exe) *g:netrw_menu* =0 disable netrw's menu - =1 (default) netrw's menu enabled + =1 (default) netrw's menu enabled *g:netrw_nogx* if this variable exists, then the "gx" map will not - be available (see |netrw-gx|) + 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. + split window + =1 preview window shown in a vertically split window. + Also affects the "previous window" (see |netrw-P|) in + the same way. - *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_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 - =\0x01 for enc == euc-jp (and perhaps it should be for - others, too, please let me - know) - Separates priority codes from filenames internally. - See |netrw-p12|. + *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. + See |netrw-p12|. *g:netrw_silent* =0 : transfers done normally - =1 : transfers done silently + =1 : transfers done silently *g:netrw_use_errorwindow* =1 : messages from netrw will use a separate one - line window. This window provides reliable + line window. This window provides reliable delivery of messages. (default) =0 : messages from netrw will use echoerr ; messages don't always seem to show up this way, but one doesn't have to quit the window. *g:netrw_win95ftp* =1 if using Win95, will remove four trailing blank - lines that o/s's ftp "provides" on transfers - =0 force normal ftp behavior (no trailing line removal) + 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 - permits network browsing to use ls with time and - size sorting (default if windows) - =0 assume Windows' scp accepts windows-style paths - Network browsing uses dir instead of ls - This option is ignored if you're using unix + *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 + Network browsing uses dir instead of ls + This option is ignored if you're using unix *g:netrw_use_nt_rcp* =0 don't use the rcp of WinNT, Win2000 and WinXP - =1 use WinNT's rcp in binary mode (default) + =1 use WinNT's rcp in binary mode (default) PATHS *netrw-path* {{{2 @@ -512,12 +532,13 @@ which contains ftp commands which will be automatically run whenever ftp starts. You may use this feature to enter a user and password for one site: > userid password +< *netrw-windows-netrc* *netrw-windows-s* If |g:netrw_ftp_cmd| contains -s:[path/]MACHINE, then (on Windows machines only) -netrw will substitute the current machine name requested for ftp connection +netrw will substitute the current machine name requested for ftp connections for MACHINE. Hence one can have multiple machine.ftp files containing login and password for ftp. Example: > - g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE' + let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE' vim ftp://myhost.somewhere.net/ will use a file > C:\Users\Myself\myhost.ftp @@ -616,6 +637,9 @@ password. readable for others. Don't forget that the system administrator can still read the file! Ie. for Linux/Unix: chmod 600 .netrc +Even though Windows' ftp clients typically do not support .netrc, netrw has +a work-around: see |netrw-windows-s|. + PASSWORD *netrw-passwd* @@ -720,11 +744,10 @@ below, a {netfile} is an url to a remote file. ============================================================================== -8. Variables and Options *netrw-settings* {{{1 +8. Variables and Options *netrw-var* *netrw-settings* {{{1 (also see: |netrw-options| |netrw-variables| |netrw-protocol| - |netrw-browser-settings| |netrw-browser-options| - |netrw-browser-var| ) + |netrw-browser-settings| |netrw-browser-options| ) The script provides several variables which act as options to affect 's file transfer behavior. These variables typically may be @@ -1222,6 +1245,18 @@ As an example, by putting the following line in your .vimrc, > let g:netrw_liststyle= 4 the tree style will become your default listing style. +One typical way to use the netrw tree display is to: > + + vim . + (use i until a tree display shows) + navigate to a file + v (edit as desired in vertically split window) + ctrl-w h (to return to the netrw listing) + P (edit newly selected file in the previous window) + ctrl-w h (to return to the netrw listing) + P (edit newly selected file in the previous window) + ...etc... +< Associated setting variables: |g:netrw_liststyle| |g:netrw_maxfilenamelen| |g:netrw_timefmt| |g:netrw_list_cmd| @@ -1395,7 +1430,7 @@ to remove it again using the g:netrw_rmf_cmd variable. Its default value is: g:netrw_rmf_cmd: ssh HOSTNAME rm -f Related topics: |netrw-d| -Associated setting variable: |g:netrw_local_rmdir| |g:netrw_rm_cmd| +Associated setting variable: |g:netrw_localrmdir| |g:netrw_rm_cmd| |g:netrw_rmdir_cmd| |g:netrw_ssh_cmd| @@ -1727,13 +1762,13 @@ MAKING A NEW DIRECTORY *netrw-d* {{{2 With the "d" map one may make a new directory either remotely (which depends on the global variable g:netrw_mkdir_cmd) or locally (which depends on the -global variable g:netrw_local_mkdir). Netrw will issue a request for the new +global variable g:netrw_localmkdir). Netrw will issue a request for the new directory's name. A bare at that point will abort the making of the directory. Attempts to make a local directory that already exists (as either a file or a directory) will be detected, reported on, and ignored. Related topics: |netrw-D| -Associated setting variables: |g:netrw_local_mkdir| |g:netrw_mkdir_cmd| +Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd| |g:netrw_remote_mkdir| @@ -2058,6 +2093,12 @@ your browsing preferences. (see also: |netrw-settings|) history. (related: |netrw-qb| |netrw-u| |netrw-U|) + *g:netrw_errorlvl* =0: error levels greater than or equal to + this are permitted to be displayed + 0: notes + 1: warnings + 2: errors + *g:netrw_fastbrowse* =0: slow speed directory browsing; never re-uses directory listings, always obtains directory listings. @@ -2116,7 +2157,7 @@ your browsing preferences. (see also: |netrw-settings|) unix or g:netrw_cygwin set: : "ls -tlF" otherwise "dir" - *g:netrw_glob_escape* ='[]*?`{~$' (unix) + *g:netrw_glob_escape* ='[]*?`{~$' (unix) ='[]*?`{$' (windows These characters in directory names are escaped before applying glob() @@ -2162,10 +2203,10 @@ your browsing preferences. (see also: |netrw-settings|) Moves marked files (|netrw-mf|) to target directory (|netrw-mt|, |netrw-mm|) - *g:netrw_local_mkdir* command for making a local directory + *g:netrw_localmkdir* command for making a local directory default: "mkdir" - *g:netrw_local_rmdir* remove directory command (rmdir) + *g:netrw_localrmdir* remove directory command (rmdir) default: "rmdir" *g:netrw_maxfilenamelen* =32 by default, selected so as to make long @@ -2246,7 +2287,7 @@ your browsing preferences. (see also: |netrw-settings|) \.info$,\.swp$,\.obj$' *g:netrw_special_syntax* If true, then certain files will be shown - in special syntax in the browser: + using special syntax in the browser: netrwBak : *.bak netrwCompress: *.gz *.bz2 *.Z *.zip @@ -2354,7 +2395,7 @@ settings. You may change any of their values; when you save the file, the settings therein will be used. One may also press "?" on any of the lines for help on what each of the variables do. -(also see: |netrw-browser-var| |netrw-protocol| |netrw-settings| |netrw-variables|) +(also see: |netrw-browser-var| |netrw-protocol| |netrw-variables|) ============================================================================== @@ -2414,8 +2455,8 @@ 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 - will use only 30 columns; the rest of the window is used for the - preview window. + will use only 30% of the columns available; the rest of the window + is used for the preview window. PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2 @@ -2841,6 +2882,28 @@ which is loaded automatically at startup (assuming :set nocp). ============================================================================== 12. History *netrw-history* {{{1 + 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 + 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 @@ -2865,843 +2928,11 @@ which is loaded automatically at startup (assuming :set nocp). now permits the "@" to be part of the user id (if there's an @ that appears to the right). - v142: Apr 06, 2011 * I modified NetrwRemoteListing() to use - shellescape(fnameescape(s:path),1) for - the benefit of those using scp://.../ - with subdirectories having spaces. - Problem reported by: Gilles Charron - Apr 18, 2011 * s:NetrwMethod() attempts to issue an - error message when given a malformed url - Apr 29, 2011 * converted most mousemaps to use s - * |g:netrw_winsize|'s meaning changed - v141: Aug 28, 2010 * added -s:... support for Windows ftp - * restored 2-leftmouse for :Rex-like return - * added balloon help for banner - Oct 26, 2010 * :Texplore changed to start from netrw's idea - of the current directory, not pwd's - Feb 10, 2011 * netrwPlugin modified to use BufReadCmd - when the "filename" ends with a "/" or a "\" - Avoids "... is a directory" message, works - inside a try-catch-endtry clause. - Feb 22, 2011 * for menus, &go =~# used to insure correct case - Apr 01, 2011 * changed g:netrw_cursorcolumn to g:netrw_cursor - In addition, there's more supported settings for - it. - v140: Jul 27, 2010 * (Lech Lorens) unexpected change of window - v139: May 14, 2010 * when viewing remote directory listings and - changing listing style, going to tree listing - mode was issuing two rather useless messages - about the buffer name. They have now been - silenced. - * (Jean Johner) with "behave mswin", clicking - on a filename in wide mode opened a new file - with a missing first letter - * (Britton Kerin) wanted netrw listings to be - buflisted; the |g:netrw_bufsettings| option - permits that. - Jun 18, 2010 * (Jan Steffens) added support for xz compression - Jun 23, 2010 * vimdiff dir1 dir2 now works - Jul 27, 2010 * (John Orr) pointed out that the intended maparg - test for gx was actually testing for g rather - than gx. Fixed. - v138: May 01, 2010 * added the bomb setting to the Save-Set-Restore - option handling (for Tony M) - May 14, 2010 * (Bram Moolenaar) netrw optionally sets cursorline - (and sometimes cursorcolumn) for its display. - This option setting was leaking through with - remote file handling. - v137: Dec 28, 2009 * modified the preview window handling for - vertically split windows. The preview - window will take up all but g:netrw_winsize - columns of the original window; those - g:netrw_winsize columns will be used for - the netrw listing. - * (Simon Dambe) removed "~" from - |g:netrw_glob_escape| under Windows - * (Bram Moolenaar) modified test for status bar - click with leftmouse. Moved code to - s:NetrwLeftmouse(). - Feb 24, 2010 * (for Jean Johner) added insert-mode maps; one - can get into insert mode with netrw via - ctrl-o :e . - Mar 15, 2010 * (Dominique Pellé) Directory with backslashes such - as foo\bar were not being entered/left properly - Mar 15, 2010 * Using :Explore .. and causing two FocusGained - events caused the directory to change. Fixed. - Mar 22, 2010 * Last fix caused problems for *//pat and */filepat - searches. - Mar 30, 2010 * With :set hidden and changing listing styles 8 - times, the tree listing buffer was being marked - as modified upon exit. Fixed. - v136: Jan 14, 2009 * extended |g:Netrw_funcref| to also handle lists - of function references - Jan 14, 2009 * (reported by Marvin Renich) with spell check - enabled, some filenamess will still being - displayed as spelling errors. - Apr 13, 2009 * (Björn Winckler) writing a file using - remote scp caused syntax highlighting problem. - Solution: avoid syntax/syntax.vim's - au Filetype * syntax setting autocommand by - checking that the current buffer has the - netrw filetype before attempting a doau - in s:NetrwSafeOptions(). - Apr 14, 2009 * (asgeo1) suggested the "T" map (|netrw-T|) - Apr 14, 2009 * marking wasn't working on executable and - other special filenames - Apr 20, 2009 * (Dennis Benzinger) files opened via http have - their syntax filetype auto-detected - Jun 19, 2009 * (Yukihiro Nakadaira) help document improvements - Jul 22, 2009 * g:netrw_browse_split will honor the - |'equalalways'| setting. - Jul 29, 2009 * implemented "I" mapping to toggle banner - (this is experimental and still being debugged) - Sep 19, 2009 * (Mike McEwan) writes via ftp now send both - g:netrw_ftpmode and g:netrw_ftpextracmd (if the - latter exists) - Dec 02, 2009 * netrw uses vimgrep several places; it now uses - "noautocmd vimgrep" (should be speedier). - Dec 03, 2009 * changed back to using -source instead of -dump - for elinks-using commands. (requested by James - Vega and Karsten Hopp) - v135: Oct 29, 2008 * using |simplify()| on directory names - (supporting handling ".."s in directory names) - Oct 31, 2008 * added special file highlighting for core dumps - under Unix/Linux. The default sorting sequence - now also gives core dumps priority. - Nov 10, 2008 * uses a call to netrw#Nread() instead of Nread - to avoid having to use fnameescape() - * fixed a tree redrawing problem (open directory, - open subdir, close subdir, close dir) - Nov 19, 2008 * sprinkled some histdel("/",-1)s through the code - in an attempt to prevent netrw from changing - the search history. - Jan 02, 2009 * |g:Netrw_funcref| included - Jan 05, 2009 * Explore */ **/ *// **// all clear explorer - variables - Jan 05, 2009 * (Panagiotis Louridas) extended s:WinPath() - to remove cygdrive from non-cygwin Windows - paths. Improved the determination as to - whether or not to do so. - Jan 13, 2009 * included contains=@NoSpell in every syntax - group for syntax/netrw.vim . - v134: Sep 30, 2008 * (Sander Marechal) provided a bugfix involving - the use of the |netrw-t| command with a remote - directory. - Sep 30, 2008 * using "x" on a remote jpg was failing; fixed. - Oct 03, 2008 * bookmarks now go on a list and are stored to - the first directory on the |'runtimepath'| in - the hopes of making their retention reliable. - History now also goes to that directory. - Oct 07, 2008 * Included check that vim 7.0 or later is in use. - Oct 07, 2008 * Improved |g:netrw_retmap| handling. - Oct 12, 2008 * Based upon Sébastien Migniot's suggestion, if - cadaver isn't available then netrw will try to - use curl for the dav://... protocol. - Oct 13, 2008 * added @*/ to netrw buffers' |'iskeyword'|setting - This lets mf (|netrw-mf|) mark directories, links - and executables. - Oct 13, 2008 * avoids a second NetrwBrowse() refresh when - g:netrw_fastbrowse is <= 1 (slow, medium speed) - Oct 22, 2008 * |g:netrw_http_xcmd| may now be overridden - independently of |g:netrw_http_cmd|. - Oct 23, 2008 * [N] added to the various Explore commands to - let users specify the width/height of new - explorer windows, overriding |g:netrw_winsize|. - v133: Aug 10, 2008 * NetReadFixup() for win95 was missing some "a:"s - Aug 12, 2008 * (Jan Minář) an error condition in NetrwMethod() - wasn't being used, resulting in "b:netrw_fname - undefined" errors - Aug 12, 2008 * (François Ingeirest) asked that "hi link" be - changed to hi default link in the netrw syntax - files. - Aug 12, 2008 * using s:NetrwUnmarkList() more often. Filenames - were being left on the global list when removed - from the buffer-local lists. - Aug 14, 2008 * (Joshua Clayton) an errant extra ")" was left in - the rcp-handling portion of NetRead(). - Sep 03, 2008 * added |'cursorline'| highlighting to thin, long, - and tree displays. - v132: Aug 06, 2008 * Fixed marked file-based obtain - Aug 08, 2008 * sourcing a file via ftp from a netrw-generated - buffer (or any buffer with |'nobl'|) left an - empty no-name buffer in its wake. Fixed. - v130: Jul 31, 2008 * trying out elinks/links for http://host/ - requests. One problem: in-page links - (such as with ...#LABEL) are not supported - * verified that Bram's modified netrwPlugin works - Aug 01, 2008 * fixed a bug: when sourcing a file via ftp, the - "filter window" was left behind. - v129: Jul 31, 2008 * bug found in non-mouse enabled vim and some - local maps - v128: Jul 30, 2008 * much work done in using shellescape() and - fnameescape() - v126: Jun 30, 2008 * after having gone to a remote directory, - was no longer taking one to the correct - entry in the help (|netrw-quickhelp|). Fixed. - Jul 01, 2008 * extracting the last filename from a wide listing - missed the last letter when |'virtualedit'| not - enabled. - Jul 01, 2008 * vim foo/bar was creating [Scratch] buffers, - where bar was also a directory - Jul 01, 2008 * numerous additional changes were made to netrw - to use fnameescape() and shellescape() instead - of escape(). Not all changes have been tested - as yet... - Jul 01, 2008 * (James Vega reported) some problems with - :NetrwSettings (due to no longer used setting - variables). - Jul 07, 2008 * Additional numerous changes to support security; - shellescape(arg,1), etc. - v125: Apr 07, 2008 * (Cristian Rigamonti) CR provides a patch; he - noted that gx was failing since its call to - netrw#NetBrowseX() wasn't updated to - netrw#NetrwBrowseX(). - * (Stanis Trendelenburg) ST provides a patch to - supports davs: (dav + ssl) - * (Rick Choi) noted that directory names comprised - of three digits were not being displayed by - the internal browser. Fixed. - * (Erik Falor) provided a patch to handle problems - with changing directory and |'acd'| option. - * (James Vega, Teemu Likonen) noted that netrw - wasn't handling multi-byte filenames/directories - correctly. Fixed. - * (Rick) found problem with g:netrw_maxfilenamelen - being overridden. - * (James Vega) pointed out that netrw was - misidentifying all files in a symbolically linked - directory as being symbolically linked - themselves. This particular problem was fixed; - however, there are now situations where - symbolically linked files will not be detected. - Really need an internal vim function to do this - identification. - Apr 17, 2008 * When g:netrw_keepdir==0, current directory - doesn't necessarily equal b:netrw_curdir - initially. Problem is due to the patch directly - above. - * Fixed qf to handle case where b:netrw_curdir - isn't the same as the current directory under - linux/macosx. - * New: |netrw-mg| (apply vimgrep to marked files) - May 05, 2008 * (Rick) pointed out that a "setlocal ts=32" was - interfering with g:netrw_maxfilenamelen - May 05, 2008 * (James Vega) a file inside a linked directory - was showing up as a symbolic link itself. - May 22, 2008 * symbolic links, fifos, and sockets are now - indicated by a trailing @, |, or =, respectively. - Jun 06, 2008 * Removed numerous bugs from the marked file - move and copy. Tested these changes under - Unix only thus far. - * :Rexplore returns to the screen position in the - netrw listing from whence the file was edited - v124: Apr 02, 2008 * (Adrian Rollett) change the line supporting the - "x" action for mac to use g:netrw_shq - v123: Feb 27, 2008 * Marked files now keeps a "global" marked file - list. The global marked file list is used to - support tag processing and vimdiff'ing - (|netrw-md| |netrw-mt|) - * Been insuring that mm and mc works with various - combinations of local and remote directories - * (Stefan Bittner) http://.../ should always have - filetype "html" -- fixed. - * (Stefan Bittner) a "?" in a http://.../ request - wasn't being handled correctly. Fixed by - removing ? from default |g:netrw_tmpfile_escape|. - * (Nico Weber) % codes in http://.../ requests - weren't being handled correctly. Fixed by - including % in default |g:netrw_fname_escape|. - * (Stefan Bittner) attempts to update Buffers.Refresh - were failing because locale use changed the menu - names. I implemented a workaround. - v122: Feb 12, 2008 * bugfix - first sorting sequence match now has - priority - Feb 14, 2008 * bugfix - sorting sequence was effectively ignoring - sequencing priority of anything following '*' - * toggling a marked file was showing incorrect list - (list was correct, but displayed matches weren't) - * |g:netrw_special_syntax| implemented - v121: Feb 11, 2008 * Bram M reported that :e file ... :e . would not - retain the alternate file. Fixed -- I hope! - * bugfix -- apparently v120 broke an explicit - :Explore dirname - v120: Jan 21, 2008 * |netrw-mt| changed to allow for target selection - based on whether or not word under cursor is a - directory or file, or if cursor is in banner - area. - * |netrw-mh| included (hiding by marked-file suffix) - * functions moved about a bit (improved - categorization) - * executable files now displayed with trailing (*) - * symbolically linked files now displayed with - trailing (@) - * Somewhen, s:NetrwMarkFileMove() got damaged. It - * is now restored (missing an endif, for example). - * |netrw-mu| implemented (unmarking marked files) - * many bugs have been removed from the marked file - system (tnx to Mark S. for feedback) - * |netrw-ms| implemented (sourcing marked files) - * fixed use of P with tree listing style - * multiple tree listing now supported - * ./ suppressed - * changed q -> qb (query bookmarks) - * implemented |netrw-qf| - * Explore now has four special list-generation - modes: */filepat **/filepat - *//pattern **//pattern - * gh (|netrw-gh|) is a shortcut for toggling the - hiding of files and directories beginning with a - dot - v119: Jan 10, 2008 * When g:netrw_keepdir is false, - NetrwOptionsRestore() had a problem - (Bill McCarthy) - Jan 11, 2008 * Netrw now shows symbolic links with a trailing - "@" and special highlighting. - Jan 15, 2008 * Changed g:netrw_noretmap -> |g:netrw_retmap|. - Changed: disabled by default at Bram's - preference. - v118: Jan 02, 2008 * Fixed a problem with Windows; - :Explore c:/path/ would not work, - but :Explore c:/path would. - * Fixed a bug in s:NetrwOptionRestore() - lcd's - argument wasn't being properly escaped so it - wouldn't handle spaces in directory names. - (Gary Johnson) - v117: Jan 02, 2008 * Fixed a problem with P; had to include - a b:netrw_curdir bypass (Bram Moolenaar) - v116: Nov 27, 2007 * netrw#LocalBrowseCheck() has &ft=="netrw" - check to prevent doing a directory listing - (was getting unexpected directory refreshes - in the middle of some function calls) - * NetrwOptionRestore moved after e! filename - in order to retain user options for editing - in s:NetrwBrowseChgDir() - Dec 12, 2007 * Bug fix -- netrw does a better job of retaining - user options when editing files under the aegis - of the browser - v115: Oct 04, 2007 * Erik Remmelzwaal pointed out that the use of - shellslash in s:GetTempfile() was incorrect - Oct 11, 2007 * Tracked down and eliminated a bug with editing - remote *.tar.gz and *.tar.bz2 files - Oct 11, 2007 * g:netrw_localmovecmd wasn't being initialized - properly, and g:netrw_localcopycmd was being - overwritten. - Oct 12, 2007 * Placed all :Rexplore and <2-leftmouse> setup - in a new support function (s:SetRexDir()). - Oct 15, 2007 * new: g:netrw_browse_split == 4; means - based selection will use previous window - Oct 20, 2007 * also checks on |'shellxquote'| to set g:netrw_shq - Oct 24, 2007 * Explore handles path/**/filename - Oct 27, 2007 * sourcing remote files often didn't work with ftp, - turns out that b:netrw_method was undefined, so - s:SaveBufVars and s:RestoreBufVars() fixed it. - v114: Sep 28, 2007 * mT, the map that invokes tags, has been improved - to support use of remote tags files. - Oct 02, 2007 * changed Netrw menu to use more submenus - v113: Sep 07, 2007 * worked out why the cursor position wasn't being - saved and restored as intended after doing such - things as deleting and renaming files. - Sep 11, 2007 * Fixed bug which effectively disabled and - maps - Sep 18, 2007 * there used to be one NetrwOptionRestore() call at - the end of the s:NetrwBrowseChgDir() function; - they're now at the end of every if..elseif..else - block. The edit-a-file one is not quite at the end - of its block; instead, it's just before the edit. - Restores user options, then this new placement - allows ftplugins, autocmds, etc to change settings - (ex. ftplugin/cpp.vim sets cindent). - Sep 19, 2007 * changed all strlen() calls to use s:Strlen(), a - function which handles utf-8 wide characters - correctly. - Sep 20, 2007 * (Nico Weber) the "x" command has been extended - to Mac's OS/X (macunix); it now uses open to - handle |netrw-x| browsing with special files. - Sep 22, 2007 * Added g:netrw_noretmap to netrw at Tony M's - request. - * Included path to NetrwRemoteRmFile() - v112: Aug 18, 2007 * added mx (|netrw-mx|) for executing arbitrary - commands on marked files - Aug 22, 2007 * more option save/restore work for - s:NetrwBrowseChgDir(); s:NetrwOptionSave() - and s:NetrwOptionRestore() now take a parameter - specifying the type of variables to be used for - saving and restoring (either "w:" or "s:") - Sep 04, 2007 * added the :NetrwClean[!] command - v111: Jul 25, 2007 * using Windows but not using Cygwin, netrw does a - "file bufname" where the bufname uses /s - instead of \s; Vim "fixes" it by changing the - bufname to use \s anyway. This meant that - NetrwGetBuffer() didn't find the appropriately - named buffer, and so would generate a new - buffer listing; hence the cursor would appear - to have been moved when doing a preview. - * added <2-leftmouse> map to return to netrw's - browser display - Aug 16, 2007 * added the mark-file system, including - maps for mf mp mt mz and mu. Modifications - made to maps for a D O and R to support - marked files. - v110: May 10, 2007 * added [ and ] maps to NetrwTreeListing - May 25, 2007 * |g:netrw_preview| included - May 29, 2007 * modified netrw#NetBrowseX to consistently use - g:netrw_shq instead of hardcoded quotes, - and modified the snippet that sets up redir - so Windows machines use "nul" instead of - "/dev/null". - Jun 01, 2007 * fixed bug -- NetGetBuffer() wasn't always - recognizing a buffer name match when it should, - thus resulting in [Scratch] buffers. - Jun 04, 2007 * Gary Johnson found a bugfix for the "c" mapping - when the directory is to be made current but - the name contains spaces. - v109: Mar 26, 2007 * if a directory name includes a "$" character, - Explore() will use expand() in an attempt to - decipher the name. - May 07, 2007 * g:netrw_use_errorwindow now allows one to - have error messages go to a reliable window - or to use a less reliable but recallable - echoerr method - May 07, 2007 * g:netrw_scpport and g:netrw_sshport support - use of -P and -p, respectively, to set port - for scp/ssh. - v108: Jan 03, 2007 * included preview map (|netrw-p|), supporting - remote browsing - * netrw can now source remote files - Jan 26, 2007 * Colton Jamieson noted that remote directory - browsing did not support alternate port - selection. This feature has now been extended - to apply to all remote browsing commands via ssh. - (list, remove/delete, rename) - Jan 31, 2007 * Luis Florit reported that @* was an invalid - register. The @* register is now only saved and - restored if |'guioptions'| contains "a". - Feb 02, 2007 * Fixed a bug that cropped up when writing files - via scp using cygwin - Feb 08, 2007 * tree listing mode managed to stop working again; - fixed again! - Feb 15, 2007 * Guido Van Hoecke reported that netrw didn't - handle browsing well with M$ ftp servers. He even - set up a temporary account for me to test with - (thanks!). Netrw now can browse M$ ftp servers. - v107: Oct 12, 2006 * bypassed the autowrite option - Oct 24, 2006 * handles automatic decompression of *.gz and *.bz2 - files - Nov 03, 2006 * Explore will highlight matching files when - **/pattern is used (and if the |'hls'| option - is set) - Nov 09, 2006 * a debugging line, when enabled, was inadvertently - bringing up help instead of simply reporting on - list contents - Nov 21, 2006 * tree listing improved (cursor remains put) - Nov 27, 2006 * fixed b:netrw_curdir bug when repeated "i"s were - pressed. - Dec 15, 2006 * considerable qty of changes, mostly to share more - code between local and remote browsing. Includes - support for tree-style listing for both remote - and local browsing. - Dec 15, 2006 * Included Peter Bengtsson's modifications to - support the Amiga. - v106: Sep 21, 2006 * removed old v:version<700 code as netrw now - requires vim 7.0 - * worked around a bug where register * was - overwritten during local browsing - v104: Sep 05, 2006 * as suggested by Rodolfo Borges, :Explore and - variants will position the cursor on the file - just having been edited - * changed default |g:netrw_sort_sequence| order - * changed b, Nb to simply mb (see |netrw-mb|) - * changed B, NB to simply gb (see |netrw-gb|) - * tree listing style (see |g:netrw_liststyle|) - * attempts to retain the alternate file - v103: Jul 26, 2006 * used Yakov Lerner's tip#1289 to improve netrw - error message display - * wide listings didn't handle files with backslashes - in their names properly. A symptom was an - inability to open files. - Aug 09, 2006 * included "t" mapping for opening tabbed windows, - both for remote and local browsing - * changed netrw_longlist to netrw_liststyle - Aug 15, 2006 * fixed one of the NB maps - Aug 22, 2006 * changed *Explore commands to use -nargs=* instead - of -nargs=?. Allows both -complete=dir _and_ the - starstar arguments to work (-nargs=? seems to - require one or the other). - Aug 23, 2006 * copied all w:.. variables across splits to - new windows - Aug 25, 2006 * when g:netrw_browsex_viewer was '-' - (see |g:netrw_browsex_viewer|) it wasn't causing - netrwFileHandlers#Invoke() to be called as it - was expected to. (tnx Steve Dugaro) - Aug 29, 2006 * changed NetBrowseX() to use "setlocal ... noswf" - instead of "set ... noswf" (tnx Benji Fisher) - Aug 31, 2006 * tabs and fastbrowse<=1 didn't work together. - v102: Jun 15, 2006 * chgd netrwPlugin to call netrw#LocalBrowseCheck() - * bugfix: g:netrw_keepdir==0 had stopped working - Jul 06, 2006 * bugfix: NetOptionSave/Restore now saves/restores - the unnamed register (|registers|) - Jul 07, 2006 * |g:netrw_menu| support included - Jul 13, 2006 * :Texplore command implemented - Jul 17, 2006 * NetSplit and (Local|Net)BrowseChgDir() were both - splitting windows. This affected o, v, and - g:netrw_browse_split. - Jul 20, 2006 * works around wildignore setting (was causing - netrw's local browser not to list wildignore'd - files) - Jul 24, 2006 * acts as a for selecting a file - acts as a for deleting a file - v100: May 14, 2006 * when using Windows and shell==cmd.exe, the - default for g:netrw_ignorenetrc is now 1 - * bugfix: unwanted ^Ms now removed - (affected shell==cmd.exe - Windows) - * added Bookmarks and History to the menu - * an error message about non-existing - w:netrw_longlist was appearing during attempts to - Explore (fixed) - * g:netrw_shq now available to make netrw use - specified style of quotes for commands - May 29, 2006 * user NFH_*() functions were inadvertently being - ignored - * fixed a Windows non-cygwin ftp handling problem. - * hiding pattern candidate separators included some - characters it shouldn't have (tnx to Osei Poku) - Jun 01, 2006 * for browsing, netrw was supposed to use "dir" - instead of "ls -lF" when using - ftp+non-cygwin+windows. Fixed. - * an inadvertently left-in-place debugging statement - was preventing use of the "x" key with browsing. - Jun 05, 2006 * g:netrw_nogx available to prevent making the gx - map (see |g:netrw_nogx|) - * bugfix, Explore wouldn't change directory - properly (vim ., :Explore subdirname) - Jun 06, 2006 * moved history to 2nd line in Netrw menu - * fixed delete for unix-based systems - Jun 07, 2006 * x key now works for windows-noncygwin-ftp - Jun 08, 2006 * Explore */pat and **//pat now wraps - v99: May 09, 2006 * g:netrw_browse_split=3 for opening files in new - tabs implemented. - May 12, 2006 * deletes temporary file at end of NetRead() - * visual mode based Obtain implemented - * added -complete=dir to the various Explore - commands - v98: May 02, 2006 * the "p" key didn't work properly when the browsing - directory name had spaces in it. - v97: May 01, 2006 * exists("&acd") now used to determine if - the 'acd' option exists - * "obtain" now works again under Windows - v96: * bugfix - the |'acd'| option is not always defined - but is now bypassed only when it is - v95: * bugfix - Hiding mode worked correctly (don't show - any file matching any of the g:netrw_hide - patterns), but showing mode was showing only those - files that didn't match any of the g:netrw_hide - patterns. Instead, it now shows all files that - match any of the g:netrw_hide patterns (the - difference between a logical and and logical or). - v94: * bugfix - a Decho() had a missing quote; only - affects things when debugging was enabled. - v93: * bugfix - removed FocusGained event from causing a - slow-browser refresh for Windows - v92: * :Explore **//pattern implemented - (**/filepattern was already taken) - v91: * :Explore */pattern implemented - * |'acd'| option bypassed - v90: * mark ', as suggested by Yegappan Lakshmanan, used - to help guarantee entry into the jump list when - appropriate. - * and are no longer defined until a - :Explore **/pattern is used (if the user already - has a map for them). They will be defined for new - browser windows from that point forward. - v89: * A , , :Nexplore, or a :Pexplore - without having first done an :Explore **/pattern - (see |netrw-starstar|) caused - a lot of unhelpful error messages to appear - v88: * moved DrChip.Netrw menu to Netrw. Now has - priority 80 by default. - g:NetrwTopLvlMenu == "Netrw" and can be changed - by the user to suit. The priority is given by - g:NetrwMenuPriority. - * Changed filetype for browser displays from - netrwlist to netrw. - v87: * bug fix -- menus were partially disappearing - v85: * bug fix -- missing an endif - * bug fix -- handles spaces in names and directories - when using ftp-based browsing - v83: * disabled stop-acd handling; the change in directory - handling may allow acd to be used again. - * D was refusing to delete remote files/directories - in wide listing mode. - v81: * FocusGained also used to refresh/wipe local browser - directory buffers - * (bugfix) netrw was leaving [Scratch] buffers behind - when the user had the "hidden" option set. The - 'hidden' option is now bypassed. - v80: * ShellCmdPost event used in conjunction with - g:netrw_fastbrowse to refresh/wipe local browser - directory buffers. - v79: * directories are now displayed with nowrap - * (bugfix) if the column width was smaller than the - largest file's name, then netrw would hang when - using wide-listing mode - fixed - * g:netrw_fastbrowse introduced - v78: * progress has been made on allowing spaces inside - directory names for remote work (reading, writing, - browsing). (scp) - v77: * Mikolaj Machowski fixed a bug in a substitute cmd - * g:netrw_browsex_viewer implemented - * Mikolaj Machowski pointed out that gnome-open is - often executable under KDE systems, although it is - effectively not functional. NetBrowseX now looks - for "kicker" as a running process to determine if - KDE is actually running. - * Explorer's O functionality was inadvertently left - out. Netrw now does the same thing, but with the - "P" key. - * added g:netrw_browse_split option - * fixed a bug where the directory contained a "." but - the file didn't (was treating the dirname from "." - onwards as a suffix) - v76: * "directory is missing" error message now restores - echo highlighting - v75: * file://... now conforms to RFC2396 (thanks to - S. Zacchiroli) - * if the binary option is set, then NetWrite() will - only write the whole file (line numbers don't make - sense with this). Supports writing of tar and zip - files. - v74: * bugfix (vim, then :Explore) now works - * ctrl-L keeps cursor at same screen location (both - local and remote browsing) - * netrw now can read remote zip and tar files - * Obtain now uses WinXP ftp+.netrc successfully - v73: * bugfix -- scp://host/path/file was getting named - incorrectly - * netrw detects use of earlier-than-7.0 version of - vim and issues a pertinent error message. - * netrwSettings.vim is now uses autoloading. Only - is needed as a pure plugin - (ie. always loaded). - v72: * bugfix -- formerly, one could prevent the loading - of netrw by "let g:loaded_netrw=1"; when - autoloading became supported, this feature was - lost. It is now restored. - v71: * bugfix -- made some "set nomodifiable"s into - setlocal variants (allows :e somenewfile to be - modifiable as usual) - * NetrwSettings calls a netrw function, thereby - assuring that netrw has loaded. However, if netrw - does not load for whatever reason, then - NetrwSettings will now issue a warning message. - * For what reason I don't recall, when wget and fetch - are both not present, and an attempt to read a - http://... url is made, netrw exited. It now only - returns. - * When ch=1, on the second and subsequent uses of - browsing Netrw would issue a blank line to clear - the echo'd messages. This caused an annoying - "Hit-Enter" prompt; now a blank line message - is echo'd only if &ch>1. - v70: * when using |netrw-O|, the "Obtaining filename" - message is now shown using |hl-User9|. If User9 - has not been defined, netrw itself will define it. - v69: * Bugfix: win95/98 machines were experiencing a - "E121: Undefined variable: g:netrw_win95ftp" - message - v68: * double-click-leftmouse selects word under mouse - v67: * Passwords which contain blanks will now be - surrounded by double-quotes automatically (Yongwei) - v66: * Netrw now seems to work with a few more Windows - situations - * O now obtains a file: remote browsing - file -> local copy, locally browsing - file -> current directory (see :pwd) - * i now cycles between thin, long, and wide listing - styles - * NB and Nb are maps that are always available; - corresponding B and b maps are only available when - not using wide listing in order to allow them to - be used for motions - v65: * Browser functions now use NetOptionSave/Restore; in - particular, netrw now works around the report - setting - v64: * Bugfix - browsing a "/" directory (Unix) yielded - buffers named "[Scratch]" instead of "/" - * Bugfix - remote browsing with ftp was omitting - the ./ and ../ - v63: * netrw now takes advantage of autoload (needs 7.0) - * Bugfix - using r (to reverse sort) working again - v62: * Bugfix - spaces allowed again in directory names - with g:netrw_keepdir=0. In fact, I've tested netrw - with most ANSI punctuation marks for directory - names. - * Bugfix - NetrwSettings gave errors when - g:netrw_silent had not be set. - v61: * Document upgrade -- netrw variable-based settings - all should have tags. Supports NetrwSettings cmd. - * Several important variables are window-oriented. - Netrw has to transfer these across a window split. - See s:BufWinVars() and s:UseBufWinVars(). - v60: * When using the i map to switch between long and - short listings, netrw will now keep cursor on same - line - * "Match # of #" now uses status line - * :Explore **/*.c will now work from a - non-netrw-browser window - * :Explore **/patterns can now be run in separate - browser windows - * active banner (hit will cause various things - to happen) - v59: * bugfix -- another keepalt work-around installed - (for vim6.3) - * "Match # of #" for Explore **/pattern matches - v58: * Explore and relatives can now handle - **/somefilepattern (v7) - * Nexplore and Pexplore introduced (v7). shift-down - and shift-up cursor keys will invoke Nexplore and - Pexplore, respectively. - * bug fixed with o and v - * autochdir only worked around for vim when it has - been compiled with either - |+netbeans_intg| or |+sun_workshop| - * Under Windows, all directories and files were - being preceded with a "/" when local browsing. - Fixed. - * When: syntax highlighting is off, laststatus=2, and - remote browsing is used, sometimes the laststatus - highlighting bleeds into the entire display. Work - around - do an extra redraw in that case. - * Bugfix: when g:netrw_keepdir=0, due to re-use of - buffers, netrw didn't change the directory when it - should've - * Bugfix: D and R commands work again - v57: * Explore and relatives can now handle RO files - * reverse sort restored with vim7's sort command - * g:netrw_keepdir now being used to keep the current - directory unchanged as intended (sense change) - * vim 6.3 still supported - v56: * LocalBrowse now saves autochdir setting, unsets it, - and restores it before returning. - * using vim's rename() instead of system + - local_rename variable - * avoids changing directory when g:netrw_keepdir is - false - v55: * -bar used with :Explore :Sexplore etc to allow - multiple commands to be separated by |s - * browser listings now use the "nowrap" option - * browser: some unuseful error messages now - suppressed - v54: * For backwards compatibility, Explore and Sexplore - have been implemented. In addition, Hexplore and - Vexplore commands are available, too. - * used instead of in the - transparency support (BufReadCmd, FileReadCmd, - FileWriteCmd) - * ***netrw*** prepended to various error messages - netrw may emit - * g:netrw_port used instead of b:netrw_port for scp - * any leading [:#] is removed from port numbers - v53: * backslashes as well as slashes placed in various - patterns (ex. g:netrw_sort_sequence) to better - support Windows - v52: * nonumber'ing now set for browsing buffers - * when the hiding list hid all files, error messages - ensued. Fixed - * when browsing, swf is set, but directory is not - set, when netrw was attempting to restore options, - vim wanted to save a swapfile to a local directory - using an url-style path. Fixed - v51: * cygwin detection now automated - (using windows and &shell is bash) - * customizable browser "file" rejection patterns - * directory history - * :[range]w url now supported (ie. netrw uses a - FileWriteCmd event) - * error messages have a "Press to continue" to - allow them to be seen - * directory browser displays no longer bother the - swapfile - * u/U commands to go up and down the history stack - * history stack may be saved with viminfo with it's - "!" option - * bugfixes associated with unwanted [No Files] - entries - v50: * directories now displayed using buftype=nofile; - should keep the directory names as-is - * attempts to remove empty "[No File]" buffers - leftover from :file ..name.. commands - * bugfix: a "caps-lock" editing difficulty left in - v49 was fixed - * syntax highlighting for "Showing:" the hiding list - included - * bookmarks can now be retained if "!" is in the - viminfo option - v49: * will use ftp for http://.../ browsing - v48: * One may use ftp to do remote host file browsing - * (windows and !cygwin) remote browsing with ftp can - now use the "dir" command internally to provide - listings - * g:netrw_keepdir now allows one to keep the initial - current directory as the current directory - (normally the local file browser makes the - currently viewed directory the current directory) - * g:netrw_alto and g:netrw_altv now support - alternate placement of windows started with o or v - * Nread ? and Nwrite ? now uses echomsg (instead of - echo) so :messages can repeat showing the help - * bugfix: avoids problems with partial matches of - directory names to prior buffers with longer names - * one can suppress error messages with g:netrw_quiet - ctrl-h used - * instead of h for editing hiding list one - may edit the sorting sequence with the S map, which - now allows confirmation of deletion with - [y(es) n(o) a(ll) q(uit)] - * the "x" map now handles special file viewing with: - (windows) rundll32 url.dll (gnome) gnome-open (kde) - kfmclient If none of these are on the executable - path, then netrwFileHandlers.vim is used. - * directory bookmarking during both local and remote - browsing implemented - * one may view all, use the hiding list to suppress, - or use the hiding list to show-only remote and - local file/directory listings - * improved unusual file and directory name handling - preview window support - v47: * now handles local browsing. - v46: * now handles remote browsing - * g:netrw_silent (if 1) will cause all transfers to - be silent - v45: * made the [user@]hostname:path form a bit more - restrictive to better handle errors in using - protocols (e.g. scp:usr@host:file was being - recognized as an rcp request) - v44: * changed from "rsync -a" to just "rsync" - * somehow an editing error messed up the test to - recognize use of the fetch method for NetRead. - * more debugging statements included - v43: * moved "Explanation" comments to help - file as "Network Reference" (|netrw-ref|) - * now uses Dfunc() Decho() and Dret() for - debugging - * removed superfluous NetRestorePosn() calls - v42: * now does BufReadPre and BufReadPost events on - file:///* and file://localhost/* - v41: * installed file:///* and file://localhost/* handling - v40: * prevents redraw when a protocol error occurs so - that the user may see it - v39: * sftp support - v38: * Now uses NetRestorePosn() calls with Nread/Nwrite - commands - * Temporary files now removed via bwipe! instead of - bwipe (thanks to Dave Roberts) - v37: * Claar's modifications which test if ftp is - successful, otherwise give an error message - * After a read, the alternate file was pointing to - the temp file. The temp file buffer is now wiped - out. - * removed silent from transfer methods so user can - see what's happening + 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). ============================================================================== diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 4bd181aca0..5a83260915 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.3. Last change: 2012 Mar 28 +*syntax.txt* For Vim version 7.3. Last change: 2012 Apr 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2836,6 +2836,18 @@ following sets of characters: > By leaving one or more of these out, the associated conceal-character substitution will not be made. + *g:tex_isk* + Tex: Controlling What's In A Keyword~ + +(La)Tex keywords normally use the characters 0-9,a-z,A-Z,192-255 only +but the "_" is the only one that causes problems. So, by default, +syntax/tex.vim overrides the usual |'iskeyword'| setting (using |setlocal|) +with one that works for LaTeX. + +However, one may override this iskeyword re-setting by setting the +variable, g:tex_isk, in one's .vimrc to whatever one wishes and +it will be used instead. + TF *tf.vim* *ft-tf-syntax* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 0ddf7cc704..1e4e57db54 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.3. Last change: 2012 Mar 28 +*todo.txt* For Vim version 7.3. Last change: 2012 Apr 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -43,6 +43,8 @@ Discussion about canonicalization of Hebrew. (Ron Aaron, 2011 April 10) Stack trace of crash: http://vpaste.net/GBt9S (Alexandre Provencio) +":help!" gives error, should use current language. (thinkca, 2012 Apr 1) + Once syntax and other runtime files have been fixed: add "set cp" to check.vim. Use a function to run both with 'cp' and 'nocp'. @@ -78,17 +80,6 @@ When exiting with unsaved changes, selecting an existing file in the file dialog, there is no dialog to ask whether the existing file should be overwritten. (Felipe G. Nievinski, 2011 Dec 22) -Using Ctrl-] in a mapping does not expand abbreviations. Patch by Christian -Brabandt, 2012 Mar 2. - -Patch to fix member confusion in Lua interface. (Taro Muraoka, 2012 Jan 8) -Update Jan 9. -Carvalho merged the patch: New version 2012 Jan 19. - -Patch for option in 'cino' to specify more indent for continued conditions. -(Lech Lorens, 2011 Nov 27) -Isn't this already possible? Update 2012 Feb 15. - Docs fix for v:register. (Ingo Karkat, 2011 Sep 26, 27) v:register doesn't work exactly as expected. (David Fishburn, 2011 Sep 20) @@ -112,7 +103,7 @@ Matsumoto, 2012 Jan 30) Patch to add completion for :history command. (Dominique Pelle, 2012 Feb 26) Patch for 'backupcopy' default behavior for symlinks on Windows. (David Pope, -2012 Mar 21) +2012 Mar 21, update Mar 31) Use a count before "v" and "V" to select that many characters or lines? (Kikyous) @@ -166,6 +157,12 @@ Needs more work. Pinged 2012 Jan 4. Patch 7.3.116 was the wrong solution. Christian Brabandt has another incomplete patch. (2011 Jul 13) +'cursorline' is drawn incorrectly in diff mode. Patch by Christian Brabandt, +2012 Apr 2. + +'cursorline' works on a text line only. Add 'cursorscreenline' for +highlighting the screen line. (Christian Brabandt, 2012 Mar 31) + With concealed text mouse click doesn't put the cursor in the right position. (Herb Sitz) Fix by Christian Brabandt, 2011 Jun 16. Doesn't work properly, need to make the change in where RET_WIN_BUF_CHARTABSIZE() is called. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 83d07bc102..2a2c0b76c7 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: 2012 Mar 28 +" Last Change: 2012 Apr 05 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -2142,6 +2142,9 @@ au BufNewFile,BufReadPost *.tssop setf tssop " TSS - Command Line (temporary) au BufNewFile,BufReadPost *.tsscl setf tsscl +" TWIG files +au BufNewFile,BufReadPost *.twig setf twig + " Motif UIT/UIL files au BufNewFile,BufRead *.uit,*.uil setf uil diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index 07da608635..8a66c840d1 100644 --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -20,7 +20,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v143" +let g:loaded_netrwPlugin = "v145" if v:version < 702 echohl WarningMsg | echo "***netrw*** you need vim version 7.2 for this version of netrw" | echohl None finish From 076f2a589837d97ca77ac4950e8ff61b047cebcc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 6 Apr 2012 13:56:04 +0200 Subject: [PATCH 37/45] updated for version 7.3.493 Problem: Two unused variables. Solution: Remove them. (Hong Xu) --- src/misc1.c | 2 -- src/version.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/misc1.c b/src/misc1.c index ddb8889331..34359a0b0d 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -6489,7 +6489,6 @@ get_c_indent() int cont_amount = 0; /* amount for continuation line */ int original_line_islabel; int added_to_amount = 0; - int is_if_for_while = 0; for (options = curbuf->b_p_cino; *options; ) { @@ -6876,7 +6875,6 @@ get_c_indent() pos_T cursor_save = curwin->w_cursor; pos_T outermost; char_u *line; - int look_col; trypos = &our_paren_pos; do { diff --git a/src/version.c b/src/version.c index 25cbb18418..e5102e53b5 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 493, /**/ 492, /**/ From bcc9d82be42e07ed8d7091e1fa3c08e202ade3e9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 6 Apr 2012 13:56:04 +0200 Subject: [PATCH 38/45] Added tag v7-3-493 for changeset bf5960ec2532 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index c9bd3315b8..b89f5a2cda 100644 --- a/.hgtags +++ b/.hgtags @@ -1829,3 +1829,4 @@ c1a6e1745cb521f863e63670e6c22c1c682ab4b1 v7-3-489 b067b8b81be9c2839df75824da2e88da24b07b54 v7-3-490 e070b34fe35e6e8c40ec31a08196dd81353db4e5 v7-3-491 214c7ec1c8f995664d5684da8cbeaaa86850468f v7-3-492 +bf5960ec253293b7240f59a7682f2e862dacd205 v7-3-493 From 8a20e77cce77017f4b4aab23b6887be6264123de Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 6 Apr 2012 14:31:00 +0200 Subject: [PATCH 39/45] updated for version 7.3.494 Problem: Can't compile with Lua 9.1 or dynamic Lua. Solution: Fix dll_ methods. Fix luado(). (Muraoka Taro, Luis Carvalho) --- src/if_lua.c | 17 ++++++++++++----- src/version.c | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/if_lua.c b/src/if_lua.c index da88aab780..ea6d1bd504 100644 --- a/src/if_lua.c +++ b/src/if_lua.c @@ -95,6 +95,7 @@ static luaV_Dict *luaV_pushdict (lua_State *L, dict_T *dic); #define luaL_loadbufferx dll_luaL_loadbufferx #define luaL_argerror dll_luaL_argerror #endif +#define luaL_checkany dll_luaL_checkany #define luaL_checklstring dll_luaL_checklstring #define luaL_checkinteger dll_luaL_checkinteger #define luaL_optinteger dll_luaL_optinteger @@ -117,8 +118,8 @@ static luaV_Dict *luaV_pushdict (lua_State *L, dict_T *dic); #define lua_pcallk dll_lua_pcallk #define lua_getglobal dll_lua_getglobal #define lua_setglobal dll_lua_setglobal -#define lua_typename dll_lua_typename #endif +#define lua_typename dll_lua_typename #define lua_close dll_lua_close #define lua_gettop dll_lua_gettop #define lua_settop dll_lua_settop @@ -151,6 +152,7 @@ static luaV_Dict *luaV_pushdict (lua_State *L, dict_T *dic); #define lua_rawset dll_lua_rawset #define lua_rawseti dll_lua_rawseti #define lua_setmetatable dll_lua_setmetatable +#define lua_next dll_lua_next /* libs */ #define luaopen_base dll_luaopen_base #define luaopen_table dll_luaopen_table @@ -177,6 +179,7 @@ int (*dll_luaL_loadfilex) (lua_State *L, const char *filename, const char *mode) int (*dll_luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode); int (*dll_luaL_argerror) (lua_State *L, int numarg, const char *extramsg); #endif +void (*dll_luaL_checkany) (lua_State *L, int narg); const char *(*dll_luaL_checklstring) (lua_State *L, int numArg, size_t *l); lua_Integer (*dll_luaL_checkinteger) (lua_State *L, int numArg); lua_Integer (*dll_luaL_optinteger) (lua_State *L, int nArg, lua_Integer def); @@ -201,8 +204,8 @@ int (*dll_lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, int ctx, lua_CFunction k); void (*dll_lua_getglobal) (lua_State *L, const char *var); void (*dll_lua_setglobal) (lua_State *L, const char *var); -const char *(*dll_lua_typename) (lua_State *L, int tp); #endif +const char *(*dll_lua_typename) (lua_State *L, int tp); void (*dll_lua_close) (lua_State *L); int (*dll_lua_gettop) (lua_State *L); void (*dll_lua_settop) (lua_State *L, int idx); @@ -235,6 +238,7 @@ void (*dll_lua_setfield) (lua_State *L, int idx, const char *k); void (*dll_lua_rawset) (lua_State *L, int idx); void (*dll_lua_rawseti) (lua_State *L, int idx, int n); int (*dll_lua_setmetatable) (lua_State *L, int objindex); +int (*dll_lua_next) (lua_State *L, int idx); /* libs */ int (*dll_luaopen_base) (lua_State *L); int (*dll_luaopen_table) (lua_State *L); @@ -268,6 +272,7 @@ static const luaV_Reg luaV_dll[] = { {"luaL_loadbufferx", (luaV_function) &dll_luaL_loadbufferx}, {"luaL_argerror", (luaV_function) &dll_luaL_argerror}, #endif + {"luaL_checkany", (luaV_function) &dll_luaL_checkany}, {"luaL_checklstring", (luaV_function) &dll_luaL_checklstring}, {"luaL_checkinteger", (luaV_function) &dll_luaL_checkinteger}, {"luaL_optinteger", (luaV_function) &dll_luaL_optinteger}, @@ -290,8 +295,8 @@ static const luaV_Reg luaV_dll[] = { {"lua_pcallk", (luaV_function) &dll_lua_pcallk}, {"lua_getglobal", (luaV_function) &dll_lua_getglobal}, {"lua_setglobal", (luaV_function) &dll_lua_setglobal}, - {"lua_typename", (luaV_function) &dll_lua_typename}, #endif + {"lua_typename", (luaV_function) &dll_lua_typename}, {"lua_close", (luaV_function) &dll_lua_close}, {"lua_gettop", (luaV_function) &dll_lua_gettop}, {"lua_settop", (luaV_function) &dll_lua_settop}, @@ -324,6 +329,7 @@ static const luaV_Reg luaV_dll[] = { {"lua_rawset", (luaV_function) &dll_lua_rawset}, {"lua_rawseti", (luaV_function) &dll_lua_rawseti}, {"lua_setmetatable", (luaV_function) &dll_lua_setmetatable}, + {"lua_next", (luaV_function) &dll_lua_next}, /* libs */ {"luaopen_base", (luaV_function) &dll_luaopen_base}, {"luaopen_table", (luaV_function) &dll_luaopen_table}, @@ -1828,7 +1834,7 @@ ex_luado(exarg_T *eap) } luaV_setrange(L, eap->line1, eap->line2); luaL_buffinit(L, &b); - luaL_addlstring(&b, "return function(line) ", 22); /* header */ + luaL_addlstring(&b, "return function(line, linenr) ", 30); /* header */ luaL_addlstring(&b, s, strlen(s)); luaL_addlstring(&b, " end", 4); /* footer */ luaL_pushresult(&b); @@ -1845,7 +1851,8 @@ ex_luado(exarg_T *eap) { lua_pushvalue(L, -1); /* function */ luaV_pushline(L, curbuf, l); /* current line as arg */ - if (lua_pcall(L, 1, 1, 0)) + lua_pushinteger(L, l); /* current line number as arg */ + if (lua_pcall(L, 2, 1, 0)) { luaV_emsg(L); break; diff --git a/src/version.c b/src/version.c index e5102e53b5..0d8348b467 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 494, /**/ 493, /**/ From 0254977d9023225df02027ce54b36bef79c2511b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 6 Apr 2012 14:31:00 +0200 Subject: [PATCH 40/45] Added tag v7-3-494 for changeset 5240610f2778 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b89f5a2cda..bb8c626508 100644 --- a/.hgtags +++ b/.hgtags @@ -1830,3 +1830,4 @@ b067b8b81be9c2839df75824da2e88da24b07b54 v7-3-490 e070b34fe35e6e8c40ec31a08196dd81353db4e5 v7-3-491 214c7ec1c8f995664d5684da8cbeaaa86850468f v7-3-492 bf5960ec253293b7240f59a7682f2e862dacd205 v7-3-493 +5240610f277823478983e3f04abfbed4e85141cf v7-3-494 From cc290f5bf3c086b68833458a5a17f4f93392d842 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 9 Apr 2012 20:42:26 +0200 Subject: [PATCH 41/45] updated for version 7.3.495 Problem: Compiler warnings. Solution: Add function declaration. Remove "offset" argument. --- src/misc1.c | 12 ++++++------ src/version.c | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/misc1.c b/src/misc1.c index 34359a0b0d..f9513e2314 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -4972,6 +4972,7 @@ static int cin_isif __ARGS((char_u *)); static int cin_iselse __ARGS((char_u *)); static int cin_isdo __ARGS((char_u *)); static int cin_iswhileofdo __ARGS((char_u *, linenr_T, int)); +static int cin_is_if_for_while_before_offset __ARGS((char_u *line, int *poffset)); static int cin_iswhileofdo_end __ARGS((int terminated, int ind_maxparen, int ind_maxcomment)); static int cin_isbreak __ARGS((char_u *)); static int cin_is_cpp_baseclass __ARGS((colnr_T *col)); @@ -5771,17 +5772,17 @@ cin_iswhileofdo(p, lnum, ind_maxparen) /* XXX */ } /* - * Check whether in "p" there is an "if", "for" or "while" before offset. + * Check whether in "p" there is an "if", "for" or "while" before "*poffset". * Return 0 if there is none. * Otherwise return !0 and update "*poffset" to point to the place where the * string was found. */ static int -cin_is_if_for_while_before_offset(line, offset, poffset) +cin_is_if_for_while_before_offset(line, poffset) char_u *line; - size_t offset; int *poffset; { + int offset = *poffset; if (offset-- < 2) return 0; @@ -5805,8 +5806,8 @@ cin_is_if_for_while_before_offset(line, offset, poffset) goto probablyFound; } } - return 0; + probablyFound: if (!offset || !vim_isIDc(line[offset - 1])) { @@ -6890,8 +6891,7 @@ get_c_indent() line = ml_get(outermost.lnum); is_if_for_while = - cin_is_if_for_while_before_offset(line, outermost.col, - &outermost.col); + cin_is_if_for_while_before_offset(line, &outermost.col); } amount = skip_label(our_paren_pos.lnum, &look, ind_maxcomment); diff --git a/src/version.c b/src/version.c index 0d8348b467..65b8c58255 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 495, /**/ 494, /**/ From 42102dd13b23f7355998fef4129815e0c0ec848b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 9 Apr 2012 20:42:27 +0200 Subject: [PATCH 42/45] Added tag v7-3-495 for changeset 27f6a22ff88e --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index bb8c626508..a61b686d65 100644 --- a/.hgtags +++ b/.hgtags @@ -1831,3 +1831,4 @@ e070b34fe35e6e8c40ec31a08196dd81353db4e5 v7-3-491 214c7ec1c8f995664d5684da8cbeaaa86850468f v7-3-492 bf5960ec253293b7240f59a7682f2e862dacd205 v7-3-493 5240610f277823478983e3f04abfbed4e85141cf v7-3-494 +27f6a22ff88eea07f24163fe470b7335f3c1b32b v7-3-495 From f2db25d3167a78bb1e058c0ce3265ea1d4ac7fd0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 13 Apr 2012 19:11:20 +0200 Subject: [PATCH 43/45] updated for version 7.3.496 Problem: MS-DOS: When "diff" trips over difference in line separators some tests fail. Solution: Make some .ok files use unix line separators. (David Pope) --- src/testdir/Make_dos.mak | 3 ++- src/testdir/Make_ming.mak | 2 ++ src/version.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak index 4498c1c81e..c3006225ef 100644 --- a/src/testdir/Make_dos.mak +++ b/src/testdir/Make_dos.mak @@ -52,7 +52,8 @@ win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) 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 + -$(VIMPROG) -u dos.vim --noplugin "+argdo set ff=unix|upd" +q \ + dotest.in test60.ok test71.ok test74.ok clean: -del *.out diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak index 4aee8cdef8..dfc1487dff 100644 --- a/src/testdir/Make_ming.mak +++ b/src/testdir/Make_ming.mak @@ -75,6 +75,8 @@ win32: fixff $(SCRIPTS16) $(SCRIPTS) $(SCRIPTS32) 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 clean: -$(DEL) *.out diff --git a/src/version.c b/src/version.c index 65b8c58255..c0d60e8aad 100644 --- a/src/version.c +++ b/src/version.c @@ -714,6 +714,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 496, /**/ 495, /**/ From 2e48a0f7e78939f6ab2e33b8c14549b62b226b0e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 13 Apr 2012 19:11:20 +0200 Subject: [PATCH 44/45] Added tag v7-3-496 for changeset 3daba355b0c1 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index a61b686d65..866b5d2675 100644 --- a/.hgtags +++ b/.hgtags @@ -1832,3 +1832,4 @@ e070b34fe35e6e8c40ec31a08196dd81353db4e5 v7-3-491 bf5960ec253293b7240f59a7682f2e862dacd205 v7-3-493 5240610f277823478983e3f04abfbed4e85141cf v7-3-494 27f6a22ff88eea07f24163fe470b7335f3c1b32b v7-3-495 +3daba355b0c15ef66a9d2810ae7c7cc534dccf62 v7-3-496 From f5ffa1956584be02cba539d0b51aef2f270f6e7d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 13 Apr 2012 23:04:47 +0200 Subject: [PATCH 45/45] Updated runtime files. --- runtime/autoload/netrw.vim | 1 - runtime/doc/eval.txt | 4 ++-- runtime/doc/if_lua.txt | 15 ++++++++------- runtime/doc/map.txt | 4 ++-- runtime/doc/syntax.txt | 4 ++-- runtime/doc/tags | 18 +++++++++++++----- runtime/doc/todo.txt | 4 +++- runtime/doc/windows.txt | 8 +++++--- runtime/filetype.vim | 14 ++++++++------ runtime/ftplugin/git.vim | 5 +++-- runtime/ftplugin/gitcommit.vim | 17 ++++++++--------- runtime/indent/gitconfig.vim | 4 +++- runtime/syntax/asm.vim | 7 ++++++- runtime/syntax/django.vim | 6 +++--- runtime/syntax/gitcommit.vim | 8 ++++---- runtime/syntax/gitrebase.vim | 5 ++++- 16 files changed, 74 insertions(+), 50 deletions(-) diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 3165933452..2700a8c825 100644 --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -324,7 +324,6 @@ call s:NetrwInit("g:netrw_localmkdir","mkdir") if !executable(g:netrw_localmkdir) call netrw#ErrorMsg(s:NOTE,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) endif -endif call s:NetrwInit("g:netrw_remote_mkdir","mkdir") if exists("g:netrw_local_movecmd") let g:netrw_localmovecmd= g:netrw_local_movecmd" diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 321995ec2e..73ea05eb81 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.3. Last change: 2012 Apr 01 +*eval.txt* For Vim version 7.3. Last change: 2012 Apr 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5092,7 +5092,7 @@ setline({lnum}, {text}) *setline()* will be set to the items in the list. Example: > :call setline(5, ['aaa', 'bbb', 'ccc']) < This is equivalent to: > - :for [n, l] in [[5, 6, 7], ['aaa', 'bbb', 'ccc']] + :for [n, l] in [[5, 'aaa'], [6, 'bbb'], [7, 'ccc']] : call setline(n, l) :endfor < Note: The '[ and '] marks are not set. diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index 718a229ebf..6626e383ea 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -59,13 +59,14 @@ Example: < *:luado* -:[range]luado {body} Execute Lua function "function (line) {body} end" for - each line in the [range], with the function argument - being set to the text of each line in turn, without a - trailing . If the value returned by the function - is a string it becomes the text of the line in the - current turn. The default for [range] is the whole - file: "1,$". {not in Vi} +:[range]luado {body} Execute Lua function "function (line, linenr) {body} + end" for each line in the [range], with the function + argument being set to the text of each line in turn, + without a trailing , and the current line number. + If the value returned by the function is a string it + becomes the text of the line in the current turn. The + default for [range] is the whole file: "1,$". + {not in Vi} Examples: > diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index f117f6fb39..0c46d45426 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.3. Last change: 2012 Feb 02 +*map.txt* For Vim version 7.3. Last change: 2012 Apr 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1188,7 +1188,7 @@ reported if any are supplied). However, it is possible to specify that the command can take arguments, using the -nargs attribute. Valid cases are: -nargs=0 No arguments are allowed (the default) - -nargs=1 Exactly one argument is require, it includes spaces + -nargs=1 Exactly one argument is required, it includes spaces -nargs=* Any number of arguments are allowed (0, 1, or many), separated by white space -nargs=? 0 or 1 arguments are allowed diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 5a83260915..f6db8f780d 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.3. Last change: 2012 Apr 05 +*syntax.txt* For Vim version 7.3. Last change: 2012 Apr 06 VIM REFERENCE MANUAL by Bram Moolenaar @@ -2841,7 +2841,7 @@ substitution will not be made. (La)Tex keywords normally use the characters 0-9,a-z,A-Z,192-255 only but the "_" is the only one that causes problems. So, by default, -syntax/tex.vim overrides the usual |'iskeyword'| setting (using |setlocal|) +syntax/tex.vim overrides the usual |'iskeyword'| setting (using |:setlocal|) with one that works for LaTeX. However, one may override this iskeyword re-setting by setting the diff --git a/runtime/doc/tags b/runtime/doc/tags index 8d7e1d6e7b..0e5bacd720 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -3630,9 +3630,6 @@ E287 mbyte.txt /*E287* E288 mbyte.txt /*E288* E289 mbyte.txt /*E289* E29 change.txt /*E29* -E290 mbyte.txt /*E290* -E291 mbyte.txt /*E291* -E292 mbyte.txt /*E292* E293 message.txt /*E293* E294 message.txt /*E294* E295 message.txt /*E295* @@ -4995,6 +4992,7 @@ cino-g indent.txt /*cino-g* cino-h indent.txt /*cino-h* cino-i indent.txt /*cino-i* cino-j indent.txt /*cino-j* +cino-k indent.txt /*cino-k* cino-l indent.txt /*cino-l* cino-m indent.txt /*cino-m* cino-n indent.txt /*cino-n* @@ -5829,6 +5827,7 @@ g:netrw_cygwin pi_netrw.txt /*g:netrw_cygwin* g:netrw_dav_cmd pi_netrw.txt /*g:netrw_dav_cmd* g:netrw_decompress pi_netrw.txt /*g:netrw_decompress* g:netrw_dirhistmax pi_netrw.txt /*g:netrw_dirhistmax* +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_fname_escape pi_netrw.txt /*g:netrw_fname_escape* @@ -5836,6 +5835,7 @@ g:netrw_ftp pi_netrw.txt /*g:netrw_ftp* g:netrw_ftp_browse_reject pi_netrw.txt /*g:netrw_ftp_browse_reject* g:netrw_ftp_cmd pi_netrw.txt /*g:netrw_ftp_cmd* g:netrw_ftp_list_cmd pi_netrw.txt /*g:netrw_ftp_list_cmd* +g:netrw_ftp_options pi_netrw.txt /*g:netrw_ftp_options* g:netrw_ftp_sizelist_cmd pi_netrw.txt /*g:netrw_ftp_sizelist_cmd* g:netrw_ftp_timelist_cmd pi_netrw.txt /*g:netrw_ftp_timelist_cmd* g:netrw_ftpextracmd pi_netrw.txt /*g:netrw_ftpextracmd* @@ -5850,10 +5850,10 @@ g:netrw_keepdir pi_netrw.txt /*g:netrw_keepdir* g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd* g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide* g:netrw_liststyle pi_netrw.txt /*g:netrw_liststyle* -g:netrw_local_mkdir pi_netrw.txt /*g:netrw_local_mkdir* -g:netrw_local_rmdir pi_netrw.txt /*g:netrw_local_rmdir* g:netrw_localcopycmd pi_netrw.txt /*g:netrw_localcopycmd* +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* g:netrw_maxfilenamelen pi_netrw.txt /*g:netrw_maxfilenamelen* g:netrw_menu pi_netrw.txt /*g:netrw_menu* g:netrw_mkdir_cmd pi_netrw.txt /*g:netrw_mkdir_cmd* @@ -5902,6 +5902,7 @@ g:tar_readoptions pi_tar.txt /*g:tar_readoptions* g:tar_secure pi_tar.txt /*g:tar_secure* g:tar_writeoptions pi_tar.txt /*g:tar_writeoptions* g:tex_conceal syntax.txt /*g:tex_conceal* +g:tex_isk syntax.txt /*g:tex_isk* g:var eval.txt /*g:var* g:vimball_home pi_vimball.txt /*g:vimball_home* g:vimball_mkdir pi_vimball.txt /*g:vimball_mkdir* @@ -6183,6 +6184,7 @@ hl-Cursor syntax.txt /*hl-Cursor* hl-CursorColumn syntax.txt /*hl-CursorColumn* hl-CursorIM syntax.txt /*hl-CursorIM* hl-CursorLine syntax.txt /*hl-CursorLine* +hl-CursorLineNr syntax.txt /*hl-CursorLineNr* hl-DiffAdd syntax.txt /*hl-DiffAdd* hl-DiffChange syntax.txt /*hl-DiffChange* hl-DiffDelete syntax.txt /*hl-DiffDelete* @@ -6559,6 +6561,9 @@ lpc.vim syntax.txt /*lpc.vim* lua if_lua.txt /*lua* lua-buffer if_lua.txt /*lua-buffer* lua-commands if_lua.txt /*lua-commands* +lua-dict if_lua.txt /*lua-dict* +lua-list if_lua.txt /*lua-list* +lua-luaeval if_lua.txt /*lua-luaeval* lua-vim if_lua.txt /*lua-vim* lua-window if_lua.txt /*lua-window* lua.vim syntax.txt /*lua.vim* @@ -6935,8 +6940,11 @@ netrw-updir pi_netrw.txt /*netrw-updir* netrw-urls pi_netrw.txt /*netrw-urls* netrw-userpass pi_netrw.txt /*netrw-userpass* netrw-v pi_netrw.txt /*netrw-v* +netrw-var pi_netrw.txt /*netrw-var* netrw-variables pi_netrw.txt /*netrw-variables* netrw-vexplore pi_netrw.txt /*netrw-vexplore* +netrw-windows-netrc pi_netrw.txt /*netrw-windows-netrc* +netrw-windows-s pi_netrw.txt /*netrw-windows-s* netrw-write pi_netrw.txt /*netrw-write* netrw-x pi_netrw.txt /*netrw-x* netrw-xfer pi_netrw.txt /*netrw-xfer* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 1e4e57db54..b7170b3fcd 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.3. Last change: 2012 Apr 05 +*todo.txt* For Vim version 7.3. Last change: 2012 Apr 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -130,6 +130,8 @@ Patch to pass list to or(), and() and xor(). (Yasuhiro Matsumoto, 2012 Feb 8) Patch to improve "it" and "at" text object matching. (Christian Brabandt, 2011 Nov 20) +Patch to add ":py3do". (Lilydjwg, 2012 Apr 7) + `[ moves to character after insert, instead of the last inserted character. (Yukihiro Nakadaira, 2011 Dec 9) diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 31a0e25449..b9f771d755 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -1,4 +1,4 @@ -*windows.txt* For Vim version 7.3. Last change: 2011 Aug 14 +*windows.txt* For Vim version 7.3. Last change: 2012 Apr 13 VIM REFERENCE MANUAL by Bram Moolenaar @@ -174,7 +174,8 @@ CTRL-W CTRL_N *CTRL-W_CTRL-N* 2. WinEnter for the new window 3. BufLeave for the current buffer 4. BufEnter for the new buffer - This behaves like a ":split" first, and then a ":e" command. + This behaves like a ":split" first, and then an ":enew" + command. :[N]vne[w] [++opt] [+cmd] [file] *:vne* *:vnew* Like |:new|, but split vertically. If 'equalalways' is set @@ -183,7 +184,8 @@ CTRL-W CTRL_N *CTRL-W_CTRL-N* :[N]new [++opt] [+cmd] {file} :[N]sp[lit] [++opt] [+cmd] {file} *:split_f* - Create a new window and start editing file {file} in it. + Create a new window and start editing file {file} in it. This + behaves like a ":split" first, and then an ":e" command. If [+cmd] is given, execute the command when the file has been loaded |+cmd|. Also see |++opt|. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 2a2c0b76c7..9eda334382 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: 2012 Apr 05 +" Last Change: 2012 Apr 13 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -17,7 +17,7 @@ augroup filetypedetect " Ignored extensions if exists("*fnameescape") -au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.rpmsave,?\+.rpmnew +au BufNewFile,BufRead ?\+.orig,?\+.bak,?\+.old,?\+.new,?\+.dpkg-dist,?\+.dpkg-old,?\+.dpkg-new,?\+.dpkg-bak,?\+.rpmsave,?\+.rpmnew \ exe "doau filetypedetect BufRead " . fnameescape(expand(":r")) au BufNewFile,BufRead *~ \ let s:name = expand("") | @@ -239,8 +239,8 @@ func! s:FTVB(alt) endif endfunc -" Visual Basic Script (close to Visual Basic) -au BufNewFile,BufRead *.vbs,*.dsm,*.ctl setf vb +" Visual Basic Script (close to Visual Basic) or Visual Basic .NET +au BufNewFile,BufRead *.vb,*.vbs,*.dsm,*.ctl setf vb " IBasic file (similar to QBasic) au BufNewFile,BufRead *.iba,*.ibi setf ibasic @@ -735,9 +735,11 @@ au BufNewFile,BufRead *.mo,*.gdmo setf gdmo au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom " Git -au BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit +au BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit au BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig -au BufNewFile,BufRead git-rebase-todo setf gitrebase +au BufNewFile,BufRead *.git/modules/**/COMMIT_EDITMSG setf gitcommit +au BufNewFile,BufRead *.git/modules/**/config setf gitconfig +au BufNewFile,BufRead git-rebase-todo setf gitrebase au BufNewFile,BufRead .msg.[0-9]* \ if getline(1) =~ '^From.*# This line is ignored.$' | \ setf gitsendemail | diff --git a/runtime/ftplugin/git.vim b/runtime/ftplugin/git.vim index e043c7587e..c9bcd43698 100644 --- a/runtime/ftplugin/git.vim +++ b/runtime/ftplugin/git.vim @@ -1,7 +1,6 @@ " Vim filetype plugin " Language: generic git output " Maintainer: Tim Pope -" Last Change: 2010 May 21 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -10,7 +9,9 @@ endif let b:did_ftplugin = 1 if !exists('b:git_dir') - if expand('%:p') =~# '\.git\>' + if expand('%:p') =~# '[\/]\.git[\/]modules[\/]' + " Stay out of the way + elseif expand('%:p') =~# '\.git\>' let b:git_dir = matchstr(expand('%:p'),'.*\.git\>') elseif $GIT_DIR != '' let b:git_dir = $GIT_DIR diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim index 94d635c5dd..86ee5222eb 100644 --- a/runtime/ftplugin/gitcommit.vim +++ b/runtime/ftplugin/gitcommit.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: git commit file " Maintainer: Tim Pope -" Last Change: 2010 May 21 +" Last Change: 2012 April 7 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -11,13 +11,14 @@ endif runtime! ftplugin/git.vim let b:did_ftplugin = 1 +setlocal nomodeline + +let b:undo_ftplugin = 'setl modeline<' + if &textwidth == 0 " make sure that log messages play nice with git-log on standard terminals setlocal textwidth=72 - if !exists("b:undo_ftplugin") - let b:undo_ftplugin = "" - endif - let b:undo_ftplugin = b:undo_ftplugin . "|setl tw<" + let b:undo_ftplugin .= "|setl tw<" endif if exists("g:no_gitcommit_commands") || v:version < 700 @@ -28,8 +29,6 @@ if !exists("b:git_dir") let b:git_dir = expand("%:p:h") endif -" Automatically diffing can be done with: -" autocmd FileType gitcommit DiffGitCached | wincmd p command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0,b:git_dir,) function! s:diffcomplete(A,L,P) @@ -58,11 +57,11 @@ function! s:gitdiffcached(bang,gitdir,...) else let extra = "-p --stat=".&columns endif - call system(git." diff --cached --no-color ".extra." > ".(exists("*shellescape") ? shellescape(name) : name)) + call system(git." diff --cached --no-color --no-ext-diff ".extra." > ".(exists("*shellescape") ? shellescape(name) : name)) exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name) wincmd P let b:git_dir = a:gitdir command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0,b:git_dir,) - nnoremap q :q + nnoremap q :q setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git endfunction diff --git a/runtime/indent/gitconfig.vim b/runtime/indent/gitconfig.vim index fa57e56ab6..8eece5d309 100644 --- a/runtime/indent/gitconfig.vim +++ b/runtime/indent/gitconfig.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: git config file " Maintainer: Tim Pope -" Last Change: 2010 May 21 +" Last Change: 2012 April 7 if exists("b:did_indent") finish @@ -12,6 +12,8 @@ setlocal autoindent setlocal indentexpr=GetGitconfigIndent() setlocal indentkeys=o,O,*,0[,],0;,0#,=,!^F +let b:undo_indent = 'setl ai< inde< indk<' + " Only define the function once. if exists("*GetGitconfigIndent") finish diff --git a/runtime/syntax/asm.vim b/runtime/syntax/asm.vim index 0ce8d23994..f208245ab1 100644 --- a/runtime/syntax/asm.vim +++ b/runtime/syntax/asm.vim @@ -3,7 +3,7 @@ " Maintainer: Erik Wognsen " Previous maintainer: " Kevin Dahlhausen -" Last Change: 2012 Jan 5 +" Last Change: 2012 Apr 09 " Thanks to Ori Avtalion for feedback on the comment markers! @@ -56,6 +56,11 @@ syn keyword asmTodo contained TODO " GAS supports one type of multi line comments: syn region asmComment start="/\*" end="\*/" contains=asmTodo +" GAS (undocumentedly?) supports C++ style comments. Unlike in C/C++ however, +" a backslash ending a C++ style comment does not extend the comment to the +" next line (hence the syntax region does not define 'skip="\\$"') +syn region asmComment start="//" end="$" keepend contains=asmTodo + " Line comment characters depend on the target architecture and command line " options and some comments may double as logical line number directives or " preprocessor commands. This situation is described at diff --git a/runtime/syntax/django.vim b/runtime/syntax/django.vim index 67c46b7260..04abcc9c0e 100644 --- a/runtime/syntax/django.vim +++ b/runtime/syntax/django.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Django template " Maintainer: Dave Hodder -" Last Change: 2010 May 19 +" Last Change: 2012 Apr 09 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -21,7 +21,7 @@ syn match djangoError "%}\|}}\|#}" syn keyword djangoStatement contained autoescape csrf_token empty " FIXME ==, !=, <, >, <=, and >= should be djangoStatements: " syn keyword djangoStatement contained == != < > <= >= -syn keyword djangoStatement contained and as block endblock by cycle debug else +syn keyword djangoStatement contained and as block endblock by cycle debug else elif syn keyword djangoStatement contained extends filter endfilter firstof for syn keyword djangoStatement contained endfor if endif ifchanged endifchanged syn keyword djangoStatement contained ifequal endifequal ifnotequal @@ -45,7 +45,7 @@ syn keyword djangoFilter contained linebreaks linebreaksbr linenumbers ljust syn keyword djangoFilter contained lower make_list phone2numeric pluralize syn keyword djangoFilter contained pprint random removetags rjust slice slugify syn keyword djangoFilter contained safe safeseq stringformat striptags -syn keyword djangoFilter contained time timesince timeuntil title +syn keyword djangoFilter contained time timesince timeuntil title truncatechars syn keyword djangoFilter contained truncatewords truncatewords_html unordered_list upper urlencode syn keyword djangoFilter contained urlize urlizetrunc wordcount wordwrap yesno diff --git a/runtime/syntax/gitcommit.vim b/runtime/syntax/gitcommit.vim index 07447ca5e4..83cd4733f4 100644 --- a/runtime/syntax/gitcommit.vim +++ b/runtime/syntax/gitcommit.vim @@ -2,7 +2,7 @@ " Language: git commit file " Maintainer: Tim Pope " Filenames: *.git/COMMIT_EDITMSG -" Last Change: 2010 May 21 +" Last Change: 2012 April 7 if exists("b:current_syntax") finish @@ -16,7 +16,7 @@ if has("spell") endif syn include @gitcommitDiff syntax/diff.vim -syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^$\|^#\@=/ contains=@gitcommitDiff +syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff syn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl syn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell @@ -26,7 +26,7 @@ syn match gitcommitComment "^#.*" syn match gitcommitHead "^\%(# .*\n\)\+#$" contained transparent syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite syn match gitcommitOnBranch "\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite -syn match gitcommitBranch "[^ \t']\+" contained +syn match gitcommitBranch "[^ ']\+" contained syn match gitcommitNoBranch "\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment syn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^# \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent @@ -35,7 +35,7 @@ syn match gitcommitNoChanges "\%(^# \)\@<=No changes$" contained containedin=g syn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold syn match gitcommitUntrackedFile "\t\@<=.*" contained -syn region gitcommitDiscarded start=/^# Changed but not updated:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold +syn region gitcommitDiscarded start=/^# Change\%(s not staged for commit\|d but not updated\):/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold syn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold syn region gitcommitUnmerged start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold diff --git a/runtime/syntax/gitrebase.vim b/runtime/syntax/gitrebase.vim index ba1745d01f..084645630a 100644 --- a/runtime/syntax/gitrebase.vim +++ b/runtime/syntax/gitrebase.vim @@ -2,7 +2,7 @@ " Language: git rebase --interactive " Maintainer: Tim Pope " Filenames: git-rebase-todo -" Last Change: 2010 May 21 +" Last Change: 2012 April 7 if exists("b:current_syntax") finish @@ -17,7 +17,9 @@ syn match gitrebaseReword "\v^r%(eword)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseEdit "\v^e%(dit)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseSquash "\v^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite syn match gitrebaseFixup "\v^f%(ixup)=>" nextgroup=gitrebaseCommit skipwhite +syn match gitrebaseExec "\v^%(x|exec)>" nextgroup=gitrebaseCommand skipwhite syn match gitrebaseSummary ".*" contains=gitrebaseHash contained +syn match gitrebaseCommand ".*" contained syn match gitrebaseComment "^#.*" contains=gitrebaseHash syn match gitrebaseSquashError "\v%^%(s%(quash)=>|f%(ixup)=>)" nextgroup=gitrebaseCommit skipwhite @@ -28,6 +30,7 @@ hi def link gitrebaseReword Number hi def link gitrebaseEdit PreProc hi def link gitrebaseSquash Type hi def link gitrebaseFixup Special +hi def link gitrebaseExec Function hi def link gitrebaseSummary String hi def link gitrebaseComment Comment hi def link gitrebaseSquashError Error