diff --git a/init.lua b/init.lua index 4305b29c..10f45b5f 100644 --- a/init.lua +++ b/init.lua @@ -57,191 +57,12 @@ if not vim.loop.fs_stat(lazypath) then end vim.opt.rtp:prepend(lazypath) --- NOTE: Here is where you install your plugins. --- You can configure plugins using the `config` key. --- --- You can also configure plugins after the setup call, --- as they will be available in your neovim runtime. -require('lazy').setup({ - -- NOTE: First, some plugins that don't require any configuration - - -- Git related plugins - 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', - - -- Detect tabstop and shiftwidth automatically - 'tpope/vim-sleuth', - - -- NOTE: This is where your plugins related to LSP can be installed. - -- The configuration is done below. Search for lspconfig to find it below. - { - -- LSP Configuration & Plugins - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs to stdpath for neovim - { 'williamboman/mason.nvim', config = true }, - 'williamboman/mason-lspconfig.nvim', - - -- Useful status updates for LSP - -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { 'j-hui/fidget.nvim', opts = {} }, - - -- Additional lua configuration, makes nvim stuff amazing! - 'folke/neodev.nvim', - }, - }, - - { - -- Autocompletion - 'hrsh7th/nvim-cmp', - dependencies = { - -- Snippet Engine & its associated nvim-cmp source - 'L3MON4D3/LuaSnip', - 'saadparwaiz1/cmp_luasnip', - - -- Adds LSP completion capabilities - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - - -- Adds a number of user-friendly snippets - 'rafamadriz/friendly-snippets', - }, - }, - - -- Useful plugin to show you pending keybinds. - { 'folke/which-key.nvim', opts = {} }, - { - -- Adds git releated signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - -- See `:help gitsigns.txt` - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - }, - }, - - { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', - priority = 1000, - config = function() - vim.cmd.colorscheme 'onedark' - end, - }, - - { - -- Set lualine as statusline - 'nvim-lualine/lualine.nvim', - -- See `:help lualine.txt` - opts = { - options = { - icons_enabled = false, - theme = 'onedark', - component_separators = '|', - section_separators = '', - }, - }, - }, - - { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }, - -- "gc" to comment visual regions/lines - { 'numToStr/Comment.nvim', opts = {} }, - - -- Fuzzy Finder (files, lsp, etc) - { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, - - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. - { - 'nvim-telescope/telescope-fzf-native.nvim', - -- NOTE: If you are having trouble with this installation, - -- refer to the README for telescope-fzf-native for more instructions. - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - - { - -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', - }, - build = ":TSUpdate", - }, - - -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart - -- These are some example plugins that I've included in the kickstart repository. - -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', - -- require 'kickstart.plugins.debug', - - -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` - -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping - -- up-to-date with whatever is in the kickstart repo. - -- - -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins - -- - -- An additional note is that if you only copied in the `init.lua`, you can just comment this line - -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. - { 'towolf/vim-helm' }, - { 'nvim-tree/nvim-tree.lua' }, - { 'nvim-tree/nvim-web-devicons' }, - - { 'neovim/nvim-lspconfig' }, - { 'jose-elias-alvarez/null-ls.nvim' }, - { 'MunifTanjim/prettier.nvim' }, - { 'f-person/git-blame.nvim' }, - { - 'ldelossa/gh.nvim', - dependencies = { - 'ldelossa/litee.nvim' } - }, - { 'tpope/vim-abolish' }, - { - "kdheepak/lazygit.nvim", - -- optional for floating window border decoration - dependencies = { - "nvim-lua/plenary.nvim", - }, - }, - { "almo7aya/openingh.nvim" }, - { - "epwalsh/obsidian.nvim", - version = "*", -- recommended, use latest release instead of latest commit - 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" - -- "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/Projects/notes", - }, - }, - } - }, - - { import = 'custom.plugins' }, -}, {}) +require('custom.plugins') +require('custom.key_maps') +require('custom.autocmd') +require('custom.leader_shortcuts') +require('custom.treesitter') +require('custom.which_key') -- [[ Setting options ]] -- See `:help vim.o` @@ -284,16 +105,6 @@ vim.o.completeopt = 'menuone,noselect' -- NOTE: You should make sure your terminal supports this vim.o.termguicolors = true --- [[ Basic Keymaps ]] - --- Keymaps for better default experience --- See `:help vim.keymap.set()` -vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) - --- Remap for dealing with word wrap -vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) -vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) - --- Autocommands -- [[ Highlight on yank ]] @@ -325,111 +136,13 @@ pcall(require('telescope').load_extension, 'fzf') require("telescope").setup { pickers = { live_grep = { - additional_args = function(opts) + additional_args = function(_) return { "--hidden" } end }, }, } --- See `:help telescope.builtin` -vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) -vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) -vim.keymap.set('n', '/', function() - -- You can pass additional configuration to telescope to change theme, layout, etc. - require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) -end, { desc = '[/] Fuzzily search in current buffer' }) - -vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) -vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) -vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) -vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) -vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) - --- [[ Configure NvimTree ]] -require("nvim-tree").setup() -vim.keymap.set('n', 'e', ":NvimTreeToggle", { desc = 'Toggle NvimTree' }) -vim.keymap.set('n', 'ef', ':NvimTreeFindFile', { desc = 'Find file' }) -vim.keymap.set('n', '', '') -vim.keymap.set('n', '', '') -vim.keymap.set('n', '', '') -vim.keymap.set('n', '', '') - --- [[ Configure Treesitter ]] --- See `:help nvim-treesitter` -require('nvim-treesitter.configs').setup { - -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim', 'terraform' }, - - -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, - - highlight = { enable = true }, - indent = { enable = true, disable = { 'python' } }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - scope_incremental = '', - node_decremental = '', - }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['aa'] = '@parameter.outer', - ['ia'] = '@parameter.inner', - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']]'] = '@class.outer', - }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', - }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[['] = '@class.outer', - }, - goto_previousqend = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', - }, - }, - swap = { - enable = true, - swap_next = { - ['a'] = '@parameter.inner', - }, - swap_previous = { - ['A'] = '@parameter.inner', - }, - }, - }, -} - --- Diagnostic keymaps -vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) -vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) -vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) - -- LSP settings. -- This function gets run when an LSP connects to a particular buffer. local on_attach = function(_, bufnr) @@ -532,40 +245,6 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, { pattern = { "*.tf", "*.tfvars" }, }) --- Configure nullls -local null_ls = require("null-ls") - -local group = vim.api.nvim_create_augroup("lsp_format_on_save", { clear = false }) -local event = "BufWritePre" -- or "BufWritePost" -local async = event == "BufWritePost" - -null_ls.setup({ - on_attach = function(client, bufnr) - if client.supports_method("textDocument/formatting") then - vim.keymap.set("n", "f", function() - vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() }) - end, { buffer = bufnr, desc = "[lsp] format" }) - - -- format on save - vim.api.nvim_clear_autocmds({ buffer = bufnr, group = group }) - vim.api.nvim_create_autocmd(event, { - buffer = bufnr, - group = group, - callback = function() - vim.lsp.buf.format({ bufnr = bufnr, async = async }) - end, - desc = "[lsp] format on save", - }) - end - - if client.supports_method("textDocument/rangeFormatting") then - vim.keymap.set("x", "f", function() - vim.lsp.buf.format({ bufnr = vim.api.nvim_get_current_buf() }) - end, { buffer = bufnr, desc = "[lsp] format" }) - end - end, -}) - -- Configure prettier local prettier = require("prettier") @@ -679,58 +358,6 @@ require('litee.gh').setup({ } }) -local wk = require("which-key") -wk.register({ - g = { - name = "+Git", - h = { - name = "+Github", - c = { - name = "+Commits", - c = { "GHCloseCommit", "Close" }, - e = { "GHExpandCommit", "Expand" }, - o = { "GHOpenToCommit", "Open To" }, - p = { "GHPopOutCommit", "Pop Out" }, - z = { "GHCollapseCommit", "Collapse" }, - }, - i = { - name = "+Issues", - p = { "GHPreviewIssue", "Preview" }, - }, - l = { - name = "+Litee", - t = { "LTPanel", "Toggle Panel" }, - }, - r = { - name = "+Review", - b = { "GHStartReview", "Begin" }, - c = { "GHCloseReview", "Close" }, - d = { "GHDeleteReview", "Delete" }, - e = { "GHExpandReview", "Expand" }, - s = { "GHSubmitReview", "Submit" }, - z = { "GHCollapseReview", "Collapse" }, - }, - p = { - name = "+Pull Request", - c = { "GHClosePR", "Close" }, - d = { "GHPRDetails", "Details" }, - e = { "GHExpandPR", "Expand" }, - o = { "GHOpenPR", "Open" }, - p = { "GHPopOutPR", "PopOut" }, - r = { "GHRefreshPR", "Refresh" }, - t = { "GHOpenToPR", "Open To" }, - z = { "GHCollapsePR", "Collapse" }, - }, - t = { - name = "+Threads", - c = { "GHCreateThread", "Create" }, - n = { "GHNextThread", "Next" }, - t = { "GHToggleThread", "Toggle" }, - }, - }, - }, -}, { prefix = "" }) - local configs = require('lspconfig.configs') local lspconfig = require('lspconfig') local util = require('lspconfig.util') diff --git a/lua/custom/autocmd.lua b/lua/custom/autocmd.lua new file mode 100644 index 00000000..e69de29b diff --git a/lua/custom/plugins/init.lua b/lua/custom/init.lua similarity index 100% rename from lua/custom/plugins/init.lua rename to lua/custom/init.lua diff --git a/lua/custom/key_maps.lua b/lua/custom/key_maps.lua new file mode 100644 index 00000000..3ccd099a --- /dev/null +++ b/lua/custom/key_maps.lua @@ -0,0 +1,9 @@ +-- [[ Basic Keymaps ]] + +-- Keymaps for better default experience +-- See `:help vim.keymap.set()` +vim.keymap.set({ 'n', 'v' }, '', '', { silent = true }) + +-- Remap for dealing with word wrap +vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) +vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) diff --git a/lua/custom/leader_shortcuts.lua b/lua/custom/leader_shortcuts.lua new file mode 100644 index 00000000..e70fff34 --- /dev/null +++ b/lua/custom/leader_shortcuts.lua @@ -0,0 +1,25 @@ +-- See `:help telescope.builtin` +vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) +vim.keymap.set('n', '', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) +end, { desc = '[/] Fuzzily search in current buffer' }) + +vim.keymap.set('n', 'sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', 'sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) +vim.keymap.set('n', 'sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) +vim.keymap.set('n', 'sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) +vim.keymap.set('n', 'sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) + +-- [[ Configure NvimTree ]] +require("nvim-tree").setup() +vim.keymap.set('n', 'e', ":NvimTreeToggle", { desc = 'Toggle NvimTree' }) +vim.keymap.set('n', 'ef', ':NvimTreeFindFile', { desc = 'Find file' }) +vim.keymap.set('n', '', '') +vim.keymap.set('n', '', '') +vim.keymap.set('n', '', '') +vim.keymap.set('n', '', '') diff --git a/lua/custom/plugins.lua b/lua/custom/plugins.lua new file mode 100644 index 00000000..8064ab24 --- /dev/null +++ b/lua/custom/plugins.lua @@ -0,0 +1,182 @@ +-- NOTE: Here is where you install your plugins. +-- You can configure plugins using the `config` key. +-- +-- You can also configure plugins after the setup call, +-- as they will be available in your neovim runtime. +require('lazy').setup({ + -- NOTE: First, some plugins that don't require any configuration + + -- Git related plugins + 'tpope/vim-fugitive', + 'tpope/vim-rhubarb', + + -- Detect tabstop and shiftwidth automatically + 'tpope/vim-sleuth', + + -- NOTE: This is where your plugins related to LSP can be installed. + -- The configuration is done below. Search for lspconfig to find it below. + { + -- LSP Configuration & Plugins + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs to stdpath for neovim + { 'williamboman/mason.nvim', config = true }, + 'williamboman/mason-lspconfig.nvim', + + -- Useful status updates for LSP + -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` + { 'j-hui/fidget.nvim', opts = {} }, + + -- Additional lua configuration, makes nvim stuff amazing! + 'folke/neodev.nvim', + }, + }, + + { + -- Autocompletion + 'hrsh7th/nvim-cmp', + dependencies = { + -- Snippet Engine & its associated nvim-cmp source + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + + -- Adds LSP completion capabilities + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + + -- Adds a number of user-friendly snippets + 'rafamadriz/friendly-snippets', + }, + }, + + -- Useful plugin to show you pending keybinds. + { 'folke/which-key.nvim', opts = {} }, + { + -- Adds git releated signs to the gutter, as well as utilities for managing changes + 'lewis6991/gitsigns.nvim', + opts = { + -- See `:help gitsigns.txt` + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, + }, + + { + -- Theme inspired by Atom + 'navarasu/onedark.nvim', + priority = 1000, + config = function() + vim.cmd.colorscheme 'onedark' + end, + }, + + { + -- Set lualine as statusline + 'nvim-lualine/lualine.nvim', + -- See `:help lualine.txt` + opts = { + options = { + icons_enabled = false, + theme = 'onedark', + component_separators = '|', + section_separators = '', + }, + }, + }, + + { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} }, + -- "gc" to comment visual regions/lines + { 'numToStr/Comment.nvim', opts = {} }, + + -- Fuzzy Finder (files, lsp, etc) + { 'nvim-telescope/telescope.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim' } }, + + -- Fuzzy Finder Algorithm which requires local dependencies to be built. + -- Only load if `make` is available. Make sure you have the system + -- requirements installed. + { + 'nvim-telescope/telescope-fzf-native.nvim', + -- NOTE: If you are having trouble with this installation, + -- refer to the README for telescope-fzf-native for more instructions. + build = 'make', + cond = function() + return vim.fn.executable 'make' == 1 + end, + }, + + { + -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, + build = ":TSUpdate", + }, + + -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart + -- These are some example plugins that I've included in the kickstart repository. + -- Uncomment any of the lines below to enable them. + -- require 'kickstart.plugins.autoformat', + -- require 'kickstart.plugins.debug', + + -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` + -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping + -- up-to-date with whatever is in the kickstart repo. + -- + -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins + -- + -- An additional note is that if you only copied in the `init.lua`, you can just comment this line + -- to get rid of the warning telling you that there are not plugins in `lua/custom/plugins/`. + { 'towolf/vim-helm' }, + { 'nvim-tree/nvim-tree.lua' }, + { 'nvim-tree/nvim-web-devicons' }, + + { 'neovim/nvim-lspconfig' }, + { 'MunifTanjim/prettier.nvim' }, + { 'f-person/git-blame.nvim' }, + { + 'ldelossa/gh.nvim', + dependencies = { + 'ldelossa/litee.nvim' } + }, + { 'tpope/vim-abolish' }, + { + "kdheepak/lazygit.nvim", + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + }, + { "almo7aya/openingh.nvim" }, + { + "epwalsh/obsidian.nvim", + version = "*", -- recommended, use latest release instead of latest commit + 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" + -- "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/Projects/notes", + }, + }, + } + }, +}, {}) diff --git a/lua/custom/treesitter.lua b/lua/custom/treesitter.lua new file mode 100644 index 00000000..3eba85c6 --- /dev/null +++ b/lua/custom/treesitter.lua @@ -0,0 +1,72 @@ +-- [[ Configure Treesitter ]] +-- See `:help nvim-treesitter` +require('nvim-treesitter.configs').setup { + -- Add languages to be installed here that you want installed for treesitter + ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim', 'terraform' }, + + -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) + auto_install = false, + + highlight = { enable = true }, + indent = { enable = true, disable = { 'python' } }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previousqend = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, +} + +-- Diagnostic keymaps +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" }) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" }) +vim.keymap.set('n', 'e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" }) + diff --git a/lua/custom/which_key.lua b/lua/custom/which_key.lua new file mode 100644 index 00000000..42ea8429 --- /dev/null +++ b/lua/custom/which_key.lua @@ -0,0 +1,51 @@ +local wk = require("which-key") +wk.register({ + g = { + name = "+Git", + h = { + name = "+Github", + c = { + name = "+Commits", + c = { "GHCloseCommit", "Close" }, + e = { "GHExpandCommit", "Expand" }, + o = { "GHOpenToCommit", "Open To" }, + p = { "GHPopOutCommit", "Pop Out" }, + z = { "GHCollapseCommit", "Collapse" }, + }, + i = { + name = "+Issues", + p = { "GHPreviewIssue", "Preview" }, + }, + l = { + name = "+Litee", + t = { "LTPanel", "Toggle Panel" }, + }, + r = { + name = "+Review", + b = { "GHStartReview", "Begin" }, + c = { "GHCloseReview", "Close" }, + d = { "GHDeleteReview", "Delete" }, + e = { "GHExpandReview", "Expand" }, + s = { "GHSubmitReview", "Submit" }, + z = { "GHCollapseReview", "Collapse" }, + }, + p = { + name = "+Pull Request", + c = { "GHClosePR", "Close" }, + d = { "GHPRDetails", "Details" }, + e = { "GHExpandPR", "Expand" }, + o = { "GHOpenPR", "Open" }, + p = { "GHPopOutPR", "PopOut" }, + r = { "GHRefreshPR", "Refresh" }, + t = { "GHOpenToPR", "Open To" }, + z = { "GHCollapsePR", "Collapse" }, + }, + t = { + name = "+Threads", + c = { "GHCreateThread", "Create" }, + n = { "GHNextThread", "Next" }, + t = { "GHToggleThread", "Toggle" }, + }, + }, + }, +}, { prefix = "" })