Skip to content

Commit

Permalink
feat: added mapping for jump & close (defaults to "o") #15
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 2, 2021
1 parent f9dd598 commit 09de784
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/trouble/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ local defaults = {
cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
refresh = "r", -- manually refresh
jump = {"<cr>", "<tab>"}, -- jump to the diagnostic or open / close folds
jump_close = {"o"}, -- jump to the diagnostic and close the list
toggle_mode = "m", -- toggle between "workspace" and "document" mode
toggle_preview = "P", -- toggle auto_preview
preview = "p", -- preview the diagnostic location
Expand Down
4 changes: 4 additions & 0 deletions lua/trouble/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ function Trouble.action(action)
if view and action == "on_win_enter" then view:on_win_enter() end
if not is_open() then return end
if action == "jump" then view:jump() end
if action == "jump_close" then
view:jump()
Trouble.close()
end
if action == "open_folds" then Trouble.refresh({open_folds = true}) end
if action == "close_folds" then Trouble.refresh({close_folds = true}) end
if action == "toggle_fold" then view:toggle_fold() end
Expand Down

0 comments on commit 09de784

Please sign in to comment.