No description
Find a file
2026-04-12 01:24:59 +02:00
lua/rephrase fix: use strdisplaywidth for multibyte/unicode safety 2026-04-12 01:10:38 +02:00
.luarc.json.c Initial commit 2026-02-09 23:18:55 +01:00
README.md docs: add README.md content 2026-04-12 01:24:59 +02:00

nvim-rephrase

LSP rename with a live preview. Changes are reflected across all visible occurrences as you type.

Requires an LSP that supports textDocument/rename, only tested on Neovim 0.12+.

Installation

lazy.nvim

{ 
  "LarssonMartin1998/nvim-rephrase",
  opts = {},
  keys = {
    { "grn", "<cmd>Rephrase<cr>" },
  },
}

vim.pack

vim.pack.add({
  "https://github.com/LarssonMartin1998/nvim-rephrase",
})
require("rephrase").setup({})
vim.keymap.set("n", "grn", "<cmd>Rephrase<cr>", {})

Default keys inside the float:

Key Action
<CR> / <C-j> Submit rename
<Esc> / q Cancel

Configuration

Default config:

require("rephrase").setup({
    -- Open the float with an empty input instead of pre-filling the current word.
    open_empty = {
        enabled = false,
        -- When open_empty is enabled, also start the live preview with nothing
        -- substituted, so the original word remains visible until you start typing.
        start_live_preview_empty = true,
    },

    -- Mode to enter when the float opens.
    -- rephrase.StartMode.NORMAL | INSERT | SELECT
    start_mode = require("rephrase").StartMode.SELECT,

    -- Where to place the cursor inside the float.
    -- rephrase.CursorPos.START | END | KEEP
    -- KEEP preserves your offset within the word at the time of invocation.
    cursor_pos = require("rephrase").CursorPos.START,
})