Comments (4)
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.
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 | endifThese 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.
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.
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 ownVimEnter
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 ENDNote the
nested
keyword. I bet that if you add that to yourautocmd
line it will work.
Reply to this email directly or view it on GitHub:
#13 (comment)
from vim-session.
Related Issues (20)
- gVim 8.1.1 full-screen HOT 2
- Saving session with makefile quicklist not working. HOT 4
- OpenSession - Entering a number without hitting enter
- autosave hidden unnamed buffers
- Persist markers into session? HOT 1
- Color scheme is not loaded properly when auto restoring session on VimEnter HOT 2
- RestartVim not working (linux vim 8.0.1453)
- Swich sessions HOT 1
- Forking this project HOT 1
- Files don't close when saving session in windows
- Missing/stale functions/mappings after some plugins get installed or removed
- Rename SaveSession, OpenSession, etc. to SessionSave, SessionOpen, etc.
- Swapfiles conflict when opening session in two Vim sessions
- Error while opening a session that contains at least one terminal buffer.
- Add support of Buffer Explorer plugin
- vim-session reorders the opened tabs
- newvim :setlocal buftype=acwrite & E676
- Save :Focus from vim-dispatch?
- slow
- Session is not completely restored on auto-load
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-session.