Git Product home page Git Product logo

git-messenger.vim's Introduction

git-messenger.vim

Build Status codecov

git-messenger.vim is a Vim/Neovim plugin to reveal the hidden message from Git under the cursor quickly. It shows the history of commits under the cursor in popup window.

This plugin shows the message of the last commit in a 'popup window'. If the last commit is not convenient, you can explore older commits in the popup window. Additionally you can also check diff of the commit.

The popup window is implemented in

  • Floating window on Neovim (0.4 or later)
  • Preview window on Vim (8 or later) or Neovim (0.3 or earlier)

The floating window is definitely recommended since it can shows the information near the cursor.

I wrote a Japanese blogpost for this plugin.

Why?

When you're modifying unfamiliar codes, you would sometimes wonder 'why was this line added?' or 'why this value was chosen?' in the source code. The answer sometimes lays in a commit message, especially in message of the last commit which modifies the line.

Screenshot

Show popup window with Neovim v0.4.0-dev

main screenshot

Exploring older commits

history screenshot

Exploring diff of the commit (you may be also interested in g:git_messenger_include_diff)

diff screenshot

Switching unified diffs and word diffs

word diff screenshot

Installation

Please ensure the following requirement before installing this plugin.

  • Git v1.8.5 or later (for -C option of git command)

If you use any package manager, please follow its instruction.

With vim-plug:

Plug 'rhysd/git-messenger.vim'

With dein.vim:

call dein#add('rhysd/git-messenger.vim', {
            \   'lazy' : 1,
            \   'on_cmd' : 'GitMessenger',
            \   'on_map' : '<Plug>(git-messenger)',
            \ })

With minpac:

call minpac#add('rhysd/git-messenger.vim')

if you use Vim's builtin packager, please follow the instruction at :help pack-add.

To enable a floating window support, you need to install Neovim 0.4 or later. Please follow the official instruction.

To check if Neovim's floating window feature is available, try :checkhealth.

Usage

Only one mapping (or one command) provides all features of this plugin. Briefly, move cursor to the position and run :GitMessenger or <Leader>gm. If you see an error message, please try health check.

Commands

:GitMessenger

Behavior of this command is depending on the situation. You can do every operations only with this mapping.

  • Normally, it opens a popup window with the last commit message
  • When a popup window is already open, it moves cursor into the window
  • When a cursor is within a popup window, it closes the window

It opens a popup window with the last commit message which modified the line at cursor. The popup window shows following contents:

  • History: History: {page number} In popup window, o/O navigates to previous/next commit.
  • Commit: Commit: {hash} The commit hash
  • Author: Author: {name}<{email}> Author name and mail address of the commit
  • Committer: Committer: {name}<{email}> Committer name and mail address of the commit when committer is different from author
  • Date: Date: {date} Author date of the commit in system format
    • When a committer date and an author date are different (e.g. the commit was created again with git commit --amend), both Author Date: and Committer Date: are shown.
  • Summary: First line after Date: header line is a summary of commit
  • Body: After summary, commit body is put (if the commit has body)

The popup window will be automatically closed when you move the cursor so you don't need to close it manually.

Running this command while a popup window is open, it moves the cursor into the window. This behavior is useful when the commit message is too long and window cannot show the whole content. By moving the cursor into the popup window, you can see the rest of contents by scrolling it. You can also see the older commits.

Following mappings are defined within popup window.

Mapping Description
q Close the popup window
o older. Back to older commit at the line
O Opposite to o. Forward to newer commit at the line
d Toggle unified diff hunks only in current file of the commit
D Toggle all unified diff hunks of the commit
r Toggle word diff hunks only in current file of the commit
R Toggle all word diff hunks of current commit
? Show mappings help

Mappings

<Plug>(git-messenger)

The same as running :GitMessenger command.

By default, this plugin defines following mapping.

nmap <Leader>gm <Plug>(git-messenger)

If you don't like the default mapping, set g:git_messenger_no_default_mappings to v:true in your .vimrc or init.vim and map the <Plug> mapping to your favorite key sequence.

For example:

nmap <C-w>m <Plug>(git-messenger)

Some other additional <Plug> mappings. Please read :help git-messenger.

Variables

Some global variables are available to configure the behavior of this plugin.

g:git_messenger_close_on_cursor_moved (Default: v:true)

When this value is set to v:false, a popup window is no longer closed automatically when moving a cursor after the window is shown up.

g:git_messenger_include_diff (Default: "none")

