Skip to content

Commit 4552274

Browse files
committed
Support for Conque Shell (issue #17)
Issue #17 on GitHub: #17
1 parent ad6feb7 commit 4552274

File tree

3 files changed

+53
-40
lines changed

3 files changed

+53
-40
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Extended session management for Vim
22

3-
The `session.vim` plug-in improves upon [Vim](http://www.vim.org/)'s built-in [:mksession][mksession] command by enabling you to easily and (if you want) automatically persist and restore your Vim editing sessions. It works by generating a [Vim script](http://vimdoc.sourceforge.net/htmldoc/usr_41.html#script) that restores your current settings and the arrangement of tab pages and/or split windows and the files they contain.
3+
The vim-session plug-in improves upon [Vim](http://www.vim.org/)'s built-in [:mksession][mksession] command by enabling you to easily and (if you want) automatically persist and restore your Vim editing sessions. It works by generating a [Vim script](http://vimdoc.sourceforge.net/htmldoc/usr_41.html#script) that restores your current settings and the arrangement of tab pages and/or split windows and the files they contain.
44

55
To persist your current editing session you can execute the `:SaveSession` command. If you don't provide a name for the session 'default' is used (you can change this name with an option). You're free to use whatever characters you like in session names. When you want to restore your session simply execute `:OpenSession`. Again the name 'default' is used if you don't provide one. When a session is active, has been changed and you quit Vim you'll be prompted whether you want to save the open session before quitting Vim:
66

@@ -16,7 +16,7 @@ When you start Vim with a custom [server name](http://vimdoc.sourceforge.net/htm
1616
$ gvim --servername session-plugin
1717
$ # etc.
1818

19-
The session scripts created by this plug-in are stored in the directory `~/.vim/sessions` (on UNIX) or `~\vimfiles\sessions` (on Windows) but you can change the location by setting `g:session_directory`. If you're curious what the session scripts generated by `session.vim` look like see the [sample below](http://peterodding.com/code/vim/session/#sample_session_script).
19+
The session scripts created by this plug-in are stored in the directory `~/.vim/sessions` (on UNIX) or `~\vimfiles\sessions` (on Windows) but you can change the location by setting `g:session_directory`. If you're curious what the session scripts generated by vim-session look like see the [sample below](http://peterodding.com/code/vim/session/#sample_session_script).
2020

2121
If you're still getting to know the plug-in, the "Sessions" menu may help: It contains menu items for most commands defined by the plug-in.
2222

@@ -72,7 +72,7 @@ Note that this command only deletes the session script, it leaves your open tab
7272

7373
### The `:ViewSession` command
7474

75-
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.
75+
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 vim-session plug-in.
7676

7777
### Tab scoped sessions
7878

@@ -104,15 +104,15 @@ The following Vim options and plug-in options (global variables) can be used to
104104

105105
### The `sessionoptions` setting
106106

107-
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:
107+
Because the vim-session 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:
108108

109109
" If you only want to save the current tab page:
110110
set sessionoptions-=tabpages
111111

112112
" If you don't want help windows to be restored:
113113
set sessionoptions-=help
114114

115-
Note that the session.vim plug-in automatically and unconditionally executes the following change just before saving a session:
115+
Note that the vim-session plug-in automatically and unconditionally executes the following change just before saving a session:
116116

117117
" Don't persist options and mappings because it can corrupt sessions.
118118
set sessionoptions-=options
@@ -153,7 +153,7 @@ By default this option is set to false (0). When you set this option to true (1)
153153

154154
### The `g:session_persist_globals` option
155155

156-
The session.vim plug-in uses Vim's [:mksession] [mksession] command but it changes ['sessionoptions'][sessionoptions] so that Vim options and mappings are not persisted. The plug-in does this because persistence of options and mappings can break loading of sessions, in other words it's fragile (in my opinion).
156+
The vim-session plug-in uses Vim's [:mksession] [mksession] command but it changes ['sessionoptions'][sessionoptions] so that Vim options and mappings are not persisted. The plug-in does this because persistence of options and mappings can break loading of sessions, in other words it's fragile (in my opinion).
157157

158158
If you want the plug-in to persist specific global variables or options you can add their names to the list `g:session_persist_globals` in your [vimrc script] [vimrc]:
159159

@@ -207,19 +207,19 @@ When you enable the aliases, the default command names will still be available.
207207

208208
### The `g:loaded_session` option
209209

210-
This variable isn't really an option but if you want to avoid loading the `session.vim` plug-in you can set this variable to any value in your [vimrc script] [vimrc]:
210+
This variable isn't really an option but if you want to avoid loading the vim-session plug-in you can set this variable to any value in your [vimrc script] [vimrc]:
211211

212212
:let g:loaded_session = 1
213213

214214
## Compatibility with other plug-ins
215215

216-
Vim's [:mksession][mksession] command isn't really compatible with plug-ins that create buffers with generated content and because of this `session.vim` includes specific workarounds for such plug-ins:
216+
Vim's [:mksession][mksession] command isn't really compatible with plug-ins that create buffers with generated content and because of this the vim-session plug-in includes specific workarounds for such plug-ins:
217217

218-
* [BufExplorer](http://www.vim.org/scripts/script.php?script_id=42), [Project](http://www.vim.org/scripts/script.php?script_id=69) and [NERD tree](http://www.vim.org/scripts/script.php?script_id=1658) windows are supported;
218+
* [BufExplorer](http://www.vim.org/scripts/script.php?script_id=42), [Conque Shell](http://www.vim.org/scripts/script.php?script_id=2771), [NERD tree](http://www.vim.org/scripts/script.php?script_id=1658) and [Project](http://www.vim.org/scripts/script.php?script_id=69) windows are supported;
219219
* When [shell.vim](http://peterodding.com/code/vim/shell/) is installed Vim's full-screen state is persisted;
220220
* The [netrw](http://vimdoc.sourceforge.net/htmldoc/pi_netrw.html#netrw-start) and [taglist.vim](http://www.vim.org/scripts/script.php?script_id=273) plug-ins support sessions out of the box.
221221

222-
If your favorite plug-in doesn't work with `session.vim` drop me a mail and I'll see what I can do. Please include a link to the plug-in in your e-mail so that I can install and test the plug-in.
222+
If your favorite plug-in doesn't work with the vim-session plug-in drop me a mail and I'll see what I can do. Please include a link to the plug-in in your e-mail so that I can install and test the plug-in.
223223

224224
## Known issues
225225

@@ -236,7 +236,7 @@ This software is licensed under the [MIT license](http://en.wikipedia.org/wiki/M
236236

237237
## Sample session script
238238

239-
Here's an example session script generated by the `session.vim` plug-in while I was editing the plug-in itself in Vim:
239+
Here's an example session script generated by the vim-session plug-in while I was editing the plug-in itself in Vim:
240240

241241
" ~/.vim/sessions/example.vim: Vim session script.
242242
" Created by session.vim on 30 August 2010 at 05:26:28.

autoload/xolox/session.vim

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Last Change: May 12, 2013
44
" URL: http://peterodding.com/code/vim/session/
55

6-
let g:xolox#session#version = '2.1'
6+
let g:xolox#session#version = '2.2'
77

88
call xolox#misc#compat#check('session', 2)
99

@@ -228,6 +228,9 @@ function! s:check_special_tabpage(session)
228228
endfunction
229229

230230
function! s:check_special_window(session)
231+
" If we detected a special window and the argument to the command is not a
232+
" pathname, this variable should be set to false to disable normalization.
233+
let do_normalize_path = 1
231234
if exists('b:NERDTreeRoot')
232235
if !has_key(s:nerdtrees, bufnr('%'))
233236
let command = 'NERDTree'
@@ -243,6 +246,10 @@ function! s:check_special_window(session)
243246
elseif exists('g:proj_running') && g:proj_running == bufnr('%')
244247
let command = 'Project'
245248
let argument = expand('%:p')
249+
elseif exists('b:ConqueTerm_Idx')
250+
let command = 'ConqueTerm'
251+
let argument = g:ConqueTerm_Terminals[b:ConqueTerm_Idx]['program_name']
252+
let do_normalize_path = 0
246253
elseif &filetype == 'netrw'
247254
let command = 'edit'
248255
let argument = bufname('%')
@@ -257,13 +264,17 @@ function! s:check_special_window(session)
257264
if argument == ''
258265
call add(a:session, command)
259266
else
260-
let argument = fnamemodify(argument, ':~')
261-
if xolox#session#options_include('slash')
262-
let argument = substitute(argument, '\', '/', 'g')
267+
if do_normalize_path
268+
let argument = fnamemodify(argument, ':~')
269+
if xolox#session#options_include('slash')
270+
let argument = substitute(argument, '\', '/', 'g')
271+
endif
263272
endif
264273
call add(a:session, command . ' ' . fnameescape(argument))
265274
endif
266-
call add(a:session, 'execute "bwipeout" s:bufnr_save')
275+
call add(a:session, 'if bufnr("%") != s:bufnr_save')
276+
call add(a:session, ' execute "bwipeout" s:bufnr_save')
277+
call add(a:session, 'endif')
267278
call add(a:session, 'execute "cd" fnameescape(s:cwd_save)')
268279
return 1
269280
endif

doc/session.txt

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Contents ~
4242
*session-introduction*
4343
Introduction ~
4444

45-
The 'session.vim' plug-in improves upon Vim's built-in |:mksession| command by
45+
The vim-session plug-in improves upon Vim's built-in |:mksession| command by
4646
enabling you to easily and (if you want) automatically persist and restore
4747
your Vim editing sessions. It works by generating a Vim |script| that restores
4848
your current settings and the arrangement of tab pages and/or split windows
@@ -77,7 +77,7 @@ Vim plug-ins:
7777
The session scripts created by this plug-in are stored in the directory
7878
'~/.vim/sessions' (on UNIX) or '~\vimfiles\sessions' (on Windows) but you can
7979
change the location by setting |g:session_directory|. If you're curious what
80-
the session scripts generated by 'session.vim' look like see the sample below
80+
the session scripts generated by vim-session look like see the sample below
8181
[3].
8282

8383
If you're still getting to know the plug-in, the "Sessions" menu may help: It
@@ -183,7 +183,7 @@ The *:ViewSession* command
183183

184184
Execute this command to view the Vim script generated for a session. This
185185
command is useful when you need to review the generated Vim script repeatedly,
186-
for example while debugging or modifying the 'session.vim' plug-in.
186+
for example while debugging or modifying the vim-session plug-in.
187187

188188
-------------------------------------------------------------------------------
189189
*tab-scoped-sessions*
@@ -236,7 +236,7 @@ to configure the plug-in to your preferences.
236236
-------------------------------------------------------------------------------
237237
The *sessionoptions* setting
238238

239-
Because the 'session.vim' plug-in uses Vim's |:mksession| command you can change
239+
Because the vim-session plug-in uses Vim's |:mksession| command you can change
240240
how it works by setting |'sessionoptions'| in your |vimrc| script, for example:
241241
>
242242
" If you only want to save the current tab page:
@@ -245,7 +245,7 @@ how it works by setting |'sessionoptions'| in your |vimrc| script, for example:
245245
" If you don't want help windows to be restored:
246246
set sessionoptions-=help
247247
248-
Note that the session.vim plug-in automatically and unconditionally executes
248+
Note that the vim-session plug-in automatically and unconditionally executes
249249
the following change just before saving a session:
250250
>
251251
" Don't persist options and mappings because it can corrupt sessions.
@@ -320,7 +320,7 @@ get rid of the dialog you have to set |g:session_autoload| to 'yes'.
320320
-------------------------------------------------------------------------------
321321
The *g:session_persist_globals* option
322322

323-
The session.vim plug-in uses Vim's |:mksession| command but it changes
323+
The vim-session plug-in uses Vim's |:mksession| command but it changes
324324
|'sessionoptions'| so that Vim options and mappings are not persisted. The
325325
plug-in does this because persistence of options and mappings can break
326326
loading of sessions, in other words it's fragile (in my opinion).
@@ -407,7 +407,7 @@ available. If you really don't like them, feel free to delete them using
407407
The *g:loaded_session* option
408408

409409
This variable isn't really an option but if you want to avoid loading the
410-
'session.vim' plug-in you can set this variable to any value in your |vimrc|
410+
vim-session plug-in you can set this variable to any value in your |vimrc|
411411
script:
412412
>
413413
:let g:loaded_session = 1
@@ -417,19 +417,20 @@ script:
417417
Compatibility with other plug-ins ~
418418

419419
Vim's |:mksession| command isn't really compatible with plug-ins that create
420-
buffers with generated content and because of this 'session.vim' includes
421-
specific workarounds for such plug-ins:
420+
buffers with generated content and because of this the vim-session plug-in
421+
includes specific workarounds for such plug-ins:
422422

423-
- BufExplorer [6], Project [7] and NERD tree [8] windows are supported;
423+
- BufExplorer [6], Conque Shell [7], NERD tree [8] and Project [9] windows are
424+
supported;
424425

425-
- When shell.vim [9] is installed Vim's full-screen state is persisted;
426+
- When shell.vim [10] is installed Vim's full-screen state is persisted;
426427

427-
- The netrw (see |netrw-start|) and taglist.vim [10] plug-ins support sessions
428+
- The netrw (see |netrw-start|) and taglist.vim [11] plug-ins support sessions
428429
out of the box.
429430

430-
If your favorite plug-in doesn't work with 'session.vim' drop me a mail and
431-
I'll see what I can do. Please include a link to the plug-in in your e-mail so
432-
that I can install and test the plug-in.
431+
If your favorite plug-in doesn't work with the vim-session plug-in drop me a
432+
mail and I'll see what I can do. Please include a link to the plug-in in your
433+
e-mail so that I can install and test the plug-in.
433434

434435
===============================================================================
435436
*session-known-issues*
@@ -450,21 +451,21 @@ Contact ~
450451
If you have questions, bug reports, suggestions, etc. the author can be
451452
contacted at peter@peterodding.com. The latest version is available at
452453
http://peterodding.com/code/vim/session/ and http://github.com/xolox/vim-session.
453-
If you like the script please vote for it on Vim Online [11].
454+
If you like the script please vote for it on Vim Online [12].
454455

455456
===============================================================================
456457
*session-license*
457458
License ~
458459

459-
This software is licensed under the MIT license [12]. Copyright 2013 Peter
460+
This software is licensed under the MIT license [13]. Copyright 2013 Peter
460461
Odding <peter@peterodding.com>.
461462

462463
===============================================================================
463464
*sample-session-script*
464465
Sample session script ~
465466

466-
Here's an example session script generated by the 'session.vim' plug-in while
467-
I was editing the plug-in itself in Vim:
467+
Here's an example session script generated by the vim-session plug-in while I
468+
was editing the plug-in itself in Vim:
468469
>
469470
" ~/.vim/sessions/example.vim: Vim session script.
470471
" Created by session.vim on 30 August 2010 at 05:26:28.
@@ -569,11 +570,12 @@ References ~
569570
[4] http://peterodding.com/code/vim/downloads/session.zip
570571
[5] http://peterodding.com/code/vim/reload/
571572
[6] http://www.vim.org/scripts/script.php?script_id=42
572-
[7] http://www.vim.org/scripts/script.php?script_id=69
573+
[7] http://www.vim.org/scripts/script.php?script_id=2771
573574
[8] http://www.vim.org/scripts/script.php?script_id=1658
574-
[9] http://peterodding.com/code/vim/shell/
575-
[10] http://www.vim.org/scripts/script.php?script_id=273
576-
[11] http://www.vim.org/scripts/script.php?script_id=3150
577-
[12] http://en.wikipedia.org/wiki/MIT_License
575+
[9] http://www.vim.org/scripts/script.php?script_id=69
576+
[10] http://peterodding.com/code/vim/shell/
577+
[11] http://www.vim.org/scripts/script.php?script_id=273
578+
[12] http://www.vim.org/scripts/script.php?script_id=3150
579+
[13] http://en.wikipedia.org/wiki/MIT_License
578580

579581
vim: ft=help

0 commit comments

Comments
 (0)