shell vim开启f5快捷键

2023-03-22 09:14:28 浏览数 (1)

代码语言:javascript复制
[root@home]# cat ch.sh
#!/bin/sh
while true;do
    count=`ps -ef|grep http|grep -v grep`
    if [ "$?" != "0" ];then
echo  ">>>>no httpd,run it"
service httpd start
else
echo ">>>>httpd is runing..."
fi
sleep 5
done

代码语言:javascript复制
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
    exec "w"
    if &filetype == 'c'
        exec "!g   % -o %<"
        exec "!time ./%<"
    elseif &filetype == 'cpp'
        exec "!g   % -o %<"
        exec "!time ./%<"
    elseif &filetype == 'java'
        exec "!javac %"
        exec "!time java %<"
    elseif &filetype == 'sh'
        :!time bash %
    elseif &filetype == 'python'
        exec "!time python2.7 %"
    elseif &filetype == 'html'
        exec "!firefox % &"
    elseif &filetype == 'go'
        exec "!go build %<"
        exec "!time go run %"
    elseif &filetype == 'mkd'
        exec "!~/.vim/markdown.pl % > %.html &"
        exec "!firefox %.html &"
    endif
endfunc

0 人点赞