Skip to content

Keyboard shortcut to toggle lualine (or statusline) #979

Answered by fitrh
MAXIIIMVS asked this question in Q&A
Discussion options

You must be logged in to vote

I think since hide() sets vim.o.statusline to empty string with Normal
highlight, you can try something like this

vim.api.nvim_set_keymap("n", "<Leader>s", "", {
    callback = function()
        local statusline = vim.o.statusline

        require("lualine").hide({
            place = { "statusline" },
            unhide = statusline == "" or statusline == "%#Normal#",
        })
    end,
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MAXIIIMVS
Comment options

Answer selected by MAXIIIMVS
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