mirror of
https://github.com/tomru/nvim.git
synced 2026-03-03 06:27:14 +01:00
em, fix rooter structure a bit :doge:
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
return {
|
||||
dir = '~/.config/nvim/lua/plugins/local/rooter.lua',
|
||||
dir = '~/.config/nvim/lua/plugins/local/rooter',
|
||||
name = 'rooter',
|
||||
config = function()
|
||||
require('rooter').setup {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local log_level = vim.log.levels.ERROR
|
||||
local log_level = vim.log.levels.WARN
|
||||
|
||||
local function log(msg, level)
|
||||
if level == vim.log.levels.ERROR then
|
||||
@@ -81,13 +81,19 @@ function M.setup(opts)
|
||||
M.config = vim.tbl_deep_extend('force', M.config, opts or {})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('my-rooter', { clear = true }),
|
||||
group = vim.api.nvim_create_augroup('tomru/rooter', { clear = true }),
|
||||
callback = debounced_on_attacched,
|
||||
})
|
||||
end
|
||||
|
||||
-- Create user commands
|
||||
-- vim.api.nvim_create_user_command('MyPluginGreet', function() print(M.config.greeting) end, {})
|
||||
-- vim.api.nvim_create_user_command('MyPluginStatus', function() print('Plugin loaded with config:', vim.inspect(M.config)) end, {})
|
||||
function M.run()
|
||||
local root = get_root()
|
||||
if root then
|
||||
vim.cmd('lcd ' .. root)
|
||||
log('Changed working directory to: ' .. root, log_level)
|
||||
else
|
||||
log('No project root found', log_level)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
3
lua/plugins/local/rooter/plugin/rooter.lua
Normal file
3
lua/plugins/local/rooter/plugin/rooter.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
vim.api.nvim_create_user_command('Rooter', function() require('rooter').run() end, {
|
||||
desc = 'Change working directory to the project root',
|
||||
})
|
||||
Reference in New Issue
Block a user