obligatory formatting run

This commit is contained in:
kalmenn 2024-01-07 18:19:07 +01:00
parent 3dd0e7ac89
commit fb7c11497d
Signed by: kalmenn
GPG key ID: F500055C44BC3834
12 changed files with 117 additions and 100 deletions

View file

@ -14,9 +14,9 @@ if not vim.loop.fs_stat(lazypath) then
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = " "; vim.g.mapleader = " "
require('lazy').setup({ { import = "plugins" } }) require("lazy").setup({ { import = "plugins" } })
require("sets") require("sets")
require("remaps") require("remaps")

View file

@ -1,14 +1,16 @@
return { { return {
"catppuccin/nvim", {
priority = 1000, "catppuccin/nvim",
config = function() priority = 1000,
require("catppuccin").setup({ config = function()
flavour = "mocha", require("catppuccin").setup({
integrations = { flavour = "mocha",
treesitter = true, integrations = {
}, treesitter = true,
transparent_background = true, },
}) transparent_background = true,
vim.cmd.colorscheme("catppuccin") })
end, vim.cmd.colorscheme("catppuccin")
} } end,
},
}

View file

@ -12,7 +12,7 @@ return {
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
}, },
config = function() config = function()
local cmp = require("cmp"); local cmp = require("cmp")
cmp.setup({ cmp.setup({
snippet = { snippet = {
@ -36,7 +36,7 @@ return {
{ name = "luasnip" }, { name = "luasnip" },
}, { }, {
{ name = "buffer" }, { name = "buffer" },
}) }),
}) })
vim.api.nvim_create_autocmd("BufRead", { vim.api.nvim_create_autocmd("BufRead", {
@ -51,18 +51,18 @@ return {
cmp.setup.cmdline({ "/", "?" }, { cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = { sources = {
{ name = "buffer" } { name = "buffer" },
} },
}) })
-- Use cmdline & path source for ":" (if you enabled `native_menu`, this won"t work anymore). -- Use cmdline & path source for ":" (if you enabled `native_menu`, this won"t work anymore).
cmp.setup.cmdline(":", { cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "path" } { name = "path" },
}, { }, {
{ name = "cmdline" } { name = "cmdline" },
}) }),
}) })
end, end,
} }

View file

@ -1,5 +1,5 @@
return { return {
'freddiehaddad/feline.nvim', "freddiehaddad/feline.nvim",
dependencies = { dependencies = {
"lewis6991/gitsigns.nvim", "lewis6991/gitsigns.nvim",
}, },

View file

@ -16,35 +16,51 @@ return {
end end
-- Navigation -- Navigation
map('n', ']c', function() map("n", "]c", function()
if vim.wo.diff then return ']c' end if vim.wo.diff then
vim.schedule(function() gs.next_hunk() end) return "]c"
return '<Ignore>' end
vim.schedule(function()
gs.next_hunk()
end)
return "<Ignore>"
end, { expr = true }) end, { expr = true })
map('n', '[c', function() map("n", "[c", function()
if vim.wo.diff then return '[c' end if vim.wo.diff then
vim.schedule(function() gs.prev_hunk() end) return "[c"
return '<Ignore>' end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true }) end, { expr = true })
-- Actions -- Actions
map('n', '<leader>hs', gs.stage_hunk) map("n", "<leader>hs", gs.stage_hunk)
map('n', '<leader>hr', gs.reset_hunk) map("n", "<leader>hr", gs.reset_hunk)
map('v', '<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end) map("v", "<leader>hs", function()
map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end) gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
map('n', '<leader>hS', gs.stage_buffer) end)
map('n', '<leader>hu', gs.undo_stage_hunk) map("v", "<leader>hr", function()
map('n', '<leader>hR', gs.reset_buffer) gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
map('n', '<leader>hp', gs.preview_hunk) end)
map('n', '<leader>hb', function() gs.blame_line { full = true } end) map("n", "<leader>hS", gs.stage_buffer)
map('n', '<leader>tb', gs.toggle_current_line_blame) map("n", "<leader>hu", gs.undo_stage_hunk)
map('n', '<leader>hd', gs.diffthis) map("n", "<leader>hR", gs.reset_buffer)
map('n', '<leader>hD', function() gs.diffthis('~') end) map("n", "<leader>hp", gs.preview_hunk)
map('n', '<leader>td', gs.toggle_deleted) map("n", "<leader>hb", function()
gs.blame_line({ full = true })
end)
map("n", "<leader>tb", gs.toggle_current_line_blame)
map("n", "<leader>hd", gs.diffthis)
map("n", "<leader>hD", function()
gs.diffthis("~")
end)
map("n", "<leader>td", gs.toggle_deleted)
-- Text object -- Text object
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>') map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
end, end,
}, },
}, },

