How to set tab size for user defined language?

  • I have a user defined language for BiBTeX.

    I want to set tab size equal 2 but where can it be set?

    Under Settings > Preference > Language the Tab Settings list does not list bibtex (or bib).

    Thanks for your help!

  • Afaik you can’t define it per UDL with npp builtin functionality.
    One workaround might be to set it as default and reconfigure it
    for builtin languages. Obviously works only if this UDL is the only one.
    Another option would be to use some “scripting” language if you want
    to go that way.

  • @Mario-Valle ,

    As far as I know, there isn’t a native way in Notepad++ to change the tab setting on a per-UDL basis.

    That would be nice, and in theory, you could put in a feature request. Unfortunately, the UDL system doesn’t often get bug fixes, let alone feature requests.

    However, there may be a workaround; the underlying Scintilla library has a SCI_SETTABWIDTH message, which you can access through a variety of means, including the PythonScript plugin (editor.setTabWidth(2) will change it to two spaces per tab). With some logic, you could write a PythonScript that determines whether the active editor is editing a BiBTeX-UDL-based file, and if so, run that PythonScript setting. If you have PythonScript, or are willing to install it, someone here should be able to give you pointers on how to implement that logic.

    <edit> You might also need to change SCI_SETTABINDENTS, depending on your Settings > Preferences > Language > Tab Settings > [Default] settings </edit>

Log in to reply