Onur Yasarlar
Search…
Using vim Effectively
One said vim is dead, but I quite disagree. The power of the modern IDEs like Visual Studio Code or Atom cannot be ignored, but there are lots of developers, administrators out there using vim as their primary interface. Even if it is not the primary one, there can still be an improvement to use vim more effectively. Here vim plugins run to our aid. I personally use vim a lot and have a "must-have" plugins. I wanted to keep them in a Git repository and I believe the best way is to add all plugins as git submodules.
Let me list down my "must-have" plugins below and thank their developers, contributors:
  1. 1.
    nerdtree
  2. 2.
    syntastic
  3. 3.
    lightline
I personally use pathogen to install and use the plugins so the way how you will edit your .vimrc file is one of the most important things. I am currently using a simple one but I add more in the future to make my life easier
.vimrc
1
execute pathogen#infect()
2
syntax on
3
filetype plugin indent on
4
set nocompatible " We're running Vim, not Vi!
5
6
set statusline+=%#warningmsg#
7
set statusline+=%{SyntasticStatuslineFlag()}
8
set statusline+=%*
9
set number
10
set cursorline
11
12
setlocal tabstop=2
13
setlocal softtabstop=2
14
setlocal shiftwidth=2
15
setlocal autoindent
16
17
let g:syntastic_always_populate_loc_list = 1
18
let g:syntastic_auto_loc_list = 1
19
let g:syntastic_check_on_open = 1
20
let g:syntastic_check_on_wq = 0
21
22
" Lighline plugin activation
23
if !has('gui_running')
24
set t_Co=256
25
endif
26
set laststatus=2
27
28
" Python indentation
29
syntax on
30
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=4
31
filetype plugin indent on
32
set autoindent
33
34
" Ruby indentation
35
syntax on
36
autocmd FileType ruby setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
37
filetype plugin indent on
38
set autoindent
39
40
" YAML indentation
41
syntax on
42
autocmd FileType yaml setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
43
filetype plugin indent on
44
set autoindent
45
46
" Bash indentation
47
syntax on
48
autocmd FileType bash setlocal expandtab shiftwidth=2 tabstop=2
49
filetype plugin indent on
50
set autoindent
51
52
53
" auto indent by F7
54
map <F7> mzgg=G`z
55
56
" Paste mode on / off by F2
57
set pastetoggle=<F2>
58
59
" vimdiff coloring change
60
map <F6> :windo set syn=OFF<CR>
61
62
" Nerdtree open side menu by "ctrl-o"
63
map <C-o> :NERDTreeToggle<CR>
64
Copied!
Last modified 1yr ago
Copy link