View file

@ -1,36 +1,36 @@
return { return {
{ {
"Saecki/crates.nvim", "Saecki/crates.nvim",
tag = 'stable', tag = "stable",
init = function() init = function()
local crates = require('crates') local crates = require("crates")
vim.api.nvim_create_autocmd("BufEnter", { vim.api.nvim_create_autocmd("BufEnter", {
pattern = "Cargo.toml", pattern = "Cargo.toml",
group = vim.api.nvim_create_augroup('UserCratesNvimConfig', {}), group = vim.api.nvim_create_augroup("UserCratesNvimConfig", {}),
callback = function(ev) callback = function(ev)
local opts = { silent = true, buffer = ev.buffer } local opts = { silent = true, buffer = ev.buffer }
vim.keymap.set('n', '<leader>ct', crates.toggle, opts) vim.keymap.set("n", "<leader>ct", crates.toggle, opts)
vim.keymap.set('n', '<leader>cr', crates.reload, opts) vim.keymap.set("n", "<leader>cr", crates.reload, opts)
vim.keymap.set('n', '<leader>cv', crates.show_versions_popup, opts) vim.keymap.set("n", "<leader>cv", crates.show_versions_popup, opts)
vim.keymap.set('n', '<leader>cf', crates.show_features_popup, opts) vim.keymap.set("n", "<leader>cf", crates.show_features_popup, opts)
vim.keymap.set('n', '<leader>cd', crates.show_dependencies_popup, opts) vim.keymap.set("n", "<leader>cd", crates.show_dependencies_popup, opts)
vim.keymap.set('n', '<leader>cu', crates.update_crate, opts) vim.keymap.set("n", "<leader>cu", crates.update_crate, opts)
vim.keymap.set('v', '<leader>cu', crates.update_crates, opts) vim.keymap.set("v", "<leader>cu", crates.update_crates, opts)
vim.keymap.set('n', '<leader>ca', crates.update_all_crates, opts) vim.keymap.set("n", "<leader>ca", crates.update_all_crates, opts)
vim.keymap.set('n', '<leader>cU', crates.upgrade_crate, opts) vim.keymap.set("n", "<leader>cU", crates.upgrade_crate, opts)
vim.keymap.set('v', '<leader>cU', crates.upgrade_crates, opts) vim.keymap.set("v", "<leader>cU", crates.upgrade_crates, opts)
vim.keymap.set('n', '<leader>cA', crates.upgrade_all_crates, opts) vim.keymap.set("n", "<leader>cA", crates.upgrade_all_crates, opts)
vim.keymap.set('n', '<leader>ce', crates.expand_plain_crate_to_inline_table, opts) vim.keymap.set("n", "<leader>ce", crates.expand_plain_crate_to_inline_table, opts)
vim.keymap.set('n', '<leader>cE', crates.extract_crate_into_table, opts) vim.keymap.set("n", "<leader>cE", crates.extract_crate_into_table, opts)
vim.keymap.set('n', '<leader>cH', crates.open_homepage, opts) vim.keymap.set("n", "<leader>cH", crates.open_homepage, opts)
vim.keymap.set('n', '<leader>cR', crates.open_repository, opts) vim.keymap.set("n", "<leader>cR", crates.open_repository, opts)
vim.keymap.set('n', '<leader>cD', crates.open_documentation, opts) vim.keymap.set("n", "<leader>cD", crates.open_documentation, opts)
vim.keymap.set('n', '<leader>cC', crates.open_crates_io, opts) vim.keymap.set("n", "<leader>cC", crates.open_crates_io, opts)
end, end,
}) })
end, end,
@ -45,12 +45,12 @@ return {
}, },
lazy = true, lazy = true,
config = function() config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities(); local capabilities = require("cmp_nvim_lsp").default_capabilities()
require("rust-tools").setup({ require("rust-tools").setup({
server = { server = {
on_attach = function(_, bufnr) on_attach = function(_, bufnr)
local rt = require("rust-tools"); local rt = require("rust-tools")
-- Hover actions -- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr }) vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups -- Code action groups
@ -65,7 +65,7 @@ return {
}, },
}, },
}, },
}); })
end, end,
}, },
} }

View file

@ -9,8 +9,7 @@ return {
dependencies = { dependencies = {
"williamboman/mason.nvim", "williamboman/mason.nvim",
}, },
config = function() config = function() end,
end,
}, },
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
@ -18,48 +17,48 @@ return {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
}, },
init = function() init = function()
vim.api.nvim_create_autocmd('LspAttach', { vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup('UserLspConfig', {}), group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev) callback = function(ev)
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc' vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
-- Buffer local mappings. -- Buffer local mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf } local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts) vim.keymap.set("n", "<space>wa", vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts) vim.keymap.set("n", "<space>wr", vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set('n', '<space>wl', function() vim.keymap.set("n", "<space>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, opts) end, opts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts) vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, opts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts) vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts) vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set('n', '<space>f', function() vim.keymap.set("n", "<space>f", function()
vim.lsp.buf.format { async = true } vim.lsp.buf.format({ async = true })
end, opts) end, opts)
end, end,
}) })
end, end,
config = function() config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities(); local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require("lspconfig"); local lspconfig = require("lspconfig")
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
handlers = { handlers = {
-- default handler -- default handler
function(server_name) function(server_name)
lspconfig[server_name].setup { lspconfig[server_name].setup({
capabilities = capabilities, capabilities = capabilities,
} })
end, end,
-- overrides -- overrides
["rust_analyzer"] = function() ["rust_analyzer"] = function()
require("lazy").load { plugins = { "rust-tools.nvim" } }; require("lazy").load({ plugins = { "rust-tools.nvim" } })
end, end,
["lua_ls"] = function() ["lua_ls"] = function()
lspconfig.lua_ls.setup({ lspconfig.lua_ls.setup({
@ -83,7 +82,7 @@ return {
}) })
end, end,
}, },
}); })
end, end,
}, },
} }

View file

@ -34,7 +34,7 @@ return {
}, },
source_selector = { source_selector = {
winbar = true, winbar = true,
} },
}, },
keys = { keys = {
{ "<C-N>t", "<cmd>Neotree toggle<cr>", "Toggle Neotree" }, { "<C-N>t", "<cmd>Neotree toggle<cr>", "Toggle Neotree" },

View file

@ -13,5 +13,5 @@ return {
{ "<C-t>f", "<cmd>Telescope find_files<cr>", desc = "Fuzzy find files with Telescope" }, { "<C-t>f", "<cmd>Telescope find_files<cr>", desc = "Fuzzy find files with Telescope" },
{ "<C-p>", "<cmd>Telescope find_files<cr>", desc = "Fuzzy find files with Telescope" }, { "<C-p>", "<cmd>Telescope find_files<cr>", desc = "Fuzzy find files with Telescope" },
{ "<C-t>b", "<cmd>Telescope buffers<cr>", desc = "Fuzzy find open buffers with Telescope" }, { "<C-t>b", "<cmd>Telescope buffers<cr>", desc = "Fuzzy find open buffers with Telescope" },
} },
} }

View file

@ -1,7 +1,7 @@
return { return {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
config = function() config = function()
require('nvim-treesitter.configs').setup({ require("nvim-treesitter.configs").setup({
modules = {}, modules = {},
ensure_installed = { "lua", "rust" }, ensure_installed = { "lua", "rust" },
sync_install = false, sync_install = false,
@ -12,5 +12,5 @@ return {
}, },
ignore_install = {}, ignore_install = {},
}) })
end end,
} }

View file

@ -4,9 +4,9 @@ return {
{ {
"<A-u>", "<A-u>",
function() function()
vim.cmd.UndotreeToggle(); vim.cmd.UndotreeToggle()
vim.cmd.UndotreeFocus(); vim.cmd.UndotreeFocus()
end end,
}, },
}, },
} }

View file

@ -39,7 +39,7 @@ vim.opt.spell = true
-- stuff -- stuff
vim.opt.mousemodel = "extend" vim.opt.mousemodel = "extend"
vim.opt.fillchars:append({ eob = ' ' }) vim.opt.fillchars:append({ eob = " " })
vim.opt.termguicolors = true vim.opt.termguicolors = true