feat: add harpoon toggle
parent
74781e2d6d
commit
bbd51a0b85
|
@ -22,9 +22,9 @@
|
||||||
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
|
"nvim-comment": { "branch": "main", "commit": "e9ac16ab056695cad6461173693069ec070d2b23" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
|
"nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
|
||||||
"nvim-grey": { "branch": "main", "commit": "e5fc8cc1e0c88c23bc6c92845f19a342f561c409" },
|
"nvim-grey": { "branch": "main", "commit": "e5fc8cc1e0c88c23bc6c92845f19a342f561c409" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "e25c4cdecd3d58c0deccce0f372426c8c480bcce" },
|
"nvim-lspconfig": { "branch": "master", "commit": "b3014f2209503944f2714cf27c95591433a0c7d8" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "81eb8d519233c105f30dc0a278607e62b20502fd" },
|
"nvim-tree.lua": { "branch": "master", "commit": "81eb8d519233c105f30dc0a278607e62b20502fd" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "2bad828b48aed74efe8f7e4ea15550e18c7b482d" },
|
"nvim-treesitter": { "branch": "master", "commit": "5c4892b0556d1258c423e2369d6a602d9b2a4988" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "6e355632387a085f15a66ad68cf681c1d7374a04" },
|
"nvim-web-devicons": { "branch": "master", "commit": "6e355632387a085f15a66ad68cf681c1d7374a04" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
|
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
|
||||||
|
|
|
@ -20,6 +20,7 @@ local function toggle_telescope(harpoon_files)
|
||||||
})
|
})
|
||||||
:find()
|
:find()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function toggle_mark()
|
local function toggle_mark()
|
||||||
local current_file = api.nvim_buf_get_name(0) -- Get the current buffer's file path
|
local current_file = api.nvim_buf_get_name(0) -- Get the current buffer's file path
|
||||||
local item, index = harpoon:list():get_by_value(current_file)
|
local item, index = harpoon:list():get_by_value(current_file)
|
||||||
|
|
132
lua/keymaps.lua
132
lua/keymaps.lua
|
@ -2,73 +2,73 @@ local keymap = vim.api.nvim_set_keymap
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
local mappings = {
|
local mappings = {
|
||||||
n = {
|
n = {
|
||||||
-- highlighting
|
-- highlighting
|
||||||
["<leader>nh"] = ":nohl<CR>",
|
["<leader>nh"] = ":nohl<CR>",
|
||||||
-- move between buffers
|
-- move between buffers
|
||||||
["<c-h>"] = "<C-w>h",
|
["<c-h>"] = "<C-w>h",
|
||||||
["<c-j>"] = "<C-w>j",
|
["<c-j>"] = "<C-w>j",
|
||||||
["<c-k>"] = "<C-w>k",
|
["<c-k>"] = "<C-w>k",
|
||||||
["<c-l>"] = "<C-w>l",
|
["<c-l>"] = "<C-w>l",
|
||||||
-- open and close buggers
|
-- open and close buggers
|
||||||
["<leader>sv"] = "<C-w>s",
|
["<leader>sv"] = "<C-w>s",
|
||||||
["<leader>sh"] = "<C-w>v",
|
["<leader>sh"] = "<C-w>v",
|
||||||
["<leader>se"] = "<C-w>=",
|
["<leader>se"] = "<C-w>=",
|
||||||
["<leader>sx"] = ":close<CR>",
|
["<leader>sx"] = ":close<CR>",
|
||||||
-- nvim-tree
|
-- nvim-tree
|
||||||
["<leader>e"] = ":NvimTreeFindFileToggle<CR>",
|
["<leader>e"] = ":NvimTreeFindFileToggle<CR>",
|
||||||
["<leader>cf"] = ":NvimTreeCollapse<CR>",
|
["<leader>cf"] = ":NvimTreeCollapse<CR>",
|
||||||
-- LSP
|
-- LSP
|
||||||
["<leader>ls"] = ":lspstop<CR>",
|
["<leader>ls"] = ":lspstop<CR>",
|
||||||
["<leader>lo"] = ":lspstart<CR>",
|
["<leader>lo"] = ":lspstart<CR>",
|
||||||
-- Telescope
|
-- Telescope
|
||||||
["<leader>ff"] = "<cmd>Telescope find_files<CR>",
|
["<leader>ff"] = "<cmd>Telescope find_files<CR>",
|
||||||
["<leader>fw"] = "<cmd>Telescope live_grep<CR>",
|
["<leader>fw"] = "<cmd>Telescope live_grep<CR>",
|
||||||
["<leader>fc"] = "<cmd>Telescope grep_string<CR>",
|
["<leader>fc"] = "<cmd>Telescope grep_string<CR>",
|
||||||
["<leader>th"] = "<cmd>Themery<CR>",
|
["<leader>th"] = "<cmd>Themery<CR>",
|
||||||
["<leader>sm"] = ":MaximizerToggle<CR>",
|
["<leader>sm"] = ":MaximizerToggle<CR>",
|
||||||
-- FTerm
|
-- FTerm
|
||||||
["<leader>h"] = "<cmd>FTermToggle<CR>",
|
["<leader>h"] = "<cmd>FTermToggle<CR>",
|
||||||
-- Harpoon
|
-- Harpoon
|
||||||
["<leader>a"] = "<cmd>HarpoonToggleFile<CR>",
|
["<leader>a"] = "<cmd>HarpoonToggleFile<CR>",
|
||||||
["<C-e>"] = "<cmd>HarpoonUI<CR>",
|
["<C-e>"] = "<cmd>HarpoonUI<CR>",
|
||||||
["<leader>c"] = "<cmd>HarpoonClear<CR>",
|
["<leader>c"] = "<cmd>HarpoonClear<CR>",
|
||||||
-- Formating
|
-- Formating
|
||||||
["<leader>fm"] = "<cmd>Format<CR>",
|
["<leader>fm"] = "<cmd>Format<CR>",
|
||||||
-- Disable help menu
|
-- Disable help menu
|
||||||
["<F1>"] = "<nop>",
|
["<F1>"] = "<nop>",
|
||||||
},
|
},
|
||||||
x = {
|
x = {
|
||||||
["<A-j>"] = ":move '>+1<CR>gv-gv",
|
["<A-j>"] = ":move '>+1<CR>gv-gv",
|
||||||
["<A-k>"] = ":move '<-2<CR>gv-gv",
|
["<A-k>"] = ":move '<-2<CR>gv-gv",
|
||||||
},
|
},
|
||||||
i = {
|
i = {
|
||||||
["<C-Space>"] = { 'copilot#Accept("<CR>")', expr = true },
|
["<C-Space>"] = { 'copilot#Accept("<CR>")', expr = true },
|
||||||
["<A-l>"] = "<esc>",
|
["<A-l>"] = "<esc>",
|
||||||
["C-BS"] = "<cmd>HarpoonRemove<CR>",
|
["C-BS"] = "<cmd>HarpoonRemove<CR>",
|
||||||
-- Disable help menu
|
-- Disable help menu
|
||||||
["<F1>"] = "<nop>",
|
["<F1>"] = "<nop>",
|
||||||
},
|
},
|
||||||
t = {
|
t = {
|
||||||
["C-h"] = "<C-\\><C-n>:FTermClose<CR>",
|
["C-h"] = "<C-\\><C-n>:FTermClose<CR>",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for mode, mode_mappings in pairs(mappings) do
|
for mode, mode_mappings in pairs(mappings) do
|
||||||
for key, mapping in pairs(mode_mappings) do
|
for key, mapping in pairs(mode_mappings) do
|
||||||
if type(mapping) == "function" then
|
if type(mapping) == "function" then
|
||||||
-- For direct Lua function calls; ensure your function returns a string command
|
-- For direct Lua function calls; ensure your function returns a string command
|
||||||
keymap(mode, key, "<cmd>lua " .. mapping() .. "<CR>", opts)
|
keymap(mode, key, "<cmd>lua " .. mapping() .. "<CR>", opts)
|
||||||
elseif type(mapping) == "table" and mapping.expr then
|
elseif type(mapping) == "table" and mapping.expr then
|
||||||
-- For expression mappings, like for copilot
|
-- For expression mappings, like for copilot
|
||||||
local expr_opts = vim.tbl_extend("force", opts, { expr = true })
|
local expr_opts = vim.tbl_extend("force", opts, { expr = true })
|
||||||
keymap(mode, key, mapping[1], expr_opts)
|
keymap(mode, key, mapping[1], expr_opts)
|
||||||
elseif type(mapping) == "table" then
|
elseif type(mapping) == "table" then
|
||||||
-- For mappings that have their options specified directly
|
-- For mappings that have their options specified directly
|
||||||
keymap(mode, key, mapping[1], mapping[2] or opts)
|
keymap(mode, key, mapping[1], mapping[2] or opts)
|
||||||
else
|
else
|
||||||
-- For simple string command mappings
|
-- For simple string command mappings
|
||||||
keymap(mode, key, mapping, opts)
|
keymap(mode, key, mapping, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
# Requirements for my setup
|
# Requirements for my setup
|
||||||
|
|
||||||
- file tree x
|
- file tree x
|
||||||
- lsp with mason x
|
- lsp with mason x
|
||||||
- telescope x
|
- telescope x
|
||||||
- theming x
|
- theming x
|
||||||
- tabfluline x
|
- tabfluline x
|
||||||
- rice x
|
- rice x
|
||||||
- terminal x
|
- terminal x
|
||||||
- harpoon x
|
- harpoon x
|
||||||
- extended history x
|
- extended history x
|
||||||
|
@ -12,5 +13,5 @@
|
||||||
- lua vim linting x
|
- lua vim linting x
|
||||||
- dashboard x
|
- dashboard x
|
||||||
- suppress vim global warnings x
|
- suppress vim global warnings x
|
||||||
- harpoon toggle file
|
- harpoon toggle file x
|
||||||
- debugger
|
- debugger
|
||||||
|
|
Loading…
Reference in New Issue