diff --git a/neovim/README.md b/neovim/README.md index 8846349..bc4763a 100644 --- a/neovim/README.md +++ b/neovim/README.md @@ -26,11 +26,16 @@ sudo apt install build-essential ``` 1. Install the latest version of Neovim from the Neovim Launchpad PPA. Ubuntu apt has an older version, and since then much has changed, so we'll prefer the latest stable from the PPA. -``` +```ubuntu sudo add-apt-repository ppa:neovim-ppa/stable sudo apt update sudo apt install neovim ``` + +```macos +brew install neovim +``` + 2. Ensure that the nvim runtimepath is correctly configured to include `~/.config.nvim`. You can check that by executing this nvim command: `:echo &runtimepath`. 3. Both `init.lua` as well as the `lua/` folder and its contents should be symlinked to `~/.config/nvim` (Might need to create the nvim folder if first time). diff --git a/neovim/init.lua b/neovim/init.lua index 51fae46..08734df 100644 --- a/neovim/init.lua +++ b/neovim/init.lua @@ -1,11 +1,5 @@ --- config files +vim.g.mapleader = " " +vim.g.maplocalleader = " " + require("config.options") -require("config.mappings") -require("config.autocmds") - --- lazy nvim plugin manager --- require("config.lazy") - --- manual inclusion of plugins -require("plugins.helloWorld") - +require("config.lazy") diff --git a/neovim/lua/config/lazy.lua b/neovim/lua/config/lazy.lua index 7ffc959..8aa6c2b 100644 --- a/neovim/lua/config/lazy.lua +++ b/neovim/lua/config/lazy.lua @@ -1,17 +1,27 @@ --- install lazy.nvim +-- 1. Correct Path & UV check local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + -- 2. Improved system call with error reporting + 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) --- load plugins -require("lazy").setup("plugins") - +-- 3. Explicit setup table +require("lazy").setup({ + spec = { + { import = "plugins" }, + }, + defaults = { + lazy = false, -- Load custom plugins on startup by default + }, +}) diff --git a/neovim/lua/plugins/coding.lua b/neovim/lua/plugins/coding.lua new file mode 100644 index 0000000..122e5fe --- /dev/null +++ b/neovim/lua/plugins/coding.lua @@ -0,0 +1,16 @@ +return { + { + "saghen/blink.cmp", + version = "*", + opts = { + keymap = { preset = 'default' }, + appearance = { + use_nvim_cmp_as_default = true, + nerd_font_variant = 'mono' + }, + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + }, + }, +} diff --git a/neovim/lua/plugins/helloWorld.lua b/neovim/lua/plugins/helloWorld.lua deleted file mode 100644 index 2ca4c43..0000000 --- a/neovim/lua/plugins/helloWorld.lua +++ /dev/null @@ -1,10 +0,0 @@ --- hello.lua - --- Define a function that prints a greeting -local function hello_world() - print("Hello, Neovim!") -end - --- Create a command ":SayHello" that runs the say_hello function -vim.api.nvim_create_user_command('HelloWorld', hello_world, {}) - diff --git a/neovim/lua/plugins/snacks.lua b/neovim/lua/plugins/snacks.lua new file mode 100644 index 0000000..7e1d414 --- /dev/null +++ b/neovim/lua/plugins/snacks.lua @@ -0,0 +1,30 @@ +return { + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + picker = { enabled = true }, + explorer = { enabled = true }, + dashboard = { enabled = true }, + indent = { enabled = true }, + input = { enabled = true }, + notifier = { enabled = true }, + scope = { enabled = true }, + scroll = { enabled = true }, + + bigfile = { enabled = true }, + words = { enabled = true }, + }, + keys = { + { "", function() Snacks.picker.smart() end, desc = "Smart Find Files" }, + { "ff", function() Snacks.picker.files() end, desc = "Find Files" }, + { "fg", function() Snacks.picker.grep() end, desc = "Grep" }, + { "fb", function() Snacks.picker.buffers() end, desc = "Buffers" }, + { "fr", function() Snacks.picker.recent() end, desc = "Recent" }, + { "e", function() Snacks.explorer() end, desc = "File Explorer" }, + { "bd", function() Snacks.bufdelete() end, desc = "Delete Buffer" }, + { ".", function() Snacks.scratch() end, desc = "Toggle Scratchpad" }, + }, + }, +} diff --git a/neovim/lua/plugins/theme.lua b/neovim/lua/plugins/theme.lua new file mode 100644 index 0000000..cb4c0dc --- /dev/null +++ b/neovim/lua/plugins/theme.lua @@ -0,0 +1,10 @@ +return { + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + config = function() + vim.cmd([[colorscheme tokyonight]]) + end, + }, +}