<feed xmlns='http://www.w3.org/2005/Atom'>
<title>vim-gitcha/ftplugin, branch v0.0.1</title>
<subtitle>Completion for Git SHAs</subtitle>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/'/>
<entry>
<title>ftplugin/gitcommit: Check for `b:did_ftplugin`</title>
<updated>2017-04-29T06:12:24+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-04-29T06:12:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/commit/?id=33bff57b53bbf80e245cda573ed9ec83da7abf9f'/>
<id>33bff57b53bbf80e245cda573ed9ec83da7abf9f</id>
<content type='text'>
Be a good Vim citizen and don't load if `b:did_ftplugin` is already set.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Be a good Vim citizen and don't load if `b:did_ftplugin` is already set.
</pre>
</div>
</content>
</entry>
<entry>
<title>ftplugin/gitcommit: Cleaner `if` condition</title>
<updated>2017-04-29T05:43:02+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-04-29T05:43:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/commit/?id=58eb3fe8a2a26ad6a6bdfba7781cc69fc777b3f8'/>
<id>58eb3fe8a2a26ad6a6bdfba7781cc69fc777b3f8</id>
<content type='text'>
Clean up the check for `g:no_plugin_maps` based on this style from
tpope's gitrebase.vim:

    https://github.com/tpope/vim-git/blob/5fcaf2b4f66cd28984cf4fe814d7803bbf073a12/ftplugin/gitrebase.vim
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Clean up the check for `g:no_plugin_maps` based on this style from
tpope's gitrebase.vim:

    https://github.com/tpope/vim-git/blob/5fcaf2b4f66cd28984cf4fe814d7803bbf073a12/ftplugin/gitrebase.vim
</pre>
</div>
</content>
</entry>
<entry>
<title>ftplugin/gitcommit: Add `b:undo_ftplugin`</title>
<updated>2017-04-29T05:31:32+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-04-29T05:31:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/commit/?id=3950864bd41ce990278ac3a5627f785e1d6e4750'/>
<id>3950864bd41ce990278ac3a5627f785e1d6e4750</id>
<content type='text'>
Allow the plugin's actions to be undone. Will be executed automatically
when users change the filetype, as explained here:

    :h undo_ftplugin
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Allow the plugin's actions to be undone. Will be executed automatically
when users change the filetype, as explained here:

    :h undo_ftplugin
</pre>
</div>
</content>
</entry>
<entry>
<title>ftplugin/gitcommit: Make completion mapping user-editable</title>
<updated>2017-04-29T05:24:52+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-04-29T05:19:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/commit/?id=0108d430e9885547517c4c33050cc6d0cac85fc3'/>
<id>0108d430e9885547517c4c33050cc6d0cac85fc3</id>
<content type='text'>
Instead of forcing the mapping '&lt;C-x&gt;&lt;C-s&gt;' to activate Git SHA
completion, allow users to define a different custom mapping.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of forcing the mapping '&lt;C-x&gt;&lt;C-s&gt;' to activate Git SHA
completion, allow users to define a different custom mapping.
</pre>
</div>
</content>
</entry>
<entry>
<title>Move functions to autoload/</title>
<updated>2017-04-29T02:48:35+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-04-29T02:48:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/commit/?id=ee60b16343ff5e98dc4279bb976586001a002bfe'/>
<id>ee60b16343ff5e98dc4279bb976586001a002bfe</id>
<content type='text'>
Don't force our functions to be loaded when the ftplugin is loaded. Be
good Vimscript citizens and respect load performance.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Don't force our functions to be loaded when the ftplugin is loaded. Be
good Vimscript citizens and respect load performance.
</pre>
</div>
</content>
</entry>
<entry>
<title>Move ftplugin to ftplugin/gitcommit/gitcha.vim</title>
<updated>2017-04-29T02:38:49+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-04-29T02:38:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/commit/?id=bc4fcb2b082805914d6e87ff38516dbafc5c5538'/>
<id>bc4fcb2b082805914d6e87ff38516dbafc5c5538</id>
<content type='text'>
To ensure that we don't conflict with the real "gitcommit" ftplugin,
move ours into a new custom file.

As described in

    :h ftplugin-name

we can create additional ftplugins for the same filetype by putting our
script in a directory named for the filetype.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To ensure that we don't conflict with the real "gitcommit" ftplugin,
move ours into a new custom file.

As described in

    :h ftplugin-name

