Skip to content

NateLehman/kustocli-vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kustocli-vim

a kusto vim plugin

screenshot-of-kustocli-vim

Background

The goal of this plugin is to provide a kusto query authoring experience native to VIM. This plugin does 2 distinct things so far

  1. Provides syntax highlighting for the kusto query/command language. These files are recognized with the extensions .kql, .csl, and .kusto
  2. Provides commands and shortcuts to send and recieve the results of queries being written.

Requirements

This project is built on and tested with VIM version 8.2 but that might not be a hard requirement.

Installation

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

Usage

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).

How to Run a Query

  1. Be in normal mode.
  2. Hover the cursor over the paragraph you wish to send as a query.
  3. 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

Setup

Connection String

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.

Kusto.Cli.exe Install location

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.

About

a kusto vim plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published