Change ${USER} environment variable in Intellij IDEA
Asked Answered
M

2

1

Intellij IDEA has class/file templates like this:

/**
 * Created by ${USER} on ${DATE}.
 */

where ${USER} by default is logged in user name (or licensed user name for Ultimate versions).

I need to have name in file templates different from logged in OS user name. How can I change in IDEA this variable?

What I can, but this it not what i'm looking for:

  • Change template header directly. NO, I need to change variable for all templates and other usages in the IDE.
  • start IDEA from bat/cmd/lnk whatever with changed %USERNAME% OS environment variable. NO, I'm looking for solution in IDEA settings, not runtime settings.
  • changing idea.exe.vmoptions (idea64.exe.vmoptions) like described in this and this answers may be a good solution, but has some disadvantages (applies changes system wide, requires admin privileges).

So, the main idea: is it possible in IDEA to set variable values in local user settings?

Mizzle answered 25/12, 2015 at 22:33 Comment(1)
Possible duplicate of IntelliJ IDEA override $userSelmaselman
M
1

So, finally on Jetbrains bug tracker i found this issue, and apparently no fix for it is planned. If you are interested in some solution - vote for the feature request.

Mizzle answered 26/12, 2015 at 22:34 Comment(0)
D
1

It's not easy.

In IdealC2020,you can click menu Help-> Edit Custom VM Options.

you should append a line:

-Duser.name=authorNameX

then you restart IDEA , it works.

Dovap answered 2/7, 2020 at 7:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.