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
vim.opt.rtp:prepend(lazypath)
vim.g.mapleader = " ";
vim.g.mapleader = " "
require('lazy').setup({ { import = "plugins" } })
require("lazy").setup({ { import = "plugins" } })
require("sets")
require("remaps")

View file

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

View file

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

View file

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

View file

@ -16,35 +16,51 @@ return {
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
map("n", "]c", function()
if vim.wo.diff then
return "]c"
end
vim.schedule(function()
gs.next_hunk()
end)
return "<Ignore>"
end, { expr = true })
map('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
map("n", "[c", function()
if vim.wo.diff then
return "[c"
end
vim.schedule(function()
gs.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })
-- Actions
map('n', '<leader>hs', gs.stage_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>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
map('n', '<leader>hS', gs.stage_buffer)
map('n', '<leader>hu', gs.undo_stage_hunk)
map('n', '<leader>hR', gs.reset_buffer)
map('n', '<leader>hp', gs.preview_hunk)
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)
map("n", "<leader>hs", gs.stage_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>hr", function()
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
end)
map("n", "<leader>hS", gs.stage_buffer)
map("n", "<leader>hu", gs.undo_stage_hunk)
map("n", "<leader>hR", gs.reset_buffer)
map("n", "<leader>hp", gs.preview_hunk)
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
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>")
end,
},
},

View file

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

View file

@ -9,8 +9,7 @@ return {
dependencies = {
"williamboman/mason.nvim",
},
config = function()
end,
config = function() end,
},
{
"neovim/nvim-lspconfig",
@ -18,48 +17,48 @@ return {
"hrsh7th/cmp-nvim-lsp",
},
init = function()
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
-- 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.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { buffer = ev.buf }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, 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', '<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>wl', function()
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, 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", "<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>wl", function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, 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', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
vim.keymap.set('n', '<space>f', function()
vim.lsp.buf.format { async = true }
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", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "<space>f", function()
vim.lsp.buf.format({ async = true })
end, opts)
end,
})
end,
config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities();
local lspconfig = require("lspconfig");
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require("lspconfig")
require("mason-lspconfig").setup({
handlers = {
-- default handler
function(server_name)
lspconfig[server_name].setup {
lspconfig[server_name].setup({
capabilities = capabilities,
}
})
end,
-- overrides
["rust_analyzer"] = function()
require("lazy").load { plugins = { "rust-tools.nvim" } };
require("lazy").load({ plugins = { "rust-tools.nvim" } })
end,
["lua_ls"] = function()
lspconfig.lua_ls.setup({
@ -83,7 +82,7 @@ return {
})
end,
},
});
})
end,
},
}

View file

@ -34,7 +34,7 @@ return {
},
source_selector = {
winbar = true,
}
},
},
keys = {
{ "<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-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" },
}
},
}

View file

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

View file

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

View file

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