1

While using VimWiki, I linked to a file on my computer using

[[file:/path/to/file.py]]

And when I hit enter, it opens the file with VSCode.

I already when to the file in Finder, clicked 'Get Info' and selected 'Open with:' -> 'Other' but 'Vim' is not an option there.

Is there are to have a file link in VimWiki and when I hit enter have it open that python inside of vim?

  • 1
    Welcome to Vi and Vim! Thanks for the interesting question: do you have $EDITOR or $VISUAL set? It sounds like you're on a mac, so it's probably using the default editor associated with that extension—there are ways to change this to MacVim, but not terminal vim. The docs point to :help VimwikiLinkHandler—you could remove the file: part and it should just work, or you can try the gf command (vim builtin) – D. Ben Knoble Apr 19 at 22:11
  • Noob question, but yes I believe I have $EDITOR and $VISUAL set properly after reading other posts online. added those to my '.zshrc' and '.vimrc' just to test both. As far as Mac vim goes, I got that working, but what I actually want is to click on a file link in vim wiki and have it open that python file directly in vim, without opening up a new MacVim window if that makes sense. Not sure if this is possible actually – Zach Apr 20 at 3:14
  • Try it without the file: piece. If that doesn’t work try gf. If that doesnt work, You’ll need to check the help page i mentioned. – D. Ben Knoble Apr 20 at 12:35

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.