You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #35: Create session for current tab page only
I ported Ingo's code (based on vim-session 1.5) to vim-session
1.8 and changed quite a few things in the process:
- Most significantly, in my version :OpenSession, :SaveSession
and :CloseSession keep their original meaning and the commands
:OpenTabSession, :SaveTabSession and :CloseTabSession should be
used to manage tab scoped sessions.
- Added documentation
- Made periodic auto-save respect tab scoped sessions
- Made lock files aware of tab scoped sessions and process IDs
- Replaced set_session_name() with t:this_session / v:this_session
- Auto-load functions for tab scoped commands,
for easy re-use in command aliases
- Renamed PushTabSessionOptions() to change_tab_options()
- Renamed PopTabSessionOptions() to restore_tab_options()
- Reimplemented session_name() as find_current_session()
- Reimplemented is_tabsession() as is_tab_scoped()
- xolox#session#save_session() now rewrites 'doautoall'
in tab scoped sessions to 'windo doautocmd'
Copy file name to clipboardExpand all lines: README.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,8 +72,34 @@ Note that this command only deletes the session script, it leaves your open tab
72
72
73
73
Execute this command to view the Vim script generated for a session. This command is useful when you need to review the generated Vim script repeatedly, for example while debugging or modifying the `session.vim` plug-in.
74
74
75
+
### Tab scoped sessions
76
+
77
+
When ['sessionoptions'][sessionoptions] contains 'tabpages' (this is the default) session scripts will persist and restore all windows in all tab pages. When you remove 'tabpages' from ['sessionoptions'][sessionoptions] you get a sort of light-weight sessions: They are constrained to a single tab page. Vim's [:mksession][mksession] command and the vim-session plug-in both fully support this.
78
+
79
+
You can change ['sessionoptions'][sessionoptions] in your [vimrc script][vimrc] but then you can never save a session including tab pages. To decide on the spot whether you want a global or tab scoped session, the vim-session plug-in defines the three commands documented below.
80
+
81
+
Note that tab scoped sessions are regular session scripts, so when you load a tab scoped session using `:OpenSession` instead of `:OpenTabSession` the vim-session plug-in *assumes* it is a global session and will close all active tab pages before opening the tab scoped session.
82
+
83
+
#### The `:OpenTabSession` command
84
+
85
+
Just like `:OpenSession` but applies only to the current tab page.
86
+
87
+
#### The `:SaveTabSession` command
88
+
89
+
Just like `:SaveSession` but applies only to the current tab page.
90
+
91
+
#### The `:AppendTabSession` command
92
+
93
+
This command opens a new tab page and loads the given tab scoped session in that tab page. You can give this command a count just like [:tabnew][tabnew].
94
+
95
+
#### The `:CloseTabSession` command
96
+
97
+
Just like `:CloseSession` but applies only to the current tab page.
98
+
75
99
## Options
76
100
101
+
The following Vim options and plug-in options (global variables) can be used to configure the plug-in to your preferences.
102
+
77
103
### The `sessionoptions` setting
78
104
79
105
Because the `session.vim` plug-in uses Vim's [:mksession][mksession] command you can change how it works by setting ['sessionoptions'][sessionoptions] in your [vimrc script][vimrc], for example:
@@ -166,6 +192,13 @@ When this option is enabled the session plug-in will define the following comman
166
192
*`SessionDelete` is an alias for `DeleteSession`
167
193
*`SessionClose` is an alias for `CloseSession`
168
194
195
+
Then there are the command aliases for tab scoped sessions:
196
+
197
+
*`SessionTabOpen` is an alias for `OpenTabSession`
198
+
*`SessionTabSave` is an alias for `SaveTabSession`
199
+
*`SessionTabAppend` is an alias for `AppendTabSession`
200
+
*`SessionTabClose` is an alias for `CloseTabSession`
201
+
169
202
The aliases support tab completion just like the real commands; they're exactly the same except for the names.
170
203
171
204
When you enable the aliases, the default command names will still be available. If you really don't like them, feel free to delete them using [:delcommand][delcommand].
@@ -301,4 +334,5 @@ Here's an example session script generated by the `session.vim` plug-in while I
0 commit comments