Skip to content
andreyhglPublic

About

aliasas and functions for nextflow, git and QoL

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

102 Commits

Folders and files

Repository files navigation

README

Personal configurations for configs, variables and functions (bash and zsh).

Appends to the existing .bashrc / .zshrc; nothing is replaced.

Note

install.sh is idempotent: safe to run multiple times (after a git pull).

Install

folder="dotfiles"

git clone [email protected]:andreyhgl/dotfiles.git "$folder" &&
  cd "$folder" &&
  bash install.sh

# edit the machine-local config
vi ~/.dotfiles.local
source ~/.bashrc

install.sh:

  • appends a source block to ~/.bashrc and/or ~/.zshrc (whichever exist; creates ~/.bashrc if neither does), after backing them up as *.backup
  • symlinks tmux.conf → ~/.tmux.conf, Rprofile → ~/.Rprofile and nvim/ → ~/.config/nvim (existing files are backed up as *.backup)
  • creates ~/.dotfiles.local from the template, if it doesn't exist

Type ,dotfiles to list the commands.

Layout

dotfiles/
├── shell/
│   ├── bashrc.sh              # entry point, sourced from ~/.bashrc / ~/.zshrc
│   ├── exports.sh             # environment variables (container images)
│   ├── functions.sh           # custom shell functions (Slurm, Nextflow)
│   ├── aliases.sh             # shell aliases (R, Slurm, listing)
│   ├── git.sh                 # git aliases and functions
│   └── prompt.sh              # git-aware cross-shell prompt
├── nvim/                      # symlinked to ~/.config/nvim
│   ├── init.lua               # entry: settings, lazy.nvim bootstrap
│   └── lua/config/
│       ├── plugins.lua        # colorscheme, Treesitter, Nextflow syntax
│       └── filetypes.lua      # .nf / nextflow.config detection
├── dotfiles.local.template    # template for machine-local settings (tracked)
├── install.sh                 # bootstrap: symlinks + appends source block
├── tmux.conf                  # symlinked to ~/.tmux.conf
├── Rprofile                   # symlinked to ~/.Rprofile
├── .vimrc                     # plain vim config (not linked by install.sh)
├── .gitignore
└── README.md

shell/bashrc.sh loads: exports, functions, aliases, prompt, git, and lastly ~/.dotfiles.local. Set ~/.local/bin on PATH and turns on case-insensitive tab completion.

Functions

Defined in shell/functions.sh.

checksum_verify

Verify files against MD5 checksum lists. Submitted as a Slurm job (sbatch -A "$ACCOUNT", 2 h) when ACCOUNT is set and sbatch exists, otherwise run locally.

checksum_verify /path/to/delivery                # every .md5 in the folder
checksum_verify P36012_1021.md5 P36012_1022.md5  # specific .md5 files
checksum_verify -h                               # help

Results are written to the directory from where the command ran from:

  • _CHECKSUM.OK — all checksums matched
  • _CHECKSUM.FAILED — one or more failed (lists the failing files)

salloc

Wrapper for an interactive Slurm session with defaults. Prints a summary before requesting the allocation. Arguments are positional and optional:

salloc [time] [mem] [cpus]
Argument Default Example
time (plain number = hours) 3 => 3:00:00 6 => 6:00:00, 1.5 => 1:30:00
mem (plain number = GB) 60 => 60G 40 => 40G, or with a unit: 500M, 1T
cpus 1 4
salloc           # 3:00:00, 60G, 1 cpu
salloc 6 40 4    # 6:00:00, 40G, 4 cpus

Requires ACCOUNT to be set (in ~/.dotfiles.local). To bypass the wrapper, use command salloc ....

Nextflow

Both load the Nextflow module if nextflow isn't on PATH (NEXTFLOW_MODULE in ~/.dotfiles.local, default nextflow).

Command Does
nflog [run_name] Task log of the latest (or named) run: status, hash, duration, realtime, name
nfclean [run_name] Show the latest (or named) run and the work directories of its non-cached tasks (with sizes), then delete them after a y/N prompt

,dotfiles

Lists the custom commands (dotfiles_help). Printed as a hint when a new interactive shell starts (not inside tmux).

Aliases & shortcuts

git

Defined in shell/git.sh.

