GithubHelp home page GithubHelp logo

exit.nvim's Introduction

exit.nvim

Ex:t

exit.nvim is a neovim plugin that allows you to prompt LLMs (large language models) to write Vim commands:

Demo: How do I exit Vim?

Once you know how to exit Vim, you can do more useful stuff:

Demo: Delete all the lines that contain solved

Installation

It is suggested to use the latest release tag instead of main.

Using vim-plug

Plug '3v0k4/exit.nvim', { 'tag': '0.1.0' }

Using dein

call dein#add('3v0k4/exit.nvim', { 'rev': '0.1.0' })
" or                           , { 'rev': '0.1.x' })

Using packer.nvim

use {
  '3v0k4/exit.nvim', tag = '0.1.0',
}

Using lazy.nvim

-- init.lua:
{
  '3v0k4/exit.nvim', tag = '0.1.0',
}

-- plugins/exit.lua:
return {
  '3v0k4/exit.nvim', tag = '0.1.0',
}

Usage

After installing, you can type :h exit.nvim:

================================================================================
                                                                   *exit.nvim*

exit.nvim is a neovim plugin that allows you to prompt LLMs (large language
models) to write Vim commands:

  1. `:lua require('exit').setup({ model = 'openai:gpt-3.5-turbo' })`
  2. `:lua require('exit').prompt('How do I exit Vim?')`

You can set up shortcuts in your neovim config (if you configure Vim with
LUA, you don't need the first and last lines):
  >
    lua << EOF
      require('exit').setup({ model = 'openai:gpt-3.5-turbo' })

      vim.api.nvim_create_user_command('ExitModel', function(opts)
        require('exit').set_model(opts.args)
      end, { nargs = 1 })

      vim.api.nvim_create_user_command('Exit', function(opts)
        require('exit').prompt(opts.args)
      end, { nargs = '*' })
    EOF
<
With the shortcuts in place, you can prompt exit.nvim as follows:
  `:Exit How do I exit Vim?`

Or change the model with:
  `:ExitModel openai:gpt-4o`

API keys for LLMs are saved in either "$XDG_DATA_HOME/exit.nvim" or
"$HOME/.local/share/exit.nvim".

The source code is available at https://github.com/3v0k4/exit.nvim

  :h exit.setup
  :h exit.set_model
  :h exit.prompt


exit.setup({opts})                                              *exit.setup()*
  Setup function to configure what LLM to use: >
    require('exit').setup({
      model = 'openai:gpt-3.5-turbo'
    })
<
  Valid keys for {opts.model}:
    - 'openai:gpt-3.5-turbo'
    - 'openai:gpt-4'
    - 'openai:gpt-4-turbo'
    - 'openai:gpt-4o'


exit.set_model({model_id})                                  *exit.set_model()*
  Sets what LLM to use: >
    require('exit').set_model('openai:gpt-3.5-turbo')
<
  Valid keys for {model_id}:
    - 'openai:gpt-3.5-turbo'
    - 'openai:gpt-4'
    - 'openai:gpt-4-turbo'
    - 'openai:gpt-4o'


exit.prompt({prompt})                                          *exit.prompt()*
  Prompts the LLM: >
    require('exit').prompt('How do I exit Vim?')
<

 vim:tw=78:ts=8:ft=help:norl:

Development

To release a new version add a tag and push:

git tag vX.Y.Z
git push --tags

Contributing

Bug reports and pull requests are welcome on GitHub.

License

The module is available as open source under the terms of the MIT License.

exit.nvim's People

Contributors

3v0k4 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

exit.nvim's Issues

Support continuing a conversation

It may be useful to allow the user to converse with the LLM.

Example:

:Exit search all files containing abc
:ExitC use rg instead

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.