Commits

Audrius Kažukauskas committed e55178b

Upgrade to session.vim 2.2.

  • Participants
  • Parent commits c18294e

Comments (0)

Files changed (3)

File autoload/xolox/session.vim

 " Vim script
 " Author: Peter Odding
-" Last Change: May 6, 2013
+" Last Change: May 12, 2013
 " URL: http://peterodding.com/code/vim/session/
 
-let g:xolox#session#version = '2.0'
+let g:xolox#session#version = '2.2'
 
 call xolox#misc#compat#check('session', 2)
 
 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'
   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('%')
     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

File doc/session.txt

                                                           *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
 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
+contains menu items for most commands defined by the plug-in.
+
 ===============================================================================
                                                           *session-installation*
 Installation ~
 
 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*
 -------------------------------------------------------------------------------
 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:
     " 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.
 -------------------------------------------------------------------------------
 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).
 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
 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*
 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.
 [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

File plugin/session.vim

 " Vim script
 " Author: Peter Odding
-" Last Change: May 6, 2013
+" Last Change: May 12, 2013
 " URL: http://peterodding.com/code/vim/session/
 
 " Support for automatic update using the GLVS plug-in.
 endif
 unlet s:directory
 
+" Define menu items to make the plug-in more accessible.
+amenu 400.10 &Sessions.&Open\ session\.\.\.<Tab>:OpenSession :OpenSession<CR>
+amenu 400.20 &Sessions.&Save\ session\.\.\.<Tab>:SaveSession :SaveSession<CR>
+amenu 400.30 &Sessions.&Close\ session\.\.\.<Tab>:CloseSession :CloseSession<CR>
+amenu 400.40 &Sessions.&Delete\ session\.\.\.<Tab>:DeleteSession :DeleteSession<CR>
+amenu 400.50 &Sessions.&View\ session\.\.\.<Tab>:ViewSession :ViewSession<CR>
+amenu 400.60 &Sessions.-Sep1- :
+amenu 400.70 &Sessions.Open\ tab\ session\.\.\.<Tab>:OpenTabSession :OpenTabSession<CR>
+amenu 400.80 &Sessions.&Append\ tab\ session\.\.\.<Tab>:AppendTabSession :AppendTabSession<CR>
+amenu 400.90 &Sessions.Save\ tab\ session\.\.\.<Tab>:SaveTabSession :SaveTabSession<CR>
+amenu 400.100 &Sessions.Close\ tab\ session\.\.\.<Tab>:CloseTabSession :CloseTabSession<CR>
+amenu 400.110 &Sessions.-Sep2- :
+amenu 400.120 &Sessions.&Restart\ Vim\.\.\.<Tab>:RestartVim :RestartVim<CR>
+
 " Define automatic commands for automatic session management.
 augroup PluginSession
   autocmd!