Как открыть терминал в atom

Обновлено: 05.07.2024

Because of the bug of pty.js , the environment variables in the terminal can not be changed(At least in Windows). This new package uses node-pty instead of pty.js to fix the bug mentioned above. And you can run npm install --save-dev foo correctly in atom-ide-terminal .

Install

Ready to install?

You can install via apm: apm install atom-ide-terminal

Or navigate to the install tab in Atom’s settings view, and search for atom-ide-terminal .

Usage

atom-ide-terminal stays in the bottom of your editor while you work.

Click on a status icon to toggle that terminal (or ctrl-` ). Right click the status icon for a list of available commands. From the right-click menu you can color code the status icon as well as hide or close the terminal instance.

Terminal

You can open the last active terminal with the atom-ide-terminal:toggle command (Default: ctrl-` ). If no terminal instances are available, then a new one will be created. The same toggle command is used to hide the currently active terminal.

From there you can begin typing into the terminal. By default the terminal will change directory into the project folder if possible. The default working directory can be changed in the settings to the home directory or to the active file directory.

Features

Full Terminal

Every terminal is loaded with your system’s default initialization files. This ensures that you have access to the same commands and aliases as you would in your standard terminal.

Themes

The terminal is preloaded with several themes that you can choose from. Not satisfied?
Use the following template in your stylesheet:

Process Titles

By hovering over the terminal status icon, you can see which command process is currently running in the terminal.


Terminal Naming

Need a faster way to figure out which terminal is which? Name your status icons!

Available via the status icon context menu.

Color Coding

Color code your status icons!

The colors are customizable in the settings, however the color names remain the same in the context menu.

Sorting

Organize your open terminal instances by dragging and dropping them.

Resizable

You can resize the view vertically, or just maximize it with the maximize button.

Working Directory

You can set the default working directory for new terminals. By default this will be the project folder.

File Dropping

Dropping a file on the terminal will insert the file path into the input. This works with external files, tabs from the Atom tab-view, and entries from the Atom tree-view.

Insert Selected Text

Insert and run selected text from your text editor by running the atom-ide-terminal:insert-selected-text command ( ctrl-enter ).

If you have text selected, it will insert your selected text into the active terminal and run it.
If you don't have text selected it, will run the text on the line where your cursor is then proceed to the next line.

Quick Command Insert

Quickly insert a command to your active terminal by executing the atom-ide-terminal:insert-text command.


A dialog will pop up asking for the input to insert. If you have the Run Inserted Text option enabled in the settings (default is false), atom-ide-terminal will automatically run the command for you.

Support for Special Keys

Support for IME, dead keys and other key combinations via the Insert Text dialog box. Just click the keyboard button in the top left of the terminal or set up a keymap to the atom-ide-terminal:insert-text command.

Note: Make sure you have the Run Inserted Command toggle off otherwise it will run your inserted text.

Map Terminal To

Map your terminals to each file or folder you are working on for automatic terminal switching.

Folder

Toggling the Auto Open a New Terminal (For Terminal Mapping) option will have the mapping create a new terminal automatically for files and folders that don't have a terminal. The toggle is located right under the Map Terminals To option.

Commands

