diff --git a/.gitignore b/.gitignore index 005b535b606..8a192cab54d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ test.sh nvim spell/ -lazy-lock.json diff --git a/INSTALLATION_CHECKLIST.md b/INSTALLATION_CHECKLIST.md new file mode 100644 index 00000000000..a067ea7f8cb --- /dev/null +++ b/INSTALLATION_CHECKLIST.md @@ -0,0 +1,120 @@ +# ✅ Avante Installation Checklist + +## What Was Done + +✅ **1. Created Avante Plugin Configuration** +- File: `/Users/stuartstephens/.config/nvim/lua/custom/plugins/avante.lua` +- Provider: `copilot` (uses your existing OpenAI API key) +- Model: `gpt-4o` (latest GPT-4 Omni model) +- Dependencies: telescope, fzf-lua, nui, dressing, snacks +- Auto-suggestions: Disabled to save API costs + +✅ **2. Set Up Keybindings** (No Conflicts!) +``` +aa → Ask Avante about code +ae → Edit with Avante +at → Toggle sidebar +ar → Refactor +ax → Execute slash command +ad → Document code +af → Fix issues +``` + +✅ **3. Configured for Your Existing Copilot Premium** +- Uses your existing `OPENAI_API_KEY` environment variable +- No second subscription needed +- Same API key as OpenCode uses (if you have it set) + +✅ **4. Created Setup Documentation** +- File: `AVANTE_SETUP.md` in your nvim config +- Quick reference guide for all features +- Troubleshooting tips + +## Current Status + +🔄 **Lazy.nvim is installing Avante now** +- Cloning repository +- Installing dependencies (avante.nvim, fzf-lua, etc.) +- Building Rust components +- Should complete shortly + +## Next Steps + +### ⏳ When Installation Completes (in a few minutes): + +1. **Restart Neovim** - Open any file: `nvim ~/.config/nvim/init.lua` + +2. **Verify Installation** + ``` + :checkhealth avante + ``` + Should show green checkmarks for all components + +3. **Test It Out** + - Open any code file + - Select a function: `v` + select lines + - Press `aa` to ask Avante a question + - Or press `at` to toggle the sidebar + +4. **Compare Workflows** + - Try `oa` (OpenCode) vs `aa` (Avante) + - See which feels better for your workflow + - Document your preference + +### 📊 Comparison Points to Test + +| Aspect | OpenCode | Avante | +|--------|----------|--------| +| **Startup** | Terminal-based | Integrated in Neovim | +| **UI** | TUI in terminal | Sidebar panel | +| **Speed** | Full agent system | Quick suggestions | +| **Best for** | Complex tasks | Quick edits | +| **Keybinding** | `o*` | `a*` | + +## ⚠️ Important Notes + +1. **API Key**: Avante needs `OPENAI_API_KEY` environment variable set + - Verify: `echo $OPENAI_API_KEY` + - Set it: Add to `~/.zshrc`: `export OPENAI_API_KEY="sk-..."` + +2. **Costs**: Both tools use the same OpenAI API, so usage is cumulative + - Monitor costs at https://platform.openai.com/account/billing/overview + +3. **Model**: Avante uses `gpt-4o` by default + - Switch to cheaper model (e.g., `gpt-4o-mini`) if needed + - Edit: `/lua/custom/plugins/avante.lua` → change `model` value + +4. **Keybindings**: Zero conflicts with existing setup + - `o*` → OpenCode (unchanged) + - `a*` → Avante (new) + - All other bindings unaffected + +## 📚 Documentation Files + +- **This file**: Current checklist and status +- **AVANTE_SETUP.md**: Full setup guide with troubleshooting +- **avante.lua**: Plugin configuration with inline comments + +## 🎯 Success Criteria + +You'll know Avante is working when: + +✓ Neovim starts without errors +✓ `:checkhealth avante` shows green checks +✓ `at` toggles a sidebar panel +✓ `aa` on selected code shows Avante chat +✓ You can type questions and get responses + +## 💬 Ready to Test? + +Once the installation finishes, just: +1. Open Neovim +2. Press `at` to toggle the Avante sidebar +3. Select some code +4. Press `aa` to ask Avante a question! + +--- + +**Installation started**: Feb 1, 2025 +**Status**: Downloading dependencies... +**Next check**: In ~5 minutes after plugin finishes building diff --git a/README.md b/README.md index 92841110bf2..e795557f56a 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,12 @@ -# kickstart.nvim -## Introduction -A starting point for Neovim that is: - -* Small -* Single-file -* Completely Documented +## Installation -**NOT** a Neovim distribution, but instead a starting point for your configuration. +### Git Config -## Installation +`git config --global user.name "StuartStephens"` +`git config --global user.email "contact@stuartstephens.com"` +`git config --global --add --bool push.autoSetupRemote true` ### Install Neovim @@ -57,8 +53,8 @@ so that you have your own copy that you can modify, then install by cloning the fork to your machine using one of the commands below, depending on your OS. > **NOTE** -> Your fork's URL will be something like this: -> `https://github.com//kickstart.nvim.git` +> Your fork's url will be something like this: +> `https://github.com/StuartStephens/PDE.git` You likely want to remove `lazy-lock.json` from your fork's `.gitignore` file too - it's ignored in the kickstart repo to make maintenance easier, but it's @@ -72,7 +68,7 @@ too - it's ignored in the kickstart repo to make maintenance easier, but it's
Linux and Mac ```sh -git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +git clone https://github.com/StuartStephens/PDE.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim ```
@@ -82,13 +78,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO If you're using `cmd.exe`: ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim" +git clone https://github.com/StuartStephens/PDE.git "%localappdata%\nvim" ``` If you're using `powershell.exe` ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim" +git clone https://github.com/StuartStephens/PDE.git "${env:LOCALAPPDATA}\nvim" ``` diff --git a/init.lua b/init.lua index 1427b6c7d5d..9b88d970a67 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,6 @@ +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + --[[ ===================================================================== @@ -91,7 +94,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -102,7 +105,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -581,29 +584,29 @@ require('lazy').setup({ -- See `:help CursorHold` for information about when this is executed -- -- When you move your cursor, the highlights will be cleared (the second autocommand). - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) - - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } - end, - }) - end + -- local client = vim.lsp.get_client_by_id(event.data.client_id) + -- if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + -- local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) + -- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + -- buffer = event.buf, + -- group = highlight_augroup, + -- callback = vim.lsp.buf.document_highlight, + -- }) + -- + -- vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + -- buffer = event.buf, + -- group = highlight_augroup, + -- callback = vim.lsp.buf.clear_references, + -- }) + -- + -- vim.api.nvim_create_autocmd('LspDetach', { + -- group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), + -- callback = function(event2) + -- vim.lsp.buf.clear_references() + -- vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } + -- end, + -- }) + -- end -- The following code creates a keymap to toggle inlay hints in your -- code, if the language server you are using supports them @@ -664,16 +667,16 @@ require('lazy').setup({ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { -- clangd = {}, - -- gopls = {}, + gopls = {}, -- pyright = {}, - -- rust_analyzer = {}, + rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, + ts_ls = {}, -- lua_ls = { @@ -734,7 +737,7 @@ require('lazy').setup({ cmd = { 'ConformInfo' }, keys = { { - 'f', + 'ff', function() require('conform').format { async = true, lsp_format = 'fallback' } end, @@ -742,8 +745,10 @@ require('lazy').setup({ desc = '[F]ormat buffer', }, }, + ---@module "conform" + ---@type conform.setupOpts opts = { - notify_on_error = false, + notify_on_error = true, format_on_save = function(bufnr) -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional @@ -763,10 +768,13 @@ require('lazy').setup({ formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, + -- python = { 'isort', 'black' }, -- -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, + javascript = { 'prettier', 'prettierd', stop_after_first = false }, + html = { 'prettier', 'htmlbeautifier', 'prettierd', stop_after_first = true }, + htmlangular = { 'prettier', 'htmlbeautifier', stop_after_first = true }, + gotmpl = { 'goimports', 'prettier', 'gofumpt', 'pretterd', stop_after_first = true }, }, }, }, @@ -791,12 +799,12 @@ require('lazy').setup({ -- `friendly-snippets` contains a variety of premade snippets. -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, }, }, 'saadparwaiz1/cmp_luasnip', @@ -894,11 +902,12 @@ require('lazy').setup({ -- change the command in the config to whatever the name of that colorscheme is. -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', + 'Mofiqul/dracula.nvim', priority = 1000, -- Make sure to load this before all the other start plugins. config = function() ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { + require('dracula').setup { + -- require('tokyonight').setup { styles = { comments = { italic = false }, -- Disable italics in comments }, @@ -907,7 +916,14 @@ require('lazy').setup({ -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + -- vim.cmd.colorscheme 'tokyonight-night' + -- vim.cmd.colorscheme 'solarized-osaka' + vim.opt.termguicolors = true + -- vim.cmd.colorscheme 'murphy' + vim.cmd.colorscheme 'dracula' + + -- You can configure highlights by doing something like: + vim.cmd.hi 'Comment gui=none' end, }, @@ -930,7 +946,13 @@ require('lazy').setup({ -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren -- - sd' - [S]urround [D]elete [']quotes -- - sr)' - [S]urround [R]eplace [)] ['] - require('mini.surround').setup() + require('mini.surround').setup { mappings = { add = 'ys', delete = 'ds', replace = 'cs' } } + + -- Don't yank when deleting or changing + local keymap = vim.keymap.set + local opts = { noremap = true, silent = true } + keymap('n', 'd', '"_d', opts) + keymap('n', 'c', '"_c', opts) -- Simple and easy statusline. -- You could remove this setup call if you don't like it, @@ -986,24 +1008,70 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + + -- Add telescope-file-browser as a separate plugin + { + 'nvim-telescope/telescope-file-browser.nvim', + dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' }, + keys = { + { + 'fb', + function() + require('telescope').extensions.file_browser.file_browser() + end, + desc = '[F]ile [B]rowser', + }, + }, + config = function() + local fb_actions = require 'telescope._extensions.file_browser.actions' + + require('telescope').setup { + extensions = { + file_browser = { + hidden = true, + respect_gitignore = false, + mappings = { + i = { + [''] = fb_actions.create_from_prompt, + [''] = fb_actions.remove, + [''] = fb_actions.rename, + [''] = fb_actions.toggle_hidden, + [''] = fb_actions.toggle_respect_gitignore, + }, + n = { + [''] = fb_actions.create_from_prompt, + [''] = fb_actions.remove, + [''] = fb_actions.rename, + [''] = fb_actions.toggle_hidden, + [''] = fb_actions.toggle_respect_gitignore, + }, + }, + }, + }, + } + require('telescope').load_extension 'file_browser' + end, + }, -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! -- In normal mode type `sh` then write `lazy.nvim-plugin` -- you can continue same window with `sr` which resumes last telescope search }, { + rocks = { + enabled = false, + }, ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table @@ -1027,3 +1095,5 @@ require('lazy').setup({ -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et +require 'custom.options' +require 'custom.keymaps' diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000000..3dcd0ac44d5 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,54 @@ +{ + "LuaSnip": { "branch": "master", "commit": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "fd3e882e56956675c620898bf1ffcf4fcbe7ec84" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "619363c30309d29ffa631e67c8183f2a72caa373" }, + "copilot.vim": { "branch": "release", "commit": "a12fd5672110c8aa7e3c8419e28c96943ca179be" }, + "dracula.nvim": { "branch": "main", "commit": "ae752c13e95fb7c5f58da4b5123cb804ea7568ee" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, + "fidget.nvim": { "branch": "main", "commit": "82404b196e73a00b1727a91903beef5ddc319d22" }, + "flutter-tools.nvim": { "branch": "main", "commit": "7d1acfd139215e02d2784733af69a61aaebe06e8" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "git-blame.nvim": { "branch": "main", "commit": "39df33dad2cbf4eb9d17264bcda0c12e670ef1c2" }, + "gitsigns.nvim": { "branch": "main", "commit": "dd3f588bacbeb041be6facf1742e42097f62165d" }, + "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03" }, + "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, + "lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "7b01e2974a47d489bb92f47a41e4c0088ea8f86e" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "9a10e096703966335bd5c46c8c875d5b0690dade" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" }, + "mason.nvim": { "branch": "main", "commit": "bb639d4bf385a4d89f478b83af4d770be05ab7eb" }, + "mini.nvim": { "branch": "main", "commit": "9d0b9b7188d5c24b5a87f0d8b383ec8bda7a0de4" }, + "neorg": { "branch": "main", "commit": "a09e0bb9b32e2d0406d4503ae8c1a7ad2ca83eae" }, + "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" }, + "nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, + "nvim-dap": { "branch": "master", "commit": "531771530d4f82ad2d21e436e3cc052d68d7aebb" }, + "nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" }, + "nvim-dap-ui": { "branch": "master", "commit": "1a66cabaa4a4da0be107d5eda6d57242f0fe7e49" }, + "nvim-lint": { "branch": "master", "commit": "d48f3a76189d03b2239f6df1b2f7e3fa8353743b" }, + "nvim-lspconfig": { "branch": "master", "commit": "6f76a3eeadc2ee235d74cd7d5319e95a261084af" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" }, + "nvim-treesitter": { "branch": "main", "commit": "cf12346a3414fa1b06af75c79faebe7f76df080a" }, + "nvim-treesitter-context": { "branch": "master", "commit": "b311b30818951d01f7b4bf650521b868b3fece16" }, + "nvim-web-devicons": { "branch": "master", "commit": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c" }, + "oil.nvim": { "branch": "master", "commit": "b91ee5a77a6a9605d9c1aaf4fda74b66082c8297" }, + "opencode.nvim": { "branch": "main", "commit": "1f6442f4b0bb140ac3e87a37c53729a72605a1c3" }, + "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, + "snacks.nvim": { "branch": "main", "commit": "882c996cf28183f4d63640de0b4c02ec886d01f2" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "3610dc7dc91f06aa98b11dca5cc30dfa98626b7e" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "b25b749b9db64d375d782094e2b9dce53ad53a40" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, + "vim-fugitive": { "branch": "master", "commit": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua new file mode 100644 index 00000000000..0f5f50d4ea2 --- /dev/null +++ b/lua/custom/keymaps.lua @@ -0,0 +1,80 @@ +local opts = { noremap = true, silent = true } +local keymap = vim.keymap.set + +-- Exit file +keymap('n', 'pv', ':bd', opts) + +-- Vertical Movement with centering +keymap('n', '', 'zz', opts) +keymap('n', '', 'zz', opts) +keymap('n', '}', '}zz', opts) +keymap('n', '{', '{zz', opts) +keymap('n', 'n', 'nzzzv', opts) +keymap('n', 'N', 'Nzzzv', opts) + +-- Resize with arrows +keymap('n', '', ':resize -2', opts) +keymap('n', '', ':resize +2', opts) +keymap('n', '', ':vertical resize -2', opts) +keymap('n', '', ':vertical resize +2', opts) + +-- Navigate buffers +keymap('n', '', ':bnext', opts) +keymap('n', '', ':bprevious', opts) + +-- Move text up and down +keymap('n', '', ':m .+1==', opts) +keymap('n', '', ':m .-2==', opts) +keymap('v', '', ":m '>+1gv=gv", opts) +keymap('v', '', ":m '<-2gv=gv", opts) +keymap('x', '', ":m '>+1gv=gv", opts) +keymap('x', '', ":m '<-2gv=gv", opts) + +-- Insert -- +-- Press jk fast to exit insert mode +keymap('i', 'jk', '', opts) +keymap('i', 'kj', '', opts) + +-- Visual -- +-- Press jk fast to exit visual mode +keymap('v', 'jk', '', opts) +keymap('v', 'kj', '', opts) + +-- Stay in indent mode +keymap('v', '<', '', '>gv^', opts) + +-- Paste without yanking in visual mode +keymap('v', 'p', '"_dP', opts) + +-- Visual Block -- +-- Move text up and down +keymap('x', 'J', ":m '>+1gv=gv", opts) +keymap('x', 'K', ":m '<-2gv=gv", opts) + +-- Quickfix Step File +keymap('n', '', ':cnext', opts) +keymap('n', '', ':cprev', opts) + +-- Toggle diagnostics visibility +keymap('n', 'td', function() + local config = vim.diagnostic.config() + if config.virtual_text == false and config.signs == false and config.underline == false then + -- Diagnostics are currently disabled, enable them + vim.diagnostic.config({ + virtual_text = true, + signs = true, + underline = true, + }) + else + -- Diagnostics are currently enabled, disable them + vim.diagnostic.config({ + virtual_text = false, + signs = false, + underline = false, + }) + end +end, { desc = '[T]oggle [D]iagnostics' }) + +-- Restart LSP +keymap('n', 'lr', ':LspRestart', { desc = '[L]SP [R]estart' }) diff --git a/lua/custom/options.lua b/lua/custom/options.lua new file mode 100644 index 00000000000..7717c06abea --- /dev/null +++ b/lua/custom/options.lua @@ -0,0 +1,44 @@ +-- set termguicolors to enable highlight groups +vim.opt.termguicolors = true + +-- Kickstart stuff? +vim.opt.guicursor = '' + +vim.opt.nu = true +vim.opt.relativenumber = true + +vim.opt.tabstop = 4 +vim.opt.softtabstop = 4 +vim.opt.shiftwidth = 4 +vim.opt.expandtab = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv 'HOME' .. '/.vim/undodir' +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 12 +vim.opt.signcolumn = 'yes' +vim.opt.isfname:append '@-@' + +vim.opt.updatetime = 50 + +-- vim.opt.colorcolumn = '80' + +-- Neorg settings -- +vim.opt.foldmethod = 'indent' +vim.opt.foldlevelstart = 1 +vim.opt.conceallevel = 1 +vim.opt.concealcursor = 'nc' + +-- Neovim config for inline hints +vim.lsp.inlay_hint.enable(true) diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000000..1a804873741 --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,3 @@ +return { + 'github/copilot.vim', +} diff --git a/lua/custom/plugins/flutter-tools.lua b/lua/custom/plugins/flutter-tools.lua new file mode 100644 index 00000000000..7ded7106182 --- /dev/null +++ b/lua/custom/plugins/flutter-tools.lua @@ -0,0 +1,34 @@ +return { + -- Dart language server + { + 'neovim/nvim-lspconfig', + opts = { + servers = { + dartls = {}, + }, + }, + }, + + -- Flutter tools integration + { + 'akinsho/flutter-tools.nvim', + lazy = false, + dependencies = { + 'nvim-lua/plenary.nvim', + 'stevearc/dressing.nvim', -- optional UI improvements + 'neovim/nvim-lspconfig', + }, + config = function() + require('flutter-tools').setup {} + vim.lsp.document_color.enable() + end, + }, + + -- Treesitter for Dart syntax + { + 'nvim-treesitter/nvim-treesitter', + opts = { + ensure_installed = { 'dart' }, + }, + }, +} diff --git a/lua/custom/plugins/fugitive.lua b/lua/custom/plugins/fugitive.lua new file mode 100644 index 00000000000..f906630c69c --- /dev/null +++ b/lua/custom/plugins/fugitive.lua @@ -0,0 +1,6 @@ +return { + 'tpope/vim-fugitive', + config = function() + vim.keymap.set('n', 'G', 'vertical G', { desc = '[G]it Fugitive' }) + end, +} diff --git a/lua/custom/plugins/git-blame.lua b/lua/custom/plugins/git-blame.lua new file mode 100644 index 00000000000..c3ecf05a0fc --- /dev/null +++ b/lua/custom/plugins/git-blame.lua @@ -0,0 +1 @@ +return { 'f-person/git-blame.nvim' } diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000000..74da576e200 --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,25 @@ +return { + 'ThePrimeagen/harpoon', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + require('harpoon').setup {} + local mark = require 'harpoon.mark' + local ui = require 'harpoon.ui' + + vim.keymap.set('n', 'pa', mark.add_file) + vim.keymap.set('n', '', ui.toggle_quick_menu) + + vim.keymap.set('n', '', function() + ui.nav_file(1) + end) + vim.keymap.set('n', '', function() + ui.nav_file(2) + end) + vim.keymap.set('n', '', function() + ui.nav_file(3) + end) + vim.keymap.set('n', '', function() + ui.nav_file(4) + end) + end, +} diff --git a/lua/custom/plugins/markdown-preview.lua b/lua/custom/plugins/markdown-preview.lua new file mode 100644 index 00000000000..3518c063417 --- /dev/null +++ b/lua/custom/plugins/markdown-preview.lua @@ -0,0 +1,10 @@ +return { + 'iamcco/markdown-preview.nvim', + -- keys = { + -- { "", "MarkdownPreview", desc = "Markdown Preview" } + -- }, + config = function() + vim.fn['mkdp#util#install']() + vim.keymap.set('n', 'md', 'MarkdownPreview', { desc = 'Markdown Preview' }) + end, +} diff --git a/lua/custom/plugins/neorg.lua b/lua/custom/plugins/neorg.lua new file mode 100644 index 00000000000..5871ea2ccd7 --- /dev/null +++ b/lua/custom/plugins/neorg.lua @@ -0,0 +1,6 @@ +return { + 'nvim-neorg/neorg', + lazy = true, -- Disable lazy loading as some `lazy.nvim` distributions set `lazy = true` by default + version = '*', -- Pin Neorg to the latest stable release + config = true, +} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua new file mode 100644 index 00000000000..29373a85ef5 --- /dev/null +++ b/lua/custom/plugins/noice.lua @@ -0,0 +1,15 @@ +return { + 'folke/noice.nvim', + event = 'VeryLazy', + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + 'MunifTanjim/nui.nvim', + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + 'rcarriga/nvim-notify', + }, +} diff --git a/lua/custom/plugins/nvim-colorizer.lua b/lua/custom/plugins/nvim-colorizer.lua new file mode 100644 index 00000000000..416f2d12559 --- /dev/null +++ b/lua/custom/plugins/nvim-colorizer.lua @@ -0,0 +1,6 @@ +return { + 'norcalli/nvim-colorizer.lua', + config = function() + require('colorizer').setup() + end, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000000..74f7349a06d --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,11 @@ +return { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + -- dependencies = { { "nvim-mini/mini.icons", opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, +} diff --git a/lua/custom/plugins/opencode.lua b/lua/custom/plugins/opencode.lua new file mode 100644 index 00000000000..765474c1e31 --- /dev/null +++ b/lua/custom/plugins/opencode.lua @@ -0,0 +1,143 @@ +return { + 'NickvanDyke/opencode.nvim', + dependencies = { + -- Recommended for `ask()` and `select()`. + -- Required for `toggle()`. + { 'folke/snacks.nvim', lazy = false, priority = 1000, opts = { input = {}, picker = {}, terminal = { enabled = true }, notifier = { top_down = false } } }, + }, + config = function() + local function pick_open_port() + local tcp = vim.uv.new_tcp() + if not tcp then + return 4096 + end + + local bind_result = tcp:bind('127.0.0.1', 0) + if bind_result ~= 0 and bind_result ~= true then + tcp:close() + return 4096 + end + + local sock = tcp:getsockname() + tcp:close() + if not sock or type(sock.port) ~= 'number' then + return 4096 + end + return sock.port + end + + local opencode_port = pick_open_port() + local opencode_cmd = string.format('NODE_TLS_REJECT_UNAUTHORIZED=0 opencode --port %d', opencode_port) + + local function run_opencode_terminal_action(action, label) + local ok, err = pcall(action) + if ok then + return + end + + local message = tostring(err) + if message:find('E444', 1, true) then + vim.cmd 'new' + local retried_ok, retried_err = pcall(action) + if retried_ok then + return + end + vim.notify(string.format('%s failed after retry: %s', label, retried_err), vim.log.levels.ERROR, { title = 'opencode.nvim' }) + return + end + + vim.notify(string.format('%s failed: %s', label, message), vim.log.levels.ERROR, { title = 'opencode.nvim' }) + end + + vim.g.opencode_opts = { + server = { + port = opencode_port, + start = function() + run_opencode_terminal_action(function() + require('opencode.terminal').start(opencode_cmd) + end, 'OpenCode terminal start') + end, + stop = function() + run_opencode_terminal_action(function() + require('opencode.terminal').stop() + end, 'OpenCode terminal stop') + end, + toggle = function() + run_opencode_terminal_action(function() + require('opencode.terminal').toggle(opencode_cmd) + end, 'OpenCode terminal toggle') + end, + }, + } + + -- Required for `vim.g.opencode_opts.auto_reload` + vim.opt.autoread = true + + local scroll_group = vim.api.nvim_create_augroup('OpencodeTerminalScroll', { clear = true }) + vim.api.nvim_create_autocmd('TermOpen', { + group = scroll_group, + callback = function(args) + local terminal_name = vim.api.nvim_buf_get_name(args.buf) + if not terminal_name:find('opencode', 1, true) then + return + end + + local function tmap(keys, command, desc) + vim.keymap.set('t', keys, function() + require('opencode').command(command) + end, { buffer = args.buf, silent = true, desc = desc }) + end + + tmap('', 'session.half.page.up', 'Messages half page up') + tmap('', 'session.half.page.down', 'Messages half page down') + tmap('', 'session.half.page.up', 'Messages half page up') + tmap('', 'session.half.page.down', 'Messages half page down') + tmap('', 'session.half.page.up', 'Messages half page up') + tmap('', 'session.half.page.down', 'Messages half page down') + tmap('', 'session.page.up', 'Messages page up') + tmap('', 'session.page.down', 'Messages page down') + end, + }) + + -- Recommended/example keymaps + vim.keymap.set({ 'n', 'x' }, 'oa', function() + require('opencode').ask('@this: ', { submit = true }) + end, { desc = 'Ask about this' }) + + vim.keymap.set({ 'n', 'x' }, 'os', function() + require('opencode').select() + end, { desc = 'Select prompt' }) + + vim.keymap.set({ 'n', 'x' }, 'o+', function() + require('opencode').prompt '@this' + end, { desc = 'Add this' }) + + vim.keymap.set('n', 'ot', function() + require('opencode').toggle() + end, { desc = 'Toggle embedded' }) + + vim.keymap.set('n', 'oc', function() + require('opencode').command() + end, { desc = 'Select command' }) + + vim.keymap.set('n', 'on', function() + require('opencode').command 'session.new' + end, { desc = 'New session' }) + + vim.keymap.set('n', 'oi', function() + require('opencode').command 'session.interrupt' + end, { desc = 'Interrupt session' }) + + vim.keymap.set('n', 'oA', function() + require('opencode').command 'agent.cycle' + end, { desc = 'Cycle selected agent' }) + + vim.keymap.set('n', '', function() + require('opencode').command 'session.half.page.up' + end, { desc = 'Messages half page up' }) + + vim.keymap.set('n', '', function() + require('opencode').command 'session.half.page.down' + end, { desc = 'Messages half page down' }) + end, +} diff --git a/lua/custom/plugins/tree-sitter-context.lua b/lua/custom/plugins/tree-sitter-context.lua new file mode 100644 index 00000000000..64b9da9e9f2 --- /dev/null +++ b/lua/custom/plugins/tree-sitter-context.lua @@ -0,0 +1,23 @@ +vim.keymap.set('n', '[c', function() + require('treesitter-context').go_to_context() +end, { silent = true }) + +return { + 'nvim-treesitter/nvim-treesitter-context', + config = function() + require('treesitter-context').setup { + enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) + max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. + min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. + line_numbers = true, + multiline_threshold = 20, -- Maximum number of lines to show for a single context + trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' + mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline' + -- Separator between context and content. Should be a single character string, like '-'. + -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. + separator = nil, + zindex = 20, -- The Z-index of the context window + on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching + } + end, +} diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index bd4422695aa..fdb8bc828c3 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -13,6 +13,7 @@ return { keys = { { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, }, + lazy = false, opts = { filesystem = { window = { @@ -20,6 +21,10 @@ return { ['\\'] = 'close_window', }, }, + filtered_items = { + hide_dotfiles = false, + hide_gitignored = false, + }, }, }, } diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000000..b7ea3d5e12b --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "nvim", + "lockfileVersion": 3, + "requires": true, + "packages": {} +}