diff options
-rw-r--r-- | runtime/doc/options.txt | 4 | ||||
-rw-r--r-- | src/nvim/option.c | 4 | ||||
-rw-r--r-- | src/nvim/testdir/test_options.vim | 16 |
3 files changed, 23 insertions, 1 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index a0adf7ec20..82be2f9033 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -874,7 +874,9 @@ A jump table for the options with a short description can be found at |Q_op|. < Use 'backupdir' to put the backup in a different directory. *'backupskip'* *'bsk'* -'backupskip' 'bsk' string (default: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*") +'backupskip' 'bsk' string (default: "$TMPDIR/*,$TMP/*,$TEMP/*" + Unix: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*" + Mac: "/private/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*") global A list of file patterns. When one of the patterns matches with the name of the file which is written, no backup file is created. Both diff --git a/src/nvim/option.c b/src/nvim/option.c index fde1116cc9..a39be0fe96 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -626,7 +626,11 @@ void set_init_1(void) char *p; # ifdef UNIX if (*names[n] == NUL) { +# ifdef __APPLE__ + p = "/private/tmp"; +# else p = "/tmp"; +# endif mustfree = false; } else # endif diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index d867964562..25d9a426f7 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -345,6 +345,22 @@ func Test_set_indentexpr() bwipe! endfunc +func Test_backupskip() + if has("mac") + call assert_match('/private/tmp/\*', &bsk) + elseif has("unix") + call assert_match('/tmp/\*', &bsk) + endif + + let bskvalue = substitute(&bsk, '\\', '/', 'g') + for var in ['$TEMPDIR', '$TMP', '$TEMP'] + if exists(var) + let varvalue = substitute(expand(var), '\\', '/', 'g') + call assert_match(varvalue . '.\*', bskvalue) + endif + endfor +endfunc + func Test_copy_winopt() set hidden |