-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc.conf
270 lines (220 loc) · 8.88 KB
/
vimrc.conf
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
" make all of the things work!
set nocompatible
" -[ colour and theming ] {{{
set t_Co=256 " enable 256 colour mode on systems that need this set
" an awesome colour scheme by Todd Werth: http://blog.toddwerth.com/entries/8
let g:onedark_termcolors=256
set background=dark
"colorscheme one
"colorscheme hemisu
"colorscheme ir_black
let g:gruvbox_contrast_dark="hard"
colorscheme gruvbox
"let g:zenburn_high_Contrast=1
"colors zenburn
"set background=dark
" }}}
" load after pathogen
call pathogen#infect() " Pathogen, baby!
call pathogen#helptags() " TagHightlight
set nocompatible " compatibility mode with traditional (and inferior) vi is for crazy people!
set encoding=utf-8
set autoread " reload files that have changed from the outside
set nocursorline
" -[ terminal settings ] {{{
set ttyfast
set lazyredraw
" }}}
" turn off spellcheck
" setlocal spell!
autocmd FileChangedShell *
\ echohl WarningMsg |
\ echo "File has been changed outside of vim." |
\ echohl None
" Load NERDtree if no files specified
"autocmd vimenter * if !argc() | NERDTree | endif
autocmd BufEnter * :syn sync maxlines=256
"-[ Indents and tabs ] {{{
set tabstop=2 " four is the best number ever (especially when combined with 2)
set shiftwidth=2 " spaces for each step of (auto)indent
"set autoindent " maintain the current indentation when going to a new line
set expandtab " expand tabs. tabs rip.
set shiftround " always round indents to multiples of shiftindent
set copyindent " use existing indents for new indents (?)
set preserveindent " save as much indent structure as possible
filetype plugin indent on " load filetype plugins and indent settings (haml needs spaces, for example)
set backspace=2 " Backspace deletes like most programs in insert mode
set formatoptions=qrn1
"set colorcolumn=+1
set undofile
set undodir=~/.vim/undo " undo across sessions
" delete files older than 90 days
let s:undos = split(globpath(&undodir, '*'), "\n")
call filter(s:undos, 'getftime(v:val) < localtime() - (60 * 60 * 24 * 90)')
call map(s:undos, 'delete(v:val)')
" }}}
" -[ Markdown stuff ] {{{
autocmd BufRead,BufNewFile *.md set filetype=markdown
" Enable spellchecking for Markdown
autocmd BufRead,BufNewFile *.md setlocal spell
" Automatically wrap at 80 characters for Markdown
autocmd BufRead,BufNewFile *.md setlocal textwidth=80
" }}}
" -[ Force file formats ] {{{
" Make .hamlc templates use the haml formatter
au BufRead,BufNewFile *.hamlc set ft=haml
au BufRead,BufNewFile *.scss set ft=scss
au BufRead,BufNewFile *.plist set ft=xml
au BufRead,BufNewFile *.cform set ft=json
au BufRead,BufNewFile *.sls set ft=yaml
" }}}
" Ensure regular line numbers when we lose focus, like when running a test
":au FocusLost * :set number
":au FocusGained * :set relativenumber
" Ensure regular line numbers in insert mode
"autocmd InsertEnter * :set number
"autocmd InsertLeave * :set relativenumber
"--------------- Console UI and text display
set laststatus=2 " always show the statusline
set title " sets the title of the terminal window
set ruler " a nice ruler
set number " line numbers? yes, please
set cul " hightlight the current line
set incsearch " live searching ftw!
set relativenumber " relative line numbers
"set nocursorline " slight performance improvement with this on
syntax on " turn on syntax colouring for various languages
"-------------- Short-cut keys, etc.
" - make window smaller, + make window bigger, ` next window
"map - <C-W>-
"map + <C-W>+
map ` <C-W>w
map ~ <C-W>p
"nmap <silent> \ :NERDTreeToggle<CR>
let mapleader = ","
nmap <Leader>, :NERDTreeToggle<cr>
nmap <Leader>bb :BufExplorer<cr>
nnoremap <F1> :set invnumber number?<cr>:set invrelativenumber relativenumber?<cr>
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
nnoremap <F4> :close<cr>
nnoremap <leader>ev :split $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
" clear the last search highlight by pressing enter after a search
nnoremap <CR> :noh<CR><CR>
" Copy and paste to and from the OS X clipboard
vmap <Leader>c y:call system("pbcopy", getreg("\""))<CR>
nmap <Leader>v :call setreg("\"",system("pbpaste"))<CR>p
"map <C-n> :bn<cr>
"map <C-p> :bp<cr>
nmap <Leader>j :%!python -m json.tool<cr>
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
"-------------- NERDtree
let NERDTreeDirArrows=1
let NERDTreeMinimalUI=1
let NERDTreeShowLineNumbers=1
"-------------- NERDcommenter
let g:NERDDefaultAlign = 'left' " Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDTrimTrailingWhitespace = 1 " Enable trimming of trailing whitespace when uncommenting
let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default
"-------------- Disabled, example, and experimental stuff
let g:indentLine_char = '|'
" stop concealing markdown characters
let g:vim_markdown_conceal = 0
let g:vim_markdown_conceal_code_blocks = 0
" set term=ansi
"source $HOME/Documents/dot-files/vim/ir_black.vim
" set t_Co=256
"function StripTrailingWhitespace()
" :%s/\s\+$//
" echo "Trailing white space stripped."
"endfunction
"command Stripwp :call StripTrailingWhitespace()
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
set list listchars=tab:\ \ ,trail:·
set mouse=a
" supertab colours
highlight Pmenu ctermbg=darkgrey ctermfg=white
highlight PmenuSel ctermbg=193 ctermfg=darkgrey
highlight PmenuSbar ctermbg=darkgrey
map <Leader>m :w<CR> :call g:ScreenShellSend("bin/rake test TESTOPTS='-p' TEST='" . @% . "'")<CR>
map <Leader>M :w<CR> :call g:ScreenShellSend("bin/rake test TESTOPTS='-p'")<CR>
map <Leader>rr :w<CR> :call g:ScreenShellSend("RAILS_ENV=test bundle exec rspec '".@% . ':' . line('.') . "'")<CR>
map <Leader>R :w<CR> :call g:ScreenShellSend("RAILS_ENV=test bin/rspec '".@% . ':' . line('.') . "'")<CR>
map <Leader>jj :w<CR> :call g:ScreenShellSend("tmux send-keys -t 5 \"yarn test '" .@% ."'\" && tmux send-keys -t 5 C-m")<CR>
" If installed using Homebrew
set rtp+=/usr/local/opt/fzf
nmap ; :Buffers<CR>
" call fzf#run(fzf#wrap({'source': 'git ls-files --exclude-standard --others --cached'}))
nmap <Leader>ff :Files<CR>
nmap <Leader>T :Tags<CR>
nmap <Leader>t :call fzf#run(fzf#wrap({'source': 'git ls-files --exclude-standard --others --cached'}))<CR>
nmap <Leader>n :NERDTreeFind<CR>
" Allow JSX in normal JS files
let g:jsx_ext_required = 0 " Allow JSX in normal JS files
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_jsxhint_exec = 'jsx-jshint-wrapper'
let g:syntastic_puppet_puppetlint_args = "--no-80chars-check --no-documentation-check"
let g:syntastic_error_symbol = "✗"
let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute "]
let g:ale_sign_error = '●' " Less aggressive than the default '>>'
let g:ale_sign_warning = '.'
let g:ale_lint_on_enter = 0 " Less distracting when opening a new file
let g:ale_completion_enabled = 0
let g:ale_lint_on_text_changed = 'normal'
let g:ale_lint_on_insert_leave = 1
let g:ale_fixers = {
\ 'javascript': ['eslint'],
\}
" use ag (Silver Surfer) instead of ack
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
let g:ackhighlight = 1
let g:ack_use_dispatch = 1
" don't let vim-dispatch set a bunch of key bindings
let g:dispatch_no_maps = 1
" Ruby is an oddball in the family, use special spacing/rules
if v:version >= 703
" Note: Relative number is quite slow with Ruby, so is cursorline
autocmd FileType ruby setlocal ts=2 sts=2 sw=2 norelativenumber nocursorline
else
autocmd FileType ruby setlocal ts=2 sts=2 sw=2
autocmd FileType jsx setlocal ts=2 sts=2 sw=2 nocursorline
endif
let g:ruby_path="~/.rbenv/shims/ruby"
augroup ft_rb
au!
" fix the SLOOOW syntax highlighting
au FileType ruby setlocal re=1 foldmethod=manual
augroup END
" Check if NERDTree is open or active
" function! IsNERDTreeOpen()
" return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
" endfunction
" " Call NERDTreeFind iff NERDTree is active, current window contains a modifiable
" " file, and we're not in vimdiff
" function! SyncTree()
" if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff
" NERDTreeFind
" wincmd p
" endif
" endfunction
" " Highlight currently open buffer in NERDTree
" autocmd BufEnter * call SyncTree()
" remove the filetype part
let g:airline_section_x=''
let g:airline_section_y=''
" remove separators for empty sections
let g:airline_skip_empty_sections = 1
let g:airline_statusline_ontop=1
set rtp+=~/.vim/tabnine-vim