Commit Graph

24815 Commits

Author SHA1 Message Date
Ghjuvan Lacambre
d34c64e342
feat: $NVIM_APPNAME #22128
This commit implements the ability to control all of the XDG paths
Neovim should use. This is done by setting an environment variable named
NVIM_APPNAME. For example, setting $NVIM_APPNAME makes Neovim look for
its configuration directory in $XDG_CONFIG_HOME/$NVIM_APPNAME instead of
$XDG_CONFIG_HOME/nvim.

If NVIM_APPNAME is not set or is an empty string, "nvim" will be used as
default.

The usecase for this feature is to enable an easy way to switch from
configuration to configuration. One might argue that the various $XDG
environment variables can already be used for this usecase. However,
setting $XDG environment variables also affects tools spawned by Neovim.
For example, while setting $XDG_CONFIG_HOME will enable Neovim to use a
different configuration directory, it will also prevent Git from finding
its "default" configuration.

Closes https://github.com/neovim/neovim/issues/21691
2023-02-16 04:15:02 -08:00
zeertzjq
631775c05d
Merge pull request #22277 from zeertzjq/vim-8.2.0114
vim-patch:8.2.{0114,0154}: info about sourced scripts is scattered
2023-02-16 12:40:46 +08:00
zeertzjq
0cbbe27e93 vim-patch:8.2.0154: reallocating the list of scripts is inefficient
Problem:    Reallocating the list of scripts is inefficient.
Solution:   Instead of using a growarray of scriptitem_T, store pointers and
            allocate each scriptitem_T separately.  Also avoids that the
            growarray pointers change when sourcing a new script.

21b9e9773d

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-16 11:50:28 +08:00
zeertzjq
e619fb1660 vim-patch:8.2.0114: info about sourced scripts is scattered
Problem:    Info about sourced scripts is scattered.
Solution:   Use scriptitem_T for info about a script, including s: variables.
            Drop ga_scripts.

