Skip to content

Commit

Permalink
(mini.basics) FEATURE: Set 'termguicolors' only on Neovim<0.10.
Browse files Browse the repository at this point in the history
Details:
- Resolves #632.
  • Loading branch information
echasnovski committed Dec 29, 2023
1 parent fd5d244 commit 937386c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ vim.keymap.set('i', '<C-z>', '<C-g>u<Esc>[s1z=`]a<C-g>u', { desc = 'Correct late
```

- 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.
- FEATURE: Set `termguicolors` only on Neovim<0.10, as later versions should have it on by default (if terminal emulator supports it).

## mini.doc

Expand Down
4 changes: 2 additions & 2 deletions doc/mini-basics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Default values:
MiniBasics.config = {
-- Options. Set to `false` to disable.
options = {
-- Basic options ('termguicolors', 'number', 'ignorecase', and many more)
-- Basic options ('number', 'ignorecase', and many more)
basic = true,
-- Extra UI features ('winblend', 'cmdheight=0', ...)
Expand Down Expand Up @@ -157,7 +157,7 @@ Here is the list of affected options (put cursor on it and press |CTRL-]|):
- |splitbelow|
- |splitkeep| (on Neovim>=0.9)
- |splitright|
- |termguicolors|
- |termguicolors| (on Neovim<0.10; later versions have it smartly enabled)
- |wrap|
- Editing
- |completeopt|
Expand Down
9 changes: 6 additions & 3 deletions lua/mini/basics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ end
--- - |splitbelow|
--- - |splitkeep| (on Neovim>=0.9)
--- - |splitright|
--- - |termguicolors|
--- - |termguicolors| (on Neovim<0.10; later versions have it smartly enabled)
--- - |wrap|
--- - Editing
--- - |completeopt|
Expand Down Expand Up @@ -313,7 +313,7 @@ end
MiniBasics.config = {
-- Options. Set to `false` to disable.
options = {
-- Basic options ('termguicolors', 'number', 'ignorecase', and many more)
-- Basic options ('number', 'ignorecase', and many more)
basic = true,

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

o.ruler = false -- Don't show cursor position in command line
o.showmode = false -- Don't show mode in command line
Expand All @@ -482,6 +481,10 @@ H.apply_options = function(config)
else
opt.shortmess:append('Wc') -- Reduce command line messages
end

if vim.fn.has('nvim-0.10') == 0 then
o.termguicolors = true -- Enable gui colors
end
end

-- Some opinioneted extra UI options
Expand Down
2 changes: 1 addition & 1 deletion readmes/mini-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Here are code snippets for some common installation methods (use only one):
{
-- Options. Set to `false` to disable.
options = {
-- Basic options ('termguicolors', 'number', 'ignorecase', and many more)
-- Basic options ('number', 'ignorecase', and many more)
basic = true,

-- Extra UI features ('winblend', 'cmdheight=0', ...)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_basics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ T['Options']['work'] = function()
load_module()

eq(child.g.mapleader, ' ')
eq(child.o.termguicolors, true)
if child.fn.has('nvim-0.10') == 0 then eq(child.o.termguicolors, true) end
eq(child.o.number, true)
eq(child.o.signcolumn, 'yes')
eq(child.o.fillchars, 'eob: ')
Expand Down

0 comments on commit 937386c

Please sign in to comment.