From 30bd92bb5174070c1d76dec78a33f61164a90d25 Mon Sep 17 00:00:00 2001 From: McAuley Penney Date: Mon, 18 Jul 2022 15:12:14 -0700 Subject: [PATCH] refactor: Actually clean up cfg conditionals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • in the last commit, I modified how the configuration is made so that I could get rid of having to check if configuration options were present before acting. I forgot to remove one, so I did it here • I also removed a reference to an experimental option that I was considering • updated readme --- README.md | 6 +++--- lua/tidy/init.lua | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e82a363..97ba8a0 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ on every `BufWritePre`. ## About -I originally wrote this as a wrapper around a couple of vim regex commands used for formatting files before I began using formatters. These commands are not mine, please see the `Credits` section below for sources. Even with real formatters in my setup now, I still like and use this because I like these specific formats to be applied to every buffer and don't want to have a formatting tool installed for them. There really isn't a reason to have this in a plugin other than wanting to disseminate it for new users or people who didn't know you could do this. You could (should) instead just yank and put the code right in your configuration. +I originally wrote this as a wrapper around a couple of vim regex commands used for formatting files before I began using formatters. These commands are not mine, please see the `Credits` section below for sources. Even with real formatters in my setup now, I still like and use this because I like these specific formats to be applied to every buffer and don't want to have a formatting tool installed for them. ## Installation @@ -28,12 +28,12 @@ use({ ``` ## Configuration -Tidy will work on all buffers using only the basic installation shown above. All configuration options are optional and there are no defaults. The options displayed below are simply examples. +Tidy will work on all buffers using only the basic installation shown above. No configuration options are required. The options displayed below are simply examples. ```lua require("tidy").setup({ filetype_exclude = { "markdown", "python" }, -}) +}) ``` diff --git a/lua/tidy/init.lua b/lua/tidy/init.lua index 26dfcd9..7f81237 100644 --- a/lua/tidy/init.lua +++ b/lua/tidy/init.lua @@ -11,10 +11,6 @@ local function list_to_set(list) end local function is_excluded_ft(opts) - if not opts.filetype_exclude then - return false - end - local ft = vim.api.nvim_buf_get_option(0, "filetype") local ft_set = list_to_set(opts.filetype_exclude) @@ -44,7 +40,6 @@ function M.setup(opts) local defaults = { filetype_exclude = {}, - newline_at_eof = false } opts = vim.tbl_extend("force", defaults, opts or {})