OFFSET偏移
← All articlesOFFSET / FIELD NOTESNO. 049

Foot: the boundaries of search, selection, and configuration

Distinguish keyboard modes, primary selection, font size, and the configuration lifecycle, with a complete key-binding reference.

English translation · Code and commands follow the Chinese original.

IN THESE READING PATHSShells, terminals, and sessions ↗
About 5 min readStart reading

Foot is a lightweight, fast, Wayland-native terminal emulator whose shortcuts are configured in foot.ini. The bindings in this article were checked against the Foot 1.28 manual; custom configuration can override the defaults. Terminal shortcuts and shortcuts inside the shell belong to different layers.


General Shortcuts#

Shortcut Action
Ctrl+Shift+c Copy selected text to the clipboard
Ctrl+Shift+v Paste from the clipboard
Shift+Insert Paste from the primary selection (select text first, then use this binding to paste)
Ctrl+Shift+r Enter scrollback search mode
Ctrl+Shift+n Open a new terminal window
Ctrl+Shift+o URL mode: highlight all URLs and select one with a key
Ctrl+Shift+u Unicode input mode (enter a code point to insert a character)
Ctrl+Shift+z Jump to the previous shell prompt
Ctrl+Shift+x Jump to the next shell prompt
Ctrl+plus / Ctrl+= / Ctrl+KP_Add Increase font size
Ctrl+minus / Ctrl+KP_Subtract Decrease font size
Ctrl+0 / Ctrl+KP_0 Reset font size
Shift+Page_Up Scroll up one page
Shift+Page_Down Scroll down one page

Prompt jumping with Ctrl+Shift+z/x requires shell support. The shell must send the correct OSC 133 prompt markers. Using Fish alone does not guarantee that every prompt function provides the same markers.


Scrollback Search Mode#

Press Ctrl+Shift+r to enter this mode; the search box appears at the top of the screen.

Navigation and Editing

Shortcut Action
Left / Ctrl+b Move the cursor left
Right / Ctrl+f Move the cursor right
Ctrl+Left / Alt+b Move the cursor left one word
Ctrl+Right / Alt+f Move the cursor right one word
Home / Ctrl+a Move the cursor to the start of the search box
End / Ctrl+e Move the cursor to the end of the search box
BackSpace Delete the previous character
Alt+BackSpace / Ctrl+BackSpace Delete the previous word
Delete Delete the next character
Alt+d / Ctrl+Delete Delete the next word
Ctrl+u Delete from the cursor to the beginning
Ctrl+k Delete from the cursor to the end

Searching and Selection

Shortcut Action
Ctrl+r Find the previous match
Ctrl+s Find the next match
Ctrl+w / Ctrl+Shift+Right Select to the end of the word (delimited by non-alphanumeric characters)
Ctrl+Shift+w Select to the next whitespace (delimited by whitespace characters)
Shift+Left Extend the selection left by one character
Shift+Right Extend the selection right by one character
Ctrl+Shift+Left Extend the selection left to the start of the word
Shift+Up Extend the selection up by one line
Shift+Down Extend the selection down by one line

Pasting and Exiting

Shortcut Action
Ctrl+v / Ctrl+y / Ctrl+Shift+v Paste into the search box
Shift+Insert Paste from the primary selection
Return Exit search and copy the current selection to the primary selection
Escape / Ctrl+g / Ctrl+c Cancel the search

Browsing Context While Searching

You can still scroll the terminal contents while the search box has focus:

Shortcut Action
Shift+Page_Up Page up
Shift+Page_Down Page down

URL Mode#

Press Ctrl+Shift+o to enter this mode. All detected URLs are highlighted, and each receives a jump label.

Shortcut Action
t Toggle URL visibility (flashing/steady)
Escape / Ctrl+g / Ctrl+c / Ctrl+d Exit URL mode

Default label keys: s a d f j k l e w c m p g h

Press the corresponding key to open that URL in your browser.


Unicode Input Mode#

Press Ctrl+Shift+u to enter this mode, then type a Unicode code point in hexadecimal to insert the corresponding character. For example, entering 00e9 produces é.


