Giter Club home page Giter Club logo

Comments (4)

xolox avatar xolox commented on July 19, 2024

The file type of a buffer is not stored in the session so if you set it manually, save your session, restart Vim and open the same session again the file type won't be restored. That doesn't seem to apply here though.

If you enabled syntax highlighting and file type detection in your session before you saved it, the following lines should be in your session script (which you can view with the command :ViewSession while having the session open):

if exists('g:syntax_on') != 1 | syntax on | endif
if exists('g:did_load_filetypes') != 1 | filetype on | endif

These lines enable the syntax highlighting and file type detection and this has worked fine for me. How do you call :OpenSession "as soon as vim starts"? From your vimrc script? And what version of Vim and the session plug-in are you using?

from vim-session.

zbuc avatar zbuc commented on July 19, 2024

Here's what it put in my session script:

if exists('g:syntax_on') != 1 | syntax on | endif
if exists('g:did_load_filetypes') != 1 | filetype on | endif
if exists('g:did_load_ftplugin') != 1 | filetype plugin on | endif
if exists('g:did_indent_on') != 1 | filetype indent on | endif

I call OpenSession like so:

function! RestoreSession()
  if argc() == 0 "vim called without arguments
    OpenSession
  end
endfunction
autocmd VimEnter * call RestoreSession()

I'm using session.vim 1.4.25 and vim 7.3(and MacVim, both have the same
behavior)

Thanks! Great work!

On Thu, Jan 12, 2012 at 4:22 PM, Peter Odding <
[email protected]

wrote:

The file type of a buffer is not stored in the session so if you set it
manually, save your session, restart Vim and open the same session again
the file type won't be restored. That doesn't seem to apply here though.

If you enabled syntax highlighting and file type detection in your session
before you saved it, the following lines should be in your session script
(which you can view with the command :ViewSession while having the
session open):

if exists('g:syntax_on') != 1 | syntax on | endif
if exists('g:did_load_filetypes') != 1 | filetype on | endif

These lines enable the syntax highlighting and file type detection and
this has worked fine for me. How do you call :OpenSession "as soon as vim
starts"? From your vimrc script? And what version of Vim and the session
plug-in are you using?


Reply to this email directly or view it on GitHub:
#13 (comment)

from vim-session.

xolox avatar xolox commented on July 19, 2024

I think I know what the problem is. The session plug-in supports a default session out of the box (so I'm not sure why you define your own VimEnter automatic command instead of using the one installed by the session plug-in) and the automatic command definitions look like this:

" Define automatic commands for automatic session management.
augroup PluginSession
  autocmd!
  au VimEnter * nested call xolox#session#auto_load()
  au VimLeavePre * call xolox#session#auto_save()
  au VimLeavePre * call xolox#session#auto_unlock()
  au BufEnter * call xolox#session#auto_dirty_check()
augroup END

Note the nested keyword. I bet that if you add that to your autocmd line it will work.

from vim-session.

zbuc avatar zbuc commented on July 19, 2024

Works perfectly! Thanks for the help!

On Thu, Jan 12, 2012 at 5:07 PM, Peter Odding <
[email protected]

wrote:

I think I know what the problem is. The session plug-in supports a default
session out of the box (so I'm not sure why you define your own VimEnter
automatic command instead of using the one installed by the session
plug-in) and the automatic command definitions look like this:

" Define automatic commands for automatic session management.
augroup PluginSession
 autocmd!
 au VimEnter * nested call xolox#session#auto_load()
 au VimLeavePre * call xolox#session#auto_save()
 au VimLeavePre * call xolox#session#auto_unlock()
 au BufEnter * call xolox#session#auto_dirty_check()
augroup END

Note the nested keyword. I bet that if you add that to your autocmd
line it will work.


Reply to this email directly or view it on GitHub:
#13 (comment)

from vim-session.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.