|
1 | | -*codecompanion.txt* For NVIM v0.11 Last change: 2025 November 19 |
| 1 | +*codecompanion.txt* For NVIM v0.11 Last change: 2025 November 24 |
2 | 2 |
|
3 | 3 | ============================================================================== |
4 | 4 | Table of Contents *codecompanion-table-of-contents* |
@@ -878,10 +878,9 @@ The configuration for both types of adapters is exactly the same, however they |
878 | 878 | sit within their own tables (`adapters.http.*` and `adapters.acp.*`) and have |
879 | 879 | different options available. HTTP adapters use `models` to allow users to |
880 | 880 | select the specific LLM they’d like to interact with. ACP adapters use |
881 | | -`commands` to allow users to customize their interaction with agents |
882 | | -(e.g. enabling `yolo` mode). As there is a lot of shared functionality between |
883 | | -the two adapters, it is recommend that you read this page alongside the ACP |
884 | | -one. |
| 881 | +`commands` to allow users to customize their interaction with agents (e.g.� |
| 882 | +enabling `yolo` mode). As there is a lot of shared functionality between the |
| 883 | +two adapters, it is recommend that you read this page alongside the ACP one. |
885 | 884 |
|
886 | 885 |
|
887 | 886 | CHANGING THE DEFAULT ADAPTER ~ |
@@ -913,7 +912,7 @@ the adapter’s URL, headers, parameters and other fields at runtime. |
913 | 912 |
|
914 | 913 | Supported `env` value types: - **Plain environment variable name (string)**: if |
915 | 914 | the value is the name of an environment variable that has already been set |
916 | | -(e.g. `"HOME"` or `"GEMINI_API_KEY"`), the plugin will read the value. - |
| 915 | +(e.g.� `"HOME"` or `"GEMINI_API_KEY"`), the plugin will read the value. - |
917 | 916 | **Command (string prefixed with cmd:)**: any value that starts with `cmd:` will |
918 | 917 | be executed via the shell. Example: `"cmd:op read |
919 | 918 | op://personal/Gemini/credential --no-newline"`. - **Function**: you can provide |
@@ -1867,69 +1866,9 @@ utilize the `insert_edit_into_file` tool, then the plugin can update files and |
1867 | 1866 | buffers and a diff will be created so you can see the changes made by the LLM. |
1868 | 1867 | The `inline` is the default diff. |
1869 | 1868 |
|
1870 | | -There are a number of diff settings available to you: |
| 1869 | +Depending on which provider you choose, there are different configuration |
| 1870 | +options available to you: |
1871 | 1871 |
|
1872 | | ->lua |
1873 | | - require("codecompanion").setup({ |
1874 | | - display = { |
1875 | | - diff = { |
1876 | | - enabled = true, |
1877 | | - provider = providers.diff, -- mini_diff|split|inline |
1878 | | - |
1879 | | - provider_opts = { |
1880 | | - -- Options for inline diff provider |
1881 | | - inline = { |
1882 | | - layout = "float", -- float|buffer - Where to display the diff |
1883 | | - |
1884 | | - diff_signs = { |
1885 | | - signs = { |
1886 | | - text = "▌", -- Sign text for normal changes |
1887 | | - reject = "✗", -- Sign text for rejected changes in super_diff |
1888 | | - highlight_groups = { |
1889 | | - addition = "DiagnosticOk", |
1890 | | - deletion = "DiagnosticError", |
1891 | | - modification = "DiagnosticWarn", |
1892 | | - }, |
1893 | | - }, |
1894 | | - -- Super Diff options |
1895 | | - icons = { |
1896 | | - accepted = " ", |
1897 | | - rejected = " ", |
1898 | | - }, |
1899 | | - colors = { |
1900 | | - accepted = "DiagnosticOk", |
1901 | | - rejected = "DiagnosticError", |
1902 | | - }, |
1903 | | - }, |
1904 | | - |
1905 | | - opts = { |
1906 | | - context_lines = 3, -- Number of context lines in hunks |
1907 | | - dim = 25, -- Background dim level for floating diff (0-100, [100 full transparent], only applies when layout = "float") |
1908 | | - full_width_removed = true, -- Make removed lines span full width |
1909 | | - show_keymap_hints = true, -- Show "gda: accept | gdr: reject" hints above diff |
1910 | | - show_removed = true, -- Show removed lines as virtual text |
1911 | | - }, |
1912 | | - }, |
1913 | | - |
1914 | | - -- Options for the split provider |
1915 | | - split = { |
1916 | | - close_chat_at = 240, -- Close an open chat buffer if the total columns of your display are less than... |
1917 | | - layout = "vertical", -- vertical|horizontal split |
1918 | | - opts = { |
1919 | | - "internal", |
1920 | | - "filler", |
1921 | | - "closeoff", |
1922 | | - "algorithm:histogram", -- https://adamj.eu/tech/2024/01/18/git-improve-diff-histogram/ |
1923 | | - "indent-heuristic", -- https://blog.k-nut.eu/better-git-diffs |
1924 | | - "followwrap", |
1925 | | - "linematch:120", |
1926 | | - }, |
1927 | | - }, |
1928 | | - }, |
1929 | | - }, |
1930 | | - }, |
1931 | | - }) |
1932 | | -< |
1933 | 1872 |
|
1934 | 1873 | You can also customize the window that the diff appears in (taking precedence |
1935 | 1874 | over `child_window`): |
@@ -2214,8 +2153,26 @@ The inline assistant supports keymaps for accepting or rejecting changes: |
2214 | 2153 | }) |
2215 | 2154 | < |
2216 | 2155 |
|
2217 | | -In this example, `<leader>a` (or `ga` on some keyboards) accepts inline |
2218 | | -changes, while `gr` rejects them. |
| 2156 | +In this example, `ga` accepts inline changes, while `gr` rejects them. |
| 2157 | + |
| 2158 | +You can also cancel an inline request with: |
| 2159 | + |
| 2160 | +>lua |
| 2161 | + require("codecompanion").setup({ |
| 2162 | + strategies = { |
| 2163 | + inline = { |
| 2164 | + keymaps = { |
| 2165 | + stop = { |
| 2166 | + modes = { n = "q" }, |
| 2167 | + index = 4, |
| 2168 | + callback = "keymaps.stop", |
| 2169 | + description = "Stop request", |
| 2170 | + }, |
| 2171 | + }, |
| 2172 | + }, |
| 2173 | + }, |
| 2174 | + }) |
| 2175 | +< |
2219 | 2176 |
|
2220 | 2177 |
|
2221 | 2178 | VARIABLES ~ |
@@ -2952,7 +2909,7 @@ The fastest way to copy an LLM’s code output is with `gy`. This will yank the |
2952 | 2909 | nearest codeblock. |
2953 | 2910 |
|
2954 | 2911 |
|
2955 | | -APPLYING AN LLM’S EDITS TO A BUFFER OR FILE ~ |
| 2912 | +APPLYING AN LLM�S EDITS TO A BUFFER OR FILE ~ |
2956 | 2913 |
|
2957 | 2914 | The |codecompanion-usage-chat-buffer-tools-files| tool, combined with the |
2958 | 2915 | |codecompanion-usage-chat-buffer-variables.html-buffer| variable or |
@@ -5020,7 +4977,7 @@ These handlers manage tool/function calling: |
5020 | 4977 | as a great reference to understand how they’re working with the output of the |
5021 | 4978 | API |
5022 | 4979 |
|
5023 | | -OPENAI’S API OUTPUT |
| 4980 | +OPENAI�S API OUTPUT |
5024 | 4981 |
|
5025 | 4982 | If we reference the OpenAI documentation |
5026 | 4983 | <https://platform.openai.com/docs/guides/text-generation/chat-completions-api> |
@@ -6927,7 +6884,7 @@ tool to function. In the case of Anthropic, we insert additional headers. |
6927 | 6884 | < |
6928 | 6885 |
|
6929 | 6886 | Some adapter tools can be a `hybrid` in terms of their implementation. That is, |
6930 | | -they’re an adapter tool that requires a client-side component (i.e. a |
| 6887 | +they’re an adapter tool that requires a client-side component (i.e.� a |
6931 | 6888 | built-in tool). This is the case for the |
6932 | 6889 | |codecompanion-usage-chat-buffer-tools-memory| tool from Anthropic. To allow |
6933 | 6890 | for this, ensure that the tool definition in `available_tools` has |
|
0 commit comments