From bcb5556f7c198f777a7e24281016a7dcd748242a Mon Sep 17 00:00:00 2001 From: Drew Galbraith Date: Sat, 5 Apr 2025 14:05:32 -0700 Subject: [PATCH] Initial Commit --- init.lua | 5 +++++ lazy-lock.json | 11 +++++++++++ lua/config/keys.lua | 19 +++++++++++++++++++ lua/config/lazy.lua | 35 +++++++++++++++++++++++++++++++++++ lua/config/lsp.lua | 34 ++++++++++++++++++++++++++++++++++ lua/config/opts.lua | 9 +++++++++ lua/plugins/lsp.lua | 7 +++++++ lua/plugins/snacks.lua | 9 +++++++++ lua/plugins/theme.lua | 21 +++++++++++++++++++++ lua/plugins/ui.lua | 16 ++++++++++++++++ 10 files changed, 166 insertions(+) create mode 100644 init.lua create mode 100644 lazy-lock.json create mode 100644 lua/config/keys.lua create mode 100644 lua/config/lazy.lua create mode 100644 lua/config/lsp.lua create mode 100644 lua/config/opts.lua create mode 100644 lua/plugins/lsp.lua create mode 100644 lua/plugins/snacks.lua create mode 100644 lua/plugins/theme.lua create mode 100644 lua/plugins/ui.lua diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..8be279a --- /dev/null +++ b/init.lua @@ -0,0 +1,5 @@ +require("config.lazy") + +require("config.opts") +require("config.lsp") +require("config.keys") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..270e70d --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,11 @@ +{ + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "material.nvim": { "branch": "main", "commit": "96285a62923ea8e38aea7b603099752da2a97e97" }, + "mini.icons": { "branch": "main", "commit": "910db5df9724d65371182948f921fce23c2c881e" }, + "nord.nvim": { "branch": "main", "commit": "b4863217a6272ecd41862e09fdea0ba7b7e5f8f5" }, + "nvim-lspconfig": { "branch": "master", "commit": "cb33dea610b7eff240985be9f6fe219920e630ef" }, + "nvim-treesitter": { "branch": "master", "commit": "523a9e148919f58eb5a013f76787e57696e00c93" }, + "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, + "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +} diff --git a/lua/config/keys.lua b/lua/config/keys.lua new file mode 100644 index 0000000..79cfea9 --- /dev/null +++ b/lua/config/keys.lua @@ -0,0 +1,19 @@ +require("which-key").add({ + { "c", group = "code" }, + { "cd", vim.diagnostic.open_float, name = "diagnostic" }, + + { "e", Snacks.explorer.open, name = "explorer" }, + + { "f", group = "find" }, + { "ff", Snacks.picker.files, name = "files" }, + + { "u", group = "ui" }, + { "ut", Snacks.picker.colorschemes, name = "colorschemes" }, + + { "g", group = "goto" }, + { "gd", vim.lsp.buf.definition, name = "definition" }, + { "gr", Snacks.picker.lsp_references, nowait = true, name = "references" }, +}) + +Snacks.toggle.diagnostics():map("ud") +Snacks.toggle.inlay_hints():map("ui") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..e2cb418 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = {}, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua new file mode 100644 index 0000000..a366fe1 --- /dev/null +++ b/lua/config/lsp.lua @@ -0,0 +1,34 @@ +require("lspconfig").basedpyright.setup({}) +require("lspconfig").ruff.setup({}) + +require("lspconfig").lua_ls.setup({ + on_init = function(client) + if client.workspace_folders then + local path = client.workspace_folders[1].name + if + path ~= vim.fn.stdpath("config") + and (vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc")) + then + return + end + end + + client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + }, + }, + }) + end, + settings = { + Lua = {}, + }, +}) diff --git a/lua/config/opts.lua b/lua/config/opts.lua new file mode 100644 index 0000000..089980e --- /dev/null +++ b/lua/config/opts.lua @@ -0,0 +1,9 @@ +vim.opt.termguicolors = true +vim.cmd("colorscheme tokyonight") + +vim.diagnostic.config({ + virtual_text = true, + virtual_lines = { + current_line = true, + }, +}) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..afd7d48 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,7 @@ +return { + "neovim/nvim-lspconfig", + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + }, +} diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua new file mode 100644 index 0000000..5feb1af --- /dev/null +++ b/lua/plugins/snacks.lua @@ -0,0 +1,9 @@ +return { + "folke/snacks.nvim", + priority = 1000, + opts = { + picker = {}, + explorer = {}, + toggle = {}, + }, +} diff --git a/lua/plugins/theme.lua b/lua/plugins/theme.lua new file mode 100644 index 0000000..f168ddb --- /dev/null +++ b/lua/plugins/theme.lua @@ -0,0 +1,21 @@ +return { + { + "marko-cerovac/material.nvim", + lazy = false, + priority = 1000, + config = function() + vim.g.material_style = "darker" + end, + }, + { + "folke/tokyonight.nvim", + lazy = true, + opts = { style = "moon" }, + }, + { + "dupeiran001/nord.nvim", + lazy = false, + priority = 1000, + opts = {}, + }, +} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua new file mode 100644 index 0000000..54b25dd --- /dev/null +++ b/lua/plugins/ui.lua @@ -0,0 +1,16 @@ +return { + { + "folke/which-key.nvim", + event = "VeryLazy", + }, + { + "echasnovski/mini.icons", + version = "*", + init = function() + package.preload["nvim-web-devicons"] = function() + require("mini.icons").mock_nvim_web_devicons() + return package.loaded["nvim-web-devicons"] + end + end, + }, +}