<commit_before>#!/usr/bin/env bash
#--------------------------------------#
#    Boostrap all your config files    #
#            by <NAME>             #
#              Dec. 2021               #
#--------------------------------------#

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"

# --------------------------------------
# Put config/dir to sync in this variable
# --------------------------------------

files_to_sync=(
    .bashrc
    .cargo/config.toml
    .config/alacritty/alacritty.yml
    .config/autostart/x11setup.desktop
    .config/bat/config
    .config/fish/config.fish
    .config/gitui/key_bindings.ron
    .config/kitty/kitty.conf
    .config/leftwm/config.toml
    .config/nvim/init.vim
    .config/nvim/lua/dap-configs.lua
    .config/nvim/lua/lsp.lua
    .config/nvim/lua/plugins.lua
    .config/ripgreprc
    .config/starship.toml
    .gitconfig
    .gitignore
    .inputrc
    .tmux.conf
    .xbindkeysrc
)

cargo_crates=(
  bat
  cargo-update
  exa
  fd-find
  git-delta
  gitui
  mdbook
  ripgrep
  starship
  tealdeer
  tokei
  watchexec-cli
  zoxide
)

python_packages=(
  ipython
  pipenv
  poetry
  python-lsp-server[all]
)

# --------------------------------------
# Put custom installaltion commands here
# --------------------------------------

sync_config_files () {
  # Define source and backup directory
  dir=$HOME/.dotfiles
  origdir=$HOME/.dotfiles.orig

  echo -n "Creating $origdir for backup ..."
  mkdir -p $origdir
  echo "done"

  echo -n "cd to $dir ..."
  cd $dir
  echo "done"

  # Symlink files
  for file in ${files_to_sync[@]}; do
      echo "$file"
      echo -e "\tMoving $file to $origdir/$file"
      if [[ -z "$file" ]]; then
          echo -e "No file $file found"
          return
      fi
      mkdir -p "$HOME/$(dirname $file)"
      mkdir -p "$origdir/$(dirname $file)"
      mv "$HOME/$file" "$origdir/$file"
      echo -e "\tSymlinking to $file in $dir"
      ln -is "$dir/$file" "$HOME/$file"
  done
}

install_tmux_package_manager() {
    tpm_dir="$HOME/.tmux/plugins/tpm"
    if [[ ! -d "$tpm_dir" ]]; then
        git clone https://github.com/tmux-plugins/tpm "$tpm_dir"
    else<commit_msg>[bootstrap] refactor with SCRIPTPATH var<commit_after>#!/usr/bin/env bash
#--------------------------------------#
#    Boostrap all your config files    #
#            by <NAME>             #
#              Dec. 2021               #
#--------------------------------------#

SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"

# --------------------------------------
# Put config/dir to sync in this variable
# --------------------------------------

files_to_sync=(
    .bashrc
    .cargo/config.toml
    .config/alacritty/alacritty.yml
    .config/autostart/x11setup.desktop
    .config/bat/config
    .config/fish/config.fish
    .config/gitui/key_bindings.ron
    .config/kitty/kitty.conf
    .config/leftwm/config.toml
    .config/nvim/init.vim
    .config/nvim/lua/dap-configs.lua
    .config/nvim/lua/lsp.lua
    .config/nvim/lua/plugins.lua
    .config/ripgreprc
    .config/starship.toml
    .gitconfig
    .gitignore
    .inputrc
    .tmux.conf
    .xbindkeysrc
)

cargo_crates=(
  bat
  cargo-update
  exa
  fd-find
  git-delta
  gitui
  mdbook
  ripgrep
  starship
  tealdeer
  tokei
  watchexec-cli
  zoxide
)

python_packages=(
  ipython
  pipenv
  poetry
  python-lsp-server[all]
)

# --------------------------------------
# Put custom installaltion commands here
# --------------------------------------

sync_config_files () {
  # Define source and backup directory
  dir=$SCRIPTPATH
  origdir=$HOME/.dotfiles.orig

  echo "Creating $origdir for backup old dotfiles ..."
  mkdir -vp $origdir

  echo "cd to $dir ..."
  pushd $dir

  # Symlink files
  for file in ${files_to_sync[@]}; do
      if [[ -z "$file" ]]; then
          echo -e "Failed to move $file to $origdir/$file: No file $file found"
          return
      fi
      mkdir -p "$HOME/$(dirname $file)"
      mkdir -p "$origdir/$(dirname $file)"
      mv -v "$HOME/$file" "$origdir/$file"
      ln -ivs "$dir/$file" "$HOME/$file"
  done

  popd
}

install_tmux_package_manager() {
    tpm_dir="$HOME/.tmux/plugins/tpm"
    if [[ ! -d "$tpm_dir" ]]; then
        git clone https://github.com/tmux-plugins/tpm "$tpm_dir"
    else
{'fraction_non_alphanumeric': 0.2275070290534208, 'fraction_numerical': 0.0032802249297094657, 'mean_word_length': 1.6062271062271063, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2794550', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1447, 'n_words': 308}