alpha-nvim icon indicating copy to clipboard operation
alpha-nvim copied to clipboard

How to autostart this plugin ?

Open Twiggeh opened this issue 2 years ago • 21 comments

It doesn't appear to autostart by itself so I added a vim.cmd("Alpha") which makes it start on nvim launching, but then it generates this weird empty file that makes the editor close image But if I remove the vim cmd and call :Alpha after nvim launches, then this file doesn't appear image

local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
	return
end
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = {
	[[                               __                ]],
	[[  ___     ___    ___   __  __ /\_\    ___ ___    ]],
	[[ / _ `\  / __`\ / __`\/\ \/\ \\/\ \  / __` __`\  ]],
	[[/\ \/\ \/\  __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
	[[\ \_\ \_\ \____\ \____/\ \___/  \ \_\ \_\ \_\ \_\]],
	[[ \/_/\/_/\/____/\/___/  \/__/    \/_/\/_/\/_/\/_/]],
}
dashboard.section.buttons.val = {
	dashboard.button("<C-P>", "  Find file", ":Telescope find_files <CR>"),
	dashboard.button("e", "  New file", ":ene <BAR> startinsert <CR>"),
	dashboard.button("p", "  Find project", ":Telescope projects <CR>"),
	dashboard.button("r", "  Recently used files", ":Telescope oldfiles <CR>"),
	dashboard.button("<CS-F>", "  Find text", ":Telescope live_grep <CR>"),
	dashboard.button("c", "  Configuration", ":e ~/.config/nvim/init.lua <CR>"),
	dashboard.button("q", "  Quit Neovim", ":qa<CR>"),
}

local function footer()
	return "hello there ... "
end

dashboard.section.footer.val = footer()

dashboard.section.footer.opts.hl = "Type"
dashboard.section.header.opts.hl = "Include"
dashboard.section.buttons.opts.hl = "Keyword"

dashboard.opts.opts.noautocmd = true
vim.cmd([[autocmd User AlphaReady echo 'ready']])
alpha.setup(dashboard.opts)

-- vim.cmd("Alpha")

Twiggeh avatar Jun 22 '22 23:06 Twiggeh

what other plugins do you have installed? can you run let @+ = ('au VimEnter') and paste the output here

goolord avatar Jun 23 '22 19:06 goolord

what other plugins do you have installed? can you run let @+ = ('au VimEnter') and paste the output here I am sorry am new to nvim, I put it into the cmdprompt and nothing was printed in neither the terminal or the editor itself.

With only alpha enabled that file shows always up. When adding bufferline makes that one open file go from [Scratch] to [No Name].

Since I didn't manage to run the command correctly here you go with the plugin list:

	-- My plugins here
	use "wbthomason/packer.nvim" -- Have packer manage itself
	use "nvim-lua/popup.nvim" -- An implementation of the Popup API from vim in Neovim
	use "nvim-lua/plenary.nvim" -- Useful lua functions used in lots of plugins
	use "windwp/nvim-autopairs" -- Autopairs, integrates with both cmp and treesitter
	use "numToStr/Comment.nvim" -- Easily comment stuff
	use "kyazdani42/nvim-web-devicons"
	use "kyazdani42/nvim-tree.lua"
	use "akinsho/bufferline.nvim"
	use "moll/vim-bbye"
	use "nvim-lualine/lualine.nvim"
	use "akinsho/toggleterm.nvim"
	use "ahmedkhalf/project.nvim"
	use "lewis6991/impatient.nvim"
	use "lukas-reineke/indent-blankline.nvim"
	use "goolord/alpha-nvim"
	use "antoinemadec/FixCursorHold.nvim" -- This is needed to fix lsp doc highlight
	use "folke/which-key.nvim"

	-- Colorschemes
	-- use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out
	use "lunarvim/darkplus.nvim"

	-- cmp plugins
	use "hrsh7th/nvim-cmp" -- The completion plugin
	use "hrsh7th/cmp-buffer" -- buffer completions
	use "hrsh7th/cmp-path" -- path completions
	use "hrsh7th/cmp-cmdline" -- cmdline completions
	use "saadparwaiz1/cmp_luasnip" -- snippet completions
	use "hrsh7th/cmp-nvim-lsp"

	-- snippets
	use "L3MON4D3/LuaSnip" --snippet engine
	use "rafamadriz/friendly-snippets" -- a bunch of snippets to use

	-- LSP
	use "neovim/nvim-lspconfig" -- enable LSP
	use "williamboman/nvim-lsp-installer" -- simple to use language server installer
	use "tamago324/nlsp-settings.nvim" -- language server settings defined in json for
	use "jose-elias-alvarez/null-ls.nvim" -- for formatters and linters

	-- Telescope
	use "nvim-telescope/telescope.nvim"
	--	use "nvim-telescope/telescope-media-files.nvim"

	-- Treesitter
	use {
		"nvim-treesitter/nvim-treesitter",
		run = ":TSUpdate",
	}
	use "p00f/nvim-ts-rainbow"
	use "JoosepAlviste/nvim-ts-context-commentstring"
	use "lewis6991/spellsitter.nvim"

	-- Git
	use "lewis6991/gitsigns.nvim"

	-- Theme
	use({
		"catppuccin/nvim",
		as = "catppuccin"
	})

	-- Smooth Scrolling
	use 'declancm/cinnamon.nvim'

	-- Debugging
	use 'mfussenegger/nvim-dap'
	use "rcarriga/nvim-dap-ui"
	use "theHamsta/nvim-dap-virtual-text"
	use 'nvim-telescope/telescope-dap.nvim'
	use 'kndndrj/nvim-dap-projector'

Twiggeh avatar Jun 24 '22 09:06 Twiggeh

if you run that command in vim it will put the output of au VimEnter into your clipboard. otherwise you could just run au VimEnter and screenshot it

goolord avatar Jun 24 '22 14:06 goolord

image

if you run that command in vim it will put the output of au VimEnter into your clipboard. otherwise you could just run au VimEnter and screenshot it

Thanks! Am really new to nvim sorry

Twiggeh avatar Jun 24 '22 16:06 Twiggeh

My full config: https://github.com/Twiggeh/nvim-cfg

Twiggeh avatar Jun 25 '22 10:06 Twiggeh

My full config: https://github.com/Twiggeh/nvim-cfg

Have you managed to solve this? I'm facing the same issue. (I'm very new to nvim too)

erlonbie avatar Jul 22 '22 15:07 erlonbie

i can see a few problems with your config @Twiggeh https://github.com/Twiggeh/nvim-cfg/blob/master/lua/user/alpha.lua#L43 this line definitely shouldn't be there for starters. also, it may help to load your config like this

    use {
        "goolord/alpha-nvim",
        requires = { 'kyazdani42/nvim-web-devicons' },
        config = function () [your config here] end
    }

since packer doesn't guarantee the plugin will be loaded before then otherwise

goolord avatar Jul 22 '22 16:07 goolord

https://github.com/goolord/nvim/blob/main/lua/plugins/init.lua#L94-L98 https://github.com/goolord/nvim/blob/main/lua/plugins/alpha.lua

here's my personal config for reference

goolord avatar Jul 22 '22 16:07 goolord

The same issue is on my side, don't know how to solve it. 😭

noahxzhu avatar Aug 28 '22 14:08 noahxzhu

what happens if you clone alpha-nvim and run the debug config from the alpha-nvim directory https://github.com/goolord/alpha-nvim/blob/main/debug/DEBUG.md

goolord avatar Aug 28 '22 17:08 goolord

Run 'nvim --clean -u debug/min-alpha-dashboard.lua'

CleanShot 2022-08-29 at 08 17 12@2x

Other two options '--noplugin', '-u' work fine.

noahxzhu avatar Aug 29 '22 00:08 noahxzhu

what happens if you move your alpha config loading to the packer setup field like mentioned above

goolord avatar Aug 29 '22 05:08 goolord

Nothing happened. All the configurations were loaded without any errors. I need to execute Alpha to start it.

noahxzhu avatar Aug 29 '22 10:08 noahxzhu

what's the output of nvim --version

goolord avatar Aug 29 '22 16:08 goolord

it would be really helpful if i could see your config, also. this feature works for 99% of this plugin's userbase and the debug configs work for you, so this must be a user config error

goolord avatar Aug 29 '22 16:08 goolord

CleanShot 2022-08-30 at 11 37 42@2x

This is my alpha config https://github.com/virezox/nvim/blob/main/lua/plugins/alpha.lua, Here is my packer config https://github.com/virezox/nvim/blob/main/lua/plugins/packer.lua#L56,

https://github.com/virezox/nvim/blob/main/lua/plugins/init.lua#L3 I require it in this place, if I don't require it, there's no "Alpha" command, so I require it. I also tested when deleting the require, not succeed.

noahxzhu avatar Aug 30 '22 03:08 noahxzhu

i cloned your config and it autostarted on my machine lol

https://user-images.githubusercontent.com/24906808/187344280-716743b8-2baf-4df4-b192-46a476651075.mov

goolord avatar Aug 30 '22 03:08 goolord

would you happen to have nvim aliased (check which nvim)

goolord avatar Aug 30 '22 03:08 goolord

i'm on HEAD neovim (0.8), it may also be that

goolord avatar Aug 30 '22 03:08 goolord

CleanShot 2022-08-30 at 21 51 59@2x I'm a mac user. I upgraded my neovim to 0.8, but it still doesn't work. I'm not sure if some dependencies are missing using homebrew to install. Both M1 and Intel don't work on my side.

noahxzhu avatar Aug 30 '22 13:08 noahxzhu

The reason is that I use neovim to open a folder, lol. I should start neovim directly. 😄

noahxzhu avatar Aug 31 '22 00:08 noahxzhu