Skip to content

8ta4/word

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 

Repository files navigation

word

Her Words, Not Mine

What's word?

word is a Neovim plugin that generates sentence-by-sentence rewrites.

Setup

How do I set up word?

  1. Make sure you're using a Mac.

  2. Install Homebrew.

  3. Make sure you're using Alacritty.

  4. Make sure you're using lazy.nvim.

  5. Open a terminal.

  6. Merge these bindings into your Alacritty configuration:

    [keyboard]
    bindings = [
      { chars = "\u001bf", key = "F", mods = "Command" },
      { chars = "\u001bj", key = "J", mods = "Command" },
      { chars = "\u001bk", key = "K", mods = "Command" },
    ]
  7. Add this block to your lazy.nvim configuration:

    {
      "8ta4/word",
      build = "./install.sh",
      dependencies = {
        "8ta4/sentence",
        build = "./install.sh",
      },
      keys = {
        { "<M-f>", function() require('word').suggest() end, mode = {"n", "i", "v"} },
        { "<M-j>", function() require('word').apply(2) end, mode = {"n", "i", "v"} },
        { "<M-k>", function() require('word').apply(1) end, mode = {"n", "i", "v"} },
      },
      opts = {
        styles = {
          { name = "casual", prompt = "Use a casual tone. Use correct grammar. Check if the sentence meets these requirements. Explain any failures. Give two rewrites of the sentence. Do not rewrite the context." },
        },
      },
    }
  8. Run the following commands:

    brew install node
    npm install -g neovim
    nvim --headless +UpdateRemotePlugins +qa!
    mkdir -p ~/.config/word/
  9. Copy an API key from the Cerebras website.

  10. Run this command:

    pbpaste > ~/.config/word/cerebras

Usage

Is the prompt I specify a system prompt or a user prompt?

The prompt is a system prompt.

How do I get suggestions from Normal mode?

Press ⌘ + f. Think fix.

How do I apply the first suggestion from Normal mode?

Press ⌘ + k. Vim uses k for up.

How do I apply the second suggestion from Normal mode?

Press ⌘ + j. Vim uses j for down.

Can I generate suggestions for multiple sentences at once?

Yes. Select the text in Visual mode and press ⌘ + f. You don't even have to select the whole sentence. As long as your selection touches part of a sentence, word rewrites the entire sentence.

Can I add more styles?

Yes.

  1. Add the number keybindings to your Alacritty configuration:

    [keyboard]
    bindings = [
      { chars = "\u001b1", key = "Key1", mods = "Command" },
      { chars = "\u001b2", key = "Key2", mods = "Command" },
      { chars = "\u001bf", key = "F", mods = "Command" },
      { chars = "\u001bj", key = "J", mods = "Command" },
      { chars = "\u001bk", key = "K", mods = "Command" },
    ]
  2. Add the number keybindings and the second style to your lazy.nvim configuration:

    local base = " Use correct grammar. Check if the sentence meets these requirements. Explain any failures. Give two rewrites of the sentence. Do not rewrite the context."
    
    {
      "8ta4/word",
      build = "./install.sh",
      dependencies = {
        "8ta4/sentence",
        build = "./install.sh",
      },
      keys = {
        { "<M-1>", function() require('word').style(1) end, mode = {"n", "i", "v"} },
        { "<M-2>", function() require('word').style(2) end, mode = {"n", "i", "v"} },
        { "<M-f>", function() require('word').suggest() end, mode = {"n", "i", "v"} },
        { "<M-j>", function() require('word').apply(2) end, mode = {"n", "i", "v"} },
        { "<M-k>", function() require('word').apply(1) end, mode = {"n", "i", "v"} },
      },
      opts = {
        styles = {
          { name = "casual", prompt = "Use a casual tone." .. base },
          { name = "formal", prompt = "Use a formal tone." .. base },
        },
      },
    }

How do I select the second style in the configuration?

Press ⌘ + 2. It picks the second entry in your styles list.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors