/lazysql.nvim

Plugin to open LazySQL without quiting neovim

Primary LanguageLuaMIT LicenseMIT

lazysql.nvim

Simple and straightforward plugin that allows the user to open lazysql without quitting their current Neovim session. For more details, check the help file

lzd

Contents

Inspiration

Alternatives

About this major release

This version introduces several key improvements over the previous major release:

  • Code Clarity: Great care has been taken with typing and commenting the functions. The codebase should be clear enough for easy understanding and tweaking.
  • Detailed Documentation: Comprehensive documentation has been added, powered by mini.doc.
  • Robust Testing: Tests have been taken very seriously. A complete suite has been added, including mocks for Neovim's built-in functions for more precise results, powered by mini.test.
  • Dependency Removal: The previous version depended on nui.nvim. This dependency has been removed, allowing for greater internal control and simplifying the plugin's architecture.

Installation

Requirements

-- Mini.deps
MiniDeps.add('DokaDev/lazysql.nvim')
require('lazysql').setup()
-- Lazy
{
  'crnvl96/lazysql.nvim',
    opts = {},
}

Configuration

lazysql.nvim comes with the following defaults. Call the setup function with your overrides.

-- Default configuration
require('lazysql').setup({
  window = {
    settings = {
      width = 0.9, -- Percentage of screen width (0 to 1)
      height = 0.9, -- Percentage of screen height (0 to 1)
      border = 'rounded', -- See ':h nvim_open_win' border options
      relative = 'editor', -- See ':h nvim_open_win' relative options
    },
  },
})

Usage

  • It exposes the global table LazySql, for more convenient use
  • Use the command :lua LazySql.toggle() or :lua require('lazysql').toggle() to toggle the floating panel.
  • Or set a keymap. It's recommended to map in both normal and terminal modes, as lazysql runs inside a terminal buffer:
vim.keymap.set({ 'n', 't' }, '<leader>ld', '<Cmd>lua LazySql.toggle()<CR>')
  • For a more detailed reference about this plugin features, run :help lazysql.nvim
  • For a quick reference regarding manipulating lazysql features within its terminal, check the official lazysql keybindings.

Acknowledgements

Special thanks to the creators and maintainers of these fantastic tools which served as inspiration or provided useful patterns: