Skip to content

Commit 937386c

Browse files
committed
(mini.basics) FEATURE: Set 'termguicolors' only on Neovim<0.10.
Details: - Resolves #632.
1 parent fd5d244 commit 937386c

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ vim.keymap.set('i', '<C-z>', '<C-g>u<Esc>[s1z=`]a<C-g>u', { desc = 'Correct late
1010
```
1111

1212
- FEATURE: Add `tab:> ` to 'listchars' option when `options.extra_ui` is set. This prevents showing `^I` instead of a tab and actual value comes from Neovim's default.
13+
- FEATURE: Set `termguicolors` only on Neovim<0.10, as later versions should have it on by default (if terminal emulator supports it).
1314

1415
## mini.doc
1516

doc/mini-basics.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Default values:
7676
MiniBasics.config = {
7777
-- Options. Set to `false` to disable.
7878
options = {
79-
-- Basic options ('termguicolors', 'number', 'ignorecase', and many more)
79+
-- Basic options ('number', 'ignorecase', and many more)
8080
basic = true,
8181
8282
-- Extra UI features ('winblend', 'cmdheight=0', ...)
@@ -157,7 +157,7 @@ Here is the list of affected options (put cursor on it and press |CTRL-]|):
157157
- |splitbelow|
158158
- |splitkeep| (on Neovim>=0.9)
159159
- |splitright|
160-
- |termguicolors|
160+
- |termguicolors| (on Neovim<0.10; later versions have it smartly enabled)
161161
- |wrap|
162162
- Editing
163163
- |completeopt|

lua/mini/basics.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ end
128128
--- - |splitbelow|
129129
--- - |splitkeep| (on Neovim>=0.9)
130130
--- - |splitright|
131-
--- - |termguicolors|
131+
--- - |termguicolors| (on Neovim<0.10; later versions have it smartly enabled)
132132
--- - |wrap|
133133
--- - Editing
134134
--- - |completeopt|
@@ -313,7 +313,7 @@ end
313313
MiniBasics.config = {
314314
-- Options. Set to `false` to disable.
315315
options = {
316-
-- Basic options ('termguicolors', 'number', 'ignorecase', and many more)
316+
-- Basic options ('number', 'ignorecase', and many more)
317317
basic = true,
318318

319319
-- Extra UI features ('winblend', 'cmdheight=0', ...)
@@ -455,7 +455,6 @@ H.apply_options = function(config)
455455
o.number = true -- Show line numbers
456456
o.splitbelow = true -- Horizontal splits will be below
457457
o.splitright = true -- Vertical splits will be to the right
458-
o.termguicolors = true -- Enable gui colors
459458

460459
o.ruler = false -- Don't show cursor position in command line
461460
o.showmode = false -- Don't show mode in command line
@@ -482,6 +481,10 @@ H.apply_options = function(config)
482481
else
483482
opt.shortmess:append('Wc') -- Reduce command line messages
484483
end
484+
485+
if vim.fn.has('nvim-0.10') == 0 then
486+
o.termguicolors = true -- Enable gui colors
487+
end
485488
end
486489

487490
-- Some opinioneted extra UI options

readmes/mini-basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Here are code snippets for some common installation methods (use only one):
146146
{
147147
-- Options. Set to `false` to disable.
148148
options = {
149-
-- Basic options ('termguicolors', 'number', 'ignorecase', and many more)
149+
-- Basic options ('number', 'ignorecase', and many more)
150150
basic = true,
151151

152152
-- Extra UI features ('winblend', 'cmdheight=0', ...)

tests/test_basics.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ T['Options']['work'] = function()
131131
load_module()
132132

133133
eq(child.g.mapleader, ' ')
134-
eq(child.o.termguicolors, true)
134+
if child.fn.has('nvim-0.10') == 0 then eq(child.o.termguicolors, true) end
135135
eq(child.o.number, true)
136136
eq(child.o.signcolumn, 'yes')
137137
eq(child.o.fillchars, 'eob: ')

0 commit comments

Comments
 (0)