Giter VIP home page Giter VIP logo

vgit.nvim's Introduction

VGit

Visual Git Plugin for Neovim to enhance your git experience

Lua Neovim

CI License

Hunk Preview

Highlighted features

  • Gutter changes
  • Current line blame
  • Authorship code lens
  • Current line blame preview
  • Gutter blame preview
  • File history preview
  • File diff preview
  • File hunk preview
  • File staged diff preview
  • Project diff preview
    • Discard all changes
    • Discard individual file
    • Stage/unstage all changes
    • Stage/unstage individual files
    • Stage/unstage hunks
    • Open the file with changes
  • Project hunks preview
  • Project staged hunks preview
  • Project logs preview
  • Project stash preview
  • Project commit preview
  • Project commits preview
  • Send all project hunks to quickfix list
  • Hunk navigations in all buffers with a diff

Requirements

  • Neovim 0.8+
  • Git 2.18.0+
  • Supported Operating Systems:
    • linux-gnu*
    • Darwin

Prerequisites

Recommended settings

vim.o.updatetime = 300
vim.o.incsearch = false
vim.wo.signcolumn = 'yes'

Installation

Default installation via Packer.

use {
  'tanvirtin/vgit.nvim',
  requires = {
    'nvim-lua/plenary.nvim'
  }
}

Setup

You must instantiate the plugin in order for the features to work.

require('vgit').setup()

To embed the above code snippet in a .vim file wrap it in lua << EOF code-snippet EOF.

lua << EOF
require('vgit').setup()
EOF

Highlights, signs, keymappings are few examples of what can be configured in VGit. Advanced setup below shows you all configurable parameters in VGit.