7ebcba61b2

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-16 11:50:28 +08:00
zeertzjq
5dc4eaf386
Merge pull request #22275 from zeertzjq/vim-9.0.1309
vim-patch:9.0.{1309,1310,1312}: scrolling two lines with even line count and 'scrolloff'
2023-02-16 08:37:42 +08:00
zeertzjq
0bb3a373d3 vim-patch:9.0.1312: Cursor position wrong when splitting window in insert mode
Problem:    Cursor position wrong when splitting window in insert mode.
Solution:   Pass the actual mode to win_fix_cursor(). (Luuk van Baal,
            closes vim/vim#11999,

bc3dc298b3

Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
2023-02-16 08:09:41 +08:00
zeertzjq
a2dd7fa97b vim-patch:9.0.1310: 'splitkeep' test has failures
Problem:    'splitkeep' test has failures.
Solution:   Adjust expected cursor line position.

fdbd14e892

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-16 08:09:41 +08:00
zeertzjq
968cd1ed93 vim-patch:9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Problem:    Scrolling two lines with even line count and 'scrolloff' set.
Solution:   Adjust how the topline is computed. (closes vim/vim#10545)

1d6539cf36

Cherry-pick test_scroll_opt.vim changes from patch 8.2.1432.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-16 08:09:41 +08:00
dundargoc
f1c5887377
ci: add GCC Release testing (#22274)
ci: add GCC release testing

We currently have no release testing, so it's good to check for any
unwanted behavior on release builds as well. Prefer GCC over clang, as
GCC release builds seem to create more warnings on release compared to
debug.
2023-02-16 00:15:09 +01:00
blt__
da3cb6ebe4
dist: use valid application id in nvim.appdata.xml #22046
According to [AppStream spec](https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-id-generic),
the <id> element should contain a reverse-DNS scheme:

    {tld}.{vendor}.{product}

Since the flathub requires that, the flatpak build replaces `<id>nvim</id>` with
`<id>io.neovim.nvim</id>`. That results in ID mismatch between flatpak version
and version from distribution's repositories. Because of that, software stores
are displaying two different neovims, instead of one neovim with options to
download it either from flatpak or from distribution's repos. We can use the
`<provides><id>nvim</id></provides>`, for everyone who was expecting the id to
be `nvim`.
2023-02-15 15:11:49 -08:00
Lewis Russell
f006313e95
Merge pull request #22056 from lewis6991/refactor/fileio_more
refactor `fileio.c`
2023-02-15 16:45:20 +00:00
Enan Ajmain
ec782211f2
fix(tui): set taskbar, icon in Windows #22270
Problem: After TUI refactor commit, code for setting Windows taskbar
icon wasn't being executed because of a backdated conditional.

Solution: Update the conditional to take TUI refactor into account.

Ref: https://github.com/neovim/neovim/pull/20634#discussion_r1088993820
2023-02-15 07:39:23 -08:00
Lewis Russell
a289e82142
fix(treesitter): make params optional 2023-02-15 12:26:07 +00:00
Christian Clason
2e450efb95
feat(treesitter)!: remove g:ts_highlight_lua (#22257)
This variable was only meant for easy testing during the development
cycle for treesitter highlighting while Lua was the only parser useable
for daily driving. Now that we have a good vimdoc parser, this approach
simply doesn't scale and should be removed sooner rather than later.

Instead of setting this variable, people for now should add the autocommand
directly to their config:
```lua
vim.api.nvim_create_autocmd('FileType', {
  pattern = 'lua', -- or { 'lua', 'help' }
  callback = function() vim.treesitter.start() end,
})
```
(or put `vim.treesitter.start()` in an `ftplugin`).
2023-02-15 09:55:23 +01:00
zeertzjq
ae7653b74c
fix(win_update): don't use unintialized memory in edge case (#22266)
This fixes two clang warnings.

Using an unintialized "cursorline_fi" without assigning to it is not
something that should normally happen, and in case it happens it will
likely cause another redraw, but still don't use unintialized memory.
2023-02-15 16:53:53 +08:00
dundargoc
8307ed3a19
revert: "build: remove ENABLE_COMPILER_SUGGESTIONS option" (#22265)
This reverts commit 1d6bb0892b.

See: https://github.com/neovim/neovim/pull/22249#issuecomment-1430548550
2023-02-15 08:51:40 +01:00
Justin M. Keyes
1539f71363
Merge #22214 move init_default_autocmds to lua 2023-02-14 19:13:12 -05:00
zeertzjq
05faa8f30a
test: make expect_unchanged() less confusing (#22255)
Problem:
The sleep before collecting the initial screen state is confusing and
may lead to unexpected success if it comes after a blocking RPC call.

Solution:
Remove that sleep and add an "intermediate" argument.
2023-02-15 07:26:55 +08:00
Justin M. Keyes
556f8646c0
refactor(api): consistent VALIDATE messages #22262
Problem:
Validation messages are not consistently formatted.
- Parameter names sometimes are NOT quoted.
- Descriptive names (non-parameters) sometimes ARE quoted.

Solution:
Always quote the `name` value passed to a VALIDATE macro _unless_ the
value has whitespace.
2023-02-14 11:19:28 -08:00
Enan Ajmain
e03ecb7d31
fix: uv_tty_set_mode failed in Windows #22264
Problem:  uv_tty_set_mode on stdout in Windows exits with error.
Cause:    Windows cannot set the properties of the output of a tty.
Solution: Remove call to uv_tty_set_mode.

Ref: #21445
Ref: 88634c1405 (r100598822)
2023-02-14 11:15:28 -08:00
Enan Ajmain
b4a92309f8
ci: print DLL copy messages only in CI environment (#22260)
In Windows, library DLL's are copied in the building process, and a message for each copy is printed. This is useful to have in the log of CI, but annoying to see when you're building and rebuilding nvim constantly. Work around this issue by only enabling the messages on CI.
2023-02-14 18:58:38 +01:00
bfredl
9a9a4d38a8
Merge pull request #11756 from bfredl/crashfix
custom statusline crash containing unprintable unicode
2023-02-14 18:51:56 +01:00
Björn Linse
39f8aaeb81 fix(status): handle unprintable chars in the statusline 2023-02-14 15:56:14 +01:00
Lewis Russell
264fb6945b
Merge pull request #22113 from luukvbaal/nrwidth
fix(column): no longer reset nrwidth_line_count for 'statuscolumn'
2023-02-14 14:37:01 +00:00
Lewis Russell
00c0a52f94
Merge pull request #22108 from luukvbaal/statuscolumn
perf(column): only build fold/sign column when present in 'statuscolumn'
2023-02-14 14:36:12 +00:00
Justin M. Keyes
ff3d04b75b
refactor(api): VALIDATE macros #22256
- VALIDATE() takes a format string
- deduplicate check_string_array
- VALIDATE_RANGE
- validate UI args
2023-02-14 05:07:38 -08:00
zeertzjq
3a6a7add57
test: remove unused field ext_float (#22243) 2023-02-14 18:26:22 +08:00
Justin M. Keyes
46a87a5d2b
refactor(api): VALIDATE macros #22187
Problem:
- API validation involves too much boilerplate.
- API validation errors are not consistently worded.

Solution:
Introduce some macros. Currently these are clumsy, but they at least
help with consistency and avoid some nesting.
2023-02-14 02:19:04 -08:00
luukvbaal
5396808267
fix(folds): cursorline highlight is not always applied on closed folds (#22242)
Problem:    The cursorline highlight logic checks for `w_cursor.lnum`
            which may be different from the line number passed to
            `win_line()` even when the cursor is actually on that line.
Solution:   Update cursor line highlight logic to check for the line
            number of the start of a closed fold if necessary.
2023-02-14 15:52:22 +08:00
zeertzjq
20c9f4b352
vim-patch:9.0.1307: setting 'formatoptions' with :let doesn't check for errors (#22252)
Problem:    Setting 'formatoptions' with :let doesn't check for errors.
Solution:   Pass "errbuf" to set_string_option(). (Yegappan Lakshmanan,
            closes vim/vim#11974, closes vim/vim#11972)

32ff96ef01

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-02-14 08:29:05 +08:00
zeertzjq
fc9ece617b
Merge pull request #22244 from zeertzjq/tui-eof
fix(tui): exit on input eof
2023-02-14 08:12:32 +08:00
zeertzjq
820430dc0b fix(tui): exit on input eof 2023-02-14 07:49:31 +08:00
zeertzjq
5a8039a0cb test(tui_spec): remove unnecessary arguments for remote UI 2023-02-14 07:49:31 +08:00
Jonas Strittmatter
b518aceaa8
feat(filetype): fall back to file extension when matching from hashbang (#22140)
If nothing matched in match_from_hashbang, also check the file extension table.
For a hashbang like '#!/bin/env foo', this will set the filetype to 'fooscript'
assuming the filetype for the 'foo' extension is 'fooscript' in the extension
table.
2023-02-13 16:04:16 -07:00
dundargoc
1d6bb0892b
build: remove ENABLE_COMPILER_SUGGESTIONS option (#22249)
We need higher level and more meaningful cmake options. Having a cmake
option for only controlling compiler flags is probably not worth it as
the same can be achieved with:

cmake -B build -D CMAKE_C_FLAGS=<compiler option>
2023-02-13 20:55:49 +01:00
dundargoc
bb9c673d2c
ci: automatically maximize MIN_LOG_LEVEL if CI detected (#22248)
Detect if on CI by checking that the CI environment variable is set to "true".
This is a common pattern among CI providers, including github actions and
cirrus.
2023-02-13 20:04:54 +01:00
Justin M. Keyes
84cf6a0a7e
ci(lintcommit): allow UPPER_CASE first word (#22245) 2023-02-13 18:26:27 +01:00
dundargoc
9de9bd4bed
ci: replace cmake script with bash script (#22246)
Bash has better error handling than cmake, and seem overall slightly
more suited to scripting than cmake.
2023-02-13 18:26:01 +01:00
Lewis Russell
d359f7a533
Merge pull request #22191 from lewis6991/feat/playground_imp
feat(treesitter): playground improvements
2023-02-13 10:54:03 +00:00
zeertzjq
89722ddfac
Merge pull request #22233 from zeertzjq/resize-screenclear
fix(ui): make sure screen is valid after resizing
2023-02-13 09:46:16 +08:00
zeertzjq
41ebe41b62 fix(ui-ext): force cursor update after resize in char-based UI
Neither ui/screen.lua nor Neovim Qt keep cursor position after resizing.
2023-02-13 08:50:54 +08:00
zeertzjq
c2375efe56 fix(ui): make sure screen is valid after resizing
Problem:
When not inside an Ex command, screen_resize() calls update_screen(),
which calls screenclear() and set the screen as valid. However, when
inside an Ex command, redrawing is postponed so update_screen() screen
doesn't do anything, and the screen is still invalid after the resize,
causing ui_comp_raw_line() to be no-op until update_screen() is called
on the main loop.

Solution:
Restore the call to screenclear() inside screen_resize() so that the
screen is invalid after screen_resize(). Since screenclear() changes
redraw type from UPD_CLEAR to UPD_NOT_VALID, it is called at most once
for each resize, so this shouldn't change how much code is run in the
common (not inside an Ex command) case.
2023-02-13 08:50:54 +08:00
dundargoc
5d3769ea23
ci: install dependencies with a single script (#22241)
It's easier if the os-specific installations are done by the script itself
2023-02-12 22:09:10 +01:00
dundargoc
5f72ab77bf
refactor: reduce scope of locals as per the style guide 3 (#22221)
refactor: reduce scope of locals as per the style guide
2023-02-12 18:48:49 +01:00
dundargoc
2b1c07a1d4
ci: remove unnecessary matrix from codeql workflow (#22239) 2023-02-12 18:12:17 +01:00
dundargoc
477d4bbf5f
ci: inline external environment scripts (#22237)
Scripts that define the build itself shouldn't be external as they lead
to hard to find bugs.
2023-02-12 18:08:37 +01:00
dundargoc
47638706a3
build: treat clang-tidy warnings as errors (#22238) 2023-02-12 17:41:54 +01:00
dundargoc
f573fcbc0d
build: don't check environment variable to detect CI (#22234)
Instead use the cmake option, which should act as the definitive source
to determine whether we use CI or not.
2023-02-12 14:42:00 +01:00
dundargoc
c099836168
ci: convert environment variables to matrix variables (#22224)
Having as few indirections as possible makes it easier to understand the
code.
2023-02-12 13:09:46 +01:00
dundargoc
e81b4274fc
ci: delete ci/ (#22227)
Having CI scripts that is separate from the build system causes
tremendous amounts of problems, headaches and bugs. Testing the validity
of the scripts locally become near impossible as time goes on as they're
only vetted if it works on whatever CI provider we happened to have at
the time, with their own quirks and behavior.

The extra indirection between "cmake <-> general CI scripts <-> GHA" is
also a frequent source of problems, as the orchestration needs to be
done with environment variables, cmake flags and github actions matrix
strategy. This combination has turned out to be exceptionally fragile.

Examples:
15394b6855
13aa23b62a
https://github.com/neovim/neovim/pull/22072#discussion_r1094390713

A lot of the code was inlined to .github/workflows/ci.yml without
further modifications. While this in itself doesn't integrate with our
build system any more than the current situation, it does
1. remove a level of indirection, and more importantly
2. allow us to slowly start integrating the CI into our build system now
   that all the relevant code is in one place.
2023-02-12 11:50:08 +01:00