Skip to content

Commit fd36a4e

Browse files
committed
feat(status): add opt-in soft wrap option
1 parent 9ea60f7 commit fd36a4e

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ neogit.setup {
138138
disable_line_numbers = true,
139139
-- Disable relative line numbers
140140
disable_relative_line_numbers = true,
141+
-- Enable text wrap
142+
enable_text_wrap = false,
141143
-- The time after which an output console is shown for slow running commands
142144
console_timeout = 2000,
143145
-- Automatically show console if a command takes more than console_timeout milliseconds

doc/neogit.txt

+2
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ to Neovim users.
157157
disable_line_numbers = true,
158158
-- Disable relative line numbers
159159
disable_relative_line_numbers = true,
160+
-- Enable text wrap
161+
enable_text_wrap = false,
160162
-- The time after which an output console is shown for slow running commands
161163
console_timeout = 2000,
162164
-- Automatically show console if a command takes more than console_timeout milliseconds

lua/neogit/buffers/status/init.lua

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ function M:open(kind)
103103
kind = kind or config.values.kind or "tab",
104104
disable_line_numbers = config.values.disable_line_numbers,
105105
disable_relative_line_numbers = config.values.disable_relative_line_numbers,
106+
enable_text_wrap = config.values.enable_text_wrap,
106107
foldmarkers = not config.values.disable_signs,
107108
active_item_highlight = true,
108109
on_detach = function()

lua/neogit/config.lua

+3
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ end
321321
---@field kind? WindowKind The default type of window neogit should open in
322322
---@field disable_line_numbers? boolean Whether to disable line numbers
323323
---@field disable_relative_line_numbers? boolean Whether to disable line numbers
324+
---@field enable_text_wrap? boolean Whether to soft wrap text
324325
---@field console_timeout? integer Time in milliseconds after a console is created for long running commands
325326
---@field auto_show_console? boolean Automatically show the console if a command takes longer than console_timeout
326327
---@field auto_show_console_on? string Specify "output" (show always; default) or "error" if `auto_show_console` enabled
@@ -382,6 +383,7 @@ function M.get_default_values()
382383
initial_branch_name = "",
383384
disable_line_numbers = true,
384385
disable_relative_line_numbers = true,
386+
enable_text_wrap = false,
385387
-- The time after which an output console is shown for slow running commands
386388
console_timeout = 2000,
387389
-- Automatically show console if a command takes more than console_timeout milliseconds
@@ -1122,6 +1124,7 @@ function M.validate_config()
11221124
validate_kind(config.kind, "kind")
11231125
validate_type(config.disable_line_numbers, "disable_line_numbers", "boolean")
11241126
validate_type(config.disable_relative_line_numbers, "disable_relative_line_numbers", "boolean")
1127+
validate_type(config.enable_text_wrap, "enable_text_wrap", "boolean")
11251128
validate_type(config.auto_show_console, "auto_show_console", "boolean")
11261129
validate_type(config.auto_show_console_on, "auto_show_console_on", "string")
11271130
validate_type(config.auto_close_console, "auto_close_console", "boolean")

lua/neogit/lib/buffer.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ end
669669
---@field autocmds table|nil
670670
---@field user_autocmds table|nil
671671
---@field spell_check boolean|nil
672+
---@field enable_text_wrap boolean|nil
672673
---@field initialize function|nil
673674
---@field after function|nil
674675
---@field on_detach function|nil
@@ -779,7 +780,7 @@ function Buffer.create(config)
779780
end
780781

781782
buffer:set_window_option("spell", config.spell_check or false)
782-
buffer:set_window_option("wrap", false)
783+
buffer:set_window_option("wrap", config.enable_text_wrap or false)
783784
buffer:set_window_option("foldmethod", "manual")
784785
-- TODO: Need to find a way to turn this off properly when unloading plugin
785786
-- buffer:set_window_option("winfixbuf", true)

0 commit comments

Comments
 (0)