Show advanced setup
require('vgit').setup({
  keymaps = {
    ['n <C-k>'] = function() require('vgit').hunk_up() end,
    ['n <C-j>'] = function() require('vgit').hunk_down() end,
    ['n <leader>gs'] = function() require('vgit').buffer_hunk_stage() end,
    ['n <leader>gr'] = function() require('vgit').buffer_hunk_reset() end,
    ['n <leader>gp'] = function() require('vgit').buffer_hunk_preview() end,
    ['n <leader>gb'] = function() require('vgit').buffer_blame_preview() end,
    ['n <leader>gf'] = function() require('vgit').buffer_diff_preview() end,
    ['n <leader>gh'] = function() require('vgit').buffer_history_preview() end,
    ['n <leader>gu'] = function() require('vgit').buffer_reset() end,
    ['n <leader>gg'] = function() require('vgit').buffer_gutter_blame_preview() end,
    ['n <leader>glu'] = function() require('vgit').buffer_hunks_preview() end,
    ['n <leader>gls'] = function() require('vgit').project_hunks_staged_preview() end,
    ['n <leader>gd'] = function() require('vgit').project_diff_preview() end,
    ['n <leader>gq'] = function() require('vgit').project_hunks_qf() end,
    ['n <leader>gx'] = function() require('vgit').toggle_diff_preference() end,
  },
  settings = {
    git = {
      cmd = 'git', -- optional setting, not really required
      fallback_cwd = vim.fn.expand("$HOME"),
      fallback_args = {
        "--git-dir",
        vim.fn.expand("$HOME/dots/yadm-repo"),
        "--work-tree",
        vim.fn.expand("$HOME"),
      },
    },
    hls = {
      GitBackground = 'Normal',
      GitHeader = 'NormalFloat',
      GitFooter = 'NormalFloat',
      GitBorder = 'LineNr',
      GitLineNr = 'LineNr',
      GitComment = 'Comment',
      GitSignsAdd = {
        gui = nil,
        fg = '#d7ffaf',
        bg = nil,
        sp = nil,
        override = false,
      },
      GitSignsChange = {
        gui = nil,
        fg = '#7AA6DA',
        bg = nil,
        sp = nil,
        override = false,
      },
      GitSignsDelete = {
        gui = nil,
        fg = '#e95678',
        bg = nil,
        sp = nil,
        override = false,
      },
      GitSignsAddLn = 'DiffAdd',
      GitSignsDeleteLn = 'DiffDelete',
      GitWordAdd = {
        gui = nil,
        fg = nil,
        bg = '#5d7a22',
        sp = nil,
        override = false,
      },
      GitWordDelete = {
        gui = nil,
        fg = nil,
        bg = '#960f3d',
        sp = nil,
        override = false,
      },
    },
    live_blame = {
      enabled = true,
      format = function(blame, git_config)
        local config_author = git_config['user.name']
        local author = blame.author
        if config_author == author then
          author = 'You'
        end
        local time = os.difftime(os.time(), blame.author_time)
          / (60 * 60 * 24 * 30 * 12)
        local time_divisions = {
          { 1, 'years' },
          { 12, 'months' },
          { 30, 'days' },
          { 24, 'hours' },
          { 60, 'minutes' },
          { 60, 'seconds' },
        }
        local counter = 1
        local time_division = time_divisions[counter]
        local time_boundary = time_division[1]
        local time_postfix = time_division[2]
        while time < 1 and counter ~= #time_divisions do
          time_division = time_divisions[counter]
          time_boundary = time_division[1]
          time_postfix = time_division[2]
          time = time * time_boundary
          counter = counter + 1
        end
        local commit_message = blame.commit_message
        if not blame.committed then
          author = 'You'
          commit_message = 'Uncommitted changes'
          return string.format(' %s • %s', author, commit_message)
        end
        local max_commit_message_length = 255
        if #commit_message > max_commit_message_length then
          commit_message = commit_message:sub(1, max_commit_message_length) .. '...'
        end
        return string.format(
          ' %s, %s • %s',
          author,
          string.format(
            '%s %s ago',
            time >= 0 and math.floor(time + 0.5) or math.ceil(time - 0.5),
            time_postfix
          ),
          commit_message
        )
      end,
    },
    live_gutter = {
      enabled = true,
      edge_navigation = true, -- This allows users to navigate within a hunk
    },
    authorship_code_lens = {
      enabled = true,
    },
    scene = {
      diff_preference = 'unified', -- unified or split
      keymaps = {
        quit = 'q'
      }
    },
    diff_preview = {
      keymaps = {
        buffer_stage = 'S',
        buffer_unstage = 'U',
        buffer_hunk_stage = 's',
        buffer_hunk_unstage = 'u',
        toggle_view = 't',
      },
    },
    project_diff_preview = {
      keymaps = {
        buffer_stage = 's',
        buffer_unstage = 'u',
        buffer_hunk_stage = 'gs',
        buffer_hunk_unstage = 'gu',
        buffer_reset = 'r',
        stage_all = 'S',
        unstage_all = 'U',
        reset_all = 'R',
      },
    },
    project_commit_preview = {
      keymaps = {
        save = 'S',
      },
    },
    signs = {
      priority = 10,
      definitions = {
        GitSignsAddLn = {
          linehl = 'GitSignsAddLn',
          texthl = nil,
          numhl = nil,
          icon = nil,
          text = '',
        },
        GitSignsDeleteLn = {
          linehl = 'GitSignsDeleteLn',
          texthl = nil,
          numhl = nil,
          icon = nil,
          text = '',
        },
        GitSignsAdd = {
          texthl = 'GitSignsAdd',
          numhl = nil,
          icon = nil,
          linehl = nil,
          text = '',
        },
        GitSignsDelete = {
          texthl = 'GitSignsDelete',
          numhl = nil,
          icon = nil,
          linehl = nil,
          text = '',
        },
        GitSignsChange = {
          texthl = 'GitSignsChange',
          numhl = nil,
          icon = nil,
          linehl = nil,
          text = '',
        },
      },
      usage = {
        screen = {
          add = 'GitSignsAddLn',
          remove = 'GitSignsDeleteLn',
        },
        main = {
          add = 'GitSignsAdd',
          remove = 'GitSignsDelete',
          change = 'GitSignsChange',
        },
      },
    },
    symbols = {
      void = '',
    },
  }
})

Status Line

Use b:vgit_status, a table containing the current buffer's number of added, removed, changed lines.

Example:

set statusline+=%{get(b:,'vgit_status','')}

API

VGit Commands


