-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
266 lines (216 loc) · 6.09 KB
/
Copy pathvimrc
File metadata and controls
266 lines (216 loc) · 6.09 KB
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
syntax on
set termguicolors
if &term =~# '^screen'
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
set nocompatible
" Use utf-8 characters (for Spanish accents and such)
set encoding=utf-8
" Backspace will work like in most other programs
set backspace=2
set autoindent
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set showbreak=↪
set list listchars=tab:››,nbsp:…,trail:…
set scrolloff=2
set lazyredraw
set wildmenu
set ignorecase
set smartcase
set showmatch
" Line numbers
set relativenumber
set noeb vb t_vb=
set linebreak
" Make splits open in the places that make sense
set splitbelow splitright
set fillchars+=vert:│
filetype plugin indent on
augroup myfiletypes
" Clear old autocmds in group
autocmd!
" autoindent with two spaces, always expand tabs
autocmd FileType markdown set spell
augroup END
" Hack to make php files indent correctly
au BufEnter, BufNew *.php :set filetype=html syn=php
" Make search look good (highlights)
set hlsearch
set incsearch
" When you scroll with the mousewheel / pad, it scrolls in Vim not in
" terminal
set mouse=a
" Configuration of the tree view
let g:netrw_banner = 0
let g:netrw_browse_split = 0
let g:netrw_winsize = 25
call plug#begin('~/.vim/plugged')
"
" Language support for Ruby on Rails editing
Plug 'vim-ruby/vim-ruby'
" Lets plugins (e.g. vim-surround) repeat with the . command
Plug 'tpope/vim-rails'
"
" Matching parentheses
Plug 'jiangmiao/auto-pairs'
"
" Use % to jump between all types of tags, not only parentheses (e.g.
" between start and end HTML tags)
Plug 'tmhedberg/matchit'
"
" Adds the verbs gs (surround) and cs (change surround) to modify
" surrounding parentheses, tags, etc
Plug 'tpope/vim-surround'
" Integrates git in vim
Plug 'tpope/vim-fugitive'
" Lets plugins (e.g. vim-surround) repeat with the . command
Plug 'tpope/vim-repeat'
"
" Adds the verb gc (comment)
Plug 'vim-scripts/tComment'
"
" Tab autocompletes in a smart way
Plug 'ervandew/supertab'
"
" Lets languages understand more programming languages
Plug 'sheerun/vim-polyglot'
"
" Snippets in Vim
Plug 'marcweber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
Plug 'garbas/vim-snipmate'
Plug 'honza/vim-snippets'
"
" Airline shows at the bottom with useful info
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"
" Use .editorconfig file for indentation and the like
Plug 'editorconfig/editorconfig-vim'
"
"
" CtrlP fuzzy finder
" Plug 'kien/ctrlp.vim'
"
" Plugins to enter zen mode for writing (narrow and highlighted)
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
"
" Asyncronous checking
Plug 'w0rp/ale'
"
" reasonable configs)
Plug 'tpope/vim-vinegar'
"
" Language support for Vue
Plug 'posva/vim-vue'
"
" Language support for Svelte
Plug 'evanleck/vim-svelte', {'branch': 'main'}
"
" Navigates seamlessly panes from vim and tmux (ctrl+hjkl)
Plug 'christoomey/vim-tmux-navigator'
"
" Lets me use Vim as a wiki with easy keybindings
Plug 'vimwiki/vimwiki'
"
" Natural way of using netrw file browser with keystroke - (and other
" Plugins to explore at some point
"
" Check what overlaps exist between supertab and vim-snippets
"
" HTML generator
" Plug 'rstacruz/sparkup'
"
" Using Ack for search, check differences with ripgrep and :Rg (they seem
" equally fast)
" Plug 'mileszs/ack.vim'
Plug 'lamchau/vim-ripgrep', { 'branch': 'patch-1' }
"
" Colorschemes
Plug 'joshdick/onedark.vim'
" Plug 'KeitaNakamura/neodark.vim'
" Plug 'rakr/vim-one'
" Plug 'arcticicestudio/nord-vim'
" Need to check again what they do
" Plug 'dyng/ctrlsf.vim'
" Plug 'sainnhe/edge'
"
call plug#end()
" Goyo is a focus mode that you enter typing :Goyo (and leave it typing :Goyo!), and the following line activates limelight when doing that
autocmd! User GoyoEnter Limelight
autocmd! User GoyoLeave Limelight!
colorscheme onedark
" colorscheme neodark
" colorscheme nord
" colorscheme edge
let g:airline_theme='onedark'
" Configuration of ALE linter
let g:ale_set_highlights = 0
" Mods to the colorscheme
hi NonText ctermfg=none
" Config for EditorConfig to play nice with Vim Fugitive
let g:EditorConfig_exclude_patterns = ['fugitive://.*']
" Config for Vim WIKI
let g:vimwiki_list = [{'path': '~/.wiki', 'syntax': 'markdown', 'ext': '.md.wiki'}]
let g:vimwiki_global_ext = 0
" Custom config for Vim WIKI
au FileType vimwiki call SetVimwikiKeybindings()
function SetVimwikiKeybindings()
nmap <buffer> <F13> <Plug>VimwikiRemoveHeaderLevel
nmap <buffer> - <Plug>VimwikiGoBackLink
endfunction
" ***** Mappings *****
" Make the spacebar the leader key
nnoremap <Space> <nop>
let mapleader = "\<Space>"
" Remove highlights
nnoremap <Leader><CR> :noh<CR>
" Easier split navigation with double click on leader
" nnoremap <Leader><Leader> <C-w>
" Open file eplorer on the side
nnoremap <Leader>f :Vex<CR>
" Quick splits and tabs
nnoremap <Leader>v :vsplit<CR>
nnoremap <Leader>b :split<CR>
nnoremap <Leader>t :tabnew<CR>
" Quick run-with-ruby
nnoremap <Leader>r :w<cr>:!ruby %<cr>
" Search and replace in the whole document
nnoremap <Leader>s :%s/\<<C-r><C-w>\>//gc<Left><Left><Left>
" Activate spellcheck
nnoremap <Leader>a :set spell!<CR>
" Spellcheck word (pick first option)
nnoremap <Leader>u 1z=
" Quit
" nnoremap <Leader>q :q<CR>
" TODO: mapping for search function
" Easier navigation of search results
nnoremap <C-n> :cnext<CR>
nnoremap <C-p> :cprevious<CR>
" Repeat the last macro, used often (instead of going into Ex mode)
nnoremap QQ @@
nnoremap n nzz
nnoremap N Nzz
" *********** COMMANDS *************
" Save myself from accidental caps
command Q q
command W w
command YANK execute "normal! gg\"*yG"
" Quickly edit vimrc file
command Evimrc edit ~/.vim/vimrc
command Svimrc source ~/.vim/vimrc
highlight VertSplit guifg=#3E4452
function! Json() abort
silent ! clear
silent %! python -m json.tool
endfunction
command! Json :call Json()
" Configuration for snipMate
let g:snipMate = { 'snippet_version' : 1 }
" Search with leader-/
nnoremap <Leader>/ :Rg<space>