-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
175 lines (140 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
"
" A (not so) minimal vimrc.
"
" You want Vim, not vi. When Vim finds a vimrc, 'nocompatible' is set anyway.
" We set it explicitely to make our position clear!
set nocompatible
call plug#begin('~/.vim/plugged')
Plug 'https://github.com/w0rp/ale.git'
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'https://github.com/pangloss/vim-javascript.git'
Plug 'https://github.com/tpope/vim-fugitive.git'
Plug 'Raimondi/delimitMate'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'jelera/vim-javascript-syntax'
Plug 'https://github.com/Yggdroot/duoduo'
Plug 'mileszs/ack.vim'
Plug 'scwood/vim-hybrid'
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'wakatime/vim-wakatime'
Plug 'jparise/vim-graphql'
Plug 'mxw/vim-jsx'
Plug 'airblade/vim-gitgutter'
Plug 'scrooloose/nerdcommenter'
Plug 'git://github.com/altercation/vim-colors-solarized.git'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
call plug#end()
filetype plugin indent on " Load plugins according to detected filetype.
syntax on " Enable syntax highlighting.
set autoindent " Indent according to previous line.
set softtabstop =2 " Tab key indents by 4 spaces.
set shiftwidth =2 " >> indents by 4 spaces.
set shiftround " >> indents to next multiple of 'shiftwidth'.
set backspace =indent,eol,start " Make backspace work as you would expect.
set hidden " Switch between buffers without having to save first.
set laststatus =2 " Always show statusline.
set display =lastline " Show as much as possible of the last line.
set showmode " Show current mode in command-line.
set showcmd " Show already typed keys when more are expected.
set incsearch " Highlight while searching with / or ?.
set hlsearch " Keep matches highlighted.
set ttyfast " Faster redrawing.
set lazyredraw " Only redraw when necessary.
set splitbelow " Open new windows below the current window.
set splitright " Open new windows right of the current window.
set cursorline " Find the current line quickly.
set wrapscan " Searches wrap around end-of-file.
set report =0 " Always report changed lines.
set synmaxcol =200 " Only highlight the first 200 columns.
set noswapfile " No swap files
set t_CO=256
set background=light
colorscheme solarized
set mouse=a
set updatetime=100
" fuzzy finder
set rtp+=/usr/local/opt/fzf
if has("gui_macvim")
set macligatures
endif
set guifont=Fira\ Code:h12
set list " Show non-printable characters.
if has('multi_byte') && &encoding ==# 'utf-8'
let &listchars = 'tab:▸ ,extends:❯,precedes:❮,nbsp:±'
else
let &listchars = 'tab:> ,extends:>,precedes:<,nbsp:.'
endif
" The fish shell is not very compatible to other shells and unexpectedly
" breaks things that use 'shell'.
if &shell =~# 'fish$'
set shell=/bin/bash
endif
" Keybinds
" Open fuzzy finder
nnoremap <C-p> :Files .<CR>
" Open fuzzy finder for current word under the cursor
nnoremap <leader>p :Files .<CR> <C-R><C-W>
" Open folder tree
nnoremap <C-b> <:NERDTreeToggle<CR>
" Toggle Quick Search
cnoreabbrev Ack Ack!
nnoremap <C-f> :Ack!<space>
" Search for current word under the cursor
:nnoremap <leader>f :Ack <C-R><C-W><CR>
" Close Buffer
nnoremap <leader>w :bd<CR>
" Next Buffer
nnoremap <C-e> :bn<CR>
" Prev Buffer
nnoremap <C-q> :bp<CR>
" Format JS
nnoremap <leader>. :ALEFix<CR>
" Clear search highlight
nnoremap <leader>/ :noh<CR>
" Find and Replace
nnoremap <leader>r :%s/<space>/<space>/g
" Copy to Clipboard
vnoremap <leader>c "+y<CR>
" Paste to Clipboard
nnoremap <leader>v "+p<CR>
" JS
let g:javascript_plugin_jsdoc = 1
" Linter and Formatter
let g:ale_fixers = {'javascript': ['prettier_standard']}
let g:ale_linters = {'javascript': ['standard']}
let g:ale_fix_on_save = 1
" Airline
let g:airline#extensions#ale#enabled = 1
let g:airline#extensions#tabline#formatter = 'default'
let g:airline_theme='solarized'
let g:airline_solarized_bg='light'
" Autocomplete
:set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
" Silver Searcher
let g:ackprg = 'ag --nogroup --nocolor --column'
" NerdTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
if &term =~ '256color'
" disable Background Color Erase (BCE) so that color schemes
" render properly when inside 256-color tmux and GNU screen.
" see also http://snk.tuxfamily.org/log/vim-256color-bce.html
set t_ut=
endif
" Disable audible and visual bells
set noerrorbells
set novisualbell
set t_vb=
" Saner behavior of n and N
nnoremap <expr> n 'Nn'[v:searchforward]
nnoremap <expr> N 'nN'[v:searchforward]