Function Name Description
setup Sets VGit up for you. This plugin cannot be used before this function has been called.
hunk_up Moves the cursor to the hunk above the current cursor position.
hunk_down Moves the cursor to the hunk below the current cursor position.
checkout [args] Wrapper command for git checkout. You can switch branches or restore working tree files
buffer_hunk_preview Opens a diff preview showing the diff of the current buffer in comparison to that found in index. This preview will open up in a smaller window relative to where your cursor is.
buffer_diff_preview Opens a diff preview showing the diff of the current buffer in comparison to that found in index. If the command is called while being on a hunk, the window will open focused on the diff of that hunk.
buffer_history_preview Opens a diff preview along with a table of logs, enabling users to see different iterations of the file through it's lifecycle in git.
buffer_blame_preview Opens a preview detailing the blame of the line that based on the cursor position within the buffer.
buffer_gutter_blame_preview Opens a preview which shows all the blames related to the lines of the buffer.
buffer_diff_staged_preview Opens a diff preview showing the diff of the staged changes in the current buffer.
buffer_hunk_staged_preview Opens a diff preview showing the diff of the staged changes in the current buffer. This preview will open up in a smaller window relative to where your cursor is.
buffer_hunk_stage Stages a hunk, if a cursor is on the hunk.
buffer_hunk_reset Removes all changes made in the buffer on the hunk the cursor is currently on to what exists in HEAD.
buffer_stage Stages all changes in the current buffer.
buffer_unstage Unstages all changes in the current buffer.
buffer_reset Removes all current changes in the buffer and resets it to the version in HEAD.
project_diff_preview Opens a diff preview along with a list of all the files that have been changed, enabling users to see all the files that were changed in the current project
project_logs_preview [args] Opens a preview listing all the logs in the current working branch. Users can filter the list by passing options to this list. Pressing the "tab" key on a list item will keep the item selected. Pressing the "enter" key on the preview will close the preview and open "project_commits_preview" with the selected commits
project_commit_preview Opens a preview through which staged changes can be committed
project_commits_preview [args] Opens a diff preview along with a list of all your commits
project_stash_preview Opens a preview listing all stashes. Pressing the "enter" key on the preview will close the preview and open "project_commits_preview" with the selected stashes
project_hunks_preview Opens a diff preview along with a foldable list of all the current hunks in the project. Users can use this preview to cycle through all the hunks.
project_hunks_staged_preview Opens a diff preview along with a foldable list of all the current staged hunks in the project. Users can use this preview to cycle through all the hunks.
project_debug_preview Opens a VGit view showing logs of a pariticular kind traced within the application.
project_hunks_qf Populate the quickfix list with hunks. Automatically opens the quickfix window.
project_stage_all Stages all file changes in your project.
project_unstage_all Unstages all file changes in your project.
project_reset_all Discards all file changes that are not staged.
toggle_diff_preference Used to switch between "split" and "unified" diff.
toggle_live_gutter Enables/disables git gutter signs.
toggle_live_blame Used to switch between "split" and "unified" diff.
toggle_authorship_code_lens Enables/disables authorship code lens that can be found on top of the file
toggle_tracing Enables/disables debug logs that are used internally by VGit to make suppressed logs visible.

Debugging

Start off by allowing VGit to trace your actions:

  • :VGit toggle_tracing

Each category of logs can be previewed using the following commands:

  • :VGit debug_preview infos
  • :VGit debug_preview warnings
  • :VGit debug_preview errors

vgit.nvim's People

Contributors

ibhagwan avatar shatur avatar skebanga avatar tanvirtin avatar zdleaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vgit.nvim's Issues

Keymapping

It would be nice for users to pass in key mappings for commands in VGit. Based on how users instantiate the plugin, this could be a nice alternative that our plugin provides. An example of an interface might look like this:

function set_keymap(mode, key, action)
  options = options or {}
  vim.api.nvim_set_keymap(mode, key, action, {
    noremap = true,
    silent = true
  })
end

The function above can then be used to create something like this:

keymap = {
   '<mode> <key>' = 'hunk_down',
   'n <c-k' = function(vgit) vgit.hunk_up() end
}

Improve command output

Describe the solution you'd like

Would be great has auto complete when you press <Tab>

E.g.
When I input

:VGit buf<Tab>

I got hints of buff_hunk_next buff_diff_view etc

Also When input either VGit and VGit help
Instead shows missing argument error messages, output
all the available subcommands

