akinsho / akinsho/toggleterm.nvim

[BUG] hide_numbers in setup is no longer valid

Offen
#637 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Lua
Sterne
5.6k
Forks
206
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Since neovim 0.11, [number is disabled by default in terminal](https://neovim.io/doc/user/terminal.html#terminal-config). So if users want to enable it, they should set it by themselves.

```vim
au TermOpen * setlocal number
au TermOpen * setlocal relativenumber
```

As a consequence, `hide_numbers` would no longer useful or valid. So I have the following patch.

```diff
diff --git a/README.md b/README.md
index 54733f3..67c2fb3 100644
--- a/README.md
+++ b/README.md
@@ -168,7 +168,6 @@ require("toggleterm").setup{
on_stdout = fun(t: Terminal, job: number, data: string[], name: string) -- callback for processing output on stdout
on_stderr = fun(t: Terminal, job: number, data: string[], name: string) -- callback for processing output on stderr
on_exit = fun(t: Terminal, job: number, exit_code: number, name: string) -- function to run when terminal process exits
- hide_numbers = true, -- hide the number column in toggleterm buffers
shade_filetypes = {},
autochdir = false, -- when neovim changes it current directory the terminal will change it's own when next it's opened
highlights = {
diff --git a/lua/toggleterm/config.lua b/lua/toggleterm/config.lua
index 736d8cf..a696891 100644
--- a/lua/toggleterm/config.lua
+++ b/lua/toggleterm/config.lua
@@ -20,7 +20,6 @@ local function shade(color, factor) return colors.shade_color(color, factor) end
--- @class ToggleTermConfig
--- @field size number
--- @field shade_filetypes string[]
---- @field hide_numbers boolean
--- @field open_mapping string | string[]
--- @field shade_terminals boolean
--- @field insert_mappings boolean
@@ -46,7 +45,6 @@ local function shade(color, factor) return colors.shade_color(color, factor) end
local config = {
size = 12,
shade_filetypes = {},
- hide_numbers = true,
shade_terminals = true,
insert_mappings = true,
terminal_mappings = true,
diff --git a/lua/toggleterm/terminal.lua b/lua/toggleterm/terminal.lua
index 19231c4..0dcffc5 100644
--- a/lua/toggleterm/terminal.lua
+++ b/lua/toggleterm/terminal.lua
@@ -437,11 +437,6 @@ function Terminal:__set_win_options()
local field = self.direction == "vertical" and "winfixwidth" or "winfixheight"
utils.wo_setlocal(self.window, field, true)
end
-
- if config.hide_numbers then
- utils.wo_setlocal(self.window, "number", false)
- utils.wo_setlocal(self.window, "relativenumber", false)
- end
end

---@package
```

Because I see the requirement is neovim 0.7. So I don't send the PR. Just let the author to decide it.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.