GitXplorerGitXplorer
k

vcd.fish

public
3 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
408c6bb8fc6c529b89244d107a2895afd8a5e2a7

Update README.md

committed 3 years ago
Unverified
58436ac12cc76c33f68d535d38e80f34cc57e143

Add VCD_IGNORE_PATTERNS

committed 3 years ago
Unverified
21522a024d3c46381b3221840d06e9e993ebe0e3

Add a warning message

committed 3 years ago
Unverified
7ab53b4c295db86e7a9563c4027852d51928279f

Add path mode

committed 3 years ago
Unverified
828316391bb063b318d44ae40d692c8de5eb8433

Check directory existence

committed 3 years ago
Unverified
9dc15367a85d2d073be746121e07039f24bba5a2

Refactor

committed 3 years ago

README

The README file for this repository.

vcd.fish

vcstool-cd for fish-shell

Prerequisites

Using apt (Ubuntu 20.04)

sudo apt install fzf fd-find jq
sudo ln -snfv /usr/bin/fdfind /usr/bin/fd

Using Homebrew / Linuxbrew

brew install fzf fd jq

Installation

Using fisher (recommended)

fisher install kenji-miyake/vcd.fish

Using local-install script (for development)

git clone git@github.com:kenji-miyake/vcd.fish.git
cd vcd.fish
./install

Usage

This package provides vcd and ccd commands for workspaces set up by vcstool.

vcd

vcd is a command for moving to vcs repositories in a workspace.

cd {vcstool_workspace_dir}
vcd <Tab>
# or use Ctrl-V key bindings

vcd.gif

This command reads setting files to find repositories and supports two modes.

  1. repos: use .repos files to find directories
  2. workspace: use .code-workspace files to find directories

To switch the mode, set $VCD_MODE.

# To use repos mode (default)
set -U VCD_MODE repos

# To use workspace mode
set -U VCD_MODE code-workspace

# To use gitmodules mode
set -U VCD_MODE gitmodules

# To use path mode
set -U VCD_MODE path

Note

To use code-workspace mode, you need to prepare .code-workspace file. It can be generated from .repos file using repos2workspace.py.

cd vcd.fish
wget -P /tmp https://raw.githubusercontent.com/kenji-miyake/vscode-utils/main/repos2workspace.py
python3 /tmp/repos2workspace.py {path-to-your-repos-file}

Note

To use gitmodules mode, you need to prepare .gitmodules file. It can be generated from .repos file using repos2gitmodules.py.

cd vcd.fish
wget -P /tmp https://raw.githubusercontent.com/kenji-miyake/vscode-utils/main/repos2gitmodules.py
python3 /tmp/repos2gitmodules.py {path-to-your-repos-file}

To filter the results, set VCD_IGNORE_PATTERNS.

set -U VCD_IGNORE_PATTERNS ".*\/vendor\/|.*\/tmp\/"

ccd

ccd is a command for moving to colcon packages in a workspace.

cd {vcstool_workspace_dir}
ccd -s <Tab> # To move under src directory
ccd -i <Tab> # To move under install directory
ccd <Tab> # To move according to the default mode
# or use Ctrl-Alt-V key bindings

ccd.gif

To switch the default mode, set $CCD_DEFAULT_MODE.

# To use src mode (default)
set -U CCD_DEFAULT_MODE src

# To use install mode
set -U CCD_DEFAULT_MODE install

Tips

Using from outside of workspaces

This tool can find workspaces based on $COLCON_PREFIX_PATH or $CMAKE_PREFIX_PATH.
If you source setup.bash, you can use commands from outside of workspaces.

bass source {vcstool_workspace_dir}/install/setup.bash
# use commands from everywhere

colcon-workspace.gif

Disable key bindings

If you'd like to disable key bindings, set VCD_DISABLE_KEYBINDINGS and/or CCD_DISABLE_KEYBINDINGS.

set -U VCD_DISABLE_KEYBINDINGS
set -U CCD_DISABLE_KEYBINDINGS

To re-enable,

set -e VCD_DISABLE_KEYBINDINGS
set -e CCD_DISABLE_KEYBINDINGS