fterm now looks at the current work directory
When I open fterm, it nows checks for the current WD for the file I am working in.
This commit is contained in:
parent
024a3df45f
commit
0a9220cdc2
|
@ -6,8 +6,22 @@ return {
|
||||||
height = 0.6,
|
height = 0.6,
|
||||||
width = 0.6,
|
width = 0.6,
|
||||||
},
|
},
|
||||||
|
-- Initial cmd setting is generic, will be dynamically updated later
|
||||||
cmd = 'Powershell.exe',
|
cmd = 'Powershell.exe',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Custom function to toggle FTerm with dynamic working directory
|
||||||
|
local function toggle_ft_with_cwd()
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
-- Update the cmd to change directory to cwd upon opening
|
||||||
|
require('FTerm'):setup {
|
||||||
|
cmd = 'Powershell.exe -NoLogo -NoExit -Command "cd \'' .. cwd .. '\'"',
|
||||||
|
}
|
||||||
|
-- Toggle FTerm after updating the command
|
||||||
|
require('FTerm').toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Keymap to use the custom toggle function
|
||||||
|
vim.keymap.set('n', '<leader>tt', toggle_ft_with_cwd, { noremap = true, silent = true, desc = '[T]oggle [T]erminal' })
|
||||||
end,
|
end,
|
||||||
vim.keymap.set('n', '<leader>tt', ':lua require("FTerm").toggle()<CR>', { noremap = true, silent = true, desc = '[T]oggle [T]erminal' }),
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue