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

"Bug" in -i command

Expand Messages
  • dhulme@...
    Is it not possible to use -i and -u simultaneously? The -u command works for me, but when I use -i, it only works when -u is omitted. -- -- You received this
    Message 1 of 10 , Aug 6, 2014
    • 0 Attachment
      Is it not possible to use -i and -u simultaneously? The -u command works for me, but when I use -i, it only works when -u is omitted.

      --
      --
      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.
    • Gary Johnson
      ... Would you please explain what you mean when you say -i doesn t work? What observation makes you think it s not working? Are you specifying a viminfo file
      Message 2 of 10 , Aug 6, 2014
      • 0 Attachment
        On 2014-08-06, dhulme wrote:
        > Is it not possible to use -i and -u simultaneously? The -u
        > command works for me, but when I use -i, it only works when -u is
        > omitted.

        Would you please explain what you mean when you say -i doesn't work?
        What observation makes you think it's not working? Are you
        specifying a viminfo file or "NONE".

        Regards,
        Gary

        --
        --
        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.
      • James McCoy
        ... Then you re likely not using them correctly. Both of those options require an argument of either a filename or NONE. Cheers, -- James GPG Key:
        Message 3 of 10 , Aug 6, 2014
        • 0 Attachment
          On Wed, Aug 06, 2014 at 06:31:09PM -0700, dhulme@... wrote:
          > Is it not possible to use -i and -u simultaneously? The -u command
          > works for me, but when I use -i, it only works when -u is omitted.

          Then you're likely not using them correctly. Both of those options
          require an argument of either a filename or NONE.

          Cheers,
          --
          James
          GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@...>

          --
          --
          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.
        • dhulme@...
          ... Sure. $echo tmprc $echo *encoding=utf-8 tmpinfo $vim -u tmprc -i tmpinfo ... viminfo= $vim -i tmpinfo ... viminfo= 100,
          Message 4 of 10 , Aug 6, 2014
          • 0 Attachment
            On Wednesday, August 6, 2014 8:37:56 PM UTC-7, Gary Johnson wrote:
            > On 2014-08-06, dhulme wrote:
            >
            > > Is it not possible to use -i and -u simultaneously? The -u
            >
            > > command works for me, but when I use -i, it only works when -u is
            >
            > > omitted.
            >
            >
            >
            > Would you please explain what you mean when you say -i doesn't work?
            >
            > What observation makes you think it's not working? Are you
            >
            > specifying a viminfo file or "NONE".
            >
            >
            >
            > Regards,
            >
            > Gary

            Sure.

            $echo > tmprc
            $echo *encoding=utf-8 > tmpinfo
            $vim -u tmprc -i tmpinfo

            :set viminfo?
            viminfo=


            $vim -i tmpinfo

            :set viminfo?
            viminfo='100,<50,s10,h

            I just did this simple test on cygwin with vim 7.4.335. However, I originally noticed this behavior using CentOS 6.5 (Vim 7.2), and confirmed it on FreeBSD 10.0 with VIM 7.4.364.

            It is remarkably consistent, so I am a little surprised no one has noticed it before.

            --
            --
            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.
          • Gary Johnson
            ... The default value of viminfo for vim running on Unix is 100,
            Message 5 of 10 , Aug 7, 2014
            • 0 Attachment
              On 2014-08-06, dhulme wrote:
              > On Wednesday, August 6, 2014 8:37:56 PM UTC-7, Gary Johnson wrote:
              > > On 2014-08-06, dhulme wrote:
              > > > Is it not possible to use -i and -u simultaneously? The -u
              > > > command works for me, but when I use -i, it only works when -u is
              > > > omitted.
              > >
              > > Would you please explain what you mean when you say -i doesn't work?
              > > What observation makes you think it's not working? Are you
              > > specifying a viminfo file or "NONE".
              > >
              > > Regards,
              > > Gary
              >
              > Sure.
              >
              > $echo > tmprc
              > $echo *encoding=utf-8 > tmpinfo
              > $vim -u tmprc -i tmpinfo
              >
              > :set viminfo?
              > viminfo=
              >
              >
              > $vim -i tmpinfo
              >
              > :set viminfo?
              > viminfo='100,<50,s10,h
              >
              > I just did this simple test on cygwin with vim 7.4.335. However,
              > I originally noticed this behavior using CentOS 6.5 (Vim 7.2), and
              > confirmed it on FreeBSD 10.0 with VIM 7.4.364.
              >
              > It is remarkably consistent, so I am a little surprised no one has
              > noticed it before.

              The default value of 'viminfo' for vim running on Unix is

              '100,<50,s10,h

              For vi, it is empty. (See ":help 'viminfo'".)

              When vim is running as vi, with only vi features enabled, it is
              running in compatible mode. When vim is running with vim features
              enabled, it is running in nocompatible mode. (See ":help
              'compatible'".)

              Note the last sentences in ":help -u":

              Using the "-u" argument has the side effect that the
              'compatible' option will be on by default. This can have
              unexpected effects.

              You appear to have a ~/.viminfo file, or a system vimrc file (such
              as /etc/vimrc) that sets 'nocompatible'. (Fedora has a /etc/vimrc
              that does that.) That is causing this command,

              vim -i tmpinfo

              to start vim in nocompatible mode, which means that 'viminfo' will
              be initialized to

              '100,<50,s10,h

              When run using this command,

              vim -u tmprc -i tmpinfo

              vim starts in compatible mode, which means that 'viminfo' will be
              initialized to be empty.

              I think that explains what you're seeing, which is all expected and
              not a bug.

              Regards,
              Gary

              --
              --
              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.
            • dhulme@...
              Sorry, I tried to water down the issue to the point that I failed to demonstrate the issue. The issue is: *** It doesn t load the viminfo at all when I use
              Message 6 of 10 , Aug 7, 2014
              • 0 Attachment
                Sorry, I tried to water down the issue to the point that I failed to demonstrate the issue. The issue is:

                *** It doesn't load the viminfo at all when I use use -u ***

                I don't think any of my own .vimrc/.viminfo files are the issue. I tried to prove this, below:

                -----------------------------------------

                myhost:~$echo > ~/.vimrc
                myhost:~$cat ~/.viminfo
                # This viminfo file was generated by Vim 7.4.
                # You may edit it if you're careful!

                # Value of 'encoding' when this file was written
                *encoding=utf-8


                # hlsearch on (H) or off (h):
                ~h
                # Command Line History (newest to oldest):
                :q
                :history

                # Search String History (newest to oldest):

                # Expression History (newest to oldest):

                # Input Line History (newest to oldest):

                # Input Line History (newest to oldest):

                # Registers:

                # File marks:

                # Jumplist (newest first):

                # History of marks within files (newest to oldest):
                myhost:~$vim -i ~/.viminfo
                :history
                # cmd history
                2 q
                > 3 history


                myhost:~$vim -u ~/.vimrc -i ~/.viminfo
                :history
                'history' option is zero

                ------------------------------------------

                As you can see, if I select my default .viminfo as the viminfo to load, it works--as long as I didn't use -u. My .vimrc is empty, as I showed by creating it from scratch above. But if I load it via -u, suddenly my history isn't loaded from the viminfo.

                The only difference between the two cases is I used "-u ~/.vimrc" in the case where it fails, and I didn't in the case where it succeeds.

                What am I missing?

                I don't have any global vimrc etc., that I can see. But if I did, should -u ~/.vimrc change any of that vs. the default option to load ~/.vimrc?

                This test was done with the following vim:

                ----------------------------------------

                VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 1 2014 17:05:47)
                Included patches: 1-316
                Compiled by <cygwin@...>
                Huge version without GUI. Features included (+) or not (-):
                +acl +farsi +mouse_netterm +syntax
                +arabic +file_in_path +mouse_sgr +tag_binary
                +autocmd +find_in_path -mouse_sysmouse +tag_old_static
                -balloon_eval +float +mouse_urxvt -tag_any_white
                -browse +folding +mouse_xterm -tcl
                ++builtin_terms -footer +multi_byte +terminfo
                +byte_offset +fork() +multi_lang +termresponse
                +cindent +gettext -mzscheme +textobjects
                -clientserver -hangul_input +netbeans_intg +title
                +clipboard +iconv +path_extra -toolbar
                +cmdline_compl +insert_expand +perl/dyn +user_commands
                +cmdline_hist +jumplist +persistent_undo +vertsplit
                +cmdline_info +keymap +postscript +virtualedit
                +comments +langmap +printer +visual
                +conceal +libcall +profile +visualextra
                +cryptv +linebreak +python/dyn +viminfo
                +cscope +lispindent +python3/dyn +vreplace
                +cursorbind +listcmds +quickfix +wildignore
                +cursorshape +localmap +reltime +wildmenu
                +dialog_con +lua/dyn +rightleft +windows
                +diff +menu +ruby/dyn +writebackup
                +digraphs +mksession +scrollbind -X11
                -dnd +modify_fname +signs -xfontset
                -ebcdic +mouse +smartindent -xim
                +emacs_tags -mouseshape -sniff -xsmp
                +eval +mouse_dec +startuptime -xterm_clipboard
                +ex_extra -mouse_gpm +statusline -xterm_save
                +extra_search -mouse_jsbterm -sun_workshop -xpm
                system vimrc file: "$VIM/vimrc"
                user vimrc file: "$HOME/.vimrc"
                2nd user vimrc file: "~/.vim/vimrc"
                user exrc file: "$HOME/.exrc"
                fall-back for $VIM: "/etc"
                f-b for $VIMRUNTIME: "/usr/share/vim/vim74"
                Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -I/usr/include/ncursesw -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/vim/vim-7.4.316-1.i686/build=/usr/src/debug/vim-7.4.316-1 -fdebug-prefix-map=/usr/src/ports/vim/vim-7.4.316-1.i686/src/vim74=/usr/src/debug/vim-7.4.316-1 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
                Linking: gcc -L. -L/usr/local/lib -Wl,--as-needed -o vim.exe -lm -lelf -lncursesw -liconv -lintl -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -fstack-protector -L/usr/local/lib -L/usr/lib/perl5/5.14/i686-cygwin-threads-64int/CORE -lperl -ldl -lcrypt
                ---------------------------------------

                --
                --
                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.
              • dhulme@...
                For reference: myhost:~$ls $VIM/vimrc $HOME/.vimrc ~/.vim/vimrc $HOME/.exrc ls: cannot access /vimrc: No such file or directory ls: cannot access
                Message 7 of 10 , Aug 7, 2014
                • 0 Attachment
                  For reference:

                  myhost:~$ls "$VIM/vimrc" "$HOME/.vimrc" "~/.vim/vimrc" "$HOME/.exrc"
                  ls: cannot access /vimrc: No such file or directory
                  ls: cannot access ~/.vim/vimrc: No such file or directory
                  ls: cannot access /home/myuser/.exrc: No such file or directory
                  /home/myuser/.vimrc

                  --
                  --
                  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.
                • James McCoy
                  ... it works--as long as I didn t use -u. When you don t specify -u, Vim does its own search for a vimrc file and finds ~/.vimrc. As documented in :help
                  Message 8 of 10 , Aug 7, 2014
                  • 0 Attachment


                    On Aug 7, 2014 2:54 PM, <dhulme@...> wrote:
                    > As you can see, if I select my default .viminfo as the viminfo to load, it works--as long as I didn't use -u.

                    When you don't specify -u, Vim does its own search for a vimrc file and finds ~/.vimrc.  As documented in ":help 'cp'", when the search finds a vimrc, 'compatible' is turned off. This means that the Vim default for the 'viminfo' option is used.

                    When you do specify -u, Vim doesn't do the search and just uses the file specified.  In this scenario, 'compatible' is not turned off because your file hasn't disabled it, so the vi default for the 'viminfo' option is used.

                    Cheers,
                    James

                    --
                    --
                    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.
                  • Gary Johnson
                    ... No problem. I appreciate the effort. My explanation was more a collection of facts than an explanation. I ll try again here. ... That s correct. My
                    Message 9 of 10 , Aug 7, 2014
                    • 0 Attachment
                      On 2014-08-07, dhulme wrote:
                      > Sorry, I tried to water down the issue to the point that I failed
                      > to demonstrate the issue.

                      No problem. I appreciate the effort. My "explanation" was more a
                      collection of facts than an explanation. I'll try again here.

                      > The issue is:
                      >
                      > *** It doesn't load the viminfo at all when I use use -u ***

                      That's correct. My understanding is that it should not, unless the
                      file specified by -u sets 'nocompatible' or you also use -N.

                      When you use -u, you are putting vim into compatible mode, as I
                      wrote before and as explained in ":help -u".

                      In compatible mode, vim initializes 'viminfo' to empty. I can't
                      find anyplace where that is stated explicitly, but ":help 'viminfo'"
                      says,

                      Vi default: ""

                      The Vi default is what you would expect when 'compatible' is set,
                      and some experimentation shows it to be true.

                      Further in that :help section it says,

                      When non-empty, the viminfo file is read upon startup and
                      written when exiting Vim.

                      That implies that when 'viminfo' is empty, the viminfo file is _not_
                      read.

                      In summary, using -u sets 'viminfo' to empty which causes the
                      viminfo file to not be read.

                      When you _don't_ use -u, then vim uses several means to determine
                      whether it is in compatible or nocompatible mode, including
                      detecting the presence of a vimrc file. (See ":help 'compatible'"
                      and ":help compatible-default".) If vim detects a ~/.vimrc file, it
                      will set 'nocompatible'.

                      In nocompatible mode on Unix, vim initializes 'viminfo' to

                      '100,<50,s10,h

                      This is non-empty. Therefore, vim reads the viminfo file upon
                      startup.

                      > What am I missing?
                      >
                      > I don't have any global vimrc etc., that I can see. But if I did,
                      > should -u ~/.vimrc change any of that vs. the default option to
                      > load ~/.vimrc?

                      Yes, as explained above.

                      You can see if a system/global vimrc was read by executing

                      :scriptnames

                      and looking at the first line or two.

                      > This test was done with the following vim:
                      >
                      > ----------------------------------------
                      >
                      > VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 1 2014 17:05:47)
                      > Included patches: 1-316
                      > Compiled by <cygwin@...>

                      The Cygwin vim package doesn't include a system vimrc file. CentOS
                      might. Fedora does.

                      I hope that's clear.

                      Regards,
                      Gary

                      --
                      --
                      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.
                    • dhulme@...
                      ... Very clear. Not necessarily intuitive, but it makes sense now. So, by doing: echo set nocompatible ~/.vimrc -u and -i work fine together. Doh! -- --
                      Message 10 of 10 , Aug 7, 2014
                      • 0 Attachment
                        On Thursday, August 7, 2014 1:21:33 PM UTC-7, Gary Johnson wrote:
                        > On 2014-08-07, dhulme wrote:
                        >
                        > > Sorry, I tried to water down the issue to the point that I failed
                        >
                        > > to demonstrate the issue.
                        >
                        >
                        >
                        > No problem. I appreciate the effort. My "explanation" was more a
                        >
                        > collection of facts than an explanation. I'll try again here.
                        >
                        >
                        >
                        > > The issue is:
                        >
                        > >
                        >
                        > > *** It doesn't load the viminfo at all when I use use -u ***
                        >
                        >
                        >
                        > That's correct. My understanding is that it should not, unless the
                        >
                        > file specified by -u sets 'nocompatible' or you also use -N.
                        >
                        >
                        >
                        > When you use -u, you are putting vim into compatible mode, as I
                        >
                        > wrote before and as explained in ":help -u".
                        >
                        >
                        >
                        > In compatible mode, vim initializes 'viminfo' to empty. I can't
                        >
                        > find anyplace where that is stated explicitly, but ":help 'viminfo'"
                        >
                        > says,
                        >
                        >
                        >
                        > Vi default: ""
                        >
                        >
                        >
                        > The Vi default is what you would expect when 'compatible' is set,
                        >
                        > and some experimentation shows it to be true.
                        >
                        >
                        >
                        > Further in that :help section it says,
                        >
                        >
                        >
                        > When non-empty, the viminfo file is read upon startup and
                        >
                        > written when exiting Vim.
                        >
                        >
                        >
                        > That implies that when 'viminfo' is empty, the viminfo file is _not_
                        >
                        > read.
                        >
                        >
                        >
                        > In summary, using -u sets 'viminfo' to empty which causes the
                        >
                        > viminfo file to not be read.
                        >
                        >
                        >
                        > When you _don't_ use -u, then vim uses several means to determine
                        >
                        > whether it is in compatible or nocompatible mode, including
                        >
                        > detecting the presence of a vimrc file. (See ":help 'compatible'"
                        >
                        > and ":help compatible-default".) If vim detects a ~/.vimrc file, it
                        >
                        > will set 'nocompatible'.
                        >
                        >
                        >
                        > In nocompatible mode on Unix, vim initializes 'viminfo' to
                        >
                        >
                        >
                        > '100,<50,s10,h
                        >
                        >
                        >
                        > This is non-empty. Therefore, vim reads the viminfo file upon
                        >
                        > startup.
                        >
                        >
                        >
                        > > What am I missing?
                        >
                        > >
                        >
                        > > I don't have any global vimrc etc., that I can see. But if I did,
                        >
                        > > should -u ~/.vimrc change any of that vs. the default option to
                        >
                        > > load ~/.vimrc?
                        >
                        >
                        >
                        > Yes, as explained above.
                        >
                        >
                        >
                        > You can see if a system/global vimrc was read by executing
                        >
                        >
                        >
                        > :scriptnames
                        >
                        >
                        >
                        > and looking at the first line or two.
                        >
                        >
                        >
                        > > This test was done with the following vim:
                        >
                        > >
                        >
                        > > ----------------------------------------
                        >
                        > >
                        >
                        > > VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jun 1 2014 17:05:47)
                        >
                        > > Included patches: 1-316
                        >
                        > > Compiled by <cygwin@...>
                        >
                        >
                        >
                        > The Cygwin vim package doesn't include a system vimrc file. CentOS
                        >
                        > might. Fedora does.
                        >
                        >
                        >
                        > I hope that's clear.
                        >
                        >
                        >
                        > Regards,
                        >
                        > Gary

                        Very clear. Not necessarily intuitive, but it makes sense now. So, by doing:

                        echo set nocompatible > ~/.vimrc

                        -u and -i work fine together.

                        Doh!

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