/neomarks

A new take on vim marks

Primary LanguageLuaMIT LicenseMIT

Important All the credits for the idea for the plugin goes to ThePrimegean and his plugin harpoon. I highly suggest you to watch is vimconf video to understand the usage of this plugin.

Warning This plugin is not stable. Is expected changes in the API. If you experience bugs open an issue

Neomarks

A new take on vim marks.

Table of contents

Goals

  • No opt-out dependencies
  • Take advantage of native neovim features

Non Goals

  • Feature compatible with harpoon
  • Support anything other than marking file

Why

Harpoon is great and all but as a lot of features that I don't really need and depends on plenary.nvim. This plugin focus on minimalism, do the minimum set of features to be usable and use only neovim standard functions.

Installation

Using your favorite Package manager:

"saccarosium/neomarks"

Put it directly in your config:

curl https://raw.githubusercontent.com/saccarosium/neomarks/main/lua/neomarks.lua -o "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim/lua/neomarks.lua

Setup

Call the setup function (the following are the defaults):

require("neomarks").setup({
  storagefile = vim.fn.stdpath('data') .. "/neomarks.json",
  menu = {
    title = "Neomarks",
    title_pos = "center",
    border = "rounded",
    width = 60,
    height = 10,
  }
})

Now you can remap as you wish the following functions:

require("neomarks").mark_file() -- Mark file
require("neomarks").menu_toggle() -- Toggle the UI
require("neomarks").jump_to(<number>) -- Jump to specific index

Branch specific marks

Note For enabling branch specific files you need to: or install some sort of git integration plugin, that exposes a function to get the current branch name, or build a function on your own. It is preferable to achive this using a plugin. Some options are: gitsigns.nvim or vim-fugitive.

To enable the feature you need to pass a function that returns the current branch name.

git_branch = vim.fn["FugitiveHead"], -- For vim-fugitive
git_branch = function() return vim.api.nvim_buf_get_var(0, "gitsigns_head") end, -- For gitsigns.nvim
git_branch = function() ... end, -- For custom function that returns branch name

Roadmap

  • Support branch specific marks
  • Mark specific buffer symbol using tree-sitter

UI Mappings

Keys Action
<CR>, e, E edit file under the cursor
<C-c>, <ESC>, q close UI