Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orbitalquark/textadept-format
Code formatting module for Textadept.
https://github.com/orbitalquark/textadept-format
formatter formatting textadept textadept-module
Last synced: about 2 months ago
JSON representation
Code formatting module for Textadept.
- Host: GitHub
- URL: https://github.com/orbitalquark/textadept-format
- Owner: orbitalquark
- License: mit
- Created: 2021-10-22T01:59:46.000Z (about 3 years ago)
- Default Branch: default
- Last Pushed: 2024-09-17T22:32:52.000Z (4 months ago)
- Last Synced: 2024-09-18T03:07:53.930Z (4 months ago)
- Topics: formatter, formatting, textadept, textadept-module
- Language: Lua
- Homepage:
- Size: 54.7 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Format
Format/reformat paragraph and code.
Install this module by copying it into your *~/.textadept/modules/* directory or Textadept's
*modules/* directory, and then putting the following in your *~/.textadept/init.lua*:require('format')
There will be an "Edit > Reformat" menu.
## Key Bindings
Windows and Linux | macOS | Terminal | Command
-|-|-|-
**Edit**| | |
Ctrl+Shift+J | ⌘⇧J | ^J | Reformat paragraph## Fields defined by `format`
Map of lexer languages to string code formatter commands or functions that return such
commands.Fields:
- `lua`:
- `cpp`:
- `go`:
### `format.ignore_file_patterns` <table>Patterns that match filenames to ignore when formatting on save.
This is useful for projects with a top-level format config file, but subfolder dependencies
whose code should not be formatted on save.
### `format.ignore_footer_lines` <table>Footer lines to ignore when reformatting paragraphs.
These can be Doxygen footers for example.Fields:
- `*/`:
### `format.ignore_header_lines` <table>Header lines to ignore when reformatting paragraphs.
These can be LuaDoc/LDoc or Doxygen headers for example.Fields:
- `---`:
- `/**`:The maximum number of characters to allow on a line when reformatting paragraphs. The default
value is 100.Whether or not to invoke a code formatter on save. The default value is `true`.
### `format.prefix_map` <table>Prefixes to remap when reformatting paragraphs.
This is for paragraphs that have a first-line prefix that is different from subsequent
line prefixes. For example, LuaDoc/LDoc comments start with '---' but continue with '--',
and Doxygen comments start with '/**' but continue with ' *'.Fields:
- `[/**]`:
- `[---]`:## Functions defined by `format`
Reformats using a code formatter for the current buffer's lexer language either the selected
text or the current paragraph, according to the rules of `textadept.editing.filter_through()`.See also:
- [`format.commands`](#format.commands)
Reformats using the Unix `fmt` tool either the selected text or the current paragraph,
according to the rules of `textadept.editing.filter_through()`.
For styled text, paragraphs are either blocks of same-styled lines (e.g. code comments),
or lines surrounded by blank lines.
If the first line matches any of the lines in [`format.ignore_header_lines`](#format.ignore_header_lines), it is not
reformatted. If the last line matches any of the lines in [`format.ignore_footer_lines`](#format.ignore_footer_lines),
it is not reformatted.See also:
- [`format.line_length`](#format.line_length)
---