I've just noticed that if the cursor is at the last line of a file and
I enter insert mode, then the buffer pans so that the cursorline is at the bottom of the [sub]window, as if in response to a zb
command, before entering insert mode.
I later found that any cursor movement (e.g., [) also causes the last line of the file to pan down to the bottom of the window.
Is there a setting responsible for this? I would like to disable this new behaviour.
Work-arounds tried
I tried to save all the information on my buffers using :mksession! ~/session.x.vim and restarting things using gvim -S ~/session.x.vim, but the behaviour persisted into the new session.
If one has the BufExplorer plugin, it is possible to avoid the unwanted behaviour by starting a new Gvim session without sourcing the mksession file from the old session, then recover some of the context from the old session. In the old session, you have to write the list of buffers and their folder paths into (say) ~/tmp/tmp.txt, then abandon the old session and start a new gvim session without sourcing ~/session.x.vim. The unwanted behaviour does not persist into such a new session.
To recover the context of the old session, one can use the file names and folder paths in ~/tmp/tmp.txt and a few regular expression search-and-replacements to reconstruct the list of full paths to each file. It is then simple to visit each file in the list using command gf, thereby rebuilding the buffer list.
To avoid this in the future, I'd be curious whether there is a setting that caused the automatic panning of the last line of the file to the bottom of the screen.
Annex: Vim version:
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jul 7 2023 22:50:38)
Included patches: 1-4372
Modified by <cygwin@cygwin.com>
Compiled by <cygwin@cygwin.com>
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_urxvt -tag_any_white
+arabic +find_in_path +mouse_xterm -tcl
+autocmd +float +multi_byte +termguicolors
+autochdir +folding +multi_lang +terminal
-autoservername -footer -mzscheme +terminfo
+balloon_eval +fork() +netbeans_intg +termresponse
+balloon_eval_term +gettext +num64 +textobjects
+browse -hangul_input +packages +textprop
++builtin_terms +iconv +path_extra +timers
+byte_offset +insert_expand +perl/dyn +title
+channel +ipv6 +persistent_undo +toolbar
+cindent +job +popupwin +user_commands
+clientserver +jumplist +postscript +vartabs
+clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +vim9script
+cmdline_hist +langmap -python +viminfo
+cmdline_info +libcall +python3/dyn +virtualedit
+comments +linebreak +quickfix +visual
+conceal +lispindent +reltime +visualextra
+cryptv +listcmds +rightleft +vreplace
+cscope +localmap +ruby/dyn +wildignore
+cursorbind +lua/dyn +scrollbind +wildmenu
+cursorshape +menu +signs +windows
+dialog_con_gui +mksession +smartindent +writebackup
+diff +modify_fname +sodium +X11
+digraphs +mouse +sound -xfontset
+dnd +mouseshape +spell +xim
-ebcdic +mouse_dec +startuptime +xpm
+emacs_tags -mouse_gpm +statusline +xsmp_interact
+eval -mouse_jsbterm -sun_workshop +xterm_clipboard
+ex_extra +mouse_netterm +syntax -xterm_save
+extra_search +mouse_sgr +tag_binary
-farsi -mouse_sysmouse -tag_old_static
system vimrc file: "/etc/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
-I/usr/include/gtk-3.0 -I/usr/include/pango-1.0
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo
-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include
-I/usr/include/atk-1.0 -I/usr/include/freetype2
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/libpng16
-I/usr/include/at-spi-2.0 -I/usr/include/pixman-1
-I/usr/include/harfbuzz -I/usr/include/gio-unix-2.0/ -D_REENTRANT
-I/usr/include/uuid -ggdb -O2 -pipe -Wall -Werror=format-security
-fstack-protector-strong --param=ssp-buffer-size=4
-fdebug-prefix-map=/pub/devel/vim/vim-8.2.4372-2.x86_64/build=/usr/src/debug/vim-8.2.4372-2
-fdebug-prefix-map=/pub/devel/vim/vim-8.2.4372-2.x86_64/src/vim-8.2.4372=/usr/src/debug/vim-8.2.4372-2
-fstack-protector-strong -DSYS_VIMRC_FILE=/etc/vimrc -D_REENTRANT
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -fstack-protector-strong -Wl,--no-as-needed
-L/usr/local/lib -Wl,--as-needed -o vim.exe -lgtk-3 -lgdk-3 -latk-1.0
-lgio-2.0 -lpangocairo-1.0 -lcairo-gobject -lpango-1.0
-lgdk_pixbuf-2.0 -lcairo -lglib-2.0 -lintl -lgobject-2.0 -lSM -lICE
-lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -lelf -lncursesw -lcanberra
-lsodium -liconv -lacl -lattr -lintl -Wl,--enable-auto-import
-Wl,--export-all-symbols -Wl,--enable-auto-image-base
-fstack-protector-strong
-L/usr/lib/perl5/5.36/x86_64-cygwin-threads/CORE -lperl -lpthread -ldl
-lcrypt
--clean? – Christian Brabandt Sep 05 '23 at 06:03vim -u NONEandgvim -u NONE). While cursor is at the last line, I presszz, enter insert mode withi, and no repositioning happens. – Hoblovski Sep 05 '23 at 11:27vimrcfile because it doesn't happen when I launch [G]Vim with thevimrc. Something happened during the use of [G]Vim to cause this. The reason I posted was in case this behaviour was readily recognizable by greater gurus, who would then be able to point to the responsible setting(s), activity/activities, or combination thereof. The responsible conditions were captured in amksessionfile, but that's pretty difficult for me to make sense of. – user2153235 Sep 05 '23 at 16:12mksessionfile from the old session. I've clarified this in the question. – user2153235 Sep 05 '23 at 16:14