Skip to content

Commit

Permalink
feat: add :Rocks edit command for opening rocks.toml (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored Dec 3, 2023
1 parent d0ea65d commit 7f92e60
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ that are no longer needed, run the `:Rocks prune [rock]` command.
> - The command provides completions for rocks that can safely
> be pruned without breaking dependencies.
### Editing `rocks.toml`

The `:Rocks edit` command opens the `rocks.toml` file for manual editing.
Make sure to run `:Rocks sync` when you are done.

## :book: License

`rocks.nvim` is licensed under [GPLv3](./LICENSE).
Expand Down
3 changes: 3 additions & 0 deletions doc/rocks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ rocks.nvim commands *rocks.commands*
------------------------------------------------------------------------------

install [rock] [version?] install {rock} with optional {version}.
prune [rock] uninstall {rock} and its stale dependencies,
and remove it from rocks.toml.
sync synchronize installed rocks with rocks.toml.
update search for updated rocks and install them.
edit edit the rocks.toml file.


==============================================================================
Expand Down
6 changes: 6 additions & 0 deletions lua/rocks/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
---------------------------------------------------------------------------------
---
--- install [rock] [version?] install {rock} with optional {version}.
--- prune [rock] uninstall {rock} and its stale dependencies,
--- and remove it from rocks.toml.
--- sync synchronize installed rocks with rocks.toml.
--- update search for updated rocks and install them.
--- edit edit the rocks.toml file.
---
---@brief ]]
---
Expand Down Expand Up @@ -49,6 +52,9 @@ local rocks_command_tbl = {
local package = args[1]
require("rocks.operations").prune(package)
end,
edit = function(_)
vim.cmd.e(require("rocks.config.internal").config_path)
end,
}

local function rocks(opts)
Expand Down

0 comments on commit 7f92e60

Please sign in to comment.