Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions nvim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: Neovim
homepage: https://github.com/neovim/neovim
tagline: |
Neovim Vim-Fork Text Editor
description: |
Neovim is a Vim fork focused on extensibility and usability
---

To update or switch versions, run `webi nvim@stable` (or `@v0.6.1`, etc).

## Cheat Sheet

> A Neovim is a project that seeks to aggressively refactor Vim in order to:
> - Simplify maintenance and encourage contributions
> - Split the work between multiple developers
> - Enable advanced UIs without modifications to the core
> - Maximize extensibility

```bash
nvim <FILE_PATH> # starts up neovim editor with file
```
58 changes: 58 additions & 0 deletions nvim/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env pwsh

###################
# Install neovim #
###################

# Every package should define these variables
$pkg_cmd_name = "nvim"

$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\nvim.exe"
$pkg_dst = "$pkg_dst_cmd"

$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\nvim-v$Env:WEBI_VERSION\bin\nvim.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\nvim-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\nvim-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"

New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"

# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
{
echo "Downloading neovim from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
}

IF (!(Test-Path -Path "$pkg_src_cmd"))
{
echo "Installing neovim"

# TODO: create package-specific temp directory
# Enter tmp
pushd .local\tmp

# Remove any leftover tmp cruft
Remove-Item -Path ".\nvim-v*" -Recurse -ErrorAction Ignore
Remove-Item -Path ".\nvim.exe" -Recurse -ErrorAction Ignore

# Unpack archive file into this temporary directory
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $pkg_download"
& tar xf "$pkg_download"


# Settle unpacked archive into place
echo "Install Location: $pkg_src_cmd"
New-Item "$pkg_src_bin" -ItemType Directory -Force | out-null
Move-Item -Path ".\nvim-*\bin\nvim.exe" -Destination "$pkg_src_bin"

# Exit tmp
popd
}

echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse
41 changes: 41 additions & 0 deletions nvim/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash
set -e
set -u

function __init_nvim() {

###################
# Install neovim #
###################

# Every package should define these 6 variables
pkg_cmd_name="nvim"

pkg_dst_cmd="$HOME/.local/bin/nvim"
pkg_dst="$pkg_dst_cmd"

pkg_src_cmd="$HOME/.local/opt/nvim-v$WEBI_VERSION/bin/nvim"
pkg_src_dir="$HOME/.local/opt/nvim-v$WEBI_VERSION"
pkg_src="$pkg_src_cmd"

# pkg_install must be defined by every package
pkg_install() {
# ~/.local/opt/nvim-v12.1.1/bin
mkdir -p "$(dirname $pkg_src_cmd)"

# mv ./nvim-*/bin/nvim ~/.local/opt/neovim-v12.1.1/bin/nvim
mv ./nvim-*/bin/nvim "$pkg_src_cmd"
}

# pkg_get_current_version is recommended, but (soon) not required
pkg_get_current_version() {
# 'nvim --version' has output in this format:
# NVIM v0.6.1
# <MORE INFO>
# This trims it down to just the version number:
# 0.6.1
echo $(nvim --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2 | cut -c 2-)
}
}

__init_nvim
20 changes: 20 additions & 0 deletions nvim/releases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var github = require('../_common/github.js');
var owner = 'neovim';
var repo = 'neovim';

module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
return all;
});
};

if (module === require.main) {
module.exports(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
// just select the first 5 for demonstration
all.releases = all.releases.slice(0, 5);
console.info(JSON.stringify(all, null, 2));
});
}
3 changes: 3 additions & 0 deletions test/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function __rmrf_local() {
nerd-font \
nerdfont \
node \
nvim \
ots \
pandoc \
pathman \
Expand Down Expand Up @@ -145,6 +146,7 @@ function __rmrf_local() {
nerd-font \
nerdfont \
node \
nvim \
ots \
pandoc \
pathman \
Expand Down Expand Up @@ -241,6 +243,7 @@ function __test() {
nerd-font \
nerdfont \
node \
nvim \
ots \
pandoc \
pathman \
Expand Down