aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/filetype.txt15
-rw-r--r--src/nvim/edit.c3
-rw-r--r--src/nvim/eval.c8
-rw-r--r--src/nvim/testdir/test_functions.vim9
4 files changed, 30 insertions, 5 deletions
diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt
index 1f7d09ae32..c579c390c6 100644
--- a/runtime/doc/filetype.txt
+++ b/runtime/doc/filetype.txt
@@ -515,9 +515,6 @@ MAN *ft-man-plugin* *:Man* *man.vim*
View manpages in Nvim. Supports highlighting, completion, locales, and
navigation. Also see |find-manpage|.
-To use Nvim as a manpager: >
- export MANPAGER='nvim +Man!'
-
man.vim will always attempt to reuse the closest man window (above/left) but
otherwise create a split.
@@ -554,6 +551,18 @@ Variables:
:let b:man_default_sections = '3,2'
*g:man_hardwrap* Hard-wrap to $MANWIDTH. May improve layout.
+To use Nvim as a manpager: >
+ export MANPAGER='nvim +Man!'
+
+Note that when running `man` from the shell and with that `MANPAGER` in your
+environment, `man` will pre-format the manpage using `groff`. Thus, Neovim
+will inevitably display the manual page as it was passed to it from stdin. One
+of the caveats of this is that the width will _always_ be hard-wrapped and not
+soft wrapped as with `:Man`. You can set in your environment: >
+ export MANWIDTH=999
+
+So `groff`'s pre-formatting output will be the same as with `:Man` i.e soft-wrapped.
+
PDF *ft-pdf-plugin*
Two maps, <C-]> and <C-T>, are provided to simulate a tag stack for navigating
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 52efd72797..1d795621e5 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -674,7 +674,8 @@ static int insert_execute(VimState *state, int key)
// there is nothing to add, CTRL-L works like CTRL-P then.
if (s->c == Ctrl_L
&& (!CTRL_X_MODE_LINE_OR_EVAL(ctrl_x_mode)
- || (compl_shown_match->cp_str != NULL
+ || (compl_shown_match != NULL
+ && compl_shown_match->cp_str != NULL
&& (int)STRLEN(compl_shown_match->cp_str)
> curwin->w_cursor.col - compl_col))) {
ins_compl_addfrommatch();
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 879600b9b1..d883b53ed2 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -15217,8 +15217,14 @@ static void set_buffer_lines(buf_T *buf, linenr_T lnum_arg, bool append,
if (added > 0) {
appended_lines_mark(append_lnum, added);
+
+ // Only adjust the cursor for buffers other than the current, unless it
+ // is the current window. For curbuf and other windows it has been done
+ // in mark_adjust_internal().
FOR_ALL_TAB_WINDOWS(tp, wp) {
- if (wp->w_buffer == buf && wp->w_cursor.lnum > append_lnum) {
+ if (wp->w_buffer == buf
+ && (wp->w_buffer != curbuf || wp == curwin)
+ && wp->w_cursor.lnum > append_lnum) {
wp->w_cursor.lnum += added;
}
}
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index fe3b8bef6e..6c3d944ad5 100644
--- a/src/nvim/testdir/test_functions.vim
+++ b/src/nvim/testdir/test_functions.vim
@@ -592,6 +592,15 @@ func Test_mode()
set complete&
endfunc
+func Test_append()
+ enew!
+ split
+ call append(0, ["foo"])
+ split
+ only
+ undo
+endfunc
+
func Test_getbufvar()
let bnr = bufnr('%')
let b:var_num = '1234'