Index ¦ Archives ¦ Atom ¦ RSS

vim

Understanding vim on Debian

Now that I understand how Debian manages vi and vim and I've grasped the purpose of the vim-tiny package, it's time to determine the requirements for obtaining a more advanced vim binary with enhanced features or support for additional functionalities.

A brief search for additional information on vim-tiny suggests various alternatives for a more comprehensive vim experience:

pionen@lilit:~$ apt-cache show vim-tiny
Package: vim-tiny
Source: vim
Version: 2:8.2.2434-3+deb11u1
Installed-Size: 1574
Maintainer: Debian Vim Maintainers <team+vim@tracker.debian.org>
Architecture: amd64
Provides: editor
Depends: vim-common (= 2:8.2.2434-3+deb11u1), libacl1 (>= 2.2.23), libc6 (>= 2.15), libselinux1 (>= 3.1~), libtinfo6 (>= 6)
Suggests: indent
Description-en: Vi IMproved - enhanced vi editor - compact version
 Vim is an almost compatible version of the UNIX editor Vi.
 .
 This package contains a minimal version of Vim compiled with no GUI and
 a small subset of features. This package's sole purpose is to provide
 the vi binary for base installations.
 .
 If a vim binary is wanted, try one of the following more featureful
 packages: vim, vim-nox, vim-athena, or vim-gtk3.
Description-md5: 85f2dbef1339af3dcf83d9ee00fd5e22
Homepage: https://www.vim.org/
Tag: devel::editor, implemented-in::c, interface::text-mode, role::program,
 uitoolkit::ncurses, use::editing, works-with::text, works-with::unicode
Section: editors
Priority: important
Filename: pool/main/v/vim/vim-tiny_8.2.2434-3+deb11u1_amd64.deb
Size: 744284
MD5sum: 3b101104ccb4e8367298e4ea9dc33d27
SHA256: 0cfc3ce179181f9c08f8460360a8bcba05c214d75ba51d78ecf021e42c9a4261

Running both apt-cache show vim-athena and apt-cache show vim-gtk3 reveals that both packages offer a graphical user interface, which I neither desire nor require.

apt-cache show vim displays information that suggests this could be the solution I've been searching for:

pionen@lilit:~$ apt-cache show vim
Package: vim
Version: 2:8.2.2434-3+deb11u1
Installed-Size: 3286
Maintainer: Debian Vim Maintainers <team+vim@tracker.debian.org>
Architecture: amd64
Provides: editor
Depends: vim-common (= 2:8.2.2434-3+deb11u1), vim-runtime (= 2:8.2.2434-3+deb11u1), libacl1 (>= 2.2.23), libc6 (>= 2.29), libgpm2 (>= 1.20.7), libselinux1 (>= 3.1~), libtinfo6 (>= 6)
Suggests: ctags, vim-doc, vim-scripts
Description-en: Vi IMproved - enhanced vi editor
 Vim is an almost compatible version of the UNIX editor Vi.
 .
 Many new features have been added: multi level undo, syntax
 highlighting, command line history, on-line help, filename
 completion, block operations, folding, Unicode support, etc.
 .
 This package contains a version of vim compiled with a rather
 standard set of features.  This package does not provide a GUI
 version of Vim.  See the other vim-* packages if you need more
 (or less).
Description-md5: 59e8b8f7757db8b53566d5d119872de8
Homepage: https://www.vim.org/
Tag: devel::editor, implemented-in::c, interface::commandline,
 interface::text-mode, role::program, scope::application,
 uitoolkit::ncurses, use::editing, works-with::text, works-with::unicode
Section: editors
Priority: optional
Filename: pool/main/v/vim/vim_8.2.2434-3+deb11u1_amd64.deb
Size: 1494176
MD5sum: f74e7886b6610f74d06c789eeb144b9c
SHA256: b06d11fdee525b919deb4778f7af352ebf3d6ce2591c8fb8e02e52f1ae90ef7d

And apt-cache show vim-nox shows me that vim-nox provides support for scripting languages, Python among them, which is missing from the bare minimum option provided by the vim package.

So I installed it:

su -c “apt-get install vim-nox”

The first thing I noticed after installing vim-nox is that now vi points to vim.nox, meaning that when running vi it will be actually running vim.nox, which is not what I was expecting.

pionen@lilit:~$ whereis vi
vi: /usr/bin/vi /usr/share/man/man1/vi.1.gz
pionen@lilit:~$ ls -la /usr/bin/vi
lrwxrwxrwx 1 root root 20 May 28  2021 /usr/bin/vi -> /etc/alternatives/vi
pionen@lilit:~$ ls -la /etc/alternatives/vi
lrwxrwxrwx 1 root root 16 Oct 12  2022 /etc/alternatives/vi -> /usr/bin/vim.nox

I really struggled to find a fix for this, it took me a while to get to the answer, but I found it:

https://superuser.com/questions/852177/why-does-the-vi-command-open-vim-editor/852219#852219

I just need to run vim and addition pass some parameters next to it:

vim -u NONE

Later I found the same suggestion on the /usr/share/vim/vim82/defaults.vim file:

" This is loaded if no vimrc file was found.
" Except when Vim is run with "-u NONE" or "-C".
" Individual settings can be reverted with ":set option&".
" Other commands can be reverted as mentioned below.

It's quite convenient to have the ability to run vi without loading any additional features from vim-nox when you simply need to make a minor edit, without relying on plugins and such. To simplify this, I added the following line to my ~/.bash_aliases file. This ensures that when I run vi it loads vim-nox without any settings or features from configuration files such as /etc/vim/vimrc /usr/share/vim/vim82/debian.vim or /usr/share/vim/vim82/defaults.vim:

Here's the code snippet I added to my ~/.bash_aliases file to ensure vi runs vim-nox without any additional settings:

# Alias to run vi instead of vim.nox
alias vi="vim -u NONE"

With this configuration, I'm all set! In the future, I'll be sharing my ~/.vimrc file and its contents.

© Porfirio Páiz. Built using Pelican. Theme by Giulio Fidente on github.