Repository navigation
Expand file tree
/
Copy pathvimrc
More file actions
56 lines (45 loc) · 1.34 KB
/
Copy pathvimrc
File metadata and controls
56 lines (45 loc) · 1.34 KB
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
set noeb
set vb
set sc
set backspace=indent,eol,start
syntax on
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set noexpandtab
set number
set ruler
set encoding=utf-8
setglobal fileencoding=utf-8
colorscheme slate
" group all autocmds so re-sourcing this file doesn't duplicate them
augroup vimrc
autocmd!
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
" strip trailing whitespace on save, keeping cursor and search history;
" skip filetypes where trailing whitespace is meaningful
function! s:StripTrailingWhitespace()
if &filetype =~# '^\(markdown\|diff\)$'
return
endif
let l:view = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:view)
endfunction
autocmd BufWritePre * call s:StripTrailingWhitespace()
au BufRead,BufNewFile *.pp set filetype=puppet
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
" enables autowrap at column 80
autocmd FileType markdown setlocal textwidth=80 formatoptions+=t
augroup END