Skip to content

narnaud/clink-terminal

Repository files navigation

Clink Setup

This repository contains a clink setup to be used with Windows Terminal.

Installation

Via Scoop (preferred)

The easiest way to get started is to install scoop for all the dependencies.

  1. Install Scoop

Open a powershell terminal:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
  1. Install a nerd font for the terminal (Cascadia Code here, but any other nerd font will work)
scoop bucket add nerd-fonts
scoop install cascadiacode-nf
  1. Install clink-terminal
scoop bucket add narnaud https://github.com/narnaud/scoop-bucket
scoop install clink-terminal narnaud/clink-completions narnaud/clink-flex-prompt

Or via zip file

  1. Go to the Releases page
  2. Download the latest clink-terminal.zip file
  3. Extract the files from it into a directory.

Terminal integration

  • open the Terminal
  • go to the settings
  • pick the Command Prompt settings
  • change the command line to cmd.exe /s /k clink-terminal

Also go to the Defaults and change the Appearance>Font face to CaskaydiaCove Nerd Font.

Features

Prompt

The first time you start clink-terminal, it will show something like that:

To configure a new prompt, run the configruation wizard with:

flexprompt configure

Note

Probably one of the best feature of the prompt is that the git status is asynchrone, so you never have to wait for it to finish before being able to enter a command.

Aliases

The configuration has some aliases already, but you are free to add more by creating a %USERPROFILE%\.alias.json, here is an example file:

{
    "l": "git log --graph --pretty=format:\"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset\" --abbrev-commit --date=relative",
    "s": "git status",
    "d": "git diff",
    "more": "bat -f -p",
    "np": "\"C:\\Program Files\\Notepad++\\notepad++.exe\"",
    "xhost": "sudo code C:\\Windows\\tem32\\Drivers\\etc\\hosts",
}

Fuzzy finder

fzf is integrated all the way into this current terminal configuration. The default shortcuts are:

  • Ctrl+T: lists files recursively; choose one or multiple to insert them,
  • Ctrl+R: lists history entries; choose one to insert it,
  • Alt+C: lists subdirectories; choose one to 'cd /d' to it,
  • Alt+B: lists key bindings; choose one to invoke it,
  • Ctrl+Space: uses fzf to filter match completions (and supports '**' for recursive)

It's also used for more advanced views (Ctrl+\ will change the preview position or hide it):

  • Ctrl+E: explorer like view, with directory or file previews
  • Ctrl+G,Ctr+F: git status, with diff for each file
  • Ctrl+G,Ctr+S: git stashes list, with diff for each file
  • Ctrl+G,Ctr+H: git log, with diff for each hash
  • Ctrl+G,Ctr+B: git branches, with log for each branch

Terminal title

If you set the terminal.update_title settings to true, you can change the terminal title based on the current folder and git branch.

clink set terminal.update_title true

Once done, the terminal title will change:

  • if it's a normal folder: "folder_name"
  • if it's a git folder: "git_topfolder_name - [branch_name]"

Other tools

It comes with other nice tools:

  • bat: a better cat with syntax highlighting
  • fd: find files in your filesystem
  • rg (ripgrep): recursive search pattern in directories
  • z (zoxide): a smarter cd command

Recommendations

Tools you should install:

  • jq: lightweight and flexible command-line JSON processor
  • use: command line tool to setup environment defined in a json file
  • yazi: blazing fast terminal file manager written in Rust, based on async I/O

To install those:

scoop install use yazi

clink-terminal comes y shell wrapper that provides the ability to change the current working directory when exiting Yazi:

  • Q will exit and change the current working directory
  • shift-Q` will exit without changing the current working directory

Third parties

This won't be possible without the help of those giants: