2016-02-05 11:52:28 +01:00
|
|
|
## Neovim
|
|
|
|
|
2016-02-05 12:42:20 +01:00
|
|
|
- [Configuration](#configuration)
|
|
|
|
- [Terminal emulator](#terminal-emulator)
|
2016-02-05 11:52:28 +01:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2016-02-05 12:42:20 +01:00
|
|
|
#### Configuration
|
|
|
|
|
|
|
|
Neovim adheres to the [XDG Base Directory
|
|
|
|
Specification](http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html).
|
|
|
|
If you don't have them set already, `$XDG_CONFIG_HOME` defaults to `~/.config`
|
|
|
|
and `$XDG_DATA_HOME` defaults to `~/.local/share`.
|
|
|
|
|
|
|
|
| Flavour | User configuration directory | vimrc |
|
|
|
|
|---------|------------------------------|-------|
|
|
|
|
| Vim | `~/.vim` | `~/.vimrc` or `/.vim/vimrc` |
|
|
|
|
| Neovim | `~/.config/nvim` | `~/.config/nvim/init.vim` |
|
|
|
|
|
|
|
|
[Working files](../README.md#handling-backup-swap-undo-and-viminfo-files) are
|
|
|
|
put under `~/.local/share/nvim` by default.
|
|
|
|
|
|
|
|
Related help: `:h nvim-configuration`
|
|
|
|
|
|
|
|
#### Terminal emulator
|
2016-02-05 11:52:28 +01:00
|
|
|
|
|
|
|
Neovim implements a proper terminal emulator
|
|
|
|
([libvterm](http://www.leonerd.org.uk/code/libvterm/)) and can easily fire up a
|
|
|
|
new shell via `:terminal`.
|
|
|
|
|
|
|
|
In Vim you run [interactive
|
|
|
|
programs](../README.md#running-external-programs-and-using-filters) like this:
|
|
|
|
`:!read foo && echo $foo`. In Neovim this won't work because `:!` uses named
|
|
|
|
pipes ([libuv processes](https://nikhilm.github.io/uvbook/processes.html)) for
|
|
|
|
communication now. Use `:te read foo && echo $foo` instead.
|
|
|
|
|
2016-02-05 12:17:28 +01:00
|
|
|
By now you might have noticed, that you can't leave the insert mode in a
|
|
|
|
terminal buffer via `<esc>`, since it gets captured by the terminal emulator
|
|
|
|
instead of Neovim. Use `<c-\><c-n>` instead.
|
|
|
|
|
|
|
|
Since terminal buffers are a new kind of buffer (`&buftype` is set to
|
|
|
|
"terminal"), there are also new commands for creating terminal
|
|
|
|
[mappings](../README.md#mappings): `:tmap`, `:tnoremap`, and `:tunmap`.
|
|
|
|
|
|
|
|
There are also two new [autocmd](../README.md#autocmds) events: `TermOpen` and
|
|
|
|
`TermClose`.
|
|
|
|
|
|
|
|
Here an example configuration:
|
|
|
|
|
|
|
|
```vim
|
|
|
|
if has('nvim')
|
|
|
|
nnoremap <leader>t :vsplit +terminal<cr>
|
|
|
|
tnoremap <esc> <c-\><c-n>
|
|
|
|
tnoremap <a-h> <c-\><c-n><c-w>h
|
|
|
|
tnoremap <a-j> <c-\><c-n><c-w>j
|
|
|
|
tnoremap <a-k> <c-\><c-n><c-w>k
|
|
|
|
tnoremap <a-l> <c-\><c-n><c-w>l
|
|
|
|
autocmd BufEnter term://* startinsert
|
|
|
|
endif
|
|
|
|
```
|
|
|
|
|
2016-02-05 11:52:28 +01:00
|
|
|
Related help:
|
|
|
|
|
|
|
|
:h :terminal
|
|
|
|
:h nvim-terminal-emulator
|