Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Q] current working directory and parent in list #506

Open
c0mpile opened this issue Jan 13, 2025 · 0 comments
Open

[Q] current working directory and parent in list #506

c0mpile opened this issue Jan 13, 2025 · 0 comments
Labels
question Further information is requested

Comments

@c0mpile
Copy link

c0mpile commented Jan 13, 2025

I want to remove the ./ and ../ from the tab completion list that pops up when I go to complete something. Everything I've tried just made it fail to complete anything in the current directory at all. I'm also stuck on how to make a tab completion list of the contents of the current working directory come up if I press tab on a blank line with nothing typed in at all.

I've spent lots of time reading documentation for fzf and fzf-tab and I must be missing something because I can't figure out how to do this. Any help would be appreciated. My .zshrc is below.

# zsh configuration          
# https://github.com/c0mpile/ 

################################
# Powerlevel10k instant prompt #
################################
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

#########################
# Environment variables #
#########################
PATH="$HOME/.local/bin:$HOME/bin:$HOME/.cargo/bin:$PATH" 
ZDOTDIR="$HOME/.config/zsh"
ZPLUGINDIR="${ZPLUGINDIR:-${ZDOTDIR:-$HOME/.config/zsh}/plugins}"
ZSH_CACHE_DIR="${ZSH_CACHE_DIR:-${ZDOTDIR:-$HOME/.config/zsh}/cache}"
EDITOR="nvim"
VISUAL="nvim"
HISTSIZE='5000'
HISTFILE="$HOME/.zsh_history"
SAVEHIST="$HISTSIZE"
HISTDUP="erase"

#############
# Functions #
#############
# clone plugins
function plugin-clone {
  local repo plugdir initfile initfiles=()
  ZPLUGINDIR=${ZPLUGINDIR:-${ZDOTDIR:-$HOME/.config/zsh}/plugins}
  for repo in $@; do
    plugdir=$ZPLUGINDIR/${repo:t}
    initfile=$plugdir/${repo:t}.plugin.zsh
    if [[ ! -d $plugdir ]]; then
      echo "Cloning $repo..."
      git clone -q --depth 1 --recursive --shallow-submodules \
        https://github.com/$repo $plugdir
    fi
    if [[ ! -e $initfile ]]; then
      initfiles=($plugdir/*.{plugin.zsh,zsh-theme,zsh,sh}(N))
      (( $#initfiles )) && ln -sf $initfiles[1] $initfile
    fi
  done
}

# source plugins
function plugin-source {
  local plugdir
  ZPLUGINDIR=${ZPLUGINDIR:-${ZDOTDIR:-$HOME/.config/zsh}/plugins}
  for plugdir in $@; do
    [[ $plugdir = /* ]] || plugdir=$ZPLUGINDIR/$plugdir
    fpath+=$plugdir
    local initfile=$plugdir/${plugdir:t}.plugin.zsh
    (( $+functions[zsh-defer] )) && zsh-defer . $initfile || . $initfile
  done
}

# update plugins
function plugin-update {
  ZPLUGINDIR=${ZPLUGINDIR:-$HOME/.config/zsh/plugins}
  for d in $ZPLUGINDIR/*/.git(/); do
    echo "Updating ${d:h:t}..."
    command git -C "${d:h}" pull --ff --recurse-submodules --depth 1 --rebase --autostash
  done
}

###########
# Plugins #
###########
# external plugin repos
repos=(
  romkatv/powerlevel10k
  ohmyzsh/ohmyzsh
  peterhurford/up.zsh
  zsh-users/zsh-autosuggestions
  zsh-users/zsh-history-substring-search
  zsh-users/zsh-completions
  zdharma-continuum/fast-syntax-highlighting
  Aloxaf/fzf-tab
  unixorn/fzf-zsh-plugin
  unixorn/git-extra-commands
  c0mpile/zypper.zsh
)

plugin-clone $repos # clone plugin repos

# load completions
fpath=( "$ZSH_CACHE_DIR/completions" $fpath )

autoload -Uz compinit
compinit

# required for oh-my-zsh plugins to work properly
ZSH=$ZPLUGINDIR/ohmyzsh
for _f in $ZSH/lib/*.zsh; do
  source $_f
done
unset _f

# plugins to load
plugins=(
  powerlevel10k
  up.zsh
  fzf-tab
  fzf-zsh-plugin
  git-extra-commands
  zsh-completions
  zsh-autosuggestions
  zsh-history-substring-search
  fast-syntax-highlighting
  zypper.zsh
  ohmyzsh/plugins/archlinux
  ohmyzsh/plugins/command-not-found
  ohmyzsh/plugins/dnf
  ohmyzsh/plugins/encode64
  ohmyzsh/plugins/safe-paste
  ohmyzsh/plugins/sudo
  ohmyzsh/plugins/universalarchive
)

# load remaining plugins
plugin-source $plugins

# load powerlevel10k
if zmodload zsh/terminfo && (( terminfo[colors] >= 256 )); then
  [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
else
  [[ ! -f ~/.p10k-ascii-8color.zsh ]] || source ~/.p10k-ascii-8color.zsh
fi

# load zmv
autoload -U zmv

###########
# Options #
###########
setopt auto_cd
setopt glob_dots
setopt appendhistory
setopt sharehistory
setopt hist_ignore_space
setopt hist_ignore_all_dups
setopt hist_save_no_dups
setopt hist_ignore_dups

############
# Keybinds #
############
bindkey '^[s' sudo-command-line

#####################
# Style completions #
#####################
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'eza -1 --color=always $realpath'
zstyle ':fzf-tab:*' fzf-flags --bind=right:accept,ctrl-space:toggle+down,ctrl-a:toggle-all

###########
# Aliases #
###########
# editor stuff
alias v='nvim'
alias vi='nvim'
alias vim='nvim'
alias nv='nvim'

# directory listing
alias l='eza --icons=always -a --group-directories-first --no-quotes'
alias ls='eza --icons=always --group-directories-first --no-quotes'
alias la='eza --icons=always -a --group-directories-first --no-quotes'
alias ll='eza --icons=always -lah --smart-group --group-directories-first --no-quotes'
alias ldot='eza --icons=always -ldh --group-directories-first --no-quotes .*'
alias tree='tree -a -I .git'

# other shit
alias mkdir='mkdir -p'
alias rsync='rsync -a --info=progress2'

################
# Integrations #
################
eval "$(zoxide init --cmd cd zsh)"
eval "$(thefuck --alias)"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
@c0mpile c0mpile added the question Further information is requested label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant