Giter Club home page Giter Club logo

nvim-bookmarks's Introduction

Table of Contents

Installation

return {
    "kdnk/nvim-bookmarks",
}

Configuration

return {
    "kdnk/nvim-bookmarks",
    config = function()
        local bm = require("bookmarks")

        bm.setup({
            persist = {
                enable = true,
                dir = "./.bookmarks", -- directory to store json file for backup. Please add `**/.bookmarks/*` to your `.gitignore_global`.
                per_branch = true, -- store backup file for each branch
            },
            sign = {
                text = "โš‘",
            },
        })

        vim.keymap.set("n", "mm", bm.toggle) -- toggle bookmark at current line
        vim.keymap.set("n", "<C-,>", bm.jump_prev) -- jump to the previous bookmark over buffers
        vim.keymap.set("n", "<C-.>", bm.jump_next) -- jump to the next bookmark over buffers
        vim.keymap.set("n", "mx", bm.reset) -- remove all bookmarks
        vim.keymap.set("n", "mr", bm.restore) -- restore bookmarks from the json backup file

        -- autocmd to restore bookmarks from the json backup file
        local bookmarkGroup = vim.api.nvim_create_augroup("bookmark_auto_restore", {})
        vim.api.nvim_create_autocmd({ "VimEnter", "SessionLoadPost" }, {
            callback = function()
                bm.restore()
            end,
            group = bookmarkGroup,
        })
    end,
}

Integration

lualine

local function bookmark_count()
    return string.format([[๐Ÿ“˜ %s]], require("bookmarks.lualine").bookmark_count())
end

require("lualine").setup({
    sections = {
        lualine_c = {
            { bookmark_count },
        },
    },
})

Telescope

require("telescope").load_extension("bookmarks")
vim.keymap.set("n", "<leader>b", function() require("telescope").extensions.bookmarks.list() end)

Credit

nvim-bookmarks's People

Contributors

kdnk avatar xzbdmw avatar

Stargazers

Bharath Devalla avatar Yuta Katayama avatar

Watchers

 avatar

Forkers

xzbdmw

nvim-bookmarks's Issues

Can't make it work

My setup

return {
    "kdnk/bookmarks-cycle-through.nvim",
    dependencies = {
        "MattesGroeger/vim-bookmarks",
    },
    lazy = false,
    config = function()
        vim.keymap.set("n", "mm", function()
            require("bookmarks-cycle-through").toggle_bookmark()
        end)
        vim.keymap.set("n", "]b", function()
            require("bookmarks-cycle-through").cycle_through({ reverse = false })
        end)
        vim.keymap.set("n", "[b", function()
            require("bookmarks-cycle-through").cycle_through({ reverse = true })
        end)
    end,
}

E5108: Error executing lua: /Users/xzb/.config/nvim/lua/config/keymaps.lua:255: attempt to call field 'toggle_bookmark' (a nil value)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.