Skip to content

Commit

Permalink
feat!: update packages and fix breaking changes from which-key v3
Browse files Browse the repository at this point in the history
  • Loading branch information
adrielp committed Oct 26, 2024
1 parent daef20b commit 1f2ce2f
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 128 deletions.
12 changes: 12 additions & 0 deletions .config/nvim/lua/core/harpoon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@ vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end)
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)

local wk = require("which-key")

wk.add({
mode = { "n" },
{"<leader>a", mark.add_file, desc = "Add file to harpoon"},
{"<C-e>", ui.toggle_quick_menu, desc = "Toggle Harpoon"},
{"<C-h>", function() ui.nav_file(1) end, desc = "Navigate to Harpoon file 1"},
{"<C-t>", function() ui.nav_file(2) end, desc = "Navigate to Harpoon file 2"},
{"<C-n>", function() ui.nav_file(3) end, desc = "Navigate to Harpoon file 3"},
{"<C-s>", function() ui.nav_file(4) end, desc = "Navigate to Harpoon file 4"},
})
15 changes: 10 additions & 5 deletions .config/nvim/lua/core/init.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
-- Initializion of core configurations

-- load mappings first
require('core.mappings')

-- lazy load plugins
require('plugins')

-- I originally had mappings loading first, for some reason. I think it was
-- important, but I can't remember why, and it doesn't appear to be an issue
-- now. If I run into issues then I'll move back.
require('core.mappings')

-- load configs dependent on plugins
-- load terraform formatter which requires plugins to be installed (plenary.nvim)
require('core.terra_fmt')
--require('core.fugitive')
require('core.settings')
require('core.lsp')
require('core.harpoon')
require('core.treesitter')
require('core.lualine')
require('core.lazygit')

-- No longer using fugitive, but I miss it.
--require('core.fugitive')
-- lazygit is currently empty of config
-- require('core.lazygit')
34 changes: 12 additions & 22 deletions .config/nvim/lua/core/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,18 @@ vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, opts)

-- vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)

-- custom registrations
local wk = require("which-key")
wk.register({
g = {
d = { vim.lsp.buf.definition, "Go to definition" },
},
K = { vim.lsp.buf.hover, "Buff Hover"},
v = {
w = {
s = { vim.lsp.buf.workspace_symbol, "Workspace Symbol" },
},
d = { vim.diagnostic.open_float, "Diagnostic Open Float"},
c = {
a = { vim.lsp.buf.code_action, "Code Action" },
},
r = {
r = { vim.lsp.buf.references, "LSP References" },
n = { vim.lsp.buf.rename, "LSP Rename" },
},
},
-- ["<C-h>"] = { vim.lsp.buf.signature_help, "Signature Help" },
}, { prefix = "<leader>" })
wk.add({
{ "<leader>K", vim.lsp.buf.hover, desc = "Buff Hover", prefix = "<leader>"},
{ "<leader>gd", vim.lsp.buf.definition, desc = "Go to definition" },
{ "<leader>vca", vim.lsp.buf.code_action, desc = "Code Action" },
{ "<leader>vd", vim.diagnostic.open_float, desc = "Diagnostic Open Float" },
{ "<leader>vrn", vim.lsp.buf.rename, desc = "LSP Rename" },
{ "<leader>vrr", vim.lsp.buf.references, desc = "LSP References" },
{ "<leader>vws", vim.lsp.buf.workspace_symbol, desc = "Workspace Symbol" },
{ "<leader><C-h>", vim.lsp.buf.signature_help, desc = "Signature Help" },
})

30 changes: 29 additions & 1 deletion .config/nvim/lua/core/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ keymap("n", "<leader>u", ":UndotreeShow<cr>", opts)
keymap("n", "<leader>C", ":let @/ = ''<cr>", opts)
keymap("n", "<leader>so", ":so %<cr>", opts)
keymap("t", "<esc>", "<c-\\><C-n>", term_opts)
keymap("n", "<leader>n", ":Oil<cr>", opts)
-- keymap("n", "<leader>n", ":Ex<cr>", opts)
-- keymap("n", "<C-d", "<C-d>zz", opts)
-- keymap("n", "<C-u", "<C-u>zz", opts)
Expand All @@ -43,9 +44,36 @@ keymap("n", "<leader>sp", ":set paste!<cr>", opts)

-- Telescope Remaps
keymap("n", "<leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>", opts)
keymap("n", "<leader>ff", "<cmd>lua require('telescope.builtin').find_files()<cr>", opts)
keymap("n", "<leader>fg", "<cmd>lua require('telescope.builtin').live_grep()<cr>", opts)
keymap("n", "<leader>fb", "<cmd>lua require('telescope.builtin').buffers()<cr>", opts)
keymap("n", "<leader>fh", "<cmd>lua require('telescope.builtin').help_tags()<cr>", opts)
keymap("n", "<leader>gb", "<cmd>lua require('telescope.builtin').git_branches()<cr>", opts)
keymap("n", "<leader>gc", "<cmd>lua require('telescope.builtin').git_commits()<cr>", opts)

