Skip to content

Open Alpha only when nvim opens a whole directory #203

Answered by goolord
MrRoiz asked this question in Q&A
Discussion options

You must be logged in to vote

alpha-nvim/lua/alpha.lua

Lines 539 to 568 in dafa11a

local function should_skip_alpha()
-- don't start when opening a file
if vim.fn.argc() > 0 then return true end
-- skip stdin
if vim.fn.line2byte("$") ~= -1 then return true end
-- Handle nvim -M
if not vim.o.modifiable then return true end
for _, arg in pairs(vim.v.argv) do
-- whitelisted arguments
-- always open
if arg == "--startuptime"
then return false
end
-- blacklisted arguments
-- always skip
if arg == "-b"
-- commands, typically used for scripting
or arg == "-c" or vim.startswith(arg, "+")
or arg == "-S"

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@MrRoiz
Comment options

@goolord
Comment options

Answer selected by MrRoiz
@MrRoiz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants