README.md
raw
1# llm.vim
2
3Asynchronous Vim plugin for Ollama LLMs.
4
5## Features
6- **Code Completion & Refactoring (`<leader>l`)**: Replaces or appends code using the File Skeleton and Local Context as prompts.
7- **Conversational Questions (`<leader>k`)**: Opens a vertical right-split scratch buffer (`ft=markdown`) for queries.
8- **Model Management (`:LLMModel`)**: Command with tab-completion for switching `g:llm_model` based on local Ollama tags.
9- **Asynchronous Execution**: Uses Vim 8 jobs and temporary files for non-blocking I/O.
10- **Indentation Aware**: Uses Vim's `=` operator on inserted code.
11
12## Installation
13```vim
14Plug 'mitjafelicijan/llm.vim'
15```
16
17## Configuration
18Override defaults in your `.vimrc`:
19
20Check for available models https://ollama.com/search.
21
22```vim
23let g:llm_model = 'granite4.1:3b'
24let g:llm_url = 'http://127.0.0.1:11434'
25```
26
27### Custom Mappings
28To disable default mappings and define your own, set `g:llm_disable_mappings` and use the following functions:
29
30```vim
31let g:llm_disable_mappings = 1
32
33" Normal mode question
34nnoremap <C-k> :call llm#AskQuestion(0)<CR>
35" Visual mode question
36xnoremap <C-k> :<C-u>call llm#AskQuestion(1)<CR>
37" Visual mode completion
38xnoremap <C-l> :<C-u>call llm#RequestCompletion(1)<CR>
39```
40
41## Mappings & Commands (Defaults)
42- `<leader>l` (Visual): Refactor or replace selection.
43- `<leader>k` (Normal/Visual): Open `[LLM Answer]` buffer on the right.
44- `:LLMModel`: Switch `g:llm_model`. Supports `<Tab>` completion via Ollama API.