From 38c9f04fd0be9a54d7d053d2a9fab2f4abaa1060 Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Thu, 8 Aug 2024 21:25:23 -0500 Subject: [PATCH 01/18] Inititial changes made to init.lua --- init.lua | 128 ++++++++++++++++++++++--------------------------------- 1 file changed, 52 insertions(+), 76 deletions(-) diff --git a/init.lua b/init.lua index 220d3045268..9dad7eb04d9 100644 --- a/init.lua +++ b/init.lua @@ -1,25 +1,4 @@ --[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== - What is Kickstart? Kickstart.nvim is *not* a distribution. @@ -43,20 +22,7 @@ What is Kickstart? Kickstart Guide: - TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. - - If you don't know what this means, type the following: - - - - : - - Tutor - - - - (If you already know the Neovim basics, you can skip this step.) - - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua. - - Next, run AND READ `:help`. + READ `:help`. This will open up a help window with some basic information about reading, navigating and searching the builtin help documentation. @@ -69,19 +35,6 @@ Kickstart Guide: I have left several `:help X` comments throughout the init.lua These are hints about where to find more information about the relevant settings, plugins or Neovim features used in Kickstart. - - NOTE: Look for lines like this - - Throughout the file. These are for you, the reader, to help you understand what is happening. - Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your Neovim config. - -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now! :) --]] -- Set as the leader key @@ -91,7 +44,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -111,12 +64,9 @@ vim.opt.mouse = 'a' vim.opt.showmode = false -- Sync clipboard between OS and Neovim. --- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' -end) +vim.opt.clipboard = 'unnamedplus' -- Enable break indent vim.opt.breakindent = true @@ -142,6 +92,10 @@ vim.opt.timeoutlen = 300 vim.opt.splitright = true vim.opt.splitbelow = true +-- disable netrw at the very start of your init.lua +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + -- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` -- and `:help 'listchars'` @@ -160,8 +114,8 @@ vim.opt.scrolloff = 10 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` --- Clear highlights on search when pressing in normal mode --- See `:help hlsearch` +-- Set highlight on search, but clear on pressing in normal mode +vim.opt.hlsearch = true vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps @@ -190,6 +144,9 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) +-- Open a new terminal in split screen +vim.keymap.set('n', '`', ':split|resize -8|terminal', { desc = 'Open a terminal in split window' }) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -223,7 +180,7 @@ vim.opt.rtp:prepend(lazypath) -- -- You can press `?` in this menu for help. Use `:q` to close the window -- --- To update plugins you can run +-- Te update plugins you can run -- :Lazy update -- -- NOTE: Here is where you install your plugins. @@ -402,22 +359,7 @@ require('lazy').setup({ end, }, - -- 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 = 'luvit-meta/library', words = { 'vim%.uv' } }, - }, - }, - }, - { 'Bilal2453/luvit-meta', lazy = true }, - { - -- Main LSP Configuration + { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim @@ -429,8 +371,19 @@ require('lazy').setup({ -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', opts = {} }, - -- Allows extra capabilities provided by nvim-cmp - 'hrsh7th/cmp-nvim-lsp', + -- `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 = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, + { 'Bilal2453/luvit-meta', lazy = true }, }, config = function() -- Brief aside: **What is LSP?** @@ -660,8 +613,9 @@ require('lazy').setup({ -- 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 }, + -- You can use a sub-list to tell conform to run *until* a formatter + -- is found. + -- javascript = { { "prettierd", "prettier" } }, }, }, }, @@ -859,6 +813,8 @@ require('lazy').setup({ config = function(_, opts) -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + -- Prefer git instead of curl in order to improve connectivity in some environments + require('nvim-treesitter.install').prefer_git = true ---@diagnostic disable-next-line: missing-fields require('nvim-treesitter.configs').setup(opts) @@ -870,6 +826,26 @@ require('lazy').setup({ -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects end, }, + { + 'nvim-tree/nvim-tree.lua', + config = function() + require('nvim-tree').setup { + sort = { + sorter = 'case_sensitive', + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + } + vim.keymap.set('n', 'p', ':NvimTreeToggle', { silent = true }) + end, + }, -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the -- init.lua. If you want these files, they are in the repository, so you can just download them and From d64b6a332a3389516c15f9c646a055aef204e0da Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Fri, 16 Aug 2024 13:43:48 -0500 Subject: [PATCH 02/18] not sure what I changed --- init.lua | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/init.lua b/init.lua index 9dad7eb04d9..a77c46e7648 100644 --- a/init.lua +++ b/init.lua @@ -213,21 +213,6 @@ require('lazy').setup({ }, }, - -- NOTE: Plugins can also be configured to run Lua code when they are loaded. - -- - -- This is often very useful to both group configuration, as well as handle - -- lazy loading plugins that don't need to be loaded immediately at startup. - -- - -- For example, in the following configuration, we use: - -- event = 'VimEnter' - -- - -- which loads which-key before all the UI elements are loaded. Events can be - -- normal autocommands events (`:help autocmd-events`). - -- - -- Then, because we use the `config` key, the configuration only runs - -- after the plugin has been loaded: - -- config = function() ... end - { -- Useful plugin to show you pending keybinds. 'folke/which-key.nvim', event = 'VimEnter', -- Sets the loading event to 'VimEnter' From 0a05725d564356195b96ca1ca570bce3ed5ddd71 Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Sat, 17 Aug 2024 14:22:21 -0500 Subject: [PATCH 03/18] change tab character + nvim-tree keybind --- init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index a77c46e7648..28e32e6d998 100644 --- a/init.lua +++ b/init.lua @@ -99,8 +99,9 @@ vim.g.loaded_netrwPlugin = 1 -- Sets how neovim will display certain whitespace characters in the editor. -- See `:help 'list'` -- and `:help 'listchars'` +-- for backup tab characters -> » vim.opt.list = true -vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } +vim.opt.listchars = { tab = '| ', trail = '·', nbsp = '␣' } -- Preview substitutions live, as you type! vim.opt.inccommand = 'split' @@ -749,11 +750,11 @@ require('lazy').setup({ -- -- Examples: -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [Q]uote + -- - yinq - [Y]an [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.) + -- Add/delete/replace surroundings (bracets, quotes, etc.) -- -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren -- - sd' - [S]urround [D]elete [']quotes @@ -828,7 +829,7 @@ require('lazy').setup({ dotfiles = true, }, } - vim.keymap.set('n', 'p', ':NvimTreeToggle', { silent = true }) + vim.keymap.set('n', '0', ':NvimTreeToggle', { silent = true }) end, }, From 2c359ed56163ea3aefa2de33029aaabea0328cc1 Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Thu, 29 Aug 2024 15:36:37 -0500 Subject: [PATCH 04/18] add a variety of new plugins --- README.md | 230 +----------------------------------------------------- init.lua | 81 +++++++++---------- 2 files changed, 38 insertions(+), 273 deletions(-) diff --git a/README.md b/README.md index 3f19854cd20..5e6c4ac06ec 100644 --- a/README.md +++ b/README.md @@ -1,229 +1,3 @@ -# 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 -``` -
+# Slayter's Neovim Config! +Based off of the [Kickstart](https://github.com/nvim-lua/kickstart.nvim) project. diff --git a/init.lua b/init.lua index 28e32e6d998..df1a719445a 100644 --- a/init.lua +++ b/init.lua @@ -1,42 +1,3 @@ ---[[ -What is Kickstart? - - Kickstart.nvim is *not* a distribution. - - Kickstart.nvim is a starting point for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving Kickstart just the way it is for a while - or immediately breaking it into modular pieces. It's up to you! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example which will only take 10-15 minutes: - - https://learnxinyminutes.com/docs/lua/ - - After understanding a bit more about Lua, you can use `:help lua-guide` as a - reference for how Neovim integrates Lua. - - :help lua-guide - - (or HTML version): https://neovim.io/doc/user/lua-guide.html - -Kickstart Guide: - - READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. - - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite Neovim features. - - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not exactly sure of what you're looking for. - - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or Neovim features used in Kickstart. ---]] - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) @@ -832,13 +793,43 @@ require('lazy').setup({ vim.keymap.set('n', '0', ':NvimTreeToggle', { silent = true }) end, }, + { + 'tiagovla/scope.nvim', + }, + -- PLUGIN: tabs-tab-management with Tabby + -- { + -- 'nanozuki/tabby.nvim', + -- -- event = 'VimEnter', -- if you want lazy load, see below + -- dependencies = 'nvim-tree/nvim-web-devicons', + -- config = function() + -- -- configs... + -- end, + -- }, + -- PLUGIN: File browsing via telescope + { + 'nvim-telescope/telescope-file-browser.nvim', + dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' }, + config = function() + require('telescope').setup { + extensions = { + file_browser = { + hijack_netrw = true, + }, + }, + } + end, - -- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the - -- init.lua. If you want these files, they are in the repository, so you can just download them and - -- place them in the correct locations. + vim.keymap.set('n', 'fb', 'Telescope file_browser', { noremap = true }), + }, + -- PLUGIN: auto-close + -- Handles auto closing brackets when the opening one is typed + { + 'm4xshen/autoclose.nvim', + config = function() + require('autoclose').setup {} + end, + }, - -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart - -- -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- @@ -848,7 +839,7 @@ require('lazy').setup({ -- require 'kickstart.plugins.autopairs', -- require 'kickstart.plugins.neo-tree', -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps - + -- -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- From a2f7557e846850a65790c31973b968e7375ce2e0 Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Thu, 29 Aug 2024 18:37:32 -0500 Subject: [PATCH 05/18] colorscheme and reorganization stuff --- init.lua | 64 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/init.lua b/init.lua index df1a719445a..0f89da1a755 100644 --- a/init.lua +++ b/init.lua @@ -136,16 +136,7 @@ end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) -- [[ Configure and install plugins ]] --- --- To check the current status of your plugins, run --- :Lazy --- --- You can press `?` in this menu for help. Use `:q` to close the window --- --- Te update plugins you can run --- :Lazy update --- --- NOTE: Here is where you install your plugins. +-- NOTE: Here is plugins are setup! require('lazy').setup({ -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically @@ -683,23 +674,47 @@ require('lazy').setup({ end, }, - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is. - -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. + -- ADD COLORSCHEMES HERE (or at least around here) + -- { + -- -- Change the name of the colorscheme plugin below, and then + -- -- change the command in the config to whatever the name of that colorscheme is. + -- -- + -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. + -- 'folke/tokyonight.nvim', + -- priority = 1000, -- Make sure to load this before all the other start plugins. + -- init = function() + -- vim.cmd.colorscheme 'catppuccin' + -- + -- vim.cmd.hi 'Comment gui=none' + -- end, + -- }, + { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + require('catppuccin').setup { + -- name = 'catppuccin', + -- priority = 1000, + integrations = { + cmp = true, + -- gitsigns = true, + nvimtree = true, + treesitter = true, + -- notify = false, + mini = { + enabled = true, + indentscope_color = '', + }, + }, + } + end, init = function() - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' - - -- You can configure highlights by doing something like: + vim.cmd.colorscheme 'catppuccin-frappe' vim.cmd.hi 'Comment gui=none' end, }, + -- END COLORSCHEMES CONFIG -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, @@ -829,6 +844,7 @@ require('lazy').setup({ require('autoclose').setup {} end, }, + -- ADD COLORSCHEMES here! -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). @@ -838,7 +854,7 @@ require('lazy').setup({ -- require 'kickstart.plugins.lint', -- require 'kickstart.plugins.autopairs', -- require 'kickstart.plugins.neo-tree', - -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. From f2a4b5b34958b72d7acfaaf82a9c41d319f51196 Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Sat, 31 Aug 2024 21:10:32 -0500 Subject: [PATCH 06/18] some theme tweaks --- init.lua | 130 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 71 insertions(+), 59 deletions(-) diff --git a/init.lua b/init.lua index 0f89da1a755..61199305965 100644 --- a/init.lua +++ b/init.lua @@ -73,6 +73,9 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +-- Set ConcealLevel for obsidian.nvim to work +vim.opt.conceallevel = 2 + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -324,28 +327,6 @@ require('lazy').setup({ { 'Bilal2453/luvit-meta', lazy = true }, }, config = function() - -- Brief aside: **What is LSP?** - -- - -- LSP is an initialism you've probably heard, but might not understand what it is. - -- - -- 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` @@ -625,13 +606,13 @@ require('lazy').setup({ -- 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 }, + -- [''] = 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(), + [''] = 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 @@ -675,45 +656,46 @@ require('lazy').setup({ }, -- ADD COLORSCHEMES HERE (or at least around here) - -- { - -- -- Change the name of the colorscheme plugin below, and then - -- -- change the command in the config to whatever the name of that colorscheme is. - -- -- - -- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - -- 'folke/tokyonight.nvim', - -- priority = 1000, -- Make sure to load this before all the other start plugins. - -- init = function() - -- vim.cmd.colorscheme 'catppuccin' - -- - -- vim.cmd.hi 'Comment gui=none' - -- end, - -- }, { - 'catppuccin/nvim', - name = 'catppuccin', - priority = 1000, + 'folke/tokyonight.nvim', + priority = 1000, -- Make sure to load this before all the other start plugins. config = function() - require('catppuccin').setup { - -- name = 'catppuccin', - -- priority = 1000, - integrations = { - cmp = true, - -- gitsigns = true, - nvimtree = true, - treesitter = true, - -- notify = false, - mini = { - enabled = true, - indentscope_color = '', - }, - }, - } + require('tokyonight').setup() end, init = function() - vim.cmd.colorscheme 'catppuccin-frappe' + vim.cmd.colorscheme 'tokyonight' + vim.cmd.hi 'Comment gui=none' end, }, + -- { + -- 'catppuccin/nvim', + -- name = 'catppuccin', + -- priority = 1000, + -- config = function() + -- require('catppuccin').setup { + -- name = 'catppuccin-mocha', + -- priority = 1000, + -- flavour = 'mocha', + -- term_colors = true, + -- integrations = { + -- cmp = true, + -- gitsigns = true, + -- nvimtree = true, + -- treesitter = true, + -- -- notify = false, + -- mini = { + -- enabled = true, + -- indentscope_color = '', + -- }, + -- }, + -- } + -- end, + -- init = function() + -- vim.cmd.colorscheme 'catppuccin-mocha' + -- vim.cmd.hi 'Comment gui=none' + -- end, + -- }, -- END COLORSCHEMES CONFIG -- Highlight todo, notes, etc in comments @@ -844,6 +826,36 @@ require('lazy').setup({ require('autoclose').setup {} end, }, + -- PLUGIN: obsidian + { + 'epwalsh/obsidian.nvim', + version = '*', + lazy = true, + ft = 'markdown', + -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: + -- event = { + -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. + -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md" + -- -- refer to `:h file-pattern` for more examples + -- "BufReadPre path/to/my-vault/*.md", + -- "BufNewFile path/to/my-vault/*.md", + -- }, + dependencies = { + -- Required. + 'nvim-lua/plenary.nvim', + + -- see below for full list of optional dependencies 👇 + }, + opts = { + workspaces = { + { + name = 'personal', + path = '~/Documents/alecaerdron', + }, + }, + }, + }, + -- ADD COLORSCHEMES here! -- Here are some example plugins that I've included in the Kickstart repository. @@ -860,7 +872,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins` + -- For additional information, see `:help lazy.nvim-jkjlazy.nvim-structuring-your-plugins` -- { import = 'custom.plugins' }, }, { ui = { From 5ad032f60ba633908c30bfe89e454e2e1e937a88 Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Sun, 1 Sep 2024 13:29:53 -0500 Subject: [PATCH 07/18] more style changes, added autosession --- init.lua | 104 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 68 insertions(+), 36 deletions(-) diff --git a/init.lua b/init.lua index 61199305965..274315bf7d0 100644 --- a/init.lua +++ b/init.lua @@ -76,6 +76,15 @@ vim.opt.scrolloff = 10 -- Set ConcealLevel for obsidian.nvim to work vim.opt.conceallevel = 2 +-- Set TAB details -> to 2 spaces +-- NOTE: differnt types of code have tab spacing set in +-- the language syntax file. If it's standard I won't get up +-- in arms about it... +-- vim.opt.tabstop = 2 +-- vim.opt.shiftwidth = 2 +-- vim.opt.expandtab = true +-- vim.bo.softtabstop = 2 + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -424,6 +433,10 @@ require('lazy').setup({ end, }) + -- See full Code Diagnostic Text + -- Useful for if they float off screen + vim.keymap.set('n', 'dd', 'lua vim.diagnostic.open_float() ', { desc = 'Focuses Code Diagnostics' }) + -- LSP servers and clients are able to communicate to each other what features they support. -- By default, Neovim doesn't support everything that is in the LSP specification. -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. @@ -527,6 +540,7 @@ require('lazy').setup({ lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], } end, + stop_after_first = true, formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially @@ -534,7 +548,8 @@ require('lazy').setup({ -- -- You can use a sub-list to tell conform to run *until* a formatter -- is found. - -- javascript = { { "prettierd", "prettier" } }, + javascript = { 'prettierd' }, + typescript = { 'prettierd' }, }, }, }, @@ -656,46 +671,46 @@ require('lazy').setup({ }, -- ADD COLORSCHEMES HERE (or at least around here) - { - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. - config = function() - require('tokyonight').setup() - end, - init = function() - vim.cmd.colorscheme 'tokyonight' - - vim.cmd.hi 'Comment gui=none' - end, - }, -- { - -- 'catppuccin/nvim', - -- name = 'catppuccin', - -- priority = 1000, + -- 'folke/tokyonight.nvim', + -- priority = 1000, -- Make sure to load this before all the other start plugins. -- config = function() - -- require('catppuccin').setup { - -- name = 'catppuccin-mocha', - -- priority = 1000, - -- flavour = 'mocha', - -- term_colors = true, - -- integrations = { - -- cmp = true, - -- gitsigns = true, - -- nvimtree = true, - -- treesitter = true, - -- -- notify = false, - -- mini = { - -- enabled = true, - -- indentscope_color = '', - -- }, - -- }, - -- } + -- require('tokyonight').setup() -- end, -- init = function() - -- vim.cmd.colorscheme 'catppuccin-mocha' + -- vim.cmd.colorscheme 'tokyonight' + -- -- vim.cmd.hi 'Comment gui=none' -- end, -- }, + { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + require('catppuccin').setup { + name = 'catppuccin-mocha', + priority = 1000, + flavour = 'mocha', + term_colors = true, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + -- notify = false, + mini = { + enabled = true, + indentscope_color = '', + }, + }, + } + end, + init = function() + vim.cmd.colorscheme 'catppuccin-mocha' + vim.cmd.hi 'Comment gui=none' + end, + }, -- END COLORSCHEMES CONFIG -- Highlight todo, notes, etc in comments @@ -823,7 +838,11 @@ require('lazy').setup({ { 'm4xshen/autoclose.nvim', config = function() - require('autoclose').setup {} + require('autoclose').setup { + keys = { + ["'"] = { escape = true, close = false, pair = "''", disabled_filetypes = {} }, + }, + } end, }, -- PLUGIN: obsidian @@ -855,8 +874,21 @@ require('lazy').setup({ }, }, }, + { + 'rmagatti/auto-session', + lazy = false, + dependencies = { + 'nvim-telescope/telescope.nvim', -- Only needed if you want to use session lens + }, - -- ADD COLORSCHEMES here! + ---enables autocomplete for opts + ---@module "auto-session" + ---@type AutoSession.Config + opts = { + suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' }, + -- log_level = 'debug', + }, + }, -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). From 5b942e760d3c23aa31f938251b2a95a27bbef3bf Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Mon, 2 Sep 2024 13:50:01 -0500 Subject: [PATCH 08/18] updates --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 274315bf7d0..83d64b93245 100644 --- a/init.lua +++ b/init.lua @@ -1,4 +1,4 @@ --- Set as the leader key +-- Set as the leader keyini -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) vim.g.mapleader = ' ' From aea8575fc10c01b51d71d7b32144096e1d67b03c Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Sun, 29 Sep 2024 08:28:54 -0500 Subject: [PATCH 09/18] configure relative line numbers to true --- init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init.lua b/init.lua index 83d64b93245..c740c255f70 100644 --- a/init.lua +++ b/init.lua @@ -7,6 +7,9 @@ vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = true +-- Set relative line #s +vim.wo.relativenumber = true + -- [[ Setting options ]] -- See `:help vim.opt` -- NOTE: You can change these options as you wish! From 434f623bcb9de95a7934014c6525ebf1c66c7b62 Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Wed, 16 Oct 2024 20:10:27 -0500 Subject: [PATCH 10/18] show hidden files in telescope tree browser --- init.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init.lua b/init.lua index c740c255f70..d6a9eca46aa 100644 --- a/init.lua +++ b/init.lua @@ -829,6 +829,10 @@ require('lazy').setup({ extensions = { file_browser = { hijack_netrw = true, + hidden = { + file_browser = true, + folder_browser = true, + }, }, }, } From cbc09c11cb97daf98b91ac4f825e15d25c02aa5f Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Sun, 20 Oct 2024 14:33:14 -0500 Subject: [PATCH 11/18] rust debugger + formatting --- init.lua | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 156 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index d6a9eca46aa..2042fb71cad 100644 --- a/init.lua +++ b/init.lua @@ -150,6 +150,30 @@ if not vim.uv.fs_stat(lazypath) then end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) +-- NOTE: rustaceanvim -> this config has been moved to it's lazyloading config function +---@type rustaceanvim.Opts +-- vim.g.rustaceanvim = { +-- ---@type rustaceanvim.tools.Opts +-- tools = { +-- -- ... +-- }, +-- ---@type rustaceanvim.lsp.ClientOpts +-- server = { +-- on_attach = function(client, bufnr) +-- -- Set keybindings, etc. here. +-- end, +-- default_settings = { +-- -- rust-analyzer language server configuration +-- ['rust-analyzer'] = {}, +-- }, +-- -- ... +-- }, +-- ---@type rustaceanvim.dap.Opts +-- dap = { +-- -- ... +-- }, +-- } + -- [[ Configure and install plugins ]] -- NOTE: Here is plugins are setup! require('lazy').setup({ @@ -316,7 +340,10 @@ require('lazy').setup({ 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim - { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants + { -- NOTE: Must be loaded before dependants + 'williamboman/mason.nvim', + config = true, + }, 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', @@ -502,10 +529,21 @@ require('lazy').setup({ }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } + -- Prevent mason from starting rust_analyzer + require('mason-lspconfig').setup_handlers { + ['rust_analyzer'] = function() end, + } + require('mason-lspconfig').setup { handlers = { function(server_name) local server = servers[server_name] or {} + + -- Don't let mason configure the rust lsp -> this is done later in rustaceanvim + if server_name == 'rust_analyzer' then + return + end + -- This handles overriding only values explicitly passed -- by the server configuration above. Useful when disabling -- certain features of an LSP (for example, turning off formatting for tsserver) @@ -672,6 +710,123 @@ require('lazy').setup({ } end, }, + { --nvim-dap-- + 'mfussenegger/nvim-dap', + config = function() + -- local mason_registry = require 'mason-registry' + -- local codelldb = mason_registry.get_package 'codelldb' + -- local extension_path = codelldb:get_install_path() .. '/extensions/' + -- local codelldb_path = extension_path .. 'adapter/codelldb' + -- + -- local dap = require 'dap' + -- dap.adapters.codelldb = { + -- type = 'server', + -- port = '${port}', + -- executable = { + -- command = codelldb_path, + -- args = { '--port', '${port}' }, + -- }, + -- } + + -- dap.configurations.rust = { + -- { + -- name = 'Launch file', + -- type = 'codelldb', + -- request = 'launch', + -- program = function() + -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + -- end, + -- cwd = '${workspaceFolder}', + -- stopOnEntry = false, + -- }, + -- } + end, + }, + { --nvim-dap-ui-- + 'rcarriga/nvim-dap-ui', + dependencies = { + 'mfussenegger/nvim-dap', + 'nvim-neotest/nvim-nio', + }, + config = function() + local dapui = require 'dapui' + local dap = require 'dap' + dapui.setup() + + -- handle closing/opening the UI when debugger stops/starts -- + dap.listeners.after.event_initialized['dapui_config'] = function() + dapui.open() + end + dap.listeners.before.event_terminated['dapui_config'] = function() + dapui.close() + end + dap.listeners.before.event_exited['dapui_config'] = function() + dapui.close() + end + + -- setup some nice keybindings -- + -- vim.keymap.set('n', 'dt', ':DapToggleBreakpoint', { desc = '[DEBUGGER] Toggle Breakpoint' }) + -- vim.keymap.set('n', 'dx', ':DapTerminate', { desc = '[DEBUGGER] Terminate Debugger' }) + -- vim.keymap.set('n', 'so', ':DapStepOver', { desc = '[DEBUGGER] Step Over' }) + + -- Nvim DAP Keybindings + local map = vim.keymap.set + + map('n', 'dl', "lua require'dap'.step_into()", { desc = '[DEBUGGER] Step Into' }) + map('n', 'dj', "lua require'dap'.step_over()", { desc = '[DEBUGGER] Step Over' }) + map('n', 'dk', "lua require'dap'.step_out()", { desc = '[DEBUGGER] Step Out' }) + map('n', 'dc', "lua require'dap'.continue()", { desc = '[DEBUGGER] Continue' }) + map('n', 'db', "lua require'dap'.toggle_breakpoint()", { desc = '[DEBUGGER] Toggle Breakpoint' }) + -- map( + -- 'n', + -- 'dd', + -- "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", + -- { desc = 'Debugger set conditional breakpoint' } + -- ) + map('n', 'de', "lua require'dap'.terminate()", { desc = '[DEBUGGER] Reset' }) + map('n', 'dr', "lua require'dap'.run_last()", { desc = '[DEBUGGER] Run Last' }) + + -- rustaceanvim + map('n', 'dt', "lua vim.cmd('RustLsp testables')", { desc = '[DEBUGGER] Testables' }) + end, + }, + { + 'mrcjkb/rustaceanvim', + version = '^5', + lazy = false, -- This plugin is already lazy + config = function() + -- TODO: these paths are wrong for some fucking reason + -- local mason_registry = require 'mason-registry' + -- local codelldb = mason_registry.get_package 'codelldb' + -- local extension_path = codelldb:get_install_path() .. '/extensions/' + -- local codelldb_path = extension_path .. 'adapter/codelldb' + -- local liblldb_path = extension_path .. 'lldb/lib/liblldb.so' + + local codelldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb' + -- NOTE: the liblldb is different between linux/mac (liblldb.so/dylib) + local liblldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/lldb/lib/liblldb.so' + local rustcfg = require 'rustaceanvim.config' + + vim.g.rustaceanvim = { + -- Plugin configuration + tools = {}, + -- LSP configuration + server = { + on_attach = function(client, bufnr) + -- you can also put keymaps in here + end, + default_settings = { + -- rust-analyzer language server configuration + ['rust-analyzer'] = {}, + }, + }, + -- DAP configuration + dap = { + adapter = rustcfg.get_codelldb_adapter(codelldb_path, liblldb_path), + }, + } + end, + }, -- ADD COLORSCHEMES HERE (or at least around here) -- { From 5e579db1248d13278f871724a6d35dc57a3f4d9b Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Sat, 16 Nov 2024 10:43:13 -0600 Subject: [PATCH 12/18] remove rust debugger, renable basic rust lsp --- init.lua | 246 +++++++++++++++++++++++++++---------------------------- 1 file changed, 123 insertions(+), 123 deletions(-) diff --git a/init.lua b/init.lua index 2042fb71cad..06f2fccfe00 100644 --- a/init.lua +++ b/init.lua @@ -530,9 +530,9 @@ require('lazy').setup({ require('mason-tool-installer').setup { ensure_installed = ensure_installed } -- Prevent mason from starting rust_analyzer - require('mason-lspconfig').setup_handlers { - ['rust_analyzer'] = function() end, - } + -- require('mason-lspconfig').setup_handlers { + -- ['rust_analyzer'] = function() end, + -- } require('mason-lspconfig').setup { handlers = { @@ -540,9 +540,9 @@ require('lazy').setup({ local server = servers[server_name] or {} -- Don't let mason configure the rust lsp -> this is done later in rustaceanvim - if server_name == 'rust_analyzer' then - return - end + -- if server_name == 'rust_analyzer' then + -- return + -- end -- This handles overriding only values explicitly passed -- by the server configuration above. Useful when disabling @@ -710,123 +710,123 @@ require('lazy').setup({ } end, }, - { --nvim-dap-- - 'mfussenegger/nvim-dap', - config = function() - -- local mason_registry = require 'mason-registry' - -- local codelldb = mason_registry.get_package 'codelldb' - -- local extension_path = codelldb:get_install_path() .. '/extensions/' - -- local codelldb_path = extension_path .. 'adapter/codelldb' - -- - -- local dap = require 'dap' - -- dap.adapters.codelldb = { - -- type = 'server', - -- port = '${port}', - -- executable = { - -- command = codelldb_path, - -- args = { '--port', '${port}' }, - -- }, - -- } - - -- dap.configurations.rust = { - -- { - -- name = 'Launch file', - -- type = 'codelldb', - -- request = 'launch', - -- program = function() - -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - -- end, - -- cwd = '${workspaceFolder}', - -- stopOnEntry = false, - -- }, - -- } - end, - }, - { --nvim-dap-ui-- - 'rcarriga/nvim-dap-ui', - dependencies = { - 'mfussenegger/nvim-dap', - 'nvim-neotest/nvim-nio', - }, - config = function() - local dapui = require 'dapui' - local dap = require 'dap' - dapui.setup() - - -- handle closing/opening the UI when debugger stops/starts -- - dap.listeners.after.event_initialized['dapui_config'] = function() - dapui.open() - end - dap.listeners.before.event_terminated['dapui_config'] = function() - dapui.close() - end - dap.listeners.before.event_exited['dapui_config'] = function() - dapui.close() - end - - -- setup some nice keybindings -- - -- vim.keymap.set('n', 'dt', ':DapToggleBreakpoint', { desc = '[DEBUGGER] Toggle Breakpoint' }) - -- vim.keymap.set('n', 'dx', ':DapTerminate', { desc = '[DEBUGGER] Terminate Debugger' }) - -- vim.keymap.set('n', 'so', ':DapStepOver', { desc = '[DEBUGGER] Step Over' }) - - -- Nvim DAP Keybindings - local map = vim.keymap.set - - map('n', 'dl', "lua require'dap'.step_into()", { desc = '[DEBUGGER] Step Into' }) - map('n', 'dj', "lua require'dap'.step_over()", { desc = '[DEBUGGER] Step Over' }) - map('n', 'dk', "lua require'dap'.step_out()", { desc = '[DEBUGGER] Step Out' }) - map('n', 'dc', "lua require'dap'.continue()", { desc = '[DEBUGGER] Continue' }) - map('n', 'db', "lua require'dap'.toggle_breakpoint()", { desc = '[DEBUGGER] Toggle Breakpoint' }) - -- map( - -- 'n', - -- 'dd', - -- "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", - -- { desc = 'Debugger set conditional breakpoint' } - -- ) - map('n', 'de', "lua require'dap'.terminate()", { desc = '[DEBUGGER] Reset' }) - map('n', 'dr', "lua require'dap'.run_last()", { desc = '[DEBUGGER] Run Last' }) - - -- rustaceanvim - map('n', 'dt', "lua vim.cmd('RustLsp testables')", { desc = '[DEBUGGER] Testables' }) - end, - }, - { - 'mrcjkb/rustaceanvim', - version = '^5', - lazy = false, -- This plugin is already lazy - config = function() - -- TODO: these paths are wrong for some fucking reason - -- local mason_registry = require 'mason-registry' - -- local codelldb = mason_registry.get_package 'codelldb' - -- local extension_path = codelldb:get_install_path() .. '/extensions/' - -- local codelldb_path = extension_path .. 'adapter/codelldb' - -- local liblldb_path = extension_path .. 'lldb/lib/liblldb.so' - - local codelldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb' - -- NOTE: the liblldb is different between linux/mac (liblldb.so/dylib) - local liblldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/lldb/lib/liblldb.so' - local rustcfg = require 'rustaceanvim.config' - - vim.g.rustaceanvim = { - -- Plugin configuration - tools = {}, - -- LSP configuration - server = { - on_attach = function(client, bufnr) - -- you can also put keymaps in here - end, - default_settings = { - -- rust-analyzer language server configuration - ['rust-analyzer'] = {}, - }, - }, - -- DAP configuration - dap = { - adapter = rustcfg.get_codelldb_adapter(codelldb_path, liblldb_path), - }, - } - end, - }, + -- { --nvim-dap-- + -- 'mfussenegger/nvim-dap', + -- config = function() + -- local mason_registry = require 'mason-registry' + -- local codelldb = mason_registry.get_package 'codelldb' + -- local extension_path = codelldb:get_install_path() .. '/extensions/' + -- local codelldb_path = extension_path .. 'adapter/codelldb' + -- + -- local dap = require 'dap' + -- dap.adapters.codelldb = { + -- type = 'server', + -- port = '${port}', + -- executable = { + -- command = codelldb_path, + -- args = { '--port', '${port}' }, + -- }, + -- } + -- + -- dap.configurations.rust = { + -- { + -- name = 'Launch file', + -- type = 'codelldb', + -- request = 'launch', + -- program = function() + -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + -- end, + -- cwd = '${workspaceFolder}', + -- stopOnEntry = false, + -- }, + -- } + -- end, + -- }, + -- { --nvim-dap-ui-- + -- 'rcarriga/nvim-dap-ui', + -- dependencies = { + -- 'mfussenegger/nvim-dap', + -- 'nvim-neotest/nvim-nio', + -- }, + -- config = function() + -- local dapui = require 'dapui' + -- local dap = require 'dap' + -- dapui.setup() + -- + -- -- handle closing/opening the UI when debugger stops/starts -- + -- dap.listeners.after.event_initialized['dapui_config'] = function() + -- dapui.open() + -- end + -- dap.listeners.before.event_terminated['dapui_config'] = function() + -- dapui.close() + -- end + -- dap.listeners.before.event_exited['dapui_config'] = function() + -- dapui.close() + -- end + -- + -- -- setup some nice keybindings -- + -- -- vim.keymap.set('n', 'dt', ':DapToggleBreakpoint', { desc = '[DEBUGGER] Toggle Breakpoint' }) + -- -- vim.keymap.set('n', 'dx', ':DapTerminate', { desc = '[DEBUGGER] Terminate Debugger' }) + -- -- vim.keymap.set('n', 'so', ':DapStepOver', { desc = '[DEBUGGER] Step Over' }) + -- + -- -- Nvim DAP Keybindings + -- local map = vim.keymap.set + -- + -- map('n', 'dl', "lua require'dap'.step_into()", { desc = '[DEBUGGER] Step Into' }) + -- map('n', 'dj', "lua require'dap'.step_over()", { desc = '[DEBUGGER] Step Over' }) + -- map('n', 'dk', "lua require'dap'.step_out()", { desc = '[DEBUGGER] Step Out' }) + -- map('n', 'dc', "lua require'dap'.continue()", { desc = '[DEBUGGER] Continue' }) + -- map('n', 'db', "lua require'dap'.toggle_breakpoint()", { desc = '[DEBUGGER] Toggle Breakpoint' }) + -- -- map( + -- -- 'n', + -- -- 'dd', + -- -- "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", + -- -- { desc = 'Debugger set conditional breakpoint' } + -- -- ) + -- map('n', 'de', "lua require'dap'.terminate()", { desc = '[DEBUGGER] Reset' }) + -- map('n', 'dr', "lua require'dap'.run_last()", { desc = '[DEBUGGER] Run Last' }) + -- + -- -- rustaceanvim + -- map('n', 'dt', "lua vim.cmd('RustLsp testables')", { desc = '[DEBUGGER] Testables' }) + -- end, + -- }, + -- { + -- 'mrcjkb/rustaceanvim', + -- version = '^5', + -- lazy = false, -- This plugin is already lazy + -- config = function() + -- -- TODO: these paths are wrong for some fucking reason + -- -- local mason_registry = require 'mason-registry' + -- -- local codelldb = mason_registry.get_package 'codelldb' + -- -- local extension_path = codelldb:get_install_path() .. '/extensions/' + -- -- local codelldb_path = extension_path .. 'adapter/codelldb' + -- -- local liblldb_path = extension_path .. 'lldb/lib/liblldb.so' + -- + -- local codelldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb' + -- -- NOTE: the liblldb is different between linux/mac (liblldb.so/dylib) + -- local liblldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/lldb/lib/liblldb.so' + -- local rustcfg = require 'rustaceanvim.config' + -- + -- vim.g.rustaceanvim = { + -- -- Plugin configuration + -- tools = {}, + -- -- LSP configuration + -- server = { + -- on_attach = function(client, bufnr) + -- -- you can also put keymaps in here + -- end, + -- default_settings = { + -- -- rust-analyzer language server configuration + -- ['rust-analyzer'] = {}, + -- }, + -- }, + -- -- DAP configuration + -- dap = { + -- adapter = rustcfg.get_codelldb_adapter(codelldb_path, liblldb_path), + -- }, + -- } + -- end, + -- }, -- ADD COLORSCHEMES HERE (or at least around here) -- { From 4d0db740da56124c187b833dad8a30a0a12e42f0 Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Thu, 5 Jun 2025 20:43:32 -0500 Subject: [PATCH 13/18] added vscode specific section to init.lua --- cli-init.lua | 1094 +++++++++++++++++++++++++++++++++++++++++++++++++ init.lua | 1098 +------------------------------------------------- 2 files changed, 1099 insertions(+), 1093 deletions(-) create mode 100644 cli-init.lua diff --git a/cli-init.lua b/cli-init.lua new file mode 100644 index 00000000000..06f2fccfe00 --- /dev/null +++ b/cli-init.lua @@ -0,0 +1,1094 @@ +-- Set as the leader keyini +-- See `:help mapleader` +-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- Set to true if you have a Nerd Font installed and selected in the terminal +vim.g.have_nerd_font = true + +-- Set relative line #s +vim.wo.relativenumber = true + +-- [[ Setting options ]] +-- See `:help vim.opt` +-- NOTE: You can change these options as you wish! +-- For more options, you can see `:help option-list` + +-- Make line numbers default +vim.opt.number = true +-- You can also add relative line numbers, to help with jumping. +-- Experiment for yourself to see if you like it! +-- vim.opt.relativenumber = true + +-- Enable mouse mode, can be useful for resizing splits for example! +vim.opt.mouse = 'a' + +-- Don't show the mode, since it's already in the status line +vim.opt.showmode = false + +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.opt.clipboard = 'unnamedplus' + +-- Enable break indent +vim.opt.breakindent = true + +-- Save undo history +vim.opt.undofile = true + +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term +vim.opt.ignorecase = true +vim.opt.smartcase = true + +-- Keep signcolumn on by default +vim.opt.signcolumn = 'yes' + +-- Decrease update time +vim.opt.updatetime = 250 + +-- Decrease mapped sequence wait time +-- Displays which-key popup sooner +vim.opt.timeoutlen = 300 + +-- Configure how new splits should be opened +vim.opt.splitright = true +vim.opt.splitbelow = true + +-- disable netrw at the very start of your init.lua +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- Sets how neovim will display certain whitespace characters in the editor. +-- See `:help 'list'` +-- and `:help 'listchars'` +-- for backup tab characters -> » +vim.opt.list = true +vim.opt.listchars = { tab = '| ', trail = '·', nbsp = '␣' } + +-- Preview substitutions live, as you type! +vim.opt.inccommand = 'split' + +-- Show which line your cursor is on +vim.opt.cursorline = true + +-- Minimal number of screen lines to keep above and below the cursor. +vim.opt.scrolloff = 10 + +-- Set ConcealLevel for obsidian.nvim to work +vim.opt.conceallevel = 2 + +-- Set TAB details -> to 2 spaces +-- NOTE: differnt types of code have tab spacing set in +-- the language syntax file. If it's standard I won't get up +-- in arms about it... +-- vim.opt.tabstop = 2 +-- vim.opt.shiftwidth = 2 +-- vim.opt.expandtab = true +-- vim.bo.softtabstop = 2 + +-- [[ Basic Keymaps ]] +-- See `:help vim.keymap.set()` + +-- Set highlight on search, but clear on pressing in normal mode +vim.opt.hlsearch = true +vim.keymap.set('n', '', 'nohlsearch') + +-- Diagnostic keymaps +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) + +-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier +-- for people to discover. Otherwise, you normally need to press , which +-- is not what someone will guess without a bit more experience. +-- +-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping +-- or just use to exit terminal mode +vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) + +-- TIP: Disable arrow keys in normal mode +-- vim.keymap.set('n', '', 'echo "Use h to move!!"') +-- vim.keymap.set('n', '', 'echo "Use l to move!!"') +-- vim.keymap.set('n', '', 'echo "Use k to move!!"') +-- vim.keymap.set('n', '', 'echo "Use j to move!!"') + +-- Keybinds to make split navigation easier. +-- Use CTRL+ to switch between windows +-- +-- See `:help wincmd` for a list of all window commands +vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) +vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) + +-- Open a new terminal in split screen +vim.keymap.set('n', '`', ':split|resize -8|terminal', { desc = 'Open a terminal in split window' }) + +-- [[ Basic Autocommands ]] +-- See `:help lua-guide-autocommands` + +-- Highlight when yanking (copying) text +-- Try it with `yap` in normal mode +-- See `:help vim.highlight.on_yank()` +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.highlight.on_yank() + end, +}) + +-- [[ Install `lazy.nvim` plugin manager ]] +-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not vim.uv.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 ---@diagnostic disable-next-line: undefined-field +vim.opt.rtp:prepend(lazypath) + +-- NOTE: rustaceanvim -> this config has been moved to it's lazyloading config function +---@type rustaceanvim.Opts +-- vim.g.rustaceanvim = { +-- ---@type rustaceanvim.tools.Opts +-- tools = { +-- -- ... +-- }, +-- ---@type rustaceanvim.lsp.ClientOpts +-- server = { +-- on_attach = function(client, bufnr) +-- -- Set keybindings, etc. here. +-- end, +-- default_settings = { +-- -- rust-analyzer language server configuration +-- ['rust-analyzer'] = {}, +-- }, +-- -- ... +-- }, +-- ---@type rustaceanvim.dap.Opts +-- dap = { +-- -- ... +-- }, +-- } + +-- [[ Configure and install plugins ]] +-- NOTE: Here is plugins are setup! +require('lazy').setup({ + -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). + 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + + -- NOTE: Plugins can also be added by using a table, + -- with the first argument being the link and the following + -- keys can be used to configure plugin behavior/loading/etc. + -- + -- Use `opts = {}` to force a plugin to be loaded. + -- + + -- Here is a more advanced example where we pass configuration + -- options to `gitsigns.nvim`. This is equivalent to the following Lua: + -- require('gitsigns').setup({ ... }) + -- + -- See `:help gitsigns` to understand what the configuration keys do + { -- 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 = '~' }, + }, + }, + }, + + { -- Useful plugin to show you pending keybinds. + 'folke/which-key.nvim', + event = 'VimEnter', -- Sets the loading event to 'VimEnter' + config = function() -- This is the function that runs, AFTER loading + require('which-key').setup() + + -- Document existing key chains + require('which-key').add { + { 'c', group = '[C]ode' }, + { 'd', group = '[D]ocument' }, + { 'r', group = '[R]ename' }, + { 's', group = '[S]earch' }, + { 'w', group = '[W]orkspace' }, + { 't', group = '[T]oggle' }, + { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + } + end, + }, + + -- NOTE: 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 + + { -- Fuzzy Finder (files, lsp, etc) + 'nvim-telescope/telescope.nvim', + event = 'VimEnter', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + { -- If encountering errors, see telescope-fzf-native README for installation instructions + 'nvim-telescope/telescope-fzf-native.nvim', + + -- `build` is used to run some command when the plugin is installed/updated. + -- This is only run then, not every time Neovim starts up. + build = 'make', + + -- `cond` is a condition used to determine whether this plugin should be + -- installed and loaded. + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + { 'nvim-telescope/telescope-ui-select.nvim' }, + + -- Useful for getting pretty icons, but requires a Nerd Font. + { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + }, + config = function() + -- 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 use Telescope, is to start by doing something like: + -- :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: + -- - Normal mode: ? + -- + -- This opens a window that shows you all of the keymaps for the current + -- Telescope picker. This is really useful to discover what Telescope can + -- do as well as how to actually do it! + + -- [[ Configure Telescope ]] + -- See `:help telescope` and `:help telescope.setup()` + require('telescope').setup { + -- You can put your default mappings / updates / etc. in here + -- All the info you're looking for is in `:help telescope.setup()` + -- + -- defaults = { + -- mappings = { + -- i = { [''] = 'to_fuzzy_refine' }, + -- }, + -- }, + -- pickers = {} + extensions = { + ['ui-select'] = { + require('telescope.themes').get_dropdown(), + }, + }, + } + + -- Enable Telescope extensions if they are installed + pcall(require('telescope').load_extension, 'fzf') + pcall(require('telescope').load_extension, 'ui-select') + + -- See `:help telescope.builtin` + local builtin = require 'telescope.builtin' + vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) + vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) + vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) + vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + + -- Slightly advanced example of overriding default behavior and theme + vim.keymap.set('n', '/', function() + -- You can pass additional configuration to Telescope to change the theme, layout, etc. + builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + + -- It's also possible to pass additional configuration options. + -- See `:help telescope.builtin.live_grep()` for information about particular keys + vim.keymap.set('n', 's/', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[S]earch [/] in Open Files' }) + + -- Shortcut for searching your Neovim configuration files + vim.keymap.set('n', 'sn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[S]earch [N]eovim files' }) + end, + }, + + { -- LSP Configuration & Plugins + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs and related tools to stdpath for Neovim + { -- NOTE: Must be loaded before dependants + 'williamboman/mason.nvim', + config = true, + }, + 'williamboman/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', + + -- Useful status updates for LSP. + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, + + -- `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 = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, + { 'Bilal2453/luvit-meta', lazy = true }, + }, + config = function() + -- If you're wondering about lsp vs treesitter, you can check out the wonderfully + -- and elegantly composed help section, `:help lsp-vs-treesitter` + + -- This function gets run when an LSP attaches to a particular buffer. + -- That is to say, every time a new file is opened that is associated with + -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this + -- function will be executed to configure the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + -- NOTE: Remember that Lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself. + -- + -- 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) + vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + -- 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 . + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + + -- Find references for the word under your cursor. + map('gr', require('telescope.builtin').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('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + + -- 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('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('rn', 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('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + + -- 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) 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) then + map('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, + }) + + -- See full Code Diagnostic Text + -- Useful for if they float off screen + vim.keymap.set('n', 'dd', 'lua vim.diagnostic.open_float() ', { desc = 'Focuses Code Diagnostics' }) + + -- LSP servers and clients are able to communicate to each other what features they support. + -- By default, Neovim doesn't support everything that is in the LSP specification. + -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) + + -- Enable the following language servers + -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. + -- + -- 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/ + local servers = { + -- clangd = {}, + -- gopls = {}, + -- pyright = {}, + -- rust_analyzer = {}, + -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs + -- + -- Some languages (like typescript) have entire language plugins that can be useful: + -- https://github.com/pmizio/typescript-tools.nvim + -- + -- But for many setups, the LSP (`tsserver`) will work just fine + -- tsserver = {}, + -- + + 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' } }, + }, + }, + }, + } + + -- Ensure the servers and tools above are installed + -- To check the current status of installed tools and/or manually install + -- other tools, you can run + -- :Mason + -- + -- You can press `g?` for help in this menu. + require('mason').setup() + + -- You can add other tools here that you want Mason to install + -- for you, so that they are available from within Neovim. + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + 'stylua', -- Used to format Lua code + }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } + + -- Prevent mason from starting rust_analyzer + -- require('mason-lspconfig').setup_handlers { + -- ['rust_analyzer'] = function() end, + -- } + + require('mason-lspconfig').setup { + handlers = { + function(server_name) + local server = servers[server_name] or {} + + -- Don't let mason configure the rust lsp -> this is done later in rustaceanvim + -- if server_name == 'rust_analyzer' then + -- return + -- end + + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for tsserver) + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end, + }, + } + end, + }, + + { -- 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) + -- 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 = 500, + lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], + } + end, + stop_after_first = true, + formatters_by_ft = { + lua = { 'stylua' }, + -- Conform can also run multiple formatters sequentially + -- python = { "isort", "black" }, + -- + -- You can use a sub-list to tell conform to run *until* a formatter + -- is found. + javascript = { 'prettierd' }, + typescript = { 'prettierd' }, + }, + }, + }, + + { -- 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', + }, + 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 {}, + + -- 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 = '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, + }, + -- { --nvim-dap-- + -- 'mfussenegger/nvim-dap', + -- config = function() + -- local mason_registry = require 'mason-registry' + -- local codelldb = mason_registry.get_package 'codelldb' + -- local extension_path = codelldb:get_install_path() .. '/extensions/' + -- local codelldb_path = extension_path .. 'adapter/codelldb' + -- + -- local dap = require 'dap' + -- dap.adapters.codelldb = { + -- type = 'server', + -- port = '${port}', + -- executable = { + -- command = codelldb_path, + -- args = { '--port', '${port}' }, + -- }, + -- } + -- + -- dap.configurations.rust = { + -- { + -- name = 'Launch file', + -- type = 'codelldb', + -- request = 'launch', + -- program = function() + -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + -- end, + -- cwd = '${workspaceFolder}', + -- stopOnEntry = false, + -- }, + -- } + -- end, + -- }, + -- { --nvim-dap-ui-- + -- 'rcarriga/nvim-dap-ui', + -- dependencies = { + -- 'mfussenegger/nvim-dap', + -- 'nvim-neotest/nvim-nio', + -- }, + -- config = function() + -- local dapui = require 'dapui' + -- local dap = require 'dap' + -- dapui.setup() + -- + -- -- handle closing/opening the UI when debugger stops/starts -- + -- dap.listeners.after.event_initialized['dapui_config'] = function() + -- dapui.open() + -- end + -- dap.listeners.before.event_terminated['dapui_config'] = function() + -- dapui.close() + -- end + -- dap.listeners.before.event_exited['dapui_config'] = function() + -- dapui.close() + -- end + -- + -- -- setup some nice keybindings -- + -- -- vim.keymap.set('n', 'dt', ':DapToggleBreakpoint', { desc = '[DEBUGGER] Toggle Breakpoint' }) + -- -- vim.keymap.set('n', 'dx', ':DapTerminate', { desc = '[DEBUGGER] Terminate Debugger' }) + -- -- vim.keymap.set('n', 'so', ':DapStepOver', { desc = '[DEBUGGER] Step Over' }) + -- + -- -- Nvim DAP Keybindings + -- local map = vim.keymap.set + -- + -- map('n', 'dl', "lua require'dap'.step_into()", { desc = '[DEBUGGER] Step Into' }) + -- map('n', 'dj', "lua require'dap'.step_over()", { desc = '[DEBUGGER] Step Over' }) + -- map('n', 'dk', "lua require'dap'.step_out()", { desc = '[DEBUGGER] Step Out' }) + -- map('n', 'dc', "lua require'dap'.continue()", { desc = '[DEBUGGER] Continue' }) + -- map('n', 'db', "lua require'dap'.toggle_breakpoint()", { desc = '[DEBUGGER] Toggle Breakpoint' }) + -- -- map( + -- -- 'n', + -- -- 'dd', + -- -- "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", + -- -- { desc = 'Debugger set conditional breakpoint' } + -- -- ) + -- map('n', 'de', "lua require'dap'.terminate()", { desc = '[DEBUGGER] Reset' }) + -- map('n', 'dr', "lua require'dap'.run_last()", { desc = '[DEBUGGER] Run Last' }) + -- + -- -- rustaceanvim + -- map('n', 'dt', "lua vim.cmd('RustLsp testables')", { desc = '[DEBUGGER] Testables' }) + -- end, + -- }, + -- { + -- 'mrcjkb/rustaceanvim', + -- version = '^5', + -- lazy = false, -- This plugin is already lazy + -- config = function() + -- -- TODO: these paths are wrong for some fucking reason + -- -- local mason_registry = require 'mason-registry' + -- -- local codelldb = mason_registry.get_package 'codelldb' + -- -- local extension_path = codelldb:get_install_path() .. '/extensions/' + -- -- local codelldb_path = extension_path .. 'adapter/codelldb' + -- -- local liblldb_path = extension_path .. 'lldb/lib/liblldb.so' + -- + -- local codelldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb' + -- -- NOTE: the liblldb is different between linux/mac (liblldb.so/dylib) + -- local liblldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/lldb/lib/liblldb.so' + -- local rustcfg = require 'rustaceanvim.config' + -- + -- vim.g.rustaceanvim = { + -- -- Plugin configuration + -- tools = {}, + -- -- LSP configuration + -- server = { + -- on_attach = function(client, bufnr) + -- -- you can also put keymaps in here + -- end, + -- default_settings = { + -- -- rust-analyzer language server configuration + -- ['rust-analyzer'] = {}, + -- }, + -- }, + -- -- DAP configuration + -- dap = { + -- adapter = rustcfg.get_codelldb_adapter(codelldb_path, liblldb_path), + -- }, + -- } + -- end, + -- }, + + -- ADD COLORSCHEMES HERE (or at least around here) + -- { + -- 'folke/tokyonight.nvim', + -- priority = 1000, -- Make sure to load this before all the other start plugins. + -- config = function() + -- require('tokyonight').setup() + -- end, + -- init = function() + -- vim.cmd.colorscheme 'tokyonight' + -- + -- vim.cmd.hi 'Comment gui=none' + -- end, + -- }, + { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + require('catppuccin').setup { + name = 'catppuccin-mocha', + priority = 1000, + flavour = 'mocha', + term_colors = true, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + -- notify = false, + mini = { + enabled = true, + indentscope_color = '', + }, + }, + } + end, + init = function() + vim.cmd.colorscheme 'catppuccin-mocha' + vim.cmd.hi 'Comment gui=none' + end, + }, + -- END COLORSCHEMES CONFIG + + -- Highlight todo, notes, etc in comments + { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, + + { -- Collection of various small independent plugins/modules + 'echasnovski/mini.nvim', + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]an [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (bracets, 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, + }, + { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + 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' } }, + }, + config = function(_, opts) + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + + -- Prefer git instead of curl in order to improve connectivity in some environments + require('nvim-treesitter.install').prefer_git = true + ---@diagnostic disable-next-line: missing-fields + require('nvim-treesitter.configs').setup(opts) + + -- 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 + end, + }, + { + 'nvim-tree/nvim-tree.lua', + config = function() + require('nvim-tree').setup { + sort = { + sorter = 'case_sensitive', + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + } + vim.keymap.set('n', '0', ':NvimTreeToggle', { silent = true }) + end, + }, + { + 'tiagovla/scope.nvim', + }, + -- PLUGIN: tabs-tab-management with Tabby + -- { + -- 'nanozuki/tabby.nvim', + -- -- event = 'VimEnter', -- if you want lazy load, see below + -- dependencies = 'nvim-tree/nvim-web-devicons', + -- config = function() + -- -- configs... + -- end, + -- }, + -- PLUGIN: File browsing via telescope + { + 'nvim-telescope/telescope-file-browser.nvim', + dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' }, + config = function() + require('telescope').setup { + extensions = { + file_browser = { + hijack_netrw = true, + hidden = { + file_browser = true, + folder_browser = true, + }, + }, + }, + } + end, + + vim.keymap.set('n', 'fb', 'Telescope file_browser', { noremap = true }), + }, + -- PLUGIN: auto-close + -- Handles auto closing brackets when the opening one is typed + { + 'm4xshen/autoclose.nvim', + config = function() + require('autoclose').setup { + keys = { + ["'"] = { escape = true, close = false, pair = "''", disabled_filetypes = {} }, + }, + } + end, + }, + -- PLUGIN: obsidian + { + 'epwalsh/obsidian.nvim', + version = '*', + lazy = true, + ft = 'markdown', + -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: + -- event = { + -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. + -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md" + -- -- refer to `:h file-pattern` for more examples + -- "BufReadPre path/to/my-vault/*.md", + -- "BufNewFile path/to/my-vault/*.md", + -- }, + dependencies = { + -- Required. + 'nvim-lua/plenary.nvim', + + -- see below for full list of optional dependencies 👇 + }, + opts = { + workspaces = { + { + name = 'personal', + path = '~/Documents/alecaerdron', + }, + }, + }, + }, + { + 'rmagatti/auto-session', + lazy = false, + dependencies = { + 'nvim-telescope/telescope.nvim', -- Only needed if you want to use session lens + }, + + ---enables autocomplete for opts + ---@module "auto-session" + ---@type AutoSession.Config + opts = { + suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' }, + -- log_level = 'debug', + }, + }, + + -- Here are some example plugins that I've included in the Kickstart repository. + -- Uncomment any of the lines below to enable them (you will need to restart nvim). + -- + -- require 'kickstart.plugins.debug', + -- require 'kickstart.plugins.indent_line', + -- require 'kickstart.plugins.lint', + -- require 'kickstart.plugins.autopairs', + -- require 'kickstart.plugins.neo-tree', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + -- + -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- This is the easiest way to modularize your config. + -- + -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. + -- For additional information, see `:help lazy.nvim-jkjlazy.nvim-structuring-your-plugins` + -- { import = 'custom.plugins' }, +}, { + ui = { + -- If you are using a Nerd Font: set icons to an empty table which will use the + -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table + icons = vim.g.have_nerd_font and {} or { + cmd = '⌘', + config = '🛠', + event = '📅', + ft = '📂', + init = '⚙', + keys = '🗝', + plugin = '🔌', + runtime = '💻', + require = '🌙', + source = '📄', + start = '🚀', + task = '📌', + lazy = '💤 ', + }, + }, +}) + +-- The line beneath this is called `modeline`. See `:help modeline` +-- vim: ts=2 sts=2 sw=2 et diff --git a/init.lua b/init.lua index 06f2fccfe00..24d85e238b5 100644 --- a/init.lua +++ b/init.lua @@ -1,1094 +1,6 @@ --- Set as the leader keyini --- See `:help mapleader` --- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' +if vim.g.vscode then + -- VSCode extension +else + require 'cli-init' +end --- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = true - --- Set relative line #s -vim.wo.relativenumber = true - --- [[ Setting options ]] --- See `:help vim.opt` --- NOTE: You can change these options as you wish! --- For more options, you can see `:help option-list` - --- Make line numbers default -vim.opt.number = true --- You can also add relative line numbers, to help with jumping. --- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true - --- Enable mouse mode, can be useful for resizing splits for example! -vim.opt.mouse = 'a' - --- Don't show the mode, since it's already in the status line -vim.opt.showmode = false - --- Sync clipboard between OS and Neovim. --- Remove this option if you want your OS clipboard to remain independent. --- See `:help 'clipboard'` -vim.opt.clipboard = 'unnamedplus' - --- Enable break indent -vim.opt.breakindent = true - --- Save undo history -vim.opt.undofile = true - --- Case-insensitive searching UNLESS \C or one or more capital letters in the search term -vim.opt.ignorecase = true -vim.opt.smartcase = true - --- Keep signcolumn on by default -vim.opt.signcolumn = 'yes' - --- Decrease update time -vim.opt.updatetime = 250 - --- Decrease mapped sequence wait time --- Displays which-key popup sooner -vim.opt.timeoutlen = 300 - --- Configure how new splits should be opened -vim.opt.splitright = true -vim.opt.splitbelow = true - --- disable netrw at the very start of your init.lua -vim.g.loaded_netrw = 1 -vim.g.loaded_netrwPlugin = 1 - --- Sets how neovim will display certain whitespace characters in the editor. --- See `:help 'list'` --- and `:help 'listchars'` --- for backup tab characters -> » -vim.opt.list = true -vim.opt.listchars = { tab = '| ', trail = '·', nbsp = '␣' } - --- Preview substitutions live, as you type! -vim.opt.inccommand = 'split' - --- Show which line your cursor is on -vim.opt.cursorline = true - --- Minimal number of screen lines to keep above and below the cursor. -vim.opt.scrolloff = 10 - --- Set ConcealLevel for obsidian.nvim to work -vim.opt.conceallevel = 2 - --- Set TAB details -> to 2 spaces --- NOTE: differnt types of code have tab spacing set in --- the language syntax file. If it's standard I won't get up --- in arms about it... --- vim.opt.tabstop = 2 --- vim.opt.shiftwidth = 2 --- vim.opt.expandtab = true --- vim.bo.softtabstop = 2 - --- [[ Basic Keymaps ]] --- See `:help vim.keymap.set()` - --- Set highlight on search, but clear on pressing in normal mode -vim.opt.hlsearch = true -vim.keymap.set('n', '', 'nohlsearch') - --- Diagnostic keymaps -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) - --- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier --- for people to discover. Otherwise, you normally need to press , which --- is not what someone will guess without a bit more experience. --- --- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping --- or just use to exit terminal mode -vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) - --- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') - --- Keybinds to make split navigation easier. --- Use CTRL+ to switch between windows --- --- See `:help wincmd` for a list of all window commands -vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) -vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) - --- Open a new terminal in split screen -vim.keymap.set('n', '`', ':split|resize -8|terminal', { desc = 'Open a terminal in split window' }) - --- [[ Basic Autocommands ]] --- See `:help lua-guide-autocommands` - --- Highlight when yanking (copying) text --- Try it with `yap` in normal mode --- See `:help vim.highlight.on_yank()` -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.highlight.on_yank() - end, -}) - --- [[ Install `lazy.nvim` plugin manager ]] --- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info -local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' -if not vim.uv.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 ---@diagnostic disable-next-line: undefined-field -vim.opt.rtp:prepend(lazypath) - --- NOTE: rustaceanvim -> this config has been moved to it's lazyloading config function ----@type rustaceanvim.Opts --- vim.g.rustaceanvim = { --- ---@type rustaceanvim.tools.Opts --- tools = { --- -- ... --- }, --- ---@type rustaceanvim.lsp.ClientOpts --- server = { --- on_attach = function(client, bufnr) --- -- Set keybindings, etc. here. --- end, --- default_settings = { --- -- rust-analyzer language server configuration --- ['rust-analyzer'] = {}, --- }, --- -- ... --- }, --- ---@type rustaceanvim.dap.Opts --- dap = { --- -- ... --- }, --- } - --- [[ Configure and install plugins ]] --- NOTE: Here is plugins are setup! -require('lazy').setup({ - -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). - 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically - - -- NOTE: Plugins can also be added by using a table, - -- with the first argument being the link and the following - -- keys can be used to configure plugin behavior/loading/etc. - -- - -- Use `opts = {}` to force a plugin to be loaded. - -- - - -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. This is equivalent to the following Lua: - -- require('gitsigns').setup({ ... }) - -- - -- See `:help gitsigns` to understand what the configuration keys do - { -- 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 = '~' }, - }, - }, - }, - - { -- Useful plugin to show you pending keybinds. - 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' - config = function() -- This is the function that runs, AFTER loading - require('which-key').setup() - - -- Document existing key chains - require('which-key').add { - { 'c', group = '[C]ode' }, - { 'd', group = '[D]ocument' }, - { 'r', group = '[R]ename' }, - { 's', group = '[S]earch' }, - { 'w', group = '[W]orkspace' }, - { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, - } - end, - }, - - -- NOTE: 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 - - { -- Fuzzy Finder (files, lsp, etc) - 'nvim-telescope/telescope.nvim', - event = 'VimEnter', - branch = '0.1.x', - dependencies = { - 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for installation instructions - 'nvim-telescope/telescope-fzf-native.nvim', - - -- `build` is used to run some command when the plugin is installed/updated. - -- This is only run then, not every time Neovim starts up. - build = 'make', - - -- `cond` is a condition used to determine whether this plugin should be - -- installed and loaded. - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - - -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - }, - config = function() - -- 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 use Telescope, is to start by doing something like: - -- :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: - -- - Normal mode: ? - -- - -- This opens a window that shows you all of the keymaps for the current - -- Telescope picker. This is really useful to discover what Telescope can - -- do as well as how to actually do it! - - -- [[ Configure Telescope ]] - -- See `:help telescope` and `:help telescope.setup()` - require('telescope').setup { - -- You can put your default mappings / updates / etc. in here - -- All the info you're looking for is in `:help telescope.setup()` - -- - -- defaults = { - -- mappings = { - -- i = { [''] = 'to_fuzzy_refine' }, - -- }, - -- }, - -- pickers = {} - extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, - }, - } - - -- Enable Telescope extensions if they are installed - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') - - -- See `:help telescope.builtin` - local builtin = require 'telescope.builtin' - vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) - vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - - -- Slightly advanced example of overriding default behavior and theme - vim.keymap.set('n', '/', function() - -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = '[/] Fuzzily search in current buffer' }) - - -- It's also possible to pass additional configuration options. - -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set('n', 's/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[S]earch [/] in Open Files' }) - - -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'sn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[S]earch [N]eovim files' }) - end, - }, - - { -- LSP Configuration & Plugins - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs and related tools to stdpath for Neovim - { -- NOTE: Must be loaded before dependants - 'williamboman/mason.nvim', - config = true, - }, - 'williamboman/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', - - -- Useful status updates for LSP. - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, - - -- `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 = 'luvit-meta/library', words = { 'vim%.uv' } }, - }, - }, - }, - { 'Bilal2453/luvit-meta', lazy = true }, - }, - config = function() - -- If you're wondering about lsp vs treesitter, you can check out the wonderfully - -- and elegantly composed help section, `:help lsp-vs-treesitter` - - -- This function gets run when an LSP attaches to a particular buffer. - -- That is to say, every time a new file is opened that is associated with - -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this - -- function will be executed to configure the current buffer - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), - callback = function(event) - -- NOTE: Remember that Lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself. - -- - -- 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) - vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end - - -- 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 . - map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - - -- Find references for the word under your cursor. - map('gr', require('telescope.builtin').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('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - - -- 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('D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') - - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - map('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map('rn', 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('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - - -- 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) 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) then - map('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, - }) - - -- See full Code Diagnostic Text - -- Useful for if they float off screen - vim.keymap.set('n', 'dd', 'lua vim.diagnostic.open_float() ', { desc = 'Focuses Code Diagnostics' }) - - -- LSP servers and clients are able to communicate to each other what features they support. - -- By default, Neovim doesn't support everything that is in the LSP specification. - -- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with nvim cmp, and then broadcast that to the servers. - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities()) - - -- Enable the following language servers - -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. - -- - -- 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/ - local servers = { - -- clangd = {}, - -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`tsserver`) will work just fine - -- tsserver = {}, - -- - - 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' } }, - }, - }, - }, - } - - -- Ensure the servers and tools above are installed - -- To check the current status of installed tools and/or manually install - -- other tools, you can run - -- :Mason - -- - -- You can press `g?` for help in this menu. - require('mason').setup() - - -- You can add other tools here that you want Mason to install - -- for you, so that they are available from within Neovim. - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code - }) - require('mason-tool-installer').setup { ensure_installed = ensure_installed } - - -- Prevent mason from starting rust_analyzer - -- require('mason-lspconfig').setup_handlers { - -- ['rust_analyzer'] = function() end, - -- } - - require('mason-lspconfig').setup { - handlers = { - function(server_name) - local server = servers[server_name] or {} - - -- Don't let mason configure the rust lsp -> this is done later in rustaceanvim - -- if server_name == 'rust_analyzer' then - -- return - -- end - - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for tsserver) - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, - } - end, - }, - - { -- 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) - -- 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 = 500, - lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], - } - end, - stop_after_first = true, - formatters_by_ft = { - lua = { 'stylua' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use a sub-list to tell conform to run *until* a formatter - -- is found. - javascript = { 'prettierd' }, - typescript = { 'prettierd' }, - }, - }, - }, - - { -- 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', - }, - 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 {}, - - -- 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 = '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, - }, - -- { --nvim-dap-- - -- 'mfussenegger/nvim-dap', - -- config = function() - -- local mason_registry = require 'mason-registry' - -- local codelldb = mason_registry.get_package 'codelldb' - -- local extension_path = codelldb:get_install_path() .. '/extensions/' - -- local codelldb_path = extension_path .. 'adapter/codelldb' - -- - -- local dap = require 'dap' - -- dap.adapters.codelldb = { - -- type = 'server', - -- port = '${port}', - -- executable = { - -- command = codelldb_path, - -- args = { '--port', '${port}' }, - -- }, - -- } - -- - -- dap.configurations.rust = { - -- { - -- name = 'Launch file', - -- type = 'codelldb', - -- request = 'launch', - -- program = function() - -- return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') - -- end, - -- cwd = '${workspaceFolder}', - -- stopOnEntry = false, - -- }, - -- } - -- end, - -- }, - -- { --nvim-dap-ui-- - -- 'rcarriga/nvim-dap-ui', - -- dependencies = { - -- 'mfussenegger/nvim-dap', - -- 'nvim-neotest/nvim-nio', - -- }, - -- config = function() - -- local dapui = require 'dapui' - -- local dap = require 'dap' - -- dapui.setup() - -- - -- -- handle closing/opening the UI when debugger stops/starts -- - -- dap.listeners.after.event_initialized['dapui_config'] = function() - -- dapui.open() - -- end - -- dap.listeners.before.event_terminated['dapui_config'] = function() - -- dapui.close() - -- end - -- dap.listeners.before.event_exited['dapui_config'] = function() - -- dapui.close() - -- end - -- - -- -- setup some nice keybindings -- - -- -- vim.keymap.set('n', 'dt', ':DapToggleBreakpoint', { desc = '[DEBUGGER] Toggle Breakpoint' }) - -- -- vim.keymap.set('n', 'dx', ':DapTerminate', { desc = '[DEBUGGER] Terminate Debugger' }) - -- -- vim.keymap.set('n', 'so', ':DapStepOver', { desc = '[DEBUGGER] Step Over' }) - -- - -- -- Nvim DAP Keybindings - -- local map = vim.keymap.set - -- - -- map('n', 'dl', "lua require'dap'.step_into()", { desc = '[DEBUGGER] Step Into' }) - -- map('n', 'dj', "lua require'dap'.step_over()", { desc = '[DEBUGGER] Step Over' }) - -- map('n', 'dk', "lua require'dap'.step_out()", { desc = '[DEBUGGER] Step Out' }) - -- map('n', 'dc', "lua require'dap'.continue()", { desc = '[DEBUGGER] Continue' }) - -- map('n', 'db', "lua require'dap'.toggle_breakpoint()", { desc = '[DEBUGGER] Toggle Breakpoint' }) - -- -- map( - -- -- 'n', - -- -- 'dd', - -- -- "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", - -- -- { desc = 'Debugger set conditional breakpoint' } - -- -- ) - -- map('n', 'de', "lua require'dap'.terminate()", { desc = '[DEBUGGER] Reset' }) - -- map('n', 'dr', "lua require'dap'.run_last()", { desc = '[DEBUGGER] Run Last' }) - -- - -- -- rustaceanvim - -- map('n', 'dt', "lua vim.cmd('RustLsp testables')", { desc = '[DEBUGGER] Testables' }) - -- end, - -- }, - -- { - -- 'mrcjkb/rustaceanvim', - -- version = '^5', - -- lazy = false, -- This plugin is already lazy - -- config = function() - -- -- TODO: these paths are wrong for some fucking reason - -- -- local mason_registry = require 'mason-registry' - -- -- local codelldb = mason_registry.get_package 'codelldb' - -- -- local extension_path = codelldb:get_install_path() .. '/extensions/' - -- -- local codelldb_path = extension_path .. 'adapter/codelldb' - -- -- local liblldb_path = extension_path .. 'lldb/lib/liblldb.so' - -- - -- local codelldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/adapter/codelldb' - -- -- NOTE: the liblldb is different between linux/mac (liblldb.so/dylib) - -- local liblldb_path = '/home/slayterteal/.local/share/nvim/mason/packages/codelldb/extension/lldb/lib/liblldb.so' - -- local rustcfg = require 'rustaceanvim.config' - -- - -- vim.g.rustaceanvim = { - -- -- Plugin configuration - -- tools = {}, - -- -- LSP configuration - -- server = { - -- on_attach = function(client, bufnr) - -- -- you can also put keymaps in here - -- end, - -- default_settings = { - -- -- rust-analyzer language server configuration - -- ['rust-analyzer'] = {}, - -- }, - -- }, - -- -- DAP configuration - -- dap = { - -- adapter = rustcfg.get_codelldb_adapter(codelldb_path, liblldb_path), - -- }, - -- } - -- end, - -- }, - - -- ADD COLORSCHEMES HERE (or at least around here) - -- { - -- 'folke/tokyonight.nvim', - -- priority = 1000, -- Make sure to load this before all the other start plugins. - -- config = function() - -- require('tokyonight').setup() - -- end, - -- init = function() - -- vim.cmd.colorscheme 'tokyonight' - -- - -- vim.cmd.hi 'Comment gui=none' - -- end, - -- }, - { - 'catppuccin/nvim', - name = 'catppuccin', - priority = 1000, - config = function() - require('catppuccin').setup { - name = 'catppuccin-mocha', - priority = 1000, - flavour = 'mocha', - term_colors = true, - integrations = { - cmp = true, - gitsigns = true, - nvimtree = true, - treesitter = true, - -- notify = false, - mini = { - enabled = true, - indentscope_color = '', - }, - }, - } - end, - init = function() - vim.cmd.colorscheme 'catppuccin-mocha' - vim.cmd.hi 'Comment gui=none' - end, - }, - -- END COLORSCHEMES CONFIG - - -- Highlight todo, notes, etc in comments - { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, - - { -- Collection of various small independent plugins/modules - 'echasnovski/mini.nvim', - config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]an [I]nside [N]ext [Q]uote - -- - ci' - [C]hange [I]nside [']quote - require('mini.ai').setup { n_lines = 500 } - - -- Add/delete/replace surroundings (bracets, 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, - }, - { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - 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' } }, - }, - config = function(_, opts) - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - - -- Prefer git instead of curl in order to improve connectivity in some environments - require('nvim-treesitter.install').prefer_git = true - ---@diagnostic disable-next-line: missing-fields - require('nvim-treesitter.configs').setup(opts) - - -- 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 - end, - }, - { - 'nvim-tree/nvim-tree.lua', - config = function() - require('nvim-tree').setup { - sort = { - sorter = 'case_sensitive', - }, - view = { - width = 30, - }, - renderer = { - group_empty = true, - }, - filters = { - dotfiles = true, - }, - } - vim.keymap.set('n', '0', ':NvimTreeToggle', { silent = true }) - end, - }, - { - 'tiagovla/scope.nvim', - }, - -- PLUGIN: tabs-tab-management with Tabby - -- { - -- 'nanozuki/tabby.nvim', - -- -- event = 'VimEnter', -- if you want lazy load, see below - -- dependencies = 'nvim-tree/nvim-web-devicons', - -- config = function() - -- -- configs... - -- end, - -- }, - -- PLUGIN: File browsing via telescope - { - 'nvim-telescope/telescope-file-browser.nvim', - dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' }, - config = function() - require('telescope').setup { - extensions = { - file_browser = { - hijack_netrw = true, - hidden = { - file_browser = true, - folder_browser = true, - }, - }, - }, - } - end, - - vim.keymap.set('n', 'fb', 'Telescope file_browser', { noremap = true }), - }, - -- PLUGIN: auto-close - -- Handles auto closing brackets when the opening one is typed - { - 'm4xshen/autoclose.nvim', - config = function() - require('autoclose').setup { - keys = { - ["'"] = { escape = true, close = false, pair = "''", disabled_filetypes = {} }, - }, - } - end, - }, - -- PLUGIN: obsidian - { - 'epwalsh/obsidian.nvim', - version = '*', - lazy = true, - ft = 'markdown', - -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: - -- event = { - -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. - -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md" - -- -- refer to `:h file-pattern` for more examples - -- "BufReadPre path/to/my-vault/*.md", - -- "BufNewFile path/to/my-vault/*.md", - -- }, - dependencies = { - -- Required. - 'nvim-lua/plenary.nvim', - - -- see below for full list of optional dependencies 👇 - }, - opts = { - workspaces = { - { - name = 'personal', - path = '~/Documents/alecaerdron', - }, - }, - }, - }, - { - 'rmagatti/auto-session', - lazy = false, - dependencies = { - 'nvim-telescope/telescope.nvim', -- Only needed if you want to use session lens - }, - - ---enables autocomplete for opts - ---@module "auto-session" - ---@type AutoSession.Config - opts = { - suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' }, - -- log_level = 'debug', - }, - }, - - -- Here are some example plugins that I've included in the Kickstart repository. - -- Uncomment any of the lines below to enable them (you will need to restart nvim). - -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps - -- - -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- This is the easiest way to modularize your config. - -- - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- For additional information, see `:help lazy.nvim-jkjlazy.nvim-structuring-your-plugins` - -- { import = 'custom.plugins' }, -}, { - ui = { - -- If you are using a Nerd Font: set icons to an empty table which will use the - -- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table - icons = vim.g.have_nerd_font and {} or { - cmd = '⌘', - config = '🛠', - event = '📅', - ft = '📂', - init = '⚙', - keys = '🗝', - plugin = '🔌', - runtime = '💻', - require = '🌙', - source = '📄', - start = '🚀', - task = '📌', - lazy = '💤 ', - }, - }, -}) - --- The line beneath this is called `modeline`. See `:help modeline` --- vim: ts=2 sts=2 sw=2 et From 85a33d9d0de370281fb22de9ba23f16e9ff592c9 Mon Sep 17 00:00:00 2001 From: slayterteal Date: Sat, 7 Jun 2025 10:18:30 -0500 Subject: [PATCH 14/18] Add vscode specific init.lua --- init.lua | 1 + cli-init.lua => lua/cli-init.lua | 0 lua/vscode-init.lua | 23 +++++++++++++++++++++++ 3 files changed, 24 insertions(+) rename cli-init.lua => lua/cli-init.lua (100%) create mode 100644 lua/vscode-init.lua diff --git a/init.lua b/init.lua index 24d85e238b5..e79f85ebcec 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,6 @@ if vim.g.vscode then -- VSCode extension + require 'vscode-init' else require 'cli-init' end diff --git a/cli-init.lua b/lua/cli-init.lua similarity index 100% rename from cli-init.lua rename to lua/cli-init.lua diff --git a/lua/vscode-init.lua b/lua/vscode-init.lua new file mode 100644 index 00000000000..ecf89d284a6 --- /dev/null +++ b/lua/vscode-init.lua @@ -0,0 +1,23 @@ +-- VSCode Specific Neovim configuration + +vim.g.have_nerd_font = true + +-- Sync clipboard between OS and Neovim. +-- Remove this option if you want your OS clipboard to remain independent. +-- See `:help 'clipboard'` +vim.opt.clipboard = 'unnamedplus' + +-- Highlight when yanking (copying) text +-- Try it with `yap` in normal mode +-- See `:help vim.highlight.on_yank()` +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.highlight.on_yank() + end, +}) + +-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term +vim.opt.ignorecase = true +vim.opt.smartcase = true \ No newline at end of file From 342255e0507382006b896e9a0e71c191fbd195e1 Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Sat, 21 Jun 2025 21:07:23 -0500 Subject: [PATCH 15/18] Attempt to assign leader key in VSCode Neovim update .gitignore for mac systems --- .gitignore | 1 + init.lua | 2 ++ lua/vscode-init.lua | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/.gitignore b/.gitignore index 005b535b606..86152ef5f3f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ nvim spell/ lazy-lock.json +.DS_Store diff --git a/init.lua b/init.lua index e79f85ebcec..938a29b9dc4 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,7 @@ +print("Loading Neovim Configuration..") if vim.g.vscode then -- VSCode extension + print("Loading VSCode Neovim Configuration..") require 'vscode-init' else require 'cli-init' diff --git a/lua/vscode-init.lua b/lua/vscode-init.lua index ecf89d284a6..b0e6023ae5b 100644 --- a/lua/vscode-init.lua +++ b/lua/vscode-init.lua @@ -1,5 +1,16 @@ -- VSCode Specific Neovim configuration +-- * Custom Keybings * -- + +-- local keymap = vim.keymap.set +-- local opts = { nmap = true, silent = true } + +-- Remap leader key +-- keymap("n", "", "", opts) +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' + +-- * VSCode Neovim Configuration vim.g.have_nerd_font = true -- Sync clipboard between OS and Neovim. From 6674abcee8211c0a7b6ecb6ea15b3941d5c5559a Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Sun, 22 Jun 2025 15:11:47 -0500 Subject: [PATCH 16/18] update vscode nvim config added lazy.nvim and mini.nvim (mainly just for mini.surround). --- init.lua | 6 +++--- lua/vscode-init.lua | 7 ++++++- lua/vscode-plugins.lua | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 lua/vscode-plugins.lua diff --git a/init.lua b/init.lua index 938a29b9dc4..a70f9e28974 100644 --- a/init.lua +++ b/init.lua @@ -1,8 +1,8 @@ -print("Loading Neovim Configuration..") if vim.g.vscode then - -- VSCode extension - print("Loading VSCode Neovim Configuration..") + -- VSCode Neovim extension configuration + print("Loading VSCode Neovim Configuration..\n") require 'vscode-init' + print("VSCode Neovim Configuration Loaded!") else require 'cli-init' end diff --git a/lua/vscode-init.lua b/lua/vscode-init.lua index b0e6023ae5b..66da0d3e6f2 100644 --- a/lua/vscode-init.lua +++ b/lua/vscode-init.lua @@ -31,4 +31,9 @@ vim.api.nvim_create_autocmd('TextYankPost', { -- Case-insensitive searching UNLESS \C or one or more capital letters in the search term vim.opt.ignorecase = true -vim.opt.smartcase = true \ No newline at end of file +vim.opt.smartcase = true + +-- * Manage plugins here +if true then + require("vscode-plugins") +end \ No newline at end of file diff --git a/lua/vscode-plugins.lua b/lua/vscode-plugins.lua new file mode 100644 index 00000000000..de5394f0f29 --- /dev/null +++ b/lua/vscode-plugins.lua @@ -0,0 +1,40 @@ +-- VSCode Neovim plugin management + +-- [[ Install `lazy.nvim` plugin manager ]] +-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info +local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' +if not vim.uv.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 ---@diagnostic disable-next-line: undefined-field +vim.opt.rtp:prepend(lazypath) + + +-- Lazy +require('lazy').setup({ + { -- Collection of various small independent plugins/modules + 'echasnovski/mini.nvim', + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]an [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (bracets, 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() + + -- For more Mini.nvim stuff: + -- Check out: https://github.com/echasnovski/mini.nvim + end, + }, +}) \ No newline at end of file From e178806339231ebdb5ee97a71609d8875341d7ee Mon Sep 17 00:00:00 2001 From: Slayter Teal Date: Fri, 18 Jul 2025 21:59:58 -0500 Subject: [PATCH 17/18] Changes to CLI config - removed some lingering kickstart code I don't use --- lua/archive/archive.lua | 73 +++++++++++++ lua/cli-init.lua | 128 +++++------------------ lua/custom/plugins/init.lua | 5 - lua/kickstart/health.lua | 52 --------- lua/kickstart/plugins/autopairs.lua | 16 --- lua/kickstart/plugins/debug.lua | 105 ------------------- lua/kickstart/plugins/indent_line.lua | 9 -- lua/kickstart/plugins/lint.lua | 55 ---------- lua/kickstart/plugins/neo-tree.lua | 25 ----- lua/{kickstart => }/plugins/gitsigns.lua | 0 10 files changed, 97 insertions(+), 371 deletions(-) create mode 100644 lua/archive/archive.lua delete mode 100644 lua/custom/plugins/init.lua delete mode 100644 lua/kickstart/health.lua delete mode 100644 lua/kickstart/plugins/autopairs.lua delete mode 100644 lua/kickstart/plugins/debug.lua delete mode 100644 lua/kickstart/plugins/indent_line.lua delete mode 100644 lua/kickstart/plugins/lint.lua delete mode 100644 lua/kickstart/plugins/neo-tree.lua rename lua/{kickstart => }/plugins/gitsigns.lua (100%) diff --git a/lua/archive/archive.lua b/lua/archive/archive.lua new file mode 100644 index 00000000000..18a9b83156f --- /dev/null +++ b/lua/archive/archive.lua @@ -0,0 +1,73 @@ + +-- NOTE: a place for me to put configuration of files +-- I don't have a use for anymore +local archive = { + -- NOTE: removed nvim-tree becuase learning telescope is + -- a better use of my time + { + 'nvim-tree/nvim-tree.lua', + config = function() + require('nvim-tree').setup { + sort = { + sorter = 'case_sensitive', + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + } + vim.keymap.set('n', '0', ':NvimTreeToggle', { silent = true }) + end, + opts = { + disable_netwr = true, + update_focused_file = { + enabled = true, + }, + }, + }, + { -- Autoformat + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + -- NOTE: I'm not certain if I need this... + -- 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) + -- 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 = 500, + lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], + } + end, + stop_after_first = true, + formatters_by_ft = { + lua = { 'stylua' }, + -- Conform can also run multiple formatters sequentially + -- python = { "isort", "black" }, + -- + -- You can use a sub-list to tell conform to run *until* a formatter + -- is found. + javascript = { 'prettierd' }, + typescript = { 'prettierd' }, + }, + }, + }, + diff --git a/lua/cli-init.lua b/lua/cli-init.lua index 06f2fccfe00..a6ccbcef325 100644 --- a/lua/cli-init.lua +++ b/lua/cli-init.lua @@ -70,6 +70,9 @@ vim.opt.listchars = { tab = '| ', trail = '·', nbsp = '␣' } -- Preview substitutions live, as you type! vim.opt.inccommand = 'split' +-- Disable wrap +vim.opt.wrap = false + -- Show which line your cursor is on vim.opt.cursorline = true @@ -80,13 +83,14 @@ vim.opt.scrolloff = 10 vim.opt.conceallevel = 2 -- Set TAB details -> to 2 spaces --- NOTE: differnt types of code have tab spacing set in +-- NOTE: different types of code have tab spacing set in -- the language syntax file. If it's standard I won't get up -- in arms about it... --- vim.opt.tabstop = 2 --- vim.opt.shiftwidth = 2 --- vim.opt.expandtab = true --- vim.bo.softtabstop = 2 +-- or will I? +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.bo.softtabstop = 2 -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -253,7 +257,7 @@ require('lazy').setup({ { 'nvim-telescope/telescope-ui-select.nvim' }, -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, + -- { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() -- Telescope is a fuzzy finder that comes with a lot of different things that @@ -335,7 +339,6 @@ require('lazy').setup({ end, { desc = '[S]earch [N]eovim files' }) end, }, - { -- LSP Configuration & Plugins 'neovim/nvim-lspconfig', dependencies = { @@ -465,7 +468,7 @@ require('lazy').setup({ -- See full Code Diagnostic Text -- Useful for if they float off screen - vim.keymap.set('n', 'dd', 'lua vim.diagnostic.open_float() ', { desc = 'Focuses Code Diagnostics' }) + vim.keymap.set('n', 'gh', 'lua vim.diagnostic.open_float() ', { desc = 'Focuses Code Diagnostics' }) -- LSP servers and clients are able to communicate to each other what features they support. -- By default, Neovim doesn't support everything that is in the LSP specification. @@ -555,46 +558,6 @@ require('lazy').setup({ end, }, - { -- 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) - -- 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 = 500, - lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype], - } - end, - stop_after_first = true, - formatters_by_ft = { - lua = { 'stylua' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use a sub-list to tell conform to run *until* a formatter - -- is found. - javascript = { 'prettierd' }, - typescript = { 'prettierd' }, - }, - }, - }, - { -- Autocompletion 'hrsh7th/nvim-cmp', event = 'InsertEnter', @@ -710,6 +673,7 @@ require('lazy').setup({ } end, }, + -- DAP = debug adapter protocol -- { --nvim-dap-- -- 'mfussenegger/nvim-dap', -- config = function() @@ -943,26 +907,6 @@ require('lazy').setup({ -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects end, }, - { - 'nvim-tree/nvim-tree.lua', - config = function() - require('nvim-tree').setup { - sort = { - sorter = 'case_sensitive', - }, - view = { - width = 30, - }, - renderer = { - group_empty = true, - }, - filters = { - dotfiles = true, - }, - } - vim.keymap.set('n', '0', ':NvimTreeToggle', { silent = true }) - end, - }, { 'tiagovla/scope.nvim', }, @@ -993,7 +937,17 @@ require('lazy').setup({ } end, - vim.keymap.set('n', 'fb', 'Telescope file_browser', { noremap = true }), + -- Telescope keymaps + vim.keymap.set('n', 'ob', 'Telescope file_browser', + { + desc = "[O]pen File [B]rowser", + noremap = true + }), + vim.keymap.set('n', 'ol', 'Telescope file_browser path=%:p:h', + { + desc = "[O]pen [L]ocal File Browser", + noremap = true + }), }, -- PLUGIN: auto-close -- Handles auto closing brackets when the opening one is typed @@ -1007,35 +961,6 @@ require('lazy').setup({ } end, }, - -- PLUGIN: obsidian - { - 'epwalsh/obsidian.nvim', - version = '*', - lazy = true, - ft = 'markdown', - -- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault: - -- event = { - -- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'. - -- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md" - -- -- refer to `:h file-pattern` for more examples - -- "BufReadPre path/to/my-vault/*.md", - -- "BufNewFile path/to/my-vault/*.md", - -- }, - dependencies = { - -- Required. - 'nvim-lua/plenary.nvim', - - -- see below for full list of optional dependencies 👇 - }, - opts = { - workspaces = { - { - name = 'personal', - path = '~/Documents/alecaerdron', - }, - }, - }, - }, { 'rmagatti/auto-session', lazy = false, @@ -1055,12 +980,7 @@ require('lazy').setup({ -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug', - -- require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', - -- require 'kickstart.plugins.autopairs', - -- require 'kickstart.plugins.neo-tree', - require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'plugins.gitsigns', -- adds gitsigns recommend keymaps -- -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index be0eb9d8d7a..00000000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -1,5 +0,0 @@ --- 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 :) --- --- See the kickstart.nvim README for more information -return {} diff --git a/lua/kickstart/health.lua b/lua/kickstart/health.lua deleted file mode 100644 index b59d08649af..00000000000 --- a/lua/kickstart/health.lua +++ /dev/null @@ -1,52 +0,0 @@ ---[[ --- --- 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/autopairs.lua b/lua/kickstart/plugins/autopairs.lua deleted file mode 100644 index 87a7e5ffa2e..00000000000 --- a/lua/kickstart/plugins/autopairs.lua +++ /dev/null @@ -1,16 +0,0 @@ --- 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/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua deleted file mode 100644 index 196f2c6dbd6..00000000000 --- a/lua/kickstart/plugins/debug.lua +++ /dev/null @@ -1,105 +0,0 @@ --- 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/indent_line.lua b/lua/kickstart/plugins/indent_line.lua deleted file mode 100644 index ed7f269399f..00000000000 --- a/lua/kickstart/plugins/indent_line.lua +++ /dev/null @@ -1,9 +0,0 @@ -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/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua deleted file mode 100644 index ca9bc237904..00000000000 --- a/lua/kickstart/plugins/lint.lua +++ /dev/null @@ -1,55 +0,0 @@ -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/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua deleted file mode 100644 index f126d68af2c..00000000000 --- a/lua/kickstart/plugins/neo-tree.lua +++ /dev/null @@ -1,25 +0,0 @@ --- 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' }, - }, - opts = { - filesystem = { - window = { - mappings = { - ['\\'] = 'close_window', - }, - }, - }, - }, -} diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua similarity index 100% rename from lua/kickstart/plugins/gitsigns.lua rename to lua/plugins/gitsigns.lua From 4fe6c41e67efb11305f55210acdd0d92f52c9eb4 Mon Sep 17 00:00:00 2001 From: slayterteal Date: Sat, 19 Jul 2025 09:40:25 -0500 Subject: [PATCH 18/18] Fix an issue with vscode nvim setup --- lua/vscode-plugins.lua | 54 ++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/lua/vscode-plugins.lua b/lua/vscode-plugins.lua index de5394f0f29..62cc03ece15 100644 --- a/lua/vscode-plugins.lua +++ b/lua/vscode-plugins.lua @@ -3,6 +3,17 @@ -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' + +-- NOTE: for windows we need to make sure we're pointing towards the +-- correct path +if vim.fn.has "win32" == 1 or vim.fn.has "win64" == 1 then + package.path = "%localappdata%\\nvim-data\\" .. package.path + lazypath = vim.fn.stdpath 'data' .. '\\lazy\\lazy.nvim' + -- lazypath ='C:\\Program Files\\Neovim\\bin\\lua' .. '\\lazy\\lazy.nvim' + -- print('C:\\Program Files\\Neovim\\bin\\lua') +end + +-- If lazy.nvim doesn't exist, clone it if not vim.uv.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 } @@ -12,29 +23,30 @@ if not vim.uv.fs_stat(lazypath) then end ---@diagnostic disable-next-line: undefined-field vim.opt.rtp:prepend(lazypath) - -- Lazy -require('lazy').setup({ - { -- Collection of various small independent plugins/modules - 'echasnovski/mini.nvim', - config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]an [I]nside [N]ext [Q]uote - -- - ci' - [C]hange [I]nside [']quote - require('mini.ai').setup { n_lines = 500 } +require('lazy').setup({ + spec = { + { -- Collection of various small independent plugins/modules + 'echasnovski/mini.nvim', + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]an [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } - -- Add/delete/replace surroundings (bracets, 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() + -- Add/delete/replace surroundings (bracets, 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() - -- For more Mini.nvim stuff: - -- Check out: https://github.com/echasnovski/mini.nvim - end, + -- For more Mini.nvim stuff: + -- Check out: https://github.com/echasnovski/mini.nvim + end, + } }, }) \ No newline at end of file