ThePrimeagen / .dotfiles

3.1k stars 306 forks source link

tmux-sessionizer not returning single directories 😱 #5

Closed lpanebr closed 3 years ago

lpanebr commented 3 years ago

ow man... I jusst feel so stupid cause I can't figure out why my freaking single directories aren't getting added to the array like yours at: https://github.com/ThePrimeagen/.dotfiles/blob/20a0a1d309d9b7735ee4e31b43e629441e221df1/bin/.local/bin/tmux-sessionizer#L8-L11

My looks like this:

if [[ $# -eq 1 ]]; then
    selected=$1
else
    items=`find ~/Dropbox/work -maxdepth 1 -mindepth 1 -type d`
    items+=`find ~/mysites/cpub -maxdepth 1 -mindepth 1 -type d`
    items+=`find ~/mysites/submit -maxdepth 1 -mindepth 1 -type d`
    items+=`find ~/mysites/portais -maxdepth 1 -mindepth 1 -type d`
    items+=`find ~/Dados -maxdepth 1 -mindepth 1 -type d`
    items+=("$HOME/Dados")
    items+=("$HOME/Dropbox/work")
    items+=("$HOME/.local/bin")
    items+=("$HOME/.config")
    selected=`echo "$items" | fzf`
fi

What am I missing?

lpanebr commented 3 years ago

I just fixed it.

The problem was that

were not getting a newline between each other.

The following very ugly thing fixes it.

    items=`find ~/Dropbox/work -maxdepth 1 -mindepth 1 -type d`
    items+=$'\n'
    items+=`find ~/mysites/cpub -maxdepth 1 -mindepth 1 -type d`
    items+=$'\n'
    items+=`find ~/mysites/submit -maxdepth 2 -mindepth 1 -type d`
    items+=$'\n'
    items+=`find ~/mysites/portais -maxdepth 1 -mindepth 1 -type d`
    items+=$'\n'
    items+=`find ~/Dados -maxdepth 1 -mindepth 1 -type d`
    items+=$'\n'
    items+=`find ~/Dropbox/src-builds -maxdepth 1 -mindepth 1 -type d`
    items+=$'\n'
    items+=`find ~/Insync-headless/luciano@editoracubo.com.br -maxdepth 1 -mindepth 1 -type d`
    items+=$'\n'
    items+=`find ~/.local/bin -maxdepth 0 -mindepth 0 -type d`
    items+=$'\n'
    items+=`find ~/.config -maxdepth 0 -mindepth 0 -type d`
    items+=$'\n'
    items+=`find ~/Dados -maxdepth 0 -mindepth 0 -type d`
    items+=$'\n'
    items+=`find ~/Dropbox/work -maxdepth 0 -mindepth 0 -type d`
    items+=$'\n'
    selected=`echo "$items" | fzf`

🎉🎉🎉