Code Monkey home page Code Monkey logo

Comments (2)

bew avatar bew commented on June 8, 2024

Actually I was wrong, some weird behavior of the result window is not from vim-dadbod-ui BUT from vim-dadbod plugin: https://github.com/tpope/vim-dadbod which is supposed to be minimal and flexible..

Using vim-dadbod without the other UI plugin

When using vim-dadbod without the UI from vim-dadbod-ui plugin, it is much better, and I have a better control on the windows, buffers, etc..

For example:

:e some_file.sql

# Set current DB for the buffer
:DB b:db = $INVENTORY_DATABASE_URI

# visual select a query, then run
:'<,'>DB b:db

# This show the special buffer with the result

I want my own flexible UI on top of vim-dadbod !!

I want to pin & name a result buffer

Currently the result buffer is volatile, simply running :CtrlSpace or running another query will hide the buffer.
Probably because of:
https://github.com/tpope/vim-dadbod/blob/779e8d6efc89b68be951ac1419baae75541cf51c/autoload/db.vim#L163
AND
https://github.com/tpope/vim-dadbod/blob/4a2a8bc6dca50bc58885bdf2c0a153d0990d7872/autoload/db.vim#L282
---> this last link tells us that the result window is a PREVIEW WINDOW!!! Instead it should be a proper window with configurable lifecycle!
---> That's why when I edit a query and do completion, the preview of the completion replaces the result window :/ too bad...
The result window should not be created (in an hardcoded way) by the plugin, it should be configurable, with a default value to pedit to open a preview window.

I want to be able to 'pin' a result buffer, so it does not disappear while I'm looking away, run :CtrlSpace, or run another query.
----> might need to change vim-dadbod? I could contribute to the plugin?

I want to give a 'virtual name' to a result buffer, without saving it to the file system when pinning, so I know what that result is about (e.g: "all resource types") (in vim's buffer list, in the status line, ...)

I want to see the result's input query in the result buffer

or have a mapping to show it / toggle it at the beginning of the result buffer.

I want to reload the result's buffer with the same query

vim-dadbod already has a mapping for that, but it doesn't seem to work...
The saved file for the query linked to a result buffer uses the interactive :DB<cr> command..

Suggestion:
In vim-dadbod, support b:some_var format for the query.
Then for a result buffer:

  • store the input query as a b:db_input_content variable
  • store the database used in a variable like b:db_uri
    Then to replay the query:
    :DB b:db_uri b:db_input_content

I want helper mappings, displays while writing queries

(ultimate would be to have some of these info in a floating window, but then how to position this window in non-obstrusive way?)

  • one to show the columns of a table (when I have the cursor on the (schema.)table name)
  • one to show the tables
  • one to create a new query buffer associated to the same db (or do I set g:db or t:db and use that always? I'd prefer no)

A discoverable tree view of the database would be helpful (similar to vim-dadbod-ui, but less rigid and simpler)

from dotfiles.

bew avatar bew commented on June 8, 2024

Another option: https://github.com/nanotee/sqls.nvim
This is a SQL language server ❤️ (https://github.com/lighttiger2505/sqls)

It supports executing sql commands through the language server..
The nvim layer is really simple, it should be easy to hack on!

from dotfiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.