Merge branch 'main' of github.com:hedyhli/outline.nvim

This commit is contained in:
~hedy
2024-05-30 07:53:26 +08:00

View File

@@ -18,10 +18,18 @@ function View:setup_view(split_command)
-- create a scratch unlisted buffer
self.buf = vim.api.nvim_create_buf(false, true)
-- set filetype
vim.api.nvim_buf_set_option(self.buf, 'filetype', 'Outline')
-- delete buffer when window is closed / buffer is hidden
vim.api.nvim_buf_set_option(self.buf, 'bufhidden', 'delete')
-- create a split
vim.cmd(split_command)
-- get current (outline) window and attach our buffer to it
self.win = vim.api.nvim_get_current_win()
vim.api.nvim_win_set_buf(self.win, self.buf)
-- resize if split_command not specify width like "25vsplit"
if split_command:match("%d+") == nil then
@@ -29,10 +37,6 @@ function View:setup_view(split_command)
vim.cmd('vertical resize ' .. cfg.o.outline_window.width)
end
-- get current (outline) window and attach our buffer to it
self.win = vim.api.nvim_get_current_win()
vim.api.nvim_win_set_buf(self.win, self.buf)
-- window stuff
vim.api.nvim_win_set_option(self.win, 'spell', false)
vim.api.nvim_win_set_option(self.win, 'signcolumn', 'no')
@@ -53,7 +57,6 @@ function View:setup_view(split_command)
-- buffer stuff
local tab = vim.api.nvim_get_current_tabpage()
vim.api.nvim_buf_set_name(self.buf, 'OUTLINE_' .. tostring(tab))
vim.api.nvim_buf_set_option(self.buf, 'filetype', 'Outline')
vim.api.nvim_buf_set_option(self.buf, 'modifiable', false)
if cfg.o.outline_window.show_numbers or cfg.o.outline_window.show_relative_numbers then