From 57be352ba5f754f5c8c4f511546f208faad29ff7 Mon Sep 17 00:00:00 2001 From: Nguyen Ngoc Long <43560378+nguyenngoclongdev@users.noreply.github.com> Date: Tue, 5 Nov 2024 07:24:52 +0000 Subject: [PATCH] fix: add quick config on terminal tabs --- .changeset/brown-kids-serve.md | 5 ++ CHANGELOG.md | 2 - docs/.vitepress/config.ts | 97 ++++++++++++------------ docs/.vitepress/navbars.ts | 16 ++-- docs/guide/getting-started.md | 107 ++++++++++++++++++++++---- docs/guide/introduction.md | 39 +++++++--- docs/index.md | 2 +- docs/manage/configuration.md | 132 ++++++++++++++++++++++----------- docs/manage/personalization.md | 4 +- docs/more/changelog.md | 3 + docs/more/faq.md | 6 +- docs/more/thanks.md | 5 -- package.json | 25 ++++++- 13 files changed, 300 insertions(+), 143 deletions(-) create mode 100644 .changeset/brown-kids-serve.md create mode 100644 docs/more/changelog.md diff --git a/.changeset/brown-kids-serve.md b/.changeset/brown-kids-serve.md new file mode 100644 index 0000000..1f0dfbf --- /dev/null +++ b/.changeset/brown-kids-serve.md @@ -0,0 +1,5 @@ +--- +"terminal-keeper": patch +--- + +add quick config on terminal tabs diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c1c3d7..94fac59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,3 @@ -# Terminal Keeper - ## 1.1.51 ### Patch Changes diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 3671c6e..0c93c2b 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -1,52 +1,55 @@ -import { defineConfig } from "vitepress"; -import * as navbars from "./navbars"; -import * as sidebars from "./sidebars"; +import { defineConfig } from 'vitepress'; +import * as navbars from './navbars'; +import * as sidebars from './sidebars'; // https://vitepress.dev/reference/site-config export default defineConfig({ - title: "Terminal Keeper", - description: - "Elevate your terminal experience! Effortlessly configuration, seamlessly restore your last session, and manage sessions with ease. Personalize your workspace with colorful themes and boost productivity by importing commands swiftly.", - base: '/vs-terminal-keeper/', - head: [ - ["link", { rel: "icon", type: "image/png", href: "./assets/logo.png" }], - ], - lastUpdated: true, - locales: { - root: { - label: "English", - lang: "en-US", - themeConfig: { - nav: navbars.en, - sidebar: sidebars.en, - }, + title: 'Terminal Keeper', + description: + 'Elevate your terminal experience! Effortlessly configuration, seamlessly restore your last session, and manage sessions with ease. Personalize your workspace with colorful themes and boost productivity by importing commands swiftly.', + base: '/vs-terminal-keeper/', + head: [['link', { rel: 'icon', type: 'image/png', href: './assets/logo.png' }]], + lastUpdated: true, + locales: { + root: { + label: 'English', + lang: 'en-US', + themeConfig: { + nav: navbars.en, + sidebar: sidebars.en + } + } }, - }, - themeConfig: { - // https://vitepress.dev/reference/default-theme-config - logo: "./assets/logo.svg", - search: { - provider: "local", - }, - socialLinks: [ - { - icon: "github", - link: "https://github.com/nguyenngoclongdev/vs-terminal-keeper", - }, - // { icon: "twitter", link: "https://twitter.com/vs-terminal-keeper" }, - ], - editLink: { - pattern: 'https://github.com/nguyenngoclongdev/vs-terminal-keeper/edit/main/docs/:path' - }, - // carbonAds: { - // code: 'your-carbon-code', - // placement: 'your-carbon-placement' - // }, - footer: { - message: - 'Released under the MIT License.', - copyright: - 'Copyright © 2022 Nguyen Ngoc Long', - }, - }, + themeConfig: { + // https://vitepress.dev/reference/default-theme-config + logo: './assets/logo.svg', + search: { + provider: 'local' + }, + socialLinks: [ + { + icon: 'github', + link: 'https://github.com/nguyenngoclongdev/vs-terminal-keeper' + }, + { + icon: { + svg: '' + }, + link: 'https://marketplace.visualstudio.com/items?itemName=nguyenngoclong.terminal-keeper' + } + // { icon: "twitter", link: "https://twitter.com/vs-terminal-keeper" }, + ], + editLink: { + pattern: 'https://github.com/nguyenngoclongdev/vs-terminal-keeper/edit/main/docs/:path' + }, + // carbonAds: { + // code: 'your-carbon-code', + // placement: 'your-carbon-placement' + // }, + footer: { + message: + 'Released under the MIT License.', + copyright: 'Copyright © 2022 Nguyen Ngoc Long' + } + } }); diff --git a/docs/.vitepress/navbars.ts b/docs/.vitepress/navbars.ts index 21deee3..2a0dcc4 100644 --- a/docs/.vitepress/navbars.ts +++ b/docs/.vitepress/navbars.ts @@ -21,18 +21,18 @@ const en = [ text: "Reference", link: "/manage/configuration", }, + { + text: "Changelog", + link: "/more/changelog", + }, { text: getVersion(), items: [ - { - text: "Changelog", - link: "https://github.com/nguyenngoclongdev/vs-terminal-keeper/blob/main/CHANGELOG.md", - }, { text: "Contribute", link: "/contribute/core" }, - { - text: "VSCode Marketplace", - link: "https://marketplace.visualstudio.com/items?itemName=nguyenngoclong.terminal-keeper", - }, + // { + // text: "VSCode Marketplace", + // link: "https://marketplace.visualstudio.com/items?itemName=nguyenngoclong.terminal-keeper", + // }, { text: "Open VSX", link: "https://open-vsx.org/extension/nguyenngoclong/terminal-keeper", diff --git a/docs/guide/getting-started.md b/docs/guide/getting-started.md index 0cb097a..75c1fe8 100644 --- a/docs/guide/getting-started.md +++ b/docs/guide/getting-started.md @@ -1,30 +1,107 @@ # Getting Started +Setting up **Terminal Keeper** is quick and easy. Follow these steps to get started in no time! + ## Installation -1. Open VSCode. -2. Navigate to the Extensions view by clicking on the Extensions icon in the Activity Bar or using the shortcut Ctrl+Shift+X. -3. Search for Terminal Keeper in the search bar. -4. Click Install next to the Terminal Keeper extension by Nguyen Ngoc Long. -5. Once installed, reload VSCode to activate the extension. +1. Open Visual Studio Code. +2. Open the Extensions View (Shift+Cmd+P or F1 and type "Extensions: Install Extensions") or (Shift+Cmd+X) +3. Type `Terminal Keeper` +4. Click `Install` -Alternatively, you can install Terminal Keeper via: +Alternatively, you can install the extension directly from: - [VSCode Marketplace](https://marketplace.visualstudio.com/items?itemName=nguyenngoclong.terminal-keeper) - [Open VSX](https://open-vsx.org/extension/nguyenngoclong/terminal-keeper) -## Usage +Or: + +1. Open a command-line prompt +2. Run `code --install-extension nguyenngoclong.terminal-keeper` + +Once installed, **Terminal Keeper** will appear in your VSCode environment, ready for configuration. + +## Using Terminal Keeper + +After installation, you can start using **Terminal Keeper** right away. Here's a quick guide to help you get up and running: ![Activate the last used terminal session](https://github.com/nguyenngoclongdev/cdn/raw/HEAD/images/terminal-keeper/active-default-session.gif) The following features will help you get started: -1. Open the Command Palette using Ctrl + Shift + P (Windows) or Cmd + Shift + P (macOS). -2. Type Terminal Keeper and select your desired action, such as: - - Generate Configuration - - Open Configuration - - Activate Session - - Import Session - - Remove Session +1. Open the Command Palette using `Ctrl + Shift + P` on Windows or `Cmd + Shift + P` on macOS. +2. Type **Terminal Keeper** and select your desired action, such as: + - **Generate Configuration**: Set up the extension by creating a default configuration. + - **Open Configuration**: Open the configuration. + - **Activate Session**: Open a specific session you’ve saved. + - **Import Session**: Import terminal settings from files. + - **Remove Session**: Delete any session you no longer need. + - **Kill All**: Kill all terminals. + - **Abort All**: Abort all terminals. + - **Clear All**: Clear all terminals. + +### First-Time Setup + +When you first use **Terminal Keeper**, you’ll be prompted to create a configuration. Accept this prompt to generate a sessions.json configuration file in the `.vscode` directory. This file will store your terminal settings. + + +## Configuration + +**Terminal Keeper** uses a configuration file named `sessions.json` (located in the `.vscode` folder). This file defines the structure, commands, and visual aspects of your terminal sessions. + +### Basic Configuration Example: + +Here’s an example configuration template for `sessions.json`: + +```json +{ + "active": "default", + "activateOnStartup": true, + "keepExistingTerminals": true, + "theme": "Dice", + "sessions": { + "default": [ + { + "name": "Server", + "commands": ["npm run dev"] + }, + [ + { + "name": "API Server", + "commands": ["npm run api"] + }, + { + "name": "Frontend Server", + "commands": ["npm start"] + } + ] + ] + } +} +``` + +### Explanation of Key Settings: + +- `active`: Specifies the default session to be activated (e.g., "default"). +- `activateOnStartup`: If true, the default session starts when VSCode launches. +- `keepExistingTerminals`: Determines if existing terminals should remain open when a session starts. +- `theme`: Choose a theme for session colors and icons (e.g., "Dice" for random themes). +- `sessions`: Defines your terminal sessions and their configurations. + +You can explore more [advanced configurations](../manage/configuration.md) as you grow familiar with Terminal Keeper! + +### Adding Multiple Commands and Terminals + +Each terminal can have its own name and commands. Use the following settings for individual terminals within a session: + +- `name`: Display name for each terminal (e.g., "Frontend"). +- `commands`: List of commands to run in the terminal (e.g., ["npm start"]). + +## Next Steps + +Now that you're set up, here are a few things you can explore next: +- Personalize your terminal themes to match your style. +- Manage multiple sessions across different projects effortlessly. +- Speed up your workflow with the command import feature. -> If this is your first time using Terminal Keeper, you'll be prompted to generate a configuration. Choose "Yes" to create and customize your settings. +For more detailed usage and tips, check out our [FAQ](https://github.com/nguyenngoclongdev/vs-terminal-keeper/issues) or visit the [GitHub repository](https://github.com/nguyenngoclongdev/vs-terminal-keeper). \ No newline at end of file diff --git a/docs/guide/introduction.md b/docs/guide/introduction.md index 4199df9..3b69a2a 100644 --- a/docs/guide/introduction.md +++ b/docs/guide/introduction.md @@ -1,17 +1,32 @@ # Introduction -[![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/nguyenngoclong.terminal-keeper)](https://marketplace.visualstudio.com/items?itemName=nguyenngoclong.terminal-keeper) -[![Open VSX Installs](https://img.shields.io/open-vsx/dt/nguyenngoclong/terminal-keeper?color=%2396C41F&label=open-vsx)](https://open-vsx.org/extension/nguyenngoclong/terminal-keeper) -[![Visual Studio Marketplace Installs](https://img.shields.io/visual-studio-marketplace/i/nguyenngoclong.terminal-keeper?label=vs-marketplace)](https://marketplace.visualstudio.com/items?itemName=nguyenngoclong.terminal-keeper) -[![Visual Studio Marketplace Downloads](https://img.shields.io/visual-studio-marketplace/d/nguyenngoclong.terminal-keeper)](https://marketplace.visualstudio.com/items?itemName=nguyenngoclong.terminal-keeper) -[![Visual Studio Marketplace Rating (Stars)](https://img.shields.io/visual-studio-marketplace/stars/nguyenngoclong.terminal-keeper)](https://marketplace.visualstudio.com/items?itemName=nguyenngoclong.terminal-keeper) -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/nguyenngoclongdev/vs-terminal-keeper/blob/main/LICENSE) +## What is Terminal Keeper -`Terminal Keeper` is a Visual Studio Code (VSCode) extension designed to enhance your terminal experience. It allows for easy configuration, session restoration, and command management within your terminal. The extension offers personalization options through colorful themes and provides efficiency by enabling quick command imports. +**Terminal Keeper** is an extension for Visual Studio Code (VSCode) that enhances terminal management by allowing users to create, save, and restore multiple terminal sessions with custom configurations. It’s especially useful for developers working with multi-terminal setups and recurring commands, enabling efficient workflow organization within VSCode. -## Why use Terminal Keeper? +:::tip +Just want to try it out? Skip to the [Quickstart](getting-started.md). +::: -- Effortless Configuration: Customize your terminal environment with minimal effort. -- Session Management: Seamlessly restore your last terminal session and manage multiple sessions. -- Personalization: Apply colorful themes to make your terminal more visually appealing. -- Command Imports: Swiftly import commonly used commands to boost productivity. +## Why Terminal Keeper? + +- Easy Setup: Quickly configure and manage terminal sessions. +- Productivity Boost: Automatically restores your previous session, imports commands, and customizes themes to suit your workflow. +- Streamlined Experience: Simplifies switching between terminal sessions and supports multiple configurations per project. +- Personalize: Customizable themes, making it easier to work in a terminal that suits your preferences. + +## Who is it for? + +**Terminal Keeper** is perfect for developers who frequently use the terminal in VSCode and need better control over their terminal workflows. Whether you're a solo developer or part of a larger team, **Terminal Keeper** offers the tools to improve your development experience by making session and terminal management more intuitive and less time-consuming. + +## Key Features + +- **Automatic Session Restoration**: Automatically restore your last terminal session when reopening VSCode, saving you time setting up each day. +- **Quick Run Button**: Adds a button to the terminal interface for quickly running commands. +- **Session Management**: + - Save, restore, and organize multiple terminal sessions. + - Easily select or remove specific sessions. +- **Theme Customization**: Personalize terminal sessions with different colors and icons. +- **Command Importing**: Import commands from popular files like package.json, Makefile, pipenv, and others. + +Whether you're a seasoned VSCode user or just getting started, **Terminal Keeper** is here to streamline your terminal management, letting you focus on what really matters—coding! \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 8fe69ab..72b3626 100644 --- a/docs/index.md +++ b/docs/index.md @@ -171,7 +171,7 @@ const members = [
-# Our wall of love +## Our wall of love See what the community is saying about Terminal Keeper. Share the love! diff --git a/docs/manage/configuration.md b/docs/manage/configuration.md index d699936..6e7cb91 100644 --- a/docs/manage/configuration.md +++ b/docs/manage/configuration.md @@ -8,9 +8,26 @@ ![Quick open configuration](https://github.com/nguyenngoclongdev/cdn/raw/HEAD/images/terminal-keeper/open-configuration.gif) -## Terminal Settings +## Advance Configuration + +For users seeking advanced customization, Terminal Keeper offers several additional settings. + +### Split-Terminal Setup + +Terminal Keeper allows splitting terminals within a session. Use nested arrays in the sessions.json configuration to specify terminals that open side-by-side. +```json +{ + "sessions": { + "custom": [ + [ + {"name": "Server", "commands": ["npm run server"]}, + {"name": "Database", "commands": ["npm run db"]} + ] + ] + } +} +``` -You can further configure Terminal Keeper through your VSCode settings. Below are some customizable options: ### Session Options @@ -126,51 +143,76 @@ strictEnv?: boolean, focus?: boolean ``` -## Example Configuration +::: details Click me to view example configuration ```jsonc { - "$schema": "https://cdn.statically.io/gh/nguyenngoclongdev/cdn/main/schema/v10/terminal-keeper.json", - "theme": "tribe", - "active": "default", - "activateOnStartup": true, - "keepExistingTerminals": false, - "sessions": { - "default": [ - { - "name": "hello", - "autoExecuteCommands": true, - "icon": "person", - "color": "terminal.ansiGreen", - "commands": ["echo hello"], - }, - [ - { - "name": "docker:ros", - "commands": [""], - }, - { - "name": "docker:k8s", - "commands": [""], - }, - ], - [ - { - "name": "docker:nats", - "commands": [""], - }, - { - "name": "docker:fleet", - "commands": [""], - }, - ], - ], - "saved-session": [ - { - "name": "connect", - "commands": [""], - }, - ], - }, + "$schema": "https://cdn.statically.io/gh/nguyenngoclongdev/cdn/main/schema/v10/terminal-keeper.json", + "theme": "neon", + "active": "default", + "activateOnStartup": true, + "keepExistingTerminals": true, + "sessions": { + "default": [ + { + "name": "workspace:frontend", + "autoExecuteCommands": true, + "icon": "folder-opened", + "color": "terminal.ansiCyan", + "commands": ["npm install", "npm start"] + }, + [ + { + "name": "workspace:backend", + "commands": ["npm run dev"] + }, + { + "name": "workspace:database", + "commands": ["mongo", "watch"] + } + ], + [ + { + "name": "workspace:docker", + "commands": ["docker-compose up -d"] + }, + { + "name": "workspace:tests", + "commands": ["npm test"] + } + ] + ], + "saved-session": [ + { + "name": "ssh:production", + "commands": ["ssh user@production-server"] + }, + { + "name": "ssh:staging", + "commands": ["ssh user@staging-server"] + } + ] + } } ``` + +::: + +## Workspace settings. + +Setting Section: settings.json + +::: warning +If you have a configuration in your user settings, we will prioritize reading and updating from there. If there's no configuration information in the user settings, we will read and update from the sessions file. +::: + +| Keys | Type | Description | Default | +| --------------------------------------- | :-----------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | ------: | +| `terminal-keeper.activateOnStartup` | boolean | Activated the session when Visual Studio Code starts up. | | +| `terminal-keeper.active` | string | Used to determine which session to use. | | +| `terminal-keeper.keepExistingTerminals` | boolean | Keep existing terminals open when a session is executed. | | +| `terminal-keeper.noClear` | boolean | A Boolean variable indicating whether to execute the clear command during initialization. If the value is true, the clear command will not be executed upon initialization. If the value is false, the clear command will be executed. | | +| `terminal-keeper.theme` | default, inkwell, chaos, tribe, iconic, neon, solarized, dice | The theme can either automatically select colors/icons or manually. | | +| `terminal-keeper.killProcess` | boolean | (Experimental) Kill the active process when the terminal is closed. | false | +| `terminal-keeper.wslSupport` | boolean | (Experimental) When enable, will convert wsl path to windows path when connect to WSL. | false | +| `terminal-keeper.quickRun` | boolean | Add a button to quick active session from the terminal tab. | true | diff --git a/docs/manage/personalization.md b/docs/manage/personalization.md index f8fd0b8..660c8cc 100644 --- a/docs/manage/personalization.md +++ b/docs/manage/personalization.md @@ -24,8 +24,8 @@ Choose between randomly assigned colors and icons based on the terminal name or "default": [ { "name": "dev", - "icon": "account", // 👈 add this line - "color": "terminal.ansiBlue", // 👈 add this line + "icon": "account", // [!code focus] + "color": "terminal.ansiBlue", // [!code focus] "commands": [] } ] diff --git a/docs/more/changelog.md b/docs/more/changelog.md new file mode 100644 index 0000000..6a56342 --- /dev/null +++ b/docs/more/changelog.md @@ -0,0 +1,3 @@ +# Changelog + + \ No newline at end of file diff --git a/docs/more/faq.md b/docs/more/faq.md index 3d52b1d..f166708 100644 --- a/docs/more/faq.md +++ b/docs/more/faq.md @@ -28,7 +28,7 @@ To stop the terminal from clearing on startup, modify the `session.json` file by ```json { "active": "default", - "noClear": true, // 👈 add this line + "noClear": true, // [!code focus] "sessions": {...} } ``` @@ -48,7 +48,7 @@ If you have multiple terminal splits and want to focus on a specific one when a "default": [ { "name": "dev", - "focus": true, // 👈 add this line + "focus": true, // [!code focus] "commands": [] } ] @@ -67,7 +67,7 @@ You can customize the join operator between commands using the `joinOperator` op "default": [ { "name": "dev", - "joinOperator": "&&", // 👈 add this line + "joinOperator": "&&", // [!code focus] "commands": ["npm run build", "npm run dev"] } ] diff --git a/docs/more/thanks.md b/docs/more/thanks.md index 992afef..e29190f 100644 --- a/docs/more/thanks.md +++ b/docs/more/thanks.md @@ -23,8 +23,3 @@ See the [list of contributors](https://github.com/nguyenngoclongdev/vs-terminal- ## Sponsor If you find this extension useful for your projects, please consider supporting me by [Github](https://github.com/sponsors/nguyenngoclongdev), [Patreon](https://patreon.com/nguyenngoclong), [KO-FI](https://ko-fi.com/nguyenngoclong) or [Paypal](https://paypal.me/longnguyenngoc). It's a great way to help me maintain and improve this tool in the future. Your support is truly appreciated! - -[![Github](https://img.shields.io/badge/Github-F15689?style=for-the-badge&logo=github&logoColor=white)](https://github.com/sponsors/nguyenngoclongdev) -[![Patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://patreon.com/nguyenngoclong) -[![KO-FI](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/nguyenngoclong) -[![Paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/longnguyenngoc) diff --git a/package.json b/package.json index 88e076a..115e727 100644 --- a/package.json +++ b/package.json @@ -257,6 +257,11 @@ } ], "view/title": [ + { + "command": "terminal-keeper.active", + "when": "view == terminal && config.terminal-keeper.quickRun == true", + "group": "navigation" + }, { "command": "terminal-keeper.active", "when": "view == terminalKeeperActivityView", @@ -380,7 +385,7 @@ "default": null, "enum": [ "default", - "inkwell", + "inkwell", "chaos", "tribe", "iconic", @@ -393,12 +398,26 @@ "terminal-keeper.killProcess": { "type": "boolean", "default": false, - "description": "(Experimental) Kill the active process when the terminal is closed." + "description": "Kill the active process when the terminal is closed.", + "tags": [ + "preview" + ] }, "terminal-keeper.wslSupport": { "type": "boolean", "default": false, - "description": "(Experimental) When enable, will convert wsl path to windows path when connect to WSL." + "description": "When enable, will convert wsl path to windows path when connect to WSL.", + "tags": [ + "experimental" + ] + }, + "terminal-keeper.quickRun": { + "type": "boolean", + "default": true, + "description": "Add a button to quick active session from the terminal tab.", + "tags": [ + "preview" + ] } } }