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

114981Re: Vim - plugins, ftplugins, buffers and syntax coloring

Expand Messages
  • AK
    Jun 7, 2010
      On 06/07/2010 07:25 PM, Vladimir Mitrovic wrote:
      > Hello everyone.
      > I'm still pretty new to Vim, and some things are just not clear to me. I
      > Googled, I RTFMed but did not find solution to my problems. So I post here.
      > :)
      > 1. I want to use Vim for coding purposes. I mainly program in Python, but
      > recently I started learning haXe. That's where I got into troubles. I
      > downloaded the haxe.vim syntax file and put it in my ~/.vim/plugin/
      > directory. Since global plugins load at startup (I made sure it was the case
      > by adding echo "Hello from ~/.vim/plugin/haxe.vim" at the end of haxe.vim
      > :)), everything looks great when I edit a .hx file with Vim (:set syntax
      > returns syntax=haxe). But when I switch buffers (either by :next or by using
      > MinuBufExplorer), syntax coloring is lost (:set syntax returns syntax=).
      > Then what I do is I type :source ~/.vim/plugin/haxe.vim and everything is
      > alright again.
      > So my first question is: WHY this happens and HOW do I prevent it from
      > happening?

      Well, syntax files should go into ~/.vim/syntax/.

      > 2. Since there are different tab spacing conventions for different
      > languages, I want to set it according to my preferences. With Python, I put
      > a bunch of setlocal directives for tabstop, smarttab, number etc. and it
      > works fine. Still, sometimes when I switch buffers, I lose syntax coloring
      > but I'm able to bring it back by typing :syntax on.
      > So I wanted to do the same with haXe. I didn't know I couldn't just write a
      > haxe.vim file, put it in ~/.vim/ftplugin/ and start coding, only later I
      > learned that I had to put an autocmd for *.hx to set filetype=haxe on
      > BufRead and BufNewFile. But when I did that, haxe.vim from ftplugin loaded,
      > but I lost syntax coloring (altthough both haxe.vim loaded.) My second
      > question: how to make settings from ftplugin/haxe.vim not overwrite
      > plugin/haxe.vim (I guess that's what this is all doing.)

      I think you want to do something like BufRead,BufLoad *.py setlocal ....

      in your .vimrc.


      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 4 messages in this topic