-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
134 lines (100 loc) · 3.67 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
"-------------------------------------------------------------------------------
" General
"-------------------------------------------------------------------------------
" get out of horrible vi-compatible mode; should be at top; see :help compatible
set nocompatible
"-------------------------------------------------------------------------------
" Plugins
"-------------------------------------------------------------------------------
" https://github.com/junegunn/vim-plug/wiki/tips#automatic-installation
" Install vim-plug if not found
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
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
" My plugins
call plug#begin('~/.vim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'tomasiser/vim-code-dark'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
call plug#end()
"-------------------------------------------------------------------------------
" Colors
"-------------------------------------------------------------------------------
" my terminal supports 256 colors
set t_Co=256
" use syntax highlighting
syntax on
" we are using a dark background
set background=dark
" use a nice color scheme
let g:airline_theme = 'codedark'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 0
colorscheme codedark
" show a line for when I go over 80 characters (requires vim 7.3+)
let &colorcolumn=join(range(81,300),",")
"-------------------------------------------------------------------------------
" Visual
"-------------------------------------------------------------------------------
" show matching brackets for a moment
set showmatch
" how many tenths of a second to blink matching brackets for
set matchtime=5
" highlight searched phrases
set hlsearch
" highlight as you type you search phrase
set incsearch
" ignore case when you're searching (and other places)
set ignorecase
" Minimal number of screen lines to keep above and below the cursor
set scrolloff=99
" Show line numbers
set number
" don't blink and be quiet
set vb t_vb=
" always show the status line
set laststatus=2
"-------------------------------------------------------------------------------
" Text
"-------------------------------------------------------------------------------
" none of these should be word dividers, so make them not be
set iskeyword+=_,$,@,%,#,-,:
" tab spacing (others are just to unify it)
set tabstop=2
set softtabstop=2
set shiftwidth=2
" don't wrap lines
set nowrap
" don't expand tabs to spaces
set noexpandtab
" don't use smarttab (use tabs at the start of a line, spaces elsewhere)
set nosmarttab
"-------------------------------------------------------------------------------
" Miscellaneous
"-------------------------------------------------------------------------------
" update the terminal title when editing a file
let &titlestring = hostname() . " [vim " . expand("%:p") . "]"
if &term == "screen"
set t_ts=^[k
set t_fs=^[\
endif
if &term == "screen" || &term == "xterm"
set title
endif
" Write the file as root; if i've changed it but forgot to sudo, then :w!!
cmap w!! w !sudo tee > /dev/null %
" Remember last line position (from defaults.vim)
if has("autocmd")
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
endif
" Don't autoindent my YAML lines when inserting a comment. So annoying!
autocmd BufEnter *.yaml,*.yml :set indentkeys-=0#