2022-07-11 06:10:27 -07:00
|
|
|
if exists('s:did_load')
|
|
|
|
" Align Nvim defaults to Vim.
|
|
|
|
set backspace=
|
2023-04-02 08:01:48 -07:00
|
|
|
set commentstring=/*%s*/
|
2022-07-11 06:10:27 -07:00
|
|
|
set complete=.,w,b,u,t,i
|
2023-06-06 09:26:29 -07:00
|
|
|
set define=^\\s*#\\s*define
|
2022-07-11 06:10:27 -07:00
|
|
|
set directory^=.
|
2022-07-20 04:58:08 -07:00
|
|
|
set display=
|
2022-08-25 17:52:13 -07:00
|
|
|
set fillchars=vert:\|,foldsep:\|,fold:-
|
2022-07-11 06:10:27 -07:00
|
|
|
set formatoptions=tcq
|
|
|
|
set fsync
|
2023-06-06 09:26:29 -07:00
|
|
|
set include=^\\s*#\\s*include
|
2022-07-11 06:10:27 -07:00
|
|
|
set laststatus=1
|
|
|
|
set listchars=eol:$
|
|
|
|
set joinspaces
|
2023-04-27 23:46:53 -07:00
|
|
|
set mousemodel=extend
|
2022-07-11 06:10:27 -07:00
|
|
|
set nohidden nosmarttab noautoindent noautoread noruler noshowcmd
|
|
|
|
set nohlsearch noincsearch
|
|
|
|
set nrformats=bin,octal,hex
|
|
|
|
set shortmess=filnxtToOS
|
|
|
|
set sidescroll=0
|
|
|
|
set tags=./tags,tags
|
|
|
|
set undodir^=.
|
|
|
|
set wildoptions=
|
|
|
|
set startofline
|
|
|
|
set sessionoptions+=options
|
|
|
|
set viewoptions+=options
|
|
|
|
set switchbuf=
|
2023-09-18 12:50:47 -07:00
|
|
|
if has('win32')
|
|
|
|
set isfname+=:
|
|
|
|
endif
|
2023-02-16 16:59:22 -07:00
|
|
|
if g:testname !~ 'test_mapping.vim$'
|
|
|
|
" Make "Q" switch to Ex mode.
|
|
|
|
" This does not work for all tests.
|
|
|
|
nnoremap Q gQ
|
|
|
|
endif
|
2022-07-11 06:10:27 -07:00
|
|
|
endif
|
2022-07-09 15:59:58 -07:00
|
|
|
|
|
|
|
" Common preparations for running tests.
|
|
|
|
|
|
|
|
" Only load this once.
|
|
|
|
if exists('s:did_load')
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let s:did_load = 1
|
|
|
|
|
2022-08-05 03:50:20 -07:00
|
|
|
" Clear Nvim default mappings and menus.
|
2022-05-12 17:28:10 -07:00
|
|
|
mapclear
|
|
|
|
mapclear!
|
2022-08-05 03:50:20 -07:00
|
|
|
aunmenu *
|
|
|
|
tlunmenu *
|
2019-06-14 08:02:58 -07:00
|
|
|
|
2022-09-16 18:40:19 -07:00
|
|
|
" roughly equivalent to test_setmouse() in Vim
|
|
|
|
func Ntest_setmouse(row, col)
|
|
|
|
call nvim_input_mouse('move', '', '', 0, a:row - 1, a:col - 1)
|
2023-10-04 16:48:37 -07:00
|
|
|
if state('m') == ''
|
|
|
|
call getchar(0)
|
|
|
|
endif
|
2022-09-16 18:40:19 -07:00
|
|
|
endfunc
|
|
|
|
|
2023-11-08 15:46:12 -07:00
|
|
|
" roughly equivalent to term_wait() in Vim
|
|
|
|
func Nterm_wait(buf, time = 10)
|
|
|
|
execute $'sleep {a:time}m'
|
|
|
|
endfunc
|
|
|
|
|
2018-02-08 18:25:03 -07:00
|
|
|
" Prevent Nvim log from writing to stderr.
|
|
|
|
let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log'
|
|
|
|
|
2017-03-21 09:07:00 -07:00
|
|
|
" Make sure 'runtimepath' and 'packpath' does not include $HOME.
|
2017-01-16 04:50:43 -07:00
|
|
|
set rtp=$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after
|
2017-03-21 09:07:00 -07:00
|
|
|
let &packpath = &rtp
|
2017-01-16 04:50:43 -07:00
|
|
|
|
2019-02-02 05:37:26 -07:00
|
|
|
" Avoid storing shell history.
|
|
|
|
let $HISTFILE = ""
|
|
|
|
|
2018-03-27 22:18:39 -07:00
|
|
|
" Use default shell on Windows to avoid segfault, caused by TUI
|
|
|
|
if has('win32')
|
|
|
|
let $SHELL = ''
|
|
|
|
let $TERM = ''
|
|
|
|
let &shell = empty($COMSPEC) ? exepath('cmd.exe') : $COMSPEC
|
|
|
|
set shellcmdflag=/s/c shellxquote=\" shellredir=>%s\ 2>&1
|
2018-08-07 20:04:01 -07:00
|
|
|
let &shellpipe = &shellredir
|
2018-03-27 22:18:39 -07:00
|
|
|
endif
|
2019-09-15 04:32:34 -07:00
|
|
|
|
|
|
|
" Detect user modules for language providers
|
|
|
|
let $PYTHONUSERBASE = $HOME . '/.local'
|
|
|
|
if executable('gem')
|
|
|
|
let $GEM_PATH = system('gem env gempath')
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Make sure $HOME does not get read or written.
|
|
|
|
let $HOME = expand(getcwd() . '/XfakeHOME')
|
|
|
|
if !isdirectory($HOME)
|
|
|
|
call mkdir($HOME)
|
|
|
|
endif
|
feat(highlight): update default color scheme
Problem: Default color scheme is suboptimal.
Solution: Start using new color scheme. Introduce new `vim` color scheme
for opt-in backward compatibility.
------
Main design ideas
- Be "Neovim branded".
- Be minimal for 256 colors with a bit more shades for true colors.
- Be accessible through high enough contrast ratios.
- Be suitable for dark and light backgrounds via exchange of dark and
light palettes.
------
Palettes
- Have dark and light variants. Implemented through exporeted
`NvimDark*` and `NvimLight*` hex colors.
- Palettes have 4 shades of grey for UI elements and 6 colors (red,
yellow, green, cyan, blue, magenta).
- Actual values are computed procedurally in Oklch color space based on
a handful of hyperparameters.
- Each color has a 256 colors variant with perceptually closest color.
------
Highlight groups
Use:
- Grey shades for general UI according to their design.
- Bold text for keywords (`Statement` highlight group). This is an
important choice to increase accessibility for people with color
deficiencies, as it doesn't rely on actual color.
- Green for strings, `DiffAdd` (as background), `DiagnosticOk`, and some
minor text UI elements.
- Cyan as main syntax color, i.e. for function usage (`Function`
highlight group), `DiffText`, `DiagnosticInfo`, and some minor text UI
elements.
- Red to generally mean high user attention, i.e. errors; in particular
for `ErrorMsg`, `DiffDelete`, `DiagnosticError`.
- Yellow very sparingly only with true colors to mean mild user
attention, i.e. warnings. That is, `DiagnosticWarn` and `WarningMsg`.
- Blue very sparingly only with true colors as `DiagnosticHint` and some
additional important syntax group (like `Identifier`).
- Magenta very carefully (if at all).
------
Notes
- To make tests work without relatively larege updates, each one is
prepended with an equivalent of the call `:colorscheme vim`.
Plus some tests which spawn new Neovim instances also now use 'vim'
color scheme.
In some cases tests are updated to fit new default color scheme.
2023-11-29 13:16:09 -07:00
|
|
|
|
|
|
|
" Use Vim's default color scheme
|
|
|
|
colorscheme vim
|