WezTerm: quickly select a command and open it in a new pane
2023-08-04
In my previous post, jump to build errors with WezTerm, I demostrated how to navigate to build error using hyperlinks. One limitation of that approach is that it requires a mouse click.
In this post, I explore how to achieve the same functionality using a shortcut key in WezTerm, thanks to QuickSelectArgs feature.
WezTerm’s QuickSelectArgs
allows us to bind a shortcut key to select specific patterns and perform actions on the selected text.
Let’s say we have the following warning:
Open same file in already running instance of Helix
2023-08-02
Recently, I came across this issue:
I find that I have occasionally (frequently!) made the mistake of two instances of helix in different terminals editing the same file. This causes me a problem, because I will then have changes in one of the instances overwrite changes that are made in another. The worst case is when I accidentally switch back to an instance that has an older version of the file open.
File tree workaround for Helix
2023-08-02
Many people have expressed that the absence of a file tree is what prevents them from using Helix.
If, for some reasons, you cannot use the PR #5768, here’s a workaround to create a file tree using WezTerm and nnn
The idea here is to implement a custom opener in nnn.
When navigating to a file, it will be opened using hx
in the right pane.
When opening another file, it checks if there is a running instance of hx
in the right pane and sends the :open $1\r
command to that pane.
How to disable ligatures in WezTerm?
2023-08-01
As you may know, I switched to WezTerm and Helix a few months ago.
What surprised me is when I type !=
in Helix, it is rendered as ≠
.
This behaviour also occurs with other character combinations, for example:
<=
becomes rendered as≤
->
becomes rendered as→
===
becomes rendered as≡
My first guess was that Helix had something to do with the font rendering but I encountered the same issue when typing directly into terminal.
How to create snippets in Helix?
2023-07-31
Helix currently does not support snippets.
However, there is a workaround to insert snippets using :insert-output
to run a shell command.
Still, this might not feel like the most natural way to work with snippets.
For instance, in GoLand, a similar feature called live templates
allows you to type err
and expand it into the following:
1if err != nil { 2 3}
I wonder if I can archieve the same functionality in Helix by creating a simple language server
Reload Helix automatically after switching from lazygit
2023-07-25
This is a continuation of the Helix series. In the previous posts, I shared methods to:
I also have a script to call lazygit from within Helix:
1#!/bin/sh 2 3source wezterm-split-pane.sh 4 5program=$(wezterm cli list | awk -v pane_id="$pane_id" '$3==pane_id { print $6 }') 6if [ "$program" = "lazygit" ]; then 7 wezterm cli activate-pane-direction down 8else 9 echo "lazygit" | wezterm cli send-text --pane-id $pane_id --no-paste 10fi
Helix: How to jump to the build error from the terminal output?
2023-07-21
In my previous post, I shared how I run code in Helix, and today I’ve taken things a step further by integrating WezTerm into Helix. Now, after running the code, if I encountered errors or warnings, I can simply click on the corresponding file to open it in Helix at the specific line and column number.
Previously, I had to either look at the line number and navigate to that specific line or manually copy the file path and open it in Helix, which was somewhat cumbersome.
How I run code in Helix editor?
2023-07-14
In my previous post, I mentioned that I’ve made the switch to WezTerm and Helix, and today I want to share how I run my code in this setup.
Previously, I would split Wezterm into two panes and run the code in a new pane.
However, I found it cumbersome to type different commands for each programming language (Go, C, Racket, and so on).
While auto-completion helped to some extent, or using control-p
to run the previous command, it still took up a little time.
SICP Exercise 2.77: expected a procedure that can be applied to arguments, given #f
2023-07-13
2.5.1 Generic Arithmetic Operations
Louis Reasoner tries to evaluate the expression (magnitude z) where z is the object shown in figure 2.24. To his surprise, instead of the answer 5 he gets an error message from
apply-generic
, saying there is no method for the operationmagnitude
on the types(complex)
.
To simplify the install-complex-package
procedure, I made the following changes:
1(define (install-complex-package) 2 (define (make-from-real-imag x y) 3 ((get 'make-from-real-imag 'rectangular) x y)) 4 (define (tag z) (attach-tag 'complex z)) 5 (put 'make-from-real-imag 'complex 6 (lambda (x y) (tag (make-from-real-imag x y)))) 7 8(install-complex-package) 9 10(trace-define (make-complex-from-real-imag x y) 11 ((get 'make-from-real-imag 'complex) x y)) 12 13(magnitude (make-complex-from-real-imag 3 4))
Docker rootless keeps restarting?
2023-07-12
As some of you may know, this blog is hosted on Raspberry Pi. To monitor its status, I wrote a script, which you can find here.
Recently, I decided to switch the Docker daemon to run in rootless mode. However, after making this change, I started receiving notifications indicating that the blog was frequently going offline.
Whenever this happens, I ssh into my Pi and run the command docker ps
to list the running containers.