|
|
|
@ -3,18 +3,30 @@ |
|
|
|
local function configure_conform() |
|
|
|
local function configure_conform() |
|
|
|
local conform = require("conform") |
|
|
|
local conform = require("conform") |
|
|
|
-- Keymaps |
|
|
|
-- Keymaps |
|
|
|
vim.keymap.set({"n", "v"}, "<leader>f", function() conform.format({}) end, {silent = true}) |
|
|
|
vim.keymap.set( |
|
|
|
|
|
|
|
{"n", "v"}, |
|
|
|
|
|
|
|
"<leader>f", |
|
|
|
|
|
|
|
function() |
|
|
|
|
|
|
|
conform.format( |
|
|
|
|
|
|
|
{}, |
|
|
|
|
|
|
|
function(err) |
|
|
|
|
|
|
|
if not err then |
|
|
|
|
|
|
|
local mode = vim.api.nvim_get_mode().mode |
|
|
|
|
|
|
|
if vim.startswith(string.lower(mode), "v") then |
|
|
|
|
|
|
|
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "n", true) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
end, |
|
|
|
|
|
|
|
{silent = true} |
|
|
|
|
|
|
|
) |
|
|
|
-- vim.o.formatexpr = "v:lua.require('conform').formatexpr()" |
|
|
|
-- vim.o.formatexpr = "v:lua.require('conform').formatexpr()" |
|
|
|
-- Configure conform |
|
|
|
-- Configure conform |
|
|
|
local opts = { |
|
|
|
local opts = { |
|
|
|
formatters_by_ft = { |
|
|
|
formatters_by_ft = { |
|
|
|
julia = {"runic"}, |
|
|
|
julia = {"runic"}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
formatters = { |
|
|
|
|
|
|
|
runic = { |
|
|
|
|
|
|
|
command = "runic", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
default_format_opts = { |
|
|
|
default_format_opts = { |
|
|
|
timeout_ms = 10000, |
|
|
|
timeout_ms = 10000, |
|
|
|
}, |
|
|
|
}, |
|
|
|
@ -24,5 +36,6 @@ end |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
"stevearc/conform.nvim", |
|
|
|
"stevearc/conform.nvim", |
|
|
|
|
|
|
|
commit = "db8a4a9edb217067b1d7a2e0362c74bfe9cc944d", |
|
|
|
config = configure_conform, |
|
|
|
config = configure_conform, |
|
|
|
} |
|
|
|
} |
|
|
|
|