Giter Club home page Giter Club logo

possession.nvim's People

Contributors

jedrzejboczar avatar raafatturki avatar wasden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

wasden

possession.nvim's Issues

No fold found Error

When restoring session, the below error happens time to time. Not always.

E5108: Error executing lua ...ck/packer/opt/possession.nvim/lua/possession/session.lua:176: Vim(normal):E490: No fold found
stack traceback:
	[C]: in function 'nvim_exec'
	...ck/packer/opt/possession.nvim/lua/possession/session.lua:176: in function 'fn'
	...possession.nvim/lua/telescope/_extensions/possession.lua:77: in function 'run_replace_or_original'
	...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
	...ack/packer/opt/telescope.nvim/lua/telescope/mappings.lua:341: in function 'execute_keymap'
	[string ":lua"]:1: in main chunk

My session options

vim.opt.sessionoptions =
	{ 'buffers', 'curdir', 'folds', 'help', 'tabpages', 'globals', 'winsize', 'winpos', 'terminal' }

Terminals are not killed because they have "unsaved changes"

If there is a neovim terminal in a hidden buffer, possession will fail to save the session with the following message:

Cannot delete buffer with unsaved changes: "term://[...]"

Perhaps terminals should simply be force-killed if they are hidden and the option is set?

Buffers are closed after PossessionLoad or PossessionSave

this has been driving me up the wall for the past 30 mins, why does my lua buffer close after a session save and why doesn't it show when I load said session. I've tried configuring it so it closes nothing and still got the same result.

https://asciinema.org/a/CeVVGybVHbj0Z1JXvoZ2JWCKE

minimal config on NVIM v0.7.0-dev+1275-g00effff56

return require('packer').startup(function()
        use 'wbthomason/packer.nvim'

        use {
                'jedrzejboczar/possession.nvim',
                requires = { 'nvim-lua/plenary.nvim' },
                config = function() require('possession').setup{
                        silent = false,
                        load_silent = false,
                        debug = true,
                        plugins = {
                                close_windows = false,
                                delete_hidden_buffers = false,
                                nvim_tree = false,
                                tabby = false,
                        },
                } end
        }
end)

Terminal command to load session.

Hello. I used to use obsession for my sessions management. But it is slightly slow...
May I use possession the same way as obsession?
I normally do :Obsession in session which I want to track and than i do nvim -S if I want restore session for current dir and just nvim if I doesn't.
How can I do it with possession?

Error in save/load sessions

Again, the close everything except the open buffer is happening, tried the solution shown in previous threads but it's not workig, running on Arch Linux with the nvim 0.7.2

Automatic session save/restore

As noted in #2, it would be nice to have this kind of functionality built-in.

Currently one could use the provided API to do this in their config: list avaliable sessions and compare sessions[X].cwd to current working directory to select the session we want.

Adding this feature to the plugin would require some configuration options like:

  • should be enabled by a config option (disabled by default)
  • do we want to match CWD exactly, or if opening Vim in /dir/a/b session with cwd /dir/a should be used?
  • or should we actually load the previously open session and not care about cwd whatsoever?
  • when to auto-save the session?
  • config option for enabling this could be a boolean or a user function that returns a boolean - this can offload some more logic to users

Problem with tmux-resurrect

tmux-resurrect is an amazing tmux plugin that allows your tmux sessions to be persistent after reboot. It has an amazing feature that allows you to also load your vim/nvim sessions afterwards as especified here restore-vim-sessions. Now the issue is when I restore my tmux session it attempts to automatically load all nvim sessions but for some reasons it can't. The feature requires that the corresponding session.vim are present in order to be able to load them. Hope anyone can reproduce the issue, thanks in advance. Sorry for opening the other issue ๐Ÿ™. Amazing nvim plugin btw.

How do I create a session?

Hi! I'm trying this plugin out but got stuck immediately. I want to save the current session, but running :PossessionSave prints the error "No session is currently open". Is that the intended behaviour? Since I don't yet have any sessions I can't open one.

This is my config:

use {
  'jedrzejboczar/possession.nvim',
  requires = { 'nvim-lua/plenary.nvim' },
  config = function()
    require('possession').setup()
  end
}

Close session without exiting Neovim

Sometimes I want to switch projects (sessions) during the same Neovim instance. It could be a convenient feature to allow the user to close the current session without exiting Neovim.

:PossessionSave only saves session after root directory

Perhaps I'm not understanding exactly, but I would expect :PossessionSave to save a session with the name of the current directory, not the root directory.

Screen Shot 2022-04-03 at 22 33 24

Currently, this is the only session file it will create.

When I dismiss the message, I get the following error:

Screen Shot 2022-04-03 at 22 36 17

Edit: After actually looking at the commands, I realize this requires an argument. However, when saving the session, all open buffers are closed. Very weird.

I was hoping this would be essentially a drop-in replacement for auto-sessions which basically just manages the sessions for me. I don't want to have to type commands or use Telescope to load a session every time. If in the future, Possession will just work out of the box like auto-session I'll be happy to have another look!

[Enhancement] add git branches support

This is best sessions plugin I have found (better then Persistence/Persisted or auto-session)
Cleanest and best configuration, custom session names (all other plugins just save session per working dir, no multiple sessions for single dir allowed)

One thing that may be lacking is command to auto name session after current git branch. Of course I can name session manually, but it would be nice to have this automated - maybe some option added to PossessionSave command
It could be even better if configuration option exist to auto load session on branch change

This is just idea, thanks for great plugin

Show session name in lualine?

Is there a way to show the current session name in a lualine section?

It seems like I would need to create a custom lualine component that returns the Possession session name as a string. It seems like I could get the session name from this function, but I'm not sure how to do that exactly. Any help would be appreciated! Thanks for a great plugin!

`:PossessionSave` closes all non-visible buffers

:PossessionSave closes any buffer that's not in a window. To reproduce, use the following config:

Click to expand
-- Ignore default config and plugins
vim.opt.runtimepath:remove(vim.fn.expand('~/.config/nvim'))
vim.opt.packpath:remove(vim.fn.expand('~/.local/share/nvim/site'))

-- Append test directory
local test_dir = vim.fn.expand('~/code-other/nvim-test-config')
vim.opt.runtimepath:append(vim.fn.expand(test_dir))
vim.opt.packpath:append(vim.fn.expand(test_dir))

-- Install packer
local install_path = test_dir .. '/pack/packer/start/packer.nvim'
local install_plugins = false

if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
  vim.cmd('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
  vim.cmd('packadd packer.nvim')
  install_plugins = true
end

local packer = require('packer')

packer.init({
  package_root = test_dir .. '/pack',
  compile_path = test_dir .. '/plugin/packer_compiled.lua'
})

packer.startup(function()
  function Use(module)
    use(require(string.format('configs.%s', module)))
  end

  -- Packer can manage itself
  packer.use 'wbthomason/packer.nvim'


  use { 'jedrzejboczar/possession.nvim',
    requires = { 'nvim-lua/plenary.nvim' },
    config = function()
      require('possession').setup()
    end
  }

  if install_plugins then
    packer.sync()
  else
    -- load plugins at your earliest convenience
    vim.defer_fn(function()
      vim.cmd('doautocmd User LoadPlugins')
    end, 1)
  end
end)
And then run this:
> nvim -u path/to/file/above.lua foo bar baz -c ':buffers' -c ':PossessionSave test' -c ':buffers'

Here's the output of the first :buffers:

  1 %a   "foo"                          line 0
  2      "bar"                          line 0
  3      "baz"                          line 0

And here's the output of the second :buffers:

  1 %a   "foo"                          line 1

You get the same behaviour if you run :PossessionSave manually from inside Neovim.

Bug when saving/loading session.

It closes all the buffers except the one in focus. Even after disabling all the plugin config

plugins = {
        -- close_windows = {
        --     hooks = { 'before_load', 'before_save' },
        --     preserve_layout = true, -- or fun(win): boolean
        --     match = {
        --         floating = true,
        --         buftype = {},
        --         filetype = {
        --             'gitcommit',
        --             'alpha',
        --             'dashboard',
        --             'neo-tree',
        --             'Outline',
        --             'Tagbar',
        --             'Mundo',
        --             'MundoDiff',
        --             'toggleterm',
        --             'undotree',
        --             'qf',
        --         },
        --         custom = false, -- or fun(win): boolean
        --     },
        -- },
        -- delete_hidden_buffers = false,
        -- delete_hidden_buffers = {
        --     hooks = {
        --         -- 'before_load',
        --         -- 'before_save',
        --         vim.o.sessionoptions:match('buffer') and 'before_save',
        --     },
        --     force = false, -- or fun(buf): boolean
        -- },
        -- nvim_tree = false,
        -- tabby = false,
        -- delete_buffers = true,
    },

My session option

vim.opt.sessionoptions = 'blank,buffers,curdir,folds,help,tabpages,globals,winsize,winpos,terminal'

It still closes all the buffers one by one. What I mean is if I have 12 buffers open, it will not close them all in a single save/restore command.

With every load/restore it will close 1 buffer. So after some use most of my buffers will be closed except the one in focus.

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.