Skip to content
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

add gig --empty-dir #762

Merged
merged 5 commits into from
Feb 25, 2024
Merged

add gig --empty-dir #762

merged 5 commits into from
Feb 25, 2024

Conversation

fj0r
Copy link
Contributor

@fj0r fj0r commented Feb 22, 2024

upgrade nvdc for neovide

upgrade nvdc for neovide
@@ -566,10 +575,9 @@ export def _git_log [v num] {
_git_log_stat $num
} else { {} }
let r = do -i {
git log --reverse -n $num --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD»¦«%D
git log --reverse -n $num --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason you're reversing this change? #757

Copy link
Contributor Author

@fj0r fj0r Feb 23, 2024

Choose a reason for hiding this comment

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

─#─┬──────refs───────
0  │[list 0 items]   
1  │[list 0 items]   
2  │[list 0 items]   
3  │[list 0 items]   
4  │[list 0 items]   
5  │[list 0 items]   
6  │[list 0 items]   
7  │[list 0 items]   
8  │[list 0 items]   
9  │[list 0 items]   
10 │[list 0 items]   
11 │[list 0 items]   
12 │[list 0 items]   
13 │[list 0 items]   
14 │[list 0 items]   
15 │[list 0 items]   
16 │[list 0 items]   
17 │[list 0 items]   
18 │[list 0 items]   
19 │[list 0 items]   
20 │[list 0 items]   
21 │[list 0 items]   
22 │[list 0 items]   
23 │[list 0 items]   
24 │[list 0 items]   
25 │[list 0 items]   
26 │[list 0 items]   
27 │[list 0 items]   
28 │[list 0 items]   
29 │[list 0 items]   
30 │[list 0 items]   
31 │──┬───────────── 
   │0 │HEAD -> main  
   │1 │origin/main   
   │2 │origin/HEAD   
   │──┴───────────── 
─#─┴──────refs───────
  • This column is mostly empty, So it should be global information rather than belonging to a specific log entry?
  • The information displayed by refs is not very intuitive.
  • Under normal circumstances, the branch will be displayed in the prompt.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@fj0r, you should coordinate with @dam4rus for this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I found that my understanding was wrong, refs are indeed necessary. But it is hints information and does not need to be processed (this will have a relatively small impact on performance)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't find this modification was submitted by @dam4rus before, let me take a look again

Copy link
Contributor Author

@fj0r fj0r Feb 23, 2024

Choose a reason for hiding this comment

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

After a simple test, if refs are parsed, the speed will slow down from 33ms 192µs 16ns to 403ms 100µs 853ns
The refs, as a prompt information, does not seem to need to be parsed?
And after parsing, it often needs to be displayed in multiple lines, which is not neat.
Are there any specific scenarios for parsing refs? Can they be parsed during use? @dam4rus

Copy link
Contributor

Choose a reason for hiding this comment

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

I added refs to the output to be consistent with git log, which shows you the refs for each commit. It can be useful information when you are on a feature branch or fork to check whether you have rebased or not. Gonna be honest, I have not benchmarked my change so maybe there is a more optimal way to parse refs. If people do not find this information useful we can add a flag or show only when the verbose flag is present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that without using the where statement, there is almost no impact on performance.
Since we already had the verbose flag before, it's OK to always parse refs.
The final problem is that it raises the line and attracts too much attention.

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that without using the where statement, there is almost no impact on performance.

That seems strange. Maybe it would worth digging into this.

The final problem is that it raises the line and attracts too much attention.

Well, the user can just reject the refs field to filter them out. E.g. I do not really care about the author, email and date of the commit every time, so I have my own alias to reject them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, this is acceptable and can be merged.

@fj0r fj0r force-pushed the main branch 2 times, most recently from 67954a0 to 16dde29 Compare February 25, 2024 11:22
@fdncred
Copy link
Collaborator

fdncred commented Feb 25, 2024

ok, i'll land this now. however, i noticed your nvim changes reference neovide which isn't quite the same as nvim. i'm wondering if neovide items need to be in a separate file?

@fdncred fdncred merged commit da6fb3e into nushell:main Feb 25, 2024
@fj0r
Copy link
Contributor Author

fj0r commented Feb 25, 2024

I found that there is only one method nvdc that references neovide, and it seems unnecessary to put it in a separate file.
This starts nvim in server-client mode, where nvc starts the client in tui and nvdc starts in gui mode (neovide). The commands to start the server and client should be together.
But nvc and nvdc may be merged together.

@fdncred
Copy link
Collaborator

fdncred commented Feb 25, 2024

we can leave it for now but at some point we may want to separate since neovide is not nvim.

@fj0r
Copy link
Contributor Author

fj0r commented Feb 25, 2024

The way I think about it is to use a unified nvc to start the neovim client, and then have a flag --gui to start the neovim gui program.
And collect some common GUI startup methods, detect which one exists and start which one.
like this

export def nvc [
    addr: string
    --gui(-g)
] {
    if $gui {
        let gs = {
            neovide: [--maximized --server $addr]
        }
        for g in ($gs | transpose prog args) {
            if not (which $g.prog | is-empty) {
                ^$g.prog ...$g.args
                break
            }
        }
    } else {
        nvim --remote-ui --server $addr
    }
}

I have opened a new PR, merge nvdc into nvc #764

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants