<feed xmlns='http://www.w3.org/2005/Atom'>
<title>dotvim/bundle/git-blamer, branch master</title>
<subtitle>My vim configuration</subtitle>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/'/>
<entry>
<title>git-blamer: Restore &amp;wrap setting on close</title>
<updated>2023-06-14T20:36:16+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2023-06-14T20:33:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/commit/?id=731b2f38194939799bca8e488cfb4fb1026c13cd'/>
<id>731b2f38194939799bca8e488cfb4fb1026c13cd</id>
<content type='text'>
When the blame window is closed, ensure the wrap setting is restored.

Not sure where `l:wrap` came from, maybe just an oversight on my part.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the blame window is closed, ensure the wrap setting is restored.

Not sure where `l:wrap` came from, maybe just an oversight on my part.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-blamer: Add `-M` flag to `git-blame` call</title>
<updated>2021-01-26T20:06:24+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2021-01-20T00:00:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/commit/?id=6bd16fa7a10ca4fbe179bf5fa56545fda5d242c1'/>
<id>6bd16fa7a10ca4fbe179bf5fa56545fda5d242c1</id>
<content type='text'>
Don't change the author for moved lines.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Don't change the author for moved lines.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-blamer: Run `git show` on &lt;Enter&gt;</title>
<updated>2018-03-27T22:50:47+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-03-27T22:50:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/commit/?id=aee838fefd2dd878915e14de0380731482b08e6d'/>
<id>aee838fefd2dd878915e14de0380731482b08e6d</id>
<content type='text'>
When the `&lt;Enter&gt;` key is pressed in the GitBlamer window, run
`!git show` on the commit from the current cursor line of the blame.

This allows a changed line to be inspected in the context of its
original changeset. It also saves me time from my previous workflow:

    cpe^Zgit show &lt;Apple-P&gt;&lt;Enter&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When the `&lt;Enter&gt;` key is pressed in the GitBlamer window, run
`!git show` on the commit from the current cursor line of the blame.

This allows a changed line to be inspected in the context of its
original changeset. It also saves me time from my previous workflow:

    cpe^Zgit show &lt;Apple-P&gt;&lt;Enter&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>git-blamer: Refocus original window when blamer buffer is closed</title>
<updated>2018-03-25T14:13:09+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-03-25T13:59:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/commit/?id=019805f339a0774574d97f138ea2b2c9425db0b4'/>
<id>019805f339a0774574d97f138ea2b2c9425db0b4</id>
<content type='text'>
Previously, when the GitBlamer window was closed, the window it was
opened from would not be re-focused. Because of this, you couldn't just
pick up where you left off, you had to run a window command first.

This change re-focuses the original window automatically, bringing you
right where you were before opening GitBlamer.

Unfortunately, this seemingly simple want is not easy to do in VimL.
There's a `WinLeave` autocmd, but that event gets executed _before_
leaving a window. Similarly, the `BufWinLeave` autocmd we already had
gets executed before the buffer is removed from the window. Because
these events happen before the window is left, running the `wincmd w`
command doesn't work. We need a way to run the command after the window
is closed, allowing us to work with the new window layout and window
numbers.

In order to run `wincmd w` at the proper time, we add a new autocmd upon
closing the GitBlamer window that gets executed when any window is
entered. That autocmd refocuses the correct window and removes itself,
having served its purpose.

I used a tab variable to store the window number because it was a way to
allow multiple GitBlamer instances in different tabs. Otherwise, the
autocmd would be attached to a window that isn't correct in other tabs.
Also, augroups can't have dynamic names, so we can't create them
programmatically, preventing us from having multiple autocmds with
different window numbers for different tabs. The disadvantage of using a
tab variable is that window focus restoration doesn't work when multiple
GitBlamers are opened in a single tab.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, when the GitBlamer window was closed, the window it was
opened from would not be re-focused. Because of this, you couldn't just
pick up where you left off, you had to run a window command first.

This change re-focuses the original window automatically, bringing you
right where you were before opening GitBlamer.

Unfortunately, this seemingly simple want is not easy to do in VimL.
There's a `WinLeave` autocmd, but that event gets executed _before_
leaving a window. Similarly, the `BufWinLeave` autocmd we already had
gets executed before the buffer is removed from the window. Because
these events happen before the window is left, running the `wincmd w`
command doesn't work. We need a way to run the command after the window
is closed, allowing us to work with the new window layout and window
numbers.

In order to run `wincmd w` at the proper time, we add a new autocmd upon
closing the GitBlamer window that gets executed when any window is
entered. That autocmd refocuses the correct window and removes itself,
having served its purpose.

