Exploring TypeScript .ts documents within Midnight Commander

Whenever I hit the F3 key in Midnight Commander while trying to open a .ts file, I encounter this message:

To view information for this file, please ensure mplayer or mpv is installed.

Is there a way to set up Midnight Commander to display a .ts file as text?

Using Linux Mint 20.1, and running Midnight Commander version 3:4.8.24-2ubuntu1

Answer №1

Typically, the.ts file extension is used for MPEG video files, so MC comes preconfigured to automatically play them with a video player.

If you want to customize how file extensions are mapped in MC, simply press F9, go to the "Command" menu, and select the "Edit extension file" submenu. Take a look at my custom mc.ext file for reference. Your configuration might look something like this:

shell/.ts
   Open=less %f
   View=%view{ascii} cat %f

Answer №2

My mc.ext.ini already contained the following section:

[Typescript]
Shell=.ts
ShellIgnoreCase=true
Type=^Java source
Include=editor

As well as this section:

[ts]
Shell=.ts
ShellIgnoreCase=true
Include=video

I decided to remove the latter section from the file. Now, Midnight Commander is able to display .ts files, although it does not provide syntax highlighting support in its viewer (despite a feature request being submitted almost 20 years ago, as seen here: Link).

It's worth noting that TypeScript syntax has been supported in the editor since 2017, you may need to press Ctrl+S if syntax highlighting is not enabled by default after opening a file.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with Angular HttpClient failing to send properties supplied by a getter function

student.ts ... public _status: string; ... get status() { return this._status; } ... student.pack.ts ... post(student: Person): Observable<Student> { const postPersonURL = 'http://localhost:8080/api/persons'; return this.ht ...

Issue with TypeScript error encountered when attempting to save data locally using React-Redux and LocalStorage

Currently, I am delving into the worlds of React-Redux and TypeScript. Within my small app, I aim to utilize localStorage to store data locally. I attempted to address this based on information from this particular answer, but ran into a TypeScript erro ...

Exploring the capabilities of accessing observables within RxJS ForkJoin

I have a series of observables that I am combining using the forkJoin operation. I am trying to determine how to identify which observable corresponds to each object in the responses array. let observables = ... // an array of observables forkJoin(observa ...

Assign a value to a file input in Angular 6

I'm currently working with Angular 6 and I have a requirement to retrieve an image that is dropped into a div element and assign it as the value of an input type="file" within a form. The process involves the user dropping an image into the designate ...

Combining Promise.all with multiple distinct data types for returned values

Can Promise.all() accept an iterable with different resolved types? For example, can promise.all([promiseA, promiseB, promiseC]) work if promiseA and promiseB return void but promiseC returns boolean? I attempted this and it seems not possible. I am unsu ...

Error encountered in sending server response to WhatsApp API cloud using webhooks in Node.js due to Typescript

Can you assist me with my issue? I'm developing an API using TypeScript and Node.js Express, utilizing Meta for WhatsApp API cloud usage. I've set up a webhook following the official documentation, but I'm facing an issue with conditional i ...

Looking to receive detailed compiler error messages along with full imports in Visual Studio Code for TypeScript?

Currently, I am trying to edit a piece of typescript code in Visual Studio Code. However, I encountered a compiler error message that looks like this: The error states: Type 'import(\"c:/path/to/project/node_modules/@com.m...' is not assign ...

Create TypeScript declaration files dynamically within the application's memory

Is there a way to programmatically generate declaration files using TypeScript? I know we can use tsc --declaration --emitDeclarationOnly --outFile index.d.ts, but I'm not sure how to do it in code. For example: import ts from 'typescript' c ...

Passing properties to a component from Material UI Tab

I have been attempting to combine react-router with Material-UI V1 Tabs, following guidance from this GitHub issue and this Stack Overflow post, but the solution provided is leading to errors for me. As far as I understand, this is how it should be implem ...

What is the method for incorporating return types into the range function?

I came across this code snippet in you don't know JS yet and I'm attempting to incorporate types into it, but I'm feeling lost. function range(start: number, end?: number) { start = Number(start) || 0; if (end === undefined) { re ...

Ways to turn off specific ngtsc warnings

Ever since updating my Angular app to version 15, I've been noticing some warnings popping up in both the terminal and Chrome DevTools. Is there a way to turn off or disable these warnings? I keep seeing this warning message about the optional chain o ...

Improving the structure of a TypeScript switch statement

Looking for a more efficient way to implement a switch statement in TypeScript? Here is the current code snippet from a component: switch (actionType) { case Type.Cancel { this.cancel(); break; } case Type.Discard { thi ...

Issues with Typescript and Hot Module Replacement functionality are preventing them from functioning

I have a front-end application developed using Typescript, ReactJS, and Webpack. I am currently working on enabling Hot Module Replacement (HMR). Here are the initial scripts: "build": "NODE_ENV=production $(npm bin)/webpack --watch", "dev": "$(npm bi ...

The error 'TypeError: instances.map is not a function in Angular Loopback' is indicating

Currently, I am utilizing the @mean-expert/loopback-sdk-builder to create my API on Angular 4.3.6. However, I encountered an error when executing the following code snippet: this._userApi.findUsersByRoles([{'name':'cliente'}]).subscrib ...

Instead of receiving a class, you will receive an object of type HTMLInputElement

I'm attempting to import a JSON file and display it in HTML, but my 'selection' object is always being converted into an HTMLInputElement instead of my intended class. Here is the JSON data: [ { "id":0, "name":"France", "acronym ...

Expecting a return value from CreateAsyncThunk

I need help converting the following JavaScript code to TypeScript. I keep running into an error message that says Expected to return a value at the end of async arrow function. Can someone help me figure out what's wrong with this code? export const ...

Having T extend Record<string, any>, the keyof T does not return 'string' as a type

My goal is to achieve the following: type UserDataProps<FieldName extends keyof DataShape, DataShape extends Record<string, any>> = { id: string; value: DataShape[FieldName]; } const userDataBuilder = <FieldName extends keyof DataShape, ...

Using Angular with Google Maps: Learn how to retrieve a list of markers from a map and implement onClick events for each one

I am currently using the AGM angular module for Angular 2+ to integrate the Google Map API. In my project, I have a directive that displays waypoints as markers on the map using the Google Map Directions Service. Now, I am looking for a way to handle the ...

Utilizing MUI for layering components vertically: A step-by-step guide

I am looking for a way to style a div differently on Desktop and Mobile devices: ------------------------------------------------------------------ | (icon) | (content) |(button here)| ----------------------------------------- ...

The p-calendar feature is experiencing compatibility issues with Internet Explorer, Edge, and Firefox

While I've had success using primeng p-calendar on Google Chrome, I've encountered an issue where the date-picker does not open upon clicking the text box on other browsers. Below is the snippet of HTML code I utilized: <p-calendar [(ngModel ...