Command Action Default Keybind
atom-ide-terminal:new Create a new terminal instance. ctrl-shift-t or cmd-shift-t
atom-ide-terminal:toggle Toggle the last active terminal instance.Note: This will create a new terminal if it needs to. ctrl-` (Control + Backtick)
atom-ide-terminal:prev Switch to the terminal left of the last active terminal. ctrl-shift-j or cmd-shift-j
atom-ide-terminal:next Switch to the terminal right of the last active terminal. ctrl-shift-k or cmd-shift-k
atom-ide-terminal:insert-selected-text Run the selected text as a command in the active terminal. ctrl-enter
atom-ide-terminal:insert-text Bring up an input box for using IME and special keys. ––––––––––––
atom-ide-terminal:fullscreen Toggle fullscreen for active terminal. ––––––––––––
atom-ide-terminal:close Close the active terminal. ctrl-shift-x or cmd-shift-x
atom-ide-terminal:close-all Close all terminals. ––––––––––––
atom-ide-terminal:rename Rename the active terminal. ––––––––––––

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

Моя обычная процедура для открытия проекта в редакторе Atom в Windows - это перейти в каталог с помощью терминала Git Bash и набрать atom . . Это откроет все содержимое каталога в Atom.

После недавнего обновления Windows, когда я набираю atom . , я теперь вижу это:

Это мигающая командная строка. Является ли базовое командное окно Windows принятым с терминала Git Bash, который я использую?

Когда я ввожу только atom в терминал, редактор Atom открывается как обычно.

Когда я ввожу explorer . , он работает просто отлично (открывает окно проводника в текущем каталоге).

Когда я открываю Windows PowerShell и ввод atom . , происходит правильное поведение.

Я использую atom.io с пакетом go-plus для разработки golang.
Обычно я запускаю основной пакет с командой "Голан: запускать пакет", но он исчез недавно, и я не знаю, есть ли другой способ сделать это отдельно от этого.

Любая помощь будет приятной.

спросил(а) 2020-03-09T18:02:46+03:00 1 год, 7 месяцев назад

С дополнительными плагинами:

Как только вы установите его, просто нажмите ALT+R , чтобы запустить файл. Обратите внимание, что это может вступать в противоречие с функциональностью переименования плагина go-plus. Вы можете изменить любую привязку клавиш в настройках Atom (измените одну из них, чтобы она была уникальной по вашему вкусу). Если вы не хотите менять привязки клавиш, вы можете использовать командную палитру Atom: нажмите CTRL+SHIFT+P , затем введите "run" или "run file", и это будет первый или второй элемент.

Установка этого дает вам внутренний терминал. Нажмите значок плюса внизу, который открывает терминал. Вы можете настроить его так, чтобы он открывал терминал, работающий непосредственно с текущим файлом, поэтому после этого вам нужно всего лишь набрать go run xx.go Вы также можете "быстро открыть" терминал, нажав ALT+SHIFT+T .

Примечание: platformio-ide-Terminal - это форк терминала plus, который не работал для меня (и, как сообщается, для других).

(a fork of super-awesome atom package - thedaniel/terminal-panel) Plugin for ATOM Editor.

Short note

This project uses jquery-autocomplete-js for autocompletion.

Development

This project is in alpha stage. Please contribute this project if you liked it. All the help is welcome. Thank you.

Usage

Just press shift-enter or just Ctrl + ` (control + backtick) and enjoy your cool ATOM terminal :D Try pressing the ctrl in the terminal for dynamic suggestions list!

Screenshot

Terminal with fancy file links and interactive interface.

Fancy custom highlighting rules.

There's also nice looking easy-to-use command finder dialog (just to search your custom commands and terminal build-ins):

A screenshot of atom-terminal-panel package

