0

So I started learning Scala today and I got all my vim config files working for Scala syntax highlighting and such, but the files I downloaded (http://lorenzod8n.wordpress.com/2008/01/11/getting-scala-syntax-hightlighting-to-work-in-vim/) did not seem to include the apparent Scala convention of indent by 2 spaces.

Since for my job I mostly work in C++ and Python, I currently have my set tabstop=4.

I've been trying to figure out how to use the if/endif statements for .vimrc files to do set tabstop=2 if the extension if *.scala, otherwise use tabstop=4 but not having much luck.. help?

Thanks!

-kshot

adelbertc
  • 7,270
  • 11
  • 47
  • 70
  • 2
    Your question might be answered here: http://stackoverflow.com/questions/6012470/possible-to-change-length-of-tab-depending-on-file-extension – Aayush Kumar Feb 15 '12 at 04:45
  • possible duplicate of [Changing Vim indentation behavior by file type](http://stackoverflow.com/questions/158968/changing-vim-indentation-behavior-by-file-type) – Ben Feb 15 '12 at 08:40
  • You know that Scala comes with a vi mode, yes? See `scala/misc/scala-tool-support/vim`. – fotNelton Feb 15 '12 at 11:24
  • FWIW, I use [Derek Wyatt's fork](https://github.com/derekwyatt/vim-scala) of the Scala bundle for vim, though I might switch to one of the alternatives with more recent updates. – Daniel C. Sobral Feb 16 '12 at 13:25
  • So, I now have [my own fork](https://dcsobral@github.com/dcsobral/vim-scala.git) of the vim bundle for Scala. Limited support for compilation from vim as well. – Daniel C. Sobral Feb 16 '12 at 15:13

1 Answers1

4
set tabstop=4
au BufNewFile,BufRead *.scala set tabstop=2
kev
  • 155,172
  • 47
  • 273
  • 272