mirror of
https://github.com/neovim/neovim
synced 2025-07-22 14:21:58 +00:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
1060bfd033 | |||
f891131c6b | |||
9a5488c2a6 | |||
1793ba8176 | |||
947069ba14 | |||
46c7e12f27 | |||
b98be54148 | |||
f1843c0035 | |||
1204421888 | |||
aaa8c3d711 |
@ -113,7 +113,7 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
||||
set(NVIM_VERSION_MAJOR 0)
|
||||
set(NVIM_VERSION_MINOR 3)
|
||||
set(NVIM_VERSION_PATCH 5)
|
||||
set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers
|
||||
set(NVIM_VERSION_PRERELEASE "") # for package maintainers
|
||||
|
||||
# API level
|
||||
set(NVIM_API_LEVEL 5) # Bump this after any API change.
|
||||
|
@ -24,29 +24,34 @@ Nvim supports Python |remote-plugin|s and the Vim legacy |python2| and
|
||||
|python3| interfaces (which are implemented as remote-plugins).
|
||||
Note: Only the Vim 7.3 API is supported; bindeval (Vim 7.4) is not.
|
||||
|
||||
|
||||
PYTHON QUICKSTART ~
|
||||
|
||||
Install the "pynvim" Python package:
|
||||
To use Python plugins, you need the "pynvim" module. Run |:checkhealth| to see
|
||||
if you already have it (some package managers install the module with Nvim
|
||||
itself).
|
||||
|
||||
- Run |:checkhealth| to see if you already have the package (some package
|
||||
managers install the "pynvim" Python package with Nvim itself).
|
||||
For Python 3 plugins:
|
||||
1. Make sure Python 3.4+ is available in your $PATH.
|
||||
2. Install the module (try "pip" if "pip3" is missing): >
|
||||
pip3 install --user --upgrade pynvim
|
||||
|
||||
- For Python 2 plugins, make sure Python 2.7 is available in your $PATH, then
|
||||
install the package systemwide: >
|
||||
sudo pip2 install --upgrade pynvim
|
||||
< or for the current user: >
|
||||
pip2 install --user --upgrade pynvim
|
||||
< If "pip2" is missing, try "pip".
|
||||
For Python 2 plugins:
|
||||
1. Make sure Python 2.7 is available in your $PATH.
|
||||
2. Install the module (try "pip" if "pip2" is missing): >
|
||||
pip2 install --user --upgrade pynvim
|
||||
|
||||
- For Python 3 plugins, make sure Python 3.4+ is available in your $PATH, then
|
||||
install the package systemwide: >
|
||||
sudo pip3 install --upgrade pynvim
|
||||
< or for the current user: >
|
||||
pip3 install --user --upgrade pynvim
|
||||
< If "pip3" is missing, try "pip".
|
||||
The pip `--upgrade` flag ensures that you get the latest version even if
|
||||
a previous version was already installed.
|
||||
|
||||
See also |python-virtualenv|.
|
||||
|
||||
Note: The old "neovim" module was renamed to "pynvim".
|
||||
https://github.com/neovim/neovim/wiki/Following-HEAD#20181118
|
||||
If you run into problems, uninstall _both_ then install "pynvim" again: >
|
||||
pip uninstall neovim pynvim
|
||||
pip install pynvim
|
||||
|
||||
- The `--upgrade` flag ensures you have the latest version even if a previous
|
||||
version was already installed.
|
||||
|
||||
PYTHON PROVIDER CONFIGURATION ~
|
||||
*g:python_host_prog*
|
||||
@ -67,8 +72,9 @@ To disable Python 2 support: >
|
||||
To disable Python 3 support: >
|
||||
let g:loaded_python3_provider = 1
|
||||
|
||||
PYTHON VIRTUALENVS ~
|
||||
|
||||
PYTHON VIRTUALENVS ~
|
||||
*python-virtualenv*
|
||||
If you plan to use per-project virtualenvs often, you should assign one
|
||||
virtualenv for Neovim and hard-code the interpreter path via
|
||||
|g:python3_host_prog| (or |g:python_host_prog|) so that the "pynvim" package
|
||||
@ -91,6 +97,7 @@ Ruby integration *provider-ruby*
|
||||
Nvim supports Ruby |remote-plugin|s and the Vim legacy |ruby-vim| interface
|
||||
(which is itself implemented as a Nvim remote-plugin).
|
||||
|
||||
|
||||
RUBY QUICKSTART ~
|
||||
|
||||
To use Ruby plugins with Nvim, install the latest "neovim" RubyGem: >
|
||||
@ -98,6 +105,7 @@ To use Ruby plugins with Nvim, install the latest "neovim" RubyGem: >
|
||||
|
||||
Run |:checkhealth| to see if your system is up-to-date.
|
||||
|
||||
|
||||
RUBY PROVIDER CONFIGURATION ~
|
||||
*g:loaded_ruby_provider*
|
||||
To disable Ruby support: >
|
||||
@ -120,6 +128,7 @@ Node.js integration *provider-nodejs*
|
||||
Nvim supports Node.js |remote-plugin|s.
|
||||
https://github.com/neovim/node-client/
|
||||
|
||||
|
||||
NODEJS QUICKSTART~
|
||||
|
||||
To use javascript remote-plugins with Nvim, install the "neovim" npm package: >
|
||||
@ -127,6 +136,7 @@ To use javascript remote-plugins with Nvim, install the "neovim" npm package: >
|
||||
|
||||
Run |:checkhealth| to see if your system is up-to-date.
|
||||
|
||||
|
||||
NODEJS PROVIDER CONFIGURATION~
|
||||
*g:loaded_node_provider*
|
||||
To disable Node.js support: >
|
||||
|
@ -594,7 +594,7 @@ void nvim_set_current_dir(String dir, Error *err)
|
||||
return;
|
||||
}
|
||||
|
||||
post_chdir(kCdScopeGlobal);
|
||||
post_chdir(kCdScopeGlobal, true);
|
||||
try_end(err);
|
||||
}
|
||||
|
||||
|
@ -1559,6 +1559,7 @@ void do_autochdir(void)
|
||||
if (starting == 0
|
||||
&& curbuf->b_ffname != NULL
|
||||
&& vim_chdirfile(curbuf->b_ffname) == OK) {
|
||||
post_chdir(kCdScopeGlobal, false);
|
||||
shorten_fnames(true);
|
||||
}
|
||||
}
|
||||
|
@ -7218,7 +7218,7 @@ void free_cd_dir(void)
|
||||
/// Deal with the side effects of changing the current directory.
|
||||
///
|
||||
/// @param scope Scope of the function call (global, tab or window).
|
||||
void post_chdir(CdScope scope)
|
||||
void post_chdir(CdScope scope, bool trigger_dirchanged)
|
||||
{
|
||||
// Always overwrite the window-local CWD.
|
||||
xfree(curwin->w_localdir);
|
||||
@ -7258,7 +7258,10 @@ void post_chdir(CdScope scope)
|
||||
}
|
||||
|
||||
shorten_fnames(true);
|
||||
do_autocmd_dirchanged(cwd, scope);
|
||||
|
||||
if (trigger_dirchanged) {
|
||||
do_autocmd_dirchanged(cwd, scope);
|
||||
}
|
||||
}
|
||||
|
||||
/// `:cd`, `:tcd`, `:lcd`, `:chdir`, `:tchdir` and `:lchdir`.
|
||||
@ -7320,7 +7323,7 @@ void ex_cd(exarg_T *eap)
|
||||
if (vim_chdir(new_dir, scope)) {
|
||||
EMSG(_(e_failed));
|
||||
} else {
|
||||
post_chdir(scope);
|
||||
post_chdir(scope, true);
|
||||
// Echo the new current directory if the command was typed.
|
||||
if (KeyTyped || p_verbose >= 5) {
|
||||
ex_pwd(eap);
|
||||
|
@ -76,7 +76,8 @@
|
||||
|
||||
/// @param flags Flags for open() call.
|
||||
///
|
||||
/// @return The open memory file.
|
||||
/// @return - The open memory file, on success.
|
||||
/// - NULL, on failure (e.g. file does not exist).
|
||||
memfile_T *mf_open(char_u *fname, int flags)
|
||||
{
|
||||
memfile_T *mfp = xmalloc(sizeof(memfile_T));
|
||||
|
@ -277,6 +277,9 @@ int ml_open(buf_T *buf)
|
||||
|
||||
// Open the memfile. No swap file is created yet.
|
||||
memfile_T *mfp = mf_open(NULL, 0);
|
||||
if (mfp == NULL) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
buf->b_ml.ml_mfp = mfp;
|
||||
buf->b_ml.ml_flags = ML_EMPTY;
|
||||
@ -360,10 +363,12 @@ int ml_open(buf_T *buf)
|
||||
return OK;
|
||||
|
||||
error:
|
||||
if (hp) {
|
||||
mf_put(mfp, hp, false, false);
|
||||
if (mfp != NULL) {
|
||||
if (hp) {
|
||||
mf_put(mfp, hp, false, false);
|
||||
}
|
||||
mf_close(mfp, true); // will also xfree(mfp->mf_fname)
|
||||
}
|
||||
mf_close(mfp, true); // will also xfree(mfp->mf_fname)
|
||||
buf->b_ml.ml_mfp = NULL;
|
||||
return FAIL;
|
||||
}
|
||||
@ -839,7 +844,7 @@ void ml_recover(void)
|
||||
mf_open() will consume "fname_used"! */
|
||||
mfp = mf_open(fname_used, O_RDONLY);
|
||||
fname_used = p;
|
||||
if (mfp->mf_fd < 0) {
|
||||
if (mfp == NULL || mfp->mf_fd < 0) {
|
||||
EMSG2(_("E306: Cannot open %s"), fname_used);
|
||||
goto theend;
|
||||
}
|
||||
|
@ -306,6 +306,15 @@ static char *(p_cot_values[]) = { "menu", "menuone", "longest", "preview",
|
||||
static char *(p_icm_values[]) = { "nosplit", "split", NULL };
|
||||
static char *(p_scl_values[]) = { "yes", "no", "auto", NULL };
|
||||
|
||||
/// All possible flags for 'shm'.
|
||||
static char_u SHM_ALL[] = {
|
||||
SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI,
|
||||
SHM_ABBREVIATIONS, SHM_WRITE, SHM_TRUNC, SHM_TRUNCALL, SHM_OVER,
|
||||
SHM_OVERALL, SHM_SEARCH, SHM_ATTENTION, SHM_INTRO, SHM_COMPLETIONMENU,
|
||||
SHM_RECORDING, SHM_FILEINFO,
|
||||
0,
|
||||
};
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "option.c.generated.h"
|
||||
#endif
|
||||
@ -2417,11 +2426,6 @@ static bool valid_filetype(char_u *val)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// MSVC optimizations are disabled for this function because it
|
||||
// incorrectly generates an empty string for SHM_ALL.
|
||||
#pragma optimize("", off)
|
||||
#endif
|
||||
/*
|
||||
* Handle string options that need some action to perform when changed.
|
||||
* Returns NULL for success, or an error message for an error.
|
||||
@ -3311,9 +3315,6 @@ did_set_string_option (
|
||||
|
||||
return errmsg;
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma optimize("", on)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simple int comparison function for use with qsort()
|
||||
|
@ -178,14 +178,6 @@ enum {
|
||||
SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI, \
|
||||
0, \
|
||||
})
|
||||
/// All possible flags for 'shm'.
|
||||
#define SHM_ALL ((char_u[]) { \
|
||||
SHM_RO, SHM_MOD, SHM_FILE, SHM_LAST, SHM_TEXT, SHM_LINES, SHM_NEW, SHM_WRI, \
|
||||
SHM_ABBREVIATIONS, SHM_WRITE, SHM_TRUNC, SHM_TRUNCALL, SHM_OVER, \
|
||||
SHM_OVERALL, SHM_SEARCH, SHM_ATTENTION, SHM_INTRO, SHM_COMPLETIONMENU, \
|
||||
SHM_RECORDING, SHM_FILEINFO, \
|
||||
0, \
|
||||
})
|
||||
|
||||
/* characters for p_go: */
|
||||
#define GO_ASEL 'a' /* autoselect */
|
||||
|
@ -4920,7 +4920,7 @@ regmatch (
|
||||
}
|
||||
} else {
|
||||
const char_u *const line =
|
||||
reg_getline(behind_pos.rs_u.pos.lnum);
|
||||
reg_getline(rp->rs_un.regsave.rs_u.pos.lnum);
|
||||
|
||||
rp->rs_un.regsave.rs_u.pos.col -=
|
||||
utf_head_off(line,
|
||||
|
@ -5338,10 +5338,11 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr)
|
||||
schar_from_ascii(ScreenLines[off - 1], ' ');
|
||||
ScreenAttrs[off - 1] = 0;
|
||||
// redraw the previous cell, make it empty
|
||||
if (put_dirty_first == -1) {
|
||||
if (put_dirty_first == -1 || col-1 < put_dirty_first) {
|
||||
put_dirty_first = col-1;
|
||||
}
|
||||
put_dirty_last = col+1;
|
||||
put_dirty_last = MAX(put_dirty_last, col+1);
|
||||
// force the cell at "col" to be redrawn
|
||||
force_redraw_next = true;
|
||||
}
|
||||
@ -5422,10 +5423,10 @@ void screen_puts_len(char_u *text, int textlen, int row, int col, int attr)
|
||||
ScreenLines[off + 1][0] = 0;
|
||||
ScreenAttrs[off + 1] = attr;
|
||||
}
|
||||
if (put_dirty_first == -1) {
|
||||
if (put_dirty_first == -1 || col < put_dirty_first) {
|
||||
put_dirty_first = col;
|
||||
}
|
||||
put_dirty_last = col+mbyte_cells;
|
||||
put_dirty_last = MAX(put_dirty_last, col+mbyte_cells);
|
||||
}
|
||||
|
||||
off += mbyte_cells;
|
||||
|
@ -2510,7 +2510,7 @@ buf_T *open_spellbuf(void)
|
||||
buf->b_spell = true;
|
||||
buf->b_p_swf = true; // may create a swap file
|
||||
if (ml_open(buf) == FAIL) {
|
||||
abort();
|
||||
ELOG("Error opening a new memline");
|
||||
}
|
||||
ml_open_file(buf); // create swap file now
|
||||
|
||||
|
@ -1304,8 +1304,6 @@ static void redraw(bool restore_cursor)
|
||||
|
||||
static void adjust_topline(Terminal *term, buf_T *buf, long added)
|
||||
{
|
||||
int height, width;
|
||||
vterm_get_size(term->vt, &height, &width);
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||
if (wp->w_buffer == buf) {
|
||||
linenr_T ml_end = buf->b_ml.ml_line_count;
|
||||
@ -1314,7 +1312,7 @@ static void adjust_topline(Terminal *term, buf_T *buf, long added)
|
||||
if (following || (wp == curwin && is_focused(term))) {
|
||||
// "Follow" the terminal output
|
||||
wp->w_cursor.lnum = ml_end;
|
||||
set_topline(wp, MAX(wp->w_cursor.lnum - height + 1, 1));
|
||||
set_topline(wp, MAX(wp->w_cursor.lnum - wp->w_height + 1, 1));
|
||||
} else {
|
||||
// Ensure valid cursor for each window displaying this terminal.
|
||||
wp->w_cursor.lnum = MIN(wp->w_cursor.lnum, ml_end);
|
||||
|
@ -286,6 +286,15 @@ describe("getcwd()", function ()
|
||||
command("call delete('../"..directories.global.."', 'd')")
|
||||
eq("", helpers.eval("getcwd()"))
|
||||
end)
|
||||
|
||||
it("works with 'autochdir' after local directory was set (#9892)", function()
|
||||
local curdir = cwd()
|
||||
command('lcd ' .. directories.global)
|
||||
command('lcd -')
|
||||
command('set autochdir')
|
||||
command('edit ' .. directories.global .. '/foo')
|
||||
eq(curdir .. pathsep .. directories.global, cwd())
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
local Screen = require('test.functional.ui.screen')
|
||||
local helpers = require('test.functional.helpers')(after_each)
|
||||
local lfs = require('lfs')
|
||||
local feed_command, eq, eval, expect, source =
|
||||
helpers.feed_command, helpers.eq, helpers.eval, helpers.expect, helpers.source
|
||||
local eq, eval, expect, source =
|
||||
helpers.eq, helpers.eval, helpers.expect, helpers.source
|
||||
local clear = helpers.clear
|
||||
local command = helpers.command
|
||||
local expect_err = helpers.expect_err
|
||||
local feed = helpers.feed
|
||||
local nvim_prog = helpers.nvim_prog
|
||||
local ok = helpers.ok
|
||||
@ -17,9 +18,14 @@ describe(':recover', function()
|
||||
before_each(clear)
|
||||
|
||||
it('fails if given a non-existent swapfile', function()
|
||||
local swapname = 'bogus-swapfile'
|
||||
feed_command('recover '..swapname) -- This should not segfault. #2117
|
||||
eq('E305: No swap file found for '..swapname, eval('v:errmsg'))
|
||||
local swapname = 'bogus_swapfile'
|
||||
local swapname2 = 'bogus_swapfile.swp'
|
||||
expect_err('E305: No swap file found for '..swapname,
|
||||
command, 'recover '..swapname) -- Should not segfault. #2117
|
||||
-- Also check filename ending with ".swp". #9504
|
||||
expect_err('Vim%(recover%):E306: Cannot open '..swapname2,
|
||||
command, 'recover '..swapname2) -- Should not segfault. #2117
|
||||
eq(2, eval('1+1')) -- Still alive?
|
||||
end)
|
||||
|
||||
end)
|
||||
|
@ -8,7 +8,7 @@ local exit_altscreen = thelpers.exit_altscreen
|
||||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
|
||||
describe('terminal altscreen', function()
|
||||
describe(':terminal altscreen', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
|
@ -6,7 +6,7 @@ local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.s
|
||||
local eq, neq = helpers.eq, helpers.neq
|
||||
local write_file = helpers.write_file
|
||||
|
||||
describe('terminal buffer', function()
|
||||
describe(':terminal buffer', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
|
@ -7,7 +7,7 @@ local feed_command = helpers.feed_command
|
||||
local hide_cursor = thelpers.hide_cursor
|
||||
local show_cursor = thelpers.show_cursor
|
||||
|
||||
describe('terminal cursor', function()
|
||||
describe(':terminal cursor', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
|
@ -5,7 +5,7 @@ local feed, clear, nvim = helpers.feed, helpers.clear, helpers.nvim
|
||||
local nvim_dir, command = helpers.nvim_dir, helpers.command
|
||||
local eq, eval = helpers.eq, helpers.eval
|
||||
|
||||
describe('terminal window highlighting', function()
|
||||
describe(':terminal window highlighting', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
|
@ -4,7 +4,7 @@ local clear, eq, eval = helpers.clear, helpers.eq, helpers.eval
|
||||
local feed, nvim = helpers.feed, helpers.nvim
|
||||
local feed_data = thelpers.feed_data
|
||||
|
||||
describe('terminal mouse', function()
|
||||
describe(':terminal mouse', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
|
@ -12,7 +12,7 @@ local curbufmeths = helpers.curbufmeths
|
||||
local nvim = helpers.nvim
|
||||
local feed_data = thelpers.feed_data
|
||||
|
||||
describe('terminal scrollback', function()
|
||||
describe(':terminal scrollback', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
@ -344,7 +344,7 @@ describe('terminal scrollback', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('terminal prints more lines than the screen height and exits', function()
|
||||
describe(':terminal prints more lines than the screen height and exits', function()
|
||||
it('will push extra lines to scrollback', function()
|
||||
clear()
|
||||
local screen = Screen.new(30, 7)
|
||||
@ -460,7 +460,7 @@ describe("'scrollback' option", function()
|
||||
screen:detach()
|
||||
end)
|
||||
|
||||
it('defaults to 10000 in terminal buffers', function()
|
||||
it('defaults to 10000 in :terminal buffers', function()
|
||||
set_fake_shell()
|
||||
command('terminal')
|
||||
eq(10000, curbufmeths.get_option('scrollback'))
|
||||
|
@ -20,7 +20,7 @@ local read_file = helpers.read_file
|
||||
|
||||
if helpers.pending_win32(pending) then return end
|
||||
|
||||
describe('tui', function()
|
||||
describe('TUI', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
|
@ -3,8 +3,12 @@ local thelpers = require('test.functional.terminal.helpers')
|
||||
local feed, clear = helpers.feed, helpers.clear
|
||||
local wait = helpers.wait
|
||||
local iswin = helpers.iswin
|
||||
local command = helpers.command
|
||||
local retry = helpers.retry
|
||||
local eq = helpers.eq
|
||||
local eval = helpers.eval
|
||||
|
||||
describe('terminal window', function()
|
||||
describe(':terminal window', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
@ -12,6 +16,19 @@ describe('terminal window', function()
|
||||
screen = thelpers.screen_setup()
|
||||
end)
|
||||
|
||||
it('sets topline correctly #8556', function()
|
||||
-- Test has hardcoded assumptions of dimensions.
|
||||
eq(7, eval('&lines'))
|
||||
command('set shell=sh')
|
||||
command('terminal')
|
||||
retry(nil, nil, function() assert(nil ~= eval('b:terminal_job_pid')) end)
|
||||
-- Terminal/shell contents must exceed the height of this window.
|
||||
command('topleft 1split')
|
||||
feed([[i<cr>]])
|
||||
-- Check topline _while_ in terminal-mode.
|
||||
retry(nil, nil, function() eq(6, eval('winsaveview()["topline"]')) end)
|
||||
end)
|
||||
|
||||
describe("with 'number'", function()
|
||||
it('wraps text', function()
|
||||
feed([[<C-\><C-N>]])
|
||||
|
@ -9,7 +9,7 @@ local eval = helpers.eval
|
||||
local iswin = helpers.iswin
|
||||
local retry = helpers.retry
|
||||
|
||||
describe('terminal', function()
|
||||
describe(':terminal', function()
|
||||
local screen
|
||||
|
||||
before_each(function()
|
||||
|
Reference in New Issue
Block a user