Quantcast

cal in a doc

classic Classic list List threaded Threaded
9 messages Options
Bee
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

cal in a doc

Bee
cal in a doc
From within terminal vim I can issue the command:
!cal
and it will display the current month.
How can I get it placed in the current document?
Bill

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: cal in a doc

Tim Chase
On 09/09/12 20:43, Bee wrote:
> cal in a doc
> From within terminal vim I can issue the command:
> !cal
> and it will display the current month.
> How can I get it placed in the current document?


  :r! cal

which you can read about at

  :help :r!

-tim



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: cal in a doc

Ben Schmidt
On 10/09/12 11:46 AM, Tim Chase wrote:

> On 09/09/12 20:43, Bee wrote:
>> cal in a doc
>>  From within terminal vim I can issue the command:
>> !cal
>> and it will display the current month.
>> How can I get it placed in the current document?
>
>    :r! cal
>
> which you can read about at
>
>    :help :r!

I suggest, though, that it is more helpful to view it as

     :r !cal

The '!' belongs more to the argument than the :read command itself. A
'!' appended to a command usually means "really do it, even if it's
dangerous". A '!' before a filename usually means "run it, don't just
look in it".

Cheers,

Ben.



--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: cal in a doc

William Robertson
In reply to this post by Tim Chase
On Monday, September 10, 2012 2:45:48 AM UTC+1, Tim Chase wrote:

> On 09/09/12 20:43, Bee wrote:
>
> > cal in a doc
>
> > From within terminal vim I can issue the command:
>
> > !cal
>
> > and it will display the current month.
>
> > How can I get it placed in the current document?
>
>
>
>
>
>   :r! cal
>
>
>
> which you can read about at
>
>
>
>   :help :r!
>
>
>
> -tim

Interesting - I've always used "!!" (possibly that's from classic vi), as in

!!cal

which I see Vim translates into

:.!cal

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: cal in a doc

Tim Chase
On 09/10/12 02:31, William Robertson wrote:

> On Monday, September 10, 2012 2:45:48 AM UTC+1, Tim Chase wrote:
>>> !cal
>>> How can I get it placed in the current document?
>>
>>   :r! cal
>
> Interesting - I've always used "!!" (possibly that's from classic vi), as in
>
> !!cal
>
> which I see Vim translates into
>
> :.!cal

The main problem with that is it replaces the current line's
contents with the output of cal.

  bash$ seq 20 | vi -
  5G           " go to line 5
  !!cal        " read in the calendar

Notice that the line containing "5" is now missing from your document.

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: cal in a doc

scott-268
On Mon, Sep 10, 2012 at 05:56:52AM -0500, Tim Chase wrote:

> On 09/10/12 02:31, William Robertson wrote:
> > On Monday, September 10, 2012 2:45:48 AM UTC+1, Tim Chase wrote:
> >>> !cal
> >>> How can I get it placed in the current document?
> >>
> >>   :r! cal
> >
> > Interesting - I've always used "!!" (possibly that's from classic vi), as in
> >
> > !!cal
> >
> > which I see Vim translates into
> >
> > :.!cal

> The main problem with that is it replaces the current line's
> contents with the output of cal.

>  bash$ seq 20 | vi -
>  5G           " go to line 5
>  !!cal        " read in the calendar

> Notice that the line containing "5" is now missing from your document.

in the Who Cares!?! department we have this:  Bee might conceivably be
interested in a slightly fancier calendar, one with today's date
"circled", with the time of day under it, thrown into insertmode, all
by just pressing shift-F7

of course it uses python -- not a python enabled vim, but python needs
to be available

put the following in your vimrc:

    nnoremap <silent> <S-F7> :call Acdmo()<CR>
    inoremap <silent> <S-F7> <ESC>:call Acdmo()<CR>

    function! Acdmo()
        read! ~/py/currmo 38
        let im = strftime("%H:%M")
        call append(line("."), "")
        call append(line("."), im)
        call append(line("."), "")
        normal 3j
        startinsert
    endfunction

and put

    https://github.com/toothpik/toothpik-s-.vimrc/blob/master/py/currmo

in your ~/py path

it makes a nice blog header IMHO

sc

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: cal in a doc

Reid Thompson
On Mon, 2012-09-10 at 06:35 -0500, sc wrote:

>
> in the Who Cares!?! department we have this:  Bee might conceivably be
> interested in a slightly fancier calendar, one with today's date
> "circled", with the time of day under it, thrown into insertmode, all
> by just pressing shift-F7
>
> of course it uses python -- not a python enabled vim, but python needs
> to be available
>
> put the following in your vimrc:
>
>     nnoremap <silent> <S-F7> :call Acdmo()<CR>
>     inoremap <silent> <S-F7> <ESC>:call Acdmo()<CR>
>
>     function! Acdmo()
>         read! ~/py/currmo 38
>         let im = strftime("%H:%M")
>         call append(line("."), "")
>         call append(line("."), im)
>         call append(line("."), "")
>         normal 3j
>         startinsert
>     endfunction
>
> and put
>
      https://github.com/toothpik/toothpik-s-.vimrc/blob/master/py/currmo
>
> in your ~/py path
>
> it makes a nice blog header IMHO
>
> sc
>

:r !gcal
gives

    September 2012
 Su Mo Tu We Th Fr Sa
                    1
  2  3  4  5  6  7  8
  9<10>11 12 13 14 15
 16 17 18 19 20 21 22
 23 24 25 26 27 28 29
 30


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: cal in a doc

scott-268
On Mon, Sep 10, 2012 at 01:23:24PM +0000, Reid Thompson wrote:

> On Mon, 2012-09-10 at 06:35 -0500, sc wrote:
> >
> > in the Who Cares!?! department we have this:  Bee might conceivably be
> > interested in a slightly fancier calendar, one with today's date
> > "circled", with the time of day under it, thrown into insertmode, all
> > by just pressing shift-F7
> >
> > of course it uses python -- not a python enabled vim, but python needs
> > to be available
> >
> > put the following in your vimrc:
> >
> >     nnoremap <silent> <S-F7> :call Acdmo()<CR>
> >     inoremap <silent> <S-F7> <ESC>:call Acdmo()<CR>
> >
> >     function! Acdmo()
> >         read! ~/py/currmo 38
> >         let im = strftime("%H:%M")
> >         call append(line("."), "")
> >         call append(line("."), im)
> >         call append(line("."), "")
> >         normal 3j
> >         startinsert
> >     endfunction
> >
> > and put
> >
>     https://github.com/toothpik/toothpik-s-.vimrc/blob/master/py/currmo
> >
> > in your ~/py path
> >
> > it makes a nice blog header IMHO
> >
> > sc
> >

> :r !gcal
> gives

>   September 2012
> Su Mo Tu We Th Fr Sa
>                   1
> 2  3  4  5  6  7  8
> 9<10>11 12 13 14 15
> 16 17 18 19 20 21 22
> 23 24 25 26 27 28 29
> 30

I had to install it and was slightly miffed when a man page didn't
come down with it.  Ha.  `gcal --help` showed me that `gcal -hh` gives
extended help, which knocked me out of my chair.  Wow -- this is one
full featured calendar program -- thanx Reid.

sc

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: cal in a doc

Chris Jones-44
On Mon, Sep 10, 2012 at 02:46:55PM EDT, sc wrote:

[..]

> I had to install it and was slightly miffed when a man page didn't
> come down with it.  

Calendars are a complicated matter and a man page is probably not
the most suitable format.

See this instead:

http://www.gnu.org/software/gcal/manual/

Complete with glossary and three indexes.

CJ

--

Have a nice day!

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Loading...