21 min to read
Your Personal Configuration and Getting Help
Create Your Perfect VIM Environment and Never Feel Lost Again
You’ve mastered VIM’s commands, but every time you log into a new server, you’re back to default settings—no line numbers, case-sensitive search, no syntax highlighting. Meanwhile, you occasionally wonder “how do I do X again?” and wish VIM had built-in help. It does, and it’s comprehensive.
This lesson teaches you to make VIM truly yours: create a configuration file that sets your preferences automatically, access VIM’s massive help system whenever you need it, and use command completion to discover features you didn’t know existed.
These aren’t just convenience features—they’re what separate someone who uses VIM from someone who’s made VIM theirs.
Understanding VIM’s Help System
VIM has one of the most comprehensive help systems of any text editor. Every command, option, and feature is documented in detail. Learning to navigate this help will make you self-sufficient.
Opening Help: :help
The simplest way to access help:
:help
Or press F1 (if your terminal supports it).
Try it now:
Open VIM:
vim
Type :help and press ENTER.
A help window opens at the top of your screen. You’re looking at VIM’s main help page with links to various topics.
What you see:
- Links in different colors (if you have syntax highlighting)
- Text surrounded by
|bars are clickable links - Categories like “USER MANUAL”, “REFERENCE MANUAL”, “STARTING”
Navigating Help
In the help window, you can:
- Move around: use
hjklor arrow keys - Jump to a topic: position cursor on a
|link|and pressCtrl-] - Jump back: press
Ctrl-O(remember this from search navigation?) - Search within help:
/search_term - Close help:
:q
Try this:
- With help open, navigate to
|quickref|(usingjor searching:/quickref) - Press
Ctrl-]with cursor onquickref - You jump to a quick reference page showing all commands
- Press
Ctrl-Oto go back - Type
:qto close help window
Getting Help on Specific Commands: :help command
This is the most powerful way to use help. Whenever you want to know about a command:
:help dd
:help yy
:help :substitute
:help /
Examples:
Get help on the delete line command:
:help dd
Learn about substitution:
:help :substitute
Understand search:
:help /
Try it:
- Type
:help yyand pressENTER - Read about the yank command
- Type
:qto close help
Help for Settings: :help 'option'
For settings, use quotes:
:help 'ignorecase'
:help 'number'
:help 'hlsearch'
Try it:
:help 'incsearch'
Learn exactly what incremental search does and all its nuances.
Help for Modes
Get help on modes:
:help insert-mode
:help normal-mode
:help visual-mode
The Help Tag System
VIM’s help uses tags. When you see text like |this|, it’s a link to a help tag. You can jump directly to any tag:
:help tag-name
For example:
:help motion.txt
:help usr_01.txt
:help pattern-searches
Searching Help
You can search within help like any other file:
- Open help:
:help - Search:
/word - Navigate matches:
nandN
Or search all help files:
:helpgrep search_term
This searches through all help files and creates a list of matches you can navigate through.
Command 2: Window Management - Ctrl-W Ctrl-W
When help opens, it creates a new window split. You can have multiple windows open in VIM and switch between them.
Switch Windows: Ctrl-W Ctrl-W
Press Ctrl-W twice (hold Ctrl, press W, press W again) to cycle between windows.
Try it:
- Type
:helpto open help - Now you have two windows (help on top, your file below)
- Press
Ctrl-W Ctrl-W - Your cursor jumps to the other window
- Press
Ctrl-W Ctrl-Wagain - Back to the first window
Shorter notation: Many people write this as Ctrl-W Ctrl-W but you can also press Ctrl-W then release and press w (lowercase). Both work.
More Window Commands (Preview)
We’ll cover these in detail in future lessons, but here are the basics:
Ctrl-W Ctrl-W- cycle between windowsCtrl-W j- move to window belowCtrl-W k- move to window aboveCtrl-W h- move to window leftCtrl-W l- move to window rightCtrl-W q- close current window (same as:q)
Close Help Window: :q
When you’re in the help window, type :q to close it and return to your file.
Workflow:
- Open help:
:help command - Read help (navigate with
hjkl, search with/, follow links withCtrl-]) - Switch to your file if needed:
Ctrl-W Ctrl-W - Close help: switch to help window and
:q, or just:qif you’re already there
Command 3: The vimrc Configuration File
Every time you start VIM, it looks for a configuration file called .vimrc (in your home directory on Unix systems). This file contains VIM commands that run automatically at startup.
What is .vimrc?
The .vimrc file is a plain text file containing VIM commands (without the : prefix). It’s where you put:
- Settings you want enabled by default
- Key mappings
- Plugin configurations
- Custom functions
Creating Your .vimrc
Let’s create a basic .vimrc with useful settings for bioinformatics work:
vim ~/.vimrc
Press i to enter Insert Mode, then type or paste:
" Basic VIM Configuration for Bioinformatics
" Comments start with a double-quote
" ============================================================
" DISPLAY SETTINGS
" ============================================================
" Show line numbers
set number
" Highlight the current line
set cursorline
" Show matching brackets when cursor is over them
set showmatch
" Always show current position
set ruler
" Show command in bottom bar
set showcmd
" ============================================================
" SEARCH SETTINGS
" ============================================================
" Case-insensitive searching
set ignorecase
" But case-sensitive if search contains uppercase
set smartcase
" Highlight search results
set hlsearch
" Search as you type (incremental search)
set incsearch
" ============================================================
" INDENTATION SETTINGS
" ============================================================
" Use spaces instead of tabs
set expandtab
" Number of spaces for each tab
set tabstop=4
" Number of spaces for indentation
set shiftwidth=4
" Number of spaces for <Tab> key in insert mode
set softtabstop=4
" Copy indent from current line when starting new line
set autoindent
" ============================================================
" EDITING BEHAVIOR
" ============================================================
" Allow backspace over everything in insert mode
set backspace=indent,eol,start
" Don't wrap lines
set nowrap
" Show line breaks visually without inserting line breaks
set linebreak
" Keep 5 lines visible above/below cursor when scrolling
set scrolloff=5
" Enable mouse support (all modes)
set mouse=a
" ============================================================
" FILE HANDLING
" ============================================================
" Enable syntax highlighting
syntax enable
" Detect file types
filetype plugin indent on
" Don't create backup files
set nobackup
set nowritebackup
" Don't create swap files
set noswapfile
" Auto-read file if changed outside VIM
set autoread
" ============================================================
" INTERFACE IMPROVEMENTS
" ============================================================
" Show partial commands in the last line
set showcmd
" Show current mode
set showmode
" Better command-line completion
set wildmenu
set wildmode=longest:full,full
" Ignore case in command-line completion
set wildignorecase
" ============================================================
" CUSTOM KEY MAPPINGS (optional - uncomment to use)
" ============================================================
" Clear search highlighting with Esc-Esc
" nnoremap <Esc><Esc> :nohlsearch<CR>
" Save file with Ctrl-S (in normal mode)
" nnoremap <C-s> :w<CR>
" Easier window navigation
" nnoremap <C-h> <C-w>h
" nnoremap <C-j> <C-w>j
" nnoremap <C-k> <C-w>k
" nnoremap <C-l> <C-w>l
" ============================================================
" BIOINFORMATICS-SPECIFIC SETTINGS
" ============================================================
" Recognize common bioinformatics file types
autocmd BufRead,BufNewFile *.fasta,*.fa set filetype=fasta
autocmd BufRead,BufNewFile *.fastq,*.fq set filetype=fastq
autocmd BufRead,BufNewFile *.vcf set filetype=vcf
autocmd BufRead,BufNewFile *.sam,*.bam set filetype=sam
autocmd BufRead,BufNewFile *.gff,*.gtf set filetype=gff
" Python settings (for bioinformatics scripts)
autocmd FileType python set expandtab tabstop=4 shiftwidth=4
" R settings (for statistical analysis)
autocmd FileType r set expandtab tabstop=2 shiftwidth=2
" Shell script settings
autocmd FileType sh set expandtab tabstop=2 shiftwidth=2
" YAML settings (for Snakemake, configs)
autocmd FileType yaml set expandtab tabstop=2 shiftwidth=2
Press ESC, type :wq, press ENTER.
Understanding .vimrc Syntax
Comments: Lines starting with " are comments
Settings: Just the command without the : prefix
set number " Instead of :set number
Multiple settings on one line:
set number ruler showcmd
Unsetting options:
set nonumber " Turn off line numbers
set nowrap " Don't wrap lines
Testing Your .vimrc
Close VIM completely and open it again:
vim test.txt
You should now see:
- Line numbers on the left
- Current line highlighted
- Other settings active
Try searching for something—results are highlighted because hlsearch is set.
Common .vimrc Settings Explained
Display settings:
set number- Show line numbers (essential for debugging)set cursorline- Highlight current line (helps track position)set ruler- Show line and column number in corner
Search settings:
set ignorecase- Case-insensitive search by defaultset smartcase- But if search has uppercase, become case-sensitiveset hlsearch- Highlight all matchesset incsearch- Show matches as you type
Indentation:
set expandtab- Use spaces instead of tab charactersset tabstop=4- Tab is 4 spaces wideset shiftwidth=4- Indent by 4 spacesset autoindent- Copy indentation from previous line
Quality of life:
set mouse=a- Enable mouse (useful for beginners)syntax enable- Turn on syntax highlightingset wildmenu- Better command completionset scrolloff=5- Keep 5 lines visible above/below cursor
Portable Configuration
The beauty of .vimrc is portability. Copy it to any server:
scp ~/.vimrc username@server.edu:~/
Now VIM behaves identically on that server.
Or keep it in a Git repository:
git clone https://github.com/yourusername/dotfiles.git
ln -s ~/dotfiles/vimrc ~/.vimrc
One configuration, everywhere you work.
Command 4: Command Completion - Ctrl-D and Tab
VIM has command-line completion that helps you discover and use commands.
See All Completions: Ctrl-D
When typing a command, press Ctrl-D to see all possible completions.
Try it:
- Type
:set(with a space after “set”) - Press
Ctrl-D - VIM shows a list of all available settings
Another example:
- Type
:help m(partial command) - Press
Ctrl-D - See all help topics starting with ‘m’
For file operations:
- Type
:e(the edit command with a space) - Press
Ctrl-D - See all files in current directory
Cycle Through Completions: Tab
Press Tab to cycle through completions one at a time.
Try it:
- Type
:set nu(incomplete) - Press
Tab - VIM completes to
:set number - Press
Tabagain - Cycles to other options starting with “nu”
For settings:
- Type
:set i - Press
Tabrepeatedly - Cycles through:
ignorecase,incsearch,indent, etc.
For files:
- Type
:e scr - Press
Tab - If you have a file starting with “scr”, it completes
- Press
Tabagain to cycle to next match
Completion with Wildmenu
If you have set wildmenu in your .vimrc (we added it), completion is even better:
- Type
:color(space after) - Press
Tab - A menu appears showing all color schemes
- Press
Tabto cycle through them - Press
Enterto select one
This works for any command with multiple options.
Discovering Commands
Use completion to discover what’s available:
All commands starting with ‘s’:
:s[Ctrl-D]
All help topics about ‘search’:
:help search[Ctrl-D]
All settings:
:set [Ctrl-D]
This is incredibly useful when you know approximately what you want but not the exact command.
Practical Workflows
Workflow 1: Learning New Commands
You want to learn about text objects:
- Type
:help text-objectsand pressEnter - Read the help
- See a command you want to try:
ciw(change inner word) - Press
Ctrl-W Ctrl-Wto switch to your file - Try the command on some text
- Switch back to help:
Ctrl-W Ctrl-W - Continue reading
- Close help:
:q
Workflow 2: Setting Up a New Server
You’ve logged into a new HPC cluster:
- Copy your .vimrc:
scp ~/.vimrc username@newserver:~/ - SSH into the server
- Open VIM:
vim analysis.sh - All your settings are active automatically
- Start working with your familiar environment
Workflow 3: Finding the Right Setting
You want to change something but don’t know the exact setting name:
- Type
:set - Press
Ctrl-Dto see all options - Search through the list
- Or type partial name:
:set wrap - Press
Tabto complete - Check current value:
:set wrap? - Change it:
:set nowrap
Workflow 4: Exploring Help
You heard about “registers” but don’t know what they are:
- Type
:help registers - Read the comprehensive documentation
- Follow links to related topics: cursor on
|link|, pressCtrl-] - Go back:
Ctrl-O - Search within help:
/yank - Close when done:
:q
Customizing Your .vimrc Over Time
Your .vimrc should evolve with your needs. Here’s how to improve it:
Testing Settings Before Adding
- Try a setting in VIM:
:set number - If you like it, add to .vimrc
- Reload .vimrc:
:source ~/.vimrc(or restart VIM)
Common Additions
Color scheme:
colorscheme desert
See available schemes: :colorscheme then Tab through options.
Status line:
set laststatus=2 " Always show status line
set statusline=%F%m%r%h%w\ [%l,%c]\ [%L]
Shows filename, line/column, total lines.
Persistent undo:
set undofile
set undodir=~/.vim/undodir
Remembers undo history between sessions.
Spell checking:
set spell spelllang=en_us
Enable with :set spell, disable with :set nospell.
Organizing Your .vimrc
Keep it organized with sections (like we did in the example):
- Display settings
- Search settings
- Indentation
- File handling
- Key mappings
- File-type specific settings
Add comments explaining why you set things:
" Case-insensitive search - important for gene names
set ignorecase
Advanced .vimrc Features (Preview)
Your .vimrc can do much more (topics for future lessons):
Custom key mappings:
" Press ,w to save file
nnoremap ,w :w<CR>
" Press ,q to quit
nnoremap ,q :q<CR>
Abbreviations:
" Type 'fastqc' and get full command
iabbrev fastqc fastqc --threads 8 -o qc_results/
Functions:
" Custom function to insert date
function! InsertDate()
r !date +\%Y-\%m-\%d
endfunction
Conditional settings:
" Different settings for different file types
if has('python')
set expandtab
endif
We’ll cover these in advanced lessons.
Practice Exercises
Exercise 1: Use Help System
- Open VIM:
vim - Get help on the yank command:
:help yy - Follow a link: position cursor on
|y|and pressCtrl-] - Go back:
Ctrl-O - Search for “motion”:
/motion - Close help:
:q
Exercise 2: Navigate Help Windows
- Open a file:
vim test.txt - Open help:
:help dd - Switch to your file:
Ctrl-W Ctrl-W - Switch back to help:
Ctrl-W Ctrl-W - Close help:
:q - Continue editing
Exercise 3: Explore Command Completion
- Type
:set - Press
Ctrl-Dto see all settings - Type
:set nu - Press
Tabto complete - Press
Enterto execute - Check result:
:set number?
Exercise 4: Customize .vimrc
- Open .vimrc:
vim ~/.vimrc - Add a new setting:
set relativenumber - Save:
:wq - Open VIM again:
vim test.txt - Verify the setting works (line numbers are now relative)
- If you don’t like it, remove it from .vimrc
Exercise 5: Help for Settings
- Type
:help 'hlsearch' - Read about highlighting search results
- Note the single quotes in the help command
- Close help:
:q - Enable the setting:
:set hlsearch - Test by searching:
/test
Common .vimrc Mistakes
Wrong location: .vimrc must be in your home directory (~/.vimrc)
Including the colon: Commands in .vimrc don’t use : prefix
" Wrong:
:set number
" Right:
set number
Syntax errors: VIM will show error on startup if .vimrc has problems
File permissions: Make sure .vimrc is readable:
chmod 644 ~/.vimrc
Quick Reference
HELP SYSTEM:
:help - Open main help
:help cmd - Help for specific command
:help 'option' - Help for setting (use quotes)
Ctrl-] - Follow help link
Ctrl-O - Go back in help
:q - Close help window
WINDOWS:
Ctrl-W Ctrl-W - Switch between windows
Ctrl-W q - Close current window
COMMAND COMPLETION:
Ctrl-D - Show all completions
Tab - Cycle through completions
VIMRC:
~/.vimrc - Configuration file location
:source ~/.vimrc - Reload configuration
" comment - Comment syntax
set option - Set an option (no colon)
What You’ve Mastered
You now know how to:
- Access VIM’s comprehensive help system
- Navigate help windows and follow links
- Create and customize your .vimrc file
- Make settings portable across servers
- Use command completion to discover features
- Build a personalized VIM environment
Combined with all previous commands, you’re now a competent VIM user with a customized setup.
What’s Next
You’ve completed the essential VIM curriculum! You can now:
- Navigate files efficiently
- Edit text with powerful commands
- Search and replace with precision
- Copy, paste, and manipulate text
- Access help when needed
- Maintain a personalized configuration
Optional advanced topics for future learning:
- Split windows and tabs (working with multiple files)
- Macros (recording and replaying command sequences)
- Registers (multiple clipboards)
- Marks (bookmarking locations)
- Visual block mode (column editing)
- Plugins (extending VIM’s functionality)
- Advanced scripting (functions and commands)
But you don’t need these to be productive. With what you’ve learned, you can efficiently edit any file on any remote server.
Your Action Items
- Create your .vimrc using the template provided
- Copy it to your HPC clusters where you work
- Practice using help when you forget a command
- Customize gradually as you discover preferences
- Keep learning by exploring help topics
The Journey Complete
You started unable to exit VIM. Now you have:
- Complete command fluency
- A personalized environment
- Self-sufficiency through help
- The foundation for advanced techniques
VIM is no longer a mysterious tool—it’s your efficient, portable, powerful text editing environment that works identically on every system you touch.
Use it daily. Keep your .vimrc updated. Explore help when curious. VIM will continue revealing its power as your skills grow.
Welcome to efficient text editing. You’ve earned your VIM mastery.
This completes the VIM Essentials series. You’re now equipped to edit configuration files, scripts, and data efficiently on any bioinformatics system. Your .vimrc travels with you, and VIM’s help is always there when you need it. Happy editing!
Comments