mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
By historical accident, Nvim defaults to background=light. So on a dark background, `:colorscheme default` looks completely wrong. The "smart" logic that Vim uses is confusing for anyone who uses Vim on multiple platforms, so rather than mimic that, pick the (hopefully) most common default. - Since Neovim is dark-powered, we assume most users have dark backgrounds. - Most of the GUIs tend to have a dark background by default. ref #6289
This commit is contained in:
parent
e53ae88e7e
commit
deb18a050e
@ -703,47 +703,24 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
been set.
|
been set.
|
||||||
|
|
||||||
*'background'* *'bg'*
|
*'background'* *'bg'*
|
||||||
'background' 'bg' string (default "dark" or "light", see below)
|
'background' 'bg' string (default "dark")
|
||||||
global
|
global
|
||||||
When set to "dark", Vim will try to use colors that look good on a
|
When set to "dark" or "light", Nvim will adjust the default color
|
||||||
dark background. When set to "light", Vim will try to use colors that
|
groups for a dark or light background, respectively.
|
||||||
look good on a light background. Any other value is illegal.
|
|
||||||
Vim tries to set the default value according to the terminal used.
|
|
||||||
This will not always be correct.
|
|
||||||
Setting this option does not change the background color, it tells Vim
|
|
||||||
what the background color looks like. For changing the background
|
|
||||||
color, see |:hi-normal|.
|
|
||||||
|
|
||||||
When 'background' is set Vim will adjust the default color groups for
|
This option does NOT change the background color, it tells Nvim what
|
||||||
the new value. But the colors used for syntax highlighting will not
|
the "inherited" (terminal/GUI) background looks like.
|
||||||
change. *g:colors_name*
|
See |:hi-normal| if you want to set the background color explicitly.
|
||||||
|
*g:colors_name*
|
||||||
When a color scheme is loaded (the "g:colors_name" variable is set)
|
When a color scheme is loaded (the "g:colors_name" variable is set)
|
||||||
setting 'background' will cause the color scheme to be reloaded. If
|
setting 'background' will cause the color scheme to be reloaded. If
|
||||||
the color scheme adjusts to the value of 'background' this will work.
|
the color scheme adjusts to the value of 'background' this will work.
|
||||||
However, if the color scheme sets 'background' itself the effect may
|
However, if the color scheme sets 'background' itself the effect may
|
||||||
be undone. First delete the "g:colors_name" variable when needed.
|
be undone. First delete the "g:colors_name" variable when needed.
|
||||||
|
|
||||||
When setting 'background' to the default value with: >
|
|
||||||
:set background&
|
|
||||||
< Vim will guess the value. In the GUI this should work correctly,
|
|
||||||
in other cases Vim might not be able to guess the right value.
|
|
||||||
|
|
||||||
When starting the GUI, the default value for 'background' will be
|
|
||||||
"light". When the value is not set in the gvimrc, and Vim detects
|
|
||||||
that the background is actually quite dark, 'background' is set to
|
|
||||||
"dark". But this happens only AFTER the gvimrc file has been read
|
|
||||||
(because the window needs to be opened to find the actual background
|
|
||||||
color). To get around this, force the GUI window to be opened by
|
|
||||||
putting a ":gui" command in the gvimrc file, before where the value
|
|
||||||
of 'background' is used (e.g., before ":syntax on").
|
|
||||||
|
|
||||||
For Windows the default is "dark". "dark" should be used if $COLORFGBG
|
|
||||||
suggests a dark background (not yet implemented). Otherwise the default
|
|
||||||
is "light".
|
|
||||||
|
|
||||||
Normally this option would be set in the vimrc file. Possibly
|
Normally this option would be set in the vimrc file. Possibly
|
||||||
depending on the terminal name. Example: >
|
depending on the terminal name. Example: >
|
||||||
:if $TERM == "xterm"
|
:if $TERM ==# "xterm"
|
||||||
: set background=dark
|
: set background=dark
|
||||||
:endif
|
:endif
|
||||||
< When this option is set, the default settings for the highlight groups
|
< When this option is set, the default settings for the highlight groups
|
||||||
|
@ -27,6 +27,7 @@ a complete and centralized reference of those differences.
|
|||||||
|
|
||||||
- 'autoindent' is set by default
|
- 'autoindent' is set by default
|
||||||
- 'autoread' is set by default
|
- 'autoread' is set by default
|
||||||
|
- 'background' always defaults to "dark"
|
||||||
- 'backspace' defaults to "indent,eol,start"
|
- 'backspace' defaults to "indent,eol,start"
|
||||||
- 'backupdir' defaults to .,~/.local/share/nvim/backup (|xdg|)
|
- 'backupdir' defaults to .,~/.local/share/nvim/backup (|xdg|)
|
||||||
- 'belloff' defaults to "all"
|
- 'belloff' defaults to "all"
|
||||||
|
@ -132,10 +132,10 @@ return {
|
|||||||
{
|
{
|
||||||
full_name='background', abbreviation='bg',
|
full_name='background', abbreviation='bg',
|
||||||
type='string', scope={'global'},
|
type='string', scope={'global'},
|
||||||
vi_def=true,
|
vim=true,
|
||||||
redraw={'all_windows'},
|
redraw={'all_windows'},
|
||||||
varname='p_bg',
|
varname='p_bg',
|
||||||
defaults={if_true={vi="light"}}
|
defaults={if_true={vi="light",vim="dark"}}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
full_name='backspace', abbreviation='bs',
|
full_name='backspace', abbreviation='bs',
|
||||||
|
@ -52,7 +52,7 @@ local function screen_setup(extra_rows, command, cols)
|
|||||||
[7] = {foreground = 130},
|
[7] = {foreground = 130},
|
||||||
[8] = {foreground = 15, background = 1}, -- error message
|
[8] = {foreground = 15, background = 1}, -- error message
|
||||||
[9] = {foreground = 4},
|
[9] = {foreground = 4},
|
||||||
[10] = {foreground = 2}, -- "Press ENTER" in embedded :terminal session.
|
[10] = {foreground = 121}, -- "Press ENTER" in embedded :terminal session.
|
||||||
})
|
})
|
||||||
|
|
||||||
screen:attach({rgb=false})
|
screen:attach({rgb=false})
|
||||||
|
@ -134,15 +134,17 @@ describe('tui', function()
|
|||||||
feed_data('\022\007') -- ctrl+g
|
feed_data('\022\007') -- ctrl+g
|
||||||
feed_data('\022\022') -- ctrl+v
|
feed_data('\022\022') -- ctrl+v
|
||||||
feed_data('\022\013') -- ctrl+m
|
feed_data('\022\013') -- ctrl+m
|
||||||
|
local attrs = screen:get_default_attr_ids()
|
||||||
|
attrs[11] = {foreground = 81}
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{9:^G^V^M}{1: } |
|
{11:^G^V^M}{1: } |
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
{4:~ }|
|
{4:~ }|
|
||||||
{5:[No Name] [+] }|
|
{5:[No Name] [+] }|
|
||||||
{3:-- INSERT --} |
|
{3:-- INSERT --} |
|
||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]])
|
]], attrs)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('automatically sends <Paste> for bracketed paste sequences', function()
|
it('automatically sends <Paste> for bracketed paste sequences', function()
|
||||||
|
@ -17,6 +17,7 @@ local function test_embed(ext_linegrid)
|
|||||||
[1] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
[1] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
|
||||||
[2] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
[2] = {bold = true, foreground = Screen.colors.SeaGreen4},
|
||||||
[3] = {bold = true, foreground = Screen.colors.Blue1},
|
[3] = {bold = true, foreground = Screen.colors.Blue1},
|
||||||
|
[4] = {bold = true, foreground = Screen.colors.Green},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ local function test_embed(ext_linegrid)
|
|||||||
Error detected while processing pre-vimrc command line: |
|
Error detected while processing pre-vimrc command line: |
|
||||||
foo |
|
foo |
|
||||||
{1:bar} |
|
{1:bar} |
|
||||||
{2:Press ENTER or type command to continue}^ |
|
{4:Press ENTER or type command to continue}^ |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -68,7 +68,12 @@ describe("shell command :!", function()
|
|||||||
|
|
|
|
||||||
{10:Press ENTER or type command to continue}{1: } |
|
{10:Press ENTER or type command to continue}{1: } |
|
||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]])
|
]], {
|
||||||
|
-- test/functional/helpers.lua defaults to background=light.
|
||||||
|
[1] = {reverse = true},
|
||||||
|
[3] = {bold = true},
|
||||||
|
[10] = {foreground = 2},
|
||||||
|
})
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
-- To debug screen tests, see Screen:redraw_debug().
|
-- To debug screen tests, see Screen:redraw_debug().
|
||||||
|
|
||||||
local global_helpers = require('test.helpers')
|
local global_helpers = require('test.helpers')
|
||||||
|
local deepcopy = global_helpers.deepcopy
|
||||||
local shallowcopy = global_helpers.shallowcopy
|
local shallowcopy = global_helpers.shallowcopy
|
||||||
local helpers = require('test.functional.helpers')(nil)
|
local helpers = require('test.functional.helpers')(nil)
|
||||||
local request, run, uimeths = helpers.request, helpers.run, helpers.uimeths
|
local request, run, uimeths = helpers.request, helpers.run, helpers.uimeths
|
||||||
@ -176,6 +177,10 @@ function Screen:set_default_attr_ids(attr_ids)
|
|||||||
self._default_attr_ids = attr_ids
|
self._default_attr_ids = attr_ids
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Screen:get_default_attr_ids()
|
||||||
|
return deepcopy(self._default_attr_ids)
|
||||||
|
end
|
||||||
|
|
||||||
function Screen:set_default_attr_ignore(attr_ignore)
|
function Screen:set_default_attr_ignore(attr_ignore)
|
||||||
self._default_attr_ignore = attr_ignore
|
self._default_attr_ignore = attr_ignore
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user