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

Re: Save all buffers on SIGTERM

Expand Messages
  • Tony Mechelynck
    ... Maybe this? (untested) save everything if terminated by an interceptible signal ... or this? delete swapfile if the swapped file is nomodified ...
    Message 1 of 3 , Mar 17, 2013
    • 0 Attachment
      On 16/03/13 18:44, Thiago Padilha wrote:
      > Is it possible to configure vim to write all buffers when it receives
      > SIGTERM? I use vim inside multiple tmux sessions and sometimes I
      > forget to save something so when I shutdown the computer and reboot
      > there's a bunch of .swp files around(I would rather have vim save
      > everything)
      >
      > I already tried the autowriteall option but it only works when exiting
      > vim cleanly
      >

      Maybe this? (untested)

      " save everything if terminated by an interceptible signal
      :aucmd VimLeave * if v:dying | wall | endif

      or this?

      " delete swapfile if the swapped file is 'nomodified'
      :au SwapExists * if !&mod | let v:swapchoice = 'd' | endif


      Best regards,
      Tony.
      --
      BEDEVERE: Stand by for attack!!
      [CUT TO enormous army forming up. Trebuchets, rows of PIKEMEN, siege
      towers, pennants flying, shouts of "Stand by for attack!" Traditional
      army build-up shots. The shouts echo across the ranks of the army.
      We see various groups reacting, and stirring themselves in readiness.]
      ARTHUR: Who are they?
      BEDEVERE: Oh, just some friends!
      "Monty Python and the Holy Grail" PYTHON (MONTY)
      PICTURES LTD

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Thiago Padilha
      thanks for the tip, Tony. On Sun, Mar 17, 2013 at 4:09 AM, Tony Mechelynck ... -- -- You received this message from the vim_use maillist. Do not top-post!
      Message 2 of 3 , Mar 18, 2013
      • 0 Attachment
        thanks for the tip, Tony.

        On Sun, Mar 17, 2013 at 4:09 AM, Tony Mechelynck
        <antoine.mechelynck@...> wrote:
        > On 16/03/13 18:44, Thiago Padilha wrote:
        >>
        >> Is it possible to configure vim to write all buffers when it receives
        >> SIGTERM? I use vim inside multiple tmux sessions and sometimes I
        >> forget to save something so when I shutdown the computer and reboot
        >> there's a bunch of .swp files around(I would rather have vim save
        >> everything)
        >>
        >> I already tried the autowriteall option but it only works when exiting
        >> vim cleanly
        >>
        >
        > Maybe this? (untested)
        >
        > " save everything if terminated by an interceptible signal
        > :aucmd VimLeave * if v:dying | wall | endif
        >
        > or this?
        >
        > " delete swapfile if the swapped file is 'nomodified'
        > :au SwapExists * if !&mod | let v:swapchoice = 'd' | endif
        >
        >
        > Best regards,
        > Tony.
        > --
        > BEDEVERE: Stand by for attack!!
        > [CUT TO enormous army forming up. Trebuchets, rows of PIKEMEN, siege
        > towers, pennants flying, shouts of "Stand by for attack!" Traditional
        > army build-up shots. The shouts echo across the ranks of the army.
        > We see various groups reacting, and stirring themselves in readiness.]
        > ARTHUR: Who are they?
        > BEDEVERE: Oh, just some friends!
        > "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES
        > LTD
        >
        > --
        > --
        > You received this message from the "vim_use" maillist.
        > Do not top-post! Type your reply below the text you are replying to.
        > For more information, visit http://www.vim.org/maillist.php
        >
        > --- You received this message because you are subscribed to the Google
        > Groups "vim_use" group.
        > To unsubscribe from this group and stop receiving emails from it, send an
        > email to vim_use+unsubscribe@....
        > For more options, visit https://groups.google.com/groups/opt_out.
        >
        >

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.