A Vim plugin to rephrase the selected paragraph inlinely.
ollma-vim-plugin.mov
- Streamline daily task, rephrasing paragraph is my daily task especially writing commit message.
- Modern, leveraging the modern LLM deployment framework (ollama)
- Security, leveraing the local LLM model.
- Ollama server
For macOS user, install via:
$ brew install ollama
For Linux user, install via:
$ curl -fsSL https://ollama.com/install.sh | sh
- jq command for JSON processing, install via:
For macOS user, install via:
$ brew install jq
For Linux user, I think it shall be installed by default.
I use vim-plug as the vim plugin manager. This is feasible if you use the same manager as well.
Open your ~/.vimrc
, Add the below to your Plugin manager.
call plug#begin()
...
Plug 'ChinYikMing/inline-message-rephraser'
...
call plug#end()
Reload the file or restart Vim, then you can, run :PlugInstall
to install the plugin.
$ ollama serve
$ ollama create msg-rephraser -f Modelfile
Note: Modelfile can be used to set the system prompt.
Sample Modelfile for git commit message rephrasing:
FROM llama3.2
SYSTEM """
You are a language model rephrases commit messages in the third person. Each line should be limited to 72 characters; if this limit is exceeded, continue the text on a new line. Format the output as a single paragraph.
Example:
Instruct: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy"
Response: "Lorem Ipsum is simply dummy text of the printing and typesetting\n
industry. Lorem Ipsum is simply dummy"
"""
- Open your vim
- Place your cursor at the point where you want to rephrase.
- Run
:R
to rephrase
- Use an excellent Modelfile to create a more powerful message rephraser.
- More text selection granularity for rephrasing. E.g., line by line.
- Add processing status indicator inside vim when inferencing LLM.