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 apologize if this has already been discussed, a search in the WiKi and the archives didn't bring up anything.
Bye,
Carsten
BTW: Congrats for the award Allan, TextMate really deserved it!
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
Anything that binds to the tab key is going to prevent tab triggers from working. And who wants to run a subprocess each time they hit the tab key? I think something like this would need to be implemented within the editor itself.
On Aug 10, 2006, at 5:26 AM, Jacob Rus wrote:
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
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 10.08.2006 um 14:26 schrieb Jacob Rus:
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:
[...]
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.
Thanks, I don't have time to actually check out if this works as expected, but it really looks promising... :-)
Bye,
Carsten