diff --git a/init.lua b/init.lua index 646bb7d..2c39b6f 100644 --- a/init.lua +++ b/init.lua @@ -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") diff --git a/lua/plugins/catppuccin.lua b/lua/plugins/catppuccin.lua index 86a7534..6c97ecf 100644 --- a/lua/plugins/catppuccin.lua +++ b/lua/plugins/catppuccin.lua @@ -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, + }, +} diff --git a/lua/plugins/completions.lua b/lua/plugins/completions.lua index 894c8f9..f571f15 100644 --- a/lua/plugins/completions.lua +++ b/lua/plugins/completions.lua @@ -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, } diff --git a/lua/plugins/feline.lua b/lua/plugins/feline.lua index 6fc3983..a045428 100644 --- a/lua/plugins/feline.lua +++ b/lua/plugins/feline.lua @@ -1,5 +1,5 @@ return { - 'freddiehaddad/feline.nvim', + "freddiehaddad/feline.nvim", dependencies = { "lewis6991/gitsigns.nvim", }, diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index d8e795c..135f84a 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -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 '' + map("n", "]c", function() + if vim.wo.diff then + return "]c" + end + vim.schedule(function() + gs.next_hunk() + end) + return "" end, { expr = true }) - map('n', '[c', function() - if vim.wo.diff then return '[c' end - vim.schedule(function() gs.prev_hunk() end) - return '' + map("n", "[c", function() + if vim.wo.diff then + return "[c" + end + vim.schedule(function() + gs.prev_hunk() + end) + return "" end, { expr = true }) -- Actions - map('n', 'hs', gs.stage_hunk) - map('n', 'hr', gs.reset_hunk) - map('v', 'hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end) - map('v', 'hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end) - map('n', 'hS', gs.stage_buffer) - map('n', 'hu', gs.undo_stage_hunk) - map('n', 'hR', gs.reset_buffer) - map('n', 'hp', gs.preview_hunk) - map('n', 'hb', function() gs.blame_line { full = true } end) - map('n', 'tb', gs.toggle_current_line_blame) - map('n', 'hd', gs.diffthis) - map('n', 'hD', function() gs.diffthis('~') end) - map('n', 'td', gs.toggle_deleted) + map("n", "hs", gs.stage_hunk) + map("n", "hr", gs.reset_hunk) + map("v", "hs", function() + gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end) + map("v", "hr", function() + gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") }) + end) + map("n", "hS", gs.stage_buffer) + map("n", "hu", gs.undo_stage_hunk) + map("n", "hR", gs.reset_buffer) + map("n", "hp", gs.preview_hunk) + map("n", "hb", function() + gs.blame_line({ full = true }) + end) + map("n", "tb", gs.toggle_current_line_blame) + map("n", "hd", gs.diffthis) + map("n", "hD", function() + gs.diffthis("~") + end) + map("n", "td", gs.toggle_deleted) -- Text object - map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk') + map({ "o", "x" }, "ih", ":Gitsigns select_hunk") end, }, }, diff --git a/lua/plugins/languages/rust.lua b/lua/plugins/languages/rust.lua index dbf4821..13ff783 100644 --- a/lua/plugins/languages/rust.lua +++ b/lua/plugins/languages/rust.lua @@ -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', 'ct', crates.toggle, opts) - vim.keymap.set('n', 'cr', crates.reload, opts) + vim.keymap.set("n", "ct", crates.toggle, opts) + vim.keymap.set("n", "cr", crates.reload, opts) - vim.keymap.set('n', 'cv', crates.show_versions_popup, opts) - vim.keymap.set('n', 'cf', crates.show_features_popup, opts) - vim.keymap.set('n', 'cd', crates.show_dependencies_popup, opts) + vim.keymap.set("n", "cv", crates.show_versions_popup, opts) + vim.keymap.set("n", "cf", crates.show_features_popup, opts) + vim.keymap.set("n", "cd", crates.show_dependencies_popup, opts) - vim.keymap.set('n', 'cu', crates.update_crate, opts) - vim.keymap.set('v', 'cu', crates.update_crates, opts) - vim.keymap.set('n', 'ca', crates.update_all_crates, opts) - vim.keymap.set('n', 'cU', crates.upgrade_crate, opts) - vim.keymap.set('v', 'cU', crates.upgrade_crates, opts) - vim.keymap.set('n', 'cA', crates.upgrade_all_crates, opts) + vim.keymap.set("n", "cu", crates.update_crate, opts) + vim.keymap.set("v", "cu", crates.update_crates, opts) + vim.keymap.set("n", "ca", crates.update_all_crates, opts) + vim.keymap.set("n", "cU", crates.upgrade_crate, opts) + vim.keymap.set("v", "cU", crates.upgrade_crates, opts) + vim.keymap.set("n", "cA", crates.upgrade_all_crates, opts) - vim.keymap.set('n', 'ce', crates.expand_plain_crate_to_inline_table, opts) - vim.keymap.set('n', 'cE', crates.extract_crate_into_table, opts) + vim.keymap.set("n", "ce", crates.expand_plain_crate_to_inline_table, opts) + vim.keymap.set("n", "cE", crates.extract_crate_into_table, opts) - vim.keymap.set('n', 'cH', crates.open_homepage, opts) - vim.keymap.set('n', 'cR', crates.open_repository, opts) - vim.keymap.set('n', 'cD', crates.open_documentation, opts) - vim.keymap.set('n', 'cC', crates.open_crates_io, opts) + vim.keymap.set("n", "cH", crates.open_homepage, opts) + vim.keymap.set("n", "cR", crates.open_repository, opts) + vim.keymap.set("n", "cD", crates.open_documentation, opts) + vim.keymap.set("n", "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", "", rt.hover_actions.hover_actions, { buffer = bufnr }) -- Code action groups @@ -65,7 +65,7 @@ return { }, }, }, - }); + }) end, }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index e5533c4..01b8de0 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -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 - 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', 'wa', vim.lsp.buf.add_workspace_folder, opts) - vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) - vim.keymap.set('n', '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", "wa", vim.lsp.buf.add_workspace_folder, opts) + vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, opts) + vim.keymap.set("n", "wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) - vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) - vim.keymap.set('n', 'f', function() - vim.lsp.buf.format { async = true } + vim.keymap.set("n", "D", vim.lsp.buf.type_definition, opts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) + vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) + vim.keymap.set("n", "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, }, } diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index 88b6ba8..27d2231 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -34,7 +34,7 @@ return { }, source_selector = { winbar = true, - } + }, }, keys = { { "t", "Neotree toggle", "Toggle Neotree" }, diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index bda2968..ce9d5a9 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -13,5 +13,5 @@ return { { "f", "Telescope find_files", desc = "Fuzzy find files with Telescope" }, { "", "Telescope find_files", desc = "Fuzzy find files with Telescope" }, { "b", "Telescope buffers", desc = "Fuzzy find open buffers with Telescope" }, - } + }, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 210677f..eb2f5b0 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -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, } diff --git a/lua/plugins/undotree.lua b/lua/plugins/undotree.lua index 90aa1b9..92c4615 100644 --- a/lua/plugins/undotree.lua +++ b/lua/plugins/undotree.lua @@ -4,9 +4,9 @@ return { { "", function() - vim.cmd.UndotreeToggle(); - vim.cmd.UndotreeFocus(); - end + vim.cmd.UndotreeToggle() + vim.cmd.UndotreeFocus() + end, }, }, } diff --git a/lua/sets.lua b/lua/sets.lua index 1aee24b..fa2d560 100644 --- a/lua/sets.lua +++ b/lua/sets.lua @@ -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