Skip to content

Commit 66cbbb4

Browse files
committed
Bug fix: Strip :args from :mksession output
1 parent ca2e72f commit 66cbbb4

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ If you have questions, bug reports, suggestions, etc. the author can be contacte
178178
## License
179179

180180
This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/MIT_License).
181-
© 2011 Peter Odding &lt;<peter@peterodding.com>&gt;.
181+
© 2013 Peter Odding &lt;<peter@peterodding.com>&gt;.
182182

183183
## Sample session script
184184

autoload/xolox/session.vim

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim script
22
" Author: Peter Odding
3-
" Last Change: January 15, 2012
3+
" Last Change: April 17, 2013
44
" URL: http://peterodding.com/code/vim/session/
55

6-
let g:xolox#session#version = '1.5'
6+
let g:xolox#session#version = '1.5.1'
77

88
" Public API for session persistence. {{{1
99

@@ -106,6 +106,8 @@ function! xolox#session#save_state(commands) " {{{2
106106
set ssop-=options ssop+=resize
107107
execute 'mksession' fnameescape(tempfile)
108108
let lines = readfile(tempfile)
109+
" Remove the mode line added by :mksession because we'll add our own in
110+
" xolox#session#save_session().
109111
if lines[-1] == '" vim: set ft=vim :'
110112
call remove(lines, -1)
111113
endif
@@ -127,6 +129,13 @@ function! s:state_filter(line)
127129
" mirrored NERDTree windows.
128130
return '" ' . a:line
129131
elseif a:line =~ '^file .\{-}\[BufExplorer\]$'
132+
" Same trick (about the E95) for BufExplorer.
133+
return '" ' . a:line
134+
elseif a:line =~ '^args '
135+
" The :mksession command adds an :args line to the session file, but when
136+
" :args is executed during a session restore it edits the first file it is
137+
" given, thereby breaking the session that the user was expecting to
138+
" get... I consider this to be a bug in :mksession, but anyway :-).
130139
return '" ' . a:line
131140
else
132141
return a:line

doc/session.txt

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
*session.txt* Extended session management for Vim
22

3+
===============================================================================
4+
*session-contents*
5+
Contents ~
6+
7+
1. Introduction |session-introduction|
8+
2. Installation |session-installation|
9+
3. Commands |session-commands|
10+
1. The |:SaveSession| command
11+
2. The |:OpenSession| command
12+
3. The |:RestartVim| command
13+
4. The |:CloseSession| command
14+
5. The |:DeleteSession| command
15+
6. The |:ViewSession| command
16+
4. Options |session-options|
17+
1. The |sessionoptions| setting
18+
2. The |g:session_directory| option
19+
3. The |g:session_autoload| option
20+
4. The |g:session_autosave| option
21+
5. The |g:session_default_to_last| option
22+
6. The |g:session_persist_globals| option
23+
7. The |g:session_restart_environment| option
24+
8. The |g:session_command_aliases| option
25+
9. The |g:loaded_session| option
26+
5. Compatibility with other plug-ins |session-compatibility-with-other-plug-ins|
27+
6. Known issues |session-known-issues|
28+
7. Contact |session-contact|
29+
8. License |session-license|
30+
9. Sample session script |sample-session-script|
31+
32+
===============================================================================
33+
*session-introduction*
34+
Introduction ~
35+
336
The 'session.vim' plug-in improves upon Vim's built-in |:mksession| command by
437
enabling you to easily and (if you want) automatically persist and restore
538
your Vim editing sessions. It works by generating a Vim |script| that restores
@@ -322,8 +355,8 @@ If you like the script please vote for it on Vim Online [11].
322355
*session-license*
323356
License ~
324357

325-
This software is licensed under the MIT license [12]. Copyright 2011 Peter
326-
Odding <peter@peterodding.com>.
358+
This software is licensed under the MIT license [12]. Š 2013 Peter Odding
359+
<peter@peterodding.com>.
327360

328361
===============================================================================
329362
*sample-session-script*

0 commit comments

Comments
 (0)