docs(README): add Neovim installation section with LuaRocks path setup and manual git methods#23
docs(README): add Neovim installation section with LuaRocks path setup and manual git methods#23
Conversation
Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds Neovim-focused installation guidance to improve discoverability and onboarding for Neovim users who want to use luarrow from their editor config.
Changes:
- Introduces a new “With Neovim” subsection under Installation
- Adds example snippets for lazy.nvim, packer.nvim, and vim-plug
- Adds a short snippet showing
require('luarrow')usage from a Neovim config
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
…ility Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
|
@copilot |
…r Neovim Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
Added a new "Manually (git clone or git submodule)" subsection under "With Neovim" in commit e666072. It shows both methods and includes the |
@copilot |
… instructions Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
| local handle = io.popen('luarocks path --lr-path') | ||
| if handle then | ||
| local luarocks_path = handle:read('*a'):gsub('\n', '') | ||
| handle:close() | ||
| if luarocks_path ~= '' then | ||
| package.path = package.path .. ';' .. luarocks_path | ||
| end | ||
| end | ||
|
|
||
| handle = io.popen('luarocks path --lr-cpath') | ||
| if handle then | ||
| local luarocks_cpath = handle:read('*a'):gsub('\n', '') | ||
| handle:close() | ||
| if luarocks_cpath ~= '' then | ||
| package.cpath = package.cpath .. ';' .. luarocks_cpath | ||
| end | ||
| end |
There was a problem hiding this comment.
The io.popen approach may not work reliably on all Windows systems. Windows has security restrictions and different shell behaviors that can cause io.popen to fail or return nil, especially in sandboxed or restricted environments.
Consider adding a note that users should verify LuaRocks is in their PATH and that their Neovim is configured to allow system calls. Alternatively, suggest manually setting the paths as a more reliable cross-platform approach, or provide a fallback mechanism if io.popen fails.
| local fun = require('luarrow').fun | ||
| ``` | ||
|
|
||
| After installation, you need to ensure Neovim can find the LuaRocks modules. Add this to your `init.lua` before requiring luarrow: |
There was a problem hiding this comment.
The phrase "After installation" is ambiguous about which installation method it refers to. The LuaRocks path configuration in lines 255-281 only applies to package manager installations (lazy.nvim, packer.nvim, vim-plug) that use make install-to-local, not to the manual git clone/submodule method described in lines 226-253.
Consider clarifying this by either:
- Moving this section immediately after line 224 (after vim-plug) and before the manual installation section, with text like "After installing with a package manager, you need to ensure..."
- Or adding a note at the start of line 255 like "For package manager installations (lazy.nvim, packer.nvim, vim-plug), you need to ensure..."
This will help users understand that manual installation is a complete standalone alternative that doesn't need the LuaRocks path setup.
| After installation, you need to ensure Neovim can find the LuaRocks modules. Add this to your `init.lua` before requiring luarrow: | |
| For package manager installations (lazy.nvim, packer.nvim, vim-plug), you need to ensure Neovim can find the LuaRocks modules. Add this to your `init.lua` before requiring luarrow: |
| local handle = io.popen('luarocks path --lr-path') | ||
| if handle then | ||
| local luarocks_path = handle:read('*a'):gsub('\n', '') | ||
| handle:close() | ||
| if luarocks_path ~= '' then | ||
| package.path = package.path .. ';' .. luarocks_path | ||
| end | ||
| end | ||
|
|
||
| handle = io.popen('luarocks path --lr-cpath') | ||
| if handle then | ||
| local luarocks_cpath = handle:read('*a'):gsub('\n', '') | ||
| handle:close() | ||
| if luarocks_cpath ~= '' then | ||
| package.cpath = package.cpath .. ';' .. luarocks_cpath | ||
| end | ||
| end | ||
|
|
There was a problem hiding this comment.
The LuaRocks command flags --lr-path and --lr-cpath may not be standard or widely supported. The typical luarocks path command outputs shell-specific export statements (e.g., export LUA_PATH=...), not just the path values.
Verify that these flags exist and work as expected across different LuaRocks versions. If they don't exist, consider alternative approaches:
- Parse the output of
luarocks pathto extract the actual path values - Use
luarocks configcommands if available - Document a more robust cross-platform method
Without access to LuaRocks documentation from my knowledge cutoff, this should be tested to ensure it works correctly.
| local handle = io.popen('luarocks path --lr-path') | |
| if handle then | |
| local luarocks_path = handle:read('*a'):gsub('\n', '') | |
| handle:close() | |
| if luarocks_path ~= '' then | |
| package.path = package.path .. ';' .. luarocks_path | |
| end | |
| end | |
| handle = io.popen('luarocks path --lr-cpath') | |
| if handle then | |
| local luarocks_cpath = handle:read('*a'):gsub('\n', '') | |
| handle:close() | |
| if luarocks_cpath ~= '' then | |
| package.cpath = package.cpath .. ';' .. luarocks_cpath | |
| end | |
| end | |
| local function add_luarocks_paths() | |
| local handle = io.popen('luarocks path') | |
| if not handle then | |
| return | |
| end | |
| local result = handle:read('*a') or '' | |
| handle:close() | |
| -- Extract LUA_PATH from the shell commands printed by `luarocks path` | |
| local lua_path = result:match('LUA_PATH%s*=%s*"([^"]+)"') | |
| or result:match("LUA_PATH%s*=%s*'([^']+)'") | |
| or result:match('LUA_PATH%s*=%s*([^%s;]+)') | |
| if lua_path and lua_path ~= '' then | |
| package.path = package.path .. ';' .. lua_path | |
| end | |
| -- Extract LUA_CPATH from the shell commands printed by `luarocks path` | |
| local lua_cpath = result:match('LUA_CPATH%s*=%s*"([^"]+)"') | |
| or result:match("LUA_CPATH%s*=%s*'([^']+)'") | |
| or result:match('LUA_CPATH%s*=%s*([^%s;]+)') | |
| if lua_cpath and lua_cpath ~= '' then | |
| package.cpath = package.cpath .. ';' .. lua_cpath | |
| end | |
| end | |
| add_luarocks_paths() |
| > 2. The package was installed with the correct Lua version: `luarocks install --lua-version 5.1 luarrow` | ||
| > 3. Alternatively, launch Neovim with LuaRocks paths pre-configured: | ||
| > - **Unix/macOS**: `eval $(luarocks path) && nvim` | ||
| > - **Windows (PowerShell)**: `$env:LUA_PATH = (luarocks path --lr-path); $env:LUA_CPATH = (luarocks path --lr-cpath); nvim` |
There was a problem hiding this comment.
The LuaRocks command flags --lr-path and --lr-cpath may not be standard or widely supported. The typical luarocks path command outputs shell-specific export statements (e.g., export LUA_PATH=...), not just the path values.
Verify that these flags exist and work as expected across different LuaRocks versions. If they don't exist, consider alternative approaches for the Windows PowerShell command.
Additionally, even if the flags work, the PowerShell syntax might need adjustment. The current approach assumes the command outputs a raw path string suitable for direct assignment, which may not be the case.
| > - **Windows (PowerShell)**: `$env:LUA_PATH = (luarocks path --lr-path); $env:LUA_CPATH = (luarocks path --lr-cpath); nvim` | |
| > - **Windows (PowerShell)**: Run `luarocks path` for your LuaRocks version and apply the printed `LUA_PATH` / `LUA_CPATH` settings in PowerShell before starting `nvim` (see the LuaRocks documentation for details). |
| -- Note: Ensure LuaRocks is configured for Lua 5.1 (Neovim's Lua version) | ||
| local handle = io.popen('luarocks path --lr-path') | ||
| if handle then | ||
| local luarocks_path = handle:read('*a'):gsub('\n', '') |
There was a problem hiding this comment.
The gsub pattern replacement is incomplete. Using gsub('\n', '') will only remove newline characters, but command output typically includes trailing whitespace beyond just \n. On Windows, line endings might be \r\n, and the output could have other trailing whitespace. Consider using a more robust pattern like gsub('%s+$', '') to remove all trailing whitespace, or use string.match to extract non-whitespace content.
|
|
||
| handle = io.popen('luarocks path --lr-cpath') | ||
| if handle then | ||
| local luarocks_cpath = handle:read('*a'):gsub('\n', '') |
There was a problem hiding this comment.
The gsub pattern replacement is incomplete. Using gsub('\n', '') will only remove newline characters, but command output typically includes trailing whitespace beyond just \n. On Windows, line endings might be \r\n, and the output could have other trailing whitespace. Consider using a more robust pattern like gsub('%s+$', '') to remove all trailing whitespace, or use string.match to extract non-whitespace content.
| Then add the `src` directory to the Lua path in your `init.lua`: | ||
|
|
||
| ```lua | ||
| -- Add luarrow's src directory to the Lua path |
There was a problem hiding this comment.
The manual installation path setup requires users to understand the nested repository structure (luarrow.lua/src inside the cloned repo). While technically correct, this could be simplified by suggesting a different clone location that aligns better with Neovim's default Lua path structure.
Consider suggesting: git clone https://github.com/aiya000/luarrow.lua ~/.local/share/nvim/site/pack/manual/start/luarrow which uses Neovim's native package loading, or provide a clearer explanation of why the nested path structure (/lua/luarrow/luarrow.lua/src) exists.
Alternatively, the current approach could benefit from a brief note explaining that the repository contains a luarrow.lua subdirectory, which is why the path includes this nested structure.
| -- Add luarrow's src directory to the Lua path | |
| -- Add luarrow's src directory to the Lua path | |
| -- Note: the cloned repository contains a "luarrow.lua/src" subdirectory, | |
| -- so the full path becomes: <your-config>/lua/luarrow/luarrow.lua/src |
luarrow-repotoluarrowin manual installation examplesOriginal prompt
Note
Custom agent used: PR Creator Agent
An agent creates PullRequests when assigned to an issue
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.