forked from bahamas10/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
154 lines (131 loc) · 5.54 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
" ---------------------------------------------
" Dave Eddy's vimrc
" License MIT
"
" Credits
" https://github.com/Happy-Dude/
" Edited by Jean Sandrin
" ---------------------------------------------
set nocompatible " Disable VI Compatibility
" ---------------------------------------------
" Init - plugins
" ---------------------------------------------
call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'godlygeek/tabular'
Plug 'preservim/vim-markdown'
Plug 'rust-lang/rust.vim'
Plug 'dense-analysis/ale'
call plug#end()
" ---------------------------------------------
" Vim Options
" ---------------------------------------------
set autoindent " Default to indenting files
set backspace=indent,eol,start " Backspace all characters
set formatoptions-=t " Don't add line-breaks for lines over 'textwidth' characters
set hlsearch " Highlight search results
set number " Enable line numbers
set nostartofline " Do not jump to first character with page commands
set ruler " Enable the ruler
set showmatch " Show matching brackets.
set showmode " Show the current mode in status line
set showcmd " Show partial command in status line
set tabstop=2 " Number of spaces <tab> counts for
set textwidth=80 " 80 columns
set title " Set the title
" ---------------------------------------------
" Theme / Color Scheme
" ---------------------------------------------
set background=dark "Dark background is best
" ---------------------------------------------
" Abbreviations
" ---------------------------------------------
iab <expr> me:: strftime("Author: Jean Sandrin <[email protected]><cr>Date: %B %d, %Y<cr>License: MIT")
" ---------------------------------------------
" Aliases
" ---------------------------------------------
cmap w!! w !sudo tee > /dev/null %
" ---------------------------------------------
" File/Indenting and Syntax Highlighting
" ---------------------------------------------
if has("autocmd")
filetype plugin indent on
" Jump to previous cursor location, unless it's a commit message
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
autocmd BufReadPost COMMIT_EDITMSG exe "normal! gg"
" Chef/Ruby
autocmd BufNewFile,BufRead *.rb setlocal filetype=ruby
autocmd FileType ruby setlocal sw=2 sts=2 et
" Yaml
autocmd BufNewFile,BufRead *.yaml,*.yml setlocal filetype=yaml
autocmd FileType yaml setlocal sw=2 sts=2 et
" JavaScript files
autocmd BufNewFile,BufReadPre,FileReadPre *.js setlocal filetype=javascript
autocmd FileType javascript setlocal sw=4 sts=4 et
" JSON files
autocmd BufNewFile,BufReadPre,FileReadPre *.json setlocal filetype=json
autocmd FileType json setlocal sw=2 sts=2 et
" Objective C / C++
autocmd BufNewFile,BufReadPre,FileReadPre *.m setlocal filetype=objc
autocmd FileType objc setlocal sw=4 sts=4 et
autocmd BufNewFile,BufReadPre,FileReadPre *.mm setlocal filetype=objcpp
autocmd FileType objcpp setlocal sw=4 sts=4 et
" Rust files
" autocmd BufNewFile,BufReadPre,FileReadPre *.rs setlocal filetype=rust
autocmd FileType rust setlocal sw=4 sts=4 et textwidth=80
" Python files
autocmd BufNewFile,BufReadPre,FileReadPre *.py setlocal filetype=python
autocmd FileType python setlocal sw=4 sts=4 et
" Markdown files
autocmd BufNewFile,BufRead,FileReadPre *.md,*.markdown setlocal filetype=markdown
autocmd FileType markdown setlocal sw=4 sts=4 et spell
" Jekyll posts ignore yaml headers
autocmd BufNewFile,BufRead */_posts/*.md syntax match Comment /\%^---\_.\{-}---$/
autocmd BufNewFile,BufRead */_posts/*.md syntax region lqdHighlight start=/^{%\s*highlight\(\s\+\w\+\)\{0,1}\s*%}$/ end=/{%\s*endhighlight\s*%}/
" EJS javascript templates
autocmd BufNewFile,BufRead,FileReadPre *.ejs setlocal filetype=html
" TXT files
autocmd FileType text setlocal spell
endif
" ---------------------------------------------
" Highlight Unwanted Whitespace
" ---------------------------------------------
highlight RedundantWhitespace ctermbg=green guibg=green
match RedundantWhitespace /\s\+$\| \+\ze\t/
" ---------------------------------------------
" Spell Check Settings
" ---------------------------------------------
set spelllang=en
highlight clear SpellBad
highlight SpellBad term=standout cterm=underline ctermfg=red
highlight clear SpellCap
highlight SpellCap term=underline cterm=underline
highlight clear SpellRare
highlight SpellRare term=underline cterm=underline
highlight clear SpellLocal
highlight SpellLocal term=underline cterm=underline
" ---------------------------------------------
" Plugins
" ---------------------------------------------
let g:airline_powerline_fonts = 0
let g:airline_theme = "deus"
let g:rust_recommended_style = 1
let g:ale_linters = {
"\ 'bash': [],
"\ 'sh': [],
"\ 'c': [],
\ 'rust': ['analyzer'],
\}
let g:ale_completion_enabled = 0
let g:vim_markdown_folding_disabled = 1
" ---------------------------------------------
" Source local config
" ---------------------------------------------
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
if filereadable(expand("~/.vimrc.indent"))
source ~/.vimrc.indent
endif