Zen Coding *Fix (2021)
-
Steps: In Notepad++ go to plugins > plugins admin then install zen coding and python scripts. They need to work together for zencoding to function. Restart notepad++ then go back to the plugins menu and click ‘open plugins folder’. You should see the newly created ZenCoding-Python folder. Go into that folder then go into the ZenCodingPython folder. Once inside, notice the npp_zen_coding.py file. Now copy the directory it is in. It should be something like this if you use the default settings: 𝘊:\𝘗𝘳𝘰𝘨𝘳𝘢𝘮 𝘍𝘪𝘭𝘦𝘴 (𝘹86)\𝘕𝘰𝘵𝘦𝘱𝘢𝘥++\𝘱𝘭𝘶𝘨𝘪𝘯𝘴\𝘡𝘦𝘯𝘊𝘰𝘥𝘪𝘯𝘨-𝘗𝘺𝘵𝘩𝘰𝘯\𝘡𝘦𝘯𝘊𝘰𝘥𝘪𝘯𝘨𝘗𝘺𝘵𝘩𝘰𝘯. Now go back to the notepad window and click plugins > python script > show console. Go to the console command line and type sys.path.append(‘𝘱𝘢𝘴𝘵𝘦 𝘥𝘪𝘳𝘦𝘤𝘵𝘰𝘳𝘺 𝘩𝘦𝘳𝘦’) then hit Enter. Finally, type import npp_zen_coding and do not include the .py extension. That’s that! You should be able to expand abbreviations now.
///A temporary fix///
npp_zen_coding.py is the file you need to make zen coding work and for some reason, python can’t ‘find’ it on its own. So you must add its pathway to get to it from the python console. This seems to be only a temporary fix because when I closed the notepad and reopened it later, zen coding stopped working again. I redid those steps which fixed the issue. I’m too lazy after a week of trying to get this thing to work to figure out a permanent system path setup. If that’s even possible. But this is the best solution for now if you’ve tried everything else. -
///So I figured out how to permanently add zencoding to the python path which should solve the problem of it altogether! The answer came to me while I was examining the system paths listed when you type sys.path into python console within notepad++. Some of which I recall typing myself and that’s when it hit me that I could use environment variables to fix my issue.///
Type ‘environment variables’ into search bar on windows. Click ‘edit the system environment variables’ Look for the environment variables button and click it. Check out the value list side of the system variable section. One of the variable names should have values with the same directories as seen within the python console sys.path list. Navigate to this and click edit. On the menu that comes up click new. Paste your ZenCodingPython directory into this field. Click okay and THAT is it. Go into notepad and now you can use zen coding with no more issues!
-
Thank you for sharing your findings, very much appreciated.
-
You probably can also fix the issue by adding this
sys.path.append(‘𝘱𝘢𝘴𝘵𝘦 𝘥𝘪𝘳𝘦𝘤𝘵𝘰𝘳𝘺 𝘩𝘦𝘳𝘦’)
to your PythonScript startup script.
As for the bug though, I think it is related to the plugin itself. So it’s best to find ZenCoding repository and create an issue there.