Last active
December 13, 2022 04:21
-
-
Save hdykokd/76777dda9b315c0074a2f4379e5faf3a to your computer and use it in GitHub Desktop.
denops
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ~/temp/.vimrc | |
syntax enable | |
filetype plugin indent on | |
" mkdir ~/temp | |
" git clone https://github.com/vim-denops/denops.vim ~/temp/denops.vim | |
set runtimepath+=~/temp/denops.vim | |
set runtimepath+=~/.config/nvim/plugins/denops-hello.vim | |
let g:denops#debug = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nvim --clean -u ~/temp/.vimrc | |
:e ~/.config/nvim/plugins/denops-hello.vim/denops/hello/main.ts | |
" main.tsのL16を `console.log("Hello!!!", denops.name);` に書き換える | |
:w | |
:call denops#plugin#reload('hello') | |
:messages | |
[denops] Server spawned: ['deno', 'run', '-q', '--no-check', '--unstable', '-A', '/Users/hideyuki.okada/temp/denops.vim/denops/@denops-private | |
/cli.ts', '--quiet', '--identity', '--port', '0'] | |
[denops] DenopsStarted | |
[denops] Connecting to `127.0.0.1:57291` | |
[denops] DenopsReady | |
[denops] 1 plugins are discovered | |
[denops] register plugin: ['hello', '/Users/hideyuki.okada/.config/nvim/plugins/denops-hello.vim/denops/hello/main.ts', {'platform': 'mac', 'h | |
ost': 'vim', 'mode': 'debug', 'version': '9.0.1000'}, {'mode': 'skip'}] | |
[denops] DenopsPluginPre:hello | |
[denops] Hello! hello | |
[denops] DenopsPluginPost:hello | |
"~/.config/nvim/plugins/denops-hello.vim/denops/hello/main.ts" 20L, 636B | |
"~/.config/nvim/plugins/denops-hello.vim/denops/hello/main.ts" 20L, 638B written | |
[denops] reload plugin: ['hello', {'platform': 'mac', 'host': 'vim', 'mode': 'debug', 'version': '9.0.1000'}, {'mode': 'error'}] | |
[denops] DenopsPluginPre:hello | |
[denops] Hello! hello | |
[denops] DenopsPluginPost:hello | |
" L23 の出力が変わってほしい |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ~/.config/nvim/plugins/denops-hello.vim/denops/hello/main.ts | |
import { Denops } from "https://deno.land/x/denops_std@v3.10.0/mod.ts"; | |
import { execute } from "https://deno.land/x/denops_std@v3.10.0/helper/mod.ts"; | |
import { ensureString } from "https://deno.land/x/unknownutil@v1.1.2/mod.ts"; | |
export async function main(denops: Denops) { | |
denops.dispatcher = { | |
async echo(text: unknown): Promise<unknown> { | |
ensureString(text); | |
console.log("Echo: ", text); | |
return await Promise.resolve(text); | |
}, | |
}; | |
console.log("Hello!", denops.name); | |
await execute( | |
denops, | |
`command! -nargs=1 DenopsHello call denops#request('${denops.name}', 'echo', [<q-args>])`, | |
); | |
} |
Author
hdykokd
commented
Dec 13, 2022
$ nvim --version
NVIM v0.9.0-dev-213+gcc5b7368d
Build type: Release
LuaJIT 2.1.0-beta3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment