| version 1.70, 2002/08/12 01:43:15 |
version 1.71, 2002/08/12 02:17:52 |
|
|
| :endif |
:endif |
| |
|
| :if version >= 600 |
:if version >= 600 |
| syntax enable |
syntax enable |
| filetype on |
filetype on |
| filetype plugin on |
filetype plugin on |
| filetype indent on |
filetype indent on |
| :endif |
:endif |
| |
|
| function! Source(File) |
function! Source(File) |
| Line 160 set showcmd showmatch showmode |
|
| Line 160 set showcmd showmatch showmode |
|
| set titleold= |
set titleold= |
| set titlestring=ViMconfig\ (c)\ 2000-2002\ Platon\ SDG |
set titlestring=ViMconfig\ (c)\ 2000-2002\ Platon\ SDG |
| set title |
set title |
| |
|
| " Indent of 1 tab with size of 4 spaces |
" Indent of 1 tab with size of 4 spaces |
| set tabstop=4 |
set tabstop=4 |
| set shiftwidth=4 |
set shiftwidth=4 |
| Line 335 if has("autocmd") |
|
| Line 335 if has("autocmd") |
|
| |
|
| " Autocomands for PlatonCopyright {{{ |
" Autocomands for PlatonCopyright {{{ |
| augroup PlatonCopyright |
augroup PlatonCopyright |
| autocmd! |
autocmd! |
| autocmd BufLeave * set titlestring= |
autocmd BufLeave * set titlestring= |
| autocmd BufLeave * silent! call RemoveAutogroup("PlatonCopyright") |
autocmd BufLeave * silent! call RemoveAutogroup("PlatonCopyright") |
| autocmd WinEnter * set titlestring= |
autocmd WinEnter * set titlestring= |
| autocmd WinEnter * silent! call RemoveAutogroup("PlatonCopyright") |
autocmd WinEnter * silent! call RemoveAutogroup("PlatonCopyright") |
| autocmd BufWrite * set titlestring= |
autocmd BufWrite * set titlestring= |
| autocmd BufWrite * silent! call RemoveAutogroup("PlatonCopyright") |
autocmd BufWrite * silent! call RemoveAutogroup("PlatonCopyright") |
| autocmd CmdwinEnter * set titlestring= |
autocmd CmdwinEnter * set titlestring= |
| autocmd CmdwinEnter * silent! call RemoveAutogroup("PlatonCopyright") |
autocmd CmdwinEnter * silent! call RemoveAutogroup("PlatonCopyright") |
| augroup END |
augroup END |
| " }}} |
" }}} |
| |
|
| " Autocomands for GUIEnter {{{ |
" Autocomands for GUIEnter {{{ |
| augroup GUIEnter |
augroup GUIEnter |
| autocmd! |
autocmd! |
| if has("gui_win32") |
if has("gui_win32") |
| autocmd GUIEnter * simalt ~x |
autocmd GUIEnter * simalt ~x |
| endif |
endif |
| augroup END |
augroup END |
| " }}} |
" }}} |
| |
|
| " Autocomands for ~/.vimrc {{{ |
" Autocomands for ~/.vimrc {{{ |
| augroup VimConfig |
augroup VimConfig |
| autocmd! |
autocmd! |
| " Reread configuration of ViM if file ~/.vimrc is saved |
" Reread configuration of ViM if file ~/.vimrc is saved |
| autocmd BufWritePost ~/.vimrc so ~/.vimrc | exec "normal zv" |
autocmd BufWritePost ~/.vimrc so ~/.vimrc | exec "normal zv" |
| autocmd BufWritePost vimrc so ~/.vimrc | exec "normal zv" |
autocmd BufWritePost vimrc so ~/.vimrc | exec "normal zv" |
| augroup END |
augroup END |
| " }}} |
" }}} |
| |
|
| " Autocommands for *.c, *.h, *.cc *.cpp {{{ |
" Autocommands for *.c, *.h, *.cc *.cpp {{{ |
| augroup C |
augroup C |
| autocmd! |
autocmd! |
| "formatovanie C-zdrojakov |
"formatovanie C-zdrojakov |
| autocmd BufEnter *.c,*.h,*.cc,*.cpp map <buffer> <C-F> mfggvG$='f |
autocmd BufEnter *.c,*.h,*.cc,*.cpp map <buffer> <C-F> mfggvG$='f |
| autocmd BufEnter *.c,*.h,*.cc,*.cpp imap <buffer> <C-F> <Esc>mfggvG$='fi |
autocmd BufEnter *.c,*.h,*.cc,*.cpp imap <buffer> <C-F> <Esc>mfggvG$='fi |
| autocmd BufEnter *.c,*.h,*.cc,*.cpp map <buffer> yii yyp3wdwi |
autocmd BufEnter *.c,*.h,*.cc,*.cpp map <buffer> yii yyp3wdwi |
| autocmd BufEnter *.c,*.h,*.cc,*.cpp map <buffer> <C-K> :call CallProg()<CR> |
autocmd BufEnter *.c,*.h,*.cc,*.cpp map <buffer> <C-K> :call CallProg()<CR> |
| autocmd BufRead,BufNewFile *.c,*.h,*.cc,*.cpp setlocal cindent |
autocmd BufRead,BufNewFile *.c,*.h,*.cc,*.cpp setlocal cindent |
| autocmd BufRead,BufNewFile *.c,*.h,*.cc,*.cpp setlocal cinoptions=>4,e0,n0,f0,{0,}0,^0,:4,=4,p4,t4,c3,+4,(2s,u1s,)20,*30,g4,h4 |
autocmd BufRead,BufNewFile *.c,*.h,*.cc,*.cpp setlocal cinoptions=>4,e0,n0,f0,{0,}0,^0,:4,=4,p4,t4,c3,+4,(2s,u1s,)20,*30,g4,h4 |
| autocmd BufRead,BufNewFile *.c,*.h,*.cc,*.cpp setlocal cinkeys=0{,0},:,0#,!<C-F>,o,O,e |
autocmd BufRead,BufNewFile *.c,*.h,*.cc,*.cpp setlocal cinkeys=0{,0},:,0#,!<C-F>,o,O,e |
| augroup END |
augroup END |
| " }}} |
" }}} |
| |
|
| Line 384 if has("autocmd") |
|
| Line 384 if has("autocmd") |
|
| " contain line "^\([<space><Tab>]*\)Last modified: ", |
" contain line "^\([<space><Tab>]*\)Last modified: ", |
| " else will be date writtend on the current " line. |
" else will be date writtend on the current " line. |
| augroup HtmlCgiPHP |
augroup HtmlCgiPHP |
| autocmd! |
autocmd! |
| " Appending right part of tag in HTML files. |
" Appending right part of tag in HTML files. |
| autocmd BufEnter *.html imap <buffer> QQ </><Esc>2F<lywf>f/pF<i |
autocmd BufEnter *.html imap <buffer> QQ </><Esc>2F<lywf>f/pF<i |
| autocmd BufWritePre,FileWritePre *.html call AutoLastMod() |
autocmd BufWritePre,FileWritePre *.html call AutoLastMod() |
| autocmd BufEnter *.cgi imap <buffer> QQ </><Esc>2F<lywf>f/pF<i |
autocmd BufEnter *.cgi imap <buffer> QQ </><Esc>2F<lywf>f/pF<i |
| autocmd BufWritePre,FileWritePre *.cgi call AutoLastMod() |
autocmd BufWritePre,FileWritePre *.cgi call AutoLastMod() |
| autocmd BufEnter *.php imap <buffer> QQ </><Esc>2F<lywf>f/pF<i |
autocmd BufEnter *.php imap <buffer> QQ </><Esc>2F<lywf>f/pF<i |
| autocmd BufWritePre,FileWritePre *.php call AutoLastMod() |
autocmd BufWritePre,FileWritePre *.php call AutoLastMod() |
| autocmd BufEnter *.php3 imap <buffer> QQ </><Esc>2F<lywf>f/pF<i |
autocmd BufEnter *.php3 imap <buffer> QQ </><Esc>2F<lywf>f/pF<i |
| autocmd BufWritePre,FileWritePre *.php3 call AutoLastMod() |
autocmd BufWritePre,FileWritePre *.php3 call AutoLastMod() |
| augroup END |
augroup END |
| " }}} |
" }}} |
| |
|
| " Autocomands for *.tcl {{{ |
" Autocomands for *.tcl {{{ |
| augroup Tcl |
augroup Tcl |
| autocmd! |
autocmd! |
| autocmd WinEnter *.tcl map <buffer> <C-K> :call CallProg()<CR> |
autocmd WinEnter *.tcl map <buffer> <C-K> :call CallProg()<CR> |
| autocmd BufRead,BufNewFile *.tcl setlocal autoindent |
autocmd BufRead,BufNewFile *.tcl setlocal autoindent |
| augroup END |
augroup END |
| " }}} |
" }}} |
| |
|
| " Autocomands for Makefile {{{ |
" Autocomands for Makefile {{{ |
| augroup Makefile |
augroup Makefile |
| autocmd! |
autocmd! |
| autocmd BufEnter [Mm]akefile* map <buffer> <C-K> :call CallProg()<CR> |
autocmd BufEnter [Mm]akefile* map <buffer> <C-K> :call CallProg()<CR> |
| augroup END |
augroup END |
| " }}} |
" }}} |
| |
|
| Line 438 if version >= 600 |
|
| Line 438 if version >= 600 |
|
| endif |
endif |
| " ChangeFoldMethod() }}} |
" ChangeFoldMethod() }}} |
| |
|
| function! Test() abort range |
|
| echo "First line = " . a:firstline |
|
| echo "Last line = " . a:lastline |
|
| echo "Current line =" . line(".") |
|
| endfunction |
|
| |
|
| " Function FoldLongLines() {{{ |
" Function FoldLongLines() {{{ |
| " |
" |
| if version >= 600 |
if version >= 600 |
|
|
| " modeline variable autolastmod to appropriate value. |
" modeline variable autolastmod to appropriate value. |
| " |
" |
| function! AutoLastMod() |
function! AutoLastMod() |
| if exists("g:autolastmod") |
if exists("g:autolastmod") |
| if g:autolastmod < 0 |
if g:autolastmod < 0 |
| return 0; |
return 0; |
| elseif g:autolastmod == 1 |
elseif g:autolastmod == 1 |
| call LastMod(g:autolastmodtext) |
call LastMod(g:autolastmodtext) |
| |
endif |
| endif |
endif |
| endif |
|
| endfunction |
endfunction |
| " AutoLastMod() }}} |
" AutoLastMod() }}} |
| |
|
|
|
| " Function CallProg() {{{ |
" Function CallProg() {{{ |
| function! CallProg() abort |
function! CallProg() abort |
| let choice = confirm("Call:", "&make\nm&ake in cwd\n" . |
let choice = confirm("Call:", "&make\nm&ake in cwd\n" . |
| \ "&compile\nc&ompile in cwd\n" . |
\ "&compile\nc&ompile in cwd\n" . |
| \ "&run\nr&un in cwd") |
\ "&run\nr&un in cwd") |
| if choice == 1 |
if choice == 1 |
| exec ":wall" |
exec ":wall" |
| exec "! cd %:p:h; pwd; make " . g:makeflags |
exec "! cd %:p:h; pwd; make " . g:makeflags |
| elseif choice == 2 |
elseif choice == 2 |
| exec ":wall" |
exec ":wall" |
| exec "! cd " . |
exec "! cd " . |
| \ getcwd() . "; pwd; make " . g:makeflags |
\ getcwd() . "; pwd; make " . g:makeflags |
| elseif choice == 3 |
elseif choice == 3 |
| :call Compile(1) |
:call Compile(1) |
| elseif choice == 4 |
elseif choice == 4 |
| Line 599 function! Compile(do_chdir) abort |
|
| Line 593 function! Compile(do_chdir) abort |
|
| endif |
endif |
| |
|
| let choice = confirm("Call:", |
let choice = confirm("Call:", |
| \ "&compile\n" . |
\ "&compile\n" . |
| \ "compile and &debug\n" . |
\ "compile and &debug\n" . |
| \ "compile and &run\n" . |
\ "compile and &run\n" . |
| \ "compile using first &line") |
\ "compile using first &line") |
| |
|
| if choice != 0 |
if choice != 0 |
| exec ":wall" |
exec ":wall" |
| Line 610 function! Compile(do_chdir) abort |
|
| Line 604 function! Compile(do_chdir) abort |
|
| |
|
| if choice == 1 |
if choice == 1 |
| exec cmd . "gcc " . g:cflags . |
exec cmd . "gcc " . g:cflags . |
| \ " -o " . filename . " " . filename_ext |
\ " -o " . filename . " " . filename_ext |
| elseif choice == 2 |
elseif choice == 2 |
| exec cmd . "gcc " . g:cflags . " " . g:c_debug_flags . |
exec cmd . "gcc " . g:cflags . " " . g:c_debug_flags . |
| \ " -o " . filename . " " . filename_ext " && gdb " . filename |
\ " -o " . filename . " " . filename_ext " && gdb " . filename |
| elseif choice == 3 |
elseif choice == 3 |
| exec cmd . "gcc " . g:cflags . |
exec cmd . "gcc " . g:cflags . |
| \ " -o " . filename . " " . filename_ext " && ./" . filename |
\ " -o " . filename . " " . filename_ext " && ./" . filename |
| elseif choice == 4 |
elseif choice == 4 |
| exec cmd . "gcc " . g:cflags . |
exec cmd . "gcc " . g:cflags . |
| \ " -o " . filename . " " . filename_ext . |
\ " -o " . filename . " " . filename_ext . |
| \ substitute(getline(2), "VIMGCC", "", "g") |
\ substitute(getline(2), "VIMGCC", "", "g") |
| endif |
endif |
| endfunction |
endfunction |
| " Compile() }}} |
" Compile() }}} |
| |
|
| " Function Indent() {{{ |
" Function Indent() {{{ |
| " Indents source code. |
" Indents source code. |
| function! Indent() |
function! Indent() range abort |
| " If there is set equalprg to source indenting (ie. perltidy for perl sources) |
let savelnum = line(".") |
| " we have not to executes "'f" at the end, else we will got "Mark not set" |
let lnum = a:firstline |
| " error message. |
let lend = a:lastline |
| if &equalprg == "" |
if lnum == lend |
| exec "normal mfggvG$='f" |
" No visual area choosen --> whole file |
| else |
let lnum = line(".") |
| exec "normal mfggvG$=" |
let lend = line("$") |
| |
" Go to the begin of the file |
| |
exec "1go" |
| endif |
endif |
| |
exec "normal " . lnum . "Gv" . lend . "G=" |
| |
exec "normal " . savelnum . "G" |
| endfunction |
endfunction |
| " Indent() }}} |
" Indent() }}} |
| |
|
| " Function UnquoteMailBody() {{{ |
" Function UnquoteMailBody() {{{ |
| " |
" |
| function! UnquoteMailBody() |
function! UnquoteMailBody() |
| " Every backslash character must be escaped in function -- Nepto |
" Every backslash character must be escaped in function -- Nepto |
| exec "normal :%s/^\\([ ]*>[ ]*\\)*\\(\\|[^>].*\\)$/\\2/g<CR>" |
exec "normal :%s/^\\([ ]*>[ ]*\\)*\\(\\|[^>].*\\)$/\\2/g<CR>" |
| endfunction |
endfunction |
| " UnquoteMailBody() }}} |
" UnquoteMailBody() }}} |
|
|
| " Function RemoveAutogroup() {{{ |
" Function RemoveAutogroup() {{{ |
| " |
" |
| silent! function! RemoveAutogroup(group) |
silent! function! RemoveAutogroup(group) |
| silent exec "augroup! ". a:group |
silent exec "augroup! ". a:group |
| endfunction |
endfunction |
| " RemoveAutogroup() }}} |
" RemoveAutogroup() }}} |
| " }}} |
" }}} |