I've seen the answers to this question on inserting filenames interactively within a yasnippet. They are excellent and work great. I was wondering, however, if it's possible to expand them to use the same interface provided by helm-find-files, i.e., keybindings to go up a level with C-l, for example.

The original code already uses completing-read to trigger helm, but the available interface lacks helm-find-files keybindings:

# -*- mode: snippet -*-
# name: test
# key: test
# --
My File: ${1:$$(unless yas-modified-p (completing-read "File: " 'read-file-name-internal))}

A simple substitution of the completing-read command for helm-find-files does not work because it'll trigger opening a file, which is not the goal of the snippet.

Any suggestions or pointers towards that goal would be welcome.

  • Maybe helm-read-file-name can help. I don't use YASnippet and don't how to try this. – xuchunyang Jul 14 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.