aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2017-05-10Increase version v0.0.1 -> v0.0.2HEADv0.0.2masterTeddy Wing
2017-05-10Add CHANGELOGTeddy Wing
2017-05-10Merge branch 'completeopt-menuone'Teddy Wing
2017-05-10ftplugin/gitcommit: Restore <Plug> mappingTeddy Wing
Restore this after 60bc8ea8b3b7be511c4240ca1d7dc1cc1149b113 where I made a mess experimenting trying to get `complete()` to work. Take the mapping that we used successfully from that commit and combine it with our `<Plug>` mappings from before to call our new completion function.
2017-05-10autoload/gitcha.vim: Remove cruft after switching to `complete()`Teddy Wing
Remove all the cruft from 60bc8ea8b3b7be511c4240ca1d7dc1cc1149b113: * Don't store user-defined 'completefunc' any more since we no longer change that setting. * Remove the commented `a:findstart` code, which is no longer relevant since this function is no longer a 'completefunc'. * Remove commented test & debugging code * Remove the `gitcha#StartGitSHACompletion()` function, which was there only to facilitate mapping to the user completion function defined in 'completefunc' using the Vim-assigned mapping `<C-x><C-u>`. Our map now directly invokes `gitcha#GitSHAComplete()`.
2017-05-10gitcha#GitSHAComplete(): Use `complete()` to open popup menu (WIP)Teddy Wing
Work in progress Rough code for a working implementation using `complete()` instead of 'completefunc'. Rejigger `start` and make a new `base` variable since we can no longer get it as an argument. Correctly reset 'completeopt' to its original user value after opening the popup menu. Return an empty string from the function as recommended by :h complete()
2017-05-10autoload/gitcha.vim: Set completeopt+=menuoneTeddy Wing
Work in progress Adds 'menuone' to the 'completeopt' option. This makes the popup menu display even if there's only a single result. We want this because it allows us to see the commit message subject for the completed SHA, providing a way to confirm that the completed SHA is the right one. Here, the idea was to try to save the user's 'completeopt' setting and restore it after completion, but we can't do that in `gitcha#GitSHAComplete` because if we do, it restores 'completeopt' before the completion menu is shown. Thus, it cancels out our custom `+=menuone` setting. After checking online to see how other plugins handle this (https://github.com/search?utf8=%E2%9C%93&q=completeopt+language%3AVimL+path%3A%2Fautoload&type=Code&ref=advsearch&l=&l=), I found that they use the `complete()` built-in function instead of overriding the user-designated 'completefunc' setting: https://github.com/heavenshell/vim-flood/blob/2bd8580642c56c2a090a8e44cc768e98019310be/autoload/flood/complete.vim This allows us to add `+=menuone` before calling `complete()` and remove the setting afterwards. Using `complete()` seems like the way to go here, so it looks like I'm going to have to refactor the code to do that instead in order to get "menuone" to work. The way I originally wrote the program was intuitive at the time. I'm glad I did it that way, because it provided me with the knowledge of how to remap the built-in completion mappings in Auditory.vim. Will have to try that out at some point.
2017-04-29Remove TODOv0.0.1Teddy Wing
All tasks are complete. This file is no longer needed at the moment.
2017-04-29Update TODOTeddy Wing
2017-04-29ftplugin/gitcommit: Check for `b:did_ftplugin`Teddy Wing
Be a good Vim citizen and don't load if `b:did_ftplugin` is already set.
2017-04-29Update TODOTeddy Wing
2017-04-29Add READMETeddy Wing
Include a short description, screenshot, and license information.
2017-04-29Add license (GPLv3+)Teddy Wing
2017-04-29Add Vim documentationTeddy Wing
Include a short description, information about the included completion mapping, and license text.
2017-04-29ftplugin/gitcommit: Cleaner `if` conditionTeddy Wing
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
2017-04-29ftplugin/gitcommit: Add `b:undo_ftplugin`Teddy Wing
Allow the plugin's actions to be undone. Will be executed automatically when users change the filetype, as explained here: :h undo_ftplugin
2017-04-29Update TODOTeddy Wing
2017-04-29ftplugin/gitcommit: Make completion mapping user-editableTeddy Wing
Instead of forcing the mapping '<C-x><C-s>' to activate Git SHA completion, allow users to define a different custom mapping.
2017-04-29Update TODOTeddy Wing
2017-04-29autoload/gitcha.vim: Fix match list populationTeddy Wing
Previously, we were using the completion function sample copied from the Vim manual. This function determined `a:findstart` using a match against `\a`, which only matches alphanumeric characters. Git commit SHAs are SHA-1s, which can contain alphanumeric characters. With the previous match regex, if the word to be completed contained numbers, the `a:findstart` match would fail. This resulted in `a:base` being empty, causing all SHAs to be added to the `matches` array. Now we correctly match only the characters that can appear in a SHA-1, and the completion correctly fills in the rest given the start of a SHA.
2017-04-29Update TODOTeddy Wing
2017-04-29autoload/gitcha.vim: Abbreviate commit SHA in the popup menuTeddy Wing
Only show the first 10 characters of the commit SHA in the popup menu to allow more room for the subject. The first part of the SHA is enough to be able to identify it, so this gets rid of some non-essential information. The full commit SHA will still be inserted as a result of the completion.
2017-04-29autoload/gitcha.vim: Include entire subject in popup extra textTeddy Wing
Fix the subject issue from 0773fdd7bde5e7ce462c15bd1c71db3a3e46862a and show the entire commit subject in the popup menu.
2017-04-29Update TODOTeddy Wing
2017-04-29autoload/gitcha.vim: Add commit subject to completion popup (WIP)Teddy Wing
Initial try at adding the commit subject to the popup menu to provide context for the commit. Currently only shows the first word of the subject because I'm using `split()`.
2017-04-29Update TODOTeddy Wing
2017-04-29autoload/gitcha.vim: Describe the code with commentsTeddy Wing
2017-04-29Move functions to autoload/Teddy Wing
Don't force our functions to be loaded when the ftplugin is loaded. Be good Vimscript citizens and respect load performance.
2017-04-29Move ftplugin to ftplugin/gitcommit/gitcha.vimTeddy Wing
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.
2017-04-28TODO: Add entry for extra contextual textTeddy Wing
2017-04-28Add TODOTeddy Wing
2017-04-28ftplugin/gitcommit.vim: Restore user completion functionTeddy Wing
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.
2017-04-28ftplugin/gitcommit.vim: Remove test code from e70d92c495001c0af0037b9fadTeddy Wing
2017-04-28ftplugin/gitcommit.vim: Experiment providing a custom mappingTeddy Wing
Experiment with providing a custom mapping for our Git SHA completion function. We use <C-x><C-s>. The custom mapping should set our function as the custom `completefunc`, call the user completion function by programmatically running `<C-x><C-u>`, 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 <C-x> 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.
2017-04-27ftplugin/gitcommit.vim: Make completion work for commit SHAsTeddy Wing
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.
2017-04-27Sample completion functionTeddy Wing
Copy the completion function included in `:h complete-functions` to give us a base custom completion function to work from. We'll be using this to provide completion for Git SHAs.