Vim Setup

Updated: September 16, 2024

Follow for customizing vim on a machine.


install vim (however you may acquire depending on your OS)

Table of Contents

INSTALL VIM

sudo apt install vim		# debian, ubuntu

sudo pacman -S vim			# arch, manjaro

brew install vim			# macOs with homebrew

INSTALL PATHOGEN

!IMPORTANT Run both lines as one in terminal

mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

If you’re using Windows, change all occurrences of ~/.vim to ~\vimfiles.

Required in your .vimrc # already in .vimrc in megadot project

set laststatus=2
set t_Co=256

VIMRC

This is a sample .vimrc configuration. A good start!

curl -o ~/.vimrc "https://gitlab.com/api/v4/projects/12002459/repository/files/vim%2F.vimrc/raw?ref=master"

PLUGINS

ADD PLUGINS (not all are necesary just here as examples)

Before installing each plugin it must be understood that Pathogen is a git repository and we are simply pulling plugin projects into a folder that Pathogen then auto adds into your $PATH. Uninstalling is just as easy, just delete the plugin’s directory inside bundle.

Since this is the case it is important that before running the git clones we must be in the right location before running git clone:

cd ~/.vim/bundle/

AIRLINE (I no longer use it but many people like it)

vim-airline

Used in Powerline series themes.

git clone https://github.com/vim-airline/vim-airline

vim-airline-theme

git clone https://github.com/vim-airline/vim-airline-themes

Once installed, use :AirlineTheme <theme> To set in .vimrc, use let g:airline_theme='<theme>'

OTHER GREAT PLUGINS

Many more can be found @VimAwesome

bufferline

git clone https://github.com/bling/vim-bufferline ~/.vim/bundle/vim-bufferline

colorschemes

git clone https://github.com/flazz/vim-colorschemes.git

css color

git clone https://github.com/ap/vim-css-color

NERDTree

For if you do not like using netrw.

git clone https://github.com/preservim/nerdtree.git

NERDTree Git Status Flags

git clone https://github.com/scrooloose/nerdtree.git

Make w!!

Shortcut to save with sudo even if file was not opened with sudo. Pick one of the 3 options. ~/.vimrc

cnoremap w!! w !sudo tee > /dev/null %		# base level save with sudo
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
cnoremap w!! execute 'silent! write !SUDO_ASKPASS=`which ssh-askpass` sudo tee % >/dev/null' <bar> edit!