请教 Debian 12.6 的 vi 和 vim.tiny 指向同一文件却执行效果不同疑问

1次阅读

共计 4407 个字符,预计需要花费 12 分钟才能阅读完成。

执行 vi 和执行 vim.tiny 为什么是两种不同的模式?
这两个不是指向的是同一个文件 /usr/bin/vim.tiny 吗?
不同的表现在于:

  • 无法使用退格键 backspace
  • 方向键变字母

以下是系统的一些信息:

root@debian:~# whereis vi
vi: /usr/bin/vi /usr/share/man/man1/vi.1.gz

root@debian:~# whereis vim.tiny 
vim.tiny: /usr/bin/vim.tiny
root@debian:~# ls -la /usr/bin/ | grep vi
-rwxr-xr-x  1 root root      14560 Sep 16  2023 dbus-update-activation-environment
lrwxrwxrwx  1 root root         23 May  4  2023 rview -> /etc/alternatives/rview
-rwxr-xr-x  1 root root      18808 Jun 16 05:44 systemd-detect-virt
lrwxrwxrwx  1 root root         20 May  4  2023 vi -> /etc/alternatives/vi
lrwxrwxrwx  1 root root         22 May  4  2023 view -> /etc/alternatives/view
-rwxr-xr-x  1 root root    1629584 May  4  2023 vim.tiny
root@debian:~# ls -la /etc/alternatives/ | grep vi
lrwxrwxrwx  1 root root   17 May  4  2023 ex -> /usr/bin/vim.tiny
lrwxrwxrwx  1 root root   28 May  4  2023 ex.1.gz -> /usr/share/man/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 ex.da.1.gz -> /usr/share/man/da/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 ex.de.1.gz -> /usr/share/man/de/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 ex.fr.1.gz -> /usr/share/man/fr/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 ex.it.1.gz -> /usr/share/man/it/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 ex.ja.1.gz -> /usr/share/man/ja/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 ex.pl.1.gz -> /usr/share/man/pl/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 ex.ru.1.gz -> /usr/share/man/ru/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 ex.tr.1.gz -> /usr/share/man/tr/man1/vim.1.gz
lrwxrwxrwx  1 root root   17 May  4  2023 rview -> /usr/bin/vim.tiny
lrwxrwxrwx  1 root root   17 May  4  2023 vi -> /usr/bin/vim.tiny
lrwxrwxrwx  1 root root   28 May  4  2023 vi.1.gz -> /usr/share/man/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 vi.da.1.gz -> /usr/share/man/da/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 vi.de.1.gz -> /usr/share/man/de/man1/vim.1.gz
lrwxrwxrwx  1 root root   17 May  4  2023 view -> /usr/bin/vim.tiny
lrwxrwxrwx  1 root root   28 May  4  2023 view.1.gz -> /usr/share/man/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 view.da.1.gz -> /usr/share/man/da/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 view.de.1.gz -> /usr/share/man/de/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 view.fr.1.gz -> /usr/share/man/fr/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 view.it.1.gz -> /usr/share/man/it/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 view.ja.1.gz -> /usr/share/man/ja/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 view.pl.1.gz -> /usr/share/man/pl/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 view.ru.1.gz -> /usr/share/man/ru/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 view.tr.1.gz -> /usr/share/man/tr/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 vi.fr.1.gz -> /usr/share/man/fr/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 vi.it.1.gz -> /usr/share/man/it/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 vi.ja.1.gz -> /usr/share/man/ja/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 vi.pl.1.gz -> /usr/share/man/pl/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 vi.ru.1.gz -> /usr/share/man/ru/man1/vim.1.gz
lrwxrwxrwx  1 root root   31 May  4  2023 vi.tr.1.gz -> /usr/share/man/tr/man1/vim.1.gz
root@debian:~# ls -la /etc/vim
total 16
drwxr-xr-x  2 root root 4096 Aug 31 05:17 .
drwxr-xr-x 69 root root 4096 Aug 30 23:37 ..
-rw-r--r--  1 root root 2553 May  4  2023 vimrc
-rw-r--r--  1 root root  662 May  4  2023 vimrc.tiny
root@debian:~# cat /etc/vim/vimrc
"$VIMRUNTIME refers to the versioned system directory where Vim stores its" system runtime files -- /usr/share/vim/vim.
"" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc." This happens after /etc/vim/vimrc(.local) are loaded, so it will override
"any settings in these files."
"If you don't want that to happen, uncomment the below line to prevent
"defaults.vim from being loaded." let g:skip_defaults_vim = 1
"" If you would rather _use_ default.vim's settings, but have the system or
"user vimrc override its settings, then uncomment the line below." source $VIMRUNTIME/defaults.vim

"All Debian-specific settings are defined in $VIMRUNTIME/debian.vim and" sourced by the call to :runtime you can find below.  If you wish to change
"any of those settings, you should do it in this file or" /etc/vim/vimrc.local, since debian.vim will be overwritten everytime an
"upgrade of the vim packages is performed. It is recommended to make changes" after sourcing debian.vim so your settings take precedence.

runtime! debian.vim

"Uncomment the next line to make Vim more Vi-compatible" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes
"numerous options, so any other options should be set AFTER changing" 'compatible'.
"set compatible" Vim5 and later versions support syntax highlighting. Uncommenting the next
"line enables syntax highlighting by default."syntax on

"If using a dark background within the editing area and syntax highlighting" turn on this option as well
"set background=dark" Uncomment the following to have Vim jump to the last position when
"reopening a file"au BufReadPost * if line("'"") > 1 && line("'"") <= line("$") | exe "normal! g'"" | endif

"Uncomment the following to have Vim load indentation rules and plugins" according to the detected filetype.
"filetype plugin indent on" The following are commented out as they cause vim to behave a lot
"differently from regular Vi. They are highly recommended though."set showcmd		"Show (partial) command in status line."set showmatch		"Show matching brackets."set ignorecase		"Do case insensitive matching"set smartcase		"Do smart case matching"set incsearch		"Incremental search"set autowrite		"Automatically save before commands like :next and :make"set hidden		"Hide buffers when they are abandoned"set mouse=a		"Enable mouse usage (all modes)" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif
root@debian:~# cat /etc/vim//vimrc.tiny 
"Vim configuration file, in effect when invoked as"vi". The aim of this" configuration file is to provide a Vim environment as compatible with the
"original vi as possible. Note that ~/.vimrc configuration files as other" configuration files in the runtimepath are still sourced.
"When Vim is invoked differently ("vim","view","evim", ...) this file is" _not_ sourced; /etc/vim/vimrc and/or /etc/vim/gvimrc are.

" Debian system-wide default configuration Vim
set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim90,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after

set compatible

" vim: set ft=vim:
正文完
 0