Compare commits

...

1618 Commits

Author SHA1 Message Date
333ba6569d NVIM 0.7
BREAKING CHANGES

* Support for Python 2 is dropped. For Python 3, the minimum supported version is 3.6. Legacy `:pythonx` commands are still available, and always uses the python 3 provider.

* api: Existing usages of `nvim_buf_set_text` that use negative line numbers will be off-by-one.
* highlight: signature of `vim.highlight.range` was changed.

* input: distinguish between some input keys which previously were synonyms. This will break some exiting mappings.

- `<cr>`, `<tab>` and `<esc>` are no longer considered equivalent to `<c-m>`, `<c-i>` and `<c-[`> respectively. In case the terminal or GUI supports distinguishing these keys, these can now be mapped separately. But even if the terminal only can send one code you might still need to change what variant is used in the config.

FEATURES

Core APIs:

* api: add support for lua function & description in keymap
* api: add api and lua autocmds
* api: nvim_clear_autocmd
* api: pass args table to autocommand callbacks
* api: remove Lua autocommand callbacks when they return true
* api: implement nvim_{add,del}_user_command
* api: implement nvim_buf_get_text
* api: add nvim_get_option_value

* highlight: ns=0 to set :highlight namespace
* highlight: support for blend in nvim_set_hl
* api: add strikethrough, nocombine to set_hl
* api: relax statusline fillchar width check

Lua:

* lua: add vim.keymap
* lua: add vim.spell
* lua: add proper support of luv threads
* lua: make :lua =expr print result of expr
* lua: handle lazy submodules in `:lua vim.` wildmenu completion
* lua: add notify_once()
* lua: add support for multiple optional types in vim.validate
* lua: show proper verbose output for lua configuration
* lua: more conversions between LuaRef and Vim Funcref
* lua: support converting nested Funcref back to LuaRef
* call __tostring on lua errors if possible before reporting to user

* filetype.lua
* filetype.lua: add support for files under .git
* filetype.lua: add support for patch files
* filetype.lua: add support for tmux.conf files
* filetype.lua: add support for txt files
* filetype.lua: Add typescript extension to filetype detection
* filetype.lua: fix .cc file not detected
* filetype.lua: fix .env file not detected
* filetype: convert patterns for mail buffers
* filetype: support scripts.vim with filetype.lua

UI and decorations:

* decorations: support signs
* extmarks: add strict option
* api: expose extmark more details
* api: expose extmark right_gravity and end_right_gravity
* use nvim_buf_set_extmark for vim.highlight
* statusline: support multibyte fillchar
* add support for global statusline

Treesitter:

* ui: allow conceal to be defined in decorations and tree-sitter queries
* tree-sitter: allow Atom-style capture fallbacks
* treesitter: add more default groups to highlight map
* treesitter: multiline match predicates
* treesitter: set allocator when possible
* ts: add support for multiline nodes in get_node_text
* ts: expose minimum language version to lua
* runtime: add query filetype

LSP and diagnostic:

* diagnostic: add "code" to the diagnostic structure
* diagnostic: allow retrieving current diagnostic config
* lsp,diagnostic: open folds in jump-related functions
* lsp: add buf_detach_client
* lsp: add handler for workspace/workspaceFolders
* lsp: dynamically generate list title in response_to_list
* lsp: enable default debounce of 150 ms
* lsp: skip or reduce debounce after idle
* lsp: use `vim.ui.select` for selecting lsp client

Initial work to support remote TUI (and ui client library):

* ui_client: connect to remote ui
* ui_client: implement event handlers
* ui_client: handle resize events
* ui_client: implement async paste handling
* ui_client: pass user input to remote server

* --headless: add on_print callback to stdioopen
* add autocommand event when search wraps around
* add vim.tbl_get
* autocmd: add Recording autocmds
* autocmd: populate v:event in RecordingLeave
* completion: support selecting item via API from Lua mapping
* eval/method: partially port v8.1.1993
* eval/method: partially port v8.1.1996
* eval/method: partially port v8.1.2004
* eval: partially port v8.2.0878
* eval: port emsg from v8.2.3284
* events: add DirChangedPre
* events: support SIGWINCH for Signal event
* hardcopy: check gui colours for highlights first
* highlight: support color names for cterm
* ignore nore on <Plug> maps
* input: delay some conversions to vgetc()
* input: enable <tab>/<c-i>, <cr>/<c-m>, <esc>/<c-[> pairs unconditionally
* keymap: add F38-F63 keys
* keymap: return nil from an expr keymap
* mappings: considering map description when filtering
* provider: remove support for python2 and python3.[3-5]
* remote: add basic --remote support
* runtime: import cleanadd.vim from Vim
* runtime: include Lua in C++ ftplugin
* runtime: new checkhealth filetype
* term: use vterm_output_set_callback()
* test: use nvim_exec in helpers.source()
* trigger ModeChanged for terminal modes
* tui: add error logging
* tui: add support for `CSI 4 : [2,4,5] m`
* tui: enable CSI u keys
* vim-patch.sh: support additional args for -s

Performance Improvements

* lsp: request only changed portions of the buffer in changetracking
* only redraw concealed line if cursor has moved horizontally
* pre-compile embedded Lua source into bytecode
* screen: reduce cursorline redrawing when jumping around
* treesitter: cache query parsing
* api: elide luaref copy when setting 'callback' in nvim_set_keymap

BUG FIXES

* --headless: do not block on press-enter prompts when no UI
* <Nop> not shown in :map commands
* add forkpty for SunOS variants
* add STRNLEN compatability macro
* anonymous sid not working
* api, lua: return NIL on failure to find converted function
* api/nvim_win_call: share common win_execute logic
* api: allow empty list for cterm in nvim_set_hl
* api: allow nvim_buf_set_extmark to accept end_row key
* api: convert blob to NUL-terminated API string
* api: correctly handle negative line numbers for nvim_buf_set_text
* api: correctly pass f-args for nvim_create_user_command
* api: delete all autocmds with the same ID
* api: force redefinition of user commands by default
* api: highlight attribute for underline
* api: improve autocmd error handling
* api: include event in get_autocmds
* api: make nil value in nvim_set_option_value clear local value
* api: nvim__set_hl_ns causes extra redraws
* api: nvim_win_set_cursor() redraw for cursorline and statusline
* api: re-route nvim_get_runtime_file errors
* api: use changedir_func() in nvim_set_current_dir()
* api: validate command names in nvim_add_user_command
* api: validate user_command name
* append test for checking zero width node range
* aucmd_win: always make aucmd_win the last window
* aucmd_win: ensure aucmd_win stays floating
* autocmd: clean up autocmds only when needed
* autocmd: restore autocmd showing behavior
* autoload variables not loaded with vim.g & nvim_get_var
* bounds check for underdot
* build: check for empty value of LUAC_PRG
* build: check that LuaJIT has required modules for compilation
* build: install luajit modules on windows
* channel: fix channel consistency
* check for interrupt in nvim_echo, write_msg and nlua_print
* checkhealth: make provider checkhealth output more consistent
* ci/backport: check for event_name == "pull_request_target"
* ci: provide necessary permissions for calling workflow
* clang/'Dead store': do not assign endcol
* close floating windows when calling win_close()
* completion: prevent K_LUA from closing pum
* completion: update submode message when selecting from API
* correct vertical dragging room calculation with global statusline
* coverity/175977: big parameter passed by value
* coverity/188749: nullify pointer to fix use-after-free
* coverity/340720: error if nvim_eval_statusline given invalid winid
* coverity: dead code and operands don't affect result
* decorations: do not put empty virt_text
* define NAME_MAX from _XOPEN_NAME_MAX
* diagnostic: allow setting arbitrary config values
* diagnostic: assert that diagnostics have line number and column
* diagnostic: clamp diagnostics on negative line numbers
* diagnostic: escape special chars in file names
* diagnostic: improve validation for list arguments
* diagnostic: make `open_float` respect global diagnostic options
* diagnostic: only set default handler config if unset
* diagnostic: resolve nil opts tables
* diagnostic: respect "if_many" source option for virtual text
* diagnostic: set effective buffer number for DiagnosticChanged autocmd
* diagnostic: set effective buffer number in autocmd (again)
* diagnostic: use botright copen for qflist
* diff: make algorithm work for vim.diff
* do not cast offset to char_u
* do not pass aucmd to the callback
* do not save K_EVENT as lastc in Insert mode
* docs: add bufnr and user_data to diagnostic-structure
* docs: spelling in new underlines docs
* don't include pty.h on SunOS
* don't use cfsetspeed, use i and o variants
* enable filetype detection and syntax highlighting with --clean
* eval/method: add missing method support for existing built-ins
* eval: v:lua support for `-` in module names
* event-loop: call vpeekc() directly first to check for character
* event-loop: check if executed register has ended
* event-loop: duplicate display updating logic in vgetorpeek()
* events: make v:event readonly in more events
* ex_normal: spam \n in Ex mode only if in Cmdline mode
* extmarks: fix signs
* extmarks: splice extmarks on accepting spell
* filetype.lua: always return a string in getline helper function
* filetype: expand tildes in filetype patterns
* filetype: fix foam pattern detection
* filetype: match negative priority patterns after extensions
* filetype: match on <afile> rather than <abuf>
* filetype: normalize slashes in file paths
* filetype: set default ft_ignore_pat in filetype.lua
* float: do not switch window before deleting last listed buffer
* float: don't always switch window when deleting last listed buffer
* float: handle buffer deletion with floating windows
* float: make laststatus=1 behave consistently with floating windows
* healthcheck: handle empty reports
* health: do not run external processes in a shell
* highlight: accept NONE as a color name
* highlight: allow globals to be cleared
* highlight: always update window highlight if highlight changed
* inccommand: do not change reg_prev_sub when previewing
* input: do not translate scroll keys into multiclicks
* input: fix clearing of reg_executing
* input: never escape CSI bytes
* input: put modifiers back into typeahead buffer when needed
* input: remove reinterpreted ALT/META chords from recorded macro
* keymap: don't coerce false to ''
* keywordprg: retain terminal buffer after K
* line continuation: set growsize to correct value
* lsp and diagnostic highlight priority
* lsp: always split text edits on \r, \r\n, and \n
* lsp: always use target bufnr in location handler
* lsp: avoid attaching to unloaded buffers
* lsp: avoid nil workspace/symbol query
* lsp: call config on_exit handler before context is cleared
* lsp: correct prefix when filterText is present
* lsp: correctly align start and end range to codepoints during incremental sync
* lsp: create lsp requests with position offsets considering client encoding
* lsp: ensure pending changes are flushed on skipped debounce
* lsp: explicitly pass bufnr in didSave handler
* lsp: fetch offset_encoding from client in references
* lsp: fix `nil`-index behavior for UTF-8 in `_str_*index_enc` methods
* lsp: fix applying multiple out-of-range TextEdits
* lsp: fix lookup of boolean values in workspace/configuration
* lsp: forward offset_encoding in rename handler
* lsp: forward offset_encoding to apply_text_edits
* lsp: handle insertion of previous line
* lsp: handle negative activeSignature in signatureHelp
* lsp: only send valid params in executeCommand
* lsp: pass offset_encoding in formatexpr()
* lsp: progress handlers should return vim.NIL on error
* lsp: resolve bufnr for get_lines
* lsp: resolve nil bufnr
* lsp: respect all of 'fixeol', 'eol', and 'binary' applying edits
* lsp: set tabSize from 'shiftwidth', not 'softtabstop'
* lsp: start incremental sync range at previous newline character
* lsp: strictly enforce passing offset encoding
* lsp: suppress ContentModified errors from UI
* lsp: use "text" filetype for plaintext
* lsp: use botright copen for all handlers
* lua: don't use nlua_error when exiting early
* lua: print multiple return values with =expr
* lua: restore priority of the preloader
* lua: stricter type check when calling API function
* make mode() return correct value in ex mode
* man.vim: fix search function on some systems
* man.vim: support calling :Man without a section again
* msgpack#strptime: use calendar.timegm to get seconds since epoch
* ops: str_to_reg passing NULL to memcpy
* options: disallow empty 'fdc' and 'scl'
* paste: avoid edges cases caused by empty chunk
* paste: deal with eol and eof in Visual mode
* paste: deal with trailing new line in chunk
* paste: don't move cursor past the end of pasted text in Normal mode
* paste: escape control characters in Cmdline mode
* paste: use getcmdtype() to determine whether in cmdline mode
* prompt: add missing changes from v8.1.0036
* pty_process_win/wait_eof_timer_cb: also check for proc->out.did_eof
* pum_redraw: use grid_puts_len() to truncate the text
* PVS/V1019: compound assignment expression is used inside condition
* PVS/V560: ignore false "conditional expression is always false"
* PVS/V583: the '?:' operator always returns one and the same value
* query.lua: check empty table for lines
* quickfix: avoid O(N^2) when filling from string typval
* remote: make compile again
* remote: report connection error, missing return values
* remote: report on missing wait commands, typecheck lua results
* remote: respect silent in error reporting
* remote: use STATIC_CSTR_AS_STRING
* resolve nil arguments to API functions
* respect os_proc_children rv of pid not found
* runtime: add missing release metadata
* runtime: add syntax file for query
* runtime: check markdownError before syn-clear
* screen: do not do syntax highlighting at filler or folded lines
* screen: do not draw filler lines post eof if already at last row
* screen: do not update syntax_last_parsed when drawing folded line
* screen: don't put empty sign text in line number column
* screenpos, float: add top and left border adjustment
* screen: truncate double-width character correctly
* screen: truncate when overwriting right half of a double-width char
* set nested before executing callback
* set RedrawingDisabled before entering aucmd_win
* signcol: always trigger a redraw
* signcol: handle edge case with maximum value
* signcol: update cursor when signcol changes
* skip libutil on SunOS
* substitute: properly check for empty command line
* syntax.c: correct hunk from Vim patch 8.0.0647
* syntax: remove trailing spaces in vim.vim
* tabpage: correct check for failure to close window
* termdebug: handle exiting during startup properly
* terminal: correctly forward mouse events
* terminal: fix resize crash with pending scrollback
* terminal: ignore left-release mouse action
* terminal: return early if there are no invalid rows
* terminal: use coladvance() to calculate buffer cursor position
* test: only use buffer completion in popupmenu timer test
* tests: update legacy tab switch test to be sane
* translation: po file for Russian
* translation: po file for Ukrainian
* ts: escape lang when loading parsers
* tui: avoid using uninitialized memory in kitty
* tui: correct CSI sequence
* tui: end streamed paste correctly when key buffer is empty
* tui: remove `ESC NUL` forced escape
* ui: close floating window on BufLeave event
* ui: inccomand performance degradation
* ui: make window resize commands manage cmdheight
* update last cursor on first CursorMoved
* uri: change scheme pattern to not include the comma character
* use normal! <C-L> in default <C-L> mapping
* vim-patch.sh: fix N/A files patterns
* win_close: count the window the be closed instead of curwin
* win_split_ins: do not fail when oldwin is not valid
2022-04-15 13:38:44 +02:00
e63e5d1dbd docs: typo fixes (#17859)
Co-authored-by: Elias Alves Moura <eliamoura.alves@gmail.com>
Co-authored-by: venkatesh <shariharanvenkatesh@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Vikas Raj <24727447+numToStr@users.noreply.github.com>
Co-authored-by: Steve Vermeulen <sfvermeulen@gmail.com>
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: rwxd <rwxd@pm.me>
Co-authored-by: casswedson <58050969+casswedson@users.noreply.github.com>
2022-04-15 12:35:06 +02:00
4503cb6b64 vim-patch:8.2.4750: small pieces of dead code (#18113)
Problem:    Small pieces of dead code.
Solution:   Remove the dead code. (Goc Dundar, closes vim/vim#10190) Rename the
            qftf_cb struct member to avoid confusion.
b836658a04
2022-04-15 17:15:47 +08:00
6160973f36 fix(lsp): fix lookup of boolean values in workspace/configuration (#18026) 2022-04-15 11:12:41 +02:00
8486c87e58 vim-patch:8.2.4747: no filetype override for .sys files (#18105)
Problem:    No filetype override for .sys files.
Solution:   Add g:filetype_sys. (Patrick Meiser-Knosowski, closes vim/vim#10181)
f420ff2440
2022-04-13 23:11:56 +02:00
a9cd9de01d Merge pull request #15972 from seandewar/vim-8.2.3487
vim-patch:8.2.{3416,3448,3470,3478,3480,3486,3487}
2022-04-13 20:50:44 +01:00
9a35704333 Merge pull request #15491 from Diomendius/lua_docs
docs(lua): fix, clarify Lua require() docs
2022-04-13 10:50:03 -06:00
9938740ca6 vim-patch:8.2.4746: supercollider filetype not recognized (#18102)
Problem:    Supercollider filetype not recognized.
Solution:   Match file extentions and check file contents to detect
            supercollider. (closes vim/vim#10142)
8cac20ed42
2022-04-13 17:04:38 +02:00
7d1142b7e7 fix(runtime): add syntax file for query (#18101)
followup to #17905: also use Lisp syntax for treesitter queries
2022-04-13 16:29:23 +02:00
e463eb8146 fix(api): correctly pass f-args for nvim_create_user_command (#18098)
Skip runs of whitespace and do not include `\` characters when
followed by another `\` or whitespace. This matches the behavior
of <f-args> when used with `:command`.
2022-04-13 08:04:56 -06:00
76e6b81b23 vim-patch:8.2.3487: illegal memory access if buffer name is very long
Problem:    Illegal memory access if buffer name is very long.
Solution:   Make sure not to go over the end of the buffer.
826bfe4bbd

Adjust the test to use :noswapfile, as Nvim fails to create the swap file on Windows due to the file
name's length (E303).

We don't have this behaviour on Linux as we get "[Permission denied]" from readfile(), so there is
no attempt to create the swap file. However, Vim doesn't try to create the swap file on Windows
either for a different reason: MAXPATHL in Vim for Windows is only 1024 (compared to Nvim's 4096 on
the Windows CI), so readfile() gives "Illegal file name" instead, thus not needing :noswapfile for
both cases.
2022-04-13 21:31:24 +08:00
fc954d0a61 vim-patch:8.2.3486: illegal memory access with invalid sequence of commands
Problem:    Illegal memory access with invalid sequence of commands.
Solution:   Do not call leave_block() when not in a try block. (closes vim/vim#8966)
            Reset did_emsg so that exception is shown as an error.
cce81e9673

Vim9script is N/A, which includes leave_block.
2022-04-13 21:28:05 +08:00
789558d365 vim-patch:8.2.3480: test does not fail without the fix for a crash
Problem:    Test does not fail without the fix for a crash.
Solution:   Write the bad code in a file and source it. (Dominique Pellé,
            closes vim/vim#8961)
949de97da3
2022-04-13 21:27:38 +08:00
5feb8cdbb4 vim-patch:8.2.3478: still crash with error in :catch and also in :finally
Problem:    Still crash with error in :catch and also in :finally.
Solution:   Only call finish_exception() once. (closes vim/vim#8954)
f67d3fb736

Exclude CSF_FUNC_DEF change (Vim9script).
2022-04-13 21:15:24 +08:00
6415051796 refactor(ex_eval): cherry-pick CSF flags changes from v8.2.3099
4197828dc6

Cherry-pick the changes to existing flags values.
Required for v8.2.3478.

That patch mostly relates to Vim9script, but I'm careful not to mark it N/A in
case the flags have some use outside of Vim9 in the future.

Excludes CSF_FUNC_DEF (flag introduced in v8.2.1870 for Vim9's block scopes).
2022-04-13 21:15:24 +08:00
a25c35d6e4 vim-patch:8.2.3470: crash with error in :catch and also in :finally
Problem:    Crash with error in :catch and also in :finally.
Solution:   Only discard an exception if there is one. (closes vim/vim#8954)
a684a68409
2022-04-13 21:15:24 +08:00
93c72d866b vim-patch:8.2.3448: :endtry after function call that throws not found
Problem:    :endtry after function call that throws not found.
Solution:   Do check for following :endtry if an exception is being thrown.
            (closes vim/vim#8889)
1d34189ecb

Nvim obsoleted did_throw; check current_exception is not NULL instead.
2022-04-13 21:15:24 +08:00
b6026337f2 vim-patch:8.2.3416: second error is reported while exception is being thrown
Problem:    Second error is reported while exception is being thrown.
Solution:   Do not check for trailing characters when already aborting.
            (closes vim/vim#8842)
36f691f5f1
2022-04-13 21:15:24 +08:00
4dc09f38ee fix(translation): po file for Ukrainian (#18100) 2022-04-13 10:25:59 +02:00
18152cf6f1 Merge pull request #18092 from zeertzjq/test-termxx-no-pending
test: unskip tests skipped in #14661
2022-04-13 05:29:23 +08:00
bc19ae4e11 test: unskip tests skipped in #14661 2022-04-13 05:04:14 +08:00
4bef2f02e8 Merge pull request #17440 from zeertzjq/vim-8.2.3184
vim-patch:8.2.{3184,3226,3325}: digraph functions
2022-04-12 21:54:01 +08:00
c9d1fcd850 refactor(digraph.c): add more const qualifiers 2022-04-12 21:26:46 +08:00
b69ecacbb4 vim-patch:partial:a2baa73d1d33
Update runtime files.
a2baa73d1d

This only includes changes to docs of digraph functions.
2022-04-12 21:26:46 +08:00
0a813ae291 vim-patch:8.2.3325: digraph test fails when LC_ALL is set to "C"
Problem:    Digraph test fails when LC_ALL is set to "C".
Solution:   When restoring 'encoding' set it to "utf-8". (closes vim/vim#8742)
52eb372a04
2022-04-12 21:26:46 +08:00
3b0bcb8ad0 vim-patch:8.2.3226: new digraph functions use old naming scheme
Problem:    New digraph functions use old naming scheme.
Solution:   Use the digraph_ prefix. (Hirohito Higashi, closes vim/vim#8580)
29b857150c
2022-04-12 21:26:46 +08:00
cbc54cf484 vim-patch:8.2.3184: cannot add a digraph with a leading space
Problem:    Cannot add a digraph with a leading space.  It is not easy to list
            existing digraphs.
Solution:   Add setdigraph(), setdigraphlist(), getdigraph() and
            getdigraphlist(). (closes vim/vim#8580)
6106504e9e

Use GA_APPEND_VIA_PTR in registerdigraph().
Use tv_list_append_*() in getdigraphlist_appendpair().
Put the error messages in digraph.c.
E196 is N/A.
Remove mentions about 'encoding' being non-Unicode.
Nvim doesn't support setting encoding=japan, so skip a test.
2022-04-12 21:26:30 +08:00
7e1e906738 vim-patch:8.2.4739: accessing freed memory after WinScrolled autocmd event (#18090)
Problem:    Accessing freed memory after WinScrolled autocmd event.
Solution:   Check the window pointer is still valid. (closes vim/vim#10156)
            Remove the argument from may_trigger_winscrolled().
d58862d18f
2022-04-12 19:16:47 +08:00
dbd5242d8e Merge pull request #18075 from zeertzjq/vim-8.2.4713
vim-patch:8.2.4713: plugins cannot track text scrolling
2022-04-12 05:48:23 +08:00
6be4fd888c test: properly test WinScrolled event 2022-04-12 05:02:05 +08:00
53668a5815 vim-patch:8.2.4713: plugins cannot track text scrolling
Problem:    Plugins cannot track text scrolling.
Solution:   Add the WinScrolled event. (closes vim/vim#10102)
0937182d49

Skip User event in autocmd.txt, not needed unless #10689 is reverted.
2022-04-12 05:02:05 +08:00
10b40440dd test(old): fix mistakes in porting Vim patches 8.1.1362 and 8.1.1585 (#18080) 2022-04-12 04:56:15 +08:00
85b33fc042 vim-patch:8.2.4737: // in JavaScript string recognized as comment (#18083)
Problem:    // in JavaScript string recognized as comment.
Solution:   Only check for linecomment if 'cindent' is set. (closes vim/vim#10151)
1655619717
2022-04-11 22:50:17 +02:00
392cb7ac0c fix(lsp): pass offset_encoding in formatexpr() (#18084) 2022-04-11 12:44:31 -07:00
da31e953b6 docs(term.txt): add documentation about TUI input (#18072) 2022-04-11 23:22:04 +08:00
96b461a000 refactor(packaging): Windows: improve MSI, remove NSIS #18069
- Removed NSIS installer.
  - Prevents undefined behaviour when two installations are performed to the same directory (NSIS + MSI).
  - Reduced cost of maintaining two installers that do the same thing.
  - Chose Wix MSI due to its better integration with Windows.
- Added Wix patch file to add neovim binaries to the system path during installation.
- Replaced neovim installer icons with better looking versions.
- Renamed neovim installer icons from logo.ico -> neovim.ico for all
  icons to better reflect contents.
2022-04-11 07:58:46 -07:00
356cff78ec vim-patch:8.2.4734: getcharpos() may change a mark position (#18077)
Problem:    getcharpos() may change a mark position.
Solution:   Copy the mark position. (closes vim/vim#10148)
3caf1cce2b
2022-04-11 21:29:18 +08:00
f0d07dcb74 Merge pull request #18067 from zeertzjq/vim-8.2.4714
vim-patch:8.2.{4714,4733}
2022-04-11 19:30:42 +08:00
2dc86ef3b2 vim-patch:8.2.4733: HEEx and Surface do need a separate filetype
Problem:    HEEx and Surface do need a separate filetype.
Solution:   Revert 8.2.4729. (closes vim/vim#10147)
4232dff815
2022-04-11 18:40:46 +08:00
18ed556bbd vim-patch:8.2.4714: using g:filetype_dat and g:filetype_src not tested
Problem:    Using g:filetype_dat and g:filetype_src not tested.
Solution:   Add a test. (Patrick Meiser-Knosowski, closes vim/vim#10117)
a8034a4886
2022-04-11 18:38:42 +08:00
8f95f3ea06 fix(vim-patch.sh): fix N/A files patterns (#18073) 2022-04-11 14:41:26 +08:00
f89ca7194f fix(events): make v:event readonly in more events (#18070)
This makes v:event readonly in these four events:
- ChanInfo
- ChanOpen
- RecordingLeave
- TermClose
2022-04-11 11:32:15 +08:00
cdfb045ea0 Merge pull request #18071 from gpanders/create_uc
refactor!: Rename nvim_add_user_command to nvim_create_user_command
2022-04-10 20:46:02 -06:00
379067d038 docs: update dev-api to include "create" 2022-04-10 20:45:17 -06:00
a2f157233f fix(tui)!: remove ESC NUL forced escape (#17198)
This make Nvim recognize `ESC NUL` as <M-C-Space>, as many terminal
emulators (including libvterm) send <M-C-Space> as `ESC NUL`.

There is already another unambiguous way to encode a `ESC` key supported
by libtermkey: `ESC [ 2 7 u`, which is a `CSI u` sequence.

If one still wants to use `ESC NUL` as `ESC`, they can just map
<M-C-Space> to <Esc>.
2022-04-11 10:23:33 +08:00
f94f75dc05 refactor!: rename nvim_add_user_command to nvim_create_user_command 2022-04-10 20:18:41 -06:00
9da0023a66 feat(keymap): add F38-F63 keys (#17893) 2022-04-11 09:54:59 +08:00
b2cb05b53e feat(events): support SIGWINCH for Signal event #18029
closes #15411
2022-04-10 15:56:08 -07:00
8bdcd832ae refactor(globals.h): avoid confusing comment placement (#18066)
These comments were indented in Vim, but their indent was removed in
Nvim, causing them to be placed in a confusing place.
2022-04-10 21:22:22 +08:00
8f3845cdb7 docs: remove mentions of removed flag '#' in 'cpoptions' (#18064) 2022-04-10 14:58:01 +02:00
b438bb4343 vim-patch:8.2.4729: HEEx and Surface templates do not need a separate filetype (#18065)
Problem:    HEEx and Surface templates do not need a separate filetype.
Solution:   Use Eelixir for the similar filetypes. (Aaron Tinio, closes vim/vim#10124)
fa76a24109
2022-04-10 13:53:33 +02:00
b531e4ea33 Merge pull request #18062 from zeertzjq/vim-8.2.4723
vim-patch:8.2.{4723,4728}: the ModeChanged autocmd event is inefficient
2022-04-10 19:14:29 +08:00
381f8f86da vim-patch:8.2.4728: no test that v:event cannot be modified
Problem:    No test that v:event cannot be modified.
Solution:   Add a test. (closes vim/vim#10139)
021996ffaa
2022-04-10 18:45:16 +08:00
263a7fde35 vim-patch:8.2.4723: the ModeChanged autocmd event is inefficient
Problem:    The ModeChanged autocmd event is inefficient.
Solution:   Avoid allocating memory. (closes vim/vim#10134)  Rename
            trigger_modechanged() to may_trigger_modechanged().
2bf52dd065

Make v:event readonly for ModeChanged.
2022-04-10 08:02:22 +08:00
ff726cc569 vim-patch:8.2.4719: ">" marker sometimes not displayed in the jumplist (#18056)
Problem:    ">" marker sometimes not displayed in the jumplist.
Solution:   If the buffer no longer exists show "-invalid-". (Christian
            Brabandt, closes vim/vim#10131, closes vim/vim#10100)
a0f659c76e

Add a modeline to test_jumplist.vim
2022-04-10 07:13:22 +08:00
12662ac0c4 vim-patch:8.2.4722: ending recording with mapping records too much (#18060)
Problem:    When a recording is ended with a mapped key that key is also
            recorded.
Solution:   Remember the previous last_recorded_len. (closes vim/vim#10122)
81b46a6ccd
2022-04-10 06:45:27 +08:00
2a2c4e191f vim-patch:8.2.4718: @@@ in the last line sometimes drawn in the wrong place (#18055)
Problem:    @@@ in the last line sometimes drawn in the wrong place.
Solution:   Make sure the column is valid. (closes vim/vim#10130)
cee9c844f2
2022-04-10 04:50:49 +08:00
61bd5426f4 vim-patch:8.2.4721: cooklang files are not recognized (#18058)
Problem:    Cooklang files are not recognized.
Solution:   recognize *.cook files. (Goc Dundar, closes vim/vim#10120)
36951ed1da
2022-04-09 17:43:33 +02:00
3280dc2b60 vim-patch:8.2.4720: ABB Rapid files are not recognized properly (#18057)
Problem:    ABB Rapid files are not recognized properly.
Solution:   Add checks for ABB Rapid files. (Patrick Meiser-Knosowski,
            closes #10104)
b09c320039
2022-04-09 17:42:46 +02:00
f3183a4d7c Merge pull request #18023 from tom-anders/vim-8.2.4702
vim-patch:8.2.{4702,4703}: C++ scope labels are hard-coded
2022-04-09 22:13:34 +08:00
bf39c5fe4f vim-patch:8.2.4703: memory leak in handling 'cinscopedecls'
Problem:    Memory leak in handling 'cinscopedecls'.
Solution:   Free the memory before returning.
cb49a1d934
2022-04-09 15:39:48 +02:00
45f62464d3 vim-patch:8.2.4702: C++ scope labels are hard-coded
Problem:    C++ scope labels are hard-coded.
Solution:   Add 'cinscopedecls' to define the labels. (Tom Praschan,
            closes vim/vim#10109)
3506cf34c1
2022-04-09 15:39:46 +02:00
8055f9857b vim-patch:8.2.4715: Vagrantfile not recognized (#18052)
Problem:    Vagrantfile not recognized.
Solution:   Recognize Vagrantfile as ruby. (Julien Voisin, closes vim/vim#10119)
5e1792270a
2022-04-09 11:19:18 +02:00
b259426a25 chore(packaging): use transparent windows logo (#18051) 2022-04-09 10:31:11 +02:00
fda9adab5d vim-patch:partial:8.1.2333: with modifyOtherKeys CTRL-^ doesn't work (#18048)
Problem:    With modifyOtherKeys CTRL-^ doesn't work.
Solution:   Handle the exception.
828ffd5963
2022-04-09 13:31:42 +08:00
012c055804 vim-patch:partial:cbaff5e06ec5 (#18044)
Update runtime files
cbaff5e06e

Docs only.

Omit json_encode (different impl, Nvim throws E474 instead; see v8.2.4695).
Skip <MouseMove> (Nvim *kinda* has <MouseMove>, but most of this doc needs
  v8.2.4674 anyway...).
Nvim's 'hidden' doc was reworded somewhat, so manually integrate the changes
  (8331cd13c4).
Also apply "comma-separated" changes to all possible places in options.txt.
Cherry-pick *highlight-clear* tag from v8.2.3578.
2022-04-08 22:40:56 +02:00
d3068d34cc vim-patch:partial:cbaff5e06ec5 (#18042)
Update runtime files
cbaff5e06e

omit doc updates here
2022-04-08 19:53:41 +02:00
b4ec6af12a Merge pull request #17971 from chentau/extmark_spell
fix(extmarks): splice extmarks on accepting spell
2022-04-08 19:09:48 +02:00
d3603e157a build(deps): bump LuaJIT to HEAD - 5e3c45c43 (#18027) 2022-04-08 16:59:40 +02:00
c26d70d581 Merge pull request #17786 from gpanders/autocmd-args
feat(api)!: pass args table to autocommand callbacks
2022-04-08 16:55:47 +02:00
30bc02c636 feat(api)!: pass args table to autocommand callbacks 2022-04-08 15:12:54 +02:00
56ee7c29ab Merge pull request #18038 from zeertzjq/vim-8.2.4711
vim-patch:8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
2022-04-08 20:17:25 +08:00
b099bb1f2f test: add a test for #16823 2022-04-08 19:25:37 +08:00
38506553f7 vim-patch:8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Problem:    When 'insermode' is set :edit from <Cmd> mapping misbehaves.
Solution:   Don't set "need_start_insertmode" when already in Insert mode.
            (closes vim/vim#10116)
3a56b6d405
2022-04-08 19:02:37 +08:00
2c7dc648ca vim-patch:8.2.3925: diff mode confused by NUL bytes (#18033)
Problem:    Diff mode confused by NUL bytes.
Solution:   Handle NUL bytes differently. (Christian Brabandt, closes vim/vim#9421,
            closes vim/vim#9418)
06f6095623
2022-04-08 10:45:42 +08:00
356baae80a vim-patch:8.2.4704: using "else" after return or break increases indent (#18032)
Problem:    Using "else" after return or break increases indent.
Solution:   Remove "else" and reduce indent. (Goc Dundar, closes vim/vim#10099)
f26c16144d
2022-04-08 10:25:22 +08:00
4c9a71c69e Merge pull request #18031 from zeertzjq/vim-8.2.0004
vim-patch:8.2.{0004,4700,4706}: buffer closing is interrupted
2022-04-08 10:23:55 +08:00
191f009ab7 vim-patch:8.2.4706: buffer remains active with WinClosed and tabpages
Problem:    Buffer remains active if a WinClosed event throws an exception
            when there are multiple tabpages.
Solution:   Ignore aborting() when closing the buffer. (closes vim/vim#10101)
6a06940f8a
2022-04-08 08:54:07 +08:00
b7bc931f63 vim-patch:8.2.4700: buffer remains active if WinClosed event throws an exception
Problem:    Buffer remains active if a WinClosed event throws an exception.
Solution:   Ignore aborting() when closing the buffer. (closes vim/vim#10097)
c947b9ae41
2022-04-08 08:54:07 +08:00
44b59d1a69 vim-patch:8.2.0004: get E685 and E931 if buffer reload is interrupted
Problem:    Get E685 and E931 if buffer reload is interrupted.
Solution:   Do not abort deleting a dummy buffer. (closes vim/vim#5361)
a6e8f888e7
2022-04-08 08:54:07 +08:00
8f3245dbfa refactor(window): cherry-pick win_close_buffer() from Vim patch 8.1.1391 2022-04-08 08:54:03 +08:00
65a5cea0d3 vim-patch:8.2.4710: smart indenting does not work after completion (#18030)
Problem:    Smart indenting does not work after completion.
Solution:   Set "can_si". (Christian Brabandt, closes vim/vim#10113, closes vim/vim#558)
ac72c21da6
2022-04-08 07:12:47 +08:00
8c25dbff46 vim-patch:8.2.4708: PHP test files are not recognized (#18025)
Problem:    PHP test files are not recognized.
Solution:   Add the *.phpt pattern. (Julien Voisin, closes vim/vim#10112)
177847e67a
2022-04-07 20:24:55 +02:00
0d2674a3c5 ci: add script to bump versions (#17884)
* ci: add script for bumping dependencies

* docs: add usage information for bump-deps.sh
2022-04-07 17:41:48 +02:00
1edca3872e vim-patch:8.2.4707: redrawing could be a bit more efficient (#18022)
Problem:    Redrawing could be a bit more efficient.
Solution:   Optimize redrawing. (closes vim/vim#10105)
8c97960850
2022-04-07 23:26:03 +08:00
abc157a6fd Merge pull request #18021 from zeertzjq/fix-clearing-reg-executing
Fix clearing of reg_executing
2022-04-07 22:40:01 +08:00
64802da6c4 fix(event-loop): check if executed register has ended 2022-04-07 21:42:11 +08:00
2a574f7aaa fix(input): fix clearing of reg_executing
vim-patch:8.2.4705
2022-04-07 21:42:07 +08:00
dc9e436986 Merge pull request #17979 from zeertzjq/autocmd-show-fix
fix(autocmd): restore autocmd showing behavior
2022-04-07 11:42:16 +02:00
f85f4e25d2 vim-patch:8.2.4701: Kuka Robot Language files not recognized (#18012)
Problem:    Kuka Robot Language files not recognized.
Solution:   Recognize *.src and *.dat files. (Patrick Meiser-Knosowski,
            closes vim/vim#10096)
3ad2090316
2022-04-07 09:09:08 +02:00
233014f92b vim-patch:8.2.0836: not all :cdo output is visible (#18007)
Problem:    Not all :cdo output is visible.
Solution:   Reset 'shortmess' temporarily. (Yegappan Lakshmanan, closes vim/vim#6155)
14798ab9a5

Cherry pick relevant changes form patches 8.1.1826 and 8.2.0557.
2022-04-06 12:04:19 +08:00
74a27748e6 fix(autocmd): restore autocmd showing behavior 2022-04-06 05:44:30 +08:00
128bedc0d2 vim-patch:8.2.4696: delete() with "rf" argument does not report a failure (#18002)
Problem:    delete() with "rf" argument does not report a failure.
Solution:   Return -1 if the directory could not be removed. (closes vim/vim#10078)
478700336d
2022-04-06 05:12:49 +08:00
f86f74c12f Merge pull request #18003 from bfredl/incperf2
fix(ui): inccomand performance degradation
2022-04-05 21:23:27 +02:00
54cec455cc fix(ui): inccomand performance degradation
It was broken since the introduction of the macro.
2022-04-05 20:21:43 +02:00
402a71ff87 Merge pull request #17335 from famiu/fix/ui/win-resize
fix: Make window resize commands manage cmdheight
2022-04-05 19:34:06 +02:00
6dc31eea43 fix(tests): update legacy tab switch test to be sane 2022-04-05 16:50:11 +02:00
463174b5d7 fix(ui): make window resize commands manage cmdheight
Previously, the window resize commands did not resize the value of `cmdheight` when they caused a change in the topframe height, leaving a gap between the end of topframe and the start of the command line, this commit fixes that by making window resize commands automatically change the value of cmdheight if the resize affects the height of topframe.
2022-04-05 16:50:07 +02:00
969d600f2a vim-patch:8.2.{4692,4691,4690}: fix Insert mode <LeftDrag> mapping bug (#17999)
vim-patch:8.2.4692: no test for what 8.2.4691 fixes

Problem:    No test for what 8.2.4691 fixes.
Solution:   Add a test.  Use a more generic sotlution. (closes vim/vim#10090)
0f68e6c07a

Test cannot be used because it must use test_setmouse(). Use a Lua test.

Reverted patches:

vim-patch:8.2.4691: solution for <Cmd> in a mapping causes trouble

Problem:    Solution for <Cmd> in a mapping causes trouble.
Solution:   Use another solution: put back CTRL-O after reading the <Cmd>
            sequence.
ca9d8d2cb9

vim-patch:8.2.4689: using <Cmd> in a mapping does not work for mouse keys

Problem:    Using <Cmd> in a mapping does not work for mouse keys in Insert
            mode. (Sergey Vlasov)
Solution:   When reading the <Cmd> argument do not use the stuff buffer.
            (closes vim/vim#10080)
d0fb2d8041
2022-04-05 21:38:53 +08:00
e135adcb8c vim-patch:8.2.4687: "vimgrep /%v/ *" may cause a crash (#17995)
Problem:    "vimgrep /\%v/ *" may cause a crash.
Solution:   When compiling the pattern with the old engine fails, restore the
            regprog of the new engine instead of leaving it NULL.
            (closes vim/vim#10079)
e8a4c0d91f
2022-04-05 09:00:48 +08:00
b08cf73be9 refactor(pos.h): remove unused include; make formatting consistent (#17892)
- remove include of limit.h from pos.h, because it is no longer used
- make formatting more consistent in pos.h
2022-04-04 15:18:00 +08:00
c41e75039f test: move completion :stopinsert test to completion_spec.lua (#17992) 2022-04-04 14:53:47 +08:00
daa8ac051d Merge pull request #17991 from zeertzjq/vim-8.2.4253
vim-patch:8.2.4253: using freed memory when substitute with function call
2022-04-04 13:02:32 +08:00
bbfc44e255 refactor: pass "preview" to regtilde() 2022-04-04 12:11:38 +08:00
6486983117 vim-patch:8.2.4253: using freed memory when substitute with function call
Problem:    Using freed memory when substitute uses a recursive function call.
Solution:   Make a copy of the substitute text.
37f47958b8

'compatible' doesn't seem needed for the test.
2022-04-04 12:11:04 +08:00
db13f105d6 Merge pull request #17988 from zeertzjq/vim-8.2.4247
vim-patch:8.2.{4247,4258}: stack corruption when looking for spell suggestions
2022-04-04 11:11:37 +08:00
683648a396 vim-patch:8.2.4258: Coverity warns for array overrun
Problem:    Coverity warns for array overrun.
Solution:   Restrict depth to MAXWLEN - 1.
6970e1e36a
2022-04-04 09:37:40 +08:00
945caeeda2 vim-patch:8.2.4247: stack corruption when looking for spell suggestions
Problem:    Stack corruption when looking for spell suggestions.
Solution:   Prevent the depth increased too much.  Add a five second time
            limit to finding suggestions.
06f15416bb

Cherry-pick parentheses from patch 8.2.4402.
2022-04-04 09:37:40 +08:00
1f038bc592 test(old): fix test_spell.vim encoding 2022-04-04 09:37:40 +08:00
a973fa5b43 test(old): fix test_regexp_latin.vim encoding (#17989)
Cherry-pick a change from Vim patch 8.2.3982
2022-04-04 09:12:20 +08:00
4e0a825262 Merge pull request #17987 from leungbk/vim-patch-4402
vim-patch:8.2.{4639,4402}: missing parenthesis may cause unexpected problems
2022-04-04 07:54:34 +08:00
33909b6564 chore: update .git-blame-ignore-revs 2022-04-03 16:12:30 -07:00
69e11b58b4 vim-patch:8.2.4402: missing parenthesis may cause unexpected problems
Problem:    Missing parenthesis may cause unexpected problems.
Solution:   Add more parenthesis is macros.
ae6f1d8b14
2022-04-03 16:11:23 -07:00
271bb32855 vim-patch:8.2.4639: not sufficient parenthesis in preprocessor macros
Problem:    Not sufficient parenthesis in preprocessor macros.
Solution:   Add more parenthesis.
9dac9b1751
2022-04-03 15:57:07 -07:00
a93b55273f Merge pull request #17986 from zeertzjq/fix-ex-mode-regression
Fix regression with :normal and Ex mode from #14311
2022-04-04 06:13:42 +08:00
559dcf45a1 test: add some tests with :normal and Ex mode 2022-04-04 05:46:54 +08:00
9955209afb fix(substitute): properly check for empty command line 2022-04-04 05:46:45 +08:00
d73bf3138a vim-patch:8.2.4672: using :normal with Ex mode may make :substitute hang (#17983)
Problem:    Using :normal with Ex mode may make :substitute hang.
Solution:   When getting an empty line behave like 'q' was typed.
            (closes vim/vim#10070)
ce416b453a

Cherry-pick a comment from patch 8.2.0363.
2022-04-03 20:38:31 +08:00
e9e16655af [RFC] vim-patch:8.1.1378: delete() can not handle a file name that looks li… (#16268)
Problem:    Delete() can not handle a file name that looks like a pattern.
Solution:   Use readdir() instead of appending "/*" and expanding wildcards.
            (Ken Takata, closes vim/vim#4424, closes vim/vim#696)
701ff0a3e5

Cherry-pick a change to Test_delete_rf() from patch 8.1.1921.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-04-03 20:27:46 +08:00
6786b6afad vim-patch:8.1.1687: the evalfunc.c file is too big (#17949)
Problem:    The evalfunc.c file is too big.
Solution:   Move testing support to a separate file.
ecaa70ea29
2022-04-03 09:26:59 +08:00
a783cdd68d fix(ex_normal): spam \n in Ex mode only if in Cmdline mode (#17977)
When using :normal in Ex mode, the editor is no longer in Cmdline mode,
but the exmode_active flag is still set, causing the wrong character to
be spammed in Insert mode, leading to a hang.
2022-04-03 08:58:49 +08:00
ea71c26ec9 fix(extmarks): splice extmarks on accepting spell 2022-04-02 12:35:33 -04:00
2a46600140 docs(options): add more missing 'nofoo' tags (#17967) 2022-04-02 15:24:10 +02:00
e6bd9eee15 docs(options): add missing 'nofoo' tags (#17965) 2022-04-02 14:08:04 +02:00
e45d141e28 vim-patch:8.2.4664: Elvish files are not recognized (#17963)
Problem:    Elvish files are not recognized.
Solution:   Recognize .elv files. (Bruno Roque, closes vim/vim#10058)
c1658a196b
2022-04-02 13:36:19 +02:00
af1b61f342 Merge pull request #17961 from zeertzjq/scroll-no-multiclick
fix(input): do not translate scroll keys into multiclicks
2022-04-02 12:47:40 +02:00
5499736380 fix(input): do not translate scroll keys into multiclicks 2022-04-02 16:18:18 +08:00
fce0d54eb2 Merge pull request #17953 from zeertzjq/vim-8.2.4660
vim-patch:8.2.4660: cursorcolumn is sometimes not correct
2022-04-01 20:37:45 +08:00
ef595e9b93 test: add a test for #13916 2022-04-01 20:14:01 +08:00
139828cc7e vim-patch:8.2.4660: cursorcolumn is sometimes not correct
Problem:    Cursorcolumn is sometimes not correct.
Solution:   Recompute the cursor column when entering Insert mode and the
            cursor is on a character wider than a screen cell.
782c6744b4
2022-04-01 19:53:40 +08:00
377e875211 Merge pull request #17948 from zeertzjq/vim-8.2.3471
vim-patch:8.2.{3471,3472,3489}: fix some crashes/errors with search
2022-04-01 17:43:31 +08:00
b9454d1676 vim-patch:8.2.3489: ml_get error after search with range
Problem:    ml_get error after search with range.
Solution:   Limit the line number to the buffer line count.
35a319b77f
2022-04-01 17:18:21 +08:00
b8fbd749a9 vim-patch:8.2.3472: other crashes with empty search pattern not tested
Problem:    Other crashes with empty search pattern not tested.
Solution:   Add a few more test lines. (Dominique Pellé)
9af9fd6ab6
2022-04-01 17:12:17 +08:00
649a11bc13 vim-patch:8.2.3471: crash when using CTRL-T after an empty search pattern
Problem:    Crash when using CTRL-T after an empty search pattern.
Solution:   Bail out when there is no previous search pattern. (closes vim/vim#8953)
d8d957de86
2022-04-01 17:11:56 +08:00
88a4ac22f0 Merge pull request #17946 from lewis6991/fixes
Quick review fixes for autocmds and keymaps
2022-04-01 10:44:58 +02:00
3cc29b7f0d fix(keymap): don't coerce false to '' 2022-04-01 09:09:30 +01:00
dc3bbd31a9 fix(api): delete all autocmds with the same ID 2022-04-01 08:38:58 +01:00
973e91007c refactor: remove redundant check for w_p_cole (#17944)
No longer needed after #17890.
2022-04-01 11:40:45 +08:00
8a6cf51a71 vim-patch:8.2.3122: with 'nowrap' cursor position is unexected in narrow window (#17935)
Problem:    With 'nowrap' cursor position is unexected in narrow window.
            (Leonid V.  Fedorenchik)
Solution:   Put cursor on the last non-empty line. (closes vim/vim#8525)
30441bb3d5
2022-04-01 07:11:38 +08:00
dc48330b9d Merge pull request #17842 from lewis6991/keymap
feat(keymap): return nil from an expr keymap
2022-04-01 00:48:46 +02:00
80d4d6b486 Merge pull request #17938 from ggandor/autocmd-api-names
refactor(api)!: use singular/plural consistently in the autocmd API
2022-04-01 00:35:21 +02:00
9d40b2fda9 refactor(api)!: use singular/plural consistently in the autocmd API 2022-03-31 23:58:47 +02:00
38ba2a75fc vim-patch:8.2.4658: org-mode files are not recognized (#17939)
Problem:    Org-mode files are not recognized.
Solution:   Add patterns to recognize "org" files. (closes vim/vim#10046)
3a6f952cc8
2022-03-31 22:16:25 +02:00
dbcb76bd7a Merge pull request #17888 from dundargoc/ci/remove-reviewers-when-drafting 2022-03-31 15:38:26 -04:00
68c0e90189 Merge pull request #17906 from dundargoc/test/skip-nvimlog-on-success 2022-03-31 15:36:18 -04:00
4a89812d85 Merge pull request #17929 from lewis6991/autocmd
fix(api): improve autocmd error handling
2022-03-31 19:28:06 +02:00
ebab51b192 docs(extmark): fix nvim_buf_get_extmarks example (#17934) 2022-03-31 18:05:17 +02:00
2e85af47d2 feat(runtime): add query filetype (#17905)
used for Tree-sitter queries
uses Lisp runtime files

(in Lua to distinguish from upstream runtime files)
2022-03-31 08:46:45 -06:00
ea8ad79990 Merge pull request #17698 from tjdevries/nvim_clear_autocmd
api: nvim_clear_autocmd
2022-03-31 15:25:56 +02:00
929293815b fix(api): improve autocmd error handling
- nvim_del_augroup_* now works with pcall
- nvim_del_autocmd now errors for invalid ids
2022-03-31 14:23:53 +01:00
b80651eda9 feat(api): nvim_clear_autocmd
Co-authored-by: Christian Clason <christian.clason@uni-due.de>
2022-03-31 14:30:42 +02:00
b2bd800416 Merge pull request #17890 from zeertzjq/conceal-virtcol-changed
perf: only redraw concealed line if cursor has moved horizontally
2022-03-31 10:56:15 +02:00
1184097261 Merge pull request #17925 from zeertzjq/vim-8.2.1844
vim-patch:8.2.{1844,2515,4156,4200,4577}: messages patches
2022-03-31 10:48:41 +08:00
86f81c471a vim-patch:8.2.4577: message test is flaky
Problem:    Message test is flaky. (Elimar Riesebieter)
Solution:   Trigger the autocommand event only after startup is finished.
9323ca51c2
2022-03-31 10:05:26 +08:00
5a3a1304e1 vim-patch:8.2.4200: some tests do not clean up properly
Problem:    Some tests do not clean up properly.
Solution:   Delete created files. (Yegappan Lakshmanan, closes vim/vim#9611)
7e765a39b7

Omit test_filetype.vim: already ported
Omit test_vim9_import.vim: N/A
2022-03-31 10:05:26 +08:00
d5dee83552 vim-patch:8.2.4156: fileinfo message overwrites echo'ed message
Problem:    Fileinfo message overwrites echo'ed message.
Solution:   Reset need_fileinfo when displaying a message. (Rob Pilling,
            closes vim/vim#9569)
726f7f91fd
2022-03-31 10:05:26 +08:00
e2247c0baa vim-patch:8.2.2515: memory access error when truncating an empty message
Problem:    Memory access error when truncating an empty message.
Solution:   Check for an empty string. (Dominique Pellé, closes vim/vim#7841)
6281815ecc
2022-03-31 10:05:26 +08:00
47630743fc vim-patch:8.2.1844: using "q" at the more prompt doesn't stop a long message
Problem:    Using "q" at the more prompt doesn't stop a long message.
Solution:   Check for "got_int". (closes vim/vim#7122)
3d30af8783

Cherry-pick file name change from patch 8.2.2112.
2022-03-31 10:05:26 +08:00
b6e3a2dbbb vim-patch:8.2.4645: 'shortmess' changed when session does not store options (#17908)
Problem:    'shortmess' changed when session does not store options.
Solution:   Save and restore 'shortmess' if needed. (James Charti,
            closes vim/vim#10037)
fd01280d01
2022-03-31 10:04:12 +08:00
0d4bd420c1 fix: correct vertical dragging room calculation with global statusline (#17928)
This fixes the bug that win_move_statusline() or mouse dragging cannot
reduce 'cmdheight' to 1 when global statusline is used.
2022-03-31 08:40:17 +08:00
6d648f5594 feat(treesitter): add more default groups to highlight map (#17835)
This covers some default groups listed in :h group-name.
2022-03-30 22:14:20 +02:00
a18c9ba2da docs(lsp): remove outdated offset_encoding default value for apply_text_edits 2022-03-30 21:04:17 +02:00
7fb2310edb fix: set nested before executing callback (#17801) 2022-03-30 17:59:36 +02:00
1217694f21 Merge pull request #17921 from zeertzjq/vim-8.2.4649
vim-patch:8.2.{4349,4649}
2022-03-30 20:46:11 +08:00
06cf205ace vim-patch:8.2.4649: various formatting problems
Problem:    Various formatting problems.
Solution:   Improve the code formatting.
b4ad3b0dea
2022-03-30 20:32:27 +08:00
4ca14b310c vim-patch:8.2.4349: FileChangedShell test fails on MS-Windows
Problem:    FileChangedShell test fails on MS-Windows.
Solution:   Skip the test on MS-Windows.
c9e3187d05
2022-03-30 20:32:27 +08:00
ac1dd046c0 vim-patch:46eea444d (#17920)
Update runtime files
46eea444d9

Skip repeat.txt as it only has vim9-specific changes.
2022-03-30 12:12:12 +01:00
75ff156d9b Merge pull request #17773 from zeertzjq/vim-8.2.3110
vim-patch:8.2.{3110,4592}: a pattern that matches the cursor position is complicated
2022-03-30 09:03:57 +08:00
465f8ff8cb vim-patch:8.2.4592: search continues after giving E1204
Problem:    Search continues after giving E1204.
Solution:   Return failure after giving E1204. (closes vim/vim#9972)
b10ff5c1b3
2022-03-30 08:35:13 +08:00
b2819eec26 docs(pattern.txt): cherry-pick latests changes from Vim runtime updates
Update runtime files
53f7fccc94

Update runtime files
2286304cdb

Update runtime files
2f0936cb9a

Update runtime files.
a2baa73d1d
2022-03-30 08:35:13 +08:00
1bbe8ec282 vim-patch:8.2.3110: a pattern that matches the cursor position is complicated
Problem:    A pattern that matches the cursor position is bit complicated.
Solution:   Use a dot to indicate the cursor line and column. (Christian
            Brabandt, closes vim/vim#8497, closes vim/vim#8179)
04db26b360

Also use `n = ++vcol` in regexp_bt.c as `++vcol` alone fails lint.
2022-03-30 08:35:13 +08:00
e5428d10b5 vim-patch:8.1.0439: recursive use of getcmdline() still not protected (#17726)
Problem:    Recursive use of getcmdline() still not protected.
Solution:   Instead of saving the command buffer when making a call which may
            cause recursiveness, save the buffer when actually being called
            recursively.
438d176e35

Co-authored-by: zeertzjq <zeertzjq@outlook.com>

Clear ccline earlier in save_cmdline() if ccline is in use so that
ccline.prev_ccline can be assigned.
2022-03-30 08:32:12 +08:00
2f37823703 vim-patch:8.2.4646: using buffer line after it has been freed (#17907)
Problem:    Using buffer line after it has been freed in old regexp engine.
Solution:   After getting mark get the line again.
b55986c52d
2022-03-30 07:44:12 +08:00
e7ac16425c vim-patch:8.2.4473: Coverity warns for not checking return value of ftell() (#17914)
Problem:    Coverity warns for not checking return value of ftell().
Solution:   Bail out if ftell() returns a negative value.
416b5f4894
2022-03-30 05:54:02 +08:00
a9665bb12c fix(event-loop): duplicate display updating logic in vgetorpeek() (#17913) 2022-03-30 05:25:00 +08:00
f4693d99df test: don't print NVIMLOG on success 2022-03-29 22:50:39 +02:00
29aa08a09d vim-patch:8.2.3449: sort fails if the sort compare function returns 999 (#17909)
Problem:    Sort fails if the sort compare function returns 999.
Solution:   Adjust value to -1 / 0 / 1. (Yasuhiro Matsumoto, closes vim/vim#8884)
c04f62346b
2022-03-30 04:14:37 +08:00
7a6978ba29 vim-patch:8.2.3551: checking first character of url twice (#17910)
Problem:    Checking first character of url twice.
Solution:   Only check once. (closes vim/vim#9026)
94e7d345c1
2022-03-30 02:23:58 +08:00
f1d5a2e82d chore: add .mailmap (#17453)
Consolidate commit author details

- Prefer user/email with either most commits or most recent commit
- Generally less preference for @users.noreply.github.com emails
- Avoided consolidating common names
2022-03-29 19:44:35 +02:00
524f6294a3 build(clint): link to wiki when accessing list_T internals directly (#17876) 2022-03-29 22:27:57 +08:00
ba257d74b1 fix(decorations): do not put empty virt_text (#17872) 2022-03-29 19:56:45 +08:00
81d7628c3f vim-patch:8.2.4644: redrawing too often when 'relativenumber' is set (#17756)
Problem:  Redrawing too often when 'relativenumber' is set.
Solution: Only redraw when the cursor line changed. (Lewis Russell,
          closes vim/vim#10040)
1624639ec8
2022-03-29 19:37:42 +08:00
d89a80fafc docs: update hl-Whitespace documentation (#17901) 2022-03-29 07:38:29 +02:00
3cc6cfecf3 vim-patch:8.2.4640: some boolean options use "long" instead of "int" (#17896)
Problem:    Some boolean options use "long" instead of "int".
Solution:   Adjust the type. (James McCoy, closes vim/vim#10033)
8be423b7ac

N/A patches for version.c:

vim-patch:8.2.4641: may mark the wrong window for redrawing

Problem:    May mark the wrong window for redrawing.
Solution:   Use redraw_win_later(). (closes vim/vim#10032)
471b3aed3e
2022-03-29 11:57:04 +08:00
4d3acd6beb fix(lsp): use "text" filetype for plaintext (#17898) 2022-03-28 09:16:11 -07:00
e55ba16a0e Merge pull request #17891 from casswedson/label-as-build
ci: label changes to Makefiles as build
2022-03-28 06:14:26 -04:00
595c1a724a perf: only redraw concealed line if cursor has moved horizontally
Building upon #17889, this moves conceal redrawing logic into move.c, so
that concealed line is only redrawn if cursor has moved horizontally.
2022-03-28 10:23:32 +08:00
9ce2c73180 revert: "Fix redraw regression with w_p_cole in visual mode"
Revert the code change from b7d6caaa03.
The test is kept.
The glitch was fixed by #17864, so this workaround is no longer needed.
2022-03-28 10:23:17 +08:00
02bac30928 ci: label changes to Makefiles as build
Makefiles are used for builds, so why not label changes to these
files as build
2022-03-27 19:20:15 -05:00
79dcd045d3 Merge pull request #17889 from zeertzjq/vim-8.2.4638
vim-patch:8.2.{4638,4630}: cursorlineopt=screenline redrawing
2022-03-28 06:40:00 +08:00
ab02b28b4e vim-patch:8.2.4630: 'cursorline' not always updated with 'culopt' is "screenline"
Problem:    'cursorline' not always updated with 'cursorlineopt' is
            "screenline".
Solution:   Call check_redraw_cursorline() more often. (closes vim/vim#10013)
bf269ed0b0

Code was reverted in patch 8.2.4638, so this just ports the test.
2022-03-28 06:15:26 +08:00
4baeb96c1b vim-patch:8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Problem:    Superfluous check if a redraw is needed for 'cursorline'.
Solution:   Remove check_redraw_cursorline(). (closes vim/vim#10030, closes vim/vim#10029)
3e559cd884

redraw_after_callback() is N/A.
Omits changes that just revert code from patch 8.2.4630.
2022-03-28 06:15:26 +08:00
a201dd265f Merge pull request #17887 from dundargoc/ci/commitlint
ci(commitlint): use -u NONE instead of --clean
2022-03-27 17:11:11 -04:00
da3ef2a538 ci: remove reviewers when drafting or closing a PR 2022-03-27 22:35:26 +02:00
b66cc0f569 Merge pull request #17873 from muniter/jl-apidocs-improvementes
ci(doc): improve missing docs workflow
2022-03-27 16:21:02 -04:00
f61841b8cc docs: .git-blame-ignore-revs #16174 2022-03-27 20:00:39 +00:00
72652cbc46 feat(test): use nvim_exec in helpers.source() #16064
helpers.source() was a hack to work around the lack of anonymous
:source. Its "create tempfile" behavior is not a required part of most
tests that use it.

Some tests still need the old "create tempfile" behavior either because
they test SID behavior, or because of missing nvim_exec features: #16071
2022-03-27 10:25:55 -07:00
680970bfbc ci(commitlint): use -u NONE instead of --clean
I get a weird error about syntax.vim not being installed when using
--clean when running it locally.
2022-03-27 18:28:11 +02:00
05edab85d7 refactor: assume STATUS_HEIGHT to be 1 (#17804)
Since https://github.com/neovim/neovim/pull/17790 being merged means we can assume the value of `STATUS_HEIGHT` to always be 1, this commit removes code that's unnecessary if `STATUS_HEIGHT` is 1.
2022-03-27 08:33:54 -07:00
a8e2c45b94 fix(diagnostic): make open_float respect global diagnostic options (#17879)
* make `open_float` respect `scope` option set in `vim.diagnostic.config`
* Closes #17878
2022-03-27 08:10:03 -06:00
a86d3d3780 docs: correct CursorMoved documentation (#17880)
behavior was changed in https://github.com/neovim/neovim/pull/9807
2022-03-27 11:02:44 +02:00
71b4c30ad6 Merge pull request #17877 from zeertzjq/vim-8.2.4631
vim-patch:8.2.4631: crash when switching window in BufWipeout autocommand
2022-03-27 10:33:05 +08:00
ae0a43ec23 fix(tabpage): correct check for failure to close window
Avoid closing window 999 times.
2022-03-27 10:01:35 +08:00
f4f18a9833 vim-patch:8.2.4631: crash when switching window in BufWipeout autocommand
Problem:    Crash when switching window in BufWipeout autocommand.
Solution:   Put any buffer in the window to avoid it being NULL.
            (closes vim/vim#10024)
347538fad0

win_init_empty() cannot be made static because it is used in autocmd.c
2022-03-27 10:01:07 +08:00
45dbb78747 ci(doc): improve missing docs workflow
1. Add new pattern `runtime/doc/**`. This is a common case were the
   contributor modifies only the help file but the doc gen would discard
   their changes.

2. Add to the output what the changes after running doc gen would be.

[skip ci]
2022-03-26 12:38:36 -05:00
a490db5ba8 refactor!: rename nvim_do_autocmd to nvim_exec_autocmd (#17854)
according to established code standards (`:h dev-api`)
2022-03-26 15:34:56 +01:00
111dd6c322 Merge pull request #17869 from dundargoc/vim-8.2.3943
vim-patch:8.2.3943: compiler warning from gcc for uninitialized variable
2022-03-26 22:27:03 +08:00
66fff788f2 Merge pull request #17857 from muniter/jl-breaking-change-label
ci: automatic breaking change label
2022-03-26 09:45:54 -04:00
85821d8b6f docs(api): fix wrong documentation of nvim_create_autocmd (#17870)
also add doc changes from typofix PR
2022-03-26 13:21:32 +01:00
ca7d633eaf ci: automatic breaking change label
When the PR title contains the breaking change format apply the
breaking-change label.
2022-03-26 07:18:00 -05:00
82304038a2 vim-patch:8.2.3943: compiler warning from gcc for uninitialized variable
Problem:    Compiler warning from gcc for uninitialized variable.
Solution:   Initialize variable. (closes vim/vim#9429)
491669701c
2022-03-26 12:12:03 +01:00
fb5587d2be Merge pull request #17839 from zeertzjq/vim-8.2.4281
vim-patch:8.2.{4281,4327}: fix two crashes with quickfix and wiping buffer
2022-03-26 12:59:34 +08:00
a70b39965b fix(tui): avoid using uninitialized memory in kitty (#17866) 2022-03-26 10:48:31 +08:00
d8b4f3e3b8 vim-patch:8.2.4327: may end up with no current buffer
Problem:    May end up with no current buffer.
Solution:   When deleting the current buffer to not pick a quickfix buffer as
            the new current buffer.
e3537aec2f

The test cannot be ported as-is because Nvim doesn't support "-Z"
command line argument. Just use only "--clean" instead.
2022-03-26 09:51:59 +08:00
19bbc43947 vim-patch:8.2.4281: using freed memory with :lopen and :bwipe
Problem:    Using freed memory with :lopen and :bwipe.
Solution:   Do not use a wiped out buffer.
9b4a80a665

Cherry-pick some indent changes from patch 8.2.1432.
2022-03-26 09:02:42 +08:00
9530c2d6d8 vim-patch:8.2.4626: Visual area not updated when removing sign in Visual mode (#17864)
Problem:    Visual area not fully updated when removing sign in Visual mode
            while scrolling.
Solution:   Adjust check for topline. (closes vim/vim#10017)
abb6fbd14d
2022-03-26 08:52:54 +08:00
c2378be3dd vim-patch:8.2.3453: autocmd not executed when editing a directory (#17846)
Problem:    Autocmd not executed when editing a directory ending in a path
            separator inside try block.
Solution:   Return NOTDONE instead of FAIL. (closes vim/vim#8885)
40fa12aea3
2022-03-26 08:27:29 +08:00
876d22fca9 fix(clang/'Dead store'): do not assign endcol (#17788) 2022-03-25 18:02:42 -06:00
61205c1def chore: fix typos (#17755)
Co-authored-by: Jordan Haine <jhaine@securitycompass.com>
2022-03-25 19:57:59 +01:00
174deafcef docs(api): improve autocommand docs (#17545)
[skip ci]
2022-03-25 19:24:53 +01:00
5e64d65df6 fix(filetype.lua): always return a string in getline helper function (#17852)
Uses of `getline` in `filetype.lua` currently assume it always returns a
string. However, if the buffer is unloaded when filetype detection runs,
`getline` returns `nil`. Fixing this prevents errors when filetype
detection is run on unloaded buffers.
2022-03-25 12:12:00 -06:00
d72e82d3db build(deps): bump luajit to commit e2c312e (#17111)
bump bundled LuaJIT to e2c312e0de
2022-03-25 17:42:32 +01:00
b81c310d49 fix(tui): correct CSI sequence (#17844)
Follow up to #17771. The sequence `CSI > 4 ; 1 m` does not enable
distinguishing all available keys; notably, it excludes `<Tab>`. Using
`CSI > 4 ; 2 m` tells the terminal to disambiguate *all* keys, which is
much more useful.

The meaning of the final parameter is documented [here][1].

[1]: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys
2022-03-24 13:11:04 -06:00
69f1de86dc feat: add vim.tbl_get (#17831)
vim.tbl_get takes a table with subsequent string arguments (variadic) that
index into the table. If the value pointed to by the set of keys exists,
the function returns the value. If the set of keys does not exist, the
function returns nil.
2022-03-24 12:01:04 -07:00
39af40580a Merge pull request #17809 from dundargoc/PVS/V1019
fix(PVS/V1019): compound assignment expression is used inside condition
2022-03-24 18:37:23 +01:00
27fccb295c Merge pull request #17771 from gpanders/extendedkeys
feat(tui): enable CSI u keys
2022-03-24 18:13:32 +01:00
93e0d9b556 fix(PVS/V1019): compound assignment expression is used inside condition 2022-03-24 17:57:36 +01:00
02fd00c042 feat(runtime): include Lua in C++ ftplugin (#17843) 2022-03-24 08:05:13 -06:00
58140a9428 feat(keymap): return nil from an expr keymap
For Lua callback expr keymaps, returning `nil` or `false` is equivalent
to an empty string
2022-03-24 13:59:20 +00:00
b438251a0e Merge pull request #17838 from zeertzjq/ci-docgen-no-src-lua
ci: remove src/nvim/**.lua from docgen pattern
2022-03-24 14:20:03 +01:00
a11ff55555 feat(tui): enable CSI u keys
On TUI startup write the CSI sequence that signals to the controlling
terminal that Neovim supports the CSI u scheme for encoding modifiers
documented in [1].

This is similar to, but distinct from, Vim's usage of the `t_TI` and
`t_TE` variables to handle Xterm's `modifyOtherKeys` setting. For a
longer explanation on those differences see [2]. Since Neovim uses
libtermkey for key input handling, we use the CSI u encoding rather than
Xterm's modifyOtherKeys encoding.

[1]: http://www.leonerd.org.uk/hacks/fixterms/
[2]: https://invisible-island.net/xterm/modified-keys.html
2022-03-24 07:13:49 -06:00
3b28bd57f9 Merge pull request #17821 from zeertzjq/vim-patch-cursorline
vim-patch:8.2.{4591,4614}: cursorline redrawing
2022-03-24 20:28:46 +08:00
1194856b31 Merge pull request #17740 from dundargoc/doxygen/memline
refactor(memline): convert function comments to doxygen format
2022-03-24 13:15:20 +01:00
4a11c7e56f chore(nvim_paste): assert the correct String (#17752) 2022-03-24 19:40:00 +08:00
534f5a419d refactor: convert function comments to doxygen format (#17710) 2022-03-24 12:17:21 +01:00
fcd57980f9 chore: add additional compiler flags (#17815)
Added:
  - -Wdouble-promotion
  - -Wmissing-noreturn
  - -Wmissing-format-attribute
  - -Wsuggest-attribute={pure,const,malloc,cold}

Resolves: #343
2022-03-24 12:14:04 +01:00
0c45753119 Merge pull request #17825 from bfredl/ctrl2
feat(input)!: distinguish ctrl input pairs (always)
2022-03-24 12:05:36 +01:00
8b7f818ee7 refactor(memline): convert function comments to doxygen format 2022-03-24 11:19:15 +01:00
ed88ca7503 feat(input): enable <tab>/<c-i>, <cr>/<c-m>, <esc>/<c-[> pairs unconditionally 2022-03-24 11:02:39 +01:00
d7488bf386 feat(input)!: delay some conversions to vgetc() 2022-03-24 11:02:39 +01:00
c29a14d1fa perf(screen): reduce cursorline redrawing when jumping around
vim-patch:8.2.4614: redrawing too much when 'cursorline' is set

Problem:    Redrawing too much when 'cursorline' is set and jumping around.
Solution:   Rely on win_update() to redraw the current and previous cursor
            line, do not mark lines as modified. (closes vim/vim#9996)
c20e46a4e3

This doesn't match the patch exactly, because I missed some lines when
porting patch 8.1.2029, and these lines were removed in this patch.

This also makes win_update() always update for 'concealcursor' like how
it always updates for 'cursorline', as 'cursorline' and 'concealcursor'
redrawing logic has been unified in Nvim.

As redrawing for 'cursorline' now always only requires VALID redraw
type, it is no longer necessary to call redraw_for_cursorline() in
nvim_win_set_cursor().
2022-03-24 16:08:59 +08:00
3e9b4e917d vim-patch:8.2.4591: cursor line not updated when a callback moves the cursor
Problem:    Cursor line not updated when a callback moves the cursor.
Solution:   Check if the cursor moved. (closes vim/vim#9970)
e7a74d5375

redraw_after_callback() is N/A. Nvim handles timers on the main loop.
2022-03-24 16:08:59 +08:00
a72f338d76 fix(float): do not switch window before deleting last listed buffer (#17840)
Just allow close_windows() to close the current window instead.
This fixes wrong working directory or autocommands not being triggered.
2022-03-24 14:53:20 +08:00
ff82b2785f fix(float): don't always switch window when deleting last listed buffer (#17836) 2022-03-24 11:56:22 +08:00
fc3bff6b7e ci: remove src/nvim/**.lua from docgen pattern
After #17623 this pattern is no longer necessary.
2022-03-24 11:35:24 +08:00
2e36117840 test: add test for deleting last listed buffer when there are floats (#17833) 2022-03-24 09:28:23 +08:00
d3af109d10 fix(PVS/V560): ignore false "conditional expression is always false" (#17830)
"'qi' points to the global variable 'ql_info' or the window local location list stack 'wp->w_llist'.  The contents of these structures can be changed out-of-band by an autocmd."

https://github.com/vim/vim/pull/9993#issuecomment-1076544168
2022-03-24 06:25:20 +08:00
06131370a4 refactor(memline.c): make swapfile_unchanged() return bool (#17827)
vim-patch:8.2.4613: return type of swapfile_unchanged() is wrong

Problem:    Return type of swapfile_unchanged() is wrong.
Solution:   Use "int". (closes vim/vim#10000  Yeah!)
3c5999e53d
2022-03-23 22:33:34 +08:00
52fe8eae07 fix(screen): do not update syntax_last_parsed when drawing folded line (#17826) 2022-03-23 20:23:41 +08:00
f5a3edb0c0 refactor: remove cpo-& behavior (#17745)
cpo-& has been removed, but its behavior was accidentally made the
default behavior. That should be removed instead.
2022-03-23 19:52:50 +08:00
0621cd3112 Merge pull request #17806 from zeertzjq/win-close-float-fix
Fix some bugs with closing window or buffer when there are floating windows
2022-03-23 18:05:31 +08:00
a9359dca37 fix(float): make laststatus=1 behave consistently with floating windows 2022-03-23 09:07:21 +08:00
3fdb7b528d fix(float): handle buffer deletion with floating windows 2022-03-23 09:07:21 +08:00
3539456f49 fix(win_close): count the window the be closed instead of curwin 2022-03-23 09:07:21 +08:00
89712dcbf8 fix(aucmd_win): always make aucmd_win the last window 2022-03-23 09:07:21 +08:00
7735163652 fix(screen): do not do syntax highlighting at filler or folded lines (#17818) 2022-03-23 07:07:34 +08:00
159111f9a5 refactor(ui_refresh): only save/restore p_lz if calling screen_resize() (#17794) 2022-03-23 06:34:45 +08:00
7863e6b709 vim-patch:8.2.1078: highlight and match functionality together in one file (#17805)
Problem:  Highlight and match functionality together in one file.
Solution: Move match functionality to a separate file. (Yegappan Lakshmanan,
          closes vim/vim#6352)

06cf97e714
2022-03-23 06:31:50 +08:00
f63a52a0db vim-patch:8.1.1608: the evalfunc.c file is too big (#17807)
Problem:    The evalfunc.c file is too big.
Solution:   Move sign functionality to sign.c.

b60d8514b8
2022-03-23 06:31:06 +08:00
04d2476d3a Merge pull request #17813 from muniter/jl-ci-api-docs-permissions
fix(ci): provide necessary permissions for calling workflow
2022-03-22 06:52:09 -04:00
b55e65980a fix(ci): provide necessary permissions for calling workflow
Also error on the side of security adding an extra check on the
automatic PR step.
2022-03-21 22:40:24 -05:00
0c02e8a62b Merge pull request #17768 from muniter/jl-genvimdoc-ci 2022-03-21 11:41:19 -04:00
50f3bb7e57 Merge pull request #17491 from neovim/marvim/api-doc-update/master 2022-03-21 11:40:56 -04:00
e9b53f3fb5 fix(PVS/V583): the '?:' operator always returns one and the same value (#17790) 2022-03-20 17:25:03 -06:00
18900758c3 Merge pull request #17760 from lewis6991/vim-patch-8.1.1734
vim-patch:8.1.{1734,1742,1743}: highlight, match and screen.c refactoring
2022-03-21 07:21:04 +08:00
087a9603d0 vim-patch:8.1.1743: 'hlsearch' and match highlighting in the wrong place
Problem:  'hlsearch' and match highlighting in the wrong place.
Solution: Move highlighting from inside screen functions to highlight.c.

bbca7732e8
2022-03-20 22:01:56 +00:00
3c62a3f9dd vim-patch:8.1.1742: still some match functions in evalfunc.c
Problem:    Still some match functions in evalfunc.c.
Solution:   Move them to highlight.c.

7dfb016d25
2022-03-20 22:01:56 +00:00
6566a4bdbd vim-patch:8.1.1734: the evalfunc.c file is too big
Problem:    The evalfunc.c file is too big.
Solution:   Move some functions to other files.

29b7d7a9aa
2022-03-20 22:01:56 +00:00
809dd65396 docs: regenerate [skip ci] 2022-03-20 18:00:30 +00:00
e7391191e2 Merge pull request #17776 from bfredl/tsconceal
feat(ui): allow conceal to be defined in decorations
2022-03-20 18:59:20 +01:00
af427dedf6 fix(lsp): set tabSize from 'shiftwidth', not 'softtabstop' (#17787)
The use of 'softtabstop' to set tabSize was introduced in 5d5b068,
replacing 'tabstop'.  If we look past the name tabSize and at the actual
purpose of the field, it's the indentation width used when formatting.
This corresponds to the Vim option 'shiftwidth', not 'softtabstop'.
The latter has the comparatively mundane purpose of controlling what
happens when you hit the tab key (and even this is incomplete, as it
fails to account for 'smarttab').
2022-03-20 10:41:46 -07:00
6eca9b69c4 feat(ui): allow conceal to be defined in decorations
Unlike syntax conceal, change highlight of concealed char

Can be used in tree-sitter using "conceal" metadata.
2022-03-20 18:02:41 +01:00
463738938d Merge pull request #17785 from muniter/jl-fix-doxygen-destroyer
docs: properly escape to avoid doxygen weirdness
2022-03-20 10:35:27 -04:00
315858bf67 fix(termdebug): handle exiting during startup properly (#16790)
s:EndTermDebug should only be called when exiting if the debugger started
without error, otherwise the plugin breaks.

Vim handles this by using job_setoptions to set the on_exit callback to
s:EndTermDebug after startup succeeds. However, Nvim does not have such
functionality; instead; use s:starting to mimic this behaviour.

Also, introduce s:running to fix s:CheckGdbRunning; it did not work correctly
due to the "[Process exited X]" message keeping the job's channel alive (though
the stream is closed). This means nvim_get_chan_info cannot be used to check if
the debugger has exited, as it may still return a non-empty dict.
2022-03-20 10:10:01 +00:00
75157d2572 vim-patch:47c532e2bc55 (#17780)
Update runtime files
47c532e2bc
2022-03-20 10:48:10 +01:00
54f15a9e47 Merge pull request #17772 from zeertzjq/vim-8.2.2716
vim-patch:8.2.{2716,4546}: the equivalent class regexp is missing some characters
2022-03-20 12:31:11 +08:00
be35d3c5ad feat(api): remove Lua autocommand callbacks when they return true (#17784)
This copies the semantics of nvim_buf_attach callbacks, and is a
convenient way to create oneshot autocommands gated by some condition.
2022-03-19 18:57:58 -06:00
77eb6f9dc7 fix(api, lua): return NIL on failure to find converted function (#17779) 2022-03-20 08:08:50 +08:00
b1207e5080 docs: properly escape to avoid doxygen weirdness
If this is not properly escaped doxygen 1.9.3 will not work correctly,
and the documentation generated in local machines will differ with what
is generated in CI.
2022-03-19 15:32:18 -05:00
2ab52bd988 refactor(tinput_wait_enqueue): use rbuffer_read() when pasting (#17754)
When pasting, all of key buffer can be consumed, and in case of phase 3
the paste event must be put exactly once, so using rbuffer_read() should
be better here.
2022-03-19 21:56:47 +08:00
536dc391f6 vim-patch:8.2.4593: unnecessary call to redraw_later() (#17775)
Problem:    Unnecessary call to redraw_later().
Solution:   Remove the call to redraw_later() in op_yank(). (closes vim/vim#9971)
95d2e7634c
2022-03-19 20:18:45 +08:00
c4624b9543 vim-patch:8.2.4546: duplicate #undef
Problem:    Duplicate #undef.
Solution:   Remove one #undef. (closes vim/vim#9932)
0a4e098f32
2022-03-19 17:12:29 +08:00
81648fd277 vim-patch:8.2.2716: the equivalent class regexp is missing some characters
Problem:    The equivalent class regexp is missing some characters.
Solution:   Update the list of equivalent characters. (Dominique Pellé,
            closes vim/vim#8029)
0b94e297af

Match upstream's indent in s:equivalence_class().
2022-03-19 17:12:29 +08:00
f2e5f509d9 docs: reword description for nvim_buf_line_count() (#17766)
This adds a few more keywords to make the function easier to find.
2022-03-18 19:58:00 +01:00
e0fe91f6a3 fix(translation): po file for Russian (#17767) 2022-03-18 19:48:20 +01:00
9191401025 ci(docs): add a check for PR's to commit their doc changes
Repurpose the api-docs workflow to also run in all PR's but work only as
a check, if the changes in the PR introduce doc changes that are not
committed fail.

[skip ci]
2022-03-18 13:29:55 -05:00
c2fa3af41f Merge pull request #17719 from dundargoc/doxygen/ex_docmd
refactor(ex_docmd): convert function comments to doxygen format
2022-03-18 19:05:24 +01:00
9e66d27d37 fix(syntax.c): correct hunk from Vim patch 8.0.0647 (#17761) 2022-03-18 21:15:18 +08:00
0a81a33a9d Merge pull request #17694 from lewis6991/fix_signcol
fix(signcol): always trigger a redraw
2022-03-18 11:07:13 +01:00
00effff569 vim-patch:8.1.1693: syntax coloring and highlighting is in one big file (#17721)
Problem:    Syntax coloring and highlighting is in one big file.
Solution:   Move the highlighting to a separate file. (Yegappan Lakshmanan,
            closes vim/vim#4674)

f9cc9f209e

Name the new file highlight_group.c instead.

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-03-18 12:47:08 +08:00
c1b98cfa5e Merge pull request #17459 from rktjmp/lua-error-tostring
feat: __tostring lua errors if possible before showing in messages
2022-03-18 00:57:48 +01:00
cac90d2de7 feat(api, lua): support converting nested Funcref back to LuaRef (#17749) 2022-03-17 20:21:47 +01:00
09a3b33d36 Merge pull request #17747 from bfredl/ui_input
feat(ui_client): input and resize
2022-03-17 20:17:38 +01:00
3c7e937a89 Merge pull request #17266 from famiu/feat/ui/global-statusline
feat(statusline): add global statusline
2022-03-17 20:16:39 +01:00
55b6ade7fe feat(ui_client): implement async paste handling 2022-03-17 19:39:06 +01:00
5ab1229174 feat: add support for global statusline
Ref: #9342

Adds the option to have a single global statusline for the current window at the bottom of the screen instead of a statusline at the bottom of every window. Enabled by setting `laststatus = 3`.

Due to the fact that statuslines at the bottom of windows are removed when global statusline is enabled, horizontal separators are used instead to separate horizontal splits. The horizontal separator character is configurable through the`horiz` item in `'fillchars'`. Separator connector characters are also used to connect the horizontal and vertical separators together, which are also configurable through the `horizup`, `horizdown`, `vertleft`, `vertright` and `verthoriz` items in `fillchars`.

The window separators are highlighted using the `WinSeparator` highlight group, which supersedes `VertSplit` and is linked to `VertSplit` by default in order to maintain backwards compatibility.
2022-03-18 00:21:41 +06:00
c6640d0d70 feat(ui_client): handle resize events 2022-03-17 19:20:20 +01:00
6636160338 feat(ui_client): pass user input to remote server 2022-03-17 19:20:13 +01:00
d238b8f600 chore: fix typos (#17670)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-03-17 13:21:24 +08:00
746a29c580 Merge pull request #17707 from tesaguri/refactor-gen_vimdoc 2022-03-16 16:13:59 -04:00
aeae88f32a Merge pull request #17739 from dundargoc/doxygen/ex_cmds
refactor(ex_cmds): convert function comments to doxygen format
2022-03-16 20:52:40 +01:00
4c7e2ab12e Merge pull request #17741 from dundargoc/doxygen/message
refactor(message): convert function comments to doxygen format
2022-03-16 20:11:43 +01:00
b9c3b617ba Merge pull request #17732 from dundargoc/doxygen/fold
refactor(fold): convert function comments to doxygen format
2022-03-16 19:31:48 +01:00
a41321a8a2 refactor(ex_cmds): convert function comments to doxygen format 2022-03-16 18:32:15 +01:00
4e5e0076cb Merge pull request #17708 from bfredl/ui_client
feat(ui): UI client episode II: event handlers
2022-03-16 16:05:40 +01:00
6435a94d62 refactor(message): convert function comments to doxygen format 2022-03-16 14:06:42 +01:00
1784842899 refactor(ex_docmd): convert function comments to doxygen format 2022-03-16 13:46:14 +01:00
fa79a016bc chore(checkhealth/provider): style fixes (#17738) 2022-03-16 09:46:14 +00:00
33ada232c7 fix(checkhealth): make provider checkhealth output more consistent (#17722)
Change missing provider plugins from errors to warnings for python and
perl. Also give proper advice under the ADVICE section instead of just
the errors.
2022-03-16 09:36:26 +01:00
72ed4a547a refactor(fold): convert function comments to doxygen format 2022-03-16 09:22:19 +01:00
5a8bf31d32 vim-patch:8.2.4571: not all gdb files are recognized (#17727)
Problem:    Not all gdb files are recognized.
Solution:   Add a few more patterns for gdb.
            (closes https://github.com/vim/vim/pull/9956)
8d5e514d77
2022-03-15 22:46:32 +01:00
a1a8cbe9e4 Merge pull request #17731 from dundargoc/doxygen/ex_eval
refactor(ex_eval): convert function comments to doxygen format
2022-03-15 21:18:08 +01:00
f01d203b70 refactor(ui): make auto-generated ui client handlers typesafe 2022-03-15 19:55:34 +01:00
c0b4d931e1 refactor(ui): make ui_client_event_grid_line typesafe 2022-03-15 19:55:34 +01:00
ca23f2ed30 refactor(ui): use "ui_client" instead of "redraw" as general prefix 2022-03-15 19:55:34 +01:00
534edce3c4 feat(ui): invoke ui client handlers 2022-03-15 19:55:34 +01:00
794d2744f3 feat(ui): implement ui_client event handlers 2022-03-15 19:55:34 +01:00
2aa473593f refactor: convert function comments to doxygen format 2022-03-15 19:44:44 +01:00
aa35d15a0d Merge pull request #17709 from seandewar/vim-8.2.4559
vim-patch:8.2.{4555,4559,4568,4569}: make `getmousepos()` return the text column
2022-03-15 11:45:53 +00:00
716df377b4 vim-patch:8.2.4568: getmousepos() does not compute the column below the last line
Problem:    getmousepos() does not compute the column below the last line.
Solution:   Also compute the column when the mouse is below the last line.
            (Sean Dewar, closes vim/vim#9946)
10792feebd

test_setmouse is N/A.
2022-03-15 11:41:13 +00:00
4a8b6bde01 vim-patch:8.2.4559: getmousepos() returns the screen column
Problem:    getmousepos() returns the screen column. (Ernie Rael)
Solution:   Return the text column, as documented.
533870a985

Re-introduce vcol2col, which was removed in 71b1f4e for being unused.
Move it to mouse.c (like in v8.1.2062, which hasn't been ported yet).
2022-03-15 11:41:13 +00:00
6906c5759d vim-patch:8.2.4555: getmousepos() returns the wrong column
Problem:    getmousepos() returns the wrong column. (Ernie Rael)
Solution:   Limit to the text size, not the number of bytes.
986b0fd0c5

test_setmouse is N/A; adjust test for Nvim.

N/A patches for version.c:

vim-patch:8.2.4569: Coverity warning for not using a return value

Problem:    Coverity warning for not using a return value.
Solution:   Add "(void)".
977525fea6
2022-03-15 11:39:38 +00:00
9a9b93c485 Merge pull request #16585 from zeertzjq/lua-paste-eol
vim.paste() fixes
2022-03-15 18:41:03 +08:00
e263afc0e9 fix(paste): escape control characters in Cmdline mode 2022-03-15 18:15:18 +08:00
3470a9c3de test(paste): add tests with virtualedit=onemore 2022-03-15 18:15:18 +08:00
e4ec8d7d50 test(paste): reorganize tests and add tests for linewise Visual mode 2022-03-15 18:15:18 +08:00
a6eafc77ce fix(paste): deal with trailing new line in chunk 2022-03-15 18:15:18 +08:00
fcc6f66cf2 fix(paste): avoid edges cases caused by empty chunk 2022-03-15 18:15:18 +08:00
21ba2d81a8 refactor(paste): do not print dots in cmdline mode 2022-03-15 18:15:18 +08:00
bfb7754442 fix(paste): deal with eol and eof in Visual mode 2022-03-15 18:15:18 +08:00
2601e0873f fix(paste): don't move cursor past the end of pasted text in Normal mode 2022-03-15 18:15:18 +08:00
9b1e1fbc9f fix(paste): use getcmdtype() to determine whether in cmdline mode 2022-03-15 18:15:18 +08:00
bef7552f70 Merge pull request #17725 from zeertzjq/vim-8.2.4566
vim-patch:8.2.4566: check for existing buffer in session file may not work
2022-03-15 10:20:00 +08:00
2ea16f7354 vim-patch:8.2.4566: check for existing buffer in session file may not work
Problem:    Check for existing buffer in session file does not work for files
            in the home directory.
Solution:   Use fnamemodify(). (James Cherti, closes vim/vim#9945)  Add a test.
7d42840033
2022-03-15 08:25:39 +08:00
61126fcc69 Merge pull request #17718 from dundargoc/doxygen/eval_c
refactor(eval): convert function comments to doxygen format
2022-03-14 20:59:57 +01:00
2fbbd3258e Merge pull request #17488 from seandewar/vim-8.2.4428
vim-patch:8.2.{1401,1413,4428,4432,4434,4438,4442,4444,4445,4454}: tabpage patches
2022-03-14 13:55:12 +00:00
378db4f32a refactor(eval): convert function comments to doxygen format 2022-03-14 14:22:58 +01:00
365a9b074f vim-patch:8.2.1413: previous tab page not usable from an Ex command
Problem:    Previous tab page not usable from an Ex command.
Solution:   Add the "#" argument for :tabnext et al. (Yegappan Lakshmanan,
            closes vim/vim#6677)
94f4ffa770

Do not rename old_curtab to prev_tp in win_new_tabpage, this can be confused
with the previous tabpage (`:tabprevious`).

Cherry-pick ex_errmsg from v8.2.1280.
8930caaa1a
2022-03-14 13:10:57 +00:00
c5f190e0c2 vim-patch:8.2.1401: cannot jump to the last used tabpage
Problem:    Cannot jump to the last used tabpage.
Solution:   Add g<Tab> and tabpagnr('#'). (Yegappan Lakshmanan, closes vim/vim#6661,
            neovim #11626)
62a232506d

Nvim implemented this feature before Vim, but Vim made some useful changes (e.g:
beeping on failure). Port the changes to closer match Vim (also makes porting
future patches easier).

Also note that because CHECK_CMDWIN was added to goto_tabpage_tp, there is no
need to do the extra work with tabpage_index and goto_tabpage inside
goto_tabpage_lastused to fix cmdwin issues any more (#11692).
Note that while goto_tabpage_tp doesn't check for textlock like goto_tabpage
does, it shouldn't matter as it is already checked for earlier.

Add tags for <C-Tab> to tabpage.txt, and refer to <C-Tab> over CTRL-Tab to be
consistent with other docs like the patch.
Remove mention of "previous tabpage" (it can be confused with the tabpage to the
left, e.g: `:tabprevious`).
Similarly, don't rename old_curtab to last_tab in enter_tabpage (it might be
confused with the right-most tabpage, e.g: `:tablast`).

Cherry-pick Test_tabpage change from v8.2.0634.
92b83ccfda
2022-03-14 13:10:57 +00:00
7e19c18a54 vim-patch:8.2.4454: resetting cmdwin_type only for one situation
Problem:    Resetting cmdwin_type only for one situation.
Solution:   Reset cmdwin_type before closing windows. (closes vim/vim#9822)
6a8b13614e

Move the check to win_free_all to match Vim.
2022-03-14 13:10:57 +00:00
70582bd925 vim-patch:8.2.4445: exit test fails on MS-Windows anyway
Problem:    Exit test fails on MS-Windows anyway.
Solution:   Skip the test on MS-Windows.
29a9e69718
2022-03-14 13:10:57 +00:00
0412dba456 vim-patch:8.2.4444: beep caused by test
Problem:    Beep caused by test.  ASAN reports leaks.
Solution:   Do not put a NL at the end of the script.  Make the text work on
            MS-Windows.  Do not run the test with ASAN.
68eab67119

The test is skipped, but cherry-pick CheckNotAsan from v8.2.2424 anyway.
97202d9516
2022-03-14 13:10:56 +00:00
fe53182934 vim-patch:8.2.4442: test for error reading input fails on MS-Windows
Problem:    Test for error reading input fails on MS-Windows.
Solution:   Don't run the test on MS-Windows.
70b9e4f4c3
2022-03-14 13:10:56 +00:00
7519af4f0f vim-patch:8.2.4438: crash on exit when using cmdline window
Problem:    Crash on exit when using cmdline window.
Solution:   Reset "cmdwin_type" before exiting. (closes vim/vim#9817)
ca0c1caa36

Bram also went with the cmdwin_type = 0 solution, but putting it in
read_error_exit isn't ideal and only fixes one specific variant of the bug, so
don't port that change.

Port the test only, but skip it as Nvim does not exit after stdin is exhausted.
Using -es instead does exit, but read_error_exit does not run preserve_exit in
that case, and does not have issues exiting even without resetting cmdwin_type.

Note that the test has problems and is fixed in later patches.
2022-03-14 13:10:56 +00:00
490874f3da vim-patch:8.2.4432: cannot use settabvar() while the cmdline window is open
Problem:    Cannot use settabvar() while the cmdline window is open.
Solution:   Only give an error when actually switching tabpage.
            (closes vim/vim#9813)
592f625001
2022-03-14 13:10:56 +00:00
880d3537d0 vim-patch:8.2.4428: crash when switching tabpage while in the cmdline window
Problem:    Crash when switching tabpage while in the cmdline window.
Solution:   Disallow switching tabpage when in the cmdline window.
0f6e28f686

Ensure cmdline window doesn't stop us from closing tabs with EXITFREE.
mem_free_all -> win_free_all -> tabpage_close -> ... -> goto_tabpage_tp
-> CHECK_CMDWIN can cause an infinite loop if Nvim is exited without using
standard methods such as :qa! and friends (e.g: killed via a signal).
This issue had caused the ASAN CI's functionaltests to timeout.

Cherry-pick Test_cmdwin_tabpage from v8.2.4463.
38b85cb4d7
This bug was already fixed in Nvim. Note that g<Tab> inside cmdwin is already
tested for in tabnewentered_spec.lua anyway.

E492 is thrown after E11 when using ":norm" in assert_fails for some reason
(except after v8.2.1919, which isn't ported yet).
As v8.2.1183 isn't ported yet, so we cannot assert E11 directly.
Modify the test to check for E11 and E492 seperately; when v8.2.1183 is ported,
the assertion for E492 will fail and the changes can be reverted to match
upstream.

Remove redundant CHECK_CMDWIN from goto_tabpage; it's handled with text_locked()
and text_locked_msg() above:

vim-patch:8.2.4434: duplicate check for cmdline window

Problem:    Duplicate check for cmdline window.
Solution:   Remove the second check. (Sean Dewar, closes vim/vim#9816)
16b51d26fe
2022-03-14 13:10:20 +00:00
895ca52e4c Merge pull request #17717 from dundargoc/doxygen/eval/funcs
refactor(eval/funcs): convert function comments to doxygen format
2022-03-14 13:38:38 +01:00
4d6863554b refactor(eval/funcs): convert function comments to doxygen format 2022-03-14 13:08:52 +01:00
ecc36c3d1c docs: remove extra whitespaces 2022-03-14 08:16:01 +09:00
be2def4100 chore(gen_vimdoc): fall back to brief_desc_node when desc_node is empty 2022-03-14 07:53:42 +09:00
334a16c791 refactor(gen_vimdoc): simplify files in CONFIG 2022-03-14 07:53:42 +09:00
cf4786ddfa chore(gen_vimdoc): call delete_lines_below only if the file exists
Previously, `delete_lines_below` would raise `FileNotFoundError` when
adding a new file to `CONFIG` and you had to manually write a file with
help tag of the first section as placeholder. This change relieves you
of that need.
2022-03-14 07:53:41 +09:00
2d28c40ef9 refactor(gen_vimdoc): detect section_start_token automatically 2022-03-14 07:53:41 +09:00
6dc2c82931 Merge pull request #17696 from dundargoc/refactor/minimize-scope
refactor: minimize variable scope and eliminate empty declarations
2022-03-13 23:17:57 +01:00
f9f843e02e refactor: use Lua autocommands in filetype.lua (#17711) 2022-03-13 15:52:41 -06:00
198bf3a8f2 refactor: minimize variable scope and eliminate empty declarations 2022-03-13 20:44:53 +01:00
ce537bb232 Merge pull request #17697 from lewis6991/screenrefactor
refactor: column drawing
2022-03-13 23:07:50 +08:00
f3f67da340 refactor: column drawing
- move some logic out of win_line into specific easy to read
  sub-functions.

- remove drawing logic from get_sign_display_info.
2022-03-13 22:41:31 +08:00
6e1caeaf3a vim-patch:8.2.4557: confusing comment about 'cursorlineopt'
Problem:    Confusing comment about 'cursorlineopt'.
Solution:   Adjust comment.  (closes vim/vim#9939)  Add parenthesis around logical
            OR.
754d2b4036
2022-03-13 22:28:37 +08:00
4ba12b3dda refactor: fix clint warnings (#17682) 2022-03-13 22:11:17 +08:00
4ede2ea4b2 test: fix runnvim.sh (#17690) 2022-03-13 22:07:22 +08:00
c45644f994 test(python3_spec): use a pattern to match SyntaxError message (#17705) 2022-03-13 22:05:56 +08:00
9e6bc228ec docs(api): improve section on nvim_set_hl (#17692) 2022-03-13 06:42:12 -06:00
c9b94188d5 Merge pull request #17702 from zeertzjq/vim-8.1.0877
vim-patch:8.1.{0877,0892,1015},8.2.{3759,3762}: quickfix patches
2022-03-13 14:21:37 +08:00
ff48e61ec9 vim-patch:8.2.3762: if quickfix buffer is wiped out getqflist() still returns it
Problem:    If the quickfix buffer is wiped out getqflist() still returns its
            number.
Solution:   Use zero if the buffer is no longer present. (Yegappan Lakshmanan,
            closes vim/vim#9306)
56150da687
2022-03-13 13:17:28 +08:00
c5e47e44aa vim-patch:8.2.3759: quickfix buffer becomes hidden while still in a window
Problem:    Quickfix buffer becomes hidden while still in a window.
Solution:   Check if the closed window is the last window showing the quickfix
            buffer. (Yegappan Lakshmanan, closes vim/vim#9303, closes vim/vim#9300)
78a61068cf
2022-03-13 13:17:28 +08:00
dc32a20503 test(old): add some missing tests from Vim patches 8.1.2320 and 8.1.2360 2022-03-13 13:17:28 +08:00
163ec00f44 vim-patch:8.1.1015: quickfix buffer shows up in list, can't get buffer number
Problem:    Quickfix buffer shows up in list, can't get buffer number.
Solution:   Make the quickfix buffer unlisted when the quickfix window is
            closed.  get the quickfix buffer number with getqflist().
            (Yegappan Lakshmanan, closes vim/vim#4113)
647e24ba3d
2022-03-13 13:17:28 +08:00
6c26ab71ce vim-patch:8.1.0892: failure when closing a window when location list is in use
Problem:    Failure when closing a window when location list is in use.
Solution:   Handle the situation gracefully. Make sure memory for 'switchbuf'
            is not freed at the wrong time. (Yegappan Lakshmanan,
            closes vim/vim#3928)
eeb1b9c7ed
2022-03-13 13:17:28 +08:00
91ac0088e1 vim-patch:8.1.0877: new buffer used every time the quickfix window is opened
Problem:    New buffer used every time the quickfix window is opened.
Solution:   Reuse the buffer. (Yegappan Lakshmanan, closes vim/vim#3902)
ee8188fc74
2022-03-13 13:17:28 +08:00
0cf2dc63bf fix(win_split_ins): do not fail when oldwin is not valid
Ref #14240
2022-03-13 13:17:22 +08:00
d33aebb821 feat(runtime): import cleanadd.vim from Vim (#17699)
Latest version from Vim v7.2a.
Closes https://github.com/neovim/neovim/issues/12875
2022-03-13 04:52:45 +00:00
f291a0339c fix: use normal! <C-L> in default <C-L> mapping (#17695) 2022-03-12 17:56:53 -07:00
356631cba0 Merge pull request #17687 from zeertzjq/fix-channel-consistency
fix(channel): fix channel consistency
2022-03-13 05:44:50 +08:00
36ca585d2f Merge pull request #17691 from bfredl/serverconnect
feat(ui): connect to remote ui (beginning of ui client)
2022-03-12 21:11:37 +01:00
a4400bf8cd feat(ui): connect to remote ui (only debug messages for now)
co-authored-by: hlpr98 <hlpr98@gmail.com>
2022-03-12 19:24:46 +01:00
8ba8f1a018 fix(signcol): always trigger a redraw
Whenever we change the size of the buffer signcol value, always trigger
a redraw.

Fixes: #17693
2022-03-12 16:27:11 +00:00
3a12737e6c refactor(main): separate connection code from --remote execution code 2022-03-12 15:06:53 +01:00
f1c9065b0e test: improve terminal channel tests 2022-03-12 19:23:45 +08:00
5051510ade fix(channel): fix channel consistency
- Fix the problem that chanclose() does not work for channel created by
  nvim_open_term().
- Fix the problem that the loopback channel is not released.
- Fix the error message when sending raw data to the loopback channel.
2022-03-12 19:23:45 +08:00
ab456bc304 vim-patch:8.2.3779: using freed memory when defining a user command recursively (#17688)
Problem:    Using freed memory when defining a user command from a user
            command.
Solution:   Do not use the command pointer after executing the command.
            (closes vim/vim#9318)
205f29c3e9
2022-03-12 08:25:28 +00:00
08d9d74fd9 Merge pull request #17680 from zeertzjq/vim-8.2.4440
vim-patch:8.2.{4440,4443}: crash with specific regexp pattern and string
2022-03-12 08:08:31 +08:00
d4982e152c vim-patch:partial:a2baa73d1d33 (#17675)
Update runtime files.
a2baa73d1d

Cherry-pick tabpage.txt changes from patch 8.2.1413.
Skip digraph functions: included in #17440.
Skip many error codes as they haven't been ported yet.
2022-03-12 06:52:54 +08:00
84af45f59f docs: remove "not in vi" notes (#17678)
[skip ci]
2022-03-11 22:25:59 +00:00
965f1fd6fd Merge pull request #17439 from groves/1750
feat: restore --remote
2022-03-11 19:47:24 +01:00
1201145b68 fix(remote): use STATIC_CSTR_AS_STRING 2022-03-11 13:05:40 -05:00
1dbf8675c7 fix(remote): respect silent in error reporting 2022-03-11 11:16:46 -05:00
2be938a251 fix(remote): report connection error, missing return values 2022-03-11 11:16:46 -05:00
29c3632285 fix(remote): report on missing wait commands, typecheck lua results
Clean up lint errors, too
2022-03-11 11:16:46 -05:00
e095a868cb docs(remote): update remote.txt for current nvim implementation 2022-03-11 11:16:46 -05:00
fcdb1f372b docs(remote): restore remote.txt from removal in f2205b83c5 2022-03-11 11:16:46 -05:00
039e94f491 test(remote): add tests for --remote
This also fixes a fair number of issues found in running the tests
2022-03-11 11:16:46 -05:00
70d2ab1583 fix(remote): make compile again 2022-03-11 11:16:46 -05:00
5862176764 feat(remote): add basic --remote support
This is starting from @geekodour's work at
https://github.com/neovim/neovim/pull/8326
2022-03-11 11:16:46 -05:00
a6e72aa295 vim-patch:8.2.4443: regexp pattern test fails on Mac
Problem:    Regexp pattern test fails on Mac.
Solution:   Do not use a swapfile for the buffer.
2457b2bbc2
2022-03-11 23:01:33 +08:00
d0b5c1f696 vim-patch:8.2.4440: crash with specific regexp pattern and string
Problem:    Crash with specific regexp pattern and string.
Solution:   Stop at the start of the string.
6456fae9ba
2022-03-11 23:01:02 +08:00
76769b8a1f Merge pull request #17673 from dundargoc/refactor/clint
refactor: fix all clint warnings from buffer
2022-03-11 15:23:51 +01:00
c2ab922f0a Merge pull request #17663 from dundargoc/refactor/uncrustify
refactor: apply uncrustify
2022-03-11 15:07:49 +01:00
c3a6ff6aa3 fix(coverity): dead code and operands don't affect result #17662
* fix(coverity/349942): structurally dead code

* fix(coverity/331396): operands don't affect result

* fix(coverity/331393): operands don't affect result

* fix(coverity/331392): operands don't affect result

* fix(coverity/331384): operands don't affect result

* fix(coverity/331374): operands don't affect result

* fix(coverity/331372): operands don't affect result

* fix(coverity/331371): operands don't affect result

* fix(coverity/331364): operands don't affect result

* fix(coverity/105585): operands don't affect result
2022-03-11 15:04:48 +01:00
9ff4acbb36 refactor: fix all clint warnings from buffer.c 2022-03-11 14:47:18 +01:00
19858288b4 Merge pull request #17672 from lewis6991/refactorprovider
refactor(decorations): move provider code
2022-03-11 13:01:33 +01:00
abbc9148db Merge pull request #17665 from clason/bump-libuv
build(deps): bump libuv to 1.44.1
2022-03-10 18:45:12 -05:00
8a5f0559cc Merge pull request #17604 from dundargoc/ci/better-error-output
Better CI error output
2022-03-10 18:42:02 -05:00
4be92ba90d refactor(decorations): unglobal decor_providers
Now all the decoration provider code is in one place, decor_providers no
longer need to be global.
2022-03-10 22:41:21 +00:00
1b054119ec refactor(decorations): move provider code
Move decoration provider code to a separate file.
2022-03-10 22:41:20 +00:00
1e7ba7ea6b build(deps): bump libuv to 1.44.1 2022-03-10 16:48:49 +01:00
6170574d2f Merge pull request #17660 from bfredl/luacomplete
feat(lua): handle lazy submodules in `:lua vim.` wildmenu completion
2022-03-10 15:46:18 +01:00
3a32aa9615 Merge pull request #17671 from zeertzjq/vim-8.2.3949
vim-patch:8.2.{3949,3950}: fix two crashes with /\%V
2022-03-10 20:32:13 +08:00
a80ec88906 test: add a test for #17489 2022-03-10 17:22:39 +08:00
c3208feb72 vim-patch:8.2.3950: going beyond the end of the line with /\%V
Problem:    Going beyond the end of the line with /\%V.
Solution:   Check for valid column in getvcol().
94f3192b03
2022-03-10 17:22:39 +08:00
d2d3be0a4a vim-patch:8.2.3949: using freed memory with /\%V
Problem:    Using freed memory with /\%V.
Solution:   Get the line again after getvvcol().
4c13e5e676
2022-03-10 16:43:27 +08:00
815ba835a3 ci: refactor and simplify CI process 2022-03-10 09:21:41 +01:00
d47714d87c ci: remove function run_suite 2022-03-10 09:21:41 +01:00
7a0fd7a288 ci: remove variable FAIL_SUMMARY
On GitHub Actions it just repeats the summary that is shown just after.
When run outside of GitHub Actions it erroneously shows the summary of
the previous suites.
2022-03-10 09:21:41 +01:00
fbcbd1d05e ci: remove variable NVIM_TEST_CURRENT_SUITE
We always know where in the test we are anyway, it's just needless
repetition.
2022-03-10 09:21:41 +01:00
17ecb60c58 ci: remove fail character from fail function 2022-03-10 09:21:40 +01:00
7e3bdc75e4 refactor(uncrustify): format all c files 2022-03-10 09:14:12 +01:00
d0cb8744d8 refactor(uncrustify): disable uncrustify for misformatted code sections
Uncrustify version 0.74 has a bug that deindents and misformats the
entire fileio.c.
2022-03-10 09:14:12 +01:00
9e9322b222 Merge pull request #17653 from dundargoc/chore/lgtm
fix lgtm warnings
2022-03-10 15:01:02 +08:00
a7b1c8893c chore: fix typos (#17331)
Co-authored-by: Hongyi Lyu <hongyi.lyu95@gmail.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: notomo <notomo.motono@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-03-10 14:34:55 +08:00
487f52c9d2 chore(regexp.c): correctly align META_flags (#17668) 2022-03-10 13:53:57 +08:00
0115b3f023 Merge pull request #16336 from kylo252/vim-8.1.2005
vim-patch:8.1.{2005,2010}: the regexp.c file is too big
2022-03-10 12:49:31 +08:00
d6fe06b0a6 Merge pull request #17666 from zeertzjq/api-statusline-fillchar-relax
feat(api): relax statusline fillchar width check
2022-03-10 10:39:14 +08:00
4fed1bf7e5 vim-patch:8.1.2005: the regexp.c file is too big
Problem:    The regexp.c file is too big.
Solution:   Move the backtracking engine to a separate file. (Yegappan
            Lakshmanan, closes vim/vim#4905)
6d7d7cf750

vim-patch:8.1.2010: new file uses old style comments

Problem:    New file uses old style comments.
Solution:   Change to new style comments. (Yegappan Lakshmanan, closes vim/vim#4910)
9490b9a61c
2022-03-10 10:09:28 +08:00
3011794c86 feat(api): relax statusline fillchar width check
Treat fillchar as single-width even if it isn't.
2022-03-10 07:40:52 +08:00
5ed60804fe feat(lua): handle lazy submodules in :lua vim. wildmenu completion 2022-03-09 15:25:06 +01:00
a978d7689d Merge pull request #17640 from lewis6991/virttextfix
fix(extmarks): fix signs
2022-03-09 13:41:13 +01:00
14859f49ae Merge pull request #17600 from kylo252/clang-format-update
chore: align clang-format configuration with clint
2022-03-09 19:54:30 +08:00
ac91c56085 chore: align clang-format configuration with clint
Some additional tweaks to make clang-format more compatible with
`clint.py` rules.
This is especially useful for range-formatting with `clangd`.
2022-03-09 19:44:03 +08:00
d2d64b1f72 Merge pull request #17643 from dundargoc/chore/remove-stripdecls
chore(stripdecls): remove unused and no longer functional script
2022-03-09 11:41:45 +01:00
c7512611bf Merge pull request #17502 from zeertzjq/vim-8.1.0999
vim-patch:8.1.0999: use register one too often and not properly tested
2022-03-09 16:55:07 +08:00
46a0cec3a6 chore(stripdecls): remove unused and no longer functional script 2022-03-09 09:30:26 +01:00
05f643f9d2 chore(lgtm): fix "empty block without comment" warnings 2022-03-09 09:29:57 +01:00
f27068caad chore(lgtm): ignore "__eq__ not overridden" warning 2022-03-09 09:29:57 +01:00
5ad63c3d98 Merge pull request #16730 from VVKot/vim-8.1.0136
vim-patch:8.1.{136, 139, 164, 300, 672, 748}
2022-03-09 16:13:20 +08:00
b743e415fe vim-patch:partial 1588bc8ebee2 (#17657)
Update runtime files
1588bc8ebe

docs only

skip :argdedupe changes (need v8.2.3888)
skip sound_playfile changes (need +sound)
skip fuzzy-matching changes in *command-attributes* (need #17536)
2022-03-09 08:44:28 +01:00
a681b5eaca vim-patch:partial 1588bc8ebee2 (#17656)
Update runtime files
1588bc8ebe

omit: doc updates
2022-03-09 08:40:16 +01:00
5ac30eacf4 vim-patch:8.1.0999: use register one too often and not properly tested
Problem:    Use register one too often and not properly tested.
Solution:   Do not always use register one when specifying a register.
            (closes vim/vim#4085)  Add more tests.
9d7fdd403a
2022-03-09 13:32:50 +08:00
f6d507f5ba refactor(ops): use op_yank_reg() instead of op_yank() when deleting
Needed for Vim patch 8.1.0999.
2022-03-09 10:02:16 +08:00
ee903e86fd vim-patch:8.1.0748: using sprintf() instead of semsg()
Problem:    Using sprintf() instead of semsg().
Solution:   Use semsg().  Fix bug with E888. (Ozaki Kiichi, closes vim/vim#3801)
1be45b2ea7

vim-patch:8.1.0136: Lua tests don't cover new features

Problem:    Lua tests don't cover new features.
Solution:   Add more tests. (Dominique Pelle, closes vim/vim#3130)
2f362bf7f9

vim-patch:8.1.0139: Lua tests fail on some platforms

Problem:    Lua tests fail on some platforms.
Solution:   Accept a hex number with and without "0x". (Ken Takata,
            closes vim/vim#3137)
a8a60d0c6b

vim-patch:8.1.0164: luaeval('vim.buffer().name') returns an error

Problem:    luaeval('vim.buffer().name') returns an error.
Solution:   Return an empty string. (Dominique Pelle, closes vim/vim#3167)
fe08df452a

vim-patch:8.1.0300: the old window title might be freed twice

Problem:    The old window title might be freed twice. (Dominique Pelle)
Solution:   Do not free "oldtitle" in a signal handler but set a flag to have
            it freed later.
d8f0cef2bd

vim-patch:8.1.0672: the Lua interface doesn't know about v:null

Problem:    The Lua interface doesn't know about v:null.
Solution:   Add Lua support for v:null. (Uji, closes vim/vim#3744)
9067cd6cdf
2022-03-09 09:22:26 +08:00
205b3765f2 Merge pull request #17622 from dundargoc/refactor/clang-tidy/remove-redundant-casts
refactor/clang tidy/remove redundant casts
2022-03-09 08:15:18 +08:00
f33cea4682 Merge pull request #17505 from zeertzjq/vim-8.2.0997
vim-patch:8.2.0997: cannot execute a register containing line continuation
2022-03-09 06:54:35 +08:00
165cf1b48e vim-patch:8.2.0997: cannot execute a register containing line continuation
Problem:    Cannot execute a register containing line continuation.
Solution:   Concatenate lines where needed. (Yegappan Lakshmanan,
            closes vim/vim#6272)
856c1110c1

According to #2542 the "Future:" part was removed intentionally.
Use size_t in more places to reduce type casts.
2022-03-09 06:25:31 +08:00
2ab2af598e fix(extmarks): fix signs
Don't add sign extmarks to state->active. Instead when drawing signs,
perform a full line scan for sign marks. This allows decor_redraw_line
to be moved back inside the `!number_only` block in screen.c, which
prevents decor scans when redrawing the number column when
'relativenumber' is set.

Fixes: #17638
2022-03-08 22:08:57 +00:00
f24121ad96 fix(line continuation): set growsize to correct value (#17655)
Using MAX always sets growsize to 8000, unless ga_len is larger...
2022-03-08 21:38:10 +00:00
4632729459 Merge pull request #17585 from zeertzjq/ci-freebsd-oldtests 2022-03-08 14:42:56 -05:00
4f007a7f65 fix: do not pass aucmd to the callback (#17650) 2022-03-08 16:27:11 +00:00
bce1fd2218 chore(aucmd): remove left-over debug log (#17649) 2022-03-08 12:56:45 +01:00
2783f4cc4a feat(api): autocmd group can be either name or id (#17559)
* feat(api): `group` can be either string or int

This affects the following API functions:
- `vim.api.nvim_create_autocmd`
- `vim.api.nvim_get_autocmds`
- `vim.api.nvim_do_autocmd`

closes #17552

* refactor: add two maps for fast lookups

* fix: delete augroup info from id->name map

When in "stupid_legacy_mode", the value in name->id map would be updated
to `AUGROUP_DELETED`, but the entry would still remain in id->name. This
would create a problem in `augroup_name` function which would return the
name of the augroup instead of `--DELETED--`.

The id->name map is only used for fast loopup in `augroup_name` function
so there's no point in keeping the entry of deleted augroup in it.

Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
2022-03-07 23:15:43 -05:00
3cc48e6273 Merge pull request #17631 from zeertzjq/vim-8.2.4520
vim-patch:8.2.4520: using wrong highlight for cursor line number
2022-03-08 10:54:01 +08:00
2adc24b18b test: add a Lua screen test for CursorLineNr in diff mode
Remove a useless test added in #14190
2022-03-08 10:11:20 +08:00
ec3f93ff88 vim-patch:8.2.4520: using wrong highlight for cursor line number
Problem:    Using wrong highlight for cursor line number.
Solution:   Take filler lines into account when using CursorLineNr.
            (closes vim/vim#9897)
127969cf98
2022-03-08 10:09:22 +08:00
bcda54b30e Merge pull request #17642 from dundargoc/ci/macos/reduce-brew-output
ci(macos): minimize log output from brew update
2022-03-07 18:59:50 -05:00
917dfa510a ci(freebsd): enable oldtests 2022-03-08 07:00:40 +08:00
d15558bfa3 ci(macos): minimize log output from brew update
Also remove perl from brew install to prevent a warning that states it's
already installed.
2022-03-07 23:49:52 +01:00
8bae974da3 build(deps): bump tree-sitter to 0.20.6 (#17587) 2022-03-07 23:48:33 +01:00
c400688752 build(deps): bump libuv to 1.44.0 (#17613) 2022-03-07 22:49:35 +01:00
26e713797b Merge pull request #17635 from dundargoc/ci/freebsd/bump-to-latest 2022-03-07 16:47:14 -05:00
caffee0b67 Merge pull request #17641 from dundargoc/ci/document-jobs 2022-03-07 14:21:36 -05:00
57fee60c76 Merge pull request #17636 from bfredl/luacrash 2022-03-07 14:05:20 -05:00
242183585c ci: document the purpose of some non-obvious jobs 2022-03-07 14:18:11 +01:00
824f24a6b0 ci(freebsd): use image freebsd/latest 2022-03-07 12:21:43 +01:00
147908336e fix(lua): don't use nlua_error when exiting early
Screen state is not initialized yet. Print directly to stderr instead.
2022-03-07 11:04:36 +01:00
c3cc17f0e6 Merge pull request #17621 from bfredl/luaindex
refactor(lua): make vim submodule lazy loading declarative
2022-03-07 11:01:50 +01:00
5f3fff62a8 chore(flake): bump flake (#17632)
it was 6 months old
2022-03-07 10:57:08 +01:00
f39a12d629 refactor(lua): make vim submodule lazy loading declarative
This will allow us to also use the same logic for lua threads and
processes, later.
2022-03-07 09:59:22 +01:00
5760cf87b6 Merge pull request #17626 from dundargoc/ci/openbsd/bump-to-latest
ci(openbsd): use latest image
2022-03-06 20:06:36 -05:00
a7c999523d Merge pull request #17630 from kchibisov/fix-underline-regression
fix(api): highlight attribute for underline
2022-03-06 18:43:02 -05:00
40e3668e54 Merge pull request #17616 from zeertzjq/vim-8.2.3739
vim-patch:8.2.{3739,3745,3920,4060,4513}
2022-03-07 07:10:48 +08:00
194411d18a test: add a test for #17609 2022-03-07 06:43:03 +08:00
0442635a50 test(autochdir_spec): use better patterns 2022-03-07 06:43:03 +08:00
eb70540ff0 vim-patch:8.2.4513: window-local directory is not applied if 'acd' fails
Problem:    Window-local directory is not applied if 'acd' fails.
Solution:   Don't call do_autochdir(). (closes vim/vim#9891)
b29ae15977
2022-03-07 06:43:03 +08:00
8e06377bc6 vim-patch:8.2.4060: win_execute() slow on systems where getcwd()/chdir() is slow
Problem:    win_execute() is slow on systems where getcwd() or chdir() is
            slow. (Rick Howe)
Solution:   Avoid using getcwd() and chdir() if no local directory is used and
            'acd' is not set. (closes vim/vim#9504)
d6f27c66cc
2022-03-07 06:43:03 +08:00
da9bc96152 vim-patch:8.2.3920: restoring directory after using another window is inefficient
Problem:    Restoring directory after using another window is inefficient.
Solution:   Only restore the directory for win_execute().  Apply 'autochdir'
            only when needed.
90c317f224
2022-03-07 06:43:03 +08:00
1a5409db0d vim-patch:8.2.3745: autochdir test fails without the +channel feature
Problem:    Autochdir test fails without the +channel feature.
Solution:   Remove the ch_logfile() call. (Dominique Pellé, closes vim/vim#9281)
f661cee847
2022-03-07 06:43:03 +08:00
8262de0b48 vim-patch:8.2.3739: in wrong directory when using win_execute() with 'acd' set
Problem:    In wrong directory when using win_execute() with 'acd' set.
Solution:   Restore the directory when returning to the window. (closes vim/vim#9276)
dea4a61637
2022-03-07 06:43:03 +08:00
04ae502691 ci(openbsd): use latest image 2022-03-06 23:02:28 +01:00
ff032f2710 refactor: remove redundant casts 2022-03-06 23:02:10 +01:00
918ab6bf00 ci(clint): remove "Unknown NOLINT error category" warning
Clang-tidy also uses "NOLINT" to suppress warnings which causes a
conflict.
2022-03-06 23:02:10 +01:00
8e7446b3cb refactor(signcol): smarter invalidation (#17533)
Previously b_signcols was invalidated whenever a sign was added/removed
or when a buffer line was added/removed.

This change introduces a sentinel linenr_T into the buffer state which
is a line number used to determine the signcolumn. With this
information, we can invalidate the signcolumn less often. Now the
signcolumn is only invalidated when a sign or line at the sentinel line
number is removed.
2022-03-06 22:45:26 +01:00
5400017020 Merge pull request #17628 from jamessan/bsd-gdb
ci(bsd): install gdb to get backtraces from cores
2022-03-06 16:09:39 -05:00
96bb1784a6 fix(api): highlight attribute for underline
This commit fixes regression introduced in c365de1 when checking for
highlight attribute for underline was returning '0' when it was present

Fixes #17624.
2022-03-06 23:51:25 +03:00
0b53645596 test(sr.ht): skip luamod-dev test which crashes nvim 2022-03-06 15:44:54 -05:00
92349b1db0 feat(api): add 'buffer' argument to nvim_get_autocmds (#17594)
This enables retrieving autocommands defined in the given buffers. Under
the hood this simply translates the buffer numbers into '<buffer=%d>'
patterns.
2022-03-06 12:35:14 -07:00
ee1112f1b7 ci(bsd): install gdb to get backtraces from cores 2022-03-06 13:58:21 -05:00
3800615da9 fix(lsp): handle insertion of previous line (#17618) 2022-03-06 07:52:11 -08:00
24d56116f7 Merge pull request #17623 from zeertzjq/lua-editor-mentions
docs(lua): reference runtime/lua/vim/_editor.lua
2022-03-06 23:05:44 +08:00
80e6f81862 docs(lua): reference runtime/lua/vim/_editor.lua 2022-03-06 22:32:22 +08:00
72a04bda90 Merge pull request #16897 from lewis6991/signs
feat(decorations): support signs
2022-03-06 14:09:01 +01:00
8ed9c84481 Merge pull request #17597 from dundargoc/build/cmake/fix-warnings
fix cmake warnings
2022-03-05 15:02:01 -05:00
c365de1d22 Merge pull request #17589 from kchibisov/add-dashed-dotted-underline
Add support for double, dashed, and dotted underlines
2022-03-05 15:00:07 -05:00
d557a45571 Merge pull request #17538 from dundargoc/refactor/bugprone-signed-char-misuse
refactor: fix clang-tidy bugprone-signed-char-misuse warnings
2022-03-05 19:39:36 +01:00
2de4d3c7ac Merge pull request #17603 from bfredl/luaworld
refactor(lua): move only runtime lua file in src/ to runtime/lua
2022-03-05 19:21:34 +01:00
a5e475fcc2 fix(lsp): start incremental sync range at previous newline character (#17610)
This change forces the start of an incremental sync range to begin always on an existing line.
2022-03-05 09:17:56 -08:00
30e4cc3b3f feat(decorations): support signs
Add the following options to extmarks:
  - sign_text
  - sign_hl_group
  - number_hl_group
  - line_hl_group
  - cursorline_hl_group

Note: ranges are unsupported and decorations are only applied to
start_row
2022-03-05 16:51:59 +00:00
7fd1182c62 fix: bounds check for underdot 2022-03-05 19:16:14 +03:00
228ea78622 Merge pull request #17611 from zeertzjq/vim-patch-pr-args
feat(vim-patch.sh): support additional args for -s
2022-03-05 11:04:30 -05:00
fff527b88d test(strcase_save): test overlong UTF8-encoding 2022-03-05 16:40:03 +01:00
0ec92bb463 feat(vim-patch.sh): support additional args for -s
This allows creating a draft vim-patch PR.
2022-03-05 10:12:17 +08:00
4d2744ffe3 refactor: fix clang-tidy bugprone-signed-char-misuse warnings
Prefer to declare variables with correct type instead of explicit casts
wherever possible.
2022-03-04 19:52:41 +01:00
eb4ae060bc build(cmake): remove unused variable CMAKE_CXX_COMPILER to fix warning 2022-03-04 19:21:35 +01:00
186a559818 refactor(lua): move only runtime lua file in src/ to runtime/lua
reorganize so that initialization is done in lua
2022-03-04 19:07:42 +01:00
6379389cbb build(cmake): fix policy warning 2022-03-04 17:16:40 +01:00
83fc914337 Merge pull request #17601 from dundargoc/revert/libuv 2022-03-04 11:04:17 -05:00
f9a8a811c7 revert: "build(deps): bump libuv to 1.43.0+7ae0c95"
This reverts commit 2da9450de5.
2022-03-04 16:24:17 +01:00
6795c9772b fix(syntax): remove trailing spaces in vim.vim 2022-03-04 15:35:44 +03:00
6b6e64dfeb Merge pull request #17598 from dundargoc/ci/reviewer/update-reviewers
ci(reviews): update reviewers
2022-03-04 06:18:14 -05:00
b842f5491f ci(reviews): update reviewers 2022-03-04 11:28:32 +01:00
ead0a5a464 Merge pull request #17596 from zeertzjq/autocmd-comment
chore(autocmd): move comment to the right place
2022-03-04 17:14:52 +08:00
08cf3fb099 chore(autocmd): move comment to the right place 2022-03-04 16:39:55 +08:00
d5bd7ffe51 fix(autocmd): clean up autocmds only when needed (#17593) 2022-03-04 09:25:09 +01:00
4472820182 fix(docs): spelling in new underlines docs 2022-03-04 00:35:51 +03:00
f89fb41a7a feat(tui): add support for CSI 4 : [2,4,5] m
This commit finishes support for colored and styled underlines adding
`CSI 4 : [2,4,5] m` support providing double, dashed, and dotted
underlines

Fixes #17362.
2022-03-03 23:35:36 +03:00
e23af71d35 Merge pull request #17567 from bfredl/preload
refactor(lua): regularize builtin modules, phase 1
2022-03-03 21:00:00 +01:00
f9faba88fd refactor(lua): reorganize builtin modules, phase 1 2022-03-03 20:03:30 +01:00
13cabfedb2 Merge pull request #17568 from groves/respect_os_proc_children_rv 2022-03-03 12:27:37 -05:00
0733f72616 Merge pull request #17564 from dundargoc/ci/freebsd/remove-deprecated-port
ci(freebsd): remove deprecated package sha to fix warning
2022-03-03 10:32:52 -05:00
e8d047df81 Merge pull request #17591 from zeertzjq/vim-8.2.4498
vim-patch:8.2.4498: using <Plug> with "noremap" does not work
2022-03-03 23:18:46 +08:00
ff20d9b106 Merge pull request #17590 from bfredl/cbfree
refactor(autocmd): simplify check for freed callback
2022-03-03 15:41:38 +01:00
e8107f0748 vim-patch:8.2.4498: using <Plug> with "noremap" does not work
Problem:    Using <Plug> with "noremap" does not work.
Solution:   Always remap <Plug>. (closes vim/vim#9879, closes vim/vim#9789)
1fc34225ac
2022-03-03 22:41:09 +08:00
dcd03f5d9d refactor(autocmd): simplify check for freed callback
When a callback is freed the type is always set to kCallbackNone.
2022-03-03 14:29:26 +01:00
7211d8ef21 Merge pull request #17584 from zeertzjq/test-pending-win32
test: use helpers.pending_win32(pending) in buffer_updates_spec
2022-03-03 16:39:24 +08:00
f8b3a1691f test: use helpers.pending_win32(pending) in buffer_updates_spec 2022-03-03 16:07:39 +08:00
f9db491a64 Merge pull request #17583 from zeertzjq/test-old-missing
test(old): add more missing test files and run more tests alone
2022-03-03 13:52:49 +08:00
78bb8c4ee7 test(old): add more missing test files and run more tests alone
Copy four files from Vim v8.2.1432.
Try to match Vim's test_alot.vim.
This marks Vim patch 8.2.0164 as ported:

vim-patch:8.2.0164: test_alot takes too long

Problem:    Test_alot takes too long.
Solution:   Run several tests individually.
842931cd7a
2022-03-03 13:23:08 +08:00
5d6006f9bf feat(diagnostic): add "code" to the diagnostic structure (#17510) 2022-03-02 18:42:27 -07:00
051a0514dc Merge pull request #17579 from zeertzjq/ci-win-fail
ci: show failed message on Windows
2022-03-02 20:21:13 -05:00
f015994a42 Merge pull request #17571 from zeertzjq/pvs-autocmd
Some clang and PVS fixes
2022-03-03 08:25:28 +08:00
1495c4d166 ci: show failed message on Windows 2022-03-03 08:16:31 +08:00
85de9b06ed Merge pull request #17578 from zeertzjq/test-warning-poke
test: mention poke_eventloop() instead of wait()
2022-03-03 06:23:10 +08:00
d477788cd5 fix(lsp): respect all of 'fixeol', 'eol', and 'binary' applying edits (#17574) 2022-03-02 11:33:02 -08:00
482ea0cc17 Merge pull request #17575 from zeertzjq/pty-did-eof
fix(pty_process_win/wait_eof_timer_cb): also check for proc->out.did_eof
2022-03-02 11:57:19 -05:00
ede4eac61f test: mention poke_eventloop() instead of wait() 2022-03-02 22:31:20 +08:00
bc04c3d1ba revert: "ci(windows): skip oldtest on windows until failing tests are fixed"
This reverts commit 07d3fb6e3b.
2022-03-02 21:28:41 +08:00
4154bf9b59 fix(pty_process_win/wait_eof_timer_cb): also check for proc->out.did_eof 2022-03-02 21:28:36 +08:00
0e02a5f109 Merge pull request #17572 from bfredl/testfix
fix(test): only use buffer completion in popupmenu timer test
2022-03-02 10:38:37 +01:00
5ecb2cb539 fix(test): only use buffer completion in popupmenu timer test 2022-03-02 09:15:49 +01:00
3763d7d2d5 refactor(clang): dead assignment buflocal_nr = 0 2022-03-02 15:17:50 +08:00
8ba47a6457 refactor(PVS/V547): aucmd.type == CALLABLE_NONE is always false 2022-03-02 15:14:52 +08:00
22d1b2423f refactor(PVS/V560): ap == NULL is always false 2022-03-02 15:14:11 +08:00
4b3f920477 Merge pull request #16804 from zeertzjq/ui-aucmd-docs
docs: clarify UIEnter and UILeave docs
2022-03-02 15:05:19 +08:00
4c24fcb91f Merge pull request #17570 from zeertzjq/pvs-autocmd-header
chore(PVS): add PVS header to api/autocmd.c
2022-03-02 09:02:28 +08:00
55a189583e chore(PVS): add PVS header to api/autocmd.c 2022-03-02 08:50:15 +08:00
1fdf903911 Merge pull request #17569 from zeertzjq/test-mapping
test: move two mapping tests to ex_cmds/map_spec.lua
2022-03-02 08:45:41 +08:00
9a5a3c699e test: move two mapping tests to ex_cmds/map_spec.lua 2022-03-02 08:15:29 +08:00
045422e4a0 fix: respect os_proc_children rv of pid not found
os_proc_children returns 2 if there's a failure in the underlying
syscall. Only shell out to pgrep in that case.

It returns 1 if the pid isn't found. In that case, we can roll forward
with returning an empty list.
2022-03-01 16:13:23 -05:00
ed1a9c310d fix: enable filetype detection and syntax highlighting with --clean (#17566)
--clean is supposed to emulate a "fresh install" and since Neovim
enables filetype detection and syntax highlighting by default, these
should be enabled when using --clean as well.
2022-03-01 10:47:20 -07:00
770b9f3c3b Merge pull request #17542 from dundargoc/ci/skip-oldtest-on-windows 2022-03-01 11:37:50 -05:00
07d3fb6e3b ci(windows): skip oldtest on windows until failing tests are fixed
The oltests hang on windows, making all CI runs fail.
2022-03-01 17:03:13 +01:00
7737a273b2 ci(freebsd): remove deprecated package sha to fix warning
It's already included by default, no need to replace it.
2022-03-01 15:20:36 +01:00
a7bc3e0f7b Merge pull request #17556 from zeertzjq/remove-unused-k-aucmd-special
refactor: remove unused K_AUCMD_SPECIAL
2022-03-01 13:16:45 +01:00
0a9b00913f Merge pull request #15079 from shadmansaleh/feat/verbose_lua
feat(lua): add :verbose support for lua config
2022-03-01 13:13:11 +01:00
37a86a2f96 fix(api): include event in get_autocmds (#17553) 2022-03-01 09:07:41 +01:00
01139ec82c Merge pull request #17557 from zeertzjq/clarify-plug
docs: clarify actual behavior of <Plug>
2022-03-01 09:44:40 +08:00
0cb9a577ed docs: clarify actual behavior of <Plug> 2022-03-01 09:28:27 +08:00
fed515d9e7 refactor: remove unused K_AUCMD_SPECIAL 2022-03-01 07:32:04 +08:00
cf0266fae1 Merge pull request #17551 from bfredl/lua_autocmd_rebase
feat(lua_autocmd): episode III (the autocmds strike back)
2022-02-28 20:57:24 +01:00
0f613482b3 feat(lua): add missing changes to autocmds lost in the rebase
Note: some of these changes are breaking, like change of API signatures
2022-02-28 19:53:50 +01:00
6732cd9e57 Merge pull request #17529 from seandewar/api-string-oopsie
fix(api): convert blob to NUL-terminated API string
2022-02-28 14:59:52 +01:00
cca08d0f3b Merge pull request #17476 from dundargoc/test/emmylua
test: correct emmylua annotations
2022-02-28 21:21:41 +08:00
7b6ee3ef0a fix: anonymous sid not working 2022-02-28 19:18:49 +06:00
ebfe083337 feat(lua): show proper verbose output for lua configuration
`:verbose` didn't work properly with lua configs (For example:
    options or keymaps are set from lua, just say that they were set
    from lua, doesn't say where they were set at.

This fixes that issue. Now `:verbose` will provide filename and line no
when option/keymap is set from lua.

Changes:
  - compiles lua/vim/keymap.lua as vim/keymap.lua
 - When souring a lua file current_sctx.sc_sid is set to SID_LUA
 - Moved finding scripts SID out of `do_source()` to `get_current_script_id()`.
   So it can be reused for lua files.
 - Added new function `nlua_get_sctx` that extracts current lua scripts
   name and line no with debug library. And creates a sctx for it.
     NOTE: This function ignores C functions and blacklist which
     currently contains only vim/_meta.lua so vim.o/opt wrappers aren't
     targeted.
 - Added function `nlua_set_sctx` that changes provided sctx to current
   lua scripts sctx if a lua file is being executed.
 - Added tests in tests/functional/lua/verbose_spec.lua
 - add primary support for additional types (:autocmd, :function, :syntax) to lua verbose
    Note: These can't yet be directly set from lua but once that's possible
    :verbose should work for them hopefully :D
 - add :verbose support for nvim_exec & nvim_command within lua
    Currently auto commands/commands/functions ... can only be defined
    by nvim_exec/nvim_command this adds support for them. Means if those
    Are defined within lua with vim.cmd/nvim_exec :verbose will show their
    location . Though note it'll show the line no on which nvim_exec call was made.
2022-02-28 19:18:49 +06:00
e383543342 Merge pull request #17544 from r0x0d/update-readme-for-fedora-link
Fix fedora broken link
2022-02-28 09:38:00 +08:00
43c495b183 docs: fix fedora broken link in readme
The link to the neovim fedorapackage.org in the README.md was broken.

Signed-off-by: Rodolfo Olivieri <rodolfo.olivieri3@gmail.com>
2022-02-27 22:19:16 -03:00
fad33b095f Merge pull request #14661 from tjdevries/tjdevries/lua_autocmd_v2
lua: autocmds take 2: electric autoroo
2022-02-28 00:07:31 +01:00
991e472881 feat(lua): add api and lua autocmds 2022-02-27 22:04:55 +01:00
1b5767aa34 feat(lua): add <f-args> to user commands callback (#17522)
Works similar to ex <f-args>. It only splits the arguments if the
command has more than one posible argument. In cases were the command
can only have 1 argument opts.fargs = { opts.args }
2022-02-27 12:35:06 -07:00
c65d93e60a Merge pull request #16969 from shadmansaleh/enhance/ingore_nore_on_plug_keymaps
feat: ignore nore on <Plug> maps
2022-02-27 16:47:55 +01:00
243869658e Merge pull request #17540 from jamessan/luv-bump-fix
ci(lint): use bundled luv until system packages are updated
2022-02-27 09:16:50 -05:00
97ed3effff ci(lint): re-add building of third-party 2022-02-27 09:07:11 -05:00
8d8288461a ci(lint): use bundled luv until system packages are updated 2022-02-27 09:07:11 -05:00
55ab76a1c0 build: bump minimum version of luv to 1.43.0
This is required for the recent addition of lua loop threading
(luv_set_thread).
2022-02-27 09:06:55 -05:00
9d3370a144 vim-patch:c51cf0329809 (#17530)
Update runtime files.
c51cf03298
2022-02-27 11:56:30 +01:00
7dd2b0b79a Merge pull request #17386 from bfredl/neothread
support threads in lua
2022-02-27 09:41:02 +01:00
8bf3a3e303 Merge pull request #17432 from zeertzjq/vim-8.1.2336
vim-patch:8.1.2336,8.2.{4338,4401}: mapping cursor and redrawing patches
2022-02-27 10:51:11 +08:00
c031e038df chore: remove <Plug> detection from vim.keymap 2022-02-27 08:21:21 +06:00
0347875a5c feat: ignore nore on <Plug> maps 2022-02-27 08:21:21 +06:00
84812bcc2c Merge pull request #17531 from dundargoc/refactor/coverity/big-parameter-passed-by-value 2022-02-26 19:41:22 -05:00
e47cdb4268 Merge pull request #17535 from dundargoc/test/ci-fold 2022-02-26 19:39:51 -05:00
24557a7f63 test(ci): remove non-existent ci-fold from tests 2022-02-27 01:02:58 +01:00
525a3a90bc Merge pull request #17525 from lf-/hardcopy-truecolor
feat(hardcopy): check gui colours for highlights first
2022-02-26 23:57:27 +01:00
da89725f34 fix(coverity/175977): big parameter passed by value 2022-02-26 21:46:05 +01:00
c26ef6bcd4 Merge pull request #17532 from dundargoc/ci/add-timeout
ci: add timeout to all jobs
2022-02-26 12:32:37 -05:00
80c3d042ed ci: add timeout to all jobs 2022-02-26 16:57:47 +01:00
f6cc604af2 fix(api): convert blob to NUL-terminated API string
Looks like I did an oopsie; although API strings carry a size field, they should
still be usable as C-strings! (even though they may contain embedded NULs)
2022-02-26 14:18:34 +00:00
850b3e19c9 refactor(lua): cleanup and docs for threads 2022-02-26 15:00:13 +01:00
639ec044b7 Merge pull request #16845 from seandewar/floaty-aucmd-win
fix(aucmd_win): ensure aucmd_win stays floating
2022-02-26 14:53:50 +01:00
4b834a9f7c Merge pull request #17414 from zeertzjq/api-set-cursor-redraw
fix(api): nvim_win_set_cursor() redraw for cursorline and statusline
2022-02-26 14:52:24 +01:00
634c3addd2 Merge pull request #17337 from dundargoc/refactor/pvs/v560
refactor(PVS/V560): part of conditional expression is always true/false
2022-02-26 14:48:12 +01:00
41f309adeb Merge pull request #17527 from zeertzjq/test-pending-win32
test: use helpers.pending_win32(pending) instead of iswin()
2022-02-26 21:17:38 +08:00
acf38245d8 refactor(lua): use references directly on main thread 2022-02-26 14:01:38 +01:00
b87867e69e feat(lua): add proper support of luv threads 2022-02-26 14:01:38 +01:00
d0f8f76224 vim-patch:8.2.4464: Dtrace files are recognized as filetype D (#17518)
Problem:    Dtrace files are recognized as filetype D.
Solution:   Add a pattern for Dtrace files. (Teubel György, closes vim/vim#9841)
            Add some more testing.
4d56b971cb
2022-02-26 14:01:37 +01:00
2703cf95dd Merge pull request #17219 from clason/bump-luvit
build(deps): bump libuv and luv
2022-02-26 14:00:46 +01:00
cfcc40cd48 Merge pull request #17479 from dundargoc/docs/usr04/update-Y-description
docs: update explanation of Y to reflect new defaults
2022-02-26 20:51:47 +08:00
8dd3d40f5c Merge pull request #17472 from lewis6991/signcol_improvements
signcol improvements
2022-02-26 13:37:01 +01:00
0545bd2180 test: use helpers.pending_win32(pending) instead of iswin() 2022-02-26 19:40:11 +08:00
2da9450de5 build(deps): bump libuv to 1.43.0+7ae0c95 2022-02-26 12:06:02 +01:00
b857bc770b build(deps): bump luv to 1.43.0-0 2022-02-26 12:00:45 +01:00
e5b5cbd19c feat(hardcopy): check gui colours for highlights first
Previously, :hardcopy would only use terminal highlight colours, with a
fixed mapping table, despite internally supporting true colour. This
patch looks at the guifg colour first while coming up with the printing
highlight colours, then falls back to the terminal ones.

I have passed through the modec argument in this change because it was
there before, but it could be deleted and hardcoded to 'c' since nobody
sets it to anything else anywhere.
2022-02-25 18:51:16 -08:00
005a7aa167 Merge pull request #17467 from dundargoc/ci/remove-failing-windows
ci: remove failing windows CI tests
2022-02-25 07:10:29 -05:00
81bffbd147 feat: call __tostring on lua errors if possible before reporting to user 2022-02-25 11:17:58 +11:00
9d53791cf8 fix(signcol): update cursor when signcol changes
Fixes #14195
2022-02-24 22:36:00 +00:00
eb6e5d0991 refactor(signcol): store signcol in win_T 2022-02-24 22:36:00 +00:00
e67cd22c38 fix(signcol): handle edge case with maximum value
50250542 failed to consider that the maximum passed to buf_signcols
is window scoped whereas the signcols value is buffer scoped. This can
lead to a bug where the signcolumn becomes incorrect if:
- global signcolumn is set to auto:N
- signcolumn in a window is changed locally to auto:M where M > N
- the buffer has a line with M or greater signs.
2022-02-24 22:35:59 +00:00
fdea15723f feat(filetype): support scripts.vim with filetype.lua (#17517)
When filetype.vim is disabled, create the autocommand that runs
scripts.vim in filetype.lua.
2022-02-24 10:02:17 -07:00
b5bf4877c0 feat(highlight): support for blend in nvim_set_hl (#17516) 2022-02-24 09:50:05 -07:00
73da7cef7b Merge pull request #17390 from RenFraser/feature/packaging
ci: improve cpack packaging
2022-02-24 06:46:07 -05:00
1630ec742d docs: update explanation of Y to reflect new defaults
Closes https://github.com/neovim/neovim/issues/17435
2022-02-24 18:13:44 +08:00
087aad3dcd ci: improved cpack packaging
Addresses: #12571

- Added the following installers through CMake files:
    - Windows NSIS.
    - Windows MSI.
    - Windows zip.
    - MacOs tarball.
    - Linux tarball.
    - Linux Deb package.
- Tweaked pipeline CPack commands to build using new CMakeLists.txt configuration file.
- Added icons and relevant packaging files.
- Updated notes.md to reflect new installation instructions.

This isn't meant to be the perfect solution, it's simply a first pass at using a
simple packaging system to build Windows installers. A Debian package has also
been added since it's very easy but other packages have been left out due to
limiting the scope. Hopefully we can build further upon this and improve it
over time with code signing, better icons and more user-friendly installation
graphics and so on.
2022-02-24 19:54:44 +10:00
15004473b5 fix(api)!: correctly handle negative line numbers for nvim_buf_set_text (#17498)
nvim_buf_set_text does not handle negative row numbers correctly: for
example,

    nvim_buf_set_text(0, -2, 0, -1, 20, {"Hello", "world"})

should replace the 2nd to last line in the buffer with "Hello" and the
first 20 characters of the last line with "world". Instead, it reports
"start_row out of bounds". This happens because when negative line
numbers are used, they are incremented by one additional number to make
the non-negative line numbers end-exclusive. However, the line numbers
for nvim_buf_set_text should be end-inclusive.

In #15181 we handled this for nvim_buf_get_text by adding a new
parameter to `normalize_index`. We can solve the problem with
nvim_buf_set_text by simply availing ourselves of this new argument.

This is a breaking change, but makes the semantics of negative line
numbers much clearer and more obvious (as well as matching
nvim_buf_get_text).

BREAKING CHANGE: Existing usages of nvim_buf_set_text that use negative
line numbers will be off-by-one.
2022-02-23 22:19:47 +00:00
c07b5b5de6 vim-patch:partial 944697ae196 (#17493)
Update runtime files
944697ae19

Doc changes:

Include remote_*() (even though +clientserver and remote.txt isn't ported yet)
Omit screenpos() (need v8.2.4389)
Other changes are N/A or cannot be directly applied
2022-02-23 12:22:18 +00:00
430371da5b refactor(aucmd_win): remove need to restore window layout
There are some places that mess with the window layout in preparation for moving
a window to a different split (win_split_ins called with new_wp != NULL).

This means the window layout can change slightly even if win_split_ins fails.

This is why it was still needed to restore the window layout in
aucmd_{prep,rest}buf even if we disallow win_split_ins from making aucmd_win
non-floating by moving it into a split.

We can just skip messing with the layout in such places if we're dealing with
the aucmd_win.
2022-02-23 00:13:17 +00:00
2deffb5ea8 fix(aucmd_win): ensure aucmd_win stays floating
Nvim uses a floating window for the autocmd window, but in certain situations,
it can be made non-floating (`:wincmd J`), which can cause issues due to the
previous setup and cleanup logic for a non-floating aucmd_win being removed from
aucmd_prepbuf and aucmd_restbuf.

This can cause glitchiness and crashes due to the aucmd_win's frame being
invalid after closing its tabpage, for example.

Ensure aucmd_win cannot be made non-floating. The only place this happens is in
win_split_ins if new_wp != NULL.
2022-02-23 00:09:27 +00:00
11f7aeed7a feat(api): implement nvim_buf_get_text (#15181)
nvim_buf_get_text is the mirror of nvim_buf_set_text. It differs from
nvim_buf_get_lines in that it allows retrieving only portions of lines.

While this can typically be done easily enough by API clients,
implementing this function provides symmetry between the get/set
text/lines APIs, and also provides a nice convenience that saves API
clients the work of having to slice the result of nvim_buf_get_lines
themselves.
2022-02-22 20:19:21 +00:00
30c9c8815b vim-patch:partial 944697ae1968 (#17490)
Update runtime files
944697ae19

skip: docs
skip: translations
2022-02-21 23:01:22 +01:00
10a46a20ce refactor(highlight)!: optional arguments for highlight.range as table (#17462)
also update documentation

BREAKING CHANGE: signature of highlight.range is now
     vim.highlight.range(bufnr, ns, hlgroup, start, finish,
         { regtype = regtype, inclusive = inclusive, priority = priority })

Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2022-02-21 21:21:42 +01:00
1e7cb2dcd9 fix(highlight): accept NONE as a color name (#17487)
... for when `ns=0`.

Also update the documentation of nvim_set_hl to clarify the set
behaviour.

Fixes #17478
2022-02-21 13:17:36 -07:00
fc7fc14bd2 Merge pull request #17484 from dundargoc/ci/skip-ci-on-doc-changes
ci: skip ci workflow on only documentation changes
2022-02-21 06:39:59 -05:00
07a5a85323 ci: skip ci workflow on only documentation changes 2022-02-21 10:12:07 +01:00
726ec7fb17 Merge pull request #17403 from zeertzjq/vim-8.1.1955
vim-patch:8.1.{1846,1955},8.2.0156
2022-02-21 08:02:45 +08:00
aeb390e28f docs: clarify ftdetect scripts loading during packadd (#17465)
The old description doesn't match the current behavior anymore.
2022-02-20 15:58:31 -07:00
9fa46d3fd4 Merge pull request #17480 from zeertzjq/vim-8.2.4427
vim-patch:8.2.4427: getchar() may return modifiers if no character is available
2022-02-21 06:46:59 +08:00
3828fb7ea4 vim-patch:8.2.4427: getchar() may return modifiers if no character is available
Problem:    getchar() may return modifiers if no character is available.
Solution:   Do not process modifiers when there is no character. (closes vim/vim#9806)
ad6c45f625
2022-02-21 06:06:01 +08:00
d80c9b9259 fix(diagnostic): use botright copen for qflist (#17475)
This matches the LSP handlers, and forces the qflist for diagnostics to
span across the horizontal space, below all open windows.
2022-02-20 13:44:14 -08:00
864e51a1dd test: correct emmylua annotations
This will fix the warnings sumneko language server outputs.
2022-02-20 21:14:27 +01:00
6a3acccd8b fix(lsp): use botright copen for all handlers (#17471) 2022-02-20 11:09:01 -08:00
4b3fb4b177 Merge pull request #17469 from jamessan/use-sysdeps-for-lint-ci
Use system dependencies for lint CI
2022-02-20 07:35:35 -05:00
13b13dcaa0 Merge pull request #17470 from dundargoc/ci/remove-success
ci: remove success check since it's the default
2022-02-20 07:34:50 -05:00
4ea8201356 ci: remove success check since it's the default 2022-02-20 13:17:55 +01:00
82c5a02050 ci: skip tests that fail on windows 2022-02-20 10:22:39 +01:00
2550212b25 ci(win): use vswhere to automatically setup required vsdev env vars 2022-02-20 10:18:45 +01:00
921162a4b1 ci: bump Windows image to windows-2019
The VS 2019 CMake generator no longer has different generator types for
different architectures.  Now, the architecture is specified via CMake's
`-A` switch.  However, this requires we also propagate
`${CMAKE_GENERATOR_PLATFORM}` to the bundled deps, so they build for the
same architecture as Nvim.
2022-02-20 10:18:45 +01:00
2446b25c6b ci: only cache third-party deps if they exist 2022-02-19 20:36:29 -05:00
0adbe58bb2 ci: ensure ~/.cache exists 2022-02-19 20:36:29 -05:00
0c4c384ed1 ci(lint): explicity build nvim
“make clint-full” bypasses the normal mechanisms used to communicate
build flags in the CI jobs, so explicitly build nvim before running the
lint jobs.
2022-02-19 20:35:05 -05:00
34cb26011e ci(lint): build against system deps 2022-02-19 20:35:04 -05:00
8cd4c11494 ci(lint): install deps via apt instead of building from third-party 2022-02-19 20:35:04 -05:00
8b3799e2c3 Merge pull request #17460 from seandewar/vim-8.2.4419
vim-patch:8.2.{4403,4418,4419,4422}
2022-02-19 22:59:15 +00:00
439a843b80 vim-patch:8.2.4424: ".gts" and ".gjs" files are not recognized (#17464)
Problem:    ".gts" and ".gjs" files are not recognized.
Solution:   Recognize Glimmer flavored typescript and javascript.
            (closes vim/vim#9799)
cdf717283c
2022-02-19 23:41:11 +01:00
791e400858 fix: lsp and diagnostic highlight priority (#17461)
Closes https://github.com/neovim/neovim/issues/17456

* treesitter uses the default highlight priority of 50
* diagnostic highlights have a priority of 150
* lsp reference highlights have a priority of 200

This ensures proper ordering.
2022-02-19 08:38:14 -08:00
9c04285057 vim-patch:8.2.4422: autochdir test fails on MS-Windows
Problem:    Autochdir test fails on MS-Windows.
Solution:   Expecta nother error on MS-Windows.
adbb383e0f
2022-02-19 15:55:17 +00:00
73cc729dbc vim-patch:8.2.4419: illegal memory access when using 20 highlights
Problem:    Illegal memory access when using exactly 20 highlights.
Solution:   Add one more item in the array. (Brandon Richardson,
            closes vim/vim#9800)
a493b6506b
2022-02-19 15:29:17 +00:00
9f4401897a vim-patch:8.2.4418: crash when using special multi-byte character
Problem:    Crash when using special multi-byte character.
Solution:   Don't use isalpha() for an arbitrary character.
5921aeb574

Rename vim_isalpha to mb_isalpha.
2022-02-19 15:29:17 +00:00
30bf40ec4b vim-patch:8.2.4403: ml_get error with nested folds and deleting lines
Problem:    ml_get error with nested folds and deleting lines.
Solution:   Correct the last line number before calling hasFoldingWin().
9437737833
2022-02-19 15:29:17 +00:00
5cb45dffba Merge pull request #17454 from dundargoc/ci/labeler/test
ci(labeler): change "tests" to "test"
2022-02-18 16:55:41 -05:00
f7803c82d4 ci(labeler): change "tests" to "test" 2022-02-18 20:23:22 +01:00
36362ef0ae vim-patch:8.2.4414: solidity files are not recognized (#17451)
Problem:    Solidity files are not recognized.
Solution:   Add the *.sol pattern. (Dundar Goc, closes vim/vim#9792)
97b231541d
2022-02-18 17:08:43 +01:00
5064ff126d Merge pull request #17200 from lewis6991/_loadfile
refactor(lua): call `loadfile` internally instead of `luaL_loadfile`
2022-02-18 15:05:50 +01:00
720bb5844d Merge pull request #17445 from dundargoc/ci/review/use-checkout 2022-02-18 08:36:45 -05:00
ac480ef6b4 Merge pull request #17404 from dundargoc/ci/put-each-test-in-separate-step
ci: run each test suite in a separate github step
2022-02-18 06:42:32 -05:00
3fb9987eef Merge pull request #17450 from dundargoc/ci/lint/fix-key
ci(lint): simplify cache key
2022-02-18 06:14:53 -05:00
40473e55a2 ci(lint): simplify cache key 2022-02-18 11:50:51 +01:00
adad10284d refactor(lua): call loadfile internally
.. instead of luaL_loadfile

allows files to be cached
2022-02-18 10:39:45 +00:00
8b92d71b30 ci: run each test suite in a separate github step
This should help combat some of the lagginess when looking at the CI
logs in the browser.
2022-02-18 11:36:30 +01:00
faeff49cbf Merge pull request #17449 from zeertzjq/vim-8.2.3659
vim-patch:8.2.{3659,3660,3661}: integer overflow with large line number
2022-02-18 10:15:08 +08:00
62a1290758 vim-patch:8.2.3661: test for put with large count fails
Problem:    Test for put with large count fails.
Solution:   Adjust the counts in the test.
8bc07e800c
2022-02-18 09:48:35 +08:00
330b3da51e vim-patch:8.2.3660: overflow check uses wrong number
Problem:    Overflow check uses wrong number.
Solution:   Divide by ten.
9b0e82f35e
2022-02-18 09:48:32 +08:00
3ed800e998 vim-patch:8.2.3659: integer overflow with large line number
Problem:    Integer overflow with large line number.
Solution:   Check for overflow. (closes vim/vim#9202)
03725c5795

Put E1247 in globals.h as E1240 is also there.
Do not make getdigits() abort.
2022-02-18 09:48:00 +08:00
592f4a7c08 Merge pull request #17433 from seandewar/vim-8.2.3492
vim-patch:8.2.{3492,3493,3570,3573,3574,3575,3577,3601}: put overflow checking shenanigans
2022-02-18 00:09:11 +00:00
1d0e38e42c ci: download reviews.js through checkout instead of wget
This makes testing the workflows much smoother.
2022-02-17 23:30:22 +01:00
df0fae2ff7 Merge pull request #17430 from dundargoc/test/remove-travis 2022-02-17 17:25:58 -05:00
1fd106ca88 vim-patch:8.2.4411: bicep files are not recognized (#17447)
Problem:    Bicep files are not recognized.
Solution:   Match *.bicep files. (Dundar Goc, closes vim/vim#9791)
8e5ba693ad
2022-02-17 23:05:48 +01:00
d1e3d8abd6 Merge pull request #17427 from dundargoc/ci/lint/remove-unnecessary-steps 2022-02-17 16:54:11 -05:00
f3e6cc1a23 test: remove checks to see if current CI job is travis or appveyor 2022-02-17 22:43:48 +01:00
58a55e3889 ci(lint): remove unnecessary steps 2022-02-17 22:38:54 +01:00
387f6a9824 Merge pull request #17442 from dundargoc/ci/refactor/move-reviews 2022-02-17 15:56:47 -05:00
3b5d456d3c Merge pull request #17444 from clason/hl-empty-cterm
fix(api): allow empty list for cterm in nvim_set_hl
2022-02-17 19:37:45 +01:00
e35a2d86fc fix(api): allow empty list for cterm in nvim_set_hl
Problem: when accessing `nvim_set_hl` from Lua, empty tables are converted
to empty lists, not dictionaries, resulting in an error for

    :lua vim.api.nvim_set_hl(0, "Comment", { cterm = {} })

Workaround: add an empty array as a special case when checking
`dict->cterm.type` and just set `cterm_mask_provided`.

(Proper solution: handle this in `gen_api_dispatch.lua`.)
2022-02-17 18:07:11 +01:00
41d0e7af20 vim-patch:8.2.3601: check for overflow in put count does not work well
Problem:    Check for overflow in put count does not work well.
Solution:   Improve the overflow check. (Ozaki Kiichi, closes vim/vim#9102)
fa53722367

Add some casts as Nvim uses size_t variables in some places.

We could technically adjust the logic to check for overflow outside of size_t's
range, but it's much easier to just port the patch exactly (also means we can
use the same tests).

v:sizeoflong is N/A, so convert the 64-bit tests to Lua and use the FFI to check
long's size.
2022-02-17 17:06:16 +00:00
8170260bb3 fix(ops): str_to_reg passing NULL to memcpy
Required for the tests introduced in v8.2.3601 to pass ASAN when running
test_alot.vim.

Co-authored-by: erw7 <erw7.github@gmail.com>
2022-02-17 15:00:32 +00:00
308c1952aa vim-patch:8.2.3577: overflow check fails with 32 ints
Problem:    Overflow check fails with 32 ints.
Solution:   Only test with 64 bit ints.
0f0044125c
2022-02-17 14:45:23 +00:00
6890f8774b vim-patch:8.2.3575: overflow check still fails when sizeof(int) == sizeof(long)
Problem:    Overflow check still fails when sizeof(int) == sizeof(long).
Solution:   Use a float to check the result.
e551ccfb93

This approach is... interesting...

Tests fail.
2022-02-17 14:45:23 +00:00
de8e2c61c1 vim-patch:8.2.3574: divide by zero
Problem:    Divide by zero.
Solution:   Don't check for overflow if multiplicand is zero.
8a1962d135
2022-02-17 14:45:22 +00:00
b149665689 vim-patch:8.2.3573: cannot decide whether to skip test that fails with 64 bit
Problem:    Cannot decide whether to skip test that fails with 64 bit ints.
            (closes vim/vim#9072)
Solution:   Add v:sizeofint, v:sizeoflong and v:sizeofpointer.  Improve the
            check for multiply overflow.
69b3072d98

Omit v:sizeof{int,long,pointer} as they're only really used for tests.
2022-02-17 14:45:22 +00:00
a256b710a2 vim-patch:8.2.3570: Test_very_large_count fails on 32bit systems
Problem:    Test_very_large_count fails on 32bit systems.
Solution:   Bail out when using 32 bit numbers. (closes vim/vim#9072)
ec6e63079d
2022-02-17 14:45:22 +00:00
3fba994de8 vim-patch:8.2.3493: large count test fails on MS-Windows
Problem:    Large count test fails on MS-Windows.
Solution:   Skip the test on MS-Windows.
cddd5ac911
2022-02-17 14:45:21 +00:00
ac5856b3f5 vim-patch:8.2.3492: crash when pasting too many times
Problem:    Crash when pasting too many times.
Solution:   Limit the size to what fits in an int. (closes vim/vim#8962)
eeed1c7ae0

Note that this overflow check pretty bad.
It also doesn't work well on Windows (where sizeof(int) == sizeof(long)).
This is all temporary; everything here is rewritten in future patches anyway.

e_resulting_text_too_long was already cherry-picked.

totlen is size_t in Nvim, but is int in Vim. This means we'll need some casts.

We could technically adjust the logic in do_put to use the entire range of
size_t in stuff like totlen, but there's not much gain, and it's much easier to
just port the patch like Vim as was done before (also allows us to use the same
tests).
2022-02-17 14:45:21 +00:00
b877237612 ci(reviews): move reviews.js to .github/scripts 2022-02-17 14:48:14 +01:00
f4e24f1eab Merge pull request #17421 from lewis6991/hl0_clear
fix(highlight): global ns improvements
2022-02-17 14:07:42 +01:00
9938961fd8 test: add more tests for :*map cursor and redrawing 2022-02-17 10:07:42 +08:00
a92046e43f vim-patch:8.2.4401: map listing does not clear the rest of the command line
Problem:    Map listing does not clear the rest of the command line.
Solution:   Call msg_clear_eos(). (closes vim/vim#5623, closes vim/vim#5962)
d288eaad84
2022-02-17 08:45:15 +08:00
80a3018a09 test: add some tests for :*map <expr>
Add tests for:
 - Cursor position restored after :map expr
 - Cursor position restored after :imap expr
 - Error in :cmap expr handled correctly

Cherry-picked from #12837
2022-02-17 08:45:15 +08:00
2ffe66a5a4 vim-patch:8.2.4338: an error from an expression mapping messes up the display
Problem:    An error from an expression mapping messes up the display.
Solution:   When the expression results in an empty string return K_IGNORE.
            In cmdline mode redraw the command line. (closes vim/vim#9726)
74a0a5b26d
2022-02-17 08:45:14 +08:00
c90cf8c77b vim-patch:8.1.2336: when an expr mapping moves the cursor it is not restored
Problem:    When an expr mapping moves the cursor it is not restored.
Solution:   Position the cursor after an expr mapping. (closes vim/vim#5256)
4ebe0e62d0
2022-02-17 08:44:58 +08:00
3230b31486 Merge pull request #17431 from zeertzjq/vim-8.2.4345
vim-patch:8.2.4345
2022-02-17 06:53:15 +08:00
dc24eeb9fe feat(highlight): support color names for cterm 2022-02-16 22:48:34 +00:00
b94b116236 Merge pull request #17429 from zeertzjq/vim-8.2.4400
vim-patch:8.2.{4392,4394,4400}
2022-02-17 06:33:45 +08:00
7b048df4dc vim-patch:8.2.4345: <amatch> is expanded like a file name for DirChangedPre
Problem:    <amatch> is expanded like a file name for DirChangedPre.
Solution:   Do not expand <amatch>. (closes vim/vim#9742)  Also for the User event.
f6246f51e3
2022-02-17 06:19:10 +08:00
4646ea1079 Merge pull request #17363 from zeertzjq/dirchangedpre
feat(events): add DirChangedPre
2022-02-17 06:07:19 +08:00
9c5228f3e7 vim-patch:8.2.4400: MS-Windows: cannot use the mouse in the console with VIMDLL
Problem:    MS-Windows: cannot use the mouse in the console with VIMDLL.
Solution:   use add_char2buf() instead of fix_input_buffer(). (closes vim/vim#9784,
            closes vim/vim#9769)
646bb7247a

N/A patches for version.c:

vim-patch:8.2.4392: MS-Windows with VIMDLL: Escaping CSI is wrong

Problem:    MS-Windows with VIMDLL: Escaping CSI is wrong.
Solution:   Put back #ifdef. (Ken Takata, closes vim/vim#9769)
64d95cfc56

vim-patch:8.2.4394: UTF8 select mode test fails on MS-Windows

Problem:    UTF8 select mode test fails on MS-Windows.
Solution:   Revert the #ifdef change.
9fdde7992a
2022-02-17 06:02:55 +08:00
876aaf2003 fix(highlight): allow globals to be cleared
- and reduce heap allocations

Fixes #17420
2022-02-16 20:22:09 +00:00
8ab5ec4aaa feat(tree-sitter): allow Atom-style capture fallbacks (#14196)
This allows falling back to `@definition` when we have no mapping
`@definition.fancy-specialization`.

This behavior is described in tree-sitter's documentation
(https://tree-sitter.github.io/tree-sitter/syntax-highlighting#theme).

Fixes https://github.com/nvim-treesitter/nvim-treesitter/issues/738
2022-02-16 19:38:19 +01:00
9fe8d2c9df Merge pull request #16678 from lewis6991/runtime_file_err
fix(api): re-route nvim_get_runtime_file errors
2022-02-16 10:52:38 +01:00
0852644bee Merge pull request #17424 from zeertzjq/map-followup
follow-up PR to #17423
2022-02-16 17:32:37 +08:00
758f1e5999 refactor: remove NULL check that is always true 2022-02-16 17:01:35 +08:00
cc81a8253b docs: minor changes related to mapping description 2022-02-16 16:58:32 +08:00
9a74c2b04a feat(mappings): considering map description when filtering (#17423) 2022-02-16 16:39:50 +08:00
deb33a9775 Merge pull request #17422 from shadmansaleh/enhance/maps
fix: <Nop> not shown in :map commands
2022-02-16 16:01:17 +08:00
07a98b1a75 fix: <Nop> not shown in :map commands 2022-02-16 13:12:46 +06:00
f5518b78c8 chore: improve lua keymaps internal representation scheme 2022-02-16 11:20:10 +06:00
9ef5696132 Merge pull request #17418 from dundargoc/revert/ci/run-functionaltest-on-draft
revert: "ci: run functionaltest-lua on drafts as well"
2022-02-15 19:02:54 -05:00
d512be55a2 fix(api): re-route nvim_get_runtime_file errors
This allows nvim_get_runtime_file to be properly used via pcall
2022-02-15 23:00:28 +00:00
238b944e58 fix(api): validate command names in nvim_add_user_command (#17406)
This uses the same validation used when defining commands with
`:command`.
2022-02-15 13:08:40 -07:00
3449405f38 Merge pull request #17417 from zeertzjq/vim-8.2.4388
vim-patch:8.2.4388: dead code in op_insert()
2022-02-15 21:12:36 +08:00
a2c3d431d6 vim-patch:8.2.4388: dead code in op_insert()
Problem:    Dead code in op_insert().
Solution:   Remove condition and else block. (closes vim/vim#9782)
7745f14ef3
2022-02-15 21:07:01 +08:00
48108975c9 revert: "ci: run functionaltest-lua on drafts as well"
This reverts commit a91a5c1880.
2022-02-15 14:01:06 +01:00
0072a97b2e Merge pull request #17411 from zeertzjq/vim-8.2.3820
vim-patch:8.2.{3820,3823}: "vrc" does not replace composing characters
2022-02-15 20:36:01 +08:00
8cc881e4f4 Merge pull request #17412 from zeertzjq/vim-8.2.4154
vim-patch:8.2.4154: ml_get error when exchanging windows in Visual mode
2022-02-15 20:35:48 +08:00
e29ba986f5 Merge pull request #17409 from dundargoc/ci/disable-sync
ci(labeler): disable sync that interferes with other jobs
2022-02-15 06:15:15 -05:00
89bff49570 Merge pull request #17405 from dundargoc/ci/add-more-reviewers
ci: add more reviewers
2022-02-15 06:10:41 -05:00
f92e74900f fix(api): nvim_win_set_cursor() redraw for cursorline and statusline 2022-02-15 11:53:12 +08:00
6eec30ccfc vim-patch:8.2.4154: ml_get error when exchanging windows in Visual mode
Problem:    ml_get error when exchanging windows in Visual mode.
Solution:   Correct end of Visual area when entering another buffer.
05b2761548
2022-02-15 10:26:39 +08:00
8f3e56ed3a vim-patch:8.2.3820: "vrc" does not replace composing characters
Problem:    "vrc" does not replace composing characters, while "rc" does.
Solution:   Check the byte length including composing characters.
            (closes vim/vim#9351)
8ee6028de3

vim-patch:8.2.3823: test for visual replace is in wrong function

Problem:    Test for visual replace is in wrong function.
Solution:   Move it to another function.
6ecf58b0d7
2022-02-15 09:35:43 +08:00
1bd6c0a05c Merge pull request #17410 from zeertzjq/test-old-reorder
test(old): reorder test_functions.vim and test_visual.vim to match Vim
2022-02-15 09:25:57 +08:00
9f9ef3e21d test(old): reorder test_functions.vim and test_visual.vim to match Vim 2022-02-15 08:59:46 +08:00
edc5554fc4 Merge pull request #17402 from seandewar/vim-8.2.4120
vim-patch:8.2.{3073,4120,4151,4152}
2022-02-15 00:30:05 +00:00
8051fa1aff Merge pull request #17394 from zeertzjq/vim-8.2.4343
vim-patch:8.2.4343: when reloading not all properties are detected
2022-02-15 08:10:21 +08:00
5aed2e9f27 ci(labeler): disable sync that interferes with other jobs 2022-02-14 21:16:36 +01:00
51cc5c5654 ci: add more reviewers 2022-02-14 18:58:10 +01:00
2b75ac7aa9 vim-patch:8.2.4152: block insert with double wide character fails
Problem:    Block insert with double wide character fails.
Solution:   Adjust the expected output.
fc6ccebea6
2022-02-14 17:29:49 +00:00
afbed8cb75 vim-patch:8.2.4151: reading beyond the end of a line
Problem:    Reading beyond the end of a line.
Solution:   For block insert only use the offset for correcting the length.
57df9e8a9f
2022-02-14 17:29:49 +00:00
e662d86e8d vim-patch:8.2.4120: block insert goes over the end of the line
Problem:    Block insert goes over the end of the line.
Solution:   Handle invalid byte better.  Fix inserting the wrong text.
9f8c304c8a
2022-02-14 17:29:49 +00:00
f8b75e5822 vim-patch:8.2.3073: when cursor is move for block append wrong text is inserted
Problem:    When cursor is move for block append wrong text is inserted.
Solution:   Calculate an offset. (Christian Brabandt, closes vim/vim#8433,
            closes vim/vim#8288)
4067bd3604
2022-02-14 17:29:48 +00:00
d5d51308c0 test(old): cherry-pick test_visual changes from v8.2.2945
59b262362f
2022-02-14 17:29:45 +00:00
b7e6c1b525 test(old): cherry-pick test_visual changes from v8.2.2901
3e72dcad8b
2022-02-14 17:29:41 +00:00
abf42b7ec6 test(old): cherry-pick test_visual changes from v8.2.0369
1671f44881

Omit Test_AAA_start_visual_mode_with_count comment change as it hasn't been
ported yet.
2022-02-14 17:29:35 +00:00
758d7726df Merge pull request #17399 from zeertzjq/ci-review-script 2022-02-14 11:30:39 -05:00
dcefd48c1b vim-patch:8.2.0156: various typos in source files and tests
Problem:    Various typos in source files and tests.
Solution:   Fix the typos. (Emir Sari, closes vim/vim#5532)
4b96df5a01
2022-02-14 18:56:30 +08:00
c9b46f154b vim-patch:8.1.1955: tests contain typos
Problem:    Tests contain typos.
Solution:   Correct the typos. (Dominique Pelle)
1bc353b6f1

Other changes are either N/A or already applied.
2022-02-14 18:56:30 +08:00
8a80ab27bd vim-patch:8.1.1846: inconsistently using GetVimCommand() and v:progpath
Problem:    Inconsistently using GetVimCommand() and v:progpath. (Daniel
            Hahler)
Solution:   Use GetVimCommand(). (closes vim/vim#4806)
93344c2d70

Cherry-pick a change to test_profile.vim from patch 8.1.1544.
Cherry-pick a change to test_vimscript.vim from patch 8.1.1826.

Some of the args are no-op in Nvim, and `-i NONE` and `--headless` are
already added by `GetVimCommand()`. I'll try to match the order of args
in upstream, substituting `--not-a-term` with `--headless`.
2022-02-14 18:56:30 +08:00
5220891571 vim-patch:8.2.4343: when reloading not all properties are detected
Problem:    When reloading not all properties are detected.
Solution:   Add the "edit" value to v:fcs_choice. (Rob Pilling, closes vim/vim#9579)
8196e94a8b

Cherry-pick some test changes from patch 8.1.1826.
2022-02-14 11:35:25 +08:00
29eabbcd07 ci: use a separate script for request review workflow 2022-02-14 07:47:10 +08:00
2ed6b99a42 refactor(PVS/V560): part of conditional expression is always true/false 2022-02-13 17:51:48 +01:00
046950f630 Merge pull request #17154 from neovim/marvim/api-doc-update/master
docs: regenerate [skip ci]
2022-02-13 09:25:05 -05:00
5d6bef0f6e Merge pull request #17374 from zeertzjq/vim-8.2.3510
vim-patch:8.2.{3510,3512,3514,3515,3534}: nanosecond timestamp change detection
2022-02-13 21:58:36 +08:00
45e666fb92 docs: regenerate [skip ci] 2022-02-13 13:44:51 +00:00
e481901748 docs: treesitter.txt - fix overflowing lines, document minimum_language_version (#17286) 2022-02-13 14:43:25 +01:00
c5f5c0d4da Merge pull request #17392 from zeertzjq/ci-review-open-only
ci: only request review on open non-draft PRs
2022-02-13 08:42:47 -05:00
b2606673cc vim-patch:8.2.3534: autoread test is a bit flaky
Problem:    Autoread test is a bit flaky.
Solution:   Wait a brief moment before overwriting the file.
944eeb44fb
2022-02-13 21:33:28 +08:00
0f1c705936 vim-patch:8.2.3515: nano time test fails on Mac and FreeBSD
Problem:    Nano time test fails on Mac and FreeBSD.
Solution:   Also check nano time when not on Linux. (Ozaki Kiichi,
            closes vim/vim#9000)
def69dffb3
2022-02-13 21:33:28 +08:00
21283aa445 vim-patch:8.2.3514: autoread test with nano second time sometimes fails
Problem:    Autoread test with nano second time sometimes fails.
Solution:   Mark the test as being flaky.
eaa006dae3
2022-02-13 21:33:28 +08:00
bad22bd656 vim-patch:8.2.3512: timestamp test fails on some systems
Problem:    Timestamp test fails on some systems.
Solution:   Sleep for a short while.
accf4ed352
2022-02-13 21:33:28 +08:00
03348e5b9d vim-patch:8.2.3510: changes are only detected with one second accuracy
Problem:    Changes are only detected with one second accuracy.
Solution:   Use the nanosecond time if possible.  (Leah Neukirchen,
            closes vim/vim#8873, closes vim/vim#8875)
0a7984af56

In Nvim Test_checktime_fast() is also flaky. Add a delay to avoid that.
2022-02-13 21:33:28 +08:00
1be9549e6b ci: only request review on open non-draft PRs 2022-02-13 19:17:18 +08:00
1b73ae653f Merge pull request #16914 from godlygeek/fix_14587
fix(screen): don't put empty sign text in line number column
2022-02-13 11:41:17 +01:00
2c4efc0347 Merge pull request #17380 from dundargoc/ci/labeler/add-filetype-label
ci(labeler): add filetype label if filetype.lua has changed
2022-02-13 11:11:43 +01:00
f378df846c Merge pull request #17375 from shadmansaleh/fix/vim.g/autoload
fix: autoload variables not loaded with vim.g & nvim_get_var
2022-02-13 10:32:32 +01:00
6f5fae08a3 Merge pull request #17389 from zeertzjq/restore-oldtests
test(old): add test_cdo.vim and test_packadd.vim
2022-02-13 11:37:49 +08:00
b16fae0f26 test(old): add test_cdo.vim and test_packadd.vim
test_cdo.vim is copied from Vim v8.1.1483.
test_packadd.vim is copied from Vim v8.2.0174.
2022-02-13 10:26:11 +08:00
a87eb896a5 Merge pull request #17388 from zeertzjq/test-assert
test(old): move some tests from assert_spec.lua to test_assert.vim
2022-02-13 10:07:09 +08:00
2a6a93b665 test(old): move some tests from assert_spec.lua to test_assert.vim 2022-02-13 09:23:20 +08:00
7a7ac004f0 Merge pull request #17385 from seandewar/vim-8.2.4359
vim-patch:8.2.{4359,4362,4363,4364}: crash when repeatedly using :retab
2022-02-12 22:51:13 +00:00
5c62bce7c1 vim-patch:8.2.4364: MS-Windows: still running out of memory for a very long line
Problem:    MS-Windows: still running out of memory for a very long line.
Solution:   Check for negative length.
4549166078
2022-02-12 22:25:39 +00:00
05f744cfc7 Merge pull request #16643 from zeertzjq/vim-8.1.2184
vim-patch:8.1.2184,8.2.3804: option context is not copied when splitting a window
2022-02-13 06:13:18 +08:00
dc415ce298 vim-patch:8.1.2184: option context is not copied when splitting a window
Problem:    Option context is not copied when splitting a window. (Daniel
            Hahler)
Solution:   Copy the option context, so that ":verbose set" works.
            (closes vim/vim#5066)
cfb381421f

vim-patch:8.2.3804: script context not set when copying 'swf' and 'ts'

Problem:    Script context not set when copying 'swf' and 'ts'.
Solution:   Use COPY_OPT_SCTX with the right argument. (closes vim/vim#9347)
6206877c51
2022-02-13 05:40:13 +08:00
72e3d2c9ba vim-patch:8.2.4363: MS-Windows: running out of memory for a very long line
Problem:    MS-Windows: running out of memory for a very long line.
Solution:   Use a 32 bit value for MAXCOL also when ints are 64 bits.
8e38555ece

This still fails Vim's Windows CI, so let's see what happens...
2022-02-12 21:38:00 +00:00
90a43e846d Merge pull request #17382 from zeertzjq/vim-8.2.2342
vim-patch:8.2.2342: "char" functions may return wrong column in Insert mode
2022-02-13 05:26:15 +08:00
700af0ab1d vim-patch:8.2.4362: :retab may allocate too much memory
Problem:    :retab may allocate too much memory.
Solution:   Bail out when allocating more than MAXCOL bytes.
33f3c59854
2022-02-12 21:23:06 +00:00
f292dd2126 fix: autoload variables not loaded with vim.g & nvim_get_var 2022-02-13 01:23:23 +06:00
f89f4b1e12 Merge pull request #17379 from clason/vim-8.2.4352
vim-patch:8.2.4352: ReScript files are not recognized
2022-02-12 20:10:26 +01:00
1b0d6bcd53 vim-patch:8.2.4359: crash when repeatedly using :retab
Problem:    crash when repeatedly using :retab.
Solution:   Bail out when the line is getting too long.
6e28703a8e

Cherry-pick e_resulting_text_too_long from v8.2.3492; put it in globals.h as
it will eventually be used in other files.

Add a modeline to test_retab.vim
2022-02-12 18:52:34 +00:00
05c3d02380 Merge pull request #17383 from lewis6991/sign_eff
refactor(signs): more efficient signcol calc
2022-02-12 19:40:44 +01:00
50250542c3 refactor(signs): more efficient signcol calc
When iterating signs to calculate the sign column, stop iterating when
we reach the maximum configured from 'signcolumn'.
2022-02-12 17:56:39 +00:00
7db0aa027c Merge pull request #17381 from zeertzjq/vim-8.2.0580
vim-patch:8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
2022-02-12 21:48:20 +08:00
12eca76e2c ci(labeler): add filetype label if any filetype files have changed 2022-02-12 14:32:42 +01:00
ed169d8997 vim-patch:8.2.2342: "char" functions may return wrong column in Insert mode
Problem:    "char" functions return the wront column in Insert mode when the
            cursor is beyond the end of the line.
Solution:   Compute the column correctly. (Yegappan Lakshmanan, closes vim/vim#7669)
9145846b6a
2022-02-12 21:30:28 +08:00
c23ec9d86e vim-patch:8.2.0580: window size wrong if 'ea' is off and 'splitright' is on
Problem:    Window size wrong if 'ea' is off and 'splitright' is on and
            splitting then closing a window.
Solution:   Put abandoned window space in the right place. (Mark Waggoner)
edd327cc07
2022-02-12 21:19:39 +08:00
a1f34b2481 Merge pull request #17377 from clason/keyset-more
feat(highlight): add strikethrough, nocombine to `nvim_set_hl`
2022-02-12 14:05:12 +01:00
cc9d08069a Merge pull request #17269 from seandewar/vim-8.2.0915
vim-patch:8.2.{0915,0918,0922,4355}
2022-02-12 12:28:28 +00:00
e126fbc971 Merge pull request #17376 from dundargoc/ci/reviews/upgrade-to-v6
ci(reviews): upgrade github-script version to v6
2022-02-12 07:09:43 -05:00
dd2c0a7d33 Merge pull request #17371 from dundargoc/revert/continue-on-error
revert: "ci: use continue-on-error instead of "|| true""
2022-02-12 07:08:57 -05:00
db06fb47b9 vim-patch:8.2.0922: search test fails
Problem:    Search test fails.
Solution:   Remove failure tests for calls that no longer fail.
48af321a33
2022-02-12 12:01:30 +00:00
0511a31ca2 vim-patch:8.2.0918: duplicate code for evaluating expression argument
Problem:    Duplicate code for evaluating expression argument.
Solution:   Merge the code and make the use more flexible.
a9c0104947
2022-02-12 12:01:29 +00:00
cdb2c10011 vim-patch:8.2.0915: search() cannot skip over matches like searchpair() can
Problem:    Search() cannot skip over matches like searchpair() can.
Solution:   Add an optional "skip" argument. (Christian Brabandt, closes vim/vim#861)
adc17a5f9d

Enable skip arg usage in autoload/freebasic.vim

evalarg_T doesn't really matter because it's deleted in v8.2.0918 (and
reincarnated for Vim9 script in v8.2.1047), but I found out too late :P Anyway:

- Port evalarg_T into eval.h and use const char * and Callback fields
- Use EVALARG_INIT to initialize
- Return bool over OK/FAIL from evalarg functions
- Remove check from evalarg_clean as callback_free ignores None callbacks anyway
- Move eva_buf field into evalarg_get as a local (not sure what reason it has
  being in the struct)

N/A patches for version.c:

vim-patch:8.2.4355: unnecessary call to check_colorcolumn()

Problem:    Unnecessary call to check_colorcolumn().
Solution:   Remove the call. (Sean Dewar, closes vim/vim#9748)
0f7ff851cb
2022-02-12 12:00:36 +00:00
cb18545253 feat(api): add strikethrough, nocombine to set_hl 2022-02-12 12:05:41 +01:00
3b13c7fc8b vim-patch:8.2.4352: ReScript files are not recognized
Problem:    ReScript files are not recognized.
Solution:   Add the *.res and *.resi patterns. (Ananda Umamil, closes vim/vim#9752)
0c3cc2fec3
2022-02-12 12:04:09 +01:00
f052e0bd11 ci(reviews): upgrade github-script version to v6 2022-02-12 11:20:00 +01:00
0c901baee1 revert: "ci: use continue-on-error instead of "|| true""
This reverts commit 559aa4179c.

I mistakenly believed both ways of writing were equivalent; this is
untrue. Setting continue-on-error to true will make the job pass, but
an error annotation will still be created which is misleading since it's
not actually an error.
2022-02-12 11:03:32 +01:00
a7321e37a7 Merge pull request #17370 from dundargoc/ci/fix-reviews-workflow
ci: fix reviews workflow by sending an artifact with PR number
2022-02-11 20:35:54 -05:00
f6485e9446 Merge pull request #16841 from zeertzjq/vim-8.1.2073
vim-patch:8.1.2073: when editing a buffer 'colorcolumn' may not work
2022-02-12 07:49:09 +08:00
4ca522fd02 test: convert some colorcolumn tests to Lua screen tests 2022-02-12 06:36:17 +08:00
612696bedc vim-patch:8.1.2073: when editing a buffer 'colorcolumn' may not work
Problem:    When editing a buffer 'colorcolumn' may not work.
Solution:   Set the buffer before copying option values. Call
            check_colorcolumn() after copying window options.
010ee9657a
2022-02-12 06:36:17 +08:00
906182065b Merge pull request #17325 from glacambre/stdioopen_doc 2022-02-11 16:21:16 -05:00
46e0f635da Merge pull request #17372 from dundargoc/ci/commitlint/fix-revert-bug 2022-02-11 16:16:37 -05:00
f50a9a4288 ci(commitlint): allow first non-space character to be a quote 2022-02-11 20:02:50 +01:00
8090753880 docs(stdioopen): add missing documentation for on_print param
This commit adds documentation for the feature introduced in #15910.
2022-02-11 19:18:47 +01:00
e3c09cb9ed Merge pull request #17284 from dundargoc/ci/reduce-noise 2022-02-11 11:12:49 -05:00
c373226ee7 ci: disable tracing (set -x) from the shell scripts 2022-02-11 16:53:34 +01:00
4761dd4fc2 Merge pull request #17365 from kevinhwang91/fix-ts-empty-lines
fix(query.lua): check empty table for lines
2022-02-11 15:19:19 +01:00
e957697334 ci: fix reviews workflow by sending an artifact with PR number 2022-02-11 15:12:41 +01:00
f6329ea137 fix(lsp): correct prefix when filterText is present (#17051)
LSP server might return an item which would replace a token to another.
For example in typescript for a `jest.Mock` object `getProductsMock.`
text I get the following response:
```
{
    commitCharacters = {
        ".",
        ",",
        "("
    },
    data = {
        entryNames = {
            "Symbol"
        },
        file = "/foo/bar/baz.service.spec.ts",
        line = 268,
        offset = 17
    },
    filterText = ".Symbol",
    kind = 6,
    label = "Symbol",
    sortText = "11",
    textEdit = {
        newText = "[Symbol]",
        range = {
            end = {
                character = 16,
                line = 267
            },
            start = {
                character = 15,
                line = 267
            }
        }
    }
},
```

In `lsp.omnifunc` to get a `prefix` we call the `adjust_start_col` which
then returns the `textEdit.range.start.character`.
Th `prefix` then be the `.` character. Then when filter the items with
`remove_unmatch_completion_items`, every item will be filtered out,
since no completion word starts `.`.

To fix we return the `end.character`, which in that particular case will
be the position after the `.`.
2022-02-11 14:04:15 +01:00
b981c231e2 Merge pull request #17368 from zeertzjq/test-filechanged-dialog
test: convert Test_file_changed_dialog() to Lua functional test
2022-02-11 21:02:27 +08:00
58d81efcb2 fix: append test for checking zero width node range 2022-02-11 20:59:47 +08:00
5546492c44 test: convert Test_file_changed_dialog() to Lua functional test 2022-02-11 20:37:20 +08:00
2db0a52074 Merge pull request #17360 from lewis6991/fix-window-close
fix: close floating windows when calling win_close()
2022-02-11 10:37:13 +01:00
afcf64479c fix(query.lua): check empty table for lines
The range of node may make `nvim_buf_get_lines` return an empty table.
2022-02-11 14:44:37 +08:00
059d36e326 feat(events): add DirChangedPre
In Nvim, like DirChanged, this also triggers when switching windows.

This marks Vim patch 8.2.4335 as ported.

vim-patch:8.2.4335: no autocommand event triggered before changing directory

Problem:    No autocommand event triggered before changing directory. (Ronnie
            Magatti)
Solution:   Add DirChangedPre. (closes vim/vim#9721)
28e8f73ae2
2022-02-11 12:55:58 +08:00
851252f79d Merge pull request #17012 from EdmundsEcho/fix-checkhealth
prevent checkhealth failure when plugin's check returns void
2022-02-11 05:50:49 +08:00
38bf52821a Merge pull request #17353 from zeertzjq/api-changedir-func
fix(api): use changedir_func() in nvim_set_current_dir()
2022-02-11 03:55:32 +08:00
4d59318ecb Merge pull request #17359 from dundargoc/ci/update-reviewers-on-manual-labeling 2022-02-10 12:31:24 -05:00
b0bcbb08a9 ci: add reviewers if labels are manually added after PR creation 2022-02-10 18:06:36 +01:00
c2ec3664e0 Merge pull request #17322 from dundargoc/ci/simplify-ci-process 2022-02-10 10:54:34 -05:00
85ae04dbfd fix: close floating windows when calling win_close() 2022-02-10 15:26:40 +00:00
a73360a09a Merge pull request #16868 from zeertzjq/vim-8.1.2221
vim-patch:8.1.2221,8.2.4336: filtering for :disp and :scriptnames
2022-02-10 21:04:41 +08:00
2c5382aafa ci: remove function run_test 2022-02-10 09:43:51 +01:00
2f3fb53dbd ci: remove meta-suite "tests" 2022-02-10 09:43:51 +01:00
357234865b ci: remove continue flag from exit_suite since it's always needed 2022-02-10 09:43:51 +01:00
b8529ea9b8 ci: run all tests with run_suite function 2022-02-10 09:43:51 +01:00
3b4bf88710 Merge pull request #17355 from zeertzjq/test-screenpos
test(old): comment out WinBar instead of skipping Test_screenpos()
2022-02-10 14:46:45 +08:00
de328de35b test(old): comment out WinBar instead of skipping Test_screenpos() 2022-02-10 14:06:48 +08:00
23c3f7f572 fix(api): use changedir_func() in nvim_set_current_dir()
Co-Authored-By: smolck <46855713+smolck@users.noreply.github.com>
2022-02-10 09:45:20 +08:00
dba1df6359 Merge pull request #17349 from dundargoc/ci/add-more-reviewers-from-label
ci: add more reviewers based on label
2022-02-09 18:44:01 -05:00
c415e764d4 vim-patch:8.2.4336: using :filter for :scriptnames does not work
Problem:    Using :filter for :scriptnames does not work. (Ben Jackson)
Solution:   Call message_filtered(). (closes vim/vim#9720)
769f5895eb

Cherry-pick a modeline from Vim patch 8.2.1432.
2022-02-10 07:28:54 +08:00
aea889fc06 vim-patch:8.1.2221: cannot filter :disp output
Problem:    Cannot filter :disp output.
Solution:   Support filtereing :disp output. (Andi Massimino, closes vim/vim#5117)
8fc4296436
2022-02-10 07:28:54 +08:00
90f2a851c7 Merge pull request #17342 from zeertzjq/mbyte-const
refactor(mbyte.c): add const qualifiers
2022-02-10 05:10:05 +08:00
aff0ddd784 vim-patch:8.2.4337: part of condition is always true (#17352)
Problem:    Part of condition is always true.
Solution:   Remove that part of the condition. (closes vim/vim#9729)
78a8404f8b
2022-02-09 17:55:01 +00:00
9b0b4829c7 Merge pull request #17345 from zeertzjq/vim-8.2.4329
vim-patch:8.2.4329: no support for end line number and column in 'errorformat'
2022-02-09 21:02:37 +08:00
60e3940b4a Merge pull request #17346 from zeertzjq/vim-8.2.4242
vim-patch:8.2.{4242,4315}: put in Visual mode cannot be repeated
2022-02-09 20:46:30 +08:00
3959f3a9c8 Merge pull request #17350 from zeertzjq/vim-8.2.1316
vim-patch:8.2.{1316,2199,2201,2202}
2022-02-09 20:11:12 +08:00
0675c7de75 vim-patch:8.2.2202: write file test still fails on MS-Windows
Problem:    Write file test still fails on MS-Windows.
Solution:   Set fileformat with the :edit command
16204962c7
2022-02-09 19:24:41 +08:00
2863fac61f vim-patch:8.2.2201: write file test fails on MS-Windows
Problem:    Write file test fails on MS-Windows.
Solution:   Force edit after setting 'fileformat'.
bd318559cf
2022-02-09 19:24:41 +08:00
47a98ab394 vim-patch:8.2.2199: first write after setting 'eol' does not have NL added
Problem:    First write after setting 'eol' does not have NL added. (Tomáš
            Janoušek)
Solution:   Only use b_no_eol_lnum when doing a binary write. (closes vim/vim#7535)
b3c8b1d254
2022-02-09 19:24:41 +08:00
92e4394562 vim-patch:8.2.1316: test 42 is still old style
Problem:    Test 42 is still old style.
Solution:   Turn it into a new style test. (Yegappan Lakshmanan, closes vim/vim#6561)
b61ef01cce

Including the Xtest2 -> Xfile2 change from Vim patch 8.2.1498.
2022-02-09 19:24:41 +08:00
afac1b5d87 ci: add more reviewers based on label 2022-02-09 10:47:14 +01:00
01b748f28f Merge pull request #17347 from zeertzjq/screen-pvs
refactor(PVS/V547): p == NULL is always false
2022-02-09 15:52:00 +08:00
a2a37effc2 refactor(PVS/V547): p == NULL is always false 2022-02-09 15:23:45 +08:00
3fe47647c7 vim-patch:8.2.4315: put in Visual mode not fully tested
Problem:    Put in Visual mode not fully tested.
Solution:   Add a few more test cases. (closes vim/vim#9708)
6bf821e8ab
2022-02-09 14:21:04 +08:00
196160b183 vim-patch:partial:f10911e5db16
Update runtime files
f10911e5db
2022-02-09 14:21:04 +08:00
d9cb3fba92 vim-patch:8.2.4242: put in Visual mode cannot be repeated
Problem:    Put in Visual mode cannot be repeated.
Solution:   Use "P" to put without yanking the deleted text into the unnamed
            register. (Shougo Matsushita, closes vim/vim#9591)
fb55207ed1

Cherry-pick get_y_previous() and set_y_previous() from patch 8.1.1736.
Nvim has removed y_current, so code related to it is N/A.
2022-02-09 14:21:04 +08:00
b9732e555b vim-patch:8.2.4329: no support for end line number and column in 'errorformat'
Problem:    No support for end line number and column in 'errorformat'.
Solution:   Add %e and %k. (closes vim/vim#9624)
e023d49937

Use "\t" to represent a Tab as it looks better.
2022-02-09 13:31:06 +08:00
300b009f47 fix(healthcheck): handle empty reports 2022-02-09 10:18:22 +08:00
07c97fa02d Merge pull request #17321 from dundargoc/refactor/pvs/v547
refactor(PVS/V547): expression is always true/false
2022-02-09 10:08:16 +08:00
ff81725ff0 refactor(mbyte.c): add const qualifiers
This only touches functions that do not return a pointer.
Also add a note about the differences between mb_head_off() and utf_head_off().
2022-02-09 09:52:57 +08:00
e16ec0be22 Merge pull request #17341 from zeertzjq/clang-suppress
chore(clang): suppress "result of operation is garbage"
2022-02-09 09:25:18 +08:00
4ce5d27f46 chore(clang): suppress "result of operation is garbage" 2022-02-09 08:54:54 +08:00
19b2ad0518 Merge pull request #17332 from cryptomilk/asn-vterm-output-callback
feat(term): Use vterm_output_set_callback()
2022-02-08 19:26:38 -05:00
0290889fa9 Merge pull request #17330 from dundargoc/ci/add-reviewer-from-label
ci: add write permissions to add-reviewer job
2022-02-08 18:43:03 -05:00
4d5cd3abe0 Merge pull request #17326 from zeertzjq/vim-8.1.2297
vim-patch:8.1.2297: the ex_vimgrep() function is too long
2022-02-09 07:07:25 +08:00
ef819fc052 vim-patch:8.1.2297: the ex_vimgrep() function is too long
Problem:    The ex_vimgrep() function is too long.
Solution:   Split it in three parts. (Yegappan Lakshmanan, closes vim/vim#5211)
d6a98a3a97

Including a missing change to ex_vimgrep() from patch 8.0.1831.
2022-02-09 06:34:21 +08:00
bcea732997 Merge pull request #17328 from zeertzjq/vim-8.2.0197
vim-patch:8.2.0197: some Ex commands not sufficiently tested
2022-02-09 04:40:15 +08:00
46c93b4304 Merge pull request #16553 from seandewar/vim-8.2.0878
vim-patch:8.2.{0882,1051,1083}: port `reduce()` function
2022-02-08 17:05:27 +00:00
79bacb0973 ci: add write permissions to add-reviewer job 2022-02-08 14:56:46 +01:00
cfed5baa38 refactor(PVS/V547): expression is always true/false 2022-02-08 14:52:31 +01:00
1a5e893cee Merge pull request #17334 from zeertzjq/vim-8.2.4326
vim-patch:8.2.4326: "o" and "O" copying comment not sufficiently tested
2022-02-08 21:45:39 +08:00
3c75e63bf6 vim-patch:8.2.4326: "o" and "O" copying comment not sufficiently tested
Problem:    "o" and "O" copying comment not sufficiently tested.
Solution:   Add a test case. (closes vim/vim#9718)
51ab7c7d0d

Fix a mistake when porting Vim patch 8.2.3934
2022-02-08 21:10:32 +08:00
7813b48645 feat(term): use vterm_output_set_callback() 2022-02-08 11:18:49 +01:00
40c36efdee chore(deps): use https for downloading libvterm and libtermkey 2022-02-08 11:18:49 +01:00
51b432a7d1 Merge pull request #17327 from zeertzjq/test-ex-mode
test: add Lua functional tests for Ex mode
2022-02-08 15:21:18 +08:00
f8b40694b1 vim-patch:8.2.0197: some Ex commands not sufficiently tested
Problem:    Some Ex commands not sufficiently tested.
Solution:   Add more tests. (Yegappan Lakshmanan, closes vim/vim#5565)
ea3db914c0
2022-02-08 15:09:54 +08:00
68603998b9 test: add Lua functional tests for Ex mode 2022-02-08 14:47:23 +08:00
01e58fb14d Merge pull request #17324 from zeertzjq/vim-patch-sh-read
chore(vim-patch.sh): use piping instead of here string for `while read`
2022-02-07 21:30:54 -05:00
8ec4410cfb Merge pull request #17323 from dundargoc/ci/add-reviewer-from-label
ci: add reviewers based on label
2022-02-07 21:30:26 -05:00
4d349330a7 chore(vim-patch.sh): use piping instead of here string for while read
Using a here string can cause an error if there are no missing patches:
`./scripts/vim-patch.sh: line 580: runtime_commits: bad array subscript`

Using piping doesn't cause the error.
2022-02-08 10:08:17 +08:00
0a8bfc0214 Merge pull request #17311 from zeertzjq/vim-8.2.4303
vim-patch:8.2.{4303,4307}: a few messages should not be translated
2022-02-08 08:20:10 +08:00
64116d7850 chore: fix typos (#17250)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Dani Dickstein <daniel.dickstein@gmail.com>
Co-authored-by: Axel Dahlberg <git@valleymnt.com>
2022-02-08 08:19:06 +08:00
9259bc6215 Merge pull request #16873 from seandewar/vim-8.2.1665
vim-patch:8.2.{1665,1726,1872,1893,1921,2280,2813}: `matchfuzzy` and friends
2022-02-07 22:57:25 +00:00
fde169f328 ci: add reviewers based on label 2022-02-07 21:25:45 +01:00
02e7431445 docs(fuzzy-match): cherry-pick latest changes
53f7fccc94
1b884a0053
4c295027a4
3ec3217f04
2022-02-07 17:39:50 +00:00
ce797e08f5 vim-patch:8.2.2813: cannot grep using fuzzy matching
Problem:    Cannot grep using fuzzy matching.
Solution:   Add the "f" flag to :vimgrep. (Yegappan Lakshmanan, closes vim/vim#8152)
bb01a1ef3a
2022-02-07 17:20:51 +00:00
715fbcbb8c vim-patch:8.2.2280: fuzzy matching doesn't give access to the scores
Problem:    Fuzzy matching doesn't give access to the scores.
Solution:   Return the scores with a third list. (Yegappan Lakshmanan,
            closes vim/vim#7596)
9d19e4f4ba

Remove seemingly useless NULL checks.
assert that removing the li one wasn't dumb.
2022-02-07 17:20:51 +00:00
712c7e5d5f vim-patch:8.2.1921: fuzzy matching does not recognize path separators
Problem:    Fuzzy matching does not recognize path separators.
Solution:   Add a bonus for slash and backslash. (Yegappan Lakshmanan,
            closes vim/vim#7225)
dcdd42a8cc
2022-02-07 17:20:50 +00:00
30deb14f39 vim-patch:8.2.1893: fuzzy matching does not support multiple words
Problem:    Fuzzy matching does not support multiple words.
Solution:   Add support for matching white space separated words. (Yegappan
            Lakshmanan, closes vim/vim#7163)
8ded5b647a
2022-02-07 17:20:50 +00:00
8313d31e4a vim-patch:8.2.1872: matchfuzzy() does not prefer sequential matches
Problem:    Matchfuzzy() does not prefer sequential matches.
Solution:   Give sequential matches a higher bonus. (Christian Brabandt,
            closes vim/vim#7140)
e9f9f16387
2022-02-07 17:20:50 +00:00
960ea01972 vim-patch:8.2.1726: fuzzy matching only works on strings
Problem:    Fuzzy matching only works on strings.
Solution:   Support passing a dict.  Add matchfuzzypos() to also get the match
            positions. (Yegappan Lakshmanan, closes vim/vim#6947)
4f73b8e9cc

Also remove some N/A and seemingly useless NULL checks -- Nvim allocs can't
return NULL. I'm not sure why the retmatchpos stuff in match_fuzzy checks for
NULL too, given that Vim checks for NULL alloc in do_fuzzymatch; assert that the
li stuff is not NULL as that's the one check I'm ever-so-slightly unsure about.

Adjust tests. Note that the text_cb tests actually throw E6000 in Nvim, but we
also can't assert that error due to v8.2.1183 not being ported yet.
2022-02-07 17:20:49 +00:00
fba00b5e7e vim-patch:8.2.1665: cannot do fuzzy string matching
Problem:    Cannot do fuzzy string matching.
Solution:   Add matchfuzzy(). (Yegappan Lakshmanan, closes vim/vim#6932)
635414dd2f

Adjust Test_matchfuzzy's 2nd assert to expect the last error thrown, as
v8.2.1183 hasn't been ported yet (to be honest, the error message is kinda weird
if the 2nd argument is not convertible to string). We can still port this fully
as porting v8.2.1183 would require removing this change to pass CI.
2022-02-07 17:19:59 +00:00
f30ce7d273 ci: run all suites with run_suite function 2022-02-07 09:57:21 +01:00
f02a5a7bda chore(typval): return NULL over false for pointer return type (#17316)
While we're at it, abort() for an unhandled v_type.
2022-02-07 01:51:09 +00:00
cf86adba61 Merge pull request #17263 from zeertzjq/vim-8.2.0208
vim-patch:8.2.{0208,0215,0942,3824,3939}: fnamemodify() patches
2022-02-07 07:13:13 +08:00
72816136a5 vim-patch:8.2.3939: MS-Windows: fnamemodify('', ':p') does not work
Problem:    MS-Windows: fnamemodify('', ':p') does not work.
Solution:   Do not consider an empty string a full path. (Yegappan Lakshmanan,
            closes vim/vim#9428, closes vim/vim#9427)
5a664fe57f
2022-02-07 06:48:10 +08:00
bfc11e9c64 vim-patch:8.2.3824: no ASAN support for MSVC
Problem:    No ASAN support for MSVC.
Solution:   Add ASAN support and fix a coupld of uncovered problems. (Yegappan
            Lakshmanan, closes vim/vim#9357)
6df0f2759d
2022-02-07 06:48:10 +08:00
53e4434c72 vim-patch:8.2.0942: expanding to local dir after homedir keeps "~/"
Problem:    Expanding to local dir after homedir keeps "~/".
Solution:   Adjust modify_fname(). (Christian Brabandt, closes vim/vim#6205,
            closes vim/vim#5979)
0e390f40e9
2022-02-07 06:48:10 +08:00
f47ba10636 vim-patch:8.2.0215: wrong file name shortening
Problem:    Wrong file name shortening. (Ingo Karkat)
Solution:   Better check for path separator. (Yasuhiro Matsumoto,
            closes vim/vim#5583, closes vim/vim#5584)
a78e9c61a0
2022-02-07 06:48:10 +08:00
d457168e3b vim-patch:8.2.0208: fnamemodify() does not apply ":~" when followed by ":."
Problem:    Fnamemodify() does not apply ":~" when followed by ":.".
Solution:   Don't let a failing ":." cause the ":~" to be skipped. (Yasuhiro
            Matsumoto, closes vim/vim#5577)
d816cd94d8
2022-02-07 06:48:10 +08:00
380bc4fe22 Merge pull request #17299 from zeertzjq/vim-8.1.0711
vim-patch:7.4.{1163,1164,1167,1173,1178,1181,1228},8.1.0711
2022-02-07 06:04:40 +08:00
fe621b4ac0 vim-patch:8.1.0711: test files still use function!
Problem:    Test files still use function!.
Solution:   Remove the exclamation mark.  Fix overwriting a function.
1e1153600c

Some of the changes were already applied previously.
2022-02-07 05:34:20 +08:00
e6e9ffb345 vim-patch:7.4.1228
Problem:    copy() and deepcopy() fail with special variables. (Nikolai
            Pavlov)
Solution:   Make it work.  Add a test.  Closes vim/vim#614.
155500077c

Code is N/A. This only ports the tests.
Comment out tests involving v:none as Nvim has removed it.
2022-02-07 05:34:20 +08:00
a937fc53ef vim-patch:7.4.1181
Problem:    free_tv() can't handle special variables. (Damien)
Solution:   Add the variable type.
6650a69454

Code is N/A. This only ports the tests.
2022-02-07 05:34:20 +08:00
3fa5d50183 vim-patch:7.4.1178
Problem:    empty() doesn't work for the new special variables.
Solution:   Make empty() work. (Damien)
767d8c1a1a

Code is N/A. This only ports the tests.
Comment out tests involving v:none as Nvim has removed it.
2022-02-07 05:34:20 +08:00
bf8f2ebb79 vim-patch:7.4.1173
Problem:    No test for new behavior of v:true et al.
Solution:   Add a test.
65591001e4

Comment out tests involving v:none as Nvim has removed it.
2022-02-07 05:34:20 +08:00
b3a14a71b0 vim-patch:7.4.1167
Problem:    No tests for "is" and "isnot" with the new variables.
Solution:   Add tests.
0436922965

Comment out tests involving v:none as Nvim has removed it.
2022-02-07 05:34:20 +08:00
6a00b16896 vim-patch:7.4.1164
Problem:    No tests for comparing special variables.  Error in jsondecode()
            not reported.  test_json does not work Japanse system.
Solution:   Set scriptencoding. (Ken Takata) Add a few more tests. Add error.
6039c7f053

Code is N/A. This only ports the tests.
Comment out tests involving v:none as Nvim has removed it.
2022-02-07 05:34:20 +08:00
7b8fcf0234 vim-patch:7.4.1163
Problem:    Expressions "0 + v:true" and "'' . v:true" cause an error.
Solution:   Return something sensible when using a special variable as a
            number or as a string. (suggested by Damien)
17a13437c9

Code is N/A. This only ports the tests.
Comment out tests involving v:none as Nvim has removed it.
2022-02-07 05:34:20 +08:00
e2466d84bc Merge pull request #17305 from zeertzjq/vim-8.2.1741
vim-patch:8.2.1741: pathshorten() only supports using one character
2022-02-07 05:21:39 +08:00
f0699f4356 Merge pull request #17279 from zeertzjq/state-enter-vpeekc
fix(event-loop): call vpeekc() directly first to check for character
2022-02-06 19:22:02 +01:00
c7df847c07 Merge pull request #17302 from lewis6991/pkg_ldr
fix(lua): restore priority of the preloader
2022-02-06 15:40:45 +01:00
51444bef24 Merge pull request #17306 from clason/vim-8.2.4305
* Vim 8.2.4305: tex filetype detection fails
* Vim 8.2.4306: no test for fixed perl filetype check
2022-02-06 15:33:39 +01:00
4903949033 Merge pull request #17277 from laomaiweng/windows-debug-symbols
build(win): package the debug symbols (PDB file) along with nvim.exe
2022-02-06 09:32:18 -05:00
2ff4726fae Merge pull request #17310 from jamessan/commitlint
ci(commitlint): use lintcommit.lua from main repo
2022-02-06 09:28:24 -05:00
707cc1a167 ci(commitlint): use lintcommit.lua from main repo
[skip ci]
2022-02-06 08:31:23 -05:00
8f0b3cadbe vim-patch:8.2.4307: a few more messages should not be translated
Problem:    A few more messages should not be translated.
Solution:   Remove _().
0c1550d9e9
2022-02-06 21:13:03 +08:00
daf7c17cdb vim-patch:8.2.4303: a few messages should not be translated
Problem:    A few messages should not be translated.
Solution:   Remove _(). (Dominique Pellé, closes vim/vim#9702)
cd53eed2c5
2022-02-06 21:13:03 +08:00
06d2d271d7 vim-patch:8.2.4306: no test for fixed perl filetype check
Problem:    No test for fixed perl filetype check.
Solution:   Add a test. Sort test functions.
500761b1cf
2022-02-06 12:19:55 +01:00
05f38bbede vim-patch:8.2.4305: tex filetype detection fails
Problem:    Tex filetype detection fails.
Solution:   Check value to be positive. (closes vim/vim#9704)
e5b7897585
2022-02-06 12:10:09 +01:00
d65ee12914 vim-patch:8.2.1741: pathshorten() only supports using one character
Problem:    pathshorten() only supports using one character.
Solution:   Add an argument to control the length. (closes vim/vim#7006)
6a33ef0deb

Cherry-pick a line in test from patch 8.2.0634.
Use Nvim's config paths in docs.

shorten_dir() returning a pointer looks a bit confusing here, as it is
actually the same pointer passed to it, and it doesn't really reduce
much code, so change it back to void.

Assigning rettv->vval.v_string = NULL is not needed if a pointer is
within 64 bits. While this is usually the case, I'm not sure if it can
be taken for granted.
2022-02-06 16:29:12 +08:00
8215c05945 Merge pull request #17194 from zeertzjq/inccommand-prev-sub
fix(inccommand): do not change reg_prev_sub when previewing
2022-02-06 10:18:59 +08:00
28d5face21 Merge pull request #16862 from seandewar/vim-8.2.2658
vim-patch:8.2.{2658,2661,2736}: for loop over strings
2022-02-06 00:02:30 +00:00
b518b577ea fix(lua): restore priority of the preloader
Neovim currently places its own loader for searching runtime files at
the front of `package.loaders`. This prevents any preloaders in
`package.preload` from being used. This change fixes that by moving the
default package preloader to run before Neovim's loader. For example,
LuaJIT provides preloaders for the built-in modules `ffi` and `bit`, so
this optimisation will improve the loading of those.
2022-02-05 21:46:04 +00:00
b17f1e6fe8 Merge pull request #17077 from zeertzjq/vim-8.2.2324
vim-patch:8.2.{1727,2324,2363}: charcol(), getcharpos(), getcursorcharpos(), setcharpos(), setcursorcharpos()
2022-02-06 05:18:02 +08:00
be9dbc925c vim-patch:partial:6aa57295cfbe
Update runtime files
6aa57295cf
2022-02-06 04:46:16 +08:00
46d1b8ed1f vim-patch:partial:2346a6378483
Update runtime files
2346a63784
2022-02-06 04:46:16 +08:00
8c3244c9a1 vim-patch:8.2.2363: curpos() does not accept a string argument as before
Problem:    curpos() does not accept a string argument as before.
solution:   Make a string argument work again. (Yegappan Lakshmanan,
            closes vim/vim#7690
9ebcf231bd
2022-02-06 04:46:16 +08:00
6ab71683d1 vim-patch:8.2.2324: not easy to get mark en cursor posotion by character count
Problem:    Not easy to get mark en cursor posotion by character count.
Solution:   Add functions that use character index. (Yegappan Lakshmanan,
            closes vim/vim#7648)
6f02b00bb0
2022-02-06 04:46:16 +08:00
8ba9f19961 vim-patch:8.2.1727: a popup created with "cursorline" will ignore "firstline"
Problem:    A popup created with "cursorline" will ignore "firstline".
Solution:   When both "cursorline" and "firstline" are present put the cursor
            on "firstline". (closes vim/vim#7000)  Add the "winid" argument to
            getcurpos().
99ca9c4868

Skip popup window related code.
Cherry-pick all of Test_getcurpos_setpos() from patch 8.2.0610.
2022-02-06 04:46:16 +08:00
8adbba7ac3 feat(eval): port emsg from v8.2.3284
80d7395dcf
2022-02-05 19:55:17 +00:00
83a48d7a44 vim-patch:8.2.2661: leaking memory when looping over a string
Problem:    Leaking memory when looping over a string.
Solution:   Free the memory.
bb5d87c850
2022-02-05 19:55:16 +00:00
7002a3433b vim-patch:8.2.2658: :for cannot loop over a string
Problem:    :for cannot loop over a string.
Solution:   Accept a string argument and iterate over its characters.
74e54fcb44

v8.2.2659 is already ported.

N/A patches for version.c:

vim-patch:8.2.2736: Vim9: for loop over string is a bit slow

Problem:    Vim9: for loop over string is a bit slow.
Solution:   Avoid using strlen().
175a41c13f
2022-02-05 19:55:11 +00:00
92e92f02e7 fix(diff): make algorithm work for vim.diff (#17300)
Fixes #17207
2022-02-05 09:49:48 -08:00
cee944e3ee Merge pull request #17199 from glacambre/fix_9358
fix(--headless): do not block on press-enter prompts when no UI
2022-02-05 16:47:51 +01:00
f68d25737f Merge pull request #17020 from seandewar/vim-8.1.2342
vim-patch:8.1.{2342,2343,2356,2357},8.2.0233: `rand` and `srand`
2022-02-05 15:30:09 +00:00
ef6cedf820 Merge pull request #17290 from dundargoc/ci/simplify-ci-process
ci: simplify CI process
2022-02-05 09:16:41 -05:00
4f7a8991a9 vim-patch:8.2.0233: crash when using garbagecollect() in between rand()
Problem:    Crash when using garbagecollect() in between rand().
Solution:   Redesign the rand() and srand() implementation. (Yasuhiro
            Matsumoto, closes vim/vim#5587, closes vim/vim#5588)
4f645c54ef

Omit test_srand_seed.
Unmacroify SHUFFLE_XOSHIRO128STARSTAR and SPLITMIX32 while we're at it (leave
ROTL alone as it's fairly innocent).
2022-02-05 14:01:00 +00:00
cc7ccf6d31 vim-patch:8.1.2357: no test with wrong argument for rand()
Problem:    No test with wrong argument for rand().
Solution:   Add a test case.
68e9e5f7fc
2022-02-05 14:00:59 +00:00
c97614d98f vim-patch:8.1.2356: rand() does not use the best algorithm
Problem:    rand() does not use the best algorithm.
Solution:   use xoshiro128** instead of xorshift. (Kaito Udagawa,
            closes vim/vim#5279)
f8c1f9200c
2022-02-05 14:00:59 +00:00
061b06a8ae docs(rand): cherry-pick changes from rt update 0c0734d
0c0734d527
2022-02-05 14:00:59 +00:00
f6a0d5498b vim-patch:8.1.2343: using time() for srand() is not very random
Problem:    Using time() for srand() is not very random.
Solution:   use /dev/urandom if available
07e4a19795

Use os_open and os_close.

time_settime is N/A, so some parts of the test are disabled.

There's maybe a very, very, very, very small chance the /dev/urandom test fails,
but it shouldn't matter. :P
2022-02-05 14:00:35 +00:00
22f0725aac vim-patch:8.1.2342: random number generator in Vim script is slow
Problem:    Random number generator in Vim script is slow.
Solution:   Add rand() and srand(). (Yasuhiro Matsumoto, closes vim/vim#1277)
06b0b4bc27

Add missing method call usage to builtin.txt.
vim_time and test_settime is N/A.
Add a modeline to test_random.vim.
Use typval_T* over listitem_T* vars so we don't need to use TV_LIST_ITEM_TV all
over the place...
Remove NULL list checks (tv_list_len covers this).
2022-02-05 13:16:34 +00:00
7c8ef809e6 Merge pull request #17274 from dundargoc/chore/correct-minimum-python-version
chore(gen_vimdoc): correct minimum python version
2022-02-05 08:06:58 -05:00
03e189d1a1 chore(gen_vimdoc): correct minimum python version 2022-02-05 13:36:27 +01:00
9d1deed6c8 Merge pull request #17298 from zeertzjq/vim-8.2.4298
vim-patch:8.2.4298: divide by zero with huge tabstop value
2022-02-05 20:33:11 +08:00
e6cfd20b7f vim-patch:8.2.4298: divide by zero with huge tabstop value
Problem:    Divide by zero with huge tabstop value.
Solution:   Reject tabstop value that overflows to zero.
fc88df42f1
2022-02-05 20:05:04 +08:00
5b34c2ab73 fix(--headless): do not block on press-enter prompts when no UI
This commit fixes #9358, where emitting multiple messages with 'echo' or
a single one with 'echom' or 'echoerr' would result in a press-enter
prompt that couldn't be dismissed by pressing enter.

This requires adapting a few tests to spawn a UI before testing whether
press-enter prompts are blocking.

It also fixes #11718, as when combined with #15910 it enables making
sure that neovim never blocks and emits messages on startup.
2022-02-05 13:02:33 +01:00
806a7c976d Merge pull request #17275 from bfredl/keysethl
refactor(api): use a keyset for highlight dicts
2022-02-05 10:18:47 +01:00
741b4d6262 Merge pull request #17297 from zeertzjq/test-expand
test(old): add test_expand.vim
2022-02-05 17:15:42 +08:00
a4078fa57e test(old): add test_expand.vim
This removes expand_spec.lua and copies test_expand.vim from Vim at
version v8.1.2278.

The rest of patch 8.1.2278 were already applied in #15952, so this marks
that patch as fully ported.

vim-patch:8.1.2278: using "cd" with "exe" may fail

Problem:    Using "cd" with "exe" may fail.
Solution:   Use chdir() instead.
3503d7c94a
2022-02-05 16:41:23 +08:00
fa192e97d5 ci: simplify CI process 2022-02-04 23:51:51 +01:00
dcbf9f93e9 Merge pull request #17288 from zeertzjq/vim-8.2.1128
vim-patch:8.2.1128: the write message mentions characters, but it's bytes
2022-02-04 23:07:21 +08:00
c50cea3de4 Merge pull request #17287 from zeertzjq/vim-8.1.2133
vim-patch:8.1.2133: some tests fail when run as root
2022-02-04 22:24:38 +08:00
9b0363d365 vim-patch:8.2.1128: the write message mentions characters, but it's bytes
Problem:    The write message mentions characters, but it's actually bytes.
Solution:   Change "C" to "B" and "characters" to "bytes".
3f40ce78f5
2022-02-04 22:17:25 +08:00
041b2d6f1e vim-patch:8.1.2133: some tests fail when run as root
Problem:    Some tests fail when run as root.
Solution:   Add CheckNotRoot and use it. (James McCoy, closes vim/vim#5020)
07282f01da

Skip test_terminal.vim and test_viminfo.vim: N/A
2022-02-04 21:52:44 +08:00
cb863d4e1f Merge pull request #17152 from zeertzjq/vim-8.2.3583
vim-patch:8.2.3583: the "gd" and "gD" commands do not update search stats
2022-02-04 19:10:50 +08:00
2fd0720de2 test: convert some search stat screendump tests to Lua screen tests 2022-02-04 18:47:20 +08:00
ab7ae8806e vim-patch:8.2.3583: the "gd" and "gD" commands do not update search stats
Problem:    The "gd" and "gD" commands do not update search stats. (Gary
            Johnson)
Solution:   Clear search stats.
0c71114aed
2022-02-04 18:47:20 +08:00
b9def4ae10 test(old): fix test order in test_search_stat.vim
Also avoid unnecessary divergences from upstream and add a modeline.
2022-02-04 18:47:20 +08:00
6bee2bf790 Merge pull request #17272 from zeertzjq/vim-8.1.0846
vim-patch:8.1.{0846,0878,0884,2358},8.2.{0305,0352,0687,3797}
2022-02-04 09:48:48 +08:00
6775a7d98f vim-patch:8.2.3797: no good reason to limit the message history in tiny version
Problem:    No good reason to limit the message history in the tiny version.
Solution:   Always use 200.
1e78deb077
2022-02-04 09:23:54 +08:00
7c3064d46e vim-patch:8.2.0687: some tests do not work on FreeBSD
Problem:    Some tests do not work on FreeBSD.
Solution:   Enable modeline.  Use WaitFor() in more cases. (Ozaki Kiichi,
            closes vim/vim#6036)
41d4299f26
2022-02-04 09:23:54 +08:00
a998b24c56 vim-patch:8.2.0352: FreeBSD: test for sourcing utf-8 is skipped
Problem:    FreeBSD: test for sourcing utf-8 is skipped.
Solution:   Run the matchadd_conceal test separately to avoid that setting
            'term' to "ansi" causes problems for other tests. (Ozaki Kiichi,
            closes vim/vim#5721)
36ddf93831
2022-02-04 09:23:54 +08:00
94eaf3cb2f vim-patch:8.2.0305: relativenumber test fails on some systems
Problem:    Relativenumber test fails on some systems. (James McCoy)
Solution:   Clear the command line.
8040a7147f
2022-02-04 09:23:54 +08:00
1e0613f58c vim-patch:8.1.2358: tests fail on Cirrus CI for FreeBSD
Problem:    Tests fail on Cirrus CI for FreeBSD.
Solution:   Fix a test and skip some. (Christian Brabandt, closes vim/vim#5281)
9134f1ecd4

Skip test_normal.vim: already applied in #11483.
2022-02-04 09:23:54 +08:00
5a9e5b6c38 vim-patch:8.1.0884: double check for bsd systems
Problem:    Double check for bsd systems.
Solution:   Delete the old line.
af630d4f7f
2022-02-04 09:23:54 +08:00
22a7693915 vim-patch:8.1.0878: test for has('bsd') fails on some BSD systems
Problem:    Test for has('bsd') fails on some BSD systems.
Solution:   Adjust the uname match. (James McCoy, closes vim/vim#3909)
a02e3f65c5
2022-02-04 09:23:54 +08:00
4c4a80950e docs: update feature-list
Add "linux", "sun".
Remove "+shellslash" as it should be passed to exists().
Sort alphabetically and consistently use Tabs for indent.
2022-02-04 09:23:54 +08:00
f25ab39faa vim-patch:8.1.0846: not easy to recognize the system Vim runs on
Problem:    Not easy to recognize the system Vim runs on.
Solution:   Add more items to the features list. (Ozaki Kiichi, closes vim/vim#3855)
39536dd557

Some doc changes have already been applied. Some others are N/A.
"moon" was removed in patch 8.2.0427 so I did not add it.
2022-02-04 09:23:54 +08:00
b667bb355d Merge pull request #17283 from dundargoc/ci/reduce-log-output
ci: only show last 100 lines of log on error
2022-02-03 17:11:18 -05:00
4fa8c66bc6 ci: only show last 100 lines of log on error 2022-02-03 22:30:51 +01:00
59fa5f4ecf Merge pull request #17282 from dundargoc/chore/remove-duplicate-entry
chore(gen_vimdoc): remove duplicate extmark.c entry
2022-02-03 14:11:26 -05:00
de672b6d7a chore(gen_vimdoc): remove duplicate extmark.c entry 2022-02-03 18:56:32 +01:00
9efdd927ff Merge pull request #16976 from seandewar/vim-8.2.4018
vim-patch:8.2.{4018,4026,4028} & `nvim_win_call` fixes
2022-02-03 16:44:42 +00:00
452b46fcf7 fix(api/nvim_win_call): share common win_execute logic
We have to be sure that the bugs fixed in the previous patches also apply to
nvim_win_call.

Checking v8.1.2124 and v8.2.4026 is especially important as these patches were
only applied to win_execute, but nvim_win_call is also affected by the same
bugs. A lot of win_execute's logic can be shared with nvim_win_call, so factor
it out into a common macro to reduce the possibility of this happening again.
2022-02-03 15:03:08 +00:00
6820420d3e vim-patch:8.2.4028: ml_get error with :doautoall and Visual area
Problem:    ml_get error with :doautoall and Visual area. (Sean Dewar)
Solution:   Disable Visual mode while executing autocommands.
cb1956d6f2

This should also fix #16937 for nvim_buf_call, so test for it.
2022-02-03 15:03:08 +00:00
d984a8d130 vim-patch:8.2.4026: ml_get error with specific win_execute() command
Problem:    ml_get error with specific win_execute() command. (Sean Dewar)
Solution:   Check cursor and Visual area are OK.
e664a32701
2022-02-03 15:03:08 +00:00
f326c9a77d vim-patch:8.2.4018: ml_get error when win_execute redraws with Visual selection
Problem:    ml_get error when win_execute redraws with Visual selection.
Solution:   Disable Visual area temporarily. (closes vim/vim#9479)
18f4740f04

{switch_to/restore}_win_for_buf is N/A (marked as such in v8.0.0860; currently
only used in Vim's if_py).

Add a modeline to test_execute_func.vim.
2022-02-03 15:02:57 +00:00
f5c4c1d768 Merge pull request #16818 from zeertzjq/vim-8.2.3454
vim-patch:8.2.{3454,3455,3497,3540,3581,3678}: some "p" and "gp" patches
2022-02-03 22:22:00 +08:00
89e308d7da Merge pull request #17226 from dundargoc/refactor/remove-redundant-code
vim-patch:8.2.4241: some type casts are redundant
2022-02-03 20:47:29 +08:00
02d4c91588 Merge pull request #17268 from zeertzjq/health-noshell
fix(health): do not run external processes in a shell
2022-02-03 19:29:24 +08:00
a87ecf5d08 fix(health): do not run external processes in a shell 2022-02-03 18:38:37 +08:00
5fe6bbae2d build(win): don't try to package a PDB if not building with MSVC…
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-02-03 07:52:27 +01:00
74998b0449 fix(event-loop): call vpeekc() directly first to check for character
Expand mappings first by calling `vpeekc()` directly.
2022-02-03 13:43:48 +08:00
f70d1442be build(win): package the debug symbols (PDB file) along with nvim.exe 2022-02-03 01:40:40 +01:00
0bafa44f8b refactor(api): use a keyset for highlight dicts 2022-02-02 23:18:25 +01:00
21cdecc8e0 Merge pull request #17245 from zeertzjq/vim-8.2.3219
vim-patch:8.2.3219: :find searches non-existing directories
2022-02-02 22:31:14 +08:00
0c66c7dafd Merge pull request #17271 from zeertzjq/vim-8.2.3947
vim-patch:8.2.{3947,4283}: changedir_func() refactoring
2022-02-02 22:01:59 +08:00
cd44f0a401 vim-patch:8.2.4283: using a variable for the return value is not needed
Problem:    Using a variable for the return value is not needed.
Solution:   Return the value directly. (closes vim/vim#9687)
73257149d7

Also move down variable declarations in changedir_func().
vim_chdirfile() doesn't need change.
2022-02-02 21:33:46 +08:00
1bce6d6e16 vim-patch:8.2.3947: unnecessary check for NULL pointer
Problem:    Unnecessary check for NULL pointer.
Solution:   Remove the check. (closes vim/vim#9434)
f38aad85cf

Reorder the two if branches to match upstream.
2022-02-02 21:33:46 +08:00
2559359035 Merge pull request #16879 from zeertzjq/vim-8.2.3966
vim-patch:8.2.3966: when using feedkeys() abbreviations may be blocked
2022-02-02 10:11:09 +08:00
3e68973755 vim-patch:8.2.3966: when using feedkeys() abbreviations may be blocked
Problem:    When using feedkeys() abbreviations may be blocked.
Solution:   Reset tb_no_abbr_cnt when running out of characters.
            (closes vim/vim#9448)
b37a65e4bf
2022-02-02 09:46:25 +08:00
5be2cdd913 Merge pull request #17187 from lewis6991/master
feat(highlight): ns=0 to set :highlight namespace
2022-02-01 17:16:14 +01:00
4aa0cdd3aa feat(highlight): ns=0 to set :highlight namespace
Passing ns=0 to nvim_set_hl will alter the `:highlight` namespace.
2022-02-01 11:54:12 +00:00
f4300985d3 Merge pull request #17113 from zeertzjq/vim-8.2.2569
feat(statusline): support multibyte fillchar
2022-02-01 17:57:01 +08:00
7d72076a6f vim-patch:8.2.3219: :find searches non-existing directories
Problem:    :find searches non-existing directories.
Solution:   Check the path is not "..".  Update help. (Christian Brabandt,
            closes vim/vim#8612, closes vim/vim#8533)
7a4ca32175

Change STRNCAT to STRLCAT as clint doesn't like the former.

Include a typo fix from 2f0936cb9a (diff-7e9292cae1f2ba70dd5b17d2d162693a91044ada6ac99e9c3e8917f32878c097)
2022-02-01 17:08:40 +08:00
a562b5771e vim-patch:8.2.4274: Basic and form filetype detection is incomplete (#17259)
Problem:    Basic and form filetype detection is incomplete.
Solution:   Add a separate function for .frm files. (Doug Kearns, closes vim/vim#9675)
c570e9cf68
2022-02-01 08:35:28 +01:00
547497b042 Merge pull request #17261 from zeertzjq/vim-8.2.4273
vim-patch:8.2.4273: the EBCDIC support is outdated
2022-02-01 10:43:14 +08:00
bba5003bdb vim-patch:8.2.4273: the EBCDIC support is outdated
Problem:    The EBCDIC support is outdated.
Solution:   Remove the EBCDIC support.
424bcae1fb

Also remove a comment in buf_init_chartab() as it is for enc_dbcs only.

Skip test_expr.vim: the check was already removed when patch 7.4.2265
was first ported.
2022-02-01 10:15:19 +08:00
5205bcc904 Merge pull request #17254 from zeertzjq/vim-8.2.3787
vim-patch:8.2.{3787,3932,3934,3935,3938}: text formatting patches
2022-02-01 04:23:59 +08:00
c00b844988 Merge pull request #17231 from seandewar/vim-8.2.4245
vim-patch:8.2.4245: ":retab 0" may cause illegal memory access
2022-01-31 18:28:56 +00:00
bddce4b0ff vim-patch:c4573eb12dba (#17258)
Update runtime files
c4573eb12d
2022-01-31 18:09:51 +01:00
79b92da0d2 vim-patch:partial:f10911e5db16 (#17248)
Update runtime files
f10911e5db
2022-01-31 15:27:01 +01:00
f195345c93 [RFC] fix: has('python') error (#17252)
* fix: has('python') error

* fix: functional tests
2022-01-31 15:06:46 +01:00
2a58e62145 vim-patch:8.2.4267: unused entry in keymap enum (#17255)
Problem:    Unused entry in keymap enum.
Solution:   Remove the entry.
4c93aff20f
2022-01-31 21:01:04 +08:00
8d99f53f3d vim-patch:8.2.1083: crash when using reduce() on a NULL list
Problem:    Crash when using reduce() on a NULL list.
Solution:   Only access the list when not NULL.
fda20c4cc5

CHECK_LIST_MATERIALIZE hasn't been ported yet, but presumably if it is ported
it'll use tv_list_first to check for range_list_item, which already checks for
NULL, so this should need no extra changes and can be a full port.

We didn't actually crash here due to the use of Nvim's tv_list functions
checking for NULL, but apply these changes to match Vim better anyway.
2022-01-31 17:38:57 +08:00
44a5875b24 vim-patch:8.2.1051: crash when changing a list while using reduce() on it
Problem:    Crash when changing a list while using reduce() on it.
Solution:   Lock the list. (closes vim/vim#6330)
ca275a05d8
2022-01-31 17:38:57 +08:00
af0bae38e2 vim-patch:8.2.0882: leaking memory when using reduce()
Problem:    Leaking memory when using reduce().
Solution:   Free the intermediate value.
48b1c21809
2022-01-31 17:38:57 +08:00
d746f5aa41 feat(eval): partially port v8.2.0878
Problem:    No reduce() function.
Solution:   Add a reduce() function. (closes vim/vim#5481)
85629985b7

Needs CHECK_LIST_MATERIALIZE from v8.2.0751 (and range_list_materialize from
8.2.0149).

Move e_reduceempty to funcs.c, as it's only used there. Make it static.
Use tv_blob_len, tv_list_len == 0 for empty checks.
Replace vim_memset(&funcexe, 0, ...) with FUNCEXE_INIT.
Leave li initially undefined (tv_list_first returns NULL if list is NULL).

This patch has a memory leak fixed by v8.2.0882.
2022-01-31 17:38:45 +08:00
ba2bb6a81b refactor(indent_c.c): add const qualifiers 2022-01-31 15:44:54 +08:00
ae649650de vim-patch:8.2.3938: line comment start is also found in a string
Problem:    Line comment start is also found in a string.
Solution:   Skip line comments in a string.
ba26367fea
2022-01-31 15:44:54 +08:00
f7801fe138 vim-patch:8.2.3935: CTRL-U in Insert mode does not fix the indent
Problem:    CTRL-U in Insert mode does not fix the indent.
Solution:   Fix the indent when 'cindent' is set.
5d20fbf2e7
2022-01-31 15:44:54 +08:00
da3b04a9e0 vim-patch:8.2.3934: repeating line comment is undesired for "O" command
Problem:    Repeating line comment is undesired for "O" command.
Solution:   Do not copy line comment leader for "O". (closes vim/vim#9426)
5ea5f37372
2022-01-31 15:44:54 +08:00
88ba0774e2 vim-patch:8.2.3932: C line comment not formatted properly
Problem:    C line comment not formatted properly.
Solution:   If a line comment follows after "#if" the next line is not the end
            of a paragraph.
264d3ddac0
2022-01-31 15:44:54 +08:00
eda957db10 vim-patch:8.2.3787: no proper formatting of a C line comment after a statement
Problem:    No proper formatting of a C line comment after a statement.
Solution:   Find the start of the line comment, insert the comment leader and
            indent the comment properly.
6e371ecb27
2022-01-31 15:44:54 +08:00
ef5cd99df0 test: remove 003_cindent_spec.lua
This no longer needed as Vim patch 8.1.1434 has been ported.
2022-01-31 15:44:54 +08:00
2870311a37 Merge pull request #17239 from seandewar/vim-8.2.3629
vim-patch:8.2.{3433,3629}
2022-01-31 01:04:10 +00:00
d38f81849b Merge pull request #17068 from VVKot/vim-8.2.3933
vim-patch:8.2.{3933,3973,3978,4013,4032,4048}
2022-01-31 00:42:11 +00:00
62c8715ee9 vim-patch:8.1.2412: crash when evaluating expression with error (#17109) 2022-01-31 08:12:44 +08:00
4dcc7bcbed vim-patch:8.2.3532: the previous '' mark is restored after moving the cursor (#17246) 2022-01-31 08:12:29 +08:00
58d01d3403 vim-patch:8.2.3475: expression register set by not executed put command (#17211) 2022-01-31 08:11:26 +08:00
f19921be0c vim-patch:8.2.3933: after ":cd" fails ":cd -" is incorrect
Problem:    After ":cd" fails ":cd -" is incorrect.
Solution:   Set the previous directory only after successfully changing
            directory. (Richard Doty, closes vim/vim#9419, closes vim/vim#8983)
3d0abad5bf

Adjust the test's error message check due to missing patch

vim-patch:8.2.3973: tiny build fails

Problem:    Tiny build fails.
Solution:   Adjust #ifdefs
0f7a5e758c

vim-patch:8.2.3978: build error when using dynamycally loaded Python 3

Problem:    Build error when using dynamycally loaded Python 3.
Solution:   Adjust #ifdef.
6b1a99dfe3

vim-patch:8.2.4013: build failure without the spell feature

Problem:    Build failure without the spell feature.
Solution:   Adjust #ifdefs.
e60b3c47d7

vim-patch:8.2.4032: ATTRIBUTE_NORETURN is not needed

Problem:    ATTRIBUTE_NORETURN is not needed.
Solution:   Use NORETURN(). (Ozaki Kiichi, closes vim/vim#9487)
e12406526a

vim-patch:8.2.4048: gcc complains about use of "%p" in printf

Problem:    gcc complains about use of "%p" in printf.
Solution:   Add (void *) typecast. (Dominique Pellé, closes vim/vim#9494)
c14f667626
2022-01-31 00:07:32 +00:00
c91fbc1b9e test(oldtest): unskip Test_addr_all
v8.1.0341 has since been ported
2022-01-30 22:25:15 +00:00
796224028b vim-patch:8.2.3629: command completion in cmdline window uses global commands
Problem:    Command completion in cmdline window uses global user commands,
            not local commands for the window where it was opened from.
Solution:   Use local commands. (closes vim/vim#9168)
a119812437
2022-01-30 22:25:15 +00:00
f8f0f14db2 vim-patch:8.2.3433: :delcommand does not take a -buffer option
Problem:    :delcommand does not take a -buffer option.
Solution:   Add the -buffer option.
bdcba24d85
2022-01-30 22:25:08 +00:00
a28a9aec63 Merge pull request #16748 from zeertzjq/vim-8.1.1434
vim-patch:8.1.{1434,1585},8.2.{3482,3625,3876}: some cindent patches
2022-01-31 04:49:54 +08:00
2793fcae0a vim-patch:8.2.4241: some type casts are redundant
Problem:    Some type casts are redundant.
Solution:   Remove the type casts. (closes vim/vim#9643)
420fabcd4f

This is not a literal port but an equivalent one.
2022-01-30 19:16:51 +01:00
46bd48f7e9 docs(tutor): modify for Neovim rather than Vim (#17092) 2022-01-30 13:53:01 +01:00
abde91ecaf docs: add example to vim.ui.select (#17241)
Closes https://github.com/neovim/neovim/issues/17137
2022-01-30 13:32:55 +01:00
9aaf7a2b4d Merge pull request #17244 from zeertzjq/vim-8.2.0092 2022-01-30 13:52:16 +08:00
8a9230db26 vim-patch:8.2.0950: tagjump test fails
Problem:    Tagjump test fails.
Solution:   Adjust expected text of the prompt.
13b8205b44
2022-01-30 13:25:29 +08:00
63173f23c4 vim-patch:8.2.0092: tags functionality insufficiently tested
Problem:    Tags functionality insufficiently tested.
Solution:   Add more tags tests. (Yegappan Lakshmanan, closes vim/vim#5446)
a1353b5352
2022-01-30 13:25:29 +08:00
4a96e7809f chore: typo fixes (#16921)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-01-29 23:15:22 +00:00
d7d015ffff Merge pull request #16975 from dstein64/vim-8.2.3917
vim-patch:8.2.3917: the eval.txt help file is way too big
2022-01-29 23:27:12 +01:00
7b3cfee982 vim-patch:partial:04fb916
Update runtime files
04fb916684
2022-01-29 15:19:30 -05:00
a94632d212 vim-patch:8.2.3917: the eval.txt help file is way too big
Problem:    The eval.txt help file is way too big.
Solution:   Move the builtin function details to a separate file.
1cae5a0a03

Note: Neovim-specific references to |functions| were changed to
|builtin-functions|. This included updates to:
  1. test/functional/vimscript/functions_spec.lua
  2. test/functional/vimscript/eval_spec.lua
  3. runtime/doc/lua.txt
2022-01-29 15:19:29 -05:00
4458413bc0 feat(filetype): convert patterns for mail buffers (#17238) 2022-01-29 12:43:06 -07:00
e0242c4a93 Merge pull request #17222 from bfredl/babajpy2
feat(provider)!: remove support for python2 and python3.[3-6]
2022-01-29 20:22:25 +01:00
baec0d3152 feat(provider)!: remove support for python2 and python3.[3-5]
These versions of python has reached End-of-life. getting rid
of python2 support removes a lot of logic to support two
incompatible python versions in the same version.
2022-01-29 19:49:37 +01:00
4b719e4a16 Merge pull request #17192 from zeertzjq/aucmd-redrawingdisabled
fix: set RedrawingDisabled before entering aucmd_win
2022-01-29 19:16:48 +01:00
49837dc805 Merge pull request #17202 from zeertzjq/unused-orig-rhs
refactor: allocate an empty string as unused orig_rhs for Lua mappings
2022-01-29 19:14:19 +01:00
b2f77c354a vim-patch:8.2.4251: vala files are not recognized (#17235)
Problem:    Vala files are not recognized.
Solution:   Add the *.vala pattern. (closes vim/vim#9654)
97c554d514
2022-01-29 15:40:29 +01:00
5e1c487d99 vim-patch:8.2.4090: after restoring a session buffer order can be quite different (#17112)
Problem:    After restoring a session buffer order can be quite different.
Solution:   Create buffers first. (Evgeni Chasnovski, closes vim/vim#9520)
26ebf1f036

---------------
As in Vim, this basically reverts 8.1.0829 providing different solution
(see vim/vim#9520).

Regarding Neovim, this basically reverts changes from #15062. Test about
restoring same terminals was a bit too restrictive with using actual
buffer ids, which changed with this patch (now they should be in the
same order as at `mksession` call), so I tweaked it.
2022-01-29 14:08:44 +00:00
ed0808412c Merge pull request #17234 from zeertzjq/vim-8.2.4248 2022-01-29 21:32:44 +08:00
950a88d4c2 vim-patch:8.2.4248: no proper test for moving the window separator
Problem:    No proper test for moving the window separator.
Solution:   Add a test.  Add comment in code. (closes vim/vim#9656)
a0c4e2f2d7

Remove the assertion as it is now possible for `fr` to be `NULL`.

The test fails without clearing messages. Not sure if this is a bug.
2022-01-29 20:37:48 +08:00
6dcdec8042 vim-patch:8.2.4052: not easy to resize a window from a plugin (#17028) 2022-01-29 20:37:07 +08:00
cf4d025c5a Merge pull request #17209 from bb010g/patch-1
fix(eval): v:lua support for `-` in module names
2022-01-29 11:45:15 +01:00
8fc9a58256 vim-patch:8.2.0028: searchpairpos() is not tested (#17232) 2022-01-29 16:34:11 +08:00
15c9d88bb7 vim-patch:8.2.4245: ":retab 0" may cause illegal memory access
Problem:    ":retab 0" may cause illegal memory access.
Solution:   Limit the value of 'tabstop' to 10000.
652dee4486

ex_retab change is N/A (+vartabs always available).

Nvim's set_num_option validation logic was refactored, hence why it looks
different from Vim's.

Also use XFREE_CLEAR in other places.
2022-01-29 06:31:51 +00:00
082ff2190c refactor: add static to some functions in funcs.c (#17030) 2022-01-29 08:22:42 +08:00
1ebac3cf4e Merge pull request #17220 from zeertzjq/unget-alt-chord 2022-01-29 06:37:44 +08:00
3adc3fc540 vim-patch:8.2.3678: illegal memory access
Problem:    Illegal memory access.
Solution:   Ignore changed indent when computing byte offset.
85be8563fe
2022-01-29 06:05:39 +08:00
6f04d3f3ef vim-patch:8.2.3581: reading character past end of line
Problem:    Reading character past end of line.
Solution:   Correct the cursor column.
0b5b06cb47
2022-01-29 06:05:39 +08:00
436a470ef5 vim-patch:8.2.3540: the mark '] is wrong after put with a count
Problem:    The mark '] is wrong after put with a count. (Naohiro Ono)
Solution:   Use the right line number. (closes vim/vim#8956)
f47ebf1e1a
2022-01-29 06:05:39 +08:00
5228850749 vim-patch:8.2.3497: put test fails when run by itself
Problem:    Put test fails when run by itself.
Solution:   Source check.vim. (Dominique Pellé, closes vim/vim#8990)
a9173d06f7
2022-01-29 06:05:39 +08:00
7812c6830c vim-patch:8.2.3455: using a count with "gp" leaves '] in wrong position
Problem:    Using a count with "gp" leaves '] in wrong position. (Naohiro Ono)
Solution:   Correct the mark position. (closes vim/vim#8899)
56858e4ed4
2022-01-29 06:05:39 +08:00
fee7d6fba4 vim-patch:8.2.3454: using a count with "gp" leave cursor in wrong position
Problem:    Using a count with "gp" leave cursor in wrong position. (Naohiro
            Ono)
Solution:   Count the inserted lines. (closes vim/vim#8899)
23003e51e1
2022-01-29 06:05:39 +08:00
75f4741db9 fix(input): remove reinterpreted ALT/META chords from recorded macro 2022-01-29 06:05:14 +08:00
af9a2a201d Merge pull request #16951 from zeertzjq/vim-8.2.4007 2022-01-29 06:03:22 +08:00
98fddc1d4c Merge pull request #17213 from zeertzjq/ci-lsan-failure 2022-01-28 13:47:29 -05:00
6fd1b12de1 Merge pull request #17206 from dundargoc/ci/remove-python2 2022-01-28 13:45:32 -05:00
b396387ec8 Merge pull request #16829 from zeertzjq/vim-8.2.2887
vim-patch:8.2.{2887,3414,3999}: fullcommand() follow-up patches
2022-01-29 02:42:14 +08:00
65529dd7a1 Merge pull request #17223 from clason/vim-8.2.4238
vim-patch:8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
2022-01-28 18:44:03 +01:00
fb8cd340dc fix(eval): v:lua support for - in module names 2022-01-28 18:20:26 +01:00
5b9980f01e vim-patch:8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Problem:    *.tf file could be fileytpe "tf" or "terraform".
Solution:   Detect the type from the file contents. (closes vim/vim#9642)
bd8168c770
2022-01-28 17:01:13 +01:00
6cb670cb2c Merge pull request #17216 from clason/vim-8.2.4233
vim-patch:8.2.{4233,4235,4236,4237}: follow-up patches for recording in Select mode
2022-01-28 14:23:48 +01:00
bea439fe99 vim-patch:8.2.4237: record buffer wrong if character in Select mode was not typed
Problem:    Record buffer wrong if character in Select mode was not typed.
Solution:   Only delete the tail from the record buffer if the character was
            typed. (closes vim/vim#9650)
fbf4f1ca15
2022-01-28 20:53:56 +08:00
ca3e382a4f Merge pull request #17183 from notomo/expose-extmark-right-gravity
feat(api): expose extmark right_gravity and end_right_gravity
2022-01-28 12:38:56 +01:00
175692325b vim-patch:8.2.4236: accessing freed memory
Problem:    Accessing freed memory.
Solution:   Set the bh_curr pointer to NULL.
166788c657
2022-01-28 19:03:39 +08:00
7114764ffb vim-patch:8.2.4235: invalid check for NULL pointer
Problem:    Invalid check for NULL pointer.
Solution:   Remove the check.
37cf413e3e
2022-01-28 19:03:39 +08:00
e691ef338c vim-patch:8.2.4233: crash when recording and using Select mode
Problem:    Crash when recording and using Select mode.
Solution:   When deleting the last recorded character check there is something
            to delete.
a4bc2dd7cc
2022-01-28 19:03:37 +08:00
530c65b17a Merge pull request #16830 from kuuote/vim-8.2.3571 2022-01-28 12:21:15 +08:00
d0493d1104 test(old): reorder test_register.vim according to upstream (#17215) 2022-01-28 09:34:03 +08:00
69f37197c0 fix(completion): update submode message when selecting from API (#17022) 2022-01-28 07:55:10 +08:00
815aa9f642 Merge pull request #16820 from seandewar/vim-8.1.2302
vim-patch:8.1.2302,8.2.{3936,4112}
2022-01-27 23:23:26 +00:00
14751eaf70 Merge pull request #16954 from f380cedric/vim-8.2.3402
vim-patch:8.2.{3402,3403}
2022-01-27 23:05:43 +00:00
503e6f7832 vim-patch:8.2.3403: memory leak for :retab with invalid argument
Problem:    Memory leak for :retab with invalid argument.
Solution:   Free the memory.  Make error messages consistent.
2ddb89f8a9

Changes in ex_retab are N/A (behind a non-FEAT_) and have been dropped.
2022-01-27 23:37:01 +01:00
9779f5c84c vim-patch:8.2.3903: "gM" does not count tabs as expected (#16796) 2022-01-28 06:26:24 +08:00
6eb8c0c0c8 ci: add intercept_tls_get_addr=0 to ASAN_OPTIONS 2022-01-27 23:16:33 +08:00
c5ac04331b vim-patch:8.2.3612: using freed memory with regexp using a mark (#16973)
Problem:    Using freed memory with regexp using a mark.
Solution:   Get the line again after getting the mark position.
64066b9acd
2022-01-27 14:59:30 +01:00
5182627ce9 vim-patch:8.2.3669: buffer overflow with long help argument (#16971)
Problem:    Buffer overflow with long help argument.
Solution:   Use snprintf().
bd228fd097
2022-01-27 14:58:53 +01:00
39d6db3899 docs(helphelp): remove extra backtick interference (#17201)
An extra backtick was explicitly written to show what a backtick looked
like, but it interferes with the syntax highlighting which thinks that
it's a part of a concealed group and couples it with the wrong backtick.
2022-01-27 14:56:18 +01:00
d95bb85024 Merge pull request #17185 from zeertzjq/vim-8.2.3993
vim-patch:8.2.{3993,4002}: when recording a change in Select mode char appears twice
2022-01-27 13:45:34 +01:00
a47fdf8421 Merge pull request #17175 from zeertzjq/vim-8.2.3095
vim-patch:8.2.3095: with 'virtualedit' set to "block" block selection is wrong
2022-01-27 13:44:30 +01:00
7ea09dde5f Merge pull request #17136 from zeertzjq/vim-8.2.4133
vim-patch:8.2.4133: output of ":scriptnames" goes into the message history
2022-01-27 13:43:27 +01:00
8c140be31f feat(ts): expose minimum language version to lua (#17186) 2022-01-27 12:46:56 +01:00
f2d84df4a8 vim-patch:8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Problem:    With 'virtualedit' set to "block" block selection is wrong after
            using "$".  (Marco Trosi)
Solution:   Compute the longest selected line. (closes vim/vim#8495)
b17ab86e7b
2022-01-27 18:55:21 +08:00
d8adb3a721 vim-patch:8.2.4112: function not deleted at end of test
Problem:    Function not deleted at end of test.
Solution:   Delete the function.
d9b74a2a41

oops -- my fault :P
2022-01-27 18:47:55 +08:00
c0ff0cac87 vim-patch:8.2.3936: no proper test for maintaining change mark in diff mode
Problem:    No proper test for maintaining change mark in diff mode.
Solution:   Run the test with internal and external diff. (Sean Dewar,
            closes vim/vim#9424)
ccc1644f95
2022-01-27 18:47:55 +08:00
e8af051f1b test(oldtest): partially port v8.1.2381
Problem:    Not all register related code is covered by tests.
Solution:   Add more test cases. (Yegappan Lakshmanan, closes vim/vim#5301)
54c8d229f5

Can't be fully ported until "set clipboard=autoselect,autoselectplus" is
re-implemented for Test_clipboard_regs (and last visual selection to PRIMARY
selection works).
2022-01-27 18:47:55 +08:00
5864edac7b vim-patch:8.1.2302: :lockmarks does not work for '[ and ']
Problem:    :lockmarks does not work for '[ and '].
Solution:   save and restore '[ and '] marks. (James McCoy, closes vim/vim#5222)
f4a1d1c054

Test_diff_maintains_change_mark doesn't actually fail without these changes.
This is fixed in v8.2.3936.
2022-01-27 18:47:52 +08:00
f9080b24c4 fix(ts): escape lang when loading parsers (#16668)
When trying to load a language parser, escape the value of
the language.

With language injection, the language might be picked up from the
buffer. If this value is erroneous it can cause `nvim_get_runtime_file`
to hard error.

E.g., the markdown expression `~~~{` will extract '{' as a language and
then try to get the parser using `parser/{*` as the pattern.
2022-01-27 10:42:59 +01:00
2320f705c4 Merge pull request #17195 from dundargoc/refactor/assert-include
refactor: include missing assert header
2022-01-27 10:23:36 +01:00
3d0149f984 Merge pull request #17191 from zeertzjq/vim-8.2.4203
vim-patch:8.2.4203: entering a character with CTRL-V may include modifiers
2022-01-27 09:00:01 +01:00
a9f112ce3a vim-patch:8.2.4133: output of ":scriptnames" goes into the message history
Problem:    output of ":scriptnames" goes into the message history, while this
            des not happen for other commands, such as ":ls".
Solution:   Use msg_outtrans() instead of smsg(). (closes vim/vim#9551)
840f16202e
2022-01-27 15:55:06 +08:00
9c4e617064 Merge pull request #17166 from Shougo/vim-8.2.4160
vim-patch:8.2.4160: cannot change the register used for Select mode d…
2022-01-27 08:52:08 +01:00
c4b906f341 Merge pull request #17110 from zeertzjq/vim-8.2.3630
vim-patch:8.2.{3630,3663}: printf() with %S does not handle multi-byte correctly
2022-01-27 08:50:38 +01:00
1270949c11 Merge pull request #17150 from zeertzjq/vim-8.2.4166
vim-patch:8.2.4166: undo synced when switching buffer in another window
2022-01-27 08:48:31 +01:00
618f7079e5 Merge pull request #17135 from seandewar/vim-8.2.0175
vim-patch:8.2.0175: crash when removing list element in map()
2022-01-27 08:47:01 +01:00
95b8a8f6ae Merge pull request #17131 from zeertzjq/vim-8.2.3580
vim-patch:8.2.3580: gj does not move properly with a wide character
2022-01-27 08:41:29 +01:00
480fbbe296 Merge pull request #17145 from zeertzjq/vim-8.2.0128
vim-patch:8.2.0128: cannot list options one per line
2022-01-27 08:37:36 +01:00
0813b9fde4 Merge pull request #17094 from zeertzjq/vim-8.2.4091
vim-patch:8.2.4091: virtcol is recomputed for statusline unnecessarily
2022-01-27 08:35:52 +01:00
d50dd12725 Merge pull request #17095 from zeertzjq/vim-8.2.3227
vim-patch:8.2.{3227,3280,4094}: global-local 'virtualedit'
2022-01-27 08:34:57 +01:00
55ad48d939 Merge pull request #17155 from zeertzjq/vim-8.2.3121
vim-patch:8.2.{3121,3410}: two 'listchars' fixes
2022-01-27 08:32:52 +01:00
47b50d5a1c Merge pull request #17174 from zeertzjq/vim-8.2.3153
vim-patch:8.2.3153: URLs with a dash in the scheme are not recognized
2022-01-27 08:32:02 +01:00
f1b91fcdbd Merge pull request #17102 from zeertzjq/vim-8.2.1762
vim-patch:8.2.1762: when a timer uses :stopinsert completion isn't stopped
2022-01-27 08:31:17 +01:00
00915864f7 Merge pull request #17184 from zeertzjq/vim-8.2.4190
vim-patch:8.2.4190: all conceal tests are skipped without the screendumps feature
2022-01-27 08:30:24 +01:00
81950af22d refactor: allocate an empty string as unused orig_rhs for Lua mappings 2022-01-27 07:24:25 +08:00
b30ac599f8 ci: remove all code containing python2
Also change all mentions of python 3 to just python.
2022-01-26 23:44:02 +01:00
6006e15e7a Merge pull request #17205 from clason/vim-8.2.4214
Vim 8.2.{4214,4215,4217,4219} various illegal memory accesses
2022-01-26 22:39:45 +01:00
540264306b vim-patch:8.2.4219: reading before the start of the line
Problem:    Reading before the start of the line.
Solution:   Check boundary before trying to read the character.
44db8213d3
2022-01-26 22:02:56 +01:00
e9247b0d5d vim-patch:8.2.4217: illegal memory access when undo makes Visual area invalid
Problem:    Illegal memory access when undo makes Visual area invalid.
Solution:   Correct the Visual area after undo.
8d02ce1ed7

vim-patch:8.2.4218: illegal memory access with bracketed paste in Ex mode (N/A)
2022-01-26 22:01:19 +01:00
b2b288f33c vim-patch:8.2.4215: illegal memory access when copying lines in Visual mode
Problem:    Illegal memory access when copying lines in Visual mode.
Solution:   Adjust the Visual position after copying lines.
dc5490e2cb
2022-01-26 22:00:29 +01:00
de673966c3 vim-patch:8.2.4214: illegal memory access with large 'tabstop' in Ex mode
Problem:    Illegal memory access with large 'tabstop' in Ex mode.
Solution:   Allocate enough memory.
85b6747abc
2022-01-26 21:34:26 +01:00
17e2938b10 Merge pull request #17132 from zeertzjq/vim-8.2.3611
vim-patch:8.2.{3494,3611,3613}: two Visual mode crash fixes
2022-01-26 21:33:53 +01:00
b7dc4491a9 refactor: include missing assert header
This will solve the "implicit declaration of function ‘assert’" warning
when running "make lint".
2022-01-26 20:44:45 +01:00
20482a2b83 Merge pull request #17204 from dundargoc/ci/windows/python-version 2022-01-26 13:43:38 -05:00
16d64796f4 ci(windows): use the provided python from github actions
This will prevent future errors whenever support for a specific python
version we rely on is removed.
2022-01-26 16:40:43 +01:00
d11bbacf0f fix(inccommand): do not change reg_prev_sub when previewing 2022-01-25 16:18:58 +08:00
ecec957125 vim-patch:8.2.4196: various file types not recognized (#17182)
Problem:    Various file types not recognized.
Solution:   Add patterns to recognize more file types (closes vim/vim#9607)
428058ab32
2022-01-25 08:22:15 +01:00
dd21e21e97 fix: set RedrawingDisabled before entering aucmd_win 2022-01-25 09:44:37 +08:00
95873aa3eb test: add more tests for Insert mode Ctrl-V 2022-01-25 08:29:04 +08:00
3d9ff675f8 vim-patch:8.2.4203: entering a character with CTRL-V may include modifiers
Problem:    Entering a character with CTRL-V may include modifiers.
Solution:   Reset "mod_mask" when entering a character with digits after
            CTRL-V. (closes vim/vim#9610)
502d8ae3e8

Commenting out test_override() as before.

Commenting out part of CheckNotFeature() because Vim patch 8.2.0427
cannot be ported without breaking a lot of oldtests that check for
removed features.
2022-01-25 08:21:20 +08:00
1b6ae2dbb0 Merge pull request #15910 from glacambre/silent_stdioopen
feat(--headless): do not print anything when stdioopen() has been used
2022-01-24 22:33:55 +01:00
a4069a3eed feat(--headless): add on_print callback to stdioopen
This commit adds an on_print callback to stdioopen's dictionary
argument which lets the caller specify a function called each time
neovim will try to output something to stdout (e.g. on "echo" or
"echoerr" in --headless mode).
2022-01-24 13:59:16 +01:00
1907a94814 Merge pull request #17143 from jamessan/coverity-fixes
Various Coverity fixes
2022-01-24 06:28:09 -05:00
c0a97d982a test(unit): add unit tests for path_with_url 2022-01-24 13:01:35 +08:00
9bb9f17592 vim-patch:8.2.3153: URLs with a dash in the scheme are not recognized
Problem:    URLs with a dash in the scheme are not recognized.
Solution:   Allow for a scheme with a dash, but not at the start or end.
            (Tsuyoshi CHO, closes vim/vim#8299)
7b7a118e74
2022-01-24 13:01:35 +08:00
5c897b6d0c vim-patch:8.2.4002: first char typed in Select mode can be wrong
Problem:    First char typed in Select mode can be wrong.
Solution:   Escape special bytes in the input buffer. (closes vim/vim#9469)
6cac77016b

The `buf` should already be large enough, but I'll change its size
anyway in case future patches change the meaning of `MB_MAXBYTES` macro.

`fix_input_buffer()` cannot be used here because of the `using_script()`
check, and there is already equivalent code in its place.
2022-01-24 12:46:52 +08:00
8f1efb018b vim-patch:8.2.3993: when recording a change in Select mode char appears twice
Problem:    When recording a change in Select mode the first typed character
            appears twice.
Solution:   When putting the character back into typeahead remove it from
            recorded characters. (closes vim/vim#9462)
c88e977862
2022-01-24 12:46:52 +08:00
1b184cea3b vim-patch:8.2.4190: all conceal tests are skipped without the screendumps feature
Problem:    All conceal tests are skipped without the screendumps feature.
Solution:   Only skip the tests that use screendumps. (closes vim/vim#9599)
206919191f
2022-01-24 11:10:37 +08:00
3d9ae9d2da feat(api): expose extmark right_gravity and end_right_gravity 2022-01-24 09:52:13 +09:00
7e2ce35e3b Merge pull request #17156 from zeertzjq/vim-8.2.3584
vim-patch:8.2.{3584,3586,3587}: :command "-keepscript" argument
2022-01-23 19:42:30 +01:00
f20bd439df Merge pull request #17168 from zeertzjq/ins-char-typebuf-mods
fix(input): put modifiers back into typeahead buffer when needed
2022-01-23 19:40:59 +01:00
4ba7fa1700 vim-patch:6f4754b9f725 (#17179)
Update runtime files
6f4754b9f7
2022-01-23 18:38:41 +01:00
28352dc6e5 vim-patch:8.2.4188: not all gitconfig files are recognized (#17178)
Problem:    Not all gitconfig files are recognized.
Solution:   Add a few more patterns. (Tim Pope, closes vim/vim#9597)
bcfa11b7df
2022-01-23 17:50:45 +01:00
ffd9551aa2 vim-patch:8.2.4191: json5 files are not recognized (#17180)
Problem:    json5 files are not recognized.
Solution:   Add a pattern for json5 files. (closes vim/vim#9601)
e15ebeffb3
2022-01-23 16:19:48 +01:00
3d62dd2077 vim-patch:8.2.4187: gnuplot file not recognized (#17177)
Problem:    Gnuplot file not recognized.
Solution:   Recognize ".gnuplot". (closes vim/vim#9588)
ff5cbe8133
2022-01-23 13:52:37 +01:00
0efe1ec6b3 test(input): add more tests for K_SPECIAL escaping in ins_char_typebuf() 2022-01-23 05:58:32 +08:00
818456470c fix(input): put modifiers back into typeahead buffer when needed 2022-01-23 05:58:32 +08:00
7717f38d3f Merge pull request #17169 from clason/bump-treesitter
build(deps): bump tree-sitter to v0.20.3
2022-01-22 18:39:14 +01:00
db9cfb18e1 build(deps): bump tree-sitter to v0.20.3
this version contains massive performance improvements as well as a new
`--abi` flag that allows generating backward compatible parsers
2022-01-22 09:02:06 +01:00
d7ab4e819a vim-patch:8.2.4160: cannot change the register used for Select mode delete
Problem:    Cannot change the register used for Select mode delete.
Solution:   Make CTRL-R set the register to be used when deleting text for
            Select mode. (Shougo Matsushita, closes vim/vim#9531)
4ede01f188
2022-01-22 11:57:06 +09:00
e07a4b97f6 Merge pull request #16936 from zeertzjq/no-escape-csi
input: never escape CSI bytes and clean up related names and comments
2022-01-21 18:04:40 +01:00
be22cc1264 Merge pull request #17076 from notomo/expose-extmark-more-details
feat(api): expose extmark more details
2022-01-21 18:02:47 +01:00
9d02fc4c00 vim-patch:8.2.4172: filetype detection for BASIC is not optimal (#17161)
Problem:    Filetype detection for BASIC is not optimal.
Solution:   Improve BASIC filetype detection. (Doug Kearns)
6517f14165
2022-01-21 16:45:32 +01:00
f2dbeca863 vim-patch:8.2.3587: compiler test fails with backslash file separator
Problem:    Compiler test fails with backslash file separator.
Solution:   Accept slash and backslash.
0a15c7676b
2022-01-21 18:18:18 +08:00
792381e1a0 vim-patch:8.2.3586: command completion test fails
Problem:    Command completion test fails.
Solution:   Add new argument to expected output
326e7da609
2022-01-21 18:18:18 +08:00
8e84d1b930 vim-patch:8.2.3584: "verbose set efm" reports location of the :compiler command
Problem:    "verbose set efm" reports the location of the :compiler command.
            (Gary Johnson)
Solution:   Add the "-keepscript" argument to :command and use it when
            defining CompilerSet.
58ef8a31d7
2022-01-21 18:18:18 +08:00
cb39c825c4 vim-patch:8.2.3410: crash with linebreak, listchars and large tabstop
Problem:    Crash with linebreak, listchars and large tabstop.
Solution:   Account for different size listchars for a tab. (closes vim/vim#8841)
89a54b413a
2022-01-21 18:16:16 +08:00
296b8fbe3b vim-patch:8.2.3121: 'listchars' "exceeds" character appears in foldcolumn
Problem:    'listchars' "exceeds" character appears in foldcolumn. Window
            separator is missing. (Leonid V.  Fedorenchik)
Solution:   Only draw the "exceeds" character in the text area.  Break the
            loop when not drawing the text. (closes vim/vim#8524)
41fb723ee9
2022-01-21 18:16:16 +08:00
6e69a3c3e7 refactor: remove CSI unescaping and clean up related names and comments 2022-01-21 18:08:56 +08:00
8300d337c8 refactor: remove the <xCSI> key
CSI typed directly is now just <CSI>. The <xCSI> key is obsolete.
2022-01-21 18:08:56 +08:00
ff7c3d1275 fix(input): never escape CSI bytes 2022-01-21 18:08:56 +08:00
c977d8b43c docs(lsp): fix on_publish_diagnostics example (#17146) 2022-01-21 08:40:48 +01:00
8e702c14ac feat(lsp): add handler for workspace/workspaceFolders (#17149) 2022-01-21 07:51:34 +01:00
2fa1b4cbff vim-patch:8.2.4166: undo synced when switching buffer in another window
Problem:    Undo synced when switching buffer in another window.
Solution:   Do not sync undo when not needed. (closes vim/vim#9575)
e615db0604
2022-01-21 05:14:40 +08:00
aa4eadd2be vim-patch:8.2.0128: cannot list options one per line
Problem:    Cannot list options one per line.
Solution:   Use ":set!" to list one option per line.
6b915c0c0e
2022-01-20 14:34:24 +08:00
5971b86338 feat(api): expose extmark more details 2022-01-20 13:25:46 +09:00
d224957d30 fix(coverity/188749): nullify pointer to fix use-after-free 2022-01-19 22:47:09 -05:00
e850a92986 fix(coverity/340720): error if nvim_eval_statusline given invalid winid 2022-01-19 21:54:06 -05:00
8f241e535f refactor(coverity/345583): assert fp is non-NULL
Since we already have a typval, we know the lookup will succeed.
2022-01-19 21:43:09 -05:00
0c541ab1f6 refactor(coverity/345582): assert fp is non-NULL
Since we already have a typval, we know the lookup will succeed.
2022-01-19 21:42:23 -05:00
431915fe6a test(put_spec): correctly order parameters to eq() (#17134)
The first parameter to eq() should be the expected value, and the second
parameter should be the actual value.
2022-01-19 13:53:39 -07:00
96aa7dd097 Merge pull request #17130 from clason/bump-treesitter
build(deps): bump tree-sitter
2022-01-19 09:24:20 +01:00
de6f9233ee refactor: source ftplugin.vim separately from filetype.vim (#17129)
This is a follow-on to #17040. The real benefit of #17040 was ensuring
that the ftplugin FileType autocommand was defined first and thus always
fired first. A side effect of the implementation in #17040 was that
setting variables that modified the state of filetype detection (such as
g:did_load_filetypes or g:do_filetype_lua) could no longer be set in the
user's init file. Filetype detection can also no longer be prevented
from loading by using `:filetype off`.

This PR addresses both of those side effects by unconditionally sourcing
ftplugin.vim and indent.vim before the user's init file (which ensures
that these autocommands run first) and sourcing filetype.vim *after* the
user's init file (thus allowing it to be blocked or modified).
2022-01-18 12:46:41 -07:00
1ae73e2d1c vim-patch:8.2.0175: crash when removing list element in map()
Problem:    Crash when removing list element in map().
Solution:   Lock the list. (closes vim/vim#2652)
db661fb95d
2022-01-18 12:49:30 +00:00
5e81687d9a vim-patch:8.2.3402: invalid memory access when using :retab with large value
Problem:    Invalid memory access when using :retab with large value.
Solution:   Check the number is positive.
b7081e135a
2022-01-18 10:04:32 +01:00
45f7fc9b06 build(deps): bump tree-sitter
update tree-sitter to
2346570901
which includes a massive performance improvement to query construction
(bumping ABI compatibility to 14; parsers need to be generated with a
flag to take advantage of this)
2022-01-18 09:07:12 +01:00
dda1c8edda vim-patch:8.2.3613: :find test fails
Problem:    :find test fails.
Solution:   Put length check inside if block.
e015d99abb
2022-01-18 10:05:31 +08:00
ec39e1e421 vim-patch:8.2.3611: crash when using CTRL-W f without finding a file name
Problem:    Crash when using CTRL-W f without finding a file name.
Solution:   Bail out when the file name length is zero.
615ddd5342
2022-01-18 10:05:31 +08:00
0a65d821fc vim-patch:8.2.3494: illegal memory access in utf_head_off
Problem:    Illegal memory access in utf_head_off.
Solution:   Check cursor position when reselecting the Visual area.
            (closes vim/vim#8963)
b07626d4af

Including the XTest_beval -> XTest_block from patch 8.2.3096.
2022-01-18 10:05:31 +08:00
176df92bd7 vim-patch:8.2.3580: gj does not move properly with a wide character
Problem:    gj does not move properly with a wide character.
Solution:   Move one to the right. (Christian Brabandt, closes vim/vim#8702)
aaec1d4fb1
2022-01-18 07:46:46 +08:00
fcf5dd34fd refactor: enable filetype detection before user startup scripts (#17040) 2022-01-17 14:11:59 -07:00
ad2dbd4b5f fix(man.vim): support calling :Man without a section again (#17119)
When `man -w` is called with an empty string as section name, it may
fail with an error code, which causes :Man to no longer work without a
section. Just remove that argument when no section is specified.
2022-01-17 11:45:46 -07:00
70db972e5f Merge pull request #16813 from neovim/marvim/api-doc-update/master
docs: regenerate
2022-01-17 13:37:28 -05:00
64b906a3fa Merge pull request #17125 from jamessan/auto-prs-as-draft
ci: create automated PRs as draft PRs
2022-01-17 13:37:19 -05:00
66076e5e1b ci: create automated PRs as draft PRs
GH workflows aren't allowed to trigger other GH workflows.  Since
commitlint is a required check now, we need something manual to happen
for it to run on vim-patch/api-doc PRs.

Creating these PRs as drafts and then marking them as "ready to review"
when we want to merge them will provide the manual trigger to run
commitlint.

[skip ci]
2022-01-17 13:36:01 -05:00
2c94b75eac docs: regenerate [skip ci] 2022-01-17 18:28:23 +00:00
8f54b88a5e Merge pull request #17122 from dundargoc/ci/remove-non-working-job
ci: remove non-working add-reviewer job
2022-01-17 13:11:46 -05:00
50eabe1c47 Merge pull request #17106 from jamessan/always-run-commitlint
Always run commitlint check
2022-01-17 13:08:27 -05:00
6c1d6f3dd6 ci: remove non-working add-reviewer job 2022-01-17 18:48:08 +01:00
69b2dd175c ci(api-docs): avoid running ci for doc commits 2022-01-17 12:21:16 -05:00
d7e2229b41 ci(commitlint): use pull_request_target to avoid "skip ci" 2022-01-17 12:21:09 -05:00
9055ec5792 perf(lsp): request only changed portions of the buffer in changetracking (#17118)
This commits introduces two performance improvements in incremental sync:

* avoiding expensive lua string reallocations on each on_lines call by requesting
only the changed chunk of the buffer as reported by firstline and new_lastline
parameters of on_lines
* re-using already allocated tables for storing the resulting lines to reduce the load on
the garbage collector

The majority of the performance improvement is from requesting only changed chunks
of the buffer.

Benchmark:

The following code measures the time required to perform a buffer edit to
that operates individually on each line, common to plugins such as vim-commentary.

    set rtp+=~/.config/nvim/plugged/nvim-lspconfig
    set rtp+=~/.config/nvim/plugged/vim-commentary
    lua require('lspconfig')['ccls'].setup({})
    function! Benchmark(tries) abort
        let results_comment = []
        let results_undo = []
        for i in range(a:tries)
            echo printf('run %d', i+1)
            let begin = reltime()
            normal gggcG
            call add(results_comment, reltimefloat(reltime(begin)))
            let begin = reltime()
            silent! undo
            call add(results_undo, reltimefloat(reltime(begin)))
            redraw
        endfor
        let avg_comment = 0.0
        let avg_undo = 0.0
        for i in range(a:tries)
            echomsg printf('run %3d: comment=%fs undo=%fs', i+1, results_comment[i], results_undo[i])
            let avg_comment += results_comment[i]
            let avg_undo += results_undo[i]
        endfor
        echomsg printf('average: comment=%fs undo=%fs', avg_comment / a:tries, avg_undo / a:tries)
    endfunction
    command! -bar Benchmark call Benchmark(10)

All text changes will be recorded within a single undo operation. Both the
comment operation itself and the undo operation will generate an on_lines event
for each changed line. Formatter plugins using setline() have also been found
to exhibit the same problem (neoformat, :RustFmt in rust.vim), as this function
too generates an on_lines event for every line it changes.

Using the neovim codebase as an example (commit 2ecf0a4)
with neovim itself built at 2ecf0a4 with
CMAKE_BUILD_TYPE=Release shows the following performance improvement:

src/nvim/lua/executor.c, 1432 lines:
  - baseline, no optimizations:             comment=0.540587s undo=0.440249s
  - without double-buffering optimization:  comment=0.183314s undo=0.060663s
  - all optimizations in this commit:       comment=0.174850s undo=0.052789s

src/nvim/search.c, 5467 lines:
  - baseline, no optimizations:             comment=7.420446s undo=7.656624s
  - without double-buffering optimization:  comment=0.889048s undo=0.486026s
  - all optimizations in this commit:       comment=0.662899s undo=0.243628s

src/nvim/eval.c, 11355 lines:
  - baseline, no optimizations:             comment=41.775695s undo=44.583374s
  - without double-buffering optimization:  comment=3.643933s undo=2.817158s
  - all optimizations in this commit:       comment=1.510886s undo=0.707928s

Co-authored-by: Dmytro Meleshko <dmytro.meleshko@gmail.com>
2022-01-17 08:19:33 -08:00
3906b2d4fc vim-patch:fd31be29b822 (#17114)
Update runtime files
fd31be29b8
2022-01-17 11:58:36 +01:00
0c0469c4f5 Merge pull request #15242 from dundargoc/docs/vim-patch/move-outsite-of-getting-started
docs: deprioritize vim-patch as a good beginner task
2022-01-16 23:39:38 +01:00
4388793799 docs: deprioritize vim-patch as a good beginner task
Also add a disclaimer where familiarity with vim is strongly suggested.
2022-01-16 22:10:22 +01:00
be15ac06ba feat(statusline): support multibyte fillchar
This includes a partial port of Vim patch 8.2.2569 and some changes to
nvim_eval_statusline() to allow a multibyte fillchar. Literally every
line of C code touched by that patch has been refactored in Nvim, and
that patch contains some irrelevant foldcolumn tests I'm not sure how to
port (as Nvim's foldcolumn behavior has diverged from Vim's).
2022-01-16 19:54:27 +08:00
658ef9c01e vim-patch:8.2.3663: using %S in printf() does not work correctly
Problem:    Using %S in printf() does not work correctly.
Solution:   Fix the problem and add more tests. (closes vim/vim#9208)
1f2453fec6
2022-01-16 17:37:06 +08:00
9afefd32d3 vim-patch:8.2.3630: printf() with %S does not handle multi-byte correctly
Problem:    Printf() with %S does not handle multi-byte correctly.
Solution:   Count cells instead of bytes. (closes vim/vim#9169, closes vim/vim#7486)
d85fccdfed
2022-01-16 17:37:06 +08:00
7085e5b0c8 fix(lsp): avoid nil workspace/symbol query (#17107) 2022-01-15 23:08:35 -08:00
a0201b6ed3 fix(lsp): fetch offset_encoding from client in references (#17104) 2022-01-15 15:49:29 -08:00
561df30981 Merge pull request #16836 from bfredl/mark2
refactor(marks): use a more efficient representation with less pointer indirection
2022-01-15 23:59:40 +01:00
b455e0179b feat: use nvim_buf_set_extmark for vim.highlight (#16963)
Closes https://github.com/neovim/neovim/issues/13647

This allows customizing the priority of the highlights.

* Add default priority of 50
* Use priority of 200 for highlight on yank
* use priority of 40 for highlight references (LSP)
2022-01-15 14:19:20 -08:00
95ab979fde refactor(extmarks): use a more efficient representation
marktree.c was originally constructed as a "generic" datatype,
to make the prototyping of its internal logic as simple as possible
and also as the usecases for various kinds of extmarks/decorations was not yet decided.
As a consequence of this, various extra indirections and allocations was
needed to use marktree to implement extmarks (ns/id pairs) and
decorations of different kinds (some which is just a single highlight
id, other an allocated list of virtual text/lines)

This change removes a lot of indirection, by making Marktree specialized
for the usecase. In particular, the namespace id and mark id is stored
directly, instead of the 64-bit global id particular to the Marktree
struct. This removes the two maps needed to convert between global and
per-ns ids.

Also, "small" decorations are stored inline, i.e. those who
doesn't refer to external heap memory anyway. That is highlights (with
priority+flags) are stored inline, while virtual text, which anyway
occurs a lot of heap allocations, do not. (previously a hack was used
to elide heap allocations for highlights with standard prio+flags)

TODO(bfredl): the functionaltest-lua CI version of gcc is having
severe issues with uint16_t bitfields, so splitting up compound
assignments and redundant casts are needed. Clean this up once we switch
to a working compiler version.
2022-01-15 22:08:12 +01:00
f3193c7b54 Merge pull request #17001 from mjlbach/feat/non-strict-extmarks
feat(extmarks): add strict option
2022-01-15 21:06:04 +01:00
d8eec8e344 Hopefully last attempt 2022-01-15 09:00:01 -08:00
facd07bcf7 Address review r3 2022-01-15 08:37:44 -08:00
8e945c2524 vim-patch:8.2.1762: when a timer uses :stopinsert completion isn't stopped
Problem:    When a timer uses :stopinsert Insert mode completion isn't
            stopped. (Stanley Chan)
Solution:   Call ins_compl_prep(ESC).
d0e1b7103c
2022-01-15 22:33:16 +08:00
c09147aad9 vim-patch:8.2.4095: sed script not recognized by the first line (#17101)
Problem:    Sed script not recognized by the first line.
Solution:   Recognize a sed script starting with "#n". (Doug Kearns)
e3ce17a3ca
2022-01-15 14:47:25 +01:00
6c22e5fd1a vim-patch:8.2.4094: 'virtualedit' is window-local but using buffer-local enum
Problem:    'virtualedit' is window-local but using buffer-local enum.
Solution:   Use window-local enum. (closes vim/vim#9529)
e1833bfd01
2022-01-15 19:21:17 +08:00
87e54f123a vim-patch:8.2.3280: 'virtualedit' local to buffer is not the best solution
Problem:    'virtualedit' local to buffer is not the best solution.
Solution:   Make it window-local. (Gary Johnson, closes vim/vim#8685)
51ad850f5f
2022-01-15 19:21:17 +08:00
d391940b9a vim-patch:8.2.3227: 'virtualedit' can only be set globally
Problem:    'virtualedit' can only be set globally.
Solution:   Make 'virtualedit' global-local. (Gary Johnson, closes vim/vim#8638)
53ba05b090

I changed some macros to unsigned integer literals to avoid compiler warnings.
2022-01-15 19:21:17 +08:00
147f65373e vim-patch:8.2.4091: virtcol is recomputed for statusline unnecessarily
Problem:    Virtcol is recomputed for statusline unnecessarily.
Solution:   Just use "w_virtcol". (closes vim/vim#9523)
0f112052ac
2022-01-15 07:47:13 +08:00
574a582202 feat(lsp): dynamically generate list title in response_to_list (#17081)
This gives quickfix/location lists created by handlers which use
'response_to_list' (textDocument/documentSymbols and workspace/symbol by
default) the ability to set a more useful list title. This commit gives
lists created for documentSymbols a title of the form:

    Symbols in <filename>

and lists for workspace/symbol a title of the form:

    Symbols matching '<query>'

These are more informative than a standard "Language Server" list title
and can help disambiguate results when users have multiple quickfix
lists that they cycle through with `:colder` and `:cnewer`.
2022-01-14 14:20:50 -07:00
59ea8fa322 fix(filetype): expand tildes in filetype patterns (#17091)
This allows patterns like

  ["~/.config/foo"] = "fooscript"

to work.
2022-01-14 14:20:17 -07:00
bac4bb1900 Merge pull request #16998 from zeertzjq/lua-vim-var-funcref
feat(api, lua): more conversions between LuaRef and Vim Funcref
2022-01-14 18:00:20 +01:00
b72aae85fd fix(lsp): always split text edits on \r, \r\n, and \n (#17087)
Closes: https://github.com/neovim/neovim/issues/17053

Servers can return a mix of line endings per the language server
protocol. See:

https://microsoft.github.io/language-server-protocol/specification.html#textDocuments

All should be equally treated as line endings.
2022-01-14 08:02:44 -08:00
a88046fe2d Merge pull request #17086 from zeertzjq/vim-8.1.2375
vim-patch:8.1.2375: no suffucient testing for registers
2022-01-13 21:43:58 -05:00
e1b557d913 vim-patch:8.1.2375: no suffucient testing for registers
Problem:    No suffucient testing for registers.
Solution:   Add more test cases. (Yegappan Lakshmanan, closes vim/vim#5296)
            Fix that "p" on last virtual column of tab inserts spaces.
6f1f0ca3ed

This patch doesn't actually change any behavior in Nvim, because Nvim
always has vartabs feature.

I modified a line in the test because of #6137.
2022-01-14 07:31:21 +08:00
9b04336445 Merge pull request #16978 from gpanders/filetype-updates 2022-01-13 15:58:39 -07:00
6e04c8653c fix(filetype): fix foam pattern detection 2022-01-13 15:32:20 -07:00
c38d602b88 feat(filetype.lua): fix .cc file not detected 2022-01-13 15:32:20 -07:00
7a574e54f2 feat(filetype.lua): add support for files under .git 2022-01-13 15:32:18 -07:00
27b664a2de feat(filetype.lua): add support for patch files 2022-01-13 15:31:59 -07:00
94d5358922 feat(filetype.lua): add support for tmux.conf files 2022-01-13 15:31:59 -07:00
19864bd995 feat(filetype.lua): fix .env file not detected 2022-01-13 15:31:59 -07:00
596c55756a vim-patch:8.2.4077: not all Libsensors files are recognized (#17080)
Problem:    Not all Libsensors files are recognized.
Solution:   Add "sensors.d/*" pattern. (Doug Kearns)
8d9e470aa9
2022-01-13 18:31:15 +01:00
8066abcd65 fix(lsp): forward offset_encoding in rename handler (#17079) 2022-01-13 18:28:27 +01:00
9304ee3874 fix(lsp): forward offset_encoding to apply_text_edits (#17075) 2022-01-13 06:47:35 -08:00
4570df0b43 Merge pull request #17034 from zeertzjq/compl-lua-select
feat(completion): support selecting item via API from Lua mapping
2022-01-13 12:26:34 +01:00
bc722c8a74 fix(lsp): strictly enforce passing offset encoding (#17049)
This removes the "fallback" to utf-16 in many of our helper functions. We
should always explicitly pass these around when possible except in two
locations:

* generating params with help utilities called by buf.lua functions
* the buf.lua functions themselves

Anything that is called by the handler should be passed the offset encoding.
2022-01-13 02:34:04 -08:00
e7cd811567 fix(lsp): handle negative activeSignature in signatureHelp (#17064)
omnisharp-roslyn can send negative values:

    {
      activeParameter = 0,
      activeSignature = -1,
      signatures = { {
          documentation = "",
          label = "TestEntity.TestEntity()",
          parameters = {}
        } }
    }

In 3.16 of the specification `activeSignature` is defined as `uinteger`
and therefore negative values shouldn't be allowed, but within 3.15 it
was defined as `number` which makes me think we can be a bit lenient in
this case and handle them.

The expected behavior is quite clear:

    The active signature. If omitted or the value lies outside the
    range of `signatures` the value defaults to zero or is ignored if
    the `SignatureHelp` has no signatures.

Fixes an error:

    util.lua:1685: attempt to get length of local 'lines' (a nil value)
    util.lua:1685: in function 'trim_empty_lines'
    handlers.lua:334: in function 'textDocument/signatureHelp'
2022-01-13 01:47:36 -08:00
43ef7df22d fix(lsp): fix applying multiple out-of-range TextEdits (#17037) 2022-01-13 10:28:13 +01:00
f9b3b2dcfc Merge pull request #16945 from theHamsta/cached-queries
perf(treesitter): cache query parsing
2022-01-13 08:50:01 +00:00
c8656e44d8 feat(api, lua): more conversions between LuaRef and Vim Funcref 2022-01-13 15:07:40 +08:00
3ee1ba35a7 fix(keywordprg): retain terminal buffer after K (#17046) 2022-01-12 22:04:30 -07:00
2fd8330628 Address review r2 2022-01-12 12:46:31 -08:00
d0d4fb792f Address 'review' 2022-01-12 12:28:18 -08:00
39a35dd006 Merge pull request #17058 from clason/bump-treesitter
build(deps): bump treesitter to commit bf210f0
2022-01-12 17:56:44 +00:00
5d15829c2b build(deps): bump treesitter to commit bf210f0
Update to bf210f0c9e, which is a significant improvement to query performance.
2022-01-12 17:04:00 +01:00
c4ce51478a Merge pull request #17054 from jamessan/debug-publish-issues
ci(release): enable gh's api debug logs when creating the release
2022-01-12 07:15:41 -05:00
5bd7ae5b0f ci(release): enable gh's api debug logs when creating the release
This is intended to help track down why the release is sporadically left
in draft state, rather than being published.

[skip ci]
2022-01-12 07:13:25 -05:00
f92a2457c2 Merge pull request #17045 from gpanders/diagnostic-fixups
Various diagnostic fixups
2022-01-11 19:47:50 -07:00
c915571b99 feat(diagnostic): allow retrieving current diagnostic config 2022-01-11 16:46:42 -07:00
8a27205d09 fix(diagnostic): only set default handler config if unset 2022-01-11 16:44:07 -07:00
984270c09f fix(diagnostic): allow setting arbitrary config values 2022-01-11 16:43:47 -07:00
fc8af96888 fix(diagnostic): resolve nil opts tables
In functions which allow opts to be optional, ensure that the value
actually resolves to a non-nil value.
2022-01-11 16:39:15 -07:00
70fe3ce004 vim-patch:8.2.4064: foam files are not detected (#17041)
* vim-patch:8.2.4064: foam files are not detected

Problem:    Foam files are not detected.
Solution:   Detect the foam filetype by the path and file contents. (Mohammed
            Elwardi Fadeli, closes vim/vim#9501)
2284f6cca3

* Port foam ft detection to filetype.lua

Co-authored-by: Gregory Anders <greg@gpanders.com>
2022-01-11 21:02:58 +01:00
074b033e7e refactor(lsp): debounce timer per buf and unify with non-debounce (#17016)
Part of the `pending_change` closure in the `changetracking.prepare` was
a bit confusing because it has access to `bufnr` and `uri` but it could
actually contain pending changes batched for multiple buffers.

(We accounted for that by grouping `pending_changes` by a `uri`, but
it's not obvious what's going on)

This commit changes the approach to do everything per buffer to avoid
any ambiguity.

It also brings the debounce/no-debounce a bit closer together: The
only difference is now whether a timer is used or if it is triggered
immediately
2022-01-11 18:10:29 +01:00
43b95b5430 Merge pull request #16962 from f380cedric/vim-8.2.3409
vim-patch:8.2.3409
2022-01-11 14:14:27 +00:00
e866da12ee vim-patch:2f0936cb9a2e (#17007)
* vim-patch:2f0936cb9a2e

Update runtime files
2f0936cb9a
2022-01-11 14:14:17 +01:00
25eb7692d8 Merge pull request #16961 from f380cedric/vim-8.2.3582
vim-patch:8.2.3582
2022-01-11 06:50:13 +00:00
c7aa64631d feat(completion): support selecting item via API from Lua mapping 2022-01-11 13:59:39 +08:00
7165e7770d fix(man.vim): fix search function on some systems (#13709)
Fixes man.vim's searching on some systems (namely mandoc) where
previously it would not respect the value of b:man_default_sects. It now
properly parses man pages on these systems.
2022-01-10 09:36:46 -07:00
3f2fbb824e fix(lsp): ensure pending changes are flushed on skipped debounce (#17015)
Follow up to https://github.com/neovim/neovim/pull/16881

Document changes could get sent out of order to the server:

    1. on_lines: debounce > 0; add to pending changes; setup timer
    2. on_lines: debounce = 0; send new changes immediately
    3. timer triggers, sending changes from 1.
2022-01-10 17:33:36 +01:00
69f1f906a0 Merge pull request #17025 from zeertzjq/compl-k-lua
fix(completion): prevent K_LUA from closing pum
2022-01-10 15:50:37 +01:00
42e5fd32b0 fix(completion): prevent K_LUA from closing pum 2022-01-10 21:30:32 +08:00
2818de8b76 Merge pull request #17006 from vigoux/tree-sitter-alloc
feat(treesitter): set allocator when possible
2022-01-10 10:52:23 +00:00
8f27c4a041 Merge pull request #17013 from dundargoc/ci/continue-on-error
ci: add a continue-on-error to the add-reviewer jobs
2022-01-09 15:24:43 -05:00
4b84544d86 Merge pull request #16849 from dundargoc/refactor/pvs/v1048
refactor(PVS/V1048): prevent "variable was assigned the same value" warning
2022-01-09 20:30:47 +01:00
f29a4ec553 ci: add a continue-on-error to the add-reviewer jobs
This is to circumvent a limitation in GitHub Actions that requires
special organization access in order to add any reviewers.
2022-01-09 19:57:25 +01:00
6ecaba510f test: use old style test for testing filetype.lua (#17003)
This is a much better solution than #16942 as it doesn't require copying
every new change from test_filetype.vim into filetype_spec.lua (which is
much more maintainable).
2022-01-09 09:11:09 -07:00
a34652ee84 fix(api): validate user_command name (#17004)
The name argument of nvim_add_user_command must begin with an uppercase
character. Check that is does.
2022-01-09 08:54:03 -07:00
8d5288889a Merge pull request #16965 from dundargoc/ci/add-reviewer-based-on-label
ci: add reviewer based on label
2022-01-09 08:57:13 -05:00
fd71162428 ci: add reviewer based on label
Also remove CODEOWNERS since this is a superior solution.
2022-01-09 11:30:05 +01:00
b1e0aa60f9 feat(treesitter): set allocator when possible
Adds a new cmake check to keep this backwards compatible with the
different versions of tree-sitter.
2022-01-09 10:17:46 +00:00
c7ffe406bc Merge pull request #16983 from dundargoc/test/add-vimruntime-variable
test: add VIMRUNTIME variable to the clear function
2022-01-08 19:31:37 -05:00
2e5bafa04c Merge pull request #17000 from dundargoc/ci/use-continue-on-error
ci: use continue-on-error instead of "|| true"
2022-01-08 16:10:47 -05:00
adf213e05e refactor(PVS/V1048): ignore "assigned the same value" warning 2022-01-08 21:11:43 +01:00
6c4b9c914b Merge pull request #16979 from dundargoc/ci/add-tsan-clang-sanitizer
ci: set CLANG_SANITIZER variable to TSAN when running the tsan job
2022-01-08 15:01:27 -05:00
e41e8b3fda fix(lsp): only send valid params in executeCommand (#16987) 2022-01-08 10:15:41 -08:00
11142f6ffe feat(extmarks): add strict option
The strict option, when set to false, allows placing extmarks on
invalid row and column values greater than the maximum buffer row
or line column respectively.

This allows for nvim_buf_set_extmark
to be a drop-in replacement for nvim_buf_set_highlight.
2022-01-08 08:47:20 -08:00
9386fca597 Merge pull request #16848 from dundargoc/refactor/prevent-overflow-by-casting
refactor: avoid overflow by explicitly casting operand to a wider type
2022-01-08 16:47:23 +01:00
e70ea6ea20 test: remove redundant feed_command('terminal') (#16993)
It just types :terminal<CR> into the terminal, which is redundant.
2022-01-08 08:29:32 -07:00
559aa4179c ci: use continue-on-error instead of "|| true"
The intention is clearer and doesn't rely on shell-isms.
2022-01-08 15:31:14 +01:00
14ec38bcf9 test: add VIMRUNTIME variable to the clear function
Some of the tests will fail if this isn't explicitly set.
2022-01-08 14:40:29 +01:00
3088ac71f9 Merge pull request #16991 from bk2204/ex-mode
Make mode() return correct value in ex mode
2022-01-08 13:13:43 +01:00
b65a23a13a fix(lsp): resolve bufnr for get_lines (#16986)
Closes https://github.com/neovim/neovim/issues/16985

* get_lines checks if buf_loaded using bufnr 0, which is
  typically used as a sentinel value, but here must be resolved
  to the true bufnr
2022-01-08 11:30:59 +01:00
600e7e3b32 fix: make mode() return correct value in ex mode
When the user is in ex mode, a call to mode(1) is documented to return
"cv".  However, it does not currently do so, because the check which
checks for ex mode is nested inside a conditional which is never reached
in ex mode.  Vim uses an explicit check for exmode_active, so let's do
the same thing here.  Add some tests for this case both with a TTY and
in silent mode.
2022-01-08 03:11:50 +00:00
e92b816336 fix(filetype): match negative priority patterns after extensions (#16980)
Negative priority patterns are those that act as catch-alls when all
other attempts at matching have failed (typically the patterns that use
the StarSetf functions).
2022-01-07 19:17:07 -07:00
20122a3590 vim-patch:8.2.4033: running filetype tests leaves directory behind (#16984)
Problem:    Running filetype tests leaves directory behind.
Solution:   Delete the top directory. (closes vim/vim#9483)
a4c96252b1
2022-01-07 19:15:27 -07:00
c2b9dea4ba ci: set CLANG_SANITIZER variable to TSAN when running the tsan job 2022-01-07 20:20:02 +01:00
b4fbb9dcf2 Merge pull request #16970 from dundargoc/ci/serialize-labeler-workflow 2022-01-07 10:33:19 -05:00
df06c36932 ci: run type-scope job after the triage job
This should prevent the scenario of one job accidentally removing a
relevant label from the other.
2022-01-07 13:32:14 +01:00
b680392687 feat(lsp): skip or reduce debounce after idle (#16881)
The idea of the debounce is to avoid overloading a server with didChange
notifications. So far this used a constant value to group changes within
an interval together and send a single notification. A side effect of
this is that when you were idle, notifications are still delayed.

This commit changes the logic to take the time the last notification
happened into consideration, if it has been greater than the debounce
interval, the debouncing is skipped or at least reduced.
2022-01-07 11:56:09 +01:00
bba679c431 vim-patch:8.2.4014: git and gitcommit file types not properly recognized (#16953)
Problem:    Git and gitcommit file types not properly recognized.
Solution:   Adjust filetype detection. (Tim Pope, closes vim/vim#9477)
c689f8c3d9
2022-01-07 10:27:34 +01:00
aa5adef969 vim-patch:8.2.4007: session does not restore help buffer properly
Problem:    Session does not restore help buffer properly when "options' is
            missing from 'sessionoptions'.
Solution:   Use a ":help" command to create the help window. (closes vim/vim#9475,
            closes vim/vim#9458, closes vim/vim#9472)
8e7d9db32b
2022-01-07 13:39:52 +08:00
e58071c92c vim-patch:8.2.0951: search stat test has leftover from debugging (#16967)
Problem:    Search stat test has leftover from debugging.
Solution:   Remove line that writes a file. (Christian Brabandt, closes vim/vim#6224)
6ba24d8763
2022-01-06 18:51:06 -07:00
b435755452 fix(runtime): check markdownError before syn-clear (#16930)
Avoids `E28: No such highlight group name: markdownError` when using a
foreign markdown syntax.
2022-01-06 11:51:47 -07:00
287d3566de fix(lua): print multiple return values with =expr (#16933) 2022-01-06 11:42:31 -07:00
d78e46679d feat(lua): add notify_once() (#16956)
Like vim.notify(), but only displays the notification once.
2022-01-06 11:10:56 -07:00
c6dddc3464 vim-patch:8.2.3582: reading uninitialized memory when giving spell suggestions
Problem:    Reading uninitialized memory when giving spell suggestions.
Solution:   Check that preword is not empty.
15d9890eee
2022-01-06 18:47:31 +01:00
2f779e3361 Merge pull request #16591 from shadmansaleh/feat/lua_keymaps2
feat(lua): add support for lua keymaps
2022-01-06 18:35:31 +01:00
bb7ef83dd3 Merge pull request #16817 from lewis6991/master
vim-patch:8.2.3921: the way xdiff is used is inefficient
2022-01-06 18:26:29 +01:00
9c26939f75 perf(treesitter): cache query parsing 2022-01-06 13:20:22 +01:00
d63284e5a6 vim-patch:8.2.3409: reading beyond end of line with invalid utf-8 character
Problem:    Reading beyond end of line with invalid utf-8 character.
Solution:   Check for NUL when advancing.
65b6056659

Dropped the non-test part, since it is only non-utf8 related.
2022-01-06 13:16:04 +01:00
09d270bcea Merge pull request #16942 from gpanders/test-filetype-lua 2022-01-05 13:21:18 -07:00
ef214e9753 chore: remove lspconfig checkhealth from issue template (#16948) 2022-01-05 12:13:16 -08:00
6c86079fa0 fix(filetype): normalize slashes in file paths 2022-01-05 12:26:43 -07:00
f1590717ac test(filetype): port test_filetype to Lua
Because filetype.lua is gated behind an opt-in variable, it's not tested
during the "standard" test_filetype.vim test. So port the test into
filetype_spec where we enable the opt-in variable.

This means runtime Vim patches will need to update test_filetype in two
places. This can eventually be removed if/when filetype.lua is made
opt-out rather than opt-in.
2022-01-05 10:41:25 -07:00
f40ce34563 fix(filetype): match on <afile> rather than <abuf> (#16943)
Filetype detection runs on BufRead and BufNewFile autocommands, both of
which can fire without an underlying buffer, so it's incorrect to use
<abuf> to determine the file path. Instead, match on <afile> and assume
that the buffer we're operating on is the current buffer. This is the
same assumption that filetype.vim makes, so it should be safe.
2022-01-05 09:50:54 -07:00
55a59e56ed feat(lsp): enable default debounce of 150 ms (#16908) 2022-01-05 08:36:35 -08:00
30547c0d2b vim-patch:8.2.3999: redundant check for NUL byte
Problem:    Redundant check for NUL byte.
Solution:   Remove the check for a NUL byte. (closes vim/vim#9471)
c024ed9233
2022-01-05 22:11:28 +08:00
bfe11dc8d0 vim-patch:8.2.3414: fullcommand() gives wrong name with buffer-local user command
Problem:    fullcommand() gives the wrong name if there is a buffer-local user
            command. (Naohiro Ono)
Solution:   Use a separate function to get the user command name.
            (closes vim/vim#8840)
80c88eac5a
2022-01-05 22:11:28 +08:00
6e1a59da6c vim-patch:8.2.2887: crash when passing null string to fullcommand()
Problem:    Crash when passing null string to fullcommand().
Solution:   Check for NULL pointer. (closes vim/vim#8256)
4c8e8c6e19
2022-01-05 22:11:28 +08:00
f65b0d4236 feat(autocmd): populate v:event in RecordingLeave (#16828) 2022-01-04 18:55:29 -07:00
a45b578dbe feat(filetype.lua): add support for txt files (#16926) 2022-01-04 16:06:57 -07:00
74a90cf098 chore: ignore unused args in filetype functions (#16927)
Also mark the 'getline' helper function as private to avoid docgen.
2022-01-04 15:24:14 -07:00
bb5e03fa4b test: fix absolute paths in filetype_spec (#16920) 2022-01-04 15:21:36 -07:00
60d3bb745d fix(filetype): set default ft_ignore_pat in filetype.lua (#16917)
This default value is also set in filetype.vim, but if filetype.vim is
disabled the variable is never defined, which causes errors in some of
the dist#ft detection functions.
2022-01-04 15:02:01 -07:00
8ade8009ee feat(filetype.lua): Add typescript extension to filetype detection (#16923)
port from `filetype.vim`; also add `getline` convenience function
2022-01-04 22:34:55 +01:00
39238435db fix(api): force redefinition of user commands by default (#16918) 2022-01-04 11:51:45 -07:00
0b0c4f7dfa chore: fix typos (#16816)
Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Sebastian Volland <seb@baunz.net>
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-01-04 11:07:40 -07:00
d6f0c9539c fix(lsp): suppress ContentModified errors from UI (#16904)
Fixes https://github.com/neovim/neovim/issues/16900

If clients receive a ContentModified error, it generally should not
show it in the UI for the end-user. Clients can resend the request if
they know how to do so.

https://microsoft.github.io/language-server-protocol/specifications/specification-current/#implementationConsiderations
2022-01-04 09:28:13 -08:00
6d41f65aa4 feat(lua): add vim.keymap
This introduces two new functions `vim.keymap.set` & `vim.keymap.del`

differences compared to regular set_keymap:
- remap is used as opposite of noremap. By default it's true for <Plug> keymaps and false for others.
- rhs can be lua function.
- mode can be a list of modes.
- replace_keycodes option for lua function expr maps. (Default: true)
- handles buffer specific keymaps

Examples:
```lua
vim.keymap.set('n', 'asdf', function() print("real lua function") end)
vim.keymap.set({'n', 'v'}, '<leader>lr', vim.lsp.buf.references, {buffer=true})
vim.keymap.set('n', '<leader>w', "<cmd>w<cr>", {silent = true, buffer = 5 })
vim.keymap.set('i', '<Tab>', function()
  return vim.fn.pumvisible() == 1 and "<C-n>" or "<Tab>"
end, {expr = true})
vim.keymap.set('n', '[%', '<Plug>(MatchitNormalMultiBackward)')

vim.keymap.del('n', 'asdf')
vim.keymap.del({'n', 'i', 'v'}, '<leader>w', {buffer = 5 })
```
2022-01-04 22:31:59 +06:00
3fd454bd4a feat: filetype.lua (#16600)
Adds a new vim.filetype module that provides support for filetype detection in
Lua.
2022-01-04 07:28:29 -07:00
cc62f3d6cb test: make test for #14040 more stable (#16911) 2022-01-04 07:25:28 -07:00
e79a588937 Merge pull request #16912 from shadmansaleh/enhance/lua_cmd_inspect
feat(lua): make :lua =expr print result of expr
2022-01-04 14:34:42 +01:00
d44254641f feat(lua): make =expr print result of expr 2022-01-04 16:08:07 +06:00
4ddd6c53bd fix(screen): don't put empty sign text in line number column
When `signcolumn=number` but no sign on a given line has any text,
display the line's line number instead of the (empty) sign text in the
line number column.
2022-01-04 01:49:40 -05:00
207307d0fa fix(lsp): explicitly pass bufnr in didSave handler (#16906)
Addresses a regression introduced by the stricter type checking
in lua api functions from https://github.com/neovim/neovim/pull/16745
2022-01-03 21:03:16 -05:00
efe6485aca Merge pull request #16903 from dundargoc/ci/install-flake-with-apt
ci: install flake8 with apt instead of pip
2022-01-03 16:23:20 -05:00
ec615abd1f ci: install flake8 with apt instead of pip 2022-01-03 21:54:23 +01:00
1036ca846e Merge pull request #16901 from dundargoc/ci/add-codeowners
ci: add jamessan as codeowner for ci related files
2022-01-03 14:50:40 -05:00
e402103911 chore(build): compile lua only on release builds (#16859) 2022-01-03 12:44:30 -07:00
e6c1545b19 fix(lsp): resolve nil bufnr (#16902)
Related: #16889, #16745
2022-01-03 12:40:09 -07:00
b402cd3315 ci: add jamessan as codeowner for ci related files
[skip ci]
2022-01-03 20:27:31 +01:00
6aeaff1220 vim-patch:8.2.3995: not all sshconfig files are detected as such (#16899)
Problem:    Not all sshconfig files are detected as such.
Solution:   Adjust the patterns used for sshconfig detection. (David Auer,
            closes vim/vim#9322)
9acf2d8be9
2022-01-03 19:29:46 +01:00
be255557ce ci: simplify ci_fold function (#16874) 2022-01-03 11:47:11 -05:00
6ed9ddec29 Merge pull request #16895 from dundargoc/ci/fix-shellcheck-warnings
ci: fix shellcheck errors introduced in version 0.8.0
2022-01-03 11:40:20 -05:00
297ff97647 fix(lua): stricter type check when calling API function (#16745)
Solves #13651

Co-authored-by: Gregory Anders <greg@gpanders.com>
2022-01-03 08:00:50 -07:00
76435c0cfa docs(usr_05): fix section numbers (#16886)
Other refs to 05.3 don't need to be updated as they refer to the simple mappings
section anyway. Seems they weren't updated when the defaults.vim section was
added as 05.3 instead.
2022-01-03 14:52:01 +01:00
36662c9612 fix: resolve nil arguments to API functions (#16889)
As revealed by #16745, some functions pass a nil value to API functions,
which have been implicitly converted to 0. #16745 breaks this implicit
conversion, so explicitly pass a resolved buffer number to these API
functions.
2022-01-03 06:48:01 -07:00
167c10130c ci: fix shellcheck errors introduced in version 0.8.0
Solved following shellcheck warnings:
SC2030
SC2295
SC2015
2022-01-03 12:47:06 +01:00
2f31e7b88b Merge pull request #16890 from dundargoc/ci/nuke-before-install
ci: remove unnecessary before_install script
2022-01-02 20:13:07 -05:00
e71fbf2eb0 ci: remove unnecessary before_install script 2022-01-02 23:46:46 +01:00
b0993bdc45 Merge pull request #16853 from jamessan/clint-master-only
ci: run lint only on master branch
2022-01-02 14:07:01 -05:00
b823ff9a60 Merge pull request #16883 from dundargoc/ci/remove-watchdog
ci: remove watchdog function run_tests_wd
2022-01-02 12:54:42 -05:00
64f23c27e2 ci: remove watchdog function run_tests_wd
It's only used once for running check-single-includes (which I strongly
suspect it doesn't need anyway), its core logic is incorrect since both the
variables "tempsize" and "prev_temsize" are never defined and parsing ps
is incredibly fragile.
2022-01-02 18:23:28 +01:00
e42c906597 fix(lsp): always use target bufnr in location handler (#16876) 2022-01-02 07:55:16 +01:00
838631e29e fix(diagnostic): improve validation for list arguments (#16855)
Function arguments that expect a list should explicitly use tbl_islist
rather than just checking for a table. This helps catch some simple
errors where a single table item is passed as an argument, which passes
validation (since it's a table), but causes other errors later on.
2022-01-01 12:58:34 -07:00
55c4393e9f feat(lua): add support for multiple optional types in vim.validate (#16864) 2022-01-01 12:35:15 -07:00
f86039de1e ci: remove outdated travis-specific code (#16869) 2022-01-01 12:42:26 -05:00
302beaa36b build(deps): bump tree-sitter to v0.20.2 (#16863) 2022-01-01 17:59:00 +01:00
603db555a4 Merge pull request #16870 from dundargoc/refactor/pvs/V009
refactor(PVS/V009): add special comment at top of file required by PVS
2022-01-01 11:55:27 -05:00
e5f7b61136 Merge pull request #16840 from zeertzjq/ci-clang-13
ci: bump clang version to 13 in asan and tsan
2022-01-01 11:43:38 -05:00
273b5c9282 Merge pull request #16871 from bfredl/luaperf
perf(api): elide luaref copy when setting 'callback' in nvim_set_keymap
2022-01-01 17:21:26 +01:00
9f489f591d perf(api): elide luaref copy when setting 'callback' in nvim_set_keymap 2022-01-01 16:41:16 +01:00
68b23b08a0 refactor(PVS/V009): add special comment at top of file required by PVS
More info: https://pvs-studio.com/en/docs/warnings/v009/
2022-01-01 16:23:22 +01:00
a5eadbaf3c test: make some tests more stable (#16860) 2022-01-01 07:28:52 -07:00
5dbc64dced Merge pull request #16857 from dundargoc/vim-8.2.3956
vim-patch:8.2.3956
2022-01-01 14:15:54 +01:00
b0f21adef0 vim-patch:8.2.3964: some common lisp and scheme files not recognized (#16866)
Problem:    Some common lisp and scheme files not recognized.
Solution:   Recognize *.asd as lisp and *.sld as scheme. (Alex Vear,
            closes vim/vim#9447)
654b729c4c
2022-01-01 14:00:33 +01:00
f6c89e03d7 vim-patch:8.2.3956: duplicate assignment
Problem:    Duplicate assignment.
Solution:   Remove the second assignment. (closes vim/vim#9442)
4b1478093e
2022-01-01 12:44:26 +01:00
36a8f31a37 vim-patch:partial 04fb91668482 (#16852)
Update runtime files
04fb916684

omits doc/usr_41.txt (rewritten to focus on vim9script)
2022-01-01 10:56:55 +01:00
3fccdeb326 chore(fixup): bfredl size_t 2022-01-01 02:55:34 +01:00
6fb9c278d8 chore(fixup): zeer
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-01-01 02:52:39 +01:00
6a932f68e6 ci: bump clang version to 13 in asan and tsan 2022-01-01 06:24:48 +08:00
b218d02c44 Merge pull request #16594 from shadmansaleh/feat/api/lua_keymaps
feat(api): add support for lua function & description in keymap
2021-12-31 20:10:35 +01:00
b411f436d3 feat(api): add support for lua function & description in keymap
Behavioral changes:

1. Added support for lua function in keymaps in
--------------------------------------------
- nvim_set_keymap
  Can set lua function as keymap rhs like following:
```lua
vim.api.nvim_{buf_}set_keymap('n', '<leader>lr', '', {callback = vim.lsp.buf.references})
```
  Note: lua function can only be set from lua . If api function being
  called from viml or over rpc this option isn't available.
- nvim_{buf_}get_keymap
  When called from lua, lua function is returned is `callback` key .
  But in other cases callback contains number of the function ref.
- :umap, nvim_del_keymap & nvim_buf_del_keymap clears lua keymaps correctly.
- :map commands for displaing rhs .
   For lua keymaps rhs is displayed as <Lua function ref_no>
   Note: lua keymap cannot be set through viml command / functions.
- mapargs()
  When dict is false it returns string in `<Lua function ref_no>`
  format (same format as :map commands).
  When dict is true it returns ref_no number in `callback` key.
- mapcheck()
  returns string in `<Lua function ref_no>` format (same format as :map commands).

2. Added support for keymap description
---------------------------------------
- nvim_{buf_}set_keymap: added `desc` option in opts table .
 ```lua
vim.api.nvim_set_keymap('n', '<leader>w', '<cmd>w<cr>', {desc='Save current file'})
```
- nvim_{buf_}get_keymap: contains `desc` in returned list.
- commands like `:nmap <leader>w` will show description in a new line below rhs.
- `maparg()` return dict contains `desc`.
2022-01-01 00:26:58 +06:00
5c1b8b77c5 fix(runtime): add missing release metadata 2021-12-31 19:04:37 +01:00
35034da779 ci: run lint only on master branch
The list of known lint issues is only updated for the master branch, so
other branches report lots of false positive issues.
2021-12-31 12:09:23 -05:00
fc62fdd42f Merge pull request #16846 from dundargoc/ci/remove-brew-workaround
ci: remove outdated brew workaround that isn't needed anymore
2021-12-31 11:24:48 -05:00
dc3a16abfc Merge pull request #16851 from zeertzjq/vim-8.2.3952
vim-patch:8.2.3952: first line not redrawn when adding lines to an empty buffer
2021-12-31 15:48:02 +01:00
ba7b30080f vim-patch:8.2.3952: first line not redrawn when adding lines to an empty buffer
Problem:    First line not redrawn when adding lines to an empty buffer.
Solution:   Adjust the argument to appended_lines(). (closes vim/vim#9439,
            closes vim/vim#9438)
1fa3de1ce8
2021-12-31 22:20:31 +08:00
db7fe34017 refactor: avoid overflow by explicitly casting operand to a wider type 2021-12-31 14:45:03 +01:00
2a12e8ddfd ci: remove outdated brew workaround that isn't needed anymore 2021-12-31 13:09:01 +01:00
991e872d80 Merge pull request #16728 from dundargoc/refactor/remove-unused-macros
refactor: remove unused macros
2021-12-30 22:20:10 +01:00
7e9aaf1e0f refactor: remove unused macros
Closes #13505
2021-12-30 21:53:18 +01:00
9d37b0998f vim-patch:8.2.3571: some unicode control characters are considered printable
Problem:    Some unicode control characters are considered printable.
Solution:   Make 0x2060 - 0x2069 not printable.
2021-12-30 12:53:38 +09:00
c46f7caad0 Merge pull request #16373 from zeertzjq/terminal-mouse-release-forward
fix(terminal): correctly forward mouse events
2021-12-28 23:44:17 +01:00
7bb593169e Merge pull request #16752 from gpanders/lua-user-commands
feat(api): implement nvim_{add,del}_user_command
2021-12-28 23:18:07 +01:00
f89989dbf3 vim-patch:8.2.3921: the way xdiff is used is inefficient
Problem:    The way xdiff is used is inefficient.
Solution:   Use hunk_func instead of the out_line callback. (Lewis Russell,
            closes vim/vim#9344)
d9da86e94e
2021-12-28 21:12:44 +00:00
eff11b3c3f feat(api): implement nvim_{add,del}_user_command
Add support for adding and removing custom user commands with the Nvim
API.
2021-12-28 14:08:44 -07:00
08616571f4 chore: fix typos (#16506)
Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Christoph Hasse <hassec@users.noreply.github.com>
Co-authored-by: Alef Pereira <ealefpereira@gmail.com>
Co-authored-by: AusCyber <willp@outlook.com.au>
Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
2021-12-28 18:15:16 +01:00
2ff5189d68 chore: fix compiler warning for multi-line comment (#16812) 2021-12-28 15:55:28 +01:00
645b314576 vim-patch:a4d131d11052 (#16811)
Update runtime files
a4d131d110
2021-12-28 12:24:44 +01:00
6e00d4754c vim-patch:8.2.3914 (#16808)
* vim-patch:8.2.3914: various spelling mistakes in comments

Problem:    Various spelling mistakes in comments.
Solution:   Fix the mistakes. (Dominique Pellé, closes vim/vim#9416)
af4a61a85d

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2021-12-28 11:28:48 +01:00
9804a2870f Merge pull request #16805 from clason/vim-8.2.3905
vim-patch:8.2.{3905,3909}: Dockerfile, Containerfile using prefix name not recognized
2021-12-27 12:52:43 +01:00
d54329e1b6 vim-patch:8.2.3909: Containerfile using prefix name not recognized
Problem:    Containerfile using prefix name not recognized.
Solution:   Recognize Containerfile.*.
bbdd3fb804
2021-12-27 12:52:17 +01:00
5743b0345c vim-patch:8.2.3905: Dockerfile using prefix name not recognized
Problem:    Dockerfile using prefix name not recognized.
Solution:   Recognize Dockerfile.*. (closes vim/vim#9410)
c88ac94a0b
2021-12-27 12:52:17 +01:00
f6df44232c docs: clarify UIEnter and UILeave docs 2021-12-27 17:31:32 +08:00
06ca0667a1 Merge pull request #16799 from bfredl/nohlsplash
fix(api): nvim__set_hl_ns causes extra redraws
2021-12-27 08:56:45 +01:00
505c12cb9c fix(api): nvim__set_hl_ns causes extra redraws 2021-12-26 23:43:37 +01:00
e0956f7452 fix(terminal): correctly forward mouse events 2021-12-27 06:08:16 +08:00
56f3c41f5f fix(uri): change scheme pattern to not include the comma character (#16797) 2021-12-26 16:36:14 -05:00
99526dc9b3 Merge pull request #16596 from dm1try/do_not_leave_terminal_mode_after_mouse_activation
do not leave Terminal mode after entering to it using a mouse
2021-12-26 19:11:51 +01:00
457a8ca7a7 Merge pull request #16630 from kylo252/unused-includes
refactor(build): remove unused includes
2021-12-26 19:03:21 +01:00
a23f4a7921 Merge pull request #16792 from zeertzjq/ins-lastc-k-event
fix: do not save K_EVENT as lastc in Insert mode
2021-12-26 18:29:49 +01:00
2b0be9eff8 Merge pull request #16788 from jamessan/strptime-fix
fix(msgpack#strptime): use calendar.timegm to get seconds since epoch
2021-12-26 09:42:52 -05:00
8c720f6b9d vim-patch:partial fa3b72348d88 (#16780)
Update runtime files
fa3b72348d

omit
doc/eval.txt (needs 8.2.3864)
doc/map.txt (needs 8.2.3619)
menu.vim (needs 8.2.0413)
2021-12-26 11:03:25 +01:00
ab1ceaaaa9 fix: do not save K_EVENT as lastc in Insert mode
I'm also gonna move some other K_EVENT-related tests to vim_spec.lua
2021-12-26 16:14:35 +08:00
9dd8557921 Merge pull request #16774 from zeertzjq/vim-8.2.2468
vim-patch:8.2.2468: not easy to get the full command name from a shortened one
2021-12-25 23:26:59 -05:00
333dd6f80b vim-patch:8.1.1412: test 30 is old style (#16768)
Problem:    Test 30 is old style.
Solution:   Turn it into a new style test. (Yegappan Lakshmanan, closes vim/vim#4440)
72fcf07b06
2021-12-25 23:20:03 -05:00
599a3d6abd fixup! vim-patch:8.2.2468: not easy to get the full command name from a shortened one 2021-12-26 11:25:57 +08:00
1dcdf86849 Merge pull request #16618 from zeertzjq/vim-8.2.3780
vim-patch:8.2.{3780,3784}: ":cd" works differently on MS-Windows
2021-12-25 21:10:44 -05:00
8bc7c6fab9 Merge pull request #16767 from zeertzjq/vim-8.2.3879
vim-patch:8.2.{3879,3882}
2021-12-25 19:36:02 -05:00
397201f2c6 Merge pull request #16705 from zeertzjq/vim-8.2.2508
vim-patch:8.2.{2508,2641,3846}
2021-12-25 19:08:36 -05:00
06985fa595 vim-patch:8.2.3883: crash when switching to other regexp engine fails (#16773)
Problem:    Crash when switching to other regexp engine fails.
Solution:   Check for regprog being NULL.
5937c7505f
2021-12-25 19:02:54 -05:00
96230d6c69 Merge pull request #16789 from janlazo/vim-8.1.1184
vim-patch:8.1.{1184,1379}
2021-12-25 18:30:51 -05:00
19ec20700b vim-patch:8.2.3880: Solution filter files are not recognized (#16779)
Problem:    Solution filter files are not recognized.
Solution:   Add pattern *.slnf and use json. (Doug Kearns)
70a120b72b
2021-12-25 18:26:27 -05:00
f7d840e295 Merge pull request #16724 from VVKot/vim-8.2.3850
vim-patch:8.2.{3850,3855}
2021-12-25 18:24:23 -05:00
57337e6814 vim-patch:8.1.1379: filechanged test hangs
Problem:    Filechanged test hangs.
Solution:   Do not check 'autoread'.
8239c62067
2021-12-25 18:01:17 -05:00
2f1e6ca773 vim-patch:8.1.1184: undo file left behind after running test
Problem:    Undo file left behind after running test.
Solution:   Delete the undo file. (Dominique Pelle, closes vim/vim#4279)
137c14bb4f
2021-12-25 17:59:41 -05:00
6b8a365465 test: port test_filechanged.vim
I can't port patch 8.1.0820.
Attempt failed in https://github.com/neovim/neovim/pull/12948.
test_filechanged.vim is required for later patches.
2021-12-25 17:55:52 -05:00
7622f1afe9 test(old): reenable Test_virtual_replace() (#16674) 2021-12-25 17:26:29 -05:00
e11a44aa22 feat(lua): add vim.spell (#16620) 2021-12-25 12:36:56 -07:00
2ae63161e8 Merge pull request #16725 from VVKot/vim-8.1.0040
vim-patch:8.1.0040: warnings from 64-bit compiler
2021-12-25 19:32:13 +01:00
fb14e2a8d6 fix(msgpack#strptime): use calendar.timegm to get seconds since epoch
datetime.datetime.timestamp does not exist on Windows and
datetime.datetiem.strftime('%s') is not supported, since '%s' is a POSIX
format.  Instead, use the recommended `calendar.timegm(obj.utctimetuple())`.
2021-12-25 12:11:34 -05:00
9e93e5c0c8 Merge pull request #16786 from jamessan/cancel-previous-ci
ci: cancel in-progress CI if a PR is updated
2021-12-25 12:03:01 -05:00
094c3f2b54 ci: cancel in-progress CI if a PR is updated
[skip ci]
2021-12-25 11:11:54 -05:00
4f95224907 vim-patch:8.2.3873: go.mod files are not recognized (#16757)
Problem:    go.mod files are not recognized.
Solution:   Check for the file name. (closes vim/vim#9380)
82b3b4c6cf
2021-12-25 15:17:55 +01:00
3e81c1f9b5 Merge pull request #16762 from zeertzjq/grid-truncate-pum-double-width
Truncate double-width character at the end of popup menu correctly
2021-12-25 13:36:37 +01:00
d2f62b3164 chore(editorconfig): set max_line_length for .h and .in files (#16775) 2021-12-24 22:35:38 -07:00
70a68dc2c5 fix(options): disallow empty 'fdc' and 'scl' (#16765)
Empty string values for these options aren't actually allowed, but
check_opt_strings allows empty string options.

It so happens that 'scl' handles empty string like "auto", but empty 'fdc'
causes glitchiness (win_fdccol_count returns an incorrect value).

Just disallow empty string values for these options completely.
2021-12-24 22:30:34 -07:00
a5d3dd9359 vim-patch:partial:0e6adf8a29d5
Update runtime files
0e6adf8a29
2021-12-25 11:31:54 +08:00
cf609ce655 vim-patch:8.2.3784: the help for options is outdated
Problem:    The help for options is outdated.
Solution:   Include all the recent changes.
7b1463bca3

This is the only applicable hunk.
2021-12-25 11:31:54 +08:00
42cf76fd0a vim-patch:8.2.3780: ":cd" works differently on MS-Windows
Problem:    ":cd" works differently on MS-Windows.
Solution:   Add the 'cdhome' option. (closes vim/vim#9324)
29f3a45915
2021-12-25 11:31:54 +08:00
ccc4d83507 vim-patch:partial:6c391a74fe90
Update runtime files
6c391a74fe
2021-12-25 08:36:32 +08:00
7fa8411d8b vim-patch:partial:6aa57295cfbe
Update runtime files
6aa57295cf
2021-12-25 08:32:58 +08:00
8eff0ca6d5 vim-patch:8.2.2468: not easy to get the full command name from a shortened one
Problem:    Not easy to get the full command name from a shortened one.
Solution:   Add fullcommand(). (Martin Tournoij, closes vim/vim#7777)
038e09ee76
2021-12-25 07:42:06 +08:00
903ec5bd85 vim-patch:8.2.3882: more duplicated code in f_getreginfo()
Problem:    More duplicated code in f_getreginfo().
Solution:   Also use getreg_get_regname(). (closes vim/vim#9398)
d3f00f54bf
2021-12-24 21:20:34 +08:00
125e870772 vim-patch:8.2.3879: getreg() and getregtype() contain dead code
Problem:    getreg() and getregtype() contain dead code.
Solution:   Remove the needless check. (closes vim/vim#9392)  Also refactor to put
            common code in a shared function.
51e64b2789
2021-12-24 21:20:34 +08:00
4f70b31f7a refactor(pum_redraw): rename col -> grid_col
This is initialized to `col_off`, while in Vim this variable `col` that
is used in the same places is initialized to `pum_col`. This can cause
confusion in patch porting, and it caused Vim patch 8.2.1995 to be
ported incorrectly. (I reverted the incorrect part in the last commit
though.) Rename it to `grid_col` to make it clear that it is different
from Vim's `col` variable.
2021-12-24 08:06:27 +08:00
e6d35b9e40 fix(pum_redraw): use grid_puts_len() to truncate the text
Nvim already resizes grid to the required width, so there is no need to
truncate the text in pum_redraw(). What's more, truncation is currently
done incorrectly because Vim patch 8.2.1995 was ported incorrectly.

This nearly reverts the truncation part of Vim patch 8.2.1995, but not
the part that reduces unnecessary calls to pum_redraw(). The original PR
https://github.com/vim/vim/pull/7306 didn't explain much about which
part of it actually reduces redraws.
2021-12-24 08:06:27 +08:00
28dadd5a54 fix(screen): truncate when overwriting right half of a double-width char
Unlike the code above, this truncates the character in the same grid.
This is mainly for the pum scrollbar in the next commit.
2021-12-24 08:06:27 +08:00
bc75544fac fix(screen): truncate double-width character correctly
The `c = '>';` is useless here, because it is not used later.
`u8c` should also need to be set to '>', and `u8cc` needs to be cleared.
2021-12-24 08:06:26 +08:00
0d7a97224f chore: set max_line_length in editorconfig (#16755)
We established a while ago that 100 chars is our line length for both C
and Lua. Not all editorconfig plugins support the "max_line_length"
option, but many do (including all of the ones available for Vim/Neovim
to the best of my knowledge).
2021-12-23 06:46:57 -07:00
bc27d807f3 docs: regenerate (#16742)
Co-authored-by: marvim <marvim@users.noreply.github.com>
2021-12-23 13:55:38 +01:00
67bf5c237f vim-patch:8.2.3876: 'cindent' does not recognize inline namespace
Problem:    'cindent' does not recognize inline namespace.
Solution:   Skip over "inline" to find "namespace". (closes vim/vim#9383)
f2f0bddf30
2021-12-23 07:41:23 +08:00
de8a2f20e9 vim-patch:8.2.3625: illegal memory access when C-indenting
Problem:    Illegal memory access when C-indenting.
Solution:   Also set the cursor column.
2de9b7c7c8
2021-12-23 07:41:23 +08:00
6714ea35ac vim-patch:8.2.3482: reading beyond end of line ending in quote and backslash
Problem:    Reading beyond end of line ending in quote and backslash.
Solution:   Check for non-NUL after backslash. (closes vim/vim#8964)
78e0fa4cf4
2021-12-23 07:41:23 +08:00
b8d6ab04a2 vim-patch:8.1.1585: :let-heredoc does not trim enough
Problem:    :let-heredoc does not trim enough.
Solution:   Trim indent from the contents based on the indent of the first
            line.  Use let-heredoc in more tests.
e7eb92708e

This is a missing part of Vim patch 8.1.1585 from #11211.
2021-12-23 07:41:23 +08:00
e3f615b205 vim-patch:8.1.1434: test 3 is old style
Problem:    Test 3 is old style.
Solution:   Turn into a new style test. (Yegappan Lakshmanan, closes vim/vim#4460)
1ab74a5af3
2021-12-23 07:41:23 +08:00
7b8fbbdebe Merge pull request #16754 from jamessan/vim-8.2.3874
vim-patch:8.2.3874
2021-12-22 17:34:36 -05:00
29141fc66a vim-patch:8.2.3874: cannot highlight the number column for a sign
Problem:    Cannot highlight the number column for a sign.
Solution:   Add the "numhl" argument. (James McCoy, closes vim/vim#9381)
a80aad7174
2021-12-22 15:03:32 -05:00
0c35fd5fcc refactor: fix comment spacing in option.h (#16749) 2021-12-21 18:13:17 -07:00
33cd1ba00a fix(api): make nil value in nvim_set_option_value clear local value (#16710)
For special options such as 'undolevels' and 'scrolloff', this sets the
local value to the special "unset" value (e.g. -12345 for 'undolevels').
2021-12-21 14:20:34 -07:00
1b04da52b3 feat(lsp): add buf_detach_client (#16250)
This allows the user to detach an active buffer from the language
client. If no clients remain attached to a buffer, the on_lines callback
is used to cancel nvim_buf_attach.
2021-12-21 10:53:34 -08:00
1062ea2cc5 Merge pull request #16736 from dundargoc/ci/remove-unused-typo-fix
ci: remove unused "squash typo" workflow
2021-12-20 17:52:19 -05:00
89a844a9c7 ci: remove unused "squash typo" workflow 2021-12-20 23:47:04 +01:00
9241c684e1 Merge pull request #16734 from zeertzjq/chdir-refactor
refactor: remove some chdir-related unnecessary calls and checks
2021-12-20 14:28:11 -05:00
9625832372 fix(lsp): fix nil-index behavior for UTF-8 in _str_*index_enc methods (#16731)
Previously, the `_str_utfindex_enc` and `_str_byteindex_enc` helper functions would return `nil` when `offset_encoding == "utf-8"` and `index == nil`. Clearly, this doesn't reflect the expected behavior of the functions they're wrapping which would return the length of the line in this case. This should fix behavior with servers that use UTF-8 `offset_encoding` when applying text edits, formatting a range, and doing range code actions (though this isn't tested currently).
2021-12-20 08:54:05 -08:00
63b21ab30d Merge pull request #16727 from dundargoc/docs/remove-good-first-issue-suggestion
docs: stop suggestion "good first issue" as a good first issue
2021-12-20 11:35:07 -05:00
09c412837f refactor: remove some chdir-related unnecessary calls and checks
xmalloc() always retuns a valid pointer.

Calling os_chdir() with the same directory as the current one doesn't do
anything other than wasting time.
2021-12-20 18:58:13 +08:00
26ced79c3b vim-patch:8.1.0040: warnings from 64-bit compiler
Problem:    Warnings from 64-bit compiler.
Solution:   Add type casts. (Mike Williams)
e31e256ba1
2021-12-20 05:30:15 +00:00
482df82e69 docs: stop suggestion "good first issue" as a good first issue
They're simply too difficult and too niche for an actual newcomer to
solve them. Instead, use the "complexity:low" as a substitute.
2021-12-19 22:15:42 +01:00
67bb01ae27 chore(build): add option to disable Lua bytecode compilation (#16722)
Include a build option to explicitly disable Lua bytecode compilation.
This is needed in some situations where the existing checks are not
sufficient (e.g. cross compilation).
2021-12-19 14:00:53 -07:00
d6b939a13f fix(lsp): avoid attaching to unloaded buffers (#16723)
Closes https://github.com/neovim/neovim/issues/16562 https://github.com/neovim/neovim/issues/16249 https://github.com/neovim/neovim/issues/16297

* buf_attach_client can be called on an unloaded buffer
* on_attach will prematurely fail, while the language server client
  tracks this buffer as attached
* The language server client will track this buffer as attached despite
  textDocument/didChange notifications not being sent to the server
* Instead, check if the buffer is loaded and return early, warning via
  the lsp logger that buf_attach_client was called on an invalid buffer
2021-12-19 12:49:56 -08:00
115d4da882 Merge pull request #16657 from lewis6991/unused_warn
chore(): suppress -Wunused-but-set-variable warns
2021-12-19 21:38:07 +01:00
6f72236a00 vim-patch:8.2.3855: illegal memory access when displaying a blob
Problem:    Illegal memory access when displaying a blob.
Solution:   Append a NUL at the end. (Yegappan Lakshmanan, closes vim/vim#9372)
bc404bfb32
2021-12-19 19:50:59 +00:00
bdfca2028b vim-patch:8.2.3850: illegal memory access when displaying a partial
Problem:    Illegal memory access when displaying a partial.
Solution:   Terminate the string with a NUL. (closes vim/vim#9371)
2de5371a75
2021-12-19 19:48:57 +00:00
e0750f3e8a chore: suppress -Wunused-but-set-variable warns 2021-12-19 13:20:17 +00:00
abdf3a8128 fix(build): check that LuaJIT has required modules for compilation (#16714)
Apparently some installations of LuaJIT do not have the "jit.bcsave"
module which is required for pre-compilation. Check that this module
exists before using LuaJIT as luac and if it doesn't, skip compiling
bytecode.
2021-12-18 20:59:02 -07:00
b42e0c40c8 fix: update last cursor on first CursorMoved (#16698)
Closes https://github.com/neovim/neovim/issues/16625 https://github.com/neovim/neovim/issues/12923

The first defined CursorMoved autocommand will immediately
fire if the cursor has previously moved upon definition
of the autocommand.

Plugins add dummy autocommands such as:

```lua
autocmd CursorMoved * execute ''
```

to avoid this behavior.

Instead, when defining a new CursorHold autocommand, force
update the last cursor position.

See https://github.com/vim/vim/issues/2053
2021-12-18 19:18:47 -08:00
0e18cf4b6d vim-patch:8.2.3846: no error when using control character for 'lcs' or 'fcs'
Problem:    No error when using control character for 'lcs' or 'fcs'.
Solution:   Use char2cells() to check the width. (closes vim/vim#9369)
60618c8f1a
2021-12-19 09:55:17 +08:00
c05e647681 vim-patch:8.2.2641: display test fails because of lacking redraw
Problem:    Display test fails because of lacking redraw.
Solution:   Add a redraw command.
2cec027af4
2021-12-19 09:55:17 +08:00
fd70018e21 vim-patch:8.2.2508: cannot change the character displayed in non existing lines
Problem:    Cannot change the character displayed in non existing lines.
Solution:   Add the "eob" item to 'fillchars'. (closes vim/vim#7832, closes vim/vim#3820)
a98f8a2305

Nvim has already implemented this feature, so this just ports the tests
and docs.
2021-12-19 09:55:17 +08:00
95803f0e90 build(deps): bump luajit to commit 1d20f33 (#16712)
fixes a bug with jit.bcsave on Windows (cf. #16631)
2021-12-18 19:09:00 +01:00
8d22049513 Merge pull request #16294 from zeertzjq/test-fewest-iteration
test: require fewest number of main loop iterations possible
2021-12-18 13:08:28 -05:00
2202400f15 Merge pull request #16707 from jamessan/filter-out-tests
test: allow excluding functional/unti tests using TEST_FILTER_OUT
2021-12-18 13:01:38 -05:00
eceb0b305e fix(build): check for empty value of LUAC_PRG (#16711)
If the LUAC_PRG environment variable is defined, but empty, compilation
would still be attempted but would be malformed. This results in garbage
bytes being included.

Fix this by checking that LUAC_PRG is both defined *and* non-empty.
2021-12-18 10:56:10 -07:00
267ec67fab test: allow excluding functional/unit tests using TEST_FILTER_OUT
Although this can already be done using `BUSTED_ARGS`, it complements
our existing shortcut of `TEST_FILTER.`

[skip ci]
2021-12-18 12:55:09 -05:00
2abd17813e fix(build): install luajit modules on windows (#16658) 2021-12-18 10:53:27 -07:00
ff1b0f632a vim-patch:8.2.3843: dep3patch files are not recognized (#16700)
Problem:    Dep3patch files are not recognized.
Solution:   Recognize dep3patch files by their location and content. (James
            McCoy, closes vim/vim#9367)
647ab4cede
2021-12-18 17:22:09 +01:00
34d88edaec feat(tui): add error logging (#16615) 2021-12-18 09:18:30 -07:00
734fba0d88 feat(runtime): new checkhealth filetype (#16660) 2021-12-18 09:14:42 -07:00
36758ba9a7 autocmd: RecordingEnter, RecordingLeave (#16684) 2021-12-18 08:55:43 -07:00
df50fb5859 test(old): change usage of Q to gQ
test(old) fix Test_ex_mode_count_overflow

test(old) change usage of Q to gQ
2021-12-18 08:54:07 -07:00
684c782546 docs(autocmd): update docs to match implementation
docs(reg_recorded): add links to relevant docs

docs(Recording): update docs to match implementation

docs(Q) update references of Q to be gQ

docs(autocmd) add description about state of reg_record{ing,ed} for RecordingLeave

docs(vim_diff) add Recording{Enter,Leave} to features

docs(index) removed duplicate gQ

docs(options) removed line about gQ erroring in visual mode

Update runtime/doc/vim_diff.txt

Co-authored-by: zeertzjq <zeertzjq@outlook.com>

docs(vim_diff) removed double mention of Q
2021-12-18 08:54:07 -07:00
8a4e26c6fe feat(autocmd): add Recording autocmds
feat(eval): add reg_recorded()

This function is used the get the last recorded register.

style(Recording): rename handler to match suggestions

fix(RecordingLeave): send autocommand earlier

This makes the autocommand fire just before setting reg_recorded to
reg_recording, this way we clearly show that we are actually just before
actually quitting the recording mode.
2021-12-18 10:54:26 +01:00
818ae74eaf fix(diagnostic): respect "if_many" source option for virtual text (#16653)
The `prefix_source` function only evaluates the sources from the
diagnostics passed to it; however, because each namespace draws its own
virtual text, its diagnostics will never contain more than a single
source (by definition). This requires changing the semantics of what
"if_many" means from "multiple sources in a single 'batch' of
diagnostics" to "multiple sources of all diagnostics within a buffer".
2021-12-17 19:38:33 -07:00
36c401db24 fix(lsp): correctly align start and end range to codepoints during incremental sync (#16670)
Closes #16624

Fixes two issues with aligning the start position and end position to
codepoints when calculating the start and end range.

When aligning the start position:
* use aligned byte index to calculate character index rather than 
  the unadjusted byte

When aligning the end position:
* do not adjust the end byte if it falls on a UTF-8 codepoint
* align byte to the first byte of the next codepoint rather than the
  last byte of the current codepoint
* compute character character end range on the aligned byte index

This commit also adds additional test coverage, including multibyte operations
that previously failed before this commit.
2021-12-17 18:05:00 -08:00
6a92a53c02 fix(lsp): call config on_exit handler before context is cleared (#16638)
The on_exit handler provided to the client configuration is called after
the client's context is cleared (e.g. which buffers the client was
attached to). Calling the handler sooner allows these handlers to access
the client object and do their own cleanup with the full context.
2021-12-17 12:06:44 -08:00
51306f98b8 Merge pull request #16681 from zeertzjq/vim-8.2.3825
vim-patch:8.2.3825: various comments could be improved
2021-12-17 07:15:42 -05:00
b1757e1c29 vim-patch:0e6adf8a29d5 (#16682)
Update runtime files
0e6adf8a29
2021-12-16 21:46:13 +01:00
80210c189f refactor(diagnostic): remove hack (#16685)
No longer required since #16548.
2021-12-16 12:13:30 -07:00
b515160cef fix(diagnostic): assert that diagnostics have line number and column (#16683)
Line number and column are required and much of the diagnostic API
assumes that these are both present. When one of the two is missing,
cryptic errors pop up in other parts of the diagnostic subsystem.
Instead, assert that diagnostics are well formed when they are entered
into the cache, which provides a clearer error.
2021-12-16 11:20:18 -07:00
4240ce8eb3 perf: pre-compile embedded Lua source into bytecode (#16631)
The Lua modules that make up vim.lua are embedded as raw source files into the
nvim binary. These sources are loaded by the Lua runtime on startuptime. We can
pre-compile these sources into Lua bytecode before embedding them into the
binary, which minimizes the size of the binary and improves startuptime.
2021-12-16 09:27:39 -07:00
f59f81c32e vim-patch:8.2.3825: various comments could be improved
Problem:    Various comments could be improved.
Solution:   Improve the comments.
52797bae17
2021-12-16 23:05:52 +08:00
56fa08b458 Merge pull request #16617 from pekdon/forkpty
fix: add forkpty for SunOS variants
2021-12-16 08:24:29 -05:00
a402b5e2d5 Merge pull request #16134 from zeertzjq/screenpos-border
fix(screenpos, float): add top and left border adjustment
2021-12-16 12:41:43 +01:00
326e74571b Merge pull request #16666 from mjlbach/fix/bad-cast 2021-12-15 13:56:41 -08:00
4218b7079e docs(options): mention how to disable inccommand preview (#16534)
Co-authored-by: Hitarth Thumma
2021-12-15 22:41:24 +01:00
fcbffcd92a chore: improve naming consistency in str_utf_start 2021-12-15 09:07:23 -08:00
1a887293ef fix: do not cast offset to char_u
* str_utf_start/end both cast the offset into the utf string
to a char_u, a pointer + long is well-defined and the cast is
unnecessary. This previously resulted in issues for offsets greater than
256.
2021-12-15 09:07:23 -08:00
4393360796 docs: regenerate (#16468)
Co-authored-by: marvim <marvim@users.noreply.github.com>
2021-12-15 08:19:54 -07:00
0a1391fdd7 fix(terminal): fix resize crash with pending scrollback (#14891)
refresh_scrollback assumes pending scrollback rows exist only if the
terminal window height decreased (or the screen was full).

However, after accumulating scrollback, it's possible in some cases for
the terminal height to increase before refresh_scrollback is called via
invalidation (especially when the terminal buffer isn't initially
displayed in a window before nvim_open_term), which may crash.

As we'll have enough room for some scrollback rows, just append them to
the top of the buffer until it fills the window, then continue with the
previous logic for any remaining scrollback rows if necessary.
2021-12-15 08:18:06 -07:00
cf65071e2e vim-patch:8.2.3814: .csx files and .sln files are not recognized (#16662)
Problem:    .csx files and .sln files are not recognized.
Solution:   Add filetype patterns. (Doug Kearns)
cfabad9bcf
2021-12-15 16:10:03 +01:00
576408ddde fix(ui): close floating window on BufLeave event (#16557)
When buffer is visible in two splits simultaneously, BufHidden event is
not triggered, causing the floating window to remain on screen after
switching to another buffer.

Remove BufHidden event from close_events defaults, and close the window
if we changed the buffer to something other than the buffer that spawned
the floating window or the floating window buffer itself.
2021-12-15 07:53:09 -07:00
5ba45a7cd6 fix(quickfix): avoid O(N^2) when filling from string typval (#16654)
When filling a quickfix/loclist from a string-typed VimL variable, the
complexity is O(N^2) in the number of lines in the variable.

The problem is caused by using `xstrlcpy(3)` to copy the characters from
the current position up to the next newline into the quickfix/loclist
buffer in a loop.

strlcpy(3) returns the length of `src`, so by necessity it has to
compute `strlen(src)`. This means scanning the full rest of the typval
on every iteration while only copying a small fraction (up to the next
'\n').

This is not a problem whenever the srclen-to-copylen ratio is close to
1, which it usually is. But not in this case. Since we already
calculated exactly how many bytes we want to copy, we should be using
memcpy(3).

This problem is not present in Vim, as it uses `vim_strncpy`, a
`strncpy(3)`-alike, which stops at either `\0` or `n`, whichever comes
first.

The quickfix/loclist window can be filled using a:

  1. File (used by commands like :grep/:make/... to source directly
     from their errorfile)
  2. Buffer (used by :cbuffer and its variants)
  3. Typval
   a. String (used by :cexpr and its variants)
   b. List of strings (used by setqflist(), setloclist(), :cepxr and its
   variants)

This commit optimizes case (3a), especially when the typval is a long
string.

The pathological path is triggered by (e.g.) :grep enhancements as found
in https://gist.github.com/romainl/56f0c28ef953ffc157f36cc495947ab3:

    function! Grep(...)
        return system(join([&grepprg] + a:000), ' '))
    endfunction
    :cgetexpr Grep('foo')

It would've been better for Neovim to use `systemlist` here, before this
commit.
2021-12-15 07:47:11 -07:00
ffe3003e02 fix(screenpos, float): add top and left border adjustment 2021-12-15 22:40:10 +08:00
14ffcd190d test: expect the correct screen in TUI paste: big burst of input (#16656) 2021-12-15 07:35:22 -07:00
bdfea9d9ae Merge pull request #16606 from clason/bump-treesitter
build(deps): bump tree-sitter commit
2021-12-14 15:19:21 +01:00
cc4c8e7af6 vim-patch:8.2.3805: i3config files are not recognized (#16645)
Problem:    i3config files are not recognized.
Solution:   Add patterns to match i3config files. (Quentin Hibon,
            closes vim/vim#7969)
8176be1598
2021-12-14 14:01:37 +01:00
f37c5f180a Merge pull request #16602 from zeertzjq/tui-end-streamed-paste 2021-12-13 09:36:02 -05:00
9a0196d245 Merge pull request #16348 from lewis6991/query
feat(treesitter): Support match queries on multiline nodes
2021-12-13 09:39:34 +01:00
5e1320708d refactor(build): remove unused includes 2021-12-12 19:05:50 +01:00
6e6c36ca5b feat(treesitter): multiline match predicates 2021-12-12 12:16:42 +00:00
2c8f4d0912 fix: add forkpty for SunOS variants
forkpty is missing on Solaris < 11 and Illumos, provide fallback implementation
for non Solaris 11 users.
2021-12-12 11:29:56 +00:00
1f3c0593eb feat(ts): add support for multiline nodes in get_node_text (#14999)
Based on https://github.com/neovim/neovim/pull/14445

This extends `vim.treesitter.query.get_node_text` to return the text
that spans a node's range even if start_row ~= end_row.
2021-12-12 12:05:39 +01:00
3aff3d6349 fix(docs): add bufnr and user_data to diagnostic-structure (#16619) 2021-12-11 16:59:16 +01:00
e93b26eb0e Merge pull request #16613 from bfredl/vim-patch-8.2.3777
vim-patch:8.2.3777: spell file write error not checked
2021-12-11 09:25:09 +01:00
a415a7e672 Merge pull request #16614 from zeertzjq/test-remove-misc1
test: remove references to misc1.c
2021-12-11 09:20:50 +01:00
5b153f5d3d test: remove references to misc1.c 2021-12-11 07:10:01 +08:00
3f8703093d Merge pull request #16607 from bfredl/no2misc1
refactor: get rid of misc1.c ("functions that didn't seem to fit elsewhere")
2021-12-10 23:38:00 +01:00
d23a5da890 vim-patch:8.2.3777: spell file write error not checked
Problem:    Spell file write error not checked.
Solution:   Check writing the prefix conditions. (Björn Linse, closes vim/vim#9323)
2021-12-10 23:30:01 +01:00
53c95ccd1b docs(vim_diff.txt): document SearchWrapped (#16612) 2021-12-10 15:04:11 -07:00
2a9aadd09b refactor: replace deprecated lua functions with their new versions (#16603)
Calling vim.lsp.buf.definition() sometimes gives a deprecation warning.
This will likely solve that.

Co-authored-by: Christian Clason <christian.clason@uni-due.de>
2021-12-10 13:20:30 -07:00
63528f4686 runtime: support once on s:GetAutocmdPrefix (#16457)
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2021-12-10 12:28:55 -07:00
8ad6015409 feat: add autocommand event when search wraps around (#8487) 2021-12-10 12:28:25 -07:00
df54d82b7c refactor(misc1): move out high-level input functions to a new file: input.c
Possibly dialog code is messages.c could be moved here as well.
misc1.c is now empty, so delete it.
2021-12-10 18:15:33 +01:00
dc37beed75 refactor(misc1): move shell related functions to os/shell.c 2021-12-10 18:08:04 +01:00
29517d95b7 refactor(misc1): move insertmode related function to edit.c 2021-12-10 17:35:06 +01:00
c88555418a refactor(misc1): move way beep functions elsewhere 2021-12-10 17:11:45 +01:00
6dbd4f3787 refactor(misc1): move msgmore function to messages.c 2021-12-10 17:03:22 +01:00
608f74a0de refactor(misc1): move comment related functions to change.c
These are used in various places, but were grouped with open_line()
which has a lot of comment prefix logic originally.
2021-12-10 16:50:09 +01:00
aad2437fc0 build(deps): bump tree-sitter commit
bump tree-sitter to 25f64e1eb6
to fix query performance regression in 0.20.1
2021-12-10 16:07:03 +01:00
8b316b18d2 refactor(misc1): move user related code to os/users.c 2021-12-10 15:52:38 +01:00
22d7dd2aec fix(lsp): create lsp requests with position offsets considering client encoding (#16382)
Co-authored-by: black-desk <clx814727823@gmail.com>
Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2021-12-10 15:17:50 +01:00
40ed2b51cb fix(tui): end streamed paste correctly when key buffer is empty 2021-12-10 18:09:55 +08:00
26eb605152 Merge pull request #16597 from bfredl/nomisc1
refactor: move out some long-hanging fruit from misc1.c
2021-12-10 10:56:17 +01:00
ac2d140a33 Merge pull request #16541 from jamessan/vim-8.2.3664
vim-patch:8.2.3664,8.2.3743,8.2.3747,8.2.3748,8.2.3757
2021-12-09 21:29:15 -05:00
238da85126 Merge pull request #16524 from dundargoc/ci/optimize-brew
ci: remove "brew upgrade" from macos jobs
2021-12-09 21:15:07 -05:00
b20871526e Merge pull request #16414 from zeertzjq/terminal-no-invalid-rows
fix(terminal): return early if there are no invalid rows
2021-12-09 21:13:16 -05:00
0cf546508d Merge pull request #16547 from pekdon/sunos
Portability improvements, first steps at getting neovim on x86_64 SunOS
2021-12-09 21:09:22 -05:00
27648ee218 Merge pull request #16564 from glacambre/improve_test_harness_perf
test(helpers): optimize read_file_list
2021-12-09 21:06:45 -05:00
a59589ca01 refactor(misc1): move preserve_exit() to related functions in main.c 2021-12-09 23:46:37 +01:00
d9c1669a54 refactor(misc1): move out misc functions which obviously belong elsewhere
Also make some function names more descriptive/regular.
2021-12-09 23:17:29 +01:00
c96f7e29dc fix(terminal): ignore left-release mouse action
if it is not proccesed by the terminal program
to prevent leaving Terminal mode after using
a mouse for window switching

closes #9483
closes #8691
2021-12-10 00:53:30 +03:00
8e64b21fed vim-patch:8.2.3769: zig files are not recognized (#16598)
Problem:    Zig files are not recognized.
Solution:   Add *.zig. (Gregory Anders, closes vim/vim#9313)
4c8c634365
2021-12-09 22:03:25 +01:00
51822f0655 refactor(misc1): move out autocmd related functions 2021-12-09 21:10:58 +01:00
2ec0e0a868 refactor(misc1): move line_breakcheck family of functions to os/input.c 2021-12-09 21:00:04 +01:00
2fe60905f6 Merge pull request #16582 from dundargoc/docs/remove-redundant-help-files
docs: remove redundant help files
2021-12-09 09:23:18 -05:00
6063e07a0f fix(diagnostic): set effective buffer number in autocmd (again) (#16589)
Follow up to #16474.
2021-12-08 21:13:47 -07:00
f3fb77c402 vim-patch:8.2.3757: an overlong highlight group name is silently truncated
Problem:    An overlong highlight group name is silently truncated.
Solution:   Give an error if the name is too long. (closes vim/vim#9289)
f7f7aaf8aa
2021-12-08 21:48:00 -05:00
ed35e20640 test(fold): add test for CursorLineFold 2021-12-08 21:47:59 -05:00
931f499d9a test(sign): add test for culhl option 2021-12-08 21:47:59 -05:00
e9051d965e vim-patch:partial 6304be625ce4
Update runtime files.
6304be625c

Remaining changes left out of 03d250eb45
2021-12-08 21:47:59 -05:00
5fda23c307 vim-patch:8.2.3748: giving an error for an empty sign argument breaks a plugin
Problem:    Giving an error for an empty sign argument breaks a plugin.
Solution:   Do not give an error.
e5710a02cb
2021-12-08 21:47:58 -05:00
4453d4c9f1 vim-patch:8.2.3747: cannot remove highlight from an existing sign
Problem:    Cannot remove highlight from an existing sign. (James McCoy)
Solution:   Only reject empty argument for a new sign.
0bac5fc5e1
2021-12-08 21:47:58 -05:00
d0b3efb7db vim-patch:8.2.3743: ":sign" can add a highlight group without a name
Problem:    ":sign" can add a highlight group without a name.
Solution:   Give an error if the group name is missing. (closes vim/vim#9280)
5e18ccc60b
2021-12-08 21:47:58 -05:00
e8f9262125 vim-patch:8.2.3664: cannot adjust sign highlighting for 'cursorline'
Problem:    Cannot adjust sign highlighting for 'cursorline'.
Solution:   Add CursorLineSign and CursorLineFold highlight groups.
            (Gregory Anders, closes vim/vim#9201)
e413ea04b7
2021-12-08 21:47:58 -05:00
2cd815c0af Merge pull request #16418 from zeertzjq/terminal-coladvance
fix(terminal): use coladvance() to calculate buffer cursor position
2021-12-08 21:17:18 -05:00
be84529190 refactor(diagnostic): remove bufnr parameter from open_float (#16579)
The overwhelming majority of use cases for `open_float` are to view
diagnostics from the current buffer in a floating window. Thus, most use
cases will just `0` or `nil` as the first argument, which makes the
argument effectively useless and wasteful.

In the cause of optimizing for the primary use case, make the `bufnr`
parameter an optional parameter in the options table. This still allows
using an alternative buffer for those that wish to do so, but makes the
"primary" use case much easier.

The old signature is preserved for backward compatibility, though it can
likely be fully deprecated at some point.
2021-12-08 18:44:31 -07:00
fb0399aacc docs: remove redundant help files 2021-12-08 19:48:51 +01:00
c096561041 docs(lsp): fix resolve_capabilities docstring (#16577) 2021-12-08 11:01:07 -07:00
e5f691baef docs: update missing help sections from main help page (#16573)
Also replace non-existent help section remote.txt to remote_plugins.txt
2021-12-08 09:56:11 -07:00
db4bc32c4a fix: check for interrupt in nvim_echo, write_msg and nlua_print (#16537)
Fixes `q` in more pager, where `:highlight` can be quit out of with a
single `q` keystroke, while in `:lua print(vim.inspect(vim))` it just
scrolls down a page.
2021-12-08 09:43:58 -07:00
5b117bbc75 ci: install doxygen with conda instead of apt (#16517)
This provides a newer version of Doxygen (1.9.0 or later)
that fixes a bug in the documentation generator.

Closes #16498
2021-12-08 09:28:25 -07:00
51d5f0517f test(helpers): optimize read_file_list
Read_file_list is used to read back data from the nvim log file as the
testsuite executes. However, the nvim log file can get really big
(each full run of the testsuite appends roughly 150MB of data to this
file). Reading each line of this file can thus be extremely slow, and so
are the repeated table.insert/table.removes that are done for each line.

A solution to this issue is tto only read the end of the file.

This results in a sizeable improvement in testsuite run times in some
cases, e.g. on my computer:

Without this commit:
real	20m0.431s
user	17m11.163s
sys	1m59.422s

With this commit:
real	4m25.356s
user	1m41.673s
sys	1m31.253s
2021-12-08 17:25:48 +01:00
c4d70dae80 refactor(diagnostic): add warning to deprecated functions (#16536) 2021-12-08 08:47:19 -07:00
cf32053d60 fix(api): allow nvim_buf_set_extmark to accept end_row key (#16548)
nvim_buf_get_extmark uses "end_row" rather than "end_line" in its
'details' dict, which means callers must modify the key names if they
want to re-use the information. Change the parameter name in
nvim_buf_set_extmark to "end_row" and use "end_line" as an alias
to make this more consistent.
2021-12-08 08:44:48 -07:00
5abd7c2c14 Merge pull request #16421 from seandewar/vim-8.1.0035
vim-patch:8.1.{35,42,64},8.2.{1781,1783,1976,2014,3671}
2021-12-07 21:17:12 -05:00
c83fedf0bd fix(terminal): return early if there are no invalid rows
Prevent on_lines emitting out-of-bounds line indexes.
2021-12-08 08:41:46 +08:00
2784a5d3d2 fix(terminal): use coladvance() to calculate buffer cursor position 2021-12-08 08:11:27 +08:00
be768be6b7 Merge pull request #16556 from zeertzjq/hl-change-update
fix(highlight): always update window highlight if highlight changed
2021-12-07 18:41:17 +01:00
ddf48193e6 Merge pull request #16559 from zeertzjq/filler-end-row
fix(screen): do not draw filler lines post eof if already at last row
2021-12-07 18:36:58 +01:00
a2db756206 refactor(lsp): remove usage of deprecated function (#16539) 2021-12-07 10:25:21 -07:00
f99f3d9052 feat(lsp): use vim.ui.select for selecting lsp client (#16531) 2021-12-07 18:09:43 +01:00
b326bf5f41 fix(screen): do not draw filler lines post eof if already at last row 2021-12-07 23:19:56 +08:00
23dcef9269 fix(highlight): always update window highlight if highlight changed 2021-12-07 20:48:39 +08:00
361f548437 vim-patch:8.2.3671: restarting Insert mode in prompt buffer too often
Problem:    Restarting Insert mode in prompt buffer too often when a callback
            switches windows and comes back. (Sean Dewar)
Solution:   Do not set "restart_edit" when already in Insert mode.
34c20ff85b

As Test_prompt_switch_windows is skipped, implement it in prompt_buffer_spec.

Replace the 50ms term_wait calls with poke_eventloop (test seems to work anyway
without them, so maybe they're not required?)

The new test does include a duplicate screen test that may generate a "screen
test succeeded immediately" warning, but this is done to match the Vim test.
2021-12-07 11:34:28 +00:00
0f792b284f test(prompt_buffer_spec): include changes from v8.1.1984
I already ported v8.1.1984 previously, but hadn't updated prompt_buffer_spec to
match test_prompt_buffer (which we have but due to Vim features such as
term_sendkeys it's mostly skipped).

Required for v8.2.3671.
2021-12-07 11:34:28 +00:00
d6258a9bad vim-patch:8.2.2014: using CTRL-O in a prompt buffer moves cursor to start
Problem:    Using CTRL-O in a prompt buffer moves cursor to start of the line.
Solution:   Do not move the cursor when restarting edit. (closes vim/vim#7330)
ee8b787bcd

Test_prompt_editing is skipped, so edit the Lua test in prompt_buffer_spec.
2021-12-07 11:34:27 +00:00
c2d0a1041e vim-patch:8.2.1976: cannot backspace in prompt buffer after using cursor-left
Problem:    Cannot backspace in prompt buffer after using cursor-left. (Maxim
            Kim)
Solution:   Ignore "arrow_used" in a prompt buffer. (closes vim/vim#7281)
6f6244855f

cmdchar_todo wasn't adapted properly for Nvim's state system, which caused it to
be a dead store and such was removed in #11900.

Re-introduce cmdchar_todo properly.
2021-12-07 11:34:27 +00:00
a128b64e73 vim-patch:8.2.1783: try-catch test fails
Problem:    Try-catch test fails.
Solution:   Don't call win_enter(), only call enterering_window().
bdf931c25b

v8.2.1781 caused Test_reload_in_try_catch() from v8.2.0004 to fail in Vim, but
it has not been ported yet.
2021-12-07 11:34:27 +00:00
38cd91de5f vim-patch:8.2.1781: writing to prompt buffer interferes with insert mode
Problem:    Writing to prompt buffer interferes with insert mode.
Solution:   Use win_enter() instead of just setting "curwin". (Ben Jackson,
            closes vim/vim#7035)
4537bcc889

Vim test will be skipped, so add a Lua test.
The problem boils down to the use of aucmd_restbuf in a callback, so just test
that (via nvim_buf_set_lines).
2021-12-07 11:34:27 +00:00
1fffccc5d6 vim-patch:8.1.0064: typing CTRL-W in a prompt buffer shows mode "-- --"
Problem:    Typing CTRL-W in a prompt buffer shows mode "-- --".
Solution:   Set restart_edit to 'A' and check for it.
942b4541a2

Nvim already checked for 'i' in showmode(), so this bug was fixed with <C-W>
(though this patch now changes <C-W> to use 'A').

However, the missing changes I ported for v8.1.0036 use 'A' when a callback
leaves the window in insert mode and edit gets restarted, so this bug was
possible there.

Modify showmode() restart_edit condition to match v8.2.1978:
957cf67d50
2021-12-07 11:34:26 +00:00
b9ab4c1dea vim-patch:8.1.0042: if omni completion opens a window Insert mode is stopped
Problem:    If omni completion opens a window Insert mode is stopped.
            (Hirohito Higashi)
Solution:   Only set stop_insert_mode in a prompt buffer window.
f98b845dd1

popupmenu_spec.lua fails without this.
2021-12-07 11:34:26 +00:00
d6ea0741c9 fix(prompt): add missing changes from v8.1.0036
v8.1.0036 is already marked as ported, but missed out changes that depended on v8.1.0035.
2021-12-07 11:34:26 +00:00
28134f4e78 vim-patch:8.1.0035: not easy to switch between prompt buffer and other windows
Problem:    Not easy to switch between prompt buffer and other windows.
Solution:   Accept CTRL-W commands in Insert mode.  Start and stop Insert mode
            as one would expect.
6d41c78e35

Cherry-pick channel.txt change from:
d2f3a8b878

b_prompt_insert was already ported.
2021-12-07 11:34:24 +00:00
05f9f63f24 fix: don't use cfsetspeed, use i and o variants
cfsetspeed is not available on SunOS, use cfsetispeed and cfsetospeed
instead.
2021-12-07 09:56:25 +01:00
435dd04bdb fix: don't include pty.h on SunOS 2021-12-07 09:56:02 +01:00
afaad8b54e Merge pull request #16194 from seandewar/vim-8.1.1925
vim-patch:7.4.1777,8.1.{1925,1995,2011,2012,2013,2166},8.2.{0532,0871,1168,1241,3576}
2021-12-07 01:14:21 -05:00
bf9e8a9df9 Merge pull request #16546 from zeertzjq/vim-8.1.1797
vim-patch:8.1.{1797,1798}: the vgetorpeek() function is too long
2021-12-07 00:15:04 -05:00
18d81a6724 Merge pull request #16107 from zeertzjq/vim-8.1.1542
vim-patch:8.1.1542,8.2.3549: an OptionSet autocommand does not get enough info
2021-12-06 22:35:05 -05:00
67d3c98dac vim-patch:8.1.2104: the normal.c file is too big (#16389)
Problem:    The normal.c file is too big.
Solution:   Move do_pending_operator() to ops.c. (Yegappan Lakshmanan,
            closes vim/vim#4999).
792cf5e1be
2021-12-06 21:45:30 -05:00
afdd9c19aa refactor: fix indent in decode.c (#16543) 2021-12-06 21:23:52 -05:00
296eb7203c vim-patch:8.1.1798: warning for unused variable in tiny version
Problem:    Warning for unused variable in tiny version. (Tony Mechelynck)
Solution:   Move inside #ifdef.  Reformat code.
eda35f7127
2021-12-07 06:47:33 +08:00
95a5912158 vim-patch:8.1.1797: the vgetorpeek() function is too long
Problem:    The vgetorpeek() function is too long.
Solution:   Split off the part that handles mappings, with fix.
edd680f364
2021-12-07 06:47:33 +08:00
8f1fdbc54a fix: add STRNLEN compatability macro
Older SunOS systems come without strnlen, add STRNLEN macro in line with
the other str* compat macros.
2021-12-06 17:34:26 +01:00
0a3826646f vim-patch:4700398e384f (#16538)
Update runtime files
4700398e38

partial skip:
doc/sign.txt
doc/various.txt
doc/motion.txt
2021-12-06 13:55:38 +01:00
8fdf1b265d fix: define NAME_MAX from _XOPEN_NAME_MAX
On SunOS NAME_MAX is not defined, _XOPEN_NAME_MAX is so fall back to
defining NAME_MAX from _XOPEN_NAME_MAX.
2021-12-06 09:19:24 +01:00
b8ae43dd24 fix: skip libutil on SunOS
libutil is not available on Solaris variants, even on Solaris 11 where
forkpty is available.
2021-12-06 08:18:02 +01:00
523f03b506 lint (#16526) 2021-12-05 23:33:22 -05:00
4306b395de refactor: format diagnostic.lua (#16540) 2021-12-05 19:42:31 -07:00
62f0157853 fix(diagnostic): escape special chars in file names (#16527)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
2021-12-05 19:39:00 -07:00
24f9463dd0 refactor: remove unused runtime lua functions (#16535) 2021-12-05 19:11:20 +01:00
9b65a7e064 docs(lsp): re-add client.requests documentation (#16530)
Closes #16528

Added in this PR: d1c470957b (diff-6b5f3071d65558aab177912061ac6a2f5312660655a449276c83697686f28e72R627)

Removed by regeneration in this PR: 2d340a3746 (diff-6b5f3071d65558aab177912061ac6a2f5312660655a449276c83697686f28e72L631)
2021-12-05 14:04:53 +01:00
c5af86b9b9 ci: remove "brew upgrade" from macos jobs
Packages are automatically upgraded on install. This will avoid
upgrading unrelated packages, cutting the macos job time to about a
half.
2021-12-04 23:44:52 +01:00
1e6eeca9d1 Merge pull request #15996 from gpanders/nvim_get_option_value
feat(api): add nvim_{get,set}_option_value
2021-12-04 14:30:27 -07:00
222ef0c00d feat(lsp,diagnostic): open folds in jump-related functions (#16520) 2021-12-04 22:14:38 +01:00
71ac00ccb5 feat(api): add nvim_get_option_value 2021-12-04 14:04:23 -07:00
7b910a1716 chore: bump API version 2021-12-04 14:04:23 -07:00
8dcf45c824 Merge pull request #16518 from dundargoc/ci/use-latest-versions
ci: use tag v2 when using checkout action
2021-12-04 12:50:55 -05:00
8cd1fa8945 ci: use tag v2 when using checkout action
Using v2 automatically fetches the latest minor patch for v2, meaning
free bug fixes without needing to manually update the tag version.
2021-12-04 13:24:46 +01:00
76af219e3e Merge pull request #16411 from dundargoc/refactor/upgrade-uncrustify
refactor: upgrade uncrustify config version to 0.74.0
2021-12-04 12:31:42 +01:00
2ccf6567b7 vim-patch:8.2.3730: "/etc/Muttrc.d/README" gets filetype muttrc (#16515)
Problem:    "/etc/Muttrc.d/README" gets filetype muttrc.
Solution:   Move the Muttrc.d pattern down, add exception for *.rc files.
800b01b0c8
2021-12-04 12:26:37 +01:00
419e0d117d vim-patch:8.2.3729: no support for squirrels (#16513)
Problem:    No support for squirrels. (closes vim/vim#9259)
Solution:   Recognize nuts.
6f42cb6e51
2021-12-03 19:51:30 +01:00
e225397bcb vim-patch:8.2.3726: README file in a config directory gets wrong filetype (#16507)
Problem:    README file in a config directory gets wrong filetype.
Solution:   Match README before patterns that match everything in a directory.
c903695be5
2021-12-03 13:19:17 +01:00
4e352ecc42 Merge pull request #16489 from zeertzjq/patch-1
[skip ci]
2021-12-02 10:33:42 -05:00
cef21e5592 Merge pull request #16408 from jamessan/rm-legacy-test 2021-12-02 10:31:40 -05:00
254c22afc3 fix(diagnostic): clamp diagnostics on negative line numbers (#16496)
Closes https://github.com/neovim/neovim/issues/16492

Despite having logic for setting the maximum diagnostic line
number to at minimum 0, previously the conditional statement only
checked if lnum and end_lnum were greater than the line count.

Fix: also check if lnum and end_lnum are less than 0.
2021-12-02 06:38:44 -08:00
0f82deb2c5 docs(CONTRIBUTING.md): use gh instead of hub; correct uncrustify link 2021-12-02 08:28:05 +08:00
73b35ef10f chore: add default luarc.json for Lua development (#16487)
The Sumneko Lua language server has matured quite a bit and many
Neovim developers use it while working on Neovim. Having a default
configuration for Neovim development is a nice convenience (and
dovetails well with the auto-generated compile_command.json for C
development).

The file is shipped under `contrib` and users can make use of it by
symlinking to `.luarc.json` in the project root.
2021-12-01 12:09:50 -07:00
99f6260f84 fix(diagnostic): set effective buffer number for DiagnosticChanged autocmd (#16474)
This enables use of <abuf> in autocommand handlers for
DiagnosticChanged.
2021-12-01 07:27:17 -07:00
195aec453a chore: remove legacy/059_utf8_spell_checking.vim
The legacy test was converted to a new style Vim test in
8b81218300.
2021-11-30 23:00:48 -05:00
d3585e0ec5 Merge pull request #16478 from jamessan/fragile-server-notifications-test
test(api): mark "notify cancels stale events on channel close" fragile
2021-11-30 22:39:14 -05:00
dd3fe86bbf Merge pull request #16477 from jamessan/backport-action
fix(ci/backport): check for event_name == "pull_request_target"
2021-11-30 22:31:58 -05:00
4342b81e8d test(api): mark "notify cancels stale events on channel close" fragile
This is already skipped in all CI environments, so it should also be
skipped in environments that don't like fragile tests.  Since there's no
convenient way to express these concisely, add the explicit fragile
skip.
2021-11-30 22:27:34 -05:00
50c8cc3020 fix(ci/backport): check for event_name == "pull_request_target"
[skip ci]
2021-11-30 22:20:32 -05:00
828bf128a6 Merge pull request #15840 from vimpostor/vim-8.2.3430
vim-patch:8.2.{3430,3434,3462,3463,3555,3609,3610}: ModeChanged autocmd
2021-11-30 22:13:50 -05:00
2635b77dba Merge pull request #16420 from seandewar/vim-8.1.2136
vim-patch:8.1.2136,8.2.2465
2021-11-30 21:39:22 -05:00
36565c9da2 vim-patch:8.2.2350: using "void" for no reason (#16410)
Problem:    Using "void" for no reason.
Solution:   Use "char *".
033135eb8e
2021-11-30 21:34:33 -05:00
730a9514dc fix(lsp): progress handlers should return vim.NIL on error (#16472) 2021-11-30 21:26:14 -05:00
8ae7dabc10 Merge pull request #16381 from VVKot/vim-8.1.0228
vim-patch:8.1.0228, 8.1.1384, 8.1.1386, 8.1.1393, 8.2.3040
2021-11-30 21:21:36 -05:00
7229afcd60 version bump 2021-11-30 18:38:40 +01:00
6e3e8c51c0 test(oldtest): uncomment method call syntax uses
We should now be equal with Vim in regards to method call support of already ported built-ins.

Enable all relevant commented-out uses of the syntax in tests that I could grep.
2021-11-26 18:53:12 +00:00
752ca2cb9f fix(eval/method): add missing method support for existing built-ins
These functions were ported with the vim-patch token, but didn't actually port
the method call support that was in their patches (method call syntax wasn't
ported yet).

Add the missing method call support and latest docs for:
 - assert_nobeep:
   5b8cabfef7
 - buffer_name, buffer_number: (obsolete)
   a8eee21e75
 - charidx:
   17793ef23a
 - flatten:
   077a1e670a
 - prompt_getprompt:
   077cc7aa0e
 - searchcount:
   e8f5ec0d30
 - strptime:
   10455d43fe
 - win_gettype:
   00f3b4e007
 - win_splitmove:
   d20dcb3d01

Also fix assert_beeps, assert_nobeep and getenv to accept exactly one argument.
Previously, they could erroneously accept one or more.
2021-11-26 18:53:12 +00:00
7e1a2301ff docs(eval): cherry-pick runtime update 2e693a88b2
2e693a88b2

Mainly to keep the method call docs up-to-date.
Much of this RT update has already been ported.
2021-11-26 18:53:12 +00:00
a0c7fff284 vim-patch:8.2.1241: cannot use getbufinfo() as a method
Problem:    Cannot use getbufinfo() as a method.
Solution:   Support using getbufinfo() as a method. (closes vim/vim#6458)
6434fc574d
2021-11-26 18:53:12 +00:00
2c185a18cd vim-patch:8.2.1168: wrong method argument for appendbufline()
Problem:    Wrong method argument for appendbufline().
Solution:   Use FEARG_3.
92053ce59e

Cherry-pick base change for append (and appendbufline) from v8.2.1167.
These changes have no visible impact, but helps us sync with Vim.

Like Vim, BASE_LAST is now unused after this commit.
Keep it anyway in case it sees use in the future.
Comment-out LAST definition in eval.lua to appease linter.
2021-11-26 18:53:11 +00:00
6bc9af43ce vim-patch:8.2.0871: cannot use getmarklist() as a method
Problem:    Cannot use getmarklist() as a method.
Solution:   Make getmarklist() work as a method.  Add one to the column
            number to match getpos(). (Yegappan Lakshmanan, closes vim/vim#6176)
f17e7ea67a

The rest of this patch was ported in:
a1ed941a78
2021-11-26 18:53:11 +00:00
60f0e18588 vim-patch:8.2.0532: cannot use simplify() as a method
Problem:    Cannot use simplify() as a method.
Solution:   Add FEARG_1. (closes vim/vim#5996)
7035fd9d90
2021-11-26 18:53:11 +00:00
f37f08314d vim-patch:8.1.2166: rubyeval() not tested as a method
Problem:    Rubyeval() not tested as a method.
Solution:   Change a test case.
4a4981b7cd
2021-11-26 18:53:11 +00:00
2ad92e9476 vim-patch:8.1.2013: more functions can be used as methods
Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
f92e58cadb

Cherry-pick s:normalize_fname for tolower test from v8.1.0894 and v8.1.1417 (even though it is
unused for now).

Fix header for win_id2tabwin in eval.txt.
2021-11-26 18:53:11 +00:00
38a831e54a vim-patch:7.4.1777
Problem:    Newly added features can escape the sandbox.
Solution:   Add checks for restricted and secure. (Yasuhiro Matsumoto)
3849992b16

timer_start is missing check_secure.

The timer callback can, for example, call a function defined from outside the sandbox that does
stuff that would be disallowed from inside the sandbox. This is usually not allowed.

Cherry-pick eval.txt change from:
68e6560b84

Required for v8.1.2013.
2021-11-26 18:53:10 +00:00
39776d1a65 vim-patch:8.1.2011: more functions can be used as methods
Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.  Make the window
            command test faster.
ce90e36f59

test_* functions in the patch are N/A as they modify internal state.

Include test changes for test_ignore_error and test_feedinput (though they aren't run).
Other changed tests were excluded from previous patches, except test_termcodes.vim, which hasn't
been ported yet.
2021-11-26 18:53:10 +00:00
0f4510cb1a feat(eval/method): partially port v8.1.2004
Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
f6ed61e148

+sound is needed for sound_* functions.

Make swapinfo and swapname take exactly one argument.
Previously, they could erroneously take one or more.
2021-11-26 18:53:10 +00:00
2ee0bc09d9 feat(eval/method): partially port v8.1.1996
Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
aad222c9c9

Partial port as this does not include eval.txt change for listener_add.

Cherry-pick eval.txt changes for:
- bufadd from v8.1.1626:
  5ca1ac373a
- setloclist and setqflist headers from:
  b0d45e7f53

Correct eval.txt typo for settabwinvar method call (matches latest Vim).
2021-11-26 18:52:58 +00:00
aad25ae4fc vim-patch:8.1.1995: more functions can be used as methods
Problem:    More functions can be used as methods.
Solution:   Make sign functions usable as a method.
93476fd634

Make sign_placelist and sign_unplacelist accept exactly one argument.
Before, they erroneously accepted one or more arguments.
2021-11-26 18:33:59 +00:00
4efcb72bb7 feat(eval/method): partially port v8.1.1993
Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
196b466443

server2client requires +clientserver, which hasn't been ported yet.
The eval.txt docs and test_clientserver.vim tests for server2client already exist, so include those
changes.

test_bufline.vim: Test for setbufline requires v8.1.1189 (which was reverted in #10848).
2021-11-26 18:33:59 +00:00
fa9076f276 vim-patch:8.1.1925: more functions can be used as methods
Problem:    More functions can be used as methods.
Solution:   Make various functions usable as a method.
4c313b13fb

The rest of this patch was ported in
3137c7d635

N/A patches for version.c:

vim-patch:8.1.2012: more functions can be used as methods

Problem:    More functions can be used as methods.
Solution:   Make terminal functions usable as a method.  Fix term_getattr().
7ee80f7661

vim-patch:8.2.3576: some functions are not documented for use with a method

Problem:    Some functions are not documented for use with a method.
Solution:   Add examples.  Fix that sign_unplacelist() only takes one
            argument. (Sean Dewar, closes vim/vim#9081)
a63780b977

Addressed in the port of v8.1.1995.
2021-11-26 18:33:58 +00:00
dac52e6d04 vim-patch:8.2.2465: using freed memory in :psearch
Problem:    Using freed memory in :psearch. (houyunsong)
Solution:   Check the current window is still valid.  Fix flaky test.
92bb83e41c

Test_cursorhold_insert timer's 100ms delay was already LoadAdjusted, but change
to 200ms (still LoadAdjust) to match Vim anyway.
2021-11-24 05:34:20 +00:00
c366c944c2 vim-patch:8.1.2136: using freed memory with autocmd from fuzzer
Problem:    using freed memory with autocmd from fuzzer. (Dhiraj Mishra,
            Dominique Pelle)
Solution:   Avoid using "wp" after autocommands. (closes vim/vim#5041)
ec66c41d84

Nvim doesn't use Vim's terminal implementation.
Despite this, Nvim has its own *exclusive* way of crashing here.

Requires 'winwidth' > winwidth() and 'nowinfixwidth' to crash; adjust
the test ('nowfw' is the default, but ensure its disabled anyway).
2021-11-24 03:55:02 +00:00
849f104c27 refactor: upgrade uncrustify config version to 0.74.0
Disable formatting for assert.h since there's a bug that results in a
segmentation fault in uncrustify.
2021-11-23 10:28:49 +01:00
419ebd8ec6 vim-patch:8.2.3549: mistakes in test comments
Problem:    Mistakes in test comments.
Solution:   Fix the comments. (closes vim/vim#9029)
b811de5d49
2021-11-22 15:50:14 +08:00
d40db0edbd vim-patch:8.1.1542: an OptionSet autocommand does not get enough info
Problem:    An OptionSet autocommand does not get enough info.
Solution:   Add v:option_command, v:option_oldlocal and v:option_oldglobal.
            (Latrice Wilgus, closes vim/vim#4118)
d7c9687947
2021-11-22 15:50:14 +08:00
ee99f34438 vim-patch:8.1.1393: unnecessary type casts
Problem:    Unnecessary type casts.
Solution:   Remove type casts from alloc() and lalloc() calls. (Mike Williams)
51e14387f1
2021-11-22 05:44:40 +00:00
6ff3475b42 vim-patch:8.1.1386: unessesary type casts for lalloc()
Problem:    Unessesary type casts for lalloc().
Solution:   Remove type casts.  Change lalloc(size, TRUE) to alloc(size).
18a4ba29ae
2021-11-22 05:44:40 +00:00
c86fb824e0 vim-patch:8.1.1384: using "int" for alloc() often results in compiler warnings
Problem:    Using "int" for alloc() often results in compiler warnings.
Solution:   Use "size_t" and remove type casts.  Remove alloc_check(), Vim
            only works with 32 bit ints anyway.
964b3746b9

N/A commits:

vim-patch:8.1.0228: dropping files is ignored while Vim is busy

Problem:    Dropping files is ignored while Vim is busy.
Solution:   Postpone the effect of dropping files until it's safe.
92d147be95

vim-patch:8.2.3040: GUI: dropping files not tested

Problem:    GUI: dropping files not tested.
Solution:   Add test_gui_drop_files() and tests. (Yegappan Lakshmanan,
            closes vim/vim#8434)
18d46587b9
2021-11-22 05:43:00 +00:00
89270346f9 docs(lua): further improve Lua require() docs
Change docs to reflect recent changes to require() search order and add
info on `.` in module names and search order for shared library modules.
2021-11-22 00:43:18 +13:00
0d32e5ba30 docs(lua): fix, clarify Lua require() docs
Corrects lua.txt help file to say that require() searches runtimepath
and loads the first module found, not the last.

Also adds additional clarification on require() and module search order.

Closes #15480
2021-11-21 21:30:13 +13:00
980c68d036 vim-patch:8.2.3610: crash when ModeChanged triggered too early
Problem:    Crash when ModeChanged triggered too early.
Solution:   Trigger ModeChanged after setting VIsual.
a062006b9d
2021-11-18 14:23:33 +01:00
1fb101afe4 vim-patch:8.2.3609: internal error when ModeChanged is triggered recursively
Problem:    Internal error when ModeChanged is triggered when v:event is
            already in use.
Solution:   Save and restore v:event if needed.
3075a45592

In the vim codebase there is no occurrence of get_vim_var_dict(VV_EVENT)
after the above patch, so in order to hold the same invariant in the
neovim codebase we needed to replace more occurrences than the related
vim patch.
2021-11-18 14:23:33 +01:00
fdfd1eda43 feat: trigger ModeChanged for terminal modes 2021-11-18 11:23:18 +01:00
11683193f5 vim-patch:8.2.3555: ModeChanged is not triggered on every mode change
Problem:    ModeChanged is not triggered on every mode change.
Solution:   Also trigger on minor mode changes. (Maguns Gross, closes vim/vim#8999)
25def2c8b8
2021-11-18 11:23:18 +01:00
60c154687a vim-patch:8.2.3463: pattern matching with ModeChanged not tested
Problem:    Pattern matching with ModeChanged not tested.
Solution:   Add a few more test lines. (issue vim/vim#8856)
72d2fa69e5
2021-11-18 11:23:18 +01:00
fc3e5caefd vim-patch:8.2.3462: ModeChanged only uses one character for new_mode and old_mode
Problem:    The ModeChanged event only uses one character for the new_mode and
            old_mode values.
Solution:   Pass one as first argument to mode(). (issue vim/vim#8856)
d85931e673
2021-11-18 11:23:18 +01:00
69bd1e4e36 vim-patch:8.2.3430: no generic way to trigger an autocommand on mode change
Problem:    No generic way to trigger an autocommand on mode change.
Solution:   Add the ModeChanged autocommand event. (Magnus Gross, closes vim/vim#8856)
f1e8876fa2

N/A patches for version.c:

vim-patch:8.2.3434: function prototype for trigger_modechanged() is incomplete

Problem:    Function prototype for trigger_modechanged() is incomplete.
Solution:   Add "void".
28e591dd50

Fixes #4399.
Fixes #7416.
2021-11-18 11:23:18 +01:00
bd15ff7b84 test: require fewest number of main loop iterations possible
Change exc_exec to pcall_err to reduce one main loop iteration.
No need to call poke_eventloop() unless after nvim_input().
2021-11-15 10:34:43 +08:00
807 changed files with 77207 additions and 45683 deletions

View File

@ -1,11 +1,10 @@
image: freebsd/12.x
image: freebsd/latest
packages:
- cmake
- gmake
- ninja
- libtool
- sha
- automake
- pkgconf
- unzip
@ -13,6 +12,7 @@ packages:
- gettext
- python
- libffi
- gdb
sources:
- https://github.com/neovim/neovim
@ -35,10 +35,6 @@ tasks:
- unittest: |
cd neovim
gmake unittest
# Unfortunately, oldtest is tanking hard on sourcehut's FreeBSD instance
# and not producing any logs as a result. So don't do this task for now.
# Ref: https://github.com/neovim/neovim/pull/11477#discussion_r352095005.
# - test-oldtest: |
# cd neovim
# gmake oldtest
- oldtest: |
cd neovim
gmake oldtest

View File

@ -1,6 +1,6 @@
# sourcehut CI: https://builds.sr.ht/~jmk/neovim
image: openbsd/6.9
image: openbsd/latest
packages:
- autoconf-2.71
@ -12,6 +12,7 @@ packages:
- libtool
- ninja-1.10.2p0
- unzip-6.0p14
- gdb
sources:
- https://github.com/neovim/neovim

View File

@ -2,10 +2,10 @@ BasedOnStyle: Google
Language: Cpp
ColumnLimit: 100
IndentWidth: 2
TabWidth: 2
TabWidth: 8
UseTab: Never
IndentCaseLabels: true
BreakBeforeBraces: Linux
IndentCaseLabels: false
BreakBeforeBraces: Custom
AlignEscapedNewlinesLeft: false
AllowShortFunctionsOnASingleLine: false
AlignTrailingComments: true
@ -17,4 +17,24 @@ AllowShortLoopsOnASingleLine: false
BinPackParameters: false
BreakBeforeBinaryOperators: true
BreakBeforeTernaryOperators: true
ContinuationIndentWidth: 4
ContinuationIndentWidth: 2
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: No
AlwaysBreakTemplateDeclarations: No
AlignEscapedNewlines: DontAlign
BinPackArguments: false
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
PointerAlignment: Right
SortIncludes: false
Cpp11BracedListStyle: false

View File

@ -8,6 +8,9 @@ end_of_line = lf
insert_final_newline = true
charset = utf-8
[*.{c,h,in,lua}]
max_line_length = 100
[{Makefile,**/Makefile,runtime/doc/*.txt}]
indent_style = tab
indent_size = 8

View File

@ -36,3 +36,18 @@ d90fb1c0bfc1e64c783c385a79e7de87013dadba
9c268263b1792d00b3ffdfd7495af2575862656e
8c74c895b300bcee5fa937a2329d1d4756567b42
40be47e0faef7aa015eb4ba44ceb1ee1a03e97cf
4472c56d54f447040f6e8610b261b7efa0d04eb6
a68faed02dc8e37b8f10da14dc02e33e6ed93947
725cbe7d414f609e769081276f2a034e32a4337b
7e3bdc75e44b9139d8afaea4381b53ae78b15746
4ba12b3dda34472c193c9fa8ffd7d3bd5b6c04d6
849f104c2789c884428fd45501912c6591a78e12
38dd53c525054daf83dba27d7d46e90e8b41fa50
6059784770c4c88fb6fe528b9f7634192fa1164e
ee031eb5256bb83e0d6add2bae6fd943a4186ffe
69e11b58b4db0952f11a5ff85aa7150b5f5b8db8
271bb32855853b011fceaf0ad2f829bce66b2a19
# typos
d238b8f6003d34cae7f65ff7585b48a2cd9449fb
4547137aaff32b20172870a549d3a28a3c7adf1c

View File

@ -27,13 +27,6 @@ body:
validations:
required: true
- type: textarea
attributes:
label: ':checkhealth'
description: |
Paste the results from `nvim -c ":checkhealth nvim lspconfig"`
render: markdown
- type: textarea
attributes:
label: 'Steps to reproduce using "nvim -u minimal_init.lua"'

6
.github/labeler.yml vendored
View File

@ -49,9 +49,10 @@
"build":
- CMakeLists.txt
- "**/CMakeLists.txt"
- "**/Makefile"
- "**/*.cmake"
"tests":
"test":
- all: ["test/**/*"]
"ci":
@ -59,3 +60,6 @@
- .github/workflows/**/*
- .builds/*
- ci/**/*
"filetype":
- runtime/lua/vim/filetype.lua

16
.github/scripts/remove-reviewers.js vendored Normal file
View File

@ -0,0 +1,16 @@
module.exports = async ({github, context}) => {
const requestedReviewers = await github.rest.pulls.listRequestedReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
const reviewers = requestedReviewers.data.users.map(e => e.login)
github.rest.pulls.removeRequestedReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
reviewers: reviewers
});
}

95
.github/scripts/reviews.js vendored Normal file
View File

@ -0,0 +1,95 @@
module.exports = async ({github, context}) => {
const pr_data = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
})
const labels = pr_data.data.labels.map(e => e.name)
const reviewers = new Set()
if (labels.includes('api')) {
reviewers.add("bfredl")
reviewers.add("gpanders")
reviewers.add("muniter")
}
if (labels.includes('build')) {
reviewers.add("jamessan")
}
if (labels.includes('ci')) {
reviewers.add("jamessan")
}
if (labels.includes('column')) {
reviewers.add("lewis6991")
}
if (labels.includes('diagnostic')) {
reviewers.add("gpanders")
}
if (labels.includes('diff')) {
reviewers.add("lewis6991")
}
if (labels.includes('dependencies')) {
reviewers.add("jamessan")
}
if (labels.includes('distribution')) {
reviewers.add("jamessan")
}
if (labels.includes('documentation')) {
reviewers.add("clason")
}
if (labels.includes('extmarks')) {
reviewers.add("bfredl")
}
if (labels.includes('filetype')) {
reviewers.add("clason")
reviewers.add("gpanders")
}
if (labels.includes('gui')) {
reviewers.add("glacambre")
reviewers.add("smolck")
}
if (labels.includes('lsp')) {
reviewers.add("mfussenegger")
reviewers.add("mjlbach")
}
if (labels.includes('treesitter')) {
reviewers.add("bfredl")
reviewers.add("vigoux")
}
if (labels.includes('typo')) {
reviewers.add("dundargoc")
}
if (labels.includes('ui')) {
reviewers.add("bfredl")
}
if (labels.includes('vim-patch')) {
reviewers.add("seandewar")
reviewers.add("zeertzjq")
}
// Remove person that opened the PR since they can't review themselves
const pr_opener = pr_data.data.user.login
reviewers.delete(pr_opener)
github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
reviewers: Array.from(reviewers)
});
}

20
.github/workflows/api-docs-check.yml vendored Normal file
View File

@ -0,0 +1,20 @@
name: Missing API docs
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches-ignore:
- 'marvim/api-doc-update**'
paths:
- 'src/nvim/api/*.[ch]'
- 'runtime/lua/**.lua'
- 'runtime/doc/**'
jobs:
call-regen-api-docs:
if: github.event.pull_request.draft == false
permissions:
contents: write
pull-requests: write
uses: ./.github/workflows/api-docs.yml
with:
check_only: true

View File

@ -1,14 +1,23 @@
# Autogenerate the API docs on new commit to important branches
# Also work as a check for PR's to not forget committing their doc changes
# called from api-docs-check.yml
name: Autogenerate API docs
on:
push:
paths:
- 'src/nvim/api/*.[ch]'
- 'src/nvim/**.lua'
- 'runtime/lua/**.lua'
- 'runtime/doc/**'
branches:
- 'master'
- 'release-[0-9]+.[0-9]+'
workflow_dispatch:
workflow_call:
inputs:
check_only:
type: boolean
default: false
required: false
jobs:
regen-api-docs:
@ -26,7 +35,9 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y doxygen python3 python3-msgpack luajit
sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y python3 luajit
conda install -c conda-forge doxygen=1.9.2 msgpack-python
echo "$CONDA/bin" >> $GITHUB_PATH
- name: Setup git config
run: |
@ -42,10 +53,18 @@ jobs:
python3 scripts/gen_vimdoc.py
printf '::set-output name=UPDATED_DOCS::%s\n' $([ -z "$(git diff)" ]; echo $?)
- name: FAIL, PR has not committed doc changes
if: ${{ steps.docs.outputs.UPDATED_DOCS != 0 && inputs.check_only }}
run: |
echo "Job failed, run ./scripts/gen_vimdoc.py and commit your doc changes"
echo "The doc generation produces the following changes:"
git --no-pager diff
exit 1
- name: Automatic PR
if: ${{ steps.docs.outputs.UPDATED_DOCS != 0 }}
if: ${{ steps.docs.outputs.UPDATED_DOCS != 0 && !inputs.check_only }}
run: |
git add -u
git commit -m 'docs: regenerate'
git commit -m 'docs: regenerate [skip ci]'
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${DOC_BRANCH}
gh pr create --fill --base ${GITHUB_REF#refs/heads/} --head ${DOC_BRANCH} || true
gh pr create --draft --fill --base ${GITHUB_REF#refs/heads/} --head ${DOC_BRANCH} || true

View File

@ -12,7 +12,7 @@ jobs:
name: Backport Pull Request
if: >
github.repository_owner == 'neovim' && (
github.event_name == 'pull_request' &&
github.event_name == 'pull_request_target' &&
github.event.pull_request.merged
) || (
github.event_name == 'issue_comment' &&

View File

@ -9,24 +9,114 @@ on:
branches:
- 'master'
- 'release-[0-9]+.[0-9]+'
paths-ignore:
- 'runtime/doc/*'
# Cancel any in-progress CI runs for a PR if it is updated
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
unixish:
lint:
# This job tests two things: it lints the code but also builds neovim using
# system dependencies instead of bundled dependencies. This is to make sure
# we are able to build neovim without pigeonholing ourselves into specifics
# of the bundled dependencies.
if: (github.event_name == 'pull_request' && github.base_ref == 'master' && !github.event.pull_request.draft) || (github.event_name == 'push' && github.ref == 'refs/heads/master')
runs-on: ubuntu-20.04
timeout-minutes: 10
env:
CC: gcc
steps:
- uses: actions/checkout@v2
- name: Setup common environment variables
run: ./.github/workflows/env.sh lint
- name: Install apt packages
run: |
sudo add-apt-repository ppa:neovim-ppa/stable
sudo apt-get update
sudo apt-get install -y \
autoconf \
automake \
build-essential \
ccache \
cmake \
flake8 \
gettext \
gperf \
libluajit-5.1-dev \
libmsgpack-dev \
libtermkey-dev \
libtool-bin \
libtree-sitter-dev \
libunibilium-dev \
libuv1-dev \
libvterm-dev \
locales \
lua-busted \
lua-check \
lua-filesystem \
lua-inspect \
lua-lpeg \
lua-luv-dev \
lua-nvim \
luajit \
ninja-build \
pkg-config
- name: Cache artifacts
uses: actions/cache@v2
with:
path: |
${{ env.CACHE_NVIM_DEPS_DIR }}
~/.ccache
key: lint-${{ hashFiles('cmake/*', '**/CMakeLists.txt', '!third-party/**CMakeLists.txt') }}-${{ github.base_ref }}
- name: Build third-party
run: ./ci/before_script.sh
- name: Build nvim
run: ./ci/run_tests.sh build_nvim
- if: "!cancelled()"
name: clint-full
run: ./ci/run_lint.sh clint-full
- if: "!cancelled()"
name: lualint
run: ./ci/run_lint.sh lualint
- if: "!cancelled()"
name: pylint
run: ./ci/run_lint.sh pylint
- if: "!cancelled()"
name: shlint
run: ./ci/run_lint.sh shlint
- if: "!cancelled()"
name: check-single-includes
run: ./ci/run_lint.sh check-single-includes
- name: Cache dependencies
run: ./ci/before_cache.sh
posix:
name: ${{ matrix.runner }} ${{ matrix.flavor }} (cc=${{ matrix.cc }})
strategy:
fail-fast: false
matrix:
include:
- flavor: asan
cc: clang-12
runner: ubuntu-20.04
os: linux
- flavor: lint
cc: gcc
cc: clang-13
runner: ubuntu-20.04
os: linux
- flavor: tsan
cc: clang-12
cc: clang-13
runner: ubuntu-20.04
os: linux
- cc: clang
@ -35,6 +125,17 @@ jobs:
- cc: clang
runner: macos-11.0
os: osx
# The functionaltest-lua test two things simultaneously:
# 1. Check that the tests pass with PUC Lua instead of LuaJIT.
# 2. Use as oldest/minimum versions of dependencies/build tools we
# still explicitly support so we don't accidentally rely on
# features that is only available on later versions.
- flavor: functionaltest-lua
cc: gcc
runner: ubuntu-20.04
os: linux
cmake: minimum_required
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
if: github.event.pull_request.draft == false
@ -53,27 +154,40 @@ jobs:
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential ccache cmake cpanminus cscope gcc-multilib gdb gettext gperf language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip
- name: Install minimum required version of cmake
if: matrix.cmake == 'minimum_required'
env:
CMAKE_URL: 'https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.sh'
CMAKE_VERSION: '3.10.0'
shell: bash
run: |
curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
mkdir -p "$HOME/.local/bin" /opt/cmake-custom
chmod a+x /tmp/cmake-installer.sh
/tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake"
cmake_version="$(cmake --version | head -1)"
echo "$cmake_version" | grep -qF "cmake version $CMAKE_VERSION" || {
echo "Unexpected CMake version: $cmake_version"
exit 1
}
- name: Install new clang
if: matrix.flavor == 'asan' || matrix.flavor == 'tsan'
run: |
wget https://apt.llvm.org/llvm.sh
chmod a+x llvm.sh
sudo ./llvm.sh 12
sudo ./llvm.sh 13
rm llvm.sh
- name: Install brew packages
if: matrix.os == 'osx'
run: |
# Workaround brew issues
rm -f /usr/local/bin/2to3
brew update >/dev/null
brew upgrade
brew install automake ccache perl cpanminus ninja
brew update --quiet
brew install automake ccache cpanminus ninja
- name: Setup interpreter packages
run: |
./ci/before_install.sh
./ci/install.sh
run: ./ci/install.sh
- name: Cache dependencies
uses: actions/cache@v2
@ -86,15 +200,31 @@ jobs:
- name: Build third-party
run: ./ci/before_script.sh
- name: Build and test
run: ./ci/script.sh
- name: Build
run: ./ci/run_tests.sh build_nvim
- if: matrix.flavor != 'tsan' && matrix.flavor != 'functionaltest-lua' && !cancelled()
name: Unittests
run: ./ci/run_tests.sh unittests
- if: matrix.flavor != 'tsan' && !cancelled()
name: Functionaltests
run: ./ci/run_tests.sh functionaltests
- if: "!cancelled()"
name: Oldtests
run: ./ci/run_tests.sh oldtests
- if: "!cancelled()"
name: Install nvim
run: ./ci/run_tests.sh install_nvim
- name: Cache dependencies
if: ${{ success() }}
run: ./ci/before_cache.sh
windows:
runs-on: windows-2016
runs-on: windows-2019
timeout-minutes: 45
if: github.event.pull_request.draft == false
env:
DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }}
@ -117,69 +247,3 @@ jobs:
run: powershell ci\build.ps1
env:
CONFIGURATION: ${{ matrix.config }}
functionaltest:
name: ${{ matrix.runner }} ${{ matrix.flavor }} (cc=${{ matrix.cc }})
strategy:
fail-fast: false
matrix:
include:
- flavor: functionaltest-lua
cc: gcc
runner: ubuntu-20.04
os: linux
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
env:
CC: ${{ matrix.cc }}
CI_OS_NAME: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Setup commom environment variables
run: ./.github/workflows/env.sh ${{ matrix.flavor }}
- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential ccache cmake cpanminus cscope gcc-multilib gdb gettext gperf language-pack-tr libtool-bin locales ninja-build pkg-config python3 python3-pip python3-setuptools unzip valgrind xclip
- name: Install minimum required version of cmake
env:
CMAKE_URL: 'https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.sh'
CMAKE_VERSION: '3.10.0'
shell: bash
run: |
curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
mkdir -p "$HOME/.local/bin" /opt/cmake-custom
chmod a+x /tmp/cmake-installer.sh
/tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake"
cmake_version="$(cmake --version | head -1)"
echo "$cmake_version" | grep -qF "cmake version $CMAKE_VERSION" || {
echo "Unexpected CMake version: $cmake_version"
exit 1
}
- name: Setup interpreter packages
run: |
./ci/before_install.sh
./ci/install.sh
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
${{ env.CACHE_NVIM_DEPS_DIR }}
~/.ccache
key: ${{ matrix.runner }}-${{ matrix.flavor }}-${{ matrix.cc }}-${{ hashFiles('cmake/*', 'third-party/**', '**/CMakeLists.txt') }}-${{ github.base_ref }}
- name: Build third-party
run: ./ci/before_script.sh
- name: Build and test
run: ./ci/script.sh
- name: Cache dependencies
if: ${{ success() }}
run: ./ci/before_cache.sh

View File

@ -1,19 +1,21 @@
name: "Commit Linter"
on:
pull_request:
# Only pull_request and push honor [skip ci]. Since this workflow must pass
# to merge a PR, it can't be skipped, so use pull_request_target
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
jobs:
lint-commits:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2.3.1
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
path: pr_nvim
- uses: rhysd/action-setup-vim@v1
with:
neovim: true
- run: nvim --clean -es +"lua require('scripts.lintcommit').main({trace=true})"
- run: wget https://raw.githubusercontent.com/neovim/neovim/master/scripts/lintcommit.lua
- run: nvim --clean -es +"cd pr_nvim" +"lua dofile('../lintcommit.lua').main({trace=true})"

View File

@ -34,18 +34,23 @@ case "$FLAVOR" in
BUILD_FLAGS="$BUILD_FLAGS -DPREFER_LUA=ON"
cat <<EOF >> "$GITHUB_ENV"
CLANG_SANITIZER=ASAN_UBSAN
SYMBOLIZER=asan_symbolize-12
ASAN_OPTIONS=detect_leaks=1:check_initialization_order=1:log_path=$GITHUB_WORKSPACE/build/log/asan
SYMBOLIZER=asan_symbolize-13
ASAN_OPTIONS=detect_leaks=1:check_initialization_order=1:log_path=$GITHUB_WORKSPACE/build/log/asan:intercept_tls_get_addr=0
UBSAN_OPTIONS=print_stacktrace=1 log_path=$GITHUB_WORKSPACE/build/log/ubsan
EOF
;;
tsan)
cat <<EOF >> "$GITHUB_ENV"
TSAN_OPTIONS=log_path=$GITHUB_WORKSPACE/build/log/tsan
CLANG_SANITIZER=TSAN
EOF
;;
lint)
# Re-enable once system deps are available
# BUILD_FLAGS="$BUILD_FLAGS -DLIBLUV_LIBRARY:FILEPATH=/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/lua/5.1/luv.so -DLIBLUV_INCLUDE_DIR:PATH=/usr/include/lua5.1"
DEPS_CMAKE_FLAGS="$DEPS_CMAKE_FLAGS -DUSE_BUNDLED_LUV=ON"
cat <<EOF >> "$GITHUB_ENV"
USE_BUNDLED=OFF
CI_TARGET=lint
EOF
;;

View File

@ -1,8 +1,9 @@
name: "Pull Request Labeler"
on:
pull_request_target:
types: opened
types: [opened]
jobs:
triage:
runs-on: ubuntu-latest
permissions:
@ -12,6 +13,8 @@ jobs:
- uses: actions/labeler@main
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: ""
type-scope:
runs-on: ubuntu-latest
permissions:
@ -23,8 +26,24 @@ jobs:
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
steps:
# Extract type and try to add it as a label
- run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" || true
- name: "Extract commit type and add as label"
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" || true
- name: "Extract commit scope and add as label"
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" || true
- name: "Extract if the PR is a breaking change and add it as label"
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" || true
# Extract scope and try to add it as a label
- run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" || true
request-reviewer:
if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false
runs-on: ubuntu-latest
needs: ["triage", "type-scope"]
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v2
- name: 'Request reviewers'
uses: actions/github-script@v6
with:
script: |
const script = require('./.github/scripts/reviews.js')
await script({github, context})

View File

@ -6,8 +6,17 @@ ${NVIM_VERSION}
### Windows
1. Extract **nvim-win64.zip**
2. Run `nvim-qt.exe`
#### Zip
1. Download **nvim-win64.zip**
2. Extract the zip.
3. Run `nvim-qt.exe`
#### MSI
1. Download **nvim-win64.msi**
2. Run the MSI
3. Search and run `nvim-qt.exe` or run `nvim.exe` on your CLI of choice.
### macOS
@ -17,6 +26,19 @@ ${NVIM_VERSION}
### Linux (x64)
#### Tarball
1. Download **nvim-linux64.tar.gz**
2. Extract: `tar xzvf nvim-linux64.tar.gz`
3. Run `./nvim-linux64/bin/nvim`
#### Debian Package
1. Download **nvim-linux64.deb**
2. Install the package using `sudo apt install ./nvim-linux64.deb`
3. Run `nvim`
#### AppImage
1. Download **nvim.appimage**
2. Run `chmod u+x nvim.appimage && ./nvim.appimage`
- If your system does not have FUSE you can [extract the appimage](https://github.com/AppImage/AppImageKit/wiki/FUSE#type-2-appimage):
@ -32,9 +54,11 @@ ${NVIM_VERSION}
## SHA256 Checksums
```
${SHA_LINUX_64}
${SHA_LINUX_64_TAR}
${SHA_LINUX_64_DEB}
${SHA_APP_IMAGE}
${SHA_APP_IMAGE_ZSYNC}
${SHA_MACOS}
${SHA_WIN_64}
${SHA_WIN_64_ZIP}
${SHA_WIN_64_MSI}
```

View File

@ -39,12 +39,17 @@ jobs:
printf '::set-output name=version::%s\n' "$(./build/bin/nvim --version | head -n 3 | sed -z 's/\n/%0A/g')"
printf '::set-output name=release::%s\n' "$(./build/bin/nvim --version | head -n 1)"
make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-linux64" install
cd "$GITHUB_WORKSPACE/build/release"
tar cfz nvim-linux64.tar.gz nvim-linux64
cd "$GITHUB_WORKSPACE/build/"
cpack -C $NVIM_BUILD_TYPE
- uses: actions/upload-artifact@v2
with:
name: nvim-linux64
path: build/release/nvim-linux64.tar.gz
path: build/nvim-linux64.tar.gz
retention-days: 1
- uses: actions/upload-artifact@v2
with:
name: nvim-linux64
path: build/nvim-linux64.deb
retention-days: 1
appimage:
@ -80,9 +85,7 @@ jobs:
fetch-depth: 0
- name: Install brew packages
run: |
rm -f /usr/local/bin/2to3
brew update >/dev/null
brew upgrade
brew update --quiet
brew install automake ninja
- if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly')
run: printf 'NVIM_BUILD_TYPE=Release\n' >> $GITHUB_ENV
@ -116,7 +119,7 @@ jobs:
retention-days: 1
windows:
runs-on: windows-2016
runs-on: windows-2019
env:
DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }}
DEPS_PREFIX: ${{ format('{0}/nvim-deps/usr', github.workspace) }}
@ -133,12 +136,16 @@ jobs:
- run: powershell ci\build.ps1 -NoTests
env:
CONFIGURATION: ${{ matrix.config }}
- run: move build\Neovim.zip build\${{ matrix.archive }}.zip
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.archive }}
path: build/${{ matrix.archive }}.zip
retention-days: 1
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.archive }}
path: build/${{ matrix.archive }}.msi
retention-days: 1
publish:
needs: [linux, appimage, macOS, windows]
@ -189,7 +196,9 @@ jobs:
run: |
cd ./nvim-linux64
sha256sum nvim-linux64.tar.gz > nvim-linux64.tar.gz.sha256sum
echo "SHA_LINUX_64=$(cat nvim-linux64.tar.gz.sha256sum)" >> $GITHUB_ENV
echo "SHA_LINUX_64_TAR=$(cat nvim-linux64.tar.gz.sha256sum)" >> $GITHUB_ENV
sha256sum nvim-linux64.deb > nvim-linux64.deb.sha256sum
echo "SHA_LINUX_64_DEB=$(cat nvim-linux64.deb.sha256sum)" >> $GITHUB_ENV
- name: Generate App Image SHA256 checksums
run: |
cd ./appimage
@ -209,11 +218,14 @@ jobs:
run: |
cd ./nvim-win64
sha256sum nvim-win64.zip > nvim-win64.zip.sha256sum
echo "SHA_WIN_64=$(cat nvim-win64.zip.sha256sum)" >> $GITHUB_ENV
echo "SHA_WIN_64_ZIP=$(cat nvim-win64.zip.sha256sum)" >> $GITHUB_ENV
sha256sum nvim-win64.msi > nvim-win64.msi.sha256sum
echo "SHA_WIN_64_MSI=$(cat nvim-win64.msi.sha256sum)" >> $GITHUB_ENV
- name: Publish release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NVIM_VERSION: ${{ needs.linux.outputs.version }}
DEBUG: api
run: |
envsubst < "$GITHUB_WORKSPACE/.github/workflows/notes.md" > "$RUNNER_TEMP/notes.md"
gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA nvim-macos/* nvim-linux64/* appimage/* nvim-win64/*

View File

@ -0,0 +1,17 @@
name: "Remove reviewers"
on:
pull_request_target:
types: [converted_to_draft, closed]
jobs:
remove-reviewers:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v2
- name: 'Remove reviewers'
uses: actions/github-script@v6
with:
script: |
const script = require('./.github/scripts/remove-reviewers.js')
await script({github, context})

18
.github/workflows/reviews.yml vendored Normal file
View File

@ -0,0 +1,18 @@
name: "Request reviews"
on:
pull_request_target:
types: [labeled, ready_for_review]
jobs:
request-reviewer:
if: github.event.pull_request.state == 'open' && github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v2
- name: 'Request reviewers'
uses: actions/github-script@v6
with:
script: |
const script = require('./.github/scripts/reviews.js')
await script({github, context})

View File

@ -1,33 +0,0 @@
name: Squash Typo Pull Requests
on:
pull_request_target:
types: labeled
concurrency:
group: ${{ github.workflow }}
jobs:
build:
if: github.event.label.name == 'typo'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- name: Setup git config
run: |
git config --global user.name 'marvim'
git config --global user.email 'marvim@users.noreply.github.com'
- run: python scripts/squash_typos.py
env:
PR_NUMBER: ${{ github.event.number }}

View File

@ -49,4 +49,4 @@ jobs:
git add -u
git commit -m 'version.c: update [skip ci]'
git push --force https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} ${VERSION_BRANCH}
gh pr create --fill --label vim-patch --base ${GITHUB_REF#refs/heads/} --head ${VERSION_BRANCH} || true
gh pr create --draft --fill --label vim-patch --base ${GITHUB_REF#refs/heads/} --head ${VERSION_BRANCH} || true

2
.gitignore vendored
View File

@ -1,6 +1,7 @@
# Tools
/venv/
compile_commands.json
/.luarc.json
# IDEs
/.vs/
@ -14,6 +15,7 @@ compile_commands.json
/.clangd/
/.cache/clangd/
/.ccls-cache/
/.clang-tidy
.DS_Store
*.mo

View File

@ -26,6 +26,10 @@ read_globals = {
"vim",
}
globals = {
"vim.g",
}
exclude_files = {
'test/functional/fixtures/lua/syntax_error.lua',
}

134
.mailmap Normal file
View File

@ -0,0 +1,134 @@
Abdelhakeem <abdelhakeem.osama@hotmail.com> Abdelhakeem Osama
Alvaro Muñoz <alvaro@pwntester.com> Alvaro Muñoz
Andreas Johansson <andreas@ndrs.xyz> <ndreas@users.noreply.github.com>
Andrew Pyatkov <mrbiggfoot@gmail.com> <mrbiggfoot@users.noreply.github.com>
Anmol Sethi <hi@nhooyr.io> <anmol@aubble.com>
Anmol Sethi <hi@nhooyr.io> <me@anmol.io>
Anmol Sethi <hi@nhooyr.io> <nhooyr@users.noreply.github.com>
BK1603 <chouhan.shreyansh2702@gmail.com> Shreyansh Chouhan
Billy Su <g4691821@gmail.com> Billy SU
Billy Vong <billyvg@gmail.com> <billyvg@users.noreply.github.com>
Björn Linse <bjorn.linse@gmail.com> bfredl
Carlos Hernandez <carlos@techbyte.ca> <hurricanehrndz@users.noreply.github.com>
Chris Kipp <ckipp@pm.me> ckipp01
Christian Clason <c.clason@uni-graz.at> <christian.clason@uni-due.de>
Cédric Barreteau <> <cbarrete@users.noreply.github.com>
Dan Aloni <alonid@gmail.com> <dan@kernelim.com>
Daniel Hahler <git@thequod.de> <github@thequod.de>
Eisuke Kawashima <e-kwsm@users.noreply.github.com> E Kawashima
ElPiloto <luis.r.piloto@gmail.com> Luis Piloto
Eliseo Martínez <eliseomarmol@gmail.com> Eliseo Martínez
Fabian Viöl <f.vioel@googlemail.com> Fabian
Florian Walch <florian@fwalch.com> <fwalch@users.noreply.github.com>
Gabriel Cruz <gabs.oficial98@gmail.com> <LTKills@users.noreply.github.com>
Gaelan Steele <gbs@canishe.com> Gaelan
Gavin D. Howard <gavin@schedmd.com> <yzena.tech@gmail.com>
George Zhao <zhaozg@gmail.com> <zhaozg@aliyun.com>
George Zhao <zhaozg@gmail.com> George Zhao
Gregory Anders <greg@gpanders.com> <8965202+gpanders@users.noreply.github.com>
Gregory Anders <greg@gpanders.com> Greg Anders
Grzegorz Milka <grzegorzmilka@gmail.com> Grzegorz
Harm te Hennepe <dhtehennepe@gmail.com> <d.h.tehennepe@student.utwente.nl>
Harm te Hennepe <dhtehennepe@gmail.com> <harm@tehennepe.org>
Hirokazu Hata <h.hata.ai.t@gmail.com> <h-michael@users.noreply.github.com>
Ihor Antonov <ngortheone@gmail.com> <ngortheone@users.noreply.github.com>
J Phani Mahesh <phanimahesh@gmail.com> <github@phanimahesh.me>
Jack Bracewell <FriedSock@users.noreply.github.com> <jack.bracewell@unboxedconsulting.com>
Jack Bracewell <FriedSock@users.noreply.github.com> <jbtwentythree@gmail.com>
Jacques Germishuys <jacquesg@striata.com> <jacquesg@users.noreply.github.com>
Jakub Łuczyński <doubleloop@o2.pl> <doubleloop@users.noreply.github.com>
James McCoy <jamessan@jamessan.com> <vega.james@gmail.com>
Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> <janedmundlazo@hotmail.com>
Jan Viljanen <jan.a.viljanen@gmail.com> <jan.viljanen@greenpeace.org>
Javier Lopez <graulopezjavier@gmail.com> Javier López
Jit Yao Yap <jityao@gmail.com> <jityao+github@gmail.com>
Jit Yao Yap <jityao@gmail.com> Jit
John Gehrig <jdg.gehrig@gmail.com> <jgehrig@users.noreply.github.com>
John Schmidt <john.schmidt.h@gmail.com> John
John Szakmeister <john@szakmeister.net> <jszakmeister@users.noreply.github.com>
Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.com> <jdebp@users.noreply.github.com>
Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.com> <postmaster@localhost>
Jurica Bradaric <jbradaric@gmail.com> <jbradaric@users.noreply.github.com>
Jurica Bradaric <jbradaric@gmail.com> <jurica.bradaric@avl.com>
KillTheMule <KillTheMule@users.noreply.github.com> <github@pipsfrank.de>
Kwon-Young Choi <kwon-young.choi@hotmail.fr> Kwon-Young
Lucas Hoffmann <l-m-h@web.de> <lucc@posteo.de>
Lucas Hoffmann <l-m-h@web.de> <lucc@users.noreply.github.com>
Marco Hinz <mh.codebro@gmail.com> <mh.codebro+github@gmail.com>
Marvim the Paranoid Android <marvim@users.noreply.github.com> marvim
Mateusz Czapliński <czapkofan@gmail.com> Mateusz Czaplinski
Mathias Fussenegger <f.mathias@zignar.net> <mfussenegger@users.noreply.github.com>
Mathias Fussenegger <f.mathias@zignar.net> Mathias Fußenegger
Matt Wozniski <godlygeek@gmail.com> <godlygeek+git@gmail.com>
Matthieu Coudron <mattator@gmail.com> <coudron@iij.ad.jp>
Matthieu Coudron <mattator@gmail.com> <matthieu.coudron@upmc.fr>
Matthieu Coudron <mattator@gmail.com> <mcoudron@hotmail.com>
Matthieu Coudron <mattator@gmail.com> <teto@users.noreply.github.com>
MichaHoffmann <michoffmann.potsdam@gmail.com> Michael Hoffmann
MichaHoffmann <michoffmann.potsdam@gmail.com> micha
Michael Ennen <mike.ennen@gmail.com> <brcolow@users.noreply.github.com>
Michael Ennen <mike.ennen@gmail.com> brcolow
Michael Reed <m.reed@mykolab.com> <Pyrohh@users.noreply.github.com>
Michael Schupikov <michael@schupikov.de> <DarkDeepBlue@users.noreply.github.com>
Nicolas Hillegeer <nicolas@hillegeer.com> <nicolashillegeer@gmail.com>
Panashe M. Fundira <fundirap@gmail.com> Panashe Fundira
Patrice Peterson <patrice.peterson@mailbox.org> runiq
Pavel Platto <hinidu@gmail.com> Hinidu
Petter Wahlman <petter@wahlman.no> <pwahlman@cisco.com>
Poh Zi How <poh.zihow@gmail.com> pohzipohzi
Rich Wareham <rjw57@cam.ac.uk> <rjw57@cantab.net>
Rui Abreu Ferreira <equalsraf@users.noreply.github.com> @equalsraf
Rui Abreu Ferreira <raf-ep@gmx.com> <equalsraf@users.noreply.github.com>
Rui Abreu Ferreira <raf-ep@gmx.com> <rap-ep@gmx.com>
Sam Wilson <tecywiz121@hotmail.com> <sawilson@akamai.com>
Sander Bosma <sanderbosma@gmail.com> sander2
Santos Gallegos <stsewd@protonmail.com> <santos_g@outlook.com>
Sebastian Parborg <darkdefende@gmail.com> DarkDefender
Shirasaka <tk.shirasaka@gmail.com> tk-shirasaka
Shota <shotat@users.noreply.github.com> shotat
Shougo Matsushita <Shougo.Matsu@gmail.com> Shougo
Stephan Seitz <stephan.seitz@fau.de> <stephan.lauf@yahoo.de>
Steven Sojka <Steven.Sojka@tdameritrade.com> <steelsojka@gmail.com>
Steven Sojka <steelsojka@gmail.com> <steelsojka@users.noreply.github.com>
TJ DeVries <devries.timothyj@gmail.com> <timothydvrs1234@gmail.com>
Thomas Fehér <thomas.feher@yahoo.de> <thomasfeher@web.de>
Thomas Vigouroux <tomvig38@gmail.com> <39092278+vigoux@users.noreply.github.com>
Utkarsh Maheshwari <UtkarshME96@gmail.com> UTkarsh Maheshwari
Utkarsh Maheshwari <utkarshme96@gmail.com> <UtkarshME96@gmail.com>
VVKot <volodymyr.kot.ua@gmail.com> Volodymyr Kot
Victor Adam <victor.adam@cofelyineo-gdfsuez.com> <Victor.Adam@derpymail.org>
Wang Shidong <wsdjeg@outlook.com> <wsdjeg@users.noreply.github.com>
Wei Huang <daviseago@gmail.com> davix
Xu Cheng <xucheng@me.com> <xu-cheng@users.noreply.github.com>
Yamakaky <yamakaky@gmail.com> <yamakaky@yamaworld.fr>
Yegappan Lakshmanan <yegappan@yahoo.com> <4298407+yegappan@users.noreply.github.com>
Yichao Zhou <broken.zhoug@gmail.com> Yichao Zhou <broken.zhou@gmail.com>
Yichao Zhou <broken.zhoug@gmail.com> zhou13 <broken.zhou@gmail.com>
Yorick Peterse <git@yorickpeterse.com> <yorick@yorickpeterse.com>
ZyX <kp-pav@yandex.ru> <kp-pav@ya.ru>
ZyX <kp-pav@yandex.ru> Nikolai Aleksandrovich Pavlov
aph <a.hewson@gmail.com> Ashley Hewson
butwerenotthereyet <58348703+butwerenotthereyet@users.noreply.github.com> We're Yet
chemzqm <chemzqm@gmail.com> Qiming zhao
chentau <tchen1998@gmail.com> Tony Chen
dedmass <carlo.abelli@gmail.com> Carlo Abelli
equal-l2 <eng.equall2@gmail.com> <equal-l2@users.noreply.github.com>
francisco souza <fsouza@users.noreply.github.com> <108725+fsouza@users.noreply.github.com>
glacambre <code@lacamb.re> <me@r4>
glacambre <code@lacamb.re> Ghjuvan Lacambre
ii14 <ii14@users.noreply.github.com> <59243201+ii14@users.noreply.github.com>
jdrouhard <john@jmdtech.org> <github@jmdtech.org>
kuuote <znmxodq1@gmail.com> <36663503+kuuote@users.noreply.github.com>
matveyt <matthewtarasov@gmail.com> <35012635+matveyt@users.noreply.github.com>
nate <nateozemon@gmail.com> nateozem
ray-x <rayx.cn@gmail.com> rayx
relnod <mail@paul-schiffers.de> <relnod@users.noreply.github.com>
rockerBOO <rockerboo@gmail.com> Dave Lage
rpigott <rpigott@berkeley.edu> Ronan Pigott
sach1t <sach0010t@gmail.com> <sach1t@users.noreply.github.com>
shade-of-noon <73705427+shade-of-noon@users.noreply.github.com> Edwin Pujols
shadmansaleh <shadmansaleh3@gmail.com> <13149513+shadmansaleh@users.noreply.github.com>
shadmansaleh <shadmansaleh3@gmail.com> Shadman
sohnryang <loop.infinitely@gmail.com> 손량
timeyyy <timeyyy_da_man@hotmail.com> Timothy C Eichler
timeyyy <timeyyy_da_man@hotmail.com> timothy eichler

View File

@ -12,6 +12,9 @@ endif()
if(POLICY CMP0060)
cmake_policy(SET CMP0060 NEW)
endif()
if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif()
# Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
@ -136,12 +139,12 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
# If not in a git repo (e.g., a tarball) these tokens define the complete
# version string, else they are combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 6)
set(NVIM_VERSION_MINOR 7)
set(NVIM_VERSION_PATCH 0)
set(NVIM_VERSION_PRERELEASE "") # for package maintainers
# API level
set(NVIM_API_LEVEL 8) # Bump this after any API change.
set(NVIM_API_LEVEL 9) # Bump this after any API change.
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
set(NVIM_API_PRERELEASE false)
@ -281,6 +284,9 @@ if(MSVC)
else()
add_compile_options(-Wall -Wextra -pedantic -Wno-unused-parameter
-Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion
-Wdouble-promotion
-Wmissing-noreturn
-Wmissing-format-attribute
-Wmissing-prototypes)
check_c_compiler_flag(-Wimplicit-fallthrough HAVE_WIMPLICIT_FALLTHROUGH_FLAG)
@ -288,6 +294,27 @@ else()
add_compile_options(-Wimplicit-fallthrough)
endif()
# Clang doesn't have -Wsuggest-attribute so check for each one.
check_c_compiler_flag(-Wsuggest-attribute=pure HAVE_WSUGGEST_ATTRIBUTE_PURE)
if(HAVE_WSUGGEST_ATTRIBUTE_PURE)
add_compile_options(-Wsuggest-attribute=pure)
endif()
check_c_compiler_flag(-Wsuggest-attribute=const HAVE_WSUGGEST_ATTRIBUTE_CONST)
if(HAVE_WSUGGEST_ATTRIBUTE_CONST)
add_compile_options(-Wsuggest-attribute=const)
endif()
check_c_compiler_flag(-Wsuggest-attribute=malloc HAVE_WSUGGEST_ATTRIBUTE_MALLOC)
if(HAVE_WSUGGEST_ATTRIBUTE_MALLOC)
add_compile_options(-Wsuggest-attribute=malloc)
endif()
check_c_compiler_flag(-Wsuggest-attribute=cold HAVE_WSUGGEST_ATTRIBUTE_COLD)
if(HAVE_WSUGGEST_ATTRIBUTE_COLD)
add_compile_options(-Wsuggest-attribute=cold)
endif()
# On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang
# 3.4.1 used there.
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_C_COMPILER_ID MATCHES "Clang")
@ -387,7 +414,7 @@ include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
find_package(Msgpack 1.0.0 REQUIRED)
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
find_package(LibLUV 1.30.0 REQUIRED)
find_package(LibLUV 1.43.0 REQUIRED)
include_directories(SYSTEM ${LIBLUV_INCLUDE_DIRS})
find_package(TreeSitter REQUIRED)
@ -408,6 +435,19 @@ main(void)
if(TS_HAS_SET_MATCH_LIMIT)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_TS_HAS_SET_MATCH_LIMIT")
endif()
check_c_source_compiles("
#include <stdlib.h>
#include <tree_sitter/api.h>
int
main(void)
{
ts_set_allocator(malloc, calloc, realloc, free);
return 0;
}
" TS_HAS_SET_ALLOCATOR)
if(TS_HAS_SET_ALLOCATOR)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_TS_HAS_SET_ALLOCATOR")
endif()
# Note: The test lib requires LuaJIT; it will be skipped if LuaJIT is missing.
option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
@ -543,6 +583,33 @@ endif()
message(STATUS "Using Lua interpreter: ${LUA_PRG}")
if(DEBUG)
option(COMPILE_LUA "Pre-compile Lua sources into bytecode (for sources that are included in the binary)" OFF)
else()
option(COMPILE_LUA "Pre-compile Lua sources into bytecode (for sources that are included in the binary)" ON)
endif()
if(COMPILE_LUA AND NOT WIN32)
if(PREFER_LUA)
foreach(CURRENT_LUAC_PRG luac5.1 luac)
find_program(_CHECK_LUAC_PRG ${CURRENT_LUAC_PRG})
if(_CHECK_LUAC_PRG)
set(LUAC_PRG "${_CHECK_LUAC_PRG} -s -o - %s" CACHE STRING "Format for compiling to Lua bytecode")
break()
endif()
endforeach()
elseif(LUA_PRG MATCHES "luajit")
check_lua_module(${LUA_PRG} "jit.bcsave" LUAJIT_HAS_JIT_BCSAVE)
if(LUAJIT_HAS_JIT_BCSAVE)
set(LUAC_PRG "${LUA_PRG} -b -s %s -" CACHE STRING "Format for compiling to Lua bytecode")
endif()
endif()
endif()
if(LUAC_PRG)
message(STATUS "Using Lua compiler: ${LUAC_PRG}")
endif()
# Setup busted.
find_program(BUSTED_PRG NAMES busted busted.bat)
find_program(BUSTED_LUA_PRG busted-lua)
@ -696,17 +763,6 @@ else()
COMMENT "lualint: LUACHECK_PRG not defined")
endif()
set(CPACK_PACKAGE_NAME "Neovim")
set(CPACK_PACKAGE_VENDOR "neovim.io")
set(CPACK_PACKAGE_VERSION ${NVIM_VERSION_MEDIUM})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Neovim")
# Set toplevel directory/installer name as Neovim
set(CPACK_PACKAGE_FILE_NAME "Neovim")
set(CPACK_TOPLEVEL_TAG "Neovim")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
include(CPack)
#add uninstall target
if(NOT TARGET uninstall)
@ -718,3 +774,8 @@ if(NOT TARGET uninstall)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/UninstallHelper.cmake)
endif()
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(packaging)
endif()

View File

@ -7,11 +7,11 @@ Getting started
If you want to help but don't know where to start, here are some
low-risk/isolated tasks:
- [Merge a Vim patch].
- Try a [good first issue](../../labels/good-first-issue) or [complexity:low] issue.
- Try a [complexity:low] issue.
- Fix bugs found by [Clang](#clang-scan-build), [PVS](#pvs-studio) or
[Coverity](#coverity).
- [Improve documentation][wiki-contribute-help]
- [Merge a Vim patch] (familiarity with Vim is *strongly* recommended)
Reporting problems
------------------
@ -244,6 +244,10 @@ You can lint a single file (but this will _not_ exclude legacy errors):
("Exuberant ctags", the typical `ctags` binary provided by your distro, is
unmaintained and won't recognize many function signatures in Neovim source.)
- Explore the source code [on the web](https://sourcegraph.com/github.com/neovim/neovim).
- If using [lua-language-server][], symlink `contrib/luarc.json` into the
project root:
$ ln -s contrib/luarc.json .luarc.json
Reviewing
@ -252,10 +256,10 @@ Reviewing
To help review pull requests, start with [this checklist][review-checklist].
Reviewing can be done on GitHub, but you may find it easier to do locally.
Using [`hub`][hub], you can create a new branch with the contents of a pull
Using [GitHub CLI][gh], you can create a new branch with the contents of a pull
request, e.g. [#1820][1820]:
hub checkout https://github.com/neovim/neovim/pull/1820
gh pr checkout https://github.com/neovim/neovim/pull/1820
Use [`git log -p master..FETCH_HEAD`][git-history-filtering] to list all
commits in the feature branch which aren't in the `master` branch; `-p`
@ -270,7 +274,7 @@ as context, use the `-W` argument as well.
[git-rebasing]: http://git-scm.com/book/en/v2/Git-Branching-Rebasing
[github-issues]: https://github.com/neovim/neovim/issues
[1820]: https://github.com/neovim/neovim/pull/1820
[hub]: https://hub.github.com/
[gh]: https://cli.github.com/
[conventional_commits]: https://www.conventionalcommits.org
[style-guide]: https://neovim.io/doc/user/dev_style.html#dev-style
[ASan]: http://clang.llvm.org/docs/AddressSanitizer.html
@ -285,6 +289,7 @@ as context, use the `-W` argument as well.
[complexity:low]: https://github.com/neovim/neovim/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity%3Alow
[master error list]: https://raw.githubusercontent.com/neovim/doc/gh-pages/reports/clint/errors.json
[wiki-contribute-help]: https://github.com/neovim/neovim/wiki/contribute-%3Ahelp
[pr-draft]: https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request
[pr-draft]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request
[pr-ready]: https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request
[uncrustify]: https://formulae.brew.sh/formula/uncrustify
[uncrustify]: http://uncrustify.sourceforge.net/
[lua-language-server]: https://github.com/sumneko/lua-language-server/

View File

@ -52,7 +52,7 @@ has a major bug:
3. Cut a release from `release-x.y`.
- Run `./scripts/release.sh`
- Update (force-push) the remote `stable` tag.
- The [nightly job](https://github.com/neovim/bot-ci/blob/master/ci/nightly.sh)
- The [nightly job](https://github.com/neovim/neovim/blob/master/.github/workflows/release.yml#L4)
will update the release assets based on the `stable` tag.
The neovim repository includes a backport [github action](https://github.com/zeebe-io/backport-action).
@ -76,6 +76,12 @@ These "bundled" dependencies can be updated by bumping their versions in `third-
- [lua-compat](https://github.com/keplerproject/lua-compat-5.3)
- [tree-sitter](https://github.com/tree-sitter/tree-sitter)
`scripts/bump-dep.sh` is a script that can automate this process for `LuaJIT`, `Luv`, `libuv` & `tree-sitter`. See usage guide:
- Run `./scripts/bump-deps.sh --dep Luv --version 1.43.0-0` to update a dependency.
See `./scripts/bump-deps.sh -h` for more detailed usage
- Run `./scripts/bump-deps.sh --pr` to create a pr
To generate the default PR title and body, the script uses the most recent commit (not in `master`) with prefix `build(deps): `
These dependencies are "vendored" (inlined), we need to update the sources manually:
- [libmpack](https://github.com/libmpack/libmpack)
- [xdiff](https://github.com/git/git/tree/master/xdiff)

View File

@ -166,7 +166,7 @@ _opt_pylint:
|| echo "SKIP: pylint (flake8 not found)"
commitlint:
$(NVIM_PRG) --clean -es +"lua require('scripts.lintcommit').main({trace=false})"
$(NVIM_PRG) -u NONE -es +"lua require('scripts.lintcommit').main({trace=false})"
_opt_commitlint:
@test -x build/bin/nvim && { $(MAKE) commitlint; exit $$?; } \

View File

@ -1,4 +1,6 @@
[![Neovim](https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo-300x87.png)](https://neovim.io)
<h1 align="center">
<img src="https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo-300x87.png" alt="Neovim">
</h1>
[Documentation](https://neovim.io/doc/general/) |
[Chat](https://app.element.io/#/room/#neovim:matrix.org) |
@ -119,7 +121,7 @@ Apache 2.0 license, except for contributions copied from Vim (identified by the
[Managed packages]: https://github.com/neovim/neovim/wiki/Installing-Neovim#install-from-package
[Debian]: https://packages.debian.org/testing/neovim
[Ubuntu]: http://packages.ubuntu.com/search?keywords=neovim
[Fedora]: https://apps.fedoraproject.org/packages/neovim
[Fedora]: https://packages.fedoraproject.org/pkgs/neovim/neovim/
[Arch Linux]: https://www.archlinux.org/packages/?q=neovim
[Void Linux]: https://voidlinux.org/packages/?arch=x86_64&q=neovim
[Gentoo]: https://packages.gentoo.org/packages/app-editors/neovim

View File

@ -7,6 +7,8 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/suite.sh"
mkdir -p "${HOME}/.cache"
echo "before_cache.sh: cache size"
du -chd 1 "${HOME}/.cache" | sort -rh | head -20
@ -16,7 +18,7 @@ ccache -s 2>/dev/null || true
find "${HOME}/.ccache" -name stats -delete
# Update the third-party dependency cache only if the build was successful.
if ended_successfully; then
if ended_successfully && [ -d "${DEPS_BUILD_DIR}" ]; then
# Do not cache downloads. They should not be needed with up-to-date deps.
rm -rf "${DEPS_BUILD_DIR}/build/downloads"
rm -rf "${CACHE_NVIM_DEPS_DIR}"

View File

@ -1,46 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
echo 'Python info:'
(
set -x
python3 --version
python2 --version
python --version
pip3 --version
pip2 --version
pip --version
pyenv --version
pyenv versions
) 2>&1 | sed 's/^/ /' || true
# Use pyenv, but not for OSX on Travis, where it only has the "system" version.
if [[ "${TRAVIS_OS_NAME}" != osx ]] && command -v pyenv; then
echo 'Setting Python versions via pyenv'
# Prefer Python 2 over 3 (more conservative).
pyenv global 2.7:3.8
echo 'Updated Python info:'
(
set -x
python3 --version
python2 --version
python --version
python3 -m pip --version
python2 -m pip --version
) 2>&1 | sed 's/^/ /'
fi
echo "Install node (LTS)"
if [[ "${TRAVIS_OS_NAME}" == osx ]] || [ ! -f ~/.nvm/nvm.sh ]; then
curl -o ~/.nvm/nvm.sh https://raw.githubusercontent.com/creationix/nvm/master/nvm.sh
fi
source ~/.nvm/nvm.sh
nvm install 10

View File

@ -6,12 +6,6 @@ set -o pipefail
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh"
# Enable ipv6 on Travis. ref: a39c8b7ce30d
if test -n "${TRAVIS_OS_NAME}" && ! test "${TRAVIS_OS_NAME}" = osx ; then
echo "before_script.sh: enable ipv6"
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0
fi
# Test some of the configuration variables.
if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then
echo "\$GCOV: '${GCOV}' is not executable."
@ -27,13 +21,6 @@ ccache -s
# Reset ccache stats for real results in before_cache.
ccache --zero-stats
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
# Adds user to a dummy group.
# That allows to test changing the group of the file by `os_fchown`.
sudo dscl . -create /Groups/chown_test
sudo dscl . -append /Groups/chown_test GroupMembership "${USER}"
fi
# Compile dependencies.
build_deps

View File

@ -77,28 +77,24 @@ if ($compiler -eq 'MINGW') {
}
elseif ($compiler -eq 'MSVC') {
$cmakeGeneratorArgs = '/verbosity:normal'
if ($bits -eq 32) {
$cmakeGenerator = 'Visual Studio 15 2017'
}
elseif ($bits -eq 64) {
$cmakeGenerator = 'Visual Studio 15 2017 Win64'
$cmakeGenerator = 'Visual Studio 16 2019'
}
if ($compiler -eq 'MSVC') {
$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($installationPath -and (test-path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x${bits} -no_logo && set" | foreach-object {
$name, $value = $_ -split '=', 2
set-content env:\"$name" $value
}
}
}
if (-not $NoTests) {
# Setup python (use AppVeyor system python)
# Disambiguate python3, if needed
if (-not (Test-Path -Path C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe) ) {
move C:\hostedtoolcache\windows\Python\3.5.4\x64\python.exe C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe
}
$env:PATH = "C:\hostedtoolcache\windows\Python\2.7.18\x64;C:\hostedtoolcache\windows\Python\3.5.4\x64;$env:PATH"
python -m ensurepip
python -m pip install pynvim ; exitIfFailed
python3 -m pip install pynvim ; exitIfFailed
# Sanity check
python -c "import pynvim; print(str(pynvim))" ; exitIfFailed
python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed
gem.cmd install --pre neovim
Get-Command -CommandType Application neovim-ruby-host.bat
@ -108,24 +104,35 @@ if (-not $NoTests) {
npm.cmd link neovim
}
if ($compiler -eq 'MSVC') {
# Required for LuaRocks (https://github.com/luarocks/luarocks/issues/1039#issuecomment-507296940).
$env:VCINSTALLDIR = "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/"
}
function convertToCmakeArgs($vars) {
return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" }
}
cd $env:DEPS_BUILD_DIR
cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
if ($compiler -eq 'MSVC') {
if ($bits -eq 32) {
cmake -G $cmakeGenerator -A Win32 $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
} else {
cmake -G $cmakeGenerator -A x64 $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
}
} else {
cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
}
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
cd $buildDir
# Build Neovim
mkdir build
cd build
cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
if ($compiler -eq 'MSVC') {
if ($bits -eq 32) {
cmake -G $cmakeGenerator -A Win32 $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
} else {
cmake -G $cmakeGenerator -A x64 $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
}
} else {
cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
}
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
.\bin\nvim --version ; exitIfFailed
@ -176,7 +183,4 @@ if (Test-Path -Path $env:ChocolateyInstall\bin\cpack.exe) {
}
# Build artifacts
cpack -G ZIP -C RelWithDebInfo
if ($env:APPVEYOR_REPO_TAG_NAME -ne $null) {
cpack -G NSIS -C RelWithDebInfo
}
cpack -C $cmakeBuildType

View File

@ -8,8 +8,6 @@ _stat() {
top_make() {
printf '%78s\n' | tr ' ' '='
# Travis has 1.5 virtual cores according to:
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
ninja "$@"
}
@ -46,7 +44,9 @@ build_deps() {
cd "${CI_BUILD_DIR}"
}
prepare_build() {
build_nvim() {
check_core_dumps --delete quiet
if test -n "${CLANG_SANITIZER}" ; then
CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON"
fi
@ -55,9 +55,8 @@ prepare_build() {
cd "${BUILD_DIR}"
echo "Configuring with '${CMAKE_FLAGS} $@'."
cmake -G Ninja ${CMAKE_FLAGS} "$@" "${CI_BUILD_DIR}"
}
build_nvim() {
echo "Building nvim."
if ! top_make nvim ; then
exit 1

View File

@ -4,7 +4,7 @@
# Args:
# $1: Flag(s) for codecov, separated by comma.
set -ex
set -e
# Change to grandparent dir (POSIXly).
CDPATH='' cd -P -- "$(dirname -- "$0")/../.." || exit
@ -18,12 +18,12 @@ if ! [ -f "$codecov_sh" ]; then
curl --retry 5 --silent --fail -o "$codecov_sh" https://codecov.io/bash
chmod +x "$codecov_sh"
python3 -m pip install --quiet --user gcovr
python -m pip install --quiet --user gcovr
fi
(
cd build
python3 -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 --exclude '.*/auto/.*' --root .. --delete -o ../coverage.xml --xml
python -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 --exclude '.*/auto/.*' --root .. --delete -o ../coverage.xml --xml
)
# Upload to codecov.

View File

@ -1,9 +1,3 @@
# HACK: get newline for use in strings given that "\n" and $'' do not work.
NL="$(printf '\nE')"
NL="${NL%E}"
FAIL_SUMMARY=""
# Test success marker. If END_MARKER file exists, we know that all tests
# finished. If FAIL_SUMMARY_FILE exists we know that some tests failed, this
# file will contain information about failed tests. Build is considered
@ -11,190 +5,27 @@ FAIL_SUMMARY=""
END_MARKER="$BUILD_DIR/.tests_finished"
FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors"
ANSI_CLEAR="\033[0K"
if test "$TRAVIS" = "true"; then
ci_fold() {
local action="$1"
local name="$2"
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
name="$(echo -n "$name" | sed 's/-$//')"
echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}"
}
elif test "$GITHUB_ACTIONS" = "true"; then
ci_fold() {
local action="$1"
local name="$2"
name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')"
name="$(echo -n "$name" | sed 's/-$//')"
case "$action" in
start)
echo "::group::${name}"
;;
end)
echo "::endgroup::"
;;
*)
:;;
esac
}
else
ci_fold() {
return 0
}
fi
enter_suite() {
set +x
FAILED=0
rm -f "${END_MARKER}"
local suite_name="$1"
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name"
ci_fold start "${NVIM_TEST_CURRENT_SUITE}"
set -x
}
exit_suite() {
set +x
if test $FAILED -ne 0 ; then
echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:"
echo "${FAIL_SUMMARY}"
else
ci_fold end "${NVIM_TEST_CURRENT_SUITE}"
fi
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}"
if test "$1" != "--continue" ; then
exit $FAILED
else
local saved_failed=$FAILED
FAILED=0
return $saved_failed
fi
}
fail() {
local test_name="$1"
local fail_char="$2"
local message="$3"
local message="$2"
: ${fail_char:=F}
: ${message:=Test $test_name failed}
local full_msg="$fail_char $NVIM_TEST_CURRENT_SUITE|$test_name :: $message"
FAIL_SUMMARY="${FAIL_SUMMARY}${NL}${full_msg}"
local full_msg="$test_name :: $message"
echo "${full_msg}" >> "${FAIL_SUMMARY_FILE}"
echo "Failed: $full_msg"
FAILED=1
}
run_test() {
local cmd="$1"
test $# -gt 0 && shift
local test_name="$1"
: ${test_name:=$cmd}
test $# -gt 0 && shift
if ! eval "$cmd" ; then
fail "${test_name}" "$@"
fi
}
run_test_wd() {
local hang_ok=
if test "$1" = "--allow-hang" ; then
hang_ok=1
shift
fi
local timeout="$1"
test $# -gt 0 && shift
local cmd="$1"
test $# -gt 0 && shift
local restart_cmd="$1"
: ${restart_cmd:=true}
test $# -gt 0 && shift
local test_name="$1"
: ${test_name:=$cmd}
test $# -gt 0 && shift
local output_file="$(mktemp)"
local status_file="$(mktemp)"
local sid_file="$(mktemp)"
local restarts=5
local prev_tmpsize=-1
while test $restarts -gt 0 ; do
: > "$status_file"
: > "$sid_file"
setsid \
env \
output_file="$output_file" \
status_file="$status_file" \
sid_file="$sid_file" \
cmd="$cmd" \
CI_DIR="$CI_DIR" \
sh -c '
. "${CI_DIR}/common/test.sh"
ps -o sid= > "$sid_file"
(
ret=0
if ! eval "$cmd" 2>&1 ; then
ret=1
fi
echo "$ret" > "$status_file"
) | tee -a "$output_file"
'
while test "$(stat -c "%s" "$status_file")" -eq 0 ; do
prev_tmpsize=$tmpsize
sleep $timeout
tmpsize="$(stat -c "%s" "$output_file")"
if test $tempsize -eq $prev_temsize ; then
# no output, assuming either hang or exit
break
fi
done
restarts=$(( restarts - 1 ))
if test "$(stat -c "%s" "$status_file")" -eq 0 ; then
# Status file not updated, assuming hang
# SID not known, this should not ever happen
if test "$(stat -c "%s" "$sid_file")" -eq 0 ; then
fail "$test_name" E "Shell did not run"
break
fi
# Kill all processes which belong to one session: should get rid of test
# processes as well as sh itself.
pkill -KILL -s$(cat "$sid_file")
if test $restarts -eq 0 ; then
if test -z "$hang_ok" ; then
fail "$test_name" E "Test hang up"
fi
else
echo "Test ${test_name} hang up, restarting"
eval "$restart_cmd"
fi
else
local new_failed="$(cat "$status_file")"
if test "$new_failed" != "0" ; then
fail "$test_name" F "Test failed in run_test_wd"
fi
break
fi
done
rm -f "$output_file"
rm -f "$status_file"
rm -f "$sid_file"
}
ended_successfully() {
if test -f "${FAIL_SUMMARY_FILE}" ; then
echo 'Test failed, complete summary:'
cat "${FAIL_SUMMARY_FILE}"
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
rm -f "$FAIL_SUMMARY_FILE"
fi
return 1
fi
if ! test -f "${END_MARKER}" ; then

View File

@ -51,7 +51,7 @@ check_core_dumps() {
fi
done
if test "$app" != quiet ; then
fail 'cores' E 'Core dumps found'
fail 'cores' 'Core dumps found'
fi
}
@ -72,7 +72,7 @@ check_logs() {
rm "${log}"
done
if test -n "${err}" ; then
fail 'logs' E 'Runtime errors detected.'
fail 'logs' 'Runtime errors detected.'
fi
}
@ -86,46 +86,39 @@ check_sanitizer() {
fi
}
run_unittests() {(
enter_suite unittests
unittests() {(
ulimit -c unlimited || true
if ! build_make unittest ; then
fail 'unittests' F 'Unit tests failed'
fail 'unittests' 'Unit tests failed'
fi
submit_coverage unittest
check_core_dumps "$(command -v luajit)"
exit_suite
)}
run_functionaltests() {(
enter_suite functionaltests
functionaltests() {(
ulimit -c unlimited || true
if ! build_make ${FUNCTIONALTEST}; then
fail 'functionaltests' F 'Functional tests failed'
fail 'functionaltests' 'Functional tests failed'
fi
submit_coverage functionaltest
check_sanitizer "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps
exit_suite
)}
run_oldtests() {(
enter_suite oldtests
oldtests() {(
ulimit -c unlimited || true
if ! make oldtest; then
reset
fail 'oldtests' F 'Legacy tests failed'
fail 'oldtests' 'Legacy tests failed'
fi
submit_coverage oldtest
check_sanitizer "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps
exit_suite
)}
check_runtime_files() {(
set +x
local test_name="$1" ; shift
local message="$1" ; shift
local tst="$1" ; shift
@ -136,27 +129,25 @@ check_runtime_files() {(
# Prefer failing the build over using more robust construct because files
# with IFS are not welcome.
if ! test -e "$file" ; then
fail "$test_name" E \
"It appears that $file is only a part of the file name"
fail "$test_name" "It appears that $file is only a part of the file name"
fi
if ! test "$tst" "$INSTALL_PREFIX/share/nvim/runtime/$file" ; then
fail "$test_name" F "$(printf "$message" "$file")"
fail "$test_name" "$(printf "$message" "$file")"
fi
done
)}
install_nvim() {(
enter_suite 'install_nvim'
if ! build_make install ; then
fail 'install' E 'make install failed'
exit_suite
fail 'install' 'make install failed'
exit 1
fi
"${INSTALL_PREFIX}/bin/nvim" --version
if ! "${INSTALL_PREFIX}/bin/nvim" -u NONE -e -c ':help' -c ':qall' ; then
echo "Running ':help' in the installed nvim failed."
echo "Maybe the helptags have not been generated properly."
fail 'help' F 'Failed running :help'
fail 'help' 'Failed running :help'
fi
# Check that all runtime files were installed
@ -177,13 +168,6 @@ install_nvim() {(
local genvimsynf=syntax/vim/generated.vim
local gpat='syn keyword vimFuncName .*eval'
if ! grep -q "$gpat" "${INSTALL_PREFIX}/share/nvim/runtime/$genvimsynf" ; then
fail 'funcnames' F "It appears that $genvimsynf does not contain $gpat."
fail 'funcnames' "It appears that $genvimsynf does not contain $gpat."
fi
exit_suite
)}
csi_clean() {
find "${BUILD_DIR}/bin" -name 'test-includes-*' -delete
find "${BUILD_DIR}" -name '*test-include*.o' -delete
}

View File

@ -3,29 +3,14 @@
set -e
set -o pipefail
if [[ "${CI_TARGET}" == lint ]]; then
python3 -m pip -q install --user --upgrade flake8
exit
fi
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
export PATH="/usr/local/opt/ccache/libexec:$PATH"
fi
# Use default CC to avoid compilation problems when installing Python modules.
echo "Install neovim module for Python 3."
CC=cc python3 -m pip -q install --user --upgrade pynvim
if python2 -m pip -c True 2>&1; then
echo "Install neovim module for Python 2."
CC=cc python2 -m pip -q install --user --upgrade pynvim
fi
echo "Install neovim module for Python."
CC=cc python -m pip -q install --user --upgrade pynvim
echo "Install neovim RubyGem."
gem install --no-document --bindir "$HOME/.local/bin" --user-install --pre neovim
echo "Install neovim npm package"
source ~/.nvm/nvm.sh
nvm use 10
npm install -g neovim
npm link neovim

View File

@ -8,29 +8,17 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/suite.sh"
enter_suite 'clint'
run_test 'make clint-full' clint
exit_suite --continue
rm -f "$END_MARKER"
enter_suite 'lualint'
run_test 'make lualint' lualint
exit_suite --continue
# Run all tests if no input argument is given
if (($# == 0)); then
tests=('clint-full' 'lualint' 'pylint' 'shlint' 'check-single-includes')
else
tests=("$@")
fi
enter_suite 'pylint'
run_test 'make pylint' pylint
exit_suite --continue
enter_suite 'shlint'
run_test 'make shlint' shlint
exit_suite --continue
enter_suite single-includes
CLICOLOR_FORCE=1 run_test_wd \
--allow-hang \
10s \
'make check-single-includes' \
'csi_clean' \
single-includes
exit_suite --continue
for i in "${tests[@]}"; do
make "$i" || fail "$i"
done
end_tests

View File

@ -8,33 +8,28 @@ source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/test.sh"
source "${CI_DIR}/common/suite.sh"
enter_suite build
rm -f "$END_MARKER"
check_core_dumps --delete quiet
# Run all tests (with some caveats) if no input argument is given
if (($# == 0)); then
tests=('build_nvim')
prepare_build
build_nvim
exit_suite --continue
source ~/.nvm/nvm.sh
nvm use 10
enter_suite tests
if test "$CLANG_SANITIZER" != "TSAN" ; then
# Additional threads are only created when the builtin UI starts, which
# doesn't happen in the unit/functional tests
if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then
run_test run_unittests
if test "$CLANG_SANITIZER" != "TSAN"; then
# Additional threads are only created when the builtin UI starts, which
# doesn't happen in the unit/functional tests
if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then
tests+=('unittests')
fi
tests+=('functionaltests')
fi
run_test run_functionaltests
tests+=('oldtests' 'install_nvim')
else
tests=("$@")
fi
run_test run_oldtests
run_test install_nvim
exit_suite --continue
for i in "${tests[@]}"; do
eval "$i" || fail "$i"
done
end_tests

View File

@ -3,14 +3,7 @@
set -e
set -o pipefail
# This will pass the environment variables down to a bash process which runs
# as $USER, while retaining the environment variables defined and belonging
# to secondary groups given above in usermod.
if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
sudo -E su "${USER}" -c "ci/run_${CI_TARGET}.sh"
else
ci/run_${CI_TARGET}.sh
fi
ci/run_${CI_TARGET}.sh
if [[ -s "${GCOV_ERROR_FILE}" ]]; then
echo '=== Unexpected gcov errors: ==='

View File

@ -8,7 +8,7 @@ WEBHOOK_PAYLOAD="$(cat "${SNAP_DIR}/.snapcraft_payload")"
PAYLOAD_SIG="${SECRET_SNAP_SIG}"
snap_realease_needed() {
snap_release_needed() {
last_committed_tag="$(git tag -l --sort=refname|head -1)"
last_snap_release="$(snap info nvim | awk '$1 == "latest/edge:" { print $2 }' | perl -lpe 's/v\d.\d.\d-//g')"
git fetch -f --tags
@ -33,7 +33,7 @@ trigger_snapcraft_webhook() {
}
if $(snap_realease_needed); then
if $(snap_release_needed); then
echo "New snap release required"
trigger_snapcraft_webhook
fi

View File

@ -46,6 +46,10 @@ if(DEFINED ENV{TEST_FILTER} AND NOT "$ENV{TEST_FILTER}" STREQUAL "")
list(APPEND BUSTED_ARGS --filter $ENV{TEST_FILTER})
endif()
if(DEFINED ENV{TEST_FILTER_OUT} AND NOT "$ENV{TEST_FILTER_OUT}" STREQUAL "")
list(APPEND BUSTED_ARGS --filter-out $ENV{TEST_FILTER_OUT})
endif()
# TMPDIR: use relative test path (for parallel test runs / isolation).
set(ENV{TMPDIR} "${BUILD_DIR}/Xtest_tmpdir/${TEST_PATH}")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory $ENV{TMPDIR})

View File

@ -45,10 +45,24 @@ check_function_exists(readlink HAVE_READLINK)
check_function_exists(setpgid HAVE_SETPGID)
check_function_exists(setsid HAVE_SETSID)
check_function_exists(sigaction HAVE_SIGACTION)
check_function_exists(strnlen HAVE_STRNLEN)
check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(strncasecmp HAVE_STRNCASECMP)
check_function_exists(strptime HAVE_STRPTIME)
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
check_c_source_compiles("
#include <termios.h>
int
main(void)
{
return forkpty(0, NULL, NULL, NULL);
}
" HAVE_FORKPTY)
else()
set(HAVE_FORKPTY 1)
endif()
# Symbols
check_symbol_exists(FD_CLOEXEC "fcntl.h" HAVE_FD_CLOEXEC)
if(HAVE_LANGINFO_H)

View File

@ -30,6 +30,7 @@
#cmakedefine HAVE_SETPGID
#cmakedefine HAVE_SETSID
#cmakedefine HAVE_SIGACTION
#cmakedefine HAVE_STRNLEN
#cmakedefine HAVE_STRCASECMP
#cmakedefine HAVE_STRINGS_H
#cmakedefine HAVE_STRNCASECMP
@ -49,6 +50,7 @@
# undef HAVE_SYS_UIO_H
# endif
#endif
#cmakedefine HAVE_FORKPTY
#cmakedefine FEAT_TUI

12
contrib/flake.lock generated
View File

@ -2,11 +2,11 @@
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1629481132,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"lastModified": 1644229661,
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
"type": "github"
},
"original": {
@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1630074300,
"narHash": "sha256-BFM7OiXRs0RvSUZd6NCGAKWVPn3VodgYQ4TUQXxbMBU=",
"lastModified": 1646254136,
"narHash": "sha256-8nQx02tTzgYO21BP/dy5BCRopE8OwE8Drsw98j+Qoaw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "21c937f8cb1e6adcfeb36dfd6c90d9d9bfab1d28",
"rev": "3e072546ea98db00c2364b81491b893673267827",
"type": "github"
},
"original": {

23
contrib/luarc.json Normal file
View File

@ -0,0 +1,23 @@
{
"runtime.version": "LuaJIT",
"diagnostics": {
"enable": true,
"globals": [
"vim",
"describe",
"it",
"before_each",
"after_each",
"setup",
"teardown"
]
},
"workspace": {
"library": {
"runtime/lua": true
},
"maxPreload": 2000,
"preloadFileSize": 1000
},
"telemetry.enable": false
}

64
packaging/CMakeLists.txt Normal file
View File

@ -0,0 +1,64 @@
set(CPACK_PACKAGE_NAME "Neovim")
set(CPACK_PACKAGE_VENDOR "neovim.io")
set(CPACK_PACKAGE_FILE_NAME "nvim")
# From the GitHub About section
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Vim-fork focused on extensibility and usability.")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
# Pull the versions defined with the top level CMakeLists.txt
set(CPACK_PACKAGE_VERSION_MAJOR ${NVIM_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${NVIM_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${NVIM_VERSION_PATCH})
# CPACK_VERBATIM_VARIABLES ensures that the variables prefixed with *CPACK_*
# are correctly passed to the cpack program.
# This should always be set to true.
set(CPACK_VERBATIM_VARIABLES TRUE)
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README ${PROJECT_SOURCE_DIR}/README.md)
if(WIN32)
set(CPACK_PACKAGE_FILE_NAME "nvim-win64")
set(CPACK_GENERATOR ZIP WIX)
# WIX
# CPACK_WIX_UPGRADE_GUID should be set, but should never change.
# CPACK_WIX_PRODUCT_GUID should not be set (leave as default to auto-generate).
# The following guid is just a randomly generated guid that's been pasted here.
# It has no special meaning other than to supply it to WIX.
set(CPACK_WIX_UPGRADE_GUID "207A1A70-7B0C-418A-A153-CA6883E38F4D")
set(CPACK_WIX_PRODUCT_ICON ${CMAKE_CURRENT_LIST_DIR}/neovim.ico)
# We use a wix patch to add further options to the installer. At present, it's just to add neovim to the path
# on installation, however, it can be extended.
# See: https://cmake.org/cmake/help/v3.7/module/CPackWIX.html#variable:CPACK_WIX_PATCH_FILE
list(APPEND CPACK_WIX_EXTENSIONS WixUtilExtension)
list(APPEND CPACK_WIX_PATCH_FILE ${CMAKE_CURRENT_LIST_DIR}/WixPatch.xml)
elseif(APPLE)
set(CPACK_PACKAGE_FILE_NAME "nvim-macos")
set(CPACK_GENERATOR TGZ)
set(CPACK_PACKAGE_ICON ${CMAKE_CURRENT_LIST_DIR}/neovim.icns)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CPACK_PACKAGE_FILE_NAME "nvim-linux64")
set(CPACK_GENERATOR TGZ DEB)
set(CPACK_DEBIAN_PACKAGE_NAME "Neovim") # required
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Neovim.io") # required
# Automatically compute required shared lib dependencies.
# Unfortunately, you "just need to know" that this has a hidden
# dependency on dpkg-shlibdeps whilst using a debian based host.
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE)
else()
set(CPACK_GENERATOR TGZ)
endif()
# CPack variables are loaded in on the call to include(CPack). If you set
# variables *after* the inclusion, they don't get updated within the CPack
# config. Note that some CPack commands should still be run after it, such
# as cpack_add_component().
include(CPack)

16
packaging/WixPatch.xml Normal file
View File

@ -0,0 +1,16 @@
<CPackWiXPatch>
<!-- Fragment ID is from: <your build dir>/_CPack_Packages/win64/WIX/files.wxs -->
<CPackWiXFragment Id="CM_CP_bin.nvim.exe">
<!-- Note: if we were to specify Value='[INSTALL_ROOT]\bin' - with a backslash, the installer will still
use a forward slash in the path. -->
<Environment
Id='UpdatePath'
Name='PATH'
Action='set'
Permanent='no'
System='yes'
Part='last'
Value='[INSTALL_ROOT]/bin'
/>
</CPackWiXFragment>
</CPackWiXPatch>

BIN
packaging/neovim.icns Normal file

Binary file not shown.

BIN
packaging/neovim.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

BIN
packaging/neovim.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

147
packaging/neovim.svg Normal file
View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:sketch="http://www.bohemiancoding.com/sketch/ns"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="256"
height="256"
viewBox="0 0 256 256"
version="1.1"
id="svg4612"
sodipodi:docname="neovim.svg"
inkscape:version="0.92.4 5da689c313, 2019-01-14">
<metadata
id="metadata4616">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>neovim-mark@2x</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1333"
id="namedview4614"
showgrid="false"
inkscape:zoom="2.1945358"
inkscape:cx="132.84232"
inkscape:cy="196.34741"
inkscape:window-x="0"
inkscape:window-y="34"
inkscape:window-maximized="1"
inkscape:current-layer="svg4612" />
<title
id="title4587">neovim-mark@2x</title>
<description>Created with Sketch (http://www.bohemiancoding.com/sketch)</description>
<defs
id="defs4604">
<linearGradient
x1="167.95833"
y1="-0.46142399"
x2="167.95833"
y2="335.45523"
id="linearGradient-1"
gradientTransform="scale(0.46142398,2.1672042)"
gradientUnits="userSpaceOnUse">
<stop
stop-color="#16B0ED"
stop-opacity="0.800235524"
offset="0%"
id="stop4589" />
<stop
stop-color="#0F59B2"
stop-opacity="0.83700023"
offset="100%"
id="stop4591" />
</linearGradient>
<linearGradient
x1="1118.3427"
y1="-0.46586797"
x2="1118.3427"
y2="338.68604"
id="linearGradient-2"
gradientTransform="scale(0.46586797,2.1465309)"
gradientUnits="userSpaceOnUse">
<stop
stop-color="#7DB643"
offset="0%"
id="stop4594" />
<stop
stop-color="#367533"
offset="100%"
id="stop4596" />
</linearGradient>
<linearGradient
x1="356.33795"
y1="0"
x2="356.33795"
y2="612.90131"
id="linearGradient-3"
gradientTransform="scale(0.84189739,1.1877932)"
gradientUnits="userSpaceOnUse">
<stop
stop-color="#88C649"
stop-opacity="0.8"
offset="0%"
id="stop4599" />
<stop
stop-color="#439240"
stop-opacity="0.84"
offset="100%"
id="stop4601" />
</linearGradient>
</defs>
<g
id="Page-1"
sketch:type="MSPage"
style="fill:none;fill-rule:evenodd;stroke:none;stroke-width:1"
transform="matrix(0.34367476,0,0,0.34367476,25.312651,1.7737533)">
<g
id="mark-copy"
sketch:type="MSLayerGroup"
transform="translate(2,3)">
<path
d="M 0,155.5704 155,-1 V 727 L 0,572.23792 Z"
id="Left---green"
sketch:type="MSShapeGroup"
inkscape:connector-curvature="0"
style="fill:url(#linearGradient-1)" />
<path
d="M 443.0604,156.9824 600,-1 596.81879,727 442,572.21994 Z"
id="Right---blue"
sketch:type="MSShapeGroup"
transform="matrix(-1,0,0,1,1042,0)"
inkscape:connector-curvature="0"
style="fill:url(#linearGradient-2)" />
<path
d="M 154.98629,0 558,615.1897 445.2246,728 42,114.17202 Z"
id="Cross---blue"
sketch:type="MSShapeGroup"
inkscape:connector-curvature="0"
style="fill:url(#linearGradient-3)" />
<path
d="M 155,283.83232 154.78675,308 31,124.71061 42.461949,113 Z"
id="Shadow"
sketch:type="MSShapeGroup"
inkscape:connector-curvature="0"
style="fill:#000000;fill-opacity:0.12999998" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
" Vim functions for file type detection
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2020 Aug 17
" Last Change: 2022 Apr 06
" These functions are moved here from runtime/filetype.vim to make startup
" faster.
@ -67,13 +67,32 @@ func dist#ft#FTasmsyntax()
endif
endfunc
" Check if one of the first five lines contains "VB_Name". In that case it is
" probably a Visual Basic file. Otherwise it's assumed to be "alt" filetype.
func dist#ft#FTVB(alt)
if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
let s:ft_visual_basic_content = '\cVB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
" See FTfrm() for Visual Basic form file detection
func dist#ft#FTbas()
if exists("g:filetype_bas")
exe "setf " . g:filetype_bas
return
endif
" most frequent FreeBASIC-specific keywords in distro files
let fb_keywords = '\c^\s*\%(extern\|var\|enum\|private\|scope\|union\|byref\|operator\|constructor\|delete\|namespace\|public\|property\|with\|destructor\|using\)\>\%(\s*[:=(]\)\@!'
let fb_preproc = '\c^\s*\%(#\a\+\|option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\)'
let fb_comment = "^\\s*/'"
" OPTION EXPLICIT, without the leading underscore, is common to many dialects
let qb64_preproc = '\c^\s*\%($\a\+\|option\s\+\%(_explicit\|_\=explicitarray\)\>\)'
let lines = getline(1, min([line("$"), 100]))
if match(lines, fb_preproc) > -1 || match(lines, fb_comment) > -1 || match(lines, fb_keywords) > -1
setf freebasic
elseif match(lines, qb64_preproc) > -1
setf qb64
elseif match(lines, s:ft_visual_basic_content) > -1
setf vb
else
exe "setf " . a:alt
setf basic
endif
endfunc
@ -93,6 +112,25 @@ func dist#ft#BindzoneCheck(default)
endif
endfunc
" Returns true if file content looks like RAPID
func IsRapid(sChkExt = "")
if a:sChkExt == "cfg"
return getline(1) =~? '\v^%(EIO|MMC|MOC|PROC|SIO|SYS):CFG'
endif
" called from FTmod, FTprg or FTsys
return getline(nextnonblank(1)) =~? '\v^\s*%(\%{3}|module\s+\k+\s*%(\(|$))'
endfunc
func dist#ft#FTcfg()
if exists("g:filetype_cfg")
exe "setf " .. g:filetype_cfg
elseif IsRapid("cfg")
setf rapid
else
setf cfg
endif
endfunc
func dist#ft#FTlpc()
if exists("g:lpc_syntax_for_c")
let lnum = 1
@ -154,7 +192,7 @@ endfunc
func dist#ft#FTent()
" This function checks for valid cl syntax in the first five lines.
" Look for either an opening comment, '#', or a block start, '{".
" Look for either an opening comment, '#', or a block start, '{'.
" If not found, assume SGML.
let lnum = 1
while lnum < 6
@ -192,6 +230,10 @@ func dist#ft#EuphoriaCheck()
endfunc
func dist#ft#DtraceCheck()
if did_filetype()
" Filetype was already detected
return
endif
let lines = getline(1, min([line("$"), 100]))
if match(lines, '^module\>\|^import\>') > -1
" D files often start with a module and/or import statement.
@ -219,6 +261,21 @@ func dist#ft#FTe()
endif
endfunc
func dist#ft#FTfrm()
if exists("g:filetype_frm")
exe "setf " . g:filetype_frm
return
endif
let lines = getline(1, min([line("$"), 5]))
if match(lines, s:ft_visual_basic_content) > -1
setf vb
else
setf form
endif
endfunc
" Distinguish between Forth and F#.
" Provided by Doug Kearns.
func dist#ft#FTfs()
@ -377,6 +434,36 @@ func dist#ft#FTmm()
setf nroff
endfunc
" Returns true if file content looks like LambdaProlog
func IsLProlog()
" skip apparent comments and blank lines, what looks like
" LambdaProlog comment may be RAPID header
let l = nextnonblank(1)
while l > 0 && l < line('$') && getline(l) =~ '^\s*%' " LambdaProlog comment
let l = nextnonblank(l + 1)
endwhile
" this pattern must not catch a go.mod file
return getline(l) =~ '\<module\s\+\w\+\s*\.\s*\(%\|$\)'
endfunc
" Determine if *.mod is ABB RAPID, LambdaProlog, Modula-2, Modsim III or go.mod
func dist#ft#FTmod()
if exists("g:filetype_mod")
exe "setf " .. g:filetype_mod
elseif IsLProlog()
setf lprolog
elseif getline(nextnonblank(1)) =~ '\%(\<MODULE\s\+\w\+\s*;\|^\s*(\*\)'
setf modula2
elseif IsRapid()
setf rapid
elseif expand("<afile>") =~ '\<go.mod$'
setf gomod
else
" Nothing recognized, assume modsim3
setf modsim3
endif
endfunc
func dist#ft#FTpl()
if exists("g:filetype_pl")
exe "setf " . g:filetype_pl
@ -493,6 +580,18 @@ func dist#ft#FTpp()
endif
endfunc
" Determine if *.prg is ABB RAPID. Can also be Clipper, FoxPro or eviews
func dist#ft#FTprg()
if exists("g:filetype_prg")
exe "setf " .. g:filetype_prg
elseif IsRapid()
setf rapid
else
" Nothing recognized, assume Clipper
setf clipper
endif
endfunc
func dist#ft#FTr()
let max = line("$") > 50 ? 50 : line("$")
@ -674,6 +773,28 @@ func dist#ft#SQL()
endif
endfunc
" This function checks the first 25 lines of file extension "sc" to resolve
" detection between scala and SuperCollider
func dist#ft#FTsc()
for lnum in range(1, min([line("$"), 25]))
if getline(lnum) =~# '[A-Za-z0-9]*\s:\s[A-Za-z0-9]\|var\s<\|classvar\s<\|\^this.*\||\w*|\|+\s\w*\s{\|\*ar\s'
setf supercollider
return
endif
endfor
setf scala
endfunc
" This function checks the first line of file extension "scd" to resolve
" detection between scdoc and SuperCollider
func dist#ft#FTscd()
if getline(1) =~# '\%^\S\+(\d[0-9A-Za-z]*)\%(\s\+\"[^"]*\"\%(\s\+\"[^"]*\"\)\=\)\=$'
setf scdoc
else
setf supercollider
endif
endfunc
" If the file has an extension of 't' and is in a directory 't' or 'xt' then
" it is almost certainly a Perl test file.
" If the first line starts with '#' and contains 'perl' it's probably a Perl
@ -692,7 +813,7 @@ func dist#ft#FTperl()
endif
let save_cursor = getpos('.')
call cursor(1,1)
let has_use = search('^use\s\s*\k', 'c', 30)
let has_use = search('^use\s\s*\k', 'c', 30) > 0
call setpos('.', save_cursor)
if has_use
setf perl
@ -701,6 +822,16 @@ func dist#ft#FTperl()
return 0
endfunc
func dist#ft#FTsys()
if exists("g:filetype_sys")
exe "setf " .. g:filetype_sys
elseif IsRapid()
setf rapid
else
setf bat
endif
endfunc
" Choose context, plaintex, or tex (LaTeX) based on these rules:
" 1. Check the first line of the file for "%&<format>".
" 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords.
@ -724,7 +855,8 @@ func dist#ft#FTtex()
let save_cursor = getpos('.')
call cursor(1,1)
let firstNC = search('^\s*[^[:space:]%]', 'c', 1000)
if firstNC " Check the next thousand lines for a LaTeX or ConTeXt keyword.
if firstNC > 0
" Check the next thousand lines for a LaTeX or ConTeXt keyword.
let lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>'
let cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>'
let kwline = search('^\s*\\\%(' . lpat . '\)\|^\s*\\\(' . cpat . '\)',
@ -811,6 +943,72 @@ func dist#ft#Redif()
endwhile
endfunc
" This function is called for all files under */debian/patches/*, make sure not
" to non-dep3patch files, such as README and other text files.
func dist#ft#Dep3patch()
if expand('%:t') ==# 'series'
return
endif
for ln in getline(1, 100)
if ln =~# '^\%(Description\|Subject\|Origin\|Bug\|Forwarded\|Author\|From\|Reviewed-by\|Acked-by\|Last-Updated\|Applied-Upstream\):'
setf dep3patch
return
elseif ln =~# '^---'
" end of headers found. stop processing
return
endif
endfor
endfunc
" This function checks the first 15 lines for appearance of 'FoamFile'
" and then 'object' in a following line.
" In that case, it's probably an OpenFOAM file
func dist#ft#FTfoam()
let ffile = 0
let lnum = 1
while lnum <= 15
if getline(lnum) =~# '^FoamFile'
let ffile = 1
elseif ffile == 1 && getline(lnum) =~# '^\s*object'
setf foam
return
endif
let lnum = lnum + 1
endwhile
endfunc
" Determine if a *.tf file is TF mud client or terraform
func dist#ft#FTtf()
let numberOfLines = line('$')
for i in range(1, numberOfLines)
let currentLine = trim(getline(i))
let firstCharacter = currentLine[0]
if firstCharacter !=? ";" && firstCharacter !=? "/" && firstCharacter !=? ""
setf terraform
return
endif
endfor
setf tf
endfunc
" Determine if a *.src file is Kuka Robot Language
func dist#ft#FTsrc()
if exists("g:filetype_src")
exe "setf " .. g:filetype_src
elseif getline(nextnonblank(1)) =~? '^\s*\%(&\w\+\|\%(global\s\+\)\?def\>\)'
setf krl
endif
endfunc
" Determine if a *.dat file is Kuka Robot Language
func dist#ft#FTdat()
if exists("g:filetype_dat")
exe "setf " .. g:filetype_dat
elseif getline(nextnonblank(1)) =~? '^\s*\%(&\w\+\|defdat\>\)'
setf krl
endif
endfunc
" Restore 'cpoptions'
let &cpo = s:cpo_save

View File

@ -0,0 +1,41 @@
" Vim filetype plugin file
" Language: FreeBASIC
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2021 Mar 16
" Dialects can be one of fb, qb, fblite, or deprecated
" Precedence is forcelang > #lang > lang
function! freebasic#GetDialect() abort
if exists("g:freebasic_forcelang")
return g:freebasic_forcelang
endif
if exists("g:freebasic_lang")
let dialect = g:freebasic_lang
else
let dialect = "fb"
endif
" override with #lang directive or metacommand
let skip = "has('syntax_items') && synIDattr(synID(line('.'), col('.'), 1), 'name') =~ 'Comment$'"
let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"'
let save_cursor = getcurpos()
call cursor(1, 1)
let lnum = search(pat, 'n', '', '', skip)
call setpos('.', save_cursor)
if lnum
let word = matchlist(getline(lnum), pat)[1]
if word =~? '\%(fb\|deprecated\|fblite\|qb\)'
let dialect = word
else
echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum)
endif
endif
return dialect
endfunction
" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:

View File

@ -1,27 +1,3 @@
function! s:enhance_syntax() abort
syntax case match
syntax keyword healthError ERROR[:]
\ containedin=markdownCodeBlock,mkdListItemLine
highlight default link healthError Error
syntax keyword healthWarning WARNING[:]
\ containedin=markdownCodeBlock,mkdListItemLine
highlight default link healthWarning WarningMsg
syntax keyword healthSuccess OK[:]
\ containedin=markdownCodeBlock,mkdListItemLine
highlight default healthSuccess guibg=#5fff00 guifg=#080808 ctermbg=82 ctermfg=232
syntax match healthHelp "|.\{-}|" contains=healthBar
\ containedin=markdownCodeBlock,mkdListItemLine
syntax match healthBar "|" contained conceal
highlight default link healthHelp Identifier
" We do not care about markdown syntax errors in :checkhealth output.
highlight! link markdownError Normal
endfunction
" Runs the specified healthchecks.
" Runs all discovered healthchecks if a:plugin_names is empty.
function! health#check(plugin_names) abort
@ -29,13 +5,9 @@ function! health#check(plugin_names) abort
\ ? s:discover_healthchecks()
\ : s:get_healthcheck(a:plugin_names)
tabnew
setlocal wrap breakindent linebreak
setlocal filetype=markdown
setlocal conceallevel=2 concealcursor=nc
setlocal keywordprg=:help
let &l:iskeyword='!-~,^*,^|,^",192-255'
call s:enhance_syntax()
" create scratch-buffer
execute 'tab sbuffer' nvim_create_buf(v:true, v:true)
setfiletype checkhealth
if empty(healthchecks)
call setline(1, 'ERROR: No healthchecks found.')
@ -49,10 +21,17 @@ function! health#check(plugin_names) abort
throw 'healthcheck_not_found'
endif
eval type == 'v' ? call(func, []) : luaeval(func)
" in the event the healthcheck doesn't return anything
" (the plugin author should avoid this possibility)
if len(s:output) == 0
throw 'healthcheck_no_return_value'
endif
catch
let s:output = [] " Clear the output
if v:exception =~# 'healthcheck_not_found'
call health#report_error('No healthcheck found for "'.name.'" plugin.')
elseif v:exception =~# 'healthcheck_no_return_value'
call health#report_error('The healthcheck report for "'.name.'" plugin is empty.')
else
call health#report_error(printf(
\ "Failed to run healthcheck for \"%s\" plugin. Exception:\n%s\n%s",
@ -70,8 +49,6 @@ function! health#check(plugin_names) abort
" needed for plasticboy/vim-markdown, because it uses fdm=expr
normal! zR
setlocal nomodified
setlocal bufhidden=hide
redraw|echo ''
endfunction
@ -157,7 +134,7 @@ endfunction " }}}
" From a path return a list [{name}, {func}, {type}] representing a healthcheck
function! s:filepath_to_healthcheck(path) abort
if a:path =~# 'vim$'
if a:path =~# 'vim$'
let name = matchstr(a:path, '\zs[^\/]*\ze\.vim$')
let func = 'health#'.name.'#check'
let type = 'v'
@ -211,7 +188,7 @@ function! s:get_healthcheck_list(plugin_names) abort
\ + nvim_get_runtime_file('lua/**/'.p.'/health/init.lua', v:true)
\ + nvim_get_runtime_file('lua/**/'.p.'/health.lua', v:true)
if len(paths) == 0
let healthchecks += [[p, '', '']] " healthchek not found
let healthchecks += [[p, '', '']] " healthcheck not found
else
let healthchecks += map(uniq(sort(paths)),
\'<SID>filepath_to_healthcheck(v:val)')

View File

@ -104,8 +104,8 @@ function! s:check_rplugin_manifest() abort
if !has_key(existing_rplugins, script)
let msg = printf('"%s" is not registered.', fnamemodify(path, ':t'))
if python_version ==# 'pythonx'
if !has('python2') && !has('python3')
let msg .= ' (python2 and python3 not available)'
if !has('python3')
let msg .= ' (python3 not available)'
endif
elseif !has(python_version)
let msg .= printf(' (%s not available)', python_version)
@ -148,14 +148,14 @@ endfunction
function! s:get_tmux_option(option) abort
let cmd = 'tmux show-option -qvg '.a:option " try global scope
let out = system(cmd)
let out = system(split(cmd))
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
if v:shell_error
call health#report_error('command failed: '.cmd."\n".out)
return 'error'
elseif empty(val)
let cmd = 'tmux show-option -qvgs '.a:option " try session scope
let out = system(cmd)
let out = system(split(cmd))
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
if v:shell_error
call health#report_error('command failed: '.cmd."\n".out)
@ -202,11 +202,11 @@ function! s:check_tmux() abort
" check default-terminal and $TERM
call health#report_info('$TERM: '.$TERM)
let cmd = 'tmux show-option -qvg default-terminal'
let out = system(cmd)
let out = system(split(cmd))
let tmux_default_term = substitute(out, '\v(\s|\r|\n)', '', 'g')
if empty(tmux_default_term)
let cmd = 'tmux show-option -qvgs default-terminal'
let out = system(cmd)
let out = system(split(cmd))
let tmux_default_term = substitute(out, '\v(\s|\r|\n)', '', 'g')
endif
@ -225,7 +225,7 @@ function! s:check_tmux() abort
endif
" check for RGB capabilities
let info = system('tmux server-info')
let info = system(['tmux', 'server-info'])
let has_tc = stridx(info, " Tc: (flag) true") != -1
let has_rgb = stridx(info, " RGB: (flag) true") != -1
if !has_tc && !has_rgb
@ -242,7 +242,7 @@ function! s:check_terminal() abort
endif
call health#report_start('terminal')
let cmd = 'infocmp -L'
let out = system(cmd)
let out = system(split(cmd))
let kbs_entry = matchstr(out, 'key_backspace=[^,[:space:]]*')
let kdch1_entry = matchstr(out, 'key_dc=[^,[:space:]]*')

View File

@ -282,10 +282,10 @@ function! s:disabled_via_loaded_var(provider) abort
return 0
endfunction
function! s:check_python(version) abort
call health#report_start('Python ' . a:version . ' provider (optional)')
function! s:check_python() abort
call health#report_start('Python 3 provider (optional)')
let pyname = 'python'.(a:version == 2 ? '' : '3')
let pyname = 'python3'
let python_exe = ''
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
let host_prog_var = pyname.'_host_prog'
@ -301,7 +301,7 @@ function! s:check_python(version) abort
call health#report_info(printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var)))
endif
let [pyname, pythonx_errors] = provider#pythonx#Detect(a:version)
let [pyname, pythonx_warnings] = provider#pythonx#Detect(3)
if empty(pyname)
call health#report_warn('No Python executable found that can `import neovim`. '
@ -311,8 +311,9 @@ function! s:check_python(version) abort
endif
" No Python executable could `import neovim`, or host_prog_var was used.
if !empty(pythonx_errors)
call health#report_error('Python provider error:', pythonx_errors)
if !empty(pythonx_warnings)
call health#report_warn(pythonx_warnings, ['See :help provider-python for more information.',
\ 'You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim'])
elseif !empty(pyname) && empty(python_exe)
if !exists('g:'.host_prog_var)
@ -405,7 +406,7 @@ function! s:check_python(version) abort
" can import 'pynvim'. If so, that Python failed to import 'neovim' as
" well, which is most probably due to a failed pip upgrade:
" https://github.com/neovim/neovim/wiki/Following-HEAD#20181118
let [pynvim_exe, errors] = provider#pythonx#DetectByModule('pynvim', a:version)
let [pynvim_exe, errors] = provider#pythonx#DetectByModule('pynvim', 3)
if !empty(pynvim_exe)
call health#report_error(
\ 'Detected pip upgrade failure: Python executable can import "pynvim" but '
@ -416,14 +417,14 @@ function! s:check_python(version) abort
\ . pynvim_exe ." -m pip install neovim # only if needed by third-party software")
endif
else
let [pyversion, current, latest, status] = s:version_info(python_exe)
let [majorpyversion, current, latest, status] = s:version_info(python_exe)
if a:version != str2nr(pyversion)
if 3 != str2nr(majorpyversion)
call health#report_warn('Unexpected Python version.' .
\ ' This could lead to confusing error messages.')
endif
call health#report_info('Python version: ' . pyversion)
call health#report_info('Python version: ' . majorpyversion)
if s:is_bad_response(status)
call health#report_info(printf('pynvim version: %s (%s)', current, status))
@ -523,7 +524,7 @@ function! s:check_virtualenv() abort
let hint = '$PATH ambiguities in subshells typically are '
\.'caused by your shell config overriding the $PATH previously set by the '
\.'virtualenv. Either prevent them from doing so, or use this workaround: '
\.'https://vi.stackexchange.com/a/7654'
\.'https://vi.stackexchange.com/a/34996'
let hints[hint] = v:true
endif
endfor
@ -565,7 +566,7 @@ function! s:check_ruby() abort
\ ['Install Ruby and verify that `ruby` and `gem` commands work.'])
return
endif
call health#report_info('Ruby: '. s:system('ruby -v'))
call health#report_info('Ruby: '. s:system(['ruby', '-v']))
let [host, err] = provider#ruby#Detect()
if empty(host)
@ -573,7 +574,8 @@ function! s:check_ruby() abort
\ ['Run `gem install neovim` to ensure the neovim RubyGem is installed.',
\ 'Run `gem environment` to ensure the gem bin directory is in $PATH.',
\ 'If you are using rvm/rbenv/chruby, try "rehashing".',
\ 'See :help g:ruby_host_prog for non-standard gem installations.'])
\ 'See :help g:ruby_host_prog for non-standard gem installations.',
\ 'You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim'])
return
endif
call health#report_info('Host: '. host)
@ -588,11 +590,11 @@ function! s:check_ruby() abort
endif
let latest_gem = get(split(latest_gem, 'neovim (\|, \|)$' ), 0, 'not found')
let current_gem_cmd = host .' --version'
let current_gem_cmd = [host, '--version']
let current_gem = s:system(current_gem_cmd)
if s:shell_error
call health#report_error('Failed to run: '. current_gem_cmd,
\ ['Report this issue with the output of: ', current_gem_cmd])
call health#report_error('Failed to run: '. join(current_gem_cmd),
\ ['Report this issue with the output of: ', join(current_gem_cmd)])
return
endif
@ -619,7 +621,7 @@ function! s:check_node() abort
\ ['Install Node.js and verify that `node` and `npm` (or `yarn`) commands work.'])
return
endif
let node_v = get(split(s:system('node -v'), "\n"), 0, '')
let node_v = get(split(s:system(['node', '-v']), "\n"), 0, '')
call health#report_info('Node.js: '. node_v)
if s:shell_error || s:version_cmp(node_v[1:], '6.0.0') < 0
call health#report_warn('Nvim node.js host does not support '.node_v)
@ -634,7 +636,8 @@ function! s:check_node() abort
if empty(host)
call health#report_warn('Missing "neovim" npm (or yarn) package.',
\ ['Run in shell: npm install -g neovim',
\ 'Run in shell (if you use yarn): yarn global add neovim'])
\ 'Run in shell (if you use yarn): yarn global add neovim',
\ 'You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim'])
return
endif
call health#report_info('Nvim node.js host: '. host)
@ -660,8 +663,8 @@ function! s:check_node() abort
let current_npm_cmd = ['node', host, '--version']
let current_npm = s:system(current_npm_cmd)
if s:shell_error
call health#report_error('Failed to run: '. string(current_npm_cmd),
\ ['Report this issue with the output of: ', string(current_npm_cmd)])
call health#report_error('Failed to run: '. join(current_npm_cmd),
\ ['Report this issue with the output of: ', join(current_npm_cmd)])
return
endif
@ -683,14 +686,15 @@ function! s:check_perl() abort
return
endif
let [perl_exec, perl_errors] = provider#perl#Detect()
let [perl_exec, perl_warnings] = provider#perl#Detect()
if empty(perl_exec)
if !empty(perl_errors)
call health#report_error('perl provider error:', perl_errors)
else
if !empty(perl_warnings)
call health#report_warn(perl_warnings, ['See :help provider-perl for more information.',
\ 'You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim'])
else
call health#report_warn('No usable perl executable found')
endif
return
return
endif
call health#report_info('perl executable: '. perl_exec)
@ -734,8 +738,8 @@ function! s:check_perl() abort
let current_cpan_cmd = [perl_exec, '-W', '-MNeovim::Ext', '-e', 'print $Neovim::Ext::VERSION']
let current_cpan = s:system(current_cpan_cmd)
if s:shell_error
call health#report_error('Failed to run: '. string(current_cpan_cmd),
\ ['Report this issue with the output of: ', string(current_cpan_cmd)])
call health#report_error('Failed to run: '. join(current_cpan_cmd),
\ ['Report this issue with the output of: ', join(current_cpan_cmd)])
return
endif
@ -751,8 +755,7 @@ endfunction
function! health#provider#check() abort
call s:check_clipboard()
call s:check_python(2)
call s:check_python(3)
call s:check_python()
call s:check_virtualenv()
call s:check_ruby()
call s:check_node()

View File

@ -7,7 +7,6 @@ let s:loaded_man = 1
let s:find_arg = '-w'
let s:localfile_arg = v:true " Always use -l if possible. #6683
let s:section_arg = '-S'
function! man#init() abort
try
@ -216,16 +215,42 @@ endfunction
function! s:get_path(sect, name) abort
" Some man implementations (OpenBSD) return all available paths from the
" search command, so we get() the first one. #8341
" search command. Previously, this function would simply select the first one.
"
" However, some searches will report matches that are incorrect:
" man -w strlen may return string.3 followed by strlen.3, and therefore
" selecting the first would get us the wrong page. Thus, we must find the
" first matching one.
"
" There's yet another special case here. Consider the following:
" If you run man -w strlen and string.3 comes up first, this is a problem. We
" should search for a matching named one in the results list.
" However, if you search for man -w clock_gettime, you will *only* get
" clock_getres.2, which is the right page. Searching the resuls for
" clock_gettime will no longer work. In this case, we should just use the
" first one that was found in the correct section.
"
" Finally, we can avoid relying on -S or -s here since they are very
" inconsistently supported. Instead, call -w with a section and a name.
if empty(a:sect)
return substitute(get(split(s:system(['man', s:find_arg, a:name])), 0, ''), '\n\+$', '', '')
let results = split(s:system(['man', s:find_arg, a:name]))
else
let results = split(s:system(['man', s:find_arg, a:sect, a:name]))
endif
" '-s' flag handles:
" - tokens like 'printf(echo)'
" - sections starting with '-'
" - 3pcap section (found on macOS)
" - commas between sections (for section priority)
return substitute(get(split(s:system(['man', s:find_arg, s:section_arg, a:sect, a:name])), 0, ''), '\n\+$', '', '')
if empty(results)
return ''
endif
" find any that match the specified name
let namematches = filter(copy(results), 'fnamemodify(v:val, ":t") =~ a:name')
let sectmatches = []
if !empty(namematches) && !empty(a:sect)
let sectmatches = filter(copy(namematches), 'fnamemodify(v:val, ":e") == a:sect')
endif
return substitute(get(sectmatches, 0, get(namematches, 0, results[0])), '\n\+$', '', '')
endfunction
" s:verify_exists attempts to find the path to a manpage
@ -243,40 +268,72 @@ endfunction
" then we don't do it again in step 2.
function! s:verify_exists(sect, name) abort
let sect = a:sect
if empty(sect)
let sect = get(b:, 'man_default_sects', '')
" no section specified, so search with b:man_default_sects
if exists('b:man_default_sects')
let sects = split(b:man_default_sects, ',')
for sec in sects
try
let res = s:get_path(sec, a:name)
if !empty(res)
return res
endif
catch /^command error (/
endtry
endfor
endif
else
" try with specified section
try
let res = s:get_path(sect, a:name)
if !empty(res)
return res
endif
catch /^command error (/
endtry
" try again with b:man_default_sects
if exists('b:man_default_sects')
let sects = split(b:man_default_sects, ',')
for sec in sects
try
let res = s:get_path(sec, a:name)
if !empty(res)
return res
endif
catch /^command error (/
endtry
endfor
endif
endif
" if none of the above worked, we will try with no section
try
return s:get_path(sect, a:name)
let res = s:get_path('', a:name)
if !empty(res)
return res
endif
catch /^command error (/
endtry
if !empty(get(b:, 'man_default_sects', '')) && sect !=# b:man_default_sects
try
return s:get_path(b:man_default_sects, a:name)
catch /^command error (/
endtry
endif
if !empty(sect)
try
return s:get_path('', a:name)
catch /^command error (/
endtry
endif
" if that still didn't work, we will check for $MANSECT and try again with it
" unset
if !empty($MANSECT)
try
let MANSECT = $MANSECT
call setenv('MANSECT', v:null)
return s:get_path('', a:name)
let res = s:get_path('', a:name)
if !empty(res)
return res
endif
catch /^command error (/
finally
call setenv('MANSECT', MANSECT)
endtry
endif
" finally, if that didn't work, there is no hope
throw 'no manual entry for ' . a:name
endfunction

View File

@ -56,6 +56,7 @@ function s:msgpack_init_python() abort
\. " time = datetime.datetime.fromtimestamp(timestamp)\n"
\. " return time.strftime(fmt)\n"
\. "def shada_dict_strptime():\n"
\. " import calendar\n"
\. " import datetime\n"
\. " import vim\n"
\. " fmt = vim.eval('a:format')\n"
@ -64,7 +65,10 @@ function s:msgpack_init_python() abort
\. " try:\n"
\. " timestamp = int(timestamp.timestamp())\n"
\. " except:\n"
\. " timestamp = int(timestamp.strftime('%s'))\n"
\. " try:\n"
\. " timestamp = int(timestamp.strftime('%s'))\n"
\. " except:\n"
\. " timestamp = calendar.timegm(timestamp.utctimetuple())\n"
\. " if timestamp > 2 ** 31:\n"
\. " tsabs = abs(timestamp)\n"
\. " return ('{\"_TYPE\": v:msgpack_types.integer,'\n"

View File

@ -1,45 +0,0 @@
" The Python provider uses a Python host to emulate an environment for running
" python-vim plugins. :help provider
"
" Associating the plugin with the Python host is the first step because plugins
" will be passed as command-line arguments
if exists('g:loaded_python_provider')
finish
endif
let [s:prog, s:err] = provider#pythonx#Detect(2)
let g:loaded_python_provider = empty(s:prog) ? 1 : 2
function! provider#python#Prog() abort
return s:prog
endfunction
function! provider#python#Error() abort
return s:err
endfunction
" The Python provider plugin will run in a separate instance of the Python
" host.
call remote#host#RegisterClone('legacy-python-provider', 'python')
call remote#host#RegisterPlugin('legacy-python-provider', 'script_host.py', [])
function! provider#python#Call(method, args) abort
if s:err != ''
return
endif
if !exists('s:host')
let s:rpcrequest = function('rpcrequest')
" Ensure that we can load the Python host before bootstrapping
try
let s:host = remote#host#Require('legacy-python-provider')
catch
let s:err = v:exception
echohl WarningMsg
echomsg v:exception
echohl None
return
endtry
endif
return call(s:rpcrequest, insert(insert(a:args, 'python_'.a:method), s:host))
endfunction

View File

@ -6,10 +6,8 @@ endif
let s:loaded_pythonx_provider = 1
function! provider#pythonx#Require(host) abort
let ver = (a:host.orig_name ==# 'python') ? 2 : 3
" Python host arguments
let prog = (ver == '2' ? provider#python#Prog() : provider#python3#Prog())
let prog = provider#python3#Prog()
let args = [prog, '-c', 'import sys; sys.path = list(filter(lambda x: x != "", sys.path)); import neovim; neovim.start_host()']
@ -23,14 +21,12 @@ function! provider#pythonx#Require(host) abort
endfunction
function! s:get_python_executable_from_host_var(major_version) abort
return expand(get(g:, 'python'.(a:major_version == 3 ? '3' : '').'_host_prog', ''), v:true)
return expand(get(g:, 'python'.(a:major_version == 3 ? '3' : execute("throw 'unsupported'")).'_host_prog', ''), v:true)
endfunction
function! s:get_python_candidates(major_version) abort
return {
\ 2: ['python2', 'python2.7', 'python2.6', 'python'],
\ 3: ['python3', 'python3.10', 'python3.9', 'python3.8', 'python3.7',
\ 'python3.6', 'python']
\ 3: ['python3', 'python3.10', 'python3.9', 'python3.8', 'python3.7', 'python']
\ }[a:major_version]
endfunction
@ -60,7 +56,7 @@ function! provider#pythonx#DetectByModule(module, major_version) abort
endfor
" No suitable Python executable found.
return ['', 'provider/pythonx: Could not load Python '.a:major_version.":\n".join(errors, "\n")]
return ['', 'Could not load Python '.a:major_version.":\n".join(errors, "\n")]
endfunction
" Returns array: [prog_exitcode, prog_version]
@ -82,7 +78,7 @@ function! provider#pythonx#CheckForModule(prog, module, major_version) abort
return [0, a:prog . ' not found in search path or not executable.']
endif
let min_version = (a:major_version == 2) ? '2.6' : '3.3'
let min_version = '3.7'
" Try to load module, and output Python version.
" Exit codes:
@ -103,7 +99,7 @@ function! provider#pythonx#CheckForModule(prog, module, major_version) abort
endif
if prog_exitcode == 2
return [0, prog_path.' does not have the "' . a:module . '" module. :help provider-python']
return [0, prog_path.' does not have the "' . a:module . '" module.']
elseif prog_exitcode == 127
" This can happen with pyenv's shims.
return [0, prog_path . ' does not exist: ' . prog_version]

View File

@ -2,7 +2,7 @@
" Maintainer: <vacancy>
" Previous Maintainer: Aaron Griffin <aaronmgriffin@gmail.com>
" Version: 0.9
" Last Updated: 2020 Oct 9
" Last Updated: 2022 Mar 30
"
" Roland Puntaier: this file contains adaptations for python3 and is parallel to pythoncomplete.vim
"
@ -91,6 +91,9 @@ endfunction
function! s:DefPython()
py3 << PYTHONEOF
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import sys, tokenize, io, types
from token import NAME, DEDENT, NEWLINE, STRING

View File

@ -240,7 +240,11 @@ function! s:GetAutocmdPrefix(name, opts)
endif
if has_key(a:opts, 'nested') && a:opts.nested
call add(rv, 'nested')
call add(rv, '++nested')
endif
if has_key(a:opts, 'once') && a:opts.once
call add(rv, '++once')
endif
return join(rv, ' ')

View File

@ -1,7 +1,7 @@
" Vim compiler file
" Compiler: Jest
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2018 May 15
" Last Change: 2021 Nov 20
if exists("current_compiler")
finish
@ -15,12 +15,14 @@ endif
let s:cpo_save = &cpo
set cpo&vim
" CompilerSet makeprg=npx\ jest\ --no-colors
" CompilerSet makeprg=npx\ --no-install\ jest\ --no-colors
CompilerSet makeprg=jest\ --no-colors
CompilerSet errorformat=%E\ \ ●\ %m,
CompilerSet errorformat=%-A\ \ ●\ Console,
\%E\ \ ●\ %m,
\%Z\ %\\{4}%.%#Error:\ %f:\ %m\ (%l:%c):%\\=,
\%Z\ %\\{6}at\ %\\S%#\ (%f:%l:%c),
\%Z\ %\\{6}at\ %\\S%#\ %f:%l:%c,
\%+C\ %\\{4}%\\w%.%#,
\%+C\ %\\{4}%[-+]%.%#,
\%-C%.%#,

View File

@ -1,7 +1,7 @@
" Vim compiler file
" Compiler: SML/NJ Compiler
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2020 Feb 10
" Last Change: 2022 Feb 09
if exists("current_compiler")
finish
@ -16,10 +16,10 @@ let s:cpo_save = &cpo
set cpo&vim
CompilerSet makeprg=sml
CompilerSet errorformat=%f:%l.%c-%\\d%\\+.%\\d%\\+\ %trror:\ %m,
CompilerSet errorformat=%f:%l.%c-%e.%k\ %trror:\ %m,
\%f:%l.%c\ %trror:\ %m,
\%trror:\ %m
\%f:%l.%c-%\\d%\\+.%\\d%\\+\ %tarning:\ %m,
\%trror:\ %m,
\%f:%l.%c-%e.%k\ %tarning:\ %m,
\%f:%l.%c\ %tarning:\ %m,
\%tarning:\ %m,
\%-G%.%#

View File

@ -45,7 +45,7 @@ start with a TCP/IP socket instead, use |--listen| with a TCP-style address: >
More endpoints can be started with |serverstart()|.
Note that localhost TCP sockets are generally less secure than named pipes,
and can lead to vunerabilities like remote code execution.
and can lead to vulnerabilities like remote code execution.
Connecting to the socket is the easiest way a programmer can test the API,
which can be done through any msgpack-rpc client library or full-featured
@ -186,7 +186,7 @@ About the `functions` map:
a type name, e.g. `nvim_buf_get_lines` is the `get_lines` method of
a Buffer instance. |dev-api|
- Global functions have the "method=false" flag and are prefixed with just
`nvim_`, e.g. `nvim_get_buffers`.
`nvim_`, e.g. `nvim_list_bufs`.
*api-mapping*
External programs (clients) can use the metadata to discover the API, using
@ -198,7 +198,7 @@ any of these approaches:
2. Start Nvim with |--api-info|. Useful for statically-compiled clients.
Example (requires Python "pyyaml" and "msgpack-python" modules): >
nvim --api-info | python -c 'import msgpack, sys, yaml; print yaml.dump(msgpack.unpackb(sys.stdin.read()))'
nvim --api-info | python -c 'import msgpack, sys, yaml; yaml.dump(msgpack.unpackb(sys.stdin.buffer.read()), sys.stdout)'
<
3. Use the |api_info()| Vimscript function. >
:lua print(vim.inspect(vim.fn.api_info()))
@ -361,7 +361,7 @@ UTF-32 and UTF-16 sizes of the deleted region is also passed as additional
arguments {old_utf32_size} and {old_utf16_size}.
"on_changedtick" is invoked when |b:changedtick| was incremented but no text
was changed. The parameters recieved are ("changedtick", {buf}, {changedtick}).
was changed. The parameters received are ("changedtick", {buf}, {changedtick}).
*api-lua-detach*
In-process Lua callbacks can detach by returning `true`. This will detach all
@ -452,7 +452,7 @@ Extended marks (extmarks) represent buffer annotations that track text changes
in the buffer. They can represent cursors, folds, misspelled words, anything
that needs to track a logical location in the buffer over time. |api-indexing|
Extmark position works like "bar" cursor: it exists between characters. Thus
Extmark position works like "bar" cursor: it exists between characters. Thus,
the maximum extmark index on a line is 1 more than the character index: >
f o o b a r line contents
@ -468,7 +468,7 @@ extmark position and enter some text, the extmark migrates forward. >
f o o z|b a r line (| = cursor)
4 extmark (after typing "z")
If an extmark is on the last index of a line and you inputsa newline at that
If an extmark is on the last index of a line and you input a newline at that
point, the extmark will accordingly migrate to the next line: >
f o o z b a r| line (| = cursor)
@ -594,7 +594,8 @@ nvim__id_float({flt}) *nvim__id_float()*
its argument.
nvim__inspect_cell({grid}, {row}, {col}) *nvim__inspect_cell()*
TODO: Documentation
NB: if your UI doesn't use hlstate, this will not return
hlstate first time.
nvim__runtime_inspect() *nvim__runtime_inspect()*
TODO: Documentation
@ -634,7 +635,7 @@ nvim_call_atomic({calls}) *nvim_call_atomic()*
atomically, i.e. without interleaving redraws, RPC requests
from other clients, or user interactions (however API
methods may trigger autocommands or event processing which
have such side-effects, e.g. |:sleep| may wake timers).
have such side effects, e.g. |:sleep| may wake timers).
2. To minimize RPC overhead (roundtrips) of a sequence of many
requests.
@ -653,11 +654,11 @@ nvim_call_atomic({calls}) *nvim_call_atomic()*
be returned.
nvim_chan_send({chan}, {data}) *nvim_chan_send()*
Send data to channel `id` . For a job, it writes it to the
Send data to channel `id`. For a job, it writes it to the
stdin of the process. For the stdio channel |channel-stdio|,
it writes to Nvim's stdout. For an internal terminal instance
(|nvim_open_term()|) it writes directly to terimal output. See
|channel-bytes| for more information.
(|nvim_open_term()|) it writes directly to terminal output.
See |channel-bytes| for more information.
This function writes raw data, not RPC messages. If the
channel was created with `rpc=true` then the channel expects
@ -683,6 +684,62 @@ nvim_create_buf({listed}, {scratch}) *nvim_create_buf()*
See also: ~
buf_open_scratch
*nvim_create_user_command()*
nvim_create_user_command({name}, {command}, {*opts})
Create a new user command |user-commands|
{name} is the name of the new command. The name must begin
with an uppercase letter.
{command} is the replacement text or Lua function to execute.
Example: >
:call nvim_create_user_command('SayHello', 'echo "Hello world!"', {})
:SayHello
Hello world!
<
Parameters: ~
{name} Name of the new user command. Must begin with
an uppercase letter.
{command} Replacement command to execute when this user
command is executed. When called from Lua, the
command can also be a Lua function. The
function is called with a single table argument
that contains the following keys:
• args: (string) The args passed to the
command, if any |<args>|
• fargs: (table) The args split by unescaped
whitespace (when more than one argument is
allowed), if any |<f-args>|
• bang: (boolean) "true" if the command was
executed with a ! modifier |<bang>|
• line1: (number) The starting line of the
command range |<line1>|
• line2: (number) The final line of the command
range |<line2>|
• range: (number) The number of items in the
command range: 0, 1, or 2 |<range>|
• count: (number) Any count supplied |<count>|
• reg: (string) The optional register, if
specified |<reg>|
• mods: (string) Command modifiers, if any
|<mods>|
{opts} Optional command attributes. See
|command-attributes| for more details. To use
boolean attributes (such as |:command-bang| or
|:command-bar|) set the value to "true". In
addition to the string options listed in
|:command-complete|, the "complete" key also
accepts a Lua function which works like the
"customlist" completion mode
|:command-completion-customlist|. Additional
parameters:
• desc: (string) Used for listing the command
when a Lua function is used for {command}.
• force: (boolean, default true) Override any
previous definition.
nvim_del_current_line() *nvim_del_current_line()*
Deletes the current line.
@ -698,7 +755,7 @@ nvim_del_keymap({mode}, {lhs}) *nvim_del_keymap()*
|nvim_set_keymap()|
nvim_del_mark({name}) *nvim_del_mark()*
Deletes a uppercase/file named mark. See |mark-motions|.
Deletes an uppercase/file named mark. See |mark-motions|.
Note:
fails with error if a lowercase or buffer local named mark
@ -714,6 +771,12 @@ nvim_del_mark({name}) *nvim_del_mark()*
|nvim_buf_del_mark()|
|nvim_get_mark()|
nvim_del_user_command({name}) *nvim_del_user_command()*
Delete a user-defined command.
Parameters: ~
{name} Name of the command to delete.
nvim_del_var({name}) *nvim_del_var()*
Removes a global (g:) variable.
@ -763,6 +826,7 @@ nvim_eval_statusline({str}, {*opts}) *nvim_eval_statusline()*
• maxwidth: (number) Maximum width of statusline.
• fillchar: (string) Character to fill blank
spaces in the statusline (see 'fillchars').
Treated as single-width even if it isn't.
• highlights: (boolean) Return highlight
information.
• use_tabline: (boolean) Evaluate tabline instead
@ -787,7 +851,7 @@ nvim_exec_lua({code}, {args}) *nvim_exec_lua()*
inside the chunk. The chunk can return a value.
Only statements are executed. To evaluate an expression,
prefix it with `return` : return my_function(...)
prefix it with `return`: return my_function(...)
Parameters: ~
{code} Lua code to execute
@ -796,7 +860,7 @@ nvim_exec_lua({code}, {args}) *nvim_exec_lua()*
Return: ~
Return value of Lua code if present or NIL.
nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()*
nvim_feedkeys({keys}, {mode}, {escape_ks}) *nvim_feedkeys()*
Sends input-keys to Nvim, subject to various quirks controlled
by `mode` flags. This is a blocking call, unlike
|nvim_input()|.
@ -804,23 +868,25 @@ nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()*
On execution error: does not fail, but updates v:errmsg.
To input sequences like <C-o> use |nvim_replace_termcodes()|
(typically with escape_csi=true) to replace |keycodes|, then
(typically with escape_ks=false) to replace |keycodes|, then
pass the result to nvim_feedkeys().
Example: >
:let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
:call nvim_feedkeys(key, 'n', v:true)
:call nvim_feedkeys(key, 'n', v:false)
<
Parameters: ~
{keys} to be typed
{mode} behavior flags, see |feedkeys()|
{escape_csi} If true, escape K_SPECIAL/CSI bytes in
`keys`
{keys} to be typed
{mode} behavior flags, see |feedkeys()|
{escape_ks} If true, escape K_SPECIAL bytes in `keys`
This should be false if you already used
|nvim_replace_termcodes()|, and true
otherwise.
See also: ~
feedkeys()
vim_strsave_escape_csi
vim_strsave_escape_ks
nvim_get_all_options_info() *nvim_get_all_options_info()*
Gets the option information for all options.
@ -1018,7 +1084,7 @@ nvim_get_mode() *nvim_get_mode()*
{fast}
nvim_get_option({name}) *nvim_get_option()*
Gets an option value string.
Gets the global value of an option.
Parameters: ~
{name} Option name
@ -1049,14 +1115,32 @@ nvim_get_option_info({name}) *nvim_get_option_info()*
Return: ~
Option Information
nvim_get_option_value({name}, {*opts}) *nvim_get_option_value()*
Gets the value of an option. The behavior of this function
matches that of |:set|: the local value of an option is
returned if it exists; otherwise, the global value is
returned. Local values always correspond to the current buffer
or window. To get a buffer-local or window-local option for a
specific buffer or window, use |nvim_buf_get_option()| or
|nvim_win_get_option()|.
Parameters: ~
{name} Option name
{opts} Optional parameters
• scope: One of 'global' or 'local'. Analogous to
|:setglobal| and |:setlocal|, respectively.
Return: ~
Option value
nvim_get_proc({pid}) *nvim_get_proc()*
Gets info describing process `pid` .
Gets info describing process `pid`.
Return: ~
Map of process properties, or NIL if process not found.
nvim_get_proc_children({pid}) *nvim_get_proc_children()*
Gets the immediate children of process `pid` .
Gets the immediate children of process `pid`.
Return: ~
Array of child process ids, empty if process not found.
@ -1165,8 +1249,8 @@ nvim_input_mouse({button}, {action}, {modifier}, {grid}, {row}, {col})
nvim_list_bufs() *nvim_list_bufs()*
Gets the current list of buffer handles
Includes unlisted (unloaded/deleted) buffers, like `:ls!` .
Use |nvim_buf_is_loaded()| to check if a buffer is loaded.
Includes unlisted (unloaded/deleted) buffers, like `:ls!`. Use
|nvim_buf_is_loaded()| to check if a buffer is loaded.
Return: ~
List of buffer handles
@ -1275,7 +1359,7 @@ nvim_paste({data}, {crlf}, {phase}) *nvim_paste()*
Errors ('nomodifiable', `vim.paste()` failure, …) are
reflected in `err` but do not affect the return value (which
is strictly decided by `vim.paste()` ). On error, subsequent
is strictly decided by `vim.paste()`). On error, subsequent
calls are ignored ("drained") until the next paste is
initiated (phase 1 or -1).
@ -1328,7 +1412,7 @@ nvim_replace_termcodes({str}, {from_part}, {do_lt}, {special})
{from_part} Legacy Vim parameter. Usually true.
{do_lt} Also translate <lt>. Ignored if `special` is
false.
{special} Replace |keycodes|, e.g. <CR> becomes a "\n"
{special} Replace |keycodes|, e.g. <CR> becomes a "\r"
char.
See also: ~
@ -1352,7 +1436,7 @@ nvim_select_popupmenu_item({item}, {insert}, {finish}, {opts})
{insert} Whether the selection should be inserted in the
buffer.
{finish} Finish the completion and dismiss the popupmenu.
Implies `insert` .
Implies `insert`.
{opts} Optional parameters. Reserved for future use.
*nvim_set_client_info()*
@ -1461,25 +1545,30 @@ nvim_set_current_win({window}) *nvim_set_current_win()*
Parameters: ~
{window} Window handle
nvim_set_hl({ns_id}, {name}, {val}) *nvim_set_hl()*
Set a highlight group.
nvim_set_hl({ns_id}, {name}, {*val}) *nvim_set_hl()*
Sets a highlight group.
TODO: ns_id = 0, should modify :highlight namespace TODO val
should take update vs reset flag
Note: Unlike the `:highlight` command which can update a
highlight group, this function completely replaces the
definition. For example: `nvim_set_hl(0, 'Visual', {})` will
clear the highlight group 'Visual'.
Parameters: ~
{ns_id} number of namespace for this highlight
{name} highlight group name, like ErrorMsg
{val} highlight definition map, like
|nvim_get_hl_by_name|. in addition the following
keys are also recognized: `default` : don't
override existing definition, like `hi default`
`ctermfg` : sets foreground of cterm color
`ctermbg` : sets background of cterm color
`cterm` : cterm attribute map. sets attributed
for cterm colors. similer to `hi cterm` Note: by
default cterm attributes are same as attributes
of gui color
{ns_id} Namespace id for this highlight
|nvim_create_namespace()|. Use 0 to set a
highlight group globally |:highlight|.
{name} Highlight group name, e.g. "ErrorMsg"
{val} Highlight definition map, like |synIDattr()|. In
addition, the following keys are recognized:
• default: Don't override existing definition
|:hi-default|
ctermfg: Sets foreground of cterm color
|highlight-ctermfg|
• ctermbg: Sets background of cterm color
|highlight-ctermbg|
• cterm: cterm attribute map, like
|highlight-args|. Note: Attributes default to
those set for `gui` if not set.
nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
Sets a global |mapping| for the given mode.
@ -1506,16 +1595,33 @@ nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()*
{rhs} Right-hand-side |{rhs}| of the mapping.
{opts} Optional parameters map. Accepts all
|:map-arguments| as keys excluding |<buffer>| but
including |noremap|. Values are Booleans. Unknown
key is an error.
including |noremap| and "desc". "desc" can be used
to give a description to keymap. When called from
Lua, also accepts a "callback" key that takes a
Lua function to call when the mapping is executed.
Values are Booleans. Unknown key is an error.
nvim_set_option({name}, {value}) *nvim_set_option()*
Sets an option value.
Sets the global value of an option.
Parameters: ~
{name} Option name
{value} New option value
*nvim_set_option_value()*
nvim_set_option_value({name}, {value}, {*opts})
Sets the value of an option. The behavior of this function
matches that of |:set|: for global-local options, both the
global and local value are set unless otherwise specified with
{scope}.
Parameters: ~
{name} Option name
{value} New option value
{opts} Optional parameters
• scope: One of 'global' or 'local'. Analogous to
|:setglobal| and |:setlocal|, respectively.
nvim_set_var({name}, {value}) *nvim_set_var()*
Sets a global (g:) variable.
@ -1531,7 +1637,7 @@ nvim_set_vvar({name}, {value}) *nvim_set_vvar()*
{value} Variable value
nvim_strwidth({text}) *nvim_strwidth()*
Calculates the number of display cells occupied by `text` .
Calculates the number of display cells occupied by `text`.
<Tab> counts as one cell.
Parameters: ~
@ -1773,9 +1879,10 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
{buffer} Buffer handle, or 0 for current buffer
{send_buffer} True if the initial notification should
contain the whole buffer: first
notification will be `nvim_buf_lines_event`
. Else the first notification will be
`nvim_buf_changedtick_event` . Not for Lua
notification will be
`nvim_buf_lines_event`. Else the first
notification will be
`nvim_buf_changedtick_event`. Not for Lua
callbacks.
{opts} Optional parameters.
• on_lines: Lua callback invoked on change.
@ -1826,12 +1933,12 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
• on_reload: Lua callback invoked on
reload. The entire buffer content should
be considered changed. Args:
• the string "detach"
• the string "reload"
• buffer handle
• utf_sizes: include UTF-32 and UTF-16 size
of the replaced region, as args to
`on_lines` .
`on_lines`.
• preview: also attach to command preview
(i.e. 'inccommand') events.
@ -1866,6 +1973,16 @@ nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
Return value of function. NB: will deepcopy lua values
currently, use upvalues to send lua references in and out.
*nvim_buf_create_user_command()*
nvim_buf_create_user_command({buffer}, {name}, {command}, {*opts})
Create a new user command |user-commands| in the given buffer.
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer.
See also: ~
nvim_create_user_command
nvim_buf_del_keymap({buffer}, {mode}, {lhs}) *nvim_buf_del_keymap()*
Unmaps a buffer-local |mapping| for the given mode.
@ -1893,6 +2010,18 @@ nvim_buf_del_mark({buffer}, {name}) *nvim_buf_del_mark()*
|nvim_buf_set_mark()|
|nvim_del_mark()|
*nvim_buf_del_user_command()*
nvim_buf_del_user_command({buffer}, {name})
Delete a buffer-local user-defined command.
Only commands created with |:command-buffer| or
|nvim_buf_create_user_command()| can be deleted with this
function.
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer.
{name} Name of the command to delete.
nvim_buf_del_var({buffer}, {name}) *nvim_buf_del_var()*
Removes a buffer-scoped (b:) variable
@ -2035,6 +2164,29 @@ nvim_buf_get_option({buffer}, {name}) *nvim_buf_get_option()*
Return: ~
Option value
*nvim_buf_get_text()*
nvim_buf_get_text({buffer}, {start_row}, {start_col}, {end_row}, {end_col},
{opts})
Gets a range from the buffer.
This differs from |nvim_buf_get_lines()| in that it allows
retrieving only portions of a line.
Indexing is zero-based. Column indices are end-exclusive.
Prefer |nvim_buf_get_lines()| when retrieving entire lines.
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
{start_row} First line index
{start_col} Starting byte offset of first line
{end_row} Last line index
{end_col} Ending byte offset of last line (exclusive)
{opts} Optional parameters. Currently unused.
Return: ~
Array of lines, or empty array for unloaded buffer.
nvim_buf_get_var({buffer}, {name}) *nvim_buf_get_var()*
Gets a buffer-scoped (b:) variable.
@ -2069,7 +2221,7 @@ nvim_buf_is_valid({buffer}) *nvim_buf_is_valid()*
true if the buffer is valid, false otherwise.
nvim_buf_line_count({buffer}) *nvim_buf_line_count()*
Gets the buffer line count
Returns the number of lines in the given buffer.
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
@ -2211,7 +2363,7 @@ nvim_buf_add_highlight({buffer}, {ns_id}, {hl_group}, {line}, {col_start},
namespace. All highlights in the same namespace can then be
cleared with single call to |nvim_buf_clear_namespace()|. If
the highlight never will be deleted by an API call, pass
`ns_id = -1` .
`ns_id = -1`.
As a shorthand, `ns_id = 0` can be used to create a new
namespace for the highlight, the allocated id is then
@ -2291,8 +2443,8 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
nvim_buf_get_extmarks(0, my_ns, [0,0], [-1,-1], {})
<
If `end` is less than `start` , traversal works backwards.
(Useful with `limit` , to get the first marks prior to a given
If `end` is less than `start`, traversal works backwards.
(Useful with `limit`, to get the first marks prior to a given
position.)
Example:
@ -2301,9 +2453,9 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
local pos = a.nvim_win_get_cursor(0)
local ns = a.nvim_create_namespace('my-plugin')
-- Create new extmark at line 1, column 1.
local m1 = a.nvim_buf_set_extmark(0, ns, 0, 0, 0, {})
local m1 = a.nvim_buf_set_extmark(0, ns, 0, 0, {})
-- Create new extmark at line 3, column 1.
local m2 = a.nvim_buf_set_extmark(0, ns, 0, 2, 0, {})
local m2 = a.nvim_buf_set_extmark(0, ns, 0, 2, {})
-- Get extmarks only from line 3.
local ms = a.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
-- Get all marks in this buffer + namespace.
@ -2353,7 +2505,7 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
|api-indexing|
{opts} Optional parameters.
• id : id of the extmark to edit.
• end_line : ending line of the mark, 0-based
• end_row : ending line of the mark, 0-based
inclusive.
• end_col : ending col of the mark, 0-based
exclusive.
@ -2432,6 +2584,39 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts})
• priority: a priority value for the highlight
group. For example treesitter highlighting
uses a value of 100.
• strict: boolean that indicates extmark should
not be placed if the line or column value is
past the end of the buffer or end of the line
respectively. Defaults to true.
• sign_text: string of length 1-2 used to
display in the sign column. Note: ranges are
unsupported and decorations are only applied
to start_row
• sign_hl_group: name of the highlight group
used to highlight the sign column text. Note:
ranges are unsupported and decorations are
only applied to start_row
• number_hl_group: name of the highlight group
used to highlight the number column. Note:
ranges are unsupported and decorations are
only applied to start_row
• line_hl_group: name of the highlight group
used to highlight the whole line. Note: ranges
are unsupported and decorations are only
applied to start_row
• cursorline_hl_group: name of the highlight
group used to highlight the line when the
cursor is on the same line as the mark and
'cursorline' is enabled. Note: ranges are
unsupported and decorations are only applied
to start_row
• conceal: string which should be either empty
or a single character. Enable concealing
similar to |:syn-conceal|. When a character is
supplied it is used as |:syn-cchar|.
"hl_group" is used as highlight for the cchar
if provided, otherwise it defaults to
|hl-Conceal|.
Return: ~
Id of the created/updated extmark
@ -2635,7 +2820,7 @@ nvim_win_hide({window}) *nvim_win_hide()*
|:hide| with a |window-ID|).
Like |:hide| the buffer becomes hidden unless another window
is editing it, or 'bufhidden' is `unload` , `delete` or `wipe`
is editing it, or 'bufhidden' is `unload`, `delete` or `wipe`
as opposed to |:close| or |nvim_win_close|, which will close
the buffer.
@ -2655,7 +2840,7 @@ nvim_win_is_valid({window}) *nvim_win_is_valid()*
true if the window is valid, false otherwise
nvim_win_set_buf({window}, {buffer}) *nvim_win_set_buf()*
Sets the current buffer in a window, without side-effects
Sets the current buffer in a window, without side effects
Attributes: ~
not allowed when |textlock| is active
@ -2666,15 +2851,15 @@ nvim_win_set_buf({window}, {buffer}) *nvim_win_set_buf()*
nvim_win_set_cursor({window}, {pos}) *nvim_win_set_cursor()*
Sets the (1,0)-indexed cursor position in the window.
|api-indexing|
|api-indexing| This scrolls the window even if it is not the
current one.
Parameters: ~
{window} Window handle, or 0 for current window
{pos} (row, col) tuple representing the new position
nvim_win_set_height({window}, {height}) *nvim_win_set_height()*
Sets the window height. This will only succeed if the screen
is split horizontally.
Sets the window height.
Parameters: ~
{window} Window handle, or 0 for current window
@ -2851,9 +3036,10 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
">", "", "", "", "<" ] will only make
vertical borders but not horizontal ones. By
default, `FloatBorder` highlight is used,
which links to `VertSplit` when not defined.
It could also be specified by character: [
{"+", "MyCorner"}, {"x", "MyBorder"} ].
which links to `WinSeparator` when not
defined. It could also be specified by
character: [ {"+", "MyCorner"}, {"x",
"MyBorder"} ].
• noautocmd: If true then no buffer-related
autocommand events such as |BufEnter|,
@ -2883,7 +3069,7 @@ nvim_win_set_config({window}, {*config}) *nvim_win_set_config()*
layouts).
When reconfiguring a floating window, absent option keys will
not be changed. `row` / `col` and `relative` must be
not be changed. `row`/`col` and `relative` must be
reconfigured together.
Parameters: ~
@ -2961,6 +3147,256 @@ nvim_tabpage_set_var({tabpage}, {name}, {value})
{value} Variable value
==============================================================================
Autocmd Functions *api-autocmd*
nvim_clear_autocmds({*opts}) *nvim_clear_autocmds()*
Clear all autocommands that match the corresponding {opts}. To
delete a particular autocmd, see |nvim_del_autocmd|.
Parameters: ~
{opts} Parameters
• event: (string|table) Examples:
• event: "pat1"
• event: { "pat1" }
• event: { "pat1", "pat2", "pat3" }
• pattern: (string|table)
• pattern or patterns to match exactly.
• For example, if you have `*.py` as that
pattern for the autocmd, you must pass
`*.py` exactly to clear it. `test.py` will
not match the pattern.
• defaults to clearing all patterns.
• NOTE: Cannot be used with {buffer}
• buffer: (bufnr)
• clear only |autocmd-buflocal| autocommands.
• NOTE: Cannot be used with {pattern}
• group: (string|int) The augroup name or id.
• NOTE: If not passed, will only delete autocmds not in any group.
nvim_create_augroup({name}, {*opts}) *nvim_create_augroup()*
Create or get an autocommand group |autocmd-groups|.
To get an existing group id, do: >
local id = vim.api.nvim_create_augroup("MyGroup", {
clear = false
})
<
Parameters: ~
{name} String: The name of the group
{opts} Dictionary Parameters
• clear (bool) optional: defaults to true. Clear
existing commands if the group already exists
|autocmd-groups|.
Return: ~
Integer id of the created group.
See also: ~
|autocmd-groups|
nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()*
Create an |autocommand|
The API allows for two (mutually exclusive) types of actions
to be executed when the autocommand triggers: a callback
function (Lua or Vimscript), or a command (like regular
autocommands).
Example using callback: >
-- Lua function
local myluafun = function() print("This buffer enters") end
-- Vimscript function name (as a string)
local myvimfun = "g:MyVimFunction"
vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
pattern = {"*.c", "*.h"},
callback = myluafun, -- Or myvimfun
})
<
Example using command: >
vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
pattern = {"*.c", "*.h"},
command = "echo 'Entering a C or C++ file'",
})
<
Example values for pattern: >
pattern = "*.py"
pattern = { "*.py", "*.pyi" }
<
Example values for event: >
"BufWritePre"
{"CursorHold", "BufWritePre", "BufWritePost"}
<
Parameters: ~
{event} (string|array) The event or events to register
this autocommand
{opts} Dictionary of autocommand options:
• group (string|integer) optional: the
autocommand group name or id to match against.
• pattern (string|array) optional: pattern or
patterns to match against |autocmd-pattern|.
• buffer (integer) optional: buffer number for
buffer local autocommands |autocmd-buflocal|.
Cannot be used with {pattern}.
• desc (string) optional: description of the
autocommand.
• callback (function|string) optional: if a
string, the name of a Vimscript function to
call when this autocommand is triggered.
Otherwise, a Lua function which is called when
this autocommand is triggered. Cannot be used
with {command}. Lua callbacks can return true
to delete the autocommand; in addition, they
accept a single table argument with the
following keys:
• id: (number) the autocommand id
• event: (string) the name of the event that
triggered the autocommand |autocmd-events|
• group: (number|nil) the autocommand group id,
if it exists
• match: (string) the expanded value of
|<amatch>|
• buf: (number) the expanded value of |<abuf>|
• file: (string) the expanded value of
|<afile>|
• command (string) optional: Vim command to
execute on event. Cannot be used with
{callback}
• once (boolean) optional: defaults to false. Run
the autocommand only once |autocmd-once|.
• nested (boolean) optional: defaults to false.
Run nested autocommands |autocmd-nested|.
Return: ~
Integer id of the created autocommand.
See also: ~
|autocommand|
|nvim_del_autocmd()|
nvim_del_augroup_by_id({id}) *nvim_del_augroup_by_id()*
Delete an autocommand group by id.
To get a group id one can use |nvim_get_autocmds()|.
NOTE: behavior differs from |augroup-delete|. When deleting a
group, autocommands contained in this group will also be
deleted and cleared. This group will no longer exist.
Parameters: ~
{id} Integer The id of the group.
See also: ~
|nvim_del_augroup_by_name()|
|nvim_create_augroup()|
nvim_del_augroup_by_name({name}) *nvim_del_augroup_by_name()*
Delete an autocommand group by name.
NOTE: behavior differs from |augroup-delete|. When deleting a
group, autocommands contained in this group will also be
deleted and cleared. This group will no longer exist.
Parameters: ~
{name} String The name of the group.
See also: ~
|autocommand-groups|
nvim_del_autocmd({id}) *nvim_del_autocmd()*
Delete an autocommand by id.
NOTE: Only autocommands created via the API have an id.
Parameters: ~
{id} Integer The id returned by nvim_create_autocmd
See also: ~
|nvim_create_autocmd()|
nvim_exec_autocmds({event}, {*opts}) *nvim_exec_autocmds()*
Execute all autocommands for {event} that match the
corresponding {opts} |autocmd-execute|.
Parameters: ~
{event} (String|Array) The event or events to execute
{opts} Dictionary of autocommand options:
• group (string|integer) optional: the
autocommand group name or id to match against.
|autocmd-groups|.
• pattern (string|array) optional: defaults to
"*" |autocmd-pattern|. Cannot be used with
{buffer}.
• buffer (integer) optional: buffer number
|autocmd-buflocal|. Cannot be used with
{pattern}.
• modeline (bool) optional: defaults to true.
Process the modeline after the autocommands
|<nomodeline>|.
See also: ~
|:doautocmd|
nvim_get_autocmds({*opts}) *nvim_get_autocmds()*
Get all autocommands that match the corresponding {opts}.
These examples will get autocommands matching ALL the given
criteria: >
-- Matches all criteria
autocommands = vim.api.nvim_get_autocmds({
group = "MyGroup",
event = {"BufEnter", "BufWinEnter"},
pattern = {"*.c", "*.h"}
})
-- All commands from one group
autocommands = vim.api.nvim_get_autocmds({
group = "MyGroup",
})
<
NOTE: When multiple patterns or events are provided, it will
find all the autocommands that match any combination of them.
Parameters: ~
{opts} Dictionary with at least one of the following:
• group (string|integer): the autocommand group
name or id to match against.
• event (string|array): event or events to match
against |autocmd-events|.
• pattern (string|array): pattern or patterns to
match against |autocmd-pattern|.
Return: ~
Array of autocommands matching the criteria, with each
item containing the following fields:
• id (number): the autocommand id (only when defined with
the API).
• group (integer): the autocommand group id.
• desc (string): the autocommand description.
• event (string): the autocommand event.
• command (string): the autocommand command.
• once (boolean): whether the autocommand is only run
once.
• pattern (string): the autocommand pattern. If the
autocommand is buffer local |autocmd-buffer-local|:
• buflocal (boolean): true if the autocommand is buffer
local.
• buffer (number): the buffer number.
==============================================================================
UI Functions *api-ui*

View File

@ -175,7 +175,7 @@ o Enable Arabic settings [short-cut]
vertical separator like "l" or "𝖨" may be used. It may also be
hidden by changing its color to the foreground color: >
:set fillchars=vert:l
:hi VertSplit ctermbg=White
:hi WinSeparator ctermbg=White
< Note that this is a workaround, not a proper solution.
If, on the other hand, you'd like to be verbose and explicit and

View File

@ -40,10 +40,10 @@ effects. Be careful not to destroy your text.
2. Defining autocommands *autocmd-define*
*:au* *:autocmd*
:au[tocmd] [group] {event} {pat} [++once] [++nested] {cmd}
:au[tocmd] [group] {event} {aupat} [++once] [++nested] {cmd}
Add {cmd} to the list of commands that Vim will
execute automatically on {event} for a file matching
{pat} |autocmd-pattern|.
{aupat} |autocmd-pattern|.
Note: A quote character is seen as argument to the
:autocmd and won't start a comment.
Nvim always adds {cmd} after existing autocommands so
@ -119,19 +119,19 @@ prompt. When one command outputs two messages this can happen anyway.
==============================================================================
3. Removing autocommands *autocmd-remove*
:au[tocmd]! [group] {event} {pat} [++once] [++nested] {cmd}
:au[tocmd]! [group] {event} {aupat} [++once] [++nested] {cmd}
Remove all autocommands associated with {event} and
{pat}, and add the command {cmd}.
{aupat}, and add the command {cmd}.
See |autocmd-once| for [++once].
See |autocmd-nested| for [++nested].
:au[tocmd]! [group] {event} {pat}
:au[tocmd]! [group] {event} {aupat}
Remove all autocommands associated with {event} and
{pat}.
{aupat}.
:au[tocmd]! [group] * {pat}
Remove all autocommands associated with {pat} for all
events.
:au[tocmd]! [group] * {aupat}
Remove all autocommands associated with {aupat} for
all events.
:au[tocmd]! [group] {event}
Remove ALL autocommands for {event}.
@ -151,12 +151,12 @@ with ":augroup"); otherwise, Vim uses the group defined with [group].
==============================================================================
4. Listing autocommands *autocmd-list*
:au[tocmd] [group] {event} {pat}
:au[tocmd] [group] {event} {aupat}
Show the autocommands associated with {event} and
{pat}.
{aupat}.
:au[tocmd] [group] * {pat}
Show the autocommands associated with {pat} for all
:au[tocmd] [group] * {aupat}
Show the autocommands associated with {aupat} for all
events.
:au[tocmd] [group] {event}
@ -499,10 +499,10 @@ CursorMoved After the cursor was moved in Normal or Visual
mode or to another window. Also when the text
of the cursor line has been changed, e.g. with
"x", "rx" or "p".
Not triggered when there is typeahead, while
executing a script file, when an operator is
pending, or when moving to another window while
remaining at the same cursor position.
Not always triggered when there is typeahead,
while executing commands in a script file, or
when an operator is pending. Always triggered
when moving to another window.
For an example see |match-parens|.
Note: Cannot be skipped with |:noautocmd|.
Careful: This is triggered very often, don't
@ -525,8 +525,19 @@ DirChanged After the |current-directory| was changed.
"global" to trigger on `:cd`
"auto" to trigger on 'autochdir'.
Sets these |v:event| keys:
cwd: current working directory
scope: "global", "tab", "window"
cwd: current working directory
scope: "global", "tabpage", "window"
changed_window: v:true if we fired the event
switching window (or tab)
<afile> is set to the new directory name.
Non-recursive (event cannot trigger itself).
*DirChangedPre*
DirChangedPre When the |current-directory| is going to be
changed, as with |DirChanged|.
The pattern is like with |DirChanged|.
Sets these |v:event| keys:
directory: new working directory
scope: "global", "tabpage", "window"
changed_window: v:true if we fired the event
switching window (or tab)
<afile> is set to the new directory name.
@ -663,15 +674,19 @@ FuncUndefined When a user function is used but it isn't
alternative is to use an autoloaded function.
See |autoload-functions|.
*UIEnter*
UIEnter After a UI connects via |nvim_ui_attach()|,
after VimEnter. Can be used for GUI-specific
configuration.
UIEnter After a UI connects via |nvim_ui_attach()|, or
after builtin TUI is started, after |VimEnter|.
Sets these |v:event| keys:
chan
chan: 0 for builtin TUI
1 for |--embed|
|channel-id| of the UI otherwise
*UILeave*
UILeave After a UI disconnects from Nvim.
UILeave After a UI disconnects from Nvim, or after
builtin TUI is stopped, after |VimLeave|.
Sets these |v:event| keys:
chan
chan: 0 for builtin TUI
1 for |--embed|
|channel-id| of the UI otherwise
*InsertChange*
InsertChange When typing <Insert> while in Insert or
Replace mode. The |v:insertmode| variable
@ -718,7 +733,27 @@ MenuPopup Just before showing the popup menu (under the
o Operator-pending
i Insert
c Command line
*OptionSet*
*ModeChanged*
ModeChanged After changing the mode. The pattern is
matched against `'old_mode:new_mode'`, for
example match against `*:c` to simulate
|CmdlineEnter|.
The following values of |v:event| are set:
old_mode The mode before it changed.
new_mode The new mode as also returned
by |mode()| called with a
non-zero argument.
When ModeChanged is triggered, old_mode will
have the value of new_mode when the event was
last triggered.
This will be triggered on every minor mode
change.
Usage example to use relative line numbers
when entering visual mode: >
:au ModeChanged [vV\x16]*:* let &l:rnu = mode() =~# '^[vV\x16]'
:au ModeChanged *:[vV\x16]* let &l:rnu = mode() =~# '^[vV\x16]'
:au WinEnter,WinLeave * let &l:rnu = mode() =~# '^[vV\x16]'
< *OptionSet*
OptionSet After setting an option (except during
|startup|). The |autocmd-pattern| is matched
against the long option name. |<amatch>|
@ -804,6 +839,25 @@ RemoteReply When a reply from a Vim that functions as
Note that even if an autocommand is defined,
the reply should be read with |remote_read()|
to consume it.
*SearchWrapped*
SearchWrapped After making a search with |n| or |N| if the
search wraps around the document back to
the start/finish respectively.
*RecordingEnter*
RecordingEnter When a macro starts recording.
The pattern is the current file name, and
|reg_recording()| is the current register that
is used.
*RecordingLeave*
RecordingLeave When a macro stops recording.
The pattern is the current file name, and
|reg_recording()| is the recorded
register.
|reg_recorded()| is only updated after this
event.
Sets these |v:event| keys:
regcontents
regname
*SessionLoadPost*
SessionLoadPost After loading the session file created using
the |:mksession| command.
@ -816,7 +870,7 @@ ShellCmdPost After executing a shell command with |:!cmd|,
*Signal*
Signal After Nvim receives a signal. The pattern is
matched against the signal name. Only
"SIGUSR1" is supported. Example: >
"SIGUSR1" and "SIGWINCH" are supported. Example: >
autocmd Signal SIGUSR1 call some#func()
< *ShellFilterPost*
ShellFilterPost After executing a shell command with
@ -1025,27 +1079,36 @@ WinLeave Before leaving a window. If the window to be
executes the BufLeave autocommands before the
WinLeave autocommands (but not for ":new").
Not used for ":qa" or ":q" when exiting Vim.
After WinClosed.
Before WinClosed.
*WinNew*
WinNew When a new window was created. Not done for
the first window, when Vim has just started.
Before WinEnter.
*WinScrolled*
WinScrolled After scrolling the viewport of the current
window.
*WinScrolled*
WinScrolled After scrolling the content of a window or
resizing a window.
The pattern is matched against the
|window-ID|. Both <amatch> and <afile> are
set to the |window-ID|.
Non-recursive (the event cannot trigger
itself). However, if the command causes the
window to scroll or change size another
WinScrolled event will be triggered later.
Does not trigger when the command is added,
only after the first scroll or resize.
==============================================================================
6. Patterns *autocmd-pattern* *{pat}*
6. Patterns *autocmd-pattern* *{aupat}*
The {pat} argument can be a comma separated list. This works as if the
command was given with each pattern separately. Thus this command: >
The {aupat} argument of `:autocmd` can be a comma-separated list. This works
as if the command was given with each pattern separately. Thus this command: >
:autocmd BufRead *.txt,*.info set et
Is equivalent to: >
:autocmd BufRead *.txt set et
:autocmd BufRead *.info set et
The file pattern {pat} is tested for a match against the file name in one of
The file pattern {aupat} is tested for a match against the file name in one of
two ways:
1. When there is no '/' in the pattern, Vim checks for a match against only
the tail part of the file name (without its leading directory path).
@ -1356,7 +1419,7 @@ Examples for reading and writing compressed files: >
: autocmd BufReadPre,FileReadPre *.gz set bin
: autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip
: autocmd BufReadPost,FileReadPost *.gz set nobin
: autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r")
: autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " .. expand("%:r")
: autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r
: autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r
@ -1455,7 +1518,7 @@ To insert the current date and time in a *.html file when writing it: >
: else
: let l = line("$")
: endif
: exe "1," . l . "g/Last modified: /s/Last modified: .*/Last modified: " .
: exe "1," .. l .. "g/Last modified: /s/Last modified: .*/Last modified: " ..
: \ strftime("%Y %b %d")
:endfun

9076
runtime/doc/builtin.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -42,8 +42,6 @@ For inserting text see |insert.txt|.
of the line and [count]-1 more lines [into register
x]; synonym for "d$".
(not |linewise|)
When the '#' flag is in 'cpoptions' the count is
ignored.
{Visual}["x]x or *v_x* *v_d* *v_<Del>*
{Visual}["x]d or
@ -355,14 +353,14 @@ CTRL-A Add [count] to the number or alphabetic character at
*v_CTRL-A*
{Visual}CTRL-A Add [count] to the number or alphabetic character in
the highlighted text. {not in Vi}
the highlighted text.
*v_g_CTRL-A*
{Visual}g CTRL-A Add [count] to the number or alphabetic character in
the highlighted text. If several lines are
highlighted, each one will be incremented by an
additional [count] (so effectively creating a
[count] incrementing sequence). {not in Vi}
[count] incrementing sequence).
For Example, if you have this list of numbers:
1. ~
1. ~
@ -381,14 +379,14 @@ CTRL-X Subtract [count] from the number or alphabetic
*v_CTRL-X*
{Visual}CTRL-X Subtract [count] from the number or alphabetic
character in the highlighted text. {not in Vi}
character in the highlighted text.
*v_g_CTRL-X*
{Visual}g CTRL-X Subtract [count] from the number or alphabetic
character in the highlighted text. If several lines
are highlighted, each value will be decremented by an
additional [count] (so effectively creating a [count]
decrementing sequence). {not in Vi}
decrementing sequence).
The CTRL-A and CTRL-X commands work for (signed) decimal numbers, unsigned
binary/octal/hexadecimal numbers and alphabetic characters.
@ -906,7 +904,7 @@ Consider using a character like "@" or ":". There is no problem if the result
of the expression contains the separation character.
Examples: >
:s@\n@\="\r" . expand("$HOME") . "\r"@
:s@\n@\="\r" .. expand("$HOME") .. "\r"@
This replaces an end-of-line with a new line containing the value of $HOME. >
s/E/\="\<Char-0x20ac>"/g
@ -1018,7 +1016,7 @@ inside of strings can change! Also see 'softtabstop' option. >
in [range] (default: current line |cmdline-ranges|),
[into register x].
*p* *put* *E353*
*p* *put* *E353* *E1240*
["x]p Put the text [from register x] after the cursor
[count] times.
@ -1065,7 +1063,7 @@ inside of strings can change! Also see 'softtabstop' option. >
the command. You need to escape the '|' and '"'
characters to prevent them from terminating the
command. Example: >
:put ='path' . \",/test\"
:put ='path' .. \",/test\"
< If there is no expression after '=', Vim uses the
previous expression. You can see it with ":dis =".
@ -1118,10 +1116,13 @@ register. With blockwise selection it also depends on the size of the block
and whether the corners are on an existing character. (Implementation detail:
it actually works by first putting the register after the selection and then
deleting the selection.)
The previously selected text is put in the unnamed register. If you want to
put the same text into a Visual selection several times you need to use
With 'p' the previously selected text is put in the unnamed register. This is
useful if you want to put that text somewhere else. But you cannot repeat the
same change.
With 'P' the unnamed register is not changed, you can repeat the same change.
But the deleted text cannot be used. If you do need it you can use 'p' with
another register. E.g., yank the text to copy, Visually select the text to
replace and use "0p . You can repeat this as many times as you like, the
replace and use "0p . You can repeat this as many times as you like, and the
unnamed register will be changed each time.
When you use a blockwise Visual mode command and yank only a single line into
@ -1595,7 +1596,8 @@ r Automatically insert the current comment leader after hitting
<Enter> in Insert mode.
*fo-o*
o Automatically insert the current comment leader after hitting 'o' or
'O' in Normal mode.
'O' in Normal mode. In case comment is unwanted in a specific place
use CTRL-U to quickly delete it. |i_CTRL-U|
*fo-q*
q Allow formatting of comments with "gq".
Note that formatting will not change blank lines or lines containing

View File

@ -44,7 +44,7 @@ functions like |chansend()| consume channel ids.
2. Reading and writing raw bytes *channel-bytes*
Channels opened by Vimscript functions operate with raw bytes by default. For
a job channel using RPC, bytes can still be read over its stderr. Similarily,
a job channel using RPC, bytes can still be read over its stderr. Similarly,
only bytes can be written to Nvim's own stderr.
*channel-callback*
@ -210,6 +210,11 @@ effective prompt text for a buffer, with |prompt_getprompt()|.
The user can go to Normal mode and navigate through the buffer. This can be
useful to see older output or copy text.
The CTRL-W key can be used to start a window command, such as CTRL-W w to
switch to the next window. This also works in Insert mode (use Shift-CTRL-W
to delete a word). When leaving the window Insert mode will be stopped. When
coming back to the prompt window Insert mode will be restored.
Any command that starts Insert mode, such as "a", "i", "A" and "I", will move
the cursor to the last line. "A" will move to the end of the line, "I" to the
start of the line.
@ -224,12 +229,12 @@ prompt. >
call chansend(g:shell_job, [a:text, ''])
endfunc
" Function handling output from the shell: Added above the prompt.
" Function handling output from the shell: Add it above the prompt.
func GotOutput(channel, msg, name)
call append(line("$") - 1, a:msg)
endfunc
" Function handling the shell exit: close the window.
" Function handling the shell exits: close the window.
func JobExit(job, status, event)
quit!
endfunc

View File

@ -207,7 +207,7 @@ CTRL-\ e {expr} *c_CTRL-\_e*
Example: >
:cmap <F7> <C-\>eAppendSome()<CR>
:func AppendSome()
:let cmd = getcmdline() . " Some()"
:let cmd = getcmdline() .. " Some()"
:" place the cursor on the )
:call setcmdpos(strlen(cmd))
:return cmd
@ -679,7 +679,7 @@ If more line specifiers are given than required for the command, the first
one(s) will be ignored.
Line numbers may be specified with: *:range* *{address}*
{number} an absolute line number
{number} an absolute line number *E1247*
. the current line *:.*
$ the last line in the file *:$*
% equal to 1,$ (the entire file) *:%*
@ -697,7 +697,8 @@ Line numbers may be specified with: *:range* *{address}*
Each may be followed (several times) by '+' or '-' and an optional number.
This number is added or subtracted from the preceding line number. If the
number is omitted, 1 is used.
number is omitted, 1 is used. If there is nothing before the '+' or '-' then
the current line is used.
The "/" and "?" after {pattern} are required to separate the pattern from
anything that follows.
@ -727,7 +728,7 @@ Some commands allow for a count after the command. This count is used as the
number of lines to be used, starting with the line given in the last line
specifier (the default is the cursor line). The commands that accept a count
are the ones that use a range but do not have a file name argument (because
a file name can also be a number).
a file name can also be a number). The count cannot be negative.
Examples: >
:s/x/X/g 5 substitute 'x' by 'X' in the current line and four
@ -863,9 +864,11 @@ Note: these are typed literally, they are not special keys!
*:<amatch>* *<amatch>*
<amatch> When executing autocommands, is replaced with the match for
which this autocommand was executed. *E497*
It differs from <afile> only when the file name isn't used
to match with (for FileType, Syntax and SpellFileMissing
It differs from <afile> when the file name isn't used to
match with (for FileType, Syntax and SpellFileMissing
events).
When the match is with a file name, it is expanded to the
full path.
*:<sfile>* *<sfile>*
<sfile> When executing a ":source" command, is replaced with the
file name of the sourced file. *E498*
@ -905,8 +908,7 @@ These modifiers can be given, in this order:
directory.
:. Reduce file name to be relative to current directory, if
possible. File name is unmodified if it is not below the
current directory, but on MS-Windows the drive is removed if
it is the current drive.
current directory.
For maximum shortness, use ":~:.".
:h Head of the file name (the last component and any separators
removed). Cannot be used with :e, :r or :t.

View File

@ -105,7 +105,7 @@ in eval.c:
- eval_call_provider(name, method, arguments, discard): calls
provider#{name}#Call with the method and arguments. If discard is true, any
value returned by the provider will be discarded and and empty value be
value returned by the provider will be discarded and empty value will be
returned.
- eval_has_provider(name): Checks the `g:loaded_{name}_provider` variable
which must be set to 2 by the provider script to indicate that it is
@ -204,7 +204,7 @@ Docstring format:
- Use `<pre>` for code samples.
Example: the help for |vim.paste()| is generated from a docstring decorating
vim.paste in src/nvim/lua/vim.lua like this: >
vim.paste in runtime/lua/vim/_editor.lua like this: >
--- Paste handler, invoked by |nvim_paste()| when a conforming UI
--- (such as the |TUI|) pastes text into the editor.
@ -243,12 +243,13 @@ If the function acts on an object then {thing} is the name of that object
with a {thing} that groups functions under a common concept).
Use existing common {action} names if possible:
add Append to, or insert into, a collection
del Delete a thing (or group of things)
exec Execute code
get Get a thing (or group of things by query)
list Get all things
set Set a thing (or group of things)
add Append to, or insert into, a collection
create Create a new thing
del Delete a thing (or group of things)
exec Execute code
get Get a thing (or group of things by query)
list Get all things
set Set a thing (or group of things)
Use consistent names for {thing} in all API functions. E.g. a buffer is called
"buf" everywhere, not "buffer" in some places and "buf" in others.

View File

@ -39,15 +39,19 @@ modify the diagnostics for a buffer (e.g. |vim.diagnostic.set()|) then it
requires a namespace.
*diagnostic-structure*
A diagnostic is a Lua table with the following keys:
A diagnostic is a Lua table with the following keys. Required keys are
indicated with (*):
lnum: The starting line of the diagnostic
bufnr: Buffer number
lnum(*): The starting line of the diagnostic
end_lnum: The final line of the diagnostic
col: The starting column of the diagnostic
col(*): The starting column of the diagnostic
end_col: The final column of the diagnostic
severity: The severity of the diagnostic |vim.diagnostic.severity|
message: The diagnostic text
message(*): The diagnostic text
source: The source of the diagnostic
code: The diagnostic code
user_data: Arbitrary data plugins or users can add
Diagnostics use the same indexing as the rest of the Nvim API (i.e. 0-based
rows and columns). |api-indexing|
@ -70,7 +74,7 @@ Functions that take a severity as an optional parameter (e.g.
2. A table with a "min" or "max" key (or both): >
vim.diagnostic.get(0, { severity = {min=vim.diagnostic.severity.WARN})
vim.diagnostic.get(0, { severity = {min=vim.diagnostic.severity.WARN} })
The latter form allows users to specify a range of severities.
@ -130,7 +134,7 @@ with |vim.notify()|: >
In this example, there is nothing to do when diagnostics are hidden, so we
omit the "hide" function.
Existing handlers can be overriden. For example, use the following to only
Existing handlers can be overridden. For example, use the following to only
show a sign for the highest severity diagnostic on a given line: >
-- Create a custom namespace. This will aggregate signs from all other
@ -175,8 +179,9 @@ All highlights defined for diagnostics begin with `Diagnostic` followed by
the type of highlight (e.g., `Sign`, `Underline`, etc.) and the severity (e.g.
`Error`, `Warn`, etc.)
Sign, underline and virtual text highlights (by default) are linked to their
corresponding default highlight.
By default, highlights for signs, floating windows, and virtual text are linked to the
corresponding default highlight. Underline highlights are not linked and use their
own default highlight groups.
For example, the default highlighting for |hl-DiagnosticSignError| is linked
to |hl-DiagnosticError|. To change the default (and therefore the linked
@ -296,7 +301,6 @@ Example: >
autocmd DiagnosticChanged * lua vim.diagnostic.setqflist({open = false })
<
==============================================================================
==============================================================================
Lua module: vim.diagnostic *diagnostic-api*
config({opts}, {namespace}) *vim.diagnostic.config()*
@ -324,16 +328,17 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
Note:
Each of the configuration options below accepts one of the
following:
• `false` : Disable this feature
• `true` : Enable this feature, use default settings.
• `table` : Enable this feature with overrides. Use an
• `false`: Disable this feature
• `true`: Enable this feature, use default settings.
• `table`: Enable this feature with overrides. Use an
empty table to use default values.
• `function` : Function with signature (namespace, bufnr)
• `function`: Function with signature (namespace, bufnr)
that returns any of the above.
Parameters: ~
{opts} table Configuration table with the following
keys:
{opts} table|nil When omitted or "nil", retrieve the
current configuration. Otherwise, a
configuration table with the following keys:
• underline: (default true) Use underline for
diagnostics. Options:
• severity: Only underline diagnostics
@ -341,13 +346,24 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
|diagnostic-severity|
• virtual_text: (default true) Use virtual
text for diagnostics. Options:
text for diagnostics. If multiple
diagnostics are set for a namespace, one
prefix per diagnostic + the last diagnostic
message are shown. Options:
• severity: Only show virtual text for
diagnostics matching the given severity
|diagnostic-severity|
• source: (string) Include the diagnostic
source in virtual text. One of "always"
or "if_many".
• source: (boolean or string) Include the
diagnostic source in virtual text. Use
"if_many" to only show sources if there
is more than one diagnostic source in the
buffer. Otherwise, any truthy value means
to always show the diagnostic source.
• spacing: (number) Amount of empty spaces
inserted at the beginning of the virtual
text.
• prefix: (string) Prepend diagnostic
message with prefix.
• format: (function) A function that takes
a diagnostic as input and returns a
string. The return value is the text used
@ -574,61 +590,67 @@ match({str}, {pat}, {groups}, {severity_map}, {defaults})
diagnostic |diagnostic-structure| or `nil` if {pat} fails
to match {str}.
open_float({bufnr}, {opts}) *vim.diagnostic.open_float()*
open_float({opts}, {...}) *vim.diagnostic.open_float()*
Show diagnostics in a floating window.
Parameters: ~
{bufnr} number|nil Buffer number. Defaults to the current
buffer.
{opts} table|nil Configuration table with the same keys
as |vim.lsp.util.open_floating_preview()| in
addition to the following:
• namespace: (number) Limit diagnostics to the
given namespace
• scope: (string, default "line") Show
diagnostics from the whole buffer ("buffer"),
the current cursor line ("line"), or the
current cursor position ("cursor").
pos: (number or table) If {scope} is "line" or
"cursor", use this position rather than the
cursor position. If a number, interpreted as a
line number; otherwise, a (row, col) tuple.
• severity_sort: (default false) Sort diagnostics
by severity. Overrides the setting from
|vim.diagnostic.config()|.
• severity: See |diagnostic-severity|. Overrides
the setting from |vim.diagnostic.config()|.
• header: (string or table) String to use as the
header for the floating window. If a table, it
is interpreted as a [text, hl_group] tuple.
Overrides the setting from
|vim.diagnostic.config()|.
• source: (string) Include the diagnostic source
in the message. One of "always" or "if_many".
Overrides the setting from
|vim.diagnostic.config()|.
• format: (function) A function that takes a
diagnostic as input and returns a string. The
return value is the text used to display the
diagnostic. Overrides the setting from
|vim.diagnostic.config()|.
• prefix: (function, string, or table) Prefix
each diagnostic in the floating window. If a
function, it must have the signature
(diagnostic, i, total) -> (string, string),
where {i} is the index of the diagnostic being
evaluated and {total} is the total number of
diagnostics displayed in the window. The
function should return a string which is
prepended to each diagnostic in the window as
well as an (optional) highlight group which
will be used to highlight the prefix. If
{prefix} is a table, it is interpreted as a
[text, hl_group] tuple as in |nvim_echo()|;
otherwise, if {prefix} is a string, it is
prepended to each diagnostic in the window with
no highlight. Overrides the setting from
|vim.diagnostic.config()|.
{opts} table|nil Configuration table with the same keys
as |vim.lsp.util.open_floating_preview()| in
addition to the following:
• bufnr: (number) Buffer number to show
diagnostics from. Defaults to the current
buffer.
namespace: (number) Limit diagnostics to the
given namespace
• scope: (string, default "line") Show diagnostics
from the whole buffer ("buffer"), the current
cursor line ("line"), or the current cursor
position ("cursor"). Shorthand versions are also
accepted ("c" for "cursor", "l" for "line", "b"
for "buffer").
• pos: (number or table) If {scope} is "line" or
"cursor", use this position rather than the
cursor position. If a number, interpreted as a
line number; otherwise, a (row, col) tuple.
• severity_sort: (default false) Sort diagnostics
by severity. Overrides the setting from
|vim.diagnostic.config()|.
• severity: See |diagnostic-severity|. Overrides
the setting from |vim.diagnostic.config()|.
• header: (string or table) String to use as the
header for the floating window. If a table, it
is interpreted as a [text, hl_group] tuple.
Overrides the setting from
|vim.diagnostic.config()|.
• source: (boolean or string) Include the
diagnostic source in the message. Use "if_many"
to only show sources if there is more than one
source of diagnostics in the buffer. Otherwise,
any truthy value means to always show the
diagnostic source. Overrides the setting from
|vim.diagnostic.config()|.
• format: (function) A function that takes a
diagnostic as input and returns a string. The
return value is the text used to display the
diagnostic. Overrides the setting from
|vim.diagnostic.config()|.
• prefix: (function, string, or table) Prefix each
diagnostic in the floating window. If a
function, it must have the signature
(diagnostic, i, total) -> (string, string),
where {i} is the index of the diagnostic being
evaluated and {total} is the total number of
diagnostics displayed in the window. The
function should return a string which is
prepended to each diagnostic in the window as
well as an (optional) highlight group which will
be used to highlight the prefix. If {prefix} is
a table, it is interpreted as a [text, hl_group]
tuple as in |nvim_echo()|; otherwise, if
{prefix} is a string, it is prepended to each
diagnostic in the window with no highlight.
Overrides the setting from
|vim.diagnostic.config()|.
Return: ~
tuple ({float_bufnr}, {win_id})

View File

@ -324,8 +324,9 @@ After setting this variable, reload the syntax script: >
FINDING THE DIFFERENCES *diff-diffexpr*
The 'diffexpr' option can be set to use something else than the standard
"diff" program to compare two files and find the differences. *E959*
The 'diffexpr' option can be set to use something else than the internal diff
support or the standard "diff" program to compare two files and find the
differences.
When 'diffexpr' is empty, Vim uses this command to find the differences
between file1 and file2: >
@ -358,7 +359,7 @@ format mentioned. These variables are set to the file names used:
v:fname_in original file
v:fname_new new version of the same file
v:fname_out resulting diff file
v:fname_out where to write the resulting diff file
Additionally, 'diffexpr' should take care of "icase" and "iwhite" in the
'diffopt' option. 'diffexpr' cannot change the value of 'lines' and
@ -370,13 +371,13 @@ Example (this does almost the same as 'diffexpr' being empty): >
function MyDiff()
let opt = ""
if &diffopt =~ "icase"
let opt = opt . "-i "
let opt = opt .. "-i "
endif
if &diffopt =~ "iwhite"
let opt = opt . "-b "
let opt = opt .. "-b "
endif
silent execute "!diff -a --binary " . opt . v:fname_in . " " . v:fname_new .
\ " > " . v:fname_out
silent execute "!diff -a --binary " .. opt .. v:fname_in .. " " .. v:fname_new ..
\ " > " .. v:fname_out
redraw!
endfunction
@ -426,8 +427,8 @@ Example (this does the same as 'patchexpr' being empty): >
set patchexpr=MyPatch()
function MyPatch()
:call system("patch -o " . v:fname_out . " " . v:fname_in .
\ " < " . v:fname_diff)
:call system("patch -o " .. v:fname_out .. " " .. v:fname_in ..
\ " < " .. v:fname_diff)
endfunction
Make sure that using the "patch" program doesn't have unwanted side effects.

View File

@ -35,6 +35,9 @@ An alternative is using the 'keymap' option.
< Avoid defining a digraph with '_' (underscore) as the
first character, it has a special meaning in the
future.
NOTE: This command cannot add a digraph that starts
with a white space. If you want to add such digraph,
you can use |digraph_set()| instead.
Example of the output of ":digraphs": >
TH Þ 222 ss ß 223 a! à 224 a' á 225 a> â 226 a? ã 227 a: ä 228

View File

@ -196,7 +196,7 @@ If you want to keep the changed buffer without saving it, switch on the
Edit {file} always. Discard any changes to the
current buffer.
Also see |++opt| and |+cmd|.
*:edit_#* *:e#*
:e[dit] [++opt] [+cmd] #[count]
Edit the [count]th buffer (as shown by |:files|).
This command does the same as [count] CTRL-^. But ":e
@ -356,7 +356,7 @@ as a wildcard when "[" is in the 'isfname' option. A simple way to avoid this
is to use "path\[[]abc]", this matches the file "path\[abc]".
*starstar-wildcard*
Expanding "**" is possible on Unix, Win32, Mac OS/X and a few other systems.
Expanding "**" is possible on Unix, Win32, macOS and a few other systems.
This allows searching a directory tree. This goes up to 100 directories deep.
Note there are some commands where this works slightly differently, see
|file-searching|.
@ -411,9 +411,9 @@ does apply like to other wildcards.
Environment variables in the expression are expanded when evaluating the
expression, thus this works: >
:e `=$HOME . '/.vimrc'`
:e `=$HOME .. '/.vimrc'`
This does not work, $HOME is inside a string and used literally: >
:e `='$HOME' . '/.vimrc'`
:e `='$HOME' .. '/.vimrc'`
If the expression returns a string then names are to be separated with line
breaks. When the result is a |List| then each item is used as a name. Line
@ -845,7 +845,7 @@ Note: When the 'write' option is off, you are not able to write any file.
*:w* *:write*
*E502* *E503* *E504* *E505*
*E512* *E514* *E667* *E796* *E949*
*E512* *E514* *E667* *E949*
:w[rite] [++opt] Write the whole buffer to the current file. This is
the normal way to save changes to a file. It fails
when the 'readonly' option is set or when there is
@ -1253,10 +1253,12 @@ working directory. If a local working directory (tab or window) does not
exist, the next-higher scope in the hierarchy applies.
*:cd* *E747* *E472*
:cd[!] On non-Unix systems: Print the current directory
name. On Unix systems: Change the current directory
to the home directory. Use |:pwd| to print the
current directory on all systems.
:cd[!] On non-Unix systems when 'cdhome' is off: Print the
current directory name.
Otherwise: Change the current directory to the home
directory. Clear any window-local directory.
Use |:pwd| to print the current directory on all
systems.
:cd[!] {path} Change the current directory to {path}.
If {path} is relative, it is searched for in the
@ -1329,6 +1331,7 @@ current directory for that window. Windows where the |:lcd| command has not
been used stick to the global or tab-local directory. When jumping to another
window the current directory is changed to the last specified local current
directory. If none was specified, the global or tab-local directory is used.
When creating a new window it inherits the local directory of the current window.
When changing tabs the same behaviour applies. If the current tab has no
local working directory the global working directory is used.
@ -1447,6 +1450,11 @@ If you don't get warned often enough you can use the following command.
if it exists now.
Once a file has been checked the timestamp is reset,
you will not be warned again.
Syntax highlighting, marks, diff status,
'fileencoding', 'fileformat' and 'binary' options
are not changed. See |v:fcs_choice| to reload these
too (for example, if a code formatting tools has
changed the file).
:[N]checkt[ime] {filename}
:[N]checkt[ime] [N]
@ -1487,7 +1495,7 @@ which version of the file you want to keep.
The accuracy of the time check depends on the filesystem. On Unix it is
usually sub-second. With old file sytems and on MS-Windows it is normally one
second. Use has('nanotime') check if sub-second time stamp checks are
second. Use `has('nanotime')` to check if sub-second time stamp checks are
available.
There is one situation where you get the message while there is nothing wrong:
@ -1566,6 +1574,10 @@ There are three different types of searching:
/u/user_x/work/include
/u/user_x/include
< Note: If your 'path' setting includes a non-existing directory, Vim will
skip the non-existing directory, and also does not search in the parent of
the non-existing directory if upwards searching is used.
3) Combined up/downward search:
If Vim's current path is /u/user_x/work/release and you do >
set path=**;/u/user_x

File diff suppressed because it is too large Load Diff

View File

@ -24,12 +24,21 @@ Each time a new or existing file is edited, Vim will try to recognize the type
of the file and set the 'filetype' option. This will trigger the FileType
event, which can be used to set the syntax highlighting, set options, etc.
Detail: The ":filetype on" command will load this file:
Detail: The ":filetype on" command will load these files:
$VIMRUNTIME/filetype.lua
$VIMRUNTIME/filetype.vim
This file is a Vim script that defines autocommands for the
BufNewFile and BufRead events. If the file type is not found by the
name, the file $VIMRUNTIME/scripts.vim is used to detect it from the
contents of the file.
filetype.lua creates an autocommand that fires for all BufNewFile and
BufRead events. It tries to detect the filetype based off of the
file's extension or name.
filetype.vim is a Vim script that defines autocommands for the
BufNewFile and BufRead events. In contrast to filetype.lua, this
file creates separate BufNewFile and BufRead events for each filetype
pattern.
If the file type is not found by the name, the file
$VIMRUNTIME/scripts.vim is used to detect it from the contents of the
file.
When the GUI is running or will start soon, the |menu.vim| script is
also sourced. See |'go-M'| about avoiding that.
@ -122,26 +131,37 @@ shell script: "#!/bin/csh".
argument was used.
*filetype-overrule*
When the same extension is used for two filetypes, Vim tries to guess what
kind of file it is. This doesn't always work. A number of global variables
can be used to overrule the filetype used for certain extensions:
When the same extension is used for multiple filetypes, Vim tries to guess
what kind of file it is. This doesn't always work. A number of global
variables can be used to overrule the filetype used for certain extensions:
file name variable ~
*.asa g:filetype_asa |ft-aspvbs-syntax| |ft-aspperl-syntax|
*.asm g:asmsyntax |ft-asm-syntax|
*.asp g:filetype_asp |ft-aspvbs-syntax| |ft-aspperl-syntax|
*.fs g:filetype_fs |ft-forth-syntax|
*.bas g:filetype_bas |ft-basic-syntax|
*.cfg g:filetype_cfg
*.dat g:filetype_dat
*.frm g:filetype_frm |ft-form-syntax|
*.fs g:filetype_fs |ft-forth-syntax|
*.i g:filetype_i |ft-progress-syntax|
*.inc g:filetype_inc
*.m g:filetype_m |ft-mathematica-syntax|
*.mod g:filetype_mod
*.p g:filetype_p |ft-pascal-syntax|
*.pl g:filetype_pl
*.pp g:filetype_pp |ft-pascal-syntax|
*.prg g:filetype_prg
*.src g:filetype_src
*.sys g:filetype_sys
*.sh g:bash_is_sh |ft-sh-syntax|
*.tex g:tex_flavor |ft-tex-plugin|
*.w g:filetype_w |ft-cweb-syntax|
For a few filetypes the global variable is used only when the filetype could
not be detected:
*.r g:filetype_r |ft-rexx-syntax|
*filetype-ignore*
To avoid that certain files are being inspected, the g:ft_ignore_pat variable
is used. The default value is set like this: >
@ -149,9 +169,10 @@ is used. The default value is set like this: >
This means that the contents of compressed files are not inspected.
*new-filetype*
If a file type that you want to use is not detected yet, there are four ways
to add it. In any way, it's better not to modify the $VIMRUNTIME/filetype.vim
file. It will be overwritten when installing a new version of Vim.
If a file type that you want to use is not detected yet, there are a few ways
to add it. In any way, it's better not to modify the $VIMRUNTIME/filetype.lua
or $VIMRUNTIME/filetype.vim files. They will be overwritten when installing a
new version of Nvim.
A. If you want to overrule all default file type checks.
This works by writing one file for each filetype. The disadvantage is that
@ -191,7 +212,7 @@ B. If you want to detect your file after the default file type checks.
au BufRead,BufNewFile * if &ft == 'pascal' | set ft=mypascal
| endif
C. If your file type can be detected by the file name.
C. If your file type can be detected by the file name or extension.
1. Create your user runtime directory. You would normally use the first
item of the 'runtimepath' option. Example for Unix: >
:!mkdir -p ~/.config/nvim
@ -206,9 +227,38 @@ C. If your file type can be detected by the file name.
au! BufRead,BufNewFile *.mine setfiletype mine
au! BufRead,BufNewFile *.xyz setfiletype drawing
augroup END
< Write this file as "filetype.vim" in your user runtime directory. For
<
Write this file as "filetype.vim" in your user runtime directory. For
example, for Unix: >
:w ~/.config/nvim/filetype.vim
<
Alternatively, create a file called "filetype.lua" that adds new
filetypes.
Example: >
vim.filetype.add({
extension = {
foo = "fooscript",
},
filename = {
[".foorc"] = "foorc",
},
pattern = {
[".*/etc/foo/.*%.conf"] = "foorc",
},
})
<
See |vim.filetype.add()|.
*g:do_filetype_lua*
For now, Lua filetype detection is opt-in. You can enable it by adding
the following to your |init.vim|: >
let g:do_filetype_lua = 1
< *g:did_load_filetypes*
In either case, the builtin filetype detection provided by Nvim can be
disabled by setting the did_load_filetypes global variable. If this
variable exists, $VIMRUNTIME/filetype.vim will not run.
Example: >
" Disable filetype.vim
let g:did_load_filetypes = 1
< 3. To use the new filetype detection you must restart Vim.
@ -245,9 +295,9 @@ D. If your filetype can only be detected by inspecting the contents of the
$VIMRUNTIME/scripts.vim.
*remove-filetype*
If a file type is detected that is wrong for you, install a filetype.vim or
scripts.vim to catch it (see above). You can set 'filetype' to a non-existing
name to avoid that it will be set later anyway: >
If a file type is detected that is wrong for you, install a filetype.lua,
filetype.vim or scripts.vim to catch it (see above). You can set 'filetype' to
a non-existing name to avoid that it will be set later anyway: >
:set filetype=ignored
If you are setting up a system with many users, and you don't want each user
@ -314,12 +364,12 @@ define yourself. There are a few ways to avoid this:
You need to define your own mapping before the plugin is loaded (before
editing a file of that type). The plugin will then skip installing the
default mapping.
*no_mail_maps*
*no_mail_maps* *g:no_mail_maps*
3. Disable defining mappings for a specific filetype by setting a variable,
which contains the name of the filetype. For the "mail" filetype this
would be: >
:let no_mail_maps = 1
< *no_plugin_maps*
< *no_plugin_maps* *g:no_plugin_maps*
4. Disable defining mappings for all filetypes by setting a variable: >
:let no_plugin_maps = 1
<

View File

@ -497,11 +497,13 @@ Note the use of backslashes to avoid some characters to be interpreted by the
:function MyFoldText()
: let line = getline(v:foldstart)
: let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
: return v:folddashes . sub
: return v:folddashes .. sub
:endfunction
Evaluating 'foldtext' is done in the |sandbox|. The current window is set to
the window that displays the line. Errors are ignored.
the window that displays the line.
Errors are ignored. For debugging set the 'debug' option to "throw".
The default value is |foldtext()|. This returns a reasonable text for most
types of folding. If you don't like it, you can specify your own 'foldtext'

View File

@ -89,9 +89,9 @@ file is opened and adds Ada related entries to the main and pop-up menu.
*ft-ada-omni*
The Ada omni-completions (|i_CTRL-X_CTRL-O|) uses tags database created either
by "gnat xref -v" or the "exuberant Ctags (http://ctags.sourceforge.net). The
complete function will automatically detect which tool was used to create the
tags file.
by "gnat xref -v" or the "Universal Ctags" (https://ctags.io). The complete
function will automatically detect which tool was used to create the tags
file.
------------------------------------------------------------------------------
3.1 Omni Completion with "gnat xref" ~
@ -125,18 +125,18 @@ NOTE: "gnat xref -v" is very tricky to use as it has almost no diagnostic
3.2 Omni Completion with "ctags"~
*ada-ctags*
Exuberant Ctags uses its own multi-language code parser. The parser is quite
fast, produces a lot of extra information (hence the name "Exuberant Ctags")
and can run on files which currently do not compile.
Universal/Exuberant Ctags use their own multi-language code parser. The
parser is quite fast, produces a lot of extra information and can run on files
which currently do not compile.
There are also lots of other Vim-tools which use exuberant Ctags.
There are also lots of other Vim-tools which use Universal/Exuberant Ctags.
Universal Ctags is preferred, Exuberant Ctags is no longer being developed.
You will need to install a version of the Exuberant Ctags which has Ada
support patched in. Such a version is available from the GNU Ada Project
(http://gnuada.sourceforge.net).
You will need to install Universal Ctags which is available from
https://ctags.io
The Ada parser for Exuberant Ctags is fairly new - don't expect complete
support yet.
The Ada parser for Universal/Exuberant Ctags is fairly new - don't expect
complete support yet.
==============================================================================
4. Compiler Support ~

View File

@ -47,20 +47,20 @@ Numbers, subscripts and superscripts are available with 's' and 'S':
But some don't come defined by default. Those are digraph definitions you can
add in your ~/.vimrc file. >
exec 'digraph \\ '.char2nr('')
exec 'digraph \< '.char2nr('≼')
exec 'digraph \> '.char2nr('≽')
exec 'digraph (L '.char2nr('⊈')
exec 'digraph )L '.char2nr('⊉')
exec 'digraph (/ '.char2nr('⊄')
exec 'digraph )/ '.char2nr('⊅')
exec 'digraph )/ '.char2nr('⊅')
exec 'digraph U+ '.char2nr('⊎')
exec 'digraph 0- '.char2nr('⊖')
exec 'digraph \\ ' .. char2nr('')
exec 'digraph \< ' .. char2nr('≼')
exec 'digraph \> ' .. char2nr('≽')
exec 'digraph (L ' .. char2nr('⊈')
exec 'digraph )L ' .. char2nr('⊉')
exec 'digraph (/ ' .. char2nr('⊄')
exec 'digraph )/ ' .. char2nr('⊅')
exec 'digraph )/ ' .. char2nr('⊅')
exec 'digraph U+ ' .. char2nr('⊎')
exec 'digraph 0- ' .. char2nr('⊖')
" Euler's constant
exec 'digraph ne '.char2nr('𝑒')
exec 'digraph ne ' .. char2nr('𝑒')
" Raku's atomic operations marker
exec 'digraph @@ '.char2nr('⚛')
exec 'digraph @@ ' .. char2nr('⚛')
Alternatively, you can write Insert mode abbreviations that convert ASCII-
based operators into their single-character Unicode equivalent. >

View File

@ -26,7 +26,7 @@ behavior of the plugin.
g:rustc_path~
Set this option to the path to rustc for use in the |:RustRun| and
|:RustExpand| commands. If unset, "rustc" will be located in $PATH: >
let g:rustc_path = $HOME."/bin/rustc"
let g:rustc_path = $HOME .. "/bin/rustc"
<
*g:rustc_makeprg_no_percent*
@ -87,7 +87,7 @@ g:rust_bang_comment_leader~
g:ftplugin_rust_source_path~
Set this option to a path that should be prepended to 'path' for Rust
source files: >
let g:ftplugin_rust_source_path = $HOME.'/dev/rust'
let g:ftplugin_rust_source_path = $HOME .. '/dev/rust'
<
*g:rustfmt_command*

View File

@ -109,8 +109,8 @@ must be configurable. The filetype plugin attempts to define many of the
standard objects, plus many additional ones. In order to make this as
flexible as possible, you can override the list of objects from within your
|vimrc| with the following: >
let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' .
\ ',schema,service,publication,database,datatype,domain' .
let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' ..
\ ',schema,service,publication,database,datatype,domain' ..
\ ',index,subscription,synchronization,view,variable'
The following |Normal| mode and |Visual| mode maps have been created which use
@ -131,10 +131,10 @@ Repeatedly pressing ]} will cycle through each of these create statements: >
create index i1 on t1 (c1);
The default setting for g:ftplugin_sql_objects is: >
let g:ftplugin_sql_objects = 'function,procedure,event,' .
\ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' .
\ 'table,trigger' .
\ ',schema,service,publication,database,datatype,domain' .
let g:ftplugin_sql_objects = 'function,procedure,event,' ..
\ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' ..
\ 'table,trigger' ..
\ ',schema,service,publication,database,datatype,domain' ..
\ ',index,subscription,synchronization,view,variable'
The above will also handle these cases: >
@ -555,7 +555,7 @@ the SQL completion plugin. >
< 1. After typing SELECT press <C-C>t to display a list of tables.
2. Highlight the table you need the column list for.
3. Press <Enter> to choose the table from the list.
4. Press <C-C>l to request a comma separated list of all columns
4. Press <C-C>l to request a comma-separated list of all columns
for this table.
5. Based on the table name chosen in step 3, the plugin attempts to
decide on a reasonable table alias. You are then prompted to
@ -609,7 +609,7 @@ your |init.vim|: >
>
omni_sql_use_tbl_alias
< - Default: a
- This setting is only used when generating a comma separated
- This setting is only used when generating a comma-separated
column list. By default the map is <C-C>l. When generating
a column list, an alias can be prepended to the beginning of each
column, for example: e.emp_id, e.emp_name. This option has three
@ -693,9 +693,9 @@ plugin. >
<C-C>c
< - Displays a list of columns for a specific table. >
<C-C>l
< - Displays a comma separated list of columns for a specific table. >
< - Displays a comma-separated list of columns for a specific table. >
<C-C>L
< - Displays a comma separated list of columns for a specific table.
< - Displays a comma-separated list of columns for a specific table.
This should only be used when the completion window is active. >
<Right>
< - Displays a list of columns for the table currently highlighted in

View File

@ -93,6 +93,7 @@ REFERENCE MANUAL: These files explain every detail of Vim. *reference_toc*
General subjects ~
|intro.txt| general introduction to Vim; notation used in help files
|nvim.txt| Transitioning from Vim
|help.txt| overview and quick reference (this file)
|helphelp.txt| about using the help files
|index.txt| alphabetical index of all commands
@ -128,22 +129,25 @@ Advanced editing ~
|diff.txt| working with two to eight versions of the same file
|autocmd.txt| automatically executing commands on an event
|eval.txt| expression evaluation, conditional commands
|builtin.txt| builtin functions
|fold.txt| hide (fold) ranges of lines
|lua.txt| Lua API
|api.txt| Nvim API via RPC, Lua and VimL
Special issues ~
|testing.txt| testing Vim and Vim scripts
|print.txt| printing
|remote.txt| using Vim as a server or client
|testing.txt| testing Vim and Vim scripts
|print.txt| printing
|remote_plugin.txt| Nvim support for remote plugins
Programming language support ~
|indent.txt| automatic indenting for C and other languages
|lsp.txt| Language Server Protocol (LSP)
|treesitter.txt| tree-sitter library for incremental parsing of buffers
|diagnostic.txt| Diagnostic framework
|syntax.txt| syntax highlighting
|filetype.txt| settings done specifically for a type of file
|quickfix.txt| commands for a quick edit-compile-fix cycle
|provider.txt| Built-in remote plugin hosts
|ft_ada.txt| Ada (the programming language) support
|ft_ps1.txt| Filetype plugin for Windows PowerShell
|ft_raku.txt| Filetype plugin for Raku
@ -164,6 +168,7 @@ GUI ~
Interfaces ~
|if_cscop.txt| using Cscope with Vim
|if_perl.txt| Perl interface
|if_pyth.txt| Python interface
|if_ruby.txt| Ruby interface
|sign.txt| debugging signs
@ -171,6 +176,16 @@ Interfaces ~
Versions ~
|vim_diff.txt| Main differences between Nvim and Vim
|vi_diff.txt| Main differences between Vim and Vi
|deprecated.txt| Deprecated items that have been or will be removed
Other ~
|terminal_emulator.txt| Terminal buffers
|term.txt| Terminal UI
|ui.txt| Nvim UI protocol
|channel.txt| Nvim asynchronous IO
|dev_style.txt| Nvim style guide
|job_control.txt| Spawn and control multiple processes
*standard-plugin-list*
Standard plugins ~
|matchit.txt| Extended |%| matching

View File

@ -164,7 +164,7 @@ If you would like to open the help in the current window, see this tip:
The initial height of the help window can be set with the 'helpheight' option
(default 20).
*help-buffer-options*
When the help buffer is created, several local options are set to make sure
the help text is displayed as it was intended:
'iskeyword' nearly all ASCII chars except ' ', '*', '"' and '|'
@ -219,7 +219,7 @@ command: >
<
*:helpt* *:helptags*
*E154* *E150* *E151* *E152* *E153* *E670* *E856*
*E150* *E151* *E152* *E153* *E154* *E670* *E856*
:helpt[ags] [++t] {dir}
Generate the help tags file(s) for directory {dir}.
When {dir} is ALL then all "doc" directories in
@ -358,7 +358,7 @@ When referring to a Vim option in the help file, place the option name between
two single quotes, eg. 'statusline'
When referring to any other technical term, such as a filename or function
parameter, surround it in backticks (`), eg. `~/.path/to/init.vim`.
parameter, surround it in backticks, eg. `~/.path/to/init.vim`.
HIGHLIGHTING

View File

@ -40,7 +40,7 @@ See |cscope-usage| to get started.
==============================================================================
Cscope commands *cscope-commands*
*:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560*
*:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E560* *E561*
All cscope commands are accessed through suboptions to the cscope commands.
`:cscope` or `:cs` is the main command
`:scscope` or `:scs` does the same and splits the window

View File

@ -1,8 +0,0 @@
NVIM REFERENCE MANUAL
Moved to |lua.txt|
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@ -1,10 +1,10 @@
*if_pyth.txt* Nvim
VIM REFERENCE MANUAL by Paul Moore
NVIM REFERENCE MANUAL
The Python Interface to Vim *if_pyth* *python* *Python*
The Python Interface to NVim *if_pyth* *python* *Python*
See |provider-python| for more information.
@ -134,7 +134,7 @@ Instead, put the Python command in a function and call that function:
Note that "EOF" must be at the start of the line.
==============================================================================
The vim module *python-vim* *python2*
The vim module *python-vim*
Python code gets all of its access to vim (with one exception - see
|python-output| below) via the "vim" module. The vim module implements two
@ -322,14 +322,13 @@ Output from Python *python-output*
supported, and may cause the program to crash. This should probably be
fixed.
*python2-directory* *python3-directory* *pythonx-directory*
*python3-directory* *pythonx-directory*
Python 'runtimepath' handling *python-special-path*
In python vim.VIM_SPECIAL_PATH special directory is used as a replacement for
the list of paths found in 'runtimepath': with this directory in sys.path and
vim.path_hooks in sys.path_hooks python will try to load module from
{rtp}/python2 (or python3) and {rtp}/pythonx (for both python versions) for
each {rtp} found in 'runtimepath'.
{rtp}/python3 and {rtp}/pythonx for each {rtp} found in 'runtimepath'.
Implementation is similar to the following, but written in C: >
@ -401,8 +400,8 @@ vim._get_paths *python-_get_paths*
hook. You should not rely on this method being present in future
versions, but can use it for debugging.
It returns a list of {rtp}/python2 (or {rtp}/python3) and
{rtp}/pythonx directories for each {rtp} in 'runtimepath'.
It returns a list of {rtp}/python3 and {rtp}/pythonx
directories for each {rtp} in 'runtimepath'.
==============================================================================
Buffer objects *python-buffer*
@ -590,6 +589,11 @@ functions to evaluate Python expressions and pass their values to Vim script.
==============================================================================
Python 3 *python3*
As Python 3 is the only supported version in Nvim, "python" is synonymous
with "python3" in the current version. However, code that aims to support older
versions of Neovim, as well as Vim, should prefer to use "python3"
variants explicitly if Python 3 is required.
*:py3* *:python3*
:[range]py3 {stmt}
:[range]py3 << [endmarker]
@ -619,31 +623,26 @@ Raising SystemExit exception in python isn't endorsed way to quit vim, use: >
:py vim.command("qall!")
<
*has-python*
You can test what Python version is available with: >
if has('python')
echo 'there is Python 2.x'
You can test if Python is available with: >
if has('pythonx')
echo 'there is Python'
endif
if has('python3')
echo 'there is Python 3.x'
endif
Python 2 is no longer supported. Thus `has('python')` always returns
zero for backwards compatibility reasons.
==============================================================================
Python X *python_x* *pythonx*
Because most python code can be written so that it works with Python 2.6+ and
Python 3, the pyx* functions and commands have been written. They work the
same as the Python 2 and 3 variants, but select the Python version using the
'pyxversion' setting.
Set 'pyxversion' in your |vimrc| to prefer Python 2 or Python 3 for Python
commands. Changing this setting at runtime risks losing the state of plugins
(such as initialization).
If you want to use a module, you can put it in the {rtp}/pythonx directory.
See |pythonx-directory|.
The "pythonx" and "pyx" prefixes were introduced for python code which
works with Python 2.6+ and Python 3. As Nvim only supports Python 3,
all these commands are now synonymous to their "python3" equivalents.
*:pyx* *:pythonx*
`:pyx` and `:pythonx` work similar to `:python`. To check if `:pyx` works: >
`:pyx` and `:pythonx` work the same as `:python3`. To check if `:pyx` works: >
:pyx print("Hello")
To see what version of Python is being used: >
@ -651,33 +650,15 @@ To see what version of Python is being used: >
:pyx print(sys.version)
<
*:pyxfile* *python_x-special-comments*
`:pyxfile` works similar to `:pyfile`. But you can add a "shebang" comment to
force Vim to use `:pyfile` or `:py3file`: >
#!/any string/python2 " Shebang. Must be the first line of the file.
#!/any string/python3 " Shebang. Must be the first line of the file.
# requires python 2.x " Maximum lines depend on 'modelines'.
# requires python 3.x " Maximum lines depend on 'modelines'.
Unlike normal modelines, the bottom of the file is not checked.
If none of them are found, the 'pyxversion' option is used.
*W20* *W21*
If Vim does not support the selected Python version a silent message will be
printed. Use `:messages` to read them.
`:pyxfile` works the same as `:py3file`.
*:pyxdo*
`:pyxdo` works similar to `:pydo`.
`:pyxdo` works the same as `:py3do`.
*has-pythonx*
To check if pyx* functions and commands are available: >
To check if `pyx*` functions and commands are available: >
if has('pythonx')
echo 'pyx* commands are available. (Python ' . &pyx . ')'
endif
If you prefer Python 2 and want to fallback to Python 3, set 'pyxversion'
explicitly in your |.vimrc|. Example: >
if has('python')
set pyx=2
elseif has('python3')
set pyx=3
echo 'pyx* commands are available. (Python ' .. &pyx .. ')'
endif
==============================================================================

View File

@ -38,11 +38,12 @@ is not a C compiler: it does not recognize all syntax. One requirement is
that toplevel functions have a '{' in the first column. Otherwise they are
easily confused with declarations.
These four options control C program indenting:
These five options control C program indenting:
'cindent' Enables Vim to perform C program indenting automatically.
'cinkeys' Specifies which keys trigger reindenting in insert mode.
'cinoptions' Sets your preferred indent style.
'cinwords' Defines keywords that start an extra indent in the next line.
'cinscopedecls' Defines strings that are recognized as a C++ scope declaration.
If 'lisp' is not on and 'equalprg' is empty, the "=" operator indents using
Vim's built-in algorithm rather than calling an external program.
@ -289,8 +290,9 @@ The examples below assume a 'shiftwidth' of 4.
<
*cino-g*
gN Place C++ scope declarations N characters from the indent of the
block they are in. (default 'shiftwidth'). A scope declaration
can be "public:", "protected:" or "private:".
block they are in. (default 'shiftwidth'). By default, a scope
declaration is "public:", "protected:" or "private:". This can
be adjusted with the 'cinscopedecls' option.
cino= cino=g0 >
{ {
@ -771,6 +773,15 @@ You can set the indent for the first line after <script> and <style>
"auto" auto indent (same indent as the blocktag)
"inc" auto indent + one indent step
You can set the indent for attributes after an open <tag line: >
:let g:html_indent_attribute = 1
<
VALUE MEANING ~
1 auto indent, one indent step more than <tag
2 auto indent, two indent steps (default)
> 2 auto indent, more indent steps
Many tags increase the indent for what follows per default (see "Add Indent
Tags" in the script). You can add further tags with: >
@ -872,7 +883,7 @@ For example, with N = 1, this will give:
*PHP_outdentphpescape*
To indent PHP escape tags as the surrounding non-PHP code (only affects the
PHP escape tags): >
:let g:PHP_outdentphpescape = 0
:let g:PHP_outdentphpescape = 0
-------------
*PHP_removeCRwhenUnix*
@ -1199,7 +1210,7 @@ comments will be indented according to the correctly indented code.
VIM *ft-vim-indent*
*g:vim_indent_cont*
For indenting Vim scripts there is one variable that specifies the amount of
indent for a continuation line, a line that starts with a backslash: >

View File

@ -339,7 +339,6 @@ tag char note action in Normal mode ~
insert text, repeat N times
|P| ["x]P 2 put the text [from register x] before the
cursor N times
|Q| Q switch to "Ex" mode
|R| R 2 enter replace mode: overtype existing
characters, repeat the entered text N-1
times
@ -354,6 +353,7 @@ tag char note action in Normal mode ~
register x]
|Y| ["x]Y yank N lines [into register x]; synonym for
"yy"
Note: Mapped to "y$" by default. |default-mappings|
|ZZ| ZZ write if buffer changed and close window
|ZQ| ZQ close window without writing
|[| [{char} square bracket command (see |[| below)
@ -401,6 +401,7 @@ tag char note action in Normal mode ~
|q| q{0-9a-zA-Z"} record typed characters into named register
{0-9a-zA-Z"} (uppercase to append)
|q| q (while recording) stops recording
|Q| Q replay last recorded macro
|q:| q: edit : command-line in command-line window
|q/| q/ edit / command-line in command-line window
|q?| q? edit ? command-line in command-line window
@ -430,6 +431,7 @@ tag char note action in Normal mode ~
|<C-LeftMouse>| <C-LeftMouse> ":ta" to the keyword at the mouse click
|<C-Right>| <C-Right> 1 same as "w"
|<C-RightMouse>| <C-RightMouse> same as "CTRL-T"
|<C-Tab>| <C-Tab> same as "g<Tab>"
|<Del>| ["x]<Del> 2 same as "x"
|N<Del>| {count}<Del> remove the last digit from {count}
|<Down>| <Down> 1 same as "j"
@ -576,7 +578,7 @@ tag command action in Normal mode ~
following the file name.
|CTRL-W_gt| CTRL-W g t same as `gt`: go to next tab page
|CTRL-W_gT| CTRL-W g T same as `gT`: go to previous tab page
|CTRL-W_g<Tab>| CTRL-W g <Tab> same as `g<Tab>` : go to last accessed tab
|CTRL-W_g<Tab>| CTRL-W g <Tab> same as |g<Tab>|: go to last accessed tab
page
|CTRL-W_h| CTRL-W h go to Nth left window (stop at first window)
|CTRL-W_i| CTRL-W i split window and jump to declaration of
@ -923,7 +925,9 @@ tag command note action in Visual mode ~
before the highlighted area
|v_J| J 2 join the highlighted lines
|v_K| K run 'keywordprg' on the highlighted area
|v_O| O Move horizontally to other corner of area.
|v_O| O move horizontally to other corner of area
|v_P| P replace highlighted area with register
contents; unnamed register is unchanged
Q does not start Ex mode
|v_R| R 2 delete the highlighted lines and start
insert
@ -986,6 +990,8 @@ tag command note action in Visual mode ~
|v_i{| i{ same as iB
|v_i}| i} same as iB
|v_o| o move cursor to other corner of area
|v_p| p replace highlighted area with register
contents; deleted text in unnamed register
|v_r| r 2 replace highlighted area with a character
|v_s| s 2 delete highlighted area and start insert
|v_u| u 2 make highlighted area lowercase

View File

@ -76,6 +76,8 @@ CTRL-U Delete all entered characters before the cursor in the current
line. If there are no newly entered characters and
'backspace' is not empty, delete all characters before the
cursor in the current line.
If C-indenting is enabled the indent will be adjusted if the
line becomes blank.
See |i_backspacing| about joining lines.
*i_CTRL-U-default*
By default, sets a new undo point before deleting.
@ -256,7 +258,7 @@ CTRL-] Trigger abbreviation, without inserting a character.
*i_backspacing*
The effect of the <BS>, CTRL-W, and CTRL-U depend on the 'backspace' option
(unless 'revins' is set). This is a comma separated list of items:
(unless 'revins' is set). This is a comma-separated list of items:
item action ~
indent allow backspacing over autoindent
@ -267,8 +269,8 @@ start allow backspacing over the start position of insert; CTRL-W and
When 'backspace' is empty, Vi compatible backspacing is used. You cannot
backspace over autoindent, before column 1 or before where insert started.
For backwards compatibility the values "0", "1" and "2" are also allowed, see
|'backspace'|.
For backwards compatibility the values "0", "1", "2" and "3" are also allowed,
see |'backspace'|.
If the 'backspace' option does contain "eol" and the cursor is in column 1
when one of the three keys is used, the current line is joined with the
@ -778,7 +780,7 @@ If the previous expansion was split, because it got longer than 'textwidth',
then just the text in the current line will be used.
If the match found is at the end of a line, then the first word in the next
line will be inserted and the message "word from next line" displayed, if
line will be inserted and the message "Word from other line" displayed, if
this word is accepted the next CTRL-X CTRL-P or CTRL-X CTRL-N will search
for those lines starting with this word.
@ -796,6 +798,7 @@ CTRL-X CTRL-K Search the files given with the 'dictionary' option
the 'dictionary' option is empty.
For suggestions where to find a list of words, see the
'dictionary' option.
'ignorecase', 'smartcase' and 'infercase' apply.
CTRL-K or
CTRL-N Search forward for next matching keyword. This
@ -828,7 +831,7 @@ space is preferred). Maximum line length is 510 bytes.
For an example, imagine the 'thesaurus' file has a line like this: >
angry furious mad enraged
<Placing the cursor after the letters "ang" and typing CTRL-X CTRL-T would
Placing the cursor after the letters "ang" and typing CTRL-X CTRL-T would
complete the word "angry"; subsequent presses would change the word to
"furious", "mad" etc.
@ -840,7 +843,7 @@ https://github.com/vim/vim/issues/629#issuecomment-443293282
Unpack thesaurus_pkg.zip, put the thesaurus.txt file somewhere, e.g.
~/.vim/thesaurus/english.txt, and the 'thesaurus' option to this file name.
Completing keywords with 'thesaurusfunc' *compl-thesaurusfunc*
If the 'thesaurusfunc' option is set, then the user specified function is
@ -862,7 +865,7 @@ Groß): >
else
let res = []
let h = ''
for l in split(system('aiksaurus '.shellescape(a:base)), '\n')
for l in split(system('aiksaurus ' .. shellescape(a:base)), '\n')
if l[:3] == '=== '
let h = substitute(l[4:], ' =*$', '', '')
elseif l[0] =~ '\a'
@ -1197,7 +1200,7 @@ An example that completes the names of the months: >
" find months matching with "a:base"
let res = []
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
if m =~ '^' . a:base
if m =~ '^' .. a:base
call add(res, m)
endif
endfor
@ -1219,7 +1222,7 @@ The same, but now pretending searching for matches is slow: >
else
" find months matching with "a:base"
for m in split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")
if m =~ '^' . a:base
if m =~ '^' .. a:base
call complete_add(m)
endif
sleep 300m " simulate searching for next match
@ -1339,11 +1342,16 @@ in 'runtimepath'. Thus for "java" it is autoload/javacomplete.vim.
C *ft-c-omni*
Completion of C code requires a tags file. You should use Exuberant ctags,
because it adds extra information that is needed for completion. You can find
it here: http://ctags.sourceforge.net/ Version 5.6 or later is recommended.
Completion of C code requires a tags file. You should use Universal/
Exuberant ctags, because it adds extra information that is needed for
completion. You can find it here:
Universal Ctags: https://ctags.io
Exuberant Ctags: http://ctags.sourceforge.net
For version 5.5.4 you should add a patch that adds the "typename:" field:
Universal Ctags is preferred, Exuberant Ctags is no longer being developed.
For Exuberant ctags, version 5.6 or later is recommended. For version 5.5.4
you should add a patch that adds the "typename:" field:
ftp://ftp.vim.org/pub/vim/unstable/patches/ctags-5.5.4.patch
A compiled .exe for MS-Windows can be found at:
http://ctags.sourceforge.net/
@ -1464,8 +1472,11 @@ will be suggested. All other elements are not placed in suggestion list.
PHP *ft-php-omni*
Completion of PHP code requires a tags file for completion of data from
external files and for class aware completion. You should use Exuberant ctags
version 5.5.4 or newer. You can find it here: http://ctags.sourceforge.net/
external files and for class aware completion. You should use Universal/
Exuberant ctags version 5.5.4 or newer. You can find it here:
Universal Ctags: https://ctags.io
Exuberant Ctags: http://ctags.sourceforge.net
Script completes:
@ -1861,14 +1872,10 @@ gi Insert text in the same position as where Insert mode
*o*
o Begin a new line below the cursor and insert text,
repeat [count] times.
When the '#' flag is in 'cpoptions' the count is
ignored.
*O*
O Begin a new line above the cursor and insert text,
repeat [count] times.
When the '#' flag is in 'cpoptions' the count is
ignored.
These commands are used to start inserting text. You can end insert mode with
<Esc>. See |mode-ins-repl| for the other special characters in Insert mode.
@ -1878,6 +1885,9 @@ When 'autoindent' is on, the indent for a new line is obtained from the
previous line. When 'smartindent' or 'cindent' is on, the indent for a line
is automatically adjusted for C programs.
'formatoptions' can be set to copy the comment leader when opening a new
line.
'textwidth' can be set to the maximum width for a line. When a line becomes
too long when appending characters a line break is automatically inserted.

View File

@ -120,7 +120,7 @@ Vim would never have become what it is now, without the help of these people!
Daniel Elstner GTK+ 2 port
Eric Fischer Mac port, 'cindent', and other improvements
Benji Fisher Answering lots of user questions
Bill Foster Athena GUI port
Bill Foster Athena GUI port (later removed)
Google Lets me work on Vim one day a week
Loic Grenie xvim (ideas for multi windows version)
Sven Guckes Vim promoter and previous WWW page maintainer
@ -322,7 +322,6 @@ notation meaning equivalent decimal value(s) ~
<Bar> vertical bar | 124 *<Bar>*
<Del> delete 127
<CSI> command sequence intro ALT-Esc 155 *<CSI>*
<xCSI> CSI when typed in the GUI *<xCSI>*
<EOL> end-of-line (can be <CR>, <NL> or <CR><NL>,
depends on system and 'fileformat') *<EOL>*
@ -563,8 +562,8 @@ The command CTRL-\ CTRL-G or <C-\><C-G> can be used to go to Insert mode when
make sure Vim is in the mode indicated by 'insertmode', without knowing in
what mode Vim currently is.
*gQ* *Q* *mode-Ex* *Ex-mode* *Ex* *EX* *E501*
Q or gQ Switch to Ex mode. This is like typing ":" commands
*gQ* *mode-Ex* *Ex-mode* *Ex* *EX* *E501*
gQ Switch to Ex mode. This is like typing ":" commands
one after another, except:
- You don't have to keep pressing ":".
- The screen doesn't get updated after each command.

View File

@ -60,7 +60,7 @@ The example will:
return nil
end
local dir = bufname
-- Just in case our algo is buggy, don't infinite loop.
-- Just in case our algorithm is buggy, don't infinite loop.
for _ = 1, 100 do
local did_change
dir, did_change = dirname(dir)

View File

@ -214,7 +214,7 @@ For |lsp-request|, each |lsp-handler| has this signature: >
request, a table with information about the error
is sent. Otherwise, it is `nil`. See |lsp-response|.
{result} (Result | Params | nil)
When the language server is able to succesfully
When the language server is able to successfully
complete a request, this contains the `result` key
of the response. See |lsp-response|.
{ctx} (table)
@ -236,7 +236,7 @@ For |lsp-request|, each |lsp-handler| has this signature: >
{config} (table)
Configuration for the handler.
Each handler can define it's own configuration
Each handler can define its own configuration
table that allows users to customize the behavior
of a particular handler.
@ -274,7 +274,7 @@ For |lsp-notification|, each |lsp-handler| has this signature: >
{config} (table)
Configuration for the handler.
Each handler can define it's own configuration
Each handler can define its own configuration
table that allows users to customize the behavior
of a particular handler.
@ -355,8 +355,8 @@ To configure the behavior of a builtin |lsp-handler|, the convenient method
*lsp-handler-resolution*
Handlers can be set by:
- Setting a field in |vim.lsp.handlers|. *vim.lsp.handlers*
|vim.lsp.handlers| is a global table that contains the default mapping of
- Setting a field in vim.lsp.handlers. *vim.lsp.handlers*
vim.lsp.handlers is a global table that contains the default mapping of
|lsp-method| names to |lsp-handlers|.
To override the handler for the `"textDocument/definition"` method: >
@ -369,7 +369,7 @@ Handlers can be set by:
For example: >
vim.lsp.start_client {
..., -- Other configuration ommitted.
..., -- Other configuration omitted.
handlers = {
["textDocument/definition"] = my_custom_server_definition
},
@ -394,6 +394,9 @@ in the following order:
2. Handler defined in |vim.lsp.start_client()|, if any.
3. Handler defined in |vim.lsp.handlers|, if any.
*vim.lsp.log_levels*
Log levels are defined in |vim.log.levels|
VIM.LSP.PROTOCOL *vim.lsp.protocol*
@ -444,7 +447,7 @@ LspCodeLens
|nvim_buf_set_extmark()|.
LspCodeLensSeparator *hl-LspCodeLensSeparator*
Used to color the seperator between two or more code lens.
Used to color the separator between two or more code lens.
*lsp-highlight-signature*
@ -485,6 +488,16 @@ buf_attach_client({bufnr}, {client_id}) *vim.lsp.buf_attach_client()*
{bufnr} (number) Buffer handle, or 0 for current
{client_id} (number) Client id
buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()*
Detaches client from the specified buffer. Note: While the
server is notified that the text document (buffer) was closed,
it is still able to send notifications should it ignore this
notification.
Parameters: ~
{bufnr} number Buffer handle, or 0 for current
{client_id} number Client id
buf_get_clients({bufnr}) *vim.lsp.buf_get_clients()*
Gets a map of client_id:client pairs for the given buffer,
where each value is a |vim.lsp.client| object.
@ -550,7 +563,7 @@ buf_request_all({bufnr}, {method}, {params}, {callback})
Return: ~
(function) A function that will cancel all requests which
is the same as the one returned from `buf_request` .
is the same as the one returned from `buf_request`.
*vim.lsp.buf_request_sync()*
buf_request_sync({bufnr}, {method}, {params}, {timeout_ms})
@ -587,9 +600,9 @@ client() *vim.lsp.client*
{handler} is not specified, If one is not found there,
then an error will occur. Returns: {status},
{[client_id]}. {status} is a boolean indicating if the
notification was successful. If it is `false` , then it
notification was successful. If it is `false`, then it
will always be `false` (the client has shutdown). If
{status} is `true` , the function returns {request_id} as
{status} is `true`, the function returns {request_id} as
the second result. You can use this with
`client.cancel_request(request_id)` to cancel the request.
• request_sync(method, params, timeout_ms, bufnr) Sends a
@ -599,13 +612,13 @@ client() *vim.lsp.client*
`err` and `result` come from the |lsp-handler|. On
timeout, cancel or error, returns `(nil, err)` where `err`
is a string describing the failure reason. If the request
was unsuccessful returns `nil` .
was unsuccessful returns `nil`.
• notify(method, params) Sends a notification to an LSP
server. Returns: a boolean to indicate if the notification
was successful. If it is false, then it will always be
false (the client has shutdown).
• cancel_request(id) Cancels a request with a given request
id. Returns: same as `notify()` .
id. Returns: same as `notify()`.
• stop([force]) Stops a client, optionally with force. By
default, it will just ask the server to shutdown without
force. If you request to stop a client which has
@ -626,17 +639,23 @@ client() *vim.lsp.client*
interaction with the client. See |vim.lsp.rpc.start()|.
• {offset_encoding} (string): The encoding used for
communicating with the server. You can modify this in the
`config` 's `on_init` method before text is sent to the
`config`'s `on_init` method before text is sent to the
server.
• {handlers} (table): The handlers used by the client as
described in |lsp-handler|.
• {requests} (table): The current pending requests in flight
to the server. Entries are key-value pairs with the key
being the request ID while the value is a table with
`type`, `bufnr`, and `method` key-value pairs. `type` is
either "pending" for an active request, or "cancel" for a
cancel request.
• {config} (table): copy of the table that was passed by the
user to |vim.lsp.start_client()|.
• {server_capabilities} (table): Response from the server
sent on `initialize` describing the server's capabilities.
• {resolved_capabilities} (table): Normalized table of
capabilities that we have detected based on the initialize
response from the server in `server_capabilities` .
response from the server in `server_capabilities`.
client_is_stopped({client_id}) *vim.lsp.client_is_stopped()*
Checks whether a client is stopped.
@ -667,7 +686,11 @@ formatexpr({opts}) *vim.lsp.formatexpr()*
Provides an interface between the built-in client and a
`formatexpr` function.
Currently only supports a single client. This can be set via `setlocal formatexpr=v:lua.vim.lsp.formatexpr()` but will typically or in `on_attach` via vim.api.nvim_buf_set_option(bufnr, 'formatexpr , 'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')`.
Currently only supports a single client. This can be set via
`setlocal formatexpr=v:lua.vim.lsp.formatexpr()` but will
typically or in `on_attach` via
`vim.api.nvim_buf_set_option(bufnr, 'formatexpr',
'v:lua.vim.lsp.formatexpr(#{timeout_ms:250})')`.
Parameters: ~
{opts} table options for customizing the formatting
@ -730,8 +753,8 @@ omnifunc({findstart}, {base}) *vim.lsp.omnifunc()*
set_log_level({level}) *vim.lsp.set_log_level()*
Sets the global log level for LSP logging.
Levels by name: "trace", "debug", "info", "warn", "error"
Level numbers begin with "trace" at 0
Levels by name: "TRACE", "DEBUG", "INFO", "WARN", "ERROR"
Level numbers begin with "TRACE" at 0
Use `lsp.log_levels` for reverse lookup.
@ -756,7 +779,7 @@ start_client({config}) *vim.lsp.start_client()*
initiates the LSP client.
{cmd_cwd} (string, default=|getcwd()|)
Directory to launch the `cmd`
process. Not related to `root_dir` .
process. Not related to `root_dir`.
{cmd_env} (table) Environment flags to pass to
the LSP on spawn. Can be specified
using keys like a map or as a list
@ -781,15 +804,15 @@ start_client({config}) *vim.lsp.start_client()*
its result.
• Note: To send an empty dictionary
use
`{[vim.type_idx]=vim.types.dictionary}`
, else it will be encoded as an
`{[vim.type_idx]=vim.types.dictionary}`,
else it will be encoded as an
array.
{handlers} Map of language server method names
to |lsp-handler|
{settings} Map with language server specific
settings. These are returned to the
language server if requested via
`workspace/configuration` . Keys are
`workspace/configuration`. Keys are
case-sensitive.
{commands} table Table that maps string of
clientside commands to user-defined
@ -802,7 +825,7 @@ start_client({config}) *vim.lsp.start_client()*
action, code lenses, ...) triggers
the command.
{init_options} Values to pass in the initialization
request as `initializationOptions` .
request as `initializationOptions`.
See `initialize` in the LSP spec.
{name} (string, default=client-id) Name in
log messages.
@ -819,10 +842,10 @@ start_client({config}) *vim.lsp.start_client()*
throws an error. `code` is a number
describing the error. Other arguments
may be passed depending on the error
kind. See |vim.lsp.client_errors| for
possible errors. Use
`vim.lsp.client_errors[code]` to get
human-friendly name.
kind. See |vim.lsp.rpc.client_errors|
for possible errors. Use
`vim.lsp.rpc.client_errors[code]` to
get human-friendly name.
{before_init} Callback with parameters
(initialize_params, config) invoked
before the LSP "initialize" phase,
@ -957,7 +980,7 @@ code_action({context}) *vim.lsp.buf.code_action()*
• only: (string|nil) LSP `CodeActionKind` used
to filter the code actions. Most language
servers support values like `refactor` or
`quickfix` .
`quickfix`.
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_codeAction
@ -988,8 +1011,8 @@ definition() *vim.lsp.buf.definition()*
document_highlight() *vim.lsp.buf.document_highlight()*
Send request to the server to resolve document highlights for
the current text document position. This request can be
triggered by a key mapping or by events such as `CursorHold` ,
eg:
triggered by a key mapping or by events such as `CursorHold`,
e.g.:
>
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()
@ -1005,11 +1028,12 @@ document_symbol() *vim.lsp.buf.document_symbol()*
Lists all symbols in the current buffer in the quickfix
window.
execute_command({command}) *vim.lsp.buf.execute_command()*
execute_command({command_params}) *vim.lsp.buf.execute_command()*
Executes an LSP server command.
Parameters: ~
{command} A valid `ExecuteCommandParams` object
{command_params} table A valid `ExecuteCommandParams`
object
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_executeCommand
@ -1104,7 +1128,7 @@ range_code_action({context}, {start_pos}, {end_pos})
• only: (string|nil) LSP `CodeActionKind`
used to filter the code actions. Most
language servers support values like
`refactor` or `quickfix` .
`refactor` or `quickfix`.
{start_pos} ({number, number}, optional) mark-indexed
position. Defaults to the start of the last
visual selection.
@ -1205,8 +1229,8 @@ on_publish_diagnostics({_}, {result}, {ctx}, {config})
},
-- Use a function to dynamically turn signs off
-- and on, using buffer local variables
signs = function(bufnr, client_id)
return vim.bo[bufnr].show_signs == false
signs = function(namespace, bufnr)
return vim.b[bufnr].show_signs == true
end,
-- Disable a feature
update_in_insert = false,
@ -1226,8 +1250,8 @@ display({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.display()*
Display the lenses using virtual text
Parameters: ~
{lenses} table of lenses to display ( `CodeLens[] |
null` )
{lenses} table of lenses to display (`CodeLens[] |
null`)
{bufnr} number
{client_id} number
@ -1239,7 +1263,7 @@ get({bufnr}) *vim.lsp.codelens.get()*
current buffer.
Return: ~
table ( `CodeLens[]` )
table (`CodeLens[]`)
*vim.lsp.codelens.on_codelens()*
on_codelens({err}, {result}, {ctx}, {_})
@ -1261,8 +1285,8 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()*
Store lenses for a specific buffer and client
Parameters: ~
{lenses} table of lenses to store ( `CodeLens[] |
null` )
{lenses} table of lenses to store (`CodeLens[] |
null`)
{bufnr} number
{client_id} number
@ -1285,7 +1309,7 @@ hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()*
{config} table Configuration table.
• border: (default=nil)
• Add borders to the floating window
• See |vim.api.nvim_open_win()|
• See |nvim_open_win()|
*vim.lsp.handlers.signature_help()*
signature_help({_}, {result}, {ctx}, {config})
@ -1312,8 +1336,8 @@ signature_help({_}, {result}, {ctx}, {config})
Lua module: vim.lsp.util *lsp-util*
*vim.lsp.util.apply_text_document_edit()*
apply_text_document_edit({text_document_edit}, {index})
Applies a `TextDocumentEdit` , which is a list of changes to a
apply_text_document_edit({text_document_edit}, {index}, {offset_encoding})
Applies a `TextDocumentEdit`, which is a list of changes to a
single document.
Parameters: ~
@ -1326,22 +1350,24 @@ apply_text_document_edit({text_document_edit}, {index})
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentEdit
*vim.lsp.util.apply_text_edits()*
apply_text_edits({text_edits}, {bufnr})
apply_text_edits({text_edits}, {bufnr}, {offset_encoding})
Applies a list of text edits to a buffer.
Parameters: ~
{text_edits} table list of `TextEdit` objects
{bufnr} number Buffer id
{text_edits} table list of `TextEdit` objects
{bufnr} number Buffer id
{offset_encoding} string utf-8|utf-16|utf-32
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textEdit
*vim.lsp.util.apply_workspace_edit()*
apply_workspace_edit({workspace_edit})
Applies a `WorkspaceEdit` .
apply_workspace_edit({workspace_edit}, {offset_encoding})
Applies a `WorkspaceEdit`.
Parameters: ~
{workspace_edit} (table) `WorkspaceEdit`
{workspace_edit} table `WorkspaceEdit`
{offset_encoding} string utf-8|utf-16|utf-32 (required)
buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()*
Removes document highlights from a buffer.
@ -1358,49 +1384,40 @@ buf_highlight_references({bufnr}, {references}, {offset_encoding})
{references} table List of `DocumentHighlight`
objects to highlight
{offset_encoding} string One of "utf-8", "utf-16",
"utf-32", or nil. Defaults to utf-16
"utf-32".
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#documentHighlight
*vim.lsp.util.character_offset()*
character_offset({bufnr}, {row}, {col})
character_offset({buf}, {row}, {col}, {offset_encoding})
Returns the UTF-32 and UTF-16 offsets for a position in a
certain buffer.
Parameters: ~
{buf} buffer id (0 for current)
{row} 0-indexed line
{col} 0-indexed byte offset in line
{buf} buffer id (0 for current)
{row} 0-indexed line
{col} 0-indexed byte offset in line
{offset_encoding} string utf-8|utf-16|utf-32|nil defaults
to `offset_encoding` of first client of
`buf`
Return: ~
(number, number) UTF-32 and UTF-16 index of the character
(number, number) `offset_encoding` index of the character
in line {row} column {col} in buffer {buf}
*vim.lsp.util.close_preview_autocmd()*
close_preview_autocmd({events}, {winnr})
Creates autocommands to close a preview window when events
happen.
Parameters: ~
{events} (table) list of events
{winnr} (number) window id of preview window
See also: ~
|autocmd-events|
*vim.lsp.util.convert_input_to_markdown_lines()*
convert_input_to_markdown_lines({input}, {contents})
Converts any of `MarkedString` | `MarkedString[]` |
`MarkupContent` into a list of lines containing valid
markdown. Useful to populate the hover window for
`textDocument/hover` , for parsing the result of
`textDocument/signatureHelp` , and potentially others.
`textDocument/hover`, for parsing the result of
`textDocument/signatureHelp`, and potentially others.
Parameters: ~
{input} ( `MarkedString` | `MarkedString[]` |
`MarkupContent` )
{contents} (table, optional, default `{}` ) List of
{input} (`MarkedString` | `MarkedString[]` |
`MarkupContent`)
{contents} (table, optional, default `{}`) List of
strings to extend with converted lines
Return: ~
@ -1444,28 +1461,31 @@ extract_completion_items({result})
https://microsoft.github.io/language-server-protocol/specification#textDocument_completion
get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()*
Returns visual width of tabstop.
Returns indentation size.
Parameters: ~
{bufnr} (optional, number): Buffer handle, defaults to
current
Return: ~
(number) tabstop visual width
(number) indentation size
See also: ~
|softtabstop|
|shiftwidth|
jump_to_location({location}) *vim.lsp.util.jump_to_location()*
*vim.lsp.util.jump_to_location()*
jump_to_location({location}, {offset_encoding})
Jumps to a location.
Parameters: ~
{location} ( `Location` | `LocationLink` )
{location} table (`Location`|`LocationLink`)
{offset_encoding} string utf-8|utf-16|utf-32 (required)
Return: ~
`true` if the jump succeeded
locations_to_items({locations}) *vim.lsp.util.locations_to_items()*
*vim.lsp.util.locations_to_items()*
locations_to_items({locations}, {offset_encoding})
Returns the items with the byte position calculated correctly
and in sorted order, for display in quickfix and location
lists.
@ -1474,8 +1494,10 @@ locations_to_items({locations}) *vim.lsp.util.locations_to_items()*
|setqflist()| or |setloclist()|.
Parameters: ~
{locations} (table) list of `Location` s or
`LocationLink` s
{locations} table list of `Location`s or
`LocationLink`s
{offset_encoding} string offset_encoding for locations
utf-8|utf-16|utf-32
Return: ~
(table) list of items
@ -1507,7 +1529,7 @@ make_floating_popup_options({width}, {height}, {opts})
• border (string or table) override `border`
• focusable (string or table) override
`focusable`
• zindex (string or table) override `zindex` ,
• zindex (string or table) override `zindex`,
defaults to 50
Return: ~
@ -1528,47 +1550,73 @@ make_formatting_params({options})
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_formatting
*vim.lsp.util.make_given_range_params()*
make_given_range_params({start_pos}, {end_pos})
make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding})
Using the given range in the current buffer, creates an object
that is similar to |vim.lsp.util.make_range_params()|.
Parameters: ~
{start_pos} ({number, number}, optional) mark-indexed
position. Defaults to the start of the last
visual selection.
{end_pos} ({number, number}, optional) mark-indexed
position. Defaults to the end of the last
visual selection.
{start_pos} ({number, number}, optional)
mark-indexed position. Defaults to the
start of the last visual selection.
{end_pos} ({number, number}, optional)
mark-indexed position. Defaults to the
end of the last visual selection.
{bufnr} (optional, number): buffer handle or 0
for current, defaults to current
{offset_encoding} string utf-8|utf-16|utf-32|nil defaults
to `offset_encoding` of first client of
`bufnr`
Return: ~
{ textDocument = { uri = `current_file_uri` }, range = {
start = `start_position` , end = `end_position` } }
start = `start_position`, end = `end_position` } }
make_position_params() *vim.lsp.util.make_position_params()*
*vim.lsp.util.make_position_params()*
make_position_params({window}, {offset_encoding})
Creates a `TextDocumentPositionParams` object for the current
buffer and cursor position.
Parameters: ~
{window} (optional, number): window handle or 0
for current, defaults to current
{offset_encoding} string utf-8|utf-16|utf-32|nil defaults
to `offset_encoding` of first client of
buffer of `window`
Return: ~
`TextDocumentPositionParams` object
See also: ~
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocumentPositionParams
make_range_params() *vim.lsp.util.make_range_params()*
*vim.lsp.util.make_range_params()*
make_range_params({window}, {offset_encoding})
Using the current position in the current buffer, creates an
object that can be used as a building block for several LSP
requests, such as `textDocument/codeAction` ,
`textDocument/colorPresentation` ,
`textDocument/rangeFormatting` .
requests, such as `textDocument/codeAction`,
`textDocument/colorPresentation`,
`textDocument/rangeFormatting`.
Parameters: ~
{window} (optional, number): window handle or 0
for current, defaults to current
{offset_encoding} string utf-8|utf-16|utf-32|nil defaults
to `offset_encoding` of first client of
buffer of `window`
Return: ~
{ textDocument = { uri = `current_file_uri` }, range = {
start = `current_position` , end = `current_position` } }
start = `current_position`, end = `current_position` } }
make_text_document_params() *vim.lsp.util.make_text_document_params()*
*vim.lsp.util.make_text_document_params()*
make_text_document_params({bufnr})
Creates a `TextDocumentIdentifier` object for the current
buffer.
Parameters: ~
{bufnr} (optional, number): Buffer handle, defaults to
current
Return: ~
`TextDocumentIdentifier`
@ -1612,8 +1660,8 @@ open_floating_preview({contents}, {syntax}, {opts})
closes the floating window
• focusable: (boolean, default true) Make
float focusable
• focus: (boolean, default true) If `true` ,
and if {focusable} is also `true` , focus an
• focus: (boolean, default true) If `true`,
and if {focusable} is also `true`, focus an
existing floating window with the same
{focus_id}
@ -1712,7 +1760,7 @@ text_document_completion_list_to_complete_items({result}, {prefix})
Parameters: ~
{result} The result of a `textDocument/completion` call,
e.g. from |vim.lsp.buf.completion()|, which may
be one of `CompletionItem[]` , `CompletionList`
be one of `CompletionItem[]`, `CompletionList`
or `null`
{prefix} (string) the prefix to filter the completion
items
@ -1909,14 +1957,14 @@ make_client_capabilities()
*vim.lsp.protocol.resolve_capabilities()*
resolve_capabilities({server_capabilities})
`*` to match one or more characters in a path segment `?` to
match on one character in a path segment `**` to match any
number of path segments, including none `{}` to group
conditions (e.g. `**/*.{ts,js}` matches all TypeScript and
JavaScript files) `[]` to declare a range of characters to
match in a path segment (e.g., `example.[0-9]` to match on
`example.0` , `example.1` , …) `[!...]` to negate a range of
characters to match in a path segment (e.g., `example.[!0-9]`
to match on `example.a` , `example.b` , but not `example.0` )
Creates a normalized object describing LSP server
capabilities.
Parameters: ~
{server_capabilities} table Table of capabilities
supported by the server
Return: ~
table Normalized table of capabilities
vim:tw=78:ts=8:ft=help:norl:

View File

@ -17,23 +17,48 @@ an idea of what lurks beneath: >
:lua print(vim.inspect(package.loaded))
Nvim includes a "standard library" |lua-stdlib| for Lua. It complements the
"editor stdlib" (|functions| and Ex commands) and the |API|, all of which can
be used from Lua code. A good overview of using Lua in neovim is given by
https://github.com/nanotee/nvim-lua-guide.
"editor stdlib" (|builtin-functions| and Ex commands) and the |API|, all of
which can be used from Lua code. A good overview of using Lua in neovim is
given by https://github.com/nanotee/nvim-lua-guide.
Module conflicts are resolved by "last wins". For example if both of these
are on 'runtimepath':
runtime/lua/foo.lua
~/.config/nvim/lua/foo.lua
then `require('foo')` loads "~/.config/nvim/lua/foo.lua", and
"runtime/lua/foo.lua" is not used. See |lua-require| to understand how Nvim
finds and loads Lua modules. The conventions are similar to those of
Vimscript |plugin|s, with some extra features. See |lua-require-example| for
a walkthrough.
The |:source| and |:runtime| commands can run Lua scripts as well as Vim
scripts. Lua modules can be loaded with `require('name')`, which
conventionally returns a table but can return any value.
See |lua-require| for details on how Nvim finds and loads Lua modules.
See |lua-require-example| for an example of how to write and use a module.
==============================================================================
IMPORTING LUA MODULES *lua-require*
Modules are searched for under the directories specified in 'runtimepath', in
the order they appear. Any `.` in the module name is treated as a directory
separator when searching. For a module `foo.bar`, each directory is searched
for `lua/foo/bar.lua`, then `lua/foo/bar/init.lua`. If no files are found,
the directories are searched again for a shared library with a name matching
`lua/foo/bar.?`, where `?` is a list of suffixes (such as `so` or `dll`)
derived from the initial value of `package.cpath`. If still no files are
found, Nvim falls back to Lua's default search mechanism. The first script
found is run and `require()` returns the value returned by the script if any,
else `true`.
The return value is cached after the first call to `require()` for each
module, with subsequent calls returning the cached value without searching for
or executing any script. For further details on `require()`, see the Lua
documentation at https://www.lua.org/manual/5.1/manual.html#pdf-require.
For example, if 'runtimepath' is `foo,bar` and `package.cpath` was
`./?.so;./?.dll` at startup, `require('mod')` searches these paths in order
and loads the first module found:
foo/lua/mod.lua
foo/lua/mod/init.lua
bar/lua/mod.lua
bar/lua/mod/init.lua
foo/lua/mod.so
foo/lua/mod.dll
bar/lua/mod.so
bar/lua/mod.dll
*lua-package-path*
Nvim automatically adjusts `package.path` and `package.cpath` according to
effective 'runtimepath' value. Adjustment happens whenever 'runtimepath' is
@ -249,13 +274,15 @@ arguments separated by " " (space) instead of "\t" (tab).
*:lua*
:[range]lua {chunk}
Executes Lua chunk {chunk}.
if {chunk} starts with "=" the rest of the chunk is
evaluated as an expression and printed. `:lua =expr`
is equivalent to `:lua print(vim.inspect(expr))`
Examples: >
:lua vim.api.nvim_command('echo "Hello, Nvim!"')
< To see the Lua version: >
:lua print(_VERSION)
< To see the LuaJIT version: >
:lua print(jit.version)
:lua =jit.version
<
*:lua-heredoc*
:[range]lua << [endmarker]
@ -272,7 +299,7 @@ arguments separated by " " (space) instead of "\t" (tab).
lua << EOF
local linenr = vim.api.nvim_win_get_cursor(0)[1]
local curline = vim.api.nvim_buf_get_lines(
0, linenr, linenr + 1, false)[1]
0, linenr - 1, linenr, false)[1]
print(string.format("Current line [%d] has %d bytes",
linenr, #curline))
EOF
@ -566,6 +593,26 @@ Example: TCP echo-server *tcp-server*
end)
print('TCP echo-server listening on port: '..server:getsockname().port)
Multithreading *lua-loop-threading*
Plugins can perform work in separate (os-level) threads using the threading
APIs in luv, for instance `vim.loop.new_thread`. Note that every thread
gets its own separate lua interpreter state, with no access to lua globals
in the main thread. Neither can the state of the editor (buffers, windows,
etc) be directly accessed from threads.
A subset of the `vim.*` API is available in threads. This includes:
- `vim.loop` with a separate event loop per thread.
- `vim.mpack` and `vim.json` (useful for serializing messages between threads)
- `require` in threads can use lua packages from the global |lua-package-path|
- `print()` and `vim.inspect`
- `vim.diff`
- most utility functions in `vim.*` for working with pure lua values
like `vim.split`, `vim.tbl_*`, `vim.list_*`, and so on.
- `vim.is_thread()` returns true from a non-main thread.
------------------------------------------------------------------------------
VIM.HIGHLIGHT *lua-highlight*
@ -593,13 +640,33 @@ vim.highlight.on_yank({opts}) *vim.highlight.on_yank()*
- {on_visual} highlight when yanking visual selection (default `true`)
- {event} event structure (default |v:event|)
vim.highlight.range({bufnr}, {ns}, {higroup}, {start}, {finish}, {rtype}, {inclusive})
vim.highlight.range({bufnr}, {ns}, {hlgroup}, {start}, {finish}, {opts})
*vim.highlight.range()*
Highlights the range between {start} and {finish} (tuples of {line,col})
in buffer {bufnr} with the highlight group {higroup} using the namespace
{ns}. Optional arguments are the type of range (characterwise, linewise,
or blockwise, see |setreg|; default to characterwise) and whether the
range is inclusive (default false).
Apply highlight group to range of text.
Parameters: ~
{bufnr} buffer number
{ns} namespace for highlights
{hlgroup} highlight group name
{start} starting position (tuple {line,col})
{finish} finish position (tuple {line,col})
{opts} optional parameters:
• `regtype`: type of range (characterwise, linewise,
or blockwise, see |setreg|), default `'v'`
• `inclusive`: range includes end position, default
`false`
• `priority`: priority of highlight, default
`vim.highlight.user` (see below)
vim.highlight.priorities *vim.highlight.priorities*
Table with default priorities used for highlighting:
• `syntax`: `50`, used for standard syntax highlighting
• `treesitter`: `100`, used for tree-sitter-based highlighting
• `diagnostics`: `150`, used for code analysis such as diagnostics
• `user`: `200`, used for user-triggered highlights such as LSP
document symbols or `on_yank` autocommands
------------------------------------------------------------------------------
VIM.REGEX *lua-regex*
@ -707,6 +774,38 @@ vim.mpack.encode({obj}) *vim.mpack.encode*
vim.mpack.decode({str}) *vim.mpack.decode*
Decodes (or "unpacks") the msgpack-encoded {str} to a Lua object.
------------------------------------------------------------------------------
VIM.SPELL *lua-spell*
vim.spell.check({str}) *vim.spell.check()*
Check {str} for spelling errors. Similar to the Vimscript function
|spellbadword()|.
Note: The behaviour of this function is dependent on: 'spelllang',
'spellfile', 'spellcapcheck' and 'spelloptions' which can all be local
to the buffer. Consider calling this with |nvim_buf_call()|.
Example: >
vim.spell.check("the quik brown fox")
-->
{
{'quik', 'bad', 4}
}
<
Parameters: ~
{str} String to spell check.
Return: ~
List of tuples with three items:
- The badly spelled word.
- The type of the spelling error:
"bad" spelling mistake
"rare" rare word
"local" word only valid in another region
"caps" word should start with Capital
- The position in {str} where the word begins.
------------------------------------------------------------------------------
VIM *lua-builtin*
@ -759,9 +858,9 @@ vim.stricmp({a}, {b}) *vim.stricmp()*
respectively.
vim.str_utfindex({str}[, {index}]) *vim.str_utfindex()*
Convert byte index to UTF-32 and UTF-16 indicies. If {index} is not
supplied, the length of the string is used. All indicies are zero-based.
Returns two values: the UTF-32 and UTF-16 indicies respectively.
Convert byte index to UTF-32 and UTF-16 indices. If {index} is not
supplied, the length of the string is used. All indices are zero-based.
Returns two values: the UTF-32 and UTF-16 indices respectively.
Embedded NUL bytes are treated as terminating the string. Invalid
UTF-8 bytes, and embedded surrogates are counted as one code
@ -881,6 +980,15 @@ vim.types *vim.types*
`vim.types.dictionary` will not change or that `vim.types` table will
only contain values for these three types.
*log_levels* *vim.log.levels*
Log levels are one of the values defined in `vim.log.levels`:
vim.log.levels.DEBUG
vim.log.levels.ERROR
vim.log.levels.INFO
vim.log.levels.TRACE
vim.log.levels.WARN
------------------------------------------------------------------------------
LUA-VIMSCRIPT BRIDGE *lua-vimscript*
@ -1000,7 +1108,7 @@ from within Lua.
`vim.opt.wildignore = '*.o,*.a,__pycache__'`
However, vim.opt also supports a more elegent way of setting
list-style options, but using lua tables:
list-style options by using lua tables:
`vim.opt.wildignore = { '*.o', '*.a', '__pycache__' }`
To replicate the behavior of |:set+=|, use: >
@ -1043,7 +1151,7 @@ In any of the above examples, to replicate the behavior |setlocal|, use
|vim.opt| returns an Option object.
For example: `local listchar_object = vim.opt.listchar`
For example: `local listchar_object = vim.opt.listchars`
An `Option` has the following methods:
@ -1176,6 +1284,10 @@ vim.wo *vim.wo*
==============================================================================
Lua module: vim *lua-vim*
*vim.connection_failure_errmsg()*
connection_failure_errmsg({consequence})
TODO: Documentation
defer_fn({fn}, {timeout}) *vim.defer_fn()*
Defers calling `fn` until `timeout` ms passes.
@ -1197,19 +1309,32 @@ inspect({object}, {options}) *vim.inspect()*
https://github.com/kikito/inspect.lua
https://github.com/mpeterv/vinspect
notify({msg}, {log_level}, {opts}) *vim.notify()*
Notification provider
notify({msg}, {level}, {opts}) *vim.notify()*
Display a notification to the user.
Without a runtime, writes to :Messages
This function can be overridden by plugins to display
notifications using a custom provider (such as the system
notification provider). By default, writes to |:messages|.
Parameters: ~
{msg} string Content of the notification to show to
the user
{log_level} number|nil enum from vim.log.levels
{opts} table|nil additional options (timeout, etc)
{msg} string Content of the notification to show to the
user.
{level} number|nil One of the values from
|vim.log.levels|.
{opts} table|nil Optional parameters. Unused by default.
See also: ~
:help nvim_notify
notify_once({msg}, {level}, {opts}) *vim.notify_once()*
Display a notification only one time.
Like |vim.notify()|, but subsequent calls with the same
message will not display a notification.
Parameters: ~
{msg} string Content of the notification to show to the
user.
{level} number|nil One of the values from
|vim.log.levels|.
{opts} table|nil Optional parameters. Unused by default.
on_key({fn}, {ns_id}) *vim.on_key()*
Adds Lua function {fn} with namespace id {ns_id} as a listener
@ -1273,6 +1398,18 @@ paste({lines}, {phase}) *vim.paste()*
See also: ~
|paste|
pretty_print({...}) *vim.pretty_print()*
Prints given arguments in human-readable format. Example: >
-- Print highlight group Normal and store it's contents in a variable.
local hl_normal = vim.pretty_print(vim.api.nvim_get_hl_by_name("Normal", true))
<
Return: ~
given arguments.
See also: ~
|vim.inspect()|
region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()*
Get a table of lines with start, end columns for a region
marked by two points
@ -1310,7 +1447,7 @@ deep_equal({a}, {b}) *vim.deep_equal()*
{b} second value
Return: ~
`true` if values are equals, else `false` .
`true` if values are equals, else `false`.
deepcopy({orig}) *vim.deepcopy()*
Returns a deep copy of the given object. Non-table objects are
@ -1327,7 +1464,7 @@ deepcopy({orig}) *vim.deepcopy()*
New table of copied keys and (nested) values.
endswith({s}, {suffix}) *vim.endswith()*
Tests if `s` ends with `suffix` .
Tests if `s` ends with `suffix`.
Parameters: ~
{s} (string) a string
@ -1431,7 +1568,7 @@ split({s}, {sep}, {kwargs}) *vim.split()*
|vim.gsplit()|
startswith({s}, {prefix}) *vim.startswith()*
Tests if `s` starts with `prefix` .
Tests if `s` starts with `prefix`.
Parameters: ~
{s} (string) a string
@ -1442,13 +1579,13 @@ startswith({s}, {prefix}) *vim.startswith()*
tbl_add_reverse_lookup({o}) *vim.tbl_add_reverse_lookup()*
Add the reverse lookup values to an existing table. For
example: tbl_add_reverse_lookup { A = 1 } == { [1] = 'A , A = 1 }`
example: `tbl_add_reverse_lookup { A = 1 } == { [1] = 'A', A = 1 }`
Parameters: ~
{o} table The table to add the reverse to.
tbl_contains({t}, {value}) *vim.tbl_contains()*
Checks if a list-like (vector) table contains `value` .
Checks if a list-like (vector) table contains `value`.
Parameters: ~
{t} Table to check
@ -1458,7 +1595,7 @@ tbl_contains({t}, {value}) *vim.tbl_contains()*
true if `t` contains `value`
tbl_count({t}) *vim.tbl_count()*
Counts the number of non-nil values in table `t` .
Counts the number of non-nil values in table `t`.
>
vim.tbl_count({ a=1, b=2 }) => 2
@ -1522,6 +1659,22 @@ tbl_flatten({t}) *vim.tbl_flatten()*
See also: ~
From https://github.com/premake/premake-core/blob/master/src/base/table.lua
tbl_get({o}, {...}) *vim.tbl_get()*
Index into a table (first argument) via string keys passed as
subsequent arguments. Return `nil` if the key does not exist. Examples: >
vim.tbl_get({ key = { nested_key = true }}, 'key', 'nested_key') == true
vim.tbl_get({ key = {}}, 'key', 'nested_key') == nil
<
Parameters: ~
{o} Table to index
{...} Optional strings (0 or more, variadic) via which to
index the table
Return: ~
nested value indexed by key if it exists, else nil
tbl_isempty({t}) *vim.tbl_isempty()*
Checks if a table is empty.
@ -1543,7 +1696,7 @@ tbl_islist({t}) *vim.tbl_islist()*
{t} Table
Return: ~
`true` if array-like table, else `false` .
`true` if array-like table, else `false`.
tbl_keys({t}) *vim.tbl_keys()*
Return a list of all keys used in a table. However, the order
@ -1615,16 +1768,25 @@ validate({opt}) *vim.validate()*
=> error('arg1: expected even number, got 3')
<
If multiple types are valid they can be given as a list. >
vim.validate{arg1={{'foo'}, {'table', 'string'}}, arg2={'foo', {'table', 'string'}}}
=> NOP (success)
vim.validate{arg1={1, {'string', table'}}}
=> error('arg1: expected string|table, got number')
<
Parameters: ~
{opt} Map of parameter names to validations. Each key is
a parameter name; each value is a tuple in one of
these forms:
{opt} table of parameter names to validations. Each key
is a parameter name; each value is a tuple in one
of these forms:
1. (arg_value, type_name, optional)
• arg_value: argument value
• type_name: string type name, one of: ("table",
"t", "string", "s", "number", "n", "boolean",
"b", "function", "f", "nil", "thread",
"userdata")
• type_name: string|table type name, one of:
("table", "t", "string", "s", "number", "n",
"boolean", "b", "function", "f", "nil",
"thread", "userdata") or list of them.
• optional: (optional) boolean, if true, `nil`
is valid
@ -1686,10 +1848,17 @@ Lua module: ui *lua-ui*
input({opts}, {on_confirm}) *vim.ui.input()*
Prompts the user for input
Example: >
vim.ui.input({ prompt = 'Enter value for shiftwidth: ' }, function(input)
vim.o.shiftwidth = tonumber(input)
end)
<
Parameters: ~
{opts} table Additional options. See |input()|
• prompt (string|nil) Text of the prompt.
Defaults to `Input:` .
Defaults to `Input:`.
• default (string|nil) Default reply to the
input
• completion (string|nil) Specifies type of
@ -1709,6 +1878,22 @@ select({items}, {opts}, {on_choice}) *vim.ui.select()*
Prompts the user to pick a single item from a collection of
entries
Example: >
vim.ui.select({ 'tabs', 'spaces' }, {
prompt = 'Select tabs or spaces:',
format_item = function(item)
return "I'd like to choose " .. item
end,
}, function(choice)
if choice == 'spaces' then
vim.o.expandtab = true
else
vim.o.expandtab = false
end
end)
<
Parameters: ~
{items} table Arbitrary items
{opts} table Additional options
@ -1716,16 +1901,169 @@ select({items}, {opts}, {on_choice}) *vim.ui.select()*
Defaults to `Select one of:`
• format_item (function item -> text)
Function to format an individual item from
`items` . Defaults to `tostring` .
`items`. Defaults to `tostring`.
• kind (string|nil) Arbitrary hint string
indicating the item shape. Plugins
reimplementing `vim.ui.select` may wish to
use this to infer the structure or
semantics of `items` , or the context in
semantics of `items`, or the context in
which select() was called.
{on_choice} function ((item|nil, idx|nil) -> ()) Called
once the user made a choice. `idx` is the
1-based index of `item` within `item` . `nil`
1-based index of `item` within `items`. `nil`
if the user aborted the dialog.
==============================================================================
Lua module: filetype *lua-filetype*
add({filetypes}) *vim.filetype.add()*
Add new filetype mappings.
Filetype mappings can be added either by extension or by
filename (either the "tail" or the full file path). The full
file path is checked first, followed by the file name. If a
match is not found using the filename, then the filename is
matched against the list of patterns (sorted by priority)
until a match is found. Lastly, if pattern matching does not
find a filetype, then the file extension is used.
The filetype can be either a string (in which case it is used
as the filetype directly) or a function. If a function, it
takes the full path and buffer number of the file as arguments
(along with captures from the matched pattern, if any) and
should return a string that will be used as the buffer's
filetype.
Filename patterns can specify an optional priority to resolve
cases when a file path matches multiple patterns. Higher
priorities are matched first. When omitted, the priority
defaults to 0.
See $VIMRUNTIME/lua/vim/filetype.lua for more examples.
Note that Lua filetype detection is only enabled when
|g:do_filetype_lua| is set to 1.
Example: >
vim.filetype.add({
extension = {
foo = "fooscript",
bar = function(path, bufnr)
if some_condition() then
return "barscript"
end
return "bar"
end,
},
filename = {
[".foorc"] = "toml",
["/etc/foo/config"] = "toml",
},
pattern = {
[".*&zwj;/etc/foo/.*"] = "fooscript",
-- Using an optional priority
[".*&zwj;/etc/foo/.*%.conf"] = { "dosini", { priority = 10 } },
["README.(%a+)$"] = function(path, bufnr, ext)
if ext == "md" then
return "markdown"
elseif ext == "rst" then
return "rst"
end
end,
},
})
<
Parameters: ~
{filetypes} table A table containing new filetype maps
(see example).
match({name}, {bufnr}) *vim.filetype.match()*
Set the filetype for the given buffer from a file name.
Parameters: ~
{name} string File name (can be an absolute or relative
path)
{bufnr} number|nil The buffer to set the filetype for.
Defaults to the current buffer.
==============================================================================
Lua module: keymap *lua-keymap*
del({modes}, {lhs}, {opts}) *vim.keymap.del()*
Remove an existing mapping. Examples: >
vim.keymap.del('n', 'lhs')
vim.keymap.del({'n', 'i', 'v'}, '<leader>w', { buffer = 5 })
<
Parameters: ~
{opts} table A table of optional arguments:
• buffer: (number or boolean) Remove a mapping
from the given buffer. When "true" or 0, use the
current buffer.
See also: ~
|vim.keymap.set()|
set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
Add a new |mapping|. Examples: >
-- Can add mapping to Lua functions
vim.keymap.set('n', 'lhs', function() print("real lua function") end)
-- Can use it to map multiple modes
vim.keymap.set({'n', 'v'}, '<leader>lr', vim.lsp.buf.references, { buffer=true })
-- Can add mapping for specific buffer
vim.keymap.set('n', '<leader>w', "<cmd>w<cr>", { silent = true, buffer = 5 })
-- Expr mappings
vim.keymap.set('i', '<Tab>', function()
return vim.fn.pumvisible() == 1 and "<C-n>" or "<Tab>"
end, { expr = true })
-- <Plug> mappings
vim.keymap.set('n', '[%', '<Plug>(MatchitNormalMultiBackward)')
<
Note that in a mapping like: >
vim.keymap.set('n', 'asdf', require('jkl').my_fun)
<
the `require('jkl')` gets evaluated during this call in order to access the
function. If you want to avoid this cost at startup you can
wrap it in a function, for example: >
vim.keymap.set('n', 'asdf', function() return require('jkl').my_fun() end)
<
Parameters: ~
{mode} string|table Same mode short names as
|nvim_set_keymap()|. Can also be list of modes to
create mapping on multiple modes.
{lhs} string Left-hand side |{lhs}| of the mapping.
{rhs} string|function Right-hand side |{rhs}| of the
mapping. Can also be a Lua function. If a Lua
function and `opts.expr == true`, returning `nil`
is equivalent to an empty string.
{opts} table A table of |:map-arguments| such as
"silent". In addition to the options listed in
|nvim_set_keymap()|, this table also accepts the
following keys:
• replace_keycodes: (boolean, default true) When
both this and expr is "true",
|nvim_replace_termcodes()| is applied to the
result of Lua expr maps.
• remap: (boolean) Make the mapping recursive.
This is the inverse of the "noremap" option from
|nvim_set_keymap()|. Default `false`.
See also: ~
|nvim_set_keymap()|
vim:tw=78:ts=8:ft=help:norl:

Some files were not shown because too many files have changed in this diff Show More