-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
127 lines (103 loc) · 3.58 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
:scriptencoding utf-8
""" use bash set shell=bash\ --login
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
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'dense-analysis/ale'
Plug 'djoshea/vim-autoread'
Plug 'lifepillar/vim-solarized8'
Plug 'janko-m/vim-test'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'quramy/tsuquyomi'
Plug 'raimondi/delimitMate'
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-surround'
Plug 'yggdroot/indentLine'
Plug 'jsit/disco.vim'
Plug 'lifepillar/vim-solarized8'
call plug#end()
""" use fzf and map it to ctrl + p
set rtp+=/opt/homebrew/bin/fzf
nnoremap <c-p> :Files<cr>
let $FZF_DEFAULT_COMMAND = 'ag -g ""'
let g:fzf_preview_window = []
set autoindent " autoindents code
set autoread " auto reload changed files
set backspace=indent,eol,start " allow backspace
set clipboard=unnamed " share clipboard with vim
set expandtab " use spaces when pressing tab
set hidden " opening a new buffer sets the current one to be hidden
set ignorecase " do not care about case when searching with /
set nocompatible " vim not vi!
set noshowmode " hide --INSERT--, --REPLACE-- etc.
set number " display line numbers
set ruler " show line number and column in the status line
set shiftwidth=2 " set the autoindent to be 2 chars
set tabstop=2 " set the tab spacing to be 2 chars
syntax enable " enable syntax highlighting
set confirm
""" handling invisible characters
set list " show invisible characters
set listchars+=tab:\ \
set listchars+=trail:. " display trailing spaces as dots
set listchars="" " reset list chars
""" strip trailing whitespace automatically
autocmd BufWritePre * :%s/\s\+$//e
""" store backups in central location
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
""" ignore some files
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/node_modules/*,*/vendor/*,*/cache/*
""" colors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors
set background=light
colorscheme solarized8
hi! Normal ctermbg=NONE guibg=NONE
hi Pmenu ctermfg=grey ctermbg=none cterm=none
hi PmenuSel ctermfg=11 ctermbg=none cterm=none
hi StatusLine cterm=none ctermbg=none ctermfg=grey
hi StatusLineNC cterm=none ctermbg=none
hi VertSplit ctermbg=none
set fillchars=stl:—,stlnc:—,vert:│
set t_Co=256
""" set syntax highlighting for non-ruby ruby files
autocmd BufNewFile,BufRead Gemfile set filetype=ruby
autocmd BufNewFile,BufRead Vagrantfile set filetype=ruby
""" autopaste, this copies vims clipboard to the system clipboard and
""" vice-versa
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
""" disable quote concealing in JSON
let g:vim_json_conceal=0
""" vim-test mappings
nmap <silent> <leader>s :TestNearest<CR>
nmap <silent> <leader>t :TestFile<CR>
set splitbelow
set splitright
set dictionary+=~/.vim/keywords.txt
set complete+=k
let g:netrw_localrmdir = 'rm -r' " allow for the deletion of non-empty directories
let g:netrw_banner = 0 " hide the banner in netrw
" ale
let g:ale_fixers = ['prettier']
let g:ale_linters = {
\ 'ruby': ['rubocop'],
\}
let g:ale_fix_on_save = 1
let g:ale_ruby_rubocop_executable = 'bundle'
let test#ruby#rspec#executable = 'bundle exec rspec'