Enable/disable word wrap by language?

bju
2011-05-02
2012-11-13
  • bju
    bju
    2011-05-02

    I am using NPP for coding and text editing at the same time (two tabs in the same instance).  Can I enable word wrap for the editing but disable it for the coding?  Maybe there is a way to set word wrap automatically for different languages?

    Thanks Bert

     
  • cchris
    cchris
    2011-05-02

    Actually, there was a per view wrap setting in older versions of Notepad++, but this has been simplified out.
    You can post your feature requests on IdeaTorrent.

    CChris

     
  • Just proposed a solution using Python Script (not a perfect solution obviously, but works, and does exactly what you want)

    • The following script will enable word wrap for Text and XML files, it should be obvious how to add other languages (do  help(LANGTYPE)  in the Python Script console for the abbreviations)

      def setWordWrap(args):
      if notepad.getCurrentLang() in (LANGTYPE.TXT, LANGTYPE.XML):
      editor.setWrapMode(WRAP.WORD)
      else:
      editor.setWrapMode(WRAP.NONE)

      notepad.callback(setWordWrap, [NOTIFICATION.LANGCHANGED, NOTIFICATION.BUFFERACTIVATED])

    Cheers,
    Dave

     
  • bju
    bju
    2011-05-03

    Fantastic, thanks Dave!

    I couldn't figure out how to make NPPExec call this script on startup.  But I appended your script to Python Script's startup.py.  It becomes and remains active upon switching tabs.

    Cheers, Bert