Skip to content

Quickstart

  1. Install the plugins and the Teradata Tree‑sitter parser (see Install).
  2. Configure a user in init.lua:
require('vim-teradata').setup({
  users = {
    { log_mech = 'TD2', user = 'USER', tdpid = 'HOST' },
  },
  replacements = { ['${DB_NAME}'] = 'MY_DB' },
  keymaps = {
     ["gcu"] = "uncomment_node",
     ["gcq"] = { "comment_node", { "statement" } },
     ["gcs"] = { "comment_node", { "select_expression" } },
     ["gcw"] = { "comment_node", { "where" } },
     ["gcf"] = { "comment_node", { "term" } },
     ["gcb"] = { "comment_node", { "binary_expression" } },
     ["gdq"] = { "delete_node", { "statement" } },
     ["gds"] = { "delete_node", { "select_expression" } },
     ["gdw"] = { "delete_node", { "where" } },
     ["gdf"] = { "delete_node", { "term" } },
     ["gdb"] = { "delete_node", { "binary_expression" } },
     ["]s"] = { "jump_to_next", { "statement" } },
     ["[s"] = { "jump_to_prev", { "statement" } },
 },

})
require('sql-autocomplete').setup({})
  1. Sync metadata (one‑time or whenever the catalog changes):
:TDSync
  1. Open a .sql file and start typing. Completion becomes schema‑aware (FROM → tables, then columns).
  2. Run a query with :TDO and watch progress in :TDJ (asynchronous execution).
  3. Bookmark useful queries: select text → :TDBAdd, then manage in :TDB.

Example

-- Use placeholder replacement if configured
SELECT *
FROM ${DB_NAME}.Orders o
JOIN ${DB_NAME}.OrderItems i
  ON o.OrderId = i.OrderId
WHERE o.OrderDate >= DATE '2024-01-01'
QUALIFY ROW_NUMBER() OVER (PARTITION BY o.CustomerId ORDER BY o.OrderDate DESC) = 1;