tanloong/interlaced.nvim

github github
language
stars 6
issues 0
subscribers 1
forks 0
CREATED

2023-08-09

UPDATED

2 months ago


interlaced.nvim

Join/split current line to align bilingual sentence pairs.

Features

Requirements

  • Neovim >= 0.9.0

Installation

{
  'tanloong/interlaced.nvim',
  config = function()
    require("interlaced").setup()
    -- or setup with your own config (see Configuration in README)
    -- require("interlaced").setup(config)
  end,
  ft = "text",
},

Configuration

Bellow is a linked snippet with the default values.

https://github.com/tanloong/interlaced.nvim/blob/a74a72dcfc3a4a5208ace8cfbcf8c182e779c4fa/lua/interlaced/config.lua#L1-L18

Commands

  • SplitEnglishSentences and SplitChineseSentences: These commands are used for sentence segmentation in a monolingual buffer. It is important to note that they may not handle all cases perfectly, as they use simple regex patterns to identify sentence boundaries. For more accurate splitting, it is recommended to use an NLP tool. However, if you just want a quick and not-that-accurate splitting, these commands can be helpful.

  • MapInterlaced and UnmapInterlaced: MapInterlaced sets keybindings for text manipulations; UnmapInterlaced restores them to their previous mappings, if any.

  • InterlaceWithL1 and InterlaceWithL2: Take lines from the current buffer and interlaces them with lines from a specified file, forming an array of (l1, l2) pairs. These commands also filter out any empty lines from both the buffer and the file to ensure that only non-empty lines are interlaced. The resulting interlaced text is then saved to a new file and opened for further editing. After openning the interlaced file, keybindings are setup if they have not been previously.