Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expansions.asciidoc: Add an example of file expansion. #3574

Merged
merged 1 commit into from Jul 3, 2020

Conversation

Screwtapello
Copy link
Contributor

Properly speaking, all expansions are of the form "%abc{}" where "abc" is the expansion type. All expansion types are listed in the documentation, as they should be. However, when searching through the documentation, a keyword like "file" is likely to hit a lot of false-positives, so a smart user is likely to search for the more-unique "%file" instead. Unfortunately, unlike every other expansion-type, file-expansions did not include an example, so a search for "%file" resulted in no hits, potentially leading people to believe it was undocumented.

Now there's an example, so people searching for "%file" will find what they're looking for.

Properly speaking, all expansions are of the form "%abc{}" where "abc"
is the expansion type. All expansion types are listed in the documentation, as
they should be. However, when searching through the documentation, a keyword
like "file" is likely to hit a lot of false-positives, so a smart user is likely
to search for the more-unique "%file" instead. Unfortunately, unlike every other
expansion-type, file-expansions did not include an example, so a search for
"%file" resulted in no hits, potentially leading people to believe it was
undocumented.

Now there's an example, so people searching for "%file" will find what they're
looking for.
@Screwtapello
Copy link
Contributor Author

Admission: Earlier today I wanted to link somebody to the %file{} docs, so I searched for %file. When I didn't find it, I decided to make a PR documenting it, only to find it had actually been documented all along. So this is as much for the benefit of my laziness as anybody else. :)

@alexherbo2
Copy link
Contributor

How to handle arbitrary filenames?

@Screwtapello
Copy link
Contributor Author

In some circumstances (such as piping to kak -p) you can use NUL as the argument delimiter. Since NUL cannot legally appear in a filename, it's safe to use it to delimit filenames. However, bash doesn't like NUL bytes appearing in command-substitutions, and I can't figure out how to type NUL directly in bash, or in Kakoune, so it's not a universally-applicable solution.

@alexherbo2
Copy link
Contributor

@Screwtapello It could be nice to add an example with a filename from an option.

@mawww mawww merged commit e509a8e into mawww:master Jul 3, 2020
@Screwtapello
Copy link
Contributor Author

It would, but off the top of my head I'm not even sure how to go about it. I suspect it would be too complex to make a good example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants