1

I developed prompter.vim, a vim plugin that autocomplete buffer text using LLMs completions. The completion is a multi-line text insertion appended at the end to the buffer.

I would like to have completion text optionally justified in a fixed width of columns (say 80). This would be like :set textwidth=80, except with a soft wrap.

Well, a workaround could be to reformat the inserted text entering gqG, but this solution inserts newlines and modifies the text.

Instead I would like a soft-wrap "non-invasive" solution that only modifies the visual appearance.

1
  • 1
    You could add a vertical buffer and make sure the initial buffer has a width of 80 columns? Commented Sep 11, 2023 at 20:05

2 Answers 2

2

I have found that vim post-9.0 patches and nvim 0.10.0 have an inline virtual-text feature to realize this. I implemented a plugin. Hope to help you.

0

There is no simple way to wrap at a specific column. You can soft-wrap at the edge of a window (:set wrap), or hard-wrap (e.g., with gq as mentioned), or write some code to do something "funky" (like using a second window purely to control wrapping…).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.