Compare commits

..

3 commits

5 changed files with 28 additions and 2 deletions

View file

@ -5,8 +5,8 @@ vim.g.maplocalleader = ";"
-- source current file -- source current file
vim.keymap.set("n", "<Leader> ", ":update<CR> :source<CR>", { desc = "Source current lua file" }) vim.keymap.set("n", "<Leader> ", ":update<CR> :source<CR>", { desc = "Source current lua file" })
-- format -- -- format
vim.keymap.set("n", "<Leader>lf", vim.lsp.buf.format, { desc = "Format buffer with available lsp" }) -- vim.keymap.set("n", "<Leader>lf", vim.lsp.buf.format, { desc = "Format buffer with available lsp" })
-- easy copy/cut/paste from system clipboard -- easy copy/cut/paste from system clipboard
vim.keymap.set({ "n", "v", "x" }, "<Leader>y", '"+y', { desc = "Yank to system clipboard" }) vim.keymap.set({ "n", "v", "x" }, "<Leader>y", '"+y', { desc = "Yank to system clipboard" })

17
lua/plugins/conform.lua Normal file
View file

@ -0,0 +1,17 @@
vim.pack.add({
{src = "https://github.com/stevearc/conform.nvim"},
})
vim.api.nvim_create_user_command("Format", function(args)
local range = nil
if args.count ~= -1 then
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
range = {
start = { args.line1, 0 },
["end"] = { args.line2, end_line:len() },
}
end
require("conform").format({ async = true, lsp_format = "fallback", range = range })
end, { range = true })
vim.keymap.set("n", "<Leader>lf", ":Format<CR>", { desc = "Format buffer with available lsp" })

View file

@ -3,3 +3,4 @@ require("plugins.treesitter")
require("plugins.lsp") require("plugins.lsp")
require("plugins.mini") require("plugins.mini")
require("plugins.markdown") require("plugins.markdown")
require("plugins.conform")

View file

@ -21,8 +21,12 @@ vim.lsp.enable({
"nixd", "nixd",
"lua_ls", "lua_ls",
"jsonls", "jsonls",
"html",
"marksman", "marksman",
"gopls", "gopls",
"ruff",
"basedpyright",
"yamlls",
}) })
-- diagnostic settings -- diagnostic settings

View file

@ -1,5 +1,9 @@
{ {
"plugins": { "plugins": {
"conform.nvim": {
"rev": "26c02e1",
"src": "https://github.com/stevearc/conform.nvim"
},
"gruvbox.nvim": { "gruvbox.nvim": {
"rev": "5e0a460", "rev": "5e0a460",
"src": "https://github.com/ellisonleao/gruvbox.nvim" "src": "https://github.com/ellisonleao/gruvbox.nvim"