Skip to content

nextpad-plus-plus-plugins/AutoEolFormat.macos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoEolFormat (macOS port)

Automatic EOL-format conversion for Nextpad++ (the macOS port of Notepad++), based on user-defined file classes.

A file class is a group of filename extensions plus a target EOL format (Windows CR LF, Unix LF, or Macintosh CR). Whenever a file is loaded, saved or renamed, or its tab is activated, the plugin looks up the active document's extension, and if it belongs to a file class it converts the document's line endings to that class's EOL format.

The file is not saved automatically after the conversion — you can always discard the change by reloading the file.

This is a from-scratch macOS reimplementation of the Windows AutoEolFormat plugin by Andreas Heim (GPL v3). The original is written in Delphi/Object-Pascal (VCL); only the feature is reproduced here in C++/Objective-C++ — the Delphi source is not compiled.

Menu commands (Plugins ▸ AutoEolFormat)

Command What it does
Settings Manage file classes ↔ filename extensions ↔ target EOL format.
About Plugin info; the "Read some infos" link opens the bundled documentation.

Settings dialog

  • File classes list (left) and Filename extensions list (right).
  • + / Update / - to add, rename/retarget, or delete a file class.
  • EOL format to set popup: Windows (CR LF) / Unix (LF) / Macintosh (CR).
  • New filename extension(s) field — separate multiple extensions with ;. Each is normalised to a leading-dot form (e.g. txt.txt).

Settings are stored as an INI file at ~/Library/Application Support/Nextpad++/plugins/Config/AutoEolFormat.ini, using the same on-disk format as the Windows plugin ([Header] Version=1.0, [Groups], one [ClassName] section per class with EolFormat=<id> and Ext1=…), so configs are interchangeable between platforms.

How the EOL is applied (host note)

On Windows the plugin issues IDM_FORMAT_TODOS/TOUNIX/TOMAC via NPPM_MENUCOMMAND. The macOS host only honours a small built-in whitelist for NPPM_MENUCOMMAND and will not invoke those commands, so the EOL is applied directly through Scintilla with SCI_CONVERTEOLS (convert the whole document) + SCI_SETEOLMODE (set the mode for new text). This is functionally identical and needs no host change.

Building

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
cmake --install build     # → ~/Library/Application Support/Nextpad++/plugins/AutoEolFormat/

Produces a universal (arm64;x86_64) AutoEolFormat.dylib.

License

GPL v3 — see LICENSE. Original plugin © 2018–2023 Andreas Heim.

About

macOS port of the AutoEolFormat Notepad++ plugin: auto-convert document EOL (CRLF/LF/CR) by user-defined file classes (filename-extension groups). Reimplemented in C++/Objective-C++ for Nextpad++.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors