diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1a54072 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +doc/tags +*.swp +*.swo +.DS_Store diff --git a/README.md b/README.md index cf92482..f7a87f0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,43 @@ # opencode.nvim -Prototype Neovim plugin that opens `opencode` in a terminal split on the right. +Neovim plugin that toggles an `opencode` terminal in a right-side split. + +The terminal buffer is kept alive when hidden, so your `opencode` session remains +available across toggles. + +## Requirements + +- Neovim 0.10 or newer +- The `opencode` CLI installed and available on `$PATH` + +This plugin does not install or bundle `opencode`; it only starts the CLI in a +Neovim terminal. Use of `opencode` is subject to that project's own license and +terms. + +## Installation + +Install with your plugin manager of choice. + +Using `lazy.nvim`: + +```lua +{ + "agj/opencode.nvim", + opts = { + width = 0.3, + }, +} +``` + +Using `vim-plug`: + +```vim +Plug 'agj/opencode.nvim' +``` + +```lua +require("opencode").setup() +``` ## Usage @@ -10,18 +47,46 @@ Run: :OpenCodeToggle ``` -The command opens `opencode` in a right-side terminal window sized to 40% of the -screen width. Running the command again closes only the window; the terminal -buffer and `opencode` session stay alive. Run `:OpenCodeToggle` again to show the -same session. +The command opens `opencode` in a right-side terminal window sized to 30% of the +screen width by default. Running the command again closes only the window; the +terminal buffer and `opencode` session stay alive. Run `:OpenCodeToggle` again to +show the same session. ## Configuration ```lua require("opencode").setup({ - width = 0.4, + width = 0.3, }) ``` `width` is the fraction of the screen width used by the terminal window. The -default is `0.4`. +default is `0.3`. It must be greater than `0` and less than or equal to `1`. + +## Help + +After installing the plugin, run: + +```vim +:help opencode.nvim +``` + +If your plugin manager does not generate helptags automatically, run: + +```vim +:helptags ALL +``` + +## License + +opencode.nvim is free software released under the GNU General Public License, +version 3 only. See [LICENSE](LICENSE) for the full license text. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. + +## Trademark Notice + +opencode.nvim is an independent Neovim plugin and is not affiliated with, +endorsed by, or sponsored by the maintainers of `opencode` or Neovim. diff --git a/doc/opencode.nvim.txt b/doc/opencode.nvim.txt new file mode 100644 index 0000000..6aeb5e7 --- /dev/null +++ b/doc/opencode.nvim.txt @@ -0,0 +1,93 @@ +*opencode.nvim.txt* Toggle opencode in a Neovim terminal + +=============================================================================== +CONTENTS *opencode.nvim-contents* + +1. Introduction |opencode.nvim| +2. Requirements |opencode.nvim-requirements| +3. Installation |opencode.nvim-installation| +4. Usage |opencode.nvim-usage| +5. Configuration |opencode.nvim-configuration| +6. License |opencode.nvim-license| + +=============================================================================== +INTRODUCTION *opencode.nvim* + +opencode.nvim toggles an `opencode` terminal in a right-side split. + +The terminal buffer is hidden instead of deleted when closed, so the same +`opencode` session is shown the next time the window is toggled open. + +=============================================================================== +REQUIREMENTS *opencode.nvim-requirements* + +- Neovim 0.10 or newer +- The `opencode` CLI installed and available on $PATH + +This plugin does not install or bundle `opencode`; it only starts the CLI in a +Neovim terminal. Use of `opencode` is subject to that project's own license and +terms. + +=============================================================================== +INSTALLATION *opencode.nvim-installation* + +Install with your plugin manager of choice. + +Using lazy.nvim: >lua + { + "agj/opencode.nvim", + opts = { + width = 0.3, + }, + } +< + +Using vim-plug: >vim + Plug 'agj/opencode.nvim' +< + +Then call setup from your Neovim configuration: >lua + require("opencode").setup() +< + +=============================================================================== +USAGE *opencode.nvim-usage* + + *:OpenCodeToggle* +:OpenCodeToggle + Toggle the right-side opencode terminal window. + + If the terminal window is visible, this closes only the window. The + terminal buffer and running `opencode` process remain alive. If the + terminal buffer already exists, the command reuses it. + +=============================================================================== +CONFIGURATION *opencode.nvim-configuration* + +Call setup with an optional table: >lua + require("opencode").setup({ + width = 0.3, + }) +< + +Options: *opencode.nvim-options* + + *opencode.nvim-width* +width number, default: 0.3 + Fraction of the screen width used by the terminal split. Must be + greater than 0 and less than or equal to 1. + +=============================================================================== +LICENSE *opencode.nvim-license* + +opencode.nvim is free software released under the GNU General Public License, +version 3 only. See the LICENSE file for the full license text. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. + +opencode.nvim is an independent Neovim plugin and is not affiliated with, +endorsed by, or sponsored by the maintainers of `opencode` or Neovim. + +vim:tw=78:ts=8:noet:ft=help:norl: