Created
September 15, 2017 22:14
-
-
Save gevann/775f23b3d1eca2fc711c99ab9118b8f3 to your computer and use it in GitHub Desktop.
python snippet for inserted the relative path for a fzy-found file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python << endpython | |
import vim | |
import os | |
def other_file(): | |
return vim.eval("system(\"rg . --files -g '' | fzy \")") | |
def relpath(): | |
target = other_file() | |
relative_path = os.path.relpath(target, vim.current.buffer.name).strip() | |
vim.command("redraw!") | |
vim.command("normal! o'%s'"%relative_path) | |
endpython |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment