mirror of
https://github.com/sadan4/nvim.git
synced 2025-06-08 04:43:03 -04:00
theres still more to do
This commit is contained in:
commit
641621a88a
13 changed files with 447 additions and 0 deletions
66
lua/setupformat.lua
Normal file
66
lua/setupformat.lua
Normal file
|
@ -0,0 +1,66 @@
|
|||
-- BY LANG
|
||||
-- https://github.com/mhartington/formatter.nvim/tree/master/lua/formatter/filetypes
|
||||
-- Utilities for creating configurations
|
||||
local util = require("formatter.util")
|
||||
|
||||
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
|
||||
require("formatter").setup({
|
||||
-- Enable or disable logging
|
||||
logging = true,
|
||||
-- Set the log level
|
||||
log_level = vim.log.levels.WARN,
|
||||
-- All formatter configurations are opt-in
|
||||
filetype = {
|
||||
-- Formatter configurations for filetype "lua" go here
|
||||
-- and will be executed in order
|
||||
kotlin = {
|
||||
require("formatter.filetypes.kotlin").ktlint,
|
||||
function()
|
||||
return {
|
||||
exe = "ktlint",
|
||||
args = {
|
||||
"--stdin",
|
||||
"--format",
|
||||
"--log-level=none",
|
||||
},
|
||||
stdin = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
lua = {
|
||||
-- "formatter.filetypes.lua" defines default configurations for the
|
||||
-- "lua" filetype
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
|
||||
-- You can also define your own configuration
|
||||
function()
|
||||
-- Supports conditional formatting
|
||||
if util.get_current_buffer_file_name() == "special.lua" then
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Full specification of configurations is down below and in Vim help
|
||||
-- files
|
||||
return {
|
||||
exe = "stylua",
|
||||
args = {
|
||||
"--search-parent-directories",
|
||||
"--stdin-filepath",
|
||||
util.escape_path(util.get_current_buffer_file_path()),
|
||||
"--",
|
||||
"-",
|
||||
},
|
||||
stdin = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Use the special "*" filetype for defining formatter configurations on
|
||||
-- any filetype
|
||||
["*"] = {
|
||||
-- "formatter.filetypes.any" defines default configurations for any
|
||||
-- filetype
|
||||
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||
},
|
||||
},
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue