-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
221 lines (178 loc) · 5.92 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
" To avoid people writing bad shell scripts that aren't fish compatible
set shell=/bin/bash
" Pathogen
filetype off
execute pathogen#infect()
call pathogen#helptags() " generate helptags for everything in 'runtimepath'
" To disable a plugin, add it's bundle name to the following list
" Temporarily disabling vimtex until I have time to configure it
let g:pathogen_disabled = []
filetype plugin indent on
set nocompatible
set modelines=0
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set smarttab
set encoding=utf-8
set scrolloff=3
set autoindent
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest
set visualbell
set cursorline
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2
set relativenumber
set undofile
let mapleader = ","
nnoremap / /\v
vnoremap / /\v
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch
" nnoremap <tab> %
" vnoremap <tab> %
set formatoptions=qrn1
set formatoptions+=t
set wrap linebreak
set textwidth=80
set colorcolumn=80
set nolist
set listchars=trail:~,tab:▸\ ,precedes:«,extends:»
" Invisible character colors
highlight NonText ctermfg=8 guifg=#505050
highlight SpecialKey ctermfg=8 guifg=#4a4a59
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
nnoremap j gj
nnoremap k gk
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
nnoremap ; :
au FocusLost * :wa
nnoremap <leader>ev <C-w><C-v><C-l>:e ~/.vimrc<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <leader>w <C-w>v<C-w>l
nnoremap <Leader>n :NERDTreeToggle<CR>
nnoremap <leader><space> :noh<cr>
nnoremap <leader>d :silent !rm -rf /tmp/vim-chrome && mkdir /tmp/vim-chrome/ && google-chrome --user-data-dir=/tmp/vim-chrome/ --no-first-run --no-default-browser-check http://localhost:3000 &> /dev/null &<cr>
nnoremap <leader>r :terminal yarn dev<cr>
tnoremap <Esc> <C-\><C-n>
au TermOpen * setlocal nonumber
au TermOpen * setlocal norelativenumber
highlight TermCursor ctermfg=red guifg=red
au BufEnter * if &buftype == 'terminal' | :startinsert | endif
tnoremap <A-h> <C-\><C-N><C-w>h
tnoremap <A-j> <C-\><C-N><C-w>j
tnoremap <A-k> <C-\><C-N><C-w>k
tnoremap <A-l> <C-\><C-N><C-w>l
inoremap <A-h> <C-\><C-N><C-w>h
inoremap <A-j> <C-\><C-N><C-w>j
inoremap <A-k> <C-\><C-N><C-w>k
inoremap <A-l> <C-\><C-N><C-w>l
nnoremap <A-h> <C-w>h
nnoremap <A-j> <C-w>j
nnoremap <A-k> <C-w>k
nnoremap <A-l> <C-w>l
inoremap jk <ESC>
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Avoid linter conflict, set standard as only linter for javascript
let g:ale_linters = { 'javascript': ['standard'], }
" Automatic standardjs formatting on save
autocmd bufwritepost *.js silent !standard --fix %
set autoread
syntax on
" ALE settings
let g:ale_sign_column_always = 1
let g:ale_sign_error = '>'
let g:ale_sign_warning = '-'
" set conceallevel=1
"
" let g:javascript_conceal_function = "ƒ"
" let g:javascript_conceal_null = "ø"
" let g:javascript_conceal_this = "@"
" let g:javascript_conceal_return = "↲"
" let g:javascript_conceal_undefined = "¿"
" let g:javascript_conceal_NaN = "ℕ"
" let g:javascript_conceal_prototype = "¶"
" let g:javascript_conceal_static = "•"
" let g:javascript_conceal_super = "Ω"
" let g:javascript_conceal_arrow_function = "⇒"
" let g:javascript_conceal_noarg_arrow_function = "🞅"
" Easy motion mapings
nmap s <Plug>(easymotion-s)
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
map n <Plug>(easymotion-next)
map N <Plug>(easymotion-prev)
let g:EasyMotion_smartcase = 1
" Solarized settings
let g:solarized_visibility="low"
let g:solarized_termtrans=1
let g:solarized_contrast="high"
set background=dark
" colorscheme solarized
set mouse=a
set autochdir
let NERDTreeChDirMode=2
let g:NERDTreeWinSize=35
let g:NERDTreeDirArrows=1
let g:NERDTreeDirArrowExpandable='▸'
let g:NERDTreeDirArrowCollapsible='▾'
autocmd FileType nerdtree setlocal nolist
let NERDTreeShowHidden=0
let NERDTreeStatusline="%{matchstr(getline('.'), '\\s\\zs\\w\\(.*\\)')}"
let NERDTreeIgnore = ['coverage', 'node_modules']
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Use 256 colours (Use this setting only if your terminal supports 256
" colours)
set t_Co=256
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
" set foldmethod=indent
" This isn't working! Need to have all folds unfolded on file open
" autocmd Syntax css,c,cpp,vim,xml,svg,html,py,js setlocal foldmethod=indent
" autocmd Syntax css,c,cpp,vim,xml,svg,html,py,js normal zR
au BufWinEnter * normal zR
nnoremap <Tab> :bnext<CR>
nnoremap <S-Tab> :bprevious<CR>
tnoremap <Tab> <C-\><C-n>:bnext<CR>
tnoremap <S-Tab> <C-\><C-n>:bprevious<CR>
autocmd FileType nerdtree nnoremap <buffer> <Tab> <nop>
autocmd FileType nerdtree nnoremap <buffer> <S-Tab> <nop>
"nnoremap <silent> <C-S> :update<CR>
"vnoremap <silent> <C-S> <C-C>:update<CR>
"inoremap <silent> <C-S> <C-O>:update<CR>
" Remaps Ctrl-O to do a full re-indent of the entire current buffer in Insert,
" Normal and Visual mode :)
nnoremap <C-o> :let b:PlugView=winsaveview()<CR>gg=G:call winrestview(b:PlugView) <CR>:echo "file indented"<CR>
vnoremap <C-o> <C-C>:let b:PlugView=winsaveview()<CR>gg=G:call winrestview(b:PlugView) <CR>:echo "file indented"<CR>v
inoremap <C-o> <C-C>:let b:PlugView=winsaveview()<CR>gg=G:call winrestview(b:PlugView) <CR>:echo "file indented"<CR>i
let g:jsx_ext_required = 0 " Allow JSX in normal JS files
"
nnoremap <C-e> :update<CR>:Bdelete<CR>
vnoremap <C-e> :update<CR>:Bdelete<CR>
inoremap <C-e> :update<CR>:Bdelete<CR>
" Use the X11 clipboard to seamlessly copy past between Vim and GUI
" http://vim.wikia.com/wiki/Accessing_the_system_clipboard
set clipboard=unnamedplus