we can create additional ftplugins for the same filetype by putting our
script in a directory named for the filetype.
</pre>
</div>
</content>
</entry>
<entry>
<title>ftplugin/gitcommit.vim: Restore user completion function</title>
<updated>2017-04-27T23:14:39+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-04-27T23:14:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/commit/?id=08dd78c72a5935fd1aa458c28c2b045a2e4aab39'/>
<id>08dd78c72a5935fd1aa458c28c2b045a2e4aab39</id>
<content type='text'>
Make our custom mapping work while retaining any user-defined
`completefunc`.

Doing it this way enables us to get away without having to set a hacky
`CursorMovedI` unsetting autocommand as imagined in
e70d92c495001c0af0037b9fadbeec170d2c318f.

We clutter our `GitSHAComplete` completion function a bit with
functionality that doesn't really belong to it in order to get a win for
simple implementation of the `completefunc` restore feature.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make our custom mapping work while retaining any user-defined
`completefunc`.

Doing it this way enables us to get away without having to set a hacky
`CursorMovedI` unsetting autocommand as imagined in
e70d92c495001c0af0037b9fadbeec170d2c318f.

We clutter our `GitSHAComplete` completion function a bit with
functionality that doesn't really belong to it in order to get a win for
simple implementation of the `completefunc` restore feature.
</pre>
</div>
</content>
</entry>
<entry>
<title>ftplugin/gitcommit.vim: Remove test code from e70d92c495001c0af0037b9fad</title>
<updated>2017-04-27T22:52:33+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-04-27T22:52:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/commit/?id=41b7976991b46915ad5cd6b8a25aa92ea5334db0'/>
<id>41b7976991b46915ad5cd6b8a25aa92ea5334db0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>ftplugin/gitcommit.vim: Experiment providing a custom mapping</title>
<updated>2017-04-27T22:45:24+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-04-27T22:45:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/commit/?id=e70d92c495001c0af0037b9fadbeec170d2c318f'/>
<id>e70d92c495001c0af0037b9fadbeec170d2c318f</id>
<content type='text'>
Experiment with providing a custom mapping for our Git SHA completion
function. We use &lt;C-x&gt;&lt;C-s&gt;.

The custom mapping should set our function as the custom `completefunc`,
call the user completion function by programmatically running
`&lt;C-x&gt;&lt;C-u&gt;`, and then unset and restore the previous `completefunc`
value.

This allows us to not clobber a user-defined completion function and
also give ourselves a special custom &lt;C-x&gt; mapping.

Just experimenting for now. Figured out how to get this to work using a
test `ASDF` function along with these resources:
* http://stackoverflow.com/questions/15643234/remapping-tab-completions-in-vim
* https://github.com/ervandew/supertab/blob/master/plugin/supertab.vim
* http://stackoverflow.com/questions/6926034/creating-a-mapping-for-insert-mode-but-not-for-autocomplete-submode

It works. The only problem is that we can't restore the old
`completefunc` value. Thinking about ways to do this, and for now my
most promising idea is to use the `CursorMovedI` autocommand.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Experiment with providing a custom mapping for our Git SHA completion
function. We use &lt;C-x&gt;&lt;C-s&gt;.

The custom mapping should set our function as the custom `completefunc`,
call the user completion function by programmatically running
`&lt;C-x&gt;&lt;C-u&gt;`, and then unset and restore the previous `completefunc`
value.

This allows us to not clobber a user-defined completion function and
also give ourselves a special custom &lt;C-x&gt; mapping.

Just experimenting for now. Figured out how to get this to work using a
test `ASDF` function along with these resources:
* http://stackoverflow.com/questions/15643234/remapping-tab-completions-in-vim
* https://github.com/ervandew/supertab/blob/master/plugin/supertab.vim
* http://stackoverflow.com/questions/6926034/creating-a-mapping-for-insert-mode-but-not-for-autocomplete-submode

It works. The only problem is that we can't restore the old
`completefunc` value. Thinking about ways to do this, and for now my
most promising idea is to use the `CursorMovedI` autocommand.
</pre>
</div>
</content>
</entry>
<entry>
<title>ftplugin/gitcommit.vim: Make completion work for commit SHAs</title>
<updated>2017-04-27T21:58:01+00:00</updated>
<author>
<name>Teddy Wing</name>
</author>
<published>2017-04-27T21:58:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.teddywing.com/vim-gitcha/commit/?id=62ca44d3f5ff9d339baf6a12bd46c68dccf94591'/>
<id>62ca44d3f5ff9d339baf6a12bd46c68dccf94591</id>
<content type='text'>
Get the list of SHAs from `git rev-list` and use this for
completion. Not too different from the original structure.

Renamed `res` to `matches` because that seemed clearer to me.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Get the list of SHAs from `git rev-list` and use this for
completion. Not too different from the original structure.

Renamed `res` to `matches` because that seemed clearer to me.
</pre>
</div>
</content>
</entry>
</feed>
