Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #243363

Re: tmux and nano in console

From "Alexander V. Makartsev" <avbetev@gmail.com>
Newsgroups linux.debian.user
Subject Re: tmux and nano in console
Date 2021-12-22 19:10 +0100
Message-ID <DxedP-8br-5@gated-at.bofh.it> (permalink)
References <Dxatz-5YL-3@gated-at.bofh.it> <Dxatz-5YL-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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
⠈⠳⣄⠀⠀⠀⠀

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

tmux and nano in console mick crane <mick.crane@gmail.com> - 2021-12-22 15:10 +0100
  Re: tmux and nano in console Markus Schönhaber <debian-user@list-post.mks-mail.de> - 2021-12-22 16:40 +0100
  Re: tmux and nano in console "Alexander V. Makartsev" <avbetev@gmail.com> - 2021-12-22 19:10 +0100
    Re: tmux and nano in console mick crane <mick.crane@gmail.com> - 2021-12-22 21:20 +0100

csiph-web