Merge remote-tracking branch 'vim/master'

This commit is contained in:
ichizok
2022-08-26 13:26:09 +09:00
44 changed files with 171 additions and 420 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ on:
jobs:
scan:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
env:
CC: gcc
+15 -7
View File
@@ -253,7 +253,7 @@ getreg([{regname} [, 1 [, {list}]]])
String or List contents of a register
getreginfo([{regname}]) Dict information about a register
getregtype([{regname}]) String type of a register
getscriptinfo() List list of sourced scripts
getscriptinfo([{opts}]) List list of sourced scripts
gettabinfo([{expr}]) List list of tab pages
gettabvar({nr}, {varname} [, {def}])
any variable {varname} in tab {nr} or {def}
@@ -1179,7 +1179,8 @@ browsedir({title}, {initdir})
browsing is not possible, an empty string is returned.
bufadd({name}) *bufadd()*
Add a buffer to the buffer list with String {name}.
Add a buffer to the buffer list with name {name} (must be a
String).
If a buffer for file {name} already exists, return that buffer
number. Otherwise return the buffer number of the newly
created buffer. When {name} is an empty string then a new
@@ -1232,7 +1233,8 @@ bufload({buf}) *bufload()*
Ensure the buffer {buf} is loaded. When the buffer name
refers to an existing file then the file is read. Otherwise
the buffer will be empty. If the buffer was already loaded
then there is no change.
then there is no change. If the buffer is not related to a
file the no file is read (e.g., when 'buftype' is "nofile").
If there is an existing swap file for the file of the buffer,
there will be no dialog, the buffer will be loaded anyway.
The {buf} argument is used like with |bufexists()|.
@@ -2734,8 +2736,6 @@ finddir({name} [, {path} [, {count}]]) *finddir()*
Returns an empty string if the directory is not found.
This is quite similar to the ex-command `:find`.
{only available when compiled with the |+file_in_path|
feature}
Can also be used as a |method|: >
GetName()->finddir()
@@ -4089,7 +4089,7 @@ getregtype([{regname}]) *getregtype()*
Can also be used as a |method|: >
GetRegname()->getregtype()
getscriptinfo() *getscriptinfo()*
getscriptinfo([{opts}) *getscriptinfo()*
Returns a |List| with information about all the sourced Vim
scripts in the order they were sourced, like what
`:scriptnames` shows.
@@ -4104,6 +4104,13 @@ getscriptinfo() *getscriptinfo()*
sourced script ID of the actually sourced script that
this script name links to, if any, otherwise
zero
version vimscript version (|scriptversion|)
The optional Dict argument {opts} supports the following
items:
name script name match pattern. If specified,
information about scripts with name
that match the pattern "name" are returned.
gettabinfo([{tabnr}]) *gettabinfo()*
If {tabnr} is not specified, then information about all the
@@ -10530,7 +10537,8 @@ ex_extra |+ex_extra| (always true)
extra_search Compiled with support for |'incsearch'| and
|'hlsearch'|
farsi Support for Farsi was removed |farsi|.
file_in_path Compiled with support for |gf| and |<cfile>|
file_in_path Compiled with support for |gf| and |<cfile>| (always
true)
filterpipe When 'shelltemp' is off pipes are used for shell
read/write/filter commands
find_in_path Compiled with support for include file searches
-3
View File
@@ -199,9 +199,6 @@ CTRL-R CTRL-L *c_CTRL-R_CTRL-L* *c_<C-R>_<C-L>*
currently displayed match is used. With CTRL-W the part of
the word that was already typed is not inserted again.
CTRL-F and CTRL-P: {only when |+file_in_path| feature is
included}
*c_CTRL-R_CTRL-R* *c_<C-R>_<C-R>*
*c_CTRL-R_CTRL-O* *c_<C-R>_<C-O>*
CTRL-R CTRL-R {register CTRL-F CTRL-P CTRL-W CTRL-A CTRL-L}
-6
View File
@@ -247,8 +247,6 @@ If you want to keep the changed buffer without saving it, switch on the
*:fin* *:find*
:fin[d][!] [++opt] [+cmd] {file}
Find {file} in 'path' and then |:edit| it.
{not available when the |+file_in_path| feature was
disabled at compile time}
:{count}fin[d][!] [++opt] [+cmd] {file}
Just like ":find", but use the {count} match in
@@ -322,8 +320,6 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is
For Unix the '~' character is expanded, like in
"~user/file". Environment variables are expanded too
|expand-env|.
{not available when the |+file_in_path| feature was
disabled at compile time}
*v_gf*
{Visual}[count]gf Same as "gf", but the highlighted text is used as the
@@ -1707,8 +1703,6 @@ problem goes away the next day.
==============================================================================
11. File Searching *file-searching*
{not available when compiled without the |+path_extra| feature}
The file searching is currently used for the 'path', 'cdpath' and 'tags'
options, for |finddir()| and |findfile()|. Other commands use |wildcards|
which is slightly different.
+1 -7
View File
@@ -1564,8 +1564,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'cdpath'* *'cd'* *E344* *E346*
'cdpath' 'cd' string (default: equivalent to $CDPATH or ",,")
global
{not available when compiled without the
|+file_in_path| feature}
This is a list of directories which will be searched when using the
|:cd|, |:tcd| and |:lcd| commands, provided that the directory being
searched for has a relative path, not an absolute part starting with
@@ -6083,7 +6081,6 @@ A jump table for the options with a short description can be found at |Q_op|.
"http://www.vim.org" will make ":find index.html" work.
- Search upwards and downwards in a directory tree using "*", "**" and
";". See |file-searching| for info and syntax.
{not available when compiled without the |+path_extra| feature}
- Careful with '\' characters, type two to get one in the option: >
:set path=.,c:\\include
< Or just use '/' instead: >
@@ -7858,8 +7855,6 @@ A jump table for the options with a short description can be found at |Q_op|.
*'suffixesadd'* *'sua'*
'suffixesadd' 'sua' string (default "")
local to buffer
{not available when compiled without the
|+file_in_path| feature}
Comma-separated list of suffixes, which are used when searching for a
file for the "gf", "[I", etc. commands. Example: >
:set suffixesadd=.java
@@ -8137,8 +8132,7 @@ A jump table for the options with a short description can be found at |Q_op|.
a directory tree. See |file-searching|. E.g., "/lib/**/tags" will
find all files named "tags" below "/lib". The filename itself cannot
contain wildcards, it is used as-is. E.g., "/lib/**/tags?" will find
files called "tags?". {not available when compiled without the
|+path_extra| feature}
files called "tags?".
The |tagfiles()| function can be used to get a list of the file names
actually used.
If Vim was compiled with the |+emacs_tags| feature, Emacs-style tag
-2
View File
@@ -81,8 +81,6 @@ For the related autocommands see |tabnew-autocmd|.
:[count]tabf[ind] [++opt] [+cmd] {file} *:tabf* *:tabfind*
Open a new tab page and edit {file} in 'path', like with
|:find|. For [count] see |:tabnew| above.
{not available when the |+file_in_path| feature was disabled
at compile time}
:[count]tab {cmd} *:tab*
Execute {cmd} and when it opens a new window open a new tab
+2 -1
View File
@@ -434,7 +434,8 @@ T *+num64* 64-bit Number support |Number|
m *+odbeditor* MacVim only: ODB Editor Protocol support |odbeditor|
m *+ole* Win32 GUI only: |ole-interface|
N *+packages* Loading |packages|
N *+path_extra* Up/downwards search in 'path' and 'tags'
T *+path_extra* Up/downwards search in 'path' and 'tags' Always
enabled since 9.0.0270
m *+perl* Perl interface |perl|
m *+perl/dyn* Perl interface |perl-dynamic| |/dyn|
N *+persistent_undo* Persistent undo |undo-persistence|
-8
View File
@@ -843,30 +843,22 @@ CTRL-W CTRL-F Split current window in two. Edit file name under cursor.
If the name is a hypertext link that looks like
"type://machine/path", only "/path" is used.
If a count is given, the count'th matching file is edited.
{not available when the |+file_in_path| feature was disabled
at compile time}
CTRL-W F *CTRL-W_F*
Split current window in two. Edit file name under cursor and
jump to the line number following the file name. See |gF| for
details on how the line number is obtained.
{not available when the |+file_in_path| feature was disabled
at compile time}
CTRL-W gf *CTRL-W_gf*
Open a new tab page and edit the file name under the cursor.
Like "tab split" and "gf", but the new tab page isn't created
if the file does not exist.
{not available when the |+file_in_path| feature was disabled
at compile time}
CTRL-W gF *CTRL-W_gF*
Open a new tab page and edit the file name under the cursor
and jump to the line number following the file name. Like
"tab split" and "gF", but the new tab page isn't created if
the file does not exist.
{not available when the |+file_in_path| feature was disabled
at compile time}
CTRL-W gt *CTRL-W_gt*
Go to next tab page, same as `gt`.
+2 -4
View File
@@ -158,10 +158,10 @@ alloc(size_t size)
void *
alloc_id(size_t size, alloc_id_T id UNUSED)
{
#ifdef FEAT_EVAL
# ifdef FEAT_EVAL
if (alloc_fail_id == id && alloc_does_fail(size))
return NULL;
#endif
# endif
return lalloc(size, TRUE);
}
#endif
@@ -425,9 +425,7 @@ free_all_mem(void)
}
free_titles();
# if defined(FEAT_SEARCHPATH)
free_findfile();
# endif
// Obviously named calls.
free_all_autocmds();
+19 -41
View File
@@ -220,7 +220,10 @@ open_buffer(
// mark cursor position as being invalid
curwin->w_valid = 0;
// Read the file if there is one.
if (curbuf->b_ffname != NULL
&& !bt_quickfix(curbuf)
&& !bt_nofilename(curbuf)
#ifdef FEAT_NETBEANS_INTG
&& netbeansReadFile
#endif
@@ -1327,11 +1330,7 @@ do_buffer_ext(
return FAIL;
}
#ifdef FEAT_PROP_POPUP
if ((flags & DOBUF_NOPOPUP) && bt_popup(buf)
# ifdef FEAT_TERMINAL
&& !bt_terminal(buf)
#endif
)
if ((flags & DOBUF_NOPOPUP) && bt_popup(buf) && !bt_terminal(buf))
return OK;
#endif
@@ -1444,11 +1443,7 @@ do_buffer_ext(
{
// Skip current and unlisted bufs. Also skip a quickfix
// buffer, it might be deleted soon.
if (buf == curbuf || !buf->b_p_bl
#if defined(FEAT_QUICKFIX)
|| bt_quickfix(buf)
#endif
)
if (buf == curbuf || !buf->b_p_bl || bt_quickfix(buf))
buf = NULL;
else if (buf->b_ml.ml_mfp == NULL)
{
@@ -1486,10 +1481,7 @@ do_buffer_ext(
}
// in non-help buffer, try to skip help buffers, and vv
if (buf->b_help == curbuf->b_help && buf->b_p_bl
#if defined(FEAT_QUICKFIX)
&& !bt_quickfix(buf)
#endif
)
&& !bt_quickfix(buf))
{
if (buf->b_ml.ml_mfp != NULL) // found loaded buffer
break;
@@ -1507,11 +1499,7 @@ do_buffer_ext(
if (buf == NULL) // No loaded buffer, find listed one
{
FOR_ALL_BUFFERS(buf)
if (buf->b_p_bl && buf != curbuf
#if defined(FEAT_QUICKFIX)
&& !bt_quickfix(buf)
#endif
)
if (buf->b_p_bl && buf != curbuf && !bt_quickfix(buf))
break;
}
if (buf == NULL) // Still no buffer, just take one
@@ -1520,10 +1508,8 @@ do_buffer_ext(
buf = curbuf->b_next;
else
buf = curbuf->b_prev;
#if defined(FEAT_QUICKFIX)
if (bt_quickfix(buf))
buf = NULL;
#endif
}
}
@@ -1986,9 +1972,7 @@ curbuf_reusable(void)
&& curbuf->b_ffname == NULL
&& curbuf->b_nwindows <= 1
&& (curbuf->b_ml.ml_mfp == NULL || BUFEMPTY())
#if defined(FEAT_QUICKFIX)
&& !bt_quickfix(curbuf)
#endif
&& !curbufIsChanged());
}
@@ -2344,9 +2328,7 @@ free_buf_options(
clear_string_option(&buf->b_s.b_p_spl);
clear_string_option(&buf->b_s.b_p_spo);
#endif
#ifdef FEAT_SEARCHPATH
clear_string_option(&buf->b_p_sua);
#endif
clear_string_option(&buf->b_p_ft);
clear_string_option(&buf->b_p_cink);
clear_string_option(&buf->b_p_cino);
@@ -3786,15 +3768,9 @@ fileinfo(
vim_snprintf_add(buffer, IOSIZE, "\"%s%s%s%s%s%s",
curbufIsChanged() ? (shortmess(SHM_MOD)
? " [+]" : _(" [Modified]")) : " ",
(curbuf->b_flags & BF_NOTEDITED)
#ifdef FEAT_QUICKFIX
&& !bt_dontwrite(curbuf)
#endif
(curbuf->b_flags & BF_NOTEDITED) && !bt_dontwrite(curbuf)
? _("[Not edited]") : "",
(curbuf->b_flags & BF_NEW)
#ifdef FEAT_QUICKFIX
&& !bt_dontwrite(curbuf)
#endif
(curbuf->b_flags & BF_NEW) && !bt_dontwrite(curbuf)
? new_file_message() : "",
(curbuf->b_flags & BF_READERR) ? _("[Read errors]") : "",
curbuf->b_p_ro ? (shortmess(SHM_RO) ? _("[RO]")
@@ -5681,27 +5657,31 @@ bt_normal(buf_T *buf)
return buf != NULL && buf->b_p_bt[0] == NUL;
}
#if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* Return TRUE if "buf" is the quickfix buffer.
*/
int
bt_quickfix(buf_T *buf)
bt_quickfix(buf_T *buf UNUSED)
{
#ifdef FEAT_QUICKFIX
return buf != NULL && buf->b_p_bt[0] == 'q';
}
#else
return FALSE;
#endif
}
#if defined(FEAT_TERMINAL) || defined(PROTO)
/*
* Return TRUE if "buf" is a terminal buffer.
*/
int
bt_terminal(buf_T *buf)
bt_terminal(buf_T *buf UNUSED)
{
#if defined(FEAT_TERMINAL)
return buf != NULL && buf->b_p_bt[0] == 't';
}
#else
return FALSE;
#endif
}
/*
* Return TRUE if "buf" is a help buffer.
@@ -5769,7 +5749,6 @@ bt_dontwrite(buf_T *buf)
|| buf->b_p_bt[0] == 'p');
}
#if defined(FEAT_QUICKFIX) || defined(PROTO)
int
bt_dontwrite_msg(buf_T *buf)
{
@@ -5780,7 +5759,6 @@ bt_dontwrite_msg(buf_T *buf)
}
return FALSE;
}
#endif
/*
* Return TRUE if the buffer should be hidden, according to 'hidden', ":hide"
-8
View File
@@ -742,9 +742,7 @@ buf_write(
&& reset_changed
&& whole
&& buf == curbuf
#ifdef FEAT_QUICKFIX
&& !bt_nofilename(buf)
#endif
&& !filtering
&& (!append || vim_strchr(p_cpo, CPO_FNAMEAPP) != NULL)
&& vim_strchr(p_cpo, CPO_FNAMEW) != NULL)
@@ -813,11 +811,9 @@ buf_write(
if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEAPPENDCMD,
sfname, sfname, FALSE, curbuf, eap)))
{
#ifdef FEAT_QUICKFIX
if (overwriting && bt_nofilename(curbuf))
nofile_err = TRUE;
else
#endif
apply_autocmds_exarg(EVENT_FILEAPPENDPRE,
sfname, sfname, FALSE, curbuf, eap);
}
@@ -846,11 +842,9 @@ buf_write(
}
else
{
#ifdef FEAT_QUICKFIX
if (overwriting && bt_nofilename(curbuf))
nofile_err = TRUE;
else
#endif
apply_autocmds_exarg(EVENT_BUFWRITEPRE,
sfname, sfname, FALSE, curbuf, eap);
}
@@ -860,11 +854,9 @@ buf_write(
if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEWRITECMD,
sfname, sfname, FALSE, curbuf, eap)))
{
#ifdef FEAT_QUICKFIX
if (overwriting && bt_nofilename(curbuf))
nofile_err = TRUE;
else
#endif
apply_autocmds_exarg(EVENT_FILEWRITEPRE,
sfname, sfname, FALSE, curbuf, eap);
}
+1 -5
View File
@@ -100,11 +100,7 @@ changed(void)
// Create a swap file if that is wanted.
// Don't do this for "nofile" and "nowrite" buffer types.
if (curbuf->b_may_swap
#ifdef FEAT_QUICKFIX
&& !bt_dontwrite(curbuf)
#endif
)
if (curbuf->b_may_swap && !bt_dontwrite(curbuf))
{
int save_need_wait_return = need_wait_return;
+1 -5
View File
@@ -482,11 +482,7 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED)
len += (int)STRLEN(p + len);
}
#endif
if (bufIsChanged(wp->w_buffer)
#ifdef FEAT_TERMINAL
&& !bt_terminal(wp->w_buffer)
#endif
)
if (bufIsChanged(wp->w_buffer) && !bt_terminal(wp->w_buffer))
{
vim_snprintf((char *)p + len, MAXPATHL - len, "%s", "[+]");
len += (int)STRLEN(p + len);
+1 -7
View File
@@ -850,11 +850,8 @@ EXTERN char e_internal_error_lalloc_zero[]
INIT(= N_("E341: Internal error: lalloc(0, )"));
EXTERN char e_out_of_memory_allocating_nr_bytes[]
INIT(= N_("E342: Out of memory! (allocating %lu bytes)"));
#ifdef FEAT_PATH_EXTRA
EXTERN char e_invalid_path_number_must_be_at_end_of_path_or_be_followed_by_str[]
INIT(= N_("E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'."));
#endif
#ifdef FEAT_SEARCHPATH
EXTERN char e_cant_find_directory_str_in_cdpath[]
INIT(= N_("E344: Can't find directory \"%s\" in cdpath"));
EXTERN char e_cant_find_file_str_in_path[]
@@ -863,7 +860,6 @@ EXTERN char e_no_more_directory_str_found_in_cdpath[]
INIT(= N_("E346: No more directory \"%s\" found in cdpath"));
EXTERN char e_no_more_file_str_found_in_path[]
INIT(= N_("E347: No more file \"%s\" found in path"));
#endif
EXTERN char e_no_string_under_cursor[]
INIT(= N_("E348: No string under cursor"));
EXTERN char e_no_identifier_under_cursor[]
@@ -955,9 +951,9 @@ EXTERN char e_at_bottom_of_quickfix_stack[]
INIT(= N_("E380: At bottom of quickfix stack"));
EXTERN char e_at_top_of_quickfix_stack[]
INIT(= N_("E381: At top of quickfix stack"));
#endif
EXTERN char e_cannot_write_buftype_option_is_set[]
INIT(= N_("E382: Cannot write, 'buftype' option is set"));
#endif
EXTERN char e_invalid_search_string_str[]
INIT(= N_("E383: Invalid search string: %s"));
EXTERN char e_search_hit_top_without_match_for_str[]
@@ -1091,12 +1087,10 @@ EXTERN char e_cannot_close_last_window[]
INIT(= N_("E444: Cannot close last window"));
EXTERN char e_other_window_contains_changes[]
INIT(= N_("E445: Other window contains changes"));
#ifdef FEAT_SEARCHPATH
EXTERN char e_no_file_name_under_cursor[]
INIT(= N_("E446: No file name under cursor"));
EXTERN char e_cant_find_file_str_in_path_2[]
INIT(= N_("E447: Can't find file \"%s\" in path"));
#endif
#ifdef USING_LOAD_LIBRARY
EXTERN char e_could_not_load_library_function_str[]
INIT(= N_("E448: Could not load library function %s"));
+1 -5
View File
@@ -93,11 +93,7 @@ find_buffer(typval_T *avar)
// buffer, these don't use the full path.
FOR_ALL_BUFFERS(buf)
if (buf->b_fname != NULL
&& (path_with_url(buf->b_fname)
#ifdef FEAT_QUICKFIX
|| bt_nofilename(buf)
#endif
)
&& (path_with_url(buf->b_fname) || bt_nofilename(buf))
&& STRCMP(buf->b_fname, avar->vval.v_string) == 0)
break;
}
+3 -15
View File
@@ -1935,7 +1935,7 @@ static funcentry_T global_functions[] =
ret_dict_any, f_getreginfo},
{"getregtype", 0, 1, FEARG_1, arg1_string,
ret_string, f_getregtype},
{"getscriptinfo", 0, 0, 0, NULL,
{"getscriptinfo", 0, 1, 0, arg1_dict_any,
ret_list_dict_any, f_getscriptinfo},
{"gettabinfo", 0, 1, FEARG_1, arg1_number,
ret_list_dict_any, f_gettabinfo},
@@ -5646,13 +5646,7 @@ f_has(typval_T *argvars, typval_T *rettv)
0
#endif
},
{"file_in_path",
#ifdef FEAT_SEARCHPATH
1
#else
0
#endif
},
{"file_in_path", 1},
{"filterpipe",
#if defined(FEAT_FILTERPIPE) && !defined(VIMDLL)
1
@@ -5974,13 +5968,7 @@ f_has(typval_T *argvars, typval_T *rettv)
0
#endif
},
{"path_extra",
#ifdef FEAT_PATH_EXTRA
1
#else
0
#endif
},
{"path_extra", 1},
{"perl",
#if defined(FEAT_PERL) && !defined(DYNAMIC_PERL)
1
+2 -11
View File
@@ -1677,12 +1677,7 @@ append_redir(
(char *)opt, (char *)fname);
}
else
vim_snprintf((char *)end, (size_t)(buflen - (end - buf)),
#ifdef FEAT_QUICKFIX
" %s %s",
#else
" %s%s", // " > %s" causes problems on Amiga
#endif
vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), " %s %s",
(char *)opt, (char *)fname);
}
@@ -1947,11 +1942,7 @@ do_write(exarg_T *eap)
* and a file name is required.
* "nofile" and "nowrite" buffers cannot be written implicitly either.
*/
if (!other && (
#ifdef FEAT_QUICKFIX
bt_dontwrite_msg(curbuf) ||
#endif
check_fname() == FAIL
if (!other && (bt_dontwrite_msg(curbuf) || check_fname() == FAIL
#ifdef UNIX
|| check_writable(curbuf->b_ffname) == FAIL
#endif
-2
View File
@@ -27,10 +27,8 @@ autowrite(buf_T *buf, int forceit)
bufref_T bufref;
if (!(p_aw || p_awa) || !p_write
#ifdef FEAT_QUICKFIX
// never autowrite a "nofile" or "nowrite" buffer
|| bt_dontwrite(buf)
#endif
|| (!forceit && buf->b_p_ro) || buf->b_ffname == NULL)
return FAIL;
set_bufref(&bufref, buf);
+1 -18
View File
@@ -55,8 +55,6 @@ static int getargopt(exarg_T *eap);
# define qf_history ex_ni
# define ex_helpgrep ex_ni
# define ex_vimgrep ex_ni
#endif
#if !defined(FEAT_QUICKFIX)
# define ex_cclose ex_ni
# define ex_copen ex_ni
# define ex_cwindow ex_ni
@@ -6686,9 +6684,7 @@ ex_wrongmodifier(exarg_T *eap)
ex_splitview(exarg_T *eap)
{
win_T *old_curwin = curwin;
#if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE)
char_u *fname = NULL;
#endif
#ifdef FEAT_BROWSE
char_u dot_path[] = ".";
int save_cmod_flags = cmdmod.cmod_flags;
@@ -6716,7 +6712,6 @@ ex_splitview(exarg_T *eap)
}
#endif
#ifdef FEAT_SEARCHPATH
if (eap->cmdidx == CMD_sfind || eap->cmdidx == CMD_tabfind)
{
fname = find_file_in_path(eap->arg, (int)STRLEN(eap->arg),
@@ -6726,11 +6721,7 @@ ex_splitview(exarg_T *eap)
eap->arg = fname;
}
# ifdef FEAT_BROWSE
else
# endif
#endif
#ifdef FEAT_BROWSE
if ((cmdmod.cmod_flags & CMOD_BROWSE)
else if ((cmdmod.cmod_flags & CMOD_BROWSE)
&& eap->cmdidx != CMD_vnew
&& eap->cmdidx != CMD_new)
{
@@ -6794,10 +6785,8 @@ ex_splitview(exarg_T *eap)
cmdmod.cmod_flags = save_cmod_flags;
# endif
# if defined(FEAT_SEARCHPATH) || defined(FEAT_BROWSE)
theend:
vim_free(fname);
# endif
}
/*
@@ -6988,7 +6977,6 @@ ex_resize(exarg_T *eap)
static void
ex_find(exarg_T *eap)
{
#ifdef FEAT_SEARCHPATH
char_u *fname;
int count;
@@ -7010,12 +6998,9 @@ ex_find(exarg_T *eap)
if (fname != NULL)
{
eap->arg = fname;
#endif
do_exedit(eap, NULL);
#ifdef FEAT_SEARCHPATH
vim_free(fname);
}
#endif
}
/*
@@ -9291,7 +9276,6 @@ eval_vars(
}
break;
#ifdef FEAT_SEARCHPATH
case SPEC_CFILE: // file name under cursor
result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL);
if (result == NULL)
@@ -9301,7 +9285,6 @@ eval_vars(
}
resultbuf = result; // remember allocated string
break;
#endif
case SPEC_AFILE: // file name for autocommand
result = autocmd_fname;
+6 -20
View File
@@ -97,6 +97,7 @@
* These features used to be optional but are now always enabled:
* +windows Multiple windows. Without this there is no help
* window and no status lines.
* +autocmd Automatic commands
* +vertsplit Vertically split windows.
* +cmdhist Command line history.
* +localmap Mappings and abbreviations local to a buffer.
@@ -115,6 +116,8 @@
* +cindent C code indenting (From Eric Fischer).
* +smartindent smart C code indenting when the 'si' option is set.
* +textobjects Text objects: "vaw", "das", etc.
* +file_in_path "gf" and "<cfile>" commands.
* +path_extra up/downwards searching in 'path' and 'tags'.
*
* Obsolete:
* +tag_old_static Old style static tags: "file:tag file ..".
@@ -201,27 +204,11 @@
# define FEAT_QUICKFIX
#endif
/*
* +file_in_path "gf" and "<cfile>" commands.
*/
#ifdef FEAT_NORMAL
# define FEAT_SEARCHPATH
#endif
/*
* +find_in_path "[I" ":isearch" "^W^I", ":checkpath", etc.
*/
#ifdef FEAT_NORMAL
# ifdef FEAT_SEARCHPATH // FEAT_SEARCHPATH is required
# define FEAT_FIND_ID
# endif
#endif
/*
* +path_extra up/downwards searching in 'path' and 'tags'.
*/
#ifdef FEAT_NORMAL
# define FEAT_PATH_EXTRA
# define FEAT_FIND_ID
#endif
/*
@@ -324,7 +311,6 @@
/*
* +diff Displaying diffs in a nice way.
* Requires +windows and +autocmd.
* Can be enabled in autoconf already.
*/
#if defined(FEAT_NORMAL) && !defined(FEAT_DIFF)
@@ -380,14 +366,14 @@
/*
* +syntax syntax highlighting. When using this, it's a good
* idea to have +autocmd and +eval too.
* idea to have +eval too.
*/
#if defined(FEAT_NORMAL) || defined(PROTO)
# define FEAT_SYN_HL
#endif
/*
* +conceal 'conceal' option. Needs syntax highlighting
* +conceal 'conceal' option. Depends on syntax highlighting
* as this is how the concealed text is defined.
*/
#if defined(FEAT_BIG) && defined(FEAT_SYN_HL)
-6
View File
@@ -514,9 +514,7 @@ readfile(
// Create a swap file now, so that other Vims are warned
// that we are editing this file. Don't do this for a
// "nofile" or "nowrite" buffer type.
#ifdef FEAT_QUICKFIX
if (!bt_dontwrite(curbuf))
#endif
{
check_need_swap(newfile);
// SwapExists autocommand may mess things up
@@ -595,9 +593,7 @@ readfile(
// Create a swap file now, so that other Vims are warned that we are
// editing this file.
// Don't do this for a "nofile" or "nowrite" buffer type.
#ifdef FEAT_QUICKFIX
if (!bt_dontwrite(curbuf))
#endif
{
check_need_swap(newfile);
if (!read_stdin && (curbuf != old_curbuf
@@ -3407,9 +3403,7 @@ shorten_buf_fname(buf_T *buf, char_u *dirname, int force)
char_u *p;
if (buf->b_fname != NULL
#ifdef FEAT_QUICKFIX
&& !bt_nofilename(buf)
#endif
&& !path_with_url(buf->b_fname)
&& (force
|| buf->b_sfname == NULL
-10
View File
@@ -942,7 +942,6 @@ findfilendir(
typval_T *rettv,
int find_what UNUSED)
{
#ifdef FEAT_SEARCHPATH
char_u *fname;
char_u *fresult = NULL;
char_u *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path;
@@ -951,7 +950,6 @@ findfilendir(
int count = 1;
int first = TRUE;
int error = FALSE;
#endif
rettv->vval.v_string = NULL;
rettv->v_type = VAR_STRING;
@@ -962,7 +960,6 @@ findfilendir(
&& check_for_opt_number_arg(argvars, 2) == FAIL)))
return;
#ifdef FEAT_SEARCHPATH
fname = tv_get_string(&argvars[0]);
if (argvars[1].v_type != VAR_UNKNOWN)
@@ -1006,7 +1003,6 @@ findfilendir(
if (rettv->v_type == VAR_STRING)
rettv->vval.v_string = fresult;
#endif
}
/*
@@ -3879,9 +3875,7 @@ gen_expand_wildcards(
static int recursive = FALSE;
int add_pat;
int retval = OK;
#if defined(FEAT_SEARCHPATH)
int did_expand_in_path = FALSE;
#endif
/*
* expand_env() is called to expand things like "~user". If this fails,
@@ -3971,7 +3965,6 @@ gen_expand_wildcards(
*/
if (mch_has_exp_wildcard(p) || (flags & EW_ICASE))
{
#if defined(FEAT_SEARCHPATH)
if ((flags & EW_PATH)
&& !mch_isFullName(p)
&& !(p[0] == '.'
@@ -3987,7 +3980,6 @@ gen_expand_wildcards(
did_expand_in_path = TRUE;
}
else
#endif
add_pat = mch_expandpath(&ga, p, flags);
}
}
@@ -4007,10 +3999,8 @@ gen_expand_wildcards(
vim_free(t);
}
#if defined(FEAT_SEARCHPATH)
if (did_expand_in_path && ga.ga_len > 0 && (flags & EW_PATH))
uniquefy_paths(&ga, p);
#endif
if (p != pat[i])
vim_free(p);
}
+12 -111
View File
@@ -67,9 +67,7 @@ typedef struct ff_stack
// the fix part (no wildcards) and the part containing the wildcards
// of the search path
char_u *ffs_fix_path;
#ifdef FEAT_PATH_EXTRA
char_u *ffs_wc_path;
#endif
// files/dirs found in the above directory, matched by the first wildcard
// of wc_part
@@ -97,11 +95,10 @@ typedef struct ff_visited
{
struct ff_visited *ffv_next;
#ifdef FEAT_PATH_EXTRA
// Visited directories are different if the wildcard string are
// different. So we have to save it.
char_u *ffv_wc_path;
#endif
// for unix use inode etc for comparison (needed because of links), else
// use filename.
#ifdef UNIX
@@ -173,21 +170,15 @@ typedef struct ff_search_ctx_T
char_u *ffsc_file_to_search;
char_u *ffsc_start_dir;
char_u *ffsc_fix_path;
#ifdef FEAT_PATH_EXTRA
char_u *ffsc_wc_path;
int ffsc_level;
char_u **ffsc_stopdirs_v;
#endif
int ffsc_find_what;
int ffsc_tagfile;
} ff_search_ctx_T;
// locally needed functions
#ifdef FEAT_PATH_EXTRA
static int ff_check_visited(ff_visited_T **, char_u *, char_u *);
#else
static int ff_check_visited(ff_visited_T **, char_u *);
#endif
static void vim_findfile_free_visited(void *search_ctx_arg);
static void vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp);
static void ff_free_visited_list(ff_visited_T *vl);
@@ -197,14 +188,8 @@ static void ff_push(ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr);
static ff_stack_T *ff_pop(ff_search_ctx_T *search_ctx);
static void ff_clear(ff_search_ctx_T *search_ctx);
static void ff_free_stack_element(ff_stack_T *stack_ptr);
#ifdef FEAT_PATH_EXTRA
static ff_stack_T *ff_create_stack_element(char_u *, char_u *, int, int);
#else
static ff_stack_T *ff_create_stack_element(char_u *, int, int);
#endif
#ifdef FEAT_PATH_EXTRA
static int ff_path_in_stoplist(char_u *, int, char_u **);
#endif
static char_u *ff_expand_buffer = NULL; // used for expanding filenames
@@ -306,9 +291,7 @@ vim_findfile_init(
int tagfile, // expanding names of tags files
char_u *rel_fname) // file name to use for "."
{
#ifdef FEAT_PATH_EXTRA
char_u *wc_part;
#endif
ff_stack_T *sptr;
ff_search_ctx_T *search_ctx;
@@ -409,7 +392,6 @@ vim_findfile_init(
#endif
}
#ifdef FEAT_PATH_EXTRA
/*
* If stopdirs are given, split them into an array of pointers.
* If this fails (mem allocation), there is no upward search at all or a
@@ -464,9 +446,7 @@ vim_findfile_init(
search_ctx->ffsc_stopdirs_v[dircount-1] = NULL;
}
}
#endif
#ifdef FEAT_PATH_EXTRA
search_ctx->ffsc_level = level;
/*
@@ -531,7 +511,6 @@ vim_findfile_init(
goto error_return;
}
else
#endif
search_ctx->ffsc_fix_path = vim_strsave(path);
if (search_ctx->ffsc_start_dir == NULL)
@@ -565,7 +544,6 @@ vim_findfile_init(
STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
add_pathsep(ff_expand_buffer);
}
#ifdef FEAT_PATH_EXTRA
else
{
char_u *p = gettail(search_ctx->ffsc_fix_path);
@@ -612,15 +590,11 @@ vim_findfile_init(
search_ctx->ffsc_wc_path = temp;
}
}
#endif
vim_free(buf);
}
sptr = ff_create_stack_element(ff_expand_buffer,
#ifdef FEAT_PATH_EXTRA
search_ctx->ffsc_wc_path,
#endif
level, 0);
search_ctx->ffsc_wc_path, level, 0);
if (sptr == NULL)
goto error_return;
@@ -643,7 +617,6 @@ error_return:
return NULL;
}
#if defined(FEAT_PATH_EXTRA) || defined(PROTO)
/*
* Get the stopdir string. Check that ';' is not escaped.
*/
@@ -672,7 +645,6 @@ vim_findfile_stopdir(char_u *buf)
r_ptr = NULL;
return r_ptr;
}
#endif
/*
* Clean up the given search context. Can handle a NULL pointer.
@@ -704,19 +676,13 @@ vim_findfile_cleanup(void *ctx)
vim_findfile(void *search_ctx_arg)
{
char_u *file_path;
#ifdef FEAT_PATH_EXTRA
char_u *rest_of_wildcards;
char_u *path_end = NULL;
#endif
ff_stack_T *stackp;
#if defined(FEAT_SEARCHPATH) || defined(FEAT_PATH_EXTRA)
int len;
#endif
int i;
char_u *p;
#ifdef FEAT_SEARCHPATH
char_u *suf;
#endif
ff_search_ctx_T *search_ctx;
if (search_ctx_arg == NULL)
@@ -731,18 +697,14 @@ vim_findfile(void *search_ctx_arg)
if ((file_path = alloc(MAXPATHL)) == NULL)
return NULL;
#ifdef FEAT_PATH_EXTRA
// store the end of the start dir -- needed for upward search
if (search_ctx->ffsc_start_dir != NULL)
path_end = &search_ctx->ffsc_start_dir[
STRLEN(search_ctx->ffsc_start_dir)];
#endif
#ifdef FEAT_PATH_EXTRA
// upward search loop
for (;;)
{
#endif
// downward search loop
for (;;)
{
@@ -778,11 +740,7 @@ vim_findfile(void *search_ctx_arg)
if (stackp->ffs_filearray == NULL
&& ff_check_visited(&search_ctx->ffsc_dir_visited_list
->ffvl_visited_list,
stackp->ffs_fix_path
#ifdef FEAT_PATH_EXTRA
, stackp->ffs_wc_path
#endif
) == FAIL)
stackp->ffs_fix_path, stackp->ffs_wc_path) == FAIL)
{
#ifdef FF_VERBOSE
if (p_verbose >= 5)
@@ -863,7 +821,6 @@ vim_findfile(void *search_ctx_arg)
goto fail;
}
#ifdef FEAT_PATH_EXTRA
rest_of_wildcards = stackp->ffs_wc_path;
if (*rest_of_wildcards != NUL)
{
@@ -923,7 +880,6 @@ vim_findfile(void *search_ctx_arg)
if (vim_ispathsep(*rest_of_wildcards))
rest_of_wildcards++;
}
#endif
/*
* Expand wildcards like "*" and "$VAR".
@@ -951,18 +907,14 @@ vim_findfile(void *search_ctx_arg)
stackp->ffs_filearray_cur = 0;
stackp->ffs_stage = 0;
}
#ifdef FEAT_PATH_EXTRA
else
rest_of_wildcards = &stackp->ffs_wc_path[
STRLEN(stackp->ffs_wc_path)];
#endif
if (stackp->ffs_stage == 0)
{
// this is the first time we work on this directory
#ifdef FEAT_PATH_EXTRA
if (*rest_of_wildcards == NUL)
#endif
{
/*
* We don't have further wildcards to expand, so we have to
@@ -995,14 +947,12 @@ vim_findfile(void *search_ctx_arg)
* Try without extra suffix and then with suffixes
* from 'suffixesadd'.
*/
#ifdef FEAT_SEARCHPATH
len = (int)STRLEN(file_path);
if (search_ctx->ffsc_tagfile)
suf = (char_u *)"";
else
suf = curbuf->b_p_sua;
for (;;)
#endif
{
// if file exists and we didn't already find it
if ((path_with_url(file_path)
@@ -1014,23 +964,17 @@ vim_findfile(void *search_ctx_arg)
== mch_isdir(file_path)))))
#ifndef FF_VERBOSE
&& (ff_check_visited(
&search_ctx->ffsc_visited_list->ffvl_visited_list,
file_path
#ifdef FEAT_PATH_EXTRA
, (char_u *)""
#endif
) == OK)
&search_ctx->ffsc_visited_list
->ffvl_visited_list,
file_path, (char_u *)"") == OK)
#endif
)
{
#ifdef FF_VERBOSE
if (ff_check_visited(
&search_ctx->ffsc_visited_list->ffvl_visited_list,
file_path
#ifdef FEAT_PATH_EXTRA
, (char_u *)""
#endif
) == FAIL)
&search_ctx->ffsc_visited_list
->ffvl_visited_list,
file_path, (char_u *)"") == FAIL)
{
if (p_verbose >= 5)
{
@@ -1072,17 +1016,14 @@ vim_findfile(void *search_ctx_arg)
return file_path;
}
#ifdef FEAT_SEARCHPATH
// Not found or found already, try next suffix.
if (*suf == NUL)
break;
copy_option_part(&suf, file_path + len,
MAXPATHL - len, ",");
#endif
}
}
}
#ifdef FEAT_PATH_EXTRA
else
{
/*
@@ -1102,12 +1043,10 @@ vim_findfile(void *search_ctx_arg)
stackp->ffs_level - 1, 0));
}
}
#endif
stackp->ffs_filearray_cur = 0;
stackp->ffs_stage = 1;
}
#ifdef FEAT_PATH_EXTRA
/*
* if wildcards contains '**' we have to descent till we reach the
* leaves of the directory tree.
@@ -1127,14 +1066,12 @@ vim_findfile(void *search_ctx_arg)
stackp->ffs_wc_path, stackp->ffs_level - 1, 1));
}
}
#endif
// we are done with the current directory
ff_free_stack_element(stackp);
}
#ifdef FEAT_PATH_EXTRA
// If we reached this, we didn't find anything downwards.
// Let's check if we should do an upward search.
if (search_ctx->ffsc_start_dir
@@ -1181,7 +1118,6 @@ vim_findfile(void *search_ctx_arg)
else
break;
}
#endif
fail:
vim_free(file_path);
@@ -1230,9 +1166,7 @@ ff_free_visited_list(ff_visited_T *vl)
while (vl != NULL)
{
vp = vl->ffv_next;
#ifdef FEAT_PATH_EXTRA
vim_free(vl->ffv_wc_path);
#endif
vim_free(vl);
vl = vp;
}
@@ -1306,7 +1240,6 @@ ff_get_visited_list(
return retptr;
}
#ifdef FEAT_PATH_EXTRA
/*
* check if two wildcard paths are equal. Returns TRUE or FALSE.
* They are equal if:
@@ -1347,7 +1280,6 @@ ff_wc_equal(char_u *s1, char_u *s2)
}
return s1[i] == s2[j];
}
#endif
/*
* maintains the list of already visited files and dirs
@@ -1361,11 +1293,8 @@ ff_wc_equal(char_u *s1, char_u *s2)
static int
ff_check_visited(
ff_visited_T **visited_list,
char_u *fname
#ifdef FEAT_PATH_EXTRA
, char_u *wc_path
#endif
)
char_u *fname,
char_u *wc_path)
{
ff_visited_T *vp;
#ifdef UNIX
@@ -1405,10 +1334,8 @@ ff_check_visited(
fnamecmp(vp->ffv_fname, ff_expand_buffer) == 0
)
{
#ifdef FEAT_PATH_EXTRA
// are the wildcard parts equal
if (ff_wc_equal(vp->ffv_wc_path, wc_path) == TRUE)
#endif
// already visited
return FAIL;
}
@@ -1437,12 +1364,10 @@ ff_check_visited(
#ifdef UNIX
}
#endif
#ifdef FEAT_PATH_EXTRA
if (wc_path != NULL)
vp->ffv_wc_path = vim_strsave(wc_path);
else
vp->ffv_wc_path = NULL;
#endif
vp->ffv_next = *visited_list;
*visited_list = vp;
@@ -1457,9 +1382,7 @@ ff_check_visited(
static ff_stack_T *
ff_create_stack_element(
char_u *fix_part,
#ifdef FEAT_PATH_EXTRA
char_u *wc_part,
#endif
int level,
int star_star_empty)
{
@@ -1482,17 +1405,11 @@ ff_create_stack_element(
fix_part = (char_u *)"";
new->ffs_fix_path = vim_strsave(fix_part);
#ifdef FEAT_PATH_EXTRA
if (wc_part == NULL)
wc_part = (char_u *)"";
new->ffs_wc_path = vim_strsave(wc_part);
#endif
if (new->ffs_fix_path == NULL
#ifdef FEAT_PATH_EXTRA
|| new->ffs_wc_path == NULL
#endif
)
if (new->ffs_fix_path == NULL || new->ffs_wc_path == NULL)
{
ff_free_stack_element(new);
new = NULL;
@@ -1540,9 +1457,7 @@ ff_free_stack_element(ff_stack_T *stack_ptr)
{
// vim_free handles possible NULL pointers
vim_free(stack_ptr->ffs_fix_path);
#ifdef FEAT_PATH_EXTRA
vim_free(stack_ptr->ffs_wc_path);
#endif
if (stack_ptr->ffs_filearray != NULL)
FreeWild(stack_ptr->ffs_filearray_size, stack_ptr->ffs_filearray);
@@ -1565,11 +1480,8 @@ ff_clear(ff_search_ctx_T *search_ctx)
vim_free(search_ctx->ffsc_file_to_search);
vim_free(search_ctx->ffsc_start_dir);
vim_free(search_ctx->ffsc_fix_path);
#ifdef FEAT_PATH_EXTRA
vim_free(search_ctx->ffsc_wc_path);
#endif
#ifdef FEAT_PATH_EXTRA
if (search_ctx->ffsc_stopdirs_v != NULL)
{
int i = 0;
@@ -1582,19 +1494,15 @@ ff_clear(ff_search_ctx_T *search_ctx)
vim_free(search_ctx->ffsc_stopdirs_v);
}
search_ctx->ffsc_stopdirs_v = NULL;
#endif
// reset everything
search_ctx->ffsc_file_to_search = NULL;
search_ctx->ffsc_start_dir = NULL;
search_ctx->ffsc_fix_path = NULL;
#ifdef FEAT_PATH_EXTRA
search_ctx->ffsc_wc_path = NULL;
search_ctx->ffsc_level = 0;
#endif
}
#ifdef FEAT_PATH_EXTRA
/*
* check if the given path is in the stopdirs
* returns TRUE if yes else FALSE
@@ -1631,9 +1539,7 @@ ff_path_in_stoplist(char_u *path, int path_len, char_u **stopdirs_v)
}
return FALSE;
}
#endif
#if defined(FEAT_SEARCHPATH) || defined(PROTO)
/*
* Find the file name "ptr[len]" in the path. Also finds directory names.
*
@@ -1882,12 +1788,8 @@ find_file_in_path_option(
buf[0] = 0;
copy_option_part(&dir, buf, MAXPATHL, " ,");
# ifdef FEAT_PATH_EXTRA
// get the stopdir string
r_ptr = vim_findfile_stopdir(buf);
# else
r_ptr = NULL;
# endif
fdip_search_ctx = vim_findfile_init(buf, ff_file_to_find,
r_ptr, 100, FALSE, find_what,
fdip_search_ctx, FALSE, rel_fname);
@@ -2636,7 +2538,6 @@ expand_in_path(
return gap->ga_len;
}
#endif // FEAT_SEARCHPATH
/*
* Converts a file name into a canonical form. It simplifies a file name into
-2
View File
@@ -1609,9 +1609,7 @@ EXTERN int netbeansSuppressNoLines INIT(= 0); // skip "No lines in buffer"
EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
#ifdef FEAT_EVAL
EXTERN char line_msg[] INIT(= N_(" line "));
#endif
#ifdef FEAT_CRYPT
EXTERN char need_key_msg[] INIT(= N_("Need encryption key for \"%s\""));
+2 -6
View File
@@ -2406,15 +2406,12 @@ update_mouseshape(int shape_idx)
/*
* Change directory to "new_dir". If FEAT_SEARCHPATH is defined, search
* 'cdpath' for relative directory names, otherwise just mch_chdir().
* Change directory to "new_dir". Search 'cdpath' for relative directory
* names, otherwise just mch_chdir().
*/
int
vim_chdir(char_u *new_dir)
{
#ifndef FEAT_SEARCHPATH
return mch_chdir((char *)new_dir);
#else
char_u *dir_name;
int r;
@@ -2425,7 +2422,6 @@ vim_chdir(char_u *new_dir)
r = mch_chdir((char *)dir_name);
vim_free(dir_name);
return r;
#endif
}
/*
+1 -4
View File
@@ -2152,10 +2152,7 @@ nb_do_cmd(
if (p_write
&& !buf->bufp->b_p_ro
&& buf->bufp->b_ffname != NULL
#ifdef FEAT_QUICKFIX
&& !bt_dontwrite(buf->bufp)
#endif
)
&& !bt_dontwrite(buf->bufp))
{
bufref_T bufref;
-6
View File
@@ -4061,7 +4061,6 @@ nv_down(cmdarg_T *cap)
}
}
#ifdef FEAT_SEARCHPATH
/*
* Grab the file name under the cursor and edit it.
*/
@@ -4104,7 +4103,6 @@ nv_gotofile(cmdarg_T *cap)
else
clearop(cap->oap);
}
#endif
/*
* <End> command: to end of current line or last line.
@@ -4451,12 +4449,10 @@ nv_brackets(cmdarg_T *cap)
old_pos = curwin->w_cursor;
curwin->w_cursor.coladd = 0; // TODO: don't do this for an error.
#ifdef FEAT_SEARCHPATH
// "[f" or "]f" : Edit file under the cursor (same as "gf")
if (cap->nchar == 'f')
nv_gotofile(cap);
else
#endif
#ifdef FEAT_FIND_ID
// Find the occurrence(s) of the identifier or define under cursor
@@ -6091,14 +6087,12 @@ nv_g_cmd(cmdarg_T *cap)
invoke_edit(cap, FALSE, 'g', FALSE);
break;
#ifdef FEAT_SEARCHPATH
// "gf": goto file, edit file under cursor
// "]f" and "[f": can also be used.
case 'f':
case 'F':
nv_gotofile(cap);
break;
#endif
// "g'm" and "g`m": jump to mark without setting pcmark
case '\'':
+1 -13
View File
@@ -223,7 +223,6 @@ set_init_1(int clean_arg)
}
}
#ifdef FEAT_SEARCHPATH
{
char_u *cdpath;
char_u *buf;
@@ -265,7 +264,6 @@ set_init_1(int clean_arg)
vim_free(cdpath);
}
}
#endif
#if defined(FEAT_POSTSCRIPT) && \
(defined(MSWIN) || defined(VMS) || defined(MAC) || defined(hpux))
@@ -5630,9 +5628,7 @@ get_varp(struct vimoption *p)
case PV_SI: return (char_u *)&(curbuf->b_p_si);
case PV_SN: return (char_u *)&(curbuf->b_p_sn);
case PV_STS: return (char_u *)&(curbuf->b_p_sts);
#ifdef FEAT_SEARCHPATH
case PV_SUA: return (char_u *)&(curbuf->b_p_sua);
#endif
case PV_SWF: return (char_u *)&(curbuf->b_p_swf);
#ifdef FEAT_SYN_HL
case PV_SMC: return (char_u *)&(curbuf->b_p_smc);
@@ -6191,10 +6187,8 @@ buf_copy_options(buf_T *buf, int flags)
buf->b_p_key = vim_strsave(p_key);
COPY_OPT_SCTX(buf, BV_KEY);
#endif
#ifdef FEAT_SEARCHPATH
buf->b_p_sua = vim_strsave(p_sua);
COPY_OPT_SCTX(buf, BV_SUA);
#endif
#ifdef FEAT_KEYMAP
buf->b_p_keymap = vim_strsave(p_keymap);
COPY_OPT_SCTX(buf, BV_KMAP);
@@ -6494,20 +6488,14 @@ set_context_in_set_cmd(
|| p == (char_u *)&p_path
|| p == (char_u *)&p_pp
|| p == (char_u *)&p_rtp
#ifdef FEAT_SEARCHPATH
|| p == (char_u *)&p_cdpath
#endif
#ifdef FEAT_SESSION
|| p == (char_u *)&p_vdir
#endif
)
{
xp->xp_context = EXPAND_DIRECTORIES;
if (p == (char_u *)&p_path
#ifdef FEAT_SEARCHPATH
|| p == (char_u *)&p_cdpath
#endif
)
if (p == (char_u *)&p_path || p == (char_u *)&p_cdpath)
xp->xp_backslash = XP_BS_THREE;
else
xp->xp_backslash = XP_BS_ONE;
-6
View File
@@ -800,9 +800,7 @@ EXTERN char_u *p_pex; // 'patchexpr'
#endif
EXTERN char_u *p_pm; // 'patchmode'
EXTERN char_u *p_path; // 'path'
#ifdef FEAT_SEARCHPATH
EXTERN char_u *p_cdpath; // 'cdpath'
#endif
#if defined(DYNAMIC_PERL)
EXTERN char_u *p_perldll; // 'perldll'
#endif
@@ -930,9 +928,7 @@ EXTERN int p_si; // 'smartindent'
EXTERN int p_sta; // 'smarttab'
EXTERN long p_sts; // 'softtabstop'
EXTERN int p_sb; // 'splitbelow'
#if defined(FEAT_SEARCHPATH)
EXTERN char_u *p_sua; // 'suffixesadd'
#endif
EXTERN int p_swf; // 'swapfile'
#ifdef FEAT_SYN_HL
EXTERN long p_smc; // 'synmaxcol'
@@ -1225,9 +1221,7 @@ enum
, BV_SPO
#endif
, BV_STS
#ifdef FEAT_SEARCHPATH
, BV_SUA
#endif
, BV_SW
, BV_SWF
#ifdef FEAT_EVAL
+1 -13
View File
@@ -126,9 +126,7 @@
# define PV_SPO OPT_BUF(BV_SPO)
#endif
#define PV_STS OPT_BUF(BV_STS)
#ifdef FEAT_SEARCHPATH
# define PV_SUA OPT_BUF(BV_SUA)
#endif
#define PV_SUA OPT_BUF(BV_SUA)
#define PV_SW OPT_BUF(BV_SW)
#define PV_SWF OPT_BUF(BV_SWF)
#ifdef FEAT_EVAL
@@ -594,13 +592,8 @@ static struct vimoption options[] =
{(char_u *)FALSE, (char_u *)0L}
SCTX_INIT},
{"cdpath", "cd", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE|P_COMMA|P_NODUP,
#ifdef FEAT_SEARCHPATH
(char_u *)&p_cdpath, PV_NONE,
{(char_u *)",,", (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCTX_INIT},
{"cedit", NULL, P_STRING,
#ifdef FEAT_CMDWIN
@@ -2492,13 +2485,8 @@ static struct vimoption options[] =
{(char_u *)".bak,~,.o,.h,.info,.swp,.obj",
(char_u *)0L} SCTX_INIT},
{"suffixesadd", "sua", P_STRING|P_VI_DEF|P_ALLOCED|P_ONECOMMA|P_NODUP,
#ifdef FEAT_SEARCHPATH
(char_u *)&p_sua, PV_SUA,
{(char_u *)"", (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
#endif
SCTX_INIT},
{"swapfile", "swf", P_BOOL|P_VI_DEF|P_RSTAT,
(char_u *)&p_swf, PV_SWF,
-2
View File
@@ -253,9 +253,7 @@ check_buf_options(buf_T *buf)
check_string_option(&buf->b_s.b_p_spl);
check_string_option(&buf->b_s.b_p_spo);
#endif
#ifdef FEAT_SEARCHPATH
check_string_option(&buf->b_p_sua);
#endif
check_string_option(&buf->b_p_cink);
check_string_option(&buf->b_p_cino);
check_string_option(&buf->b_p_cinsd);
-4
View File
@@ -914,7 +914,6 @@ get_spec_reg(
emsg(_(e_no_inserted_text_yet));
return TRUE;
#ifdef FEAT_SEARCHPATH
case Ctrl_F: // Filename under cursor
case Ctrl_P: // Path under cursor, expand via "path"
if (!errmsg)
@@ -923,7 +922,6 @@ get_spec_reg(
| (regname == Ctrl_P ? FNAME_EXP : 0), 1L, NULL);
*allocated = TRUE;
return TRUE;
#endif
case Ctrl_W: // word under cursor
case Ctrl_A: // WORD (mnemonic All) under cursor
@@ -2586,10 +2584,8 @@ get_reg_type(int regname, long *reglen)
case ':': // last command line
case '/': // last search-pattern
case '.': // last inserted text
# ifdef FEAT_SEARCHPATH
case Ctrl_F: // Filename under cursor
case Ctrl_P: // Path under cursor, expand via "path"
# endif
case Ctrl_W: // word under cursor
case Ctrl_A: // WORD (mnemonic All) under cursor
case '_': // black hole: always empty
+27 -1
View File
@@ -1946,17 +1946,35 @@ get_sourced_lnum(
: SOURCING_LNUM;
}
/*
* getscriptinfo() function
*/
void
f_getscriptinfo(typval_T *argvars UNUSED, typval_T *rettv)
f_getscriptinfo(typval_T *argvars, typval_T *rettv)
{
int i;
list_T *l;
char_u *pat = NULL;
regmatch_T regmatch;
if (rettv_list_alloc(rettv) == FAIL)
return;
if (check_for_opt_dict_arg(argvars, 0) == FAIL)
return;
l = rettv->vval.v_list;
regmatch.regprog = NULL;
regmatch.rm_ic = p_ic;
if (argvars[0].v_type == VAR_DICT)
{
pat = dict_get_string(argvars[0].vval.v_dict, "name", TRUE);
if (pat != NULL)
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
}
for (i = 1; i <= script_items.ga_len; ++i)
{
scriptitem_T *si = SCRIPT_ITEM(i);
@@ -1965,15 +1983,23 @@ f_getscriptinfo(typval_T *argvars UNUSED, typval_T *rettv)
if (si->sn_name == NULL)
continue;
if (pat != NULL && regmatch.regprog != NULL
&& !vim_regexec(&regmatch, si->sn_name, (colnr_T)0))
continue;
if ((d = dict_alloc()) == NULL
|| list_append_dict(l, d) == FAIL
|| dict_add_string(d, "name", si->sn_name) == FAIL
|| dict_add_number(d, "sid", i) == FAIL
|| dict_add_number(d, "sourced", si->sn_sourced_sid) == FAIL
|| dict_add_number(d, "version", si->sn_version) == FAIL
|| dict_add_bool(d, "autoload",
si->sn_state == SN_STATE_NOT_LOADED) == FAIL)
return;
}
vim_regfree(regmatch.regprog);
vim_free(pat);
}
#endif
+3 -14
View File
@@ -148,11 +148,8 @@ ses_do_win(win_T *wp)
&& term_should_restore(wp->w_buffer);
#endif
if (wp->w_buffer->b_fname == NULL
#ifdef FEAT_QUICKFIX
// When 'buftype' is "nofile" can't restore the window contents.
|| bt_nofilename(wp->w_buffer)
#endif
)
|| bt_nofilename(wp->w_buffer))
return (ssop_flags & SSOP_BLANK);
if (bt_help(wp->w_buffer))
return (ssop_flags & SSOP_HELP);
@@ -374,10 +371,7 @@ put_view(
# endif
// Load the file.
else if (wp->w_buffer->b_ffname != NULL
# ifdef FEAT_QUICKFIX
&& !bt_nofilename(wp->w_buffer)
# endif
)
&& !bt_nofilename(wp->w_buffer))
{
// Editing a file in this buffer: use ":edit file".
// This may have side effects! (e.g., compressed or network file).
@@ -708,11 +702,9 @@ makeopens(
{
if (!(only_save_windows && buf->b_nwindows == 0)
&& !(buf->b_help && !(ssop_flags & SSOP_HELP))
#ifdef FEAT_TERMINAL
// Skip terminal buffers: finished ones are not useful, others
// will be resurrected and result in a new buffer.
&& !bt_terminal(buf)
#endif
&& buf->b_fname != NULL
&& buf->b_p_bl)
{
@@ -826,10 +818,7 @@ makeopens(
if (ses_do_win(wp)
&& wp->w_buffer->b_ffname != NULL
&& !bt_help(wp->w_buffer)
#ifdef FEAT_QUICKFIX
&& !bt_nofilename(wp->w_buffer)
#endif
)
&& !bt_nofilename(wp->w_buffer))
{
if (need_tabnext && put_line(fd, "tabnext") == FAIL)
goto fail;
-2
View File
@@ -2976,9 +2976,7 @@ struct file_buffer
int b_p_si; // 'smartindent'
long b_p_sts; // 'softtabstop'
long b_p_sts_nopaste; // b_p_sts saved for paste mode
#ifdef FEAT_SEARCHPATH
char_u *b_p_sua; // 'suffixesadd'
#endif
int b_p_swf; // 'swapfile'
#ifdef FEAT_SYN_HL
long b_p_smc; // 'synmaxcol'
-4
View File
@@ -3398,11 +3398,7 @@ get_tagfname(
buf[0] = NUL;
(void)copy_option_part(&tnp->tn_np, buf, MAXPATHL - 1, " ,");
#ifdef FEAT_PATH_EXTRA
r_ptr = vim_findfile_stopdir(buf);
#else
r_ptr = NULL;
#endif
// move the filename one char forward and truncate the
// filepath with a NUL
filename = gettail(buf);
+7
View File
@@ -2368,6 +2368,13 @@ func Test_bufadd_bufload()
exe 'bwipe ' .. buf2
call assert_equal(0, bufexists(buf2))
" when 'buftype' is "nofile" then bufload() does not read the file
bwipe! XotherName
let buf = bufadd('XotherName')
call setbufvar(buf, '&bt', 'nofile')
call bufload(buf)
call assert_equal([''], getbufline(buf, 1, '$'))
bwipe someName
bwipe XotherName
call assert_equal(0, bufexists('someName'))
-1
View File
@@ -954,7 +954,6 @@ endfunc
" Test for the default CDPATH option
func Test_opt_default_cdpath()
CheckFeature file_in_path
let after =<< trim [CODE]
call assert_equal(',/path/to/dir1,/path/to/dir2', &cdpath)
call writefile(v:errors, 'Xtestout')
+26 -4
View File
@@ -31,12 +31,34 @@ endfunc
" Test for the getscriptinfo() function
func Test_getscriptinfo()
call writefile(['let loaded_script_id = expand("<SID>")'], 'Xscript')
source Xscript
let lines =<< trim END
let g:loaded_script_id = expand("<SID>")
let s:XscriptVar = [1, #{v: 2}]
func s:XscriptFunc()
endfunc
END
call writefile(lines, 'X22script91')
source X22script91
let l = getscriptinfo()
call assert_match('Xscript$', l[-1].name)
call assert_match('X22script91$', l[-1].name)
call assert_equal(g:loaded_script_id, $"<SNR>{l[-1].sid}_")
call delete('Xscript')
let l = getscriptinfo({'name': '22script91'})
call assert_equal(1, len(l))
call assert_match('22script91$', l[0].name)
let l = getscriptinfo({'name': 'foobar'})
call assert_equal(0, len(l))
let l = getscriptinfo({'name': ''})
call assert_true(len(l) > 1)
call assert_fails("echo getscriptinfo({'name': []})", 'E730:')
call assert_fails("echo getscriptinfo({'name': '\\@'})", 'E866:')
let l = getscriptinfo({'name': test_null_string()})
call assert_true(len(l) > 1)
call assert_fails("echo getscriptinfo('foobar')", 'E1206:')
call delete('X22script91')
endfunc
" vim: shiftwidth=2 sts=2 expandtab
+4
View File
@@ -1896,6 +1896,10 @@ def Test_getregtype()
getregtype('')->assert_equal("\<C-V>4")
enddef
def Test_getscriptinfo()
v9.CheckDefAndScriptFailure(['getscriptinfo("x")'], ['E1013: Argument 1: type mismatch, expected dict<any> but got string', 'E1206: Dictionary required for argument 1'])
enddef
def Test_gettabinfo()
v9.CheckDefAndScriptFailure(['gettabinfo("x")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1'])
enddef
+7 -2
View File
@@ -732,10 +732,15 @@ def Test_use_relative_autoload_import_in_mapping()
source Xmapscript.vim
assert_match('\d\+ A: .*XrelautoloadExport.vim', execute('scriptnames')->split("\n")[-1])
assert_match('XrelautoloadExport.vim$', getscriptinfo()[-1].name)
assert_true(getscriptinfo()[-1].autoload)
var l = getscriptinfo()
assert_match('XrelautoloadExport.vim$', l[-1].name)
assert_true(l[-1].autoload)
feedkeys("\<F3>", "xt")
assert_equal(42, g:result)
l = getscriptinfo({name: 'XrelautoloadExport'})
assert_true(len(l) == 1)
assert_match('XrelautoloadExport.vim$', l[0].name)
assert_false(l[0].autoload)
unlet g:result
delete('XrelautoloadExport.vim')
+20 -8
View File
@@ -246,11 +246,7 @@ static char *(features[]) =
"-extra_search",
#endif
"-farsi",
#ifdef FEAT_SEARCHPATH
"+file_in_path",
#else
"-file_in_path",
#endif
#ifdef FEAT_FIND_ID
"+find_in_path",
#else
@@ -462,11 +458,7 @@ static char *(features[]) =
#else
"-packages",
#endif
#ifdef FEAT_PATH_EXTRA
"+path_extra",
#else
"-path_extra",
#endif
#ifdef FEAT_PERL
# ifdef DYNAMIC_PERL
"+perl/dyn",
@@ -746,6 +738,26 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
270,
/**/
269,
/**/
268,
/**/
267,
/**/
266,
/**/
265,
/**/
264,
/**/
263,
/**/
262,
/**/
261,
/**/
260,
/**/
+1 -9
View File
@@ -434,12 +434,8 @@ write_viminfo_bufferlist(FILE *fp)
{
if (buf->b_fname == NULL
|| !buf->b_p_bl
#ifdef FEAT_QUICKFIX
|| bt_quickfix(buf)
#endif
#ifdef FEAT_TERMINAL
|| bt_terminal(buf)
#endif
|| removable(buf->b_ffname))
continue;
@@ -1994,11 +1990,7 @@ write_buffer_marks(buf_T *buf, FILE *fp_out)
static int
skip_for_viminfo(buf_T *buf)
{
return
#ifdef FEAT_TERMINAL
bt_terminal(buf) ||
#endif
removable(buf->b_ffname);
return bt_terminal(buf) || removable(buf->b_ffname);
}
/*
+3 -16
View File
@@ -136,10 +136,8 @@ do_window(
{
long Prenum1;
win_T *wp;
#if defined(FEAT_SEARCHPATH) || defined(FEAT_FIND_ID)
char_u *ptr;
linenr_T lnum = -1;
#endif
#ifdef FEAT_FIND_ID
int type = FIND_DEFINE;
int len;
@@ -172,12 +170,10 @@ do_window(
case 's':
CHECK_CMDWIN;
reset_VIsual_and_resel(); // stop Visual mode
#ifdef FEAT_QUICKFIX
// When splitting the quickfix window open a new buffer in it,
// don't replicate the quickfix buffer.
if (bt_quickfix(curbuf))
goto newwindow;
#endif
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
@@ -189,12 +185,10 @@ do_window(
case 'v':
CHECK_CMDWIN;
reset_VIsual_and_resel(); // stop Visual mode
#ifdef FEAT_QUICKFIX
// When splitting the quickfix window open a new buffer in it,
// don't replicate the quickfix buffer.
if (bt_quickfix(curbuf))
goto newwindow;
#endif
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
#endif
@@ -228,9 +222,7 @@ do_window(
case 'n':
CHECK_CMDWIN;
reset_VIsual_and_resel(); // stop Visual mode
#ifdef FEAT_QUICKFIX
newwindow:
#endif
if (Prenum)
// window height
vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, "%ld", Prenum);
@@ -527,7 +519,6 @@ newwindow:
do_nv_ident(Ctrl_RSB, NUL);
break;
#ifdef FEAT_SEARCHPATH
// edit file name under cursor in a new window
case 'f':
case 'F':
@@ -540,9 +531,9 @@ wingotofile:
{
tabpage_T *oldtab = curtab;
win_T *oldwin = curwin;
# ifdef FEAT_GUI
#ifdef FEAT_GUI
need_mouse_correct = TRUE;
# endif
#endif
setpcmark();
if (win_split(0, 0) == OK)
{
@@ -565,7 +556,6 @@ wingotofile:
vim_free(ptr);
}
break;
#endif
#ifdef FEAT_FIND_ID
// Go to the first occurrence of the identifier under cursor along path in a
@@ -643,13 +633,12 @@ wingotofile:
do_nv_ident('g', xchar);
break;
#ifdef FEAT_SEARCHPATH
case 'f': // CTRL-W gf: "gf" in a new tab page
case 'F': // CTRL-W gF: "gF" in a new tab page
cmdmod.cmod_tab = tabpage_index(curtab) + 1;
nchar = xchar;
goto wingotofile;
#endif
case 't': // CTRL-W gt: go to next tab page
goto_tabpage((int)Prenum);
break;
@@ -719,11 +708,9 @@ get_wincmd_addr_type(char_u *arg, exarg_T *eap)
#if defined(FEAT_QUICKFIX)
case '}':
#endif
#ifdef FEAT_SEARCHPATH
case 'f':
case 'F':
case Ctrl_F:
#endif
#ifdef FEAT_FIND_ID
case 'i':
case Ctrl_I: