πŸ’‘Vim

https://www.vim.org/

The Basics

Configuration

All configuration in .vimrc file

To change .vimrc you need update configuration by command : + so %

Visual mode

  • shift + v - visual line mode

  • shift + v and get some line numbers, then :sort - will sort lines

Commands

  • d + d - delete

  • y - copy line

  • p - paste line

  • . - repeat last command

  • yiw - copy the word

  • / - search in file


  • vs - vertical split

  • sp - horizontal split

  • cntr + w + hjkl - move between split windows

  • cntr + hjkl - move between split windows if you change .vimrc file

  • cntr + w + w - move between split windows


  • zz - point window to cursor


  • !ls - list all files in work directory


  • e . - files in current directory

  • ^ - switch between files

  • : + tabedit + file.txt - edit file in new tab

  • : + bd - delete current tab


  • bp - previous buffer

  • ls - list of buffers

  • b3 - go to the third buffer

  • bd - delete current buffer

  • gt - switch beetween buffers


  • di( - remove, for example array $arr parameter in method

  • di' - remove inside ', for example in 'some here th', will be ''

  • ci' - change inside '

  • vi' - select inside '

  • vi( - select inside (

  • va{ - will select inside { with itself

  • vat - will select inside of current cursor

Digging Deeper

Install plugin

  1. Paste into .vimrc name of plugin: Plugin 'tpope/vim-vinegar'

  2. Run : + PluginInstall

Shortcuts

Every shortcut add in .vimrc

Plugins

Vundle

  • cntr + p - find file

  • cntr + t - open tree in directory

Ctag

Snipmate

Surround plugin

Php plugin

Last updated