-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
120 lines (99 loc) · 3.33 KB
/
.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
set nocp
if empty($VIMHOME)
let $VIMHOME = $HOME. "/.vim"
endif
if empty($MYVIMRC)
let $MYVIMRC = expand('<sfile>:p')
endif
let &runtimepath = $VIMHOME . "," . &runtimepath
if empty(glob("$VIMHOME/autoload/plug.vim"))
silent !curl -fLo $VIMHOME/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin("$VIMHOME/plugged")
"Highlight trailing spaces
Plug 'ntpeters/vim-better-whitespace'
" Visual file tree
Plug 'scrooloose/nerdtree'
" Collection of color schemes
Plug 'flazz/vim-colorschemes'
" Status/tabline
Plug 'vim-airline/vim-airline'
" Syntax checking
Plug 'scrooloose/syntastic'
" Full path fuzzy file, buffer, mru, tag, ... finder for Vim
Plug 'ctrlpvim/ctrlp.vim'
" Perl syntax and helpers
Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' }
" JavaScript syntax and helpers
Plug 'pangloss/vim-javascript'
" Vue syntax
Plug 'posva/vim-vue'
" JSON syntax
Plug 'leshill/vim-json'
call plug#end()
" Enforcing UTF-8 (some machines may not be properly configured) to display
" airline characters
set encoding=utf-8
" Default colorscheme
:silent! colorscheme gruvbox
:silent! set background=dark
" Use filetype detection and file-based automatic indenting
filetype plugin indent on
syntax enable
autocmd Filetype html setlocal ts=2 sts=2 sw=2
autocmd Filetype ruby setlocal ts=2 sts=2 sw=2
autocmd Filetype javascript setlocal ts=2 sts=2 sw=2
autocmd Filetype perl setlocal ts=4 sts=4 sw=4
set tabstop=2 " The width of a TAB is set to 2.
" Still it is a \t. It is just that
" Vim will interpret it to be having
" a width of 4
set shiftwidth=2 " Indents will have a width of 2
set softtabstop=2 " Sets the number of columns for a TAB
set expandtab " Expand TABs to spaces
set ic " Ignore case in search patterns
set scs " Smart search (override 'ic' when pattern has uppers)
set nobackup " No backup (~) files
set noswapfile " No swap (.swp) files
set nonumber " Don't display number lines by default
set laststatus=2 " Ensure Airline is displayed
" Line marker at col 80
set colorcolumn=80
" Recommended synctastic settings
set statusline+=%#warningmsg#
set statusline+=%{exists('g:loaded_syntastic_plugin')?SyntasticStatuslineFlag():''}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" Show/hide line numbers
nnoremap <silent> <C-n> :set invnumber<CR>
" Show/hide NERDTree
nnoremap <silent> <C-t> :NERDTreeToggle<CR>
" Locate current file in NERdTree
nnoremap <silent> ,t :NERDTreeFind<CR>
" Switching between windows in an easier way
map <Tab> <C-W><C-W>
map <C-K> <C-W>k
map <C-J> <C-W>j
map <C-H> <C-W>h
map <C-L> <C-W>l
" pressing < or > will let you indent/unident selected lines
vnoremap < <gv
vnoremap > >gv
nnoremap > >i{
nnoremap < <i{
nnoremap = =i{
" Common typos.
command! Qa qa
command! Q q
command! W w
command! Wq wq
" Include overrides if the file exists
let $OVERRIDE_FILE = $VIMHOME . '/vimrc.override'
if filereadable($OVERRIDE_FILE)
source $OVERRIDE_FILE
endif