-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
140 lines (115 loc) · 3.46 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
scriptencoding utf-8
set encoding=utf-8
" load plugins via pathogen
runtime bundle/pathogen/autoload/pathogen.vim
call pathogen#infect()
set nocompatible
" increase default history
set history=100
" colors
set background=dark
colorscheme ron
syntax on
" status bar
set laststatus=2
set ruler
" show line numbers
set number
" no bells please
set novisualbell
set noerrorbells
" highlight search results
set incsearch
set hlsearch
" directories for swp files
set backupdir=~/.vimbackup
set directory=~/.vimbackup
" use whitespaces not tabs
set smarttab
set expandtab
set shiftwidth=2
set tabstop=2
set list " we do what to show tabs, to ensure we get them
" out of my files
set listchars=tab:»·,trail:·,extends:>,precedes:<,nbsp:% " show tabs and trailing
" autocomplete first on longest common than interate matches
set wildmode=longest:full,list:full
set wildmenu
" remove trailing spaces on file save
function TrimWhiteSpace()
%s/\s*$//
''
:endfunction
autocmd BufWritePre *.{c,h,cpp,ino,java,php,js,html} call TrimWhiteSpace()
" ardunio files with cpp code
au BufNewFile,BufRead *.ino set filetype=cpp
" add json syntax highlighting
au BufNewFile,BufRead *.json set ft=javascript
" autocomplete on based on file type
filetype plugin on
au FileType php set omnifunc=phpcomplete#CompletePHP
au FileType javascript set omnifunc=javascriptcomplete#CompleteJS
au FileType php set makeprg=php\ -l\ %
au FileType php set errorformat=%m\ in\ %f\ on\ line\ %l,%-GErrors\ parsing\ %f,%-G
au FileType php nnoremap <buffer> <silent> <f2> :update<bar>sil! make<bar>cwindow<cr>:redraw!<cr>
" dont wrap text
set nowrap
" enable mouse control
set selectmode=mouse
set mouse=a
" mouse type
if has("mouse_sgr")
set ttymouse=sgr
else
set ttymouse=xterm2
end
" shortcuts for vim tabs
map <F5> <ESC>:tabp<RETURN>
map <F6> <ESC>:tabn<RETURN>
map <F7> <ESC>:bn<RETURN>
map <F8> <ESC>:bp<RETURN>
map <C-c> <ESC>:tabnew<RETURN>
map <C-d> <ESC>:q<RETURN>
map <C-e> <ESC>:tabedit %<RETURN>
nnoremap <C-x> <C-\><C-n>:e <C-r>=fnameescape(expand('%:p:h'))<CR>
"====[ Make the 81st column stand out ]====================
"highlight ColorColumn ctermbg=magenta
"call matchadd('ColorColumn', '\%81v', 100)
"=====[ Highlight matches when jumping to next ]=============
nnoremap <silent> n n:call HLNext(0.2)<cr>
nnoremap <silent> N N:call HLNext(0.2)<cr>
"=====[ Blink a red ring around the match ]=============
function! HLNext (blinktime)
highlight RedOnRed ctermfg=red ctermbg=red
let [bufnum, lnum, col, off] = getpos('.')
let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/))
echo matchlen
let ring_pat = (lnum > 1 ? '\%'.(lnum-1).'l\%>'
\ . max([col-4,1]) .'v\%<'.(col+matchlen+3).'v.\|' : '')
\ . '\%'.lnum.'l\%>'.max([col-4,1]) .'v\%<'.col.'v.'
\ . '\|'
\ . '\%'.lnum.'l\%>'.max([col+matchlen-1,1])
\ . 'v\%<'.(col+matchlen+3).'v.'
\ . '\|'
\ . '\%'.(lnum+1).'l\%>'.max([col-4,1])
\ . 'v\%<'.(col+matchlen+3).'v.'
let ring = matchadd('RedOnRed', ring_pat, 101)
redraw
exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm'
call matchdelete(ring)
redraw
endfunction
" Dragvisuals plugin
runtime plugin/dragvisuals.vim
vmap <expr> H DVB_Drag('left')
vmap <expr> L DVB_Drag('right')
vmap <expr> J DVB_Drag('down')
vmap <expr> K DVB_Drag('up')
vmap <expr> D DVB_Duplicate()
" Enable synatx for js libs
autocmd BufReadPre *.js let b:javascript_lib_use_jquery = 1
autocmd BufReadPre *.js let b:javascript_lib_use_angularjs = 1
runtime plugin/sort.vim
" include folder config
set exrc
set secure