forked from bndabbs/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
176 lines (139 loc) · 5.05 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
" Install vim-plug if not already present
" See: https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | source $MYVIMRC
endif
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC
\| endif
" vim plug-ins
call plug#begin('~/.vim/plugged')
" Customized status line plugin
" See: https://vimawesome.com/plugin/vim-crystalline
Plug 'rbong/vim-crystalline'
" Git integration plugin
" See: https://vimawesome.com/plugin/fugitive-vim
Plug 'tpope/vim-fugitive'
" Per project editor configuration settings
" See: https://vimawesome.com/plugin/editorconfig-vim
Plug 'editorconfig/editorconfig-vim'
" File tree browser
" Use :NERDTree to open file browser window
" See: https://vimawesome.com/plugin/nerdtree-red
Plug 'scrooloose/nerdtree'
" Source code tag browser
" https://vimawesome.com/plugin/taglist-vim
Plug 'vim-scripts/taglist.vim'
" Syntastic sytax checker
" Removed due to complexity of identifying project include files
" See: https://vimawesome.com/plugin/syntastic
"Plug 'scrooloose/syntastic'
" Lucius color scheme
" Removed, deferring to crystalline color scheme
" See: https://vimawesome.com/plugin/lucius
"Plug 'jonathanfilip/vim-lucius'
" Visual indent level plugin
" Removed due to error at startup regarding 'Normal' highlight setting
" https://github.com/nathanaelkane/vim-indent-guides/issues/131
" See: https://vimawesome.com/plugin/indent-guides
"Plug 'nathanaelkane/vim-indent-guides'
call plug#end()
function! StatusLine(current, width)
let l:s = ''
if a:current
let l:s .= crystalline#mode() . crystalline#right_mode_sep('')
else
let l:s .= '%#CrystallineInactive#'
endif
let l:s .= ' %f%h%w%m%r '
if a:current
let l:s .= crystalline#right_sep('', 'Fill') . ' %{fugitive#head(12)}'
endif
let l:s .= '%='
if a:current
let l:s .= crystalline#left_sep('', 'Fill') . ' %{&paste ?"PASTE ":""}%{&spell?"SPELL ":""}'
let l:s .= crystalline#left_mode_sep('')
endif
if a:width > 80
let l:s .= ' %{&ft}[%{&fenc!=#""?&fenc:&enc}][%{&ff}] %l/%L %c%V %P '
else
let l:s .= ' '
endif
return l:s
endfunction
function! TabLine()
let l:vimlabel = has('nvim') ? ' NVIM ' : ' VIM '
return crystalline#bufferline(2, len(l:vimlabel), 1) . '%=%#CrystallineTab# ' . l:vimlabel
endfunction
" vim crystalline settings
let g:crystalline_enable_sep = 1
let g:crystalline_statusline_fn = 'StatusLine'
let g:crystalline_tabline_fn = 'TabLine'
let g:crystalline_theme = 'molokai'
" vim behavior changes
set showtabline=2
set guioptions-=e
set laststatus=2
set incsearch " do incremental searching
set backspace=2 " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set showcmd " display incomplete commands
set incsearch " do incremental searching
set autowrite " Automatically :write before running commands
set pastetoggle=<F10> " Use F10 to toggle between :paste and :nopaste
"set mouse=a " Enable mouse in all modes
set ttymouse=xterm2
set list
set listchars=eol:¬,tab:>·,trail:~,extends:>,precedes:<,space:·
" Set search options
set hlsearch " Highlight matching search terms
" Press F4 to toggle highlighting on/off, and show current value.
noremap <F4> :set hlsearch! hlsearch?<CR>
nnoremap <F8> :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>
" vmdiff settrings
set diffopt=vertical,filler
set scrollbind
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Simpler buffer switching
nnoremap <F5> :buffers<CR>:buffer<Space>
" More intuitive ctags matching
nnoremap <C-]> g<C-]>
" Show function list
nnoremap <C-l> :TlistToggle<CR>
" Map NERDTree viewport to CTRL+t
nnoremap <C-t> :NERDTreeToggle<CR>
" Exit Vim if NERDTree is the only window left.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
\ quit | endif
"
" Syntastic configuration
"
"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
" Configure syntastic syntax checking to check on open as well as save
" Removed due to complexity of identifying project include files
" let g:syntastic_c_checkers = ['gcc']
" let g:syntastic_c_compiler = 'gcc'
"let g:syntastic_error_symbol = "✗"
"let g:syntastic_warning_symbol = '💩'
"highlight link SyntasticErrorSign SignColumn
"highlight link SyntasticWarningSign SignColumn
" Auto-enable IndentGuide on vim startup
" https://github.com/nathanaelkane/vim-indent-guides/issues/131
"let g:indent_guides_enable_on_vim_startup = 1
" Colarized color scheme setup
"syntax enable
"set background=dark
"colorscheme solarized