Vim plugin for LLM-assisted code/text completion
Vim Script
2,185
108 commits
updated Sep 29, 2026
https://github.com/user-attachments/assets/641a6e72-f1a2-4fe5-b0fd-c2597c6f4cdc
https://github.com/user-attachments/assets/68bff15b-2d91-4800-985d-b7f110a0ccb7
Insert modeTabShift+Tab<leader>llivim-plug
Plug 'ggml-org/llama.vim'
Vundle
cd ~/.vim/bundle
git clone https://github.com/ggml-org/llama.vim
Then add Plugin 'llama.vim' to your .vimrc in the vundle#begin() section.
lazy.nvim
{
'ggml-org/llama.vim',
}
You can customize llama.vim by setting the g:llama_config variable.
Examples:
Disable the inline info:
" put before llama.vim loads
let g:llama_config = { 'show_info': 0 }
Same thing but setting directly
let g:llama_config.show_info = v:false
Disable auto FIM (Fill-In-the-Middle) completion with lazy.nvim
{
'ggml-org/llama.vim',
init = function()
vim.g.llama_config = {
auto_fim = false,
}
end,
}
Configure FIM keymaps:
let g:llama_config.keymap_fim_trigger = "<leader>llf"
let g:llama_config.keymap_fim_accept_full = "<Tab>"
let g:llama_config.keymap_fim_accept_line = "<S-Tab>"
let g:llama_config.keymap_fim_accept_word = "<leader>ll]"
Configure instruction-based editing keymaps
let g:llama_config.keymap_inst_trigger = "<leader>lli"
let g:llama_config.keymap_inst_rerun = "<leader>llr"
let g:llama_config.keymap_inst_continue = "<leader>llc"
let g:llama_config.keymap_inst_accept = "<Tab>"
let g:llama_config.keymap_inst_cancel = "<Esc>"
Configure named llama.cpp servers:
let g:llama_config.profiles = {
\ 'spark': 'http://192.168.0.66:8080',
\ 'gmktec': 'http://192.168.0.65:8080',
\ }
let g:llama_config.profile = 'spark'
Use :LlamaProfile to show the available profiles and :LlamaProfile spark
to switch both FIM and instruction requests to another server. Profile names
support command-line completion. The selected profile is persisted and
:LlamaProfileReset can be used to restore the profile (or custom endpoints)
configured in .vimrc.
This only allows the host servers to be specified, not the models used which are
configured using model_fim and model_inst. But using consistent naming
accross servers, or using server aliases, one can make this independant of the
actual selected profile. For example, using something like:
\ 'model_fim': 'fim_model',
\ 'model_inst': 'inst_model',
And then in the server configuration, something like the following can be used:
[qwen3.8-27B]
alias = inst_model,pi
And likewise for the fim_model.
Please refer to :help llama_config or the source
for the full list of options.
The plugin requires a llama.cpp server instance to be running at g:llama_config.endpoint_fim and/or g:llama_config.endpoint_inst.
brew install llama.cpp
winget install llama.cpp
Either build from source or use the latest binaries: https://github.com/ggml-org/llama.cpp/releases
Here are recommended settings, depending on the amount of VRAM that you have:
More than 64GB VRAM:
llama-server --fim-qwen-30b-default
More than 16GB VRAM:
llama-server --fim-qwen-7b-default
Less than 16GB VRAM:
llama-server --fim-qwen-3b-default
Less than 8GB VRAM:
llama-server --fim-qwen-1.5b-default
Use :help llama for more details.
The plugin requires FIM-compatible models: HF collection
llama.vim on M1 Pro (2021) with Qwen2.5-Coder 1.5B Q8_0:The orange text is the generated suggestion. The green text contains performance stats for the FIM request: the currently used context is 15186 tokens and the maximum is 32768. There are 30 chunks in the ring buffer with extra context (out of 64). So far, 1 chunk has been evicted in the current session and there are 0 chunks in queue. The newly computed prompt tokens for this request were 260 and the generated tokens were 24. It took 1245 ms to generate this suggestion after entering the letter c on the current line.
llama.vim on M2 Ultra with Qwen2.5-Coder 7B Q8_0:https://github.com/user-attachments/assets/1f1eb408-8ac2-4bd2-b2cf-6ab7d6816754
Demonstrates that the global context is accumulated and maintained across different files and showcases the overall latency when working in a large codebase.
The plugin aims to be very simple and lightweight and at the same time to provide high-quality and performant local FIM completions, even on consumer-grade hardware. Read more on how this is achieved in the following links:
(top 24 of 49)
11,397 followers · starred Feb 2025
32,138 followers · starred Aug 2025
13,895 followers · starred Jan 2025
1,195 followers · starred Jan 2025
Vim plugin for LLM-assisted code/text completion
Vim Script
2,185
108 commits
updated Sep 29, 2026
https://github.com/user-attachments/assets/641a6e72-f1a2-4fe5-b0fd-c2597c6f4cdc
https://github.com/user-attachments/assets/68bff15b-2d91-4800-985d-b7f110a0ccb7
Insert modeTabShift+Tab<leader>llivim-plug
Plug 'ggml-org/llama.vim'
Vundle
cd ~/.vim/bundle
git clone https://github.com/ggml-org/llama.vim
Then add Plugin 'llama.vim' to your .vimrc in the vundle#begin() section.
lazy.nvim
{
'ggml-org/llama.vim',
}
You can customize llama.vim by setting the g:llama_config variable.
Examples:
Disable the inline info:
" put before llama.vim loads
let g:llama_config = { 'show_info': 0 }
Same thing but setting directly
let g:llama_config.show_info = v:false
Disable auto FIM (Fill-In-the-Middle) completion with lazy.nvim
{
'ggml-org/llama.vim',
init = function()
vim.g.llama_config = {
auto_fim = false,
}
end,
}
Configure FIM keymaps:
let g:llama_config.keymap_fim_trigger = "<leader>llf"
let g:llama_config.keymap_fim_accept_full = "<Tab>"
let g:llama_config.keymap_fim_accept_line = "<S-Tab>"
let g:llama_config.keymap_fim_accept_word = "<leader>ll]"
Configure instruction-based editing keymaps
let g:llama_config.keymap_inst_trigger = "<leader>lli"
let g:llama_config.keymap_inst_rerun = "<leader>llr"
let g:llama_config.keymap_inst_continue = "<leader>llc"
let g:llama_config.keymap_inst_accept = "<Tab>"
let g:llama_config.keymap_inst_cancel = "<Esc>"
Configure named llama.cpp servers:
let g:llama_config.profiles = {
\ 'spark': 'http://192.168.0.66:8080',
\ 'gmktec': 'http://192.168.0.65:8080',
\ }
let g:llama_config.profile = 'spark'
Use :LlamaProfile to show the available profiles and :LlamaProfile spark
to switch both FIM and instruction requests to another server. Profile names
support command-line completion. The selected profile is persisted and
:LlamaProfileReset can be used to restore the profile (or custom endpoints)
configured in .vimrc.
This only allows the host servers to be specified, not the models used which are
configured using model_fim and model_inst. But using consistent naming
accross servers, or using server aliases, one can make this independant of the
actual selected profile. For example, using something like:
\ 'model_fim': 'fim_model',
\ 'model_inst': 'inst_model',
And then in the server configuration, something like the following can be used:
[qwen3.8-27B]
alias = inst_model,pi
And likewise for the fim_model.
Please refer to :help llama_config or the source
for the full list of options.
The plugin requires a llama.cpp server instance to be running at g:llama_config.endpoint_fim and/or g:llama_config.endpoint_inst.
brew install llama.cpp
winget install llama.cpp
Either build from source or use the latest binaries: https://github.com/ggml-org/llama.cpp/releases
Here are recommended settings, depending on the amount of VRAM that you have:
More than 64GB VRAM:
llama-server --fim-qwen-30b-default
More than 16GB VRAM:
llama-server --fim-qwen-7b-default
Less than 16GB VRAM:
llama-server --fim-qwen-3b-default
Less than 8GB VRAM:
llama-server --fim-qwen-1.5b-default
Use :help llama for more details.
The plugin requires FIM-compatible models: HF collection
llama.vim on M1 Pro (2021) with Qwen2.5-Coder 1.5B Q8_0:The orange text is the generated suggestion. The green text contains performance stats for the FIM request: the currently used context is 15186 tokens and the maximum is 32768. There are 30 chunks in the ring buffer with extra context (out of 64). So far, 1 chunk has been evicted in the current session and there are 0 chunks in queue. The newly computed prompt tokens for this request were 260 and the generated tokens were 24. It took 1245 ms to generate this suggestion after entering the letter c on the current line.
llama.vim on M2 Ultra with Qwen2.5-Coder 7B Q8_0:https://github.com/user-attachments/assets/1f1eb408-8ac2-4bd2-b2cf-6ab7d6816754
Demonstrates that the global context is accumulated and maintained across different files and showcases the overall latency when working in a large codebase.
The plugin aims to be very simple and lightweight and at the same time to provide high-quality and performant local FIM completions, even on consumer-grade hardware. Read more on how this is achieved in the following links:
(top 24 of 49)
11,397 followers · starred Feb 2025
32,138 followers · starred Aug 2025
13,895 followers · starred Jan 2025
1,195 followers · starred Jan 2025