-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
241 lines (211 loc) · 7.57 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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
"------------------------------------------------------------------
" Other mapped keys
"------------------------------------------------------------------
"------------------------------------------------------------------
" Syntax, number, limit, encoding, tab, fold, backspace, speel
"------------------------------------------------------------------
set number
syntax on
set textwidth=80
set colorcolumn=+1
set tabstop=4 shiftwidth=4 expandtab
set nocompatible
set backspace=2
set encoding=utf-8
set spelllang=en
set nocompatible
set ruler " Show position of the cursor in status bar
set number " Show number lines
"set cursorline " Highlight cursor line
set foldmethod=syntax
" Python's folding
autocmd Filetype python set foldmethod=indent
" Spellang
autocmd Filetype *tex set spelllang=es
autocmd Filetype markdown set spelllang=es
autocmd Filetype *wiki set spelllang=es
autocmd Filetype *exs set tabstop=2 |
\ set shiftwidth=2 |
\ expandtab |
\ syntax=elixir
set spell
set foldnestmax=2
set breakindent
" Keeps the visual textwidht without breaking new line
set formatoptions-=t
set nowrap
" Italic Comments
highlight Comment cterm=italic
let mapleader = ","
set hidden " allow buffer switching without saving
set showtabline=2 " always show tabline
"--- Buffer movement ---
" Open a new buffer
nmap <leader>T :enew<cr>
" Move to the next buffer
nmap <leader>l :bnext<CR>
" Move to the previous buffer
nmap <leader>h :bprevious<CR>
" Close the current buffer and move to the previous one
nmap <leader>bq :bp <BAR> bd #<CR>
" Show all open buffers and their status
nmap <leader>bl :ls<CR>
"------------------------------------------------------------------
" Plugins - Vundle
"------------------------------------------------------------------
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'ctrlpvim/ctrlp.vim' " Ctrlp
Plugin 'Raimondi/delimitMate' " Delimiters
Plugin 'vim-latex/vim-latex' " vim latex
Plugin 'altercation/vim-colors-solarized' " solarized
Plugin 'vimwiki/vimwiki'
Plugin 'rust-lang/rust.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'bling/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'majutsushi/tagbar'
Plugin 'w0rp/ale'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
Plugin 'maralla/completor.vim'
Plugin 'reedes/vim-pencil' " Plugin for writing with vim
call vundle#end()
filetype plugin indent on
"------------------------------------------------------------------
" Config theme
"------------------------------------------------------------------
set background=dark
highlight Normal ctermbg=NONE
colorscheme solarized
"------------------------------------------------------------------
" Config vim-airline
"------------------------------------------------------------------
let g:airline#extensions#branch = 1
let g:airline#extensions#syntastic = 1
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_solarized_bg='dark'
" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = ''
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
"airline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''
set laststatus=2
"airline buffer options
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#fnamemod = ':t'
"------------------------------------------------------------------
" Config latex
"------------------------------------------------------------------
" Auto insert text for arara compiling
let g:Tex_DefaultTargetFormat='pdf'
let g:Tex_CompileRule_pdf = 'xelatex $*.tex'
if has('mac')
let g:Tex_ViewRule_pdf = 'open -a preview'
elseif has("unix")
let g:Tex_ViewRule_pdf = 'evince'
endif
"------------------------------------------------------------------
" Config identLine
"------------------------------------------------------------------
"let g:indentLine_enabled = 1
let g:indentLine_char = '│'
"------------------------------------------------------------------
" Encryptation algorithm
"------------------------------------------------------------------
if !has('nvim')
set cm=blowfish2
endif
"------------------------------------------------------------------
" Special shortcut
"------------------------------------------------------------------
map <F3> :echo 'Current time is ' . strftime('%c')<CR>
"------------------------------------------------------------------
" Explorer
"------------------------------------------------------------------
map <C-n> :Explore<CR>
"map <C-N> :Sex<CR>
let g:netrw_liststyle=3
"------------------------------------------------------------------
" Markdown
"------------------------------------------------------------------
map <F4> :!pandoc ${pwd}% --latex-engine=xelatex -o ${pwd}%<.pdf<CR>
"------------------------------------------------------------------
" Latex Preview
"------------------------------------------------------------------
if has('mac')
let g:livepreview_previewer = 'open -a preview'
elseif has("unix")
let g:livepreview_previewer = 'evince'
endif
map <F4> :LLPStartPreview<CR>
"------------------------------------------------------------------
" Vim Wiki
"------------------------------------------------------------------
" Load from file the multiples wikis
source ~/.vim/wikis.vim
" let g:vimwiki_list = [{'path': '~/Dropbox/wiki'}]
let g:vimwiki_folding='syntax'
"------------------------------------------------------------------
" TagBar
"------------------------------------------------------------------
map <C-m> :TagbarToggle<CR>
let g:tagbar_ctags_bin='/usr/local/bin/ctags'
"------------------------------------------------------------------
" Markdown preview
"------------------------------------------------------------------
"let vim_markdown_preview_github=1
if has('mac')
let vim_markdown_preview_browser='open -a firefox'
elseif has("unix")
let vim_markdown_preview_browser='firefox'
endif
"------------------------------------------------------------------
" Ale
"------------------------------------------------------------------
"------------------------------------------------------------------
" NERDTree
"------------------------------------------------------------------
map <C-n> :NERDTreeToggle<CR>
"------------------------------------------------------------------
" Completor.vim
"------------------------------------------------------------------
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
" Completion only avalaible for Python, C, Rust and Lates
let g:completor_whitelist=['python', 'c', 'cpp', 'rust']
if has('mac')
let g:completor_python_binary = '/usr/local/bin/python3'
let g:completor_racer_binary = '/path/to/racer'
let g:completor_clang_binary = '/usr/bin/clang'
elseif has("unix")
endif
"------------------------------------------------------------------
" Pencil
"------------------------------------------------------------------
augroup pencil
autocmd!
autocmd FileType markdown,mkd call pencil#init()
autocmd FileType text call pencil#init({'wrap': 'hard', 'autoformat': 0})
augroup END