0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 8.1.1736: viminfo support is spread out

Problem:    Viminfo support is spread out.
Solution:   Move more viminfo code to viminfo.c. (Yegappan Lakshmanan,
            closes #4717)  Reorder code to make most functions static.
This commit is contained in:
Bram Moolenaar
2019-07-23 22:15:25 +02:00
parent c61a48d259
commit c3328169d5
13 changed files with 1794 additions and 1740 deletions

View File

@@ -5573,49 +5573,6 @@ set_options_bin(
}
}
#ifdef FEAT_VIMINFO
/*
* Find the parameter represented by the given character (eg ', :, ", or /),
* and return its associated value in the 'viminfo' string.
* Only works for number parameters, not for 'r' or 'n'.
* If the parameter is not specified in the string or there is no following
* number, return -1.
*/
int
get_viminfo_parameter(int type)
{
char_u *p;
p = find_viminfo_parameter(type);
if (p != NULL && VIM_ISDIGIT(*p))
return atoi((char *)p);
return -1;
}
/*
* Find the parameter represented by the given character (eg ''', ':', '"', or
* '/') in the 'viminfo' option and return a pointer to the string after it.
* Return NULL if the parameter is not specified in the string.
*/
char_u *
find_viminfo_parameter(int type)
{
char_u *p;
for (p = p_viminfo; *p; ++p)
{
if (*p == type)
return p + 1;
if (*p == 'n') /* 'n' is always the last one */
break;
p = vim_strchr(p, ','); /* skip until next ',' */
if (p == NULL) /* hit the end without finding parameter */
break;
}
return NULL;
}
#endif
/*
* Expand environment variables for some string options.
* These string options cannot be indirect!