Commit Graph

1517 Commits

Author SHA1 Message Date
raichoo
8ce6393048 terminal: Leave 'relativenumber' alone (#8360)
ref #6796
2018-05-05 18:45:15 +02:00
Justin M. Keyes
e46534b423 Merge #4486 'refactor: Remove maxmem, maxmemtot options'
After this change we never release blocks from memory (in practice it
never happened because the memory limits are never reached).  Let the OS
take care of that.

---

On today's systems the 'maxmem' and 'maxmemtot' values are huge (4+ GB)
so the limits are never reached in practice, but Vim wastes a lot of
time checking if the limit was reached.

If the limit is reached Vim starts saving pieces of the swap file that were in
memory to the disk. Said in a different way: Vim implements its own
memory-paging mechanism. This is unnecessary and inefficient since the
operating system already has virtual memory and will swap to the disk if
programs start using too much memory.

This change does...

1. Reduce the number of config options and need for documentation.
2. Make the code more efficient as we don't have to keep track of memory
   usage nor check if the memory limits were reached to start swapping
   to disk every time we need memory for buffers.
3. Simplify the code. Once memfile.c is simple enough it could be
   replaced by actual operating system memory mapping (mmap,
   MemoryViewOfFile...). This change does not prevent Vim to recover
   changes from swap files since the swapping code is never triggered
   with the huge limits set by default.
2018-05-02 10:14:42 +02:00
Daniel Hahler
1f2301eacf health#provider: fix sys.path for Python
Remove "" from sys.path (typically the first entry), which could cause
e.g. "logging" to be added from the current directory.
This gets done already for loading the host in
runtime/autoload/provider/pythonx.vim.
2018-04-30 16:54:35 +02:00
Daniel Hahler
7d8327fd30 health#provider: improve error reporting
- quote command, so that e.g. markdown handling is not applied to `__init__.py`
- include cwd
2018-04-30 16:50:01 +02:00
Daniel Hahler
87d3f265bc health#provider: fix logic with s:shellify
It should be quoted if there is any character that needs escaping, but
not if there is a character that does not need escaping.
2018-04-30 16:48:32 +02:00
Andy Russell
6208c7fb98 doc: clarify stdout_buffered docs (#8299)
Fixes #8150
2018-04-28 00:45:55 +02:00
Justin M. Keyes
9139bf81cf defaults: disable 'fsync'
ref #6725

fsync() is very slow on some systems.  And since the parent commit, Nvim
is smarter about flushing files at certain times (e.g. CursorHold),
regardless of whether 'fsync' is enabled.  So it's less risky to disable
'fsync'.

Profiling showed slow (2-4s) :write and :quit caused by fsync():

:quit
    shada_write_file(NULL, false);

:write + fsync
    0  0x00007f72da567b2d in fsync () at ../sysdeps/unix/syscall-template.S:84
    1  0x0000000000638970 in uv__fs_fsync (req=<optimized out>) at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:150
    2  uv__fs_work (w=<optimized out>) at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:953
    3  0x0000000000639a70 in uv_fs_fsync (loop=<optimized out>, req=<optimized out>, file=41, cb=0x7f72da567b2d <fsync+45>)
       at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:1094
    4  0x0000000000573694 in os_fsync (fd=41) at ../src/nvim/os/fs.c:631
    5  0x00000000004ec9dc in buf_write (buf=<optimized out>, fname=<optimized out>, sfname=<optimized out>, start=1, end=1997, eap=0x7fffc864c570,
       append=<optimized out>, forceit=<optimized out>, reset_changed=<optimized out>, filtering=<optimized out>) at ../src/nvim/fileio.c:3387
    6  0x00000000004b44ff in do_write (eap=0x7fffc864c570) at ../src/nvim/ex_cmds.c:1745
    ...

:write + nofsync
    0  0x00007f72da567b2d in fsync () at ../sysdeps/unix/syscall-template.S:84
    1  0x0000000000638970 in uv__fs_fsync (req=<optimized out>) at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:150
    2  uv__fs_work (w=<optimized out>) at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:953
    3  0x0000000000639a70 in uv_fs_fsync (loop=<optimized out>, req=<optimized out>, file=36, cb=0x7f72da567b2d <fsync+45>)
       at /home/vagrant/neovim/.deps/build/src/libuv/src/unix/fs.c:1094
    4  0x0000000000573694 in os_fsync (fd=36) at ../src/nvim/os/fs.c:631
    5  0x0000000000528f5a in mf_sync (mfp=0x7f72d8968d00, flags=5) at ../src/nvim/memfile.c:466
    6  0x000000000052d569 in ml_preserve (buf=0x7f72d890f000, message=0) at ../src/nvim/memline.c:1659
    7  0x00000000004ebadf in buf_write (buf=<optimized out>, fname=<optimized out>, sfname=<optimized out>, start=1, end=1997, eap=0x7fffc864c570,
       append=<optimized out>, forceit=<optimized out>, reset_changed=<optimized out>, filtering=<optimized out>) at ../src/nvim/fileio.c:3071
    8  0x00000000004b44ff in do_write (eap=0x7fffc864c570) at ../src/nvim/ex_cmds.c:1745
    ...
2018-04-21 12:51:27 +02:00
Andy Russell
d29c243bef doc: platform-specific config locations (#8297)
Fixes #7374.
2018-04-20 19:04:30 +02:00
Justin M. Keyes
8fa0b8051d job-control: mitigate process-kill race
children_kill_cb() is racey. One obvious problem is that
process_close_handles() is *queued* by on_process_exit(), so when
children_kill_cb() is invoked, the dead process might still be in the
`loop->children` list.  If the OS already reclaimed the dead PID, Nvim
may try to SIGKILL it.

Avoid that by checking `proc->status`.

Vim doesn't have this problem because it doesn't attempt to kill
processes that ignored SIGTERM after a timeout.

closes #8269
2018-04-15 18:23:11 +02:00
geekodour
1e71978cf0 events: VimSuspend, VimResume #8280
closes #3648
ref #5959
2018-04-15 15:05:02 +02:00
Justin M. Keyes
1e7d5e8cdf
Merge #6272 'stdpath()' 2018-04-15 04:09:30 +02:00
Jan Edmund Lazo
7c8122f36d win: getftype(symlink) returns 'link'
Vim doesn't detect symlinks correctly so stick with Neovim's behaviour.
2018-04-12 02:28:38 -04:00
Justin M. Keyes
87f4d2592c
test/util: expect_err() (#8257)
other cleanup, ref #8245
2018-04-11 22:07:00 +02:00
Justin M. Keyes
507bda1c95 server: introduce --listen, deprecate $NVIM_LISTEN_ADDRESS 2018-04-11 02:41:05 +02:00
Justin M. Keyes
9f598e5765 serverstop(): return FALSE for invalid address 2018-04-11 01:58:41 +02:00
Justin M. Keyes
e8c39f72fd
Merge #8226 from justinmk/insert-mode-meta 2018-04-04 04:36:13 +02:00
Justin M. Keyes
224ebc0078 insert-mode: interpret unmapped META as ESC
closes #2454
closes #8213
ref #7972
2018-04-04 03:23:15 +02:00
Justin M. Keyes
eb00fc0cf0 vim-patch:8.0.0564: cannot detect Bazel BUILD files on some systems
Problem:    Cannot detect Bazel BUILD files on some systems.
Solution:   Check for BUILD after script checks. (Issue vim/vim#1340)
39170e2d97

vim-patch:8.0.1283: test 86 fails under ASAN
2018-04-02 23:59:49 +02:00
Justin M. Keyes
b982f0e654 vim-patch:8.0.1285
d09a206ee9

vim-patch:8.0.0564: cannot detect Bazel BUILD files on some systems
2018-04-02 23:59:49 +02:00
Justin M. Keyes
411d578137 vim-patch:8.0.1282
Problem:    script-local variable defined in the wrong script
Solution:   Move variable to autoload/filetype.vim.

cef7322d8a
2018-04-02 23:59:48 +02:00
Justin M. Keyes
04f5062978 vim-patch:8.0.1281
Problem:    Loading file type detection slows down startup.
Solution:   Move functions to an autoload script.
851ee6c3da

---

vim-patch:8.0.0635
Problem:    When 'ignorecase' is set script detection is inaccurate.
Solution:   Enforce matching case for text. (closes #1753)
2018-04-02 23:59:46 +02:00
Björn Linse
98e7112390 msg: do not scroll entire screen (#8088) 2018-03-31 11:12:27 +02:00
Christian Höltje
868b84199e eval: Add stdpath() method (#5297)
Adds the :stdpath method for fetching XDG standard directories.

Fixes #5297
2018-03-29 10:41:04 -04:00
Vadim A. Misbakh-Soloviov
9ebe2ad331 runtime/dircolors.vim: support termguicolors (#8175) 2018-03-25 15:45:02 +02:00
Jan Edmund Lazo
131aad953c win: defaults: 'shellcmdflag', 'shellxquote' #7343
closes #7698

Wrapping a command in double-quotes allows cmd.exe to safely dequote the
entire command as if the user entered the entire command in an
interactive prompt. This reduces the need to escape nested and uneven
double quotes.

The `/s` flag of cmd.exe makes the behaviour more reliable:

    :set shellcmdflag=/s\ /c

Before this patch, cmd.exe cannot use cygwin echo.exe (as opposed to
cmd.exe `echo` builtin) even if it is wrapped in double quotes.

Example:
:: internal echo
> cmd /s /c " echo foo\:bar" "
foo\:bar"

:: cygwin echo.exe
> cmd /s /c " "echo" foo\:bar" "
foo:bar
2018-03-24 22:05:53 +01:00
Björn Linse
d407a48665 getchar: implement <Cmd> key to invoke command in any mode 2018-03-23 14:01:49 +01:00
b-r-o-c-k
c49dac7cd3 build: Fix CMake target dependency problem
nvim was being ran before its runtime dependencies were copied.
2018-03-18 12:51:39 -05:00
Justin M. Keyes
0093c25dd3 doc: nodejs 2018-03-15 04:59:18 +01:00
chemzqm
338664e96c node/provider: support g:node_host_prog #8135 2018-03-15 04:55:48 +01:00
Daniel Hahler
1d5eec2c62 health/provider: python: warning with correct host prog (#8049)
I have `g:python3_host_prog` set to the system Python, where a package
is also installed to provide the "neovim" module.

`:checkhealth provider` however displays a warning for this:

> Your virtualenv is not set up optimally.

This is because /usr/bin/python is not in /home/user/.pyenv.

I think this warning should not get displayed if host_prog_var exists.

It goes back to the initial commit (20447ba09), and is maybe only
missing the `!` there as with the previous commit.

Full output:
```
  - INFO: pyenv: /home/user/.pyenv/libexec/pyenv
  - INFO: pyenv root: /home/user/.pyenv
  - INFO: Using: g:python3_host_prog = "/usr/bin/python"
  - WARNING: Your virtualenv is not set up optimally (/usr/bin/python is not in /home/user/.pyenv).
    - ADVICE:
      - Create a virtualenv specifically for Neovim and use `g:python3_host_prog`.  This will avoid the need to install Neovim's Python module in each virtualenv.
  - WARNING: $VIRTUAL_ENV exists but appears to be inactive. This could lead to unexpected results.
    - ADVICE:
      - If you are using Zsh, see: http://vi.stackexchange.com/a/7654
  - INFO: Executable: /usr/bin/python
  - INFO: Python3 version: 3.6.4
  - INFO: python-neovim version: 0.2.1
  - OK: Latest python-neovim is installed: 0.2.1
```
2018-03-04 20:04:52 +01:00
Björn Linse
e18177692a screen.c: make negative 'writedelay' show all redraws
Currently writedelay shows the sequence of characters that are sent to
the UI/TUI module. Here nvim has already applied an optimization: when
attempting to put a char in a screen cell, if the same char already was
there with the same attributes, UI output is disabled. When debugging
redrawing it it sometimes more useful to inspect the redraw stream one
step earlier, what region of the screen nvim actually is recomputing
from buffer contents (win_line) and from evaluating statusline
expressions.

Take the popupmenu as an example. When closing the popupmenu (in the
TUI), currently 'writedelay' looks like vim only is redrawing the region
which the pum covered. This is not what happens internally: vim redraws
the entire screen, even if only outputs the changed region.

This commit allows negative values of 'writedelay', which causes a delay
for all redrawn characters, even if the character already was displayed
by the UI before.
2018-02-24 09:10:00 +01:00
Matthieu Coudron
384a39479a 'fillchars': fix defaults logic; handle ambiwidth=double #7986
Update tests.
2018-02-23 00:48:35 +01:00
Justin M. Keyes
0c930c2969 defaults: 'fillchars'
Most fonts should have these by now. Both are a significant visual
improvement.

- Vertical connecting bar `│` is used by tmux, pstree, Windows 7 cmd.exe
  and nvim-qt.exe.
- Middle dot `·` works on Windows 7 cmd.exe, nvim-qt.exe.

For reference: tmux uses these chars to draw lines: │ ├ ─
2018-02-23 00:48:35 +01:00
Daniel Hahler
4696a5a10e health.vim: minor cleanup (#8046) 2018-02-22 02:42:08 +01:00
Daniel Hahler
830b5819a0 health/provider: check Python also with loaded_var (#8047)
`g:loaded_python3_provider` gets set when the autoload file is sourced,
but this might error out, e.g. with deoplete:

    [deoplete] Failed to load python3 host. You can try to see what happened by starting nvim with $NVIM_PYTHON_LOG_FILE set and opening the generated log file. Also, the host stderr is available in messages.
    [deoplete] function remote#define#FunctionBootstrap[1]..remote#host#Require[10]..provider#pythonx#Require[13]..provider#Poll, line 14
    [deoplete] deoplete requires Python3 support("+python3").
    [deoplete] deoplete failed to load. Try the :UpdateRemotePlugins command and restart Neovim.  See also :checkhealth.

It refers to `:checkhealth` from there explicitly, which would then
(without this patch) say that Python 3 is disabled.

This patch changes the reported info to include that it might have been
disabled due to some error, and keeps on going.
2018-02-22 02:38:00 +01:00
Daniel Hahler
1eb4aff57a checkhealth: python: do not report pythonx_errs twice (#8045)
They get reported unconditionally as errors below.
2018-02-22 02:37:23 +01:00
Daniel Hahler
c8074e3792 runtime/autoload/health/*.vim: fix vint warning (#8048) 2018-02-22 02:30:39 +01:00
James McCoy
6bbec71fde
Merge pull request #8019 from jamessan/invalid-provider-stderr
Improve error handling and reduce duplication of providers' #Require()
2018-02-19 20:10:10 -05:00
Justin M. Keyes
06b7561e78
build: remove contents of build/runtime/doc/* surgically (#8024)
Only remove the directory contents. If the directory itself is removed,
then `sudo make install` creates a root-owned …/doc/ directory. That
breaks the next non-root build.

This was an accident of 0b1904d835.

Note: the following does not work, because it misses renamed help files
(which would no longer be in the build-tree definition)

    COMMAND ${CMAKE_COMMAND} -E remove ${BUILDDOCFILES} ${GENERATED_HELP_TAGS}
2018-02-19 21:10:16 +01:00
Shougo
00665d3c70 vim-patch:8.0.1493: completion items cannot be annotated (#8003)
Problem:    Completion items cannot be annotated.
Solution:   Add a "user_data" entry to the completion item. (Ben Jackson,
            coses vim/vim#2608, closes vim/vim#2508)

9b56a57cda
2018-02-18 23:56:59 +01:00
Justin M. Keyes
eccd60aaf4 runtime/doc: modeline is mandatory in help docs
see Vim 8.0.0650 e9134421ab
2018-02-18 22:17:47 +01:00
James McCoy
3af3515e74 Add provider#Poll() to handle starting and polling the provider 2018-02-16 14:08:12 -05:00
James McCoy
6fbb8d6739 provider: Safely access job.stderr in #Require
If `jobstart()` fails, then the subsequent `rpcrequest()` will throw due
to an invalid channel id.  This causes `job.stderr` not to exist, so we
throw another exception when trying to dump the job's stderr.

    Error detected while processing function remote#define#AutocmdBootstrap[1]..remote#host#Require[10]..provider#pythonx#Require:
    line 22:
    E716: Key not present in Dictionary: stderr

This obfuscates the actual problem.
2018-02-16 13:33:23 -05:00
James McCoy
48dc1f3f90 provider: ruby: Use stderr_buffered to collect stderr 2018-02-16 13:33:07 -05:00
Nimit Bhardwaj
e9134421ab vim-patch-8.0.0649 and vim-patch-8.0.0650: autocmd open help 2 times 2018-02-17 00:02:16 +05:30
Björn Linse
6e5cb0debd ui: refactor ui options 2018-02-13 20:48:51 +01:00
Justin M. Keyes
e15f2b4b96 vim-patch:8.0.0906: don't recognize Couchbase files
Problem:    Don't recognize Couchbase files.
Solution:   Add filetype detection. (Eugene Ciurana, closes vim/vim#1951)

d9bc8a801a
2018-02-11 19:03:27 +01:00
Justin M. Keyes
9baf60c617 vim-patch:8.0.0894: there is no test for runtime filetype detection
Problem:    There is no test for runtime filetype detection.
Solution:   Test a list of filetypes from patterns.

0a0217abfa
2018-02-11 19:03:26 +01:00
Justin M. Keyes
16a4168364 vim-patch:8.0.0613: the conf filetype is used before ftdetect from packages
Problem:    The conf filetype detection is done before ftdetect scripts from
            packages that are added later.
Solution:   Add the FALLBACK argument to :setfiletype. (closes vim/vim#1679,
            closes vim/vim#1693)

3e54569b17
2018-02-11 19:03:26 +01:00
Justin M. Keyes
bbdb074aec vim-patch:8.0.0721: :argedit can only have one argument
Problem:    :argedit can only have one argument.
Solution:   Allow for multiple arguments. (Christian Brabandt)
90305c66a8
2018-02-11 15:29:19 +01:00