Skip to content

Instantly share code, notes, and snippets.

@stephenlb
Last active September 29, 2025 20:27
Show Gist options
  • Select an option

  • Save stephenlb/c8d999dd79546bc73bf7d4ad24461698 to your computer and use it in GitHub Desktop.

Select an option

Save stephenlb/c8d999dd79546bc73bf7d4ad24461698 to your computer and use it in GitHub Desktop.
# Neovim + Rust Analyzer installation
brew install neovim
rustup component add rust-analyzer
brew install luajit
sudo ln -s `which luajit` /usr/local/bin/lua
nvim -u NORC -c "source https://raw.githubusercontent.com/lumen-oss/rocks.nvim/master/installer.lua"
nvim
:Rocks install rustaceanvim
:RustAnalyzer start
-- Your Lua Init File
--
-- ~/.config/nvim/init.lua
--
local rocks_config = {
rocks_path = vim.env.HOME .. "/.local/share/nvim/rocks",
}
vim.g.rocks_nvim = rocks_config
local luarocks_path = {
vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"),
vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?", "init.lua"),
}
package.path = package.path .. ";" .. table.concat(luarocks_path, ";")
local luarocks_cpath = {
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"),
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"),
-- Remove the dylib and dll paths if you do not need macos or windows support
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dylib"),
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dylib"),
vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.dll"),
vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.dll"),
}
package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";")
vim.opt.runtimepath:append(vim.fs.joinpath(rocks_config.rocks_path, "lib", "luarocks", "rocks-5.1", "*", "*"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment