Look Back

/media/images/look_back01_udcywho.png

Look Back by Tatsuki Fujimoto is about a young girl in fourth grade who is proud of her role as the manga artist in her class newspaper.

/media/images/look_back02_gbckidt.png /media/images/look_back03.png

Another classmate, a recluse that avoids school sends in their artwork and she's stunned to discover it is significantly better than her own.

/media/images/look_back04.png /media/images/look_back05.png

She works harder and her artwork improves but her social life suffers but when she sees another example of her reclusive classmate's work she realizes it's hopeless and gives up.

/media/images/look_back06.png /media/images/look_back07.png

At the end of the year her teacher asks her to take something to the home of this reclusive classmate. She objects at first but then goes to her classmate's house and slips a quickly scribbled little comic about wanting her to come out under the door. As she's leaving her classmate comes running out and confronts her.

/media/images/look_back08.png /media/images/look_back09.png

Her classmate says as soon as she saw the scribbled cartoon she she knew who it was, that she's a big fan, and she's been eagerly reading her comics over the years. Stunned by this news, she lies and tells the reclusive girl the reason she stopped drawing is because she was working on a big idea for a contest.

/media/images/look_back10.png /media/images/look_back11.png

The next few panels are the reason I'm making this post. This girl was proud of her skills, crushed by the realization there are others with greater talent, had given up, and then her pride dragged her back in. The panels following this revelation don't have any dialog but you can see her anguish and pride.

/media/images/look_back12.png /media/images/look_back13.png

The plot continues but this really is the moment that makes the whole comic shine. The artist behind this one-shot, Tatsuki Fujimoto is the same artist that did chainsaw man.

Albert's Path is strange and difficult

Spellchecker in Helix

/media/images/grav_labs_helix_multi_kit_pipe.jpg

An image search for 'helix pipe' returned a bunch of images of whatever this is

There's currently no official support for spellchecking in helix but it supports the LSP protocol and there are tools that will provide spelling and grammar checking over LSP. I've setup my editor to use ltex-ls. It's slow (written in java) and it won't actually fix the spelling but it's better than nothing until we get official support. Here's how I set it up.

Start by downloading and unzipping the application.

Then modify your .config/helix/languages.toml with this (using your path to the ltex-ls binary):

[[language]]
name = "markdown"
language-servers = [{ name = "ltex"}]
soft-wrap.enable = true
soft-wrap.wrap-indicator = ""
# scope = "source.markdown"
file-types = ["md", "txt", "tex"]

[language-server.ltex]
command = "/home/na/app/ltex-ls/bin/ltex-ls"

