a kusto vim plugin
The goal of this plugin is to provide a kusto query authoring experience native to VIM. This plugin does 2 distinct things so far
- Provides syntax highlighting for the kusto query/command language. These files are recognized with the extensions
.kql
,.csl
, and.kusto
- Provides commands and shortcuts to send and recieve the results of queries being written.
This project is built on and tested with VIM version 8.2 but that might not be a hard requirement.
Install the Vim plugin using your preferred plugin manager:
Plugin Manager | Command |
---|---|
Vim-plug | Plug 'NateLehman/kustocli-vim' |
Vundle | Bundle 'NateLehman/kustocli-vim' |
NeoBundle | NeoBundle 'NateLehman/kustocli-vim' |
... or git:
'runtimepath' handler | Command |
---|---|
Vim 8.0+ Native packages | $ git clone git://github.com/NateLehman/kustocli-vim ~/.vim/pack/plugins/start/kustocli-vim |
Pathogen | $ git clone git://github.com/NateLehman/kustocli-vim ~/.vim/bundle/kustocli-vim |
If not using a plugin manager such as Vim-plug (which does this automatically), make sure your .vimrc contains these lines:
filetype indent plugin on
syntax enable
The plugin is designed to work very similarly to Kusto.Explorer. Kusto query commands and syntax highlighting will activate when a kusto
file type is opened, or when the filetype is set to kusto
within VIM (by using :set filetype=kusto
).
- Be in normal mode.
- Hover the cursor over the paragraph you wish to send as a query.
- Press
shift
+enter
. You may need to wait while the query completes. A new scratch window should open up with the output of the query.
If you'd like to be more flexible with where the window opens for your query results. You can use the underlying command :KustoQuery
which also works with <mods>
. For example, shift
+enter
maps to:
:bel KustoQuery
The connection string used for the kusto cluster can be set with
" add this to your .vimrc to point queries at your preferred kusto cluster
:let g:KustoCli_cluster_conn_string = "<my-cluster-connection-string>"
It is very important that you add this to your vimrc to access your desired cluster. By default, the connection string is set to the Samples database referenced by the kusto documentation, so you can test out the plugin by copy-pasting queries from the documentation.
You may define a path to the Kusto.Cli.exe you have installed with:
:let g:KustoCli_executable_path="C:\<path-to>\Kusto.Cli.exe"
Otherwise, upon first loading a .kusto
file or setting the filetype to kusto
, the plugin will automatically download and cache the most recent version of the Kusto CLI from its official source.