Skip to content

Tips and Tricks

Kevin Zhuang edited this page Jul 11, 2020 · 2 revisions
  • Most commands related to files support multi selection (default fzf setting is TAB for multi select).

  • Most commands related to commits and branches doesn't support multi selection.

  • Checkout fzf doc for more default fzf keybinds information.

  • Alias dotbare to shorter words to type less.

    alias dots=dotbare
  • Create keybinds for dotbare (e.g. bind ctrl-g to launch fedit and edit files).

    # zsh example
    bindkey -s '^g' "dotbare fedit"^j
    # bash example
    bind -x '"\C-g":"dotbare fedit"'
  • dotbare has disabled the command dotbare add --All as it is a really dangerous command in the conext of dotbare as it will stage everything in your $DOTBARE_TREE to the index.

    # Recommended ways
    dotbare fadd  # and then press alt-a to select all
    dotbare add -u # stage all modified file to index
    dotbare commit -am "message" # this also works, it will stage all modified files and then commit
  • Add the value of $DOTBARE_DIR to global .gitignore to avoid any weird recursion problem if accidentally adding $DOTBARE_DIR to index, the value needs to be relative path to $DOTBARE_TREE

    # e.g. DOTBARE_DIR="$HOME/.cfg", DOTBARE_TREE="$HOME"
    echo ".cfg" >> $HOME/.gitignore
    # e.g. DOTBARE_DIR="$HOME/.config/.cfg" DOTBARE_TREE="$HOME"
    echo ".config/.cfg" >> $HOME/.gitignore
    # e.g. DOTBARE_DIR="$HOME/.config/.cfg" DOTBARE_TREE="$HOME/.config"
    echo ".cfg" >> $HOME/.gitignore
  • Define a custom vim command to select dotfiles using fzf.vim

    command! Dots call fzf#run(fzf#wrap({
      \ 'source': 'dotbare ls-files --full-name --directory "${DOTBARE_TREE}" | awk -v home="${DOTBARE_TREE}/" "{print home \$0}"',
      \ 'sink': 'e',
      \ 'options': [ '--multi', '--preview', 'cat {}' ]
      \ }))
Clone this wiki locally