minimal-vim-config – The Efficient Minimal Vim/Neovim Configuration

The minimal-vim-config project is a Vim configuration that is intended to serve as a solid foundation for a Vim configuration.

The author began developing this configuration upon first adopting Vim and has continuously refined it over 25 years of research and testing to identify the most effective parameters and optimizations for a Vim configuration file.

This Vim configuration does not install any plugins. It lets you choose exactly which plugins to use, giving you the freedom to build a setup suited to your specific needs without unnecessary dependencies or bloat.

Installation

Clone the repository into ~/.minimal-vim-config:

git clone https://github.com/jamescherti/minimal-vim-config ~/.minimal-vim-configCode language: plaintext (plaintext)

Create symbolic links for Vim:

ln -sf ~/.minimal-vim-config/minimal-vim-config.vim ~/.vimrcCode language: plaintext (plaintext)

Create symbolic links for Neovim:

mkdir -p ~/.config/nvim
ln -sf ~/.minimal-vim-config/minimal-vim-config.vim ~/.config/nvim/init.vimCode language: plaintext (plaintext)

Update

To update minimal-vim-config with the latest changes from the repository, execute the following command:

git -C ~/.minimal-vim-config pullCode language: plaintext (plaintext)

Features

This vimrc enhances defaults that improve the editing experience with Vim, based on extensive research and testing.

Miscellaneous enhancements:

  • Automatically remove unnecessary whitespace before saving files.
  • Disables compatibility with Vi and uses Vim-specific settings.
  • Prevents loading the configuration multiple times.

Encoding and File Handling:

  • Sets global encoding, file encodings, and script encoding to UTF-8.
  • Allows loading an optional pre-configuration script (~/.vim/before.vim).
  • Allows loading an optional post-configuration script (~/.vim/after.vim).

Font Settings:

  • Configures default font and size (DejaVu Sans Mono at size 14).
  • Offers a method to scale the GUI font size within a defined range (6-30).

Session Management:

  • Defines options for Vim sessions and view settings (e.g., folds, current directory, cursor position).
  • Restore the cursor position when editing a file, except for Git commit files such as COMMIT_EDITMSG.

GUI and Console Configuration:

  • Customizes GUI-specific settings, including window size, font rendering, cursor behavior, and disabling unnecessary UI elements.
  • Improves color handling and terminal display with 256-color support and true color.

Syntax, Indentation, and Formatting:

  • Enables syntax highlighting and filetype-based indentation plugins.
  • Configures indentation style (spaces instead of tabs, 4 spaces per indentation level).
  • Automatically wraps comments and disables smart indenting features for better manual control.

Status Line:

  • Customizes the status line to show relevant information such as paste mode, wrap status, filename, line/column number, and current Git branch.

Window and Layout Settings:

  • Sets split window behavior (e.g., splits right and below).
  • Configures window size and scrolling behavior.

Backup and Undo Settings:

  • Disables backup files and sets undo options (e.g., persistent undo with undo files).

Key Mappings and Shortcuts:

  • Assigns useful key mappings (e.g., tabs, grep, for writing files, changing directories, adjusting font size).
  • Custom leader key (,), allowing for personalized shortcuts.

Search Settings:

  • Configures incremental search, case-sensitive search (smartcase), and disables search wrapping.

Language and Spell Check:

  • Configures spell checking and defines custom dictionary and thesaurus files.

Clipboard Integration:

  • Supports clipboard integration (copy/paste between Vim and external applications) when available.

File Type Specific Settings:

  • Defines custom settings for specific file types (e.g., Dockerfile, YAML, Python, Shell, Vim).

Autocommands:

  • Uses autocommands to automate behaviors like adjusting settings when a file type is detected or resizing windows on Vim resize events.

Mouse Configuration:

  • Configures mouse support in various modes, including the ability to drag and select text within Vim without switching to visual mode.

Optimization Settings:

  • Includes optimizations for smooth scrolling and fast terminal connections, including reducing screen redraw times.

Smart Write Function:

  • Defines a function (smart_write) to save files intelligently, ensuring proper handling of modified and non-modified files.

Better tabline:

  • Enhance the visual clarity of the tabline by displaying solely the filename and removing unnecessary information.

Useful functions:

  • Select pasted text
  • Search the current selection using //, *, or #.

Links

Leave a Reply

Your email address will not be published. Required fields are marked *