How to require relative paths

I am constantly tweaking my config files. And always changing require paths is a pain.

For example, I have a file lua/plugins/lsp/init.lua from which I do

require('plugins.lsp.servers.ts')
require('plugins.lsp.servers.lua')
require('plugins.lsp.servers.bash')

When I move files around it’s a pain to change all imports.

I want to be able to do something like this

require('./servers/ts.lua') -- obviuosly wrong syntax
2 Likes