-- File Remaps
keymap("n", "<leader>fs", ":w<cr>", opts)
keymap("n", "<leader>fq", ":q<cr>", opts)
keymap("n", "<leader>fQ", ":q!<cr>", opts)
keymap("n", "<leader>qa", ":qa<cr>", opts)
keymap("n", "<leader>QA", ":qa!<cr>", opts)

-- Which Key Helpers
local wk = require("which-key")
wk.add({
mode = { "n" },
{"<leader>n", "<cmd>Oil<cr>", desc = "Open Oil"},
{"<leader>f", group = file},
{"<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find File"},
{"<leader>fb", "<cmd>Telescope oldfiles<cr>", desc = "Recently Used Files"},
{"<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live Grep"},
{"<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help Tags"},
{"<leader>fs", "<cmd>w<cr>", desc = "Save"},
{"<leader>fq", "<cmd>q<cr>", desc = "Quit"},
{"<leader>fQ", "<cmd>q!<cr>", desc = "Force Quit"},
{"<leader>qa", "<cmd>qa<cr>", desc = "Quit All"},
{"<leader>QA", "<cmd>qa!<cr>", desc = "Force Quit All"},
{"<leader>g", group = git},
{"<leader>gb", "<cmd>Telescope git_branches<cr>", desc = "Git Branches"},
{"<leader>gc", "<cmd>Telescope git_commits<cr>", desc = "Git Commits"},
{"<leader>gs", "<cmd>Neogit<cr>", desc = "Git Status"},
})
14 changes: 0 additions & 14 deletions .config/nvim/lua/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,5 @@
-- /__/ \__\ |__| https://www.youtube.com/channel/UCMvC5sEUUx4U5CsM24Egmhg

vim.g.mapleader = " "
-- vim.cmd("hi Normal guibg=NONE ctermbg=NONE")

require 'core'
-- require 'plugins'
-- require "user.plugins"
-- require "user.settings"
-- require "user.keymaps"
-- require "user.harpoon"
-- require "user.fugitive"
-- require "user.lsp"
-- require "user.treesitter"
-- require "user.terra_fmt"
-- require('nvim-autopairs').setup{}

-- Extras
-- require('telescope').load_extension('fzf')
56 changes: 0 additions & 56 deletions .config/nvim/lua/plugins/config/whichkey.lua

This file was deleted.

66 changes: 36 additions & 30 deletions .config/nvim/lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ local plugs = {
}

},
-- 'vim-airline/vim-airline',
'github/copilot.vim',
{
'nvim-treesitter/nvim-treesitter',
Expand Down Expand Up @@ -91,15 +90,22 @@ local plugs = {
},
-- Only load whichkey after all the gui
{
"folke/which-key.nvim",
opts = function()
return require ('plugins.config.whichkey')
end,
config = function(_, opts)
vim.o.timeout = true
vim.o.timeoutlen = 300
require("which-key").setup(opts)
end,
"folke/which-key.nvim",
event = "VeryLazy",
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
},
},
},
{
"darrikonn/vim-gofmt",
Expand All @@ -110,26 +116,6 @@ local plugs = {
require('stay-centered').setup{}
end
},
-- See the docs for more information
-- https://github.com/huynle/ogpt.nvim
-- {
-- "huynle/ogpt.nvim",
-- event = "VeryLazy",
-- opts = {
-- default_provider = "ollama",
-- providers = {
-- ollama = {
-- api_host = os.getenv("OLLAMA_API_HOST") or "http://localhost:11434",
-- api_key = os.getenv("OLLAMA_API_KEY") or "",
-- }
-- }
-- },
-- dependencies = {
-- "MunifTanjim/nui.nvim",
-- "nvim-lua/plenary.nvim",
-- "nvim-telescope/telescope.nvim"
-- }
-- },
-- NeoGit, a replacement for Vim Fugitive
{
"NeogitOrg/neogit",
Expand Down Expand Up @@ -185,6 +171,26 @@ local plugs = {
debug = false -- Prints errors and the command which is run.
}
}
-- See the docs for more information
-- https://github.com/huynle/ogpt.nvim
-- {
-- "huynle/ogpt.nvim",
-- event = "VeryLazy",
-- opts = {
-- default_provider = "ollama",
-- providers = {
-- ollama = {
-- api_host = os.getenv("OLLAMA_API_HOST") or "http://localhost:11434",
-- api_key = os.getenv("OLLAMA_API_KEY") or "",
-- }
-- }
-- },
-- dependencies = {
-- "MunifTanjim/nui.nvim",
-- "nvim-lua/plenary.nvim",
-- "nvim-telescope/telescope.nvim"
-- }
-- },
}

-- can add opts to .setup(plugs)
Expand Down

0 comments on commit 1f2ce2f

Please sign in to comment.