diff options
| author | twells46 <173561638+twells46@users.noreply.github.com> | 2025-12-31 13:28:05 -0600 |
|---|---|---|
| committer | twells46 <173561638+twells46@users.noreply.github.com> | 2025-12-31 13:28:05 -0600 |
| commit | 2140ab51deed88e90eafebf9520fa5f9995dc7c9 (patch) | |
| tree | 03cf1dcd2900495c1efb79aaa85f3254ecd5fb87 /dot_config/nvim | |
| parent | ff8f50638e4b17a9d7cc88d2f0d9560b7effce39 (diff) | |
Migrate from stow
Diffstat (limited to 'dot_config/nvim')
24 files changed, 1205 insertions, 0 deletions
diff --git a/dot_config/nvim/LICENSE.md b/dot_config/nvim/LICENSE.md new file mode 100644 index 0000000..9cf1062 --- /dev/null +++ b/dot_config/nvim/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/dot_config/nvim/README.md b/dot_config/nvim/README.md new file mode 100644 index 0000000..4113950 --- /dev/null +++ b/dot_config/nvim/README.md @@ -0,0 +1,241 @@ +# 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), + [fd-find](https://github.com/sharkdp/fd#installation) +- Clipboard tool (xclip/xsel/win32yank or other depending on the 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 +- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji` +- Language Setup: + - If you want to write Typescript, you need `npm` + - If you 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/<your_github_username>/kickstart.nvim.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 +[recommended to track it in version control](https://lazy.folke.io/usage/lockfile). + +#### Clone kickstart.nvim + +> [!NOTE] +> If following the recommended step above (i.e., forking the repo), replace +> `nvim-lua` with `<your_github_username>` in the commands below + +<details><summary> Linux and Mac </summary> + +```sh +git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +``` + +</details> + +<details><summary> Windows </summary> + +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" +``` + +</details> + +### Post Installation + +Start Neovim + +```sh +nvim +``` + +That's it! Lazy will install all the plugins you have. Use `:Lazy` to view +the current plugin status. Hit `q` to close the window. + +#### Read The Friendly Documentation + +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. + +> [!NOTE] +> For more information about a particular plugin check its repository's documentation. + + +### 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://lazy.folke.io/usage#-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 + +<details><summary>Windows with Microsoft C++ Build Tools and CMake</summary> +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' } +``` +</details> +<details><summary>Windows with gcc/make using chocolatey</summary> +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 the 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 +``` +</details> +<details><summary>WSL (Windows Subsystem for Linux)</summary> + +``` +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 +``` +</details> + +#### Linux Install +<details><summary>Ubuntu Install Steps</summary> + +``` +sudo add-apt-repository ppa:neovim-ppa/unstable -y +sudo apt update +sudo apt install make gcc ripgrep unzip git xclip neovim +``` +</details> +<details><summary>Debian Install Steps</summary> + +``` +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-linux-x86_64.tar.gz +sudo rm -rf /opt/nvim-linux-x86_64 +sudo mkdir -p /opt/nvim-linux-x86_64 +sudo chmod a+rX /opt/nvim-linux-x86_64 +sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz + +# make it available in /usr/local/bin, distro installs to /usr/bin +sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/ +``` +</details> +<details><summary>Fedora Install Steps</summary> + +``` +sudo dnf install -y gcc make git ripgrep fd-find unzip neovim +``` +</details> + +<details><summary>Arch Install Steps</summary> + +``` +sudo pacman -S --noconfirm --needed gcc make git ripgrep fd unzip neovim +``` +</details> + diff --git a/dot_config/nvim/doc.md b/dot_config/nvim/doc.md new file mode 100644 index 0000000..5e1456a --- /dev/null +++ b/dot_config/nvim/doc.md @@ -0,0 +1,67 @@ +--- +title: Kickstart docs +author: Thomas Wells +--- + +# Purpose + +Although the `kickstart.nvim` documentation will not be as useful outside of its original context, I am moving it here in the interest of maintaing a cleaner `init.lua`. + +# Lazy +Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. +Alternatively, use `config = function() ... end` for full control over the configuration. +Therefore, if you prefer to call `setup` explicitly, use: + +```lua +{ + 'lewis6991/gitsigns.nvim', + config = function() + require('gitsigns').setup({ + -- Your gitsigns configuration here + }) + end, +} +``` + +Plugins can specify dependencies. +The dependencies are proper plugin specifications as well - anything you do for a plugin at the top level, you can do for a dependency. +Use the `dependencies` key to specify the dependencies of a particular plugin + +# Telescope +Telescope is a fuzzy finder that comes with a lot of different things that +it can fuzzy find! It's more than just a "file finder", it can search +many different aspects of Neovim, your workspace, LSP, and more! + +The easiest way to learn Telescope is: `:Telescope help_tags`. +After running this command, a window will open up and you're able to type in the prompt window. +You'll see a list of `help_tags` options and a corresponding preview of the help. + +Two important keymaps to use while in Telescope are: + +- Insert mode: `<c-/>` +- Normal mode: `?` + +More setup info can be found in `:help telescope.setup()` + +# LSP +Brief aside: **What is LSP?** + +LSP is an initialism you've probably heard, but might not understand. +LSP stands for Language Server Protocol. +It's a protocol that helps editors and language tooling communicate in a standardized fashion. + +In general, you have a "server" which is some tool built to understand a particular language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). +These Language Servers (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone processes that communicate with some "client" - in this case, Neovim! + +LSP provides Neovim with features like: + + - Go to definition + - Find references + - Autocompletion + - Symbol Search + - and more! + +Thus, Language Servers are external tools that must be installed separately from Neovim. +This is where `mason` and related plugins come into play. +If you're wondering about lsp vs treesitter, you can check out the wonderfully and elegantly composed help section, `:help lsp-vs-treesitter` + diff --git a/dot_config/nvim/doc.pdf b/dot_config/nvim/doc.pdf Binary files differnew file mode 100644 index 0000000..4eaa31e --- /dev/null +++ b/dot_config/nvim/doc.pdf diff --git a/dot_config/nvim/doc/kickstart.txt b/dot_config/nvim/doc/kickstart.txt new file mode 100644 index 0000000..cb87ac3 --- /dev/null +++ b/dot_config/nvim/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/dot_config/nvim/doc/tags b/dot_config/nvim/doc/tags new file mode 100644 index 0000000..687ae77 --- /dev/null +++ b/dot_config/nvim/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/dot_config/nvim/dot_stylua.toml b/dot_config/nvim/dot_stylua.toml new file mode 100644 index 0000000..139e939 --- /dev/null +++ b/dot_config/nvim/dot_stylua.toml @@ -0,0 +1,6 @@ +column_width = 160 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferSingle" +call_parentheses = "None" diff --git a/dot_config/nvim/ftplugin/css.lua b/dot_config/nvim/ftplugin/css.lua new file mode 100644 index 0000000..5fe9e43 --- /dev/null +++ b/dot_config/nvim/ftplugin/css.lua @@ -0,0 +1,2 @@ +vim.bo.shiftwidth = 2 +vim.bo.expandtab = true diff --git a/dot_config/nvim/ftplugin/html.lua b/dot_config/nvim/ftplugin/html.lua new file mode 100644 index 0000000..5fe9e43 --- /dev/null +++ b/dot_config/nvim/ftplugin/html.lua @@ -0,0 +1,2 @@ +vim.bo.shiftwidth = 2 +vim.bo.expandtab = true diff --git a/dot_config/nvim/ftplugin/lua.lua b/dot_config/nvim/ftplugin/lua.lua new file mode 100644 index 0000000..5fe9e43 --- /dev/null +++ b/dot_config/nvim/ftplugin/lua.lua @@ -0,0 +1,2 @@ +vim.bo.shiftwidth = 2 +vim.bo.expandtab = true diff --git a/dot_config/nvim/ftplugin/markdown.lua b/dot_config/nvim/ftplugin/markdown.lua new file mode 100644 index 0000000..d53f59d --- /dev/null +++ b/dot_config/nvim/ftplugin/markdown.lua @@ -0,0 +1,6 @@ +vim.api.nvim_create_autocmd('BufWritePost', { + callback = function() + local out_lines = vim.fn.systemlist(vim.fn.expandcmd 'compiler %:p') + vim.fn.setqflist({}, 'r', { title = 'lowdown', lines = out_lines }) + end, +}) diff --git a/dot_config/nvim/ftplugin/typescript.lua b/dot_config/nvim/ftplugin/typescript.lua new file mode 100644 index 0000000..5fe9e43 --- /dev/null +++ b/dot_config/nvim/ftplugin/typescript.lua @@ -0,0 +1,2 @@ +vim.bo.shiftwidth = 2 +vim.bo.expandtab = true diff --git a/dot_config/nvim/ftplugin/typescriptreact.lua b/dot_config/nvim/ftplugin/typescriptreact.lua new file mode 100644 index 0000000..5fe9e43 --- /dev/null +++ b/dot_config/nvim/ftplugin/typescriptreact.lua @@ -0,0 +1,2 @@ +vim.bo.shiftwidth = 2 +vim.bo.expandtab = true diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua new file mode 100644 index 0000000..fa7598e --- /dev/null +++ b/dot_config/nvim/init.lua @@ -0,0 +1,115 @@ +-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +vim.g.have_nerd_font = true + +-- [[ Setting options ]] +-- See `:help vim.o` +-- For more options, you can see `:help option-list` + +vim.o.number = true +vim.o.relativenumber = true + +-- Enable mouse mode, can be useful for resizing splits +vim.o.mouse = 'a' + +vim.o.showmode = false + +-- Enable break indent +vim.o.breakindent = true + +-- Save undo history +vim.o.undofile = true + +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term +vim.o.ignorecase = true +vim.o.smartcase = true + +-- Keep signcolumn on by default +vim.o.signcolumn = 'yes' + +-- Decrease update time +vim.o.updatetime = 250 + +-- Decrease mapped sequence wait time +vim.o.timeoutlen = 300 + +-- Configure how new splits should be opened +vim.o.splitright = true +vim.o.splitbelow = true + +-- Sets how neovim will display certain whitespace characters in the editor. +-- See `:help 'list'` +-- and `:help 'listchars'` +-- +-- Notice listchars is set using `vim.opt` instead of `vim.o`. +-- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables. +-- See `:help lua-options` +-- and `:help lua-options-guide` +vim.o.list = true +vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } + +-- Preview substitutions live, as you type! +vim.o.inccommand = 'split' + +-- Show which line your cursor is on +vim.o.cursorline = true + +-- Minimal number of screen lines to keep above and below the cursor. +vim.o.scrolloff = 10 + +vim.o.confirm = true + +-- [[ Keymaps ]] +vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') +vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) +vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) + +-- [[ Basic Autocommands ]] +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.hl.on_yank() + end, +}) + +-- [[ Install `lazy.nvim` plugin manager ]] +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = 'https://github.com/folke/lazy.nvim.git' + local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } + if vim.v.shell_error ~= 0 then + error('Error cloning lazy.nvim:\n' .. out) + end +end +---@type vim.Option +local rtp = vim.opt.rtp +rtp:prepend(lazypath) + +require('util.plugin').lazy_file() + +-- [[ Configure and install plugins ]] +require('lazy').setup 'plugins' + +vim.cmd.colorscheme 'catppuccin' + +vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }) + +vim.api.nvim_create_autocmd('BufWritePost', { + pattern = { '*.tex', '*.rmd', '*.ms' }, + callback = function() + vim.fn.systemlist(vim.fn.expandcmd 'compiler %:p') + end, +}) + +vim.keymap.set('n', '<leader>c', function() + vim.fn.systemlist(vim.fn.expandcmd 'compiler %:p') +end) + +-- The line beneath this is called `modeline`. See `:help modeline` +-- vim: ts=2 sts=2 sw=2 et diff --git a/dot_config/nvim/lazy-lock.json b/dot_config/nvim/lazy-lock.json new file mode 100644 index 0000000..2a20b22 --- /dev/null +++ b/dot_config/nvim/lazy-lock.json @@ -0,0 +1,24 @@ +{ + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, + "catppuccin": { "branch": "main", "commit": "cb5665990a797b102715188e73c44c3931b3b42e" }, + "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, + "fidget.nvim": { "branch": "main", "commit": "4ec7bed6c86b671ddde03ca1b227343cfa3e65fa" }, + "fzf-lua": { "branch": "main", "commit": "e40e2337611fa426b8bcb6989fc310035c6ec4aa" }, + "gitsigns.nvim": { "branch": "main", "commit": "cc2e664c7e3cd8a31af34df040d16a75cfcadced" }, + "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, + "mason.nvim": { "branch": "main", "commit": "3671ab0d40aa5bd24b1686562bd0a23391ecf76a" }, + "mini.icons": { "branch": "main", "commit": "b8f6fa6f5a3fd0c56936252edcd691184e5aac0c" }, + "mini.nvim": { "branch": "main", "commit": "c122e852517adaf7257688e435369c050da113b1" }, + "nvim-lint": { "branch": "master", "commit": "7ef127aaede2a4d5ad8df8321e2eb4e567f29594" }, + "nvim-lspconfig": { "branch": "master", "commit": "3db16ceeea947517f0dc1404c24dcb5ab0c91d26" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "4a8369f4c78ef6f6f895f0cec349e48f74330574" }, + "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +} diff --git a/dot_config/nvim/lua/health.lua b/dot_config/nvim/lua/health.lua new file mode 100644 index 0000000..b59d086 --- /dev/null +++ b/dot_config/nvim/lua/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/dot_config/nvim/lua/plugins/autocomplete.lua b/dot_config/nvim/lua/plugins/autocomplete.lua new file mode 100644 index 0000000..4f38b38 --- /dev/null +++ b/dot_config/nvim/lua/plugins/autocomplete.lua @@ -0,0 +1,87 @@ +return { + { -- Autocompletion + 'saghen/blink.cmp', + lazy = true, + -- event = 'VimEnter', + version = '1.*', + dependencies = { + -- Snippet Engine + { + 'L3MON4D3/LuaSnip', + version = '2.*', + 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, + -- }, + }, + opts = {}, + }, + 'folke/lazydev.nvim', + }, + --- @module 'blink.cmp' + --- @type blink.cmp.Config + opts = { + keymap = { + -- All presets have the following mappings: + -- <tab>/<s-tab>: move to right/left of your snippet expansion + -- <c-space>: Open menu or open docs if already open + -- <c-n>/<c-p> or <up>/<down>: Select next/previous item + -- <c-e>: Hide menu + -- <c-k>: Toggle signature help + -- See :h blink-cmp-config-keymap for defining your own keymap + preset = 'default', + + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono', + }, + + completion = { + -- By default, you may press `<c-space>` to show the documentation. + -- Optionally, set `auto_show = true` to show the documentation after a delay. + documentation = { auto_show = false, auto_show_delay_ms = 500 }, + }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'lazydev' }, + providers = { + lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, + }, + }, + + snippets = { preset = 'luasnip' }, + + -- Blink.cmp includes an optional, recommended rust fuzzy matcher, + -- which automatically downloads a prebuilt binary when enabled. + + -- By default, we use the Lua implementation instead, but you may enable + -- the rust implementation via `'prefer_rust_with_warning'` + + -- See :h blink-cmp-config-fuzzy for more information + fuzzy = { implementation = 'prefer_rust_with_warning' }, + + -- Shows a signature help window while you type arguments for a function + signature = { enabled = true }, + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/init.lua b/dot_config/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..be4b9e3 --- /dev/null +++ b/dot_config/nvim/lua/plugins/init.lua @@ -0,0 +1,156 @@ +return { + -- Detect tabstop and shiftwidth automatically + { + 'NMAC427/guess-indent.nvim', + event = 'VeryLazy', + }, + + -- Adds git related signs to the gutter, as well as utilities for managing changes + { + 'lewis6991/gitsigns.nvim', + event = 'VeryLazy', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, + }, + + -- Useful plugin to show you pending keybinds. + { + 'folke/which-key.nvim', + event = 'VeryLazy', -- Sets the loading event to 'VimEnter' + opts = { + -- delay between pressing a key and opening which-key (milliseconds) + -- this setting is independent of vim.o.timeoutlen + delay = 0, + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default which-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = '<Up> ', + Down = '<Down> ', + Left = '<Left> ', + Right = '<Right> ', + C = '<C-…> ', + M = '<M-…> ', + D = '<D-…> ', + S = '<S-…> ', + CR = '<CR> ', + Esc = '<Esc> ', + ScrollWheelDown = '<ScrollWheelDown> ', + ScrollWheelUp = '<ScrollWheelUp> ', + NL = '<NL> ', + BS = '<BS> ', + Space = '<Space> ', + Tab = '<Tab> ', + F1 = '<F1>', + F2 = '<F2>', + F3 = '<F3>', + F4 = '<F4>', + F5 = '<F5>', + F6 = '<F6>', + F7 = '<F7>', + F8 = '<F8>', + F9 = '<F9>', + F10 = '<F10>', + F11 = '<F11>', + F12 = '<F12>', + }, + }, + + -- Document existing key chains + spec = { + { '<leader>s', group = '[S]earch' }, + { '<leader>t', group = '[T]oggle' }, + { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + }, + }, + }, + { + 'folke/trouble.nvim', + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = 'Trouble', + keys = { + { + '<leader>xx', + '<cmd>Trouble diagnostics toggle<cr>', + desc = 'Diagnostics (Trouble)', + }, + { + '<leader>xX', + '<cmd>Trouble diagnostics toggle filter.buf=0<cr>', + desc = 'Buffer Diagnostics (Trouble)', + }, + { + '<leader>cs', + '<cmd>Trouble symbols toggle focus=false<cr>', + desc = 'Symbols (Trouble)', + }, + { + '<leader>cl', + '<cmd>Trouble lsp toggle focus=false win.position=right<cr>', + desc = 'LSP Definitions / references / ... (Trouble)', + }, + { + '<leader>xL', + '<cmd>Trouble loclist toggle<cr>', + desc = 'Location List (Trouble)', + }, + { + '<leader>xQ', + '<cmd>Trouble qflist toggle<cr>', + desc = 'Quickfix List (Trouble)', + }, + }, + }, + { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + event = 'VeryLazy', + opts = { + flavour = 'latte', + transparent_background = false, + integrations = { + blink_cmp = true, + cmp = false, + fidget = true, + mason = true, + gitsigns = true, + treesitter = true, + notify = false, + which_key = false, + mini = { + enabled = true, + indentscope_color = '', + }, + }, + }, + }, + { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = {}, + -- Optional dependencies + dependencies = { { 'echasnovski/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, + }, + + -- Highlight todo, notes, etc in comments + { 'folke/todo-comments.nvim', event = 'VeryLazy', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, + + -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` + -- Or use telescope! + -- In normal mode type `<space>sh` then write `lazy.nvim-plugin` + -- you can continue same window with `<space>sr` which resumes last telescope search +} diff --git a/dot_config/nvim/lua/plugins/lint.lua b/dot_config/nvim/lua/plugins/lint.lua new file mode 100644 index 0000000..7d337ac --- /dev/null +++ b/dot_config/nvim/lua/plugins/lint.lua @@ -0,0 +1,80 @@ +return { + { + 'mfussenegger/nvim-lint', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + require('lint').linters.mdl = { + cmd = 'mdl', + stdin = false, + args = { '-s', '~/.config/mdl/style.rb' }, + stream = 'stdout', + ignore_exitcode = true, + parser = require('lint.parser').from_errorformat('%f:%l: %m', { + source = 'mdl', + severity = vim.diagnostic.severity.WARN, + }), + } + local lint = require 'lint' + lint.linters_by_ft = { + markdown = { 'mdl' }, + } + + -- 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() + -- Only run the linter in buffers that you can modify in order to + -- avoid superfluous noise, notably within the handy LSP pop-ups that + -- describe the hovered symbol using Markdown. + if vim.bo.modifiable then + lint.try_lint() + end + end, + }) + end, + }, + + -- Autoformat + { + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + keys = { + { + '<leader>f', + function() + require('conform').format { async = true, lsp_format = 'fallback' } + end, + mode = '', + desc = '[F]ormat buffer', + }, + }, + opts = { + notify_on_error = false, + 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 + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { c = true, cpp = true } + if disable_filetypes[vim.bo[bufnr].filetype] then + return nil + else + return { + timeout_ms = 500, + lsp_format = 'fallback', + } + end + end, + formatters_by_ft = { + lua = { 'stylua' }, + -- Conform can also run multiple formatters sequentially + -- 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 }, + }, + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/lsp.lua b/dot_config/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..4860c82 --- /dev/null +++ b/dot_config/nvim/lua/plugins/lsp.lua @@ -0,0 +1,205 @@ +return { -- LSP Plugins + { + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + }, + }, + }, + { + -- Main LSP Configuration + 'neovim/nvim-lspconfig', + + event = 'LazyFile', + + dependencies = { + -- Mason must be loaded before its dependents so we need to set it up here. + { 'mason-org/mason.nvim', opts = {} }, + + -- Useful status updates for LSP. + { 'j-hui/fidget.nvim', opts = {} }, + + -- Allows extra capabilities provided by blink.cmp + 'saghen/blink.cmp', + }, + config = function() + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + local fzf = require 'fzf-lua' + + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + + -- Find references for the word under your cursor. + map('grr', fzf.lsp_references, '[G]oto [R]eferences') + + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map('gri', fzf.lsp_implementations, '[G]oto [I]mplementation') + + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press <C-t>. + map('grd', fzf.lsp_definitions, '[G]oto [D]efinition') + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map('gO', fzf.lsp_document_symbols, 'Open Document Symbols') + + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map('gW', fzf.lsp_workspace_symbols, 'Open Workspace Symbols') + + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map('grt', fzf.lsp_typedefs, '[G]oto [T]ype Definition') + + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- 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(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 + -- + -- This may be unwanted, since they displace some of your code + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + map('<leader>th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, + }) + + -- Diagnostic Config + -- See :help vim.diagnostic.Opts + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = ' ', + [vim.diagnostic.severity.WARN] = ' ', + [vim.diagnostic.severity.INFO] = ' ', + [vim.diagnostic.severity.HINT] = ' ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, + } + + -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. + local capabilities = require('blink.cmp').get_lsp_capabilities() + + -- Add any additional override configuration in the following tables. Available keys are: + -- - cmd (table): Override the default command used to start the server + -- - filetypes (table): Override the default list of associated filetypes for the server + -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. + -- - settings (table): Override the default settings passed when initializing the server. + -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + -- See `:help lspconfig-all` for a list of all the pre-configured LSPs + local servers = { + -- clangd = {}, + -- gopls = {}, + pyright = {}, + lua_ls = { + -- cmd = { ... }, + -- filetypes = { ... }, + -- capabilities = {}, + settings = { + Lua = { + completion = { + callSnippet = 'Replace', + }, + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + vtsls = {}, + bashls = {}, + awk_ls = {}, + } + + servers.lua_ls.capabilities = vim.tbl_deep_extend('force', {}, capabilities, servers.lua_ls.capabilities or {}) + vim.lsp.config('lua_ls', servers.lua_ls) + vim.lsp.enable 'lua_ls' + + servers.pyright.capabilities = vim.tbl_deep_extend('force', {}, capabilities, servers.pyright.capabilities or {}) + vim.lsp.config('pyright', servers.pyright) + vim.lsp.enable 'pyright' + + servers.vtsls.capabilities = vim.tbl_deep_extend('force', {}, capabilities, servers.vtsls.capabilities or {}) + vim.lsp.config('vtsls', servers.vtsls) + vim.lsp.enable 'vtsls' + + servers.bashls.capabilities = vim.tbl_deep_extend('force', {}, capabilities, servers.bashls.capabilities or {}) + vim.lsp.config('bashls', servers.bashls) + vim.lsp.enable 'bashls' + + servers.awk_ls.capabilities = vim.tbl_deep_extend('force', {}, capabilities, servers.awk_ls.capabilities or {}) + vim.lsp.config('awk_ls', servers.awk_ls) + vim.lsp.enable 'awk_ls' + end, + }, +} diff --git a/dot_config/nvim/lua/plugins/mini.lua b/dot_config/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..0cfb523 --- /dev/null +++ b/dot_config/nvim/lua/plugins/mini.lua @@ -0,0 +1,40 @@ +return { + { -- Collection of various small independent plugins/modules + 'echasnovski/mini.nvim', + event = 'VeryLazy', + config = function() + -- 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 + require('mini.ai').setup { 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 [)] ['] + require('mini.surround').setup() + + -- 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 + + -- ... and there is more! + -- Check out: https://github.com/echasnovski/mini.nvim + end, + }, +} diff --git a/dot_config/nvim/lua/plugins/telescope.lua b/dot_config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..2a92acd --- /dev/null +++ b/dot_config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,29 @@ +return { + { + 'ibhagwan/fzf-lua', + event = 'VeryLazy', + -- optional for icon support + dependencies = { 'nvim-tree/nvim-web-devicons' }, + -- or if using mini.icons/mini.nvim + -- dependencies = { "echasnovski/mini.icons" }, + opts = {}, + config = function() + local fzf = require 'fzf-lua' + vim.keymap.set('n', '<leader>sh', fzf.helptags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', '<leader>sk', fzf.keymaps, { desc = '[S]earch [K]eymaps' }) + vim.keymap.set('n', '<leader>sf', fzf.files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', '<leader>ss', fzf.builtin, { desc = '[S]earch [S]elect fzf' }) + vim.keymap.set('n', '<leader>sw', fzf.grep_cword, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', '<leader>sg', fzf.live_grep_native, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', '<leader>sd', fzf.diagnostics_document, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', '<leader>sD', fzf.diagnostics_workspace, { desc = '[S]earch workspace [D]iagnostics' }) + vim.keymap.set('n', '<leader>sr', fzf.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', '<leader>sl', fzf.lsp_finder, { desc = '[S]earch [L]SP' }) + vim.keymap.set('n', '<leader>s.', fzf.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set('n', '<leader><leader>', fzf.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', '<leader>sn', function() + fzf.files { cwd = '~/.config/nvim' } + end, { desc = '[S]earch [N]eovim files' }) + end, + }, +} diff --git a/dot_config/nvim/lua/plugins/treesitter.lua b/dot_config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..e7044bc --- /dev/null +++ b/dot_config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,28 @@ +return { + { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + event = 'VeryLazy', + build = ':TSUpdate', + main = 'nvim-treesitter.configs', -- Sets main module to use for opts + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + opts = { + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { + enable = true, + -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. + -- If you are experiencing weird indenting issues, add the language to + -- the list of additional_vim_regex_highlighting and disabled languages for indent. + additional_vim_regex_highlighting = { 'ruby' }, + }, + indent = { enable = true, disable = { 'ruby' } }, + }, + -- There are additional nvim-treesitter modules that you can use to interact + -- with nvim-treesitter. You should go explore a few and see what interests you: + -- + -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` + -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context + -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects + }, +} diff --git a/dot_config/nvim/lua/util/plugin.lua b/dot_config/nvim/lua/util/plugin.lua new file mode 100644 index 0000000..8bf6a94 --- /dev/null +++ b/dot_config/nvim/lua/util/plugin.lua @@ -0,0 +1,13 @@ +local M = {} + +M.lazy_file_events = { 'BufReadPost', 'BufNewFile', 'BufWritePre' } + +function M.lazy_file() + -- Add support for the LazyFile event + local Event = require 'lazy.core.handler.event' + + Event.mappings.LazyFile = { id = 'LazyFile', event = M.lazy_file_events } + Event.mappings['User LazyFile'] = Event.mappings.LazyFile +end + +return M |