aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md35
-rw-r--r--runtime/doc/eval.txt2
-rw-r--r--runtime/doc/starting.txt2
-rw-r--r--src/nvim/charset.c6
-rw-r--r--src/nvim/ex_cmds2.c29
-rw-r--r--src/nvim/ex_docmd.c16
-rw-r--r--src/nvim/ops.c18
-rw-r--r--src/nvim/testdir/Makefile1
-rw-r--r--src/nvim/testdir/test_registers.vim65
-rw-r--r--src/nvim/testdir/test_virtualedit.vim18
-rw-r--r--test/functional/legacy/packadd_spec.lua23
11 files changed, 176 insertions, 39 deletions
diff --git a/README.md b/README.md
index 803e16aaf0..d3b3752625 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,21 @@ for more information.
[![Throughput Graph](https://graphs.waffle.io/neovim/neovim/throughput.svg)](https://waffle.io/neovim/neovim/metrics)
+Features
+--------
+
+- Modern [GUIs](https://github.com/neovim/neovim/wiki/Related-projects#gui)
+- [API](https://github.com/neovim/neovim/wiki/Related-projects#api-clients)
+ access from any language including clojure, lisp, go, haskell, lua,
+ javascript, perl, python, ruby, rust.
+- Embedded, scriptable [terminal emulator](https://neovim.io/doc/user/nvim_terminal_emulator.html)
+- Asynchronous [job control](https://github.com/neovim/neovim/pull/2247)
+- [Shared data (shada)](https://github.com/neovim/neovim/pull/2506) among multiple editor instances
+- [XDG base directories](https://github.com/neovim/neovim/pull/3470) support
+- Compatible with most Vim plugins, including Ruby and Python plugins.
+
+See [`:help nvim-features`][nvim-features] for the full list!
+
Install from source
-------------------
@@ -57,6 +72,11 @@ Pre-built packages for Windows, macOS, and Linux are found at the
Managed packages are in [Homebrew], [Debian], [Ubuntu], [Fedora], [Arch Linux], [Gentoo],
and [more](https://github.com/neovim/neovim/wiki/Installing-Neovim)!
+Transitioning from Vim
+--------------------
+
+See [`:help nvim-from-vim`](https://neovim.io/doc/user/nvim.html#nvim-from-vim) for instructions.
+
Project layout
--------------
@@ -76,21 +96,6 @@ Project layout
├─ third-party/ cmake subproject to build dependencies
└─ test/ tests (see test/README.md)
-Features
---------
-
-- Modern [GUIs](https://github.com/neovim/neovim/wiki/Related-projects#gui)
-- [API](https://github.com/neovim/neovim/wiki/Related-projects#api-clients)
- access from any language including clojure, lisp, go, haskell, lua,
- javascript, perl, python, ruby, rust.
-- Embedded, scriptable [terminal emulator](https://neovim.io/doc/user/nvim_terminal_emulator.html)
-- Asynchronous [job control](https://github.com/neovim/neovim/pull/2247)
-- [Shared data (shada)](https://github.com/neovim/neovim/pull/2506) among multiple editor instances
-- [XDG base directories](https://github.com/neovim/neovim/pull/3470) support
-- Compatible with most Vim plugins, including Ruby and Python plugins.
-
-See [`:help nvim-features`][nvim-features] for the full list!
-
License
-------
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index a306c77829..dce531b663 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1508,7 +1508,7 @@ v:errmsg Last given error message. It's allowed to set this variable.
:silent! next
:if v:errmsg != ""
: ... handle error
-
+<
*v:errors* *errors-variable*
v:errors Errors found by assert functions, such as |assert_true()|.
This is a list of strings.
diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt
index ad1077bcab..24fb87a6b4 100644
--- a/runtime/doc/starting.txt
+++ b/runtime/doc/starting.txt
@@ -837,7 +837,7 @@ resulting file, when executed with a ":source" command:
such as creating menu items in the GUI version.
After restoring the Session, the full filename of your current Session is
-available in the internal variable "v:this_session" |this_session-variable|.
+available in the internal variable |v:this_session|.
An example mapping: >
:nmap <F2> :wa<Bar>exe "mksession! " . v:this_session<CR>:so ~/sessions/
This saves the current Session, and starts off the command to load another.
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index a02d2a812d..231bff26e8 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -1344,7 +1344,11 @@ colnr_T getvcol_nolist(pos_T *posp)
colnr_T vcol;
curwin->w_p_list = false;
- getvcol(curwin, posp, NULL, &vcol, NULL);
+ if (posp->coladd) {
+ getvvcol(curwin, posp, NULL, &vcol, NULL);
+ } else {
+ getvcol(curwin, posp, NULL, &vcol, NULL);
+ }
curwin->w_p_list = list_save;
return vcol;
}
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index f07bc0e137..120278d3fb 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -2693,14 +2693,27 @@ void ex_packloadall(exarg_T *eap)
/// ":packadd[!] {name}"
void ex_packadd(exarg_T *eap)
{
- static const char *plugpat = "pack/*/opt/%s"; // NOLINT
-
- size_t len = STRLEN(plugpat) + STRLEN(eap->arg);
- char *pat = (char *)xmallocz(len);
- vim_snprintf(pat, len, plugpat, eap->arg);
- do_in_path(p_pp, (char_u *)pat, DIP_ALL + DIP_DIR + DIP_ERR, add_pack_plugin,
- eap->forceit ? &APP_ADD_DIR : &APP_BOTH);
- xfree(pat);
+ static const char *plugpat = "pack/*/%s/%s"; // NOLINT
+ int res = OK;
+
+ // Round 1: use "start", round 2: use "opt".
+ for (int round = 1; round <= 2; round++) {
+ // Only look under "start" when loading packages wasn't done yet.
+ if (round == 1 && did_source_packages) {
+ continue;
+ }
+
+ const size_t len = STRLEN(plugpat) + STRLEN(eap->arg) + 5;
+ char *pat = xmallocz(len);
+ vim_snprintf(pat, len, plugpat, round == 1 ? "start" : "opt", eap->arg);
+ // The first round don't give a "not found" error, in the second round
+ // only when nothing was found in the first round.
+ res = do_in_path(p_pp, (char_u *)pat,
+ DIP_ALL + DIP_DIR
+ + (round == 2 && res == FAIL ? DIP_ERR : 0),
+ add_pack_plugin, eap->forceit ? &APP_ADD_DIR : &APP_BOTH);
+ xfree(pat);
+ }
}
/// ":options"
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index b077aefa1e..97369c50d9 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -7920,7 +7920,7 @@ static void ex_mkrc(exarg_T *eap)
if (failed) {
EMSG(_(e_write));
} else if (eap->cmdidx == CMD_mksession) {
- // successful session write - set this_session var
+ // successful session write - set v:this_session
char *const tbuf = xmalloc(MAXPATHL);
if (vim_FullName(fname, tbuf, MAXPATHL, false) == OK) {
set_vim_var_string(VV_THIS_SESSION, tbuf, -1);
@@ -8784,15 +8784,15 @@ makeopens(
if (ssop_flags & SSOP_BUFFERS)
only_save_windows = FALSE; /* Save ALL buffers */
- /*
- * Begin by setting the this_session variable, and then other
- * sessionable variables.
- */
- if (put_line(fd, "let v:this_session=expand(\"<sfile>:p\")") == FAIL)
+ // Begin by setting v:this_session, and then other sessionable variables.
+ if (put_line(fd, "let v:this_session=expand(\"<sfile>:p\")") == FAIL) {
return FAIL;
- if (ssop_flags & SSOP_GLOBALS)
- if (store_session_globals(fd) == FAIL)
+ }
+ if (ssop_flags & SSOP_GLOBALS) {
+ if (store_session_globals(fd) == FAIL) {
return FAIL;
+ }
+ }
/*
* Close all windows but one.
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index c95345f9b2..67171cb27e 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -2509,19 +2509,27 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
}
// Some versions of Vi use ">=" here, some don't...
if (yanklines > (size_t)p_report) {
+ char namebuf[100];
+
+ if (oap->regname == NUL) {
+ *namebuf = NUL;
+ } else {
+ vim_snprintf(namebuf, sizeof(namebuf), _(" into \"%c"), oap->regname);
+ }
+
// redisplay now, so message is not deleted
update_topline_redraw();
if (yanklines == 1) {
if (yank_type == kMTBlockWise) {
- MSG(_("block of 1 line yanked"));
+ smsg(_("block of 1 line yanked%s"), namebuf);
} else {
- MSG(_("1 line yanked"));
+ smsg(_("1 line yanked%s"), namebuf);
}
} else if (yank_type == kMTBlockWise) {
- smsg(_("block of %" PRId64 " lines yanked"),
- (int64_t)yanklines);
+ smsg(_("block of %" PRId64 " lines yanked%s"),
+ (int64_t)yanklines, namebuf);
} else {
- smsg(_("%" PRId64 " lines yanked"), (int64_t)yanklines);
+ smsg(_("%" PRId64 " lines yanked%s"), (int64_t)yanklines, namebuf);
}
}
}
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index e3b717989e..87d7ff5bad 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -93,6 +93,7 @@ NEW_TESTS ?= \
test_quickfix.res \
test_quotestar.res \
test_recover.res \
+ test_registers.res \
test_retab.res \
test_scrollbind.res \
test_search.res \
diff --git a/src/nvim/testdir/test_registers.vim b/src/nvim/testdir/test_registers.vim
new file mode 100644
index 0000000000..d7b6de5652
--- /dev/null
+++ b/src/nvim/testdir/test_registers.vim
@@ -0,0 +1,65 @@
+
+func Test_yank_shows_register()
+ enew
+ set report=0
+ call setline(1, ['foo', 'bar'])
+ " Line-wise
+ exe 'norm! yy'
+ call assert_equal('1 line yanked', v:statusmsg)
+ exe 'norm! "zyy'
+ call assert_equal('1 line yanked into "z', v:statusmsg)
+ exe 'norm! yj'
+ call assert_equal('2 lines yanked', v:statusmsg)
+ exe 'norm! "zyj'
+ call assert_equal('2 lines yanked into "z', v:statusmsg)
+
+ " Block-wise
+ exe "norm! \<C-V>y"
+ call assert_equal('block of 1 line yanked', v:statusmsg)
+ exe "norm! \<C-V>\"zy"
+ call assert_equal('block of 1 line yanked into "z', v:statusmsg)
+ exe "norm! \<C-V>jy"
+ call assert_equal('block of 2 lines yanked', v:statusmsg)
+ exe "norm! \<C-V>j\"zy"
+ call assert_equal('block of 2 lines yanked into "z', v:statusmsg)
+
+ bwipe!
+endfunc
+
+func Test_display_registers()
+ e file1
+ e file2
+ call setline(1, ['foo', 'bar'])
+ /bar
+ exe 'norm! y2l"axx'
+ call feedkeys("i\<C-R>=2*4\n\<esc>")
+ call feedkeys(":ls\n", 'xt')
+
+ let a = execute('display')
+ let b = execute('registers')
+
+ call assert_equal(a, b)
+ call assert_match('^\n--- Registers ---\n'
+ \ . '"" a\n'
+ \ . '"0 ba\n'
+ \ . '"1 b\n'
+ \ . '"a b\n'
+ \ . '.*'
+ \ . '"- a\n'
+ \ . '.*'
+ \ . '": ls\n'
+ \ . '"% file2\n'
+ \ . '"# file1\n'
+ \ . '"/ bar\n'
+ \ . '"= 2\*4', a)
+
+ let a = execute('registers a')
+ call assert_match('^\n--- Registers ---\n'
+ \ . '"a b', a)
+
+ let a = execute('registers :')
+ call assert_match('^\n--- Registers ---\n'
+ \ . '": ls', a)
+
+ bwipe!
+endfunc
diff --git a/src/nvim/testdir/test_virtualedit.vim b/src/nvim/testdir/test_virtualedit.vim
index 2b8849f488..d49025237b 100644
--- a/src/nvim/testdir/test_virtualedit.vim
+++ b/src/nvim/testdir/test_virtualedit.vim
@@ -41,3 +41,21 @@ func Test_paste_end_of_line()
bwipe!
set virtualedit=
endfunc
+
+func Test_edit_CTRL_G()
+ new
+ set virtualedit=insert
+ call setline(1, ['123', '1', '12'])
+ exe "normal! ggA\<c-g>jx\<c-g>jx"
+ call assert_equal(['123', '1 x', '12 x'], getline(1,'$'))
+
+ set virtualedit=all
+ %d_
+ call setline(1, ['1', '12'])
+ exe "normal! ggllix\<c-g>jx"
+ call assert_equal(['1 x', '12x'], getline(1,'$'))
+
+
+ bwipe!
+ set virtualedit=
+endfunc
diff --git a/test/functional/legacy/packadd_spec.lua b/test/functional/legacy/packadd_spec.lua
index fb308475c0..67f6006d1d 100644
--- a/test/functional/legacy/packadd_spec.lua
+++ b/test/functional/legacy/packadd_spec.lua
@@ -58,6 +58,24 @@ describe('packadd', function()
call assert_fails("packadd", 'E471:')
endfunc
+ func Test_packadd_start()
+ let plugdir = expand(s:topdir . '/pack/mine/start/other')
+ call mkdir(plugdir . '/plugin', 'p')
+ set rtp&
+ let rtp = &rtp
+ filetype on
+
+ exe 'split ' . plugdir . '/plugin/test.vim'
+ call setline(1, 'let g:plugin_works = 24')
+ wq
+
+ packadd other
+
+ call assert_equal(24, g:plugin_works)
+ call assert_true(len(&rtp) > len(rtp))
+ call assert_true(&rtp =~ (escape(plugdir, '\') . '\($\|,\)'))
+ endfunc
+
func Test_packadd_noload()
call mkdir(s:plugdir . '/plugin', 'p')
call mkdir(s:plugdir . '/syntax', 'p')
@@ -286,6 +304,11 @@ describe('packadd', function()
expected_empty()
end)
+ it('loads packages from "start" directory', function()
+ call('Test_packadd_start')
+ expected_empty()
+ end)
+
describe('command line completion', function()
local Screen = require('test.functional.ui.screen')
local screen