-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
161 lines (142 loc) · 4.94 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
set nocompatible " Use VIM settings rather than
" Vi settings; this *must* be
" first in .vimrc
syntax enable "keeps your current color settings
syntax on "highlight syntax permanently
filetype plugin indent on
set number " numbered lines (set nu)
set autoindent " auto-identacao (set ai)
set cindent " revolves around the recoil style (set ci cindent)
set shiftwidth=4 " creates 4 spaces in the tab
set tabstop=4 " changes the width of tab
set softtabstop=4 " option to cause <Tab> and <BS> to the correct number of spaces
set expandtab " creates spaces instead of tab
set showmatch " shows the beginning of a new closed block { },[ ], ( ) (set sm)
set incsearch " increases search (set is)
set hlsearch " Highlight search (set hls)
set smartcase " considers uppercase of lowercase (set smartcase scs)
set hidden " Hide buffers when they are abandoned
set nobackup " no backup
set noswapfile " no swap file
set nowritebackup " no write backup
set mouse=a " Enable mouse usage (all modes)
set showcmd " Show (partial) command in status line.
set ruler " ruler
set linebreak " does not share the word EOL
set visualbell " disable beep
set path+=** " find files with :find myfile.txt
set scrolloff=0 " Lines visible above or below the cursor
set clipboard=unnamedplus "copy to clipboard
set completeopt=longest,menuone
"set background=dark " background
"set makeprg=php\ -1\ %
"set errorformat=%m\ in\ %f\ on\ line\ %1
"set foldmethod=indent
"set foldminlines=5
"
" AUTOCOMPLETE in specific languages
" ----------------------------------------
"
autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
autocmd FileType html setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType c setlocal omnifunc=ccomplete#Complete
autocmd FileType cpp setlocal omnifunc=omni#cpp#complete#Main
autocmd FileType hpp setlocal omnifunc=omni#cpp#complete#Main
"
" AUTOCMD by file type
" ----------------------------------------
"
if has("autocmd")
autocmd BufEnter *.phtml set syn=php " Files found ZendFramework
autocmd BufEnter *.ctp set syn=php " Files found CackePHP
autocmd BufRead,BufNewFile,BufReadPost *.php set filetype=php.html
autocmd BufRead,BufNewFile,BufReadPost *.cpp set filetype=cpp.c
autocmd BufRead,BufNewFile,BufReadPost *.twig set filetype=twig.html
endif
"
" DISABLE arrow keys
" ----------------------------------------
"
"noremap <up> <nop>
"noremap <down> <nop>
"noremap <left> <nop>
"noremap <right> <nop>
"inoremap <up> <nop>
"inoremap <down> <nop>
"inoremap <left> <nop>
"inoremap <right> <nop>
"
" Automatic CLOSING
" ----------------------------------------
"
inoremap '' ''
inoremap `` ``
inoremap "" ""
inoremap () ()
inoremap [] []
inoremap {} {}
inoremap ( ()<left>
inoremap { {}<left>
inoremap [ []<left>
inoremap ' ''<left>
inoremap " ""<left>
inoremap ` ``<left>
inoremap '; '';<left><left>
inoremap `; ``;<left><left>
inoremap "; "";<left><left>
inoremap (; ();<left><left>
inoremap [; [];<left><left>
inoremap {; {};<left><left>
inoremap ', '',<left><left>
inoremap `, ``,<left><left>
inoremap ", "",<left><left>
inoremap (, (),<left><left>
inoremap [, [],<left><left>
inoremap {, {};<left><left>
inoremap (<CR> (<CR>)<ESC>O<TAB>
inoremap (;<CR> (<CR>);<ESC>O<TAB>
inoremap [<CR> [<CR>]<ESC>O<TAB>
inoremap [;<CR> [<CR>];<ESC>O<TAB>
inoremap {<CR> {<CR>}<ESC>O<TAB>
inoremap {;<CR> {<CR>};<ESC>O<TAB>
"
" SHORTCUTS
" ----------------------------------------
"
noremap <leader>w :w!<cr>
noremap <leader>W :wa!<cr>
inoremap <leader>w <c-o>:w!<cr>
inoremap <leader>W <c-o>:wa!<cr>
" HIGHLIGHT WORD under the cursor
noremap <leader>hw :let @/="<C-r><C-w>"<cr>
" CLEAR buffer search
noremap <leader>hc :let @/=''<cr>
"
" LOWERCASE
" ----------------------------------------
"
cab W w|cab Q q|cab B b
cab LS ls|cab Ls ls|cab lS ls
cab PWD pwd|cab Pwd pwd
cab Wq wq|cab wQ wq|cab WQ wq|cab Wa wa|cab WA wa|cab wA wa
cab WALL wall|cab Wall wall|cab wALL wall
cab QALL qall|cab Qall qall|cab qALL qall|cab QA qa|cab qA qa
cab WQALL wqall|cab wQALL wqall|cab Wqall wqall
cab BN bn|cab Bn bn|cab bN bn
cab BD bd|cab Bd bd|cab bD bd
" REMOVE the TAGS and keep the text
cab rm_tag %s#<[^>]\+>##g
" HIGHLIGHT cursor line
set cul
hi cursorline cterm=NONE ctermbg=black guibg=lightgrey
" LOAD VIMRC without closing the editor
map ,u :source /etc/vim/vimrc<CR>:echo ' VIMRC global loaded!'<CR>
" map ,u :source ~/.vim/vimrc<CR>:echo ' VIMRC local reloaded!'<CR>
" map ,u :source ~/vimfiles/vimrc<CR>:echo ' VIMRC vimfiles reloaded!'<CR>
"
" EOF