-
Notifications
You must be signed in to change notification settings - Fork 73
/
.vimrc
201 lines (154 loc) · 5.1 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
set nocompatible
set shortmess=I
call plug#begin()
Plug 'dense-analysis/ale'
Plug 'airblade/vim-gitgutter'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'sheerun/vim-polyglot'
Plug 'preservim/nerdtree'
Plug 'preservim/nerdcommenter'
Plug 'itchyny/lightline.vim'
Plug 'maximbaz/lightline-ale'
Plug 'alvan/vim-closetag'
Plug 'ervandew/supertab'
Plug 'tpope/vim-fugitive'
call plug#end()
" Set fzf runtime
set rtp+=/opt/homebrew/opt/fzf
" Enable syntax highlighting
syntax on
filetype plugin indent on
" Colorscheme see https://github.com/hukl/Smyck-Color-Scheme
color smyck
" Add line numbers
set number
set ruler
set cursorline
" Disable Backup and Swap files
set noswapfile
set nobackup
set nowritebackup
" Set encoding
set encoding=utf-8
" Whitespace stuff
set nowrap
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" Disable Mode Display because Status line is on
set noshowmode
" Show trailing spaces and highlight hard tabs
set list listchars=tab:»·,trail:·
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Strip trailing whitespaces on each save
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
" Close window if last remaining window is NerdTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Search related settings
set incsearch
set hlsearch
" Map Ctrl+l to clear highlighted searches
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l>
nnoremap <silent> <C-p> :<C-u>Files<CR><C-p>
map <leader>d :ALEGoToDefinition<CR>
map <leader>r :ALEFindReferences<CR>
" Highlight characters behind the 80 chars margin
:au BufWinEnter * let w:m2=matchadd('ColumnMargin', '\%>80v.\+', -1)
" Disable code folding
set nofoldenable
" Always show status bar
set laststatus=2
" NERDTree configuration
let NERDTreeIgnore=['\.pyc$', '\.rbc$', '\~$']
map <Leader>n :NERDTreeToggle<CR>
" Always show ALE Gutter
let g:ale_sign_column_always = 1
let g:ale_elixir_elixir_ls_release = expand("~/src/elixir-ls/rel")
" No bgcolor for ALE SignColumn
highlight clear SignColumn
" ALE Linting Settings
" Erlang linting done via https://github.com/ten0s/syntaxerl
" Download/Build it and put it in your $PATH
let g:ale_linters = {
\ 'erlang': ['syntaxerl'],
\ 'elixir': ['elixir-ls'],
\ 'javascript': ['eslint'],
\}
" Ignorde JS files on CTAGS generation
let g:vim_tags_ignore_files = ['.gitignore', '.svnignore', '.cvsignore', '*.js', '*.json', '*.css']
" make uses real tabs
au FileType make set noexpandtab
" Ruby uses 2 spaces
au FileType ruby set softtabstop=2 tabstop=2 shiftwidth=2
" Go uses tabs
au FileType go set noexpandtab tabstop=4 shiftwidth=4
" Go Foo
let g:go_fmt_command = "goimports"
" Thorfile, Rakefile, Vagrantfile and Gemfile are Ruby
au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,Thorfile,config.ru} set ft=ruby
" add json syntax highlighting
au BufNewFile,BufRead *.json set ft=javascript
" make various elixir related files highlight correctly
au BufRead,BufNewFile *.eex,*.heex,*.leex,*.sface,*.lexs set filetype=eelixir
" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
au FileType ruby set softtabstop=2 tabstop=2 shiftwidth=2
au FileType javascript set softtabstop=2 tabstop=2 shiftwidth=2
" Gitgutter
set updatetime=250
" lightline / Ale
let g:lightline = {
\ 'colorscheme': 'smyck'
\}
let g:lightline.component_expand = {
\ 'linter_checking': 'lightline#ale#checking',
\ 'linter_warnings': 'lightline#ale#warnings',
\ 'linter_errors': 'lightline#ale#errors',
\ 'linter_ok': 'lightline#ale#ok',
\ }
let g:lightline.component_type = {
\ 'linter_checking': 'left',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error',
\ 'linter_ok': 'left',
\ }
let g:lightline.active = { 'right': [['filetype'],[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ]] }
command! -bang -nargs=? -complete=dir Files
\ call fzf#vim#files(<q-args>, fzf#vim#with_preview(), <bang>0)
" Similarly, we can apply it to fzf#vim#grep. To use ripgrep instead of ag:
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --smart-case '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
nnoremap <silent> <Leader>f :Rg!<CR>
let s:test_colors = [
\ '#616e64', '#0d0a79',
\ '#6d610d', '#0a7373',
\ '#690d0a', '#6d696e',
\ '#0d0a6f', '#616e0d',
\ '#0a6479', '#6d0d0a',
\ '#617373', '#0d0a69',
\ '#6d690d', '#0a6e6f',
\ '#610d0a', '#6e6479',
\]
let g:terminal_ansi_colors = [
\ '#616e64', '#0d0a79',
\ '#6d610d', '#0a7373',
\ '#690d0a', '#6d696e',
\ '#0d0a6f', '#616e0d',
\ '#0a6479', '#6d0d0a',
\ '#617373', '#0d0a69',
\ '#6d690d', '#0a6e6f',
\ '#610d0a', '#6e6479',
\]