@@ -8,7 +8,7 @@ local config = {
88 width = 0.8 ,
99 height = 0.8 ,
1010 cmd = { ' gh' , ' dash' },
11- -- whether to auto-install the ghdash TUI not found (requires npm)
11+ -- whether to auto-install the gh_dash TUI not found (requires npm)
1212 autoinstall = false ,
1313}
1414
@@ -20,20 +20,20 @@ local state = {
2020
2121function M .setup (user_config )
2222 config = vim .tbl_deep_extend (' force' , config , user_config or {})
23- -- define commands for toggling the ghdash popup
24- vim .api .nvim_create_user_command (' ghdash ' , function ()
23+ -- define commands for toggling the gh_dash popup
24+ vim .api .nvim_create_user_command (' GHdash ' , function ()
2525 M .toggle ()
26- end , { desc = ' Toggle ghdash popup' })
27- vim .api .nvim_create_user_command (' ghdash-toggle ' , function ()
26+ end , { desc = ' Toggle gh-dash popup' })
27+ vim .api .nvim_create_user_command (' GHdashToggle ' , function ()
2828 M .toggle ()
29- end , { desc = ' Toggle ghdash popup (alias)' })
29+ end , { desc = ' Toggle gh-dash popup (alias)' })
3030 -- optional keymap for toggle
3131 if config .keymaps .toggle then
32- vim .api .nvim_set_keymap (' n' , config .keymaps .toggle , ' <cmd>ghdash-toggle <CR>' , { noremap = true , silent = true })
32+ vim .api .nvim_set_keymap (' n' , config .keymaps .toggle , ' <cmd>GHDashToggle <CR>' , { noremap = true , silent = true })
3333 end
3434end
3535
36- -- Create a floating window displaying the ghdash buffer
36+ -- Create a floating window displaying the gh_dash buffer
3737local function open_window ()
3838 -- compute dimensions and position
3939 local width = math.floor (vim .o .columns * config .width )
@@ -101,10 +101,10 @@ function M.open()
101101 -- buffer options
102102 vim .api .nvim_buf_set_option (state .buf , ' bufhidden' , ' hide' )
103103 vim .api .nvim_buf_set_option (state .buf , ' swapfile' , false )
104- vim .api .nvim_buf_set_option (state .buf , ' filetype' , ' ghdash ' )
105- -- map <Esc> in terminal and normal modes to close the ghdash window
106- vim .api .nvim_buf_set_keymap (state .buf , ' t' , ' <Esc>' , [[ <C-\><C-n><cmd>lua require('ghdash ').close()<CR>]] , { noremap = true , silent = true })
107- vim .api .nvim_buf_set_keymap (state .buf , ' n' , ' <Esc>' , [[ <cmd>lua require('ghdash ').close()<CR>]] , { noremap = true , silent = true })
104+ vim .api .nvim_buf_set_option (state .buf , ' filetype' , ' gh_dash ' )
105+ -- map <Esc> in terminal and normal modes to close the gh_dash window
106+ vim .api .nvim_buf_set_keymap (state .buf , ' t' , ' <Esc>' , [[ <C-\><C-n><cmd>lua require('gh_dash ').close()<CR>]] , { noremap = true , silent = true })
107+ vim .api .nvim_buf_set_keymap (state .buf , ' n' , ' <Esc>' , [[ <cmd>lua require('gh_dash ').close()<CR>]] , { noremap = true , silent = true })
108108 end
109109 open_window ()
110110 -- determine if config.cmd is a simple executable name (no args) for checking
@@ -127,52 +127,52 @@ function M.open()
127127 local cmd = {
128128 shell_cmd ,
129129 ' -c' ,
130- " echo 'Autoinstalling OpenAI ghdash via npm...'; npm install -g @openai/ghdash " ,
130+ " echo 'Autoinstalling OpenAI gh_dash via npm...'; npm install -g @openai/gh_dash " ,
131131 }
132132 state .job = vim .fn .termopen (cmd , {
133133 cwd = vim .loop .cwd (),
134134 on_exit = function (_ , exit_code )
135135 if exit_code == 0 then
136- vim .notify (' [ghdash .nvim] ghdash CLI installed successfully' , vim .log .levels .INFO )
137- -- automatically re-launch ghdash CLI now that it's installed
136+ vim .notify (' [gh_dash .nvim] gh_dash CLI installed successfully' , vim .log .levels .INFO )
137+ -- automatically re-launch gh_dash CLI now that it's installed
138138 vim .schedule (function ()
139139 M .close ()
140140 state .buf = nil
141141 M .open ()
142142 end )
143143 else
144- vim .notify (' [ghdash .nvim] failed to install ghdash CLI' , vim .log .levels .ERROR )
144+ vim .notify (' [gh_dash .nvim] failed to install gh_dash CLI' , vim .log .levels .ERROR )
145145 end
146146 state .job = nil
147147 end ,
148148 })
149149 end
150150 else
151- -- show installation instructions in the ghdash popup
151+ -- show installation instructions in the gh_dash popup
152152 local msg = {
153- ' npm not found; cannot auto-install ghdash CLI.' ,
153+ ' npm not found; cannot auto-install gh_dash CLI.' ,
154154 ' ' ,
155155 ' Please install via your system package manager, or manually run:' ,
156- ' npm install -g @openai/ghdash ' ,
156+ ' npm install -g @openai/gh_dash ' ,
157157 }
158158 vim .api .nvim_buf_set_lines (state .buf , 0 , - 1 , false , msg )
159159 end
160160 else
161161 -- show instructions inline when autoinstall is disabled
162162 local msg = {
163- ' ghdash CLI not found.' ,
163+ ' gh_dash CLI not found.' ,
164164 ' ' ,
165165 ' Install with:' ,
166- ' npm install -g @openai/ghdash ' ,
166+ ' npm install -g @openai/gh_dash ' ,
167167 ' ' ,
168168 ' Or enable autoinstall in your plugin setup:' ,
169- ' require("ghdash ").setup{ autoinstall = true }' ,
169+ ' require("gh_dash ").setup{ autoinstall = true }' ,
170170 }
171171 vim .api .nvim_buf_set_lines (state .buf , 0 , - 1 , false , msg )
172172 end
173173 return
174174 end
175- -- spawn the ghdash CLI in the floating terminal buffer
175+ -- spawn the gh_dash CLI in the floating terminal buffer
176176 if not state .job then
177177 state .job = vim .fn .termopen (config .cmd , {
178178 cwd = vim .loop .cwd (),
@@ -200,20 +200,20 @@ end
200200
201201function M .statusline ()
202202 if state .job and not (state .win and vim .api .nvim_win_is_valid (state .win )) then
203- return ' [ghdash ]'
203+ return ' [gh_dash ]'
204204 end
205205 return ' '
206206end
207207
208- --- Return a lualine.nvim component for displaying ghdash status
209- -- Usage: table.insert(opts.sections.lualine_x, require('ghdash ').status())
208+ --- Return a lualine.nvim component for displaying gh_dash status
209+ -- Usage: table.insert(opts.sections.lualine_x, require('gh_dash ').status())
210210function M .status ()
211211 return {
212212 -- component function
213213 function ()
214214 return M .statusline ()
215215 end ,
216- -- only show when ghdash job is running in background
216+ -- only show when gh_dash job is running in background
217217 cond = function ()
218218 return M .statusline () ~= ' '
219219 end ,
0 commit comments