[GH-ISSUE #7937] Using from Vim gives weird characters #51590

Closed
opened 2026-04-28 20:36:48 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @gwpl on GitHub (Dec 5, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7937

What is the issue?

When pipeing text from Vim and wanting result e.g. :

Example:
tomato
End.

When running in vim to pipe second line to make a joke :2!ollama run smollm2:135m 'joke about'
then it shows weird characters in Vim:

2024-12-05--01-38-21_Screenshot

However if I run from terminal like thisl:

echo tomato | ollamasmollm2_135m 'joke about' | vim -

Then I see properly clear text in Vim.

OS

Linux

GPU

No response

CPU

No response

Ollama version

ollama version is 0.4.6

Originally created by @gwpl on GitHub (Dec 5, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7937 ### What is the issue? When pipeing text from Vim and wanting result e.g. : ``` Example: tomato End. ``` When running in vim to pipe second line to make a joke `:2!ollama run smollm2:135m 'joke about'` then it shows weird characters in Vim: ![2024-12-05--01-38-21_Screenshot](https://github.com/user-attachments/assets/38097475-3a69-4463-b6d9-fd78d48eee26) However if I run from terminal like thisl: ``` echo tomato | ollamasmollm2_135m 'joke about' | vim - ``` Then I see properly clear text in Vim. ### OS Linux ### GPU _No response_ ### CPU _No response_ ### Ollama version ollama version is 0.4.6
GiteaMirror added the bug label 2026-04-28 20:36:48 -05:00
Author
Owner

@rick-github commented on GitHub (Dec 5, 2024):

vim is capturing stderr which has the spinner output.

Related: https://github.com/ollama/ollama/issues/7820

You can work around this by closing stderr:

:2!ollama run smollm2:135m 'joke about' 2>&-

Or creating a shell script:

#!/bin/bash
ollama run smollm2:135m 'joke about' 2>&-

:2!./smol

<!-- gh-comment-id:2518858100 --> @rick-github commented on GitHub (Dec 5, 2024): vim is capturing stderr which has the spinner output. Related: https://github.com/ollama/ollama/issues/7820 You can work around this by closing stderr: `:2!ollama run smollm2:135m 'joke about' 2>&-` Or creating a shell script: ```sh #!/bin/bash ollama run smollm2:135m 'joke about' 2>&- ``` `:2!./smol`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#51590