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

Re: How to identify filetype during plugin initialization?

Expand Messages
  • Andre Costa
    Hi Luc, On Wed, 24 Sep 2003 01:17:40 +0200 ... Actually, I did download and analyzed EnhancedCommentify before starting, and I did base my work on it. Details
    Message 1 of 3 , Sep 25, 2003
    • 0 Attachment
      Hi Luc,

      On Wed, 24 Sep 2003 01:17:40 +0200
      Luc Hermitte <hermitte@...> wrote:

      > Why don't you try to play with the code of one of the "commentifiers"
      > like EnhancedCommentify for instance.

      Actually, I did download and analyzed EnhancedCommentify before
      starting, and I did base my work on it. Details below...

      > When you the call the function that will toggle the comment on a line,
      > test the value of &ft. That's all.
      >
      > if &ft == 'cpp' | echo "I'm editing a C++ file"
      > elseif &ft == 'vim' | echo "I'm editing a VimL file"

      Right, that did the trick. The reason why it was not working was because
      I was not using it inside of my commentify function, but instead as part
      of the plugin initialization code (i.e. code outside any function). I
      moved my filetype identification code inside the function, and it
      "automagically" works =) I guess that at the time the script is loaded,
      &ft simply doesn't exist.

      This goes to prove I still have a lot to understand about scope,
      buffers, initialization routines etc. =/ (BTW: I did read vim excellent
      docs about plugins and startup procedures, I probably overlooked this
      particular information)

      [...]
      > Do check plugins like EnhancedCommentify.

      I did that, I just didn't make it clear on my original msg. Sorry.

      Thank you very much for the tip, now I got it fully working =)

      Best,

      Andre

      --
      Andre Oliveira da Costa
    Your message has been successfully submitted and would be delivered to recipients shortly.