Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the current harpoon mark #514

Open
wants to merge 2 commits into
base: harpoon2
Choose a base branch
from

Conversation

skykosiner
Copy link
Contributor

In harpoon one there was a neat little function you could call to get the current status.

So I added this feature to harpoon two. If you're currently in a buffer that is a mark when you call this function it will return the idx of the mark, or it will return nil.

The function can be called by doing

require("harpoon"):list():get_current_status()

@jjcramer
Copy link

I'm not quite sure why it's failing the style test, but definitely looking forward to this being approved.

iainsimmons pushed a commit to iainsimmons/dotfiles that referenced this pull request Mar 8, 2024
iainsimmons added a commit to iainsimmons/dotfiles that referenced this pull request Mar 17, 2024
@fsorodrigues
Copy link

Would love to see this bad boy implemented. The two cents i'd add is that:

vim.api.nvim_buf_get_name(0):gsub(vim.fn.getcwd() .. "/", "")

will fail miserably if you're anything like me and use - (the hyphen char) in your paths. Has to do with - being a "magical" character in Lua's pattern matching. I learned it the hard way.

So, you probably wanna escape that first (and other chars that need escaping). Could probably just use this implementation from Lua Núcleo: https://github.com/lua-nucleo/lua-nucleo/blob/v0.1.0/lua-nucleo/string.lua#L245-L267

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants