-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
161 lines (122 loc) · 3.55 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
"
" ~/.vimrc
"
set nocompatible
filetype off
" used to detect our platform
let s:uname = system("echo -n \"$(uname)\"")
" setup vundle
"
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" vundle likes to manage vundle
Plugin 'VundleVim/Vundle.vim'
" general vim enhancements
Plugin 'scrooloose/nerdtree'
Plugin 'arusso/vim-colorschemes'
Plugin 'majutsushi/tagbar'
Plugin 'dense-analysis/ale'
" tabular must come before vim-markdown
Plugin 'godlygeek/tabular'
Plugin 'preservim/vim-markdown'
Plugin 'preservim/nerdcommenter'
" hashi stuffz
Plugin 'hashivim/vim-terraform'
Plugin 'hashivim/vim-vaultproject'
" plugins for external tools / languages
Plugin 'tpope/vim-fugitive'
Plugin 'rodjek/vim-puppet'
Plugin 'rudexi/vim-epp'
Plugin 'tpope/vim-bundler'
Plugin 'pearofducks/ansible-vim'
Plugin 'glench/vim-jinja2-syntax'
" plugins for languages
Plugin 'fatih/vim-go'
Plugin 'rust-lang/rust.vim'
" platform specific plugins
if s:uname == "Darwin"
Plugin 'rizzatti/dash.vim'
endif
call vundle#end()
let g:syntastic_puppet_puppetlint_args='--no-class_inherits_from_params_class --no-80chars-check'
" use frontmatter syntax highlighting
let g:vim_markdown_frontmatter=1
" disable vim-markdown folding behavior
let g:vim_markdown_folding_disabled = 1
let g:terraform_fmt_on_save = 1
"let g:ale_linters = {'terraform': ['tflint', 'terraform-lsp']}
"" General Options
" Enable filetype plugins
filetype plugin on
filetype indent on
" Enable syntax highlighting
syntax on
" Don't backup files
set nobackup
" Auto read any changes made to files outside of vim
set autoread
" Ignore compiled files
set wildignore=*.o,*~,*.pyc
"" Interface
let g:solarized_termcolors = 256
"colorscheme desert
colorscheme solarized
set background=dark
"line numbers
set number
" Smart indentation (ie. spaces not tabs)
set smartindent
set tabstop=2
set shiftwidth=2
set expandtab
" control highlighting
set hlsearch
nmap <space> :noh<cr>
set modeline
set modelines=4
" highlight our 81st character
highlight OverLength ctermbg=yellow ctermfg=black guibg=#592929
call matchadd('OverLength', '\%81v.', -1)
" highlight the 141st character
highlight OverLength140 ctermbg=red ctermfg=black guibg=#592929
call matchadd('OverLength140', '\%141v.', -1)
" highlight trailing spaces
highlight TrailingSpace ctermbg=red ctermfg=black guibg=#592929
call matchadd('TrailingSpace', '\s\+$', -1)
" allow us to hit ; in normal mode as an alternative to shift-: to enter
" commands
nnoremap ; :
" setup some leaders for common commands
let mapleader = '-'
" clear out all trailing whitespace
nnoremap <leader>w :%s/\s\+$//g<return>
" replace unquoted modes in puppet
nnoremap <leader>fixmode :%s/\(=>\s\+\)\([0-9]\+\)\s*\(,\?\)$/\1'\2'\3/g<return>
" incremental search
set incsearch
autocmd BufNewFile,BufRead *.go set syntax=go
" statusline configuration cribbed from https://github.com/shapeshed/dotfiles/blob/master/vimrc
set laststatus=2
function! GitBranch()
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
endfunction
function! StatuslineGit()
let l:branchname = GitBranch()
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
endfunction
set statusline=
set statusline+=%#PmenuSel#
set statusline+=%{StatuslineGit()}
set statusline+=%#LineNr#
set statusline+=\ %f
set statusline+=%m\
set statusline+=%=
set statusline+=%#CursorColumn#
set statusline+=\ %y
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
set statusline+=\[%{&fileformat}\]
set statusline+=\ %p%%
set statusline+=\ %l:%c
set statusline+=\
" control backspace / delete key behavior
set backspace=indent,start,eol