Blog: 2023-08-07

From razwiki
Jump to navigation Jump to search

Currently waiting on nushell to download, straight from cargo. Apparently it hasn't been packaged for debian/ubuntu, which is a bit surprising. That might be a worthwhile project, if nushell is any good.

Reading vim koans made me think maybe I'm barking up the wrong tree trying to replace tmux with vim. But I'm pretty tired of tmux, and generally environments that have a bespoke configuration language. And the command line interface of tmux is a bit wack. I tried at one point to make tmux automatically start, but canceled that for some reason, maybe having to do with tmux updates. Probably a tool I don't need.

Anyways that reminds me of the ideas I had which prompted me to blog:

  • an old one from an April blog:

Idea: a spellchecker kinda thing that fixes common typos in a variety of places, like command line, email, text editor. Really just spellchecker that doesn't do things you don't want, like smart quotes

Much like lsp, it would be nice to have this functionality abstracted such that different environments could reuse the core logic of what replacements are to be done. I suppose a bunch of applications have a spelling corrections list, and this is even built in to MacOS. But I don't use macos much any more. Anyways it could be good, since a command line could implement typo fixes using abbrs, email web client using javascript, text editor using built in abbrs or something. But ideally the corrections would be stored in a single location. not a super high priority tho

Ok the other idea is this sort of tree of programming, where I document what depends on what, and then identify proprietary / suboptimal components I'd like to get rid of. Like

computing experience

  operating system
    desktop environment

programming language: c, make, python

python: depends on c
  package manager: pip, poetry
  web framework: django, flask

text editor: vim, emacs, neovim

and then rate the various components, thus understanding what is a solid foundation and what isn't Like how I'm using reattach-to-user-namespace with tmux, don't like that leaf, figure out if I can get rid of it. What problems does it solve, what problems does it create.

That's a sorta silly example since that only depends on macos, but tmux is a good example, I've used it for years, it has some use, but it has some frustrations too.

Started trying to write up my patch for fish tab completion:

I have a patch which implements what @krobelus and @krackers discussed above, namely it removes the `COMPLETE_REPLACES_TOKEN` logic that removed the different-case options from the tab completion. It's similar to the @krackers comment but smaller since it only deals with smart-case tab completion.

Working on this led me to a design question. Currently the tab completion underlines the prefix of the result that matches the token you have typed:


However if the result matches the token but is a different case, should the corresponding characters with different case also be underlined?

The way the current display code works, the prefix is set in one place and printed before each of the results, which doesn't work if the case is different between the results. My patch removes the prefix underlining entirely; it was simple to implement but is a regression in functionality. Here's a screenshot of how my patch looks:


As you can see, the options with different case are now showing, but the underlined `c` in the results is gone.

I don't expect my patch will be merged as-is since it removes the prefix underlining entirely but I hope it is useful as a starting point.

I imagine the ideal solution is keep prefix underlining and to underline the prefix of different case, preserving the case of the result. So it would look like:

<img width="650" alt="underlined" src="">


To implement this would require changing `pager.set_prefix` behavior to be smart about the case of the prefix it prints, since depending on the result, the prefix in the result could show as lowercase or uppercase.

Tests would be a welcome addition to pin down the expected behavior. Unfortunately the test file relating to tab completion, `tests/checks/`, is apparently flakey and disabled on CI; perhaps that should be tracked as another issue.

But now I'm realizing the other comment has the functionality I describe as the ideal... maybe. Should try to get that patch working. But it also has a reference to a function in another file `set_completions` which has a different signature now, and I'm not sure how the logic maps.

So maybe the move is to ask for the full patch, ideally in commit form.