0%

Personal vim configuration

image-20200726005015462

Auto Complete

Download AutoComplPop: [vim-autocomplpop.zip] (no dependency)

1
2
3
4
5
mkdir -p ~/.vim/autoload
mkdir -p ~/.vim/plugin
unzip vim-autocomplpop.zip
cp autoload/* ~/.vim/autoload/
cp plugin/* ~/.vim/plugin/

File Sidebar

First, install the pathogen package manager following instructions [here] (very easy to setup).

Then install the NERDTree plugin (depends on pathogen):

1
git clone https://github.com/preservim/nerdtree.git ~/.vim/bundle/nerdtree

Statusline Customization

Install Lightline (depends on pathogen):

1
git clone https://github.com/itchyny/lightline.vim ~/.vim/bundle/lightline.vim

Color Theme

Download monokai color themes from [vimcolors] (no dependency):

1
2
3
mkdir -p ~/.vim/colors
wget https://raw.githubusercontent.com/dunckr/vim-monokai-soda/master/colors/monokai-soda.vim -O ~/.vim/colors/monokai-soda.vim
wget https://raw.githubusercontent.com/phanviet/vim-monokai-pro/master/colors/monokai_pro.vim -O ~/.vim/colors/monokai-pro.vim

Optional: Install vim-polyglot for improved syntax highlighting (depends on pathogen):

1
git clone https://github.com/sheerun/vim-polyglot ~/.vim/bundle/vim-polyglot

~/.vimrc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
set number          " show line number
set expandtab " convert tab to 4 spaces
set tabstop=4
set shiftwidth=4 " shift 4 spaces when indenting code blocks
set autoindent " automatically indent for for, if, etc.
set mouse=a " allow using mouse to move cursor, control split bars, etc.
set termguicolors " for removing vertical split bar `|` characters

" pathogen package manager
execute pathogen#infect()
filetype plugin indent on

" Ctrl-T to toggle file sidebar
nmap <C-t> :NERDTreeToggle<cr>

" file exclude pattern
let NERDTreeIgnore = ['\.swp$', '\.pyc$', '\.ipynb_checkpoints$', '^__pycache__$']

" status line color theme
let g:lightline = {
\ 'colorscheme': 'seoul256',
\ }
set ttymouse=xterm2

" main color theme
colo monokai-soda

" automatically trim white spaces on save
fun! TrimWhitespace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun

command! TW call TrimWhitespace()
autocmd BufWritePre * :call TrimWhitespace()

" Highlight CamelCase symbols
syntax match myClassName '\v(<\u\i*>)+'
highlight link myClassName Type