-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add config.chat_template
to be able to customize the chat file banner
#117
Conversation
config.chat_template
to be able to customize the chat file bannerconfig.chat_template
to be able to customize the chat file banner
`gp.nvim` has autosave feature which is triggered by few events, one of which is `TextChangedI`. when typing text in insert mode, any change done there saves the file. This grows the `:undolist` too much, because any change in insert mode is saved and treated as a separate change. Normally to undo the last change, you would press `u` once in normal mode. But with autosave triggered by `TextChangedI`, you have to press `u` multiple times, for each change. using `InsertLeave` instead of `TextChangedI` avoids such problem. For comparison, consider scenario: 1. open neovim 2. run `:GpChatNew` 3. go to insert mode and type `123` 4. leave insert mode 5. run `:undolist` on my setup it shows: ``` number changes when saved 4 4 2 seconds ago ``` doing the equivalent when `InsertLeave` is used instead of `TextChangedI`: ``` number changes when saved 1 1 2 seconds ago 1 ``` this is much better, because now you can undo the last change with single `u` press!
fixes the error: ``` ln: failed to create symbolic link 'chats/last.md': Directory not empty ```
- Set `model` parameter to "gpt-4o" in both chat and command configurations.
Add a prominent note about this repo being a fork with improvements.
this changes the `{{filename}}` substitute in templates to point to a relative path from the `.git` repository. If `.git` repository is not found, then full path is used. With this change commands like `:GpChatPaste` would include a less verbose path without including the username. For example with config like this: ```lua template_selection = "from `{{filename}}`" ``` we now get ``` from `my-project/file.py` ``` previously we would get ``` from `/home/username/projects/repositories/my-project/file.py` ``` which is often excessive and also leaks the username.
just what I was looking for...hope this gets merged soon 🤞 |
Hey @marcomayer 👋🏻 Wrote about how to do that here i see this PR now includes more than needed, because it points to the I'll try to remember about it and find time to update 🤞🏻 |
@argshook Hey, I've cherry picked and slightly adjusted the
|
Hey @Robitx 👋🏻 this is great, thanks a lot! and pardon for leaving the PR in such a state, my mistake for pointing the PR from Anyway, thanks for your work, the plugin is still kickin'! |
Hello again 👋
Your plugin is still amazing, thanks once more for working on it and keeping it open source!
This PR adds a new config option:
chat_template
. The default messaging is good, but as i'm familiar with how the plugin works, I don't need to be reminded about the shortcuts each time.Therefore, i'd like to configure that message, but couldn't find a way to do so. Maybe i missed it?
A bit naive but very simple way is to expose
chat_template
to be configurable. If user decides to set it, then it is up to them to set it correctly.If
chat_template
is not set, nothing changes and the current message is shown. So no impact for existing users.Having
chat_template
config option i'm able to:and now each chat file looks like:
which is neat, much cleaner!
additional thought is that perhaps markdown frontmatter would fit here for the banner? It is often used to set some extra properties that are not part of markdown body. Lua probably already has some utilities to deal with frontmatter, so chances are it might be easy addition (i'm lua noob, i wouldn't know!).
Anyway, thanks for the plugin, just wanted to share my 2 cents.
Cheers!