mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
updated for version 7.1-215
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.1. Last change: 2008 Jan 06
|
||||
*eval.txt* For Vim version 7.1. Last change: 2008 Jan 10
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1786,6 +1786,7 @@ synID( {lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col}
|
||||
synIDattr( {synID}, {what} [, {mode}])
|
||||
String attribute {what} of syntax ID {synID}
|
||||
synIDtrans( {synID}) Number translated syntax ID of {synID}
|
||||
synstack({lnum}, {col}) List stack of syntax IDs at {lnum} and {col}
|
||||
system( {expr} [, {input}]) String output of shell command/filter {expr}
|
||||
tabpagebuflist( [{arg}]) List list of buffer numbers in tab page
|
||||
tabpagenr( [{arg}]) Number number of current or last tab page
|
||||
@@ -4962,6 +4963,24 @@ synIDtrans({synID}) *synIDtrans()*
|
||||
highlight the character. Highlight links given with
|
||||
":highlight link" are followed.
|
||||
|
||||
synstack({lnum}, {col}) *synstack()*
|
||||
Return a |List|, which is the stack of syntax items at the
|
||||
position {lnum} and {col} in the current window. Each item in
|
||||
the List is an ID like what |synID()| returns.
|
||||
The stack is the situation in between the character at "col"
|
||||
and the next character. Note that a region of only one
|
||||
character will not show up, it only exists inside that
|
||||
character, not in between characters.
|
||||
The first item in the List is the outer region, following are
|
||||
items contained in that one. The last one is what |synID()|
|
||||
returns, unless not the whole item is highlighted or it is a
|
||||
transparent item.
|
||||
This function is useful for debugging a syntax file.
|
||||
Example that shows the syntax stack under the cursor: >
|
||||
for id in synstack(line("."), col("."))
|
||||
echo synIDattr(id, "name")
|
||||
endfor
|
||||
|
||||
system({expr} [, {input}]) *system()* *E677*
|
||||
Get the output of the shell command {expr}.
|
||||
When {input} is given, this string is written to a file and
|
||||
|
42
src/eval.c
42
src/eval.c
@@ -651,6 +651,7 @@ static void f_substitute __ARGS((typval_T *argvars, typval_T *rettv));
|
||||
static void f_synID __ARGS((typval_T *argvars, typval_T *rettv));
|
||||
static void f_synIDattr __ARGS((typval_T *argvars, typval_T *rettv));
|
||||
static void f_synIDtrans __ARGS((typval_T *argvars, typval_T *rettv));
|
||||
static void f_synstack __ARGS((typval_T *argvars, typval_T *rettv));
|
||||
static void f_system __ARGS((typval_T *argvars, typval_T *rettv));
|
||||
static void f_tabpagebuflist __ARGS((typval_T *argvars, typval_T *rettv));
|
||||
static void f_tabpagenr __ARGS((typval_T *argvars, typval_T *rettv));
|
||||
@@ -7252,6 +7253,7 @@ static struct fst
|
||||
{"synID", 3, 3, f_synID},
|
||||
{"synIDattr", 2, 3, f_synIDattr},
|
||||
{"synIDtrans", 1, 1, f_synIDtrans},
|
||||
{"synstack", 2, 2, f_synstack},
|
||||
{"system", 1, 2, f_system},
|
||||
{"tabpagebuflist", 0, 1, f_tabpagebuflist},
|
||||
{"tabpagenr", 0, 1, f_tabpagenr},
|
||||
@@ -15845,6 +15847,46 @@ f_synIDtrans(argvars, rettv)
|
||||
rettv->vval.v_number = id;
|
||||
}
|
||||
|
||||
/*
|
||||
* "synstack(lnum, col)" function
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
f_synstack(argvars, rettv)
|
||||
typval_T *argvars;
|
||||
typval_T *rettv;
|
||||
{
|
||||
#ifdef FEAT_SYN_HL
|
||||
long lnum;
|
||||
long col;
|
||||
int i;
|
||||
int id;
|
||||
#endif
|
||||
|
||||
rettv->v_type = VAR_LIST;
|
||||
rettv->vval.v_list = NULL;
|
||||
|
||||
#ifdef FEAT_SYN_HL
|
||||
lnum = get_tv_lnum(argvars); /* -1 on type error */
|
||||
col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
|
||||
|
||||
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count
|
||||
&& col >= 0 && col < (long)STRLEN(ml_get(lnum))
|
||||
&& rettv_list_alloc(rettv) != FAIL)
|
||||
{
|
||||
(void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL);
|
||||
for (i = 0; ; ++i)
|
||||
{
|
||||
id = syn_get_stack_item(i);
|
||||
if (id < 0)
|
||||
break;
|
||||
if (list_append_number(rettv->vval.v_list, id) == FAIL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* "system()" function
|
||||
*/
|
||||
|
@@ -13,6 +13,7 @@ void set_context_in_echohl_cmd __ARGS((expand_T *xp, char_u *arg));
|
||||
void set_context_in_syntax_cmd __ARGS((expand_T *xp, char_u *arg));
|
||||
char_u *get_syntax_name __ARGS((expand_T *xp, int idx));
|
||||
int syn_get_id __ARGS((win_T *wp, long lnum, colnr_T col, int trans, int *spellp));
|
||||
int syn_get_stack_item __ARGS((int i));
|
||||
int syn_get_foldlevel __ARGS((win_T *wp, long lnum));
|
||||
void init_highlight __ARGS((int both, int reset));
|
||||
int load_colors __ARGS((char_u *name));
|
||||
|
16
src/syntax.c
16
src/syntax.c
@@ -6105,6 +6105,22 @@ syn_get_id(wp, lnum, col, trans, spellp)
|
||||
return (trans ? current_trans_id : current_id);
|
||||
}
|
||||
|
||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||
/*
|
||||
* Return the syntax ID at position "i" in the current stack.
|
||||
* The caller must have called syn_get_id() before to fill the stack.
|
||||
* Returns -1 when "i" is out of range.
|
||||
*/
|
||||
int
|
||||
syn_get_stack_item(i)
|
||||
int i;
|
||||
{
|
||||
if (i >= current_state.ga_len )
|
||||
return -1;
|
||||
return CUR_STATE(i).si_id;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_FOLDING) || defined(PROTO)
|
||||
/*
|
||||
* Function called to get folding level for line "lnum" in window "wp".
|
||||
|
@@ -666,6 +666,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
215,
|
||||
/**/
|
||||
214,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user