simonw / llm

Access large language models from the command-line
https://llm.datasette.io
Apache License 2.0
3.43k stars 176 forks source link

backslash cannot be used in `llm chat` #516

Open grota opened 1 week ago

grota commented 1 week ago

Hopefully this is not something stupid on my part, but I cannot seem to be able to use the backslash \ in llm chat (not in single nor in multiline mode). Both typing interactively and pasting text have this problem; in the latter case the backslash is simply taken out.

As you can imagine this is problematic when pasting code.

The workaround is to use a literal Ctrl-v before \ then it appears, but when the prompt is long, with snippets of code, I have to open a scratch buffer in the editor and prefix each backslash with a literal Ctrl-v char which is error prone and something that in principle should not be asked to the user (in neovim you can type ctrl-v twice in insert mode).

llm prompt does not seem to have this problem.