Post AVpHBzhUcFIvZT2AgC by joostruis@mastodon.tech
 (DIR) More posts by joostruis@mastodon.tech
 (DIR) Post #AVok4vZqFdh4GgThTM by hyde@lazybear.social
       2023-05-19T15:49:46Z
       
       0 likes, 0 repeats
       
       For those who spend their time in a terminal, what are your best #shell functions?  #linux #termina https://lazybear.io/notes/your-best-functions/
       
 (DIR) Post #AVokDHChj8yLevdXKC by btp@fosstodon.org
       2023-05-19T15:51:15Z
       
       0 likes, 0 repeats
       
       @hyde My current favorite little trick is a function to auto-start v-envs when entering a directory that holds a v-env.# Auto activate venv when entering a venv directoryfunction precmd {    # Set up the venv    if ! typeset -f deactivate >/dev/null; then        for activate in ./venv/bin/activate ./.venv/bin/activate; do            if [ -e "$activate" ]; then                . "$activate"            fi        done    fi}
       
 (DIR) Post #AVokK0N4i22fTqhCsq by hyde@lazybear.social
       2023-05-19T15:52:29Z
       
       0 likes, 0 repeats
       
       @btp nice 🙌
       
 (DIR) Post #AVoxyIPmLExcQfVFlA by etam@im-in.space
       2023-05-19T18:25:19Z
       
       0 likes, 0 repeats
       
       @hyde Automatic "ls" after "cd path" ("cd" without arguments goes to $HOME and I don't want "ls" there).case "$-" in    *i*) is_interactive="true" ;;esacif [[ "$is_interactive" == "true" ]]; then    cd() {        if (( $# == 0 )); then            builtin cd        else            builtin cd "$@"            (( $? == 0 )) \                && ls -lah >&2        fi    }fi
       
 (DIR) Post #AVpHBzhUcFIvZT2AgC by joostruis@mastodon.tech
       2023-05-19T19:41:01.604570Z
       
       0 likes, 0 repeats
       
       @hyde  I really use grep a lot to find things in files.grep -R <string>
       
 (DIR) Post #AVpHC0fl0BVgaNEIc4 by hyde@lazybear.social
       2023-05-19T22:00:45Z
       
       0 likes, 0 repeats
       
       @joostruis i prefer ripgrep or fzf ... And that's not really a shell function 😅
       
 (DIR) Post #AVpHGlLlOjniVn8zuC by hyde@lazybear.social
       2023-05-19T22:01:40Z
       
       0 likes, 0 repeats
       
       @etam why do you ls when you get in a directory ? I mean ... I'm not doing it often 😅
       
 (DIR) Post #AVq5N2gHSlOoshQhNY by etam@im-in.space
       2023-05-20T07:22:58Z
       
       0 likes, 0 repeats
       
       @hydeObviously to see the contents of the directory. I need to see my context.For a similar reason I don't like GNOME 3. There's no list of windows in or no indication of current workspace. It makes me feel lost.
       
 (DIR) Post #AVqFJ4pTfvVDgLJ1No by hyde@lazybear.social
       2023-05-20T09:14:23Z
       
       0 likes, 0 repeats
       
       @etam i just jump to the directory and do "nvim ." with nvim-tree installed 😜
       
 (DIR) Post #AVqFMYV3ohVwZZPlY0 by hyde@lazybear.social
       2023-05-20T09:15:01Z
       
       0 likes, 0 repeats
       
       @etam i'm an awesomewm user since over ten years I think ... I love tiling managers
       
 (DIR) Post #AVqIXYUgTmYfbNAvgm by etam@im-in.space
       2023-05-20T09:50:33Z
       
       0 likes, 0 repeats
       
       @hyde Likewise, I use i3wm.
       
 (DIR) Post #AVqLapHIpfaOO8ARYe by hyde@lazybear.social
       2023-05-20T10:24:50Z
       
       0 likes, 0 repeats
       
       @etam at some I will need to try it !
       
 (DIR) Post #AVqrSwdAoAj5PPgP32 by ambihelical@qoto.org
       2023-05-20T16:21:57Z
       
       0 likes, 0 repeats
       
       @hyde  I wrote a bash function I call gcd which allows cd relative to the current git repo root. There is also bash completion for it.  Very handy at times. I’m on my phone rn but you can see in my GitHub dotfiles repo same user name.
       
 (DIR) Post #AVqx0oj1CvNAVSO77I by hyde@lazybear.social
       2023-05-20T17:24:07Z
       
       0 likes, 0 repeats
       
       @ambihelical I'll check it
       
 (DIR) Post #AVrR4cF2YmkJZZ5qaG by deblan@mamot.fr
       2023-05-20T23:00:55Z
       
       0 likes, 0 repeats
       
       @hyde one of my favourite and more used function is called `repo`. It takes an argument which is a project name and jump to it if exists or ask me to create it. It also could be used to clone a repository in my dev workspace by taking a git url.
       
 (DIR) Post #AVsIqYStCRivKXJbsW by hyde@lazybear.social
       2023-05-21T09:03:24Z
       
       0 likes, 0 repeats
       
       @deblan Nice. Could you share it ?
       
 (DIR) Post #AVsK6vaL6hodcjAfaa by deblan@mamot.fr
       2023-05-21T09:17:37Z
       
       0 likes, 0 repeats
       
       @hyde Code: https://gitnet.fr/deblan/gists/src/branch/master/zsh/plugins/project.plugin.zshExamples: https://asciinema.org/a/kVvi8mTvJUVGifihZZj544Dj9I wrote it for zsh with autocomplete.