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

18665Re: Five questions about VIM

Expand Messages
  • William Lee
    Jun 1, 2001
      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

      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

      :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

      > 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 |
    • Show all 7 messages in this topic