Vim Workflows and Config Tips for Linux Sysadmins
Vim remains one of the most efficient editors available on Linux and Unix systems. While it has a steep learning curve, the payoff in speed and capability is substantial once you develop muscle memory. This guide covers practical configuration strategies, essential keybindings, and workflow improvements that actually matter in daily use.
Setting up your configuration
A solid .vimrc (or init.vim/init.lua for Neovim) provides the foundation for an effective setup. Rather than starting from scratch, consider using a well-maintained configuration as a base and customizing from there.
For version control, store your dotfiles in a Git repository:
cd ~
git clone https://github.com/yourusername/dotfiles.git ~/.config/nvim
# For traditional Vim:
ln -s ~/.config/nvim/init.vim ~/.vimrc
If migrating from an existing setup, carefully merge settings rather than overwriting. Key areas to configure:
- Plugin manager: Use
lazy.nvimfor Neovim (faster startup) orvim-plugfor traditional Vim - Leader key: Set to a key you can reach easily (many use space:
let mapleader = " ") - Color scheme: Choose one that works for your terminal (try
tokyonight,gruvbox, ornord) - Tab and indent behavior: Consistent
shiftwidth,tabstop, andexpandtabsettings - Language-specific settings: File type detection and formatting rules
Version control your dotfiles so you can sync across machines and revert problematic changes quickly.
Movement and navigation
Home row navigation keeps you efficient:
h,j,k,lfor movement (disable arrow keys in your config to build the habit)w(next word),b(previous word),e(end of word),ge(end of previous word)f<char>to jump to a character on the current line;;repeats forward,,repeats backward/<pattern>to search forward,?<pattern>to search backward*to search for the word under the cursorGto go to end of file,ggto go to start,:<number>or<number>Gto jump to a specific line%to jump between matching brackets, parentheses, or braces
Use counts with motions: 3w moves three words forward, 5j moves five lines down. This is faster than repeated keypresses.
Text selection and editing
Vim’s selection modes give you precise control:
- Visual character mode (
v): Select individual characters - Visual line mode (
V): Select entire lines (useful for moving blocks of code) - Visual block mode (
Ctrl+V): Select columns; perfect for multi-line edits or adding comments to multiple lines
Combine selection with operations:
d<motion>deletes (e.g.,dwdeletes a word,d$deletes to end of line)c<motion>deletes and enters insert mode (e.g.,cwchanges a word)y<motion>yanks (copies) textgqformats (wraps) selected text totextwidth
For complex edits, use visual block mode with I (insert at start) or A (append at end):
" To comment multiple lines in a config file:
1. Ctrl+V to enter block mode
2. Move down to select all lines
3. I to insert at the start
4. Type # and space
5. Esc to apply to all selected lines
Search and replace
Replace operations are powerful but need care:
:s/old/new/replaces the first occurrence on the current line:s/old/new/greplaces all occurrences on the current line:%s/old/new/greplaces globally in the entire file:%s/old/new/gcreplaces globally with confirmation on each match (safer for large changes):5,20s/old/new/greplaces only in lines 5–20
Use regex patterns for complex replacements. For example, :%s/\(.*\)_old/\1_new/ swaps suffixes while preserving prefixes.
Working with multiple files and splits
Vim’s buffer and split system allows efficient multi-file editing:
Buffers (in-memory file list):
:bn(next buffer),:bp(previous buffer):b <name>jump to a specific buffer:lslist all open buffers:bdclose a buffer without closing Vim
Splits (visible windows):
Ctrl+Wfollowed bys(horizontal split),v(vertical split)Ctrl+Wfollowed by arrow keys orh/j/k/lto switch between splitsCtrl+Wfollowed by=to equalize split sizes,|to maximize width,_to maximize height
For working with a project directory structure, use Netrw (built-in):
" Open file browser
:e .
" Or configure a key:
nnoremap <leader>f :Explore<CR>
Alternatively, use vim-vinegar or nvim-tree for a better file browsing experience.
Neovim-specific features
Neovim 0.9+ includes native LSP support—no complex setup required. Install the nvim-lspconfig plugin and enable LSP for your languages:
-- init.lua
require('lspconfig').pyright.setup({}) -- Python
require('lspconfig').ts_ls.setup({}) -- TypeScript
require('lspconfig').rust_analyzer.setup({}) -- Rust
Pair LSP with a completion framework like nvim-cmp:
local cmp = require('cmp')
cmp.setup({
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'buffer' },
})
})
Neovim also supports Lua configuration (faster and more expressive than pure VimScript):
-- init.lua
vim.opt.number = true
vim.opt.expandtab = true
vim.opt.shiftwidth = 4
vim.opt.textwidth = 80
vim.keymap.set('n', '<leader>w', ':w<CR>', { noremap = true })
Practical habits to build efficiency
- Learn one command per session: Master movement first, then selection, then operations. Rushing to memorize everything leads to muscle memory failures.
- Use counts liberally:
10jis faster than holding downj. - Map frequently-used operations: Create custom keybindings for commands you use daily.
- Practice visual mode: It’s intuitive and faster for many edits than remembering complex motions.
- Use marks for large jumps:
m<letter>sets a mark,'<letter>jumps to it. Useful for navigating large files.
Resources for deeper learning
:helpwithin Vim accesses comprehensive documentationvimtutoris a built-in interactive tutorial (run it from the terminal)- Browse community configurations at
github.com/dotfiles/dotfilesfor configuration inspiration vim.fandom.comcovers advanced techniques and edge cases- Practice with real work rather than drills—muscle memory develops faster with actual editing tasks

Added Latex Writing in Vim with the Help of vim-latex: http://www.fclose.com/5242/vim-howtos-and-tips/#latex-writing-in-vim-with-the-help-of-vim-latex
Also check the posts on FAQ tagged with vim: https://www.systutorials.com/qa/tag/vim
You can use `CTRL-O` and `CTRL-I` to jump to previous/next position jumped by `g` or `gg` or `G` or similar commands.
You can use `g;` and `g,`can jump to the previous/next changed places.
Filename/pathname autocomplete:
You can autocomplete filenames or pathnames in insert mode of vim by
`Ctrl-x` `Ctrl-f`
Find the current filetype in Vim:
:set filetype?
or, in short
:se ft?
or,
:echo &filetype
or, in short
:echo &ft
Set the character encoding for a file in vim:
set fileencodings=utf-8,latin1
It can contain a list of encodings. Vim will try the encodings from left to right till it find a workign one.