├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── index.js └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Nicolás Bevacqua 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # `hyperterm-working-directory` 2 | 3 | > 🖥👷📂 Adds a default working directory setting. Opens new tabs using that working directory. 4 | 5 | # usage 6 | 7 | - Open `~/.hyperterm.js` 8 | - Add `hyperterm-working-directory` to the list of `plugins` 9 | - Set `config.workingDirectory` to something like `~/dev` (note that on Windows you will need to use \\ to escape the backslash. e.g. `C:\\Working\\Directory\\Example`) 10 | 11 | That's it. If `config.workingDirectory` is not set, a default value of `$HOME` will be used. 12 | 13 | # info 14 | 15 | Supports hot configuration reloads. When `config.workingDirectory` changes, new tabs opened in HyperTerm will recognize the new value. 16 | 17 | This package is compatible with `hypercwd`. When `hypercwd` is installed, the configured `workingDirectory` will be used on first load and `hypercwd` will take over for tabs opened after that. 18 | 19 | # license 20 | 21 | mit 22 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const untildify = require('untildify'); 2 | 3 | const pull = value => value ? untildify(value) : process.env.HOME; 4 | const push = cwd => store.dispatch({ type: 'SESSION_SET_CWD', cwd }); 5 | 6 | exports.middleware = store => next => action => { 7 | const { type } = action; 8 | 9 | if (type === 'CONFIG_LOAD' || type === 'CONFIG_RELOAD') { 10 | push(pull(action.config.workingDirectory)); 11 | } 12 | 13 | next(action); 14 | }; 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hyperterm-working-directory", 3 | "version": "0.1.1", 4 | "description": "Adds a default working directory setting. Opens new tabs using that working directory.", 5 | "main": "index.js", 6 | "keywords": [ 7 | "hyperterm", 8 | "cwd", 9 | "working", 10 | "directory" 11 | ], 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/bevacqua/hyperterm-working-directory.git" 15 | }, 16 | "author": "Nicolás Bevacqua (https://ponyfoo.com)", 17 | "license": "MIT", 18 | "dependencies": { 19 | "untildify": "3.0.2" 20 | } 21 | } 22 | --------------------------------------------------------------------------------