[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: |
Paul Fox |
Subject: |
Re: [vile] Can one ^X! direct into text being edited somehow? |
Date: |
Thu, 06 Sep 2012 09:36:45 -0400 |
chris wrote:
> 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
i just realized i have that in my .vilerc -- just have never really used
it. you can see that it cheats, with regard to the newline thing: (the
"day" command prints a formatted date.)
store-procedure insert-day
insert-string "\n\n"
previous-line
filter-til goto-eol "day"
previous-line
join-lines
join-lines
~endm
bind-key insert-day M-d
> 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?
i thought there was a way, but i'm not finding it.
i know you're asking a more general question, but there's also the
the &date function:
| &date | 2 | format 2nd param with 1st, like strftime. |
paul
>
> --
> Chris Green
>
> _______________________________________________
> vile mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/vile
=---------------------
paul fox, address@hidden (arlington, ma, where it's 65.5 degrees)
- [vile] Can one ^X! direct into text being edited somehow?, Chris Green, 2012/09/06
- Re: [vile] Can one ^X! direct into text being edited somehow?, Chris Green, 2012/09/06
- Re: [vile] Can one ^X! direct into text being edited somehow?, Paul Fox, 2012/09/06
- Re: [vile] Can one ^X! direct into text being edited somehow?, Chris Green, 2012/09/06
- Re: [vile] Can one ^X! direct into text being edited somehow?, Brendan O'Dea, 2012/09/06
- Re: [vile] Can one ^X! direct into text being edited somehow?,
Paul Fox <=
- Re: [vile] Can one ^X! direct into text being edited somehow?, Chris Green, 2012/09/06
- Re: [vile] Can one ^X! direct into text being edited somehow?, Paul Fox, 2012/09/06
- Re: [vile] Can one ^X! direct into text being edited somehow?, Thomas Dickey, 2012/09/06