One of "none", "current", "all".

When this value is not set to "none", a popup window includes diff hunks of the commit at showing up. "current" includes diff hunks of only current file in the commit. "all" includes all diff hunks in the commit.

Please note that typing d/D or r/R in popup window toggle showing diff hunks even if this value is set to "none".

g:git_messenger_git_command (Default: "git")

git command to retrieve commit messages. If your git executable is not in $PATH directories, please specify the path to the executable.

g:git_messenger_no_default_mappings (Default: v:false)

When this value is set to v:true, it does not define any key mappings. <Plug> mappings are still defined since they don't make any conflicts with existing mappings.

g:git_messenger_into_popup_after_show (Default: v:true)

When this value is set to v:false, running :GitMessenger or <plug>(git-messenger) again after showing a popup does not move the cursor in the window.

g:git_messenger_always_into_popup (Default: v:false)

When this value is set to v:true, the cursor goes into a popup window when running :GitMessenger or <Plug>(git-messenger).

g:git_messenger_extra_blame_args (Default: "")

When this variable is set the contents will be appended to the git blame command. Use it to add options (like -w).

g:git_messenger_preview_mods (Default: "")

This variable is effective only when opening preview window (on Neovim (0.3.0 or earlier) or Vim).

Command modifiers for opening preview window. The value will be passed as prefix of :pedit command. For example, setting "botright" to the variable opens a preview window at bottom of the current window. Please see :help <mods> for more details.

g:git_messenger_max_popup_height (Default: v:null)

Max lines of popup window in an integer value. Setting v:null means no limit.

g:git_messenger_max_popup_width (Default: v:null)

Max characters of popup window in an integer value. Setting v:null means no limit.

g:git_messenger_date_format (Default: "%c")

String value to format dates in popup window. Please see :help strftime() to know the details of the format.

" Example: '2019 May 26 03:27:43'
let g:git_messenger_date_format = "%Y %b %d %X"

g:git_messenger_conceal_word_diff_marker (Default: v:true)

When this value is set to v:true, markers for word diffs like [-, -], {+, +} are concealed. Set v:false when you don't want to hide them.

Note: Word diff is enabled by typing "r" in a popup window.

g:git_messenger_floating_win_opts (Default {})

Options passed to nvim_open_win() on opening a popup window. This is useful when you want to override some window options.

The following example will add single border line to the window.

let g:git_messenger_floating_win_opts = { 'border': 'single' }

g:git_messenger_popup_content_margins (Default: v:true)

Setting v:true means adding margins in popup window. Blank lines at the top and bottom of popup content are inserted. And every line is indented with one whitespace character. Setting v:false to this variable removes all the margins.

Popup Window Highlight

This plugin uses color definitions from your colorscheme for highlighting stuffs in popup window by default. This is done by linking highlight groups in syntax/gitmessengerpopup.vim on gitmessengerpopup filetype. Highlights for diff are common with normal diff filetype syntax highlighting.

If the groups don't fit, please rearrange the highlight with :hi link. For example:

" Normal color in popup window with 'CursorLine'
hi link gitmessengerPopupNormal CursorLine

" Header such as 'Commit:', 'Author:' with 'Statement' highlight group
hi link gitmessengerHeader Statement

" Commit hash at 'Commit:' header with 'Special' highlight group
hi link gitmessengerHash Special

" History number at 'History:' header with 'Title' highlight group
hi link gitmessengerHistory Title

For another example, if you want to define colors directly, defining the colors with :hi works fine as follows.

hi gitmessengerPopupNormal term=None guifg=#eeeeee guibg=#333333 ctermfg=255 ctermbg=234
hi gitmessengerHeader term=None guifg=#88b8f6 ctermfg=111
hi gitmessengerHash term=None guifg=#f0eaaa ctermfg=229
hi gitmessengerHistory term=None guifg=#fd8489 ctermfg=210

Note: If your colorscheme does not allocate proper color for NormalFloat, you may need to set proper color to gitmessengerPopupNormal.

Note: gitmessengerPopupNormal is only available on Neovim since winhighlight option is used. On Vim, simply Normal highlight group is used for normal color.

Configuration for Popup Window

Filetype gitmessengerpopup is set in the popup window. Please hook FileType event to do some local setup within a popup window.

For example:

function! s:setup_git_messenger_popup() abort
    " Your favorite configuration here

    " For example, set go back/forward history to <C-o>/<C-i>
    nmap <buffer><C-o> o
    nmap <buffer><C-i> O
