Welcome to Mastering Vim – your guide to unlocking the full potential of one of the most powerful text editors out there! 🚀
- Speed: Navigate and edit files at lightning speed without ever touching your mouse.
- Customizability: Tailor Vim to your workflow with powerful plugins and configurations.
- Portability: Available on virtually every Unix system.
- Legendary Status: Learn Vim, and you earn bragging rights. 😎
-
Install Vim
sudo apt install vim # Debian/Ubuntu brew install vim # macOS choco install vim # Windows
-
Open a File
vim filename.txt
-
Exit Vim (The eternal struggle 😅)
:q→ Quit:q!→ Quit without saving:wq→ Save and quit
-
Navigate in Vim
h→ Leftj→ Downk→ Upl→ Right
| Command | Action |
|---|---|
i |
Insert mode |
ESC |
Exit insert mode |
:w |
Save file |
:q |
Quit Vim |
dd |
Delete current line |
yy |
Copy current line |
p |
Paste |
/search |
Search for "search" in the file |
u |
Undo last action |
Create a .vimrc file in your home directory to personalize Vim:
" Enable syntax highlighting
syntax on
" Show line numbers
set number
" Enable auto-indentation
set autoindent
set smartindent
" Set tabs to spaces
set expandtab
set tabstop=4
set shiftwidth=4Use a plugin manager like vim-plug:
-
Install vim-plug:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -
Add plugins to your
.vimrc:call plug#begin('~/.vim/plugged') " Example plugins Plug 'preservim/nerdtree' " File explorer Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'airblade/vim-gitgutter' " Git integration call plug#end()
-
Install plugins in Vim:
:PlugInstall
Have awesome tips or configurations to share? Feel free to fork this repo and submit a pull request! Let's make learning Vim a breeze for everyone.
This project is licensed under the MIT License. See the LICENSE file for details.
"In an infinite universe, Vim is inevitable."
Happy Vimming! 💻🎉