Skip to content

feat(status): add hint #225

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

Merged
merged 2 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ local neogit = require("neogit")

neogit.setup {
disable_signs = false,
disable_hint = false,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It matches the options, but wouldn't it be better to have them other way around? Maybe something like:

neogit.setup {
  display = {
    signs = true,
    hint = true,
    context_highlighting = true,
    commit_confirmation = true,
  },
}

I know it's breaking change, but simplifies things in my opinion. What do you think @TimUntersberger? (most likely not part of that PR though)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gegoune That's actually more readable, but then these properties might not be easily searchable, which is part of the reason why I can find the relevant files quickly, say by searching for disable_signs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gegoune I think grouping these together into a common subtable wouldn't be a bad idea, but I am not sure what to call it yet. Can you open a seperate issue for this?

disable_context_highlighting = false,
disable_commit_confirmation = false,
auto_refresh = true,
Expand Down Expand Up @@ -203,6 +204,9 @@ You can override them to fit your colorscheme by creating a `syntax/NeogitStatus

Set `disable_context_highlighting = true` in your call to [`setup`](#configuration) to disable context highlighting altogether.

## Disabling Hint
Set `disable_hint = true` in your call to [`setup`](#configuration) to hide hints on top of the panel.

## Disabling Commit Confirmation

Set `disable_commit_confirmation = true` in your call to [`setup`](#configuration) to disable the "Are you sure you want to commit?" prompt after saving the commit message buffer.
Expand Down
1 change: 1 addition & 0 deletions lua/neogit/config.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local M = {}

M.values = {
disable_hint = false,
disable_context_highlighting = false,
disable_signs = false,
disable_commit_confirmation = false,
Expand Down
4 changes: 4 additions & 0 deletions lua/neogit/status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ local function draw_buffer()
M.status_buffer:clear_sign_group('fold_markers')

local output = LineBuffer.new()
if not config.values.disable_hint then
output:append("Hint: [<tab>] toggle diff | [s]tage | [u]nstage | [x] discard | [c]ommit | [?] more help")
output:append("")
end
output:append(string.format("Head: %s %s", M.repo.head.branch, M.repo.head.commit_message or '(no commits)'))
if M.repo.upstream.branch then
output:append(string.format("Push: %s %s", M.repo.upstream.branch, M.repo.upstream.commit_message or '(no commits)'))
Expand Down