Merge branch 'main' of github.com:hedyhli/outline.nvim
This commit is contained in:
@@ -18,21 +18,25 @@ function View:setup_view(split_command)
|
|||||||
-- create a scratch unlisted buffer
|
-- create a scratch unlisted buffer
|
||||||
self.buf = vim.api.nvim_create_buf(false, true)
|
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
|
-- delete buffer when window is closed / buffer is hidden
|
||||||
vim.api.nvim_buf_set_option(self.buf, 'bufhidden', 'delete')
|
vim.api.nvim_buf_set_option(self.buf, 'bufhidden', 'delete')
|
||||||
|
|
||||||
-- create a split
|
-- create a split
|
||||||
vim.cmd(split_command)
|
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"
|
-- resize if split_command not specify width like "25vsplit"
|
||||||
if split_command:match("%d+") == nil then
|
if split_command:match("%d+") == nil then
|
||||||
-- resize to a % of the current window size
|
-- resize to a % of the current window size
|
||||||
vim.cmd('vertical resize ' .. cfg.o.outline_window.width)
|
vim.cmd('vertical resize ' .. cfg.o.outline_window.width)
|
||||||
end
|
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
|
-- window stuff
|
||||||
vim.api.nvim_win_set_option(self.win, 'spell', false)
|
vim.api.nvim_win_set_option(self.win, 'spell', false)
|
||||||
vim.api.nvim_win_set_option(self.win, 'signcolumn', 'no')
|
vim.api.nvim_win_set_option(self.win, 'signcolumn', 'no')
|
||||||
@@ -53,7 +57,6 @@ function View:setup_view(split_command)
|
|||||||
-- buffer stuff
|
-- buffer stuff
|
||||||
local tab = vim.api.nvim_get_current_tabpage()
|
local tab = vim.api.nvim_get_current_tabpage()
|
||||||
vim.api.nvim_buf_set_name(self.buf, 'OUTLINE_' .. tostring(tab))
|
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)
|
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
|
if cfg.o.outline_window.show_numbers or cfg.o.outline_window.show_relative_numbers then
|
||||||
|
|||||||
Reference in New Issue
Block a user