Sublime Forum

Altering the value of a shell variable

#1

Hi,

I am using ST3. Say I have defined a shell variable MY_VAR with a value of “1234”, so my tmPreferences file contains the following lines :

		<dict>
			<key>name</key>
			<string>MY_VAR</string>
			<key>value</key>
			<string>1234</string>
		</dict>

And this works fine when I include the variable in a snippet. Now what I’d really like to be able to do is to make the 1234 value user-adjustable, so some other mechanism can be invoked to change the value of MY_VAR occasionally. Is this even possible? Could it be done from the ST console? Or is it easiest just to edit the preferences file when I want to change the value?

Ali

0 Likes

#2

You need to write a plugin that takes user input (e.g. using an input panel) and then write an automatically generated .tmPreferences file. The easiest would be to create a new file in the User package, and replace that file when the command is re-run.

Other than that, you could of course also edit the tmpreferences file directly.

0 Likes

#3

OK, thanks FichteFoll. I’ll give it a whirl. And thanks again for your help. There sure is a lot to learn with this editor, but my feeling is that it’ll be worth the effort!

0 Likes