Replace `j`, `k` with event `CursorMoved`
Hi!
I was wondering if you would consider changing the input method in lists (and trees) to react to the event CursorMoved instead of a particular keymap for up/down. The rationale: navigation by 1 (hjkl) is usually replaced with more efficient methods, and it feels irritating that moving the cursor by other means doesn't have the same effect.
It looks like the required changes are minimal. The following works for buffer_history_preview
diff --git a/lua/vgit/features/screens/HistoryScreen/init.lua b/lua/vgit/features/screens/HistoryScreen/init.lua
index 6dc6902..a4ea433 100644
--- a/lua/vgit/features/screens/HistoryScreen/init.lua
+++ b/lua/vgit/features/screens/HistoryScreen/init.lua
@@ -120,6 +120,11 @@ function HistoryScreen:show()
},
})
+ self.table_view.scene:get('table').buffer:on('CursorMoved', function()
+ self.store:set_index(self.table_view:move())
+ self.diff_view:render_debounced(function() self.diff_view:navigate_to_mark(1) end)
+ end)
+
return true
end
https://github.com/tanvirtin/vgit.nvim/issues/340 could be related
proof of concept: https://github.com/notEvil/vgit.nvim/tree/i344
Issues:
project_diff_preview: when staging the first hunk of a file, the file gets added to the 'staged' part of the tree which essentially moves the cursor up
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Thanks this is much better.