-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVIMRC
More file actions
189 lines (162 loc) · 6.67 KB
/
VIMRC
File metadata and controls
189 lines (162 loc) · 6.67 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
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below. If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed. It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
" au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
"filetype plugin indent on
"endif
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
" Auto source if vimrc has been modified
au! BufWritePost .vimrc source %
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
"set incsearch " Incremental search
"set autowrite " Automatically save before commands like :next and :make
"set hidden " Hide buffers when they are abandoned
"set mouse=a " Enable mouse usage (all modes)
""""""""""""""""""""""""""""""""""""""""""""""""""
" DISPLAY OF THE EDITOR
set virtualedit=all
set number
set list
set listchars=tab:»_,eol:¶,trail:-,nbsp:%
set t_Co=256 " Set the terminal to 256 colors
"set showmatch
"set matchtime=1
set incsearch
set history=1000
set nowrap
"set whichwrap=<,>,h,l
set wildmode=list:longest "full
set wildmenu
"set foldlevelstart=99
colors my-molokai
""""""""""""""""""""""""""""""""""""""""""""""""""
" DISPLAY IF LENGTH >80
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
"match OverLength /\%81v.*/
""""""""""""""""""""""""""""""""""""""""""""""""""
" STATUSBAR
set laststatus=2
set statusline=%f%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]%=[POS=%04l,%04v][%p%%]\ [LEN=%L]
" COLORS
hi Statusline ctermfg=2* ctermbg=0
au InsertEnter * hi StatusLine ctermfg=1 ctermbg=0
au InsertLeave * hi StatusLine ctermfg=2 ctermbg=0 gui=bold,reverse
set updatetime=50
""""""""""""""""""""""""""""""""""""""""""""""""""
" Start pathogen - VIM 'package' manager
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags()
filetype plugin indent on
""""""""""""""""""""""""""""""""""""""""""""""""""
" CONFIGURATION FOR INDENTATION
set autoindent
set smartindent
set tabstop=8
set softtabstop=4
set shiftwidth=4
set expandtab
set cindent
set shiftround
autocmd BufNewFile,BufRead * call showmarks#ShowMarks('global,enable')
let g:xml_syntax_folding=1
""""""""""""""""""""""""""""""""""""""""""""""""""
" CONFIGURATION VIMORGANIZER
" let g:org_todo_setup= 'TODO STARTED | DONE'
" let g:org_tag_setup='{@home(h) @work(w) @tennisclub(t)} \n {easy(e) hard(d)} \n {computer(c) phone(p)}'
" let v:foldhighlight=hlID('Folded')
"
" au! BufRead,BufWrite,BufWritePost,BufNewFile *.org
" au BufRead,BufNewFile *.org call org#SetOrgFileType()
" au BufRead *.org :PreLoadTags
" au BufWrite *.org :PreWriteTags
" au BufWritePost *.org :PostWriteTags
""""""""""""""""""""""""""""""""""""""""""""""""""
" CUSTOM HOTKEYS
let maplocalleader = "«"
let mapleader = ";"
map <Leader>m :DoShowMarks<CR>
map ZX :NERDTree<CR>
map ZA :NERDTreeClose<CR>
map <F2> <ESC>:%!xmllint --format -<CR>
map zl z30l
map zh z30h
nmap > >>
nmap < <<
"my mapping to split two lines
nmap <C-j> i<CR><ESC>k$
"my mapping to paste(^p) lines(l) and headers(h) (type b=bash(#) h=html(<!--) c=C(/*)
map <C-p>lb o<ESC>80i#<ESC>
map <C-p>lc o<ESC>80i/<ESC>
map <C-p>lh :set paste<CR>o<!-- <ESC>72A-<ESC>A--><ESC>:set nopaste<CR>
map <C-p>hb :set paste<CR>o<ESC>80i#<ESC>A<CR># <CR><ESC>80i#<ESC>:set nopaste<CR>kA
map <C-p>hc :set paste<CR>o/<ESC>79A*<ESC>A<CR> * <CR> <ESC>78A*<ESC>A/<ESC>:set nopaste<CR>kA
"simplify usage of selection
map v <C-v>
"use ctags files for display and coloring and stuff...
nmap <F8> :TagbarToggle<CR>
map <F9> :sp tags<CR>:%s/^\([^ :]*:\)\=\([^ ]*\).*/syntax keyword Tag \2/<CR>:wq! tags.vim<CR>/^<CR><F10>
map <f10> :so tags.vim<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""
" CUSTOM CONFIGURATION FOR FILETYPE
au FileType xml,xsd setlocal foldmethod=syntax softtabstop=2 shiftwidth=2 foldclose=all foldlevel=1 foldopen=quickfix,search,tag,undo,mark,hor,block
au BufRead *.zsh-theme set filetype=sh
"au BufNewFile,BufRead * :HiMatchOff
"au BufNewFile,BufRead *.xsd,*.xml :HiMatchOn
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
let xml_jump_string="`"
" Transparent editing of gpg encrypted files.
" By Wouter Hanegraaff
augroup encrypted
au!
" First make sure nothing is written to ~/.viminfo while editing
" an encrypted file.
autocmd BufReadPre,FileReadPre *.gpg set viminfo=
" We don't want a swap file, as it writes unencrypted data to disk
autocmd BufReadPre,FileReadPre *.gpg set noswapfile
" Switch to binary mode to read the encrypted file
autocmd BufReadPre,FileReadPre *.gpg set bin
autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=2
autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg --decrypt 2> /dev/null
" Switch to normal mode for editing
autocmd BufReadPost,FileReadPost *.gpg set nobin
autocmd BufReadPost,FileReadPost *.gpg let &ch = ch_save|unlet ch_save
autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd BufReadPost " . expand("%:r")
" Convert all text to encrypted text before writing
autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg --default-recipient-self -ae 2>/dev/null
" Undo the encryption so we are back in the normal text, directly
" after the file has been written.
autocmd BufWritePost,FileWritePost *.gpg u
augroup END