-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
242 lines (202 loc) · 8.5 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
242
" -----------------------------------------------------------------------------
" | VIM Settings |
" | (see gvimrc for gui vim settings) |
" | |
" | Some highlights: |
" | jj = <esc> Very useful for keeping your hands on the home row |
" | ,n = toggle NERDTree off and on |
" | |
" | ,f = fuzzy find all files |
" | ,b = fuzzy find in all buffers |
" | |
" | hh = inserts '=>' |
" | aa = inserts '@' |
" | |
" | ,h = new horizontal window |
" | ,v = new vertical window |
" | |
" | ,i = toggle invisibles |
" | |
" | enter and shift-enter = adds a new line after/before the current line |
" | |
" | :call Tabstyle_tabs = set tab to real tabs |
" | :call Tabstyle_spaces = set tab to 2 spaces |
" | |
" | Put machine/user specific settings in ~/.vimrc.local |
" -----------------------------------------------------------------------------
set nocompatible " vi--
set smarttab " tabulacion, indentacion, etc
set shiftwidth=4
set expandtab
set tabstop=4
set smartindent
set autoindent
set number
set showmatch " al insertar closing brackets mostrar el opening bracket
set ignorecase " ignorar mayusculas/minusculas en las busquedas
set foldmethod=marker " foldmethod por defecto
set pastetoggle=<F11> " para habilitar y deshabilitar rapido el modo paste
set hidden " para poder switchear buffers sin grabar
set wildmenu " mostrar menu scrollable al buscar archivos
set wildmode=list:longest,full " que al primer TAB muestre lista completa y con el segundo recorrar los files
" Colors **********************************************************************
syntax on
set t_Co=256
set background=dark " para conservar la vista hasta los 80
"highlight Normal ctermbg=darkgray ctermfg=white
" *****************************************************************************
" Searching *******************************************************************
set hlsearch " highlight search
set incsearch " incremental search, search as you type
set ignorecase " Ignore case when searching
set smartcase " Ignore case when searching lowercase
" *****************************************************************************
" Cursor highlights ***********************************************************
set cursorline
" set cursorcolumn
" *****************************************************************************
" Status Line *****************************************************************
set showcmd
set ruler " Show ruler
" set ch=2 " Make command line two lines high
" match LongLineWarning '\%120v.*' "Error format when a line is longer than 120
" *****************************************************************************
" Line Wrapping ***************************************************************
set nowrap
set linebreak " Wrap at word
" *****************************************************************************
" Mappings ********************************************************************
" Professor VIM says '87% of users prefer jj over esc', jj abrams disagrees
imap jj <Esc>
" *****************************************************************************
" Directories *****************************************************************
" Setup backup location and enable
set backupdir=~/backup/vim
set backup
" Set Swap directory
set directory=~/backup/vim/swap
" *****************************************************************************
" Mouse
" ***********************************************************************
" set mouse=a " Enable the mouse
" "behave xterm
" "set selectmode=mouse
" *****************************************************************************
" Python stuff
" ******************************************************************
" compiler python " Enable compiler support for ruby
" map <F5> :!python %<CR>
" ******************************************************************
" -----------------------------------------------------------------------------
" | Plug-ins |
" -----------------------------------------------------------------------------
" NERDTree ********************************************************************
:noremap ,n :NERDTreeToggle<CR>
" User instead of Netrw when doing an edit /foobar
let NERDTreeHijackNetrw=1
" Single click for everything
let NERDTreeMouseMode=1
" Share tree across tabs
let NERDTreeMirror=1
" ******************************************************************
" -----------------------------------------------------------------------------
" | Startup |
" -----------------------------------------------------------------------------
" Open NERDTree on start
"autocmd VimEnter * NERDTree
" autocmd VimEnter * wincmd p
" ******************************************************************
" para que use folding inteligente en archivos php
let php_folding = 1
" tab completion
function! CleverTab()
if strpart(getline("."), 0, col('.')-1) =~ '^\s*$'
return "\<TAB>"
else
return "\<C-N>"
endfunction
inoremap <TAB> <C-R>=CleverTab()<CR>
set backspace=indent,eol,start
" mostrar numero de lineas para archivos php
" autocmd filetype php set number
autocmd filetype php set keywordprg=phpman
autocmd filetype docbk set foldmethod=syntax
au Bufenter *.inc set filetype=php
au Bufenter *.class set filetype=php
au Bufenter *.proc set filetype=php
" para el slrn
au Bufenter .letter set filetype=mail
" tildes y caracteres especiales: para usar los mismos shortcuts que mac
" para compatibilidad con todas las terminales
map! <A-e> e
map! <A-n> n
map! <A-u> u
map! ea <C-k>'a
map! eA <C-k>'A
map! ee <C-k>'e
map! eE <C-k>'E
map! ei <C-k>'i
map! eI <C-k>'I
map! eo <C-k>'o
map! eO <C-k>'O
map! eu <C-k>'u
map! eU <C-k>'U
map! en <C-k>?n
map! eN <C-k>?N
map! 1 <C-k>!I
map! ? <C-k>?I
" custom key bindings
set backspace=indent,eol,start
" para hacer word wrap de parrafos al escribir mails
noremap Q gq}
map ,w :w<CR>
map ,q :wq<CR>
map ,x :q!<CR>
map ,d :bd<CR>
map ,n :bn<CR>
map ,p :bp<CR>
map ,, :noh<CR>
" correccion ortografica (spanish)
map ,s :w!<CR>:!aspell check --lang=es -e %<CR>:e! %<CR>
" correccion ortografica (english)
map ,e :w!<CR>:!aspell check --lang=en -e %<CR>:e! %<CR>
" pylinteo
map ,y :!pylint %<CR>
"if has("autocmd")
" autocmd FileType python set complete+=k/home/andres/.vim/pydiction-0.5/pydiction isk+=.,(
"endif
" diferencias del archivo actual con la version del repo
function! SvnDiff()
let ft = &ft
let fp = expand("%:p:h")
let fn = expand("%:t")
execute ":vertical belowright diffsplit ".fp."/.svn/text-base/".fn.".svn-base"
execute ":set filetype=".ft
execute ":wincmd h"
unlet fp fn ft
endfunction
nmap ,d :call SvnDiff()<CR>
" diferencias del archivo actual con la version del repo
function! SvnUnDiff()
execute ":bd"
execute ":diffoff"
endfunction
nmap ,D :call SvnUnDiff()<CR>
map <F2> :tabprevious<CR>
map <F3> :tabnext<CR>
filetype on
filetype plugin on
" comment (#)
nmap sc 0i# <ESC>
vmap <silent> sc :s/^/# /<CR>:silent noh<CR>
" uncomment (#)
nmap su :s/^# //<CR>
vmap <silent> su :s/^# //<CR>:silent noh<CR>
" Pig latin
augroup filetypedetect
au BufNewFile,BufRead *.pig set filetype=pig syntax=pig
augroup END
" mis keybindings
map <C-l> 0/^\s\+<CR>ddj<C-l>
map <space> <C-w>w
cmap bq :bufdo q<CR>