diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..b8a004b1553 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/gitleaks/gitleaks + rev: v8.24.2 + hooks: + - id: gitleaks diff --git a/README.md b/README.md index aa5f4fc8f1e..8ace8b9b22b 100644 --- a/README.md +++ b/README.md @@ -27,18 +27,19 @@ External Requirements: - Clipboard tool (xclip/xsel/win32yank or other depending on the platform) - A [Nerd Font](https://www.nerdfonts.com/): optional, provides various icons - if you have it set `vim.g.have_nerd_font` in `init.lua` to true +- Emoji fonts (Ubuntu only, and only if you want emoji!) `sudo apt install fonts-noto-color-emoji` - Language Setup: - If you want to write Typescript, you need `npm` - If you want to write Golang, you will need `go` - etc. -> **NOTE** +> [!NOTE] > See [Install Recipes](#Install-Recipes) for additional Windows and Linux specific notes > and quick install snippets ### Install Kickstart -> **NOTE** +> [!NOTE] > [Backup](#FAQ) your previous configuration (if any exists) Neovim's configurations are located under the following paths, depending on your OS: @@ -55,7 +56,7 @@ Neovim's configurations are located under the following paths, depending on your 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** +> [!NOTE] > Your fork's URL will be something like this: > `https://github.com//kickstart.nvim.git` @@ -64,7 +65,8 @@ too - it's ignored in the kickstart repo to make maintenance easier, but it's [recommended to track it in version control](https://lazy.folke.io/usage/lockfile). #### Clone kickstart.nvim -> **NOTE** + +> [!NOTE] > If following the recommended step above (i.e., forking the repo), replace > `nvim-lua` with `` in the commands below @@ -212,14 +214,14 @@ 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 +curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz +sudo rm -rf /opt/nvim-linux-x86_64 +sudo mkdir -p /opt/nvim-linux-x86_64 +sudo chmod a+rX /opt/nvim-linux-x86_64 +sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz # make it available in /usr/local/bin, distro installs to /usr/bin -sudo ln -sf /opt/nvim-linux64/bin/nvim /usr/local/bin/ +sudo ln -sf /opt/nvim-linux-x86_64/bin/nvim /usr/local/bin/ ```
Fedora Install Steps diff --git a/init.lua b/init.lua index 4eae8e7d95a..a1e017a04a9 100644 --- a/init.lua +++ b/init.lua @@ -1,89 +1,3 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== - -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: - - 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`. - 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. - - 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 -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) @@ -91,7 +5,7 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.opt` @@ -102,7 +16,7 @@ vim.g.have_nerd_font = false vim.opt.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! --- vim.opt.relativenumber = true +vim.opt.relativenumber = false -- Enable mouse mode, can be useful for resizing splits for example! vim.opt.mouse = 'a' @@ -156,6 +70,11 @@ vim.opt.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. vim.opt.scrolloff = 10 +-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), +-- instead raise a dialog asking if you wish to save the current file(s) +-- See `:help 'confirm'` +vim.opt.confirm = true + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -189,6 +108,12 @@ 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' }) +-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes +-- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) +-- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) +-- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) +-- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -203,6 +128,22 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) +-- -- Show errors and warnings in a floating window +-- vim.api.nvim_create_autocmd('CursorHold', { +-- desc = 'Show errors and warnings in a floating window', +-- callback = function() +-- vim.diagnostic.open_float(nil, { focusable = true, source = 'if_many' }) +-- end, +-- }) + +vim.api.nvim_create_autocmd('FileType', { + pattern = { 'markdown' }, + callback = function() + vim.wo.conceallevel = 2 + vim.cmd 'Pencil' + 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' @@ -234,12 +175,22 @@ require('lazy').setup({ -- 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. + -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. -- + -- Alternatively, use `config = function() ... end` for full control over the configuration. + -- If you prefer to call `setup` explicitly, use: + -- { + -- 'lewis6991/gitsigns.nvim', + -- config = function() + -- require('gitsigns').setup({ + -- -- Your gitsigns configuration here + -- }) + -- end, + -- } + -- -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. This is equivalent to the following Lua: - -- require('gitsigns').setup({ ... }) + -- options to `gitsigns.nvim`. -- -- See `:help gitsigns` to understand what the configuration keys do { -- Adds git related signs to the gutter, as well as utilities for managing changes @@ -315,11 +266,7 @@ require('lazy').setup({ -- Document existing key chains spec = { - { 'c', group = '[C]ode', mode = { 'n', 'x' } }, - { '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' } }, }, @@ -336,7 +283,6 @@ require('lazy').setup({ { -- 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 @@ -465,8 +411,8 @@ require('lazy').setup({ -- Useful status updates for LSP. { 'j-hui/fidget.nvim', opts = {} }, - -- Allows extra capabilities provided by nvim-cmp - 'hrsh7th/cmp-nvim-lsp', + -- Allows extra capabilities provided by blink.cmp + 'saghen/blink.cmp', }, config = function() -- Brief aside: **What is LSP?** @@ -511,42 +457,55 @@ require('lazy').setup({ vim.keymap.set(mode, 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') + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) -- Find references for the word under your cursor. - map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + map('grr', 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') + map('gri', 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') + -- 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('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') -- Fuzzy find all the symbols in your current document. -- Symbols are things like variables, functions, types, etc. - map('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') -- Fuzzy find all the symbols in your current workspace. -- Similar to document symbols, except searches over your entire project. - map('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', { 'n', 'x' }) + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - -- 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') + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + + -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) + ---@param client vim.lsp.Client + ---@param method vim.lsp.protocol.Method + ---@param bufnr? integer some lsp support methods only in specific files + ---@return boolean + local function client_supports_method(client, method, bufnr) + if vim.fn.has 'nvim-0.11' == 1 then + return client:supports_method(method, bufnr) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end -- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. @@ -554,7 +513,7 @@ require('lazy').setup({ -- -- 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 + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { buffer = event.buf, @@ -581,7 +540,7 @@ require('lazy').setup({ -- 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 + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) 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') @@ -589,93 +548,120 @@ require('lazy').setup({ end, }) - -- Change diagnostic symbols in the sign column (gutter) - -- if vim.g.have_nerd_font then - -- local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' } - -- local diagnostic_signs = {} - -- for type, icon in pairs(signs) do - -- diagnostic_signs[vim.diagnostic.severity[type]] = icon - -- end - -- vim.diagnostic.config { signs = { text = diagnostic_signs } } - -- end + -- Diagnostic Config + -- See :help vim.diagnostic.Opts + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', + [vim.diagnostic.severity.WARN] = '󰀪 ', + [vim.diagnostic.severity.INFO] = '󰋽 ', + [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, + } -- 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/ + -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. + local capabilities = require('blink.cmp').get_lsp_capabilities() + + -- Enable the following language servers. Configs are merged on top of the + -- defaults shipped in nvim-lspconfig's `lsp/.lua`, so we keep cmd / + -- root_dir defaults without using the deprecated require('lspconfig') + -- framework. See `:help lspconfig-nvim-0.11`. 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 (`ts_ls`) will work just fine - -- ts_ls = {}, - -- - lua_ls = { - -- cmd = { ... }, - -- filetypes = { ... }, - -- capabilities = {}, settings = { Lua = { - completion = { - callSnippet = 'Replace', + completion = { callSnippet = 'Replace' }, + }, + }, + }, + terraformls = { + cmd = { 'terraform-ls', 'serve' }, + filetypes = { 'terraform', 'tf', 'terraform-vars' }, + }, + tflint = { + filetypes = { 'terraform', 'tf' }, + }, + ansiblels = { + filetypes = { 'yaml.ansible', 'ansible' }, + settings = { + ansible = { + python = { interpreterPath = 'python3' }, + ansible = { path = 'ansible' }, + executionEnvironment = { enabled = false }, + validation = { + enabled = true, + lint = { enabled = true, path = 'ansible-lint' }, + }, + }, + }, + }, + yamlls = { + filetypes = { 'yaml', 'yml' }, + settings = { + yaml = { + schemas = { + kubernetes = '*.yaml', + ['http://json.schemastore.org/ansible-stable-2.9'] = 'playbooks/*.{yml,yaml}', + ['http://json.schemastore.org/ansible-playbook'] = '*play*.{yml,yaml}', + ['http://json.schemastore.org/github-workflow'] = '.github/workflows/*', }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, + format = { enable = true }, + validate = true, + completion = true, + hover = true, }, }, }, + ruff = { + init_options = { settings = {} }, + }, + basedpyright = { + settings = { + pyright = { disableOrganizeImports = true }, + python = { analysis = { ignore = { '*' } } }, + }, + }, } - -- 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. - -- - -- `mason` had to be setup earlier: to configure its options see the - -- `dependencies` table for `nvim-lspconfig` above. - -- - -- 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 {}) + -- Mason installs servers (above) plus extra tools that are NOT LSPs + -- (formatters/linters). Tools live in a separate list so we never hand + -- them to vim.lsp.enable. + local ensure_installed = vim.tbl_keys(servers) vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code + 'stylua', + 'terraform-ls', + 'tflint', + 'ansible-language-server', + 'yaml-language-server', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } - require('mason-lspconfig').setup { - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- 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 ts_ls) - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, - } + for name, cfg in pairs(servers) do + cfg.capabilities = vim.tbl_deep_extend('force', {}, capabilities, cfg.capabilities or {}) + vim.lsp.config(name, cfg) + vim.lsp.enable(name) + end end, }, @@ -700,16 +686,14 @@ require('lazy').setup({ -- 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 } - local lsp_format_opt if disable_filetypes[vim.bo[bufnr].filetype] then - lsp_format_opt = 'never' + return nil else - lsp_format_opt = 'fallback' + return { + timeout_ms = 500, + lsp_format = 'fallback', + } end - return { - timeout_ms = 500, - lsp_format = lsp_format_opt, - } end, formatters_by_ft = { lua = { 'stylua' }, @@ -723,12 +707,14 @@ require('lazy').setup({ }, { -- Autocompletion - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', + 'saghen/blink.cmp', + event = 'VimEnter', + version = '1.*', dependencies = { - -- Snippet Engine & its associated nvim-cmp source + -- Snippet Engine { 'L3MON4D3/LuaSnip', + version = '2.*', build = (function() -- Build Step is needed for regex support in snippets. -- This step is not supported in many windows environments. @@ -749,93 +735,74 @@ require('lazy').setup({ -- end, -- }, }, + opts = {}, }, - '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', + 'folke/lazydev.nvim', }, - 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` + --- @module 'blink.cmp' + --- @type blink.cmp.Config + opts = { + keymap = { + -- 'default' (recommended) for mappings similar to built-in completions + -- to accept ([y]es) the completion. + -- This will auto-import if your LSP supports it. + -- This will expand snippets if the LSP sent a snippet. + -- 'super-tab' for tab to accept + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- For an understanding of why the 'default' preset is recommended, + -- 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' }), + -- + -- All presets have the following mappings: + -- /: move to right/left of your snippet expansion + -- : Open menu or open docs if already open + -- / or /: Select next/previous item + -- : Hide menu + -- : Toggle signature help + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + preset = 'default', - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps - }, - 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' }, + -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: + -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono', + }, + + completion = { + -- By default, you may press `` to show the documentation. + -- Optionally, set `auto_show = true` to show the documentation after a delay. + documentation = { auto_show = false, auto_show_delay_ms = 500 }, + }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'lazydev' }, + providers = { + lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, }, - } - end, + }, + + snippets = { preset = 'luasnip' }, + + -- Blink.cmp includes an optional, recommended rust fuzzy matcher, + -- which automatically downloads a prebuilt binary when enabled. + -- + -- By default, we use the Lua implementation instead, but you may enable + -- the rust implementation via `'prefer_rust_with_warning'` + -- + -- See :h blink-cmp-config-fuzzy for more information + fuzzy = { implementation = 'prefer_rust_with_warning' }, + + -- Shows a signature help window while you type arguments for a function + signature = { enabled = true }, + }, }, { -- You can easily change to a different colorscheme. @@ -845,14 +812,18 @@ require('lazy').setup({ -- 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() + config = function() + ---@diagnostic disable-next-line: missing-fields + require('tokyonight').setup { + styles = { + comments = { italic = false }, -- Disable italics in comments + }, + } + -- 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.hi 'Comment gui=none' end, }, @@ -942,7 +913,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. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lua/custom/plugins/better-escape.lua b/lua/custom/plugins/better-escape.lua new file mode 100644 index 00000000000..d8e6aa67440 --- /dev/null +++ b/lua/custom/plugins/better-escape.lua @@ -0,0 +1,3 @@ +return { + 'nvim-zh/better-escape.vim', +} diff --git a/lua/custom/plugins/code_companion.lua b/lua/custom/plugins/code_companion.lua new file mode 100644 index 00000000000..04b34ce19c5 --- /dev/null +++ b/lua/custom/plugins/code_companion.lua @@ -0,0 +1,8 @@ +return { + 'olimorris/codecompanion.nvim', + opts = {}, + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + }, +} diff --git a/lua/custom/plugins/copilot.lua b/lua/custom/plugins/copilot.lua new file mode 100644 index 00000000000..ea9e13f1785 --- /dev/null +++ b/lua/custom/plugins/copilot.lua @@ -0,0 +1,27 @@ +return { + { + 'CopilotC-Nvim/CopilotChat.nvim', + dependencies = { + { 'github/copilot.vim' }, -- or zbirenbaum/copilot.lua + { 'nvim-lua/plenary.nvim', branch = 'master' }, -- for curl, log and async functions + }, + build = 'make tiktoken', -- Only on MacOS or Linux + opts = { + -- See Configuration section for options + prompts = { + WriteAtomic = { + system_prompt = 'You are a seasoned and experienced Editor. You job is to assist a budding writer and researcher with writing at a higher level.', + prompt = 'Please review the following Atomic Note. I want you to analyse it and provide me with feedback. Do not rewrite it. I want to keep my tone and style of writing. I just want to know where I can improve the quality of my writing. A bonus would be to identify any potential biases or gaps in the content which I can focus on adding or improving. But most important is to identify any deficiencies and strengths in the writing. Use the buffer for context: #buffer', + mapping = 'apwa', + description = 'Copilot: Write Atomic Note', + }, + -- You can add more prompts here + }, + }, + config = function(_, opts) + require('CopilotChat').setup(opts) + vim.api.nvim_set_keymap('n', 'ac', ':CopilotChat', { noremap = true, silent = true }) + end, + -- See Commands section for default commands if you want to lazy load on them + }, +} diff --git a/lua/custom/plugins/diffview.lua b/lua/custom/plugins/diffview.lua new file mode 100644 index 00000000000..c5b250ae9cc --- /dev/null +++ b/lua/custom/plugins/diffview.lua @@ -0,0 +1,23 @@ +return { + -- Git diff viewer + { + 'sindrets/diffview.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + require('diffview').setup { + enhanced_diff_hl = true, -- Highlight word differences within lines + view = { + default = { + layout = 'diff2_horizontal', -- Options: diff2_horizontal, diff2_vertical, diff3_horizontal, diff3_vertical + }, + }, + file_panel = { + win_config = { + position = 'left', -- Can be "left", "right", "top", "bottom" + width = 35, + }, + }, + } + end, + }, +} diff --git a/lua/custom/plugins/flutter-tools.lua b/lua/custom/plugins/flutter-tools.lua new file mode 100644 index 00000000000..c224327b18a --- /dev/null +++ b/lua/custom/plugins/flutter-tools.lua @@ -0,0 +1,9 @@ +return { + 'nvim-flutter/flutter-tools.nvim', + lazy = false, + dependencies = { + 'nvim-lua/plenary.nvim', + 'stevearc/dressing.nvim', -- optional for vim.ui.select + }, + config = true, +} diff --git a/lua/custom/plugins/golf.lua b/lua/custom/plugins/golf.lua new file mode 100644 index 00000000000..b21cf44fea2 --- /dev/null +++ b/lua/custom/plugins/golf.lua @@ -0,0 +1,3 @@ +return { + { 'vuciv/golf' }, +} diff --git a/lua/custom/plugins/neotest.lua b/lua/custom/plugins/neotest.lua new file mode 100644 index 00000000000..04b3e0ab7ef --- /dev/null +++ b/lua/custom/plugins/neotest.lua @@ -0,0 +1,16 @@ +return { + 'nvim-neotest/neotest', + dependencies = { + 'nvim-neotest/nvim-nio', + 'nvim-lua/plenary.nvim', + 'antoinemadec/FixCursorHold.nvim', + 'nvim-treesitter/nvim-treesitter', + }, + config = function() + require('neotest').setup { + adapters = { + require 'rustaceanvim.neotest', + }, + } + end, +} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua new file mode 100644 index 00000000000..5d3e61c7535 --- /dev/null +++ b/lua/custom/plugins/noice.lua @@ -0,0 +1,35 @@ +return { + 'folke/noice.nvim', + event = 'VeryLazy', + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + 'MunifTanjim/nui.nvim', + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + 'rcarriga/nvim-notify', + }, + config = function(_, opts) + require('noice').setup { + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ['vim.lsp.util.convert_input_to_markdown_lines'] = true, + ['vim.lsp.util.stylize_markdown'] = true, + ['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + } + end, +} diff --git a/lua/custom/plugins/note2cal.lua b/lua/custom/plugins/note2cal.lua new file mode 100644 index 00000000000..450715d5834 --- /dev/null +++ b/lua/custom/plugins/note2cal.lua @@ -0,0 +1,18 @@ +return { + 'lfilho/note2cal.nvim', + config = function() + require('note2cal').setup { + debug = false, -- if true, prints a debug message an return early (won't schedule events) + calendar_name = 'Calendar', -- the name of the calendar as it appear on Calendar.app + highlights = { + at_symbol = 'WarningMsg', -- the highlight group for the "@" symbol + at_text = 'Number', -- the highlight group for the date-time part + }, + keymaps = { + normal = 'se', -- mnemonic: Schedule Event + visual = 'se', -- mnemonic: Schedule Event + }, + } + end, + ft = 'markdown', +} diff --git a/lua/custom/plugins/nvim_bacon.lua b/lua/custom/plugins/nvim_bacon.lua new file mode 100644 index 00000000000..df4cc955fd6 --- /dev/null +++ b/lua/custom/plugins/nvim_bacon.lua @@ -0,0 +1,14 @@ +return { + -- other plugins + { + 'Canop/nvim-bacon', + config = function() + require('bacon').setup { + quickfix = { + enabled = true, -- Enable Quickfix integration + event_trigger = true, -- Trigger QuickFixCmdPost after populating Quickfix list + }, + } + end, + }, +} diff --git a/lua/custom/plugins/obsidian.lua b/lua/custom/plugins/obsidian.lua new file mode 100644 index 00000000000..6ee5642d0a4 --- /dev/null +++ b/lua/custom/plugins/obsidian.lua @@ -0,0 +1,32 @@ +return { + 'obsidian-nvim/obsidian.nvim', + version = '*', -- recommended, use latest release instead of latest commit + 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 = 'nts', + path = '~/nts', + }, + }, + + checkbox = { + order = { ' ', 'x', '~', '!', '>' }, + }, + }, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000000..c78356e4790 --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,18 @@ +vim.keymap.set('n', '-', 'Oil', { desc = 'Open Oil file explorer' }) + +return { + 'stevearc/oil.nvim', + ---@module 'oil' + ---@type oil.SetupOpts + opts = { + view_options = { + -- Show hidden files + show_hidden = true, + }, + }, + -- Optional dependencies + dependencies = { { 'echasnovski/mini.icons', opts = {} } }, + -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons + -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. + lazy = false, +} diff --git a/lua/custom/plugins/pencil.lua b/lua/custom/plugins/pencil.lua new file mode 100644 index 00000000000..b4aecdb7575 --- /dev/null +++ b/lua/custom/plugins/pencil.lua @@ -0,0 +1,7 @@ +return { + 'preservim/vim-pencil', + init = function() + vim.g['pencil#wrapModeDefault'] = 'soft' + vim.g['pencil#conceallevel'] = 2 + end, +} diff --git a/lua/custom/plugins/pomo.lua b/lua/custom/plugins/pomo.lua new file mode 100644 index 00000000000..553bd96d913 --- /dev/null +++ b/lua/custom/plugins/pomo.lua @@ -0,0 +1,29 @@ +return { + 'epwalsh/pomo.nvim', + version = '*', -- Recommended, use latest release instead of latest commit + lazy = true, + cmd = { 'TimerStart', 'TimerRepeat', 'TimerSession' }, + dependencies = { + -- Optional, but highly recommended if you want to use the "Default" timer + 'rcarriga/nvim-notify', + }, + opts = { + -- See below for full list of options 👇 + sessions = { + norm = { + { name = 'Work', duration = '24m30s' }, + { name = 'Status', duration = '30s' }, + { name = 'Short Break', duration = '5m' }, + { name = 'Work', duration = '24m30s' }, + { name = 'Status', duration = '30s' }, + { name = 'Short Break', duration = '5m' }, + { name = 'Work', duration = '24m30s' }, + { name = 'Status', duration = '30s' }, + { name = 'Short Break', duration = '5m' }, + { name = 'Work', duration = '24m30s' }, + { name = 'Status', duration = '30s' }, + { name = 'Long Break', duration = '15m' }, + }, + }, + }, +} diff --git a/lua/custom/plugins/quickscope.lua b/lua/custom/plugins/quickscope.lua new file mode 100644 index 00000000000..d8fabaa704e --- /dev/null +++ b/lua/custom/plugins/quickscope.lua @@ -0,0 +1,10 @@ +return { + 'unblevable/quick-scope', + event = { 'VimEnter' }, -- Load plugin on VimEnter event + config = function() + -- Enable QuickScope highlighting + vim.cmd [[ + let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] + ]] + end, +} diff --git a/lua/custom/plugins/rustaceanvim.lua b/lua/custom/plugins/rustaceanvim.lua new file mode 100644 index 00000000000..96b79eaaa70 --- /dev/null +++ b/lua/custom/plugins/rustaceanvim.lua @@ -0,0 +1,43 @@ +return { + 'mrcjkb/rustaceanvim', + version = '^6', -- Recommended + lazy = false, -- This plugin is already lazy + dependencies = { 'nvim-neotest/neotest' }, + config = function() + vim.g.rustaceanvim = { + server = { + settings = { + ['rust-analyzer'] = { + check = { + command = 'clippy', + extra_args = { + '--', + '-W', + 'clippy::pedantic', + '-W', + 'clippy::unwrap_used', + '-W', + 'clippy::expect_used', + '-W', + 'clippy::panic', + '-W', + 'clippy::exit', + '-W', + 'clippy::todo', + '-W', + 'clippy::unimplemented', + '-W', + 'clippy::dbg_macro', + '-A', + 'clippy::module_name_repetitions', + }, + }, + rustfmt = { + extraArgs = { '+nightly' }, + }, + }, + }, + }, + } + end, +} diff --git a/lua/custom/plugins/smear_cursor.lua b/lua/custom/plugins/smear_cursor.lua new file mode 100644 index 00000000000..43393203783 --- /dev/null +++ b/lua/custom/plugins/smear_cursor.lua @@ -0,0 +1,4 @@ +return { + 'sphamba/smear-cursor.nvim', + opts = {}, +} diff --git a/lua/custom/plugins/snacks.lua b/lua/custom/plugins/snacks.lua new file mode 100644 index 00000000000..bc0afd5da6f --- /dev/null +++ b/lua/custom/plugins/snacks.lua @@ -0,0 +1,546 @@ +return { + 'folke/snacks.nvim', + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + toggle = { enabled = true }, + dim = { enabled = true }, + lazygit = { enabled = true }, + bigfile = { enabled = true }, + dashboard = { enabled = true }, + explorer = { enabled = true }, + indent = { enabled = true }, + input = { enabled = true }, + notifier = { + enabled = true, + timeout = 3000, + }, + picker = { enabled = true }, + quickfile = { enabled = true }, + scope = { enabled = true }, + scroll = { enabled = true }, + statuscolumn = { enabled = true }, + words = { enabled = true }, + styles = { + notification = { + -- wo = { wrap = true } -- Wrap notifications + }, + }, + }, + keys = { + -- Top Pickers & Explorer + { + '', + function() + Snacks.picker.smart() + end, + desc = 'Smart Find Files', + }, + { + ',', + function() + Snacks.picker.buffers() + end, + desc = 'Buffers', + }, + { + '/', + function() + Snacks.picker.grep() + end, + desc = 'Grep', + }, + { + ':', + function() + Snacks.picker.command_history() + end, + desc = 'Command History', + }, + { + 'n', + function() + Snacks.picker.notifications() + end, + desc = 'Notification History', + }, + { + 'e', + function() + Snacks.explorer() + end, + desc = 'File Explorer', + }, + -- find + { + 'fb', + function() + Snacks.picker.buffers() + end, + desc = 'Buffers', + }, + { + 'fc', + function() + Snacks.picker.files { cwd = vim.fn.stdpath 'config' } + end, + desc = 'Find Config File', + }, + { + 'ff', + function() + Snacks.picker.files() + end, + desc = 'Find Files', + }, + { + 'fg', + function() + Snacks.picker.git_files() + end, + desc = 'Find Git Files', + }, + { + 'fp', + function() + Snacks.picker.projects() + end, + desc = 'Projects', + }, + { + 'fr', + function() + Snacks.picker.recent() + end, + desc = 'Recent', + }, + -- git + { + 'gb', + function() + Snacks.picker.git_branches() + end, + desc = 'Git Branches', + }, + { + 'gl', + function() + Snacks.picker.git_log() + end, + desc = 'Git Log', + }, + { + 'gL', + function() + Snacks.picker.git_log_line() + end, + desc = 'Git Log Line', + }, + { + 'gs', + function() + Snacks.picker.git_status() + end, + desc = 'Git Status', + }, + { + 'gS', + function() + Snacks.picker.git_stash() + end, + desc = 'Git Stash', + }, + { + 'gd', + function() + Snacks.picker.git_diff() + end, + desc = 'Git Diff (Hunks)', + }, + { + 'gf', + function() + Snacks.picker.git_log_file() + end, + desc = 'Git Log File', + }, + -- Grep + { + 'sb', + function() + Snacks.picker.lines() + end, + desc = 'Buffer Lines', + }, + { + 'sB', + function() + Snacks.picker.grep_buffers() + end, + desc = 'Grep Open Buffers', + }, + { + 'sg', + function() + Snacks.picker.grep() + end, + desc = 'Grep', + }, + { + 'sw', + function() + Snacks.picker.grep_word() + end, + desc = 'Visual selection or word', + mode = { 'n', 'x' }, + }, + -- search + { + 's"', + function() + Snacks.picker.registers() + end, + desc = 'Registers', + }, + { + 's/', + function() + Snacks.picker.search_history() + end, + desc = 'Search History', + }, + { + 'sa', + function() + Snacks.picker.autocmds() + end, + desc = 'Autocmds', + }, + { + 'sb', + function() + Snacks.picker.lines() + end, + desc = 'Buffer Lines', + }, + { + 'sc', + function() + Snacks.picker.command_history() + end, + desc = 'Command History', + }, + { + 'sC', + function() + Snacks.picker.commands() + end, + desc = 'Commands', + }, + { + 'sd', + function() + Snacks.picker.diagnostics() + end, + desc = 'Diagnostics', + }, + { + 'sD', + function() + Snacks.picker.diagnostics_buffer() + end, + desc = 'Buffer Diagnostics', + }, + { + 'sh', + function() + Snacks.picker.help() + end, + desc = 'Help Pages', + }, + { + 'sH', + function() + Snacks.picker.highlights() + end, + desc = 'Highlights', + }, + { + 'si', + function() + Snacks.picker.icons() + end, + desc = 'Icons', + }, + { + 'sj', + function() + Snacks.picker.jumps() + end, + desc = 'Jumps', + }, + { + 'sk', + function() + Snacks.picker.keymaps() + end, + desc = 'Keymaps', + }, + { + 'sl', + function() + Snacks.picker.loclist() + end, + desc = 'Location List', + }, + { + 'sm', + function() + Snacks.picker.marks() + end, + desc = 'Marks', + }, + { + 'sM', + function() + Snacks.picker.man() + end, + desc = 'Man Pages', + }, + { + 'sp', + function() + Snacks.picker.lazy() + end, + desc = 'Search for Plugin Spec', + }, + { + 'sq', + function() + Snacks.picker.qflist() + end, + desc = 'Quickfix List', + }, + { + 'sR', + function() + Snacks.picker.resume() + end, + desc = 'Resume', + }, + { + 'su', + function() + Snacks.picker.undo() + end, + desc = 'Undo History', + }, + { + 'uC', + function() + Snacks.picker.colorschemes() + end, + desc = 'Colorschemes', + }, + -- LSP + { + 'gd', + function() + Snacks.picker.lsp_definitions() + end, + desc = 'Goto Definition', + }, + { + 'gD', + function() + Snacks.picker.lsp_declarations() + end, + desc = 'Goto Declaration', + }, + { + 'gr', + function() + Snacks.picker.lsp_references() + end, + nowait = true, + desc = 'References', + }, + { + 'gI', + function() + Snacks.picker.lsp_implementations() + end, + desc = 'Goto Implementation', + }, + { + 'gy', + function() + Snacks.picker.lsp_type_definitions() + end, + desc = 'Goto T[y]pe Definition', + }, + { + 'ss', + function() + Snacks.picker.lsp_symbols() + end, + desc = 'LSP Symbols', + }, + { + 'sS', + function() + Snacks.picker.lsp_workspace_symbols() + end, + desc = 'LSP Workspace Symbols', + }, + -- Other + { + 'z', + function() + Snacks.zen() + end, + desc = 'Toggle Zen Mode', + }, + { + 'Z', + function() + Snacks.zen.zoom() + end, + desc = 'Toggle Zoom', + }, + { + '.', + function() + Snacks.scratch() + end, + desc = 'Toggle Scratch Buffer', + }, + { + 'S', + function() + Snacks.scratch.select() + end, + desc = 'Select Scratch Buffer', + }, + { + 'n', + function() + Snacks.notifier.show_history() + end, + desc = 'Notification History', + }, + { + 'bd', + function() + Snacks.bufdelete() + end, + desc = 'Delete Buffer', + }, + { + 'cR', + function() + Snacks.rename.rename_file() + end, + desc = 'Rename File', + }, + { + 'gB', + function() + Snacks.gitbrowse() + end, + desc = 'Git Browse', + mode = { 'n', 'v' }, + }, + { + 'gg', + function() + Snacks.lazygit() + end, + desc = 'Lazygit', + }, + { + 'un', + function() + Snacks.notifier.hide() + end, + desc = 'Dismiss All Notifications', + }, + { + '', + function() + Snacks.terminal() + end, + desc = 'Toggle Terminal', + }, + { + '', + function() + Snacks.terminal() + end, + desc = 'which_key_ignore', + }, + { + ']]', + function() + Snacks.words.jump(vim.v.count1) + end, + desc = 'Next Reference', + mode = { 'n', 't' }, + }, + { + '[[', + function() + Snacks.words.jump(-vim.v.count1) + end, + desc = 'Prev Reference', + mode = { 'n', 't' }, + }, + { + 'N', + desc = 'Neovim News', + function() + Snacks.win { + file = vim.api.nvim_get_runtime_file('doc/news.txt', false)[1], + width = 0.6, + height = 0.6, + wo = { + spell = false, + wrap = false, + signcolumn = 'yes', + statuscolumn = ' ', + conceallevel = 3, + }, + } + end, + }, + }, + init = function() + vim.api.nvim_create_autocmd('User', { + pattern = 'VeryLazy', + callback = function() + -- Setup some globals for debugging (lazy-loaded) + _G.dd = function(...) + Snacks.debug.inspect(...) + end + _G.bt = function() + Snacks.debug.backtrace() + end + vim.print = _G.dd -- Override print to use snacks for `:=` command + + -- Create some toggle mappings + Snacks.toggle.option('spell', { name = 'Spelling' }):map 'us' + Snacks.toggle.option('wrap', { name = 'Wrap' }):map 'uw' + Snacks.toggle.option('relativenumber', { name = 'Relative Number' }):map 'uL' + Snacks.toggle.diagnostics():map 'ud' + Snacks.toggle.line_number():map 'ul' + Snacks.toggle.option('conceallevel', { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map 'uc' + Snacks.toggle.treesitter():map 'uT' + Snacks.toggle.option('background', { off = 'light', on = 'dark', name = 'Dark Background' }):map 'ub' + Snacks.toggle.inlay_hints():map 'uh' + Snacks.toggle.indent():map 'ug' + Snacks.toggle.dim():map 'uD' + end, + }) + end, +} diff --git a/lua/custom/plugins/telescope-frecency.lua b/lua/custom/plugins/telescope-frecency.lua new file mode 100644 index 00000000000..3db84c9b956 --- /dev/null +++ b/lua/custom/plugins/telescope-frecency.lua @@ -0,0 +1,8 @@ +return { + 'nvim-telescope/telescope-frecency.nvim', + -- install the latest stable version + version = '*', + config = function() + require('telescope').load_extension 'frecency' + end, +} diff --git a/lua/custom/plugins/tiny-glimmer.lua b/lua/custom/plugins/tiny-glimmer.lua new file mode 100644 index 00000000000..4d3c02e3b75 --- /dev/null +++ b/lua/custom/plugins/tiny-glimmer.lua @@ -0,0 +1,139 @@ +return { + 'rachartier/tiny-glimmer.nvim', + event = 'VeryLazy', + priority = 10, + opts = { + enabled = true, + disable_warnings = true, + refresh_interval_ms = 8, + overwrite = { + auto_map = true, + yank = { + enabled = true, + default_animation = 'fade', + }, + search = { + enabled = false, + default_animation = 'pulse', + next_mapping = 'n', + prev_mapping = 'N', + }, + paste = { + enabled = true, + default_animation = 'reverse_fade', + paste_mapping = 'p', + Paste_mapping = 'P', + }, + undo = { + enabled = false, + default_animation = { + name = 'fade', + settings = { + from_color = 'DiffDelete', + max_duration = 500, + min_duration = 500, + }, + }, + undo_mapping = 'u', + }, + redo = { + enabled = false, + default_animation = { + name = 'fade', + settings = { + from_color = 'DiffAdd', + max_duration = 500, + min_duration = 500, + }, + }, + redo_mapping = '', + }, + }, + support = { + substitute = { + enabled = false, + default_animation = 'fade', + }, + }, + presets = { + pulsar = { + enabled = false, + on_events = { 'CursorMoved', 'CmdlineEnter', 'WinEnter' }, + default_animation = { + name = 'fade', + settings = { + max_duration = 1000, + min_duration = 1000, + from_color = 'DiffDelete', + to_color = 'Normal', + }, + }, + }, + }, + transparency_color = nil, + animations = { + fade = { + max_duration = 400, + min_duration = 300, + easing = 'outQuad', + chars_for_max_duration = 10, + from_color = 'Visual', + to_color = 'Normal', + }, + reverse_fade = { + max_duration = 380, + min_duration = 300, + easing = 'outBack', + chars_for_max_duration = 10, + from_color = 'Visual', + to_color = 'Normal', + }, + bounce = { + max_duration = 500, + min_duration = 400, + chars_for_max_duration = 20, + oscillation_count = 1, + from_color = 'Visual', + to_color = 'Normal', + }, + left_to_right = { + max_duration = 350, + min_duration = 350, + min_progress = 0.85, + chars_for_max_duration = 25, + lingering_time = 50, + from_color = 'Visual', + to_color = 'Normal', + }, + pulse = { + max_duration = 600, + min_duration = 400, + chars_for_max_duration = 15, + pulse_count = 2, + intensity = 1.2, + from_color = 'Visual', + to_color = 'Normal', + }, + rainbow = { + max_duration = 600, + min_duration = 350, + chars_for_max_duration = 20, + }, + custom = { + max_duration = 350, + chars_for_max_duration = 40, + color = 'Visual', -- You can replace this with a highlight group or hex + effect = function(self, progress) + return self.settings.color, progress + end, + }, + hijack_ft_disabled = { + 'alpha', + 'snacks_dashboard', + }, + }, + virt_text = { + priority = 2048, + }, + }, +} diff --git a/lua/custom/plugins/tokyonight.lua b/lua/custom/plugins/tokyonight.lua new file mode 100644 index 00000000000..25fd1a83f7c --- /dev/null +++ b/lua/custom/plugins/tokyonight.lua @@ -0,0 +1,6 @@ +return { + 'folke/tokyonight.nvim', + lazy = false, + priority = 1000, + opts = {}, +} diff --git a/lua/custom/plugins/tranparent.lua b/lua/custom/plugins/tranparent.lua new file mode 100644 index 00000000000..b8d4a84552e --- /dev/null +++ b/lua/custom/plugins/tranparent.lua @@ -0,0 +1,5 @@ +return { + 'tribela/transparent.nvim', + event = 'VimEnter', + config = true, +} diff --git a/lua/custom/plugins/trouble.lua b/lua/custom/plugins/trouble.lua new file mode 100644 index 00000000000..9561d5a4d87 --- /dev/null +++ b/lua/custom/plugins/trouble.lua @@ -0,0 +1,47 @@ +return { + 'folke/trouble.nvim', + opts = {}, -- for default options, refer to the configuration section for custom setup. + cmd = 'Trouble', + keys = { + { + 'xd', + 'Trouble diagnostics toggle', + desc = 'Diagnostics (Trouble)', + }, + { + 'xl', + function() + require('trouble').toggle { + mode = 'diagnostics', + win = { position = 'right', type = 'split', size = 75 }, + } + end, + desc = 'Toggle Trouble diagnostics sidebar', + }, + { + 'xX', + 'Trouble diagnostics toggle filter.buf=0', + desc = 'Buffer Diagnostics (Trouble)', + }, + { + 'cs', + 'Trouble symbols toggle focus=false', + desc = 'Symbols (Trouble)', + }, + { + 'cl', + 'Trouble lsp toggle focus=false win.position=right', + desc = 'LSP Definitions / references / ... (Trouble)', + }, + { + 'xL', + 'Trouble loclist toggle', + desc = 'Location List (Trouble)', + }, + { + 'xQ', + 'Trouble qflist toggle', + desc = 'Quickfix List (Trouble)', + }, + }, +} diff --git a/lua/custom/plugins/typr.lua b/lua/custom/plugins/typr.lua new file mode 100644 index 00000000000..c887b92bb0c --- /dev/null +++ b/lua/custom/plugins/typr.lua @@ -0,0 +1,6 @@ +return { + 'nvzone/typr', + dependencies = 'nvzone/volt', + opts = {}, + cmd = { 'Typr', 'TyprStats' }, +} diff --git a/lua/custom/plugins/unimpaired.lua b/lua/custom/plugins/unimpaired.lua new file mode 100644 index 00000000000..3a92f151acc --- /dev/null +++ b/lua/custom/plugins/unimpaired.lua @@ -0,0 +1,7 @@ +return { + 'tummetott/unimpaired.nvim', + event = 'VeryLazy', + opts = { + -- add options here if you wish to override the default settings + }, +} diff --git a/lua/custom/plugins/wezterm-move.lua b/lua/custom/plugins/wezterm-move.lua new file mode 100644 index 00000000000..a7751282ad2 --- /dev/null +++ b/lua/custom/plugins/wezterm-move.lua @@ -0,0 +1,29 @@ +return { + 'letieu/wezterm-move.nvim', + keys = { -- Lazy loading, don't need call setup() function + { + '', + function() + require('wezterm-move').move 'h' + end, + }, + { + '', + function() + require('wezterm-move').move 'j' + end, + }, + { + '', + function() + require('wezterm-move').move 'k' + end, + }, + { + '', + function() + require('wezterm-move').move 'l' + end, + }, + }, +} diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua index 87a7e5ffa2e..386d392e7ad 100644 --- a/lua/kickstart/plugins/autopairs.lua +++ b/lua/kickstart/plugins/autopairs.lua @@ -4,13 +4,5 @@ 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, + opts = {}, } diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index c269bc06e15..cbbd22d24fc 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -44,7 +44,7 @@ return { map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) @@ -54,7 +54,7 @@ return { end, { desc = 'git [D]iff against last commit' }) -- Toggles map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', 'tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' }) + map('n', 'tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) 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 = {}, - }, -}