Skip to content

michhernand/RLDX.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

45 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

RLDX.nvim

Logo

Experience an Issue?

  1. Review the Known Issues to find a workaround.
  2. If the issue is new then create a Github issue.

🎷 Features

  • Autocomplete for your contact list.
  • At-rest obfuscation of contact list.
  • Syntax highlighting for contacts.

Left: Neovim Editor, Right: At-Rest Obfuscated Catalog Demo1

πŸ–₯️ Usage

  • Autocomplete: To trigger autocomplete, simply start a word with your prefix_char (defaults to @).
  • Add Contact: To add a contact to the Contact Catalog, use :RldxAdd (leader X a).
  • Delete Contact: To delete a contact from the Contact Catalog, use :RldxDelete (leader X d).
  • Reload Contact Catalog: To reload the Contact Catalog, use :RldxLoad (leader X l).
    • Note: Loading occurs automatically on startup. Reload is only necessary if the Contact Catalog is updated by a process other than Neovim. In the vast majority of scenarios, this command is not needed.
  • Save Contact Catalog: To save the Contact Catalog, use :RldxSave (leader X s).
    • Note: Saving occurs automatically when contacts are saved or deleted. Manually saving is useful if an error occurs with either of those processes.

πŸ“Ž Requirements

πŸ’Ύ Installation

  1. Add to your Neovim package manager's configuration. See specific steps below.
  2. Update your cmp-nvim configuration.
  3. [Optional] Update your cmp-nvim formatting configuration.

Package Managers

Lazy

{
    "michhernand/RLDX.nvim",
    event = "VeryLazy",
    dependencies = {
        "hrsh7th/nvim-cmp",
    },
    opts = {}, -- see configuration docs for details
    keys = {
        { "<leader>Xa", "<cmd>RldxAdd<CR>" },
        { "<leader>Xl", "<cmd>RldxLoad<CR>" },
        { "<leader>Xs", "<cmd>RldxSave<CR>" },
        { "<leader>Xd", "<cmd>RldxDelete<CR>" },
        { "<leader>Xp", "<cmd>RldxProps<CR>" },
    }
}

Packer

use {
    "michhernand/RLDX.nvim", 
    requires = { "hrsh7th/nvim-cmp" },
    config = function()
        require("rldx").setup{} -- see configuration docs for details
    end,
        setup = function()
        vim.keymap.set("n", "<leader>Xa", "<cmd>RldxAdd<CR>", { noremap = true, silent = true })
        vim.keymap.set("n", "<leader>Xl", "<cmd>RldxLoad<CR>", { noremap = true, silent = true })
        vim.keymap.set("n", "<leader>Xs", "<cmd>RldxSave<CR>", { noremap = true, silent = true })
        vim.keymap.set("n", "<leader>Xd", "<cmd>RldxDelete<CR>", { noremap = true, silent = true })
        vim.keymap.set("n", "<leader>Xp", "<cmd>RldxProps<CR>", { noremap = true, silent = true})
    end
}

Completions Engine Configuration

nvim-cmp

[Required] Core Configuration

nvim-cmp configuration for all file types.

require('cmp').setup({
    sources = {
        { name = 'cmp_rolodex' }
    }
})

nvim-cmp configuration for select file types.

require('cmp').setup.filetype('org', {
    sources = {
        { name = 'cmp_rolodex' }
    },
 })

[Optional] Formatting

An optional feature is to add formatting for nvim-cmp to display the type and source of the completion.

A completion without formatting applied.

Completion Without Formatting

A completion with formatting applied.

Completion With Formatting

This is enabled by setting formatting in the config function for hrsh7th/nvim-cmp.

-- nvim-cmp.lua

return {
    "hrsh7th/nvim-cmp",
    config = function()
        formatting = {
            format = function(entry, vim_item)
                if entry.source.name = "cmp_rolodex" then
                    vim_item.kind = "πŸ“‡ Contact"
                    vim_item.menu = "[RLDX]"
                end
                return vim_item
            end
        }
    end
}

For more details on formatting setup, see the Formatting Doc.

βš™οΈ Configuration

Default Configuration

opts = {
    prefix_char = "@",
    filename = os.getenv("HOME") .. "/.rolodex/db.json"),
    highlight_enabled = true,
    highlight_color = "00ffff",
    highlight_bold = true,
    schema_ver = "latest",
    encryption = "plaintext",
}

Prefix Char

prefix_char (str) is the character that triggers autocomplete.

DB Filename

filename (str) is the location where your contacts are stored.

Highlighting

Highlight Enabled

highlight_enabled (bool) is a flag indicating whether highlighting of names is enabled.

Highlight Color

highlight_color (str) is a hex color code indicating what color names should be highlighted as.

Highlight Bold

highlight_bold (bool) is a flag indicating whether highlighted names should be bolded.

Schema Version

schema_ver (str) tells RLDX what version of the schmea to use when writing out data. Options include '0.0.2', '0.1.0', or '0.2.0'. 'latest' (which is the default) is also an option which automatically upgrades your catalog to the latest schema.

Obfuscation

Encryption

  • encryption (str) is the chosen encryption methodology. Options include:
    • plaintext: No encryption of fields.
    • elementwise_xor (only available for schema_ver >= '0.1.0'): xor encryption of each contact.

Hash Salt Length

hash_salt_length (str) is the number of random salt characters added to the hash.

For more information about Obfuscation, see the Obfuscation Doc

πŸ–‹οΈ Usage

Autocompleting and Storing Contacts

Left: Neovim Editor, Right: At-Rest Plaintext Catalog Demo for Adding Contacts

πŸ”’ Obfuscation

RLDX optionally provides obfuscation of data at rest. RLDX and its maintainers make no guarantees around security. For a full breakdown of obfuscation, see the Obfuscation Doc.

Left: Neovim Editor, Right: At-Rest Obfuscated Catalog Demo for Obfuscation

What Is Obfuscation?

  • In schema_ver >= 0.1.0, RLDX provides:
    • Very light encryption of names.
    • Hashing of names to guarantee uniqueness.
  • To enable obfuscation, see the instructions in Obfusfaction Doc

Adding Properties

Arbitrary JSON key-value data can be assigned to any contact using :RldxProps. Arbitrary JSON is obfuscated (when obfuscation is enabled).

🚘 Roadmap

  • Obfuscation
  • Salt for Hashing
  • Form for adding contacts
  • Allow saving all contacts
  • Allow loading all contacts
  • Allow deleting contacts
  • Store contact key-value metadata
  • Display contact key-value metadata
  • Filter by contact key-value metadata
  • Blink.nvim compatability
  • Grep files by contact name

πŸ¦— Known Issues

[RESOLVED in v0.1.0] Shows duplicate autocomplete recommendations.

This appears to happen when you add contacts and then query them in the same session. A workaround is to exit and re-launch Neovim.

[RESOLVED in v0.1.0] Highlighting does not initialize on lazy loading.

This appears to happen when lazy loading with Lazy.nvim. A workaround is to set lazy = false in opts.

  • Only highlighting is affected here. Other functionality is unaffected.

Highlighting does not intiialize some org-roam files.

This appears to happen when a new org-roam file is created via org-roam-capture. This resolves when Neovim is restarted.

  • Only highlighting is affected here. Other functionality is unaffected.

πŸ† Acknowledgements

About

Contact management and autocomplete system for Neovim.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages