vim editor commands code example

Example 1: vim plug

# Neovim:
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
       https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
       
# Vim:
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Example 2: vim command to open a file

vim filename 
i
*Insert/Edit Text*
*Esc*
:wq       (save the file and exit to commands)

Example 3: vim insert

i - insert before the cursor

I - insert at the beginning of the line

a - insert (append) after the cursor

A - insert (append) at the end of the line

o - append (open) a new line below the current line

O - append (open) a new line above the current line

ea - insert (append) at the end of the word

Example 4: edit in vim

Press i letter on your keyboard to start editing (Insert Mode). When youre done press the ESC key to exit insert mode

Tags:

Misc Example