Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mini): dodge status line when cmdheight > 0 #685

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lua/noice/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ function M.setup(options)
end,
})

if M.options.cmdline.enabled then
vim.o.cmdheight = 0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed?

Copy link
Author

@Frederick888 Frederick888 Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I don't apply it here, I guess due to the fact that MiniView's initialisation happens too early, there's a gap between the pop-ups and the status line.

image

PS: repro.lua

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  "MunifTanjim/nui.nvim",
  { "https://github.com/Frederick888/noice.nvim.git", branch = 'mini-dodge-status-line' },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

require("noice").setup({
  lsp = {
    -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
    override = {
      ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
      ["vim.lsp.util.stylize_markdown"] = true,
      ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
    },
  },
  -- you can enable a preset for easier configuration
  presets = {
    bottom_search = true, -- use a classic bottom cmdline for search
    command_palette = true, -- position the cmdline and popupmenu together
    long_message_to_split = true, -- long messages will be sent to a split
    inc_rename = false, -- enables an input dialog for inc-rename.nvim
    lsp_doc_border = false, -- add a border to hover docs and signature help
  },

  cmdline = {
    enabled = true,
  },
  messages = {
    enabled = true,
  }
})

local timer = vim.uv.new_timer()
local counter = 1
vim.uv.timer_start(timer, 1000, 1000, function ()
  vim.notify('hello, world! ' .. counter)
  counter = counter + 1
end)

end
require("noice.lsp").setup()
M._running = true
end
Expand Down
1 change: 1 addition & 0 deletions lua/noice/view/backend/mini.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ end

function MiniView:update_options()
self._opts = vim.tbl_deep_extend("force", defaults, self._opts)
self._opts.position.row = self._opts.position.row - vim.o.cmdheight
end

---@param message NoiceMessage
Expand Down