### Configure Harpoon Plugin Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippet demonstrating the basic structure for configuring the Harpoon plugin by calling its `setup` function with desired options. ```lua require("harpoon").setup({ ... }) ``` -------------------------------- ### Install Harpoon Plugin for Neovim Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Instructions for installing the Harpoon plugin using vim-plug, a popular Neovim plugin manager. It also highlights the dependency on plenary.nvim. ```vim Plug 'nvim-lua/plenary.nvim' " don't forget to add this one if you don't have it yet! Plug 'ThePrimeagen/harpoon' ``` -------------------------------- ### Setup and Configuration for Harpoon Neovim Plugin Source: https://context7.com/theprimeagen/harpoon/llms.txt Initializes the Harpoon Neovim plugin with default or custom configuration settings. This includes options for saving marks, menu appearance, and project-specific terminal commands. ```lua -- Basic setup with default settings require("harpoon").setup() -- Full configuration with all available options require("harpoon").setup({ global_settings = { -- Save marks when toggling the menu (default: false) save_on_toggle = false, -- Auto-save marks on any change (default: true) save_on_change = true, -- Execute command immediately when sent to terminal (default: false) enter_on_sendcmd = false, -- Close tmux windows when Neovim exits (default: false) tmux_autoclose_windows = false, -- Filetypes to exclude from marking (default: { "harpoon" }) excluded_filetypes = { "harpoon" }, -- Use git branch-specific marks (default: false) mark_branch = false, -- Enable tabline showing harpoon marks (default: false) tabline = false, tabline_prefix = " ", tabline_suffix = " ", }, -- Dynamic menu width based on window size menu = { width = vim.api.nvim_win_get_width(0) - 4, }, -- Pre-configured commands per project projects = { ["$HOME/personal/vim-with-me/server"] = { term = { cmds = { "./env && npx ts-node src/index.ts" } } } } }) ``` -------------------------------- ### Tmux Pane Identification for Harpoon Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Examples of using Tmux pane identifiers with Harpoon's `gotoTerminal` and `sendCommand` functions for precise control over Tmux panes. ```lua lua require("harpoon.tmux").gotoTerminal("{down-of}") -- focus the pane directly below lua require("harpoon.tmux").sendCommand("%3", "ls") -- send a command to the pane with id '%3' ``` -------------------------------- ### Direct File Navigation with Harpoon UI Source: https://context7.com/theprimeagen/harpoon/llms.txt Enables direct navigation to marked files by their index using the Harpoon UI module. It also supports cycling through marks and setting up example keybindings for quick access to navigation functions. ```lua -- Navigate to specific mark by index require("harpoon.ui").nav_file(1) -- Go to first marked file require("harpoon.ui").nav_file(2) -- Go to second marked file require("harpoon.ui").nav_file(3) -- Go to third marked file require("harpoon.ui").nav_file(4) -- Go to fourth marked file -- Cycle through marks require("harpoon.ui").nav_next() -- Go to next mark (wraps around) require("harpoon.ui").nav_prev() -- Go to previous mark (wraps around) -- Example keybindings for quick access vim.keymap.set("n", "a", require("harpoon.mark").add_file) vim.keymap.set("n", "", require("harpoon.ui").toggle_quick_menu) vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(1) end) vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(2) end) vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(3) end) vim.keymap.set("n", "", function() require("harpoon.ui").nav_file(4) end) ``` -------------------------------- ### Customize Harpoon Tabline Highlights Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Provides example Lua code to customize the appearance of the Harpoon tabline by modifying highlight groups. This allows users to integrate Harpoon's tabline display with their existing Neovim color scheme. ```lua vim.cmd('highlight! HarpoonInactive guibg=NONE guifg=#63698c') vim.cmd('highlight! HarpoonActive guibg=NONE guifg=white') vim.cmd('highlight! HarpoonNumberActive guibg=NONE guifg=#7aa2f7') vim.cmd('highlight! HarpoonNumberInactive guibg=NONE guifg=#7aa2f7') vim.cmd('highlight! TabLineFill guibg=NONE guifg=white') ``` -------------------------------- ### Manage Harpoon Marks (Lua) Source: https://context7.com/theprimeagen/harpoon/llms.txt Functions for querying and managing marks within the Harpoon plugin. This includes getting indices, checking validity, retrieving mark details, and getting the total number of marks. It also provides a status string for UI integration. ```lua -- Get index of a file in the mark list local idx = require("harpoon.mark").get_index_of("src/main.lua") -- Returns: number or nil if not found -- Get current buffer's mark index local current_idx = require("harpoon.mark").get_current_index() -- Returns: number or nil if current buffer is not marked -- Check if an index is valid (has a mark) local is_valid = require("harpoon.mark").valid_index(1) -- Returns: true or false -- Get marked file object by index local mark = require("harpoon.mark").get_marked_file(1) -- Returns: { filename = "path/to/file.lua", row = 10, col = 5 } -- Get marked file name only local filename = require("harpoon.mark").get_marked_file_name(1) -- Returns: "path/to/file.lua" or "" -- Get total number of marks local length = require("harpoon.mark").get_length() -- Returns: number -- Get status string for statusline integration local status = require("harpoon.mark").status() -- Returns: "M1", "M2", etc. or "" if not marked ``` -------------------------------- ### Quick Menu Navigation with Harpoon UI Source: https://context7.com/theprimeagen/harpoon/llms.txt Provides functionality to open and interact with the Harpoon quick menu. Users can toggle the menu, select files, and use keyboard shortcuts for various actions like opening in splits or new tabs. ```lua -- Toggle the quick menu popup require("harpoon.ui").toggle_quick_menu() -- Menu keybindings (when menu is open): -- q or - Close menu and save -- - Open selected file -- - Open in vertical split -- - Open in horizontal split -- - Open in new tab -- Edit marks directly in the menu by: -- - Deleting lines to remove marks -- - Reordering lines to change mark positions -- - Adding new file paths ``` -------------------------------- ### Switch Back to Neovim from Tmux Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Bash script snippet to be added to `tmux.conf` to create a keybind that switches back to the Neovim window from Tmux. ```bash bind-key -r G run-shell "path-to-harpoon/harpoon/scripts/tmux/switch-back-to-nvim" ``` -------------------------------- ### Telescope Integration for Harpoon (Lua) Source: https://context7.com/theprimeagen/harpoon/llms.txt Instructions for integrating Harpoon marks with Telescope fuzzy finder. This allows browsing and managing marks with preview support. Keybindings are provided for common actions like deleting, moving, and opening marks. ```lua -- Load the extension (in your telescope config) require("telescope").load_extension("harpoon") -- Open Telescope picker for marks :Telescope harpoon marks -- Or via Lua require("telescope").extensions.harpoon.marks() -- Telescope picker keybindings: -- - Delete selected mark(s) -- - Move mark up in list -- - Move mark down in list -- - Open selected file ``` -------------------------------- ### Toggle Harpoon Quick Menu for Files Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippet to display the quick menu of all marked project files using the harpoon.ui module. This menu allows navigation, deletion, and reordering of marks. ```lua :lua require("harpoon.ui").toggle_quick_menu() ``` -------------------------------- ### Navigate Tmux Window with Harpoon Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippets demonstrating how to use Harpoon to navigate and send commands to Tmux windows, treating them as terminals. ```lua lua require("harpoon.tmux").gotoTerminal(1) -- goes to the first tmux window lua require("harpoon.tmux").sendCommand(1, "ls -La") -- sends ls -La to tmux window 1 lua require("harpoon.tmux").sendCommand(1, 1) -- sends command 1 to tmux window 1 ``` -------------------------------- ### Telescope Integration Source: https://context7.com/theprimeagen/harpoon/llms.txt Use Telescope fuzzy finder to browse and manage Harpoon marks with preview support. ```APIDOC ## Telescope Integration ### Description Use Telescope fuzzy finder to browse and manage Harpoon marks with preview support. ### Method Lua functions and Vim commands ### Endpoints - `:Telescope harpoon marks` - `require("telescope").load_extension("harpoon")` - `require("telescope").extensions.harpoon.marks()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua -- Load the extension (in your telescope config) require("telescope").load_extension("harpoon") -- Open Telescope picker for marks via command :Telescope harpoon marks -- Or via Lua require("telescope").extensions.harpoon.marks() ``` ### Response #### Success Response (200) Opens the Telescope UI for managing Harpoon marks. Keybindings within Telescope allow for: - ``: Delete selected mark(s) - ``: Move mark up in list - ``: Move mark down in list - ``: Open selected file #### Response Example None (opens Telescope UI) ``` -------------------------------- ### Quickfix List Export Source: https://context7.com/theprimeagen/harpoon/llms.txt Export all marks to Neovim's quickfix list for integration with other tools and workflows. ```APIDOC ## Quickfix List Export ### Description Export all marks to Neovim's quickfix list for integration with other tools and workflows. ### Method Lua function and standard Vim commands ### Endpoints - `require("harpoon.mark").to_quickfix_list()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua -- Send all marks to quickfix list require("harpoon.mark").to_quickfix_list() -- Then use standard quickfix commands :copen -- Open quickfix window :cnext -- Go to next item :cprev -- Go to previous item :cclose -- Close quickfix window ``` ### Response #### Success Response (200) Populates Neovim's quickfix list with the current Harpoon marks. Subsequent commands like `:copen` will display these marks. #### Response Example None (populates quickfix list) ``` -------------------------------- ### Tmux Integration Source: https://context7.com/theprimeagen/harpoon/llms.txt Use tmux windows instead of Neovim terminals. Supports all terminal operations with tmux-specific features like pane targeting. ```APIDOC ## Tmux Integration ### Description Use tmux windows instead of Neovim terminals. Supports all terminal operations with tmux-specific features like pane targeting. ### Method Various (Lua functions) ### Endpoints - `require("harpoon.tmux").gotoTerminal(target)` - `require("harpoon.tmux").sendCommand(target, command)` - `require("harpoon.tmux").clear_all()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua -- Go to tmux window by index (creates if doesn't exist) require("harpoon.tmux").gotoTerminal(1) -- Send command to tmux window require("harpoon.tmux").sendCommand(1, "npm run test") -- Send pre-configured command require("harpoon.tmux").sendCommand(1, 1) -- Use tmux pane identifiers for advanced targeting require("harpoon.tmux").gotoTerminal("{down-of}") require("harpoon.tmux").gotoTerminal("{up-of}") require("harpoon.tmux").gotoTerminal("{left-of}") require("harpoon.tmux").gotoTerminal("{right-of}") -- Send to specific pane by ID require("harpoon.tmux").sendCommand("%3", "ls -la") -- Clear all harpoon-created tmux windows require("harpoon.tmux").clear_all() ``` ### Response #### Success Response (200) These functions typically perform actions and do not return specific data, but rather modify the tmux and Neovim state. #### Response Example None (actions performed directly in tmux/Neovim) ``` -------------------------------- ### Register Harpoon as Telescope Extension Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippet to load Harpoon as an extension for the Telescope fuzzy finder in Neovim, enabling Telescope integration. ```lua require("telescope").load_extension('harpoon') ``` -------------------------------- ### Command UI for Terminal Commands Source: https://context7.com/theprimeagen/harpoon/llms.txt Manage pre-configured terminal commands through a dedicated UI. Commands are saved per-project and can be sent to any terminal. ```APIDOC ## Command UI for Terminal Commands ### Description Manage pre-configured terminal commands through a dedicated UI. Commands are saved per-project and can be sent to any terminal. ### Method Various (Lua functions) ### Endpoints - `require("harpoon.cmd-ui").toggle_quick_menu()` - `require("harpoon.term").add_cmd(command)` - `require("harpoon.term").rm_cmd(index)` - `require("harpoon.term").set_cmd_list(commands_list)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua -- Toggle the commands quick menu require("harpoon.cmd-ui").toggle_quick_menu() -- Add a new command programmatically require("harpoon.term").add_cmd("npm run build") -- Remove a command by index require("harpoon.term").rm_cmd(1) -- Set entire command list require("harpoon.term").set_cmd_list({ "npm run dev", "npm run test", "npm run build" }) ``` ### Response #### Success Response (200) These functions typically perform actions and do not return specific data, but rather modify the Neovim state or UI. #### Response Example None (actions performed directly in Neovim) ``` -------------------------------- ### Configure Tabline Integration (Lua) Source: https://context7.com/theprimeagen/harpoon/llms.txt Enables and customizes the Harpoon tabline to display marks as tabs at the top of the screen. This includes setting prefixes, suffixes, and highlight groups for different tab states. ```lua require("harpoon").setup({ global_settings = { tabline = true, tabline_prefix = " ", tabline_suffix = " ", } }) -- Customize tabline highlight groups vim.cmd('highlight! HarpoonInactive guibg=NONE guifg=#63698c') vim.cmd('highlight! HarpoonActive guibg=NONE guifg=white') vim.cmd('highlight! HarpoonNumberActive guibg=NONE guifg=#7aa2f7') vim.cmd('highlight! HarpoonNumberInactive guibg=NONE guifg=#7aa2f7') vim.cmd('highlight! TabLineFill guibg=NONE guifg=white') ``` -------------------------------- ### Open Harpoon Mark in Split or Tab Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Describes how to open a selected Harpoon mark in a vertical split (Ctrl+V), horizontal split (Ctrl+X), or a new tab (Ctrl+T) from the quick menu. ```lua -- From the quickmenu, open a file in: -- a vertical split with control+v, -- a horizontal split with control+x, -- a new tab with control+t ``` -------------------------------- ### Manage Terminal Commands UI (Lua) Source: https://context7.com/theprimeagen/harpoon/llms.txt Functions for managing pre-configured terminal commands through a dedicated UI. Commands are saved per-project and can be sent to any terminal. This includes toggling the menu, adding, removing, and setting command lists programmatically. ```lua -- Toggle the commands quick menu require("harpoon.cmd-ui").toggle_quick_menu() -- Menu workflow: -- 1. Open menu with toggle_quick_menu() -- 2. View/edit/reorder commands in the buffer -- 3. Press on a command to execute it -- 4. Enter terminal index when prompted (default: 1) -- 5. Press q or to close -- Add a new command programmatically require("harpoon.term").add_cmd("npm run build") -- Remove a command by index require("harpoon.term").rm_cmd(1) -- Set entire command list require("harpoon.term").set_cmd_list({ "npm run dev", "npm run test", "npm run build" }) ``` -------------------------------- ### Cycle Through Harpoon Marks Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippets to navigate to the next or previous marked file in the list using the harpoon.ui module. ```lua :lua require("harpoon.ui").nav_next() -- navigates to next mark :lua require("harpoon.ui").nav_prev() -- navigates to previous mark ``` -------------------------------- ### Navigate Neovim Terminals (Lua) Source: https://context7.com/theprimeagen/harpoon/llms.txt Functions for navigating and managing Neovim terminal buffers. Terminals are created on-demand and persist across navigation. Commands can be sent directly to these terminals. ```lua -- Go to terminal by index (creates if doesn't exist) require("harpoon.term").gotoTerminal(1) -- Go to/create terminal 1 require("harpoon.term").gotoTerminal(2) -- Go to/create terminal 2 -- Send a command directly to a terminal require("harpoon.term").sendCommand(1, "npm run test") require("harpoon.term").sendCommand(1, "ls -la") -- Send a pre-configured command by index require("harpoon.term").sendCommand(1, 1) -- Send command #1 to terminal #1 require("harpoon.term").sendCommand(2, 1) -- Send command #1 to terminal #2 -- Clear all terminal buffers require("harpoon.term").clear_all() -- Example workflow require("harpoon.term").gotoTerminal(1) -- Open terminal require("harpoon.term").sendCommand(1, "npm start") -- Run dev server require("harpoon.term").gotoTerminal(2) -- Open second terminal require("harpoon.term").sendCommand(2, "npm test") -- Run tests ``` -------------------------------- ### Mark Query Functions Source: https://context7.com/theprimeagen/harpoon/llms.txt Query information about marks, including their indices, associated file names, and current buffer status. ```APIDOC ## Mark Query Functions ### Description Query information about marks including indices, file names, and current buffer status. ### Method Various (Lua functions) ### Endpoints - `require("harpoon.mark").get_index_of(filename)` - `require("harpoon.mark").get_current_index()` - `require("harpoon.mark").valid_index(index)` - `require("harpoon.mark").get_marked_file(index)` - `require("harpoon.mark").get_marked_file_name(index)` - `require("harpoon.mark").get_length()` - `require("harpoon.mark").status()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua -- Get index of a file in the mark list local idx = require("harpoon.mark").get_index_of("src/main.lua") -- Get current buffer's mark index local current_idx = require("harpoon.mark").get_current_index() -- Check if an index is valid (has a mark) local is_valid = require("harpoon.mark").valid_index(1) -- Get marked file object by index local mark = require("harpoon.mark").get_marked_file(1) -- Get marked file name only local filename = require("harpoon.mark").get_marked_file_name(1) -- Get total number of marks local length = require("harpoon.mark").get_length() -- Get status string for statusline integration local status = require("harpoon.mark").status() ``` ### Response #### Success Response (200) - `idx` (number or nil): Index of the file if found, otherwise nil. - `current_idx` (number or nil): Index of the current buffer if marked, otherwise nil. - `is_valid` (boolean): True if the index is valid, false otherwise. - `mark` (table): A table containing `filename`, `row`, and `col` if the mark exists. - `filename` (string): The filename of the marked file, or an empty string if not found. - `length` (number): The total number of marks. - `status` (string): A status string (e.g., "M1", "M2") or an empty string if not marked. #### Response Example ```json { "idx": 1, "current_idx": 2, "is_valid": true, "mark": { "filename": "path/to/file.lua", "row": 10, "col": 5 }, "filename": "path/to/file.lua", "length": 5, "status": "M1" } ``` ``` -------------------------------- ### Terminal Navigation Source: https://context7.com/theprimeagen/harpoon/llms.txt Navigate to and manage Neovim terminal buffers. Terminals are created on-demand and persist across navigation. ```APIDOC ## Terminal Navigation ### Description Navigate to and manage Neovim terminal buffers. Terminals are created on-demand and persist across navigation. ### Method Various (Lua functions) ### Endpoints - `require("harpoon.term").gotoTerminal(index)` - `require("harpoon.term").sendCommand(terminal_index, command) - `require("harpoon.term").clear_all()` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua -- Go to terminal by index (creates if doesn't exist) require("harpoon.term").gotoTerminal(1) require("harpoon.term").gotoTerminal(2) -- Send a command directly to a terminal require("harpoon.term").sendCommand(1, "npm run test") require("harpoon.term").sendCommand(1, "ls -la") -- Send a pre-configured command by index require("harpoon.term").sendCommand(1, 1) require("harpoon.term").sendCommand(2, 1) -- Clear all terminal buffers require("harpoon.term").clear_all() ``` ### Response #### Success Response (200) These functions typically perform actions and do not return specific data, but rather modify the Neovim state. #### Response Example None (actions performed directly in Neovim) ``` -------------------------------- ### Toggle Harpoon Command Menu Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippet to display a menu of stored commands for quick execution via Harpoon. ```lua lua require('harpoon.cmd-ui').toggle_quick_menu() -- shows the commands menu ``` -------------------------------- ### Preconfigure Terminal Commands with Harpoon Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Allows users to preconfigure terminal commands for specific project directories. This enables quick execution of defined commands within the project context, streamlining development workflows. ```lua projects = { -- Yes $HOME works ["$HOME/personal/vim-with-me/server"] = { term = { cmds = { "./env && npx ts-node src/index.ts" } } } } ``` -------------------------------- ### Mark Current File in Harpoon Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippet to mark the current file for later revisiting using the harpoon.mark module. ```lua :lua require("harpoon.mark").add_file() ``` -------------------------------- ### Tmux Integration for Harpoon (Lua) Source: https://context7.com/theprimeagen/harpoon/llms.txt Functions for using tmux windows instead of Neovim terminals. This supports all terminal operations with tmux-specific features like pane targeting. Commands can be sent to specific panes using their identifiers. ```lua -- Go to tmux window by index (creates if doesn't exist) require("harpoon.tmux").gotoTerminal(1) -- Send command to tmux window require("harpoon.tmux").sendCommand(1, "npm run test") -- Send pre-configured command require("harpoon.tmux").sendCommand(1, 1) -- Send command #1 to tmux window #1 -- Use tmux pane identifiers for advanced targeting require("harpoon.tmux").gotoTerminal("{down-of}") -- Focus pane below require("harpoon.tmux").gotoTerminal("{up-of}") -- Focus pane above require("harpoon.tmux").gotoTerminal("{left-of}") -- Focus pane to left require("harpoon.tmux").gotoTerminal("{right-of}") -- Focus pane to right -- Send to specific pane by ID require("harpoon.tmux").sendCommand("%3", "ls -la") -- Send to pane %3 -- Clear all harpoon-created tmux windows require("harpoon.tmux").clear_all() -- Tmux keybind to switch back to Neovim (add to tmux.conf) -- bind-key -r G run-shell "path-to-harpoon/harpoon/scripts/tmux/switch-back-to-nvim" ``` -------------------------------- ### Export Harpoon Marks to Quickfix List (Lua) Source: https://context7.com/theprimeagen/harpoon/llms.txt Function to export all Harpoon marks to Neovim's quickfix list. This enables integration with other tools and workflows that utilize the quickfix list for navigation and management. ```lua -- Send all marks to quickfix list require("harpoon.mark").to_quickfix_list() -- Then use standard quickfix commands :copen -- Open quickfix window :cnext -- Go to next item :cprev -- Go to previous item :cclose -- Close quickfix window ``` -------------------------------- ### Configure Global Settings for Harpoon Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Sets various global options for the Harpoon plugin, such as save behavior, terminal command execution, excluded filetypes, and tabline appearance. These settings control how Harpoon manages marks and interacts with the Neovim environment. ```lua global_settings = { -- sets the marks upon calling `toggle` on the ui, instead of require `:w`. save_on_toggle = false, -- saves the harpoon file upon every change. disabling is unrecommended. save_on_change = true, -- sets harpoon to run the command immediately as it's passed to the terminal when calling `sendCommand`. enter_on_sendcmd = false, -- closes any tmux windows harpoon that harpoon creates when you close Neovim. tmux_autoclose_windows = false, -- filetypes that you want to prevent from adding to the harpoon list menu. excluded_filetypes = { "harpoon" }, -- set marks specific to each git branch inside git repository mark_branch = false, -- enable tabline with harpoon marks tabline = false, tabline_prefix = " ", tabline_suffix = " ", } ``` -------------------------------- ### Adding and Removing File Marks in Harpoon Source: https://context7.com/theprimeagen/harpoon/llms.txt Manages file marks within the Harpoon plugin. This includes adding, removing, toggling, and clearing marks for the current file or specific files, as well as setting marks at specific indices. ```lua -- Add current file to marks require("harpoon.mark").add_file() -- Remove current file from marks require("harpoon.mark").rm_file() -- Toggle current file (add if not marked, remove if marked) require("harpoon.mark").toggle_file() -- Output: "Mark added" or "Mark removed" -- Add a specific file by path require("harpoon.mark").add_file("src/main.lua") -- Remove a specific file by path require("harpoon.mark").rm_file("src/main.lua") -- Clear all marks for the current project require("harpoon.mark").clear_all() -- Set current file at a specific index position require("harpoon.mark").set_current_at(1) -- Set current file as mark #1 ``` -------------------------------- ### Navigate to Specific Harpoon Mark Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippet to directly navigate to a specific marked file by its index using the harpoon.ui module. ```lua :lua require("harpoon.ui").nav_file(3) -- navigates to file 3 ``` -------------------------------- ### Access Harpoon Marks via Telescope Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Vim command to access Harpoon marks using Telescope, allowing users to search and navigate their Harpoon marks through the Telescope interface. ```vim :Telescope harpoon marks ``` -------------------------------- ### Customize Harpoon Popup Menu Width Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Dynamically adjusts the width of the Harpoon popup menu based on the current Neovim window's width. This ensures the menu is always appropriately sized, improving usability. ```lua require("harpoon").setup({ menu = { width = vim.api.nvim_win_get_width(0) - 4, } }) ``` -------------------------------- ### Register Event Callbacks for Mark Changes (Lua) Source: https://context7.com/theprimeagen/harpoon/llms.txt Registers callbacks to be executed when Harpoon marks are changed. This allows for custom integrations and statusline updates. Multiple callbacks can be registered for the same event. ```lua require("harpoon.mark").on("changed", function() print("Harpoon marks have been updated!") -- Refresh statusline, update UI, etc. end) -- Multiple callbacks can be registered require("harpoon.mark").on("changed", function() -- Update statusline component vim.cmd("redrawstatus") end) require("harpoon.mark").on("changed", function() -- Log to file local log = io.open("/tmp/harpoon.log", "a") log:write("Marks changed at " .. os.date() .. "\n") log:close() end) ``` -------------------------------- ### Navigate to Harpoon Terminal Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippet to navigate to a specific terminal index managed by Harpoon. If no terminal exists at the index, a new one is created. ```lua lua require("harpoon.term").gotoTerminal(1) -- navigates to term 1 ``` -------------------------------- ### Send Stored Command to Harpoon Terminal Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippet to send a pre-stored command (identified by its index) to a specific Harpoon-managed terminal. ```lua lua require("harpoon.term").sendCommand(1, 1) -- sends command 1 to term 1 ``` -------------------------------- ### Send Command to Harpoon Terminal Source: https://github.com/theprimeagen/harpoon/blob/master/README.md Lua code snippet to send a command to a specific terminal managed by Harpoon. This is useful for executing shell commands within Harpoon-managed terminals. ```lua lua require("harpoon.term").sendCommand(1, "ls -La") -- sends ls -La to tmux window 1 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.