feat(lvim): add lua-format

chezmoi
sgoudham 2 years ago
parent 223686aba2
commit 97f44a1340
Signed by: hammy
GPG Key ID: 44E818FD5457EEA4

@ -34,25 +34,38 @@ local mappings = {
['<A-n>'] = cmp.mapping.scroll_docs(4), ['<A-n>'] = cmp.mapping.scroll_docs(4),
} }
lvim.builtin.cmp.cmdline.enable = true lvim.builtin.cmp.cmdline.enable = true
lvim.builtin.cmp.mapping = vim.tbl_deep_extend("keep", mappings, lvim.builtin.cmp.mapping) lvim.builtin.cmp.mapping = vim.tbl_deep_extend("keep", mappings,
lvim.builtin.cmp.mapping)
-- lsp -- lsp
local lsp_diagnostics = { local lsp_diagnostics = {
update_in_insert = true, update_in_insert = true,
float = { float = { border = "rounded" },
border = "rounded"
}
} }
local buffer_mappings = { local buffer_mappings = {
normal_mode = { normal_mode = {
["ge"] = { function() require("telescope.builtin").diagnostics() end, "Display Workplace Diagnostics" }, ["ge"] = {
["gr"] = { function() require("telescope.builtin").lsp_references() end, "Goto References" }, function() require("telescope.builtin").diagnostics() end,
["gd"] = { function() require("telescope.builtin").lsp_definitions() end, "Goto Definitions" }, "Display Workplace Diagnostics",
["gI"] = { function() require("telescope.builtin").lsp_implementations() end, "Goto Implementations" } },
} ["gr"] = {
function() require("telescope.builtin").lsp_references() end,
"Goto References",
},
["gd"] = {
function() require("telescope.builtin").lsp_definitions() end,
"Goto Definitions",
},
["gI"] = {
function() require("telescope.builtin").lsp_implementations() end,
"Goto Implementations",
},
},
} }
lvim.lsp.diagnostics = vim.tbl_deep_extend("keep", lsp_diagnostics, lvim.lsp.diagnostics) lvim.lsp.diagnostics = vim.tbl_deep_extend("keep", lsp_diagnostics,
lvim.lsp.buffer_mappings = vim.tbl_deep_extend("keep", buffer_mappings, lvim.lsp.buffer_mappings) lvim.lsp.diagnostics)
lvim.lsp.buffer_mappings = vim.tbl_deep_extend("keep", buffer_mappings,
lvim.lsp.buffer_mappings)
-- useful -- useful
lvim.keys.normal_mode["<C-u>"] = "<C-u>zz" lvim.keys.normal_mode["<C-u>"] = "<C-u>zz"
@ -75,7 +88,10 @@ lvim.builtin.which_key.mappings["f"] = {
g = { "<cmd>Telescope live_grep<cr>", "Find Text" }, g = { "<cmd>Telescope live_grep<cr>", "Find Text" },
R = { "<cmd>Telescope registers<cr>", "Find Registers" }, R = { "<cmd>Telescope registers<cr>", "Find Registers" },
k = { "<cmd>Telescope keymaps<cr>", "Find Keymaps" }, k = { "<cmd>Telescope keymaps<cr>", "Find Keymaps" },
c = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "Find Text In Current Buffer" }, c = {
"<cmd>Telescope current_buffer_fuzzy_find<cr>",
"Find Text In Current Buffer",
},
C = { "<cmd>Telescope commands<cr>", "Find Commands" }, C = { "<cmd>Telescope commands<cr>", "Find Commands" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" }, r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
p = { "<cmd>Telescope projects<cr>", "Open Projects" }, p = { "<cmd>Telescope projects<cr>", "Open Projects" },
@ -85,9 +101,7 @@ lvim.builtin.which_key.mappings["f"] = {
local _, actions = pcall(require, "telescope.actions") local _, actions = pcall(require, "telescope.actions")
lvim.builtin.telescope.defaults.prompt_prefix = "🔍 " lvim.builtin.telescope.defaults.prompt_prefix = "🔍 "
lvim.builtin.telescope.defaults.selection_caret = "> " lvim.builtin.telescope.defaults.selection_caret = "> "
lvim.builtin.telescope.defaults.file_ignore_patterns = { lvim.builtin.telescope.defaults.file_ignore_patterns = { ".git/" }
".git/"
}
lvim.builtin.telescope.defaults.mappings = { lvim.builtin.telescope.defaults.mappings = {
i = { i = {
["<A-j>"] = actions.move_selection_next, ["<A-j>"] = actions.move_selection_next,
@ -99,7 +113,7 @@ lvim.builtin.telescope.defaults.mappings = {
["<A-j>"] = actions.move_selection_next, ["<A-j>"] = actions.move_selection_next,
["<A-k>"] = actions.move_selection_previous, ["<A-k>"] = actions.move_selection_previous,
["<A-n>"] = actions.preview_scrolling_down, ["<A-n>"] = actions.preview_scrolling_down,
["<A-p>"] = actions.preview_scrolling_up ["<A-p>"] = actions.preview_scrolling_up,
}, },
} }
@ -144,19 +158,14 @@ lvim.builtin.treesitter.ensure_installed = {
"html", "html",
"go", "go",
"erlang", "erlang",
"toml" "toml",
} }
require("lspconfig.ui.windows").default_options.border = "rounded"
---configure a server manually. !!Requires `:LvimCacheReset` to take effect!! ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!!
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "hls" }) vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "hls" })
local opts = { local opts = { cmd = { "haskell-language-server-9.2.4", "--lsp" } } -- check the lspconfig documentation for a list of all possible options
cmd = {
"haskell-language-server-9.2.4", "--lsp"
}
} -- check the lspconfig documentation for a list of all possible options
require("lvim.lsp.manager").setup("hls", opts) require("lvim.lsp.manager").setup("hls", opts)
require("lspconfig.ui.windows").default_options.border = "rounded"
-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!! -- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))` ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))`
@ -175,21 +184,21 @@ require("lvim.lsp.manager").setup("hls", opts)
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") -- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- end -- end
-- -- set a formatter, this will override the language server formatting capabilities (if it exists) local formatters = require "lvim.lsp.null-ls.formatters"
-- local formatters = require "lvim.lsp.null-ls.formatters" formatters.setup {
-- formatters.setup { {
-- { command = "black", filetypes = { "python" } }, command = "lua-format",
-- { command = "isort", filetypes = { "python" } }, filetypes = { "lua" },
-- { extra_args = {
-- -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration "--spaces-inside-table-braces",
-- command = "prettier", "--indent-width=2",
-- ---@usage arguments to pass to the formatter "--tab-width=2",
-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}` "--continuation-indent-width=2",
-- extra_args = { "--print-with", "100" }, "--chop-down-table",
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports. "--extra-sep-at-table-end",
-- filetypes = { "typescript", "typescriptreact" }, },
-- }, },
-- } }
-- -- set additional linters -- -- set additional linters
-- local linters = require "lvim.lsp.null-ls.linters" -- local linters = require "lvim.lsp.null-ls.linters"
@ -225,31 +234,26 @@ lvim.plugins = {
{ {
name = "chezmoi", name = "chezmoi",
command = [[chezmoi managed -x encrypted -i files | awk '{ printf("%s/%s\n", "~", $0) }']], command = [[chezmoi managed -x encrypted -i files | awk '{ printf("%s/%s\n", "~", $0) }']],
opts = require('telescope.themes').get_dropdown({}) opts = require('telescope.themes').get_dropdown({}),
}, },
}, },
} }
end end,
}, },
{ {
'stevearc/dressing.nvim', 'stevearc/dressing.nvim',
config = function() config = function()
require("dressing").setup { require("dressing").setup { input = { insert_only = false } }
input = { end,
insert_only = false
}
}
end
}, },
{ {
"kylechui/nvim-surround", "kylechui/nvim-surround",
tag = "*", -- Use for stability; omit to use `main` branch for the latest features tag = "*", -- Use for stability; omit to use `main` branch for the latest features
config = function() config = function() require("nvim-surround").setup() end,
require("nvim-surround").setup()
end
}, },
{ {
"catppuccin/nvim", as = "catppuccin", "catppuccin/nvim",
as = "catppuccin",
config = function() config = function()
local cp = require("catppuccin.palettes").get_palette() local cp = require("catppuccin.palettes").get_palette()
@ -262,14 +266,8 @@ lvim.plugins = {
integrations = { integrations = {
ts_rainbow = true, ts_rainbow = true,
which_key = true, which_key = true,
dap = { dap = { enabled = true, enable_ui = true },
enabled = true, navic = { enabled = true, custom_bg = "NONE" },
enable_ui = true,
},
navic = {
enabled = true,
custom_bg = "NONE",
},
}, },
color_overrides = { color_overrides = {
mocha = { mocha = {
@ -287,16 +285,15 @@ lvim.plugins = {
TelescopeBorder = { link = "FloatBorder" }, TelescopeBorder = { link = "FloatBorder" },
TelescopeMatching = { link = "TelescopeNormal" }, TelescopeMatching = { link = "TelescopeNormal" },
TelescopeSelection = { fg = "NONE", bg = cp.surface0 }, TelescopeSelection = { fg = "NONE", bg = cp.surface0 },
TelescopeTitle = { fg = cp.subtext0 } TelescopeTitle = { fg = cp.subtext0 },
}, },
}) })
vim.api.nvim_command "colorscheme catppuccin" vim.api.nvim_command "colorscheme catppuccin"
end end,
} },
} }
-- SOME PROPER CUSTOM CONFIGURATION -- -- SOME PROPER CUSTOM CONFIGURATION --
vim.api.nvim_create_autocmd("BufWritePost", { vim.api.nvim_create_autocmd("BufWritePost", {

Loading…
Cancel
Save