Skip to content

ixtenu/ta-editorconfig-sc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Self-Contained Textadept EditorConfig Plugin

DISCLAIMER

The code in this repository was generated by a large language model (LLM). It seems to work, but caveat emptor.

Description

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_style
  • indent_size
  • tab_width
  • end_of_line

Note that the official plugin has support for more properties, specifically charset, trim_trailing_whitespace, and insert_final_newline.

Usage

mkdir -p ~/.textadept/modules
git clone https://github.com/ixtenu/ta-editorconfig-sc ~/.textadept/modules/editorconfig-sc
$EDITOR ~/.textadept/init.lua

In ~/.textadept/init.lua:

local editorconfig = require('editorconfig-sc')
editorconfig.setup()

Additional Textadept Configuration

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

About

Alternative self-contained EditorConfig plugin for Textadept

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages