nvim: formatter.nvim

This commit is contained in:
Cat /dev/Nulo 2021-11-18 12:24:01 -03:00
parent e78b379f28
commit 8427185784
3 changed files with 29 additions and 0 deletions

View file

@ -50,8 +50,33 @@ for _, lsp in ipairs(servers) do
on_attach = on_attach, on_attach = on_attach,
} }
end end
local prettier = {
function()
return {
exe = "prettier",
args = {"--stdin-filepath", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0))},
stdin = true
}
end
}
require('formatter').setup({
filetype = {
javascript = prettier,
typescript = prettier,
html = prettier,
css = prettier,
scss = prettier,
sass = prettier,
}
})
EOF EOF
augroup FormatAutogroup
autocmd!
autocmd BufWritePost *.js,*.ts,*.html,*.css,*.scss,*.sass FormatWrite
augroup END
let g:fzf_layout = { 'down': '40%' } let g:fzf_layout = { 'down': '40%' }
noremap <space>f :Files<return> noremap <space>f :Files<return>

@ -0,0 +1 @@
Subproject commit 0cdce2da8762ee01ee7d8df047b6e569d58c1ba3

3
.gitmodules vendored
View file

@ -22,3 +22,6 @@
[submodule ".config/nvim/pack/plugins/start/fzf"] [submodule ".config/nvim/pack/plugins/start/fzf"]
path = .config/nvim/pack/plugins/start/fzf path = .config/nvim/pack/plugins/start/fzf
url = https://github.com/junegunn/fzf url = https://github.com/junegunn/fzf
[submodule ".config/nvim/pack/plugins/start/formatter.nvim"]
path = .config/nvim/pack/plugins/start/formatter.nvim
url = https://github.com/mhartington/formatter.nvim