[Tex/LaTex] How to complete placeholders is TeXstudio using keyboard

texstudio

I know how to jump between placeholders in TeXstudio, but not how to exit them. In Eclipse and other editors with similar functionality, I press enter and then the placeholder
disappears and the cursor is (usually) placed after the inserted text. It TexStudio when I press enter, the placeholders disappears but it also treats the enter as a character input, inserting a new line and overwriting any selected text. This is pretty useless, especially when filling out text between brackets where you as good as never want a newline.

How can I exit/finalize/complete placeholders in a template, without inserting extra text/newlines.

Thank you.

EDIT I am using both mac and windows on and off, so please share hotkeys for as many platforms you know 🙂

Best Answer

There is currently no builtin functionality for this. As a workaround you can create a script (Menu Macros -> Edit Macros...)

%SCRIPT
var phID = editor.currentPlaceHolder();
if (phID >= 0) {
    editor.removePlaceHolder(phID);
} else {
    editor.insertText('\n');
}

Then go to Options -> Shortcuts and bind the Return key to that Skript (You need to actually type return in the dropdown box because it's not in the dropdown list).

Note: Most of the time, placeholders are used for parameters in brackets. There you can simply continue typing the corresponding closing bracket and the placeholder will vanish. But I think the return is a reasonable addition to the concept and we will natively support it in the next release of TXS.

Related Question