Install formatter.nvim instead of neoformat
This commit is contained in:
@@ -62,7 +62,7 @@ require("packer").startup(function(use)
|
|||||||
use({"tpope/vim-fugitive"})
|
use({"tpope/vim-fugitive"})
|
||||||
|
|
||||||
-- Formatter
|
-- Formatter
|
||||||
use({"sbdchd/neoformat"})
|
use({"mhartington/formatter.nvim"})
|
||||||
|
|
||||||
use({"caenrique/nvim-toggle-terminal"})
|
use({"caenrique/nvim-toggle-terminal"})
|
||||||
|
|
||||||
@@ -109,9 +109,7 @@ autocmd FileType go,lua set noexpandtab
|
|||||||
|
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
|
||||||
vim.cmd(
|
require("format")
|
||||||
[[autocmd BufWritePre *.js,*.jsx,*.ts,*.tsx,*.html,*.css,*.scss,*.json,*.lua,*.svelte silent Neoformat]])
|
|
||||||
|
|
||||||
require("lsp")
|
require("lsp")
|
||||||
|
|
||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
|
|||||||
33
config/nvim/lua/format.lua
Normal file
33
config/nvim/lua/format.lua
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
local function prettierd()
|
||||||
|
return {
|
||||||
|
exe = "prettierd",
|
||||||
|
args = {vim.api.nvim_buf_get_name(0)},
|
||||||
|
stdin = true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
local function luaformat()
|
||||||
|
return {
|
||||||
|
exe = "lua-format",
|
||||||
|
args = {vim.api.nvim_buf_get_name(0)},
|
||||||
|
stdin = true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
require("formatter").setup({
|
||||||
|
filetype = {
|
||||||
|
javascript = {prettierd},
|
||||||
|
javascriptreact = {prettierd},
|
||||||
|
typescript = {prettierd},
|
||||||
|
typescriptreact = {prettierd},
|
||||||
|
html = {prettierd},
|
||||||
|
css = {prettierd},
|
||||||
|
scss = {prettierd},
|
||||||
|
json = {prettierd},
|
||||||
|
svelte = {prettierd},
|
||||||
|
lua = {luaformat}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd(
|
||||||
|
[[autocmd BufWritePost *.js,*.jsx,*.ts,*.tsx,*.html,*.css,*.scss,*.json,*.svelte,*.lua FormatWrite]])
|
||||||
Reference in New Issue
Block a user