Keyboard shortcuts

Use keyboard shortcuts to streamline your workflow and reduce dependence on mouse interactions.

Available keyboard commands

Bob offers keyboard commands to enhance your workflow. This page focuses on the Bob.acceptInput command, but here is a quick reference to key keyboard commands:

CommandDescriptionDefault Shortcut
Bob.acceptInputSubmit text or accept the primary suggestionNone (configurable)
Bob.focusFocus the Bob input boxNone (configurable)
Inline editEdit code directly in the editorCmd + K (Mac) / Ctrl + K (Windows/Linux)
Move to chatSend selected code to the chat interfaceCmd + L (Mac) / Ctrl + L (Windows/Linux)
Literate coding modeToggle literate coding modeCmd + I (Mac) / Ctrl + I (Windows/Linux)

For a complete list of all available keyboard shortcuts and to configure custom bindings, open Bob Settings, under General settings and navigate to the Keyboard shortcuts option where you can view and modify all shortcuts.

Key benefits of keyboard commands

  • Keyboard-driven interface: Submit text or select the primary suggestion button without mouse interaction
  • Improved accessibility: Essential for users with mobility limitations or those who experience discomfort with mouse usage
  • Vim/Neovim compatibility: Supports seamless transitions for developers coming from keyboard-centric environments
  • Workflow efficiency: Reduces context switching between keyboard and mouse during development tasks

Bob.acceptInput command

The Bob.acceptInput command lets you submit text or accept suggestions with keyboard shortcuts instead of clicking buttons or pressing Enter in the input area.

How the command works

The Bob.acceptInput command is a general-purpose input submission command. When triggered, it:

  • Submits your current text or image input when in the text input area (equivalent to pressing Enter)
  • Clicks the primary (first) button when action buttons are visible (such as confirm/cancel buttons or any other action buttons)

Detailed setup guide

Method 1: Using the UI

  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac)
  2. Type "Preferences: Open Keyboard Shortcuts"
  3. In the search box, type "Bob.acceptInput"
  4. Locate "Bob: Accept Input/Suggestion" in the results
  5. Click the + icon to the left of the command
  6. Press your desired key combination (e.g., Ctrl+Enter or Alt+Enter)
  7. Press Enter to confirm

Method 2: Editing keybindings.json directly

  1. Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac)
  2. Type "Preferences: Open Keyboard Shortcuts (JSON)"
  3. Add the following entry to the JSON array:
{
  "key": "ctrl+enter",  // or your preferred key combination
  "command": "Bob.acceptInput",
  "when": "BobViewFocused"  // This is a context condition that ensures the command only works when Bob is focused
}

You can also use a more specific condition:

{
  "key": "ctrl+enter",
  "command": "Bob.acceptInput",
  "when": "webviewViewFocus && webviewViewId == 'Bob-cline.SidebarProvider'"
}

Choose a key combination that does not conflict with existing IBM Bob shortcuts:

  • Alt+Enter - Easy to press while typing
  • Ctrl+Space - Familiar for those who use autocomplete
  • Ctrl+Enter - Intuitive for running commands
  • Alt+A - Mnemonic for "Accept"

Practical use cases

Quick development workflows

  • Text submission: Send messages to Bob without moving your hands from the keyboard
  • Action confirmations: Accept operations like saving files, running commands, or applying diffs
  • Multi-step processes: Move quickly through steps that require confirmation or input
  • Consecutive tasks: Chain multiple tasks together with minimal interruption

Keyboard-centric development

  • Vim/Neovim workflows: If you are coming from a Vim/Neovim background, maintain your keyboard-focused workflow
  • IDE integration: Use alongside other IBM Bob keyboard shortcuts for a seamless experience
  • Code reviews: Quickly accept suggestions when reviewing code with Bob
  • Documentation writing: Submit text and accept formatting suggestions when generating documentation

Accessibility use cases

  • Hand mobility limitations: Essential for users who have difficulty using a mouse
  • Repetitive strain prevention: Reduce mouse usage to prevent or manage repetitive strain injuries
  • Screen reader integration: Works well with screen readers for visually impaired users
  • Voice control compatibility: Can be triggered via voice commands when using voice control software

Accessibility benefits

The Bob.acceptInput command was designed with accessibility in mind:

  • Reduced mouse dependence: Complete entire workflows without reaching for the mouse
  • Reduced physical strain: Helps users who experience discomfort or pain from mouse usage
  • Alternative input method: Supports users with mobility impairments who rely on keyboard navigation
  • Workflow optimization: Particularly valuable for users coming from keyboard-centric environments like Vim/Neovim

Keyboard-centric workflows

Here are some complete workflow examples showing how to effectively use keyboard shortcuts with Bob:

Development workflow example

  1. Open IBM Bob and navigate to your project
  2. Open Bob via the sidebar
  3. Type your request: "Create a REST API endpoint for user registration"
  4. When Bob asks for framework preferences, use your Bob.acceptInput shortcut to select the first suggestion
  5. Continue using the shortcut to accept code generation suggestions
  6. When Bob offers to save the file, use the shortcut again to confirm
  7. Use IBM Bob's built-in shortcuts to navigate through the created files

Code review workflow

  1. Select code you want to review and use IBM Bob's "Copy" command
  2. Ask Bob to review it: "Review this code for security issues"
  3. As Bob asks clarifying questions about the code context, use your shortcut to accept suggestions
  4. When Bob provides improvement recommendations, use the shortcut again to accept implementation suggestions

Troubleshooting

IssueSolution
Shortcut does not workEnsure Bob is focused (click in the Bob panel first)
Wrong suggestion selectedThe command always selects the first (primary) button; use mouse if you need a different option
Conflicts with existing shortcutsTry a different key combination in IBM Bob keyboard settings
No visual feedback when usedThis is normal - the command silently activates the function without visual confirmation
Shortcut works inconsistentlyMake sure the when clause is properly configured in your keybindings.json (either BobViewFocused or the webview-specific condition)

Technical implementation

The Bob.acceptInput command is implemented as follows:

  • Command registered as Bob.acceptInput with display title "Bob: Accept Input/Suggestion" in the command palette
  • When triggered, it sends an "acceptInput" message to the active Bob webview
  • The webview determines the appropriate action based on the current UI state:
    • Clicks the primary action button if action buttons are visible and enabled
    • Sends the message if the text area is enabled and contains text/images
  • No default key binding - users assign their preferred shortcut

Limitations

  • Works only when the Bob interface is active
  • Has no effect if no inputs or suggestions are currently available
  • Prioritizes the primary (first) button when multiple options are shown
How is this topic?