Vim Tips for Daily Development
Split the current window horizontally:
Ctrl-W Ctrl-S
Switch between windows:
Ctrl-W Ctrl-W " toggle to next window
Ctrl-W j " move to window below
Ctrl-W k " move to window above
Ctrl-W h " move to window left
Ctrl-W l " move to window right
Rotate window positions:
Ctrl-W Ctrl-R " rotate clockwise
Ctrl-W Ctrl-X " exchange with next window
Resize windows:
Ctrl-W Ctrl-_ " maximize current window
Ctrl-W Ctrl-= " equalize all window heights
Ctrl-W + " increase height
Ctrl-W - " decrease height
Ctrl-W > " increase width
Ctrl-W < " decrease width
Use :vsplit or Ctrl-W Ctrl-V to split vertically. Close a window with :close or Ctrl-W c.
Search and Replace
Basic search:
/pattern " search forward
?pattern " search backward
n " next match
N " previous match
Replace with confirmation:
:%s/old/new/gc
Breaking down the flags:
%— operate on entire file (omit for current line only)g— replace all occurrences per line (withoutg, only the first match per line is replaced)c— confirm each replacement interactively
For case-insensitive replacement, add the i flag:
:%s/old/new/gci
To replace only in a visual selection, select the range and use:
:s/old/new/gc
Visual and Block Mode
Enter visual mode to select text:
v " character-wise selection
V " line-wise selection
Ctrl-V " block-wise selection (rectangular blocks)
Move the cursor while in visual mode to extend the selection. Block mode is particularly useful for editing columns of text — select a rectangular block, then use I to insert or A to append text at the end of each line in the selection.
In block mode, you can:
- Delete the selection:
d - Replace with text:
c(then type replacement, which applies to all lines) - Indent the block:
>or<
Note: If you’ve configured behave mswin, Ctrl-V may be mapped to paste instead. Use Ctrl-Q as an alternative for block selection in that case.
Optimize ESC Key Usage
The ESC key sits in an awkward location on most keyboards. Since you’ll press it frequently in Vim, remap it to something more convenient. Ctrl-[ is a built-in equivalent that requires minimal hand movement:
" In your .vimrc or init.vim, optionally add:
inoremap <C-[> <Esc>
Many users also prefer remapping to Ctrl-C or Ctrl-\ depending on their keyboard layout and muscle memory. Experiment to find what works best for your workflow.
Essential Editor Configuration
A well-configured editor dramatically improves productivity. For Vim users, invest time in crafting a solid vimrc. For Emacs users, use use-package for cleaner configuration management. Both editors support extensive plugin ecosystems that can transform them into full IDEs.
Learn the navigation commands thoroughly before adding plugins. Mastery of core movement commands (word, paragraph, search motions in Vim; mark, isearch, ace-jump in Emacs) provides more productivity gains than any single plugin.
Performance Tips
Large files can slow down both editors. For Vim, set lazyredraw and disable syntax highlighting for files over a certain size. For Emacs, use so-long-mode for files with long lines. Both editors benefit from disabling line numbers on very large files to improve scrolling performance.
Quick Verification
After applying the changes described above, verify that everything works as expected. Run the relevant commands to confirm the new configuration is active. Check system logs for any errors or warnings that might indicate problems. If something does not work as expected, review the steps carefully and consult the official documentation for your specific version.
