Merge pull request #162 from madlep/wrap-option
Add `wrap` config option
This commit is contained in:
@@ -46,6 +46,7 @@ local opts = {
|
|||||||
autofold_depth = nil,
|
autofold_depth = nil,
|
||||||
auto_unfold_hover = true,
|
auto_unfold_hover = true,
|
||||||
fold_markers = { '', '' },
|
fold_markers = { '', '' },
|
||||||
|
wrap = false,
|
||||||
keymaps = { -- These keymaps can be a string or a table for multiple keys
|
keymaps = { -- These keymaps can be a string or a table for multiple keys
|
||||||
close = {"<Esc>", "q"},
|
close = {"<Esc>", "q"},
|
||||||
goto_location = "<Cr>",
|
goto_location = "<Cr>",
|
||||||
@@ -113,7 +114,8 @@ local opts = {
|
|||||||
| symbol_blacklist | Which symbols to ignore ([possible values](./lua/symbols-outline/symbols.lua)) | table (array) | {} |
|
| symbol_blacklist | Which symbols to ignore ([possible values](./lua/symbols-outline/symbols.lua)) | table (array) | {} |
|
||||||
| autofold_depth | Depth past which nodes will be folded by default | int | nil |
|
| autofold_depth | Depth past which nodes will be folded by default | int | nil |
|
||||||
| auto_unfold_hover | Automatically unfold hovered symbol | boolean | true |
|
| auto_unfold_hover | Automatically unfold hovered symbol | boolean | true |
|
||||||
| fold_markers | Markers to denote foldable symbol's status | table (array) | { '', '' } |
|
| fold_markers | Markers to denote foldable symbol's status | table (array) | { '', '' } |
|
||||||
|
| wrap | Whether to wrap long lines, or let them flow off the window | boolean | false |
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ M.defaults = {
|
|||||||
autofold_depth = nil,
|
autofold_depth = nil,
|
||||||
auto_unfold_hover = true,
|
auto_unfold_hover = true,
|
||||||
fold_markers = { '', '' },
|
fold_markers = { '', '' },
|
||||||
|
wrap = false,
|
||||||
keymaps = { -- These keymaps can be a string or a table for multiple keys
|
keymaps = { -- These keymaps can be a string or a table for multiple keys
|
||||||
close = { '<Esc>', 'q' },
|
close = { '<Esc>', 'q' },
|
||||||
goto_location = '<Cr>',
|
goto_location = '<Cr>',
|
||||||
|
|||||||
@@ -27,6 +27,14 @@ function View:setup_view()
|
|||||||
vim.api.nvim_win_set_option(self.winnr, 'relativenumber', false)
|
vim.api.nvim_win_set_option(self.winnr, 'relativenumber', false)
|
||||||
vim.api.nvim_win_set_option(self.winnr, 'winfixwidth', true)
|
vim.api.nvim_win_set_option(self.winnr, 'winfixwidth', true)
|
||||||
vim.api.nvim_win_set_option(self.winnr, 'list', false)
|
vim.api.nvim_win_set_option(self.winnr, 'list', false)
|
||||||
|
vim.api.nvim_win_set_option(self.winnr, 'wrap', config.options.wrap)
|
||||||
|
vim.api.nvim_win_set_option(self.winnr, 'linebreak', true) -- only has effect when wrap=true
|
||||||
|
vim.api.nvim_win_set_option(self.winnr, 'breakindent', true) -- only has effect when wrap=true
|
||||||
|
-- Would be nice to use ui.markers.vertical as part of showbreak to keep
|
||||||
|
-- continuity of the tree UI, but there's currently no way to style the
|
||||||
|
-- color, apart from globally overriding hl-NonText, which will potentially
|
||||||
|
-- mess with other theme/user settings. So just use empty spaces for now.
|
||||||
|
vim.api.nvim_win_set_option(self.winnr, 'showbreak', ' ') -- only has effect when wrap=true.
|
||||||
-- buffer stuff
|
-- buffer stuff
|
||||||
vim.api.nvim_buf_set_name(self.bufnr, 'OUTLINE')
|
vim.api.nvim_buf_set_name(self.bufnr, 'OUTLINE')
|
||||||
vim.api.nvim_buf_set_option(self.bufnr, 'filetype', 'Outline')
|
vim.api.nvim_buf_set_option(self.bufnr, 'filetype', 'Outline')
|
||||||
@@ -49,9 +57,9 @@ end
|
|||||||
|
|
||||||
function View:is_open()
|
function View:is_open()
|
||||||
return self.winnr
|
return self.winnr
|
||||||
and self.bufnr
|
and self.bufnr
|
||||||
and vim.api.nvim_buf_is_valid(self.bufnr)
|
and vim.api.nvim_buf_is_valid(self.bufnr)
|
||||||
and vim.api.nvim_win_is_valid(self.winnr)
|
and vim.api.nvim_win_is_valid(self.winnr)
|
||||||
end
|
end
|
||||||
|
|
||||||
return View
|
return View
|
||||||
|
|||||||
Reference in New Issue
Block a user