ProgerXP / Notepad2e

Word highlighting, simultaneous editing, split views, math evaluation, un/grep, comment reformatting, UAC elevation, complete regexps (PCRE), Lua lexers, DPI awareness and more (XP+)
Other
374 stars 52 forks source link

Toggle "Insert Tabs as Spaces" by filetype #203

Open PranavMathur opened 5 years ago

PranavMathur commented 5 years ago

I use tabs for most indentation in most programs, but I have to use spaces when coding in Python. When I'm using Notepad2e to quickly edit a .py, I always have to remember to select the "Insert Tabs as Spaces" option, and then to turn it off when I open a non-.py file.

Currently, the option is stored in the .ini file as "TabsAsSpaces". This option could be kept as the default option, and per-filetype options could be stored with the per-filetype syntax schemes.

Please let me know if this is a Scintilla thing and not a Notepad2 thing. Thank you!

ProgerXP commented 5 years ago

You are thinking in terms of vim's autocommands but Notepad 2e will never offer such flexibility. However, there are two possible solutions to this problem although neither is perfect:

  1. Your best bet IMHO - utilizing several INI files. Create a file system association for .py files which launches Notepad2e.exe /f c:\my-python-config.ini. The /f switch sets the location of the INI file. For other file types, the default INI file will be used, with your choice of tabs. Read more about INI location in the README.
    • first downside: you can't merge two INI files together meaning that INI file has to contain all settings; it can't read "missing" settings from your default INI file
    • second downside: works only for existing files; if a Notepad 2e instance ran without /f does File > New and then Save as a .py - it will still use tabs
    • but if you typically open .py files from Explorer, you can add a .py template to the Explorer's New menu and then open the just created blank file
  2. Using an editor that supports EditorConfig (request #179). It's like vim's modeline and exrc, allowing to set settings dependong on the location of the file being edited. But it's not supported in Notepad 2e and also works for only new files or files in a specific directory.

Please let me know if this is a Scintilla thing and not a Notepad2 thing. Thank you!

It's certainly not Scintilla's - Scintilla is just a formatted text manager, it's not handling who and how sets various settings.