Blog: 2023-07-19

From razwiki
Revision as of 00:22, 19 July 2023 by Razzi (talk | contribs)
Jump to navigation Jump to search

It's getting late ~~ and I'm stuck trying to scratch a particular itch, yet one I have felt many times...

clone-cd git clone <somerepo>

The problem is I copy urls from the browser that try to helpfully have a git clone as part of them, but I don't use that, I use my function clone-cd, which sets the depth to 1 and cds into it.

Now I just came up with another solution, namely: make a git wrapper that does the above. But even before that, I have written

git clone git clone <somerepo>

many times.

First attempt was using abbr with the --position anywhere flag. But it doesn't look like having a space in the pattern works

Then I thought "maybe I can do an abbr for git and one for clone". that should work but it's pretty hacky.

Then I thought "maybe I can tap into the paste function" - this is probably actually the most straightforward solution. But I guess alt+v is not what is bound that might go straight through the terminal app as a string of keystrokes. But maybe rebinding it would work...

Ok so it didn't work at first, since I had config in my alacritty toml. But upon turning that off, I'm able to call razzi_paste:

bind \ev razzi_paste
function razzi_paste
    echo asdf
end

Ok I have something working, looks like:

function paste_avoiding_double_git_clone
    set command (commandline | string trim)
    set clipboard (wl-paste -n | string collect -N)
    if string match -q clone-cd $command
        set clipboard (echo $clipboard | string replace 'git clone ' '')
    end
    commandline -i -- $clipboard
end

and

bind \ev paste_avoiding_double_git_clone

great, flow preserved


Also misc

=

https://www.youtube.com/playlist?list=PLMHbQxe1e9Mk5kOHrm9v20-umkE2ck_gE seems to be a good intro to rust on a cool tool that seems to be trying to improve the git experience: https://github.com/Byron/gitoxide

I hit git pull in mediawiki and it's at 20% after a couple hours. Is it trying to unshallow itself? huh. This is the kinda thing a new git client could improve.

Also I forget how to use weechat, and the default /help command scrolls out of the screen size I gave it... and I don't know how to scroll it... so I started looking into the suckless tools, and I'm sorta trying to get lchat working. All of which is helping me understand irc internals... I guess. Losing interest on that front a bit