hyper-cwd-wsl
Execute the 'cd ${current working directory}'
command after opening the new tab in Hyper for WSL(Windows Subsystem for Linux).
Read this in other languages: 日本語
This is inspired by the hypercwd.
Installation
Open Hyper's configuration file and add hyper-cwd-wsl
to the list of plugins
.
module.exports = {
plugins: [
'hyper-cwd-wsl'
],
}
Configuration
Open Hyper's configuration file and add hyperCwdWsl
to the object of config
.
module.exports = {
config: {
hyperCwdWsl: {
titleRegExp: '^user@hostname: (.*)$',
clearAfter: true
}
}
}
Options
Key | Description | Type | Default |
---|---|---|---|
titleRegExp |
Regular expression for recognizing cwd from tab title. Be sure to set this properly. | string | '^.+: (.+)$' |
defaultDirectory |
Initial directory. | string | null |
replaceRegExp |
Plugin replaces title like title = title.replace(replaceRegExp, replaceWith);
|
string | null |
replaceWith |
Plugin replaces title like title = title.replace(replaceRegExp, replaceWith);
|
string | '' |
clearAfter |
Execute clear command after executing cd command. |
boolean | false |
validateCwdEveryTime |
Validate cwd every time tab title is changed. | boolean | false |
debugMode |
Output tab title & cwd to console. | boolean | false |
How to recognize cwd
This plugin recognizes cwd from tab title using regular expression (titleRegExp
).
Therefore, this plugin will not operate properly if cwd is not displayed in the title.
Also, be sure to set titleRegExp
properly.
Replace title
You can replace tab title by using regular expression (replaceRegExp
).
Example
If tab title is "user@hostname: ${cwd}"
,
module.exports = {
config: {
hyperCwdWsl: {
titleRegExp: '^user@hostname: (.*)$',
replaceRegExp: '^user@hostname: (/)$|^user@hostname: /?(.+/)*([^/]+)$',
replaceWith: '$1$3',
clearAfter: true,
}
}
}
License
MIT