endfunction
autocmd FileType gitmessengerpopup call <SID>setup_git_messenger_popup()

Recent Neovim supports adding border lines to floating windows. git_messenger_floating_win_opts is available to set the options. And g:git_messenger_popup_content_margins can remove margins within popup content if you feel margins are unnecessary.

let g:git_messenger_floating_win_opts = { 'border': 'single' }
let g:git_messenger_popup_content_margins = v:false

popup with border

Health Check

This plugin supports a health checker on Neovim. When you see some error, please run :checkhealth to check your environment is ready for use of this plugin.

On Vim, please install vim-healthcheck and run :CheckHealth. It's a plugin to run :checkhealth on Vim.

Known Issues

  • On Windows, git command installed via MSYS does not work. Please use Git for Windows for now. This issue is tracked at #57.

License

Distributed under the MIT License

git-messenger.vim's People

Contributors

ahonn avatar alfunx avatar bew avatar chiastolite avatar colinryan avatar hokorobi avatar jshuay avatar justincsmith avatar lyokha avatar misanthropicbit avatar phelipetls avatar pocari avatar rhysd avatar voldikss avatar vsajko avatar wookayin 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-messenger.vim's Issues

[Feature Request] View word-diff version of commit

I usually find it very useful to see the --word-diff of a commit instead of the normal diff.

I have a working (albeit hacked together) version working that passes the default --word-diff=plain to the git arguments in s:blame__reveal_diff and added some additional syntax stuff to highlight the word-diff. One issue that popped up is that lines can become quite long as seen in the screenshot.

For starters, I can clean everything up and submit a pull request if you agree this would be a useful feature?

Screenshot 2020-12-22 at 10 23 16

Jumping to another window

When opening the floating window with an existing split window the cursor is jumping to the split window:
git-messenger

Diff does not work with initial commit

Repro

  1. git init .
  2. echo aaa > foo.txt
  3. git add foo.txt && git commit -m 'init'
  4. vim foo.txt
  5. :GitMessenger
  6. :GitMessenger
  7. Type d

Expected

Show diff of initial commit of file foo.txt

Actual

Error as follows:

git-messenger: fatal: bad revision 'xxxxxxxx^..xxxxxxxx' : `git --no-pager diff xxxxxxxx^..xxxxxxxx -- nvimrc` exited with non-zero status 128

where xxxxxxxx is a commit hash

Investigation

This issue is caused because git-messenger.vim obtains diff of specific commit by git diff {hash}^..{hash}. For initial commit, {hash}^ is invalid so the commit fails.

Duplicated text in commits starting with '[]'

If the commit message starts with square brackets [] opening and closing the diffs duplicate the text

Commit example:

Dummy commit

[Test] git messenger commit test

Steps:

  • Create a new commit with the commit example
  • Execute :GitMessenger
  • Jump to gitmessenger window and reveal diff with "d" or "D"

messenger

messenger2

Consider `<nowait>` for floating window mappings

If I press d to see diff, there's a pause as it decides whether I meant "show diff" or "delete". Adding <nowait> to line 177 of autoload/gitmessenger/popup.vim fixes that. It may be worth having behind an option in case it conflicts with something.

Toggle diff

Is possible to toggle diffs by pressing d or D twice? i.e the first time actually reveal the diff hunks and the second time d or D is press hide them. Thanks!

Inside .github directory is detected as inside .git directory

Repro

  1. Clone https://github.com/rhysd/git-messenger.vim.git
  2. cd /path/to/git-messenger
  3. Open .github/workflows/ci.yaml
  4. Run :GitMessenger

Expected behavior

The command runs successfully

Actual behavior

git-messenger: Directory '/Users/rhysd/.vim/bundle/git-messenger.vim/.github/workflows' is not inside a Git repository

Environment

  • git-messenger: 74b767a
  • Vim: 8.2.2164

unmap inside the popup window

I have remapped d to scroll down the half-page in my workflow, but git-messenger.vim can't unmap d inside popup.

filetype event didn't work because it was triggered before mapping key inside the popup window.

popup mappings don't work

Pressing any of the default mapping keys just do the default neovim action. (e.g: o sets the insert mode and add a newline)

Any idea?

Lines starting with '-' are highlighted as 'removed' in word diffs

Repro

  1. git clone https://github.com/rhysd/git-messenger.vim.git && cd git-messenger.vim
  2. Open README.md
  3. Move cursor to line starting with - (list item). At this time it's L15 for instance
  4. :GitMessenger twice to enter the popup
  5. r to reveal word diff

