Master Vim for Front‑End Developers: Essential Commands and Must‑Have Plugins
This comprehensive guide walks front‑end developers through installing Vim, mastering core editing commands, configuring a personalized .vimrc, and integrating essential plugins for file navigation, code completion, syntax highlighting, Git integration, markdown preview, and more, boosting productivity in modern web development.
Installation
sudo apt-get install vim # UbuntuOther platforms can be installed via their respective package managers.
Beginner Guide
Cursor Movement
# hjkl # move left, down, up, right
# 2w # move forward two words
# 3e # move to end of the third word
# 0 # go to line start
# $ # go to line end
# gg # first line of file
# G # last line of file
# 42G # go to line 42
# <ctrl>+o # jump back
# <ctrl>+i # jump forwardExiting
# <esc> # enter normal mode
# :q! # quit without saving
# :wq # write and quitDeletion
# x # delete character under cursor
# dw # delete to end of word
# de # delete to end of word including character
# d$ # delete to end of line
# dd # delete whole line
# 2dd # delete two linesModification
# i # insert before cursor
# A # append at end of line
# r # replace character
# o # open new line below and enter insert modeUndo/Redo
# u # undo
# <ctrl>+r # redoCopy, Paste, Cut
# v # visual mode
# y # yank (copy)
# p # paste
# yy # yank whole line
# dd # delete (cut) lineStatus
# <ctrl>+g # show file info and cursor positionSearch
# / # forward search (n to repeat, N reverse)
# ? # backward search
# % # find matching pair
# :set ic # ignore case
# :set noic # case‑sensitive
# :set hls # highlight matches
# :set is # show partial matchesReplace
# :s/old/new # replace first match in line
# :s/old/new/g # replace all matches in line
# :%s/old/new/g # replace all matches in fileFolding
# zc # close fold
# zC # close all nested folds
# zo # open fold
# zO # open all foldsExternal Commands
# :!shell # execute external shell command.vimrc
The .vimrc file stores Vim configuration. Create it in your home directory and use vim-plug to manage plugins:
cd ~
# create .vimrc file
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vimBasic Configuration
set nobackup " disable backup files
set noswapfile " disable swap files
set encoding=utf-8 " file encoding
set number " show line numbers
set nowrap " disable line wrapping
set ruler " show cursor position
set cindent
set tabstop=2
set shiftwidth=2
set cursorline " highlight current line
set ic " ignore case in searches
set hls " highlight search results
set showmode " show mode in status linePlugin Configuration
File Explorer
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'Xuyuanp/nerdtree-git-plugin'
" key mappings omitted for brevityCode Completion & Snippets
Plug 'Valloric/YouCompleteM e'
Plug 'Raimondi/delimitMate'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }Syntax Highlighting & Linting
Plug 'sheerun/vim-polyglot'
Plug 'w0rp/ale'
let g:ale_linters = {'javascript': ['eslint'], 'css': ['stylelint']}
let g:ale_fixers = {'javascript': ['eslint'], 'css': ['stylelint']}
let g:ale_fix_on_save = 1File & Code Search
Plug 'rking/ag.vim'
Plug 'kien/ctrlp.vim'Status Line
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
let g:airline_theme='papercolor'Commenting
Plug 'scrooloose/nerdcommenter'
" example mappings omitted for brevityGit Integration
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'Markdown Preview
Plug 'suan/vim-instant-markdown'
let g:instant_markdown_autostart = 0Emmet
Plug 'mattn/emmet-vim'
let g:user_emmet_leader_key = '<Tab>'
let g:user_emmet_settings = {'javascript.jsx': {'extends': 'jsx'}}HTML5 Support
Plug 'othree/html5.vim'CSS3 Support
Plug 'hail2u/vim-css3-syntax'
Plug 'ap/vim-css-color'JavaScript Enhancements
Plug 'pangloss/vim-javascript'
let g:javascript_plugin_jsdoc = 1
let g:javascript_plugin_ngdoc = 1
let g:javascript_plugin_flow = 1
set foldmethod=syntax
" additional conceal settings omitted for brevityReact JSX
Plug 'mxw/vim-jsx'
let g:jsx_ext_required = 0Prettier Formatting
Plug 'prettier/vim-prettier', { 'do': 'yarn install', 'for': ['javascript','typescript','css','less','scss','json','graphql'] }
let g:prettier#config#bracket_spacing = 'true'
let g:prettier#config#jsx_bracket_same_line = 'false'
let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql PrettierAsyncConclusion
The above .vimrc configuration provides a solid Vim setup for front‑end development; feel free to customize further or share improvements in the comments.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
