Lokyr
Documentation

Mouse and selection

On this page

macOS · on by default · [clipboard] copy-on-select, [cursor] click-to-move, [window] smooth-scroll

Select text with the mouse as in any Mac app, by words, by lines or as a rectangle, and copy it. ⌘-click a link or a path to open it, click in the command line to move the cursor, scroll back through what programs printed, and drop files from the Finder to paste their paths.

Try it

Run this command:

ls -l /

Double-click the word usr in the listing, press ⌘C, then ⌘V: the word pastes at the prompt. Hold ⌥ and drag down across the first column: a rectangle of the permissions is selected.

What it gives you

Select text

Drag across the text to select the cells between where you press and where the pointer is.

Output that scrolls the text while you drag keeps the selection's start on its text. For a selection made with the keyboard, see copy mode.

Try it: run seq 1 100, then drag from 90 past the window's top: the view scrolls up while the selection grows.

Copy what you select

Press ⌘C to copy the selection, as in other Mac apps. With copy-on-select on, letting go of the button copies it, and a double click on a word copies the word.

[clipboard]
copy-on-select = true   # a selection by the mouse copies its text as it ends

The text that Lokyr copies joins the rows of a line that wrapped, drops the spaces at the end of each line, and keeps each row of a rectangle a line of its own.

Try it: select two lines of ls -l /, press ⌘C, then run pbpaste: the two lines print, without trailing spaces.

Hold ⌘ and move the pointer over a link, a URL or a path: Lokyr underlines it and shows the pointing hand. Click to open it: a URL in your browser, a file in its app, a folder in the Finder, and a path with a line, such as src/main.rs:42, at that line in your editor. Links tells what Lokyr finds and how to open it from the keyboard.

Try it: run echo https://lokyr.dev/docs/, then ⌘-click the address: it opens in your browser.

Click in the command line

Platforms: macOS · Since 1.3

With shell integration, a click in the command line moves the shell's cursor there, like in a text field. Select part of the command line and press Delete to remove it, or type to replace it. [cursor] click-to-move turns both off.

Try it: type echo hello world without pressing Return, click on the w, then type X: the line reads echo hello Xworld.

Use the context menu

A right click, or a ⌃-click, opens a menu at the pointer:

The menu also lists the bundled plugins' items, and dims an item that would do nothing: Pane, a submenu that splits the pane right, left, down or up, moves it to a tab or a window of its own, or closes it, and, while Blocks is on, Block, a submenu of the actions on the block under the pointer, which takes Copy Command Output and Select Command Output in. A click on a selection keeps it for the menu; a click elsewhere selects the word under the pointer.

Try it: run echo grep, right-click the word grep, and choose Open man Page for “grep”: a window of grep's manual opens.

Scroll

The wheel and the trackpad scroll through the scrollback, the rows that went up past the screen's top. In a program that takes the whole screen, such as less or man, they scroll the program's text instead, as its arrow keys do.

Try it: run seq 1 500 and scroll up with the trackpad: the earlier numbers come back. Then run man ls and scroll: the manual's page moves. Press q to quit it.

Scroll by pixels

Platforms: macOS · off by default · Since 1.4

With [window] smooth-scroll on, the text follows your fingers on a trackpad or a Magic Mouse pixel by pixel, rather than a row at a time, and keeps gliding when you lift them. A mouse wheel's step glides over its rows instead of jumping. A click, a selection and a ⌘-click take the text where you see it, even halfway through a row.

[window]
smooth-scroll = true   # the trackpad and the wheel scroll by pixels

Try it: turn smooth-scroll on, run seq 1 500, and scroll up slowly with two fingers: the numbers move by pixels. Flick and lift your fingers: the text glides to a stop.

Programs that take the mouse

A program can ask for the mouse, such as vim with set mouse=a, htop or tmux. It then gets your clicks, the right button's too, and the wheel, and the pointer becomes an arrow over its window. Hold ⇧ to select, open the menu or scroll the scrollback anyway.

Try it: run less --mouse /etc/services and drag across the text: nothing is selected, as less takes the mouse. Hold ⇧ and drag: the text is selected. Press q to quit.

Drop files and text

Drag files from the Finder onto a pane: their paths paste at the cursor, each quoted for the shell where it needs it, such as '/Users/me/My Notes.txt', and followed by a space. Dropped text pastes as a paste would, asking first as confirm-paste says.

Try it: type ls -l at the prompt, drag a file from the Finder onto the pane, and press Return: ls lists the file.

Settings

[clipboard]
copy-on-select = false       # true copies a selection as you let go of the button

[cursor]
click-to-move = true         # a click in the command line moves the shell's cursor

[plugins.splits]
focus-follows-mouse = false  # true gives the keyboard to the pane under the pointer

[window]
smooth-scroll = false        # true scrolls by pixels with the trackpad and the wheel

[clipboard], click-to-move, focus-follows-mouse and smooth-scroll tell more. [keys] can bind the wheel and ⌘-click to other commands too.

Limits

Troubleshooting

Dragging selects nothing

Why: the program in front takes the mouse, such as vim, htop or tmux.

Fix: hold ⇧ while you drag, or turn the program's mouse off, such as :set mouse= in vim.

Check: drag with ⇧ held: the text is selected.

⌘C copied nothing

Why: nothing was selected, or a program that takes the mouse got the drag.

Fix: select with ⇧ held, then press ⌘C.

Check: run pbpaste: it prints what you selected.

A click in the command line doesn't move the cursor

Platforms: macOS · Since 1.3

Why: the shell has no integration, the program in front isn't a shell, or click-to-move is off.

Fix: see Shell integration.

See also