Expected behavior

Only removed parts are highlighted as 'removed'

Actual behavior

The line starting with - is also highlighted as 'removed'

スクリーンショット 2021-02-15 22 40 19

Environment

  • git-messenger.vim: be97d5e
  • Vim: 8.2.2164

description on "g:git_messenger_no_default_mappings" is incorrect

I think readme & help file should be modified with following part.

At first, readme describes as follows and that is true.

If you don't like the default mapping, set g:git_messenger_no_default_mappings to v:true in your .vimrc or init.vim and map the mapping to your favorite key sequence.

but below lines seems to explaining opposite thing.

g:git_messenger_no_default_mappings (Default: v:true)

When this value is set to v:false, it does not define any key mappings. mappings are >still defined since they don't make any conflict with existing mappings.

It should be

  • (Default: v:false) = given default is not v:true but v:false.
  • When this value is set to v:true, it does not .... = with v:true, there would be no default key mapping.

Thanks.

Can't resolve file paths that include a space

File paths that include a space fail to resolve in gitmessenger#git#root_dir() resulting in the error:

git-messenger: Directory '/my git root with space' is not inside a Git repository

Cursor doesn't move inside the popup window

Behavior of this command is depending on the situation. You can do every operations only with this mapping.

  • Normally, it opens a popup window with the last commit message
  • When a popup window is already open, it moves cursor into the window
  • When a cursor is within a popup window, it closes the window

<leader>gm open the popup properly, I can see all the info. But the cursor is not moved inside so I can't use any of the other mappings to go back/forward in history etc…

As you can see in the image, o creates a new line & D deletes the rest of the line.

popup

Worktree inside main repository causes an error

Repro

git init .
echo foo > a.txt
git add a.txt
git commit -m init
git checkout -b other
git checkout -
git worktree add work other

Then open work/a.txt and run :GitMessenger

Expected behavior

Show the 'init' commit

Actual behavior

Cause an error as follows:

git-messenger: fatal: no such path 'work/a.txt' in HEAD: `git --no-pager blame /Users/rhysd/Tmp/foo/work/a.txt -L 1,+1 --porcelain` exited with non-zero status 128

Note: This is not related to #37 but I found this bug while debugging the issue.

[Feature Request] Diff of unstaged content

git-messenger.vim is a Vim/Neovim plugin to reveal the hidden message from Git under the cursor quickly. It shows the history of commits under the cursor in popup window.

I know that this plugin is developed to display the commited messenger and blame.
Could it support diff for unstaged/uncommited content? (like what git-p does)

Opening preview-window closes folds

Using Vim 8.1, when git-messenger opens the preview-window on a file containing open folds, they are all closed as if I had just opened the file. I have to manually open them again to restore the view as it was before calling git-messenger.

However when I switch to the preview-window or close it using the same mapping, my folds are kept intact.

Ignore whitespace

Hi. Great plugin but I'm having an issue with whitespace and I'd like to add a flag to diff (-w) to fix it. How would I go about doing that?

Wrong cursor position after diff

Awesome plugin! I found one minor nit. Consider the following minimal init.vim:

set nocompatible

let $DOTVIM = expand('$HOME/.config/nvim')

set runtimepath+=$DOTVIM/bundle/repos/github.com/rhysd/git-messenger.vim

filetype plugin indent on
let g:mapleader = ','
nmap <silent> <Leader>gm <Plug>(git-messenger)

Now as in the GIF:

  1. run ,gm twice from a right vertical split window
  2. Press D in the floating window to get a diff
  3. Press q to exit the floating window
  4. Now the cursor is on the left vertical split
    I expect the cursor position to be preserverd.

gitmessenger

Bonus: is it possible to render diffs always below the cursor? Currently when I press D inside the floating window then the floating window generally moves to the upper west corner of the screen.

Vimproc使用時にエラーステータスを取得できない

vimproc 有効時にもステータス参照に v:shell_status を見にいってしまっているため、シェルコマンドのステータスを正常にハンドリングできていません。
vimproc利用時には vimproc#get_last_status() でステータスを取得できます。

修正してみましたが、Pull-req を送る程でもないので、Issueにしておきます。

Does not detect symlinks

Hi! I've been using this plugin for a few months now, and today I noticed that it does not detect a symlinked folder that is inside a git directory. That is, if the original directory/file is in a git repo, and I am accessing the symlink through vim, it does not detect the repo. WOuld it be possible to add this enhancement?

