vimrc 4.18 KB
Newer Older
Nigel Kukard's avatar
Nigel Kukard committed
1 2 3
" Setup colors
set t_Co=256

Nigel Kukard's avatar
Nigel Kukard committed
4 5 6 7 8 9
" Tab to 4 chars
set tabstop=4
set shiftwidth=4

" Turn syntax highlighting on
syntax on
Nigel Kukard's avatar
Nigel Kukard committed
10 11
" Filetypes based on extension
filetype on
Nigel Kukard's avatar
Nigel Kukard committed
12 13 14 15 16

" Show edit window details in bar at bottom
set title
" Always show status line
set ls=2
Nigel Kukard's avatar
Nigel Kukard committed
17
set statusline=%<\ %n:%f\ %m%r%y%=%-35.(line:\ %l\ of\ %L,\ col:\ %c%V\ (%P)%)
Nigel Kukard's avatar
Nigel Kukard committed
18 19 20 21
" Show incomplete commands
set showcmd
" Show ruler
set ruler
22 23 24 25 26 27 28 29 30 31 32 33 34

" Set autocomplete menu colors
highlight Pmenu ctermfg=254 ctermbg=233
highlight PmenuSel cterm=bold ctermfg=233 ctermbg=254

" Set search background
highlight search cterm=bold ctermbg=222 ctermfg=160

" Set color of cursor column
highlight CursorColumn ctermbg=238

" Set color of end of line for programming
highlight ColorColumn ctermbg=238
35

36 37
" Highlight line we're on
highlight CursorLine cterm=none ctermbg=235
Nigel Kukard's avatar
Nigel Kukard committed
38
set cursorline
Nigel Kukard's avatar
Nigel Kukard committed
39

Nigel Kukard's avatar
Nigel Kukard committed
40
" Highlight messed up tab/spaces
41
highlight ExtraWhitespaces ctermbg=202
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

" Switch whitespace handling based on file type
function! WhitespaceHighlight()
	if &filetype == 'python'
		call matchadd('ExtraWhitespaces','^\t')
		set colorcolumn=79
	elseif &filetype != ''
		call matchadd('ExtraWhitespaces',' \t')
		call matchadd('ExtraWhitespaces','\t ')
		call matchadd('ExtraWhitespaces','^  ')
		set colorcolumn=132
	endif
	call matchadd('ExtraWhitespaces','\s\+$')
endfunction


" Autocmd
au BufNewFile,BufRead * call WhitespaceHighlight()
au BufNewFile,BufRead *.md set filetype=markdown | call WhitespaceHighlight()
au BufNewFile,BufRead *.html.ep set filetype=php | call WhitespaceHighlight()
au BufNewFile,BufRead *.py set filetype=python | set expandtab softtabstop=4 | call WhitespaceHighlight()
Nigel Kukard's avatar
Nigel Kukard committed
63

Nigel Kukard's avatar
Nigel Kukard committed
64 65 66 67 68 69 70
" Don't use backup files
set nobackup
set nowb

" Auto-indentation
set backspace=indent,eol,start
set cindent
Nigel Kukard's avatar
Nigel Kukard committed
71 72
set cinoptions=>s,e0,n0,f0,{0,}0,^0,L-1,:s,=s,ls,b0,gs,hs,N0,ps,t0,is,+2s,c1,C1,/0,(2s,us,Us,w0,W2s,k2s,m1,M-1,j0,J0,)20,*70,#1
set cinkeys=0{,0},0),:,!^F,o,O,e
Nigel Kukard's avatar
Nigel Kukard committed
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

" Closing braces
"inoremap {      {}<Left>
"inoremap {<CR>  {<CR>}<Esc>O
"inoremap {{     {
"inoremap {}     {}
" Closing brackets
"inoremap        (  ()<Left>
"inoremap <expr> )  strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")"

" Try keep on same column when moving in a file
set nostartofline

" Highlight search on
set hlsearch
" Ignore search case
set ignorecase


" Show matching brackets when text indicator is over them
set showmatch


" Pull vim settings from end of file
set modeline
" Use 3 lines at bottom of file
set modelines=3

101 102 103 104 105
" Only support unix filetypes
set fileformats=unix

" All unknown chars should be in hex
set dy=uhex
Nigel Kukard's avatar
Nigel Kukard committed
106 107 108 109 110 111

" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
Nigel Kukard's avatar
Nigel Kukard committed
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133



"
" vim-plug start
"
call plug#begin('~/.vim/plugged')

" https://github.com/Shougo/neocomplete.vim
Plug 'Shougo/neocomplete.vim'
" https://github.com/Shougo/neosnippet
Plug 'Shougo/neosnippet'

" https://github.com/airblade/vim-gitgutter
Plug 'airblade/vim-gitgutter'

" https://github.com/bling/vim-airline
Plug 'bling/vim-airline'

" https://github.com/tpope/vim-fugitive
Plug 'tpope/vim-fugitive'

Nigel Kukard's avatar
Nigel Kukard committed
134 135 136
" https://github.com/vim-syntastic/syntastic
Plug 'vim-syntastic/syntastic'

Nigel Kukard's avatar
Nigel Kukard committed
137 138 139 140 141 142 143 144 145 146 147 148

" vim-plug end
call plug#end()



"
" Enable neocomplete
"
let g:neocomplete#enable_at_startup = 1


Nigel Kukard's avatar
Nigel Kukard committed
149 150
"
" neosnippet configuration
151 152 153 154 155 156

" Enable snipMate compatibility feature, this loads all snippets/ from all
" plugins.
let g:neosnippet#enable_snipmate_compatibility = 1

" We also have another snippet directory here...
Nigel Kukard's avatar
Nigel Kukard committed
157
let g:neosnippet#snippets_directory='~/.vim/snippets'
158
let g:neosnippet#disable_runtime_snippets = { '_' : 1 }
Nigel Kukard's avatar
Nigel Kukard committed
159 160


Nigel Kukard's avatar
Nigel Kukard committed
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
"
" Configure neosnippets
"

" Plugin key-mappings.
imap <C-k>     <Plug>(neosnippet_expand_or_jump)
smap <C-k>     <Plug>(neosnippet_expand_or_jump)
xmap <C-k>     <Plug>(neosnippet_expand_target)

" SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: "\<TAB>"

" For conceal markers.
if has('conceal')
	set conceallevel=2 concealcursor=niv
endif


"
" Configure vim-gitgutter
"
Nigel Kukard's avatar
Nigel Kukard committed
187
set signcolumn=yes
Nigel Kukard's avatar
Nigel Kukard committed
188 189 190 191 192 193 194 195 196 197


"
" Configure vim-airline
"

let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1