├── images └── preview.png ├── package.json ├── index.js ├── LICENSE ├── .gitignore ├── yarn.lock └── README.md /images/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tolbertam/hyper-font-ligatures/HEAD/images/preview.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hyper-font-ligatures", 3 | "version": "0.0.8", 4 | "description": "Extension for Hyper.app to enable Font Ligatures", 5 | "main": "index.js", 6 | "repository": "https://github.com/tolbertam/hyper-font-ligatures", 7 | "author": { 8 | "name": "Andy Tolbert", 9 | "email": "x@andrewtolbert.com" 10 | }, 11 | "license": "MIT", 12 | "dependencies": { 13 | "xterm-addon-ligatures": "0.1.0-beta-2" 14 | }, 15 | "keywords": [ 16 | "hyper", 17 | "font", 18 | "fonts", 19 | "ligatures" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const ligatures = require('xterm-addon-ligatures'); 2 | 3 | exports.decorateTerm = (Term, { React, notify }) => { 4 | return class extends React.Component { 5 | constructor(props, context) { 6 | super(props, context); 7 | this.onDecorated = this.onDecorated.bind(this); 8 | } 9 | 10 | onDecorated(term) { 11 | if (!term) { 12 | return; 13 | } 14 | 15 | if (this.props.onDecorated) { 16 | this.props.onDecorated(term); 17 | } 18 | 19 | if (term.term) { 20 | ligatures.enableLigatures(term.term); 21 | } 22 | } 23 | 24 | render() { 25 | return React.createElement(Term, 26 | Object.assign( 27 | {}, 28 | this.props, 29 | { onDecorated: this.onDecorated } 30 | ) 31 | ); 32 | } 33 | }; 34 | }; 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2018 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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # parcel-bundler cache (https://parceljs.org/) 61 | .cache 62 | 63 | # next.js build output 64 | .next 65 | 66 | # nuxt.js build output 67 | .nuxt 68 | 69 | # vuepress build output 70 | .vuepress/dist 71 | 72 | # Serverless directories 73 | .serverless 74 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | font-finder@^1.0.2, font-finder@^1.0.3: 6 | version "1.0.4" 7 | resolved "https://registry.yarnpkg.com/font-finder/-/font-finder-1.0.4.tgz#2ca944954dd8d0e1b5bdc4c596cc08607761d89b" 8 | dependencies: 9 | get-system-fonts "^2.0.0" 10 | promise-stream-reader "^1.0.1" 11 | 12 | font-ligatures@^1.3.1: 13 | version "1.3.2" 14 | resolved "https://registry.yarnpkg.com/font-ligatures/-/font-ligatures-1.3.2.tgz#227eb5fc38fef34b5373aa19b555320b82842a71" 15 | dependencies: 16 | font-finder "^1.0.3" 17 | lru-cache "^4.1.3" 18 | opentype.js "^0.8.0" 19 | 20 | get-system-fonts@^2.0.0: 21 | version "2.0.0" 22 | resolved "https://registry.yarnpkg.com/get-system-fonts/-/get-system-fonts-2.0.0.tgz#a43b9a33f05c0715a60176d2aad5ce6e98f0a3c6" 23 | 24 | lru-cache@^4.1.3: 25 | version "4.1.3" 26 | resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" 27 | dependencies: 28 | pseudomap "^1.0.2" 29 | yallist "^2.1.2" 30 | 31 | opentype.js@^0.8.0: 32 | version "0.8.0" 33 | resolved "https://registry.yarnpkg.com/opentype.js/-/opentype.js-0.8.0.tgz#acabcfa1642fbe894a3e4d759e43ba694e02bd35" 34 | dependencies: 35 | tiny-inflate "^1.0.2" 36 | 37 | promise-stream-reader@^1.0.1: 38 | version "1.0.1" 39 | resolved "https://registry.yarnpkg.com/promise-stream-reader/-/promise-stream-reader-1.0.1.tgz#4e793a79c9d49a73ccd947c6da9c127f12923649" 40 | 41 | pseudomap@^1.0.2: 42 | version "1.0.2" 43 | resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" 44 | 45 | tiny-inflate@^1.0.2: 46 | version "1.0.2" 47 | resolved "https://registry.yarnpkg.com/tiny-inflate/-/tiny-inflate-1.0.2.tgz#93d9decffc8805bd57eae4310f0b745e9b6fb3a7" 48 | 49 | xterm-addon-ligatures@0.1.0-beta-2: 50 | version "0.1.0-beta-2" 51 | resolved "https://registry.yarnpkg.com/xterm-addon-ligatures/-/xterm-addon-ligatures-0.1.0-beta-2.tgz#def635fd0ca671fe61179629f8492b76c66dec6e" 52 | dependencies: 53 | font-finder "^1.0.2" 54 | font-ligatures "^1.3.1" 55 | 56 | yallist@^2.1.2: 57 | version "2.1.2" 58 | resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" 59 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | hyper-font-ligatures 2 | ==================== 3 | 4 | Enables [font ligatures][font ligatures] for [hyper 2.1+][hyper] 5 | via the [xterm-addon-ligatures][xterm-addon-ligatures] and 6 | [font-ligatures][font-ligatures] packages. 7 | 8 | ![](https://raw.githubusercontent.com/tolbertam/hyper-font-ligatures/master/images/preview.png) 9 | 10 | Use fonts supporting ligatures such as [Fira Code][Fira Code], 11 | [Hasklig][Hasklig], and [Iosevka][Iosevka] to benefit from this plugin. 12 | 13 | ## Installation 14 | 15 | **Disclaimer**: Please note that this plugin requires hyper version 2.1.0 16 | or later. 17 | 18 | **Also note**: For those on hyper 3+, you must 19 | [disable WebGL rendering](#disabling-webgl-rendering) for this 20 | plugin to function. 21 | 22 | ### Using the built-in hyper plugin manager 23 | ```bash 24 | $ hyper i hyper-font-ligatures 25 | ``` 26 | 27 | ### Using the .hyper.js file 28 | Open the [.hyper.js] file using your favorite text editor and edit the 29 | plugins array to include `hyper-font-ligatures`: 30 | ```js 31 | plugins: ['hyper-font-ligatures'], 32 | ``` 33 | 34 | ### Disabling WebGL Rendering 35 | 36 | if you are running hyper 3+, this plugin currently does not work with hyper 3 37 | unless you disable WebGL rendering. 38 | 39 | Note that WebGL rendering was a major performance improvement introduced 40 | in hyper 3, by disabling it you should expect the same level of performance 41 | seen with hyper 2. 42 | 43 | To disable WebGL rendering, set `webGLRenderer` to `false` in the `config` 44 | section of your 45 | [.hyper.js] configuration file, i.e.: 46 | 47 | ```javascript 48 | module.exports = { 49 | config: { 50 | webGLRenderer: false, 51 | }, 52 | plugins: [ 53 | "hyper-font-ligatures" 54 | ], 55 | }; 56 | ``` 57 | 58 | See [issue #8](https://github.com/tolbertam/hyper-font-ligatures/issues/8) and 59 | [zeit/hyper#3607](https://github.com/zeit/hyper/issues/3607) more details. 60 | 61 | In all cases, a 'Full Reload' (`View -> Full Reload`) is required. 62 | 63 | [font ligatures]: https://www.hanselman.com/blog/MonospacedProgrammingFontsWithLigatures.aspx 64 | [font-ligatures]: https://github.com/princjef/font-ligatures 65 | [xterm-addon-ligatures]: https://github.com/xtermjs/xterm-addon-ligatures 66 | [xterm.js]: https://github.com/xtermjs/xterm.js 67 | [Fira Code]: https://github.com/tonsky/FiraCode 68 | [Hasklig]: https://github.com/i-tu/Hasklig 69 | [hyper]: https://hyper.is 70 | [.hyper.js]: https://hyper.is/#config-location 71 | [Iosevka]: https://github.com/be5invis/Iosevka 72 | [#3178]: https://github.com/zeit/hyper/pull/3178 73 | --------------------------------------------------------------------------------