doc/llm.txt raw
 1*llm.txt*   Asynchronous LLM interaction for Vim
 2
 3==============================================================================
 4INTRODUCTION                                                   *llm-introduction*
 5
 6llm.vim is a plugin that allows you to interact with local Large Language
 7Models via Ollama. It supports code completion, refactoring, and general
 8questions, all handled asynchronously to keep Vim responsive.
 9
10==============================================================================
11MAPPINGS                                                       *llm-mappings*
12
13<leader>l           (Visual Mode)
14                    Uses the selected text as context and prompts for an
15                    instruction (e.g., "refactor this"). The selection is
16                    replaced with the LLM's response.
17
18<leader>k           (Normal or Visual Mode)
19                    Opens a vertical split on the right named "[LLM Answer]"
20                    and prompts for a question. The buffer uses Markdown
21                    formatting and is cleared for each new question.
22
23==============================================================================
24COMMANDS                                                        *llm-commands*
25
26:LLMModel [model]                                               *:LLMModel*
27                    Switch the current model (|g:llm_model|).
28                    Supports custom tab-completion for all locally
29                    available Ollama models. If called without arguments,
30                    it displays the current model.
31
32==============================================================================
33CONFIGURATION                                                   *llm-config*
34
35The following variables can be set in your |.vimrc| to override defaults:
36
37g:llm_model                                                 *g:llm_model*
38    The Ollama model name to use.
39    Default: 'granite4.1:3b'
40
41g:llm_url                                                   *g:llm_url*
42    The base URL for the Ollama API.
43    Default: 'http://127.0.0.1:11434'
44
45g:llm_system_prompt_question                   *g:llm_system_prompt_question*
46    The system prompt used for general questions.
47
48g:llm_visual_task_prompt                       *g:llm_visual_task_prompt*
49    The prompt used for code replacement in visual mode.
50
51g:llm_disable_mappings                       *g:llm_disable_mappings*
52    If set to 1, the default mappings for <leader>l and <leader>k are
53    not defined.
54    Default: 0
55
56==============================================================================
57CUSTOM MAPPINGS                                           *llm-custom-mappings*
58
59If you disable default mappings, you can define your own using the
60following functions:
61
62    llm#AskQuestion(is_visual)
63    llm#RequestCompletion(is_visual)
64
65Example:
66>
67    let g:llm_disable_mappings = 1
68    nnoremap <C-k> :call llm#AskQuestion(0)<CR>
69    xnoremap <C-k> :<C-u>call llm#AskQuestion(1)<CR>
70    xnoremap <C-l> :<C-u>call llm#RequestCompletion(1)<CR>
71<
72==============================================================================
73vim:tw=78:ts=8:ft=help:norl: