diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..9cf1062 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,19 @@ +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3f19854 --- /dev/null +++ b/README.md @@ -0,0 +1,229 @@ +# kickstart.nvim + +## Introduction + +A starting point for Neovim that is: + +* Small +* Single-file +* Completely Documented + +**NOT** a Neovim distribution, but instead a starting point for your configuration. + +## Installation + +### Install Neovim + +Kickstart.nvim targets *only* the latest +['stable'](https://github.com/neovim/neovim/releases/tag/stable) and latest +['nightly'](https://github.com/neovim/neovim/releases/tag/nightly) of Neovim. +If you are experiencing issues, please make sure you have the latest versions. + +### Install External Dependencies + +External Requirements: +- Basic utils: `git`, `make`, `unzip`, C Compiler (`gcc`) +- [ripgrep](https://github.com/BurntSushi/ripgrep#installation) +- Clipboard tool (xclip/xsel/win32yank or other depending on platform) +- A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons + - if you have it set `vim.g.have_nerd_font` in `init.lua` to true +- Language Setup: + - If want to write Typescript, you need `npm` + - If want to write Golang, you will need `go` + - etc. + +> **NOTE** +> See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes +> and quick install snippets + +### Install Kickstart + +> **NOTE** +> [Backup](#FAQ) your previous configuration (if any exists) + +Neovim's configurations are located under the following paths, depending on your OS: + +| OS | PATH | +| :- | :--- | +| Linux, MacOS | `$XDG_CONFIG_HOME/nvim`, `~/.config/nvim` | +| Windows (cmd)| `%localappdata%\nvim\` | +| Windows (powershell)| `$env:LOCALAPPDATA\nvim\` | + +#### Recommended Step + +[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) this repo +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` + +#### Clone kickstart.nvim +> **NOTE** +> If following the recommended step above (i.e., forking the repo), replace +> `nvim-lua` with `` in the commands below + +
Linux and Mac + +```sh +git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +``` + +
+ +
Windows + +If you're using `cmd.exe`: + +``` +git clone https://github.com/nvim-lua/kickstart.nvim.git %localappdata%\nvim\ +``` + +If you're using `powershell.exe` + +``` +git clone https://github.com/nvim-lua/kickstart.nvim.git $env:LOCALAPPDATA\nvim\ +``` + +
+ +### Post Installation + +Start Neovim + +```sh +nvim +``` + +That's it! Lazy will install all the plugins you have. Use `:Lazy` to view +current plugin status. Hit `q` to close the window. + +Read through the `init.lua` file in your configuration folder for more +information about extending and exploring Neovim. That also includes +examples of adding popularly requested plugins. + + +### Getting Started + +[The Only Video You Need to Get Started with Neovim](https://youtu.be/m8C0Cq9Uv9o) + +### FAQ + +* What should I do if I already have a pre-existing neovim configuration? + * You should back it up and then delete all associated files. + * This includes your existing init.lua and the neovim files in `~/.local` + which can be deleted with `rm -rf ~/.local/share/nvim/` +* Can I keep my existing configuration in parallel to kickstart? + * Yes! You can use [NVIM_APPNAME](https://neovim.io/doc/user/starting.html#%24NVIM_APPNAME)`=nvim-NAME` + to maintain multiple configurations. For example, you can install the kickstart + configuration in `~/.config/nvim-kickstart` and create an alias: + ``` + alias nvim-kickstart='NVIM_APPNAME="nvim-kickstart" nvim' + ``` + When you run Neovim using `nvim-kickstart` alias it will use the alternative + config directory and the matching local directory + `~/.local/share/nvim-kickstart`. You can apply this approach to any Neovim + distribution that you would like to try out. +* What if I want to "uninstall" this configuration: + * See [lazy.nvim uninstall](https://github.com/folke/lazy.nvim#-uninstalling) information +* Why is the kickstart `init.lua` a single file? Wouldn't it make sense to split it into multiple files? + * The main purpose of kickstart is to serve as a teaching tool and a reference + configuration that someone can easily use to `git clone` as a basis for their own. + As you progress in learning Neovim and Lua, you might consider splitting `init.lua` + into smaller parts. A fork of kickstart that does this while maintaining the + same functionality is available here: + * [kickstart-modular.nvim](https://github.com/dam9000/kickstart-modular.nvim) + * Discussions on this topic can be found here: + * [Restructure the configuration](https://github.com/nvim-lua/kickstart.nvim/issues/218) + * [Reorganize init.lua into a multi-file setup](https://github.com/nvim-lua/kickstart.nvim/pull/473) + +### Install Recipes + +Below you can find OS specific install instructions for Neovim and dependencies. + +After installing all the dependencies continue with the [Install Kickstart](#Install-Kickstart) step. + +#### Windows Installation + +
Windows with Microsoft C++ Build Tools and CMake +Installation may require installing build tools and updating the run command for `telescope-fzf-native` + +See `telescope-fzf-native` documentation for [more details](https://github.com/nvim-telescope/telescope-fzf-native.nvim#installation) + +This requires: + +- Install CMake and the Microsoft C++ Build Tools on Windows + +```lua +{'nvim-telescope/telescope-fzf-native.nvim', build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' } +``` +
+
Windows with gcc/make using chocolatey +Alternatively, one can install gcc and make which don't require changing the config, +the easiest way is to use choco: + +1. install [chocolatey](https://chocolatey.org/install) +either follow the instructions on the page or use winget, +run in cmd as **admin**: +``` +winget install --accept-source-agreements chocolatey.chocolatey +``` + +2. install all requirements using choco, exit previous cmd and +open a new one so that choco path is set, and run in cmd as **admin**: +``` +choco install -y neovim git ripgrep wget fd unzip gzip mingw make +``` +
+
WSL (Windows Subsystem for Linux) + +``` +wsl --install +wsl +sudo add-apt-repository ppa:neovim-ppa/unstable -y +sudo apt update +sudo apt install make gcc ripgrep unzip git xclip neovim +``` +
+ +#### Linux Install +
Ubuntu Install Steps + +``` +sudo add-apt-repository ppa:neovim-ppa/unstable -y +sudo apt update +sudo apt install make gcc ripgrep unzip git xclip neovim +``` +
+
Debian Install Steps + +``` +sudo apt update +sudo apt install make gcc ripgrep unzip git xclip curl + +# Now we install nvim +curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz +sudo rm -rf /opt/nvim-linux64 +sudo mkdir -p /opt/nvim-linux64 +sudo chmod a+rX /opt/nvim-linux64 +sudo tar -C /opt -xzf nvim-linux64.tar.gz + +# make it available in /usr/local/bin, distro installs to /usr/bin +sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/ +``` +
+
Fedora Install Steps + +``` +sudo dnf install -y gcc make git ripgrep fd-find unzip neovim +``` +
+ +
Arch Install Steps + +``` +sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim +``` +
+ diff --git a/after/ftplugin/c.lua b/after/ftplugin/c.lua new file mode 100644 index 0000000..25ba546 --- /dev/null +++ b/after/ftplugin/c.lua @@ -0,0 +1,6 @@ +vim.opt_local.expandtab = true +vim.opt_local.smartindent = true +vim.opt_local.tabstop = 2 +vim.opt_local.shiftwidth = 2 +vim.opt_local.formatoptions:append { c = true, r = true, o = true, q = true } +vim.bo.commentstring = '// %s' diff --git a/after/ftplugin/cmake.lua b/after/ftplugin/cmake.lua new file mode 100644 index 0000000..a7b35a8 --- /dev/null +++ b/after/ftplugin/cmake.lua @@ -0,0 +1,4 @@ +vim.opt_local.expandtab = true +vim.opt_local.smartindent = true +vim.opt_local.tabstop = 2 +vim.opt_local.shiftwidth = 2 diff --git a/after/ftplugin/cpp.lua b/after/ftplugin/cpp.lua new file mode 100644 index 0000000..25ba546 --- /dev/null +++ b/after/ftplugin/cpp.lua @@ -0,0 +1,6 @@ +vim.opt_local.expandtab = true +vim.opt_local.smartindent = true +vim.opt_local.tabstop = 2 +vim.opt_local.shiftwidth = 2 +vim.opt_local.formatoptions:append { c = true, r = true, o = true, q = true } +vim.bo.commentstring = '// %s' diff --git a/doc/kickstart.txt b/doc/kickstart.txt new file mode 100644 index 0000000..cb87ac3 --- /dev/null +++ b/doc/kickstart.txt @@ -0,0 +1,24 @@ +================================================================================ +INTRODUCTION *kickstart.nvim* + +Kickstart.nvim is a project to help you get started on your neovim journey. + + *kickstart-is-not* +It is not: +- Complete framework for every plugin under the sun +- Place to add every plugin that could ever be useful + + *kickstart-is* +It is: +- Somewhere that has a good start for the most common "IDE" type features: + - autocompletion + - goto-definition + - find references + - fuzzy finding + - and hinting at what more can be done :) +- A place to _kickstart_ your journey. + - You should fork this project and use/modify it so that it matches your + style and preferences. If you don't want to do that, there are probably + other projects that would fit much better for you (and that's great!)! + + vim:tw=78:ts=8:ft=help:norl: diff --git a/doc/tags b/doc/tags new file mode 100644 index 0000000..687ae77 --- /dev/null +++ b/doc/tags @@ -0,0 +1,3 @@ +kickstart-is kickstart.txt /*kickstart-is* +kickstart-is-not kickstart.txt /*kickstart-is-not* +kickstart.nvim kickstart.txt /*kickstart.nvim* diff --git a/lua/kickstart/health.lua b/lua/kickstart/health.lua new file mode 100644 index 0000000..b59d086 --- /dev/null +++ b/lua/kickstart/health.lua @@ -0,0 +1,52 @@ +--[[ +-- +-- This file is not required for your own configuration, +-- but helps people determine if their system is setup correctly. +-- +--]] + +local check_version = function() + local verstr = tostring(vim.version()) + if not vim.version.ge then + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + return + end + + if vim.version.ge(vim.version(), '0.10-dev') then + vim.health.ok(string.format("Neovim version is: '%s'", verstr)) + else + vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + end +end + +local check_external_reqs = function() + -- Basic utils: `git`, `make`, `unzip` + for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do + local is_executable = vim.fn.executable(exe) == 1 + if is_executable then + vim.health.ok(string.format("Found executable: '%s'", exe)) + else + vim.health.warn(string.format("Could not find executable: '%s'", exe)) + end + end + + return true +end + +return { + check = function() + vim.health.start 'kickstart.nvim' + + vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth` + + Fix only warnings for plugins and languages you intend to use. + Mason will give warnings for languages that are not installed. + You do not need to install, unless you want to use those languages!]] + + local uv = vim.uv or vim.loop + vim.health.info('System Information: ' .. vim.inspect(uv.os_uname())) + + check_version() + check_external_reqs() + end, +} diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua new file mode 100644 index 0000000..196f2c6 --- /dev/null +++ b/lua/kickstart/plugins/debug.lua @@ -0,0 +1,105 @@ +-- debug.lua +-- +-- Shows how to use the DAP plugin to debug your code. +-- +-- Primarily focused on configuring the debugger for Go, but can +-- be extended to other languages as well. That's why it's called +-- kickstart.nvim and not kitchen-sink.nvim ;) + +return { + -- NOTE: Yes, you can install new plugins here! + 'mfussenegger/nvim-dap', + -- NOTE: And you can specify dependencies as well + dependencies = { + -- Creates a beautiful debugger UI + 'rcarriga/nvim-dap-ui', + + -- Required dependency for nvim-dap-ui + 'nvim-neotest/nvim-nio', + + -- Installs the debug adapters for you + 'williamboman/mason.nvim', + 'jay-babu/mason-nvim-dap.nvim', + + -- Add your own debuggers here + 'leoluz/nvim-dap-go', + }, + keys = function(_, keys) + local dap = require 'dap' + local dapui = require 'dapui' + return { + -- Basic debugging keymaps, feel free to change to your liking! + { '', dap.continue, desc = 'Debug: Start/Continue' }, + { '', dap.step_into, desc = 'Debug: Step Into' }, + { '', dap.step_over, desc = 'Debug: Step Over' }, + { '', dap.step_out, desc = 'Debug: Step Out' }, + { 'b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' }, + { + 'B', + function() + dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end, + desc = 'Debug: Set Breakpoint', + }, + -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. + { '', dapui.toggle, desc = 'Debug: See last session result.' }, + unpack(keys), + } + end, + config = function() + local dap = require 'dap' + local dapui = require 'dapui' + + require('mason-nvim-dap').setup { + -- Makes a best effort to setup the various debuggers with + -- reasonable debug configurations + automatic_installation = true, + + -- You can provide additional configuration to the handlers, + -- see mason-nvim-dap README for more information + handlers = {}, + + -- You'll need to check that you have the required things installed + -- online, please don't ask me how to install them :) + ensure_installed = { + -- Update this to ensure that you have the debuggers for the langs you want + 'delve', + }, + } + + -- Dap UI setup + -- For more information, see |:help nvim-dap-ui| + dapui.setup { + -- Set icons to characters that are more likely to work in every terminal. + -- Feel free to remove or use ones that you like more! :) + -- Don't feel like these are good choices. + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', + run_last = '▶▶', + terminate = '⏹', + disconnect = '⏏', + }, + }, + } + + dap.listeners.after.event_initialized['dapui_config'] = dapui.open + dap.listeners.before.event_terminated['dapui_config'] = dapui.close + dap.listeners.before.event_exited['dapui_config'] = dapui.close + + -- Install golang specific config + require('dap-go').setup { + delve = { + -- On Windows delve must be run attached or it crashes. + -- See https://github.com/leoluz/nvim-dap-go/blob/main/README.md#configuring + detached = vim.fn.has 'win32' == 0, + }, + } + end, +} diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua new file mode 100644 index 0000000..ca9bc23 --- /dev/null +++ b/lua/kickstart/plugins/lint.lua @@ -0,0 +1,55 @@ +return { + + { -- Linting + 'mfussenegger/nvim-lint', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + local lint = require 'lint' + lint.linters_by_ft = { + markdown = { 'markdownlint' }, + } + + -- To allow other plugins to add linters to require('lint').linters_by_ft, + -- instead set linters_by_ft like this: + -- lint.linters_by_ft = lint.linters_by_ft or {} + -- lint.linters_by_ft['markdown'] = { 'markdownlint' } + -- + -- However, note that this will enable a set of default linters, + -- which will cause errors unless these tools are available: + -- { + -- clojure = { "clj-kondo" }, + -- dockerfile = { "hadolint" }, + -- inko = { "inko" }, + -- janet = { "janet" }, + -- json = { "jsonlint" }, + -- markdown = { "vale" }, + -- rst = { "vale" }, + -- ruby = { "ruby" }, + -- terraform = { "tflint" }, + -- text = { "vale" } + -- } + -- + -- You can disable the default linters by setting their filetypes to nil: + -- lint.linters_by_ft['clojure'] = nil + -- lint.linters_by_ft['dockerfile'] = nil + -- lint.linters_by_ft['inko'] = nil + -- lint.linters_by_ft['janet'] = nil + -- lint.linters_by_ft['json'] = nil + -- lint.linters_by_ft['markdown'] = nil + -- lint.linters_by_ft['rst'] = nil + -- lint.linters_by_ft['ruby'] = nil + -- lint.linters_by_ft['terraform'] = nil + -- lint.linters_by_ft['text'] = nil + + -- Create autocommand which carries out the actual linting + -- on the specified events. + local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { + group = lint_augroup, + callback = function() + lint.try_lint() + end, + }) + end, + }, +} diff --git a/lua/rayandrew/keymaps.lua b/lua/rayandrew/keymaps.lua new file mode 100644 index 0000000..80c84f5 --- /dev/null +++ b/lua/rayandrew/keymaps.lua @@ -0,0 +1,8 @@ +vim.keymap.set('n', '', 'nohlsearch') +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) +vim.keymap.set('n', 'fs', 'w', { desc = 'Save file' }) +vim.keymap.set('n', 'ws', 'split', { desc = '[W]indow Horizontal [S]plit' }) -- split horizontal +vim.keymap.set('n', 'wv', 'vsplit', { desc = '[W]indow [V]ertical Split' }) -- split vertical +vim.keymap.set('n', 'wq', 'q', { desc = '[W]indow [Q]uit' }) -- quit +vim.keymap.set('n', 'x', '!chmod +x %', { desc = 'Chmod File E[x]ecutable', silent = true }) +vim.keymap.set('n', 'lz', 'Lazy', { desc = 'Chmod File E[x]ecutable', silent = true }) diff --git a/lua/rayandrew/plugins/aerial.lua b/lua/rayandrew/plugins/aerial.lua new file mode 100644 index 0000000..69ef50b --- /dev/null +++ b/lua/rayandrew/plugins/aerial.lua @@ -0,0 +1,14 @@ +return { + { + 'stevearc/aerial.nvim', + event = 'VeryLazy', + keys = { + { 'ta', 'AerialToggle', desc = '[T]oggle [A]erial' }, + }, + opts = {}, + dependencies = { + 'nvim-treesitter/nvim-treesitter', + 'nvim-tree/nvim-web-devicons', + }, + }, +} diff --git a/lua/rayandrew/plugins/ai-chat.lua b/lua/rayandrew/plugins/ai-chat.lua new file mode 100644 index 0000000..a5531bd --- /dev/null +++ b/lua/rayandrew/plugins/ai-chat.lua @@ -0,0 +1,138 @@ +return { + -- { + -- 'huynle/ogpt.nvim', + -- event = 'VeryLazy', + -- opts = { + -- default_provider = 'ollama', + -- edgy = true, -- enable this! + -- single_window = false, -- set this to true if you want only one OGPT window to appear at a time + -- providers = { + -- ollama = { + -- api_host = os.getenv 'OLLAMA_API_HOST' or 'http://localhost:11434', + -- api_key = os.getenv 'OLLAMA_API_KEY' or '', + -- }, + -- }, + -- }, + -- dependencies = { + -- 'MunifTanjim/nui.nvim', + -- 'nvim-lua/plenary.nvim', + -- 'nvim-telescope/telescope.nvim', + -- }, + -- }, + -- { + -- 'folke/edgy.nvim', + -- event = 'VeryLazy', + -- init = function() + -- vim.opt.laststatus = 3 + -- vim.opt.splitkeep = 'screen' -- or "topline" or "screen" + -- end, + -- opts = { + -- exit_when_last = false, + -- animate = { + -- enabled = false, + -- }, + -- wo = { + -- winbar = true, + -- winfixwidth = true, + -- winfixheight = false, + -- winhighlight = 'WinBar:EdgyWinBar,Normal:EdgyNormal', + -- spell = false, + -- signcolumn = 'no', + -- }, + -- keys = { + -- -- -- close window + -- ['q'] = function(win) + -- win:close() + -- end, + -- -- close sidebar + -- ['Q'] = function(win) + -- win.view.edgebar:close() + -- end, + -- -- increase width + -- [''] = function(win) + -- win:resize('width', 3) + -- end, + -- -- decrease width + -- [''] = function(win) + -- win:resize('width', -3) + -- end, + -- -- increase height + -- [''] = function(win) + -- win:resize('height', 3) + -- end, + -- -- decrease height + -- [''] = function(win) + -- win:resize('height', -3) + -- end, + -- }, + -- right = { + -- { + -- title = 'OGPT Popup', + -- ft = 'ogpt-popup', + -- size = { width = 0.2 }, + -- wo = { + -- wrap = true, + -- }, + -- }, + -- { + -- title = 'OGPT Parameters', + -- ft = 'ogpt-parameters-window', + -- size = { height = 6 }, + -- wo = { + -- wrap = true, + -- }, + -- }, + -- { + -- title = 'OGPT Template', + -- ft = 'ogpt-template', + -- size = { height = 6 }, + -- }, + -- { + -- title = 'OGPT Sessions', + -- ft = 'ogpt-sessions', + -- size = { height = 6 }, + -- wo = { + -- wrap = true, + -- }, + -- }, + -- { + -- title = 'OGPT System Input', + -- ft = 'ogpt-system-window', + -- size = { height = 6 }, + -- }, + -- { + -- title = 'OGPT', + -- ft = 'ogpt-window', + -- size = { height = 0.5 }, + -- wo = { + -- wrap = true, + -- }, + -- }, + -- { + -- title = 'OGPT {{{selection}}}', + -- ft = 'ogpt-selection', + -- size = { width = 80, height = 4 }, + -- wo = { + -- wrap = true, + -- }, + -- }, + -- { + -- title = 'OGPt {{{instruction}}}', + -- ft = 'ogpt-instruction', + -- size = { width = 80, height = 4 }, + -- wo = { + -- wrap = true, + -- }, + -- }, + -- { + -- title = 'OGPT Chat', + -- ft = 'ogpt-input', + -- size = { width = 80, height = 4 }, + -- wo = { + -- wrap = true, + -- }, + -- }, + -- }, + -- }, + -- }, +} diff --git a/lua/rayandrew/plugins/autocomplete.lua b/lua/rayandrew/plugins/autocomplete.lua new file mode 100644 index 0000000..b970082 --- /dev/null +++ b/lua/rayandrew/plugins/autocomplete.lua @@ -0,0 +1,216 @@ +local utils = require 'rayandrew.utils' + +return { + { -- Autocompletion + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + { + 'L3MON4D3/LuaSnip', + build = (function() + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then + return + end + return 'make install_jsregexp' + end)(), + dependencies = { + -- `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, + }, + }, + }, + 'saadparwaiz1/cmp_luasnip', + + -- Adds other completion capabilities. + -- nvim-cmp does not ship with all sources by default. They are split + -- into multiple repos for maintenance purposes. + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + { + 'zbirenbaum/copilot-cmp', + -- enable if hostname starts with polaris-* + cond = utils.is_argonne_servers(), + opts = {}, + dependencies = { + { + 'zbirenbaum/copilot.lua', + cmd = 'Copilot', + event = 'InsertEnter', + config = true, + }, + }, + config = function(_, opts) + local copilot_cmp = require 'copilot_cmp' + copilot_cmp.setup(opts) + -- attach cmp source whenever copilot attaches + -- fixes lazy-loading issues with the copilot cmp source + local on_attach = function(client, _) + if client.name == 'copilot' then + copilot_cmp._on_insert_enter {} + end + end + vim.api.nvim_create_autocmd('LspAttach', { + callback = function(args) + local buffer = args.buf ---@type number + local client = vim.lsp.get_client_by_id(args.data.client_id) + on_attach(client, buffer) + end, + }) + end, + }, + { + 'sourcegraph/sg.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + cond = not utils.is_argonne_servers(), + opts = { + enable_cody = true, + accept_tos = true, + download_binaries = true, + }, + }, + -- { + -- 'Exafunction/codeium.nvim', + -- dependencies = { 'nvim-lua/plenary.nvim' }, + -- config = true, + -- -- disable if hostname starts with polaris-* + -- cond = not utils.is_argonne_servers(), + -- }, + -- { + -- 'tzachar/cmp-ai', + -- config = function() + -- local cmp_ai = require 'cmp_ai.config' + -- + -- cmp_ai:setup { + -- max_lines = 100, + -- provider = 'Ollama', + -- provider_options = { + -- model = 'codegemma:2b-code', + -- prompt = function(lines_before, lines_after) + -- return lines_before + -- end, + -- suffix = function(lines_after) + -- return lines_after + -- end, + -- }, + -- notify = true, + -- -- notify_callback = function(msg) + -- -- vim.notify(msg) + -- -- end, + -- run_on_every_keystroke = true, + -- ignored_file_types = { + -- -- default is not to ignore + -- -- uncomment to ignore in lua: + -- -- lua = true + -- }, + -- } + -- end, + -- }, + }, + config = function() + -- See `:help cmp` + local cmp = require 'cmp' + local luasnip = require 'luasnip' + luasnip.config.setup {} + + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + completion = { completeopt = 'menu,menuone,noinsert' }, + + -- For an understanding of why these mappings were + -- chosen, you will need to read `:help ins-completion` + -- + -- No, but seriously. Please read `:help ins-completion`, it is really good! + mapping = cmp.mapping.preset.insert { + -- Select the [n]ext item + [''] = cmp.mapping.select_next_item(), + -- Select the [p]revious item + [''] = cmp.mapping.select_prev_item(), + + -- Scroll the documentation window [b]ack / [f]orward + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + + -- Accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + [''] = cmp.mapping.confirm { select = true }, + + -- If you prefer more traditional completion keymaps, + -- you can uncomment the following lines + --[''] = cmp.mapping.confirm { select = true }, + --[''] = cmp.mapping.select_next_item(), + --[''] = cmp.mapping.select_prev_item(), + + -- Manually trigger a completion from nvim-cmp. + -- Generally you don't need this, because nvim-cmp will display + -- completions whenever it has completion options available. + [''] = cmp.mapping.complete {}, + + -- [''] = cmp.mapping( + -- cmp.mapping.complete { + -- config = { + -- sources = cmp.config.sources { + -- -- { name = 'cmp_ai' }, + -- -- { name = 'codeium' }, + -- { name = 'cody' }, + -- }, + -- }, + -- }, + -- { 'i' } + -- ), + + -- Think of as moving to the right of your snippet expansion. + -- So if you have a snippet that's like: + -- function $name($args) + -- $body + -- end + -- + -- will move you to the right of each of the expansion locations. + -- is similar, except moving you backwards. + [''] = cmp.mapping(function() + if luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + end + end, { 'i', 's' }), + + [''] = cmp.mapping(function() + if luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + end + end, { 'i', 's' }), + + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + }, + sources = { + -- { name = 'cmp_ai' }, + { name = 'cody' }, + { name = 'codeium' }, + { name = 'copilot' }, + { + name = 'lazydev', + -- set group index to 0 to skip loading LuaLS completions as lazydev recommends it + group_index = 0, + }, + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + }, + } + end, + }, +} diff --git a/lua/rayandrew/plugins/autopairs.lua b/lua/rayandrew/plugins/autopairs.lua new file mode 100644 index 0000000..87a7e5f --- /dev/null +++ b/lua/rayandrew/plugins/autopairs.lua @@ -0,0 +1,16 @@ +-- autopairs +-- https://github.com/windwp/nvim-autopairs + +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + -- Optional dependency + dependencies = { 'hrsh7th/nvim-cmp' }, + config = function() + require('nvim-autopairs').setup {} + -- If you want to automatically add `(` after selecting a function or method + local cmp_autopairs = require 'nvim-autopairs.completion.cmp' + local cmp = require 'cmp' + cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done()) + end, +} diff --git a/lua/rayandrew/plugins/colorscheme.lua b/lua/rayandrew/plugins/colorscheme.lua new file mode 100644 index 0000000..8e1270b --- /dev/null +++ b/lua/rayandrew/plugins/colorscheme.lua @@ -0,0 +1,46 @@ +return { + { + 'thimc/gruber-darker.nvim', + lazy = true, + -- priority = 1000, + opts = { + transparent = true, + }, + config = function(_, opts) + require('gruber-darker').setup(opts) + vim.cmd.colorscheme 'gruber-darker' + vim.cmd.hi 'Comment gui=none' + end, + }, + + { + 'Mofiqul/adwaita.nvim', + lazy = true, + -- priority = 1000, + -- configure and set on startup + config = function() + vim.g.adwaita_darker = true -- for darker version + vim.g.adwaita_disable_cursorline = true -- to disable cursorline + vim.g.adwaita_transparent = true -- makes the background transparent + -- vim.cmd.colorscheme 'adwaita' + end, + }, + + { + 'HoNamDuong/hybrid.nvim', + lazy = false, + priority = 1000, + config = function() + vim.cmd.colorscheme 'hybrid' + end, + }, + + { + 'rebelot/kanagawa.nvim', + lazy = true, + -- priority = 1000, + config = function() + -- vim.cmd.colorscheme 'kanagawa-dragon' + end, + }, +} diff --git a/lua/rayandrew/plugins/compile-mode.lua b/lua/rayandrew/plugins/compile-mode.lua new file mode 100644 index 0000000..52bf2eb --- /dev/null +++ b/lua/rayandrew/plugins/compile-mode.lua @@ -0,0 +1,15 @@ +return { + 'ej-shafran/compile-mode.nvim', + branch = 'latest', + cmd = { 'Compile' }, + -- or a specific version: + -- tag = "v3.0.0" + dependencies = { + 'nvim-lua/plenary.nvim', + { 'm00qek/baleia.nvim', tag = 'v1.3.0' }, + }, + opts = { + -- to add ANSI escape code support, add: + baleia_setup = true, + }, +} diff --git a/lua/rayandrew/plugins/conform.lua b/lua/rayandrew/plugins/conform.lua new file mode 100644 index 0000000..a389c3e --- /dev/null +++ b/lua/rayandrew/plugins/conform.lua @@ -0,0 +1,47 @@ +return { + { -- Autoformat + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + keys = { + { + 'f', + function() + require('conform').format { async = true, lsp_fallback = true } + end, + mode = '', + desc = '[F]ormat buffer', + }, + }, + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + + -- Disable "format_on_save lsp_fallback" for languages that don't + -- have a well standardized coding style. You can add additional + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { c = true, cpp = true } + return { + timeout_ms = 5000, + lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], + } + end, + formatters_by_ft = { + lua = { 'stylua' }, + -- Conform can also run multiple formatters sequentially + python = { 'isort', 'black' }, + rust = { 'rustfmt' }, + nix = { 'alejandra' }, + c = { 'clang-format' }, + cpp = { 'clang-format' }, + ['_'] = { 'trim_whitespace', 'trim_newlines', 'squeeze_blanks' }, + -- + -- You can use 'stop_after_first' to run the first available formatter from the list + -- javascript = { "prettierd", "prettier", stop_after_first = true }, + }, + }, + }, +} diff --git a/lua/rayandrew/plugins/fold.lua b/lua/rayandrew/plugins/fold.lua new file mode 100644 index 0000000..431398d --- /dev/null +++ b/lua/rayandrew/plugins/fold.lua @@ -0,0 +1,56 @@ +return { + { + 'kevinhwang91/nvim-ufo', + dependencies = { + { 'kevinhwang91/promise-async' }, + }, + init = function() + vim.o.foldcolumn = '0' -- '0' is not bad + vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value + vim.o.foldlevelstart = 99 + vim.o.foldenable = true + end, + config = function() + local handler = function(virtText, lnum, endLnum, width, truncate) + local newVirtText = {} + local totalLines = vim.api.nvim_buf_line_count(0) + local foldedLines = endLnum - lnum + local suffix = (' ↙ %d %d%%'):format(foldedLines, foldedLines / totalLines * 100) + local sufWidth = vim.fn.strdisplaywidth(suffix) + local targetWidth = width - sufWidth + local curWidth = 0 + for _, chunk in ipairs(virtText) do + local chunkText = chunk[1] + local chunkWidth = vim.fn.strdisplaywidth(chunkText) + if targetWidth > curWidth + chunkWidth then + table.insert(newVirtText, chunk) + else + chunkText = truncate(chunkText, targetWidth - curWidth) + local hlGroup = chunk[2] + table.insert(newVirtText, { chunkText, hlGroup }) + chunkWidth = vim.fn.strdisplaywidth(chunkText) + -- str width returned from truncate() may less than 2nd argument, need padding + if curWidth + chunkWidth < targetWidth then + suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) + end + break + end + curWidth = curWidth + chunkWidth + end + local rAlignAppndx = math.max(width - 3 - curWidth - sufWidth, 0) + suffix = (' '):rep(rAlignAppndx) .. suffix + table.insert(newVirtText, { suffix, 'MoreMsg' }) + return newVirtText + end + require('ufo').setup { + provider_selector = function() + return { 'treesitter', 'indent' } + end, + fold_virt_text_handler = handler, + } + -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself + vim.keymap.set('n', 'zR', require('ufo').openAllFolds) + vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) + end, + }, +} diff --git a/lua/rayandrew/plugins/fzf.lua b/lua/rayandrew/plugins/fzf.lua new file mode 100644 index 0000000..7e0ee6f --- /dev/null +++ b/lua/rayandrew/plugins/fzf.lua @@ -0,0 +1,38 @@ +return { + { + 'ibhagwan/fzf-lua', + event = 'VimEnter', + -- dependencies = { 'nvim-tree/nvim-web-devicons' }, + dependencies = { 'echasnovski/mini.icons' }, + -- build = './install --bin', + config = function() + local fzf = require 'fzf-lua' + fzf.setup { + { + 'default', + keymap = { + builtin = { + true, -- inherit all other default binds + [''] = 'close', + [''] = 'close', + }, + }, + }, + } + vim.keymap.set('n', 'sf', fzf.files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', 'sk', fzf.keymaps, { desc = '[S]earch [K]eymaps' }) + vim.keymap.set('n', 'ss', fzf.builtin, { desc = '[S]earch [S]elect Telescope' }) + vim.keymap.set('n', 'sg', fzf.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', 'sd', fzf.diagnostics_document, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', 'sr', fzf.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', 's.', fzf.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set('n', '', fzf.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', 'sh', fzf.helptags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sw', fzf.grep_cword, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', '/', fzf.lgrep_curbuf, { desc = '[/] Fuzzily search in current buffer' }) + vim.keymap.set('n', 'sn', function() + fzf.files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) + end, + }, +} diff --git a/lua/rayandrew/plugins/git-conflict.lua b/lua/rayandrew/plugins/git-conflict.lua new file mode 100644 index 0000000..3bd430d --- /dev/null +++ b/lua/rayandrew/plugins/git-conflict.lua @@ -0,0 +1,16 @@ +return { + { + 'akinsho/git-conflict.nvim', + event = 'VeryLazy', + version = '*', + config = function() + require('git-conflict').setup() + vim.api.nvim_create_autocmd('User', { + pattern = 'GitConflictDetected', + callback = function() + vim.notify('Conflict detected in ' .. vim.fn.expand '') + end, + }) + end, + }, +} diff --git a/lua/rayandrew/plugins/gitsigns.lua b/lua/rayandrew/plugins/gitsigns.lua new file mode 100644 index 0000000..fa7e1b9 --- /dev/null +++ b/lua/rayandrew/plugins/gitsigns.lua @@ -0,0 +1,71 @@ +-- Adds git related signs to the gutter, as well as utilities for managing changes +-- NOTE: gitsigns is already included in init.lua but contains only the base +-- config. This will add also the recommended keymaps. +-- See `:help gitsigns` to understand what the configuration keys do + +return { + { + -- Adds git related signs to the gutter, as well as utilities for managing changes + + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + on_attach = function(bufnr) + local gitsigns = require 'gitsigns' + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal { ']c', bang = true } + else + gitsigns.nav_hunk 'next' + end + end, { desc = 'Jump to next git [c]hange' }) + + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal { '[c', bang = true } + else + gitsigns.nav_hunk 'prev' + end + end, { desc = 'Jump to previous git [c]hange' }) + + -- Actions + -- visual mode + map('v', 'hs', function() + gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'stage git hunk' }) + map('v', 'hr', function() + gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } + end, { desc = 'reset git hunk' }) + -- normal mode + map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) + map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) + map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) + map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) + map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) + map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) + map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) + map('n', 'hD', function() + gitsigns.diffthis '@' + end, { desc = 'git [D]iff against last commit' }) + -- Toggles + map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) + map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) + end, + }, + }, +} diff --git a/lua/rayandrew/plugins/harpoon.lua b/lua/rayandrew/plugins/harpoon.lua new file mode 100644 index 0000000..9cf0dd5 --- /dev/null +++ b/lua/rayandrew/plugins/harpoon.lua @@ -0,0 +1,60 @@ +return { + { + 'theprimeagen/harpoon', + event = 'VeryLazy', + keys = { + { + 'ha', + function() + local mark = require 'harpoon.mark' + mark.add_file() + vim.print('Added to Harpoon ' .. vim.fn.expand '%') + end, + desc = 'Harpoon Add File', + }, + { + 'he', + function() + local ui = require 'harpoon.ui' + ui.toggle_quick_menu() + end, + desc = 'Harpoon UI', + }, + { + 'h1', + function() + local ui = require 'harpoon.ui' + ui.nav_file(1) + end, + }, + { + 'h2', + function() + local ui = require 'harpoon.ui' + ui.nav_file(2) + end, + }, + { + 'h3', + function() + local ui = require 'harpoon.ui' + ui.nav_file(3) + end, + }, + { + 'h4', + function() + local ui = require 'harpoon.ui' + ui.nav_file(4) + end, + }, + { + 'h5', + function() + local ui = require 'harpoon.ui' + ui.nav_file(5) + end, + }, + }, + }, +} diff --git a/lua/rayandrew/plugins/indent_line.lua b/lua/rayandrew/plugins/indent_line.lua new file mode 100644 index 0000000..ed7f269 --- /dev/null +++ b/lua/rayandrew/plugins/indent_line.lua @@ -0,0 +1,9 @@ +return { + { -- Add indentation guides even on blank lines + 'lukas-reineke/indent-blankline.nvim', + -- Enable `lukas-reineke/indent-blankline.nvim` + -- See `:help ibl` + main = 'ibl', + opts = {}, + }, +} diff --git a/lua/rayandrew/plugins/init.lua b/lua/rayandrew/plugins/init.lua new file mode 100644 index 0000000..bf635c1 --- /dev/null +++ b/lua/rayandrew/plugins/init.lua @@ -0,0 +1,11 @@ +-- You can add your own plugins here or in other files in this directory! +-- I promise not to create any merge conflicts in this directory :) + +vim.schedule(function() + require 'rayandrew.keymaps' + require 'rayandrew.commands' +end) + +-- +-- See the kickstart.nvim README for more information +return {} diff --git a/lua/rayandrew/plugins/markdown.lua b/lua/rayandrew/plugins/markdown.lua new file mode 100644 index 0000000..e889579 --- /dev/null +++ b/lua/rayandrew/plugins/markdown.lua @@ -0,0 +1,11 @@ +return { + { + 'OXY2DEV/markview.nvim', + lazy = true, + ft = 'markdown', + dependencies = { + 'nvim-treesitter/nvim-treesitter', + 'nvim-tree/nvim-web-devicons', + }, + }, +} diff --git a/lua/rayandrew/plugins/mini.lua b/lua/rayandrew/plugins/mini.lua new file mode 100644 index 0000000..56e0357 --- /dev/null +++ b/lua/rayandrew/plugins/mini.lua @@ -0,0 +1,81 @@ +return { + { -- buffer remove + 'echasnovski/mini.bufremove', + version = false, + -- stylua: ignore + keys = { + { "bd", function() require("mini.bufremove").delete(0, false) end, desc = "Delete Buffer" }, + { "bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" }, + }, + }, + { + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + + 'echasnovski/mini.ai', + version = false, + opts = { + n_lines = 500, + }, + }, + { + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - sr)' - [S]urround [R]eplace [)] ['] + + 'echasnovski/mini.surround', + version = false, + config = true, + }, + + { + 'echasnovski/mini.statusline', + version = false, + config = function() + -- Simple and easy statusline. + -- You could remove this setup call if you don't like it, + -- and try some other statusline plugin + local statusline = require 'mini.statusline' + -- set use_icons to true if you have a Nerd Font + statusline.setup { use_icons = vim.g.have_nerd_font } + + -- You can configure sections in the statusline by overriding their + -- default behavior. For example, here we set the section for + -- cursor location to LINE:COLUMN + ---@diagnostic disable-next-line: duplicate-set-field + statusline.section_location = function() + return '%2l:%-2v' + end + end, + }, + { + 'echasnovski/mini.indentscope', + version = false, + config = true, + }, + { + 'echasnovski/mini-git', + main = 'mini.git', + version = false, + config = true, + keys = { + { 'gs', 'lua MiniGit.show_at_cursor()', mode = 'n' }, + { 'gs', 'lua MiniGit.show_at_cursor()', mode = 'x' }, + }, + }, + -- { + -- 'echasnovski/mini.comment', + -- version = false, + -- config = true, + -- keys = { + -- 'gc', + -- 'gcc', + -- }, + -- }, +} diff --git a/lua/rayandrew/plugins/multicursors.lua b/lua/rayandrew/plugins/multicursors.lua new file mode 100644 index 0000000..793f8b9 --- /dev/null +++ b/lua/rayandrew/plugins/multicursors.lua @@ -0,0 +1,42 @@ +return { + -- lazy.nvim: + { + 'smoka7/multicursors.nvim', + event = 'VeryLazy', + dependencies = { + 'nvimtools/hydra.nvim', + }, + opts = { + normal_keys = { + -- to change default lhs of key mapping change the key + [''] = { + method = nil, + opts = { desc = 'Exit' }, + }, + }, + insert_keys = { + -- to change default lhs of key mapping change the key + [''] = { + method = nil, + opts = { desc = 'Exit' }, + }, + }, + extend_keys = { + -- to change default lhs of key mapping change the key + [''] = { + method = nil, + opts = { desc = 'Exit' }, + }, + }, + }, + cmd = { 'MCstart', 'MCvisual', 'MCclear', 'MCpattern', 'MCvisualPattern', 'MCunderCursor' }, + keys = { + { + mode = { 'v', 'n' }, + 'm', + 'MCstart', + desc = 'Create a selection for selected text or word under the cursor', + }, + }, + }, +} diff --git a/lua/rayandrew/plugins/neo-tree.lua b/lua/rayandrew/plugins/neo-tree.lua new file mode 100644 index 0000000..31a74bb --- /dev/null +++ b/lua/rayandrew/plugins/neo-tree.lua @@ -0,0 +1,73 @@ +-- Neo-tree is a Neovim plugin to browse the file system +-- https://github.com/nvim-neo-tree/neo-tree.nvim + +return { + 'nvim-neo-tree/neo-tree.nvim', + version = '*', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended + 'MunifTanjim/nui.nvim', + }, + cmd = 'Neotree', + keys = { + { '\\', ':Neotree reveal', desc = 'NeoTree reveal' }, + -- { + -- 'fe', + -- ':Neotree toggle', + -- desc = 'Toggle NeoTree', + -- }, + }, + opts = { + filesystem = { + window = { + mappings = { + ['\\'] = 'close_window', + [''] = 'none', + -- ["C"] = "copy", + ['C'] = { + 'copy', + config = { + show_path = 'absolute', -- "none", "relative", "absolute" + }, + }, + ['R'] = { 'rename', config = { show_path = 'absolute' } }, + ['y'] = function(state) + local node = state.tree:get_node() + -- get relative path + local filepath = node:get_id() + local filename = vim.fn.fnamemodify(filepath, ':.') + -- local filename = node.name + vim.fn.setreg('+', filename) + vim.notify('Copied: ' .. filename) + end, + ['Y'] = function(state) + local node = state.tree:get_node() + local filepath = node:get_id() + vim.fn.setreg('+', filepath) + vim.notify('Copied: ' .. filepath) + end, + ['O'] = { + command = function(state) + local node = state.tree:get_node() + local filepath = node.path + local osType = os.getenv 'OS' + + local command + + if osType == 'Windows_NT' then + command = 'start ' .. filepath + elseif osType == 'Darwin' then + command = 'open ' .. filepath + else + command = 'xdg-open ' .. filepath + end + os.execute(command) + end, + desc = 'open_with_system_defaults', + }, + }, + }, + }, + }, +} diff --git a/lua/rayandrew/plugins/neogit.lua b/lua/rayandrew/plugins/neogit.lua new file mode 100644 index 0000000..fae6e8d --- /dev/null +++ b/lua/rayandrew/plugins/neogit.lua @@ -0,0 +1,22 @@ +return { + { + 'NeogitOrg/neogit', + dependencies = { + 'nvim-lua/plenary.nvim', -- required + 'sindrets/diffview.nvim', -- optional - Diff integration + + -- Only one of these is needed, not both. + 'nvim-telescope/telescope.nvim', -- optional + 'ibhagwan/fzf-lua', -- optional + }, + config = true, + lazy = true, + keys = { + { + 'gg', + ':Neogit', + desc = 'Neo[g]it', + }, + }, + }, +} diff --git a/lua/rayandrew/plugins/numb.lua b/lua/rayandrew/plugins/numb.lua new file mode 100644 index 0000000..d72f31c --- /dev/null +++ b/lua/rayandrew/plugins/numb.lua @@ -0,0 +1,7 @@ +return { + { + 'nacro90/numb.nvim', + event = 'VimEnter', + config = true, + }, +} diff --git a/lua/rayandrew/plugins/oil.lua b/lua/rayandrew/plugins/oil.lua new file mode 100644 index 0000000..355ded5 --- /dev/null +++ b/lua/rayandrew/plugins/oil.lua @@ -0,0 +1,72 @@ +return { + { + 'stevearc/oil.nvim', + dependencies = { { 'echasnovski/mini.icons', opts = {} } }, + cmd = { 'Oil' }, + opts = { + default_file_explorer = true, + restore_win_options = true, + use_default_keymaps = false, + float = { + padding = 2, + max_width = 240, + max_height = 70, + -- width = 0.2, + -- max_height = 0.5, + border = 'rounded', + win_options = { + winblend = 10, + }, + }, + keymaps = { + ['g?'] = 'actions.show_help', + [''] = 'actions.select', + -- [''] = { 'actions.select', opts = { vertical = true }, desc = 'Open the entry in a vertical split' }, + -- [''] = { 'actions.select', opts = { horizontal = true }, desc = 'Open the entry in a horizontal split' }, + [''] = { 'actions.select', opts = { tab = true }, desc = 'Open the entry in new tab' }, + [''] = 'actions.preview', + [''] = 'actions.close', + [''] = 'actions.close', + [''] = 'actions.refresh', + ['-'] = 'actions.parent', + ['_'] = 'actions.open_cwd', + ['`'] = 'actions.cd', + ['~'] = { 'actions.cd', opts = { scope = 'tab' }, desc = ':tcd to the current oil directory' }, + ['gs'] = 'actions.change_sort', + ['gx'] = 'actions.open_external', + ['g.'] = 'actions.toggle_hidden', + ['g\\'] = 'actions.toggle_trash', + [''] = { + callback = function() + if vim.bo.filetype == 'oil' then + local oil = require 'oil' + vim.g.oil_show_info = not vim.g.oil_show_info + if vim.g.oil_show_info then + oil.set_columns { + 'permissions', + 'size', + 'mtime', + 'icon', + } + else + oil.set_columns {} + end + return + end + end, + desc = 'Toggle info', + }, + ['q'] = 'actions.close', + -- [''] = 'actions.toggle_hidden', + ['?'] = 'actions.show_help', + }, + }, + keys = { + { 'fm', 'Oil', desc = '[F]ile [M]anager' }, + { 'fM', 'Oil --float', desc = '[F]ile [M]anager' }, + }, + init = function() + vim.g.oil_show_info = false + end, + }, +} diff --git a/lua/rayandrew/plugins/osc52.lua b/lua/rayandrew/plugins/osc52.lua new file mode 100644 index 0000000..5ad645b --- /dev/null +++ b/lua/rayandrew/plugins/osc52.lua @@ -0,0 +1,15 @@ +return { + { + 'ojroques/nvim-osc52', + event = 'VimEnter', + config = function() + local copy = function() + if vim.v.event.operator == 'y' and vim.v.event.regname == '+' then + require('osc52').copy_register '+' + end + end + + vim.api.nvim_create_autocmd('TextYankPost', { callback = copy }) + end, + }, +} diff --git a/lua/rayandrew/plugins/outline.lua b/lua/rayandrew/plugins/outline.lua new file mode 100644 index 0000000..1e5cb04 --- /dev/null +++ b/lua/rayandrew/plugins/outline.lua @@ -0,0 +1,14 @@ +return { + { + 'hedyhli/outline.nvim', + event = 'VeryLazy', + keys = { + { 'to', 'Outline', desc = '[T]oggle [O]utline' }, + }, + config = function() + require('outline').setup { + -- Your setup opts here (leave empty to use defaults) + } + end, + }, +} diff --git a/lua/rayandrew/plugins/rainbow-delimiters.lua b/lua/rayandrew/plugins/rainbow-delimiters.lua new file mode 100644 index 0000000..98b5973 --- /dev/null +++ b/lua/rayandrew/plugins/rainbow-delimiters.lua @@ -0,0 +1,34 @@ +return { + { + 'HiPhish/rainbow-delimiters.nvim', + event = 'VimEnter', + config = function() + local rainbow_delimiters = require 'rainbow-delimiters' + + ---@type rainbow_delimiters.config + vim.g.rainbow_delimiters = { + strategy = { + [''] = rainbow_delimiters.strategy['global'], + vim = rainbow_delimiters.strategy['local'], + }, + query = { + [''] = 'rainbow-delimiters', + lua = 'rainbow-blocks', + }, + priority = { + [''] = 110, + lua = 210, + }, + highlight = { + 'RainbowDelimiterRed', + 'RainbowDelimiterYellow', + 'RainbowDelimiterBlue', + 'RainbowDelimiterOrange', + 'RainbowDelimiterGreen', + 'RainbowDelimiterViolet', + 'RainbowDelimiterCyan', + }, + } + end, + }, +} diff --git a/lua/rayandrew/plugins/readline.lua b/lua/rayandrew/plugins/readline.lua new file mode 100644 index 0000000..6701535 --- /dev/null +++ b/lua/rayandrew/plugins/readline.lua @@ -0,0 +1,78 @@ +return { + { + 'assistcontrol/readline.nvim', + event = 'VeryLazy', + keys = { + { + '', + function() + require('readline').forward_word() + end, + mode = '!', + }, + { + '', + function() + require('readline').backward_word() + end, + mode = '!', + }, + { + '', + function() + require('readline').kill_word() + end, + mode = '!', + }, + { + '', + function() + require('readline').backward_kill_word() + end, + mode = '!', + }, + { + '', + function() + require('readline').unix_word_rubout() + end, + mode = '!', + }, + { + '', + function() + require('readline').kill_line() + end, + mode = '!', + }, + { + '', + function() + require('readline').backward_kill_line() + end, + mode = '!', + }, + { + '', + function() + require('readline').beginning_of_line() + end, + mode = '!', + }, + { + '', + function() + require('readline').end_of_line() + end, + mode = '!', + }, + { '', '', mode = '!' }, -- forward-char + { '', '', mode = '!' }, -- backward-char + { '', '', mode = '!' }, -- next-line + { '', '', mode = '!' }, -- previous-line + { '', '', mode = '!' }, -- delete-char + { '', '', mode = '!' }, -- backward-delete-char + { '', '', mode = '!' }, -- abort + }, + }, +} diff --git a/lua/rayandrew/plugins/tmux.lua b/lua/rayandrew/plugins/tmux.lua new file mode 100644 index 0000000..e76dbc4 --- /dev/null +++ b/lua/rayandrew/plugins/tmux.lua @@ -0,0 +1,15 @@ +return { + { + 'christoomey/vim-tmux-navigator', + cmd = { + 'TmuxNavigateLeft', + 'TmuxNavigateDown', + 'TmuxNavigateUp', + 'TmuxNavigateRight', + }, + keys = { '', '', '', '' }, + config = function() + vim.g.tmux_navigator_no_wrap = 1 + end, + }, +} diff --git a/lua/rayandrew/plugins/typewriter.lua b/lua/rayandrew/plugins/typewriter.lua new file mode 100644 index 0000000..2cac2ce --- /dev/null +++ b/lua/rayandrew/plugins/typewriter.lua @@ -0,0 +1,18 @@ +return { + { + 'joshuadanpeterson/typewriter', + dependencies = { + 'nvim-treesitter/nvim-treesitter', + }, + lazy = true, + config = true, + cmd = { 'TWEnable', 'TWToggle' }, + opts = { + enable_with_zen_mode = true, + enable_with_true_zen = true, + -- keep_cursor_position = true, + enable_notifications = true, + -- enable_horizontal_scroll = true, + }, + }, +} diff --git a/lua/rayandrew/plugins/undotree.lua b/lua/rayandrew/plugins/undotree.lua new file mode 100644 index 0000000..a22d331 --- /dev/null +++ b/lua/rayandrew/plugins/undotree.lua @@ -0,0 +1,9 @@ +return { + { + 'mbbill/undotree', + cmd = { 'UndotreeToggle' }, + keys = { + { 'ut', 'UndotreeToggle', desc = '[U]ndo Tree' }, + }, + }, +} diff --git a/lua/rayandrew/utils.lua b/lua/rayandrew/utils.lua new file mode 100644 index 0000000..2856d23 --- /dev/null +++ b/lua/rayandrew/utils.lua @@ -0,0 +1,11 @@ +local M = {} + +local _is_argonne_servers = false + +M.is_argonne_servers = function() + local is_polaris = not not (vim.fn.hostname():match '^polaris%-') + _is_argonne_servers = is_polaris + return _is_argonne_servers +end + +return M