Carsten Hoever wrote:
Hi,
at the moment I have to write some code in ancient Fortran77 (don't ask ;-) ). I am nearly going nuts about the fixed column structure a Fortran77 source code has to (at least in my case) obey to:
column function 1 comment sign (c,*) 1-5 statement label 6 continuation sign if line wrap in previous line 7-72 actual code
The problem is that this fixed source form makes it very hard to work with any special tab stop size, even with "Soft tabs" turned on as I don't need to access any column between 1-5, but instead would like to go from 1 to 6 to 7 (and vice versa!).
In emacs I would be able to specifiy a tab stop list, i.e. a list with the actual columns a tab should bring me to, e.g.: 6, 7, 11, 15, 19...
Is there any way to simulate something in Textmate? I am tired of adding and deleting spaces manually in order to obey to that structure.
I think you want to make a command which, taking into account where you are on the current line, inserts the correct number of spaces. The environment variable is $TM_LINE_INDEX, and you should be able to just insert x - $TM_LINE_INDEX spaces, where x is the next number in your list.
In python this would look something like:
#!/usr/bin/env python from os import environ as env from sys import stdout columnList = [1, 5, 6, 10, 14, 18, 22] curPos = env['TM_LINE_INDEX'] spacesLeft = [num - curPos for num in columnList if num - curPos > 0] stdout.write(" " * spacesLeft[0])
Bind this to the ⇥ key, set the input to selected text or line, and set the output to insert text, and you should be all set.
-Jacob