| verzia 1.27, 2002/01/04 10:37:41 |
verzia 1.28, 2002/01/15 18:34:45 |
|
|
| |
|
| " $Id$ |
" $Id$ |
| |
|
| " Settings {{{1 |
" Settings {{{ |
| " To be secure & Vi nocompatible |
" To be secure & Vi nocompatible |
| :set secure nocompatible |
set secure nocompatible |
| :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 |
| :else |
else |
| : syntax on |
syntax on |
| :endif |
endif |
| |
|
| " Settings for C language {{{2 |
" Settings for C language {{{ |
| :let c_gnu=1 |
let c_gnu=1 |
| :let c_comment_strings=1 |
let c_comment_strings=1 |
| :let c_space_errors=1 |
let c_space_errors=1 |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " History and viminfo settings {{{2 |
" History and viminfo settings {{{ |
| :set history=10000 |
set history=10000 |
| :if filewritable(expand("$HOME/.vim/viminfo")) == 1 || |
if filewritable(expand("$HOME/.vim/viminfo")) == 1 || |
| \ filewritable(expand("$HOME/.vim/")) == 2 |
\ filewritable(expand("$HOME/.vim/")) == 2 |
| : set viminfo=!,%,'5000,\"10000,:10000,/10000,n~/.vim/viminfo |
set viminfo=!,%,'5000,\"10000,:10000,/10000,n~/.vim/viminfo |
| :else |
else |
| : set viminfo= |
set viminfo= |
| :endif |
endif |
| " Don't save backups of files. |
" Don't save backups of files. |
| :set nobackup |
set nobackup |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Status line settings {{{2 |
" Status line settings {{{ |
| ":set ruler |
":set ruler |
| " Display a status-bar. |
" Display a status-bar. |
| :set laststatus=2 |
set laststatus=2 |
| :set statusline=%<%f%h\ %3*%m%1*%r%0*\ %2*%y%4*%w%0*%=[%b\ 0x%B]\ \ %8l,%10([%c%V/%{strlen(getline(line('.')))}]%)\ %P |
set statusline=%<%f%h\ %3*%m%1*%r%0*\ %2*%y%4*%w%0*%=[%b\ 0x%B]\ \ %8l,%10([%c%V/%{strlen(getline(line('.')))}]%)\ %P |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Settings for Explorer script {{{ |
" Settings for Explorer script {{{ |
| :let g:explDetailedHelp=1 |
let g:explDetailedHelp=1 |
| :let g:explDetailedList=1 |
let g:explDetailedList=1 |
| :let g:explDateFormat="%d %b %Y %H:%M" |
let g:explDateFormat="%d %b %Y %H:%M" |
| "}}} |
"}}} |
| " Settings for gcc & make {{{ |
" Settings for gcc & make {{{ |
| :let g:cflags="-Wall -pedantic" |
let g:cflags="-Wall -pedantic" |
| :let g:c_debug_flags="-ggdb -DDEBUG" |
let g:c_debug_flags="-ggdb -DDEBUG" |
| :let g:makeflags="" |
let g:makeflags="" |
| "}}} |
"}}} |
| " Settings for folding long lines {{{ |
" Settings for folding long lines {{{ |
| :let g:fold_long_lines=300 |
let g:fold_long_lines=300 |
| " }}} |
" }}} |
| " Settings for AutoLastMod {{{ |
" Settings for AutoLastMod {{{ |
| " Set this to 1 if you will automaticaly change date of modification of file. |
" Set this to 1 if you will automaticaly change date of modification of file. |
| :let g:autolastmod=1 |
let g:autolastmod=1 |
| " Modification is made on line like this variable: |
" Modification is made on line like this variable: |
| :let g:autolastmodtext="Last modified: " |
let g:autolastmodtext="Last modified: " |
| " }}} |
" }}} |
| |
|
| " Automatically setting options in various files |
" Automatically setting options in various files |
| :set modeline |
set modeline |
| |
|
| " Available TAGS files |
" Available TAGS files |
| :set tags=./TAGS,./tags,tags |
set tags=./TAGS,./tags,tags |
| |
|
| " Don't add EOF at end of file |
" Don't add EOF at end of file |
| :set noendofline |
set noendofline |
| " Do case insensitive matching |
" Do case insensitive matching |
| :set noignorecase |
set noignorecase |
| |
|
| :set showfulltag |
set showfulltag |
| |
|
| :set ch=2 bs=2 tabstop=4 |
set ch=2 bs=2 tabstop=4 |
| :set incsearch report=0 title |
set incsearch report=0 title |
| :set showcmd showmatch showmode |
set showcmd showmatch showmode |
| |
|
| " 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 |
| |
|
| " Use an indent of 4 spaces, with no tabs. This setting is recommended by PEAR |
" Use an indent of 4 spaces, with no tabs. This setting is recommended by PEAR |
| " (PHP Extension and Application Repository) Conding Standarts. If you want |
" (PHP Extension and Application Repository) Conding Standarts. If you want |
|
|
| ":set expandtab |
":set expandtab |
| |
|
| " Settings for mouse (gvim under Xwindows) |
" Settings for mouse (gvim under Xwindows) |
| :set nomousefocus mousehide |
set nomousefocus mousehide |
| |
|
| " Cursor always in the middle of the screen |
" Cursor always in the middle of the screen |
| :set scrolloff=999 |
set scrolloff=999 |
| |
|
| " Make window maximalized |
" Make window maximalized |
| :set winheight=100 |
set winheight=100 |
| |
|
| " The screen will not be redrawn while executing macros, registers |
" The screen will not be redrawn while executing macros, registers |
| " and other commands that have not been typed. To force an updates use |:redraw|. |
" and other commands that have not been typed. To force an updates use |:redraw|. |
| :set lazyredraw |
set lazyredraw |
| |
|
| " Vim beeping go to the hell... |
" Vim beeping go to the hell... |
| :set vb t_vb= |
set vb t_vb= |
| |
|
| " Set this, if you will open all windows for files specified |
" Set this, if you will open all windows for files specified |
| " on the commandline at vim startup. |
" on the commandline at vim startup. |
| :let g:open_all_win=1 |
let g:open_all_win=1 |
| |
|
| "################################################################# }}}1 |
"################################################################# }}} |
| " Keybord mappings {{{1 |
" Keybord mappings {{{ |
| " |
" |
| " start of line |
" start of line |
| ":noremap <C-A> i<Home> |
":noremap <C-A> i<Home> |
| :inoremap <C-A> <Home> |
inoremap <C-A> <Home> |
| " end of line |
" end of line |
| :noremap <C-E> i<End> |
noremap <C-E> i<End> |
| :inoremap <C-E> <End> |
inoremap <C-E> <End> |
| " back one word |
" back one word |
| :inoremap <C-B> <S-Left> |
inoremap <C-B> <S-Left> |
| " forward one word |
" forward one word |
| ":inoremap <C-F> <S-Right> |
":inoremap <C-F> <S-Right> |
| |
|
| " Switching between windows by pressing one time CTRL-X keys. |
" Switching between windows by pressing one time CTRL-X keys. |
| :noremap <C-X> <C-W><C-W> |
noremap <C-X> <C-W><C-W> |
| |
|
| :set remap |
set remap |
| :map <C-O><C-O> :split |
map <C-O><C-O> :split |
| :imap <C-O><C-O> <Esc>:split |
imap <C-O><C-O> <Esc>:split |
| |
|
| " diakritika |
" diakritika |
| ":map <C-D><C-D> :so ~/.vim/diakritika.vim |
":map <C-D><C-D> :so ~/.vim/diakritika.vim |
| ":imap <C-D><C-D> <Esc>:so ~/.vim/diakritika.vim |
":imap <C-D><C-D> <Esc>:so ~/.vim/diakritika.vim |
| |
|
| " Open new window with the file ~/.tcshrc (my shell configuration file) |
" Open new window with the file ~/.tcshrc (my shell configuration file) |
| :map <C-O><C-T> :split ~/.tcshrc<CR> |
map <C-O><C-T> :split ~/.tcshrc<CR> |
| :imap <C-O><C-T> <Esc>:split ~/.tcshrc<CR> |
imap <C-O><C-T> <Esc>:split ~/.tcshrc<CR> |
| |
|
| " Open new window with file ~/.vimrc (ViM configuration file) |
" Open new window with file ~/.vimrc (ViM configuration file) |
| :map <C-O><C-K> :split ~/.vimrc<CR> |
map <C-O><C-K> :split ~/.vimrc<CR> |
| :imap <C-O><C-K> <Esc>:split ~/.vimrc<CR> |
imap <C-O><C-K> <Esc>:split ~/.vimrc<CR> |
| |
|
| " Safe delete line (don't add line to registers) |
" Safe delete line (don't add line to registers) |
| ":imap <C-D> <Esc>"_ddi |
":imap <C-D> <Esc>"_ddi |
| :imap <C-D> <Esc>:call SafeLineDelete()<CR>i |
imap <C-D> <Esc>:call SafeLineDelete()<CR>i |
| |
|
| " Mappings for folding {{{2 |
" Mappings for folding {{{ |
| " Open one foldlevel of folds in whole file |
" Open one foldlevel of folds in whole file |
| " Note: 'Z' works like 'z' but for all lines in file |
" Note: 'Z' works like 'z' but for all lines in file |
| :noremap Zo mzggvGzo'z |
noremap Zo mzggvGzo'z |
| :noremap ZO mzggvGzO'z " same as 'zR' |
noremap ZO mzggvGzO'z " same as 'zR' |
| :noremap Zc mzggvGzc'z |
noremap Zc mzggvGzc'z |
| :noremap ZC mzggvGzC'z |
noremap ZC mzggvGzC'z |
| :noremap Zd mzggvGzd'z |
noremap Zd mzggvGzd'z |
| :noremap ZD mzggvGzD'z |
noremap ZD mzggvGzD'z |
| :noremap Za mzggvGza'z |
noremap Za mzggvGza'z |
| :noremap ZA mzggvGzA'z |
noremap ZA mzggvGzA'z |
| :noremap Zx mzggvGzx'z |
noremap Zx mzggvGzx'z |
| :noremap ZX mzggvGzX'z |
noremap ZX mzggvGzX'z |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| "################################################################# }}}1 |
"################################################################# }}} |
| " New commands {{{1 |
" New commands {{{ |
| :command! -nargs=1 Printf call libcallnr("/lib/libc.so.6", "printf", <args>) |
command! -nargs=1 Printf call libcallnr("/lib/libc.so.6", "printf", <args>) |
| :command! -nargs=0 FoldLongLines call FoldLongLines() |
command! -nargs=0 FoldLongLines call FoldLongLines() |
| :command! -nargs=0 Indent call Indent() |
command! -nargs=0 Indent call Indent() |
| :command! -nargs=0 CallProg call CallProg() |
command! -nargs=0 CallProg call CallProg() |
| :command! -nargs=0 OpenAllWin call OpenAllWin() |
command! -nargs=0 OpenAllWin call OpenAllWin() |
| :command! -nargs=0 UnquoteMailBody call UnquoteMailBody() |
command! -nargs=0 UnquoteMailBody call UnquoteMailBody() |
| :command! -nargs=* ReadFileAboveCursor call ReadFileAboveCursor(<f-args>) |
command! -nargs=* ReadFileAboveCursor call ReadFileAboveCursor(<f-args>) |
| :command! -nargs=* R call ReadFileAboveCursor(<f-args>) |
command! -nargs=* R call ReadFileAboveCursor(<f-args>) |
| "################################################################# }}}1 |
"################################################################# }}} |
| " Autocomands {{{1 |
" Autocomands {{{ |
| if has("autocmd") |
if has("autocmd") |
| " Autocomands for ~/.vimrc {{{2 |
" Autocomands for ~/.vimrc {{{ |
| :augroup VimConfig |
augroup VimConfig |
| : autocmd! |
autocmd! |
| " Update line 'Last Change:' |
" Update line 'Last Change:' |
| : autocmd BufWritePre,FileWritePre ~/.vimrc call LastMod("\" Last Change: ") |
autocmd BufWritePre,FileWritePre ~/.vimrc call LastMod("\" Last Change: ") |
| : autocmd BufWritePre,FileWritePre vimrc call LastMod("\" Last Change: ") |
autocmd BufWritePre,FileWritePre vimrc call LastMod("\" Last Change: ") |
| " Reread configuration of ViM if file ~/.vimrc is saved |
" Reread configuration of ViM if file ~/.vimrc is saved |
| : autocmd BufWritePost ~/.vimrc so ~/.vimrc |
autocmd BufWritePost ~/.vimrc so ~/.vimrc |
| : autocmd BufWritePost vimrc so ~/.vimrc |
autocmd BufWritePost vimrc so ~/.vimrc |
| :augroup END |
augroup END |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Autocommands for *.c, *.h, *.cc *.cpp {{{2 |
" 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 |
| " vytvaranie hlaviciek novych *.c, *.h suborov |
" vytvaranie hlaviciek novych *.c, *.h suborov |
| : autocmd BufNewFile *.c,*.cc,*.cpp 0r ~/.vim/skelet.c |
autocmd BufNewFile *.c,*.cc,*.cpp 0r ~/.vim/skelet.c |
| : autocmd BufNewFile *.h call MakeHeader() |
autocmd BufNewFile *.h call MakeHeader() |
| :augroup END |
augroup END |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Autocommands for *.html *.cgi {{{2 |
" Autocommands for *.html *.cgi {{{ |
| " Automatic updates date of last modification in HTML files. File must |
" Automatic updates date of last modification in HTML files. File must |
| " contain line "^Last modified: ", else will be date writtend on the current |
" contain line "^Last modified: ", else will be date writtend on the current |
| " line. |
" line. |
| :augroup HtmlCgi |
augroup HtmlCgi |
| : 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() |
| :augroup END |
augroup END |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Autocomands for *.tcl {{{2 |
" 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 |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Autocomands for Makefile {{{2 |
" 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 |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Autocomands on Win32 {{{2 |
" Autocomands on Win32 {{{ |
| if has("gui_win32") |
if has("gui_win32") |
| au GUIEnter * simalt ~x |
au GUIEnter * simalt ~x |
| endif |
endif |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| endif " if has("autocmd") |
endif " if has("autocmd") |
| "################################################################# }}}1 |
"################################################################# }}} |
| " Functions {{{1 |
" Functions {{{ |
| " Function ChangeFoldMethod() {{{2 |
" Function ChangeFoldMethod() {{{ |
| " Function for changing folding method. |
" Function for changing folding method. |
| " |
" |
| :if version >= 600 |
if version >= 600 |
| : fun! ChangeFoldMethod() |
fun! ChangeFoldMethod() |
| : let choice = confirm("Which folde method?", "&manual\n&indent\n&expr\nma&rker\n&syntax", 2) |
let choice = confirm("Which folde method?", "&manual\n&indent\n&expr\nma&rker\n&syntax", 2) |
| : if choice == 1 |
if choice == 1 |
| : set foldmethod=manual |
set foldmethod=manual |
| : elseif choice == 2 |
elseif choice == 2 |
| : set foldmethod=indent |
set foldmethod=indent |
| : elseif choice == 3 |
elseif choice == 3 |
| : set foldmethod=expr |
set foldmethod=expr |
| : elseif choice == 4 |
elseif choice == 4 |
| : set foldmethod=marker |
set foldmethod=marker |
| : elseif choice == 5 |
elseif choice == 5 |
| : set foldmethod=syntax |
set foldmethod=syntax |
| : else |
else |
| : endif |
endif |
| : endfun |
endfun |
| :endif |
endif |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function FoldLongLines() {{{2 |
" Function FoldLongLines() {{{ |
| " |
" |
| :if version >= 600 |
if version >= 600 |
| : fun! FoldLongLines() |
fun! FoldLongLines() |
| " Get screen size: |
" Get screen size: |
| : let lines = system("`which tcsh` -f -c telltc | " . |
let lines = system("`which tcsh` -f -c telltc | " . |
| \ "grep lines | awk '{print \$6-1}'") |
\ "grep lines | awk '{print \$6-1}'") |
| : let info = "<Esc>[" . lines . ";0HProcessing line " |
let info = "<Esc>[" . lines . ";0HProcessing line " |
| " Set mark for return back |
" Set mark for return back |
| : exec "normal mF" |
exec "normal mF" |
| " Delete line |
" Delete line |
| : Printf(&t_dl) |
Printf(&t_dl) |
| : exec "1go" |
exec "1go" |
| : let lnum = line(".") |
let lnum = line(".") |
| : let lend = line("$") |
let lend = line("$") |
| : while lnum <= lend |
while lnum <= lend |
| : Printf(info . lnum) |
Printf(info . lnum) |
| " Skip closed folds |
" Skip closed folds |
| : if foldclosed(lnum) != -1 |
if foldclosed(lnum) != -1 |
| : let lnum = foldclosedend(lnum) + 1 |
let lnum = foldclosedend(lnum) + 1 |
| : continue |
continue |
| : endif |
endif |
| : let dlzka = strlen(getline(".")) |
let dlzka = strlen(getline(".")) |
| : if dlzka >= g:fold_long_lines |
if dlzka >= g:fold_long_lines |
| " Create fold for one line |
" Create fold for one line |
| : exec "normal zfl" |
exec "normal zfl" |
| : endif |
endif |
| : let lnum = line(".") |
let lnum = line(".") |
| " Move one line down |
" Move one line down |
| : exec "normal OB" |
exec "normal OB" |
| : if lnum == lend |
if lnum == lend |
| : break |
break |
| : endif |
endif |
| : endwhile |
endwhile |
| : Printf(" -- OK\n") |
Printf(" -- OK\n") |
| " Skip back to the mark |
" Skip back to the mark |
| : exec "normal 'F" |
exec "normal 'F" |
| : redraw! |
redraw! |
| : endfun |
endfun |
| :endif |
endif |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function SetVimVar() {{{2 |
" Function SetVimVar() {{{ |
| " Functions set appropriate values in variables according to line in |
" Functions set appropriate values in variables according to line in |
| " 'modelines' VIM_VAR: var1=value1 var2=value2 |
" 'modelines' VIM_VAR: var1=value1 var2=value2 |
| " |
" |
| "fun! SetVimVar() |
"fun! SetVimVar() |
| ":$-5,$ call SetVimVarFromLine() |
":$-5,$ call SetVimVarFromLine() |
| "endfun |
"endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function SetVimVarFromLine() {{{2 |
" Function SetVimVarFromLine() {{{ |
| " |
" |
| "fun! SetVimVarFromLine() |
"fun! SetVimVarFromLine() |
| ":let matx = ".* VIM_VAR: " |
":let matx = ".* VIM_VAR: " |
| Riadok 313 endif " if has("autocmd") |
|
| Riadok 313 endif " if has("autocmd") |
|
| ": exec ":let " . substitute(curr_line, matx, "", "") |
": exec ":let " . substitute(curr_line, matx, "", "") |
| ":endif |
":endif |
| "endfun |
"endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function AutoLastMod() {{{2 |
" Function AutoLastMod() {{{ |
| " Provides atomatic change of date in files, if it is set via |
" Provides atomatic change of date in files, if it is set via |
| " modeline variable autolastmod to appropriate value. |
" modeline variable autolastmod to appropriate value. |
| " |
" |
| fun! AutoLastMod() |
fun! 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 |
| endfun |
endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function LastMod() {{{2 |
" Function LastMod() {{{ |
| " Automatic change date in *.html files. |
" Automatic change date in *.html files. |
| " |
" |
| fun! LastMod(text, ...) |
fun! LastMod(text, ...) |
| :mark d |
mark d |
| :let line = a:text . strftime("%Y %b %d %X") " text of changed line |
let line = a:text . strftime("%Y %b %d %X") " text of changed line |
| :let find = "g/^" . a:text " regexpr to find line |
let find = "g/^" . a:text " regexpr to find line |
| :let matx = "^" . a:text " ...if line was found |
let matx = "^" . a:text " ...if line was found |
| :exec find |
exec find |
| :let curr_line = getline(".") |
let curr_line = getline(".") |
| :if match(curr_line, matx) == 0 |
if match(curr_line, matx) == 0 |
| : call setline(line("."), line) |
call setline(line("."), line) |
| : exec "'d" |
exec "'d" |
| :endif |
endif |
| endfun |
endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function MakeHeader() {{{2 |
" Function MakeHeader() {{{ |
| " Prepare header in *.h files. |
" Prepare header in *.h files. |
| " |
" |
| fun! MakeHeader() |
fun! MakeHeader() |
| " Line look variables. |
" Line look variables. |
| :let line = "" . bufname("%") |
let line = "" . bufname("%") |
| :let line = substitute(line, "\\\.", "_\0", "") |
let line = substitute(line, "\\\.", "_\0", "") |
| :let line1 = substitute(line, ".*", "#ifndef _\\U\\0", "") |
let line1 = substitute(line, ".*", "#ifndef _\\U\\0", "") |
| :let line2 = substitute(line, ".*", "#define _\\U\\0", "") |
let line2 = substitute(line, ".*", "#define _\\U\\0", "") |
| :let line6 = "#endif /* " . line1 . " */" |
let line6 = "#endif /* " . line1 . " */" |
| " Writeout of sets variebles. |
" Writeout of sets variebles. |
| ":echo line |
":echo line |
| " ... |
" ... |
| " Setting appropriate lines according to the prepared variables. |
" Setting appropriate lines according to the prepared variables. |
| " In target file there must be sufficient number of lines, else setline() will |
" In target file there must be sufficient number of lines, else setline() will |
| " fails. Function append() appends next line into file, see :help append |
" fails. Function append() appends next line into file, see :help append |
| :call setline(1, line1) |
call setline(1, line1) |
| :call append(1, line2) |
call append(1, line2) |
| :call append(2, "") |
call append(2, "") |
| :call append(3, "") |
call append(3, "") |
| :call append(4, "") |
call append(4, "") |
| :call append(5, "") |
call append(5, "") |
| :call setline(6, line6) |
call setline(6, line6) |
| :call append(6, "") |
call append(6, "") |
| endfun |
endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function OpenAllWin() {{{2 |
" Function OpenAllWin() {{{ |
| " Opens windows for all files in the command line. |
" Opens windows for all files in the command line. |
| " Variable "opened" is used for testing, if window for file was already opened |
" Variable "opened" is used for testing, if window for file was already opened |
| " or not. This is prevention for repeat window opening after ViM config file |
" or not. This is prevention for repeat window opening after ViM config file |
| " reload. |
" reload. |
| " |
" |
| :fun! OpenAllWin() |
fun! OpenAllWin() |
| :let i = 0 |
let i = 0 |
| :if !exists("opened") |
if !exists("opened") |
| : while i < argc() - 1 |
while i < argc() - 1 |
| : split |
split |
| : n |
n |
| : let i = i + 1 |
let i = i + 1 |
| : endwhile |
endwhile |
| :endif |
endif |
| :let opened = 1 |
let opened = 1 |
| :endfun |
endfun |
| |
|
| :if exists("g:open_all_win") |
if exists("g:open_all_win") |
| : call OpenAllWin() |
call OpenAllWin() |
| :endif |
endif |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function CallProg() {{{2 |
" Function CallProg() {{{ |
| :fun! CallProg() |
fun! CallProg() |
| : 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 |
| : :call Compile(0) |
:call Compile(0) |
| : elseif choice == 5 |
elseif choice == 5 |
| : exec "! cd %:p:h; pwd; ./%:t:r" |
exec "! cd %:p:h; pwd; ./%:t:r" |
| : elseif choice == 6 |
elseif choice == 6 |
| : exec "! cd " . getcwd() . "; pwd; ./%<" |
exec "! cd " . getcwd() . "; pwd; ./%<" |
| : endif |
endif |
| :endfun |
endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function Compile() {{{2 |
" Function Compile() {{{ |
| :fun! Compile(do_chdir) |
fun! Compile(do_chdir) |
| : let cmd = "" |
let cmd = "" |
| : let filename = "" |
let filename = "" |
| : let filename_ext = "" |
let filename_ext = "" |
| : |
|
| : if a:do_chdir == 1 |
if a:do_chdir == 1 |
| : let cmd = "! cd %:p:h; pwd; " |
let cmd = "! cd %:p:h; pwd; " |
| : let filename = "%:t:r" |
let filename = "%:t:r" |
| : let filename_ext = "%:t" |
let filename_ext = "%:t" |
| : else |
else |
| : let cmd = "! cd " . getcwd() . "; pwd; " |
let cmd = "! cd " . getcwd() . "; pwd; " |
| : let filename = "%<" |
let filename = "%<" |
| : let filename_ext = "%" |
let filename_ext = "%" |
| : 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" |
| : endif |
endif |
| |
|
| : 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 |
| :endfun |
endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function Indent() {{{2 |
" Function Indent() {{{ |
| " Indents source code. |
" Indents source code. |
| fun! Indent() |
fun! Indent() |
| " If there is set equalprg to source indenting (ie. perltidy for perl sources) |
" If there is set equalprg to source indenting (ie. perltidy for perl sources) |
| " we have not to executes "'f" at the end, else we will got "Mark not set" |
" we have not to executes "'f" at the end, else we will got "Mark not set" |
| " error message. |
" error message. |
| :if &equalprg == "" |
if &equalprg == "" |
| : exec "normal mfggvG$='f" |
exec "normal mfggvG$='f" |
| :else |
else |
| : exec "normal mfggvG$=" |
exec "normal mfggvG$=" |
| :endif |
endif |
| endfun |
endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function UnquoteMailBody() {{{2 |
" Function UnquoteMailBody() {{{ |
| " |
" |
| fun! UnquoteMailBody() |
fun! 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>" |
| endfun |
endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function SafeLineDelete() {{{2 |
" Function SafeLineDelete() {{{ |
| " |
" |
| fun! SafeLineDelete() |
fun! SafeLineDelete() |
| : exec "normal \"_dd" |
exec "normal \"_dd" |
| endfun |
endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| " Function ReadFileAboveCursor() {{{2 |
" Function ReadFileAboveCursor() {{{ |
| " |
" |
| fun! ReadFileAboveCursor(file, ...) |
fun! ReadFileAboveCursor(file, ...) |
| : let str = ":" . (v:lnum - 1) . "read " . a:file |
let str = ":" . (v:lnum - 1) . "read " . a:file |
| : let idx = 1 |
let idx = 1 |
| : while idx <= a:0 |
while idx <= a:0 |
| : exec "let str = str . \" \" . a:" . idx |
exec "let str = str . \" \" . a:" . idx |
| : let idx = idx + 1 |
let idx = idx + 1 |
| : endwhile |
endwhile |
| : exec str |
exec str |
| endfun |
endfun |
| """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}}2 |
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" }}} |
| "################################################################# }}}1 |
"################################################################# }}} |
| " Gvim settings {{{1 |
" Gvim settings {{{ |
| :if &t_Co > 2 || has("gui_running") |
if &t_Co > 2 || has("gui_running") |
| : hi Normal guibg=Black guifg=White |
hi Normal guibg=Black guifg=White |
| : hi Cursor guibg=Green guifg=NONE |
hi Cursor guibg=Green guifg=NONE |
| : hi NonText guibg=Black |
hi NonText guibg=Black |
| : hi Constant gui=NONE |
hi Constant gui=NONE |
| : hi Special gui=NONE |
hi Special gui=NONE |
| :endif |
endif |
| "################################################################# }}}1 |
"################################################################# }}} |
| " Colors {{{1 |
" Colors {{{ |
| :set background=dark |
set background=dark |
| :hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red |
hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red |
| :hi User2 term=bold cterm=bold ctermfg=yellow |
hi User2 term=bold cterm=bold ctermfg=yellow |
| :hi User3 term=inverse,bold cterm=inverse,bold ctermfg=blue |
hi User3 term=inverse,bold cterm=inverse,bold ctermfg=blue |
| :hi User4 term=inverse,bold cterm=inverse,bold ctermfg=lightblue |
hi User4 term=inverse,bold cterm=inverse,bold ctermfg=lightblue |
| :hi Folded term=standout ctermbg=black ctermfg=Blue guifg=DarkBlue |
hi Folded term=standout ctermbg=black ctermfg=Blue guifg=DarkBlue |
| :hi FoldColumn term=standout ctermbg=black ctermfg=DarkBlue guibg=Grey guifg=DarkBlue |
hi FoldColumn term=standout ctermbg=black ctermfg=DarkBlue guibg=Grey guifg=DarkBlue |
| " }}}1 |
" }}} |
| " Modeline {{{1 |
" Modeline {{{ |
| " vim:set ts=4: |
" vim:set ts=4: |
| " vim600:fdm=marker fdl=0 fdc=3 vb t_vb=: |
" vim600:fdm=marker fdl=0 fdc=3 vb t_vb=: |
| "################################################################# }}}1 |
"################################################################# }}} |