evanthegrayt / vim-lovehandle Goto Github PK
View Code? Open in Web Editor NEW🫶 A DadBod extension that helps switch database URLs by calling user-defined handles. Also handles setting DB URLs for SQL files based on file name.
License: MIT License
🫶 A DadBod extension that helps switch database URLs by calling user-defined handles. Also handles setting DB URLs for SQL files based on file name.
License: MIT License
Currently, you have to call :LHReload
every time you change directories. There should be an option to enable auto-loading, probably on the DirChanged
event.
Also, add documentation about :LHReload
to readme so users can create their own autocmd
.
Add the code.
When generating the sql file contents, only postgres and mysql are supported. This should be easy; mariadb, for example, is the same syntax as mysql
show tables
describe users
Users should be able to add to array of generated lines.
LHSwitch
always sets b:db
. It'd be nice if we could call LHSwitch development w:db
for "window", or even g:db
for global.
Instead of looking for an exact match of directory as g:lovehandle_projects
, it should see if it matches up until a certain point, and then load the file located in the root, without changing to that directory.
This plugin sets the handles to g:db
and b:db
, which are DadBod-specific. Might be nice to be able to set it to other, user-defined variables.
I've personally switched away from set exrc secure
, and instead, I use this script.
augroup local_vimrc
autocmd!
autocmd VimEnter,BufRead *
\ if s:should_load_local_vimrc() |
\ source .vimrc |
\ let g:projects_with_vimrc = 1 |
\ endif
augroup END
function! s:should_load_local_vimrc() abort
let l:projects_with_vimrc = ['project_directory'] " Obviously, set real directories.
return index(l:ps_projects, fnamemodify(getcwd(), ':t')) >= 0 &&
\ filereadable(".vimrc") &&
\ get(g:, 'project_vimrc_sourced', 0) == 0
endfunction
You could also just set the g:lovehandle_list
from this autocmd, but I keep my vimrc public and don't want DB info in there.
Currently, there is confirmation and a different syntax highlighting when you switch to the "production" branch. The user might want this to be a different handle name.
LHList
-> DBList
, etc.
I initially went with LH to fit the name of the plugin, but in practice, it's unnecessarily convoluted. It extends dadbod, so it should be similar to its command. Not to mention, it's much easier to type.
I'm not 100% sure of this change though; comments are welcome.
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.