Posts tagged: linux

All posts with the tag "linux"

tmux new-window

https://youtu.be/YRPZBv-iYyE

New window as it sounds makes new windows in tmux. Windows are kind of like tabs. They are another screen within your sessions that you can name and make new panes in.

Default key bindings for creating and navigating windows in tmux.

...

tmux slect-pane

https://youtu.be/CPZJZjN9YTY

These are my MOST often used keybindings that I use in tmux. They allow me to jump between splits with ease with a vim style layout. I can hold mod and jump between panes with a familiar arrow key.

bind -n M-h select-pane -L bind -n M-l select-pane -R bind -n M-k select-pane -U bind -n M-j select-pane -D

How I navigate tmux in 2021

...

tmux select-layout

https://youtu.be/F0mHnwTrNNc

When you get many splits going in tmux sometimes its time for a new layout. There are four layout strategies that I use, main-vertical, main-horizontal, even-vertical, even-horizontal. Almost always I am useing the main ones with mod plus a or mod plus shift a keybindings.

# Select Layouts #――――――――――――――――― bind -n M-a select-layout main-vertical bind -n M-A select-layout main-horizontal bind -n M-E select-layout even-vertical bind -n M-V select-layout even-horizontal

How I navigate tmux in 2021

...

tmux resize-panes

https://youtu.be/hpFYE2LU7xc

Resizing panes in tmux can be quite difficult in default tmux, I use a set of keybingings to help resize panes in the rare occasions that I do need just a bit more space. I set the keybinding to the same as my split navigation bindings but shifted. They are very vim like (h,j,k,l).

# resize panes #――――――――――――――――――――――――――――― bind -n M-H resize-pane -L 2 bind -n M-L resize-pane -R 2 bind -n M-K resize-pane -U 2 bind -n M-J resize-pane -D 2

Most often when I need to resize panes I just grab the edge of the pane with my mouse. Yes the mouse, its not that often that I actually need to change the size of a pane.

...

tmux choose-tree

https://youtu.be/79Y-kqAiMpw

Choose tree is a powerful tmux utility that provides a graphical interface to preview all sessions, windows, and panes, move between them kill them, move them and much more.

The default keybinding

...

tmux prefix

https://youtu.be/BMkpbfhbkKM

The prefix key is an essential part of tmux, by default all of tmux’s key-bindings sit behind a prefix. This prefix is very similar to vim’s leader key. It is common for folks to change the default C-b (control b) to C-a or if they are a vim user something to match their vim leader key.

set -g prefix C-Space bind Space send-prefix

A few of the essential default key-bindings.

...

tmux splitting panes

https://youtu.be/kzgyiHap1nQ

splitting panes is a core feature of tmux. It allows us to split the terminal vertically or horizontally into new panes.

bind -n M-s split-window -c '#{pane_current_path}' bind -n M-v split-window -h -c '#{pane_current_path}' bind -n M-X kill-pane

🗒️ note that ‘#{pane_current_path}‘will keep the split in the same directory as it’s parent, without this it will default to your home directory.

...

tmux last session

https://youtu.be/RB87EEnnMnU

An ultimate productivity key-binding in tmux is one to switch to the last session. I use this to quickly get between sessions really quick. Often I am working and need to lookup a quick note, or copy something into my notes, then get back to where I was quickly.

bind -n M-b switch-client -l

I think of this hub and spoke model, and use last-session to quickly drive it.

...

tmux floating popups

https://youtu.be/2ZqFDsJywt8

Tmux popups are actually floating windows that you can drag around the screen. They always open in the middle (by default) when you open them, no matter where you leave them.

Here are a couple of keybindings I use to open up popup windows.

...

Copy and Paste on Linux

These are the notes that I used as I set up my first ever ubuntu desktop.

sudo apt install gnome-tweaks

nordix gtk theme #

I ran this, but have no idea if it had any effect as the theme did not show up until I relogged.

gsettings set org.gnome.desktop.wm.preferences theme Nordic

What I think actuagnome terminal showing scrollbar in tmuxlly worked was

...

How I configure git

Git can be a bit tricky to get configured correctly. I often stumble into config issues weeks after setting up a new machine that I did not even notice. These are my notes to remind me how I configure git.

How I navigate tmux in 2021

In 2021 I changed the way I navigate between tmux sessions big time. Now I can create, kill, switch with ease, and generally keep work separated into logical groups.

Since making this post, I have made ~20 other posts in short form that all have a YouTube video to go along with them you can find them all on my tmux-playlist.

I took Chris’s tmux course in December 2020 and it was fantastic. Even as a seasoned tmux user, I learned quite a bit. Before the course, I was proficient in navigating within each of my tmux sessions but rarely started more than one session. A few months later, I have adopted a lot of what I learned from Chris and made it my own.

...

Trim unused git branches

Trim branches no longer on origin ¶ # git remote prune origin --dry-run git remote prune origin Find branches already merged ¶ # git checkout main # list remote branches that have already been merged into main git branch -r --merged # list local branches that have already been merged into main git branch --merged

Create a Virtual File Gallery with Symlinks

Creating a directory that is a union of several directories can be achieved with a few symlinks at the command line.

Here is how I am creating a virtual directory of all my projects that is a combination of both work and not-work projects. I am creating symlinks for every directory under ~/work and ~/git.

rm -rf ~/projects mkdir ~/projects ln -sf ~/work/* ~/projects ln -sf ~/git/* ~/projects

⚠ Notice that first I am recreating the directory each time. This will ensure that any project that is deleted from their actual directory is removed from the virtual gallery.

...

Live Substitution In Neovim

Replacing text in vim can be quite frustrating especially since it doesn’t have live feedback to what is changing. Today I was watching Josh Branchaud’s Vim-Unalphabet series on Youtuve and realized that his vim was doing this and I had to have it.

https://twitter.com/_WaylonWalker/status/1346081617199198210

I had to do a bit of searching and found a great post from vimcasts that shows exactly how to get the live search and replace highlighting using inccomand

...