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

Re: editing a file without loading syntax

Expand Messages
  • Stahlman Family
    ... From: To: Stahlman Family Cc: Sent: Saturday, February 05, 2005 11:35 PM Subject:
    Message 1 of 5 , Feb 6, 2005
    • 0 Attachment
      ----- Original Message -----
      From: <drchip@...>
      To: "Stahlman Family" <brettstahlman@...>
      Cc: <vim@...>
      Sent: Saturday, February 05, 2005 11:35 PM
      Subject: Re: editing a file without loading syntax


      > Quoting Stahlman Family <brettstahlman@...>:
      >
      >> What is the best way to load a file (e.g., with view or edit) without
      >> loading any syntax files, but without undoing any syntax that has already
      >> been loaded;...snip
      >
      > I'm not exactly sure what you're looking for here, so here's a case or
      > two:

      Thanks, Dr. Chip. As for the application, I wrote my own Grep utils, which
      uses 'find' to get and cache the list of files for a recursive grep. (I know
      it's in the TODO for vimgrep, but I couldn't wait...) To do the actual grep,
      I use vimgrep if vim version is 70 or greater, but traverse the files
      manually if an older version of Vim is detected. Although I know I could fix
      the line numbering by simply deleting the extra line after a read, I felt it
      was a bit cleaner (conceptually, if not in fact), to edit the actual file
      readonly. Thus, I settled on the use of 'eventignore' rather than a read
      method. (See response to Bram's post for the details.) Actually, though, the
      fact that neither you nor Bram mentioned that method makes me wonder if
      perhaps it suffers from a defect. Since all I'm doing with the file is a
      :global command, which processes all the lines matching the grep pattern, I
      don't really want any autocommands run. It seems to work fine, but I haven't
      been using it for long...

      Anyways, thanks for the excellent examples.

      Brett S.

      >
      > case1: open a new window onto some file w/o syntax highlighting
      > :split
      > :enew
      > :0r somefile
      >
      > (side effect: there'll be an extra blank line at the bottom)
      >
      > case2: blow away current window contents, bring in new file w/o syntax
      > highlighting.
      > :enew
      > :0r somefile
      >
      > (same side effect)
      >
      > case3: get the file's contents into a buffer w/o pausing to do syntax
      > highlighting first
      > :1split
      > :enew
      > :0r somefile
      > :setlocal hidden
      > :$d
      > :q
      >
      > case4: just like case3, but get the file's proper name instead of [No
      > File]
      > :1split
      > :enew
      > :0r somefile
      > :setlocal hidden
      > :$d
      > :file somefile
      > :q
      >
      > Hope that helps,
      > Chip Campbell
      >
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.