diff options
author | Abouzar Parvan <[email protected]> | 2021-07-14 04:19:36 +0430 |
---|---|---|
committer | GitHub <[email protected]> | 2021-07-13 19:49:36 -0400 |
commit | de7ec62f5fde20ca1d7e53ed83a0077f8945f67c (patch) | |
tree | 1d54b2232489e53a98025825ed550c28e7adea95 /ftplugin/sh.lua | |
parent | 6bbc082f5758cdb57ecb25f270e5558ab63d3754 (diff) |
Added default formatters (#908)
* added default formatters for a couple of langs
* fix: sugesstions from tastyep
* allow users to change default formatters
* suggestion: mellow pointed out the telescope issue
* we don't need to use formatter.setup
Diffstat (limited to 'ftplugin/sh.lua')
-rw-r--r-- | ftplugin/sh.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ftplugin/sh.lua b/ftplugin/sh.lua index 2c96dfd1..54002f19 100644 --- a/ftplugin/sh.lua +++ b/ftplugin/sh.lua @@ -1,3 +1,17 @@ +O.formatters.filetype["sh"] = { + function() + return { + exe = O.lang.sh.formatter.exe, + args = O.lang.sh.formatter.args, + stdin = not (O.lang.sh.formatter.stdin ~= nil), + } + end, +} + +require("formatter.config").set_defaults { + logging = false, + filetype = O.formatters.filetype, +} if not require("lv-utils").check_lsp_client_active "bashls" then -- npm i -g bash-language-server require("lspconfig").bashls.setup { @@ -26,7 +40,7 @@ if not require("lv-utils").check_lsp_client_active "efm" then -- init_options = {initializationOptions}, cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" }, init_options = { documentFormatting = true, codeAction = false }, - root_dir = require("lspconfig").util.root_pattern(".git/"), + root_dir = require("lspconfig").util.root_pattern ".git/", filetypes = { "sh" }, settings = { rootMarkers = { ".git/" }, |