mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
options: change "unnamedclip" back to "clipboard=unnamed/unnamedplus"
This allows to configure which of '*' and '+' should be used for the unnamed clipboard, and is consistent with vim.
This commit is contained in:
parent
61aaf815db
commit
5476250ba3
@ -60,6 +60,7 @@
|
||||
#define DELETION_REGISTER 36
|
||||
#define CLIP_REGISTER 37
|
||||
|
||||
# define CB_UNNAMEDMASK (CB_UNNAMED | CB_UNNAMEDPLUS)
|
||||
/*
|
||||
* Each yank register is an array of pointers to lines.
|
||||
*/
|
||||
@ -751,7 +752,8 @@ void get_yank_register(int regname, int writing)
|
||||
int i;
|
||||
|
||||
y_append = FALSE;
|
||||
if ((regname == 0 || regname == '"') && !p_unc && !writing && y_previous != NULL) {
|
||||
int unnamedclip = cb_flags & CB_UNNAMEDMASK;
|
||||
if ((regname == 0 || regname == '"') && !unnamedclip && !writing && y_previous != NULL) {
|
||||
y_current = y_previous;
|
||||
return;
|
||||
}
|
||||
@ -1378,9 +1380,10 @@ int op_delete(oparg_T *oap)
|
||||
* register. For the black hole register '_' don't yank anything.
|
||||
*/
|
||||
if (oap->regname != '_') {
|
||||
if (oap->regname != 0 || p_unc) {
|
||||
bool unnamedclip = oap->regname == 0 && (cb_flags & CB_UNNAMEDMASK);
|
||||
if (oap->regname != 0 || unnamedclip) {
|
||||
/* check for read-only register */
|
||||
if (!( valid_yank_reg(oap->regname, TRUE) || (p_unc && oap->regname == 0) )) {
|
||||
if (!( valid_yank_reg(oap->regname, TRUE) || unnamedclip )) {
|
||||
beep_flush();
|
||||
return OK;
|
||||
}
|
||||
@ -5204,18 +5207,23 @@ static void free_register(struct yankreg *reg)
|
||||
y_current = curr;
|
||||
}
|
||||
|
||||
// return target register
|
||||
static int check_clipboard_name(int *name) {
|
||||
if (*name == '*' || *name == '+') {
|
||||
return CLIP_REGISTER;
|
||||
} else if (p_unc && *name == NUL && eval_has_provider("clipboard")) {
|
||||
} else if (*name == NUL && eval_has_provider("clipboard")) {
|
||||
if (cb_flags & CB_UNNAMEDPLUS) {
|
||||
*name = '+';
|
||||
return 0; //unnamed register
|
||||
} else {
|
||||
return -1;
|
||||
return 0; //unnamed
|
||||
} else if (cb_flags & CB_UNNAMED) {
|
||||
*name = '*';
|
||||
return 0; //unnamed
|
||||
}
|
||||
}
|
||||
// don't do anything for other register names
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static void get_clipboard(int name)
|
||||
{
|
||||
int ireg = check_clipboard_name(&name);
|
||||
|
@ -527,7 +527,7 @@ static struct vimoption
|
||||
(char_u *)0L}
|
||||
SCRIPTID_INIT},
|
||||
{"clipboard", "cb", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
|
||||
(char_u *)NULL, PV_NONE,
|
||||
(char_u *)&p_cb, PV_NONE,
|
||||
{(char_u *)"", (char_u *)0L}
|
||||
SCRIPTID_INIT},
|
||||
{"cmdheight", "ch", P_NUM|P_VI_DEF|P_RALL,
|
||||
@ -1620,9 +1620,6 @@ static struct vimoption
|
||||
{"undoreload", "ur", P_NUM|P_VI_DEF,
|
||||
(char_u *)&p_ur, PV_NONE,
|
||||
{ (char_u *)10000L, (char_u *)0L} SCRIPTID_INIT},
|
||||
{"unnamedclip", "ucp", P_BOOL|P_VI_DEF|P_VIM,
|
||||
(char_u *)&p_unc, PV_NONE,
|
||||
{(char_u *)FALSE, (char_u *)FALSE} SCRIPTID_INIT},
|
||||
{"updatecount", "uc", P_NUM|P_VI_DEF,
|
||||
(char_u *)&p_uc, PV_NONE,
|
||||
{(char_u *)200L, (char_u *)0L} SCRIPTID_INIT},
|
||||
@ -4279,6 +4276,10 @@ did_set_string_option (
|
||||
if (check_opt_strings(p_ead, p_ead_values, FALSE) != OK)
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
else if (varp == &p_cb) {
|
||||
if (opt_strings_flags(p_cb, p_cb_values, &cb_flags, TRUE) != OK)
|
||||
errmsg = e_invarg;
|
||||
}
|
||||
/* When 'spelllang' or 'spellfile' is set and there is a window for this
|
||||
* buffer in which 'spell' is set load the wordlists. */
|
||||
else if (varp == &(curbuf->b_s.b_p_spl) || varp == &(curbuf->b_s.b_p_spf)) {
|
||||
@ -4846,7 +4847,6 @@ char_u *check_stl_option(char_u *s)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
|
||||
* Return error message when failed, NULL when OK.
|
||||
|
@ -317,6 +317,13 @@ EXTERN char_u *p_enc; /* 'encoding' */
|
||||
EXTERN int p_deco; /* 'delcombine' */
|
||||
EXTERN char_u *p_ccv; /* 'charconvert' */
|
||||
EXTERN char_u *p_cedit; /* 'cedit' */
|
||||
EXTERN char_u *p_cb; /* 'clipboard' */
|
||||
EXTERN unsigned cb_flags;
|
||||
#ifdef IN_OPTION_C
|
||||
static char *(p_cb_values[]) = {"unnamed", "unnamedplus", NULL};
|
||||
#endif
|
||||
# define CB_UNNAMED 0x001
|
||||
# define CB_UNNAMEDPLUS 0x002
|
||||
EXTERN long p_cwh; /* 'cmdwinheight' */
|
||||
EXTERN long p_ch; /* 'cmdheight' */
|
||||
EXTERN int p_confirm; /* 'confirm' */
|
||||
@ -582,7 +589,6 @@ static char *(p_ttym_values[]) =
|
||||
EXTERN char_u *p_udir; /* 'undodir' */
|
||||
EXTERN long p_ul; /* 'undolevels' */
|
||||
EXTERN long p_ur; /* 'undoreload' */
|
||||
EXTERN int p_unc; /* 'unnamedclip' */
|
||||
EXTERN long p_uc; /* 'updatecount' */
|
||||
EXTERN long p_ut; /* 'updatetime' */
|
||||
EXTERN char_u *p_fcs; /* 'fillchar' */
|
||||
|
Loading…
Reference in New Issue
Block a user