Code Monkey home page Code Monkey logo

lite-formatters's Introduction

Formatters for lite and lite-xl

List of formatters (Keep alphabetical)

Installation instructions

  1. Copy the formatter.lua file into the lite/lite-xl data/plugins folder

  2. To install any specific formatter, copy the corresponding file into the data/plugins folder. List of formatters is at the top of this file.

  3. Make sure you have the command that formatter uses installed, or it won't work.

  4. Extra configuration: If you want to customize the cli arguments for a specific formatter, you can do this from your init.lua script. Example:

config.jsbeautify_args = {"-r", "-s 4", "-p", "-b end-expand"} -- set jsBeautify arguments to indent with spaces.

using the formatter

the default keymap to format the current doc is alt+shift+f the command is formatter:format-doc

to format a document at each save add the following config to your user init.lua as shown:

config.format_on_save = true

Adding a formatter

here is an example formatter:

-- mod-version:1 lite-xl 2.00
-- ^^^ lite-xl version tag ^^^
-- for JS Beautify fortmatter
local config = require "core.config"
local formatter = require "plugins.formatter"

config.jsbeautify_args = {"-r", "-q", "-s 1", "-t", "-p", "-b end-expand"} -- make sure to keep -r arg if you change this

formatter.add_formatter {
    name = "JS Beautifier",
    file_patterns = {"%.js$"},
    command = "js-beautify $ARGS $FILENAME",
    args = config.jsbeautify_args
}

a few things to keep in mind

  • make sure to add the lite-xl version tag at the top
  • make sure to keep the arguments inside config.yourformatter_args
  • make sure to set a name
  • make sure to add it to the list in readme.md (and keep it alphabetical)

Then, submit a pull request

lite-formatters's People

Contributors

aiuno avatar averagegabe avatar faetu avatar guscardvs avatar jgmdev avatar mutazashhab avatar nightwing13 avatar perilousbooklet avatar varlad avatar viima-xyz avatar vincens2005 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

lite-formatters's Issues

Issues formatting

the log:

Mon Sep 25 23:25:44 2023 [ERROR] /home/kome/.config/pragtical/plugins/formatter.lua:64: attempt to concatenate local 'filename' (a nil value) at /usr/share/pragtical/core/init.lua:1069

stack traceback:
/home/kome/.config/pragtical/plugins/formatter.lua:64: in function 'perform'
/usr/share/pragtical/core/command.lua:144: in function </usr/share/pragtical/core/command.lua:137>
[C]: in function 'xpcall'
/usr/share/pragtical/core/init.lua:1068: in function 'try'
/usr/share/pragtical/core/command.lua:169: in function 'perform'
/usr/share/pragtical/core/keymap.lua:230: in function 'on_key_pressed'
/usr/share/pragtical/core/init.lua:1086: in function 'on_event'
/usr/share/pragtical/plugins/macro.lua:19: in function </usr/share/pragtical/plugins/macro.lua:18>
[C]: in function 'xpcall'
/usr/share/pragtical/core/init.lua:1068: in function 'try'
/usr/share/pragtical/core/init.lua:1178: in function 'step'
/usr/share/pragtical/core/init.lua:1301: in function 'core_run'
/usr/share/pragtical/plugins/settings.lua:1914: in function 'core_run'
/usr/share/pragtical/plugins/ipc.lua:852: in function 'core_run'
/home/kome/.config/pragtical/plugins/recentfiles.lua:77: in function 'run'
[string "local core..."]:15: in function <[string "local core..."]:6>
[C]: in function 'xpcall'
[string "local core..."]:6: in main chunk

I'm using pragtical which is a fork of lite xl but I'm not all that sure it's a pragtical plugin since they maintain coherence as much as possible to the lite xl project

Formatting file breaks history (undo/redo)

I am editing (mostly) julia files. I noticed that formatting a file with Alt+shift+R breaks the history of file modifications, accessible with undo/redo.
This is particularily unpleasant when formatting an unsaved file, since it is not possible to recover the unsaved edits.

Formatting does not work

Hey,

I added this plugin to my lite-xl install.
When I format either by calling the command directly or save on format, I get log that the formatting was triggered, but I don't see the changes in the file.

I even poked around and logged out the formatting command.Iif I run that in my terminal it works.

The issue is on an apple silicon mac.
Any idea what could it be?

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.