Doesn't track updates from external program

Description

Hello. I'm using lazygit to work with git. When I got to lazygit in external terminal window and make some changes (commit, revert, or whatever) and then back to nvim with enabled vgit it doesn't react to any changes.

Can you fix it please?

  • nvim --version 0.5;
  • Nixo unstable

E5113: Error while calling lua chunk: ...hare/nvim/site/pack/paqs/start/vgit.nvim/lua/vgit/ui.lua:72: attempt to index local 'config' (a nil value)

Description

Thanks a lot for this awesome plugin.

I use Paq as plugin manager.
I tried to uninstall and reinstall VGit.
I keep getting E5113: Error while calling lua chunk: ...hare/nvim/site/pack/paqs/start/vgit.nvim/lua/vgit/ui.lua:72: attempt to index local 'config' (a nil value) error.

Screenshot 2021-08-03 at 12 32 49 AM

After this error, I'm not able to use the plugin (i.e. VGit command doesn't appear/work in commandbar at the bottom).
This problem has appeared just recently after updating the plugin.

  • nvim --version output:
λ › nvim --version                                                                                                                                     Blocks/cloche_api ueberauth
Found existing alias for "nvim". You should use: "n"
NVIM v0.5.0
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210702-14987-rep9di/neovim-0.5.0/build/config -I/tmp/neovim-20210702-14987-rep9di/neovim-0.5.0/src -I/usr/local/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20210702-14987-rep9di/neovim-0.5.0/build/src/nvim/auto -I/tmp/neovim-20210702-14987-rep9di/neovim-0.5.0/build/include
Compiled by brew@BigSur

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.5.0/share/nvim"

Run :checkhealth for more info
λ ›                                                          
  • Operating system: Mac Big Sur
  • Terminal: Kitty

undo hunk stage

Describe the solution you'd like
Add option to unstage a hunk
buffer_hunk_unstage

A bug related to scheduling?

Description

I don't know why but continuously i am getting Error executing vim.schedule lua callback: ...acker/start/plenary.nvim/lua/plenary/async/async.lua:14: The coroutine failed with this message: /home/shantnu/.config/nvim/lua/config/vgit-nvim.lua:91: attempt to call global 'round' (a nil value) for some reason. What is this and how do I stop it? This error is irritating ast i have to press enter whenever it pops up

  • nvim --version output:
NVIM v0.6.0-dev
Build type: RelWithDebInfo
Lua 5.1
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-d07uyf/neovim-0.5.0+ubuntu2+git202107201521-2475161de-d569569c9=. -fstack-protector-str
ong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unus
ed-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common
 -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build
/neovim-d07uyf/neovim-0.5.0+ubuntu2+git202107201521-2475161de-d569569c9/build/config -I/build/neovim-d07uyf/neovim-0.5.0+ubuntu2+git202107201521-2475161
de-d569569c9/src -I/build/neovim-d07uyf/neovim-0.5.0+ubuntu2+git202107201521-2475161de-d569569c9/.deps/usr/include -I/usr/include -I/build/neovim-d07uyf
/neovim-0.5.0+ubuntu2+git202107201521-2475161de-d569569c9/build/src/nvim/auto -I/build/neovim-d07uyf/neovim-0.5.0+ubuntu2+git202107201521-2475161de-d569
569c9/build/include
Compiled by buildd@bos02-arm64-021

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
  • Operating system: Ubuntu arm64

VGit fails for projects with repositories without a remote

Description

VGit fails for projects with repositories without a remote

Expected Behavior
Previews should always be highlighted

Actual Behavior
Previewers are sometimes not highlighted

Details

Reproduce 1. Create a repository not associated with any remote 2. Observe VGit failing to work 3.
Environment - nvim --version output: NVIM v0.5.0-dev+1372-g056c464e8 - Operating system: Any

Blame Preview

Describe the solution you'd like

As a user it would be really convenient to get a detailed view of the blame the user is currently on. Please see the screenshot below.

Screen Shot 2021-06-15 at 9 17 37 PM

Repositories without a remote

Describe the solution you'd like

Right now, every interactions you have with VGit is all related to the repository having a remote. There currently exists no feature related to repositories that have no remote.