Question about autocmd on float window

Hi, @rhysd :
I am debugging a vim plugin using BufEnter autocmd on nvim. I found that when I call :GitMessenger, a BufEnter autocmd is triggered. But BufEnter won't be triggered again when float window disappear (git_messenger_close_on_cursor_moved is true).
My plugin depends BufEnter to do some detect. When it enter to git-messenger buffer, function is closed, and there is no condition to make me open function again when back to normal buffer.
I am not familiar with vimscript, so could you help to answer my question?

  1. Is this the vim/nvim behavior which plugins can not do something to change it ?
  2. Does git-messenger depends on this autocmd? Could git-messenger do something to make no BufEnter on popup window show or BufEnter again when popup window close? (Because I think it may be a more compatible behavior to have pairing autocmd.)
    This may not an issue of git messenger, but thanks any way~

Commit hash always on new line

This isn't a real problem, but also not very nice: if the Commit: <commit-hash> line is the longest, it does not get respected on the floating window width calculation. Instead the width is too small and I get the commit hash is on a new line. Similar goes for long Author: <author> lines, which also break into a new line instead of a more wide window with the full author in one line. It would be just more pretty. I add two screenshots with examples (my colorscheme it not optimal for this atm).

Commit hash on new line:
screenshot_1574417945

Author line break:
screenshot_1574417935

<leader>gm doesn't work out-of-the-box for me.

I installed via minpac.

Went to give this a try and pressed <leader>gm and got nothing. :GitMessenger<CR> works though.

I'm on the latest Vim provided by Homebrew on macOS (8.1).

Any ideas why this wouldn't work out of the box? I checked my mappings and, as far as I can tell, I don't have anything mapped to <leader>gm or even <leader>g.

Popup allows to switch its buffer

Derived from #3.

Repro

:edit README.md
:GitMessenger
:GitMessenger
:bnext

Expected behavior

Popup closes

Actual behavior

Popup window is still showing up and its buffer is README.md (original buffer was wiped out)

Please do not map h and l in the floating window

In commit f6fa25a, new keybindings are added: h and l for browsing prev/next commit on the line. This feature is so nice, but I feel the default keybinding is somewhat unnatural to me as h and l are also the keys for cursor movement. Please consider switching to another keys by default.

It would be also great to have those keymaps configurable, using <Plug> mappings.

Git on CentOS7 does not work because it does not support -C option

Version info: neovim 0.5.0
git: 1.8.3.1
system: CentOS 7.4

When using the default mapping <leader>gm to show message a line: I am seeing the following error:

git-messenger: Unknown option: -C usage: git ....

I think it is because the git version is not so up to date. Can we use --git-dir and --work-tree option instead of -C?

Preview was closed immediately as soon as it was opened on Vim 8

Vim version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 10 2018 21:31:58)
including patch: 1-1453

This plugin works perfect on Neovim. but on Vim 8, the preview window will crash on the moment it is created if I set updatetime to 100.

Is this a bug of Vim? Do we have a solution for the problem?

Float window is not respectively sized its the content

Love this plugin, however, at some point, the floating window just got huge/oversized and won't size to the content itself. I've tried setting the g:git_messenger_max_popup_height and g:git_messenger_max_popup_width plugin preferences, but they don't seem to make a difference. CoC and other popup/floating window plugins seem to be fine. Any thoughts of what I might look at/adjust to try and fix?

git-messenger-float-window-oversized

git-messenger seems to fail in worktrees

When I try it in a worktree I see something like:
git-messenger: fatal: '/usr/scratch/<snip>' is outside repository :git --no-pager blame /usr/scratch/ -L 86,+1 --porcelainexited with non-zero status 128

If I do it in the main directory I don't see this issue.

[Feature request] Support for content diff in the float window

Thanks you, this is an awesome plugin! Since I can view the specific commit history with it. It would be better that this plugin supports viewing the changed content.

Most people as well as I commonly use vim-fugutive's command Gvdiff to view the not yet staged content. Besides, we use vim-mundo to view the history.

Now there might be a plugin which allow us to view the changed content within a commit. How do you think about this?

Better error message handling

If you perform a :GitMessenger on a file that has no HEAD then you get a very convoluted error message.
Error below:

