Your Latest Workflow Improvement - Desktop Customization & Workflow
josuah
This ^. And with the "win" command. You get an interactive shell within the editor.

Presentation from Russ Cox himself.
Mafia
I hope there isn't anyone using acme without win out there.
z3bra
Not using acme, but I'm using more and more sam commands thanks to vis. I must say it is way more powerful and comprehensive than vi's addresses. Once you wrap your head around it, it is pretty nice!

Workfllw wise, well, not much changed. I'm removing more and more fluff everyday, and using bare tools more (eg, default dvtm against 1000 lines .tmux.conf).
r4ndom
I'm more and more writing small scripts using dmenu to do things faster.

For example this beauty, which is a small file explorer using dmenu. For me it is used to open my lecture/exercise slides.
drkhsh
Code:
function up {
    if [[ "$#" < 1 ]]; then
        cd ..
    else
        CDSTR=""
        for i in {1..$1}; do
            CDSTR="../$CDSTR"
        done
        cd $CDSTR
    fi
}

Code:
function extract {
    if [ -f $1 ] ; then
        case $1 in
            *.tar.bz2)  tar xjf $1 ;;
            *.tar.gz)   tar xzf $1 ;;
            *.tar.xz)   tar xvJf $1;;
            *.tar.lzma) tar --lzma xvf $1;;
            *.bz2)      bunzip2 $1 ;;
            *.rar)      unrar x $1 ;;
            *.gz)       gunzip $1 ;;
            *.tar)      tar xf $1 ;;
            *.tbz2)     tar xjf $1 ;;
            *.tgz)      tar xzf $1 ;;
            *.zip)      unzip $1 ;;
            *.Z)        uncompress $1 ;;
            *.7z)       7zr e $1 ;;
            *)          echo "'$1' cannot be extracted via extract()" ;;
        esac
    else
        echo "'$1' is not a valid file"
    fi
}

Code:
function video {
    mpv --cookies-file=/tmp/cookies.txt $(youtube-dl -g --cookies /tmp/cookies.txt "$1")
}

Code:
alias stopwatch="time cat"
darthlukan
A small thing I did recently that has made things a tiny bit easier on myself is to use ZSH's Vi mode. I spend most of my time at work in various vim sessions with several shells open for performing various tasks (e.g. One specifically for debugging and that's all I do in it, another for file management, etc). It always felt a bit jarring to go from vim to one of my shells and have to use different key bindings for tasks. Well, with Vi mode a lot of that is alleviated and it's made a small improvement to my productivity as I don't have to think as much about key bindings.

Since it will probably come up, here's what's in my ~/.zshrc to distinguish modes at the prompt:

Code:
function ins-mode() { echo "λ" }
function cmd-mode() { echo "Ω" }

function build_prompt() {
    local p
    p=()
    if [[ $UID -eq 0 ]]; then
        p+="%{$fg[yellow]%}⚡"
    else
        p+="%{$fg[green]%}⊡"
    fi
    [[ -n $p ]] && echo "$p"  # Need 'echo' or the color escapes cause errors
}

function TRAPINT() {
    VIM_MODE=$(ins-mode)
    zle && zle reset-prompt
    return $(( 128 + $1 ))
}

function set-prompt() {
    case ${KEYMAP} in
        (vicmd)
            VIM_MODE="%{$fg[red]%}$(cmd-mode)"
            ;;
        (main | viins)
            VIM_MODE="%{$fg[green]%}$(ins-mode)"
            ;;
        (*)
            VIM_MODE="%{$fg[green]%}$(ins-mode)"
            ;;
    esac

    PROMPT=" ${VIM_MODE}%{$reset_color%} $(build_prompt)%{$reset_color%} ❱ "
}

function zle-line-init zle-keymap-select {
  set-prompt
  zle && zle reset-prompt
}

function zle-line-finish {
    VIM_MODE=$(ins-mode)
}

zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select

The result looks like the following.

CMD Mode:
Code:
Ω ⊡ ❱

INS Mode:
Code:
λ ⊡ ❱
Github: https://github.com/darthlukan
CRUX Ports: http://ports.brianctomlinson.com
GPG: 3694569D
"We're all human, act accordingly." -- Me
jvarg
I guess i'm the only one who does not knew this but
getting some output from a shell command into vim with that little command:

Code:
:r !shellcommand

just blew my mind.
That's so nice :D
z3bra
(03-05-2017, 06:21 PM)jvarg Wrote: I guess i'm the only one who does not knew this but
getting some output from a shell command into vim with that little command:

Code:
:r !shellcommand

just blew my mind.
That's so nice :D

Then you'll probably love piping your selection into random programs
Code:
:'<,'>!tr a-z A-Z
venam
(04-05-2017, 05:39 PM)z3bra Wrote: Then you'll probably love piping your selection into random programs
Code:
:'<,'>!tr a-z A-Z
My favorite one:
Code:
:'<,'> !fmt
jvarg
(05-05-2017, 12:42 AM)venam Wrote:
(04-05-2017, 05:39 PM)z3bra Wrote: Then you'll probably love piping your selection into random programs
Code:
:'<,'>!tr a-z A-Z
My favorite one:
Code:
:'<,'> !fmt

Oh yes, 10/10 thanks guys!!




Members  |  Stats  |  Night Mode