Git Product home page Git Product logo

workspaces-rs's Introduction

Workspaces-rs

This project is a simple command-line utility to easily switch between directories in your OS.

Once you're in a project directory, you can add it as a workspace, and then use a fuzzy finder to open it. Since no process is allowed to modify the working directory of the terminal it runs on, this program saves the chosen workspace in a text file, that can be then used as a parameter for the cd command. This README shows a simple way to do this both on Windows and Linux.

preview of the workspaces program that shows how fast you can switch folders

Installation

You can install this application only through the following command:

cargo install workspaces-rs

This will build and install the executable in the ~/.cargo/bin directory.

If you're running linux, you will need libx11-dev to build this project, since it's a dependency for the ruscii library (here it shows how to install it).

You can check if the application is installed and if it's in the PATH by running the following command:

workspaces --help

When run without commands, the program will allow you to fuzzy-find the project you want to go to. However, as said above, you will need to create a shortcut to change the working directory of the terminal. Here's how to do it

Windows shortcut

In windows, if you're using Powershell, you can create the following file that will act as your profile configuration: ~\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1.

Then, you can type this function to create the shortcut:

function w {
    workspaces
    if (test-path "~/AppData/Roaming/workspaces-rs/result.txt") {
        cd (& cat ~/AppData/Roaming/workspaces-rs/result.txt)
    }
}

Now, you can just type w to fuzzy-find between your workspaces.

Linux shortcut

Similarly, you can add the following function in the ~/.bashrc file:

w () {
    workspaces
    if test -f ~/.config/workspaces-rs/result.txt
    then
        cd "$(cat ~/.config/workspaces-rs/result.txt)"
    fi
}

Usage

Adding workspaces

You can add a new workspace by navigating in the terminal to the directory you want to save, and then using the following command:

workspaces add [workspace-name]

Replace [workspace-name] with the name you want for this directory.

Removing workspaces

You can remove a workspace by name with this command:

workspaces remove [workspace-name]

Listing workspaces

If you want to see a list of the workspaces you saved, but without navigating to any of them, you can use this command:

workspaces list

Chosing a workspace

After adding the shortcuts shown in the Installation section, you can open the picker by typing w in the terminal. You will see a list of folders. when you type, the most similar name will be on top. You can also navigate with the Up and Down arrows to select a workspace that isn't on top. The currently selected workspace is highlighted in yellow.

You can choose a workspace by pressing Enter or quit the program by pressing Esc.

workspaces-rs's People

Contributors

andreadev-it avatar

Stargazers

 avatar

Watchers

 avatar

workspaces-rs's Issues

Add tests

There isn't much to test here, but it might still be useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.