[Top][All Lists]

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

Re: [vile] Can one ^X! direct into text being edited somehow?

From: Chris Green
Subject: Re: [vile] Can one ^X! direct into text being edited somehow?
Date: Thu, 6 Sep 2012 13:58:10 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Sep 06, 2012 at 08:07:59AM -0400, Paul Fox wrote:
> chris wrote:
>  > On Thu, Sep 06, 2012 at 10:11:06AM +0100, Chris Green wrote:
>  > > I want an easy way to insert today's date (or possibly another, I might
>  > > get the called command to pop up a calendar) into the text I'm editing.
>  > > 
>  > > Using ":r !date" is a bit clumsy as one has to exit and return to insert
>  > > mode.  
>  > > 
>  > > The alternative "^X!date" puts the date into a separate buffer so,
>  > > again, is a bit clumsy if one simply wants the date inserted at the
>  > > point at which one is typing.
>  > > 
>  > > Is there a quick and easy way to do this or do I need to write a macro?
>  > > I guess a macro which does "<ESC>:r !date^Mi" isn't too bad.
>  > > 
>  > Well I've nearly solved it myself, the following:-
>  > 
>  >     map! #2 ^[:r !date^Mi
>  > 
>  > gets the date into the text at the insertion point, the only downside is
>  > that the insertion point remains at the beginning of the date.  Since
>  > I'm going to use a customized date format of fixed length I think I can
>  > just move the required number of characters forward easily enough. 
>  > Unless anyone can suggest an easy way of automating the "getting the end
>  > of text inserted using 'r'".
> it requires opening a new line before doing so, but i use
>     !!date
> for this sort of thing.  !-filtering is line oriented, so you can't
> do less than a line that way.
OK, same problem with my ":r ...." solution as well of course.

So, I want to create a command which will get the date without any new
lines, it seems the way to do this will be to create a store-procedure
which gets the date in the format I want and then to call this with a
map! key.

The only bit I can't see how to do is to get the output of a command
into a string in the store-procedure.  How does one do the equivalent of
a shell sequence like "dt=`date +%Y-%m-%d` in a store-procedure?

Chris Green

reply via email to

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