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

Re: How to change the mode for a new file automatically?

Expand Messages
  • Michael Wagner
    * Peng Yu 02.12.2009 ... Hello Peng, I have this in my vimrc. ... function ModeChange() | if getline(1) =~ ^#! | if
    Message 1 of 7 , Dec 3, 2009
    • 0 Attachment
      * Peng Yu <pengyu.ut@...> 02.12.2009

      > When I edit a new .sh file, I always want to 'chmod +x'. I'm wondering
      > if there is a way to make this process automated in vim?

      Hello Peng,

      I have this in my vimrc.
      --------------------------------+
      function ModeChange() |
      if getline(1) =~ "^#!" |
      if getline(1) =~ "/bin/" |
      silent !chmod a+x <afile> |
      endif |
      endif |
      endfunction |
      --------------------------------+
      Hth Michael

      --
      24 hours in a day, 24 beers in a case. Coincidence?
    Your message has been successfully submitted and would be delivered to recipients shortly.