neovim/README.md

90 lines
2.1 KiB
Markdown

# My `neovim` setup
I'm trying to document my neovim setup. Mostly, I'm using neovim to edit
markdown, HTML, CSS/SCSS and python files.
I'm using `vim-plug` as a plugin manager. To install and activate `vim-plug`
see the [documentation][7].
## To do
- [x] Document how to use `pyenv` to provide a python engine.
- [x] Identify the python package dependencies.
## Requirements
1. `neovim`
1. `git`
1. A python virtualenv with python dependencies installed. (see [pyenv
section][10]).
1. `nodejs`, `yarn`
1. [vim-plug][1]
1. [ripgrep][2]
1. [The Silver Searcher (`ag`)][3]
1. A [font patched for nerds][8].
## Installation
1. Check [the requirements][4]. ⬆
1. Clone the repository \
`git clone <URL>`
1. Create a symlink: \
`ln /path/neovim/init.vim /home/user/.config/nvim/init.vim`.
1. [Install `vim-plug`][7].
1. Start `neovim`.
1. Install the plugins (`:PlugInstall`).
## Create a virtualenv with pyenv
Benefit: having a separate virtual environment for the python engine than the
one your working into.
Install `pyenv` with the [`pyenv-installer`][9].
Install the python version you need with `pyenv`:
```bash
pyenv install <python version>
```
Create and name the virtual environment for neovim:
```bash
pyenv virtualenv <python version> neovim
```
Activate the virtual environment and fetch the python path:
```bash
pyenv activate neovim
pyenv which python # Note the provided path
```
Add the following line to your `init.vim`:
```init.vim
let g:python3_host_prog = '/full/path/to/neovim/bin/python
```
Install the python dependencies in the virtual environment as it is activated:
```bash
pip install -r requirements.txt
```
To deactivate the virtual environment:
```bash
pyenv deactivate
```
[1]: https://github.com/junegunn/vim-plug
[2]: https://github.com/BurntSushi/ripgrep
[3]: https://github.com/ggreer/the_silver_searcher
[4]: /requirements
[5]: https://www.nordtheme.com/ports/vim
[7]: https://github.com/junegunn/vim-plug#installation
[8]: https://www.github.com/ryanoasis/nerd-fonts
[9]: https://github.com/pyenv/pyenv-installer
[10]: #create-a-virtualenv-with-pyenv