Skip to content

Default session name based on directory name + branch name  #170

Open

Description

@Seybo

Is it possible to set the default session name based on directory name + branch name? At the moment I have this in my config

let g:session_autosave = 'yes'
let g:session_autoload = 'yes'
let g:session_default_name = fnamemodify(getcwd(), ':t')

and it saves sessions under the name of the project directory. But I would like to have separate sessions for every branch. Is it possible?

Activity

  1. weilbith commented on Feb 15, 2018

    @weilbith

    @Seybo when u set this as ur default name it works for u? Cause it doesn't for me.

    As an experiment I just change the working diretory with :cd <dir-name> and call :SaveSession afterwards. When I take a look to the list of stored sessions, there isn't any new session and nor with the name of by current working directory.

    Can u help me, cause I'm really interested in the same as u, without the branches.
    Furthermore it would be awesome to have a solution, that open vim tries to search for a stored session based on the current working directory.

  2. Dbz commented on May 8, 2018

    @Dbz

    I would also like to store the default session based off of branch name. That was as I go between branches I go back to the appropriate session automatically. Did you figure this out @Seybo @weilbith ?

  3. weilbith commented on May 9, 2018

    @weilbith

    @Dbz not so far, sry.

  4. Dbz commented on Jul 12, 2018

    @Dbz

    @xolox do you have a recommendation for how we can solve this?

  5. Dbz commented on Aug 20, 2018

    @Dbz

    I solved this by switching plugins.

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

    I have the setting: let g:prosession_per_branch = 1

    So far, this works as well for me as vim-session, and I have the git branch feature I really wanted.

  6. Seybo commented on Aug 31, 2018

    @Seybo
    Author

    @Dbz this is a good solution. But the problem for me is that you can't save named sessions using this solution. Right? I want to have two sessions for the same branch (let's say front-end-session and back-end-session) and be able to load them explicitly. And i can't do it with the plugins you suggest. AFAIU

  7. Dbz commented on Aug 31, 2018

    @Dbz

    Are you sure? You should still be able to call mksession and source on the session to load it.

  8. Seybo commented on Sep 1, 2018

    @Seybo
    Author

    Oh right. That should work. Anyway i decided to keep using vim-session plugin for these needs

  9. Dbz commented on Sep 1, 2018

    @Dbz

    Yeah, the most important thing for me is automatic sessions with a default name of the git_branch. For that:

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

    and let g:prosession_per_branch = 1 match my needs perfectly. Also, those plugins are regularly maintained, and vim-session is not actively maintained. If that changes I would consider using this plugin, but I will choose not to use a non maintained plugin when there are maintained plugins that do what I want and better :)

  10. mMontu commented on Oct 4, 2018

    @mMontu

    @Dbz I have come here due to a different issue (#154), and just noticed the lack of maintenance (#172).

    I completely agree with you, in both that this plugin could use a little bit of love and about avoid using non maintained plugins.

    Do you mind sharing which similar plugins you have found that we can use while we don't have word from @xolox?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions