Lech Lorens wrote:
> :help :mksession states:
> > 10. If a file exists with the same name as the Session file, but ending in
> > "x.vim" (for eXtra), executes that as well. You can use *x.vim files to
> > specify additional settings and actions associated with a given Session,
> > such as creating menu items in the GUI version.
>
> This is achieved by adding the following lines to the session file:
>
> let s:sx = expand("<sfile>:p:r")."x.vim"
> if file_readable(s:sx)
> exe "source " . s:sx
> endif
>
> However, a problem arises when the path of the session file contains a
> whitespace character. To fix this, the contents of the session file
> should be:
>
> let s:sx = expand("<sfile>:p:r")."x.vim"
> if file_readable(s:sx)
> exe "source " . fnameescape(s:sx)
> endif
>
> The following patch makes Vim generate the latter form of the session
> file:
>
> Index: src/ex_docmd.c
> ===================================================================
> --- src/ex_docmd.c (revision 1289)
> +++ src/ex_docmd.c (working copy)
> @@ -10106,7 +10106,7 @@
> */
> if (put_line(fd, "let s:sx = expand(\"<sfile>:p:r\").\"x.vim\"") == FAIL
> || put_line(fd, "if file_readable(s:sx)") == FAIL
> - || put_line(fd, " exe \"source \" . s:sx") == FAIL
> + || put_line(fd, " exe \"source \" . fnameescape(s:sx)") == FAIL
> || put_line(fd, "endif") == FAIL)
> return FAIL;
Good fix, thanks!
--
ARTHUR: A scratch? Your arm's off!
BLACK KNIGHT: No, it isn't.
ARTHUR: Well, what's that then?
BLACK KNIGHT: I've had worse.
The Quest for the Holy Grail (Monty Python)
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---