This feature request is also related to the issue of detecting changes that have been staged. No computation in this plugin is done based on git staging.

Staged hunks or changes should be highlighted with a different highlight, do distinguish between changes that are staged vs changes that are not present in remote.

VGit doesn't work on first opened buffer

Description

Most of the plugin doesn't work on the first opened buffer, only on subsequent ones. Doing :e file to reload the file fixes the issue. The plugin works on new buffers created using splits or tabs. Only a couple of functions like VGit diff and VGit hunks_quickfix_list still work all of the time.

  • nvim --version output:
NVIM v0.5.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
  • Operating system:
    Ubuntu LTS running on windows wsl2

WSL operating system:
Ubuntu 20.04.2 LTS (Focal Fossa)

WSL version:
5.10.16.3-microsoft-standard-WSL2

Windows version:
Windows 11 Version 21H2 (OS Build 22000.51)

Buffer Lens Preview

Description

Provide a full width horizontal buffer preview window, which hovered on a hunk takes the height of the hunk, otherwise a fixed height. This lens can also be used to navigate through other hunks.

This preview is also an improved version of the hunk_preview feature that currently exists

Floating dialogs get stuck

Description

When I install the plugin and call lua vim.lsp.buf.hover() the hover dialog gets stuck. Without the plugin installed the hover windows work absolutely fine.

  • nvim --version output:
  • NVIM v0.5.0
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210702-97973-1wtbty6/neovim-0.5.0/build/config -I/tmp/neovim-20210702-97973-1wtbty6/neovim-0.5.0/src -I/opt/homebrew/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/homebrew/opt/gettext/include -I/tmp/neovim-20210702-97973-1wtbty6/neovim-0.5.0/build/src/nvim/auto -I/tmp/neovim-20210702-97973-1wtbty6/neovim-0.5.0/build/include
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.5.0/share/nvim"

Run :checkhealth for more info
  • Operating system: MacOS Big Sur 11.5.2

Failed Preview Highlights

Description

Open a file via telescope, use some preview feature and then close, it. After this, open the same file with nvim-tree.lua and you will notice that nvim-treesitter fails add highlights to the preview.

Expected Behavior
Previews should always be highlighted

Actual Behavior
Previewers are sometimes not highlighted

Details