Restart helix and it should automatically start loading the LSP (you'll see a spinner in the status bar).

By default ltex-ls is set for american english but you can set other langues like this.

This was taken from a blog post that talks about setting up a note taking app in helix.

Debugging rust in helix

/media/images/helixforward-helix-piercing.jpg

An image search for helix produced a bunch of pictures of ears

This is cool and the existing documentation isn't super clear. I wanted to debug some unit tests in a script I was writing. Rust provides a gdb debugger with the ability to pretty print rust objects called rust-dbg. Run it from the command line like normal with:

rust-gdb target/debug/rename_files

Unfortunately unit tests like this:

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn crop_start() {
        let filename = "1234567890";
        let newfilename = crop_filename(filename, 1, 0, false).expect("failed to crop");
        assert_eq!("234567890".to_string(), newfilename);
    }

    #[test]
    fn crop_end() {

aren't normally compiled and linked into your binary but you can get a path to this binary with 'cargo test':

~/source/rust/rename_files  cargo test                                                                                   3m 51s
    Finished test [unoptimized + debuginfo] target(s) in 0.02s
     Running unittests src/main.rs (target/debug/deps/rename_files-26e38ab9001eb8c3)

running 26 tests
test capitalize::tests::single_word ... ok
test capitalize::tests::space_separated_words ... ok
test capitalize::tests::three_words_one_short ... ok
test capitalize::tests::three_words ... ok
test capitalize::tests::three_words_start_short ... ok
test capitalize::tests::two_long_words ... ok
test crop::tests::crop_end_out_of_range ... FAILED

Run rust-gdb on this path to debug your unit tests.

rust-gdb target/debug/deps/rename_files-26e38ab9001eb8c3

Unfortunately this only gives you raw gdb connection and I couldn't get -tui to work but you can do your debugging directly in the helix editor. To get started configure your system.

In my case I ran:

      sudo pacman -S lldb
      cd /usr/local/etc
sudo helix lldb_vscode_rustc_primer.py

and pasted this into that file:

import subprocess
import pathlib
import lldb

# Determine the sysroot for the active Rust interpreter
rustlib_etc = pathlib.Path(subprocess.getoutput('rustc --print sysroot')) / 'lib' / 'rustlib' / 'etc'
if not rustlib_etc.exists():
    raise RuntimeError('Unable to determine rustc sysroot')

# Load lldb_lookup.py and execute lldb_commands with the correct path
lldb.debugger.HandleCommand(f"""command script import "{rustlib_etc / 'lldb_lookup.py'}" """)
lldb.debugger.HandleCommand(f"""command source -s 0 "{rustlib_etc / 'lldb_commands'}" """)

Finally I updated my languages.toml file with:

[[language]]
name = "rust"

[language.debugger]
name = "lldb-vscode"
transport = "stdio"
command = "lldb-vscode"

[[language.debugger.templates]]
name = "binary"
request = "launch"
completion = [ { name = "binary", completion = "filename" } ]
args = { program = "{0}", initCommands = [ "command script import /usr/local/etc/lldb_vscode_rustc_primer.py" ] }

I reloaded my config with ':config-reload' and then in helix I used '<Space> g' to bring up the debugger menu and 'b' to set a breakpoint on a particular line of code (in my unit test).

Then 'l <Enter>' to tell it to run a binary in the debugger and I gave it the path to the compiled binary with linked in unit tests:

And that's it. It automatically ran the script, stopped at my breakpoint and let me inspect values. It's still primitive but having this all already built into the editor without any plugins or super weird configuration is nice.

fal.ai real time image generation

This is impressive

/media/images/fast_image_generation.png

Helix the revisiting

/media/images/helix_2024-03-03_09-12.png /media/images/helix_2024-03-03_09-13.png

Since my last post in July I've made the jump to helix as my primary editor for code. They still haven't addressed most of the things that bothered me last year but I've been writing more rust code and the rust-analyzer support in helix is just better than neovim.

Unfortunately it took hours to get this working. As it turned out:

helix --health

lies. It told me I was all good to go but rust-analyzer wasn't actually installed. I still needed to run:

rustup component add rust-analyzer

On my main system I also needed to remove an old version of rust-analyzer that was in my ~/.local/bin/ (found with 'which rust-analyzer' and 'rustup which rust-analyzer').

Before I discovered the missing rust-analyzer I went through every configuration option to make sure I didn't miss an enable switch and I revisited my theme to make sure it was working but the text wasn't visible. There was also conflicting information on whether I needed to add stuff to the language.toml file. The changes I'd made were for older versions of helix and were no longer necessary. You can see my final helix configuration in my dotfiles repo here.)

Now I'm attempting to train my fingers to use this new editor. My config.toml file has the list of aliases I'm trying to remember:

# na's muscle memory
# https://cheatography.com/hiddenmonkey/cheat-sheets/helix/
# https://github.com/helix-editor/helix/wiki/Migrating-from-Vim
# x selects the current line - delete it with xd
# d deletes the current character
# :e                            # use :o
# reload from disk with :reload
# *                             # be*n  (or preferably Alt+o*n)
# \c                            # use Ctrl+c
# m is now a jumplist           # use Ctrl+s to save and Ctrl+o to return, space+j to view
# :%s/word/replacement/g<ret>   # use %sword<ret>creplacement<esc>
# %                             # use mm instead!
#  0 = "goto_line_start"        # use gh instead!
#  "$" = "goto_line_end"        # use gl instead!
#  G = "goto_file_end"          # use ge instead!
# ,1 = goto_last_accessed_file  # use ga or (Space Space) instead
# can't toggle a render so use two buttons
# can't toggle gutter contents
# can't toggle soft-wrap see languages.toml
# V (select whole line)        # use xv to get started
# :reg                         # not possible https://www.reddit.com/r/HelixEditor/comments/130gbzy/is_it_possible_to_cycle_through_the_yank_history/?rdt=40070
# Y                            # use :clipboard-yank (or Space y)
# Ctrl+r  (redo)               # use U
# autocomplete                 # Ctrl+x
# q  and `                     # Q and q

# new stuff (multicursor)
# C - duplicate cursor down
# s - select - duplicate cursor horizontally
# ,, - cancel multiple cursors
# & - align vertical cursors
# Alt-s - select all endlines in a block
# S - split on a regex pattern
# Alt+; - put cursor on other end of selection
# ; - drop selection but keep cursors
#
# R - replace a selected word with the contents of the paste buffer
# ms( - add paranthesis around selection
# md( - remove paranthesis from within

I've found the main pain points are 'x', 'd', and 's'.

  • 'x' used to be delete the character under the cursor, now it means select the entire line
  • 'd' now means delete a selection or a single character under the cursor
  • 's' used to mean delete and go into insert mode (to replace a selection) now it means start a search in 'selection' mode for the multicursor.

What this means is that 50+ times a day I type 'dd' to remove a line and discover it only removed two characters. Or I type 'x' to remove a character and have to stop because now the entire line is highlighted. Or I select some text and hit 's' to change it and enter a restricted selection mode.

Just now, typing that last paragraph, I literally made these mistakes six times. Extrapolate that to all the typing I did today and you can imagine the frustration.


Stuff I like

  • It feels faster and less bloated than neovim.
  • The popup menus are fast and filled with useful information.
  • The type hinting, git integration, LSP help, and other file status stuff is appreciated.
  • My config file is practically empty, meaning they've chosen good defaults (and they aren't trying to support multiple configuration languages).
  • The integration with the system clipboard isn't insane.
  • I like the FZF file pickers.
  • The kakoune inspired keymap is more consistent than vim.
  • I like that the developers are taking a thoughful approach towards adding new features. It seems like the project, despite the slow progress, is unlikely to be abandoned or go off the rails.

Stuff I don't like

  • They don't have a spellchecker. This is critical for something I use for all my writing. One of the main devs recently changed his mind and decided a spellchecker should be a core feature but that the existing spellcheckers are all inadequate so they're starting a new rust project that will work with the existing hunspell dictionaries.
  • They don't have a plugin system. They're working on it but it's unclear when it will be available. A plugin system would allow users to go nuts. If helix had a plugin system we would have six different ghetto spellcheckers within a week. As it's looking now, we won't have this for a few years.
  • They don't have the option to run a diff between buffers. This is something I do often and I'm not looking forward to jumping back and forth between editors or running some other app to do my diffs.

Still it seems like the editor has some momentum. They recently added a pipe command and I've been seeing helix users abusing it to do unspeakable things like adding copilot support. And the vifm guys have instructions on how to integrate the file picker into a tmux-helix install using some frightening tmux configuration hacks.

I still use vim for my git commits (and apparently for spellcheck) and I can already tell my muscle memory is soon going to have the opposite problem and I'll start making helix mistakes in neovim. The perils of switching text editors are fraught.