| verzia 1.69, 2002/08/12 00:44:06 |
verzia 1.70, 2002/08/12 01:43:15 |
| Riadok 321 noremap ZX mzggvGzX'z |
|
| Riadok 321 noremap ZX mzggvGzX'z |
|
| " }}} |
" }}} |
| |
|
| " New commands {{{ |
" New commands {{{ |
| command! -nargs=0 FoldLongLines call FoldLongLines() |
command! -nargs=0 -range Indent <line1>,<line2>call Indent() |
| command! -nargs=0 Indent call Indent() |
command! -nargs=0 -range FoldLongLines <line1>,<line2>call FoldLongLines() |
| |
command! -nargs=0 -range UnquoteMailBody <line1>,<line2>call UnquoteMailBody() |
| 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=* 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>) |
| command! -nargs=* Help call Help(<f-args>) |
|
| " }}} |
" }}} |
| |
|
| " Autocomands {{{ |
" Autocomands {{{ |
| Riadok 421 endif " if has("autocmd") |
|
| Riadok 420 endif " if has("autocmd") |
|
| " Function for changing folding method. |
" Function for changing folding method. |
| " |
" |
| if version >= 600 |
if version >= 600 |
| function! ChangeFoldMethod() |
function! ChangeFoldMethod() abort |
| 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 |
| Riadok 439 if version >= 600 |
|
| Riadok 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 |
| fun! FoldLongLines() |
function! FoldLongLines() range abort |
| " Set mark for return back |
let savelnum = line(".") |
| exec "normal mF" |
let lnum = a:firstline |
| " Go to the first line |
let lend = a:lastline |
| exec "1go" |
if lnum == lend |
| let lnum = line(".") |
" No visual area choosen --> whole file |
| let lend = line("$") |
let lnum = line(".") |
| |
let lend = line("$") |
| |
" Go to the begin of the file |
| |
exec "1go" |
| |
endif |
| while lnum <= lend |
while lnum <= lend |
| " 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 j" |
exec "normal j" |
| if lnum == lend |
if lnum == lend |
| break |
break |
| endif |
endif |
| endwhile |
endwhile |
| " Skip back to the mark |
" ...and go back |
| exec "normal 'F" |
exec "normal " . savelnum . "G" |
| redraw! |
redraw! |
| endfunction |
endfunction |
| endif |
endif |
|
|
| " OpenAllWin() }}} |
" OpenAllWin() }}} |
| |
|
| " Function CallProg() {{{ |
" Function CallProg() {{{ |
| function! CallProg() |
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") |
|
|
| " CallProg() }}} |
" CallProg() }}} |
| |
|
| " Function Compile() {{{ |
" Function Compile() {{{ |
| function! Compile(do_chdir) |
function! Compile(do_chdir) abort |
| let cmd = "" |
let cmd = "" |
| let filename = "" |
let filename = "" |
| let filename_ext = "" |
let filename_ext = "" |
|
|
| " If you are root, function return "# " string --> it is showed at begin of |
" If you are root, function return "# " string --> it is showed at begin of |
| " statusline |
" statusline |
| " If you aren't root, function return empty string --> nothing is visible |
" If you aren't root, function return empty string --> nothing is visible |
| let g:get_id="" |
|
| " Check for your name ID |
" Check for your name ID |
| let g:get_id = $USER |
let g:get_id = $USER |
| " If you are root, set to '#', else set to '' |
" If you are root, set to '#', else set to '' |