GithubHelp home page GithubHelp logo

tidy.nvim's People

Stargazers

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

Watchers

 avatar

tidy.nvim's Issues

Provide option to run the cleanup manually

In some cases (for example when using real-time preview for markdown or tex files) many saves can happen.
This causes the plugin to repeatedly delete trailing whitespaces while writing.
For situations like these it could be useful to stop the plugin and run it manually.
A function to stop the plugin and a function to run the cleanup could be provided.

Typo in readme with lazy config

{
    "mcauley-penney/tidy.nvim",
    config = {  -- <----------------------------- here
        filetype_exclude = { "markdown", "diff" }
    },
    init = function()
        vim.keymap.set('n', "<leader>te", require("tidy").toggle, {})
    end
}

In the above snippet it should be opts instead of config I believe

Disable tidy for markdown

Hi! I'm trying to migrate my vim config to lua, and stumbled upon this plugin, which looks great, except for one thing: it uses Markdown as an example for the main usage, and Markdown is the only file format I know for which trailing whitespace is meaningful. I don't use it and no longer work with people who do so I'm still going to use your plugin, but still, it would be nice to be able to disable this plugin for markdown only.

Error when writing `:w` file when tidy.nvim is enabled

Received an error when writing file.

Error detected while processing BufWritePre Autocommands for "*":
Error executing lua callback: ...config/nvim/autoload/plugged/tidy.nvim/lua/tidy/init.lua:17: attempt to call field 'list_contains' (a nil value)
stack traceback:
        ...config/nvim/autoload/plugged/tidy.nvim/lua/tidy/init.lua:17: in function 'is_excluded_ft'

vim code became unnecessary

You can use now with neovim master

vim.api.nvim_create_augroup('MYAUCMDS',  {clear = true})
vim.api.nvim_create_autocmd('BufWritePre', {group = 'MYAUCMDS', pattern = '*', command = [[:keepjumps keeppatterns %s/\s\+$//e]]}) -- remove trailing spaces

Also, I dont understand what you want to preserve in the undotree.
Marks will be lost, if they correspond to deleted text. You would need to tell neovim how the text was moved, once parts get deleted.
But you only delete empty lines, which should not have marks. So its unclear to me, what behavior has problems.

Also Remove Unnecessary Leading Whitespace

Use this C program as an example:

 #include <stdio.h>

int main(void)
{
    printf("%s\n", "Hello world");
}

Notice the unnecessary leading space in front of #include <stdio.h>. After writing to the file, the result should be this:

#include <stdio.h>

int main(void)
{
    printf("%s\n", "Hello world");
}

The leading whitespace in front of printf should not be deleted because it is used for indentation. This should work if someone indents with tabs or spaces. I am not sure how to implement this myself, so I am opening an issue instead of a pull request.

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.