akinsho / akinsho/toggleterm.nvim

[BUG] hide_numbers in setup is no longer valid

Open
#637 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Lua
Stars
5.6k
Forks
206
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.