Vim Setup

Setting up vim for the first time

Run the commands on the terminal

brew update brew install vim

git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim

touch ~/.vimrc

Open vimrc file using vim .vimrc and in the command mode install the plugins using :PluginInstall

All the plugins will be installed.

There can be a problem with the YCM server, solve it using below

cd ~/.vim/bundle/YouCompleteMe/ sudo pip install cmake python install.py

Link to .vimrc

Vim commands

There are modes in vim, insert mode, command mode

i for the insert mode
Escape for the command mode
h - left
l - right
j - up
k - down

:w for write
:wq for write and quit
:q for quit
:q! for quitting without saving
In command mode use dd to delete a line
use x to delete char by char in command mode

use :NERDTreeToggle to toggle the nerdtree on the left side of the window

move to next word = w
move to end of the line = $
move to the end of the file = G
move to the beginning of the line = ^
u for undo

dw deletes the next word
d$ deletes to the end of the line
dG to the end of the file

A few interesting keybindings are:

preview markdown in atom - ctrl + shift + m
## Vim resources

  1. https://realpython.com/vim-and-python-a-match-made-in-heaven/
  2. https://linuxhint.com/vim-python-development/
  3. https://www.fullstackpython.com/vim.html
  4. https://www.vimfromscratch.com/articles/vim-for-python/