Mouse Controls#

Mouse operation Action
Left-button drag Select text by character (copied to the primary selection)
Left-button double-click Select a whole word
Left-button triple-click Select a quoted string (the contents enclosed in quotation marks)
Left-button quadruple-click Select the entire line
Ctrl + left-button drag Block selection (rectangular area)
Right-click Extend the current selection
Ctrl + right-click Extend by character rather than by word
Middle-click Paste the primary selection
Ctrl + scroll wheel up Increase font size
Ctrl + scroll wheel down Decrease font size
Scroll wheel up/down Scroll through the history buffer

Hold Shift to override mouse control by an application inside the terminal, such as vim's mouse mode.


Mouse Selection Comparison#

Operation Selection range Example (cursor over hello_world)
Double-click (BTN_LEFT-2) Whole word (letters, numbers, and underscores) hello_world
Ctrl + double-click Whitespace-delimited word hello_world (an underscore is not whitespace; use an example containing punctuation to see how this differs from ordinary word selection)
Triple-click (BTN_LEFT-3) Contents enclosed in quotation marks "hello world"
Quadruple-click (BTN_LEFT-4) Entire line All contents of the current line

Customizable Actions with No Default Binding#

The following actions can be assigned custom bindings in foot.ini under [key-bindings], but have no default shortcuts:

Action Description
scrollback-up-half-page Scroll up half a page
scrollback-up-line Scroll up one line
scrollback-down-half-page Scroll down half a page
scrollback-down-line Scroll down one line
scrollback-home Jump to the start of the buffer
scrollback-end Jump to the end of the buffer (latest output)
minimize Minimize the window
maximize Maximize the window
fullscreen Full screen
pipe-visible Pipe the visible contents
pipe-scrollback Pipe the entire buffer
pipe-selected Pipe the selected contents
pipe-command-output Pipe command output to an external command
show-urls-copy URL mode: copy instead of opening
show-urls-persistent URL mode: persistent mode
regex-launch Match with a regular expression and open
regex-copy Match with a regular expression and copy
color-theme-switch-dark/light Switch color schemes
color-theme-toggle Toggle between two color schemes
quit Exit the terminal
noop No operation (override an unwanted default binding)

Configuration File Location and Reloading#

# 主配置文件
~/.config/foot/foot.ini

# 验证配置
foot --check-config

# 指定配置启动一个新实例
foot --config ~/.config/foot/foot.ini

General configuration changes should be read by a new instance; server mode also involves the server's configuration lifecycle. In Foot 1.28, SIGUSR1 / SIGUSR2 switch between dark and light color schemes. They are not general configuration-reload signals. Do not send signals to every Foot process in an attempt to “refresh” it.

Management with NixOS / Home Manager

# Home Manager
programs.foot = {
  enable = true;
  settings = {
    main = {
      font = "Iosevka:size=11";
      shell = "fish";
    };
    key-bindings = {
      scrollback-up-line = "Control+Shift+Up";
      scrollback-down-line = "Control+Shift+Down";
    };
  };
};

Tips#

Custom single-line scrolling (the defaults only scroll by page):

[key-bindings]
scrollback-up-line=Control+Shift+Up
scrollback-down-line=Control+Shift+Down

Use Alt as Meta (the default behavior, sending an ESC prefix):

[key-bindings]
# Alt+h → 发送 ESC+h 序列(vim/nvim 中即识别为 Meta+h)
# 这是默认行为,无需配置

Toggle full screen:

[key-bindings]
fullscreen=F11

References & further reading

  1. Foot upstream repository and manual ↗
  2. Foot 1.28 configuration manual ↗

Adapted from technical notes. Examples use generic names.

Continue along a reading path

Shells, terminals, and sessions

  1. 01Fish: from key bindings to an editable command line
  2. 02Foot: the boundaries of search, selection, and configuration
  3. 03Zellij: does the session survive when the window closes?
CONTINUE READING / NEXT ARTICLEZellij: does the session survive when the window closes?

Move from panes and tabs to sessions, distinguishing reconnection, layout restoration, and process state.