Giter Club home page Giter Club logo

Comments (53)

clason avatar clason commented on August 11, 2024

Can we support :Git commit -m "foo bar"?

from mini.nvim.

echasnovski avatar echasnovski commented on August 11, 2024

Can we support :Git -m "foo bar"?

What is it supposed to do? As :Git commit -m "foo bar"? If yes, then I don't think it is worthwhile to add this special behavior.

from mini.nvim.

clason avatar clason commented on August 11, 2024

Yes, sorry. It should behave exactly like git commit -m "foo bar". (After all, "if it works with git, it should work with :Git"...)

from mini.nvim.

echasnovski avatar echasnovski commented on August 11, 2024

After all, "if it works with git, it should work with :Git"...

This is indeed the goal. But git -m "foo bar" does not work for me from CLI. It says unknown option: -m. And :Git behaves the same.

Can we support :Git commit -m "foo bar"?

Yes, of course this works. With slight caveat: :Git commit -m foo\ bar.

from mini.nvim.

clason avatar clason commented on August 11, 2024

Yes. I am explicitly referring to that; I would prefer not to need a special syntax.

from mini.nvim.

echasnovski avatar echasnovski commented on August 11, 2024

Yes. I am explicitly referring to that; I would prefer not to need a special syntax.

Ah, I see now. No, I don't think it will be added, as the current approach feels more like how Vim user commands work.

from mini.nvim.

clason avatar clason commented on August 11, 2024

Ok. Then I'll just leave two more suggestions here for the record; no need to respond:

  • I would suggest making the fugitive behavior (split + scrollbind) the default for Git blame
  • Consider mapping show_at_cursor for mini.git buffers, e.g., to K.

from mini.nvim.

echasnovski avatar echasnovski commented on August 11, 2024

Ok. Then I'll just leave two more suggestions here for the record; no need to respond:

Thanks!

In case other people miss it in help file.

* I would suggest making the fugitive behavior (split + `scrollbind`) the default for `Git blame`

There is an example of customizing blame subcommand (preferably be used inside mapping with <Cmd>vert Git blame -- %<CR> right hand side).

* Consider mapping `show_at_cursor` for `mini.git` buffers, e.g., to `K`.

I'd suggest mapping it some <Leader> mapping as it can be used inside regular Git-tracked file to show range history. But making buffer-local mapping is also possible (albeit a bit verbose for the most robust behavior):

local map_local = vim.schedule_wrap(function(data)
  if not vim.api.nvim_buf_is_valid(data.buf) then return end
  local buf_name = vim.api.nvim_buf_get_name(data.buf)
  if not vim.startswith(buf_name, 'minigit://') then return end
  vim.keymap.set({ 'n', 'x' }, 'K', MiniGit.show_at_cursor, { buffer = data.buf })
end)
-- Alternative is to map for `User` `MiniGitCommandSplit` event, but
-- it would not trigger when buffer is created with `show_xxx()` functions
vim.api.nvim_create_autocmd('BufNew', { callback = map_local })

from mini.nvim.

231tr0n avatar 231tr0n commented on August 11, 2024

Is there a way where i can navigate through diff changes in all the files(not just current buffer) like I can using :Git command in vim-fugitive. Also stage and unstage hunks like I can in vim-fugitive.

from mini.nvim.

echasnovski avatar echasnovski commented on August 11, 2024

The 'mini.git' module is not meant as a full Git client, so do not expect full feature parity with 'vim-fugitive'. Here is a comparison to 'vim-fugitive'.

Is there a way where i can navigate through diff changes in all the files(not just current buffer) like I can using :Git command in vim-fugitive.

Not like in 'vim-fugitive', but you can use plain :Git diff with enabled folding. Ideally, you'd be able to navigate to diff source with show_at_cursor(), but show_diff_source() (and hence show_at_cursor()) does not work in that output (needs explicit commit). I'll look at how it can resolved.

Also stage and unstage hunks like I can in vim-fugitive.

The suggested way is to use 'mini.diff' for staging hunks when inside a buffer. Interactive unstaging is not supported, only with what git CLI through :Git can offer.

from mini.nvim.

rafamadriz avatar rafamadriz commented on August 11, 2024

@echasnovski Thanks for your amazing work. This fits really nice within my workflow since I don't need the full feature set of fugitive (for that I use lazygit).

I just have one question so asking here to not create an issue, what's the purpose of setting foldlevel ?

vim.wo.foldlevel = 999

I have a modified commit message that shows for commits, and I use folds for some parts which I'd rather start closed, for that I have vim.opt.foldlevel = 0 in after/ftplugin/gitcommit.lua. It works fine when doing it from the command line git commit but if I do it inside neovim (:Git commit) then foldlevel is set to 999. So really my question is, is there anyway that options in after/ftplugin/gitcommit.lua are not overwritten ?

from mini.nvim.

echasnovski avatar echasnovski commented on August 11, 2024

I just have one question so asking here to not create an issue, what's the purpose of setting foldlevel ?

I am using foldmethod=indent (and recommending it to everyone). So output of :Git command in split tended to be folded when I did not expect it to (like after :Git help commit). As that foldlevel is set before manually setting filetype in output of :Git command, it works in most cases. It just doesn't work in GIT_EDITOR (like for commit). I'll fix this (probably tomorrow), as setting vim.wo.foldlevel = 0 in 'after/ftplugin/gitcommit.lua' should work.

from mini.nvim.

tssm avatar tssm commented on August 11, 2024

Hey @echasnovski, this is great! It covers most of what I wanted from Fugitive without its complexity, and for the rest I can create my own mappings :)

Regarding the split behavior, I miss an option to use the current window by default, without touching the tab layout at all, and without creating a new tab

from mini.nvim.

echasnovski avatar echasnovski commented on August 11, 2024

Hey @echasnovski, this is great! It covers most of what I wanted from Fugitive without its complexity, and for the rest I can create my own mappings :)

That's great to hear!

Regarding the split behavior, I miss an option to use the current window, without touching the tab layout at all, and without creating a new tab

Yeah, I've thought about this one. In early prototypes it even preferred reusing window if it already showed a buffer from 'mini.git'.

There are two main reasons (aside from a convenient for implementation "there is always a new window" invariant) for not including something like split = 'none':

  • The buffers from 'mini.git' are cleaned up after window is closed. If not done, they will be accumulating in buffer list, which is not nice. The usual approach of setting buftype=wipeout so that buffer is wiped out when it is not visible is not great here, because it prevents exploring other buffers in the same window.
  • There is no good user command modifier to force it. Unlike "horizontal", "vertical", and "tab". So having only one not enforceable split direction ("auto") felt more appropriate.

I'll have this mind, but not sure if this is a good idea. I do wonder about supporting split = 'float' for floating windows, but that would require exposing a config.window.config option, which is also not great. Maybe some time later.

from mini.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.