epher : Calculator language with inline answers and unit conversion
| script karma |
Rating 0/0,
Downloaded by 4 |
Comments, bugs, improvements
|
Vim wiki
|
| created by |
| Upy Esp |
| |
| script type |
| utility |
| |
| description |
epher is a calculator language: you write ordinary math, with units
that convert, and every statement's answer appears inline, right next
to the line that produced it.
This package teaches Vim the language. It adds filetype detection for
.epher files, syntax highlighting for comments, strings, every number
form (decimal, scientific, 0b, 0o, 0x, imaginary i), the twenty
keywords, and the conservative unit-suffix rule that mirrors the
parser's adjacency rule. The ftplugin settings cover # comments
(commentstring) and _ in iskeyword, so x1 and sin_x stay whole. The
same files work in Neovim.
What Vim gets on its own: the highlighting and filetype settings
above, in any .epher file, with nothing to configure. The inline
answers, diagnostics, hover, completion, and script runs come from the
shared epher-lsp language server and need a client for it. Vim reaches
that server through the vim-lsp plugin (with its async.vim
dependency); with both installed and epher-lsp on your PATH, register
it once in your vimrc:
if executable('epher-lsp')
au User lsp_setup call lsp#register_server({
\ 'name': 'epher',
\ 'cmd': {server_info -> ['epher-lsp']},
\ 'allowlist': ['epher'],
\ })
endif
That wiring adds the language server features to Vim: diagnostics,
hover, completion, and the :EpherRun results pane. The inline answers
are inlay hints; vim-lsp renders them when g:lsp_inlay_hints_enabled
is set and Vim runs as Vim9 with virtual text. Neovim has its native
glue in the repository's clients/nvim directory; its README has the
setup lines.
The server binary is a separate download from the releases page:
https://github.com/upyesp/epher/releases
Usage: open any .epher file. Vim detects the filetype and applies the
syntax automatically, and :EpherRun runs the script once the language
server is attached.
What it looks like: terminal captures of the inline answers, hover,
completion, the run results, and a scripted demo are in the repository:
https://github.com/upyesp/epher/tree/main/clients/vim/images
epher.org has the standalone calculator and a library of ready-made
scripts: https://epher.org |
| |
| install details |
Install:
- copy the ftdetect, syntax, and ftplugin directories into ~/.vim/
(~/vimfiles on Windows, $VIM/vimfiles for a system-wide install);
- or download epher-vim.zip from
https://github.com/upyesp/epher/releases and extract it into
~/.vim/pack/epher/start/, where Vim picks up the epher-vim
directory automatically;
- or with a plugin manager, point it at the directory, or add
"set runtimepath+=/path/to/epher-vim" to your vimrc.
|
| |
script versions (upload new version)
Click on the package to download.
ip used for rating: 216.73.217.32
|