goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.84k stars 109 forks source link

Incompatibility with `telescope-ui-select.nvim` #109

Closed tapyu closed 1 year ago

tapyu commented 2 years ago

I've set up alpha-nvim to work along with Shatur/neovim-session-manager which, in turn, makes use of telescope-ui-select.nvim to handle vim.ui.select with telescope. Whenever I try to select a session in a bare neovim command, alpha-nvim wrongly alert me that the current session have change.

How to reproduce

  1. save this file as minimal_init.lua

    require("packer").startup{function ()
      use 'wbthomason/packer.nvim'
      use 'nvim-lua/plenary.nvim'
      use 'nvim-telescope/telescope.nvim'
      use {'nvim-telescope/telescope-ui-select.nvim', requires =  'nvim-telescope/telescope.nvim'}
      use 'Shatur/neovim-session-manager'
      use {
        'goolord/alpha-nvim',
        config = function ()
            require'alpha'.setup(require'alpha.themes.dashboard'.config)
        end
      }
    end
    }
    
    -- section manager config
    local Path = require('plenary.path')
    require('session_manager').setup({
      sessions_dir = Path:new(vim.fn.stdpath('data'), 'sessions'), -- The directory where the session files will be saved.
      path_replacer = '__', -- The character to which the path separator will be replaced for session files.
      colon_replacer = '++', -- The character to which the colon symbol will be replaced for session files.
      autoload_mode = require('session_manager.config').AutoloadMode.Disabled, -- Define what to do when Neovim is started without arguments. Possible values: Disabled, CurrentDir, LastSession
      autosave_last_session = true, -- Automatically save last session on exit and on session switch.
      autosave_ignore_not_normal = true, -- Plugin will not save a session when no buffers are opened, or all of them aren't writable or listed.
      autosave_ignore_filetypes = { -- All buffers of these file types will be closed before the session is saved.
        'gitcommit',
      },
      autosave_only_in_session = false, -- Always autosaves session. If true, only autosaves after a session is active.
      max_path_length = 80,  -- Shorten the display path if length exceeds this threshold. Use 0 if don't want to shorten the path at all.
    })
    
    require("telescope").setup {
      extensions = {
        ["ui-select"] = {
          require("telescope.themes").get_dropdown {}
        }
      }
    }
    
    -- load_extension
    require("telescope").load_extension("ui-select")
  2. run nvim -u minimal_init.lua
  3. :SessionManager load_session (you should have a session saved, of course. If you don't, just run :SessionManager save_current session)
  4. Select any session.

You will see this behavior: Peek 2022-05-01 22-41

Expected behavior

alpha-nvim should go to session directly.

goolord commented 2 years ago

... I don't really know what's going on here but alpha doesn't touch sessions at all. i use neovim-session-manager without telescope-ui-select.nvim and it works fine. I can try to dig around and see what's up with this though

tapyu commented 2 years ago

but alpha doesn't touch sessions at all.

This statement might be true but that's not where the problem probably lies. It seems that alpha-nvim are seeing a modified unsaved buffer, when actually there isn't anything...

i use neovim-session-manager without telescope-ui-select.nvim and it works fine

Yeah, this is right, I can reproduce the same here. It works fine without telescope-ui-select.nvim

I can try to dig around and see what's up with this though

I can do it as soon as I have a free time, which is quite hard nowadays :cold_sweat:

goolord commented 2 years ago

yea you can't display text without creating a buffer. since the buffer type is nofile i would surmise it wouldn't effect the session

GabMus commented 2 years ago

A bit of a shot in the dark, but try calling the telescope-ui-select callback using vim.schedule

benbrastmckie commented 1 year ago

... I don't really know what's going on here but alpha doesn't touch sessions at all. i use neovim-session-manager without telescope-ui-select.nvim and it works fine. I can try to dig around and see what's up with this though

I'm trying to get this setup to work for me, i.e., alpha-nvim + neovim-sessions-manager. When I enter the command SessionManager load_session from the start screen it works great. However, I've also added the following button which does not work:

    dashboard.button("l", "Load session", ":SessionManager load_session <CR>"),

Instead, when I hit l for 'Load session' I get: "No such subcommand: load_sessions". I must be missing something small as it seems that it is close to working. Any help would be greatly appreciated.

goolord commented 1 year ago

the error message says "No such subcommand: load_sessions"? or is that a typo only present in your comment

benbrastmckie commented 1 year ago

Yes my typo. It is in fact singular.

goolord commented 1 year ago

@benbrastmckie i finally figured out what your bug is. there is a space here load_session <CR> that's getting parsed as the session name " " by that plugin. just remove the space and your button should work 👍

goolord commented 1 year ago

@tapyu is this still a problem for you? i'm using these plugins in this way with no problems

benbrastmckie commented 1 year ago

Hey sorry for the slow reply. I got it working just great. Thanks for the help!