Error detected while processing function <SNR>204_on_exit_vim[2]..<SNR>204_git__may_finalize_vim[10]..<SNR>203_blame__after_blame:
line    8:
E605: Exception not caught: `git --no-pager blame /home/mikey/code/node/test/src/support/api/etfs.api.js -L 3,+1 --porcelain` exited w
ith non-zero status 128: fatal: no such ref: HEAD
Error detected while processing function <SNR>204_on_exit_vim[2]..<SNR>204_git__may_finalize_vim:
line   10:
E171: Missing :endif
Press ENTER or type command to continue

ideally the error message could be more friendly.

Triggering :GitMessenger changes the color of ~ in the sidebar

This just started happening with the latest update. When you run :GitMessenger, all of the ~ characters in the left margin change colors in all buffers. In my case, they change from grey to white.

BEFORE
Screen Shot 2019-05-23 at 2 58 43 PM
AFTER
Screen Shot 2019-05-23 at 2 58 56 PM

I also removed all of my personal config to see if that changed anything, but that did not help.

Support colorscheme

I was pondering if it is possible to use our colorscheme to choose a background color for the popup.
I use Gruvbox, which has variations of its main background color, that would be useful.
I made an issue here: morhetz/gruvbox#278
I think coc.nvim uses Pmenu as its highlight group, which seems to work fine.

Don't give error when first commit is reached

When using o and O to move through the commit history if the last commit is reached the following message is shown:

git-messenger: The latest commit

On the other hand when the first commit is reached and o is pressed again the following error shows:

git-messenger: fatal: no such path vim/init.vim in 238b69d88d84f13a746f8be64c9b15fc736a9748 : `git ...edro/git-repos/private/dotfiles/vim/init.vim -L 360,+1 --porcelain` exited with non-zero status 128

Is that a feature? Isn't it better to show a message like git-messenger: Already at oldest commit? Thanks!

Show total number of revisions

I think it would be useful to show the total number of revisions in the History: #0 text:
image

Something like History: #0 (0/2). What do you think? Thanks!

Outside repository error on windows with msys/git

Giving a full path to msys/git doesn't seem to work well.
When :GitMesseger is executed on the C:\Users\hokorobi\vimfiles\vimrc, it will be as follows.

git-messenger: fatal: 'C:\Users\hokorobi\vimfiles\vimrc' is outside repository at '/home/hokorobi/vimfiles': `git --no-pager blame C:\Users\hokorobi\vimfiles\vimrc -L 1,+1 --porcelain` exited with non-zero status 128

Error when in submodule

When I try to call git-messenger in a submodule it fails with an error like:

git-messenger: fatal: no such path 'path/to/submodule/path/to/file' ... exited with non-zero status 128

To explain a little more:

path/to/submodule is the path to the sub module from the top-level repository (containing .git).
path/to/file is the path to the file from where I am calling git-messenger relative to submodule directory.

I am using vim-rooter to automatically change into project root directories identified by .git directory/file, Now, submodules are special, because they also contain a .git file, but this is just a text file containing the path to the submodule git directory like this:

gitdir: relative/path/to/toplevel_repo/.git/modules/path/to/submodule

vim-rooter behaves correctly by changing into path/to/submodule which is what I want most of the time. So when I open a file inside the submodule vim automatically changes into the directory of the submodule. Git-messenger however resolves the path up until the top-level repo and of course, the path/to/submodule/path/to/file doesn't exist relative to the current submodule directory, giving the above error.

I think a fix for correctly finding .git was introduced for git worktrees in this commit. Maybe this can be extended to also handle submodules.

Error when Calling :GitMessenger

Hi, I got some errors after calling :GitMessenger function. Here is the error.

Error detected while processing function <SNR>112_on_exit_nvim[2]..<SNR>111_blame__after_log[21]..<SNR>111_blame__open_popup[31]..<SNR>110_popup__open[5]..<SNR>110_popup__window_size:
line    2:
E117: Unknown function: win_screenpos
Press ENTER or type command to continue
Error detected while processing function <SNR>112_on_exit_nvim[2]..<SNR>111_blame__after_log[21]..<SNR>111_blame__open_popup[31]..<SNR>110_popup__open[5]..<SNR>110_popup__window_size:
line    2:
E15: Invalid expression: win_screenpos(bufwinnr(self.opener_bufnr))
Press ENTER or type command to continue
Error detected while processing function <SNR>112_on_exit_nvim[2]..<SNR>111_blame__after_log[21]..<SNR>111_blame__open_popup[31]..<SNR>110_popup__open:
line    5:
E714: List required
Press ENTER or type command to continue

I'm using neovim 0.3.1. Any help is appreciated. Thank you

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.