-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
191 lines (185 loc) · 9.01 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
"===================================================================================
" FILE: .vimrc
" DESCRIPTION: suggestion for a personal configuration file ~/.vimrc
" AUTHOR: Dr.-Ing. Fritz Mehner
" VERSION: 1.0
" CREATED: 23.05.2008
" REVISION: $Id: customization.vimrc,v 1.8 2009/04/03 09:54:21 mehner Exp $
"===================================================================================
"
"===================================================================================
" GENERAL SETTINGS
"===================================================================================
"
"-------------------------------------------------------------------------------
" Use Vim settings, rather then Vi settings.
" This must be first, because it changes other options as a side effect.
"-------------------------------------------------------------------------------
set nocompatible
"
"-------------------------------------------------------------------------------
" Enable file type detection. Use the default filetype settings.
" Also load indent files, to automatically do language-dependent indenting.
"-------------------------------------------------------------------------------
filetype plugin on
filetype indent on
"
"-------------------------------------------------------------------------------
" Switch syntax highlighting on.
"-------------------------------------------------------------------------------
syntax on
"
"-------------------------------------------------------------------------------
" Various settings
"-------------------------------------------------------------------------------
set autoindent " copy indent from current line
set autoread " read open files again when changed outside Vim
set autowrite " write a modified buffer on each :next , ...
set backspace=indent,eol,start " backspacing over everything in insert mode
"set backup " keep a backup file
set browsedir=current " which directory to use for the file browser
set complete+=k " scan the files given with the 'dictionary' option
set history=50 " keep 50 lines of command line history
set hlsearch " highlightthe last used search pattern
set incsearch " do incremental searching
set listchars=tab:>.,eol:\$ " strings to use in 'list' mode
set nowrap " do not wrap lines
set popt=left:8pc,right:3pc " print options
set ruler " show the cursor position all the time
set shiftwidth=4 " number of spaces to use for each step of indent
set showcmd " display incomplete commands
set smartindent " smart autoindenting when starting a new line
set ts=4 sw=4 sts=4 " number of spaces that a <Tab> counts for
set visualbell " visual bell instead of beeping
" wildmenu: ignore these extensions
set wildignore=*.bak,*.o,*.e,*~,.svn,CVS,.git,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif
set wildmenu " command-line completion in an enhanced mode
set ignorecase "Usually I don't care about case when searching
set smartcase "Only ignore case when we type lower case when searching
set wrapmargin=1
set expandtab
set laststatus=2
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
set title
"set undofile "These files contain undo information so you can undo previous actions even after you close and reopen a file
"
"-------------------------------------------------------------------------------
" highlight paired brackets
"-------------------------------------------------------------------------------
highlight MatchParen ctermbg=blue guibg=lightyellow
"
"-------------------------------------------------------------------------------
" some additional hot keys
"-------------------------------------------------------------------------------
" F2 - write file without confirmation
" F3 - call file explorer Ex
" F4 - show tag under curser in the preview window (tagfile must exist!)
" F6 - list all errors
" F7 - display previous error
" F8 - display next error
" F12 - list buffers and edit n-th buffer
"-------------------------------------------------------------------------------
"noremap <silent> <F2> :write<CR>
noremap <silent> <F3> :Explore<CR>
noremap <silent> <F4> :execute ":ptag ".expand("<cword>")<CR>
noremap <silent> <F5> :copen<CR>
noremap <silent> <F6> :cclose<CR>
noremap <silent> <F7> :cprevious<CR>
noremap <silent> <F8> :cnext<CR>
noremap <F12> :ls<CR>:edit #
"
"inoremap <silent> <F2> <C-C>:write<CR>
inoremap <silent> <F3> <C-C>:Explore<CR>
inoremap <silent> <F4> <C-C>:execute ":ptag ".expand("<cword>")<CR>
inoremap <silent> <F5> <C-C>:copen<CR>
inoremap <silent> <F6> <C-C>:cclose<CR>
inoremap <silent> <F7> <C-C>:cprevious<CR>
inoremap <silent> <F8> <C-C>:cnext<CR>
inoremap <F12> <C-C>:ls<CR>:edit #
"
"-------------------------------------------------------------------------------
" comma always followed by a space
"-------------------------------------------------------------------------------
"inoremap , ,<Space>
"
"-------------------------------------------------------------------------------
" autocomplete parenthesis, (brackets) and braces
"-------------------------------------------------------------------------------
"inoremap ( ()<Left>
"inoremap [ []<Left>
"inoremap { {}<Left>
"
"vnoremap ( s()<Esc>P<Right>%
"vnoremap [ s[]<Esc>P<Right>%
"vnoremap { s{}<Esc>P<Right>%
"
" surround content with additional spaces
"
"vnoremap ) s( )<Esc><Left>P<Right><Right>%
"vnoremap ] s[ ]<Esc><Left>P<Right><Right>%
"vnoremap } s{ }<Esc><Left>P<Right><Right>%
"
"-------------------------------------------------------------------------------
" autocomplete quotes (visual and select mode)
"-------------------------------------------------------------------------------
"xnoremap ' s''<Esc>P<Right>
"xnoremap " s""<Esc>P<Right>
"xnoremap ` s``<Esc>P<Right>
"
"-------------------------------------------------------------------------------
" The current directory is the directory of the file in the current window.
"-------------------------------------------------------------------------------
if has("autocmd")
autocmd BufEnter * :lchdir %:p:h
endif
"
"-------------------------------------------------------------------------------
" Fast switching between buffers
" The current buffer will be saved before switching to the next one.
" Choose :bprevious or :bnext
"-------------------------------------------------------------------------------
noremap <silent> <s-tab> :if &modifiable && !&readonly &&
\ &modified <CR> :write<CR> :endif<CR>:bprevious<CR>
inoremap <silent> <s-tab> <C-C>:if &modifiable && !&readonly &&
\ &modified <CR> :write<CR> :endif<CR>:bprevious<CR>
"
"-------------------------------------------------------------------------------
" Leave the editor with Ctrl-q (KDE): Write all changed buffers and exit Vim
"-------------------------------------------------------------------------------
nnoremap <C-q> :wqall<CR>
"
"
"===================================================================================
" VARIOUS PLUGIN CONFIGURATIONS
"===================================================================================
"
"-------------------------------------------------------------------------------
" perl-support.vim
"-------------------------------------------------------------------------------
"
" --empty --
"
"-------------------------------------------------------------------------------
" plugin taglist.vim : toggle the taglist window
" plugin taglist.vim : define the tag file entry for Perl
"-------------------------------------------------------------------------------
"-------------------------------------------------------------------------------
noremap <silent> <F11> :TlistToggle<CR>
inoremap <silent> <F11> <C-C>:TlistToggle<CR>
"
let tlist_perl_settings = 'perl;c:constants;f:formats;l:labels;p:packages;s:subroutines;d:subroutines;o:POD'
"
"This is necessary to allow pasting from outside vim. It turns off auto stuff.
"You can tell you are in paste mode when the ruler is not visible
set pastetoggle=<F2>
let g:Perl_MapLeader = ','
" Adds / and . as used in requires. Also adds _ as used in procedure names.
setlocal iskeyword=a-z,A-Z,48-57,:,/,.,_
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview
" highlight trailing whitespace
autocmd InsertEnter * syn clear EOLWS | syn match EOLWS excludenl /\s\+\%#\@!$/
autocmd InsertLeave * syn clear EOLWS | syn match EOLWS excludenl /\s\+$/
highlight EOLWS ctermbg=red guibg=red
" Load templates is exist
autocmd BufNewFile * silent! 0r $HOME/.vim/templates/%:e.tpl