Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Create A Neovim Plugin

TODO: Fix the formatting of this post that got busted during the move to nextjs

Code

# not sure if this needs to be installed globally or 
just in a virtual environment. 
pip install pynvim

-- hr

-- hr

setup pyenv by doing:

    pyenv install -v 2.7.18
    pyenv global 2.7.18
    pip install pynvim

    pyenv install -v 3.9.4
    pyenv global 3.9.4
    pip install pynvim
    
    # and finally:
    
    pyenv global 3.9.4 2.7.18
    
--

Put your python3 stuff in: rplugin/python3


Neovim allows Python 3 plugins to be defined by 
placing python files or packages in rplugin/python3/ 
(in a runtimepath folder). Python 2 rplugins are also 
supported and placed in rplugin/python/, but are 
considered deprecated. 

Further added library features will only be available 
on Python 3.


-- hr

echo "let &runtimepath.=','.escape(expand('<sfile>:p:h'), '\,')" > testvimrc


--- 

nvim -u testvimrc +UpdateRemotePlugins


-- hr


This wasn't great
https://dev.to/christalib/how-i-wrote-my-first-neovim-plugin-357h


This was better:
https://pynvim.readthedocs.io/en/latest/usage/remote-plugins.html

Didn't look at this one yet, but might be interesting:
https://github.com/jacobsimpson/nvim-example-python-plugin


--- 

This was in some other notes, but it's not something I had to 
mess with once I got the pyenv stuff sorted. 


#testing adding this to `./init.vim` (note, this is not:`~/.config/nvim/init.vim`)

let g:python3_host_prog = '/Users/alans/.pyenv/versions/3.9.4/bin/python'
let g:python_host_prog = '/Users/alans/.pyenv/versions/2.7.18/bin/python'

-- hr