Skip to content

Latest commit

 

History

History
62 lines (41 loc) · 1.82 KB

README.md

File metadata and controls

62 lines (41 loc) · 1.82 KB

zippy.nvim

nvim plugin written in lua to help with debugging. this is inspired by the popular vscode extension turbo console log, for javascript, lua and python.

the main functionality is to insert meaningful print statements automatically.

image

image

the print statement is formatted as

- file name -> line number -> variable

if you have nvim navic installed, breadcrumbs to your function are additionally added:

- file name -> line number -> breadcrumbs -> variable

Installation

Packer:

use 'PatschD/zippy.nvim'

Keymap

vim.keymap.set("n", "<leader>lg", "<cmd>lua require('zippy').insert_print()<CR>")

Setup

Tree-sitter is required

if you are happy with the defaults, nothing has to be configured.

otherwise two options can be configured:

  • formatting:

as lua, javascript and python are quite different (indentations, newlines), zippy.nvim focuses on creating valid code, then calls the lsp to format. this can be disabled, performed only on the affected rows or perfomed globally. Not all formatters can format only a certain range (such as black for python)

  • print function: if you have a custom print function you can pass that instead.
require("zippy").setup({
  ["lua"] = {
    language_format_behaviour = "none",
    print_function = "print",
  },
  ["typescriptreact"] = {
    print_function = "console.warn",
  }
})