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

Re: Detecting Encrypted File

Expand Messages
  • ZyX
    Reply to message «Re: Detecting Encrypted File», sent 03:40:27 01 August 2011, Monday ... + documentation
    Message 1 of 10 , Jul 31, 2011
    • 0 Attachment
      Reply to message «Re: Detecting Encrypted File»,
      sent 03:40:27 01 August 2011, Monday
      by Ben Schmidt:

      > BufReadPost should also work, and won't trigger every time you move the
      > cursor into the encrypted file's window/buffer.

      @Paul:
      > This works when I've already opened the file, but it doesn't work when I
      > put it in my .vimrc, even when I try it both ways, like this:
      >
      > if !empty(&key) | set viminfo= | endif
      > au! BufRead * if !empty(&key) | set viminfo= | endif
      + documentation
      > BufRead or BufReadPost When ...


      Original message:
      > On 1/08/11 5:46 AM, Paul wrote:
      > > On Sun, Jul 31, 2011 at 09:51:00PM +0400, ZyX wrote:
      > >> Try BufWinEnter, BufEnter or such. I don't really know which events are
      > >> launched after file is decrypted.
      > >
      > > Either of those work, thank you.
      >
      > BufReadPost should also work, and won't trigger every time you move the
      > cursor into the encrypted file's window/buffer.
      >
      > Ben.
    • Paul
      ... I agree, it should work... but neither of these do: au! BufReadPost * if !empty(&key) | set viminfo= | endif au! BufRead * if !empty(&key) | set
      Message 2 of 10 , Aug 1, 2011
      • 0 Attachment
        On Mon, Aug 01, 2011 at 09:40:27AM +1000, Ben Schmidt wrote:
        > BufReadPost should also work, and won't trigger every time you move the
        > cursor into the encrypted file's window/buffer.

        I agree, it should work... but neither of these do:

        au! BufReadPost * if !empty(&key) | set viminfo= | endif
        au! BufRead * if !empty(&key) | set viminfo= | endif

        Maybe there's something special about the file being encrypted that makes these not work - a bug, maybe?

        --

        .

        --
        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
      • ZyX
        Reply to message «Re: Detecting Encrypted File», sent 13:35:05 01 August 2011, Monday ... BufRead and BufReadPost are the same events.
        Message 3 of 10 , Aug 1, 2011
        • 0 Attachment
          Reply to message «Re: Detecting Encrypted File»,
          sent 13:35:05 01 August 2011, Monday
          by Paul:

          > I agree, it should work... but neither of these do:
          >
          > au! BufReadPost * if !empty(&key) | set viminfo= | endif
          > au! BufRead * if !empty(&key) | set viminfo= | endif
          BufRead and BufReadPost are the same events.

          Original message:
          > On Mon, Aug 01, 2011 at 09:40:27AM +1000, Ben Schmidt wrote:
          > > BufReadPost should also work, and won't trigger every time you move the
          > > cursor into the encrypted file's window/buffer.
          >
          > I agree, it should work... but neither of these do:
          >
          > au! BufReadPost * if !empty(&key) | set viminfo= | endif
          > au! BufRead * if !empty(&key) | set viminfo= | endif
          >
          > Maybe there's something special about the file being encrypted that makes
          > these not work - a bug, maybe?
        • Ben Schmidt
          ... Strange. The following works for me in my .vimrc. if v:version =702 fun! NoSwapEncrypt() if &key != setlocal noswapfile endif endfun au BufReadPost *
          Message 4 of 10 , Aug 3, 2011
          • 0 Attachment
            On 1/08/11 7:35 PM, Paul wrote:
            > On Mon, Aug 01, 2011 at 09:40:27AM +1000, Ben Schmidt wrote:
            >> BufReadPost should also work, and won't trigger every time you move the
            >> cursor into the encrypted file's window/buffer.
            >
            > I agree, it should work... but neither of these do:
            >
            > au! BufReadPost * if !empty(&key) | set viminfo= | endif
            > au! BufRead * if !empty(&key) | set viminfo= | endif
            >
            > Maybe there's something special about the file being encrypted that makes these
            > not work - a bug, maybe?

            Strange. The following works for me in my .vimrc.

            if v:version>=702
            fun! NoSwapEncrypt()
            if &key != ""
            setlocal noswapfile
            endif
            endfun
            au BufReadPost * call NoSwapEncrypt()
            endif

            Obviously, it has a different purpose, but nevertheless, it accurately
            detects whether a file is encrypted or not, using BufReadPost.

            Ben.



            --
            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
          Your message has been successfully submitted and would be delivered to recipients shortly.