+ new shortcuts new plugins
This commit is contained in:
@@ -2,19 +2,14 @@ require("itsigo.remap")
|
||||
require("itsigo.set")
|
||||
require("itsigo.lazy")
|
||||
|
||||
vim.filetype.add({ extension = { templ = "templ" } })
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
function R(name)
|
||||
require("plenary.reload").reload_module(name)
|
||||
end
|
||||
|
||||
autocmd({"BufWritePre"}, {
|
||||
pattern = "*",
|
||||
command = [[%s/\s\+$//e]],
|
||||
})
|
||||
autocmd({ "BufWritePre" }, { pattern = { "*.templ" }, callback = vim.lsp.buf.format })
|
||||
|
||||
autocmd('LspAttach', {
|
||||
callback = function (e)
|
||||
callback = function(e)
|
||||
local opts = { buffer = e.buf }
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 999,
|
||||
config = function()
|
||||
vim.cmd.colorscheme "catppuccin-macchiato"
|
||||
end,
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 999,
|
||||
config = function()
|
||||
local cat = require("catppuccin")
|
||||
cat.setup({
|
||||
integrations = {
|
||||
harpoon = true,
|
||||
mason = true,
|
||||
cmp = true,
|
||||
telescope = { enabled = true },
|
||||
}
|
||||
})
|
||||
vim.cmd.colorscheme "catppuccin-macchiato"
|
||||
end,
|
||||
}
|
||||
|
||||
39
lua/itsigo/plugins/conform.lua
Normal file
39
lua/itsigo/plugins/conform.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
dependencies = { "mason.nvim" },
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
keys = {
|
||||
{
|
||||
-- Customize or remove this keymap to your liking
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_fallback = true })
|
||||
end,
|
||||
mode = "",
|
||||
desc = "Format buffer",
|
||||
},
|
||||
},
|
||||
-- Everything in opts will be passed to setup()
|
||||
opts = {
|
||||
-- Define your formatters
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = { "tsserver" },
|
||||
go = { { "gofumts", "goimports" } },
|
||||
templ = { "templ" },
|
||||
},
|
||||
-- Set up format-on-save
|
||||
format_on_save = { timeout_ms = 500, lsp_fallback = true },
|
||||
-- Customize formatters
|
||||
formatters = {
|
||||
shfmt = {
|
||||
prepend_args = { "-i", "2" },
|
||||
},
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
-- If you want the formatexpr, here is the place to set it
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
end,
|
||||
}
|
||||
@@ -11,7 +11,6 @@ return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"j-hui/fidget.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
},
|
||||
|
||||
config = function()
|
||||
@@ -29,12 +28,11 @@ return {
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
-- "rust_analyzer",
|
||||
"rust_analyzer",
|
||||
"gopls",
|
||||
},
|
||||
handlers = {
|
||||
function(server_name) -- default handler (optional)
|
||||
|
||||
require("lspconfig")[server_name].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
@@ -54,6 +52,23 @@ return {
|
||||
}
|
||||
}
|
||||
end,
|
||||
|
||||
["rust_analyzer"] = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
local util = require("lspconfig/util")
|
||||
lspconfig.rust_analyzer.setup {
|
||||
filetypes = { "rust" },
|
||||
root_dir = util.root_pattern("Cargo.toml"),
|
||||
opts = {
|
||||
inlay_hints = { enabled = true },
|
||||
},
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
cargo = { allFeatures = true, },
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
}
|
||||
})
|
||||
|
||||
@@ -71,23 +86,23 @@ return {
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
--if cmp.visible() then
|
||||
-- cmp.select_next_item()
|
||||
if luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s"}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
--if cmp.visible() then
|
||||
-- cmp.select_next_item()
|
||||
if luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'luasnip' }, -- For luasnip users.
|
||||
{ name = 'nvim_lsp' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
vim.diagnostic.config({
|
||||
@@ -101,30 +116,5 @@ return {
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
|
||||
local null_ls = require("null-ls")
|
||||
local autogroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.gofumpt,
|
||||
null_ls.builtins.formatting.goimports,
|
||||
},
|
||||
on_attach = function (client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({
|
||||
group = autogroup,
|
||||
buffer = bufnr,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = autogroup,
|
||||
buffer = bufnr,
|
||||
callback = function ()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
opts = {
|
||||
},
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
opts = function()
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = "catppuccin"
|
||||
},
|
||||
extensions = { 'oil', 'mason', 'lazy' }
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
6
lua/itsigo/plugins/markdown.lua
Normal file
6
lua/itsigo/plugins/markdown.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
return {
|
||||
"iamcco/markdown-preview.nvim",
|
||||
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
||||
ft = { "markdown" },
|
||||
build = function() vim.fn["mkdp#util#install"]() end,
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function ()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function ()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
|
||||
configs.setup({
|
||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" },
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end
|
||||
configs.setup({
|
||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html", "markdown", "markdown_inline" },
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user