The code in this repository was generated by a large language model (LLM). It seems to work, but caveat emptor.
This is an alternative EditorConfig plugin for the Textadept text
editor. Unlike the official plugin, this one is entirely
self-contained: it does not depend on editorconfig-core-lua. All the
.editorconfig parsing is done internally in the plugin's init.lua.
The only supported EditorConfig properties are:
indent_styleindent_sizetab_widthend_of_line
Note that the official plugin has support for more properties,
specifically charset, trim_trailing_whitespace, and insert_final_newline.
mkdir -p ~/.textadept/modules
git clone https://github.com/ixtenu/ta-editorconfig-sc ~/.textadept/modules/editorconfig-sc
$EDITOR ~/.textadept/init.luaIn ~/.textadept/init.lua:
local editorconfig = require('editorconfig-sc')
editorconfig.setup()The trim_trailing_whitespace property is not supported by this plugin.
Personally, I always want that behavior enabled, except when hand-editing a
patch file. To accomplish that, copy the below snippet into
~/.textadept/init.lua.
-- Always strip trailing spaces, except in patch files.
local function set_strip_trailing_spaces()
textadept.editing.strip_trailing_spaces = buffer.lexer_language ~= 'diff'
end
events.connect(events.LEXER_LOADED, set_strip_trailing_spaces)
events.connect(events.BUFFER_AFTER_SWITCH, set_strip_trailing_spaces)
events.connect(events.VIEW_AFTER_SWITCH, set_strip_trailing_spaces)The insert_final_newline property is not supported by this plugin.
Personally, I always want that behavior enabled. To accomplish that, copy the
below snippet into ~/.textadept/init.lua.
-- Always ensure final newline (this is false by default on Windows)
io.ensure_final_newline = true