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

Re: 'ed' and 'split' with read-only enabled

Expand Messages
  • Gary Johnson
    ... If you want to continue to use the :split command, the swapExists autocommand event can be used to detect the warning condition and the v:swapchoice
    Message 1 of 8 , Jul 15, 2013
    • 0 Attachment
      On 2013-07-15, Woody Wu wrote:
      > Hi, List
      >
      > How can I open a file in current buffer using 'ed' and 'split' but with
      > read-only enabled in the same time? One reason why I want this is,
      > sometimes when I've already open a file in another vim instance and
      > don't want to close it, then I need to temparaly open the same file in
      > current vim instance to copy something from the file. Then when I do
      > the 'split myfile' in the current buffer, I will alwasy got a warning
      > and prompt me to open it in read-only mode. So I want to directly open
      > it in read-only mode to git rid of the boring red warning message.

      If you want to continue to use the :split command, the swapExists
      autocommand event can be used to detect the warning condition and
      the v:swapchoice variable set to specify the desired action, e.g.,

      autocmd SwapExists * let v:swapchoice='o'

      Or you could just open the file using the :sview command which is
      the same as using :split but also sets 'readonly' in the new buffer.
      See

      :help SwapExists
      :help v:swapchoice
      :help :sview

      Regards,
      Gary

      --
      --
      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.
    • Woody Wu
      ... Many thanks Gary, these are really tips I am looking for! ... -- I can t go back to yesterday - because I was a different person then -- -- You received
      Message 2 of 8 , Jul 15, 2013
      • 0 Attachment
        On Mon, Jul 15, 2013 at 07:41:30AM -0700, Gary Johnson wrote:
        > On 2013-07-15, Woody Wu wrote:
        > > Hi, List
        > >
        > > How can I open a file in current buffer using 'ed' and 'split' but with
        > > read-only enabled in the same time? One reason why I want this is,
        > > sometimes when I've already open a file in another vim instance and
        > > don't want to close it, then I need to temparaly open the same file in
        > > current vim instance to copy something from the file. Then when I do
        > > the 'split myfile' in the current buffer, I will alwasy got a warning
        > > and prompt me to open it in read-only mode. So I want to directly open
        > > it in read-only mode to git rid of the boring red warning message.
        >
        > If you want to continue to use the :split command, the swapExists
        > autocommand event can be used to detect the warning condition and
        > the v:swapchoice variable set to specify the desired action, e.g.,
        >
        > autocmd SwapExists * let v:swapchoice='o'
        >
        > Or you could just open the file using the :sview command which is
        > the same as using :split but also sets 'readonly' in the new buffer.
        > See
        >
        > :help SwapExists
        > :help v:swapchoice
        > :help :sview
        >

        Many thanks Gary, these are really tips I am looking for!

        > Regards,
        > Gary
        >
        > --
        > --
        > 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.
        >

        --
        I can't go back to yesterday - because I was a different person then

        --
        --
        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.
      • Woody Wu
        ... Many thanks. At this moment, my google network looks has a problem so that I cannot open the vim wikia page. I will try later. The name looks very close
        Message 3 of 8 , Jul 15, 2013
        • 0 Attachment
          On Mon, Jul 15, 2013 at 07:52:59PM +0530, Karthick Gururaj wrote:
          > On Mon, Jul 15, 2013 at 7:03 PM, Woody Wu <narkewoody@...> wrote:
          >
          > > sometimes when I've already open a file in another vim instance and
          > > don't want to close it, then I need to temparaly open the same file in
          > > current vim instance to copy something from the file. Then when I do
          > > the 'split myfile' in the current buffer, I will alwasy got a warning
          > > and prompt me to open it in read-only mode. So I want to directly open
          > > it in read-only mode to git rid of the boring red warning message.
          >
          > http://vim.wikia.com/wiki/Open_same_file_read-only_in_second_Vim
          >

          Many thanks. At this moment, my google network looks has a problem so
          that I cannot open the vim wikia page. I will try later. The name looks
          very close to what I want.

          > --
          > --
          > 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.
          >

          --
          I can't go back to yesterday - because I was a different person then

          --
          --
          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.