-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9dc0e94
commit 3a3a6d9
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
vim9script | ||
|
||
if get(g:, "devcontainer_vim", v:false) | ||
export def Send(host: string, port: number) | ||
var buffer_content = join(getbufline('%', 1, '$'), "\n") | ||
call send_to_simai#SendWithText(buffer_content, host, port) | ||
enddef | ||
|
||
export def SendWithText(text: string, host: string, port: number) | ||
var channelToSimai = ch_open($"{host}:{port}", {"mode": "raw"}) | ||
call ch_sendraw(channelToSimai, text, {}) | ||
call ch_close(channelToSimai) | ||
enddef | ||
|
||
export def StartPreview() | ||
augroup devcontainer_md | ||
autocmd! | ||
autocmd BufWritePost *.md execute ':call send_to_simai#Send("host.docker.internal", 7878)' | ||
augroup END | ||
enddef | ||
|
||
export def StopPreview() | ||
augroup devcontainer_md | ||
autocmd! | ||
augroup END | ||
enddef | ||
endif | ||
|
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