ivalkeen / vim-simpledb Goto Github PK
View Code? Open in Web Editor NEWExecution of postgresql or mysql commands from vim buffer
Execution of postgresql or mysql commands from vim buffer
Not an editor command: select * from dvl_version;^@'| mysql -v -v -v -t -
D baseproject -u root -P 3316 -h 127.0.0.1 > /tmp/vim-simpledb-result.txt 2>&1
Make it option for your plugin.
And also I recommend you to wrap such actions to:
\set QUIET on
...actions...
\set QUIET off
to get rid off unwanted messages ("timing enabled", "pager enabled", etc.)
Earlier you would use this to execute the current paragraph of SQL:
:call simpledb#ExecuteSql("'{", "'}")
Now you changed that to this version that moves the cursor to the '{
mark a line above the paragraph.
:'{,'}SimpleDBExecuteSql
A small improvement would be to use this to put the cursor in the first line of the paragraph:
:'{+1,'}SimpleDBExecuteSql
But I would prefer the previous behavior where the cursor wasn't moved at all.
Could you make that possible again? Thank you!
to run queries (regardless if selected text, paragraph etc. ) stopped working after Ctrl-C was issued to stop a running query.
I noticed vim-simpledb does this in ftdetect/sql.vim:
" sql
au BufNewFile,BufRead *.sql set filetype=sql
" plpgsql
au BufNewFile,BufRead *.pgsql,*.plpgsql set filetype=pgsql.sql
The first part is a near direct copy of what $RUNTIME/filetype.vim
does:
" SQL
au BufNewFile,BufRead *.sql call s:SQL()
func! s:SQL()
if exists("g:filetype_sql")
exe "setf " . g:filetype_sql
else
setf sql
endif
endfunc
So this introduces a redundant autocommand. Worse, it doesn't respect g:filetype_sql
, which left me scratching my head for way too long.
It would be best to just remove the first two lines I think (and the other one too, IMHO). Failing that, respecting g:filetype_sql
would be a "workable" second option.
executing the sql query
SELECT 1 != 0;
using simpledb results in the following error:
ERROR: syntax error at or near "("
LINE 1: SELECT 1 (cat /tmp/vim-simpledb-error.txt >> /tmp/vim-simple...
which matches up with the line here: https://github.com/ivalkeen/vim-simpledb/blob/master/plugin/simpledb.vim#L44
I've seen similar errors when there is an exclamation point in a WHERE clause as well, but the provided query was the simplest/smallest reproduction of the bug.
Hey. Good plugin. One suggestion similar to #7.
There should be a configuration variable to prevent default keybindings. It can be enabled by default if you like.
Like this.
ftplugin/sql.vim:
if g:simpledb_use_default_keybindings
vnoremap <buffer> <enter> :SimpleDBExecuteSql<cr>
nnoremap <buffer> <enter> m':SimpleDBExecuteSql <cr>g`'
nnoremap <buffer> <leader><enter> m':'{,'}SimpleDBExecuteSql<cr>g`'
endif
plugin/simpledb.vim:
if !exists('g:simpledb_use_default_keybindings')
let g:simpledb_use_default_keybindings=1
endif
Then if you don't want those default keybindings to be bound you can edit your personal vim configuration:
let g:simpledb_use_default_keybindings=0
Query result have been written to /tmp/vim-simpledb-result.txt but have not been displayed on screen.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.