-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
125 lines (104 loc) · 3.22 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
121
122
123
124
125
set nocompatible " be iMproved, required for vundle
filetype off " required for vundle
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let vundle manage vundle, required
Plugin 'VundleVim/Vundle.vim'
" plugins -------------------------
Plugin 'mattn/emmet-vim'
Plugin 'pangloss/vim-javascript'
Plugin 'ervandew/supertab'
Plugin 'ap/vim-buftabline'
Plugin 'Chiel92/vim-autoformat'
Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'itmammoth/doorboy.vim'
" /plugins ------------------------
call vundle#end()
filetype plugin indent on
" buffer setup --------------------
set hidden
" show buffer numbers
let g:buftabline_numbers = 1
" show modified indicator
let g:buftabline_indicators = 1
let g:buftabline_separators = 1
" /buffer setup -------------------
syntax on
set t_Co=256
colorscheme distinguished
set background=dark
set number
set tabstop=2
set shiftwidth=2
set expandtab
" netrw config --------------------
" https://shapeshed.com/vim-netrw/
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_altv = 1
let g:netrw_winsize = 25
" /netrw config -------------------
" statusline config ---------------
" http://stackoverflow.com/a/9121083
" always display status line
set laststatus=2
" switch colors based on mode
function! InsertStatuslineColor(mode)
if a:mode == 'i'
hi statusline ctermfg=6 ctermbg=0
elseif a:mode == 'r'
hi statusline ctermfg=5 ctermbg=0
else
hi statusline ctermfg=1 ctermbg=0
endif
endfunction
au InsertEnter * call InsertStatuslineColor(v:insertmode)
au InsertLeave * hi statusline ctermfg=8 ctermbg=15
" default the statusline to green when entering vim
hi statusline ctermfg=8 ctermbg=15
" Formats the statusline
set statusline=%f " file name
set statusline+=[%{strlen(&fenc)?&fenc:'none'}, " file encoding
set statusline+=%{&ff}] " file format
set statusline+=%y " filetype
set statusline+=%h " help file flag
set statusline+=%m " modified flag
set statusline+=%r " read only flag
set statusline+=\ %= " align left
set statusline+=Line:%l/%L[%p%%] " line X of Y [% of file]
set statusline+=\ Col:%c " current column
set statusline+=\ Buf:%n " buffer number
" /statusline config --------------
" ultisnips config ----------------
let g:UltiSnipsSnippetDirectories=["UltiSnips"]
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
let g:UltiSnipsListSnippets="<c-tab>"
" /ultisnips config ---------------
" keymappings ---------------------
" Save on double escape
map <Esc><Esc> :w<CR>
noremap <F3> :Autoformat<CR>
noremap <C-N> :bn<CR>
noremap <C-P> :bp<CR>
" /keymappings --------------------
" relative line numbers -----------
set rnu
set nu!
function! ToggleNumRel()
if(&nu == 1)
set rnu
set nu!
else
set nu
set rnu!
endif
endfunc
command! ToggleNumRel
\ call ToggleNumRel()
noremap <F2> :ToggleNumRel<CR>
" /relative line numbers ----------