Skip to content

Commit

Permalink
viewdir: make it writable by default on Windows + Amiga
Browse files Browse the repository at this point in the history
fixes vim#12119
  • Loading branch information
chrisbra committed Jun 22, 2023
1 parent 7f29122 commit a62820d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion runtime/doc/options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8913,7 +8913,7 @@ A jump table for the options with a short description can be found at |Q_op|.

*'viewdir'* *'vdir'*
'viewdir' 'vdir' string (default for Amiga and Win32:
"$VIM/vimfiles/view",
"$HOME/vimfiles/view",
for Unix: "~/.vim/view",
for macOS: "$VIM:vimfiles:view"
for VMS: "sys$login:vimfiles/view")
Expand Down
2 changes: 1 addition & 1 deletion src/os_amiga.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ typedef long off_t;
#endif

#ifndef DFLT_VDIR
# define DFLT_VDIR "$VIM/vimfiles/view" // default for 'viewdir'
# define DFLT_VDIR "home:vimfiles/view" // default for 'viewdir'
#endif

#ifndef DFLT_MAXMEM
Expand Down
2 changes: 1 addition & 1 deletion src/os_dos.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
#endif

#ifndef DFLT_VDIR
# define DFLT_VDIR "$VIM/vimfiles/view" // default for 'viewdir'
# define DFLT_VDIR "$HOME/vimfiles/view" // default for 'viewdir'
#endif

#ifndef DFLT_DIR
Expand Down
2 changes: 2 additions & 0 deletions src/testdir/setup.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ if 1
" Avoid storing shell history.
let $HISTFILE = ""

" have $HOME available as $ORIGHOME (required for test_mksession)
let $ORIGHOME = $HOME
" Make sure $HOME does not get read or written.
" It must exist, gnome tries to create $HOME/.gnome2
let $HOME = getcwd() . '/XfakeHOME'
Expand Down
11 changes: 11 additions & 0 deletions src/testdir/test_mksession.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1262,4 +1262,15 @@ func Test_mkview_manual_fold()
bw!
endfunc

" Test Viewdir is in $HOME
func Test_mkview_default_home()
if !has('win32') || !has('unix')
throw 'Skipped: only runs on MS-Windows or Unix'
endif
" We don't want Vim to potentially create $viewdir for the user that is
" running the test, so therefore just test that it points to $HOME
" and assume that will be writable.
call assert_equal(0, stridx(&viewdir, $ORIGHOME))
endfunc

" vim: shiftwidth=2 sts=2 expandtab

0 comments on commit a62820d

Please sign in to comment.