brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: set -g word-separators controls where w and b stop in tmux copy mode

Tmux
~/tips/tip-tmux-word-separators

set -g word-separators ' '

Sets which characters tmux treats as word boundaries when you move by word in copy mode.

In copy mode, moving word by word stops at every slash and dash in a path. For a long path or URL I want one jump per token, and tmux lets me decide what counts as a word.

In vi copy mode, w moves to the next word, b to the previous word and e to the end of the next word. Which characters separate words comes from the session option word-separators.

set -g word-separators ' '

With only a space in the list, a path such as /mnt/user/appdata/<app>/config.json counts as one word. The manual says an empty string makes next and previous word behave like next and previous space:

set -g word-separators ''

If you only need that now and then, you do not have to touch the option. The copy mode commands next-space, previous-space and next-space-end use a space alone as the separator, and in vi mode they sit on W, B and E.

Look at the current value first, so you can put it back:

tmux show -gv word-separators

It is a session option. A set without -g changes only the session you are in, and the show -g above reads the global value.

Further reading: tmux manual

Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link