Neovim: An Ambitious Extensible and Customizable Text Editor

Neovim logo

Neovim logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License

Neovim, a fork of Vim, is what these editors are often compared against. Although it does not support collaboration out of the box, it has a plugin system, which is taken advantage of extensively. “Plugin UI Architecture” lays out the plugin architecture. The communication between the core and the GUI is done through MessagePack (“It’s like JSON. but fast and small”) (Wikipedia)-based RPC. For example, it can run in Web browsers. In addition, it also offers a separate remote API. Plugins can be implemented in any language, and are executed in their own processes and communicate with the Neovim instance either locally or remotely. Collections of awesome neovim plugins.

Similarly, if you were to run Emacs on Web browser, see “Is embedding Emacs in a browser possible? : emacs.” Obviously, it is a whole lot harder to do than with Neovim, but one way is to use WeTTY: Terminal in browser over http/https and run Emacs on it, either locally or remotely. Cloudmacs uses Docker for the Emacs instance, and seems to be a simple extension of that idea.

I am not sure plugins are always run in separate processes.

Vim is extensible with the script language Vim Script (otherwise called VimScript or VimL), which feature Neovim inherits, but Neovim in addition supports and encourages the use of Lua instead as the extension language.

Neovim offers the following two advanced features to provide language-specific assistance: Support for Tree-Sitter and support for Language Server Protocol (LSP).

Tree-sitter is a generator for incremental parsers. It was not obvious from the website, but it seems it was developed by GitHub for its Atom text editor. Nvim Treesitter configurations and abstraction layer. By the way, Node.js bindings for tree-sitter called Node-Tree-Sitter exists, and it seems you can access all the functionality of the generated parser from Javascript. The way you specify where changes have been made may be a good match for OT- or CRDT-based editing, e.g.,  Delta in “OT: Operational Transformation.”

The Language Server Protocol (LSP) (Wikipedia) is an open, JSON-RPC-based protocol for use between source code editors or integrated development environments (IDEs) and servers that provide programming language-specific features. The goal of the protocol is to allow programming language support to be implemented and distributed independently of any given editor or IDE. It was originally developed for Microsoft Visual Studio Code and is now an open standard. There is a companion format called Language Server Index Format, or LSIF, read “else if,” whose goal is to “support rich code navigation in development tools or a Web UI without needing a local copy of the source code.”

I would think public LSP servers are available somewhere, but I could not find any. As far as I know, no parser-generating tools are available specifically for LSP.

Postscript: Onivim 2 is a cross-platform Vim descendant. It uses its own libvim: The core Vim editing engine as a minimal C library (but also compiles to WebAssembly/ Wasm), which is based on Vim, not Neovim. They say the choice was mostly due to the build issues they faced with Neovim. Onivim 2 also supports VS Code extensions via the Open VSX extension registry.

It has a unique licensing scheme. It is source-available software, but the master branch of the repository is not open-source; it comes with a commercial license. However, every commit there will be dual-licensed under the permissive MIT license in 18 months.

Amazfit Band 5

XiaomiのフィットネストラッカーMi Smart Band 5(中国国内では単にMi Band 5)は以下の記事に書いたように,今年はじめの時点では間違いなくコスパが高かった。特に中国からAliExpressなどを利用して安く個人輸入すれば。後継機種Mi Band 6の新機能が特に必要なければ,GShopper.com で国際版が送料無料で2,500円ほどで購入できるのだから今でも十分高コスパ。

なので何人にも今までお世話になってきた方々にプレゼントとして差し上げた(しかし実は自分では使ってない)。そのとき「いかがですか?」とお伺いしたものの「考えておく」というお返事だった方が,今になって「やっぱり欲しい」とのこと。ところがその間,ここ半年ほどの間に以下が起こってる。

