This is a Neovim Lua plugin - no build system required. Test by loading in Neovim.
- Use 2-space indentation
- Local variables with
localkeyword - Module pattern:
local M = {}andreturn M - Snake_case for variables and functions
- Use
vim.APIs instead of deprecatedvim.fnwhere possible
- Place all
require()statements at top of file - Use descriptive variable names for required modules
- Use
vim.notify()for user messages with appropriate log levels - Check return values from system calls (
vim.v.shell_error) - Validate inputs before processing (file handles, buffer existence)
- Functions: snake_case (
send_current_buffer) - Config keys: snake_case (
auto_detect_socket) - Commands: PascalCase with plugin prefix (
OpencodeSendBuffer)
- Main logic in
lua/opencode-context/init.lua - Commands and keymaps in
plugin/opencode.lua - Use guard clause pattern for plugin loading