@@ -210,6 +210,51 @@ function MarketplaceView:before_leave()
210210end
211211
212212function MarketplaceView :setup_active_mode ()
213+ local function enter_detail_mode ()
214+ local cursor = vim .api .nvim_win_get_cursor (0 )
215+ local server = self :get_server_at_line (cursor [1 ])
216+ if server then
217+ self .cursor_positions .browse_mode = cursor
218+ self .selected_server = server
219+ self .active_mode = " details"
220+ self .active_installation_index = 1
221+ self :setup_active_mode ()
222+ self :draw ()
223+ local install_line = self .interactive_lines [1 ]
224+ vim .api .nvim_win_set_cursor (0 , { install_line and install_line .line or 7 , 0 })
225+ end
226+ end
227+ local function go_to_browse_mode ()
228+ self .cursor_positions .details_mode = vim .api .nvim_win_get_cursor (0 )
229+ self .active_mode = " browse"
230+ self .selected_server = nil
231+ self :setup_active_mode ()
232+ self :draw ()
233+ -- Restore browse mode position
234+ if self .cursor_positions .browse_mode then
235+ vim .api .nvim_win_set_cursor (0 , self .cursor_positions .browse_mode )
236+ end
237+ end
238+ local function install_server ()
239+ local cursor = vim .api .nvim_win_get_cursor (0 )
240+ local type , context = self :get_line_info (cursor [1 ])
241+
242+ if type == " install_with_method" and not State :is_server_installed (self .selected_server .id ) then
243+ -- Open installation editor directly
244+ self :handle_installation_selection (
245+ context --[[ @as { server: MarketplaceItem, installation: MarketplaceInstallation }]]
246+ )
247+ elseif type == " uninstall_server" and State :is_server_installed (self .selected_server .id ) then
248+ -- Show confirmation and uninstall
249+ if context then
250+ local server_id = context .server .id --[[ @as string]]
251+ utils .confirm_and_delete_server (server_id )
252+ end
253+ else
254+ -- Normal vim movement: move cursor right
255+ vim .cmd (" normal! l" )
256+ end
257+ end
213258 if self .active_mode == " browse" then
214259 self .keymaps = {
215260 [" /" ] = {
@@ -308,37 +353,22 @@ function MarketplaceView:setup_active_mode()
308353 desc = " Clear filters" ,
309354 },
310355 [" l" ] = {
311- action = function ()
312- local cursor = vim .api .nvim_win_get_cursor (0 )
313- local server = self :get_server_at_line (cursor [1 ])
314- if server then
315- self .cursor_positions .browse_mode = cursor
316- self .selected_server = server
317- self .active_mode = " details"
318- self .active_installation_index = 1
319- self :setup_active_mode ()
320- self :draw ()
321- local install_line = self .interactive_lines [1 ]
322- vim .api .nvim_win_set_cursor (0 , { install_line and install_line .line or 7 , 0 })
323- end
324- end ,
356+ action = enter_detail_mode ,
357+ desc = " View details" ,
358+ },
359+ [" <Cr>" ] = {
360+ action = enter_detail_mode ,
325361 desc = " View details" ,
326362 },
327363 }
328364 else
329365 self .keymaps = {
330366 [" h" ] = {
331- action = function ()
332- self .cursor_positions .details_mode = vim .api .nvim_win_get_cursor (0 )
333- self .active_mode = " browse"
334- self .selected_server = nil
335- self :setup_active_mode ()
336- self :draw ()
337- -- Restore browse mode position
338- if self .cursor_positions .browse_mode then
339- vim .api .nvim_win_set_cursor (0 , self .cursor_positions .browse_mode )
340- end
341- end ,
367+ action = go_to_browse_mode ,
368+ desc = " Back to list" ,
369+ },
370+ [" <Esc>" ] = {
371+ action = go_to_browse_mode ,
342372 desc = " Back to list" ,
343373 },
344374 [" <Tab>" ] = {
@@ -371,26 +401,11 @@ function MarketplaceView:setup_active_mode()
371401 desc = " Switch installation method" ,
372402 },
373403 [" l" ] = {
374- action = function ()
375- local cursor = vim .api .nvim_win_get_cursor (0 )
376- local type , context = self :get_line_info (cursor [1 ])
377-
378- if type == " install_with_method" and not State :is_server_installed (self .selected_server .id ) then
379- -- Open installation editor directly
380- self :handle_installation_selection (
381- context --[[ @as { server: MarketplaceItem, installation: MarketplaceInstallation }]]
382- )
383- elseif type == " uninstall_server" and State :is_server_installed (self .selected_server .id ) then
384- -- Show confirmation and uninstall
385- if context then
386- local server_id = context .server .id --[[ @as string]]
387- utils .confirm_and_delete_server (server_id )
388- end
389- else
390- -- Normal vim movement: move cursor right
391- vim .cmd (" normal! l" )
392- end
393- end ,
404+ action = install_server ,
405+ desc = " Install/Uninstall" ,
406+ },
407+ [" <Cr>" ] = {
408+ action = install_server ,
394409 desc = " Install/Uninstall" ,
395410 },
396411 }
@@ -416,8 +431,8 @@ function MarketplaceView:handle_installation_selection(context)
416431 start_insert = false ,
417432 go_to_placeholder = true , -- Position cursor at first ${} placeholder
418433 virtual_lines = {
419- { Text .icons .hint .. " ${VARIABLES} will be resolved from environment if not replaced" , " DiagnosticHint " },
420- { Text .icons .hint .. " ${cmd: echo 'secret'} will run command and replace ${}" , " DiagnosticHint " },
434+ { Text .icons .hint .. " ${VARIABLES} will be resolved from environment if not replaced" , " Comment " },
435+ { Text .icons .hint .. " ${cmd: echo 'secret'} will run command and replace ${}" , " Comment " },
421436 },
422437 on_success = function ()
423438 -- Switch to main view and browse mode after successful installation
@@ -666,6 +681,10 @@ function MarketplaceView:render_browse_mode(line_offset)
666681 end
667682 end
668683
684+ local info_line = NuiLine ()
685+ info_line :append (Text .icons .bug .. " Report issues or suggest changes: " , Text .highlights .title )
686+ info_line :append (" https://github.com/ravitemer/mcp-registry" , Text .highlights .link )
687+ table.insert (lines , Text .pad_line (info_line ))
669688 return lines
670689end
671690
@@ -776,9 +795,9 @@ function MarketplaceView:render_details_mode(line_offset)
776795 })
777796
778797 table.insert (lines , Text .pad_line (NuiLine ()))
779- local prereq_line = NuiLine ()
780- prereq_line :append (" PREVIEW " , Text .highlights .muted )
781- table.insert (lines , Text .pad_line (prereq_line ))
798+ -- local prereq_line = NuiLine()
799+ -- prereq_line:append("PREVIEW ", Text.highlights.muted)
800+ -- table.insert(lines, Text.pad_line(prereq_line))
782801 table.insert (lines , self :divider ())
783802
784803 -- Show details based on active tab
@@ -834,9 +853,9 @@ function MarketplaceView:render_details_mode(line_offset)
834853 -- table.insert(lines, Text.pad_line(prereq_line))
835854 -- end
836855
837- local prereq_line = NuiLine ()
838- prereq_line :append (" PREVIEW " , Text .highlights .muted )
839- table.insert (lines , Text .pad_line (prereq_line ))
856+ -- local prereq_line = NuiLine()
857+ -- prereq_line:append("PREVIEW ", Text.highlights.muted)
858+ -- table.insert(lines, Text.pad_line(prereq_line))
840859 table.insert (lines , self :divider ())
841860
842861 -- Show active installation details
0 commit comments