neovim.scm
| 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)))))))))))) |
| 72 |