GithubHelp home page GithubHelp logo

orbitalquark / textadept-format Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 48 KB

Code formatting module for Textadept.

License: MIT License

Makefile 9.23% Lua 90.77%
textadept textadept-module formatter formatting

textadept-format's Introduction

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

format.commands <table>

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:

  • ---:
  • /**:

format.line_length

The maximum number of characters to allow on a line when reformatting paragraphs. The default value is 100.

format.on_save

Whether or not to invoke a code formatter on save. The default value is true.

Functions defined by format

format.code()

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.paragraph()

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, it is not reformatted. If the last line matches any of the lines in format.ignore_footer_lines, it is not reformatted.

See also:


textadept-format's People

Contributors

orbitalquark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

lifecanvs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.