Make the 'scrollback' option work like most other buffer-local options:
- `:set scrollback=x` sets the global and local value
- `:setglobal scrollback=x` sets only the global default
- new terminal buffers inherit the global
Normal buffers are still always -1, and :setlocal there is an error.
Closes#6337
The comment is incorrect, s:error does need to be called. I thought the
call was unnecessary because it didn't show any message for me but I had
shortmess+=F which was hiding the message.
Problem: It is not possible to use plugins in an "after" directory to tune
the behavior of a package.
Solution: First load plugins from non-after directories, then packages and
finally plugins in after directories.
Reset 'loadplugins' before executing --cmd arguments.
66459b7c98
vim-patch:7.4.2172
vim-patch:7.4.2169
vim-patch:7.4.2177
vim-patch:7.4.2178
vim-patch:7.4.2184
vim-patch:8.0.0050
vim-patch:8.0.0105
vim-patch:8.0.0400
vim-patch:8.0.0405
Closes#6034
Problem: There is no easy way to stop all timers. There is no way to
temporary pause a timer.
Solution: Add timer_stopall() and timer_pause().
b73598e2f0
Problem: 'formatprg' is a global option but the value may depend on the
type of buffer. (Sung Pae)
Solution: Make 'formatprg' global-local. (closesvim/vim#1380)
9be7c04e6c
- Vim "unix default" of 'noshowcmd' is serving few users. And it's
inconsistent.
- 'ruler' and 'belloff=all' improve the out-of-the-box experience.
- Continue to use 'noshowcmd' and 'noruler' by default in the functional
tests to keep them fast.
TODO: Add a "disable slow stuff" command or mapping to address the
use-case of a very slow terminal connection.
Dispense with the FuncUndefined/CmdUndefined quasi-optimization.
If there are no rplugins, plugin/rplugin.vim takes less than 1ms.
Closes#5821Closes#6250
Helped-by: Qiming zhao <chemzqm@gmail.com>
Do this on all systems, so that portable builds work everywhere. This
allows us to ship archives with this folder structure:
bin/nvim
share/nvim/runtime
then ./bin/nvim works without the user needing to explicitly set VIMRUNTIME.
It's important that users have a single, easy-to-remember place for
reading about the API. So this commit changes gen_api_vimdoc.py so that
the generated section is appended to api.txt instead of creating
a separate document.
Also remove the section numbering and ToC: it's a maintenance cost, and
it will be unnecessary when #5169 is integrated.
Let the terminal dictate the normal-mode cursor position. This will be
disorienting sometimes, but it is closer to what users expect vs always
going to the last line.
Problem: Man test fails when run with the GUI.
Solution: Adjust for different behavior of GUI. Add assert_inrange().
61c04493b0
Only changes related to assert_inrange() were included, since we have a
distinct man plugin.
Problem: Values for true and false can be confusing.
Solution: Update the documentation. Add a test. Make v:true evaluate to
TRUE for a non-zero-arg.
e381d3d5e0
Problem: Cannot get all information about a quickfix list.
Solution: Add an optional argument to get/set loc/qf list(). (Yegappan
Lakshmanan)
d823fa910c
Problem: There is no equivalent of 'smartcase' for a tag search.
Solution: Add value "followscs" and "smart" to 'tagcase'. (Christian
Brabandt, closesvim/vim#712) Turn tagcase test into new style.
66e29d7112
The "technically correct" interpretation is to execute the first line
that is seen (and this is what happens on middle-click paste in Vim).
^M is only intended to "defuse" the newline, so the user can review it.
The parent commit changed the behavior to insert <Space> between lines,
but that's a higher-risk change: it is arguably possible that some user
*wants* the literal ^M chars when e.g. assigning to a register:
:let @a='<C-R>b'
To avoid that risk, keep the old behavior and only omit the last ^M.
This makes `yy:<C-R>0` nicer at no cost.
^M isn't any more "correct" than space: the "technically correct"
interpretation is to execute the first line that is seen (and this is
what happens on middle-click paste in Vim). ^M is only intended to
defuse the newline, so that the user can review the command. We can do
that with a space instead, and then the command can be executed without
having to fix it up first.
Problem: Using function() with a name will find another function when it is
redefined.
Solution: Add funcref(). Refer to lambda using a partial. Fix several
reference counting issues.
437bafe4c8
Problem: User defined functions can't be a closure.
Solution: Add the "closure" argument. Allow using :unlet on a bound
variable. (Yasuhiro Matsumoto, Ken Takata)
10ce39a0d5
Problem: Using submatch() in a lambda passed to substitute() is verbose.
Solution: Use a static list and pass it as an optional argument to the
function. Fix memory leak.
df48fb456f
Problem: filter() and map() either require a string or defining a function.
Solution: Support lambda, a short way to define a function that evaluates an
expression. (Yasuhiro Matsumoto, Ken Takata)
069c1e7fa9
Problem: Cannot detect a crash in tests when caused by garbagecollect().
Solution: Add garbagecollect_for_testing(). Do not free a job if is still
useful.
ebf7dfa6f1
The exists('g:loaded_foo') convention is rather common, and may be
relied upon in some cases. It's also very unlikely that a user or plugin
has any reason to set g:loaded_foo to zero, so the principle of least
surprise can be brushed aside here.
https://github.com/neovim/neovim/issues/6107#issuecomment-279532143
This allows executables to be found by :!, system(), and executable() if
they live next to ("sibling" to) nvim.exe. This is what gvim on Windows
does, and also matches the behavior of Win32 SearchPath().
c4a249a736/src/os_win32.c (L354-L370)
Closes#3689
cmake: Add `desktop-install` and `icon-install` targets. `runtime`
target will trigger them.
Specification:
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys
Icons are stored system-wide in /usr/share/applications or user wide at
/usr/share/icons/hicolor/scalable/apps and can be overriden in ~/.local/share/icons
nvim.desktop file can be installed system wide or in
~/.local/share/applications/
To test without an installer:
$ xdg-desktop-menu install --novendor runtime/nvim.desktop
$ xdg-icon-resource install --novendor --mode user --size 64 contrib/nvim-icon.png
Once it is installed, you can test with gtk-launch if installed or
dmenu/rofi (drun mode)
This default causes too much confusion for terminal users. Until
a better approach is implemented, revert to the traditional default.
Better solution would be:
- Implement a right-click menu for TUI
- Set 'mouse=a' *only* if clipboard is working.
Closes#5938
Since `curl -s` is used, the actual error (e.g. "curl: (6) Could not
resolve host: pypi.python.org") gets not reported anyway, and s:download
returns an error message with `s:shell_error` already.
This changes `s:download` to also include `a:url` in the error message
now.
It removes
> ERROR: Command error (7) curl -sL https://pypi.python.org/pypi/neovim/json:
And changes
> ERROR: HTTP request failed: error: curl error with https://pypi.python.org/pypi/neovim/json: 6
This helps to identify where the `neovim` module is coming from, e.g.
- INFO: python3-neovim version: 0.1.10 (outdated; from ~/Vcs/neovim-python-client/neovim)
- WARNING: Latest python3-neovim is NOT installed: 0.1.12
- s:version_info: return errors from the `import`
- skip report_ok for latest version, in case the current version was
not found. status contains the error that has been reported in that
case already.
* health: Handle backslash path separators.
* health: brevity, consistency
* health: Do not set bufhidden=wipe.
In the context of CheckHealth, bufhidden=wipe loses data for no reason.
I gone through every single line, renamed the variables to be more consistent
and reordered many lines. Information is now printed as soon as it's available
and errors lead to early returns.
I altered the suggestions for each condition to be more precise and checked that
they fail properly.
This also prevents invalid arguments getting passed to s:version_cmp().
- Eliminate global test_autochdir.
- Eliminate VimL function test_autochdir()
- Use a lua test instead. Fails correctly after reverting
0c43479979 / vim-patch:7.4.2015.
Problem: getwininfo() and getbufinfo() are inefficient.
Solution: Do not make a copy of all window/buffer-local options. Make it
possible to get them with gettabwinvar() or getbufvar().
3056735ae8
Problem: The field names used by getbufinfo(), gettabinfo() and
getwininfo() are not consistent.
Solution: Use bufnr, winnr and tabnr. (Yegappan Lakshmanan)
3392883770
Problem: It's not easy to find out if a window is a quickfix or location
list window.
Solution: Add "loclist" and "quickfix" entries to the dict returnec by
getwininfo(). (Yegappan Lakshmanan)
386600f0cb
Problem: It is not easy to get information about buffers, windows and
tabpages.
Solution: Add getbufinfo(), getwininfo() and gettabinfo(). (Yegappan
Lakshmanan)
b5ae48e9ff
- Improves compatibility with shell=tcsh.
- man.vim: split read_page into get_page, put_page. Do not split the
window until we know there is going to be output.
Problem: When using a partial on a dictionary it always gets bound to that
dictionary.
Solution: Make a difference between binding a function to a dictionary
explicitly or automatically.
1d429610bf
This ameliorates use-cases like:
:!cat foo.txt
:make
where the user is interested in the last few lines of output.
Try these shell-based ex-commands before/after this commit:
:grep -r '' *
:make
:!yes
:!grep -r '' *
:!git grep ''
:!cat foo
:!echo foo
:!while true; do date; done
:!for i in `seq 1 20000`; do echo XXXXXXXXXX $i; done
In all cases the last few lines of the command should always be shown,
regardless of where throttling was triggered.
Periodically skip :! spam. This is a "cheat" that works for all UIs and greatly
improves responsiveness when :! spams MB or GB of output:
:!yes
:!while true; do date; done
:!git grep ''
:grep -r '' *
After ~10KB of data is seen from a single :! invocation, output will be skipped
for ~1s and three dots "..." will pulse in the bottom-left. Thereafter the
behavior alternates at every:
* 10KB received
* ~1s throttled
This also avoids out-of-memory which could happen with large :! outputs.
Note: This commit does not change the behavior of execute(':!foo').
execute(':!foo') returns the string ':!foo^M', it captures *only* Vim
messages, *not* shell command output. Vim behaves the same way.
Use system('foo') for capturing shell command output.
Closes#1234
Helped-by: oni-link <knil.ino@gmail.com>
- By re-enabling code blocks (every line that doesn't begin with a "-" and is
indented by at least 4 spaces), we prevent the Markdown syntax to evaluate "_"
as beginning for italic text.
That's the case for `:CheckHealth deoplete` for instance. It would output:
$ cat /tmp/log_{PID}
Since the deoplete check gets run first, almost all of the following
`:CheckHealth` output would be italic.
- Since we re-enable code blocks, we now have to tell our custom syntax that it
can be part of markdownCodeBlock as well. Otherwise there would be no
highlithing for our keywords ERROR, INFO, etc. after 4 spaces of indent.
- Since we do the above anyway, we make it work for mkdListItemLine as well.
That's a highlight group from `plasticboy/vim-markdown` opposed to the shipped
markdown syntax (which essentially is `tpope/vim-markdown`). Before this patch
there was no highlighting at all in the `:CheckHealth` output.
This option simplifies the configuration options:
1) `g:python{,3}_host_prog` is not set.
Neovim tries its best to find a suitable interpreter. This means calling
exepath(), potentially multiple times, and a system('python -c ...') with
the first found interpreter, to get the Python version.
2) `g:python{,3}_host_prog` is set.
Avoids everything of the above. No safety checks, no training wheels. Fast
host startup time!
Many people have `runtime ftplugin/man.vim` in their init file, as was
required in Vim to have the `:Man` command generally available.
7a4d069b removed the &filetype check, which caused these setups to
always create a blank `man://` buffer.
Contains the exit value nvim will use.
Before exiting, it is v:null. That way jobs or autocmds (in VimLeavePre or
VimLeave) can check if Neovim is about to quit and with what exit value.
Closes#4666.
Problem: It is not possible to only see part of the message history. It is
not possible to clear messages.
Solution: Add a count to ":messages" and a clear argument. (Yasuhiro
Matsumoto)
451f849fd6
In order to not conflict with new error codes that Vim adds, all Neovim
error codes should be above 5000. The three existing sub-5000 error
codes (E926, E951, and E952) are now E50003, E5004, and E5005
respectively.
E953 was removed in 6167ce6df2, so just
remove it from the help.
Problem: Crash when an autocommand changes a quickfix list. (Dominique)
Solution: Check wether an entry is still valid. (Yegappan Lakshmanan,
Hirohito Higashi)
ffec3c5349
command_line_changed:
- Check (current_SID == 0) instead of KeyTyped
- We want to update during mappings (KeyTyped is false then).
- Check vpeekc_any()
- Avoids unnecessary work.
- Avoids triggering live preview during macros.
- Caveat: This makes the redraw "stutter" if user spams (holds a key)
in the replace pattern. But that scenario is not important.
- Update screen if the command is changed to a non-live command.
(`s->live` goes from true => false) => clears the preview
command_line_execute:
- Let CTRL-C cancel live preview
do_sub:
- Enforce a time limit ('redrawtime').
- Unset 'inccommand' if time limit is reached.
Closes#5602Closes#5585
* health.vim: Include v:throwpoint in error message
* health/provider.vim: Check for ruby executable
* health/provider.vim: Combine subprocess stdout and stderr
* test: Updated CheckHealth test
- Use a standard scratch buffer instead of a new 'buftype', functions
like curbufIsChanged() already have special handling for scratch bufs.
- Cleanup some stuff from the previous merge.
- Add support for :smagic, :snomagic. Closes#5578
'inccommand' allows us to expand the feature to other commands, such as:
:cdo
:cfdo
:global
Also rename "IncSubstitute" highlight group to "Substitute".
- Eliminate/isolate static/global variables
- Remove special-case parameter from buflist_new()
- Remove special-case ECMD_RESERVED_BUFNR
- To determine when u_undo_and_forget() should be done, check
b_changedtick instead of a heuristic.
- use mb_string2cells() instead of strlen() to measure the :sub patterns
- call ml_close() before buf_clear_file(). Avoids leaks caught by ASan.
Original patch by:
Robin Elrharbi-Fleury (Robinhola)
Audrey Rayé (Adrey06)
Philémon Hullot (DesbyP)
Aymeric Collange (aym7)
Clément Guyomard (Clement0)
We can now use help links like in normal help pages. The bars around them will
be concealed as well.
* Health: link string "SUCCESS" to ModeMsg
So far we linked "SUCCESS" to the Function highlight group.
The newly introduced healthHelp group links to Idenfifier as it does for links
in normal help pages.
Now the problem is that the Function group links again to Identifier as well, so
both, "SUCCESS" and help links, would use the same colors.
* Health: don't use Markdown code blocks
Every line indented by more than 4 spaces would lose its highlighting otherwise.
* Health: add helper health#help_to_link()
Never throw an error when provider/clipboard.vim is sourced for the first time.
Save the error instead and expose it via `provider#clipboard#Error()`, mimicking
provider/python.vim.
Originally implemented by
* Clement0
* DesbyP
* aym7
* Adrey06
* Robinhola
in #4811. Major reworkings and bug
fixes by
* bfredl
Most tests suggested by ZyX-l, suggestions for improvements by oni-link.
API level is disconnected from NVIM version. The API metadata holds the
current API level, and the lowest backwards-compatible level supported
by this instance.
Release 0.1.6 is the first release that reports the Nvim version and API
level.
metadata['version'] = {
major: 0,
minor: 1,
patch: 6,
api_level: 1,
api_compatible: 0,
api_prerelease: false,
}
The API level may remain unchanged across Nvim releases if the API has
not changed.
When changing the API,
- set NVIM_API_PRERELEASE to true
- increment NVIM_API_LEVEL (at most once per Nvim version)
- adjust NVIM_API_LEVEL_COMPAT if backwards-compatibility was broken
api_level_0.mpack was generated from Nvim 0.1.5 with:
nvim --api-info
The API level is disconnected from the NVIM version. The API metadata
holds the current API level, and the lowest backwards-compatible level
supported by this instance.
Release 0.1.6 will be the first release reporting the Nvim version and
API level.
metadata['version'] = {
major: 0,
minor: 1,
patch: 6,
prerelease: true,
api_level: 1,
api_compatible: 0,
}
The API level may remain unchanged across Neovim releases if the API has
not changed.
When changing the API the CMake variable NVIM_API_PRERELEASE is set to
true, and NVIM_API_CURRENT/NVIM_API_COMPATIBILITY are incremented
accordingly.
The functional tests check the API table against fixtures of past
versions of Neovim. It compares all the functions in the old table with
the new one, it does ignore some metadata attributes that do not alter
the function signature or were removed since 0.1.5. Currently the only
fixture is 0.mpack, generated from Neovim 0.1.5 with nvim --api-info.
Closes#5449
A file containing the string "vim" followed by a very large number in a modeline
location will trigger an overflow in getdigits() which is called by
chk_modeline() when trying to parse the version number.
Add getdigits_safe(), which does not assert overflows, but reports them to the
caller.
vim-patch:7.4.2109
Problem: Setting 'display' to "lastline" is a drastic change, while
omitting it results in lots of "@" lines.
Solution: Add "truncate" to show "@@@" for a truncated line.
ad9c2a08f0
When a file is opened by nvim with ft=man already set, and
"has('vim_starting')", ftplugin/man.vim calls
'execute 'file man://'.ref', this causes nvim to display something like
this:
````
"<name of original file>" 977, 41017C
"man://foo(1)" [Not edited] 977 lines --0%--
Press ENTER or type command to continue
````
This is annoying, because nothing of note has actually happened.
Use cases why you might want to read a man page from a file:
`MANPAGER='bash -c "nvim -c \"set ft=man\" </dev/tty <(col -bx)"' man git`
`nvim -c 'set ft=man' <(man -P cat git)`
Closes#3529Closes#5241
In Vim,
:echo system('cat - &', 'foo')
works because for both system() and :! Vim writes input to a temp file and uses
shell syntax to redirect the file to the backgrounded `cat` (get_cmd_output()
.. make_filter_cmd()).
In Nvim,
:echo system('cat - &', 'foo')
fails because we write the input directly via pipes (shell.c:do_os_system()),
but (per POSIX[1]) backgrounded process input stream is redirected from
/dev/null (unless overridden by shell redirection; supported only by some shells
[2]), so our writes are ignored, the process exits quickly, and if we are
writing data larger than the buffer size we'll see EPIPE.
This still works:
:%w !tee > foo1358.txt &
but this does not:
:%w !tee foo1358.txt &
though it *should* (why doesn't it?) because we still do the temp file dance
in do_bang() .. do_filter().
[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_03_02
[2] http://unix.stackexchange.com/a/71218
These tests are essentially affirming a regression vs Vim. In Vim,
:echo system('cat - &', 'foo')
returns "foo", because Vim internally wraps the command with shell-specific
syntax to redirect the streams from /dev/null[1].
That can't work in Nvim because we use pipes directly (instead of temp files)
and don't wrap the command with shell-specific redirection syntax.
References #3529
References #5241
[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_03_02
`:CheckHealth nvim` would always report an outdated manifest if symlinks were
used, because the manifest file contains unresolved paths that get compared
against resolved paths.
Now we resolve paths before they get written to the manifest file.
If multiple versions of a package are installed, the provider health check could
choose a wrong path:
/usr/local/lib/python3.5/site-packages/neovim-0.1.10-py3.5.egg-info/PKG-INFO
/usr/local/lib/python3.5/site-packages/neovim-0.1.9-py3.5.egg-info/PKG-INFO
Prior to this change :CheckHealth could falsely show 0.1.9 as the installed
version, since glob() doesn't enforce any predictable order.
Now we sort all potential paths numerically in descending order and just look at
the first path instead.
Problem: Cannot use a window ID where a window number is expected.
Solution: Add LOWEST_WIN_ID, so that the window ID can be used where a
number is expected.
888ccac890
Problem: Non-GUI specific settings in the gvimrc_example file.
Solution: Move some settings to the vimrc_example file. Remove setting
'hlsearch' again. (suggested by Hirohito Higashi)
54f1b7abf8
Problem: Although emoji characters are ambiguous width, best is to treat
them as full width.
Solution: Update the Unicode character tables. Add the 'emoji' options.
(Yasuhiro Matsumoto)
3848e00e01
`deprecated.txt` is a place for deprecated tags to live.
- Encourages aggressive documentation of deprecations without cluttering
the main help files.
- Provides a single browsable reference of all deprecations.
Other changes:
- Move tags to doc/vim_diff.txt.
- Remove doc/quotes.txt. It has little historical value, except maybe the
Larry Wall quote.
Compare current version number to that of the latest released neovim
rubygem, rather than a hard-coded version.
Note: The `gem list` command introduced here adds about 4 seconds to the
execution time of the CheckHealth command.
- fix synopsis highlighting in other locales. Cannot always rely on the first
line for the section in some locales; instead, use the file path and
explicitly set b:man_sect to the actual section.
- eliminate separate s:man_args function
- simplify logic: do not reuse buffer content
- introduce b:man_default_sects Fixes#5233
- introduce <Plug>(man_vsplit), <Plug>(man_tab)
- simplify regexps
This is necessary incase the buffer was previously opened in a different
tab, in which the window options there do not carry over. It is not
explicitly documented in ':help local-options' but that is how it works.
:silent does not silence this message, even :redir does not consume it.
But execute() _does_ consume it, which interferes with the current
implementation of health.vim. It's prudent to avoid it in any case, even
if the implementation of health.vim changes in the future.
We can add this later if it is proven necessary, but it should not be
because:
1. User can run a subset of checkers via `:CheckHealth plugin1, ...,`
2. Healthcheck is a very rare operation. Optimizing it is not worth the
code/API complexity.
To healthcheck the "foo" plugin:
:CheckHealth foo
To healthcheck the "foo" and "bar" plugins:
:CheckHealth foo bar
To run all auto-discovered healthchecks:
:CheckHealth
- Use execute() instead of redir
- Fixed logic on suboptimal pyenv/virtualenv checks.
- Move system calls from strings to lists. Fixes#5218
- Add highlighting
- Automatically discover health checkers
- Add tests
Helped-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Helped-by: Tommy Allen <tommy@esdf.io>
Closes#4932
- Links to Search by default
screen.c: Combine CursorLine with QuickFixLine
- HLF_QFL takes priority over HLF_CUL
docs: Updated to mention QuickFixLine
runtime: Added QuickFixLine to nvimHLGroup
tests: QuickFixLine highlight
- Weird tab+space combination used for alignment. All spaces now
- Added back <C-T> mapping (somehow we missed that completely)
- Fixed mistake that <Plug>(Man) opens in a new tab. Also added note at
top on how the window is chosen/opened.
- Clarified q local mapping
- Removed section that shows an example autocmd to add desired folding
style.
- Removed random line in `usr_12.txt` about `<Leader>` and backslash.
- :Man supports completion, not auto-completion.
Closes#5171
In 3b12bb225a, ":oldfiles" was taught to
behave like Vim's ":browse oldfiles" if ":oldfiles!" was used. However,
this conflates the use of ! for abandoning a modified buffer with
choosing one file out of a list of oldfiles.
Now that ":browse" is supported again, ":browse oldfiles" will allow the
user to select an old file, while still complaining if that would cause
a modified buffer to be abandoned. ":browse oldfiles!" will just
abandon the buffer, as expected.
With -count, if the first argument is a number, it is made available
with <count>. Problem is, there is always a default count it is impossible
to tell whether the user set it.
Since v:count and v:count1 still work with 'keywordprg', -count is
unnecessary. But 'keywordprg' still calls ':Man' with a count prefixed.
So it must still accept a count in the line number position, but not consume
the first argument. This is done with -range.
Fixes#5202.
Regression from #5168. Also changed the Man command's nargs to '+' so
that man#open_page does not need to handle 0 arguments, because that
will never occur.
- Use the default buffer text provided by before_each (avoids extra steps and
makes the tests more consistent with each other)
- Indent
- Adjust help doc