Feature

  • multiple terminal
  • colorful status icon
  • kill long live process
  • fancy ls (with custom extension colouring!)
    • Do you wanna have a blue or a green executables? Do the yellow shell scripts look nice?
    • Just like in normal, native terminal.
    • Just type ? , easy right?)
    • Do you want a current time, computer name or a cwd in your command prompt? There's no problem.
    • You don't have to play with dirty shell script files!
    • Now you can quickly access your command just by pressing one button
    • To add new commands just write your own /or download existing plugin!
    • And copy it to the ./commands directory! - Easy, right?

    And a lot more! See it by yourself!

    Plugins

    This ATOM plugin is modular. You can create your own commands or download existing from the other users. The release contains also the built-in plugins (for file system management etc.).

    Terminal-commands.json

    The terminal-commands.json is the main configuration file for this package. If it's not present (or the JSON syntax is invalid) a new config file is created (in folder .atom).

    The config file contains:

    • custom commands definitions
    • rules (defininig highlights, regex replacement for text etc.)

    The sample config file can look like:

    The above configuration file will create highlight rule for all lines containing "warning: " text (this lines will be colored yellow).

    Creating custom terminal shortcuts

    You can create your own shortcuts buttons, which are placed on the terminal toolbar. To do it just put a new entry in the toolbar property:

    E.g. creating a button, which displays all avaliable terminal bultin commands:

    Another example. Now the button will move the terminal to the C: directory:

    You can add also tooltips describing the button functions:

    And now creating custom actions:

    Actions allows you to run your commands as atom commands or bind them to the specified keys. From the moment of the terminal initialization a new atom command is created - atom-terminal-panel:test , which will execute the hello_world command in the terminal.

    You can now bind the command to the specified keys by editing your keymap.cson :

    Defining custom commands

    Each command is defined in the commands entry the following way:

    'command0', 'command1'. are the commands that will be invoked by the user entry. Example involving g++ usage:

    As you can see you are able to build the current C/C++ project using only a single command. You may also try creating a build command accepting single file path (simple source file path) and the auto_build command, which will execute build command with %(file) parameter. E.g.

    Defining custom rules

    The highlight rules that are placed in rules property can be defined using two methods. The simple way looks like:

    Or more complex (and also more powerful) way:

    The REGEXP will be replaced with REPLACEMENT and all the line with matched token will be colored to red(matchLine:true).

    And specify how many lines under the match should be replaced:

    This rule will be applied to the entire line with the match and the next 3 lines (below it). Note that, the matchNextLines option can be used only with matchLine set to true , otherwise it's got no meaning.

    Getting more from custom patterns

    You can event make your patterns to be applied to the html code. Adding the forced option to the match :

    From now your pattern will be applied to the html code, so it may seriously broke entire terminal output! The forced patterns must be carefully designed to correctly manipulate the html code. If you're a beginner you should do most things without using forced patterns.

    More about regex rules

    You can use the following properties in regex matches:

    • matchLine - bool value specifies if the regex should be applied to the whole line
    • matchNextLines - integer value specifies how many lines after the line containing current match should be also matched
    • replace - text that the match will be replaced with

    Special annotation

    You can use special annotation (on commands/rules definitions or in settings - command prompt message/current file path replacement) which is really powerful:

    • (R - can be used in the rules user definitions)
    • (T - can be directly typed to the terminal)
    • (A - can be used from the terminal API)

    A few words about indexing in variables. The variable components are always indexed from 0, so %(path:0) refers to the first path component. You can also reference last element of the path using negative values: %(path:-1) is last element, %(path:-2) the seconds last etc. The same for referencing passed parameters - %(INDEX) and project directories - %(project:INDEX) .

    Text formatting

    Please use the %(^. ) modifiers to format the text:

    Internally defined commands

    You can take advantage of commands like memdump which prints information about all loaded commands (internal, not native!). Here the list of all commands:

    • ls
    • new FILENAME - creates new empty file in current working directory and opens it instantly in editor view
    • edit FILENAME - opens a given file in editor
    • link FILENAME - creates new file link (you can use it to open a file)
    • rm FILENAME - removes file in current working directory
    • memdump or ? - prints information about all loaded commands
    • clear - clears console output
    • cd - moves to a given path
    • update - reloads plugin config (terminal-commands.json)
    • reload - reloads atom window

    Included example commands:

    • compile - compiles current file using g++
    • run - runs the previously compiled file
    • test FILENAME - runs the test on the compiled application FILENAME is a FILE0.in file and the compiled application name must be FILE.exe e.g. test test5.in means test.exe < test5.in

    Internal configuration

    You can modify the extensions.less file and add your own extension colouring rules. E.g:

    Simple like making a cup of fresh coffee. Just dot, extension name and CSS formatting.

    The ./config/terminal-style.less contains the general terminal stylesheet: E.g.

    You can modify it to make the terminal look cooler.

    Creating more advanced custom functions (plugins)

    The ./commands directory contains the plugins (you can add your own commands). Each plugin exports a list of all custom commands (each plugin directory must contain index.coffee file - its entry point, which looks like described below) E.g.

    The state is the terminal view object and the args - the array of all passesd parameters. Your custom functional command can also create console links using state.consoleLink path , labels using state.consoleLabel type, text or execute other commands: E.g.

    But if you're using state.exec you must remember about passing not only command string but also state and args parameters (array of refernced parameters). The array of the referenced parameters contains all parameters which will be referenced by a command string (element at zero index in array will be used for %(0) replacement). If the command string do not reference its parameters you can pass only a null value. As you can see all terminal messages are displayed automatically (just return the string message). but you can also print them manually:

    You can specify the command description, example usage and if the plugin command is outdated - make it deprecated:

    You can also export new variables:

    In the given example the variable can be acessed by typing %(name) .

    More about console

    As you can see in previous examples we were calling state.exec . This method accepts tree parametes: command , args_reference , state command is the string command to be executed e.g. echo test or format C: args_reference is the array containing all reference arguments e.g. if you passes a ['arg0', 'arg1'] as parameter the %(0) sequence will be replaced with arg0 text and %(1) with arg1 . If this paramter is undefined or null the command is executed normally and the %(0) sequences are simply removed. state - the console view object e.g. state.exec 'echo test > test.txt', null, state

    You can also call other useful console methods:

    • state.message 'MESSAGE' - displays a message (can contains css/html formatting)
    • state.rawMessage 'MESSAGE' - displays a message without parsing special sequences like %(link). %(endlink) or %(cwd) etc.
    • state.clear - clears console output
    • state.consoleLink 'FILENAME' - creates console link to a given file (returns text which will be replaced with interactive file link)
    • state.consoleLabel 'TYPE', 'TEXT' - creates console label just like %(label:TYPE:text:TEXT)

    Hotkeys

    • shift-enter toggle current terminal
    • command-shift-t new terminal
    • command-shift-j next terminal
    • command-shift-k prev terminal
    • ` - toggle terminal
    • escape (in focused input box) - close terminal
    • Make a more cool terminal cursor.
    • More interactive stuff
    • Maybe a little bash parser written in javascript?
    • Some about stdinput (which is currently really bad)

    Example configuration

    Here it is, the example configuration (terminal-commands.json) - that you can see on the preview images. To use it just copy it to your ./atom/terminal-commands.json file (if the file doesn't exist call update command and it should be created).

    The regex rules preview can be easily checked by invoking echo command (e.g. echo warn test warning messages. ).

    Note that after each config update you must call update command otherwise changes will take no effects.

    Experiments

    This package is in alpha development phase. You can enable experimental features, which may be added to the software in incoming releases.

    I think this package is bad news.

    Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

    Читайте также: