-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
145 lines (111 loc) · 3.24 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
packadd minpac
call minpac#init()
" minpac must have {'type': 'opt'} so that it can be loaded with `packadd`.
call minpac#add('k-takata/minpac', {'type': 'opt'})
call minpac#add('tpope/vim-sensible')
" language support
call minpac#add('amadeus/vim-mjml')
call minpac#add('chrisbra/csv.vim')
call minpac#add('elixir-lang/vim-elixir')
call minpac#add('hashivim/vim-terraform')
call minpac#add('mustache/vim-mustache-handlebars')
call minpac#add('mxw/vim-jsx')
call minpac#add('pangloss/vim-javascript')
call minpac#add('rust-lang/rust.vim')
call minpac#add('tpope/vim-bundler')
call minpac#add('tpope/vim-haml')
call minpac#add('tpope/vim-rails')
call minpac#add('tpope/vim-rake')
call minpac#add('vim-ruby/vim-ruby')
" prettyness
call minpac#add('chriskempson/base16-vim')
call minpac#add('itchyny/lightline.vim')
" the rest
call minpac#add('junegunn/fzf')
call minpac#add('mileszs/ack.vim')
call minpac#add('mudge/runspec.vim')
call minpac#add('rizzatti/dash.vim')
call minpac#add('tpope/vim-abolish')
call minpac#add('tpope/vim-commentary')
call minpac#add('tpope/vim-endwise')
call minpac#add('tpope/vim-surround')
set nocompatible
" allow unsaved background buffers and remember marks/undo for them
set hidden
" remember more commands and search history
set history=10000
" 2 space tabs
set expandtab
set softtabstop=2
set shiftwidth=2
set tabstop=4
set autoindent
" make searches case-sensitive only if they contain upper-case characters
set ignorecase smartcase
set switchbuf=useopen
set numberwidth=5
set showtabline=2
set winwidth=79
" keep more context when scrolling off the end of a buffer
set scrolloff=3
" display incomplete commands
set showcmd
" Enable highlighting for syntax
syntax on
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" line numbers by default
set number
" subtle reminder to wrap text.
set cc=81
set encoding=utf-8
" theming
colorscheme base16-default-dark
set background=dark
" always show the status bar, powerline
set laststatus=2
" remove trailing whitespace
autocmd BufWritePre * :%s/\s\+$//e
" helping keep my commit messages clean
autocmd Filetype gitcommit setlocal spell cc=71
" use the system clipboard
if has("clipboard")
set clipboard=unnamed
endif
" indent if we're at the beginning of a line. Else, do completion.
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-p>"
endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
inoremap <s-tab> <c-n>
" disable the arrow keys
map <Left> <Nop>
map <Right> <Nop>
map <Up> <Nop>
map <Down> <Nop>
set wildignore+=*/tmp/*,*/log/*,*.swp,*/node_modules/*
" new splits appear below or to the right, don't move my eyes
set splitbelow
set splitright
" custom shortcuts
map <Leader>sc :vs db/schema.rb<cr>
" RIP ctrl-p
nnoremap <c-p> :FZF<cr>
" enable backups
set backupdir=~/.vim/backup
set backup
" move tmp files out of repos
set directory=$HOME/.vim/tmp
" persistent undo
set undodir=$HOME/.vim/undo
set undofile
" ack with ripgrep
let g:ackprg = 'rg --vimgrep --no-heading --smart-case --hidden'