Repository navigation
Expand file tree
/
Copy path_vimrc
More file actions
414 lines (362 loc) · 12.4 KB
/
Copy path_vimrc
File metadata and controls
414 lines (362 loc) · 12.4 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
" .vimrc
" =======
" 1. core
" 2. plugins
" 3. options
" 4. appearance
" 5. plugin-settings
" 6. Key mappings
" 7. Automatic commands
" 1. core
" ========
if !has('win32')
set shell=bash "Comment in WINDOWS
endif
let mapleader=" " " Remap leader to <space> the default Leader is '\'
runtime! macros/matchit.vim "Pull in matchit.vim, which is already bundled with Vim
" 2. plugins
" ===========
" Plugin management with Vundle
filetype off
if has('win32')
set rtp+=$HOME/vimfiles/bundle/Vundle.vim/ "WINDOWS
call vundle#begin('$HOME/vimfiles/bundle/') "WINDOWS
else
"has('unix') "Includes Mac
set rtp+=~/.vim/bundle/Vundle.vim/
let path='~\.vim\bundle' "Comment in WINDOWS
call vundle#begin()
endif
Plugin 'VundleVim/Vundle.vim' " let Vundle manage Vundle, required
" Themes
Plugin 'sickill/vim-monokai'
Plugin 'tomasr/molokai'
" Syntax and Language Support
Plugin 'plasticboy/vim-markdown'
Plugin 'kien/rainbow_parentheses.vim'
Plugin 'guns/vim-sexp'
Plugin 'tpope/vim-sexp-mappings-for-regular-people'
Plugin 'lervag/vimtex' "Latex support
Plugin 'elixir-editors/vim-elixir'
Plugin 'neovimhaskell/haskell-vim'
"Plugin 'tpope/vim-rails'
"Plugin 'mhinz/vim-mix-format' " Testing Mix Format for elixir
""Plugin 'skammer/vim-css-color'
""Plugin 'jelera/vim-javascript-syntax'
"Plugin 'elzr/vim-json'
""Plugin 'mustache/vim-mustache-handlebars'
""Plugin 'lepture/vim-jinja'
" Editing and Navigating
Plugin 'Raimondi/delimitMate' "Provides Sublime-Text like smart completion of braces, parens and such
Plugin 'vim-scripts/vim-auto-save' " Auto-Saving -> Use :AutoSaveToggle para activarlo
Plugin 'scrooloose/nerdtree' " Nerdtree provides a file explorer
Plugin 'tpope/vim-surround' " Surround is useful for adding surrounding tags to elements (especially html)
Plugin 'tpope/vim-repeat' " Allows vim-surround to be used with . command
Plugin 'scrooloose/nerdcommenter' " Provides easy shortcuts for commenting out lines
Plugin 'easymotion/vim-easymotion' " Jump to words
Plugin 'vim-scripts/loremipsum' " Lorem Ipsum generator
Plugin 'Yggdroot/indentLine'
Plugin 'itchyny/lightline.vim'
Plugin 'haya14busa/is.vim'
" File management
Plugin 'ctrlpvim/ctrlp.vim' " ctrlp is file fuzzy search
Plugin 'yegappan/mru' "MRU - Recently used files
" Not using right now
"Plugin 'dhruvasagar/vim-table-mode' " Table mode (:TableModeToggle & :Tableize)
"Plugin 'garbas/vim-snipmate'
"Plugin 'honza/vim-snippets' " Snippets for snipMate
call vundle#end()
filetype plugin indent on
" 3. options
" ===========
" General editor behaviour
set encoding=utf-8
set number " Line numbers are nice
set relativenumber
set backspace=indent,eol,start " Allow backspace in insert mode
set history=100 " Store lots of :cmdline history
set showcmd " Show incomplete cmds down the bottom
"set gcr=a:blinkon0 " Disable cursor blink
set guicursor=n-v-c:block-Cursor" NORMAL-VISUAL-COMMAND: cursor is a block █
set guicursor+=i:ver10 " Insert mode: cursor is a vertical line |
"set guicursor+=a:blinkon0 " Disable cursor blink
let &t_EI = "\033[1 q" " NORMAL █ in Terminal
let &t_SI = "\033[5 q" " INSERT | in Terminal
set autoread " Reload files changed outside vim
set laststatus=2 " Always show status line
set hidden " Buffers can exist in the background
set splitright " Opens vertical split right of current window
set splitbelow " Opens horizontal split below current window
set shortmess=filnxtToOI " see :help shortmess
set visualbell " Visual Beep
" set lines=50 columns=140
set clipboard^=unnamed,unnamedplus " Use system clipboard in all OSes (Mac, Windows AND Linux)
set noshowmode " Let airline/lightline handle the mode display
" Mouse and terminal
"set ttyfast " Send more characters for redraws
set mouse=a " Enable mouse use in all modes
" Set this to the name of your terminal that supports mouse codes.
"if !has('nvim')
"set ttymouse=xterm2 " Must be one of: xterm, xterm2, netterm, dec, jsbterm, pterm
"endif
" Search Settings
set incsearch " Find the next match as we type the search
set hlsearch " Highlight searches by default
"set viminfo='100,f1 " Save up to 100 marks, enable capital marks
"if has('nvim')
"set shada='100,f1
"else
"set viminfo='100,f1 " Save up to 100 marks, enable capital marks
"endif
set ignorecase " Ignore case while searching
set smartcase " smart use of case while searching
" Files, Swap, backup and undo
set noswapfile
set nobackup
set nowritebackup
" Next 2 lines only are needed if backup of swapfile are active
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
"if has('gui_running')
"set undodir=~/.vim/backups "Persistent Undo across sessions (storing in file), only works in gui MacVim
"set undofile
"endif
if has('nvim')
set undodir=~/.local/state/nvim/undo
else
set undodir=~/.vim/undo
endif
set undofile
" Indentation and display (Replace tabs with 4 space width indentation)
set autoindent
set smartindent
set smarttab
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
"set list listchars=tab:\ \ ,trail:· " Display tabs and trailing spaces visually
"set nowrap " Don't wrap lines
"set wrap linebreak nolist " Softwrap text
set listchars=tab:\ \ ,trail:·
"set nolist
set list
set wrap
set linebreak
" Folding
set foldmethod=indent " Fold based on indent
set foldnestmax=3 " Deepest fold is 3 levels
set nofoldenable " Don't fold by default
" Completion
set path+=** " Search down into subfolders & Provides tab-completion for all file-related tasks
set wildmode=list:longest "set wildmode=longest,list,full
set wildmenu " Enable ctrl-n and ctrl-p to scroll thru matches
set wildignore=*.o,*.obj,*~ " Stuff to ignore when tab completing
set wildignore+=*vim/backups*,*.so,*.swp,*.zip
" Scrolling (Start scrolling when we're getting close to margins)
set scrolloff=10
set sidescrolloff=15
set sidescroll=1
" normal timeout (for jj, etc.)
"set timeoutlen=300
" 4. appearance
"
" ==============
"syntax on
syntax enable
"set t_Co=256 "We want syntax highlighting in 256 colors
set background=dark
colorscheme molokai
"if has('gui_running')
"colorscheme molokai
"else
"let base16colorspace = 256 " Access colors present in 256 colorspace
"colorscheme molokai
"endif
" GUI fonts
if has('gui_running')
if has('macunix')
set guifont=JetBrains\ Mono:h20 " Mac Font
"set macligatures
"set guifont=JetBrainsMono\ Nerd\ Font\ Mono:h18 " Mac Font
"set guifont=Menlo\ Regular:h18 " Mac Font
"set guifont=Fira\ Code\ Retina:h18 " Mac Font
elseif has('unix')
set guifont=Liberation\ Mono\ 16 "Linux Font
"set guifont=Ubuntu\ Mono:h20 " Linux Ubuntu Font
else
set guifont=Lucida\ Console:h16 " Windows Font
endif
endif
" 5. plugin-settings
" ===================
" vim-markdown: show the actual Markdown delimiters
let g:vim_markdown_conceal = 0
let g:vim_markdown_conceal_code_blocks = 0
let g:vim_markdown_folding_disabled = 1
" Config for markdown conceal (avoiding config of indentLine plugin)
let g:indentLine_setConceal = 0
"NERDTree
let NERDTreeHijackNetrw = 1 " Put Nerdtree into a window
"CtrlP settings in case the plugin is enabled
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll)$',
\ }
"TableMode Markdown Tables Format
let g:table_mode_corner="|"
" AutoSave
let g:auto_save_no_updatetime = 1 " AutoSave don't change the update time to 200ms. Default=4000ms
"VimTeX
let g:tex_flavor = "latex"
"indentLine options
let g:indentLine_char = '│'
"lightline options
let g:lightline = { 'colorscheme': 'powerlineish', }
"haskell-vim options
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
"let g:haskell_classic_highlighting = 1 " classic highlighting
let g:haskell_indent_if = 3
let g:haskell_indent_case = 2
let g:haskell_indent_let = 4
let g:haskell_indent_where = 6
let g:haskell_indent_before_where = 2
let g:haskell_indent_after_bare_where = 2
let g:haskell_indent_do = 3
let g:haskell_indent_in = 1
let g:haskell_indent_guard = 2
"let g:haskell_indent_case_alternative = 1
let g:cabal_indent_section = 2
" 6. Key mappings
" ===============
" Leave insert/command mode - <ESC> control
inoremap jj <Esc>
inoremap jk <Esc>
inoremap kj <Esc>
cnoremap jj <C-c>
"cmap <leader>. <C-c>
"vmap <leader>. <esc>
"imap <leader>. <esc>
"cmap ºº <C-c>
"vmap ºº <esc>
"imap ºº <esc>
"Clear search highlights
nnoremap <esc> :noh<return><esc>
nmap <leader><leader><leader> :noh<CR><Esc>
nnoremap <C-c> :noh<CR><Esc>
nnoremap <leader>h :noh<CR><Esc>
"nnoremap ºº :noh<CR><Esc>
"<leader>. normal -> ex-mode else -><esc>
" Buffers
nnoremap gt :bnext<CR>
nnoremap gn :bnext<CR>
nnoremap gT :bprevious<CR>
nnoremap gp :bprevious<CR>
map <leader>b :b
" <leader>w: next buffer, not write
nnoremap <leader>w :bnext<CR>
" Editing behaviour
nnoremap K i<Enter><Esc> "Let K be the opposite of J
nnoremap U <C-R> " U is redo too
nnoremap gh 0
nnoremap gl $
nnoremap ge G
"nnoremap oo o<Esc>k
"nnoremap <leader>o o<Esc>k
nnoremap <leader>o o<Esc>
"nnoremap OO O<Esc>j
"nnoremap <leader>O O<Esc>j
nnoremap <leader>O O<Esc>
" Reload/open vimrc
if has('win32')
map <leader>rr :source ~/_vimrc<CR>
map ,r :source ~/_vimrc<CR>
else
"has('unix') "Includes has('mac')
map <leader>rr :source ~/.vimrc<CR>
map ,r :source ~/.vimrc<CR>
endif
map <BS>r :source ~/.vimrc<CR>
map <BS>o :e ~/.vimrc<CR>
" Files, windows and commands
map <leader>e :edit<Space>
map <leader>f :edit<Space>
map <leader>v :vsplit<CR>
nnoremap <leader>s :write<CR>
"map <leader>w :w<CR>
map <C-s> :w<CR>
nnoremap <leader>q :quit<CR>
nnoremap <leader>qq :quit!<CR>
map <leader><leader>q :q!<CR>
"map <leader>s /
"map <leader>S ?
map <leader>S /
map <leader>r :%s/
"map <leader>m :@
map <leader>. :
map <leader>x :
" Toggles
map <leader>as :AutoSaveToggle<CR>
map <leader>- :AutoSaveToggle<CR>
map <leader>max :set lines=999 columns=999<CR>
map <leader>min :set lines=50 columns=140<CR>
"Toggle Word Wrap
map <leader>z :set wrap!<CR>
"Toggle line absolute and relative numbers (set number is already set)
map <leader>n :set relativenumber!<CR>
map <leader>l :set relativenumber!<CR>
"Spellcheck
map <leader><leader>c :setlocal spell!<CR>
"map <leader>cen :setlocal spell! spelllang=en<CR>
"map <leader>ces :setlocal spell! spelllang=es_es<CR>
"Comments
nmap <leader>c <Plug>NERDCommenterToggle
vmap <leader>c <Plug>NERDCommenterToggle
nmap ,c <Plug>NERDCommenterToggle
vmap ,c <Plug>NERDCommenterToggle
nmap <D-7> <Plug>NERDCommenterToggle
vmap <D-7> <Plug>NERDCommenterToggle
"NERDTree
map <C-n> :NERDTreeToggle<CR>
"EasyMotion options
"<leader><leader>s easymotion with n-chars
map <leader><leader>s <Plug>(easymotion-sn)
omap <leader><leader>s <Plug>(easymotion-tn)
nmap ,,w <Plug>(easymotion-w)
nmap <leader><leader>w <Plug>(easymotion-w)
"Return is easymotion with words (the same as <leader><leader>w)
nmap <CR> <Plug>(easymotion-w)
vmap <CR> <Plug>(easymotion-w)
nmap gw <Plug>(easymotion-w)
vmap gw <Plug>(easymotion-w)
" CtrlP
nmap <leader>t :CtrlP<CR>
nmap <leader>p :CtrlP<CR>
" Not used
"map <leader>mru :MRU<CR>
nmap <leader>m :MRU<CR>
" 7. Automatic commands
" =======================
" Keep delimitMate active in Markdown, but do not treat the backtick as a quote.
augroup delimitmate_markdown
autocmd!
autocmd FileType markdown let b:delimitMate_quotes = "\" '"
augroup END
"rainbow-parentheses options "Always on
augroup rainbow_parentheses
autocmd!
autocmd VimEnter * RainbowParenthesesToggleAll
autocmd Syntax * RainbowParenthesesLoadRound
autocmd Syntax * RainbowParenthesesLoadSquare
autocmd Syntax * RainbowParenthesesLoadBraces
augroup END
"au VimEnter * RainbowParenthesesToggleAll
"au Syntax * RainbowParenthesesLoadRound
"au Syntax * RainbowParenthesesLoadSquare
"au Syntax * RainbowParenthesesLoadBraces