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

RE: [VIM] Testing for vim

Expand Messages
  • petesea@bigfoot.com
    ... Didn t see it. I only get a digest of this list, so perhaps I haven t received it yet. ... The problem with which is that it s not available
    Message 1 of 24 , Feb 28, 2003
    • 0 Attachment
      On Fri, 28 Feb 2003, Bowie Bailey wrote:

      > Something like this was suggested before, but I don't remember you
      > commenting on it.

      Didn't see it. I only get a digest of this list, so perhaps I haven't
      received it yet.

      > This could probably be condensed a bit...
      >
      > ------------------------------------------
      > unalias vi > /dev/null 2>&1
      > unalias vim > /dev/null 2>&1
      > vi=`which vi 2>/dev/null`
      > vim=`which vim 2>/dev/null`
      > alias vi=${vim:-$vi}
      > ------------------------------------------
      >
      > The 'unalias' commands are to make sure the 'which' command doesn't give
      > current alias info. You could also use the '--skip-alias' flag on
      > 'which' if your version supports it.
      >
      > The 'vi' alias will be set to the full path of either vim or vi.

      The problem with "which" is that it's not available everywhere... and it
      doesn't always behave the same. I have accounts on several different os's
      and os versions, so the approach needs to rely as little as possible on
      external commands.
    Your message has been successfully submitted and would be delivered to recipients shortly.