I used a tab variable to store the window number because it was a way to
allow multiple GitBlamer instances in different tabs. Otherwise, the
autocmd would be attached to a window that isn't correct in other tabs.
Also, augroups can't have dynamic names, so we can't create them
programmatically, preventing us from having multiple autocmds with
different window numbers for different tabs. The disadvantage of using a
tab variable is that window focus restoration doesn't work when multiple
GitBlamers are opened in a single tab.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-blamer: Fix bug when `nowrap`</title>
<updated>2018-03-24T03:41:53+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-03-24T03:41:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/commit/?id=f8efc45d741883eb1566b9973fe1a24a79061b97'/>
<id>f8efc45d741883eb1566b9973fe1a24a79061b97</id>
<content type='text'>
If `nowrap` is set, the plugin causes an error because it tries to
concatenate the `restore` variable which hasn't been defined. Define the
variable outside the `if &amp;l:wrap` condition to ensure it's available for
concatenation.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If `nowrap` is set, the plugin causes an error because it tries to
concatenate the `restore` variable which hasn't been defined. Define the
variable outside the `if &amp;l:wrap` condition to ensure it's available for
concatenation.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-blamer: Set `nowrap` on buffer</title>
<updated>2018-03-07T20:17:58+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-03-07T20:17:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/commit/?id=ee5760b0cd08ebe8dce08b230581cedccb7ce4ef'/>
<id>ee5760b0cd08ebe8dce08b230581cedccb7ce4ef</id>
<content type='text'>
In order to get the cursor lines to correctly match up horizontally in
all cases, set 'nowrap' on the buffer.

To set 'wrap' back, follow fugitive.vim's example:
https://github.com/tpope/vim-fugitive/blob/f3ccb0c12ee4985b8808f83059830a24cc92821c/plugin/fugitive.vim#L2038-L2040
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to get the cursor lines to correctly match up horizontally in
all cases, set 'nowrap' on the buffer.

To set 'wrap' back, follow fugitive.vim's example:
https://github.com/tpope/vim-fugitive/blob/f3ccb0c12ee4985b8808f83059830a24cc92821c/plugin/fugitive.vim#L2038-L2040
</pre>
</div>
</content>
</entry>
<entry>
<title>git-blamer: Add `q` mapping to quit window</title>
<updated>2018-03-07T20:11:51+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-03-07T20:11:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/commit/?id=17acd727bbb97950536da0963f0b9a2af449ee13'/>
<id>17acd727bbb97950536da0963f0b9a2af449ee13</id>
<content type='text'>
Makes it just a bit easier to close the GitBlamer window. Since we
shouldn't need macros in this panel it should be fine.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Makes it just a bit easier to close the GitBlamer window. Since we
shouldn't need macros in this panel it should be fine.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-blamer: Use `syncbind` to aid horizontal line alignment</title>
<updated>2018-03-07T20:08:47+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-03-07T20:08:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/commit/?id=56440acd5b4dbd5d871021088ef4c2080cda346d'/>
<id>56440acd5b4dbd5d871021088ef4c2080cda346d</id>
<content type='text'>
Adding `syncbind` appears to fix the bug where in certain cases the
GitBlamer cursor line and the buffer cursor line weren't horizontally
aligned.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Adding `syncbind` appears to fix the bug where in certain cases the
GitBlamer cursor line and the buffer cursor line weren't horizontally
aligned.
</pre>
</div>
</content>
</entry>
<entry>
<title>git-blamer: Use `cursor()` instead of `setpos()`</title>
<updated>2018-03-07T20:04:01+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-03-07T20:04:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/commit/?id=a48836ad6f4e8aae8b1dcd5b5c0d8a5935271abc'/>
<id>a48836ad6f4e8aae8b1dcd5b5c0d8a5935271abc</id>
<content type='text'>
Use the `cursor()` function to set the position of the cursor. This call
is simpler than `setpos()`, and more descriptive than `execute
l:top_line` (that was inspired by fugitive.vim,
https://github.com/tpope/vim-fugitive/blob/f3ccb0c12ee4985b8808f83059830a24cc92821c/plugin/fugitive.vim#L2048-L2064)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use the `cursor()` function to set the position of the cursor. This call
is simpler than `setpos()`, and more descriptive than `execute
l:top_line` (that was inspired by fugitive.vim,
https://github.com/tpope/vim-fugitive/blob/f3ccb0c12ee4985b8808f83059830a24cc92821c/plugin/fugitive.vim#L2048-L2064)
</pre>
</div>
</content>
</entry>
<entry>
<title>git-blamer: Align cursor lines of buffer and GitBlamer window</title>
<updated>2018-03-07T19:52:34+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2018-03-07T19:52:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/dotvim/commit/?id=26d6b13bc20582b09df7ee40c7d0f2c2580d19e2'/>
<id>26d6b13bc20582b09df7ee40c7d0f2c2580d19e2</id>
<content type='text'>
Take the mechanism that Fugitive.vim uses:
https://github.com/tpope/vim-fugitive/blob/f3ccb0c12ee4985b8808f83059830a24cc92821c/plugin/fugitive.vim#L2048-L2064

This positions the cursor lines on the same horizontal line so that
blame information can be read on the same line as the code it
corresponds to.

Not sure, but it doesn't seem to work exactly right on one of my
machines, but did appear to work correctly on another. Could just be the
fault of 'wrap' though.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Take the mechanism that Fugitive.vim uses:
https://github.com/tpope/vim-fugitive/blob/f3ccb0c12ee4985b8808f83059830a24cc92821c/plugin/fugitive.vim#L2048-L2064

This positions the cursor lines on the same horizontal line so that
blame information can be read on the same line as the code it
corresponds to.

Not sure, but it doesn't seem to work exactly right on one of my
machines, but did appear to work correctly on another. Could just be the
fault of 'wrap' though.
</pre>
</div>
</content>
</entry>
</feed>