その方は80歳を超えるご高齢なので,Mi Band 6の大きくなった画面は魅力的。 “Xiaomi Mi Band 6 v Mi Band 5: the key differences” に掲載されているこの写真を見ると,Mi Band 5に比べて「気のせい」以上の差があるのがわかる。 “Xiaomi Mi Smart Band 6 in review: Effective design improvement, the price fits – NotebookCheck.net Reviews” によりわかりやすい比較写真がある。

新たに追加されたSpO2測定機能はどの程度信頼性あるのか怪しいが,このコロナ禍中にあってはいくらかは意味があろう。なのでMi Band 6を代わりに選ぶのが妥当な判断なんだろうが,AliExpressでパッと検索してみると5,000円前後する。Mi Band 5が本体だけなら3,000円弱であることを考えるとかなり高い。6はまだ発売されたばかりだからか。また,今のところ本体のUI言語として日本語がサポートされているようではない。

その方にとっては本体のUIが完全に日本語であることも重要。今までMi Band 5をプレゼントした方々は皆さん英語UIで問題ないようだが,この方はそうはいかない。公式日本語版Mi Band 5は4,500円する。最初に買ったMi Band 5は国際版で,国際版を選んだのは本体で日本語UIを選べるはずだからだったんだが,今のところ日本語UIがサポートされた気配はない。国際版は(現時点で)日本語化できないと言い切っている記事もある。とはいえ,元から日本語版では日本語化できることはわかっているし,ファームウェアまで手を入れる覚悟があれば国際版でもできそうだ。ただし手間。

そこでAmazfit Band 5のことを思い出した。以下の記事にも説明があるが,Mi Band 5と同様Huamiが製造している,いわばMi Band 5の兄弟機種。スペックは非常に似通っており,バンドも流用できる上,日本語UIがサポートされているMi Band 5にないSpO2測定機能がある,という点で,確かに「実質Mi Band 5 Pro」といえる。現に,ファームウェアやカスタマイゼーションを扱うBBSのGeekDoingでもひとくくりに扱われているAlexa対応もMi Band 5にない機能だが,現在日本語?日本のアマゾン?のAlexaには対応していないらしい。

ちなみに,公式サイトの英語ページではSpO2測定機能が明確にうたわれているのに対し,日本語ページではそれについての記載が一切ない。何か国内の規制にひっかかるのだろうか?

ただし,対応するスマホアプリはMi Fitではなく別のZeppとなるようでそこは少し残念。もっとも中身は実質同じで操作性もほぼ同じだろう。その他AmazfitがらみのAndroidアプリ

あるいは,オープンソースのサードパーティアプリのGadgetbridge for Androidを使うという手もあるが,auth keyを取得する必要があり面倒。Root化済み端末が使えるのなら手間ではない。非Root化端末でもPythonスクリプトでauth keyは得られるらしい(以前XiaomiのBLEスマート温湿度計LYWSD03MMCのBluetooth bindkeyを取得しようとしてできなかったが,同様な手がそちらにも使えないか?)。

調べてみるとAliExpressで3,333円で購入できることがわかったので結局これを購入。追加の付属品が一切ないが,スクリーンプロテクタは最初に買ったMi Band 5国際版に付属してたのが余ってるはずなのでそれを流用しよう。ちなみに,このリスティングなかなかに謎で今は3,556円になっているアマゾンでは6,000円程度でそのお値段では論外。

なにせ使用者はご高齢なのでより画面サイズの大きいものが当然よい。ただ画面が大きくなれば一般的には重くなる。重くて着用が億劫になってしまっては意味がない。Mi Band 6は間違いなくいい候補だがまだ高いし,日本語UI対応はいつになるかわからない。ご本人は早くご所望のようだし,日本語UI,SpO2測定機能と,いつか使えるようになるかもしれないAlexa機能があってMi Band 5級に安く買えたAmazfit Band 5はいい妥協ではなかっただろうか。

お一人住まいの高齢者ということで,みまもりは大きな課題。ゆくゆくはご自宅にBLE対応のサーバを用意し(TTGo T-Display ディスプレーつきESP32開発ボードなんかを使って)心拍数なんかをほぼリアルタイムで拾えるようにしたら理想的だが,そこまでやれるか。心拍数データを定期的に発信するように設定できるということなので,もし暗号化なしでアドバタイズするようにできるのなら比較的簡単に実現できるはず。自宅外の場合は,Gadgetbridgeアプリで定期的にデータのエキスポートができるようだから,そこから必要データを抽出してどこかのサーバーにあげるようにしたらよいのだろう。”Mi-Band steps on node-RED Dashboard – servo-server” ではGadgetbridge for Androidに定期的にエキスポートさせたデータをNode-REDに移している。

CAP Theorem

Nowadays, no blurbs about distributed data store systems are complete without mentioning the CAP theorem, which dictates a distributed data store system can have at most two, but never all three, of Consistency, Availability, and Partition tolerance. Usually, partition tolerance is indispensable, so they often make it look like it inevitably boils down to the choice between consistency (in which case the system is labeled “CP”) and availability (“AP”).

Martin Kleppmann, however, argues in “Please stop calling databases CP or AP” that things are not all that simple. He meticulously breaks it down as follows:

  • The actual definitions of consistency, availability and partition tolerance à la CAP theorem are quite narrow and vastly different from what you’d naively expect. The “CP” and “AP” labels thrown around in marketing literature are often not technically correct. Conversely, a system that can only be labeled just “P” in the strict sense may still have practical values.
    • Consistency in CAP has nothing to do with consistency in ACID. The latter seems to be usually defined as a property of a database system where starting in a valid state, it always end in a valid state after a transaction. Consistency in CAP, on the other hand, means linearizability, which is essentially the following:

      If operation B started after operation A successfully completed, then operation B must see the the system in the same state as it was on completion of operation A, or a newer state.

    • Availability in CAP is defined as “every request received by a non-failing [database] node in the system must result in a [non-error] response”. It’s not sufficient for some node to be able to handle the request: any non-failing node needs to be able to handle it. Many so-called “highly available” (i.e. low downtime) systems actually do not meet this definition of availability. Availability in the practical sense does not quite correspond to CAP-availability.
    • Partition Tolerance (terribly mis-named) basically means that you’re communicating over an asynchronous network that may delay or drop messages. The internet and all our datacenters have this property, so you don’t really have any choice in this matter.

Consistency has nuances, which are spelled out in “Consistency Models” by Kyle Kingsbury of Jepsen.

Upcoming Changes in Hypercore 10

I happened to run into “Hypercore Protocol Dev Update – Multiwriter/Networking – YouTube” by sheer chance while it was still being broadcast live, though it was already the tail end of it. I have since watched the whole video a couple of times, but a large portion of it simply went over my head.

Here is my personal (and very incomplete, question-laden) summary.

Hypercore 10

I am already lost here. “Only one signature for a Hypercore”? Isn’t that how it always has been with Hypercore? I am not clear on what “fork” means here either. When you say “fork recovery,” does that mean “recovery from a fork (or forks),” or “recovery of a fork (or forks)”? Either way, it is synonymous with “truncation” or realized by it? What does it mean for a Hypercore to get truncated? Does it mean its old data gets thrown away?If a Hypercore getting truncated creates a new “fork,” a “fork” is like a version of the Hypercore?

Multiwriter

Using causally-ordered Hypercores satisfies the requirements

Suppose there are multiple Hypercores that have causal relationships amongst them (I do not know what kinds of causal relationships are assumed here). If a block in a Hypercore is causally dependent on a block in a different Hypercore, the former records the latter by way of, e.g., <Hypercore ID (e.g., its pub key), block #>. (Andrew says “vector clocks” around 35:00, so I guess that’s what they actually use.)

All the blocks in these Hypercores are partially ordered by two kinds of relationships: i) intra-hypercore sequencing; and ii) inter-hypercore causality. They can be topologically sorted to form one sequence of blocks.

This sequence resembles a Hypercore. It is indeed recorded in a Hypercore (persistence optional) and serves as an index.

