Skip to content

Commit e5c3fbd

Browse files
committed
feat: add release automation and plug keymaps
This commit introduces release automation using release-please and luarocks publishing. It also adds <Plug> keymaps for explaining code and adding docstrings, and updates the README with the new keymap recommendations.
1 parent 9395904 commit e5c3fbd

4 files changed

Lines changed: 56 additions & 5 deletions

File tree

.github/workflows/luarocks.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Push to Luarocks
2+
3+
on:
4+
push:
5+
tags: # Will upload to luarocks.org when a tag is pushed
6+
- "*"
7+
pull_request: # Will test a local install without uploading to luarocks.org
8+
workflow_dispatch:
9+
10+
jobs:
11+
luarocks-upload:
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: LuaRocks Upload
16+
uses: nvim-neorocks/luarocks-tag-release@v7
17+
env:
18+
LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
release:
15+
name: release
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: googleapis/release-please-action@v4
19+
with:
20+
token: ${{ secrets.PAT }}
21+
release-type: simple

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,12 @@ You can map the commands to keybindings for easier access:
9393

9494
```lua
9595
-- Ask questions about code
96-
vim.api.nvim_set_keymap("v", "<leader>ae", ":AskCode \"Explain this code\"<CR>", { noremap = true, silent = true })
97-
vim.api.nvim_set_keymap("v", "<leader>ab", ":AskCode \"Find potential bugs\"<CR>", { noremap = true, silent = true })
96+
vim.keymap.set("v", "<leader>ae", ":AskCode <Plug>(AskCodeExplain)")
97+
vim.keymap.set("v", "<leader>ab", ":AskCode \"Find potential bugs\"<CR>")
9898

9999
-- Code replacement shortcuts
100-
vim.api.nvim_set_keymap("v", "<leader>ad", ":AskCodeReplace \"Add docstring\"<CR>", { noremap = true, silent = true })
101-
vim.api.nvim_set_keymap("v", "<leader>af", ":AskCodeReplace \"Fix this code\"<CR>", { noremap = true, silent = true })
102-
vim.api.nvim_set_keymap("v", "<leader>ar", ":AskCodeReplace \"Refactor this code\"<CR>", { noremap = true, silent = true })
100+
vim.keymap.set("v", "<leader>ae", ":AskCode <Plug>(AskCodeAddDocstring)")
101+
vim.keymap.set("v", "<leader>ar", ":AskCodeReplace \"Refactor this code\"<CR>", { noremap = true, silent = true })
103102
```
104103

105104
## Development

plugin/askCode.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,16 @@ vim.api.nvim_create_user_command("AskCodeReplace", function(opts)
3737
require("askCode").ask_replace(opts.args, mode)
3838
end
3939
end, { range = true, nargs = "?" })
40+
41+
vim.keymap.set(
42+
"v",
43+
"<Plug>(AskCodeExplain)",
44+
'AskCode "Explain this code"<CR>',
45+
{ desc = "Asking code agent to explain the selected code" }
46+
)
47+
vim.keymap.set(
48+
"v",
49+
"<Plug>(AskCodeAddDocstring)",
50+
':AskCodeReplace "Add docstring to this function"<CR>',
51+
{ desc = "Asking code agent add docstring to the selected function" }
52+
)

0 commit comments

Comments
 (0)