dhruvasagar / vim-prosession

Handle vim sessions like a pro
254 stars 22 forks source link

Improved "Getting Started" documentation #66

Closed dagostinelli closed 4 years ago

dagostinelli commented 4 years ago

Request: Improve the README.md file for newbies to understand how to do this.

Here's what I did. I'm totally lost now.

0) Discovered that this existed after reading this post I think to myself, "Oh, I get it. Obsession makes session files (but maybe puts too much in them) (and leaves them all over the place) This Procession thing puts the session files into a central location so as to not clutter up my folders and it is smart about what gets serialized to the session files. I want to try this"

1) Installed the two plugins

Plugin 'tpope/vim-obsession'
Plugin 'dhruvasagar/vim-prosession'

2) In the terminal, I navigate to where my code is at and start vim

3) Split the window in two, loaded a different source code file in each

4) Hmm... Now what... "I guess I type :Obsession?"

and that made a file called Session.vim

"Wait a minute, I thought this was supposed to prevent that. I'll just see what happens"

5) Quit vim

5) Now what... I guess I type in vim -S Session.vim?

and that didn't seem to work. I got a blank vim.

And now I start the guess-work.

I think we need more "getting started" assistance.

dhruvasagar commented 4 years ago

Hi, the plugin is designed to require least effort. All you do is essentially step 2. and you're set. Your session is created on startup and once you exit vim, and launch it back, it should be loaded back and you can resume from where you left off.

You don't need to do anything other than this, there are obviously some settings which you can configure, for which you can find help via :h prosession within vim.

I do agree however, that the README can be improved further, will try to add similar documentation as I described above in a getting started section soon, will update here when I do.

@dagostinelli Thanks for your inputs.

dhruvasagar commented 4 years ago
  • Should I have typed :Procession? (tries that)

This is not required, the command :Prosession(correcting the typo above), is available to use if you wish to switch from your current project to another project.

  • I read that Procession puts the files into ~/.vim/session. So I go over there and do ls, up, I see them. Why don't they load? Hmm, why do I also have Session.vim then?

I would strongly advice to delete the Session.vim file within the project directory, that may be causing some issues. On start up, vim-prosession is designed to lookup session for your directory based on it's absolute path and load it on launch. As long as that exists, vim-prosession should be able to load it up, if it doesn't exist it will create a new empty session on launch. When you load files, do your stuff in vim these changes are recorded in the said session file. The session handling is actually handled by vim-obsession, vim-prosession only modifies that behavior to ensure sessions are kept in the central location as described.

  • Goes back to the GitHub project page to learn more and there's nothing more to learn.

That's no good, will certainly do something about this.

dagostinelli commented 4 years ago

Hi @dhruvasagar! After that episode when I was trying to get things to work in vim, I gave up and went back to work in gvim (Though I was testing with vim, I actually use gvim mostly) I did eventually notice (later that day) that when I open/exit gvim, that it remembers my layout. I've been enjoying this for the past few days and noticed that it's enhanced my work-flow. Thank you! I still think the readme should explain this better though. Read on:

Due to (I think) the way gvim is launched, I always end up with the same session/workspace. At the moment, I'm working on 2 projects. I ended up just accepting the fact that I have to have files open from both projects in different tabs in gvim at the same time. It's a little bit odd. Maybe this is something else that you might add to the readme.

$ ls ~/.vim/session/
%home%dagostinelli.vim

Makes sense that it's just using one workspace I guess. (it's a GUI app after all and always launched with the same working directory)

dhruvasagar commented 4 years ago

@dagostinelli If you launch gvim using some kind of launcher it launches gvim from the users home directory. Unless you launch gvim from the terminal from the project directory it wouldn't be set to that when it launches and that breaks the session handling. The slightly awkward work around for this is to use :Prosession project/dir to switch to the session of the project you want to work on, and you can always use this again to switch between several other project sessions in a similar fashion.

dhruvasagar commented 4 years ago

@dagostinelli Oh you can also make use of g:prosession_last_session_dir to work around this issue. I'd recommend reading the help for it :h g:prosession_last_session_dir