more changes, maybe nicer now?
This commit is contained in:
parent
89ab8c246f
commit
496bdcc57f
@ -1,6 +1,6 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.autoformat = false
|
M.autoformat = true
|
||||||
|
|
||||||
function M.toggle()
|
function M.toggle()
|
||||||
M.autoformat = not M.autoformat
|
M.autoformat = not M.autoformat
|
||||||
@ -8,19 +8,13 @@ function M.toggle()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.format()
|
function M.format()
|
||||||
local buf = vim.api.nvim_get_current_buf()
|
local ok, conform = pcall(require, "conform")
|
||||||
local ft = vim.bo[buf].filetype
|
|
||||||
local have_nls = #require("null-ls.sources").get_available(ft, "NULL_LS_FORMATTING") > 0
|
|
||||||
|
|
||||||
vim.lsp.buf.format({
|
if ok then
|
||||||
bufnr = buf,
|
conform.format()
|
||||||
filter = function(client)
|
else
|
||||||
if have_nls then
|
vim.lsp.buf.format()
|
||||||
return client.name == "null-ls"
|
end
|
||||||
end
|
|
||||||
return client.name ~= "null-ls"
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.on_attach(client, buf)
|
function M.on_attach(client, buf)
|
||||||
|
|||||||
@ -140,35 +140,47 @@ return {
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- formatters
|
-- formatters
|
||||||
|
-- {
|
||||||
|
-- "jose-elias-alvarez/null-ls.nvim",
|
||||||
|
-- event = "BufReadPre",
|
||||||
|
-- dependencies = { "mason.nvim" },
|
||||||
|
-- opts = function()
|
||||||
|
-- local nls = require("null-ls")
|
||||||
|
-- return {
|
||||||
|
-- root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"),
|
||||||
|
-- debug = false,
|
||||||
|
-- sources = {
|
||||||
|
-- nls.builtins.formatting.stylua,
|
||||||
|
-- nls.builtins.formatting.prettier.with({
|
||||||
|
-- filetypes = {
|
||||||
|
-- "javascript",
|
||||||
|
-- "typescript",
|
||||||
|
-- "css",
|
||||||
|
-- "scss",
|
||||||
|
-- "html",
|
||||||
|
-- "json",
|
||||||
|
-- "yaml",
|
||||||
|
-- },
|
||||||
|
-- }),
|
||||||
|
-- nls.builtins.formatting.black.with({ extra_args = { "--fast" } }),
|
||||||
|
-- nls.builtins.formatting.bibclean,
|
||||||
|
-- nls.builtins.formatting.beautysh,
|
||||||
|
-- nls.builtins.diagnostics.shellcheck,
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
{
|
{
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
"stevearc/conform.nvim",
|
||||||
event = "BufReadPre",
|
opts = {
|
||||||
dependencies = { "mason.nvim" },
|
formatters_by_ft = {
|
||||||
opts = function()
|
lua = { "stylua" },
|
||||||
local nls = require("null-ls")
|
-- Conform will run multiple formatters sequentially
|
||||||
return {
|
python = { "isort", "black" },
|
||||||
root_dir = require("null-ls.utils").root_pattern(".null-ls-root", ".neoconf.json", "Makefile", ".git"),
|
-- Use a sub-list to run only the first available formatter
|
||||||
debug = false,
|
javascript = { { "prettierd", "prettier" } },
|
||||||
sources = {
|
},
|
||||||
nls.builtins.formatting.stylua,
|
},
|
||||||
nls.builtins.formatting.prettier.with({
|
|
||||||
filetypes = {
|
|
||||||
"javascript",
|
|
||||||
"typescript",
|
|
||||||
"css",
|
|
||||||
"scss",
|
|
||||||
"html",
|
|
||||||
"json",
|
|
||||||
"yaml",
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
nls.builtins.formatting.black.with({ extra_args = { "--fast" } }),
|
|
||||||
nls.builtins.formatting.bibclean,
|
|
||||||
nls.builtins.formatting.beautysh,
|
|
||||||
nls.builtins.diagnostics.shellcheck,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- cmdline tools and lsp servers
|
-- cmdline tools and lsp servers
|
||||||
@ -208,4 +220,5 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
require("lazyvim.plugins.lsp.lang.c_sharp"),
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,130 +1,130 @@
|
|||||||
return {
|
return {
|
||||||
{
|
-- {
|
||||||
"kyazdani42/nvim-tree.lua",
|
-- "kyazdani42/nvim-tree.lua",
|
||||||
cmd = "NvimTreeToggle",
|
-- cmd = "NvimTreeToggle",
|
||||||
config = function()
|
-- config = function()
|
||||||
local nvim_tree = require("nvim-tree")
|
-- local nvim_tree = require("nvim-tree")
|
||||||
local icons = require("lazyvim.config.icons")
|
-- local icons = require("lazyvim.config.icons")
|
||||||
|
--
|
||||||
local function edit_or_open()
|
-- local function edit_or_open()
|
||||||
-- open as vsplit on current node
|
-- -- open as vsplit on current node
|
||||||
local action = "edit"
|
-- local action = "edit"
|
||||||
local node = lib.get_node_at_cursor()
|
-- local node = lib.get_node_at_cursor()
|
||||||
|
--
|
||||||
-- Just copy what's done normally with vsplit
|
-- -- Just copy what's done normally with vsplit
|
||||||
if node.link_to and not node.nodes then
|
-- if node.link_to and not node.nodes then
|
||||||
require("nvim-tree.actions.node.open-file").fn(action, node.link_to)
|
-- require("nvim-tree.actions.node.open-file").fn(action, node.link_to)
|
||||||
view.close() -- Close the tree if file was opened
|
-- view.close() -- Close the tree if file was opened
|
||||||
elseif node.nodes ~= nil then
|
-- elseif node.nodes ~= nil then
|
||||||
lib.expand_or_collapse(node)
|
-- lib.expand_or_collapse(node)
|
||||||
else
|
-- else
|
||||||
require("nvim-tree.actions.node.open-file").fn(action, node.absolute_path)
|
-- require("nvim-tree.actions.node.open-file").fn(action, node.absolute_path)
|
||||||
view.close() -- Close the tree if file was opened
|
-- view.close() -- Close the tree if file was opened
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
|
--
|
||||||
nvim_tree.setup({
|
-- nvim_tree.setup({
|
||||||
hijack_directories = {
|
-- hijack_directories = {
|
||||||
enable = false,
|
-- enable = false,
|
||||||
},
|
-- },
|
||||||
ignore_ft_on_setup = {
|
-- ignore_ft_on_setup = {
|
||||||
"alpha",
|
-- "alpha",
|
||||||
},
|
-- },
|
||||||
filters = {
|
-- filters = {
|
||||||
custom = { ".git" },
|
-- custom = { ".git" },
|
||||||
exclude = { ".gitignore" },
|
-- exclude = { ".gitignore" },
|
||||||
},
|
-- },
|
||||||
hijack_cursor = false,
|
-- hijack_cursor = false,
|
||||||
update_cwd = true,
|
-- update_cwd = true,
|
||||||
renderer = {
|
-- renderer = {
|
||||||
add_trailing = false,
|
-- add_trailing = false,
|
||||||
group_empty = false,
|
-- group_empty = false,
|
||||||
highlight_git = false,
|
-- highlight_git = false,
|
||||||
highlight_opened_files = "none",
|
-- highlight_opened_files = "none",
|
||||||
root_folder_modifier = ":t",
|
-- root_folder_modifier = ":t",
|
||||||
indent_markers = {
|
-- indent_markers = {
|
||||||
enable = false,
|
-- enable = false,
|
||||||
icons = {
|
-- icons = {
|
||||||
corner = "└ ",
|
-- corner = "└ ",
|
||||||
edge = "│ ",
|
-- edge = "│ ",
|
||||||
none = " ",
|
-- none = " ",
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
icons = {
|
-- icons = {
|
||||||
webdev_colors = true,
|
-- webdev_colors = true,
|
||||||
git_placement = "before",
|
-- git_placement = "before",
|
||||||
padding = " ",
|
-- padding = " ",
|
||||||
symlink_arrow = " ➛ ",
|
-- symlink_arrow = " ➛ ",
|
||||||
show = {
|
-- show = {
|
||||||
file = true,
|
-- file = true,
|
||||||
folder = true,
|
-- folder = true,
|
||||||
folder_arrow = true,
|
-- folder_arrow = true,
|
||||||
git = true,
|
-- git = true,
|
||||||
},
|
-- },
|
||||||
glyphs = {
|
-- glyphs = {
|
||||||
default = "",
|
-- default = "",
|
||||||
symlink = "",
|
-- symlink = "",
|
||||||
folder = {
|
-- folder = {
|
||||||
arrow_open = icons.ui.ArrowOpen,
|
-- arrow_open = icons.ui.ArrowOpen,
|
||||||
arrow_closed = icons.ui.ArrowClosed,
|
-- arrow_closed = icons.ui.ArrowClosed,
|
||||||
default = "",
|
-- default = "",
|
||||||
open = "",
|
-- open = "",
|
||||||
empty = "",
|
-- empty = "",
|
||||||
empty_open = "",
|
-- empty_open = "",
|
||||||
symlink = "",
|
-- symlink = "",
|
||||||
symlink_open = "",
|
-- symlink_open = "",
|
||||||
},
|
-- },
|
||||||
git = {
|
-- git = {
|
||||||
unstaged = "",
|
-- unstaged = "",
|
||||||
staged = "S",
|
-- staged = "S",
|
||||||
unmerged = "",
|
-- unmerged = "",
|
||||||
renamed = "➜",
|
-- renamed = "➜",
|
||||||
untracked = "U",
|
-- untracked = "U",
|
||||||
deleted = "",
|
-- deleted = "",
|
||||||
ignored = "◌",
|
-- ignored = "◌",
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
diagnostics = {
|
-- diagnostics = {
|
||||||
enable = true,
|
-- enable = true,
|
||||||
icons = {
|
-- icons = {
|
||||||
hint = icons.diagnostics.Hint,
|
-- hint = icons.diagnostics.Hint,
|
||||||
info = icons.diagnostics.Information,
|
-- info = icons.diagnostics.Information,
|
||||||
warning = icons.diagnostics.Warning,
|
-- warning = icons.diagnostics.Warning,
|
||||||
error = icons.diagnostics.Error,
|
-- error = icons.diagnostics.Error,
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
update_focused_file = {
|
-- update_focused_file = {
|
||||||
enable = true,
|
-- enable = true,
|
||||||
update_cwd = true,
|
-- update_cwd = true,
|
||||||
ignore_list = {},
|
-- ignore_list = {},
|
||||||
},
|
-- },
|
||||||
git = {
|
-- git = {
|
||||||
enable = true,
|
-- enable = true,
|
||||||
ignore = true,
|
-- ignore = true,
|
||||||
timeout = 500,
|
-- timeout = 500,
|
||||||
},
|
-- },
|
||||||
view = {
|
-- view = {
|
||||||
width = 30,
|
-- width = 30,
|
||||||
hide_root_folder = false,
|
-- hide_root_folder = false,
|
||||||
side = "left",
|
-- side = "left",
|
||||||
number = false,
|
-- number = false,
|
||||||
relativenumber = false,
|
-- relativenumber = false,
|
||||||
mappings = {
|
-- mappings = {
|
||||||
custom_only = false,
|
-- custom_only = false,
|
||||||
list = {
|
-- list = {
|
||||||
{ key = "l", action = "edit", action_cb = edit_or_open },
|
-- { key = "l", action = "edit", action_cb = edit_or_open },
|
||||||
{ key = "h", action = "close_node" },
|
-- { key = "h", action = "close_node" },
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
actions = {
|
-- actions = {
|
||||||
open_file = {
|
-- open_file = {
|
||||||
quit_on_open = true,
|
-- quit_on_open = true,
|
||||||
},
|
-- },
|
||||||
},
|
-- },
|
||||||
})
|
-- })
|
||||||
end,
|
-- end,
|
||||||
},
|
-- },
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,30 +11,11 @@ return {
|
|||||||
history = true,
|
history = true,
|
||||||
delete_check_events = "TextChanged",
|
delete_check_events = "TextChanged",
|
||||||
},
|
},
|
||||||
|
-- stylua: ignore
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{ "<tab>", function() return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>" end, expr = true, silent = true, mode = "i", },
|
||||||
"<tab>",
|
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s", },
|
||||||
function()
|
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" }, },
|
||||||
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
|
|
||||||
end,
|
|
||||||
expr = true,
|
|
||||||
silent = true,
|
|
||||||
mode = "i",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<tab>",
|
|
||||||
function()
|
|
||||||
require("luasnip").jump(1)
|
|
||||||
end,
|
|
||||||
mode = "s",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<s-tab>",
|
|
||||||
function()
|
|
||||||
require("luasnip").jump(-1)
|
|
||||||
end,
|
|
||||||
mode = { "i", "s" },
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user