# Maintainer: Cedric Girard <girard.cedric@gmail.com>

pkgname=vim-numbertoggle-git
pkgver=20120210
pkgrel=1
pkgdesc="Toggles between relative and absolute line numbers automatically"
arch=('any')
url="https://github.com/jeffkreeftmeijer/vim-numbertoggle"
license=('custom:vim')
depends=(vim)
groups=('vim-plugins')
install=vimdoc.install

_gitroot="https://github.com/jeffkreeftmeijer/vim-numbertoggle.git"
_gitname="vim-numbertoggle"

build() {
  cd "$srcdir"
  msg "Connecting to GIT server...."

  if [[ -d "$_gitname" ]]; then
    cd "$_gitname" && git pull origin
    msg "The local files are updated."
  else
    git clone "$_gitroot" "$_gitname"
  fi

  msg "GIT checkout done or server timeout"

}

package() {
  cd "$srcdir/$_gitname"

  install -d "${pkgdir}/usr/share/vim/vimfiles/doc"
  install -d "${pkgdir}/usr/share/vim/vimfiles/plugin"
  install -m644 -D plugin/number_toggle.vim "${pkgdir}/usr/share/vim/vimfiles/plugin"
  install -m644 -D doc/numbertoggle.txt "${pkgdir}/usr/share/vim/vimfiles/doc"
}