Code Monkey home page Code Monkey logo

codeium.vim's Introduction

Codeium


Discord Twitter Follow License

Visual Studio JetBrains Open VSX Google Chrome

codeium.vim

Free, ultrafast Copilot alternative for Vim and Neovim

Codeium autocompletes your code with AI in all major IDEs. We launched this implementation of the Codeium 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 Codeium 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/codeium.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 Codeium.

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 Codeium.

๐Ÿ› ๏ธ Configuration

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

โŒจ๏ธ Keybindings

Codeium 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>

Codeium'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 <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/codeium.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 })
    vim.keymap.set('i', '<c-;>', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true })
    vim.keymap.set('i', '<c-,>', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true })
    vim.keymap.set('i', '<c-x>', function() return vim.fn['codeium#Clear']() end, { expr = true })
  end
}

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

โ›” Disabling Codeium

Codeium 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,
    \ }

Codeium is enabled by default for most filetypes.

You can also disable codeium by default with the g:codeium_enabled variable:

let g:codeium_enabled = v:false

Instead, if you would like to just disable the automatic triggering of completions:

let g:codeium_manual = v:true

Show Codeium status in statusline

Codeium status can be generated by calling codeium#GetStatusString() function. It produce 3 char long string with status:

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

In normal mode, status shows if Codeium 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 Codeium logo:

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

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

For vim-airline extension you can use following config:

let g:airline_section_y = '{โ€ฆ}%3{codeium#GetStatusString()}'

๐Ÿ’พ Installation Options

๐Ÿ”Œ vim-plug

Plug 'Exafunction/codeium.vim'

๐Ÿ“ฆ Vundle

Plugin 'Exafunction/codeium.vim'

๐Ÿ“ฆ packer.nvim:

use 'Exafunction/codeium.vim'

๐Ÿ’ช Manual

๐Ÿ–ฅ๏ธ Vim

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

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

๐Ÿ’ป Neovim

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

git clone https://github.com/Exafunction/codeium.vim ~/.config/nvim/pack/Exafunction/start/codeium.vim

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.