version 1.48, 2002/03/21 19:18:52 |
version 1.49, 2002/04/06 15:15:44 |
|
|
" To be secure & Vi nocompatible |
" To be secure & Vi nocompatible |
:set secure nocompatible |
:set secure nocompatible |
:if version < 600 |
:if version < 600 |
: echo "Please update your vim to 6.0 version" |
: echo "Please update your vim to 6.0 version (version 6.1 already available!)" |
: finish |
: finish |
:endif |
:endif |
|
|
|
|
filetype indent on |
filetype indent on |
:endif |
:endif |
|
|
|
function! Source(File) |
|
silent! execute "source " . a:File |
|
endfunction |
|
|
|
let VIMRC_EXTRA="~/vimconfig/vimrc-local" |
|
if executable("uname") && executable("awk") |
|
let machine = system("uname -n | awk 'BEGIN {ORS=\"\"} {print; }'") |
|
else |
|
let machine = "" |
|
endif |
|
if executable("awk") |
|
let user = system("echo $USER | awk 'BEGIN {ORS=\"\"} {print; }'") |
|
else |
|
let user = $USER |
|
endif |
|
|
|
call Source(VIMRC_EXTRA.".pre") |
|
call Source(VIMRC_EXTRA."-".user.".pre") |
|
call Source(VIMRC_EXTRA."-".machine.".pre") |
|
call Source(VIMRC_EXTRA."-".machine."-".user.".pre") |
|
call Source(VIMRC_EXTRA."") |
|
call Source(VIMRC_EXTRA."-".user) |
|
call Source(VIMRC_EXTRA."-".machine) |
|
call Source(VIMRC_EXTRA."-".machine."-".user) |
|
|
" Settings for C language {{{ |
" Settings for C language {{{ |
let c_gnu=1 |
let c_gnu=1 |
Line 336 endif " if has("autocmd") |
|
Line 360 endif " if has("autocmd") |
|
" Function for changing folding method. |
" Function for changing folding method. |
" |
" |
if version >= 600 |
if version >= 600 |
fun! ChangeFoldMethod() |
function! 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 |
Line 350 if version >= 600 |
|
Line 374 if version >= 600 |
|
set foldmethod=syntax |
set foldmethod=syntax |
else |
else |
endif |
endif |
endfun |
endfunction |
endif |
endif |
" ChangeFoldMethod() }}} |
" ChangeFoldMethod() }}} |
|
|
Line 392 if version >= 600 |
|
Line 416 if version >= 600 |
|
" Skip back to the mark |
" Skip back to the mark |
exec "normal 'F" |
exec "normal 'F" |
redraw! |
redraw! |
endfun |
endfunction |
endif |
endif |
" FoldLongLines() }}} |
" FoldLongLines() }}} |
|
|
|
|
" 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() |
function! AutoLastMod() |
if exists("g:autolastmod") |
if exists("g:autolastmod") |
if g:autolastmod < 0 |
if g:autolastmod < 0 |
return 0; |
return 0; |
Line 408 if exists("g:autolastmod") |
|
Line 432 if exists("g:autolastmod") |
|
call LastMod(g:autolastmodtext) |
call LastMod(g:autolastmodtext) |
endif |
endif |
endif |
endif |
endfun |
endfunction |
" AutoLastMod() }}} |
" AutoLastMod() }}} |
|
|
" Function LastMod() {{{ |
" Function LastMod() {{{ |
" Automatic change date in *.html files. |
" Automatic change date in *.html files. |
" |
" |
fun! LastMod(text, ...) |
function! LastMod(text, ...) |
mark d |
mark d |
let line = "\\1" . strftime("%Y %b %d %X") " text of changed line |
let line = "\\1" . 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 |
Line 426 fun! LastMod(text, ...) |
|
Line 450 fun! LastMod(text, ...) |
|
call setline(line("."), substitute(getline("."), matx, line, "")) |
call setline(line("."), substitute(getline("."), matx, line, "")) |
exec "'d" |
exec "'d" |
endif |
endif |
endfun |
endfunction |
" LastMod() }}} |
" LastMod() }}} |
|
|
" Function OpenAllWin() {{{ |
" Function OpenAllWin() {{{ |
|
|
" 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() |
function! OpenAllWin() |
let i = 0 |
let i = 0 |
if !exists("opened") |
if !exists("opened") |
while i < argc() - 1 |
while i < argc() - 1 |
Line 445 fun! OpenAllWin() |
|
Line 469 fun! OpenAllWin() |
|
endwhile |
endwhile |
endif |
endif |
let opened = 1 |
let opened = 1 |
endfun |
endfunction |
|
|
if exists("g:open_all_win") |
if exists("g:open_all_win") |
if g:open_all_win == 1 |
if g:open_all_win == 1 |
|
|
" OpenAllWin() }}} |
" OpenAllWin() }}} |
|
|
" Function CallProg() {{{ |
" Function CallProg() {{{ |
fun! CallProg() |
function! 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") |
|
|
elseif choice == 6 |
elseif choice == 6 |
exec "! cd " . getcwd() . "; pwd; ./%<" |
exec "! cd " . getcwd() . "; pwd; ./%<" |
endif |
endif |
endfun |
endfunction |
" CallProg() }}} |
" CallProg() }}} |
|
|
" Function Compile() {{{ |
" Function Compile() {{{ |
fun! Compile(do_chdir) |
function! Compile(do_chdir) |
let cmd = "" |
let cmd = "" |
let filename = "" |
let filename = "" |
let filename_ext = "" |
let filename_ext = "" |
Line 518 fun! Compile(do_chdir) |
|
Line 542 fun! Compile(do_chdir) |
|
\ " -o " . filename . " " . filename_ext . |
\ " -o " . filename . " " . filename_ext . |
\ substitute(getline(2), "VIMGCC", "", "g") |
\ substitute(getline(2), "VIMGCC", "", "g") |
endif |
endif |
endfun |
endfunction |
" Compile() }}} |
" Compile() }}} |
|
|
" Function Indent() {{{ |
" Function Indent() {{{ |
" Indents source code. |
" Indents source code. |
fun! Indent() |
function! 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. |
|
|
else |
else |
exec "normal mfggvG$=" |
exec "normal mfggvG$=" |
endif |
endif |
endfun |
endfunction |
" Indent() }}} |
" Indent() }}} |
|
|
" Function UnquoteMailBody() {{{ |
" Function UnquoteMailBody() {{{ |
" |
" |
fun! 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>" |
endfun |
endfunction |
" UnquoteMailBody() }}} |
" UnquoteMailBody() }}} |
|
|
" Function SafeLineDelete() {{{ |
" Function SafeLineDelete() {{{ |
" |
" |
fun! SafeLineDelete() |
function! SafeLineDelete() |
exec "normal \"_dd" |
exec "normal \"_dd" |
endfun |
endfunction |
" SafeLineDelete() }}} |
" SafeLineDelete() }}} |
|
|
" Function GetID() {{{ |
" Function GetID() {{{ |
|
|
" 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="" |
let g:get_id="" |
if executable("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 '' |
if g:get_id == "root" |
if g:get_id == "root" |
let g:get_id = "# " |
let g:get_id = "# " |
else |
else |
let g:get_id = "" |
let g:get_id = "" |
|
endif |
|
endif |
endif |
fun! GetID() |
function! GetID() |
return g:get_id |
return g:get_id |
endfun |
endfunction |
" GetID() }}} |
" GetID() }}} |
|
|
" Function ReadFileAboveCursor() {{{ |
" Function ReadFileAboveCursor() {{{ |
" |
" |
fun! ReadFileAboveCursor(file, ...) |
function! 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 |
Line 581 fun! ReadFileAboveCursor(file, ...) |
|
Line 603 fun! ReadFileAboveCursor(file, ...) |
|
let idx = idx + 1 |
let idx = idx + 1 |
endwhile |
endwhile |
exec str |
exec str |
endfun |
endfunction |
" ReadFileAboveCursor() }}} |
" ReadFileAboveCursor() }}} |
" }}} |
" }}} |
|
|
Line 618 hi FoldColumn guibg=Black guifg |
|
Line 640 hi FoldColumn guibg=Black guifg |
|
|
|
" }}} |
" }}} |
|
|
|
call Source(VIMRC_EXTRA.".post") |
|
call Source(VIMRC_EXTRA."-".user.".post") |
|
call Source(VIMRC_EXTRA."-".machine.".post") |
|
call Source(VIMRC_EXTRA."-".machine."-".user.".post") |
|
|
" Modeline {{{ |
" 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=: |