|
1 | 1 | local luv = vim.loop |
2 | 2 | local lib = require'lib.lib' |
| 3 | +local config = require'lib.config' |
3 | 4 | local colors = require'lib.colors' |
4 | 5 | local renderer = require'lib.renderer' |
5 | 6 | local fs = require'lib.fs' |
@@ -28,6 +29,18 @@ function M.open() |
28 | 29 | end |
29 | 30 | end |
30 | 31 |
|
| 32 | +local function gen_go_to(mode) |
| 33 | + local icon_state = config.get_icon_state() |
| 34 | + local flags = mode == 'prev_git_item' and 'b' or '' |
| 35 | + local icons = table.concat(vim.tbl_values(icon_state.icons.git_icons), '\\|') |
| 36 | + return function() |
| 37 | + return icon_state.show_git_icon and vim.fn.search(icons, flags) |
| 38 | + end |
| 39 | +end |
| 40 | + |
| 41 | +local go_to_prev_git_item = gen_go_to('prev_git_item') |
| 42 | +local go_to_next_git_item = gen_go_to('next_git_item') |
| 43 | + |
31 | 44 | function M.on_keypress(mode) |
32 | 45 | local node = lib.get_node_at_cursor() |
33 | 46 | if not node then return end |
@@ -55,6 +68,14 @@ function M.on_keypress(mode) |
55 | 68 | return lib.toggle_ignored() |
56 | 69 | end |
57 | 70 |
|
| 71 | + if mode == 'prev_git_item' then |
| 72 | + return go_to_prev_git_item() |
| 73 | + end |
| 74 | + |
| 75 | + if mode == 'next_git_item' then |
| 76 | + return go_to_next_git_item() |
| 77 | + end |
| 78 | + |
58 | 79 | if node.name == ".." then |
59 | 80 | return lib.change_dir("..") |
60 | 81 | elseif mode == "cd" and node.entries ~= nil then |
|
0 commit comments