feat: harpoon2 -> harpoon

This commit is contained in:
mpaulson 2023-11-30 14:03:51 -07:00
parent fc35ba1831
commit ac9cbed9ed
12 changed files with 61 additions and 45 deletions

View File

@ -11,18 +11,12 @@
-- image provided by **Bob Rust**
## ⇁ TOC
* [Note to legacy Harpoon 1 users](#-Note-to-legacy-Harpoon-1-users)
* [The Problems](#-The-Problems)
* [The Solutions](#-The-Solutions)
* [Installation](#-Installation)
* [Getting Started](#-Getting-Started)
* [Social](#-Social)
## ⇁ Note to legacy Harpoon 1 users
Original Harpoon will remain in a frozen state and i will merge PRs in with _no
code review_ for those that wish to remain on that. Harpoon 2 is significantly
better and allows for MUCH greater control. Please migrate to that (will
become `master` within the next few months).
* [Note to legacy Harpoon 1 users](#-Note-to-legacy-Harpoon-1-users)
## ⇁ The Problems
1. You're working on a codebase. medium, large, tiny, whatever. You find
@ -37,17 +31,39 @@ to go to the files you want.
1. Unlimited terminals and navigation.
## ⇁ Installation
* neovim 0.5.0+ required
* install using your favorite plugin manager (`vim-plug` in this example)
```vim
Plug 'nvim-lua/plenary.nvim' " don't forget to add this one if you don't have it yet!
Plug 'ThePrimeagen/harpoon'
* neovim 0.8.0+ required
* install using your favorite plugin manager (i am using `packer` in this case)
```lua
use "nvim-lua/plenary.nvim" -- don't forget to add this one if you don't have it yet!
use {
"ThePrimeagen/harpoon",
branch = "0.1.x",
requires = { {"nvim-lua/plenary.nvim"} }
}
```
## ⇁ Getting Started
### Quick Note
You will want to add your style of remaps and such to your neovim dotfiles with
the shortcuts you like. My shortcuts are for me. Me alone. Which also means
they are designed with dvorak in mind (My layout btw, I use dvorak btw).
```lua
local harpoon = require("harpoon")
harpoon.ui:toggle_quick_menu(harpoon:list())
```
## ⇁ Social
For questions about Harpoon, there's a #harpoon channel on [the Primagen's Discord](https://discord.gg/theprimeagen) server.
For questions about Harpoon, there's a #harpoon channel on [the Primeagen's Discord](https://discord.gg/theprimeagen) server.
* [Discord](https://discord.gg/theprimeagen)
* [Twitch](https://www.twitch.tv/theprimeagen)
* [Twitter](https://twitter.com/ThePrimeagen)
## ⇁ Note to legacy Harpoon 1 users
Original Harpoon will remain in a frozen state and i will merge PRs in with _no
code review_ for those that wish to remain on that. Harpoon 2 is significantly
better and allows for MUCH greater control. Please migrate to that (will
become `master` within the next few months).

View File

@ -1,4 +1,4 @@
local utils = require("harpoon2.utils")
local utils = require("harpoon.utils")
local M = {}
local HARPOON_MENU = "__harpoon-menu__"
@ -47,27 +47,27 @@ function M.setup_autocmds_and_keymaps(bufnr)
bufnr,
"n",
"q",
"<Cmd>lua require('harpoon2').ui:toggle_quick_menu()<CR>",
"<Cmd>lua require('harpoon').ui:toggle_quick_menu()<CR>",
{ silent = true }
)
vim.api.nvim_buf_set_keymap(
bufnr,
"n",
"<ESC>",
"<Cmd>lua require('harpoon2').ui:toggle_quick_menu()<CR>",
"<Cmd>lua require('harpoon').ui:toggle_quick_menu()<CR>",
{ silent = true }
)
vim.api.nvim_buf_set_keymap(
bufnr,
"n",
"<CR>",
"<Cmd>lua require('harpoon2').ui:select_menu_item()<CR>",
"<Cmd>lua require('harpoon').ui:select_menu_item()<CR>",
{}
)
-- TODO: Update these to use the new autocmd api
vim.cmd(
string.format(
"autocmd BufWriteCmd <buffer=%s> lua require('harpoon2').ui:save()",
"autocmd BufWriteCmd <buffer=%s> lua require('harpoon').ui:save()",
bufnr
)
)
@ -77,7 +77,7 @@ function M.setup_autocmds_and_keymaps(bufnr)
if global_config.save_on_change then
vim.cmd(
string.format(
"autocmd TextChanged,TextChangedI <buffer=%s> lua require('harpoon2').ui:save()",
"autocmd TextChanged,TextChangedI <buffer=%s> lua require('harpoon').ui:save()",
bufnr
)
)
@ -90,7 +90,7 @@ function M.setup_autocmds_and_keymaps(bufnr)
)
)
vim.cmd(
"autocmd BufLeave <buffer> ++nested ++once silent lua require('harpoon2').ui:toggle_quick_menu()"
"autocmd BufLeave <buffer> ++nested ++once silent lua require('harpoon').ui:toggle_quick_menu()"
)
end

View File

@ -1,7 +1,7 @@
local Path = require("plenary.path")
local data_path = vim.fn.stdpath("data")
local full_data_path = string.format("%s/harpoon2.json", data_path)
local full_data_path = string.format("%s/harpoon.json", data_path)
---@param data any
local function write_data(data)

View File

@ -1,8 +1,8 @@
local Ui = require("harpoon2.ui")
local Data = require("harpoon2.data")
local Config = require("harpoon2.config")
local List = require("harpoon2.list")
local Listeners = require("harpoon2.listeners")
local Ui = require("harpoon.ui")
local Data = require("harpoon.data")
local Config = require("harpoon.config")
local List = require("harpoon.list")
local Listeners = require("harpoon.listeners")
-- setup
-- read from a config file
@ -141,7 +141,7 @@ function Harpoon:dump()
end
function Harpoon:__debug_reset()
require("plenary.reload").reload_module("harpoon2")
require("plenary.reload").reload_module("harpoon")
end
return Harpoon:new()

View File

@ -1,5 +1,5 @@
local Listeners = require("harpoon2.listeners")
local Buffer = require("harpoon2.buffer")
local Listeners = require("harpoon.listeners")
local Buffer = require("harpoon.buffer")
local function index_of(items, element, config)
local equals = config and config.equals

View File

@ -1,3 +1,3 @@
local harpoon = require("harpoon2")
local harpoon = require("harpoon")
harpoon.ui:toggle_quick_menu(harpoon:list())

View File

@ -1,4 +1,4 @@
local Config = require("harpoon2.config")
local Config = require("harpoon.config")
local eq = assert.are.same
describe("config", function()

View File

@ -1,5 +1,5 @@
local utils = require("harpoon2.test.utils")
local harpoon = require("harpoon2")
local utils = require("harpoon.test.utils")
local harpoon = require("harpoon")
local eq = assert.are.same
@ -8,7 +8,7 @@ local be = utils.before_each(os.tmpname())
describe("harpoon", function()
before_each(function()
be()
harpoon = require("harpoon2")
harpoon = require("harpoon")
end)
it("when we change buffers we update the row and column", function()

View File

@ -1,5 +1,5 @@
local List = require("harpoon2.list")
local Config = require("harpoon2.config")
local List = require("harpoon.list")
local Config = require("harpoon.config")
local eq = assert.are.same
describe("list", function()

View File

@ -1,6 +1,6 @@
local utils = require("harpoon2.test.utils")
local Buffer = require("harpoon2.buffer")
local harpoon = require("harpoon2")
local utils = require("harpoon.test.utils")
local Buffer = require("harpoon.buffer")
local harpoon = require("harpoon")
local eq = assert.are.same
local be = utils.before_each(os.tmpname())
@ -8,7 +8,7 @@ local be = utils.before_each(os.tmpname())
describe("harpoon", function()
before_each(function()
be()
harpoon = require("harpoon2")
harpoon = require("harpoon")
end)
it("open the ui without any items in the list", function()

View File

@ -1,4 +1,4 @@
local Data = require("harpoon2.data")
local Data = require("harpoon.data")
local M = {}
@ -10,10 +10,10 @@ function M.before_each(name)
Data.set_data_path(name)
Data.__dangerously_clear_data()
require("plenary.reload").reload_module("harpoon2")
Data = require("harpoon2.data")
require("plenary.reload").reload_module("harpoon")
Data = require("harpoon.data")
Data.set_data_path(name)
local harpoon = require("harpoon2")
local harpoon = require("harpoon")
M.clean_files()

View File

@ -1,5 +1,5 @@
local popup = require("plenary").popup
local Buffer = require("harpoon2.buffer")
local Buffer = require("harpoon.buffer")
local DEFAULT_WINDOW_WIDTH = 69 -- nice
---@class HarpoonUI