Command Expands to Notes
gs git status --short Compact status
ga git add
gd git diff Unstaged changes
gds git diff --staged Staged changes
gc git commit -m "$*" No quotes needed: gc fix the bug. Quote if using special chars (> \ ' ! # ; &). Without arguments opens the editor.
gca git commit --amend Amend, edit message
gcan git commit --amend --no-edit Amend, keep message
gsw git switch Switch branches
gp git push
gpl git pull gpl [dir] [args]: pulls in dir if given (git -C); extra args go to git pull
gl git log --graph ... Pretty one-line graph log; takes git log args (gl -10)
gt git for-each-ref ... refs/tags Tags, newest first, with date/tagger/subject
gb git branch -a ... All branches, newest commit first, with subject + relative date. With arguments: plain git branch (gb new-feature)

git workflows

Merge a feature into main

git switch main
git pull --ff-only
git switch feature-branch
git rebase main      # replay the branch's commits on top of main: linear history
                     # on conflicts: fix, git add <files>, git rebase --continue

git switch main
git merge --no-ff feature-branch   # always make a merge commit
git push

# Remove the branch, locally and remotely
git branch -D feature-branch       # -D: after a rebase, -d refuses if the
                                   # branch was pushed (origin has old commits)
git push origin --delete feature-branch

--no-ff: no fast-forward. Always creates a merge commit, even when main could just move forward, so the branch's commits stay grouped and you can see where the branch started and ended.

Squash a feature into one commit

--squash stages all changes from a branch into the current branch, without committing. Good when the feature is complete and its history is noisy ("fix", "typo"). Main gets one commit; the branch's own commits are dropped.

git switch main
git pull --ff-only
git merge --squash feature-branch
git commit -m "add feature ..."    # or plain git commit: lists squashed commits
git push

# Remove the branch, locally and remotely (-D: its commits never reach main)
git branch -D feature-branch
git push origin --delete feature-branch

Tidy a branch's history

Squash or reword commits like "fix" and "typo" before merging. Rewrites history, so only on a branch nobody else works on.

git rebase -i main          # pick / squash / fixup / reword / drop
git push --force-with-lease # refuses if someone else pushed meanwhile

R

Defined in shell/aliases.sh.

Command Expands to Notes
R R --no-save --no-restore Stateless interactive R; Ctrl-D quits without the save prompt. Interactive only — pass flags explicitly in batch jobs.

Slurm

Defined in shell/aliases.sh.

Command Expands to Notes
jobinfo squeue -u $USER Your jobs
jobinfo_full squeue -u $USER -o "..." | column -t | less -FRXS Wide, scrollable job table

Listing

Defined in shell/aliases.sh. GNU ls (Linux/HPC) groups directories first and sorts naturally; BSD ls (macOS) gets the closest equivalent.

Command Does
ll Long listing, human-readable sizes
lt Long listing by modification time, newest last
la Long listing including hidden files
du du -sh (total size, human-readable)

Environment variables

Defined in shell/exports.sh: container image URIs for analysis environments (RNASEQ_SIF, GO_SIF, METHYL_ENV, EDGER_SIF).

Prompt

Defined in shell/prompt.sh.

Shows the current git branch (or short commit hash when detached), works in zsh and bash.

[user@machine ~] (main) $

Neovim

Config lives in nvim/ and is symlinked to ~/.config/nvim by install.sh. Provides syntax highlighting for bash, R, and Nextflow, plus the nightfly colorscheme.

Requirements

  • Neovim 0.9+ (uses vim.filetype.add and modern Lua APIs).
  • A true-color terminal — nightfly is true-color only. On macOS use iTerm2, kitty, WezTerm, or Ghostty (Terminal.app does not do full 24-bit color). termguicolors is already enabled in init.lua.
  • A C compiler for Treesitter parser compilation. On macOS: xcode-select --install.

First launch

  1. Open nvim. lazy.nvim bootstraps itself and installs the plugins automatically (you'll see the install UI).
  2. Treesitter compiles the bash/r/groovy/lua parsers. If it doesn't run automatically, run :TSUpdate.
  3. Restart nvim.

On HPC, run the first launch on a login node (which has network access) so plugins and parsers download; compute nodes are often offline.

Notes

  • Treesitter is pinned to its master branch — the newer main branch is an incompatible rewrite with a different API.
  • If highlighting looks wrong or plugins seem stuck, reset the cache: rm -rf ~/.local/share/nvim/lazy/nvim-treesitter then reopen nvim.

Configs

Tmux

  • Mouse on; new panes open in the current directory
  • Switch panes using Ctrl+hjkl (vim-style) without prefix
  • vi copy mode: v to select, y to copy to the clipboard, prefix P to paste. Copies with pbcopy (macOS); see the comment in tmux.conf for Linux

R

Rprofile sets the CRAN mirror (mirror.accum.se).

Machine-local config

Per-machine values live in ~/.dotfiles.local, which is not tracked in git. install.sh creates it from dotfiles.local.template; uncomment and fill in what you need on each machine:

Variable Used by
ACCOUNT Slurm account: salloc, checksum_verify
EMAIL Your own scripts (not used by the dotfiles themselves)
NEXTFLOW_MODULE Module(s) nflog / nfclean load if nextflow is missing
PROJECT Project folder for the Apptainer cache/tmp paths below
APPTAINER_BIND, cache/tmp dirs Apptainer/Singularity (optional)

To create it by hand:

cp dotfiles.local.template ~/.dotfiles.local

Uninstall

Remove the marked block from ~/.bashrc (and ~/.zshrc):

# >>> dotfiles >>>
...
# <<< dotfiles <<<

or restore the backup install.sh made:

cp ~/.bashrc.backup ~/.bashrc

Then remove the symlinks (~/.tmux.conf, ~/.Rprofile, ~/.config/nvim) and restore any *.backup files next to them.

About

aliasas and functions for nextflow, git and QoL

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages