Added two new functions to support git operations:
- git_diff: Get git diff for generating commit message (both staged and unstaged changes)
- git_commit: Commit changes with commit message and optional signing
These functions also support:
- GPG signing if available and configured
- Automatic staging of files if scope is provided
- User confirmation before committing
- Signed-off-by line with git user info
Signed-off-by: Hanchin Hsieh <me@yuchanns.xyz>
This fixes a bunch of errors I was getting when switching away from the
avante sidebar and then back. Sometimes the sidebar would lose track of
the various windows, and you'd get errors like this:
```
|| stack traceback:
|| ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2350: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2349>
|| Error detected while processing BufLeave Autocommands for "<buffer=294>":
|| Error executing lua callback: ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2398: attempt to index field 'selected_files_container' (a nil value)
```
Or this one:
```
|| stack traceback:
|| ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2350: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2349>
|| Error detected while processing BufLeave Autocommands for "<buffer=294>":
|| Error executing lua callback: ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2398: attempt to index field 'selected_files_container' (a nil value)
```
This change does the following:
1. Proper order of cleanup in `reset()`
2. Proper cleanup in `create_selected_files_container()`
This fix is required for users with vim.o.virtualedit="all". Otherwise,
the cursor remains at the end of the prompt and has to be manually moved
back before entering the next prompt.
* Add helper function to check for dev icon availability
* Add function to display dev icon or nothing if icon plugins unavailable
* Fix existing use of icons
* Reformat with stylua