zsh alias pwd | xc

alias pwx='pwd | xc'

I really need to gather them all in one place and make ~/.zshrc cleaner and neater.

bash / python / whatever todo small things

~I keep doing things like echo 1 2 4 | paste -sd+ | bc -> cc 123/5 etc. Some small things like avgof 1 2 3 etc would help. Has this been solved by something, any sci / mathematical environment? If not I’d write it the functions myself.~

cc() python3 -c "from math import *; from statistics import *; print($*);"
alias cc='noglob cc'

Added statistics to it, now I can do things like cc mean([2, 4, 9]). (As a bonus stdev() etc., full list). Works for now. ", if any, have to be escaped.

zsh prompt

Yet another change (theme file clean2.zsh-theme): PROMPT='%{$fg[green]%}(%*/%!) %{$fg[$NCOLOR]%}%B%b%{$reset_color%}%{$fg[blue]%}%B%5c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '

It transforms to:

(10:23:09/10712) some/folder/whatever/ $ mycommand

Removed the user (that I had to edit out often), moved current time from PROMPT to the left side (now I can happily copypaste CLI args and output again).

regex greedy / lazy

Regex Quantifier Tutorial: Greedy, Lazy, Possessive TODO

TL;DR most regex engines are greedy by default. Greedy = ‘longest possible match’. Making it lazy sometimes means adding a “?” to the quantifier, such as .*?. Not supported everywhere, notably grep does this only with the perl syntax (grep -P .*?).

For vim: regular expression - How to make regex matchers non-greedy? - Vi and Vim Stack Exchange

info command instead of man

Nice, had no idea this existed. info diff, for example. Found here: linux - Understanding of diff output - Unix & Linux Stack Exchange.

Unified diff how to read

@@ -1,4 +1,5 @@:

  • The number after the comma is the length of the chunk (in the old or new file), and
  • the number before the comma is the line number for the beginning of the chunk.
  • The + and - signs refer to adding and deleting lines, respectively. 1

Gnu diff man page has more: Detailed Unified (Comparing and Merging Files)

Git / Jira / Bitbucket branches and connections to tickets

As long as the branch name contains the issue key (ABCD-123), it gets connected - but only if the branch is created after the creation of the ticket. 2

As stated previously in this question, it is not possible. You are screwed if you create the branch first.

But also it seems that mentioning an issue name in the pull request (does this work for commits?) also works:

Simply renaming the Pull Request in Github to include the issue id XXX-nnn in the name triggered that PR and Branch to be linked to the Jira ticket. 2

Random / i3 / workspaces

I could define a workspace officially, like number 5, for terminals I don’t really need but that are open in deep folders I might need later.

Random / documentation / dtb

Sometimes I miss the ability to drag and drop screenshots to my textfile with descriptions of stuff I did. I can drag and drop screenshots but they are a bit ephemeral. An interesting idea would be create a different keybinding that creates screenshots that get put in a particular folder; I can still drag-and-drop them, but I’ll have stricter guarantees that they’ll be there when I’ll look for them.

vim plugin MultipleSearch

MultipleSearch - Highlight multiple searches at the same time, each with a different color. : vim online

:Search sth
:Search somethingelse
:SearchReset

Highlights them in diff colors, just what I need. n/N works only on the last one.

vim-scripts/MultipleSearch2.vim: Improve Multiple search looks like an improved version of the above.

vim search and substitute

You can use \1 etc for %s/.. commands, if the groups where previously defined by you in a usual /search-for-stuff!

/\v(https?):\/\/(.{-})\/.*        <-- Search
:%s,,Protocol:\1 - Domain:\2,g    <-- Substitution

This is awesome.