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

Re: vim bug?

Expand Messages
  • Sung-Hyun Nam
    ... The directory does not exist. File also does not exist. But after :cd .. , the directory is valid. src -+- xxx +- foo I worked in foo directory. I did
    Message 1 of 13 , Aug 3, 2000
    • 0 Attachment
      Ralf Schandl wrote:
      > Dear namsh,
      >
      > unfortunally your initial mail didn't have enough information for me to
      > fully understand your problem, so I had to guess.
      >
      > 1) Does the direcory xxx exist? Does the file exist?

      The directory does not exist. File also does not exist.
      But after ':cd ..', the directory is valid.

      src -+- xxx
      +- foo

      I worked in 'foo' directory.
      I did ':n xxx/yyy.c' and then ':cd ..'.
      Because the current buffer has yet 'xxx/yyy.c',
      I thought it is not consistent.

      > 2) What OS are you using?

      Linux.

      > I assumed the directory xxx exists and remembered the problem with
      > win32.
      >
      > If xxx exists, I can't reproduce your problem on Linux. It doesn't care
      > if yyy.c exists or not.
      >
      > If xxx does not exist, the way vim behaves is IMHO one valid way to handle
      > this situation.

      So it's not bug? I see.

      > [snip...]

      Thanks.

      namsh
    • Toan Pham
      Hi, i am not sure if this is a bug; but when i use vim, and depending on the keyboard settings, i usually type the command below to exit. ... however, because
      Message 2 of 13 , Feb 7 12:26 PM
      • 0 Attachment
        Hi, i am not sure if this is a bug; but when i use vim, and depending on the keyboard settings, i usually type the command below to exit.

        :wq!

        however, because of the keyboard settings, sometimes it will be entered as

        :;wq!


        As the result of the later command, the content of the file will be flushed/erased completely. It would not be possible to recover the original content once the content is erased. It is very irritating, and I've been given up using vim b/c of this bug.


        Please let me know if this is an expected behavior or if it is a bug. If it is an expected behavior, is there anyway (via configuration), that i can always translate the ":;wq!" to ":wq!" command?

        Thank you


        Toan

        --
        --
        You received this message from the "vim_dev" 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_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • Marc Weber
        ... Well - probably you misstype . How to protect against misstyping? use ZZ ZQ for quitting vim (last buffer) remap :; to : or such, eg noremap :; : More
        Message 3 of 13 , Feb 7 4:41 PM
        • 0 Attachment
          > :wq!

          > however, because of the keyboard settings, sometimes it will be entered as
          > :;wq!
          Well - probably you "misstype". How to protect against misstyping?
          use ZZ ZQ for quitting vim (last buffer)

          remap :; to : or such, eg
          noremap :; :

          More advanced mappings would use cnoremap (remap in command line), ec
          cnoremap ; <c-r>=YourFunTakingCursorPosIntoAccountToDecideWhetherToInsert(';')<cr>

          ....

          Thus this alone is not a reason to give up on Vim :)

          There are even people remapping : to ; and ; to : because : (using
          shift) is so awkward but is required to be typed often.

          Marc Weber

          --
          --
          You received this message from the "vim_dev" 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_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • Erik Falor
          ... This must be very frustrating. Hang in there, and don t give up on Vim yet! In my opinion, the very best thing for you to do in this case is to not execute
          Message 4 of 13 , Feb 8 12:05 AM
          • 0 Attachment
            On Sat, Feb 07, 2015 at 12:26:46PM -0800, Toan Pham wrote:
            >
            >
            > Hi, i am not sure if this is a bug; but when i use vim, and depending on the keyboard settings, i usually type the command below to exit.
            >
            > :wq!
            >
            > however, because of the keyboard settings, sometimes it will be entered as
            >
            > :;wq!
            >
            >
            > As the result of the later command, the content of the file will be flushed/erased completely. It would not be possible to recover the original content once the content is erased. It is very irritating, and I've been given up using vim b/c of this bug.

            This must be very frustrating. Hang in there, and don't give up on Vim
            yet!

            In my opinion, the very best thing for you to do in this case is to
            not execute the :wq command with the ! modifier. When you accidentally
            issue :;wq, you will still have an opportunity to avoid disaster.

            > Please let me know if this is an expected behavior or if it is a bug. If it is an expected behavior, is there anyway (via configuration), that i can always translate the ":;wq!" to ":wq!" command?

            The behavior you are experiencing is not due to a bug in Vim. Many
            commands in Vim can be prefixed with prefixed with one or two line
            numbers to specify a range of the file over which the commands
            operate.

            The :w and :wq commands use the range of lines to allow you to save
            only a portion of the file (perhaps under a different file name).

            Your lone semi-colon is interpreted as a range which indicates the
            line the cursor is presently on. So you are in fact replacing the
            contents of the entire current file with the single line containing
            your cursor.

            Obviously, this isn't a very useful application of this feature of
            Vim, but I hope that you can regard it as an example of the expressive
            power available to you as a Vim user. Given some time and experience,
            you'll become a text-editing power user!

            --
            Erik Falor
            Registered Linux User #445632 http://linuxcounter.net

            --
            --
            You received this message from the "vim_dev" 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_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • Toan Pham
            ​Erik, Thank you for the explanation. Maybe we should change the interpretation of that ***particular*** command, not to replace the entire file with the
            Message 5 of 13 , Feb 8 1:56 PM
            • 0 Attachment

              ​Erik,

              Thank you for the explanation.
              Maybe we should change the interpretation of that ***particular*** command, not to replace the entire file with the current line.  I know that it is a feature; but i looks like it does more harm than good.  When I ever need to do something like that, i would mostly use sed over vim.  I know that it is a nice feature in vim; but it would be nice to be able to re-interpret that command to :wq! using a global environment configuration, for example.


              export VIM_CMD_REINTERPRETE=":;wq!#:wq!"







              --
              --
              You received this message from the "vim_dev" 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_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            • Marc Weber
              I hit similar once as well. Also note that wfoo means write foo or such - thus spaces can be omitted. ... You can implement this on your own, but such into
              Message 6 of 13 , Feb 8 2:08 PM
              • 0 Attachment
                I hit similar once as well. Also note that wfoo means write foo or such
                - thus spaces can be omitted.

                > export VIM_CMD_REINTERPRETE=":;wq!#:wq!"
                You can implement this on your own, but such into your .vimrc

                let l = split('#", $VIM_CMD_REINTERPRETE)
                exec 'cnoremap '.l[0].' '.l[1]

                or similar - see my other mail as well which suggested using cnoremap
                without env var - or remember ZZ or ZQ which might even be easier to
                type and works always everywhere.

                Marc Weber

                --
                --
                You received this message from the "vim_dev" 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_dev" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/d/optout.
              • Toan Pham
                @Marc Weber Thank you, your suggestion is very clear and helpful. I will use ZZ from now on b/c it is simpler than :wq! , and less prone to the keyboard
                Message 7 of 13 , Feb 9 9:32 AM
                • 0 Attachment
                  @Marc Weber

                  Thank you, your suggestion is very clear and helpful. I will use ZZ from now on b/c it is simpler than ":wq!", and less prone to the keyboard typo.
                  I will also use cnoremap to remap the key (:;), just to be safe.

                  I have never experienced this issue on Ubuntu < 12.04; until recently, when I started to use Kubuntu 14.04. It could be related to the KDE desktop manager changing the keyboard settings, or that my logitech wireless keyboard acting up; because I am 99.9% certain that I would never press the same key twice (: and ;) when exiting vim.


                  Again, thank you. We have come to a conclusion that this is not a bug, and if it was a keyboard bug in KDE; the bug needs to be fixed in KDE/kubuntu instead.

                  -toan


                  --
                  --
                  You received this message from the "vim_dev" 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_dev" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                  For more options, visit https://groups.google.com/d/optout.
                • Marc Weber
                  ... Especially look for key repetition settings xev can be used to debug which keys get typed in which order. Marc Weber -- -- You received this message from
                  Message 8 of 13 , Feb 9 9:52 AM
                  • 0 Attachment
                    > Again, thank you. We have come to a conclusion that this is not a
                    > bug, and if it was a keyboard bug in KDE; the bug needs to be fixed in
                    > KDE/kubuntu instead.
                    Especially look for key repetition settings
                    xev can be used to debug which keys get typed in which order.

                    Marc Weber

                    --
                    --
                    You received this message from the "vim_dev" 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_dev" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                    For more options, visit https://groups.google.com/d/optout.
                  Your message has been successfully submitted and would be delivered to recipients shortly.