-
Notifications
You must be signed in to change notification settings - Fork 39
TerminalHere
mitchell edited this page Dec 12, 2020
·
2 revisions
This function will open a terminal window with the working directory set to the location of the file being edited.
- Be sure to replace "Terminal" with "gnome-terminal", "konsole", or "xterm" if you don't use XFCE's Terminal program.
- Also check that "--working-directory" is the correct option for setting the working directory of your terminal program.
Code:
function openTerminalHere()
terminalString = "Terminal"
pathString = "~"
if buffer.filename then
pathString = buffer.filename:match(".+/")
end
io.popen(terminalString.." --working-directory="..pathString.." &")
end
Assign a key binding to trigger the function. Example:
keys['ctrl+T'] = openTerminalHere