Comments (12)
Your description is a bit ambiguous (from the perspective of the person who programmed the plug-in and thinks in very specific terms about what Vim and users do) so I'm not sure exactly what you expect the plug-in to do. Here's how it currently works:
- If you open Vim without specifying any filenames in the argument list on the command line the vim-session plug-in will attempt to load the default or last used session. If that session doesn't exist, nothing happens (no session is loaded).
- If you quit Vim while working in a loaded session, that session will be saved. If you quit Vim, automatic session saving is enabled and you haven't created any sessions yet, the plug-in will prompt you if you want to save the current (unnamed) session as the default session (this makes it easier to get started using the plug-in with the default session).
The behavior described above is currently the only "automagic" behavior in the vim-session plug-in (note that my description assumes the settings are left at their defaults). Everything else happens after an explicit action by the user. Does this help clear up any potential confusion? If not, and you insist the plug-in should be changed, then you'll need to be a lot more unambiguous in your wording (and convince me that the change is worth it ;-).
from vim-session.
Hmm maybe I should have read your description more carefully, you imply there is a bug in the periodic auto-save but without looking at the code I don't see how I could have missed that (I use the plug-in every day). I'll nevertheless take a look at the code to see if there are any corner cases involving quickly opening & quitting Vim.
from vim-session.
When I open a file without a session specified, make a quick edit and then close a file. I expect that when I start gvim with no parameters that it will start back up a default session with that file I was editing.
This does not appear to happen. An explicit SaveSession works great, but not the automatic save.
You say "open a file", but I suppose you mean you start Vim and edit a file in that empty Vim instance? And with "close a file" I suppose you mean you quit Vim? Before doing this, did a default session already exist or not?
from vim-session.
Sorry for the ambiguity, here's a clear series of steps to illustrate the issue:
- run 'vim file.ext'
- ":q"
- run 'vim'
My expectation after step 3 is that I will open up 'file.ext' in the same working directory as when I did step 2. Yes there is an existing default session. My expectation for this stems from setting 'g:session_autosave = 'yes''. Maybe I'm misunderstanding the description, but that seems to say that on quit, it will autosave the session. If it is different, maybe I can change this into a feature request :).
from vim-session.
If I put myself in your perspective I see what you expect, but coming back to my perspective as the maintainer of the plug-in I'm not sure if and how I would implement this for general use. The plug-in is not very creative with automatic session creation; It only proposes to create the default session if no sessions exist yet.
In the default configuration all sessions are stored together in a single directory, so they need a unique name. You mentioned you already have a default session, yet you expect the vim-session plug-in to automatically come up with a suitable unique session name for the session created in steps 1 and 2 of your example.
The simplest way to realize this would be to have sessions bound to directories. You can already do this by simply changing the location of the session directory (and optionally the name of the default session):
let g:session_directory = '.'
let g:session_default_name = 'session'
If you add the above Vim commands to your vimrc script, sessions will be bound to directories and saved as session.vim
. Does that help? :-)
from vim-session.
There I go not speaking clearly again. My expectation is not for another session, just that the default session is overwritten with the new values. Or whatever session I'm running is overwritten. I apologize for the back and forth on this.
from vim-session.
If every Vim instance overwrites the default session, what happens when you start multiple instances of Vim at the same time?
(edit: with instance I mean process)
from vim-session.
I would expect last one in to win. I'm viewing the default session as the last-used session, and the named session as one you handle carefully, it appears that's not the intent from this discussion though.
from vim-session.
Changing this now would be a backwards incompatible change that would overwrite the default session of users when they wouldn't expect it (because previously it wouldn't have happened). I guess I can make it an option though, something like "session_default_overwrite" which is set to false by default but can be set to true.
from vim-session.
That'd be awesome! Thanks a lot man!
from vim-session.
I think the new version should do what you expect it to if you set the session_default_overwrite option. Can you confirm that it works?
from vim-session.
Works perfect! Thanks a lot for the quick turnaround and sorry it took me so long to test it out.
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.