shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: script shell com vim


From: Ivan lopes
Subject: Re: script shell com vim
Date: Thu, 30 Aug 2007 22:06:05 -0300

" ////////////////////////////////////////////////////////////////////////////

" WideMsg() prints [long] message up to (&columns-1) length
function WideMsg(msg)
        let x=&ruler | let y=&showcmd
        set noruler noshowcmd
        redraw
        echo a:msg
        let &ruler=x | let &showcmd=y
endfunction
" call WideMsg("This should be a very loooong line of text")

" ////////////////////////////////////////////////////////////////////////////

esqueciiiii

On 8/30/07, Ivan lopes <address@hidden> wrote:
> Amigos, sou totalmente fanatico pelo VIM e shell, logo eu ficava
> de saco cheio, de ter que ir no man varias vezes para saber oque
> siguinifica  tal parametro do comando tal ... e resolvi compartilhar
> com vcs essa dica ...
>
> VAMOS AO QUE INTERESSA  ...
>
> ta editando aquele escript do coracao e vc ve a seguinte linha
>
> grep -v -colour ....
>
> ai vc aperta ?, isso, interrogacao, que vai aparecer no seu vim
> a descricao dos parametros -v e -colour
>
> " comeca aqui
> map <expr> ? WhatIsThis(getline('.'))
>
> function  WhatIsThis(line)
>
>         let line = getline('.')
>
>         let command = filter(split(line, '\s\+'), 'v:val !~ "\\A\\+"')
>
>         if len(command) > 1
>                 let command[0] = expand('<cWORD>')
>
>         endif
>
>         let option  = filter(split(line, '\s\+'), 'v:val =~ "^-\\+"')
>
>         let times = 0
>         while times < len(option)
>                 call GetInMan(command[0], option[times])
>
>                 let times += 1
>
>         endwhile
>
>         return col('.')
> endfunction
>
> function  GetInMan(command, option)
>         let cmd = a:command
>         let opt = a:option
>         call WideMsg (system('man -7 '.cmd.' 1| col -b| sed 
> "/^\s*'.opt.'\>/,/^$/!d"'))
> endfunction
>
>
>
> --
> [ ]'s
> Ivan Carlos Da Silva Lopes
>
> Engenheiro Eletronico e Computacao
> UFRJ
>


-- 
[ ]'s
Ivan Carlos Da Silva Lopes

Engenheiro Eletronico e Computacao
UFRJ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]