Loading ...
Sorry, an error occurred while loading the content.

.vim_logout ???

Expand Messages
  • Meino Christian Cramer
    Hi, I am looking for a way to execute some lines of vim-script everytime when ich leave vim (end the programm). Are there any hooks , which I can use for such
    Message 1 of 4 , Sep 30, 2006
    • 0 Attachment
      Hi,

      I am looking for a way to execute some lines of vim-script everytime
      when ich leave vim (end the programm).

      Are there any "hooks", which I can use for such a task ?

      Keep hacking!
      mcc
    • Meino Christian Cramer
      From: A.J.Mechelynck Subject: Re: .vim_logout ??? Date: Sat, 30 Sep 2006 11:05:28 +0200 ... Hi, hmmmm...it still does not
      Message 2 of 4 , Sep 30, 2006
      • 0 Attachment
        From: "A.J.Mechelynck" <antoine.mechelynck@...>
        Subject: Re: .vim_logout ???
        Date: Sat, 30 Sep 2006 11:05:28 +0200

        > Meino Christian Cramer wrote:
        > > Hi,
        > >
        > > I am looking for a way to execute some lines of vim-script everytime
        > > when ich leave vim (end the programm).
        > >
        > > Are there any "hooks", which I can use for such a task ?
        > >
        > > Keep hacking!
        > > mcc
        > >
        >
        > :autocmd VimLeave * " any ex-command here
        >
        > Most (but not all) autocommands can be placed on one line, separated by | (A
        > few will take a following | as part of their arguments.)
        >
        > You can also use several ":autocmd" lines (the autocommands are executed in
        > the order defined), or, if you want a more complex script, you can e.g. do
        >
        > :autocmd VimLeave * source ~/.vim/macros/logout.vim
        >
        > see
        > :help :autocmd
        > :help VimLeave
        >
        >
        > Best regards
        >

        Hi,

        hmmmm...it still does not work, which definitely is my fault.

        The situation: I set

        if &term =~ "xterm-256color"
        let &t_SI = "\<Esc>]12;red\x7"
        let &t_EI = "\<Esc>]12;white\x7"
        endif

        which set the color of the cursor to reflect the mode (insert/normal)
        vim is in.

        The drawback of this is: When leaving vim, the color of the cursor of
        the terminal from which vim was started, is effected. This may result
        in a non visible or less then optimal readability of the cursor.

        So why not to reset the cursor color?

        I did the following:

        autocmd VimLeave * let &t_EI = "\<Esc>]12;green\x7"

        which _should_ set the cursor back to the "original" color.

        This does not work.

        Then I tried (experimental...not based on any knowledge ;O) )

        autocmd VimLeave * echo "\<Esc>]12;green\x7"

        which also does not work.

        "WARNING! IDEA STACK UNDERFLOW" was the next error I got..... ;)

        Is there a way to reset the cursor color to "normal"...and...
        Is there a way to determine the original cursor color before tweaking
        t_SI and t_EI, to remember the color and to use it in the
        reset-cursor-color-code instead of hardcoding it ?

        Thank you very much for any help in advance !
        keep hacking!
        mcc
      • Yakov Lerner
        ... No, this will not work (vim s builtin echo translates Esc to ^[). Try something like: autocmd VimLeave * silent !echo -e e]12;green 007 (untested) Yakov
        Message 3 of 4 , Oct 1, 2006
        • 0 Attachment
          On 10/1/06, Meino Christian Cramer <Meino.Cramer@...> wrote:
          > From: "A.J.Mechelynck" <antoine.mechelynck@...>
          > Subject: Re: .vim_logout ???
          > Date: Sat, 30 Sep 2006 11:05:28 +0200
          >
          > > Meino Christian Cramer wrote:
          > > > Hi,
          > > >
          > > > I am looking for a way to execute some lines of vim-script everytime
          > > > when ich leave vim (end the programm).
          > > >
          > > > Are there any "hooks", which I can use for such a task ?
          > > >
          > > > Keep hacking!
          > > > mcc
          > > >
          > >
          > > :autocmd VimLeave * " any ex-command here
          > >
          > > Most (but not all) autocommands can be placed on one line, separated by | (A
          > > few will take a following | as part of their arguments.)
          > >
          > > You can also use several ":autocmd" lines (the autocommands are executed in
          > > the order defined), or, if you want a more complex script, you can e.g. do
          > >
          > > :autocmd VimLeave * source ~/.vim/macros/logout.vim
          > >
          > > see
          > > :help :autocmd
          > > :help VimLeave
          > >
          > >
          > > Best regards
          > >
          >
          > Hi,
          >
          > hmmmm...it still does not work, which definitely is my fault.
          >
          > The situation: I set
          >
          > if &term =~ "xterm-256color"
          > let &t_SI = "\<Esc>]12;red\x7"
          > let &t_EI = "\<Esc>]12;white\x7"
          > endif
          >
          > which set the color of the cursor to reflect the mode (insert/normal)
          > vim is in.
          >
          > The drawback of this is: When leaving vim, the color of the cursor of
          > the terminal from which vim was started, is effected. This may result
          > in a non visible or less then optimal readability of the cursor.
          >
          > So why not to reset the cursor color?
          >
          > I did the following:
          >
          > autocmd VimLeave * let &t_EI = "\<Esc>]12;green\x7"

          No, this will not work (vim's builtin echo translates Esc to ^[).
          Try something like:
          autocmd VimLeave * silent !echo -e '\e]12;green\007'
          (untested)

          Yakov
        • Meino Christian Cramer
          From: Yakov Lerner Subject: Re: .vim_logout ??? Date: Sun, 1 Oct 2006 16:31:44 +0300 ... Hi Yakov ! Thanks a lot for the reply and your
          Message 4 of 4 , Oct 1, 2006
          • 0 Attachment
            From: "Yakov Lerner" <iler.ml@...>
            Subject: Re: .vim_logout ???
            Date: Sun, 1 Oct 2006 16:31:44 +0300

            > On 10/1/06, Meino Christian Cramer <Meino.Cramer@...> wrote:
            > > From: "A.J.Mechelynck" <antoine.mechelynck@...>
            > > Subject: Re: .vim_logout ???
            > > Date: Sat, 30 Sep 2006 11:05:28 +0200
            > >
            > > > Meino Christian Cramer wrote:
            > > > > Hi,
            > > > >
            > > > > I am looking for a way to execute some lines of vim-script everytime
            > > > > when ich leave vim (end the programm).
            > > > >
            > > > > Are there any "hooks", which I can use for such a task ?
            > > > >
            > > > > Keep hacking!
            > > > > mcc
            > > > >
            > > >
            > > > :autocmd VimLeave * " any ex-command here
            > > >
            > > > Most (but not all) autocommands can be placed on one line, separated by | (A
            > > > few will take a following | as part of their arguments.)
            > > >
            > > > You can also use several ":autocmd" lines (the autocommands are executed in
            > > > the order defined), or, if you want a more complex script, you can e.g. do
            > > >
            > > > :autocmd VimLeave * source ~/.vim/macros/logout.vim
            > > >
            > > > see
            > > > :help :autocmd
            > > > :help VimLeave
            > > >
            > > >
            > > > Best regards
            > > >
            > >
            > > Hi,
            > >
            > > hmmmm...it still does not work, which definitely is my fault.
            > >
            > > The situation: I set
            > >
            > > if &term =~ "xterm-256color"
            > > let &t_SI = "\<Esc>]12;red\x7"
            > > let &t_EI = "\<Esc>]12;white\x7"
            > > endif
            > >
            > > which set the color of the cursor to reflect the mode (insert/normal)
            > > vim is in.
            > >
            > > The drawback of this is: When leaving vim, the color of the cursor of
            > > the terminal from which vim was started, is effected. This may result
            > > in a non visible or less then optimal readability of the cursor.
            > >
            > > So why not to reset the cursor color?
            > >
            > > I did the following:
            > >
            > > autocmd VimLeave * let &t_EI = "\<Esc>]12;green\x7"
            >
            > No, this will not work (vim's builtin echo translates Esc to ^[).
            > Try something like:
            > autocmd VimLeave * silent !echo -e '\e]12;green\007'
            > (untested)
            >
            > Yakov
            >

            Hi Yakov !

            Thanks a lot for the reply and your helping hands!
            I will see, how grenn I can get the cursor with it ! :)))))))

            keep hacking!
            mcc
          Your message has been successfully submitted and would be delivered to recipients shortly.