Ana içeriğe atla

Getting back into tmux

I've been using an i3 + Alacritty + Vim setup for a while, and recently spent some time getting my tmux workflow organized again.

My setup is fairly simple:

i3
 └── Alacritty
      └── tmux
           ├── Vim
           ├── shell
           ├── SSH
           └── other terminal work

tmux fits nicely into this setup because i3 handles the graphical windows while tmux handles the terminal environment.

tmux windows

I mostly use the standard tmux prefix:

Ctrl-b

followed by a command.

Some of the shortcuts I use regularly are:

Ctrl-b n    next window
Ctrl-b p    previous window
Ctrl-b l    last window
Ctrl-b c    create a window
Ctrl-b z    zoom the current pane
Ctrl-b d    detach

One small detail worth remembering is that these are two-key sequences, not simultaneous combinations.

For example:

Ctrl-b
release
z

zooms the current pane.

tmux sessions

The session functionality is particularly useful when working with several terminal environments.

Running:

tmux ls

shows the sessions currently running:

0: 5 windows
1: 1 windows
2: 1 windows

My regular environment is in session 0.

When already inside tmux, I can switch directly to it with:

tmux switch-client -t 0

rather than trying to attach another tmux client from inside the existing one.

Sessions can also be given meaningful names, which makes larger setups easier to manage.

Copying text

Another part of the setup is clipboard handling.

Locally, Vim has clipboard support, so I can use:

"+y

For remote Vim sessions over SSH, I use vim-oscyank and OSC 52 instead.

My remote Vim configuration uses Space as the leader:

let mapleader = " "

so copying with the OSC 52 mapping is:

Space + y

The text then travels through the terminal connection to the local clipboard.

The overall path looks like:

Remote Vim
    ↓
vim-oscyank
    ↓
OSC 52
    ↓
SSH
    ↓
local tmux
    ↓
Alacritty
    ↓
X11 clipboard

This means I can copy text from Vim on a remote machine and paste it directly into a local application without needing the remote machine to have access to my local X11 clipboard.

tmux copy mode

For text that is already displayed in the terminal, tmux's copy mode is useful.

That gives me two different clipboard workflows:

Text inside Vim
    → vim-oscyank → OSC 52 → local clipboard

Text in terminal output
    → tmux copy mode → local clipboard

This is particularly convenient for copying logs, command output, error messages, or text from an SSH session.

Keeping the setup simple

One thing I like about this setup is that each component has a fairly clear role:

  • i3 manages graphical windows.

  • Alacritty provides the terminal.

  • tmux manages terminal sessions, windows, and panes.

  • Vim handles editing.

  • SSH provides remote access.

  • vim-oscyank + OSC 52 handles clipboard forwarding from remote Vim.

There isn't much overlap between the tools, and tmux provides persistence without requiring me to keep multiple terminal windows open.

For a terminal-heavy workflow, this remains a useful combination, especially when working across local and remote machines.

Yorumlar

Bu blogdaki popüler yayınlar

An Awk feature

I was trying to use sub (or gsub) function in awk to delete an \r from the end of line. For that purpose I used dum=sub(/\r/,"",$0) and thought that the variable "dum" will be filled with the changed value of $0. But I realised that sub function only make the change and returns 0,1 accordingly. So I wrote like this sub(/r/,"") ; x=$0;

Centos 6 Postgresql 9.1 Install

Today I have changed my mind and decided to begin learning and using Postgresql. On a Centos 6 host there are some ways of installing Postgresql. I have chosen the easy one: use repos. Here http://yum.pgrpms.org/repopackages.php is the official Postgresql repos for Red Hat related distros. I have chosen the x86_64 rpm for Centos 6 and installed it. Later using yum install postgresql91-server I have installed three packages postgresql91,postgresql91-server and postgresql91-libs which is enough for now to start Postgresql 9.1. Using the instructions at /usr/share/doc/postgresql91-9.1.1/README.rpm-dist , I first did service postgresql-9.1 initdb and then service postgresql-9.1 start.Voila! Now let the journey begin! Edit:  Here is another place to look instructions http://www.postgresonline.com/journal/archives/203-postgresql90-yum.html

OpenBSD Nfsen install

I was  trying to find a solution for network monitoring as a friend's request. OpenBSD is the firewall. I saw the Nfsen packages and installed to a 5.2 server. After some effort trying to understand what is going on behind, I realised that Netflow is a protocol by Cisco designed to export router traffic to outside. And OpenBSD has a support of it with pflow interface. First I made a new pflow0 interface like ifconfig pflow0 flowdst 127.0.0.1:9998 flowsrc 127.0.0.1 up Then made some configuration changesto /etc/nfsen.conf and /var/www/htdocs/nfsen/conf.php. Because Apache in OpenBSD runs in chrooted by default, if you dont make the necessary changes in these pages you got an error stating  ERROR: nfsend connect() error: Permission denied!  ERROR: nfsend - connection failed!!  ERROR: Can not initialize globals! which is because apache cant reach the communication socket which is initially  located at $PIDDIR/nfsen.comm namely /var/db/nfsen/run direc...