14 ms·
I don't want to be Debbie Downer, but what's the usecase for this tool that isn't better suited for a client in a separate terminal? I am guessing that the two
by falcolas 9y ago
I don't want to be Debbie Downer, but what's the usecase for this tool that isn't better suited for a client in a separate terminal? I am guessing that the two biggest answers would be the :%DB command and the variable setting, but given the ease of switching and copy-pasting between terminals, this seems superfluous. Maybe it's for easier integration into other plugins?
Personally, if I was looking for a DB integration with VIM, I'd be looking for an interactive prompt style buffer instead of per-command executions.
- mbreese 9y agoI haven’t tried this, but the docs mention an interactive mode. I assume this would be a more vim-esque prompt mode.
- eptcyka 9y agoI did try this and the 'interactive' mode just spawns a shell of a given SQL terminal. And this doesn't work on neovim.
- wmonk 9y agoFor me, vim is so integral now to my dev workflow that being able to work in a single environment is great. I don't really use and cli tooling for DB access and querying, now being able to use a vim pane as my query entry is really nice - no switching back and forth between various applications. An interactive prompt would be pretty nice though, agree with that.
- in9 9y agoinb4 "oh so you should use emacs" :D
- zeveb 9y agoI find it really amusing that the vim ecosystem is reinventing emacs, more slowly, in a worse language. There are some really amazing, really smart people (like Tim Pope), creating some really amazing, really cool software — I can only imagine how much more effective they'd be if they were working in a better environment.
- arjunrc 9y agoI’m tied to Windows at work. I’ve tried to start a few conversations about offering MacBooks as an option, but that never goes anywhere due to the additional upfront cost. Given that constraint, I picked up Vim and have used it for the past 6 years. Tried Emacs at first, but it didn’t play well on Windows (not sure if user error!) So I definitely encourage “reinventing the wheel” on multiple platforms, as long as the platform is popular enough. Competition doesn’t hurt.
- jamesgeck0 9y agoModal editing is just that good. ;-) The thing that would get me to use Emacs is a plugin implementing Neovim's remote editing protocol. Vim is an incredibly deep state machine, and no plugins that reimplement it get things exactly right.
- zeveb 9y agoI hear good things about evil-mode & viper for emacs. Dunno about Neovim's remote editing protocol though. TRAMP does the trick exceedingly well for me (to include 'remote' editing as root on the local machine, which is kinda awesome).
- chongli 9y agoI have tried evil mode many times. It just doesn't work. It may be 99% faithful implementation of vim but I hit the missing 1% so often that I throw up my hands before quitting out to use the real thing.
- Dangeranger 9y agoWhich parts of EVIL mode don’t work as you expect them to?
- syrrim 9y ago99% of ex commands don't work.
- icc97 9y agoIsn't it the same use case as having say SQL Server Management Studio? You get nice syntax highlighting and your Vim dev environment for modifying SQL then you can run the script and see the result and edit, rinse, repeat
- falcolas 9y agoI can do exactly what you mention with two terminal windows, swapping back and forth with a single key combination. As a bonus, it lets me take advantage of keeping my connection credentials out of a history file. My response is based largely on my workflow - I use VIM as one part of my development environment (ie the shell), not as a standalone IDE. Perhaps this is the biggest difference.
- petepete 9y agoI use tmux for this, often with a horizontal split displaying the output of the script on the bottom and the query/ddl on top (just like isqlw). I know it's possible to automate further (to make vim talk to tmux and execute the bit of SQL under the cursor, for example), but it works well for me as is.
- WhatIsDukkha 9y agoAs I got better over with Vim I wanted more and more things under the editing and movement power of Vim Text Objects - https://blog.carbonfive.com/2011/10/17/vim-text-objects-the-definitive-guide/ https://blog.carbonfive.com/2011/10/17/vim-text-objects-the-... That's probably why I ended up with Emacs/Evil mode :) https://www.emacswiki.org/emacs/SqlMode https://www.emacswiki.org/emacs/SqlMode For me SQL is editing and sending chunks of text fluently, that exactly where vim or emacs are at their best.
- fiddlerwoaroof 9y agoYeah, the best implementation of vi is written in Emacs Lisp
- 9y ago
- Jeaye 9y ago> Personally, if I was looking for a DB integration with VIM, I'd be looking for an interactive prompt style buffer instead of per-command executions. Especially when "modern" is in the title, one might expect more than just a wrapper of :DB commands. Given that both Vim 8 and Neovim have a :terminal, this might as well be a collection of shell functions; it'd also be more portable.
- pweissbrod 9y agohaving a consistent interface between local and terminal is ideal. being able to highlight any text in any buffer and say 'send this to DB and place results in new pane' is extremely usable. You dont see this sort of power in things like intellij or visual studio because it normally requires you to open an entirely different program for sql.
- platz 9y agoHaving a single active connection is an assumption those tools tend not to make
- pweissbrod 9y agoHave you ever used dbext? I dont understand your comment because it can handle multiple connections. Connections are referred to as named profiles. If you want to work with one connection at a time for safety sake you can use :DBSetOption profile=X But dbext is vimscript which is very hackable like anything else in vim. If you want to use multiple connections theres nothing stopping you from writing something like nmap <leader>se1 to run the selection with connection profile #1 nmap <leader>se2 to run the selection with connection profile #2 and so forth
- cgag 9y agoEither you're not using vim right or I don't know how to copy and paste correctly. and
- freshhawk 9y ago> I'd be looking for an interactive prompt style buffer instead of per-command executions > given the ease of switching and copy-pasting between terminals, this seems superfluous. This really makes me think you are a prime candidate for a plugin that can easily open an interactive prompt or make the whole copy, switch terminal, paste, copy response flow one command. This is just repl-integration for db repls (interactive prompts if you prefer). Many people are used to this workflow: Open your editor, open a prompt in another terminal. Write the simple stuff in the prompt, the complex stuff in your editor and then copy/paste to the prompt. Write a simple query in the prompt that ends up pretty complex, so you copy it, switch to the editor and paste, fix it up then copy, switch to prompt and paste it back. Now you copy part of the query results, switch to editor and paste so you can extract some of the results for the next complicated query. A lot of us know this workflow, an many of us aren't aware that what we are looking for is repl integration in the editor. Same workflow, goes like this: edit query, eval, edit again, eval, etc. It is not a different way of working, it is the same way but much better. How do you know if you want this? If you use vim and set your readline config to use vi keybindings you want this. You already noticed that editing stuff in the prompt is worse than in vim, you just picked the wrong fix for that problem.
- falcolas 9y agoIf you use tmux, the transmission of a command from Vim to another tmux pane is remarkably simple. It's just a shell out to the tmux binary with the appropriate arguments. My problem with vim-integrated shells, prompts - anything inherently interactive except for editing itself - is that it's always worse. Be it performance, integration between vim and the interactive prompt, or an impedance mismatch between vim's modal editing and an interactive prompt's non-modal editing. I'd rather switch windows and use a native shell than a kinda-working shell in vim. Same with a DB prompt. Same with pretty much every other tool I pull up in the terminal. Honestly, it's the same reason I don't use emacs with EVIL mode: it's not quite vim, and those speedbumps absolutely kill my "Flow". Any gains from a rich editing environment are lost (with interest) by trying to figure out how to get the non-editing part of that environment to behave correctly. And I even use emacs bindings in bash (no, not zsh or fish or...); because then when I go to remote servers, everything just works. That's my opinion, at least.