aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Teichroeb <joel@teichroeb.net>2014-02-28 15:37:19 -0800
committerJoel Teichroeb <joel@teichroeb.net>2014-12-13 11:43:48 -0800
commitd0dcf56338e79ad5a56515a0cf057d0c6bbfaa8d (patch)
treee7d4384a85952f418b364f2477b93db70359f732
parenta44f39955f232d26076edceb3c5d9f16ffde9cbd (diff)
downloadrneovim-d0dcf56338e79ad5a56515a0cf057d0c6bbfaa8d.tar.gz
rneovim-d0dcf56338e79ad5a56515a0cf057d0c6bbfaa8d.tar.bz2
rneovim-d0dcf56338e79ad5a56515a0cf057d0c6bbfaa8d.zip
Ignore compatible mode
-rw-r--r--src/nvim/ex_docmd.c9
-rw-r--r--src/nvim/globals.h1
-rw-r--r--src/nvim/main.c9
-rw-r--r--src/nvim/message.c2
-rw-r--r--src/nvim/option.c64
-rw-r--r--src/nvim/version.c6
6 files changed, 13 insertions, 78 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 6bca1ff34d..2d20ec5025 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -6961,15 +6961,6 @@ static void ex_mkrc(exarg_T *eap)
failed = TRUE;
}
- if (eap->cmdidx != CMD_mkview) {
- /* Write setting 'compatible' first, because it has side effects.
- * For that same reason only do it when needed. */
- if (p_cp)
- (void)put_line(fd, "if !&cp | set cp | endif");
- else
- (void)put_line(fd, "if &cp | set nocp | endif");
- }
-
if (!view_session
|| (eap->cmdidx == CMD_mksession
&& (*flagp & SSOP_OPTIONS)))
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 233d326a40..5f542eec0c 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -1229,6 +1229,7 @@ EXTERN char_u e_invalpat[] INIT(= N_(
EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
+EXTERN char_u e_unsupportedoption[] INIT(= N_("E519: Option not supported"));
EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 8c6df6a212..7c47be3147 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -955,7 +955,6 @@ static void parse_command_name(mparm_T *parmp)
exmode_active = EXMODE_VIM;
else
exmode_active = EXMODE_NORMAL;
- change_compatible(TRUE); /* set 'compatible' */
}
}
@@ -1090,10 +1089,6 @@ static void command_line_scan(mparm_T *parmp)
curbuf->b_p_bin = 1; /* binary file I/O */
break;
- case 'C': /* "-C" Compatible */
- change_compatible(TRUE);
- break;
-
case 'e': /* "-e" Ex mode */
exmode_active = EXMODE_NORMAL;
break;
@@ -1142,7 +1137,7 @@ static void command_line_scan(mparm_T *parmp)
break;
case 'N': /* "-N" Nocompatible */
- change_compatible(FALSE);
+ /* No-op */
break;
case 'n': /* "-n" no swap file */
@@ -2207,8 +2202,6 @@ static void usage(void)
main_msg(_("-M\t\t\tModifications in text not allowed"));
main_msg(_("-b\t\t\tBinary mode"));
main_msg(_("-l\t\t\tLisp mode"));
- main_msg(_("-C\t\t\tCompatible with Vi: 'compatible'"));
- main_msg(_("-N\t\t\tNot fully Vi compatible: 'nocompatible'"));
main_msg(_("-V[N][fname]\t\tBe verbose [level N] [log messages to fname]"));
main_msg(_("-D\t\t\tDebugging mode"));
main_msg(_("-n\t\t\tNo swap file, use memory only"));
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 808253d33c..46e0a1a0df 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -839,7 +839,7 @@ void wait_return(int redraw)
* to avoid that typing one 'j' too many makes the messages
* disappear.
*/
- if (p_more && !p_cp) {
+ if (p_more) {
if (c == 'b' || c == 'k' || c == 'u' || c == 'g'
|| c == K_UP || c == K_PAGEUP) {
if (msg_scrolled > Rows)
diff --git a/src/nvim/option.c b/src/nvim/option.c
index b3a883c79e..c1ab3f2ee5 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -1851,8 +1851,8 @@ void set_init_1(void)
langmap_init();
- /* Be Vi compatible by default */
- p_cp = TRUE;
+ /* Be nocompatible */
+ p_cp = FALSE;
/* Use POSIX compatibility when $VIM_POSIX is set. */
if (os_getenv("VIM_POSIX") != NULL) {
@@ -1995,6 +1995,9 @@ void set_init_1(void)
check_win_options(curwin);
check_options();
+ /* Set all options to their Vim default */
+ set_options_default(OPT_FREE);
+
/* Must be before option_expand(), because that one needs vim_isIDc() */
didset_options();
@@ -2617,7 +2620,7 @@ do_set (
if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL
&& (!(options[opt_idx].flags & P_BOOL)
|| nextchar == '?'))
- errmsg = (char_u *)N_("E519: Option not supported");
+ errmsg = (char_u *)_(e_unsupportedoption);
goto skip;
}
@@ -4922,13 +4925,10 @@ set_bool_option (
if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0)
*(int *)get_varp_scope(&(options[opt_idx]), OPT_GLOBAL) = value;
- /*
- * Handle side effects of changing a bool option.
- */
-
- /* 'compatible' */
- if ((int *)varp == &p_cp) {
- compatible_set();
+ if ((int *)varp == &p_cp && p_cp == TRUE) {
+ /* Ensure that compatible can not be enabled */
+ p_cp = FALSE;
+ return e_unsupportedoption;
}
/* 'undofile' */
else if ((int *)varp == &curbuf->b_p_udf || (int *)varp == &p_udf) {
@@ -7748,18 +7748,9 @@ static void paste_option_changed(void)
*/
void vimrc_found(char_u *fname, char_u *envname)
{
- int opt_idx;
int dofree = FALSE;
char_u *p;
- if (!option_was_set((char_u *)"cp")) {
- p_cp = FALSE;
- for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
- if (!(options[opt_idx].flags & (P_WAS_SET|P_VI_DEF)))
- set_option_default(opt_idx, OPT_FREE, FALSE);
- didset_options();
- }
-
if (fname != NULL) {
p = vim_getenv(envname, &dofree);
if (p == NULL) {
@@ -7775,22 +7766,6 @@ void vimrc_found(char_u *fname, char_u *envname)
}
/*
- * Set 'compatible' on or off. Called for "-C" and "-N" command line arg.
- */
-void change_compatible(int on)
-{
- int opt_idx;
-
- if (p_cp != on) {
- p_cp = on;
- compatible_set();
- }
- opt_idx = findoption((char_u *)"cp");
- if (opt_idx >= 0)
- options[opt_idx].flags |= P_WAS_SET;
-}
-
-/*
* Return TRUE when option "name" has been set.
* Only works correctly for global options.
*/
@@ -7818,25 +7793,6 @@ void reset_option_was_set(char_u *name)
}
/*
- * compatible_set() - Called when 'compatible' has been set or unset.
- *
- * When 'compatible' set: Set all relevant options (those that have the P_VIM)
- * flag) to a Vi compatible value.
- * When 'compatible' is unset: Set all options that have a different default
- * for Vim (without the P_VI_DEF flag) to that default.
- */
-static void compatible_set(void)
-{
- int opt_idx;
-
- for (opt_idx = 0; !istermoption(&options[opt_idx]); opt_idx++)
- if ( ((options[opt_idx].flags & P_VIM) && p_cp)
- || (!(options[opt_idx].flags & P_VI_DEF) && !p_cp))
- set_option_default(opt_idx, OPT_FREE, p_cp);
- didset_options();
-}
-
-/*
* fill_breakat_flags() -- called when 'breakat' changes value.
*/
static void fill_breakat_flags(void)
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 6f37982f4d..7ca37c7535 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -944,12 +944,6 @@ void intro_message(int colon)
if (((row >= 2) && (Columns >= 50)) || colon) {
for (i = 0; i < (int)(sizeof(lines) / sizeof(char *)); ++i) {
p = lines[i];
- if (p == NULL) {
- if (!p_cp) {
- break;
- }
- continue;
- }
if (sponsor != 0) {
if (strstr(p, "children") != NULL) {