]> git.phdru.name Git - dotfiles.git/blob - .vimrc
.vim: change colors
[dotfiles.git] / .vimrc
1 " User configuration file for Vi IMproved.
2 "
3 " vim 6.0+ required, 7.0+ recommended.
4
5 " 1 important
6
7 " Remove ALL autocommands in case the file is sourced for the second time
8 autocmd!
9
10 language messages C " Print messages in English
11
12 if exists("b:wrap") " Only do this on the second and subsequent :source's
13    let fenc = &fileencoding
14    let ftype = &filetype
15    let mod = &modified
16    set all& " Reset all options, except terminal options, to their default value.
17    execute 'set fileencoding=' . fenc
18    execute 'set filetype=' . ftype
19    if mod
20       set modified
21    else
22       set nomodified
23    endif
24    unlet fenc ftype mod
25 endif
26
27 " No, it is not VI, it is VIM! It is important to set this first, because this
28 " command resets many other options.
29 set nocompatible
30
31 " Set behavior to xterm, not mswin
32 behave xterm
33
34 " 2 moving around, searching and patterns
35
36 set ignorecase    " Ignore case in search patterns
37 set smartcase     " Match 'word' case-insensitive and 'Word' case-sensitive
38
39 set nostartofline " Keep cursor's column
40 set whichwrap=b,s,h,l,<,>,[,],~ " Wrap to the previous/next line on all keys and ~ command
41
42 " 4 displaying text
43
44 set display=lastline,uhex " Show the last line instead of '@'; show non-printable chars as <hex>
45 set lazyredraw    " Do not update screen while executing macros
46 set list          " listchars only works with 'list'
47 set listchars=tab:>_,trail:_,extends:+ " Show tabs, trailing spaces, long lines
48 set wrap          " Visually wrap long lines
49
50 " With 'set wrap' wrap long lines at a character in 'breakat'
51 " Please note 'nolist' is required to use 'linebreak'
52 set linebreak showbreak=+\ " A plus and a space
53
54 set sidescroll=1  " The minimal number of columns to scroll horizontally
55
56 " 5 highlighting
57
58 set nohlsearch    " Stop the search highlighting
59
60 " 6 multiple windows
61
62 set hidden        " Don't unload a buffer when no longer shown in a window; allow to switch between buffers/windows when the buffer is modified
63 set laststatus=2  " Always show status line
64
65 set splitbelow    " A new window is put below of the current one
66 set splitright    " A new window is put right of the current one
67
68 " 8 terminal
69
70 set ttyfast       " terminal connection is fast
71
72 set title         " Set title to the value of 'titlestring' or to 'filename - VIM'
73 set titleold=     " string to restore the title to when exiting Vim
74 " String to use for the Vim window title; with statusline printf items:
75 " display filename, modification flag, full path, argument list status,
76 " the current user, host and program name (to distinguish vim/view/etc).
77 set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)\ -\ [%{$USER}@%{hostname()}]\ %{v:progname}
78
79 " 9 using the mouse
80
81 set mouse=ar      " Use mouse in all modes, plus hit-return
82
83 " 12 messages and info
84
85 set ruler         " Show cursor position below each window
86 set showcmd       " Show (partial) command keys in the status line
87
88 " Short message for [Modified];
89 " overwrite message for writing a file with subsequent message;
90 " truncate long file messages
91 set shortmess=mot
92
93 " 14 editing text
94
95 set backspace=indent,eol,start
96 set complete+=k   " Scan spell dictionaries for completion in addition to standard places
97 set infercase     " adjust case of a keyword completion match
98 set nojoinspaces  " Do not insert two spaces after a '.', '?' and '!' with a join command
99 set nrformats=hex " I seldom edit octal numbers, but very often dates like 2001-02-01
100
101 " Default value 'croql' is a compromise for both natural and programming
102 " languages, but as any compromise it works good for neither natural nor
103 " programming languages. This value is good for natural texts,
104 " let ftplugins to set values suitable for programming languages.
105 set formatoptions=2t " list of flags that tell how automatic formatting works
106
107 " 15 tabs and indenting
108
109 set expandtab     " expand <Tab> to spaces in Insert mode
110 set shiftwidth=3  " number of spaces used for each step of (auto)indent
111 set smarttab      " a <Tab> in an indent inserts 'shiftwidth' spaces
112 set softtabstop=3 " number of spaces to insert for a <Tab>
113
114 set noautoindent  " Do not automatically set the indent of a new line
115
116 " 18 mapping
117
118 set timeout timeoutlen=3000 ttimeoutlen=100 " allow timing out up to 3 seconds halfway into a mapping; 100 ms to wait for a key code or mapped key sequence to complete
119
120 " 19 reading and writing files
121 if v:version >= 703
122    set cryptmethod=blowfish " encryption method for file writing: zip or blowfish
123 endif
124
125 " 20 the swap file
126
127 " list of directories for the swap file; remove . (the current directory)
128 if has("win32")
129    set directory=$TEMP//,c:/tmp//,c:/temp//
130 else
131    set directory=~/tmp//,/var/tmp//,/tmp//
132 endif
133 " if a directory ends in two path separators "//"
134 " or "\\", the swap file name will be built from the complete path to
135 " the file with all path separators substituted to percent '%' signs.
136 " This will ensure file name uniqueness in the preserve directory.
137
138 " 21 command line editing
139
140 set history=1000  " how many command lines are remembered
141 set suffixes+=.pyc,.pyo " list of file name extensions that have a lower priority
142 set wildignore+=*.py[co] " Ignore these patterns when completing file names
143 set wildmenu      " command-line completion shows a list of matches
144 set wildmode=longest,list:longest,full " Bash-vim completion behavior
145
146 " 22 executing external commands
147
148 if has("filterpipe")
149    set noshelltemp " Use pipes on Unix
150 endif
151
152 " 25 multi-byte characters
153
154 " Automatically detected character encodings
155 set fileencodings=ucs-bom,us-ascii,utf-8,koi8-r,cp1251,cp866,latin1
156
157 " 26 various
158
159 " ! - when included, save and restore global variables that start
160 "     with an uppercase letter, and don't contain a lowercase letter;
161 " h - disable the effect of 'hlsearch';
162 " ' - number of files for which the marks are remembered;
163 " " and < - maximum number of lines saved for a register;
164 " s - maximum size of an item in Kbytes.
165 if version < 603
166    set viminfo=!,h,'50,\"1000
167 else
168    set viminfo=!,h,'50,<1000,s10
169 endif
170
171 " c - convert viminfo to the current encoding;
172 if has("iconv")
173    set viminfo^=c
174 endif
175
176 " Removable media paths
177 if has("win32")
178    set viminfo+=ra:,rb:
179 endif
180
181 " ----------
182
183 if has("gui_running")
184    set background=light
185
186    if has("win32")
187       "set guifont=Courier_New:h18:cRUSSIAN
188       set guifont=Lucida_Console:h18:cRUSSIAN
189    else
190       set guifont=Monospace\ 16
191       set toolbar=icons,text " how to show the toolbar
192    endif
193
194    set guicursor+=a:blinkon0 " Stop cursor blinking
195
196    " Make shift-insert work like in Xterm
197    " map <S-Insert> <MiddleMouse>
198    " map! <S-Insert> <MiddleMouse>
199
200    " ----------
201    " From http://slobin.pp.ru/vim/_vimrc.html
202
203    " Arrows should go into wrapped lines, but not while popup menu is visible
204    imap <expr> <Down> pumvisible() ? "<Down>" : "<C-O>gj"
205    imap <expr> <Up> pumvisible() ? "<Up>" : "<C-O>gk"
206
207    " The <CR> key should select from completion menu without adding a newline
208    imap <expr> <CR> pumvisible() ? "<C-Y>" : "<CR>"
209    " ----------
210
211 else
212    if (&term =~ "linux") || ($BACKGROUND == 'DARK') || ($BACKGROUND == 'dark')
213          \ || has("win32")
214       " Background of the terminal is black or dark grey
215       set background=dark
216    else
217       set background=light
218    endif
219
220    if (&term =~ "linux")
221       execute 'set t_kb=' . nr2char(127)
222    endif
223
224    if (&term =~ "rxvt") || (&term =~ "screen") || (&term =~ "term") || (&term =~ "vt100")
225       execute 'set t_kb=' . nr2char(127)
226
227       " 'autoselect' to always put selected text on the clipboard;
228       " 'unnamed' to use the * register like unnamed register '*'
229       " for all yank, delete and put operations;
230       " This allows to use mouse for copy/paste in local xterm,
231       " but prevents to save the unnamed register between sessions.
232       " set clipboard=autoselect,unnamed,exclude:cons\|linux
233
234       if has ("terminfo")
235          " set t_Co=256
236          set t_Co=16
237       else
238          set t_Co=8
239          set t_Sf="\e[3%dm"
240          set t_Sb="\e[4%dm"
241       endif
242    endif
243
244    if (&term =~ "screen")
245       set ttymouse=xterm2 " Enable mouse codes under screen/tmux
246       if empty(&t_ts)
247          " Enable window title under screen/tmux
248          let &t_ts = "\e]2;"
249          let &t_fs = "\007"
250       endif
251    endif
252 endif
253
254 " Multiline comments often confuse vim syntax highlighting - these maps
255 " allow to resynchronize; the first is faster, the second is more thorough
256 nmap \sc :syntax sync clear<Enter>
257 nmap \ss :syntax sync fromstart<Enter>
258
259
260 " AUTOCOMMANDS
261
262 " Enable filetype detection
263 filetype plugin indent on
264
265 runtime macros/matchit.vim
266
267 " Reread me after editing
268 autocmd BufWritePost ~/.vimrc source ~/.vimrc | syntax on
269
270 if version >= 700
271 " Save all files before running any quickfix command (grep, makeprg, etc.)
272 autocmd QuickFixCmdPre * wall
273 endif
274
275 " Syntax highlighting
276 autocmd BufReadPost * syntax on
277
278
279 " Restore last known cursor position
280 function! RestorePosition()
281    if exists('b:position_restored')
282       return
283    endif
284
285    if line("'\"") > 0
286       call cursor(line("'\""), col("'\""))
287    endif
288    let b:position_restored = 1
289 endfunction
290
291 " When editing a file, always jump to the last cursor position (if saved)
292 autocmd BufReadPost * call RestorePosition()
293
294
295 function! SetupEncoding(encoding)
296    if !has("iconv") || exists('b:encoding_set') || strlen(a:encoding) == 0
297       return
298    endif
299
300    call RestorePosition()
301    let b:encoding_set = 1
302    execute "edit ++enc=" . a:encoding
303 endfunction
304
305
306 " http://lwn.net/Articles/226514/
307
308 augroup gpg
309 " Remove ALL autocommands for the current group.
310 autocmd!
311 autocmd BufReadPre,FileReadPre *.gpg set viminfo=
312 autocmd BufReadPre,FileReadPre *.gpg setlocal noswapfile
313 autocmd BufReadPost *.gpg :%!gpg -q -d
314 autocmd BufReadPost *.gpg | redraw
315 autocmd BufWritePre *.gpg :%!gpg --default-recipient-self -q -e -a
316 autocmd BufWritePost *.gpg u
317 autocmd VimLeave *.gpg :!clear
318 " For OpenSSL:
319 " BufReadPost: use "openssl bf -d -a"
320 " BufWritePre: use "openssl bf -salt -a"
321 augroup END
322
323
324 function! SetWrap()
325    setlocal wrap
326    map <Up> gk
327    imap <Up> <C-O>gk
328    map <Down> gj
329    imap <Down> <C-O>gj
330    let b:wrap = 1
331 endfunction
332
333 function! SetNoWrap()
334    setlocal nowrap
335    map <Up> k
336    map <Down> j
337    let b:wrap = 0
338 endfunction
339
340 command! SetWrap call SetWrap()
341 command! SetNoWrap call SetNoWrap()
342
343 " b:wrap can be set by an ftplugin
344 autocmd BufReadPost * if !exists("b:wrap") | call SetWrap() | endif
345
346
347 " MAPPINGS
348
349 " Do not unindent #-comment
350 inoremap # X<C-H>#
351
352 " map <C-A> <Home>
353 " map <C-E> <End>
354 " map <C-Z> :shell<CR>
355
356
357 if version >= 700
358 " WEB BROWSERS
359
360 let s:URL_re="\\v(((https?|ftp|gopher|telnet)://|(mailto|file|news|about|ed2k|irc|sip|magnet):)[^' \t<>\"]+|(www|web|w3)[a-z0-9_-]*\\.[a-z0-9._-]+\\.[^' \t<>\"]+)[a-z0-9/]\\c"
361
362 function! ExtractURL()
363    let line = getline('.')
364    let parts = split(line, s:URL_re . '\zs')
365
366    if len(parts) == 0
367       throw 'ExtractURLCannotFindURL' " No URL found
368    endif
369
370    let length = 0
371    let column = col('.')
372
373    for p in parts
374       let save_length = length
375       let length += len(p)
376       if length >= column
377          break
378       endif
379    endfor
380
381    let pos = match(p, s:URL_re)
382    if pos == -1
383       throw 'ExtractURLCannotFindURL' " No URL found
384    endif
385
386    if save_length + pos >= column " cursor left of the URL
387       throw 'ExtractURLCannotFindURL'
388    endif
389
390    return strpart(p, pos)
391 endfunction
392
393 function! EscapeURL(url)
394    let url = substitute(a:url, ' ', '%20', 'g')
395    return escape(url, '!#$%')
396 endfunction
397
398 function! OpenURL(url, newwin)
399    execute "!webbrowser " . a:newwin . " '" . EscapeURL(a:url) . "'"
400 endfunction
401
402 function! ExtractOpenURL(newwin)
403    try
404       let url = ExtractURL()
405    catch /^ExtractURLCannotFindURL$/
406       echoerr 'No URL found under cursor'
407       return
408    endtry
409
410    call OpenURL(url, a:newwin)
411 endfunction
412
413 function! EncodeOpenURL(url, newwin)
414    execute "!webbrowser-encode-url " . a:newwin . " '" . EscapeURL(a:url) . "'"
415 endfunction
416
417
418 " Send current link to a browser
419 nmap \b :call ExtractOpenURL('')<CR>
420 nmap \w :call ExtractOpenURL('-n')<CR>
421 nmap \t :call ExtractOpenURL('-t')<CR>
422 " Send visual block to a browser
423 vmap \b ""y:call OpenURL('<C-R>"', '')<CR>
424 vmap \w ""y:call OpenURL('<C-R>"', '-n')<CR>
425 vmap \t ""y:call OpenURL('<C-R>"', '-t')<CR>
426 " Encode and send visual block to a browser
427 vmap \B ""y:call EncodeOpenURL('<C-R>"', '')<CR>
428 vmap \W ""y:call EncodeOpenURL('<C-R>"', '-n')<CR>
429 vmap \T ""y:call EncodeOpenURL('<C-R>"', '-t')<CR>
430 " Send current file's name to a browser
431 nmap \B :call EncodeOpenURL('file:' . expand("%:p"), '')<CR>
432 nmap \W :call EncodeOpenURL('file:' . expand("%:p"), '-n')<CR>
433 nmap \T :call EncodeOpenURL('file:' . expand("%:p"), '-t')<CR>
434
435 endif " version >= 700
436
437
438 " SPELLING
439
440 if has("spell") " Works in 7.0+
441    " Use builtin spellchecker
442    nmap \sv :syntax off <BAR> setlocal spell<CR>
443    " Clear
444    nmap \sn :syntax on <BAR> setlocal nospell<CR>
445 endif
446
447
448 " Russian letters mapped in normal mode
449 "if has("keymap")
450 "   set keymap=russian-jcuken
451 "endif
452
453 if has("langmap")
454    if v:version >= 702
455       " langmap in utf-8 mode requires at least Vim 7.2.109
456       scriptencoding utf-8
457       set langmap=ё`Ё~йqцwуeкrеtнyгuшiщoзpх[ъ]фaыsвdаfпgрhоjлkдlж\\;э'
458                  \яzчxсcмvиbтnьmб\\,ю.ЙQЦWУEКRЕTНYГUШIЩOЗPХ{Ъ}
459                  \ФAЫSВDАFПGРHОJЛKДLЖ:Э\\"ЯZЧXСCМVИBТNЬMБ<Ю>
460
461    elseif &encoding != 'utf-8'
462       scriptencoding koi8-r
463       set langmap=ё`Ё~йqцwуeкrеtнyгuшiщoзpх[ъ]фaыsвdаfпgрhоjлkдlж\\;э'
464                  \яzчxсcмvиbтnьmб\\,ю.ЙQЦWУEКRЕTНYГUШIЩOЗPХ{Ъ}
465                  \ФAЫSВDАFПGРHОJЛKДLЖ:Э\\"ЯZЧXСCМVИBТNЬMБ<Ю>
466    endif
467
468    scriptencoding us-ascii
469 endif
470
471
472 if version >= 700
473 function! W()
474    " let encodings=filter(split(&fileencodings, ','), 'v:val != "ucs-bom"')
475    let encodings = ['us-ascii']
476    if $LC_CTYPE =~ 'UTF-8' " UTF-8 or en_US.UTF-8 or ru_RU.UTF-8 or such
477       let encodings += ['utf-8']
478    elseif $LC_CTYPE == 'ru_RU.KOI8-R'
479       let encodings += ['koi8-r', 'utf-8']
480    elseif v:lc_time == 'Russian_Russia.1251'
481       let encodings += ['cp1251', 'utf-8']
482    endif
483
484    for e in encodings
485       try
486          execute 'set fileencoding=' . e
487          w
488          break
489       catch /E513: write error, conversion failed/
490          continue
491       endtry
492    endfor
493
494    if &modified
495       throw '"' . expand('%') . '" E513: write error, conversion failed; tried ' . join(encodings, ',')
496    elseif has("spell")
497       call SetupSpell()
498    endif
499 endfunction
500
501 command! W call W()
502 endif
503
504
505 function! SlowTerm()
506    set laststatus=1
507    set noruler
508    set shortmess=aoOtT
509    set noshowcmd
510    set scrolljump=5 " The minimal number of lines to scroll vertically when the cursor gets of the screen
511    set sidescroll=5
512    set nottyfast
513    set notitle
514    set timeoutlen=5000
515    set nowildmenu
516    set wildmode=list:longest
517    set viminfo=!,h,'10,<100,s5
518    syntax off
519    highlight NonText cterm=NONE ctermfg=NONE
520 endfunction
521
522 if exists("$SLOWTERM")
523    call SlowTerm()
524 endif
525
526
527 " ----------
528 " From http://slobin.pp.ru/vim/_vimrc.html
529
530 " These options will be kept between editing sessions
531 " let options = []
532
533 " Called automagically after .viminfo and plugins are loaded, sets
534 " miscellaneous options from persistent global variables
535 " function! VimEnter()
536   " for optname in g:options
537   "   let varname = "g:OPT_" . toupper(optname)
538   "   if exists(varname)
539   "     execute "let &" . optname . " = " . varname
540   "   endif
541   " endfor
542
543   " if has("gui_running") && exists("g:WINPOSX") && exists("g:WINPOSY")
544   "   execute "winpos" g:WINPOSX g:WINPOSY
545   " endif
546 " endfunction
547
548 " Called automagically before .viminfo is saved, saves miscellaneous
549 " options into persistent global variables
550 " function! VimLeavePre()
551   " call filter(g:, 'v:key !~# "^OPT_"')
552   " for optname in g:options
553   "   let varname = "g:OPT_" . toupper(optname)
554   "   execute "let " . varname . " = &g:" . optname
555   " endfor
556
557   " if has("gui_running")
558   "   let g:WINPOSX = getwinposx()
559   "   let g:WINPOSY = getwinposy()
560   " endif
561 " endfunction
562
563 " autocmd VimEnter * call VimEnter()
564 " autocmd VimLeavePre * call VimLeavePre()
565
566
567 " Called automagically after every buffer read, enables fileencoding
568 " setting from modeline (see Tip #911: http://vim.wikia.com/wiki/VimTip911)
569 function! AutoEncoding()
570   if &modified && &fileencoding != ""
571     call SetupEncoding(&fileencoding)
572   else
573     redraw
574   endif
575   autocmd! auto-encoding
576   augroup! auto-encoding
577 endfunction
578
579 augroup auto-encoding
580 autocmd!
581 autocmd BufWinEnter * call AutoEncoding()
582 augroup END
583
584
585 let CONVERT=1
586
587 " Value of a character under cursor; better than standard '0x%02B (%b)'
588 function! HexDec()
589   let char = matchstr(getline("."), ".", col(".") - 1)
590   if g:CONVERT
591     let char = iconv(char, &encoding, &fileencoding)
592     let format = "0x%02X <%d>"
593   else
594     let format = "0x%02X (%d)"
595   endif
596   let char = char2nr(char)
597   return printf(format, char, char)
598 endfunction
599
600
601 if has("iconv")
602    " Helper function for :DecodeQP and :DecodeURL commands
603    function! DecodeHex(arg)
604      return iconv(printf("%c", str2nr(submatch(1), 16)), a:arg, &encoding)
605    endfunction
606
607    " Custom completion for encoding names
608    function! EncList(ArgLead, CmdLine, CursorPos)
609      return filter(split(&fileencodings, ','),
610                  \ "strpart(v:val, 0, strlen(a:ArgLead)) == a:ArgLead")
611    endfunction
612
613    if version >= 700
614    " Command for decoding qp-encoded text
615    command! -bar -nargs=? -range -complete=customlist,EncList DecodeQP
616           \ <line1>,<line2>s/=\(\x\x\|\n\)/\=DecodeHex(<q-args>)/eg
617
618    " Command for decoding url-encoded text
619    command! -bar -nargs=? -range -complete=customlist,EncList DecodeURL
620           \ <line1>,<line2>s/%\(\x\x\)/\=DecodeHex(<q-args>)/eg
621    endif
622 endif
623
624
625 if has("spell")
626    function! SetupSpell()
627       if &fileencoding =~ 'ascii'
628          setlocal spelllang=en spellfile=~/.vim/spell/en.ascii.add
629       elseif &fileencoding == 'koi8-r'
630          setlocal spelllang=en,ru spellfile=~/.vim/spell/en.ascii.add,~/.vim/spell/ru.koi8-r.add
631       elseif &fileencoding == 'utf-8'
632          setlocal spelllang=en,ru spellfile=~/.vim/spell/en.ascii.add,~/.vim/spell/ru.utf-8.add
633       else
634          setlocal spelllang= spellfile=
635       endif
636    endfunction
637    autocmd BufReadPost * call SetupSpell()
638 endif
639
640
641 function! SyntaxName()
642   echomsg synIDattr(synID(line("."), col("."), 1), "name")
643 endfunction
644
645
646 if has("python")
647
648 python << END_OF_PYTHON
649
650 import sys, rlcompleter, unicodedata, vim
651 from itertools import *
652 vim_complete = rlcompleter.Completer().complete
653
654 def vim_comp_list():
655   """Implementation of CompList() function"""
656   arglead = vim.eval("a:ArgLead")
657   fence = int(vim.eval("match(a:ArgLead, '\(\w\|\.\)*$')"))
658   left, right = arglead[:fence], arglead[fence:]
659   try:
660     completions = (vim_complete(right, i) for i in count())
661     candidates = list(takewhile(bool, completions))
662   except NameError:
663     candidates = []
664   suggestions = [left + x for x in candidates]
665   vim.command("return " + repr(suggestions))
666
667 def vim_calc(command):
668   """Implementation of :Calc command"""
669   global _
670   try:
671     result = eval(command)
672   except SyntaxError:
673     exec command in globals()
674   else:
675     if result != None:
676       print result
677       _ = result
678       xx = ''.join('\\x%02x' % ord(x) for x in str(_))
679       vim.command('let @" = "%s"' % xx)
680
681 def vim_pydo(command):
682   """Implementation of :Pydo command"""
683   codeobj = compile(command, "command", "eval")
684   line1 = vim.current.range.start
685   line2 = vim.current.range.end
686   delta = 0
687   for numz in range(line1, line2+1):
688     line = vim.current.buffer[numz-delta]
689     uline = unicode(line, vim.eval('&fileencoding'))
690     num = numz + 1
691     words = line.split()
692     result = eval(codeobj, globals(), locals())
693     if result is None or result is False:
694       del vim.current.buffer[numz-delta]
695       delta += 1
696       continue
697     if isinstance(result, list) or isinstance(result, tuple):
698       result = " ".join(map(str, result))
699     else:
700       result = str(result)
701     vim.current.buffer[numz-delta] = result
702
703 def vim_unicode_name():
704   try:
705     char = vim.eval("matchstr(getline('.'), '.', col('.') - 1)")
706     print map(unicodedata.name, char.decode(vim.eval("&encoding")))
707   except (AttributeError, ValueError), target:
708     print "%s: %s" % (target.__class__.__name__, target.message)
709
710 END_OF_PYTHON
711
712 " Custom completion for python expressions
713 function! CompList(ArgLead, CmdLine, CursorPos)
714   python vim_comp_list()
715 endfunction
716
717 " Python command line calculator
718 command! -nargs=+ -range -complete=customlist,CompList Calc
719        \ <line1>,<line2> python vim_calc(<q-args>)
720
721 " Python text range filter
722 command! -nargs=+ -range -complete=customlist,CompList Pydo
723        \ <line1>,<line2> python vim_pydo(<q-args>)
724
725 " Display unicode name for the character under cursor
726 command! Uname python vim_unicode_name()
727 command! UName call Uname()
728
729 endif
730 " ----------
731
732 " This has to go to the very end of ~/.vimrc to allow reading the .vimrc
733 set secure        " safer working with script files in the current directory