Skip to content

Commit

Permalink
Merge pull request #48 from joshuachp/feature/terrafrom-fmt
Browse files Browse the repository at this point in the history
feat(fmt): add terraform formatter
  • Loading branch information
joshuachp authored Jan 19, 2024
2 parents 63e110e + 9e5cb15 commit 3722458
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lua/plugins/formatter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ local function shell_format()
return { exe = 'shfmt', args = { '-i', '4', '-ci' }, stdin = true }
end

-- terraform
local function terraform_fmt()
return { exe = 'terraform', args = { 'fmt', '-' }, stdin = true }
end

-- rustfmt
local function rustfmt()
return { exe = 'rustfmt', args = { '--emit=stdout' }, stdin = true }
end

--- Pass to formatter.nvim plugin config
local function formatter_config()
require('formatter').setup({
Expand All @@ -57,18 +67,15 @@ local function formatter_config()
},
sh = { shell_format },
zsh = { shell_format },
rust = {
function()
return { exe = 'rustfmt', args = { '--emit=stdout' }, stdin = true }
end,
},
rust = { rustfmt },
go = {
function()
return { exe = 'gofmt', args = {}, stdin = true }
end,
},
c = { clang_format },
cpp = { clang_format },
terrafrom = { terraform_fmt },

-- Prettier
php = { prettier },
Expand Down

0 comments on commit 3722458

Please sign in to comment.