app-editors/neovim: implement nvimpager useflag
authorBen de Groot <yngwin@gentoo.org>
Fri, 14 Aug 2015 09:36:03 +0000 (17:36 +0800)
committerBen de Groot <yngwin@gentoo.org>
Fri, 14 Aug 2015 09:36:37 +0000 (17:36 +0800)
Package-Manager: portage-2.2.20.1

app-editors/neovim/metadata.xml
app-editors/neovim/neovim-0.0.0_pre20150814.ebuild

index d5a0b7af40f6ab926b26b249f337bd8b8d6e2572..4ead8c2a61bf358393d58ed7b867f057f10fc541 100644 (file)
@@ -2,6 +2,9 @@
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
   <herd>vim</herd>
+  <use>
+    <flag name='nvimpager'>Install nvimpager symlink to less.sh macro</flag>
+  </use>
   <upstream>
     <remote-id type="github">neovim/neovim</remote-id>
   </upstream>
index 0dd499e107d28bf79799e6aed9897c9f294582e1..27615d2a9f9e964836bedc7d146f191fa5d22af6 100644 (file)
@@ -17,7 +17,7 @@ fi
 
 LICENSE="Apache-2.0 vim"
 SLOT="0"
-IUSE="perl python"
+IUSE="+nvimpager perl python"
 
 CDEPEND="dev-lang/luajit:2
        >=dev-libs/libtermkey-0.17
@@ -42,6 +42,9 @@ src_prepare() {
        # add eclass to bash filetypes
        sed -e 's|*.ebuild|*.ebuild,*.eclass|' -i runtime/filetype.vim || die
 
+       # make less.sh macro actually work with neovim
+       sed -e 's|vim |nvim |g' -i runtime/macros/less.sh || die
+
        cmake-utils_src_prepare
 }
 
@@ -60,7 +63,13 @@ src_configure() {
 
 src_install() {
        cmake-utils_src_install
+
        # install a default configuration file
        insinto /etc/vim
        doins "${FILESDIR}"/nvimrc
+
+       # conditionally install a symlink for nvimpager
+       if use nvimpager; then
+               dosym /usr/share/nvim/runtime/macros/less.sh /usr/bin/nvimpager
+       fi
 }