Skip to content

Commit

Permalink
Support for Conque Shell (issue #17)
Browse files Browse the repository at this point in the history
Issue #17 on GitHub:
  #17
  • Loading branch information
xolox committed May 12, 2013
1 parent ad6feb7 commit 4552274
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 40 deletions.
22 changes: 11 additions & 11 deletions README.md
@@ -1,6 +1,6 @@
# Extended session management for Vim

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.
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.

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:

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

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).
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).

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.

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

### The `:ViewSession` command

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.
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.

### Tab scoped sessions

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

### The `sessionoptions` setting

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:
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:

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

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

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

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

### The `g:session_persist_globals` option

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).
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).

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]:

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

### The `g:loaded_session` option

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]:
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]:

:let g:loaded_session = 1

## Compatibility with other plug-ins

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:
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:

* [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;
* [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;
* When [shell.vim](http://peterodding.com/code/vim/shell/) is installed Vim's full-screen state is persisted;
* 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.

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.
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.

## Known issues

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

## Sample session script

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

" ~/.vim/sessions/example.vim: Vim session script.
" Created by session.vim on 30 August 2010 at 05:26:28.
Expand Down
21 changes: 16 additions & 5 deletions autoload/xolox/session.vim
Expand Up @@ -3,7 +3,7 @@
" Last Change: May 12, 2013
" URL: http://peterodding.com/code/vim/session/

let g:xolox#session#version = '2.1'
let g:xolox#session#version = '2.2'

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

Expand Down Expand Up @@ -228,6 +228,9 @@ function! s:check_special_tabpage(session)
endfunction

function! s:check_special_window(session)
" If we detected a special window and the argument to the command is not a
" pathname, this variable should be set to false to disable normalization.
let do_normalize_path = 1
if exists('b:NERDTreeRoot')
if !has_key(s:nerdtrees, bufnr('%'))
let command = 'NERDTree'
Expand All @@ -243,6 +246,10 @@ function! s:check_special_window(session)
elseif exists('g:proj_running') && g:proj_running == bufnr('%')
let command = 'Project'
let argument = expand('%:p')
elseif exists('b:ConqueTerm_Idx')
let command = 'ConqueTerm'
let argument = g:ConqueTerm_Terminals[b:ConqueTerm_Idx]['program_name']
let do_normalize_path = 0
elseif &filetype == 'netrw'
let command = 'edit'
let argument = bufname('%')
Expand All @@ -257,13 +264,17 @@ function! s:check_special_window(session)
if argument == ''
call add(a:session, command)
else
let argument = fnamemodify(argument, ':~')
if xolox#session#options_include('slash')
let argument = substitute(argument, '\', '/', 'g')
if do_normalize_path
let argument = fnamemodify(argument, ':~')
if xolox#session#options_include('slash')
let argument = substitute(argument, '\', '/', 'g')
endif
endif
call add(a:session, command . ' ' . fnameescape(argument))
endif
call add(a:session, 'execute "bwipeout" s:bufnr_save')
call add(a:session, 'if bufnr("%") != s:bufnr_save')
call add(a:session, ' execute "bwipeout" s:bufnr_save')
call add(a:session, 'endif')
call add(a:session, 'execute "cd" fnameescape(s:cwd_save)')
return 1
endif
Expand Down
50 changes: 26 additions & 24 deletions doc/session.txt
Expand Up @@ -42,7 +42,7 @@ Contents ~
*session-introduction*
Introduction ~

The 'session.vim' plug-in improves upon Vim's built-in |:mksession| command by
The vim-session plug-in improves upon Vim's built-in |: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| that restores
your current settings and the arrangement of tab pages and/or split windows
Expand Down Expand Up @@ -77,7 +77,7 @@ Vim plug-ins:
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
the session scripts generated by vim-session look like see the sample below
[3].

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

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.
for example while debugging or modifying the vim-session plug-in.

-------------------------------------------------------------------------------
*tab-scoped-sessions*
Expand Down Expand Up @@ -236,7 +236,7 @@ to configure the plug-in to your preferences.
-------------------------------------------------------------------------------
The *sessionoptions* setting

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

The session.vim plug-in uses Vim's |:mksession| command but it changes
The vim-session plug-in uses Vim's |:mksession| command but it changes
|'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).
Expand Down Expand Up @@ -407,7 +407,7 @@ available. If you really don't like them, feel free to delete them using
The *g:loaded_session* option

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|
vim-session plug-in you can set this variable to any value in your |vimrc|
script:
>
:let g:loaded_session = 1
Expand All @@ -417,19 +417,20 @@ script:
Compatibility with other plug-ins ~

Vim's |: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:
buffers with generated content and because of this the vim-session plug-in
includes specific workarounds for such plug-ins:

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

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

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

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.
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.

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

===============================================================================
*session-license*
License ~

This software is licensed under the MIT license [12]. Copyright 2013 Peter
This software is licensed under the MIT license [13]. Copyright 2013 Peter
Odding <peter@peterodding.com>.

===============================================================================
*sample-session-script*
Sample session script ~

Here's an example session script generated by the 'session.vim' plug-in while
I was editing the plug-in itself in Vim:
Here's an example session script generated by the vim-session plug-in while I
was editing the plug-in itself in Vim:
>
" ~/.vim/sessions/example.vim: Vim session script.
" Created by session.vim on 30 August 2010 at 05:26:28.
Expand Down Expand Up @@ -569,11 +570,12 @@ References ~
[4] http://peterodding.com/code/vim/downloads/session.zip
[5] http://peterodding.com/code/vim/reload/
[6] http://www.vim.org/scripts/script.php?script_id=42
[7] http://www.vim.org/scripts/script.php?script_id=69
[7] http://www.vim.org/scripts/script.php?script_id=2771
[8] http://www.vim.org/scripts/script.php?script_id=1658
[9] http://peterodding.com/code/vim/shell/
[10] http://www.vim.org/scripts/script.php?script_id=273
[11] http://www.vim.org/scripts/script.php?script_id=3150
[12] http://en.wikipedia.org/wiki/MIT_License
[9] http://www.vim.org/scripts/script.php?script_id=69
[10] http://peterodding.com/code/vim/shell/
[11] http://www.vim.org/scripts/script.php?script_id=273
[12] http://www.vim.org/scripts/script.php?script_id=3150
[13] http://en.wikipedia.org/wiki/MIT_License

vim: ft=help

0 comments on commit 4552274

Please sign in to comment.