To make a default Vim installation more useful, type the following 5 lines into its .vimrc file:

set hls
set ic
set is
set nu
set noswf

Thoues 5 lines allow you to:

  • set hls - highlight all search results
  • set ic - do case insensitive search
  • set is - show incremental search results as you type
  • set nu - display line number
  • set noswf - disable swap file

Thoese 5 lines can be combined into a single line like below:

set hls ic is nu noswf

Vim is a powerful text editor for Unix/Linux and I often use to view and edit files. Unfortunately, Vim’s default configurations lack several important usability features compared to popular alternative text editors, such as VSCode.

The undesirable defaults are not an issue on my own computer, as I can take the time to configure them. However, often I’d find myself debugging or reading logs on near-fresh Linux installations (eg. virtual machines spun up to do integration testing, cloud env.), where Vim had not yet been configured.

Over time I start using the text editor setup that I needed the most. To set it up, I run vim ~/.vimrc manually, add those 5 lines, save and restart vim with a new configuration.


Reference:

  1. Vim
  2. Neovim.io
  3. Helping a Million Developers Exit Vim
  4. Learn Vim Progressively
  5. VIM AFTER 11 YEARS
  6. Vim colors

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee