4

Say I have document A in which I define a new command, \foo.

I'd like to have \foo{} autocomplete in document A, but document B does not use \foo. Instead, it uses a command \food. I don't want Texstudio to autocomplete to \foo when I'm working in document B.

Is there some way I can have a custom .cwl file load when I am working in document A and a different .cwl when working on document B?

I know I can go and uncheck .cwl files in the autocomplete config, but I'd like to automate this if possible so I don't have to remember to check/uncheck every time I work on something new.

4
  • TeXstudio automatically detects \newcommand definitions and adds these commands to the completer. If you don't need the cwl file to specify special behavior of the command, you can simply leave out cwl files at all. But if you really need cwl files, there is currently no way to automatically load specific ones. Jul 13, 2013 at 22:53
  • Well one of my commands is for referencing, so I put #r after the command in the cwl. This will automatically fill in tag options when I use it, and I'd like to keep this feature active. Is there a way to specify a command as a referencing command without a cwl?
    – DocBuckets
    Jul 14, 2013 at 19:18
  • Sorry, there is currently no way to make this work automatically. But I'll consider your case in the further development. Meanwhile if you don't want to switch the cwls manually you could load both and add * to the less often used command. Then it will only show up in the "all" tab of the completer. (Ok it's a crude workaround, but at least both commands will be known and only one will apprear in the "typical completer tab.) Jul 14, 2013 at 21:26
  • @TimHoffmann Could you make your comment here an answer (unless there has been a change in this in the meantime)
    – Joseph Wright
    Aug 4, 2014 at 12:02

1 Answer 1

5

Reposted the comments above as an answer:

TeXstudio automatically detects \newcommand definitions and adds these commands to the completer. If you don't need the cwl file to specify special behavior of the command, you can simply leave out cwl files at all. But if you really need cwl files, there is currently no way to automatically load specific ones. We'll consider this in the further development.

Meanwhile if you don't want to switch the cwls manually you could load both and add * to the less often used command. Then it will only show up in the "all" tab of the completer. (Ok it's a crude workaround, but at least both commands will be known and only one will appear in the "typical" completer tab.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .