Run commands at Vi Startup and exiting - Unix

This is a discussion on Run commands at Vi Startup and exiting - Unix ; I work on a PuTTY terminal on Windows connecting HP-UX11i. When I invoke vi or vim and maximum the PuTTY with vi, the editor can't detect the change of the window size. often I execute resize after maximum the window ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Run commands at Vi Startup and exiting

  1. Run commands at Vi Startup and exiting

    I work on a PuTTY terminal on Windows connecting HP-UX11i. When I
    invoke vi or vim and maximum the PuTTY with vi, the editor can't
    detect the change of the window size. often I execute resize after
    maximum the window and before start vi, and execute resize after exit
    vi and restore the window size.

    Can I put the resize command in a `vi' script and run the script
    automatically every time at the startup and exit of vi?


  2. Re: Run commands at Vi Startup and exiting

    In <1177550791.402329.247190@n15g2000prd.googlegroups. com> "lovecreatesbea...@gmail.com" writes:

    > Can I put the resize command in a `vi' script and run the script
    > automatically every time at the startup and exit of vi?


    I don't know of any way to make vi execute a script automatically upon
    startup.

    You could make a script like this:

    resize
    vi $*
    resize

    And just run the script instead of running vi directly. Or make it
    a shell alias instead, if you like that better.

    --
    John Gordon A is for Amy, who fell down the stairs
    gordon@panix.com B is for Basil, assaulted by bears
    -- Edward Gorey, "The Gashlycrumb Tinies"


  3. Re: Run commands at Vi Startup and exiting

    On 2007-04-26, lovecreatesbea...@gmail.com wrote:
    > I work on a PuTTY terminal on Windows connecting HP-UX11i. When I
    > invoke vi or vim and maximum the PuTTY with vi, the editor can't
    > detect the change of the window size. often I execute resize after
    > maximum the window and before start vi, and execute resize after exit
    > vi and restore the window size.
    >
    > Can I put the resize command in a `vi' script and run the script
    > automatically every time at the startup and exit of vi?


    Try connecting via ssh instead of telnet or rlogin. The ssh protocol
    has the ability to advise of changes in terminal size dynamically:
    telnet doesn't. I'm currently typing this from PuTTY connected to
    a NetBSD box and new vi. Any change in terminal size causes a
    SIGWINCH which vi handles automatically.

    SIGWINCH is one of those things that sometimes doesn't work - it
    depends on several different elements all supporting it, but on
    reasonably modern systems you shouldn't have any problems. If you
    do ask back here and someone may be able to help.

    --
    Andrew Smallshaw
    andrews@sdf.lonestar.org

  4. Re: Run commands at Vi Startup and exiting

    Andrew Smallshaw wrote:

    > Try connecting via ssh instead of telnet or rlogin. The ssh protocol
    > has the ability to advise of changes in terminal size dynamically:
    > telnet doesn't. I'm currently typing this from PuTTY connected to


    any reasonably recent telnet implements NAWS

    http://www.faqs.org/rfcs/rfc1073.html

    (noting that some applications on various platforms are maintained in
    a bug-for-bug compatibility mode).

    --
    Thomas E. Dickey
    http://invisible-island.net
    ftp://invisible-island.net

  5. Re: Run commands at Vi Startup and exiting

    On 2007-04-27, Thomas Dickey wrote:
    > Andrew Smallshaw wrote:
    >
    >> Try connecting via ssh instead of telnet or rlogin. The ssh protocol
    >> has the ability to advise of changes in terminal size dynamically:
    >> telnet doesn't. I'm currently typing this from PuTTY connected to

    >
    > any reasonably recent telnet implements NAWS
    >
    > http://www.faqs.org/rfcs/rfc1073.html


    I just tested this and you are of course quite right. I remember
    thinking when I typed that "do I need to double check this?" I
    decided no - telnet's been around 35 years, they'd never considered
    resizable windows back then. Teach me to be more careful in future.
    ;-)

    --
    Andrew Smallshaw
    andrews@sdf.lonestar.org

+ Reply to Thread