Add working directory persistence, command aliases, and keyboard shortcuts reference
1. Working Directory Persistence: Tracks and restores last directory per tab 2. Command Aliases: Create shortcuts for long commands (e.g., gs=git status) - Manage aliases in Settings - Type 'aliases' to see all defined aliases 3. Keyboard Shortcuts Reference: Cmd+? to view all shortcuts All features tested and working
This commit is contained in:
@@ -52,7 +52,20 @@ class MainWindowController: NSWindowController {
|
||||
let session = tabManager.addTab(title: sessionData.title)
|
||||
session.title = sessionData.title // Override the auto-generated title
|
||||
session.setupTextView(frame: contentView.bounds)
|
||||
|
||||
// Restore working directory if available
|
||||
if let workingDir = sessionData.workingDirectory {
|
||||
session.currentWorkingDirectory = workingDir
|
||||
}
|
||||
|
||||
session.startShell()
|
||||
|
||||
// Change to saved directory
|
||||
if let workingDir = sessionData.workingDirectory, workingDir != "~" {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
session.executeCommand("cd \(workingDir)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Restore current tab index
|
||||
@@ -181,6 +194,8 @@ class MainWindowController: NSWindowController {
|
||||
toolsMenu.addItem(NSMenuItem(title: "AI Command Generator", action: #selector(showAIGenerator), keyEquivalent: "k"))
|
||||
toolsMenu.addItem(NSMenuItem(title: "Command Snippets", action: #selector(showSnippets), keyEquivalent: "p"))
|
||||
toolsMenu.addItem(NSMenuItem.separator())
|
||||
toolsMenu.addItem(NSMenuItem(title: "Keyboard Shortcuts", action: #selector(showShortcuts), keyEquivalent: "?"))
|
||||
toolsMenu.addItem(NSMenuItem.separator())
|
||||
toolsMenu.addItem(NSMenuItem(title: "Clear History", action: #selector(clearHistory), keyEquivalent: ""))
|
||||
|
||||
// Window menu
|
||||
@@ -478,6 +493,44 @@ class MainWindowController: NSWindowController {
|
||||
}
|
||||
}
|
||||
|
||||
@objc func showShortcuts() {
|
||||
let alert = NSAlert()
|
||||
alert.messageText = "Keyboard Shortcuts"
|
||||
alert.informativeText = """
|
||||
File:
|
||||
Cmd+T - New Tab
|
||||
Cmd+W - Close Tab
|
||||
Cmd+K - Clear Screen
|
||||
Cmd+Shift+K - Clear Scrollback
|
||||
|
||||
Edit:
|
||||
Cmd+C - Copy
|
||||
Cmd+V - Paste
|
||||
Cmd+A - Select All
|
||||
Cmd+F - Find in Terminal
|
||||
Cmd+R - Search History
|
||||
|
||||
Tools:
|
||||
Cmd+K - AI Command Generator
|
||||
Cmd+P - Command Snippets
|
||||
Cmd+, - Settings
|
||||
Cmd+? - This Help
|
||||
|
||||
View:
|
||||
Cmd+Plus - Increase Font
|
||||
Cmd+Minus - Decrease Font
|
||||
Cmd+0 - Reset Font
|
||||
Cmd+F - Toggle Fullscreen
|
||||
|
||||
Terminal:
|
||||
Tab - Accept Auto-suggestion
|
||||
Double-click Tab - Rename Tab
|
||||
"""
|
||||
alert.alertStyle = .informational
|
||||
alert.addButton(withTitle: "OK")
|
||||
alert.runModal()
|
||||
}
|
||||
|
||||
@objc func clearHistory() {
|
||||
let alert = NSAlert()
|
||||
alert.messageText = "Clear Command History?"
|
||||
|
||||
Reference in New Issue
Block a user