diff --git a/.stylua.toml b/.stylua.toml deleted file mode 100644 index 440061b..0000000 --- a/.stylua.toml +++ /dev/null @@ -1,3 +0,0 @@ -indent_type = "Spaces" -call_parentheses = "None" -collapse_simple_statement = "Always" diff --git a/init.lua b/init.lua index edcbe09..ed5fb2b 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,5 @@ vim.g.mapleader = " " +vim.opt.termguicolors = true -- bootstrap lazy.nvim local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" @@ -18,7 +19,7 @@ require("lazy").setup { spec = "plugins", lockfile = vim.fn.stdpath "data" .. "/lazy-lock.json", dev = { path = "~/Projects/lua/nvim" }, - install = { colorscheme = { "catppuccin" } }, + install = { colorscheme = { "tokyonight" } }, ui = { border = "rounded", icons = { lazy = " " }, @@ -42,6 +43,7 @@ require("lazy").setup { } -- Set vim options +vim.cmd([[colorscheme tokyonight]]) vim.opt.laststatus = 3 vim.opt.showtabline = 1 vim.opt.shiftwidth = 4 diff --git a/lua/lsp/attach.lua b/lua/lsp/attach.lua index fa68929..1bff195 100644 --- a/lua/lsp/attach.lua +++ b/lua/lsp/attach.lua @@ -1,24 +1,26 @@ +-- LSP format call with options +local lsp_formatting = function(bufnr) + vim.lsp.buf.format { + bufnr = bufnr, + timeout_ms = 2000, + async = true, + } +end + -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) -- Mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions local bufopts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set("n", "gD", vim.lsp.buf.definition, bufopts) - vim.keymap.set("n", "gd", "Trouble lsp_definitions", bufopts) - vim.keymap.set("n", "gR", vim.lsp.buf.references, bufopts) - vim.keymap.set("n", "gr", "Trouble lsp_references", bufopts) - vim.keymap.set("n", "gI", vim.lsp.buf.implementation, bufopts) - vim.keymap.set("n", "gi", "Trouble lsp_implementations", bufopts) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, bufopts) + vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, bufopts) vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) - vim.keymap.set("n", "", vim.lsp.buf.signature_help, bufopts) - vim.keymap.set("n", "wa", vim.lsp.buf.add_workspace_folder, bufopts) - vim.keymap.set("n", "wr", vim.lsp.buf.remove_workspace_folder, bufopts) - vim.keymap.set("n", "wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, bufopts) vim.keymap.set("n", "D", vim.lsp.buf.type_definition, bufopts) vim.keymap.set("n", "rn", vim.lsp.buf.rename, bufopts) vim.keymap.set("n", "ca", vim.lsp.buf.code_action, bufopts) - vim.keymap.set("n", "i", require "lsp.formatting", bufopts) + vim.keymap.set("n", "i", lsp_formatting, bufopts) if client.server_capabilities.documentSymbolProvider then require("nvim-navic").attach(client, bufnr) require("nvim-navbuddy").attach(client, bufnr) diff --git a/lua/lsp/cmp.lua b/lua/lsp/cmp.lua index 70ed5b1..553a2c4 100644 --- a/lua/lsp/cmp.lua +++ b/lua/lsp/cmp.lua @@ -42,8 +42,8 @@ cmp.setup { } -- Set configuration for specific filetype. -cmp.setup.filetype("python", { sources = { { name = "nvim_lsp" } } }) -cmp.setup.filetype("nix", { sources = { { name = "nvim_lsp" } } }) +-- cmp.setup.filetype("python", { sources = { { name = "nvim_lsp" } } }) +-- cmp.setup.filetype("nix", { sources = { { name = "nvim_lsp" } } }) cmp.setup.cmdline("/", { mapping = cmp.mapping.preset.cmdline(), sources = { { name = "buffer" } } }) cmp.setup.cmdline(":", { mapping = cmp.mapping.preset.cmdline(), diff --git a/lua/lsp/formatting.lua b/lua/lsp/formatting.lua deleted file mode 100644 index 4c70408..0000000 --- a/lua/lsp/formatting.lua +++ /dev/null @@ -1,8 +0,0 @@ -local lsp_formatting = function(bufnr) - vim.lsp.buf.format { - bufnr = bufnr, - timeout_ms = 2000, - async = true, - } -end -return lsp_formatting diff --git a/lua/plugins/barbecue.lua b/lua/plugins/barbecue.lua new file mode 100644 index 0000000..7c6da7b --- /dev/null +++ b/lua/plugins/barbecue.lua @@ -0,0 +1,15 @@ +return { + "utilyre/barbecue.nvim", + name = "barbecue", + version = "*", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "SmiteshP/nvim-navic", + "nvim-tree/nvim-web-devicons", + -- "catppuccin", + "folke/tokyonight.nvim", + }, + opts = { + theme = 'tokyonight', + }, +} diff --git a/lua/plugins/catppuccin.lua b/lua/plugins/catppuccin.lua index f8b5d34..a40c233 100644 --- a/lua/plugins/catppuccin.lua +++ b/lua/plugins/catppuccin.lua @@ -28,6 +28,7 @@ if vim.g.neovide then config.transparent_background = false end return { "catppuccin/nvim", + enabled = false, name = "catppuccin", lazy = false, priority = 1000, diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 7b5a7f9..acef030 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -1,11 +1,11 @@ return { "nvim-lualine/lualine.nvim", - dependencies = { "nvim-tree/nvim-web-devicons", "SmiteshP/nvim-navic", "folke/noice.nvim" }, - event = { "BufReadPre", "BufNewFile" }, + dependencies = { "nvim-tree/nvim-web-devicons", "folke/noice.nvim", "folke/tokyonight.nvim" }, + event = { "VeryLazy" }, config = true, opts = { options = { - theme = "catppuccin", + theme = "tokyonight", component_separators = "|", section_separators = { left = "", right = "" }, globalstatus = true, @@ -13,19 +13,12 @@ return { sections = { lualine_a = { { "mode", separator = { left = "" }, right_padding = 2 } }, lualine_b = { "filename", { "branch", icon = "󰊢" }, "diff" }, - lualine_c = { "diagnostics", "require('noice').api.status.lsp.get_hl()" }, + lualine_c = { "diagnostics" }, lualine_x = { "filetype", "fileformat", "encoding" }, lualine_y = { "progress" }, lualine_z = { "selectioncount", { "location", separator = { right = "" }, left_padding = 2 } }, }, - tabline = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { "require('nvim-navic').get_location()" }, - lualine_x = { "windows" }, - lualine_y = {}, - lualine_z = {}, - }, + tabline = {}, winbar = {}, extensions = { "aerial", "fzf", "lazy", "neo-tree", "toggleterm", "trouble" }, }, diff --git a/lua/plugins/magma_nvim.lua b/lua/plugins/magma_nvim.lua index 33d3797..33d4eef 100644 --- a/lua/plugins/magma_nvim.lua +++ b/lua/plugins/magma_nvim.lua @@ -1,3 +1,4 @@ return { "dccsillag/magma-nvim", + event = { "BufReadPre", "BufNewFile" } } diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua index 3ddd8f6..21b1760 100644 --- a/lua/plugins/neotree.lua +++ b/lua/plugins/neotree.lua @@ -6,14 +6,19 @@ return { "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended "MunifTanjim/nui.nvim", }, - cmd = "NeoTree", - event = { "BufEnter" }, + cmd = "Neotree", init = function() vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 vim.g.neo_tree_remove_legacy_commands = 1 vim.keymap.set("n", "nn", "Neotree left reveal reveal_force_cwd") vim.keymap.set("n", "nb", "Neotree toggle show buffers right") + if vim.fn.argc() == 1 then + local stat = vim.loop.fs_stat(vim.fn.argv(0)) + if stat and stat.type == "directory" then + require("neo-tree") + end + end end, config = true, opts = { diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua index 28dbfc6..a822508 100644 --- a/lua/plugins/noice.lua +++ b/lua/plugins/noice.lua @@ -1,5 +1,6 @@ return { "folke/noice.nvim", + event = {"VeryLazy"}, dependencies = { "MunifTanjim/nui.nvim", "rcarriga/nvim-notify", @@ -11,8 +12,8 @@ return { enabled = true, format = { "({data.progress.percentage}%) ", - { "{spinner} ", hl_group = "NoiceLspProgressSpinner" }, - { "{data.progress.title} ", hl_group = "NoiceLspProgressTitle" }, + { "{spinner} ", hl_group = "NoiceLspProgressSpinner" }, + { "{data.progress.title} ", hl_group = "NoiceLspProgressTitle" }, { "{data.progress.client} ", hl_group = "NoiceLspProgressClient" }, }, }, @@ -30,15 +31,13 @@ return { win_options = { winblend = 0 }, }, }, - status = { lsp = { event = "lsp", kind = "progress" } }, - routes = { { view = "mini", filter = { event = "lsp", kind = "progress" }, opts = { skip = true } } }, -- you can enable a preset for easier configuration presets = { - bottom_search = false, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together + bottom_search = false, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together long_message_to_split = false, -- long messages will be sent to a splitnoice - inc_rename = true, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = true, -- add a border to hover docs and signature help + inc_rename = true, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = true, -- add a border to hover docs and signature help }, }, } diff --git a/lua/plugins/notify.lua b/lua/plugins/notify.lua index f96506e..08f71c3 100644 --- a/lua/plugins/notify.lua +++ b/lua/plugins/notify.lua @@ -1,9 +1,10 @@ return { "rcarriga/nvim-notify", - dependencies = { "catppuccin" }, + lazy = true, + -- dependencies = { "catppuccin" }, config = true, opts = { - background_colour = require("catppuccin.palettes").get_palette("macchiato").base, + -- background_colour = require("catppuccin.palettes").get_palette("macchiato").base, fps = 60, render = "default", -- "minimal", "simple" }, diff --git a/lua/plugins/tokyonight.lua b/lua/plugins/tokyonight.lua new file mode 100644 index 0000000..9414b02 --- /dev/null +++ b/lua/plugins/tokyonight.lua @@ -0,0 +1,9 @@ +return { + 'folke/tokyonight.nvim', + lazy = true, + opts = { + transparent = false, + styles = { sidebars = "normal", floats = "transparent", } + }, + config = true, +} diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua index 46cc808..d302ce2 100644 --- a/lua/plugins/trouble.lua +++ b/lua/plugins/trouble.lua @@ -8,6 +8,7 @@ return { vim.keymap.set("n", "xd", "TroubleToggle document_diagnostics") vim.keymap.set("n", "xq", "TroubleToggle quickfix") vim.keymap.set("n", "xl", "TroubleToggle loclist") + vim.keymap.set("n", "gR", "TroubleToggle lsp_references") end, config = true, opts = { @@ -15,6 +16,7 @@ return { auto_open = false, auto_close = false, auto_preview = true, - auto_jump = { "lsp_definitions", "lsp_references", "lsp_implementations" }, + auto_jump = { "lsp_definitions" }, + use_diagnostic_signs = true, }, } diff --git a/lua/plugins/which_key.lua b/lua/plugins/which_key.lua index 82b680d..d87f0c0 100644 --- a/lua/plugins/which_key.lua +++ b/lua/plugins/which_key.lua @@ -1,8 +1,9 @@ return { "folke/which-key.nvim", - config = function() + event = { "VeryLazy"}, + init = function() vim.o.timeout = true vim.o.timeoutlen = 300 - require("which-key").setup {} end, + config = true, }