Skip to content

Commit b9a46fe

Browse files
committed
patch 7.4.2115
Problem: Loading defaults.vim with -C argument. Solution: Don't load the defaults script with -C argument. Test sourcing the defaults script. Set 'display' to "truncate".
1 parent d05b191 commit b9a46fe

6 files changed

Lines changed: 20 additions & 2 deletions

File tree

runtime/defaults.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" The default vimrc file.
22
"
33
" Maintainer: Bram Moolenaar <[email protected]>
4-
" Last change: 2016 Jul 28
4+
" Last change: 2016 Jul 29
55
"
66
" This is loaded if no vimrc file was found.
77
" Except when Vim is run with "-u NONE" or "-C".
@@ -25,6 +25,9 @@ set ruler " show the cursor position all the time
2525
set showcmd " display incomplete commands
2626
set wildmenu " display completion matches in a status line
2727

28+
" Show @@@ in the last line if it is truncated.
29+
set display=truncate
30+
2831
" Do incremental searching when it's possible to timeout.
2932
if has('reltime')
3033
set incsearch

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,6 +2107,7 @@ test_arglist \
21072107
test_regexp_utf8 \
21082108
test_reltime \
21092109
test_ruby \
2110+
test_startup \
21102111
test_searchpos \
21112112
test_set \
21122113
test_sort \

src/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ static char *(main_errors[]) =
9090

9191
static char_u *start_dir = NULL; /* current working dir on startup */
9292

93+
static int has_dash_c_arg = FALSE;
94+
9395
int
9496
# ifdef VIMDLL
9597
_export
@@ -1928,6 +1930,7 @@ command_line_scan(mparm_T *parmp)
19281930

19291931
case 'C': /* "-C" Compatible */
19301932
change_compatible(TRUE);
1933+
has_dash_c_arg = TRUE;
19311934
break;
19321935

19331936
case 'e': /* "-e" Ex mode */
@@ -3001,7 +3004,7 @@ source_startup_scripts(mparm_T *parmp)
30013004
#ifdef USR_EXRC_FILE2
30023005
&& do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE) == FAIL
30033006
#endif
3004-
)
3007+
&& !has_dash_c_arg)
30053008
{
30063009
/* When no .vimrc file was found: source defaults.vim. */
30073010
do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE);

src/testdir/Make_all.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ NEW_TESTS = test_arglist.res \
184184
test_perl.res \
185185
test_quickfix.res \
186186
test_ruby.res \
187+
test_startup.res \
187188
test_stat.res \
188189
test_syntax.res \
189190
test_textobjects.res \

src/testdir/test_startup.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
" Check that loading startup.vim works.
2+
3+
func Test_startup_script()
4+
set compatible
5+
source $VIMRUNTIME/defaults.vim
6+
7+
call assert_equal(0, &compatible)
8+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ static char *(features[]) =
758758

759759
static int included_patches[] =
760760
{ /* Add new patch number below this line */
761+
/**/
762+
2115,
761763
/**/
762764
2114,
763765
/**/

0 commit comments

Comments
 (0)