[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: tmux and nano in console



On 22.12.2021 18:59, mick crane wrote:
I'm trying to use the console to see if my editing problems go away.
Want to copy lines from one file into another.
Splitting the screen with tmux with the 2 files opened in nano the nano buffer is not shared.
Seems can have more than one buffer in nano but the things I want are not in the same file.
If use the mouse to select text in one file in one tmux window the selection goes across both windows/files.
Is there a way in console to achieve copying lines from one file to another ?

mick
'tmux' was made to let people work in console without using a mouse. Ideally, to do everything without even touching a mouse at all and always keep their fingers on 'A' 'S' 'D' 'F' and 'J' 'K' 'L' ';' keys.
Like when you use 'vim' (or 'nano' in your case), you just type and use memorized key combinations to perform actions on text, buffers, etc, and in case of 'tmux' , on text inside multiple panes.
Personally, I've failed to memorize all the commands of 'tmux' and 'vim' and "be efficient and fast without a mouse", as it says on a tin.
But I've managed to remember a few major ones and still enjoy working inside several consoles on a single screen and do that quite frequently.

AFAICR I had to personalize configurations for both 'tmux' and 'vim' , so they would use clipboard of X server instead of their own buffers.
I can use mouse to select and copy lines of text in linear or in rectangular fashion:
Rectangular fashion:
    Hold Shift + Hold Ctrl + Press and hold LMB at the beginning of the text you want to copy;
    Move mouse to select wanted text lines and release LMB;
    Click LMB on the selected text and then release Shift and Ctrl keys.

Linear fashion:
    Hold Shift + Press and hold LMB at the beginning of the text you want to copy;
    Move mouse to select wanted text lines and release LMB;
    Click LMB on the selected text and then release Shift key.

Linear fashion for a single 'tmux' pane:
    Press and hold LMB at the beginning of the text you want to copy;
    Move mouse to select wanted text lines and press 'y' key;
    Then release LMB.

To paste copied text press "Ctrl + v" or "Shift + Ctrl + v" or "Shift + Insert" or "Shift" + "p" (if you would use 'vim').
If my directions work differently for you, here I've tried to gather, hopefully, relevant config lines from my "~/.tmux.conf":

========8<============8<============8<============8<====
## Mouse mode enabled by default
set -g mouse on
## Use vi control scheme by default
set-window-option -g mode-keys vi
## Use system buffer for copy paste operations in tmux
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind -T copy-mode-vi y send-keys -X copy-pipe "xclip -sel clip -i"
bind P paste-buffer
bind-key -T prefix PageUp copy-mode -eu
bind-key -T prefix PageDown copy-mode
========8<============8<============8<============8<====

Btw, keys 'v' (visual mode select) 'y' (copy text) and 'P' (paste text) are for the same actions in 'vim' , so they are easier to remember.
Also, I use Xfce and "xfce4-terminal" so my instructions may not work if your DE is different.


-- 
With kindest regards, Alexander.

⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀⠀⠀⠀ 

Reply to: