This script isn't written by me, but I found it on StackOverflow and find it very usefull.
You add this to your startup.py and every time the buffer is switched, it tries to detect automatically if the file is using tabs or spaces. I made one small change to check only the first 100 lines of the file because it was slow for very large files.
As stated on stackoverflow, it could be improved by storing the setting for open files.
One problem I notices is, it isn't called if notepad++ is started by opening a file. If I then add another empty file and switch back, it works. Maybe someone who knows which callback to use could add this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This script isn't written by me, but I found it on StackOverflow and find it very usefull.
You add this to your startup.py and every time the buffer is switched, it tries to detect automatically if the file is using tabs or spaces. I made one small change to check only the first 100 lines of the file because it was slow for very large files.
As stated on stackoverflow, it could be improved by storing the setting for open files.
One problem I notices is, it isn't called if notepad++ is started by opening a file. If I then add another empty file and switch back, it works. Maybe someone who knows which callback to use could add this.
You can use this improved version that works from the startup file, not only on tab switch : https://gist.github.com/vincepare/8a204172d959defb2122