{"id":26268144,"url":"https://github.com/bjornbytes/lovr-neovim","last_synced_at":"2025-09-05T03:37:56.617Z","repository":{"id":272937959,"uuid":"917972387","full_name":"bjornbytes/lovr-neovim","owner":"bjornbytes","description":"Neovim client for LÖVR","archived":false,"fork":false,"pushed_at":"2025-01-17T01:57:08.000Z","size":107,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T00:52:08.251Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bjornbytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-17T01:56:27.000Z","updated_at":"2025-02-17T15:14:26.000Z","dependencies_parsed_at":"2025-01-17T15:35:43.693Z","dependency_job_id":"81f40a0c-6086-42d9-b385-8d740f3e958c","html_url":"https://github.com/bjornbytes/lovr-neovim","commit_stats":null,"previous_names":["bjornbytes/lovr-neovim"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Flovr-neovim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Flovr-neovim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Flovr-neovim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjornbytes%2Flovr-neovim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bjornbytes","download_url":"https://codeload.github.com/bjornbytes/lovr-neovim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251768617,"owners_count":21640748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-14T04:19:51.655Z","updated_at":"2025-04-30T19:27:32.965Z","avatar_url":"https://github.com/bjornbytes.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"Neovim for LÖVR\n===\n\nThis is a LÖVR client for the neovim text editor.  It lets you connect to an instance of neovim\n(potentially on a different machine), send keypresses to it, and render the result in LÖVR.  The\nlibrary is minimal in nature and is designed to be embedded in a larger development environment.\n\nNote: this requires 2 native LÖVR plugins, [`lua-mp`](https://github.com/bjornbytes/lua-mp/tree/lovr) and\n[`luv`](https://github.com/bjornbytes/luv/tree/lovr).\n\n![com oculus vrshell-20250116-174734](https://github.com/user-attachments/assets/6d4d8d20-7bfb-4dbf-a47f-b842ee038599)\n\nFeatures\n---\n\n- Can spawn multiple neovim connections.\n- Behaves just like neovim would, all your config/theme/plugins work.\n- Can connect to PC neovim from standalone Android headsets.\n- Can send virtual keyboard/mouse events (or just forward the ones from `lovr.keypressed` etc.).\n- Tells you when the editor has changed, so you can cache the rendering to a Texture or Layer and\n  only redraw when needed.\n\n\nNot yet implemented:\n\n- Loading the system font set by vimrc.  Currently you have to provide your own font.\n- Bold/underline/strikethrough/emoji text effects aren't supported.\n\nHow It Works\n---\n\nNeovim has a client/server design where a single instance of the editor can have multiple clients\nconnected to it, communicating using the MessagePack RPC protocol.  This library acts as a client.\nThe server sends us a grid of characters which are rendered to a LÖVR `Pass` object.  We can also\nsend keyboard events back to the server, and it will update the grid and send back the result.\n\nExample\n---\n\n```lua\nlocal editor = require 'neovim'\n\nfunction lovr.load()\n  editor:init({\n    width = 800,\n    height = 600,\n    font = lovr.graphics.newFont('font.ttf'),\n    fontSize = 18\n  })\nend\n\nfunction lovr.update(dt)\n  editor:update()\nend\n\nfunction lovr.draw(pass)\n  pass:push()\n  pass:translate(0, 1.7, -1)\n  pass:scale(1 / 500) -- 500 pixels per meter\n  pass:translate(-editor.width * .5, editor.height * .5, 0)\n  editor:draw(pass)\n  pass:pop()\nend\n\nfunction lovr.keypressed(key)\n  editor:keypressed(key)\nend\n\nfunction lovr.keyreleased(key)\n  editor:keyreleased(key)\nend\n\nfunction lovr.textinput(text)\n  editor:textinput(text)\nend\n```\n\nSee `main.lua` for a full example.  You can pass a server address as the first command line\nargument. Controller inputs will be converted to mouse inputs (trigger is click, thumbstick is\nscroll).  It also caches the rendering to a `Layer` object, only redrawing when the editor contents\nchange.\n\nUsage\n---\n\nlovr-neovim can be used in two ways:\n\n- **Embedded**.  The library will start a new headless neovim process, and communicate with it over\n  stdin and stdout.  Requires neovim to be installed.  This is the default if no IP is given.  \n- **Remote**.  The library will connect to a neovim server over the network using its IP address.\n\nFor embedded, make sure neovim is installed.  `neovim:init` will try to spawn the `nvim` executable.\nIf you don't have a `nvim` executable on your PATH, set the `exe` config option to the path to\nneovim.  The `cwd` option can also be set to change the editor's working directory.  Example:\n\n```lua\nneovim:init({\n  exe = '/usr/bin/nvim',\n  cwd = '/home/user'\n})\n```\n\nFor remote, first launch neovim with `--listen 0.0.0.0:1337` to have it listen on a TCP socket (here\nI chose port 1337 but it can be anything).  You can run `:echo serverlist()` from neovim to see the\nserver address.  Then when initializing lovr-neovim, set the `address` to the server address:\n\n```lua\nneovim:init({\n  address = '127.0.0.1:1337'\n})\n\n-- or this\nneovim:init({\n  address = '127.0.0.1',\n  port = 1337\n})\n```\n\nAPI\n---\n\n```lua\nneovim:init(options)\neditor = neovim.new(options)\n```\n\nCreate a new editor.  You can call `init` on the library if you only plan on using a single editor,\nor you can use `.new` to create multiple different editors.\n\n`options` can be a table with the following:\n\nname            | description\n:---------------|:-----------\n`address`       | The IP of the server to connect to.  Can also contain both the IP and port separated by a colon.  If this is nil, a new headless neovim process will be spawned.\n`port`          | The port of the server to connect to, when connecting by IP.\n`exe`           | The neovim executable to spawn.  Default: `nvim`.\n`cwd`           | The working directory to use for the neovim process.  Default: `lovr.filesystem.getWorkingDirectory()`.\n`width`         | The width of the editor, in pixels.  Default: 800.\n`height`        | The height of the editor, in pixels.  Default: 600.\n`font`          | The font to use.  Should be monospace.\n`fontSize`      | The font size, in pixels.  Default: 16.\n`onquit`        | Called when the editor quits.  Default: `lovr.event.quit`.\n`onfontchanged` | Called when the neovim font setting is changed.\n`onerror`       | Called when there is an error.  Default: `error`.\n`capsescape`    | Whether `keypressed` should map `capslock` to `escape`.\n\n```lua\ndirty = neovim:update()\n```\n\nThis should be called every frame from `lovr.update`.  It polls the connection for messages and\nupdates the state of the editor.  It returns `dirty`, indicating if the editor needs to be redrawn.\n\n```lua\nneovim:draw(pass)\n```\n\nDraws the editor to `pass`.  The upper left corner of the editor is at `(0,0)` and the units are in\npixels.  Currently it doesn't support transform information, so use the pass transform stack to\ntransform it as needed.\n\n```lua\nneovim:quit()\n```\n\nShuts down the editor, closing the connection or killing the child process.\n\n```lua\nneovim:keypressed(key)\n```\n\nSend a key press to the editor.  This works with modifier keys, so sending a keypress for `lctrl`\nand a textinput for `r` will send `\u003cC-r\u003e` to neovim.\n\n```lua\nneovim:keyreleased(key)\n```\n\nThis is currently only used to track modifier key state.\n\n```lua\nneovim:textinput(text)\n```\n\nSend a text input event to the editor.\n\n```lua\nneovim:mousepressed(button, row, col)\n```\n\nSends a mouse press event to the editor.\n\n```lua\nneovim:mousereleased(button, row, col)\n```\n\nSends a mouse release event to the editor.\n\n```lua\nneovim:mousemoved(row, col)\n```\n\nSends a mouse move event to the editor.\n\n```lua\nneovim:wheelmoved(dx, dy, row, col)\n```\n\nSends a scroll event to the editor.\n\n```lua\nneovim:setSize(width, height)\n```\n\nResize the editor.  `width` and `height` are in pixels.  Note that this is a request to the server,\nand the actual size may end up being smaller, since the size of the editor is determined by the\nsmallest connected client.  This may change the number of rows and columns.\n\n```lua\nneovim:setFont(font, size)\n```\n\nSet a new font.  `size` is in pixels.  This may change the number of rows and columns.\n\n    neovim.width\n    neovim.height\n    neovim.colsize\n    neovim.rowsize\n    neovim.cols\n    neovim.rows\n\nGet various dimensions of the editor.  All sizes are in pixels.\n\nLicense\n---\n\nMIT, see [`LICENSE`](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjornbytes%2Flovr-neovim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjornbytes%2Flovr-neovim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjornbytes%2Flovr-neovim/lists"}