-*eval.txt* For Vim version 7.0aa. Last change: 2005 Jan 27
+*eval.txt* For Vim version 7.0aa. Last change: 2005 Jan 31
VIM REFERENCE MANUAL by Bram Moolenaar
inputsecret( {prompt} [, {text}]) String like input() but hiding the text
insert( {list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}]
isdirectory( {directory}) Number TRUE if {directory} is a directory
+islocked( {expr}) Number TRUE if {expr} is locked
items( {dict}) List List of key-value pairs in {dict}
join( {list} [, {sep}]) String join {list} items into one String
keys( {dict}) List List of keys in {dict}
exist, or isn't a directory, the result is FALSE. {directory}
is any expression, which is used as a String.
+islocked({expr}) *islocked()*
+ The result is a Number, which is non-zero when {expr} is the
+ name of a locked variable.
+ {expr} must be the name of a variable, List item or Dictionary
+ entry, not the variable itself! Example: >
+ :let alist = [0, ['a', 'b'], 2, 3]
+ :lockvar 1 alist
+ :echo islocked('alist') " 1
+ :echo islocked('alist[1]') " 0
+
+< When {expr} is a variable that does not exist you get an error
+ message. Use |exists()| to check for existance.
+
items({dict}) *items()*
Return a List with all the key-value pairs of {dict}. Each
List item is a list with two items: the key of a {dict} entry
arguments an argument "..." can be specified, which means that more arguments
may optionally be following. In the function the extra arguments can be used
as "a:1", "a:2", etc. "a:0" is set to the number of extra arguments (which
-can be 0). "a:000" is set to a List that contains these arguments.
+can be 0). "a:000" is set to a List that contains these arguments. Note that
+"a:1" is the same as "a:000[0]".
+ *E742*
+The a: scope and the variables in it cannot be changed, they are fixed.
+However, if a List or Dictionary is used, you can changes their contents.
+Thus you can pass a List to a function and have the function add an item to
+it. If you want to make sure the function cannot change a List or Dictionary
+use |:lockvar|.
When not using "...", the number of arguments in a function call must be equal
to the number of named arguments. When using "...", the number of arguments
# Number
* Funcref
- *:unlet* *:unl* *E108*
-:unl[et][!] {var-name} ...
- Remove the internal variable {var-name}. Several
- variable names can be given, they are all removed.
+
+:unl[et][!] {name} ... *:unlet* *:unl* *E108*
+ Remove the internal variable {name}. Several variable
+ names can be given, they are all removed. The name
+ may also be a List or Dictionary item.
With [!] no error message is given for non-existing
variables.
One or more items from a List can be removed: >
:unlet dict['two']
:unlet dict.two
+:lockv[ar][!] [depth] {name} ... *:lockvar* *:lockv*
+ Lock the internal variable {name}. Locking means that
+ it can no longer be changed (until it is unlocked).
+ A locked variable can be deleted: >
+ :lockvar v
+ :let v = 'asdf' " fails!
+ :unlet v
+< *E741*
+ If you try to change a locked variable you get an
+ error message: "E741: Value of {name} is locked"
+
+ [depth] is relevant when locking a List or Dictionary.
+ It specifies how deep the locking goes:
+ 1 Lock the List or Dictionary itself,
+ cannot add or remove items, but can
+ still change their values.
+ 2 Also lock the values, cannot change
+ the items. If an item is a List or
+ Dictionary, cannot add or remove
+ items, but can still change the
+ values.
+ 3 Like 2 but for the List/Dictionary in
+ the List/Dictionary, one level deeper.
+ The default [depth] is 2, thus when {name} is a List
+ or Dictionary the values cannot be changed.
+ *E743*
+ For unlimited depth use [!] and omit [depth].
+ However, there is a maximum depth of 100 to catch
+ loops.
+
+ Note that when two variables refer to the same List
+ and you lock one of them, the List will also be locked
+ when used through the other variable. Example: >
+ :let l = [0, 1, 2, 3]
+ :let cl = l
+ :lockvar l
+ :let cl[1] = 99 " won't work!
+< You may want to make a copy of a list to avoid this.
+ See |deepcopy()|.
+
+
+:unlo[ckvar][!] [depth] {name} ... *:unlockvar* *:unlo*
+ Unlock the internal variable {name}. Does the
+ opposite of |:lockvar|.
+
+
:if {expr1} *:if* *:endif* *:en* *E171* *E579* *E580*
:en[dif] Execute the commands until the next matching ":else"
or ":endif" if {expr1} evaluates to non-zero.
-*options.txt* For Vim version 7.0aa. Last change: 2005 Jan 26
+*options.txt* For Vim version 7.0aa. Last change: 2005 Jan 30
VIM REFERENCE MANUAL by Bram Moolenaar
knows about pasting and will mostly do the right thing without 'paste'
being set. The same is true for a terminal where Vim handles the
mouse clicks itself.
+ This option is reset when starting the GUI. Thus if you set it in
+ your .vimrc it will work in a terminal, but not in the GUI. Setting
+ 'paste' in the GUI has side effects: e.g., the Paste toolbar button
+ will no longer work in Insert mode, because it uses a mapping.
When the 'paste' option is switched on (also when it was already on):
- mapping in Insert mode and Command-line mode is disabled
- abbreviations are disabled
-*repeat.txt* For Vim version 7.0aa. Last change: 2004 Jul 30
+*repeat.txt* For Vim version 7.0aa. Last change: 2005 Jan 28
VIM REFERENCE MANUAL by Bram Moolenaar
of ":function". For local functions this means that something like "<SNR>99_"
is prepended.
+Note that functions are first loaded and later executed. When they are loaded
+the "file" breakpoints are checked, when they are executed the "func"
+breakpoints.
+
DELETING BREAKPOINTS
*:breakd* *:breakdel* *E161*
:loadview starting.txt /*:loadview*
:loc motion.txt /*:loc*
:lockmarks motion.txt /*:lockmarks*
+:lockv eval.txt /*:lockv*
+:lockvar eval.txt /*:lockvar*
:ls windows.txt /*:ls*
:lu map.txt /*:lu*
:lunmap map.txt /*:lunmap*
:mzfile if_mzsch.txt /*:mzfile*
:mzscheme if_mzsch.txt /*:mzscheme*
:n editing.txt /*:n*
+:nbkey netbeans.txt /*:nbkey*
:ne editing.txt /*:ne*
:new windows.txt /*:new*
:next editing.txt /*:next*
:unhide windows.txt /*:unhide*
:unl eval.txt /*:unl*
:unlet eval.txt /*:unlet*
+:unlo eval.txt /*:unlo*
+:unlockvar eval.txt /*:unlockvar*
:unm map.txt /*:unm*
:unm! map.txt /*:unm!*
:unmap map.txt /*:unmap*
E739 starting.txt /*E739*
E74 message.txt /*E74*
E740 eval.txt /*E740*
+E741 eval.txt /*E741*
+E742 eval.txt /*E742*
+E743 eval.txt /*E743*
+E744 netbeans.txt /*E744*
E75 vi_diff.txt /*E75*
E76 pattern.txt /*E76*
E77 message.txt /*E77*
iquote motion.txt /*iquote*
is motion.txt /*is*
isdirectory() eval.txt /*isdirectory()*
+islocked() eval.txt /*islocked()*
items() eval.txt /*items()*
iw motion.txt /*iw*
i{ motion.txt /*i{*
ncf-syntax syntax.txt /*ncf-syntax*
ncf.vim syntax.txt /*ncf.vim*
netbeans netbeans.txt /*netbeans*
+netbeans-commands netbeans.txt /*netbeans-commands*
netbeans-configure netbeans.txt /*netbeans-configure*
netbeans-download netbeans.txt /*netbeans-download*
netbeans-intro netbeans.txt /*netbeans-intro*
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2005 Jan 24
+" Last Change: 2005 Jan 27
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
au BufNewFile,BufRead *.fs,*.ft setf forth
" Fortran
-au BufNewFile,BufRead *.f,*.F,*.for,*.fpp,*.ftn,*.f77,*.F77,*.f90,*.F90,*.f95,*.F95 setf fortran
+au BufNewFile,BufRead *.f,*.F,*.for,*.fpp,*.FPP*.ftn,*.f77,*.F77,*.f90,*.F90,*.f95,*.F95 setf fortran
" FStab
au BufNewFile,BufRead fstab setf fstab
" Icewm menu
au BufNewFile,BufRead */.icewm/menu setf icemenu
-" Inform
-au BufNewFile,BufRead .indent.pro setf indent
-
" IDL (Interactive Data Language)
au BufNewFile,BufRead *.pro setf idlang
+" Inform
+au BufNewFile,BufRead .indent.pro setf indent
+
" Inform
au BufNewFile,BufRead *.inf,*.INF setf inform
+" Ipfilter
+au BufNewFile,BufRead ipf.conf,ipf.rules setf ipfilter
+
" Informix 4GL (source - canonical, include file, I4GL+M4 preproc.)
au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl setf fgl
+" Menu Translations: Traditional Chinese
+
source <sfile>:p:h/menu_chinese_taiwan.950.vim
-" Menu Translations: Traditional Chinese (for UTF-8)
-" Translated By: Hung-Teh, Lin <piaip@csie.ntu.edu.tw>
-" Last Change: Thu Apr 24 17:35:17 CST 2003
+" Menu Translations: Traditional Chinese
+" Translated By: Hung-Te Lin <piaip@csie.ntu.edu.tw>
+" Last Change: 2005/01/28 02:51:38
" {{{ Quit when menu translations have already been done.
if exists("did_menu_trans")
menutrans &How-to\ links 如何作\.\.\.(&H)
menutrans &GUI 圖型界面(&G)
menutrans &Credits 感謝(&C)
-menutrans Co&pying 版權宣告(&P)
+menutrans Co&pying 版權(&P)
+menutrans &Sponsor/Register 贊助/註冊(&S)
menutrans O&rphans 拯救孤兒(&R)
" ------------------------------------------------------------------------
menutrans &Version 程式版本資訊(&V)
menutrans Put\ &Before<Tab>[p 貼到游標前(&B)<Tab>[p
menutrans Put\ &After<Tab>]p 貼到游標後(&A)<Tab>]p
menutrans &Delete<Tab>x 刪除(&D)<Tab>x
-menutrans &Select\ all<Tab>ggVG 全選(&S)<Tab>ggvG
+menutrans &Select\ All<Tab>ggVG 全選(&S)<Tab>ggvG
" ------------------------------------------------------------------------
menutrans &Find\.\.\. 尋找(&F)\.\.\.
menutrans Find\ and\ Rep&lace\.\.\. 尋找並取代(&L)\.\.\.
" You can also use this as a start for your own set of menus.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2004 Dec 04
+" Last Change: 2005 Jan 30
" Note that ":an" (short for ":anoremenu") is often used to make a menu work
" in all modes and avoid side effects from mappings defined by the user.
" There is no exact match, try matching with a wildcard added
" (e.g. find menu_de_de.iso_8859-1.vim if s:lang == de_DE).
let s:lang = substitute(s:lang, '\.[^.]*', "", "")
- exe "runtime! lang/menu_" . s:lang . "*.vim"
+ exe "runtime! lang/menu_" . s:lang . "[^a-z]*.vim"
if !exists("did_menu_trans") && strlen($LANG) > 1
" On windows locale names are complicated, try using $LANG, it might
" have been set by set_init_1().
- exe "runtime! lang/menu_" . tolower($LANG) . "*.vim"
+ " But don't match "slovak" when $LANG is "sl".
+ exe "runtime! lang/menu_" . tolower($LANG) . "[^a-z]*vim"
endif
endif
endif
if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-for ac_header in X11/Xmu/Editres.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-else
- # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
+ echo "$as_me:$LINENO: checking for X11/Xmu/Editres.h" >&5
+echo $ECHO_N "checking for X11/Xmu/Editres.h... $ECHO_C" >&6
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
+
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/Editres.h>
+int
+main ()
+{
+int i; i = 0;
+ ;
+ return 0;
+}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
- ac_header_compiler=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_header_compiler=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <$ac_header>
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_X11_XMU_EDITRES_H 1
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
- ac_header_preproc=yes
+
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
- yes:no: )
- { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
- (
- cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists. ##
-## ------------------------------------------ ##
-_ASBOX
- ) |
- sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
- cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
-done
-
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
CPPFLAGS=$cppflags_save
fi
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-for ac_header in Xm/Xm.h Xm/XpmP.h
+
+
+
+
+for ac_header in Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h \
+ Xm/UnhighlightT.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
#undef HAVE_X11_SUNKEYSYM_H
#undef HAVE_XM_XM_H
#undef HAVE_XM_XPMP_H
+#undef HAVE_XM_TRAITP_H
+#undef HAVE_XM_MANAGER_H
+#undef HAVE_XM_UNHIGHLIGHTT_H
+#undef HAVE_XM_JOINSIDET_H
#undef HAVE_X11_XPM_H
#undef HAVE_X11_XMU_EDITRES_H
#undef HAVE_X11_SM_SMLIB_H
if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
- AC_CHECK_HEADERS(X11/Xmu/Editres.h)
+dnl Xmu/Editres.h may exist but can only be used after including Intrinsic.h
+ AC_MSG_CHECKING([for X11/Xmu/Editres.h])
+ AC_TRY_COMPILE([
+#include <X11/Intrinsic.h>
+#include <X11/Xmu/Editres.h>],
+ [int i; i = 0;],
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_X11_XMU_EDITRES_H),
+ AC_MSG_RESULT(no))
CPPFLAGS=$cppflags_save
fi
if test -z "$SKIP_MOTIF"; then
cppflags_save=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
- AC_CHECK_HEADERS(Xm/Xm.h Xm/XpmP.h)
+ AC_CHECK_HEADERS(Xm/Xm.h Xm/XpmP.h Xm/JoinSideT.h Xm/TraitP.h Xm/Manager.h \
+ Xm/UnhighlightT.h)
CPPFLAGS=$cppflags_save
fi
do_cmdline_cmd((char_u *)
"command -nargs=* CompilerSet setlocal <args>");
}
- do_unlet((char_u *)"current_compiler");
- do_unlet((char_u *)"b:current_compiler");
+ do_unlet((char_u *)"current_compiler", TRUE);
+ do_unlet((char_u *)"b:current_compiler", TRUE);
sprintf((char *)buf, "compiler/%s.vim", eap->arg);
if (cmd_runtime(buf, TRUE) == FAIL)
vim_free(old_cur_comp);
}
else
- do_unlet((char_u *)"current_compiler");
+ do_unlet((char_u *)"current_compiler", TRUE);
}
}
}
#if defined(FEAT_BEVAL) || defined(PROTO)
/* BALLOON-EVAL IMPLEMENTATION FOR WINDOWS.
- * Added by Sergey Khorev
+ * Added by Sergey Khorev <sergey.khorev@gmail.com>
*
* The only reused thing is gui_beval.h and gui_mch_get_beval_info()
* from gui_beval.c (note it uses x and y of the BalloonEval struct
/* vi:set ts=8 sts=4 sw=4:
*
* CSCOPE support for Vim added by Andy Kahn <kahn@zk3.dec.com>
- * Ported to Win32 by Sergey Khorev <khorev@softlab.ru>
+ * Ported to Win32 by Sergey Khorev <sergey.khorev@gmail.com>
*
* The basic idea/structure of cscope for Vim was borrowed from Nvi. There
* might be a few lines of code that look similar to what Nvi has.
/* vi:set ts=8 sts=4 sw=4:
*
* CSCOPE support for Vim added by Andy Kahn <kahn@zk3.dec.com>
- * Ported to Win32 by Sergey Khorev <khorev@softlab.ru>
+ * Ported to Win32 by Sergey Khorev <sergey.khorev@gmail.com>
*
* The basic idea/structure of cscope for Vim was borrowed from Nvi.
* There might be a few lines of code that look similar to what Nvi
#define NBDLEVEL(flags) (nb_debug != NULL && (nb_dlevel & (flags)))
#define NBDEBUG_TRACE 1
-//#define NBDEBUG_SENSE 2
typedef enum {
WT_ENV = 1, /* look for env var if set */
/* The color scheme must have set 'background' back to another
* value, that's not what we want here. Disable the color
* scheme and set the colors again. */
- do_unlet((char_u *)"g:colors_name");
+ do_unlet((char_u *)"g:colors_name", TRUE);
free_string_option(p_bg);
p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
check_string_option(&p_bg);
void set_context_for_expression __ARGS((expand_T *xp, char_u *arg, cmdidx_T cmdidx));
void ex_call __ARGS((exarg_T *eap));
void ex_unlet __ARGS((exarg_T *eap));
-int do_unlet __ARGS((char_u *name));
+void ex_lockvar __ARGS((exarg_T *eap));
+int do_unlet __ARGS((char_u *name, int forceit));
void del_menutrans_vars __ARGS((void));
char_u *get_user_var_name __ARGS((expand_T *xp, int idx));
char_u *get_function_name __ARGS((expand_T *xp, int idx));
char_u *set_cmdarg __ARGS((exarg_T *eap, char_u *oldarg));
char_u *get_var_value __ARGS((char_u *name));
void new_script_vars __ARGS((scid_T id));
-void vars_init __ARGS((hashtab_T *ht));
void init_var_dict __ARGS((dict_T *dict, dictitem_T *dict_var));
void vars_clear __ARGS((hashtab_T *ht));
void ex_echo __ARGS((exarg_T *eap));
#ifdef FEAT_MBYTE
/* When there is a multi-byte character, just output a
* space to keep it simple. */
- if (has_mbyte && mb_off2cells(LineOffset[screen_row - 1]
- + (unsigned)Columns - 1) != 1)
+ if (has_mbyte && MB_BYTE2LEN(ScreenLines[LineOffset[
+ screen_row - 1] + (Columns - 1)]) > 1)
out_char(' ');
else
#endif
*/
typedef struct
{
- char v_type; /* see below: VAR_NUMBER, VAR_STRING, etc. */
+ char v_type; /* see below: VAR_NUMBER, VAR_STRING, etc. */
+ char v_lock; /* see below: VAR_LOCKED, VAR_FIXED */
union
{
varnumber_T v_number; /* number value */
#define VAR_LIST 4 /* "v_list" is used */
#define VAR_DICT 5 /* "v_dict" is used */
+/* Values for "v_lock". */
+#define VAR_LOCKED 1 /* locked with lock(), can use unlock() */
+#define VAR_FIXED 2 /* locked forever */
+
/*
* Structure to hold an item of a list: an internal variable without a name.
*/
listitem_T *lv_first; /* first item, NULL if none */
listitem_T *lv_last; /* last item, NULL if none */
listwatch_T *lv_watch; /* first watcher, NULL if none */
+ char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */
};
/*
#define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */
#define DI_FLAGS_RO_SBX 2 /* "di_flags" value: read-only in the sandbox */
#define DI_FLAGS_FIX 4 /* "di_flags" value: fixed variable, not allocated */
+#define DI_FLAGS_LOCK 8 /* "di_flags" value: locked variable */
/*
* Structure to hold info about a Dictionary.
{
int dv_refcount; /* reference count */
hashtab_T dv_hashtab; /* hashtab that refers to the items */
+ char dv_lock; /* zero, VAR_LOCKED, VAR_FIXED */
};
else
{
syntax_clear(curbuf);
- do_unlet((char_u *)"b:current_syntax");
+ do_unlet((char_u *)"b:current_syntax", TRUE);
}
}
else
{
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"enable");
syn_cmd_onoff(eap, "syntax");
- do_unlet((char_u *)"g:syntax_cmd");
+ do_unlet((char_u *)"g:syntax_cmd", TRUE);
}
/*
{
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset");
do_cmdline_cmd((char_u *)"runtime! syntax/syncolor.vim");
- do_unlet((char_u *)"g:syntax_cmd");
+ do_unlet((char_u *)"g:syntax_cmd", TRUE);
}
}
*/
#endif
#ifdef FEAT_EVAL
- do_unlet((char_u *)"colors_name");
+ do_unlet((char_u *)"colors_name", TRUE);
#endif
restore_cterm_colors();
STARTTEST
:so small.vim
-:fun Test()
+:fun Test(...)
:" Creating List directly with different types
:let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},]
:$put =string(l)
:let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},}
:$put =string(d) . d.1
:$put =string(sort(keys(d)))
-:$put =string(values(d))
+:$put =string (values(d))
:for [key, val] in items(d)
: $put =key . ':' . string(val)
: unlet key val
:endfor
-:call extend(d, {3:33, 1:99})
+:call extend (d, {3:33, 1:99})
:call extend(d, {'b':'bbb', 'c':'ccc'}, "keep")
:try
: call extend(d, {3:333,4:444}, "error")
:unlet l[2]
:$put =string(l)
:let l = range(8)
+:try
:unlet l[:3]
:unlet l[1:]
+:catch
+:$put =v:exception
+:endtry
:$put =string(l)
:"
:unlet d.c
:func d.func(a)
: return "a:". a:a
:endfunc
-:$put = d.func(string(remove(d, 'func')))
+:$put =d.func(string(remove(d, 'func')))
:"
:" Nasty: deepcopy() dict that refers to itself (fails)
:let d = {1:1, 2:2}
: $put =v:exception[:14]
:endtry
:"
+:" Locked variables
+:for depth in range(5)
+: $put ='depth is ' . depth
+: for u in range(3)
+: unlet l
+: let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}]
+: exe "lockvar " . depth . " l"
+: if u == 1
+: exe "unlockvar l"
+: elseif u == 2
+: exe "unlockvar " . depth . " l"
+: endif
+: let ps = islocked("l").islocked("l[1]").islocked("l[1][1]").islocked("l[1][1][0]").'-'.islocked("l[2]").islocked("l[2]['6']").islocked("l[2]['6'][7]")
+: $put =ps
+: let ps = ''
+: try
+: let l[1][1][0] = 99
+: let ps .= 'p'
+: catch
+: let ps .= 'F'
+: endtry
+: try
+: let l[1][1] = [99]
+: let ps .= 'p'
+: catch
+: let ps .= 'F'
+: endtry
+: try
+: let l[1] = [99]
+: let ps .= 'p'
+: catch
+: let ps .= 'F'
+: endtry
+: try
+: let l[2]['6'][7] = 99
+: let ps .= 'p'
+: catch
+: let ps .= 'F'
+: endtry
+: try
+: let l[2][6] = {99: 99}
+: let ps .= 'p'
+: catch
+: let ps .= 'F'
+: endtry
+: try
+: let l[2] = {99: 99}
+: let ps .= 'p'
+: catch
+: let ps .= 'F'
+: endtry
+: try
+: let l = [99]
+: let ps .= 'p'
+: catch
+: let ps .= 'F'
+: endtry
+: $put =ps
+: endfor
+:endfor
+:"
+:" a:000 function argument
+:" first the tests that should fail
+:try
+: let a:000 = [1, 2]
+:catch
+: $put ='caught a:000'
+:endtry
+:try
+: let a:000[0] = 9
+:catch
+: $put ='caught a:000[0]'
+:endtry
+:try
+: let a:000[2] = [9, 10]
+:catch
+: $put ='caught a:000[2]'
+:endtry
+:try
+: let a:000[3] = {9: 10}
+:catch
+: $put ='caught a:000[3]'
+:endtry
+:" now the tests that should pass
+:try
+: let a:000[2][1] = 9
+: call extend(a:000[2], [5, 6])
+: let a:000[3][5] = 8
+: let a:000[3]['a'] = 12
+: $put =string(a:000)
+:catch
+: $put ='caught ' . v:exception
+:endtry
+:"
:endfun
-:call Test() " This may take a while
+:call Test(1, 2, [3, 4], {5: 6}) " This may take a while
:"
:/^start:/,$wq! test.out
ENDTEST
g:dict.func-4
a:function('3')
Vim(let):E698:
+depth is 0
+0000-000
+ppppppp
+0000-000
+ppppppp
+0000-000
+ppppppp
+depth is 1
+1000-000
+ppppppF
+0000-000
+ppppppp
+0000-000
+ppppppp
+depth is 2
+1100-100
+ppFppFF
+0000-000
+ppppppp
+0000-000
+ppppppp
+depth is 3
+1110-110
+pFFpFFF
+0010-010
+pFppFpp
+0000-000
+ppppppp
+depth is 4
+1111-111
+FFFFFFF
+0011-011
+FFpFFpp
+0000-000
+ppppppp
+caught a:000
+caught a:000[0]
+caught a:000[2]
+caught a:000[3]
+[1, 2, [3, 9, 5, 6], {'a': 12, '5': 8}]
#define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
-#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Jan 27)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Jan 27, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Jan 31)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Jan 31, compiled "