Skip to content

protex/better-digraphs.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Better Digraphs

Digraphs are incredibly useful, but oftentimes hard to remember. The h digraph-table and h digaph-table-mbyte entries are helpful, but cumbersome and their usage tends to interrupt the natural flow that every nvim user aspires to. Enter better-digraphs, a plugin that improves the digraph experience in nvim by adding the contents of the digraph-table-mbyte to a telescope finder.

Example

example.mov

Installation

Requires Neovim >= 0.7
Using vim plug

Plug 'nvim-telescope/telescope.nvim'
Plug 'protex/better-digraphs.nvim'

Usage

The recommended mappings for this plugin are the following:

inoremap <C-k><C-k> <Cmd>lua require'better-digraphs'.digraphs("insert")<CR>
nnoremap r<C-k><C-k> <Cmd>lua require'better-digraphs'.digraphs("normal")<CR>
vnoremap r<C-k><C-k> <ESC><Cmd>lua require'better-digraphs'.digraphs("visual")<CR>

This will allow the usage of the normal <C-k> in insert mode, single character replace, and multiple character replace, but allows you to quickly pull up the search if you can't remember the digraph you're looking for. The search will allow you to fuzzy search by either digraph shortcut (OK for ✓) or official name ("CHECK MARK" for ✓).

What if I've re-mapped to something else

You can change the command sequence that better digraphs uses to enter digraph mode. ( is helpful for creating the proper control characters)

vim.g.digraph_map_sequences = {
  insert = "",
  normal = "",
  visual = ""
}

Adding or modifying digraphs

Adding or modifying digraphs can be done by setting the vim.g.BetterDigraphsAdditions variable

Example

Modifying the OK (✓) digraph to be *, and adding a new zz digraph that maps to Z:

vim.g.BetterDigraphsAdditions = {
  {
    digraph = "OK",
    symbol = "*",
    name = "NEW STAR"
  },
  {
    digraph = "zz",
    symbol = "Z",
    name = "CAPITAL Z"
  }
}

About

Better digraphs plugin based on idea from Damian Conway

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5