Click to See Complete Forum and Search --> : vim, emacs compatibility


kashirat
09-09-2003, 12:48 AM
Hey everyone,

I'm having a little problem with regards to emacs and vim. I'm in some group (programming) projects at school and a few of us use vim and a few use emacs. Unfortunately for some reason emacs likes to put spaces instead of the tab characters, so the formatting in the source is all wacky when the file is worked on by a few users...

Is there a way to make emacs use tabs instead of replacing tabs with spaces?

Has anyone had this problem? What did you do to solve it ?

I know its just something minor but its really frustrating after awhile :o

Thanks for your time!

'kash

mage492
09-09-2003, 12:57 AM
Well, I don't know how to change the behavior of the editors, themselves, but here's a quick fix (which is perfect for a programming class).

Write a program that reads spaces after a line break and converts them to tabs (or vice versa) in an input file. Then, run this program on your source code.

Again, it's just a quick and dirty fix, but it'll work...

Of course, you could always offer an incentive to the student who submits this program first... A little competition never hurt anyone!

kashirat
09-09-2003, 01:07 AM
aye, I was considering that, but I was hoping for a solution within the program itself ;) That program would definately be doable, but if you're saving a lot and updating and stuff it would probably get pretty tiresome to run all the source through your program every time...

Thanks for the suggestion though :p

'kash

X_console
09-09-2003, 07:57 AM
Check the documentation for emacs, it should be there somewhere. For vim you can configure it to use either spaces or tabs, so it would seem weird that it's number one competitor does not have this feature. :)

mindcooler
09-09-2003, 08:24 AM
If you want the code to look the same no matter which editor you choose to view it with, use spaces instead of tabs. The 'size' of a tab varies and a lot of editors have just too great a size (by default) to make readable code. So the solution to your problem is not to make Emacs use tabs but Vim to use spaces for indenting. That way the code will look the same no matter what editor you view it (not taking fonts into consideration, but who codes with a non-fixed-width font?).