I'd like to have a directory which includes a range of vim functions written in python.
I'd like to then be able to call these functions in my .vimrc, and run them through :<FuncName>
I've looked at a number of resources online, and while it is quite easy to get python functionality working if it is written in your .vimrc, I'm struggling to bring in outside files.
I have the following file:
/home/daniel/vim/hey_vim.py
def HeyVim():
print("Hey Vim")
In my .vimrc I have the following:
function HeyVim()
pyfile /home/daniel/vim/hey_vim.py
endfunction
:command HeyVim :call HeyVim()
I've also tried the following variations:
- Quoting the filepath in the vimscript function
- Removing colons from the command
- Various path expansions to get to hey_vim.py
- Quick file creation instead of print to see if it was just a printing issue
- Changing file name from hey_vim.py to HeyVim.py
When I run :HeyVim, nothing happens. There are no errors, but also nothing is printed, and no file is created when that part is in there.
Any ideas?