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

apt-cache show vim-nox reveals that vim-nox provides support for scripting languages, including Python, which is absent in the minimal 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 actually runs vim.nox, which was unexpected.

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 struggled to find a fix for this, but I eventually found the solution:

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

I just needed to run vim and pass some parameters to avoid loading additional features:

vim -u NONE

Later, I found the same suggestion in 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.

This setup allows me to run vi without loading any additional features from vim-nox, which is useful for quick edits without plugins. To simplify this, I added the following alias to my ~/.bash_aliases file:

# Alias to run vi without additional features
alias vi="vim -u NONE"

With this configuration, I'm all set! In a future post, I’ll share my ~/.vimrc file and its configuration details.

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