Closed zhangddjs closed 11 months ago
I have gotten around this by turning off execute on save and then using this keybind to run the query under my cursor https://github.com/skbolton/titan/blob/d37c0178c41652191285fe031ca89ee0568c3bf5/nvim/nvim/after/ftplugin/sql.lua#L5
I am okay with separating my different queries my newlines to make it work.
cool, this helped a lot, thanks @skbolton . Also I found that some of the dbext
built-in keymap like <leader>sep
or <leader>sel
can execute the cursor querys.
Background
Sometimes there are many sql querys in one single file, split by
;
, but once I want execute a single query, I need to select the whole syntax and then<Leader>S
.But one problem is that , if I forgot to select the syntax, then
<Leader>S
will execute the whole file, what was not I wanted. (It maybe drop some tables without any confirm popup, which will cause serious results)Requirement
According to this situation, is it possible to provide a mechanism that:
Example
for e.g.
the cursor is in middle of this create table query, when I execute, it will just execute the
create table ....
block ending with semi-colon, and will not execute thedrop table
and other querys outside of the cursor.