Reproduce 1. Open a file via [telescope](https://github.com/nvim-telescope/telescope.nvim) 2. Use some preview feature and then close, it 3. Repeat Step-1 and Step-2 4. After this, open the same file with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua) 5. You will notice that [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) fails add highlights to the preview.
Environment - nvim --version output: NVIM v0.5.0-dev+1372-g056c464e8 - Operating system: Any

Hunk navigation on previews

Describe the solution you'd like

In previews which show diff, users should be able to navigate the hunks if there are any.

Tests

Describe the solution you'd like

VGit has been falling behind test coverage. Before version v0.1.0 is released, the whole application must be secured by unit tests.

Investigate if there is a way to show test coverage for the project as well so that a baseline can be maintained at all costs.

:VGit hunk_stage

Describe the solution you'd like

Thank you for time and effort for this plugin.
Currently, i've switched from gitsigns over to it

But i miss ability to stage hunks from within buffer
... or i overlooked it?

Thank you!

Animated Spinner

We can have things that are nicer in the terminal. Loading spinners add a great user experience. Right now users only see a static text indicating that VGit view is currently loading something.

It would also be amazing if the spinner can be configurable by the users themselves.

Support lazyload

Issue

When setup VGIt, the VGit buffer attach is hook to events.on('BufWinEnter', ':lua require("vgit")._buf_attach()')

This can be a problem if I would like to load the plugin on first VGit command, or, maybe on event BufWinEnter/CmdlineEnter.

Describe the solutions you'd like

  • In setup, attach the current buffer
  • BufferCache, if cache missed, try to load the buffer and return nil only when the buffer add is failed.

Support new files for showing signs

Describe the solution you'd like

Showing 'add signs' for whole buffer in sign-column for untracked files

Thank you!

UPD.

It shows add signs for 'unstaged file' if i stage it

Getting the error on startup

I'm getting the following error on startup after updating the vgit.nvim.

Screenshot 2021-08-20 at 8 50 05 AM

Please let me know if more information is required.

Buffer History with no commits

Description

On a repository with no commits, git log shows a error on the views.

Expected Behavior
Buffer history should show that there are no commits in the repository

Actual Behavior
Shows a view with an error message

Details

Reproduce 1. Open a file via [telescope](https://github.com/nvim-telescope/telescope.nvim) 2. Use some preview feature and then close, it 3. Repeat Step-1 and Step-2 4. After this, open the same file with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua) 5. You will notice that [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) fails add highlights to the preview.
Environment - nvim --version output: NVIM v0.5.0-dev+1372-g056c464e8 - Operating system: Any

Add Layout themes

Describe the solution you'd like

Layout support to configure previews.

Popups might not be everyone's thing. Themes will allow alternate ways of looking at vgit.nvim.

We want users of this plugin to have fine grained control on how they want to assemble vgit.nvim.

This feature will allow users to create their own layouts and submit future PRs for predefined configurations.

Suppress errors shown to users

Describe the solution you'd like

  • If any error occurs we should use some sort of debugging instead of showing users that something went wrong.
  • This will allow us to build a cleaner interface and perhaps only show users errors that we really want/need them to see such as the ones we see in the popup.
  • Having finer control is always better.

Window Focus Indicator

Describe the solution you'd like

As a user it can sometimes be confusing to know which window I am currently focused when a widget is open. Since this plugin is all about making git visually appealing to the users while being inside Neovim, it would really be useful if the user had an indicator to which window they are currently focusing in.

Hunk Prediction

Describe the solution you'd like

  • As the users are typing, the hunks should be calculated as I am typing
  • As I am typing, and as the buffer is unsaved, every single action available related to the hunks should all be workable

Highlight Groups Unset

Description

Highlight Groups are not being set automatically.

  • nvim --version output: 0.5
  • Operating system: MacOS BigSur 11.5.2

Highlight Word Changes in Previews

Having ability to highlight words that were changes within a line is a great way for a programmer to keep track of changes. Mostly all git integrations provide this feature. Here's is a screenshot of the intended feature:

Capture

Horizontal View

Describe the solution you'd like

horizontal_diff

  • The image above shows the desired result to be achieved.
  • Users should have the ability to switch to this view as they are using 'Buffer Preview' feature.
  • A command should be provided which the users can use on these buffers to switch between the views.

Blame Preview

Goal of this plugin is to make the git life easier. This plugin takes inspiration from various sources, even including the Github website itself.

This new preview should look exactly this.

Foldable Lists Component

Describe the solution you'd like

VGit has the following reusable components:

  • Code (Used for previewing code and diff changes via Preview.lua)
  • Table (Can be used to construct table with rows and columns and column header via Preview.lua)

An addition to the UI components having foldable lists would be absolutely amazing from a usability perspective. there are some awesome plugins out there with similar features such as Trouble.nvim.

The goal is to use this foldable list and enhance project_diff_preview and bring out the usability of what can be seen in VSCode:

Capture

Must support the following feature:

  • The folds can be closed and opened by clicking or entering the fold header.
  • Folds should also show the number of elements inside the fold using virtual signs on the fold header.
  • Folds should be stackable.
  • Fold list items should be highly customizable.
  • Implementation must be decoupled to increase reusability in future components. Several other git features will be able to use this in the future, such as:
    • Branches
    • Commits
    • Stashes
  • Folds should be nestable.

Signs not showing on edit/write when PWD is not the git root.

Description

If the nvim PWD is a subdirectory of the git repo, diff signs do now show when a file is opened or saved.
They do show when an open buffer is changed, but disappear when the buffer is saved.

To reproduce using this repo as an example:

# This works as expected
cd path/to/vgit.nvim
nvim lua/vgit/init.lua
# Modify file - signs appear
:w
# Signs persist
# Reproduce error
cd path/to/vgit.nvim/lua
nvim vgit/init.lua
# Modify file - signs appear
:w
# Signs disappear

Setting debug = true then running :VGit show_debug_logs shows the error:

VGit[11:43:48]: VGit[11:43:45][init.lua/_blame_line]: fatal: no such path 'lua/lua/vgit/init.lua' in HEAD
  • nvim --version output:

    • NVIM v0.6.0-dev+14-gdf33f30e8
    • NVIM v0.5.0
  • Operating system:

    • Macos
    • Centos 8

Love your works and thanks!

Widget focus issue without a mouse

Description

Having no mouse support makes it very difficult to navigate through different window components of a widget. There should be a distinction between widgets. Some of them should act like only popups, others should behave like views.

  • nvim --version output: NVIM v0.5.0-dev+1459-g384f9870f
  • Operating system: Ubuntu 20.04

Error: module 'plenary.async' not found

Description

After installation I get next error:

line    3:
E5108: Error executing lua ...iles/nvim/.config/nvim/vendor/vgit.nvim/lua/vgit/git.lua:3: module 'plenary.async' not found:
        no field package.preload['plenary.async']
        no file './plenary/async.lua'
        no file '/usr/share/luajit-2.0.5/plenary/async.lua'
        no file '/usr/local/share/lua/5.1/plenary/async.lua'
        no file '/usr/local/share/lua/5.1/plenary/async/init.lua'
        no file '/usr/share/lua/5.1/plenary/async.lua'
        no file '/usr/share/lua/5.1/plenary/async/init.lua'
        no file './plenary/async.so'
        no file '/usr/local/lib/lua/5.1/plenary/async.so'
        no file '/usr/lib/lua/5.1/plenary/async.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file './plenary.so'
        no file '/usr/local/lib/lua/5.1/plenary.so'
        no file '/usr/lib/lua/5.1/plenary.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
  • nvim --version output:
    NVIM v0.5.0-dev+1318-g61aefaf29
    Build type: RelWithDebInfo
    LuaJIT 2.0.5
    Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/var/tmp/pamac-build-me/neovim-nightly-git/src/build/config -I/var/tmp/pamac-build-me/neovim-nightly-git/src/neovim-nightly-git/src -I/usr/include -I/var/tmp/pamac-build-me/neovim-nightly-git/src/build/src/nvim/auto -I/var/tmp/pamac-build-me/neovim-nightly-git/src/build/include
  • Operating system:
    ArchLinux

Git Diff

Describe the solution you'd like

  • Users usually want to changes made in a repository quickly
  • Since this plugin is all things git, this feature would really be a great addition
  • Similar to history plugin, there should be a bottom view listing all the files that have changes in it with number of addition and deletion, along with other metadata related to the diff
  • Pressing enter should show show the diff that exists for the file
  • This feature should also transform into the quckfix action when user presses c-q

Configurable Popups

Describe the solution you'd like

Telescope is a great example of a plugin that is highly extensible. Users can customize the size and position of the windows. In addition, users can even create their own layout themes (Could be possibly another issue).

VGit's current project structure should easily make us add this feature. Each popup's state could store the following parameters that can be passed in from within setup, which are:

  • height
  • width
  • row
  • col

These four parameters should be enough for a user to configure the window as much as they want. A place where these would go to would be here. Which can used to replace the values used here.

Failed to retrieve tracked files for the project

Description

Expected Behavior

Actual Behavior
image

Details

Reproduce 1. nvim helloWorld.cc
Environment - nvim --version output: NVIM v0.5.0-dev+1362-g3cd688ff7 - Operating system: arch linux - VGit commit:

Invalid command "project_diff_preview"

Description

enter :
:VGit project_diff_preview
Got above errors

Is this command out of date?

Also a few commands not working (no output)
e.g. VGit buffer_history

My config:

require('vgit').setup()

Is there any field that needs to setup to non-default to allow those commands to be working?

  • nvim --version output: nvim-0.6.0
  • Operating system: Mac

Prevent Carriage Return Symbols

Description

In non Unix system, some files may indicate line breaks as carriage returns instead of line breaks. These symbols appear in previews and should be hidden.

A clear and concise description of your bug.

  • nvim --version output: NVIM v0.6.0-dev+13-ga6cdfa27d
  • Operating system: Ubuntu 20.04

Show staged and unstaged changes in `project_diff_preview`

Describe the solution you'd like

Having the ability to show not only changed files but also staged and unstaged files in the project_diff_preview would be very helpful similar to that found in VSCode:

Capture

Using the new folding lists enhance the look and feel of project_diff_preview further to match that of the screenshot.

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.