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

Re: Five questions about VIM

Expand Messages
  • Peter Bismuti
    I can t seem to find this option. A related question is that when I use an xterm I reverse the video so the white background becomes black and the black
    Message 1 of 7 , Jun 1, 2001
    • 0 Attachment
      I can't seem to find this option.

      A related question is that when I use an xterm I reverse the video so the
      white background becomes black and the black foreground becomes white. For
      some reason it never sticks long because some sequence in vim will change
      it back, something involving the escape key. Anyone seen this before?
      Know how to fix?

      Thanks


      > I usually don't change the syntax highlighting. I do a
      >
      > :set bgcolor=dark
      >
      > instead and do a :syntax on if I have a dark background (black). This
      > will change all the syntax colors to fit a dark background. I rarely
      > need to tweak the colors. In fact, it's one of the wonderful things I
      > found about Vim. If you really want to change the color, you should
      > see:
      >
      > :help syntax
      >
      > >
      > > (2) When the cursor is at the end of a line, I would like the 'L' (move
      > > right) key
      > > to cause an alert (e.g. audible bell or visual flash) rather than
      > > moving to the
      > > first character of the next line. Is there a way to do this?
      > >
      >
      > I'm not so clear on this. Are you wrapping a long line into multiple
      > visual lines?
      >
      > > (3) I would like the '%' command to work on angle brackets ("<" and ">")
      > >
      > > the way it works on other matched-pair characters. This is very
      > > useful
      > > in HTML files and other files with similar angle-bracket syntaxes.
      > > The previous vi-like editor I used did this, but vim does not (at
      > > least by default).
      > > Is there a way to enable this?
      >
      > I'm not quite sure about matching "<" and ">", but there's an excellent
      > package called matchit.vim. It can even match html tags and other
      > things. With it, you can even jump from the <table> to the matching
      > </table> tags. There maybe some other ways to do what you want.
      >
      > >
      > > (4) The vim editor appears to hide MS-DOS-style ctrl-M's at the end of
      > > lines.
      > > I like to know when a file has ctrl-M's at the end of its lines, so
      > > that I can see
      > > them and remove them (using :1,$s/^V^M$//). By hiding them, vim
      > > prevents
      > > me not only from seeing them, but also from removing them, because
      > > the above
      > > removal command doesn't work in vim.
      >
      > You usually do a:
      >
      > :set fileformat
      >
      > to check whether a file is dos or unix format. You shouldn't really
      > care about the ^M at the end.
      >
      > You then can do:
      >
      > :set fileformat=unix
      >
      > to convert the file in unix ending chars or
      >
      > :set fileformat=dos
      >
      > to convert the file in dos format.
      >
      > It's just a different way to do things.
      >
      > >
      > > (5) When switching back and forth between two files (using :e#), the vim
      > > editor
      > > does not preserve the exact set of lines being shown within the file
      > > that were
      > > showing originally. It does this, I believe, so that the line on
      > > which the cursor
      > > lies ends up in the middle of the screen. Vim behaves like the
      > > original vi in
      > > this respect. Is it possible to disable this auto-centering
      > > behavior in vim?
      >
      > Hmm..dunno about this one. Some other vimmers may be able to answer
      > you.
      >
      > >
      > > I am using vim version 5.2.
      > > Thanks.
      >
      > Wow, you should upgrade to the latest 5.8 instead. (or be brave and try
      > the 6.0 alpha)
      >
      > --
      > William Lee (Will) | Sendmail Inc.
      > Email: wlee@... | http://www.sendmail.com
      > Tel: (510) 594-5505 |
      >

      _____________________________________________________________________
      | |
      | Pete Bismuti |
      | Department of Computer Science |
      | Florida State University |
      | bismuti@... (850) 644-6835 |
      |_____________________________________________________________________|
    • Gary Johnson
      ... This is controlled by the whichwrap option, which defaults to the behavior you want (at least in 5.6). So either the default setting was different in
      Message 2 of 7 , Jun 1, 2001
      • 0 Attachment
        On Fri, Jun 01, 2001 at 05:21:17PM -0700, Dave McCooey wrote:

        > (2) When the cursor is at the end of a line, I would like the 'L'
        > (move right) key to cause an alert (e.g. audible bell or visual
        > flash) rather than moving to the first character of the next line.
        > Is there a way to do this?

        This is controlled by the 'whichwrap' option, which defaults to the
        behavior you want (at least in 5.6). So either the default setting was
        different in 5.2 or 'whichwrap' (or 'ww') has been set in your .vimrc.
        See ':help whichwrap'.

        > (3) I would like the '%' command to work on angle brackets ("<" and ">")
        > the way it works on other matched-pair characters. This is very
        > useful in HTML files and other files with similar angle-bracket
        > syntaxes. The previous vi-like editor I used did this, but vim
        > does not (at least by default). Is there a way to enable this?

        This is controlled by the 'matchpairs' option. To enable matching '<'
        and '>', add this to your .vimrc:

        set mps+=<:>

        Again, this applies to 5.6 and later; I don't know about 5.2.

        Gary

        --
        Gary Johnson | Agilent Technologies
        garyjohn@... | RF Communications Product Generation Unit
        | Spokane, Washington, USA
      • Benji Fisher
        ... [snip] ... [snip] ... should also help. [snip] ... [snip] ... You can get matchit.vim from my web pages: http://sites.netscape.net/BBenjiF/vim/#matchit I
        Message 3 of 7 , Jun 3, 2001
        • 0 Attachment
          William Lee wrote:
          >
          > Dave McCooey wrote:
          > >
          [snip]
          > > (1) How can I change the colors used for syntax highlighting.
          > > For example, the blue used for C-style comments is way too dark on
          > > my system.
          >
          [snip]
          > :help syntax

          :help :syn-default-override

          should also help.

          [snip]
          > > (3) I would like the '%' command to work on angle brackets ("<" and ">")
          [snip]
          >
          > I'm not quite sure about matching "<" and ">", but there's an excellent
          > package called matchit.vim. It can even match html tags and other
          > things. With it, you can even jump from the <table> to the matching
          > </table> tags. There maybe some other ways to do what you want.

          You can get matchit.vim from my web pages:
          http://sites.netscape.net/BBenjiF/vim/#matchit
          I am pretty sure that this will not work with Vim 5.2, though. You can
          also use the 'matchpairs' option if all you want is to match < with >.

          [snip]
          > > (5) When switching back and forth between two files (using :e#), the vim
          > > editor
          > > does not preserve the exact set of lines being shown within the file
          > > that were
          > > showing originally. It does this, I believe, so that the line on
          > > which the cursor
          > > lies ends up in the middle of the screen. Vim behaves like the
          > > original vi in
          > > this respect. Is it possible to disable this auto-centering
          > > behavior in vim?

          I do not know how to change this. Another option is to keep two
          windows open at once. Try

          $ vim foo.c
          :sp foo.html

          and see if you like it.

          :help windows

          A lot of features were added with Vim versions 5.3 and 5.4, and there
          have been four bug-fix releases since then. I think that a lot of the
          advice you get will not work on version 5.2. Most users find that
          upgrading is very smooth.

          HTH --Benji Fisher
        • Jeff Turner
          ... It s background for me. Wow.. I ve had it set wrong for so long.. it s almost blinding ;) To everyone: don t just assume it s correct! Type set
          Message 4 of 7 , Jun 3, 2001
          • 0 Attachment
            On Fri, Jun 01, 2001 at 05:39:54PM -0700, William Lee wrote:
            >
            >
            > Dave McCooey wrote:
            > >
            > > Hi,
            > >
            > > I started using vim recently, and there are five things that I
            > > cannot figure out how to do in vim, or whether they are even
            > > possible.
            > >
            > > (1) How can I change the colors used for syntax highlighting.
            > > For example, the blue used for C-style comments is way too dark on
            > > my system.
            >
            > I usually don't change the syntax highlighting. I do a
            >
            > :set bgcolor=dark

            It's "background" for me. Wow.. I've had it set wrong for so long.. it's almost
            blinding ;)

            To everyone: don't just assume it's correct! Type "set background?" to make
            sure.

            [..]
            > > (3) I would like the '%' command to work on angle brackets ("<" and ">")
            > >
            > > the way it works on other matched-pair characters. This is very
            > > useful in HTML files and other files with similar angle-bracket
            > > syntaxes. The previous vi-like editor I used did this, but vim
            > > does not (at least by default). Is there a way to enable this?
            >
            > I'm not quite sure about matching "<" and ">", but there's an
            > excellent package called matchit.vim. It can even match html tags and
            > other things. With it, you can even jump from the <table> to the
            > matching </table> tags. There maybe some other ways to do what you
            > want.

            Ah lovely.. this in combination with vim6.0 HTML indenting.. life is sweet ;)

            thanks,

            --Jeff

            [..]
            > --
            > William Lee (Will) | Sendmail Inc.
            > Email: wlee@... | http://www.sendmail.com
            > Tel: (510) 594-5505 |
          • William Lee
            Sorry guys, it should be :set background instead...:) I ve had too much html coding...:) See :help background (note the quote) for more info. Will ... Will
            Message 5 of 7 , Jun 4, 2001
            • 0 Attachment
              Sorry guys, it should be :set background instead...:) I've had too much
              html coding...:)

              See :help 'background' (note the quote) for more info.

              Will

              Peter Bismuti wrote:
              >
              > I can't seem to find this option.
              >
              > A related question is that when I use an xterm I reverse the video so the
              > white background becomes black and the black foreground becomes white. For
              > some reason it never sticks long because some sequence in vim will change
              > it back, something involving the escape key. Anyone seen this before?
              > Know how to fix?
              >
              > Thanks
              >

              Will
            Your message has been successfully submitted and would be delivered to recipients shortly.