“Because it is not always orderable” (I think what he means here is that the result of topological ordering is not always unique. So what follows is that strategies to have a deterministic behavior needed to be applied, while minimizing the cost of calculation.)

In case of “causal forks,” rebase the shortest fork on top of the longest one (optimized to minimize the work necessary for rebasing)

When a rebase occurs, use the truncation API to apply it to the index Hypercore.

You control fully what the set of writers should be. If you remove or add a writer, simply rebase the index.

I can see dynamically granting and revoking write permissions is supported, but how about read permissions? Can they be given and taken away just as easily?

Auto Rebase with Autobase

The new Autobase() function specifies writable Hypercores.

Personal Thoughts

No specific conflict resolution scheme is not provided; just the primitives for the programmers to implement their own.

No dedicated facility for ID/user management

No easy key management

Auの4GガラホGratinaでSMSの送受信をリモートで

Auから2016年2月発売のGratina 4G KYF31

SMS Gateアプリのアイコン

2020年?4月頃に考えていたこと。内容はまとまってないが今後それをすることは期待できないので未完成だが公開する。

この段階ではGMS (Google Mobile Services),通称「開発者サービス」がない,Au 4GガラホGratinaのもともとの状態でなんとかすることを考えていた。その後,開発者サービスを導入することに成功した2度めの試みのときはもっとうまくいき,そこでも遠隔でSMS送受信することについて試してる


ちょっと以前と要件が微妙に変わってて,以前はSMSの送受信をPC上でやりたかった。今もそれはそうなんだが,今は別のスマホでもやりたい,という要件が追加されたところが以前と違う。

Relay Meというアプリがかつてあり,有料機能としてGmailとの双方向のゲートウェー機能を提供していた。一時期作者がオープンソース化したがその後そのソースは消え去り,後継アプリは登場していない。

SMS Gate 不具合多し 楽天リンクで受け取ったSMSには対処できない。これはこのアプリ側の問題ではないが

加えて、Android端末単独で着信したGmailメッセージの内容を読み取るのは意外と難しいようだTaskerとK-9 Mailを併用すればサブジェクト等は得られるようだが、本体はダメ外部サービスZapierを使ってGmailの処理は行い、それをAutoRemoteでAndroid端末に通知することは可能のようGoogle Apps Scriptも使えるだろう。Aqua MailがTaskerプラグインを提供している

Android SMS works better with IFTTT IFTTTのようなサービスのほうがやりやすいかも IFTTT – Apps on Google Play クロスプラットフォーム iOSでも使える。が開発者サービスが必要。

IFTTTはWebhooks機能を提供している。なので着信したSMSをAutomateの該当ブロックやSMSsync公式サイト)でwebhookでIFTTTに投げることはできる。が,IFTTTから端末にメッセージを送ることが,IFTTTアプリが使えないのなら難しい。

SmsMatrixが使えればいいんだが,Android 6.0以上を要求する。Android 5をサポートの依頼は出てるが作者は反応していない

XMPPを利用してAndroid端末を遠隔にコントロールするMAXSはAndroid 2.3.3しか要求しない。Hangoutsに接続できればいいが…。コマンドを打たなければならないのが煩わしい。2015年の時点でHangoutsのサーバーはインセキュアな接続を許すXMPPサーバーと接続はできてた

