Reputation: 818
I'm using Kubuntu 22.04, and Neovim 0.8 from the Konsole command-line.
I'm using vim-dadbod
and vim-dadbod-ui
plugins for MySQL database connection.
I don't want to have to type the password every time I open the connection, but I can't just use it directly in the mysql url (mysql://<username>:<password>@<host>:<port>/<db_name>
) in the init.vim
file, because this file WILL BE SHARED with other people.
Therefore, I want to store the user & password in a separate file, and call it with a variable inside my init.vim
.
I've tried to create a ~/.config/nvim/lua/myVars.lua
file and use require('myVars')
in my init.vim
file, but didn't work...
So, how can I import the variables from the lua file, and use it within init.vim
?
Upvotes: 3
Views: 1471
Reputation: 161
You may want to consider a plugin to help you manage local project items such as database or debugging tasks.
I've been helping to develop the plugin
https://github.com/kndndrj/nvim-projector
Which has built in support for dadbod configurations, nvim-dap, and even just running shell commands.
I put my database dadbod connection information in my project file stored at ./projector.json for each project I am working on.
Then just keep the file out of source control by putting a line in your .gitignore file and your all setup!
Upvotes: 0