mirror of https://github.com/mickael-menu/zk
Support for VS Code and minor LSP fixes (#34)
parent
b82b217078
commit
f3ebdb4813
@ -0,0 +1,15 @@
|
|||||||
|
VERSION := `git describe --tags --match v[0-9]* 2> /dev/null`
|
||||||
|
|
||||||
|
all: macos linux
|
||||||
|
rm -f zk
|
||||||
|
|
||||||
|
macos:
|
||||||
|
rm -f zk && ./go build && zip -r "zk-${VERSION}-macos-`uname -m`.zip" zk
|
||||||
|
|
||||||
|
linux:
|
||||||
|
rm -f zk && docker run --rm -v "${PWD}":/usr/src/zk -w /usr/src/zk mickaelmenu/zk-xcompile:linux-i386 /bin/bash -c './go build' && tar -zcvf "zk-${VERSION}-linux-i386.tar.gz" zk
|
||||||
|
rm -f zk && docker run --rm -v "${PWD}":/usr/src/zk -w /usr/src/zk mickaelmenu/zk-xcompile:linux-amd64 /bin/bash -c './go build' && tar -zcvf "zk-${VERSION}-linux-amd64.tar.gz" zk
|
||||||
|
rm -f zk && docker run --rm -v "${PWD}":/usr/src/zk -w /usr/src/zk mickaelmenu/zk-xcompile:linux-arm64 /bin/bash -c './go build' && tar -zcvf "zk-${VERSION}-linux-arm64.tar.gz" zk
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf zk*
|
@ -0,0 +1,86 @@
|
|||||||
|
# Editors integration
|
||||||
|
|
||||||
|
There are several extensions available to integrate `zk` in your favorite editor:
|
||||||
|
|
||||||
|
* [`zk.nvim`](https://github.com/megalithic/zk.nvim) for Neovim 0.5+, maintained by [Seth Messer](https://github.com/megalithic)
|
||||||
|
* [`zk-vscode`](https://github.com/mickael-menu/zk-vscode) for Visual Studio Code
|
||||||
|
|
||||||
|
## Language Server Protocol
|
||||||
|
|
||||||
|
`zk` ships with a [Language Server](https://microsoft.github.io/language-server-protocol/overviews/lsp/overview/) to provide basic support for any LSP-compatible editor. The currently supported features are:
|
||||||
|
|
||||||
|
* Auto-complete Markdown links with `[[` (setup wiki-links in the [note formats configuration](note-format.md))
|
||||||
|
* Auto-complete [hashtags and colon-separated tags](tags.md).
|
||||||
|
* Preview the content of a note when hovering a link.
|
||||||
|
* Navigate in your notes by following internal links.
|
||||||
|
* [And more to come...](https://github.com/mickael-menu/zk/issues/22)
|
||||||
|
|
||||||
|
To start the Language Server, use the `zk lsp` command. Refer to the following sections for editor-specific examples. [Feel free to share the configuration for your editor](https://github.com/mickael-menu/zk/issues/22).
|
||||||
|
|
||||||
|
### Vim and Neovim
|
||||||
|
|
||||||
|
#### Vim and Neovim 0.4
|
||||||
|
|
||||||
|
With [`coc.nvim`](https://github.com/neoclide/coc.nvim), run `:CocConfig` and add the following in the settings file:
|
||||||
|
|
||||||
|
```jsonc
|
||||||
|
{
|
||||||
|
// Important, otherwise link completion containing spaces and other special characters won't work.
|
||||||
|
"suggest.invalidInsertCharacters": [],
|
||||||
|
|
||||||
|
"languageserver": {
|
||||||
|
"zk": {
|
||||||
|
"command": "zk",
|
||||||
|
"args": ["lsp"],
|
||||||
|
"trace.server": "messages",
|
||||||
|
"filetypes": ["markdown"]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Neovim 0.5 built-in LSP client
|
||||||
|
|
||||||
|
Using [`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig):
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
local configs = require('lspconfig/configs')
|
||||||
|
|
||||||
|
configs.zk = {
|
||||||
|
default_config = {
|
||||||
|
cmd = {'zk', 'lsp'},
|
||||||
|
filetypes = {'markdown'},
|
||||||
|
root_dir = function()
|
||||||
|
return vim.loop.cwd()
|
||||||
|
end,
|
||||||
|
settings = {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
lspconfig.zk.setup({ on_attach = function(client, buffer)
|
||||||
|
-- Add keybindings here, see https://github.com/neovim/nvim-lspconfig#keybindings-and-completion
|
||||||
|
end })
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sublime Text
|
||||||
|
|
||||||
|
Install the [Sublime LSP](https://github.com/sublimelsp/LSP) package, then run the **Preferences: LSP Settings** command. Add the following to the settings file:
|
||||||
|
|
||||||
|
```jsonc
|
||||||
|
{
|
||||||
|
"clients": {
|
||||||
|
"zk": {
|
||||||
|
"enabled": true,
|
||||||
|
"command": ["zk", "lsp"],
|
||||||
|
"languageId": "markdown",
|
||||||
|
"scopes": [ "source.markdown" ],
|
||||||
|
"syntaxes": [ "Packages/MarkdownEditing/Markdown.sublime-syntax" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Visual Studio Code
|
||||||
|
|
||||||
|
Install the [`zk-vscode`](https://marketplace.visualstudio.com/items?itemName=mickael-menu.zk-vscode) extension from the Marketplace.
|
Loading…
Reference in New Issue