home: Add neovim home type. * home/neovim.scm: New file. * doc/neovim.md: New file. * doc/README.md: Add it.
doc/README.md
| 63 | 63 | #### Shell Software | |
| 64 | 64 | ||
| 65 | 65 | * [Bash](doc/bash.md) | |
| 66 | + | * [Neovim](doc/neovim.md) | |
| 66 | 67 | ||
| 67 | 68 | ### Common Issues | |
| 68 | 69 |
doc/neovim.md unknown status 1
| 1 | + | Neovim | |
| 2 | + | ====== | |
| 3 | + | ||
| 4 | + | Neovim is a fork of vim, a text editor. This lets you configure it and manage | |
| 5 | + | plugins. | |
| 6 | + | ||
| 7 | + | Main Configuration | |
| 8 | + | ------------------ | |
| 9 | + | ||
| 10 | + | Neovim is configured by using the `neovim-home-type` service type. | |
| 11 | + | ||
| 12 | + | **Scheme Procedure**: neovim-home-type | |
| 13 | + | ||
| 14 | + | The type of service that generates configuration files for neovim. Its value | |
| 15 | + | is a neovim-configuration object. | |
| 16 | + | ||
| 17 | + | **Data Type**: neovim-configuration | |
| 18 | + | ||
| 19 | + | Data type that represents the Neovim configuration. This data type has the | |
| 20 | + | following fields: | |
| 21 | + | ||
| 22 | + | * **init** (default *default-init*): the content of the `init.vim` file. This | |
| 23 | + | is a list of strings and file-like objects. | |
| 24 | + | * **plugins** (default '()): the list of plugins you wish to use. They will | |
| 25 | + | be added to the top of the `init.vim` file. | |
| 26 | + | ||
| 27 | + | Example Configuration | |
| 28 | + | --------------------- | |
| 29 | + | ||
| 30 | + | ```scheme | |
| 31 | + | (user-home | |
| 32 | + | neovim-home-type | |
| 33 | + | (neovim-configuration | |
| 34 | + | (init '("set colorcolumn=80\n")) | |
| 35 | + | (plugins (list neovim-syntastic)))) | |
| 36 | + | ``` |
home/neovim.scm unknown status 1
| 1 | + | ;;; Guix Home Manager. | |
| 2 | + | ;;; | |
| 3 | + | ;;; Copyright ?? 2019 Julien Lepiller <julien@lepiller.eu> | |
| 4 | + | ;;; | |
| 5 | + | ;;; This program is free software: you can redistribute it and/or modify | |
| 6 | + | ;;; it under the terms of the GNU General Public License as published by | |
| 7 | + | ;;; the Free Software Foundation, either version 3 of the License, or | |
| 8 | + | ;;; (at your option) any later version. | |
| 9 | + | ;;; | |
| 10 | + | ;;; This program is distributed in the hope that it will be useful, | |
| 11 | + | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | + | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 13 | + | ;;; GNU General Public License for more details. | |
| 14 | + | ;;; | |
| 15 | + | ;;; You should have received a copy of the GNU General Public License | |
| 16 | + | ;;; along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 17 | + | ||
| 18 | + | (define-module (home neovim) | |
| 19 | + | #:use-module (guix build utils) | |
| 20 | + | #:use-module (guix gexp) | |
| 21 | + | #:use-module (guix packages) | |
| 22 | + | #:use-module (guix records) | |
| 23 | + | #:use-module (gnu packages lxde) | |
| 24 | + | #:use-module (ice-9 match) | |
| 25 | + | #:use-module (srfi srfi-1) | |
| 26 | + | #:use-module (home) | |
| 27 | + | #:export (neovim-configuration | |
| 28 | + | neovim-configuration-init | |
| 29 | + | neovim-configuration-plugins | |
| 30 | + | ||
| 31 | + | default-init.vim | |
| 32 | + | ||
| 33 | + | neovim-home-type)) | |
| 34 | + | ||
| 35 | + | (define default-init.vim | |
| 36 | + | `("")) | |
| 37 | + | ||
| 38 | + | (define-record-type* <neovim-configuration> | |
| 39 | + | neovim-configuration make-neovim-configuration | |
| 40 | + | neovim-configuration? | |
| 41 | + | (init neovim-configuration-init | |
| 42 | + | (default default-init.vim)) | |
| 43 | + | (plugins neovim-configuration-plugins | |
| 44 | + | (default '()))) | |
| 45 | + | ||
| 46 | + | (define neovim-home-type | |
| 47 | + | (home-type | |
| 48 | + | (name 'neovim) | |
| 49 | + | (extensions | |
| 50 | + | (list | |
| 51 | + | (home-extension | |
| 52 | + | (target root-home-type) | |
| 53 | + | (compute | |
| 54 | + | (lambda (config) | |
| 55 | + | (match config | |
| 56 | + | (($ <neovim-configuration> init plugins) | |
| 57 | + | (let ((init.vim | |
| 58 | + | (apply mixed-text-file "init.vim" | |
| 59 | + | (append | |
| 60 | + | (fold | |
| 61 | + | (lambda (plugin result) | |
| 62 | + | (append | |
| 63 | + | result | |
| 64 | + | (list | |
| 65 | + | "set runtimepath+=" | |
| 66 | + | (file-append plugin "/share/nvim/site") | |
| 67 | + | "\n"))) | |
| 68 | + | '() | |
| 69 | + | plugins) | |
| 70 | + | init)))) | |
| 71 | + | `((".config/nvim/init.vim" ,init.vim)))))))))))) |