Skip to content

Commit

Permalink
Support for BufExplorer windows (issue #12)
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Jan 15, 2012
1 parent 5d26cab commit ca2e72f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -159,9 +159,9 @@ This variable isn't really an option but if you want to avoid loading the `sessi

## Compatibility with other plug-ins

Vim's [:mksession][mksession] command isn't fully 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 `session.vim` includes specific workarounds for such plug-ins:

* [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;
* [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;
* 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.

Expand Down
15 changes: 10 additions & 5 deletions autoload/xolox/session.vim
@@ -1,9 +1,9 @@
" Vim script
" Author: Peter Odding
" Last Change: December 11, 2011
" Last Change: January 15, 2012
" URL: http://peterodding.com/code/vim/session/

let g:xolox#session#version = '1.4.25'
let g:xolox#session#version = '1.5'

" Public API for session persistence. {{{1

Expand Down Expand Up @@ -126,6 +126,8 @@ function! s:state_filter(line)
" Silence "E95: Buffer with this name already exists" when restoring
" mirrored NERDTree windows.
return '" ' . a:line
elseif a:line =~ '^file .\{-}\[BufExplorer\]$'
return '" ' . a:line
else
return a:line
endif
Expand Down Expand Up @@ -168,6 +170,9 @@ function! s:check_special_window(session)
let command = 'NERDTreeMirror'
let argument = ''
endif
elseif expand('%:t') == '[BufExplorer]'
let command = 'BufExplorer'
let argument = ''
elseif exists('g:proj_running') && g:proj_running == bufnr('%')
let command = 'Project'
let argument = expand('%:p')
Expand Down Expand Up @@ -325,7 +330,9 @@ function! s:serialize_buffer_state(bufnr)
return a:bufnr . ':' . bufname
endfunction

function! s:prompt(msg, var) " {{{2
" Commands that enable users to manage multiple sessions. {{{1

function! s:prompt(msg, var)
let value = eval(a:var)
if value == 'yes' || (type(value) != type('') && value)
return 1
Expand All @@ -337,8 +344,6 @@ function! s:prompt(msg, var) " {{{2
endif
endfunction

" Commands that enable users to manage multiple sessions. {{{1

function! xolox#session#open_cmd(name, bang) abort " {{{2
let name = s:select_name(s:unescape(a:name), 'restore')
if name != ''
Expand Down
23 changes: 12 additions & 11 deletions doc/session.txt
Expand Up @@ -282,15 +282,15 @@ script:
*session-compatibility-with-other-plug-ins*
Compatibility with other plug-ins ~

Vim's |:mksession| command isn't fully compatible with plug-ins that create
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:

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

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

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

If your favorite plug-in doesn't work with 'session.vim' drop me a mail and
Expand All @@ -316,13 +316,13 @@ 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 [10].
If you like the script please vote for it on Vim Online [11].

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

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

===============================================================================
Expand Down Expand Up @@ -434,11 +434,12 @@ References ~
[3] http://peterodding.com/code/vim/session/#sample_session_script
[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=1658
[6] http://www.vim.org/scripts/script.php?script_id=42
[7] http://www.vim.org/scripts/script.php?script_id=69
[8] http://peterodding.com/code/vim/shell/
[9] http://www.vim.org/scripts/script.php?script_id=273
[10] http://www.vim.org/scripts/script.php?script_id=3150
[11] http://en.wikipedia.org/wiki/MIT_License
[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

vim: ft=help

0 comments on commit ca2e72f

Please sign in to comment.