Conversation
lervag
left a comment
There was a problem hiding this comment.
Wow, this is quite impressive. I do have some comments. I'll probably make minor adjustments myself, so feel free to ignore the trivial comments if you find me too pedantic. :p
In general, it seems this is pretty much ready for merging, but there a couple of important comments to discuss:
- Version requirement due to optional function args.
- Use
customlistinstead ofcustomfor completion and adjust theget_tag_namesoutput to list instead of string?
I think the overlap between page.vim and tags.vim is OK for now. I agree this could probably be generalised, but let's be pragmatic.
autoload/wiki/tags.vim
Outdated
| endfunction | ||
|
|
||
| " }}}1 | ||
| function! wiki#tags#rename(old_tag, new_tag='', rename_to_existing=0) abort " {{{1 |
There was a problem hiding this comment.
Huh, I was not aware of the default value syntax. It seems it was introduced quite recently? I like it, but it does set a requirement to the users to use Vim 8.1 and/or neovim 0.5. Is that OK? I never did specify a version requirement...
There was a problem hiding this comment.
I’m a Python programmer so default args like that make me happy. It would be simple to change it to use … instead, but not as nice looking. I have no sense of what versions people are using currently; it seems like one would naturally use an up-to-date Vim for one’s personal wiki? But… 🤷
There was a problem hiding this comment.
I'm also quite used to Python, and I tend to like this syntax myself. I would not mind to accept this, but we should add a comment in the README and docs about version requirement.
|
I will attack any pedantry-related changes and anything else when I have some time, possibly during the weekend; or of course feel free to do it for me 😉. |
|
Thanks! I've merged this now. Very nice work, I appreciate the contribution! |
|
FYI: I've reverted the modern optional arg syntax due to #194. |
|
Yes, makes sense, the nicer syntax probably isn't worth the compatibility issues. |
This PR adds functionality to rename tags. Some highlights:
tags.vim:wiki#tags#rename(old_tag, new_tag='', rename_to_existing=0)The main renaming function. The
rename_to_existingparameter forces a tag to be renamed even if the new name already exists (implemented primarily for non-interactive testing).wiki#tags#rename_ask(old_tag='', new_tag='', ...)The user-facing rename function, called by the
WikiTagRenamecommand. Prompts for one or both parameters.wiki#tags#get_tag_names(...)Returns a list of tag names from the cache. Used for completion by
WikiTagRename.g:wiki#tags#default_parser.make(taglist, curline='')Required to construct a new buffer line containing the updated tag name.
buffer.vim:WikiTagRename<leader>wsn→<plug>(wiki-tag-rename)Tests:
test-tags/test-defaults.vimandtest-tags/test-custom-yaml.vimThere is some overlap in functionality between
tags.vim:394-407,420-424andpage.vim:118-132,137-141, but I wasn’t sure if it was worth pulling out into a third file.