Skip to content

Commit df5eb03

Browse files
committed
initial commit
0 parents  commit df5eb03

12 files changed

Lines changed: 526 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, codecov-dev]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Neovim ${{ matrix.neovim }}
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
neovim: ["stable", "v0.10.0", "nightly"]
16+
17+
steps:
18+
- name: Checkout plugin
19+
uses: actions/checkout@v4
20+
21+
- name: Install Neovim ${{ matrix.neovim }}
22+
run: |
23+
set -euo pipefail
24+
25+
VERSION=${{ matrix.neovim }}
26+
27+
# All historic 0.x tags use nvim-linux64.tar.gz, everything newer uses -x86_64
28+
if [[ "$VERSION" =~ ^v0\.[0-9]+\. ]]; then
29+
FILENAME=nvim-linux64.tar.gz
30+
else
31+
FILENAME=nvim-linux-x86_64.tar.gz
32+
fi
33+
34+
URL="https://github.com/neovim/neovim/releases/download/${VERSION}/${FILENAME}"
35+
echo "Downloading $URL"
36+
37+
curl -fL -o nvim.tar.gz "$URL" # -f = fail on 4xx/5xx, -L = follow redirects
38+
39+
mkdir nvim-extract
40+
tar -xzf nvim.tar.gz -C nvim-extract
41+
42+
DIR="$(ls nvim-extract | head -n1)" # should be nvim-linux64 or nvim-linux-x86_64
43+
sudo mv "nvim-extract/$DIR" /opt/nvim
44+
echo "/opt/nvim/bin" >> "$GITHUB_PATH"
45+
46+
- name: Verify Neovim
47+
run: nvim --version
48+
49+
- name: Install Plenary
50+
run: |
51+
mkdir -p ~/.local/share/nvim/site/pack/test/start
52+
git clone https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/test/start/plenary.nvim
53+
54+
- name: Install LuaRocks + luacheck + coverage tools
55+
run: |
56+
set -euo pipefail
57+
sudo apt-get update
58+
sudo apt-get install -y lua5.1 liblua5.1-0-dev luarocks
59+
luarocks --lua-version=5.1 --local install luacheck
60+
luarocks --lua-version=5.1 --local install luacov
61+
luarocks --lua-version=5.1 --local install luacov-reporter-lcov
62+
echo "$HOME/.luarocks/bin" >> $GITHUB_PATH
63+
64+
- name: Run tests with coverage
65+
run: |
66+
eval "$(luarocks --lua-version=5.1 path)"
67+
luarocks --lua-version=5.1 list # debug
68+
nvim --headless -u tests/minimal_init.lua -c "luafile tests/run_cov.lua"
69+
70+
luacov -r lcov > lcov.info
71+
sed -i 's|SF:.*/codex.nvim/codex.nvim/|SF:|g' lcov.info
72+
head -n 10 lcov.info # debug
73+
74+
# Debug output
75+
echo "=== first 20 lines of lcov.info ==="
76+
head -n 20 lcov.info
77+
78+
echo "=== all source-file entries ==="
79+
grep '^SF:' lcov.info | sed -e 's/^SF://g' | sort | uniq | head -n 10
80+
81+
- name: Upload code coverage
82+
uses: codecov/codecov-action@v4
83+
with:
84+
files: lcov.info # <-- new file
85+
disable_search: true
86+
token: ${{ secrets.CODECOV_TOKEN }}

.luacheckrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- .luacheckrc
2+
std = "luajit"
3+
globals = { "vim" }
4+
ignore = {
5+
"plugin/*", -- plugin loader shim
6+
}
7+
8+
max_line_length = false -- or turn it off completely
9+

.luacov

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- .luacov (Lua, not INI)
2+
return {
3+
statsfile = "luacov.stats.out",
4+
reportfile = "luacov.report.out",
5+
6+
-- collect coverage only for plugin source
7+
include = {
8+
"lua/",
9+
},
10+
11+
-- ignore test helpers and specs
12+
exclude = {
13+
"tests/",
14+
},
15+
}

.stylua.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ~/.config/stylua/stylua.toml
2+
indent_type = "Spaces"
3+
indent_width = 2
4+
column_width = 160
5+
line_endings = "Unix"
6+
quote_style = "AutoPreferSingle"
7+
call_parentheses = "None"

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# gh-dash Neovim Plugin
2+
3+
## A Neovim plugin integrating the open-source gh-dash TUI for the `gh` cli ([gh-dash](https://github.com/dlvhdr/gh-dash/)).
4+
> Latest version: ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/johnseth97/gh-dash.nvim?sort=semver)
5+
6+
### Features:
7+
- ✅ Toggle gh-dash floating window with `:ghdash-toggle`
8+
- ✅ Optional keymap mapping via `setup` call
9+
- ✅ Background running when window hidden
10+
- ✅ Statusline integration via `require('ghdash').status()`
11+
12+
### Installation:
13+
14+
- Install the `gh-dash` CLI via npm, or mark autoinstall as true in the config function
15+
16+
```bash
17+
npm install -g @openai/gh-dash
18+
```
19+
20+
- Grab an API key from OpenAI and set it in your environment variables:
21+
- Note: You can also set it in your `~/.bashrc` or `~/.zshrc` file to persist across sessions, but be careful with security. Especially if you share your config files.
22+
23+
```bash
24+
export OPENAI_API_KEY=your_api_key
25+
```
26+
27+
- Use your plugin manager, e.g. lazy.nvim:
28+
29+
```lua
30+
return {
31+
'johnseth97/gh-dash.nvim',
32+
lazy = true,
33+
keys = {
34+
{
35+
'<leader>cc',
36+
function() require('gh-dash').toggle() end,
37+
desc = 'Toggle gh-dash popup',
38+
},
39+
},
40+
opts = {
41+
keymaps = {}, -- disable internal mapping
42+
border = 'rounded', -- or 'double'
43+
width = 0.8,
44+
height = 0.8,
45+
autoinstall = true,
46+
},
47+
}
48+
```
49+
50+
### Usage:
51+
- Call `:gh-dash` (or `:gh-dashToggle`) to open or close the gh-dash popup.
52+
-- Map your own keybindings via the `keymaps.toggle` setting.
53+
- Add the following code to show presence of backgrounded gh-dash window in lualine:
54+
```lua
55+
require('gh-dash').status() -- drop in to your lualine sections
56+
```

0 commit comments

Comments
 (0)