5 Star 6 Fork 1

Gitee 极速下载/codeium-vim

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/Exafunction/codeium.vim
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Windsurf


Discord Twitter Follow License Docs Canny Board built with Windsurf

Visual Studio JetBrains Open VSX Google Chrome

windsurf.vim

Free, ultrafast Copilot alternative for Vim and Neovim

Windsurf autocompletes your code with AI in all major IDEs. We launched this implementation of the Windsurf plugin for Vim and Neovim to bring this modern coding superpower to more developers. Check out our playground if you want to quickly try out Windsurf online.

Contributions are welcome! Feel free to submit pull requests and issues related to the plugin.


Example


🚀 Getting started

  1. Install Vim (at least 9.0.0185) or Neovim (at least 0.6)

  2. Install Exafunction/windsurf.vim using your vim plugin manager of choice, or manually. See Installation Options below.

  3. Run :Codeium Auth to set up the plugin and start using Windsurf.

You can run :help codeium for a full list of commands and configuration options, or see this guide for a quick tutorial on how to use Windsurf.

🛠️ Configuration

For a full list of configuration options you can run :help codeium. A few of the most popular options are highlighted below.

⌨️ Keybindings

Windsurf provides the following functions to control suggestions:

Action Function Default Binding
Clear current suggestion codeium#Clear() <C-]>
Next suggestion codeium#CycleCompletions(1) <M-]>
Previous suggestion codeium#CycleCompletions(-1) <M-[>
Insert suggestion codeium#Accept() <Tab>
Manually trigger suggestion codeium#Complete() <M-Bslash>
Accept word from suggestion codeium#AcceptNextWord() <C-k>
Accept line from suggestion codeium#AcceptNextLine() <C-l>

Windsurf's default keybindings can be disabled by setting

let g:codeium_disable_bindings = 1

or in Neovim:

vim.g.codeium_disable_bindings = 1

If you'd like to just disable the <Tab> binding, you can alternatively use the g:codeium_no_map_tab option.

If you'd like to bind the actions above to different keys, this might look something like the following in Vim:

imap <script><silent><nowait><expr> <C-g> codeium#Accept()
imap <script><silent><nowait><expr> <C-h> codeium#AcceptNextWord()
imap <script><silent><nowait><expr> <C-j> codeium#AcceptNextLine()
imap <C-;>   <Cmd>call codeium#CycleCompletions(1)<CR>
imap <C-,>   <Cmd>call codeium#CycleCompletions(-1)<CR>
imap <C-x>   <Cmd>call codeium#Clear()<CR>

Or in Neovim (using wbthomason/packer.nvim or folke/lazy.nvim):

-- Remove the `use` here if you're using folke/lazy.nvim.
use {
  'Exafunction/windsurf.vim',
  config = function ()
    -- Change '<C-g>' here to any keycode you like.
    vim.keymap.set('i', '<C-g>', function () return vim.fn['codeium#Accept']() end, { expr = true, silent = true })
    vim.keymap.set('i', '<c-;>', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true, silent = true })
    vim.keymap.set('i', '<c-,>', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true, silent = true })
    vim.keymap.set('i', '<c-x>', function() return vim.fn['codeium#Clear']() end, { expr = true, silent = true })
  end
}

(Make sure that you ran :Codeium Auth after installation.)

⛔ Disabling Windsurf

Windsurf can be disabled for particular filetypes by setting the g:codeium_filetypes variable in your vim config file (vimrc/init.vim):

let g:codeium_filetypes = {
    \ "bash": v:false,
    \ "typescript": v:true,
    \ }

Windsurf is enabled by default for most filetypes.

You can also disable codeium by default with the g:codeium_enabled variable, and enable it manually per buffer by running :CodeiumEnable:

let g:codeium_enabled = v:false

or in Neovim:

vim.g.codeium_enabled = false

Or you can disable codeium for all filetypes with the g:codeium_filetypes_disabled_by_default variable, and use the g:codeium_filetypes variable to selectively enable codeium for specified filetypes:

" let g:codeium_enabled = v:true
let g:codeium_filetypes_disabled_by_default = v:true

let g:codeium_filetypes = {
    \ "rust": v:true,
    \ "typescript": v:true,
    \ }

If you would like to just disable the automatic triggering of completions:

let g:codeium_manual = v:true

" You might want to use `CycleOrComplete()` instead of `CycleCompletions(1)`.
" This will make the forward cycling of suggestions also trigger the first
" suggestion manually.
imap <C-;> <Cmd>call codeium#CycleOrComplete()<CR>

To disable automatic text rendering of suggestions (the gray text that appears for a suggestion):

let g:codeium_render = v:false

Show Windsurf status in statusline

Windsurf status can be generated by calling the codeium#GetStatusString() function. In Neovim, you can use vim.api.nvim_call_function("codeium#GetStatusString", {}) instead. It produces a 3 char long string with Windsurf status:

  • '3/8' - third suggestion out of 8
  • '0' - Windsurf returned no suggestions
  • '*' - waiting for Windsurf response

In normal mode, status shows if Windsurf is enabled or disabled by showing 'ON' or 'OFF'.

In order to show it in status line add following line to your .vimrc:

set statusline+=\{…\}%3{codeium#GetStatusString()}

Shorter variant without Windsurf logo:

set statusline+=%3{codeium#GetStatusString()}

Please check :help statusline for further information about building statusline in VIM.

vim-airline supports Windsurf out-of-the-box since commit 3854429d.

Launching Windsurf Chat

Calling the codeium#Chat() function or using the Codeium Chat command will enable search and indexing in the current project and launch Codeium Chat in a new browser window.

:call codeium#Chat()
:Codeium Chat

The project root is determined by looking in Vim's current working directory for some specific files or directories to be present and goes up to parent directories until one is found. This list of hints is user-configurable and the default value is:

let g:codeium_workspace_root_hints = ['.bzr','.git','.hg','.svn','_FOSSIL_','package.json']

Note that launching chat enables telemetry.

💾 Installation Options

💤 Lazy

{
  'Exafunction/windsurf.vim',
  event = 'BufEnter'
}

🔌 vim-plug

Plug 'Exafunction/windsurf.vim', { 'branch': 'main' }

📦 Vundle

Plugin 'Exafunction/windsurf.vim'

📦 packer.nvim:

use 'Exafunction/windsurf.vim'

💪 Manual

🖥️ Vim

Run the following. On windows, you can replace ~/.vim with $HOME/vimfiles:

git clone https://github.com/Exafunction/windsurf.vim ~/.vim/pack/Exafunction/start/windsurf.vim

💻 Neovim

Run the following. On windows, you can replace ~/.config with $HOME/AppData/Local:

git clone https://github.com/Exafunction/windsurf.vim ~/.config/nvim/pack/Exafunction/start/windsurf.vim
MIT License Copyright (c) 2023 Exafunction Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

codeium.vim 是适用于 Vim 和 Neovim 的 AI 编程助手,可作为 GitHub Copilot 的免费替代方案 展开 收起
Vim Script 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/codeium-vim.git
git@gitee.com:mirrors/codeium-vim.git
mirrors
codeium-vim
codeium-vim
main

搜索帮助