Implement working dir integration with neovim terminal bash cd command
This commit is contained in:
parent
294d39665f
commit
7b2adb5411
8
init.lua
8
init.lua
|
|
@ -359,12 +359,14 @@ require("which-key").add ({
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
-- See :help terminal-events, we can use this to implement cd commands etc changing the working directory of the nvim host and other terminal app to nvim host ipc.
|
||||
-- sleep 5 && printf "\033]7;file://${PWD}/foo/bar\033\\"
|
||||
vim.api.nvim_create_autocmd({ 'TermRequest' }, {
|
||||
desc = 'Handles OSC 7 dir change requests',
|
||||
callback = function(ev)
|
||||
local dir = string.gsub(vim.v.termrequest, '\x1b]7;file://[^/]*', '')
|
||||
print(dir)
|
||||
if string.sub(vim.v.termrequest, 1, 4) == '\x1b]7;' then
|
||||
local dir = string.gsub(vim.v.termrequest, '\x1b]7;file://[^/.]*', '')
|
||||
vim.cmd("cd " .. dir)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue