我现在使用的东西可以通过 ssh 登录两个单独的 Linux 终端,以便使用 vim 进行编码。第一个 ssh 登录是我的主要登录,出于某种原因,如果我使用 vim 打开并编写程序,我可以在插入模式下使用箭头键进行导航。当我使用箭头键时,我永远不必按 Esc,我只需按箭头键上/下/左/右即可,当我仍处于插入模式时,光标会完美移动。由于某种原因,与按住 h/j/k/l 相比,按住其中一个箭头键光标移动速度要快得多(不确定为什么会发生这种情况)。
我的问题是,我无法在辅助 linux ssh 登录(与我使用的主 linux ssh 几乎相同)上重新创建此特性/功能。我觉得必须有一个我可以在命令模式(例如:use arrow keys
)下输入的命令,或者我可以做其他事情来使其永久化。
我知道人们非常不喜欢使用箭头键来导航 vim,但由于特定原因,我目前迫切希望找到答案。我发现的大多数文章和线程都显示模仿类似行为的键盘快捷键,但我特别尝试在插入模式下重新创建常规箭头键的使用。任何人都知道这是否可能,或者为什么这种情况发生在一个 linux ssh 终端而不是另一个?我使用的是 M1 MacBook Air,仅供参考。
编辑: Linux 主终端
:version
在主 Linux 终端上执行的结果是:
:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 01 2022 09:16:32)
Included patches: 1-2269, 3612, 3625, 3669, 3741
Modified by [email protected]
Compiled by [email protected]
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl +clipboard +dnd +gettext +localmap +mouse_urxvt +profile +statusline +timers +windows
+arabic +cmdline_compl -ebcdic -hangul_input +lua +mouse_xterm -python -sun_workshop +title +writebackup
+autocmd +cmdline_hist +emacs_tags +iconv +menu +multi_byte +python3 +syntax +toolbar +X11
+autochdir +cmdline_info +eval +insert_expand +mksession +multi_lang +quickfix +tag_binary +user_commands -xfontset
-autoservername +comments +ex_extra +job +modify_fname -mzscheme +reltime -tag_old_static +vartabs +xim
+balloon_eval +conceal +extra_search +jumplist +mouse +netbeans_intg +rightleft -tag_any_white +vertsplit +xpm
+balloon_eval_term +cryptv -farsi +keymap +mouseshape +num64 -ruby +tcl +virtualedit +xsmp_interact
+browse +cscope +file_in_path +lambda +mouse_dec +packages +scrollbind +termguicolors +visual +xterm_clipboard
++builtin_terms +cursorbind +find_in_path +langmap +mouse_gpm +path_extra +signs +terminal +visualextra -xterm_save
+byte_offset +cursorshape +float +libcall -mouse_jsbterm +perl +smartindent +terminfo +viminfo
+channel +dialog_con_gui +folding +linebreak +mouse_netterm +persistent_undo +sound +termresponse +vreplace
+cindent +diff -footer +lispindent +mouse_sgr +postscript +spell +textobjects +wildignore
+clientserver +digraphs +fork() +listcmds -mouse_sysmouse +printer +startuptime +textprop +wildmenu
system vimrc file: "$VIM/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 -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu
/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/cair
o -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib
/x86_64-linux-gnu/glib-2.0/include -Wdate-time -g -O2 -fdebug-prefix-map=/build/vim-9EpYYi/vim-8.1.2269=. -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTI
FY_SOURCE=1
Linking: gcc -Wl,-E -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0
-lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -lcanberra -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L
/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.30/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm -L/usr/lib/
x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm
做的:verbose set compatible?
结果是compatible
辅助 Linux 终端
:version
在辅助 Linux 终端上执行操作会导致:
:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 01 2022 09:16:32)
Included patches: 1-2269, 3612, 3625, 3669, 3741
Modified by [email protected]
Compiled by [email protected]
Huge version with GTK3 GUI. Features included (+) or not (-):
+acl +clipboard +dnd +gettext +localmap +mouse_urxvt +profile +statusline +timers +windows
+arabic +cmdline_compl -ebcdic -hangul_input +lua +mouse_xterm -python -sun_workshop +title +writebackup
+autocmd +cmdline_hist +emacs_tags +iconv +menu +multi_byte +python3 +syntax +toolbar +X11
+autochdir +cmdline_info +eval +insert_expand +mksession +multi_lang +quickfix +tag_binary +user_commands -xfontset
-autoservername +comments +ex_extra +job +modify_fname -mzscheme +reltime -tag_old_static +vartabs +xim
+balloon_eval +conceal +extra_search +jumplist +mouse +netbeans_intg +rightleft -tag_any_white +vertsplit +xpm
+balloon_eval_term +cryptv -farsi +keymap +mouseshape +num64 -ruby +tcl +virtualedit +xsmp_interact
+browse +cscope +file_in_path +lambda +mouse_dec +packages +scrollbind +termguicolors +visual +xterm_clipboard
++builtin_terms +cursorbind +find_in_path +langmap +mouse_gpm +path_extra +signs +terminal +visualextra -xterm_save
+byte_offset +cursorshape +float +libcall -mouse_jsbterm +perl +smartindent +terminfo +viminfo
+channel +dialog_con_gui +folding +linebreak +mouse_netterm +persistent_undo +sound +termresponse +vreplace
+cindent +diff -footer +lispindent +mouse_sgr +postscript +spell +textobjects +wildignore
+clientserver +digraphs +fork() +listcmds -mouse_sysmouse +printer +startuptime +textprop +wildmenu
system vimrc file: "$VIM/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 -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu
/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/cair
o -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib
/x86_64-linux-gnu/glib-2.0/include -Wdate-time -g -O2 -fdebug-prefix-map=/build/vim-9EpYYi/vim-8.1.2269=. -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTI
FY_SOURCE=1
Linking: gcc -Wl,-E -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0
-lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -lcanberra -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L
/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.30/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm -L/usr/lib/
x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm
做的:verbose set compatible?
结果是nocompatible Last set from /usr/share/vim/vim81/debian.vim line 3