Gratina 4G KYF31 (製造元の京セラのサイト

Googleのサービスがない Googleの開発者サービスを利用するものは全て使えない。MightyText, Google謹製Messages (「メッセージ」)

Apkpure.comアプリでも見当たらなかったがApkmirro.comでスマホにインストールいわば「本体版」は入手できる。遠隔アクセスはWebかタブレット用アプリで,後者はスマホ上のPlay Storeでは見つけられないが,これまたApkmirror.comでタブレットに入れる「遠隔版」が入手できる。

Google謹製Messagesアプリ messages.google.com/webでブラウザからアクセス可 複数の端末にアプリをインストールして使うような状況(つまり複数番号への/からのSMSを処理する)に対応しているのか?

MightyText 外から操作するためのタブレット用アプリが用意されている。Webアプリもあり。

Text Directly From Gmail
SMS directly from Gmail on your computer. Just like a Google chat/hangout window.

有償版で電子メールとのゲートウェイ機能あり。上との違いは?

ガラホでは画面が小さくてログインすらできない 開発者には報告済み
How Does Android Messages for Web Compare to Similar Apps?

MySMS クライアントアプリが充実している。タブレット用アプリ,デスクトップ(PC/Mac)アプリ,モバイルアプリもセットアップによってはクライアントアプリとして動作する?

操作したい端末でアプリがインストールされたことを,MySMSサーバー側で検知できて,そこで初めてGoogleアカウントと紐付けされたアカウントが作成されるようになっている。開発者サービスをインストールしていてもそれがうまくいくふうではないKYF39だと,アカウント自身が作成されず,そのKYF39でのSMS送受信を外から操作できない。一方,既に作成されたアカウントでログインして,他の端末のSMSが送受信を操作することは可。

Pulse SMS (Phone/Tablet/Web)は無料アプリだが,遠隔操作には有料のサブスクリプションが必要。

AirDroid: Remote access & File

Your Phone Companion – Link to Windows Windowsアプリしか用意されておらず他のスマホから操作はできない。

‘Real Differences between OT and CRDT’ Series by Chengzheng Sun, et. al.

[1810.02137] Real Differences between OT and CRDT for Co-Editors” was discussed about on Hacker News. This paper, submitted to ArXiv on October 2018, seems to be the oldest of the series of papers by the same authors with seemingly overlapping content. In fact, ArXiv attaches a note to that effect. Below are the newer papers, all of which were last revised on 10 Jun 2020 and are labeled “v2”:

The first one is supposedly a revised version of Real Differences between OT and CRDT under a General Transformation Framework for Consistency Maintenance in Co-Editors” in Proceedings of the ACM on Human-Computer Interaction, January 2020 Article No.: 06 https://doi.org/10.1145/3375186. There is a rebuttal in “Response to ‘Real Differences between OT and CRDT for Co-Editors’ · GitHub.”

Cheap Cell Phone Plans in the US Primarily for Texts Only

Page Plus logo

Page Plus logo

US Paypal is giving me another headache, by insisting again that I give them a cell phone number to which they can send a verification code. The problem is I have none. I had the same issue before, but at that time I resolved the problem by calling their customer service and having them turn off their two-phase authentication. I wrote the following articles on the topic at that time:

But exactly the same issue occurred again. So I had to call them yet again. They had me on hold for almost exactly one hour. The rep sent me a link via email from which I could change my password and with that I could log in and make the transaction I needed to make. However, once I was logged out, I couldn’t log in again, and they again ask for a phone number for them to send a text message for verification. The rep said it was a rare situation but here I am again. Is this the dance I need to do every time I need to log into Paypal from now on?

God I hope not! So I researched some more.

Page Plus Cellular’s No Contract Prepaid Plans include $10 Standard Plan, valid for 120 days. In reality more like $13 every 120 days so roughly $40 for a year. I need to use only one or two texts a month, so each text would cost more than $2 — that’s a heck of an expensive text. But this is certainly an option when push comes to shove.

Interestingly, 4G Pay-As-You-Go Plans is cheaper than 3G Pay-As-You-Go Plans. BYOP 3-in-1 SIM Activation Kit | Page Plus Cellular is $0.99.

Page Plus Cellular is a Verizon MVNO. For LTE (4G), Verizon uses bands 2, 4, 5, 13, 66, with 13 being the primary one. There is zero overlapping with LTE bands used in Japan. Cell phone models made specifically for the Japanese market may support only part of Verizon’s bands at best.

For the band usage in the US, see “Cheat sheet: which 4G LTE bands do AT&T, Verizon, T-Mobile and Sprint use in the USA? – Business.”