Re: [kinda ot] writing the date into a file when saving it

From: Peder Blom (dion_at_bredband.net)
Date: 01/27/04

  • Next message: Andrew L. Gould: "Re: dhcp"
    Date: Tue, 27 Jan 2004 16:50:01 +0100
    To: rob_spellberg <emailrob@emailrob.com>
    
    

    On Mon, 26 Jan 2004 15:59:19 -0600
    rob_spellberg <emailrob@emailrob.com> wrote:

    > dear sir or madam ---
    >
    > this may be a vi question, but i'd like to be editor-independent, if
    > possible.
    >
    > i want to self-document source code files when i write them to disk.
    >
    > this would include such things as path and modification time.
    >
    > ideally, within vi, i would like to have :w run a script [ that i
    > would write ]
    > that does exactly what i want.
    >
    > for years, i've been doing this more or less haphazardly during
    > development,
    > until i was satisfied that the file was in its final form.
    > then i would manually get it right and leave it alone.
    > but i'm writing too much right now to keep doing this manually and
    > i'm something of a nut for documentation.
    >
    > its easy enough to write a sed script to find a unique string and do a
    > replacement. its only slightly more involved to write a glorified
    > version of touch
    > [ which is kinda what i want, actually ].
    >
    > maybe what i want is to go into vi [ or ex, or wherever ],
    > find where :w is processed and cause it to look for a script to
    > run.
    >
    > i know about :so.
    > i know about !command.
    > neither are really "it".
    >
    > i've been googling for about an hour and coming up almost completely
    > empty. maybe there's a jargon word for what i want that i don't know.
    >
    > so to get to the question: what do you folks do?
    >
    > rob spellberg
    > woodstock, illinois
    >
    > _______________________________________________
    > freebsd-questions@freebsd.org mailing list
    > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    > To unsubscribe, send any mail to
    > "freebsd-questions-unsubscribe@freebsd.org"

    I guess this is not what you are after, but have you considered mapping
    keys in vi? E.g. something like

    :map = 1GO^[!!date;whoami;hostname^M1G3J:w^M

    Now, pressing "=" in command mode adds a line at the top of the file
    with current date, user and host, then saves the file. You could be
    creative with !command, write your own script or c-program to generate
    input.

    _______________________________________________
    freebsd-questions@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-questions
    To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"


  • Next message: Andrew L. Gould: "Re: dhcp"

    Relevant Pages

    • RE: export question
      ... environment, but that is what export is supposed to do. ... 'set' command. ... It *is* set in the sub-process created when you run the script. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
      (Debian-User)
    • when lid is closed
      ... This script use a command called "vidcontrol", and I don't know and also didn't found any command with this name, more over, I also don't know what is the relation between close-the-lid and the "notify 5" inside the file ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
      (Debian-User)
    • Re: pop-up notices for all gnome users
      ... with 'who' command) and sitting at the terminal, ... > try to run your script as non root user, ... > display the info ... To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list ...
      (Fedora)
    • Re: Customize xfterm4 for a terminal-bound program in Xfce
      ... > launcher in the Panel for a program running on a terminal, ... script, which I then call from the window manager. ... The last command ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
      (Debian-User)
    • Re: Problems trying to configure Linux laptop to print to Windows XP shared printer
      ... map to guest = Never ... check password script = ... enumports command = ... ldap delete dn = No ...
      (comp.os.linux.setup)