Trying out Windows Terminal customization via settings.json. I found a profiles.json that follow the new conventions closely enough to work when pasted into settings.json, (I know it took because the theme changed). The problem is that changes to "fontFace" are not having any effect. I'm trying to use a nerd font for some powerline stuff, works in Powershell running in ConEmu but not in Windows Terminal. Here is the relevant portion of settings.json:
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
// You can add more global application settings here.
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
// If enabled, selections are automatically copied to your clipboard.
"copyOnSelect": false,
// If enabled, formatted data is also copied to your clipboard
"copyFormatting": false,
// A profile specifies a command to execute paired with information about how it should look and feel.
// Each one of them will appear in the 'New Tab' dropdown,
// and can be invoked from the commandline with `wt.exe -p xxx`
// To learn more about profiles, visit https://aka.ms/terminal-profile-settings
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles.
"cursorShape": "vintage",
"fontFace": "Iosevka Nerd Font"
},
"list":
[
{
// Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false,
"fontFace": "Iosevka Nerd Font",
"colorScheme": "PowerShellTom",
"useAcrylic": true,
"acrylicOpacity": 0.8
},
{ ...
I get the same behavior in Windows Terminal Preview, which is supposed to be the least "bleeding edge" version.
Even trying non-nerd fonts for "fontFace" has no effect, however, "fontSize" will work.
For people who are coming from SCOTT HANSELMAN article (especially from the third step)
Install Cascadia Code for all users
Change the "fontFace" property in the settings.json like this
Shortcut to open settings.json: Ctrl+Shift+, (comma)
here is the code to copy
"profiles": {
"defaults": {
"fontFace": "Cascadia Code PL"
// Put settings here that you want to apply to all profiles.
}
}
This is the only way I made that work (after 2 hours or trying)
Change the fontFace from "Iosevka Nerd Font" to just "Iosevka"; the fontFace attribute expects a font family, as far as I'm aware this isn't in the documentation and I only found it out after reading this issue on the WT github
I wanted to install MesloLGS NF Regular as a recommended font for Powerlevel10k in WindowsTerminal for WSL:
https://github.com/romkatv/powerlevel10k/blob/master/font.md
To make it work I had to:
Install it for all users as #hakan-fıstık showed in his answer.
Change the "fontFace" in settings.json to "MesloLGS NF" (Supplying full names of fonts is not working as supposed to).
Be sure to change size of font (changing font may make it huge): https://learn.microsoft.com/en-us/windows/terminal/customize-settings/profile-appearance
From a comment to the Issue I opened on Windows Terminal's GitHub page, (#6606), I was directed to another fontFace problem where choosing another font would not stick if you reopened WT, (not quite the problem I was having).
Anyway, the current solution to that is to uninstall any font you want to use, then right-click and choose "Install for all users". Double-click the file to open the sample view, and use the font name found just below the the two buttons. use the spaces in the font name as is in your settings.json file.
This worked for MesloLGL NF, but not Iosevka NF.
In my experience, editing the 'settings.json' file manually creates more issues than it resolves. The easiest way to edit the default font of your terminal is as follows:
Open the settings
Select Ubuntu under the 'Profiles' header on the sidebar
Scroll down to 'Additional Settings' and select 'Appearance'
Under the text header, change the 'Font face' attribute to your preferred font
Open 'settings.json' to view changes
You should see the expected format for selecting a font - Should you wish to edit the json file manually, you should follow this format
Save changes and exit
Related
VS code has suddenly stopped recognizing html files (the file icon is the default one for files with no extension)
all other file extensions work just fine
except for html
the tags still work but it won't autocomplete
Adding this to file extensions worked for me:
"files.associations": {
"*.html": "html"
}
In my case, for this problem the solution was to manually add *.html to files.associations, in user settings. Its unlogical but it seems that somehow the extension wasn't associated to the type of file. Now everything works perfectly...
Go to the settings (In mac it is Code -- > Preferences --> Settings)
In the search bar search for Association.
In Files:Associations click on Add items.
update key = *.html & Value = html
Below is the screenshot for reference.
I had the same issue but none of the other solutions worked for me!
You can try this:
Go to the path where the "settings.json" file exits, for my case the path is:
C:> Users> User123 > AppData > Roaming > Code > User > settings.json
Now, paste the code in the file:
"code-runner.executorMap": {
"html": "\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\"",
}
Now search for the "files.associations" section in your settings.json file:
As an example
Now if you have the "files.associations" section then just add the line there:
"*html": "html"
(don't forget to write a comma after a line if there are more lines in it)
or if you don't have a "files.associations" section, then copy paste the code there:
"files.associations": {
"*.rmd": "markdown",
"*html": "html"
},
I had the same problem in Windows 10 a few minutes ago:
Yeah, from the solutions above I did this but still had some errors:
File -- > Preferences --> Settings
In the search bar search for Files: Association.
In Files:Associations click on Add item button.
update Item = *.html & Value = HTML
As shown below:
When I saved, I got this error
Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again.
The problem is that terminal.integrated.shellArgs settings have been deprecated.
One of the answers here will help:
So I just had this problem and I figured it out the problem was from an extension that I installed which is the pyscript extension I disabled it and everything started to work again!
Well if you have pyscript extension installed, disable it. It has conflicts with html files I guess.
Or if you don't want to disable it just ctrl+shift+p then change language mode. Select configure file association for html.
This applies for any extension not just pyscript. For me it was pyscript
I've download the latest Visual Studio Code and am trying to write some HTML code. For example, <div>, <a>, <p> tags. However, there are no HTML suggestions in Visual Studio Code:
I've read this article and it says:
Visual Studio Code provides basic support for HTML programming out of
the box.
However, I've tried to install HTML extension:
In addition, I've turned on HTML5 suggestion in settings.json file:
{
"workbench.colorTheme": "Visual Studio Light",
"workbench.activityBar.visible": true,
"editor.multiCursorModifier": "ctrlCmd",
"window.zoomLevel": 0,
"html.suggest.html5": true,
}
Nevertheless, HTML, CSS suggestion does not work.
What can I do to code with suggestions?
I think the issue is that Visual Studio Code is not detecting the file type correctly. If you notice in these pictures, vscode has correctly detected that I am writing a html file by the icon <> beside the file name and the language indicator in the bottom right of the screen.
The language indicator most likely says plain text in your case. Click on it and a menu should appear at the top centre of the screen. Then try the following:
Enabling Auto Detect. I think this will be the first option.
Selecting Configure File Association for '.html'...
2 can also be accomplished by adding
"files.associations": { "*.html": "html" }
to your settings.
OR just add to settings.json (File -> Preferences -> Settings):
{
// Configure file associations to languages (e.g. "*.extension": "html"). These have
//precedence over the default associations of the languages installed.
"files.associations": { "*.html": "html" },
}
Just go to "File -> Preferences -> Settings"
Search for "Associations"
Check this image
Go to
File > Preferences > settings > Extensions > Emmet
Then click on
( C:\Users\Code\User\settings.json ) #
for reference
Add the following code:-
"emmet.triggerExpansionOnTab": true,
"files.associations": {"*html":"html"},
Save the file.
I would like to create a chrome extension which changes my default tab in chrome browser.
Inside the page I will put my favorite websites, which I think I can handle using HTML + CSS. My difficult part is how to make it become a chrome extension because I have never done it before.
Can anyone give me some basic steps which I could start with?
You are looking for what's called Override Pages.
An extension can declare that it supplies a new newtab page. Here's a strictly minimal manifest for it:
{
"manifest_version": 2,
"name": "My awesome New Tab override",
"version": "1.0",
"chrome_url_overrides" : {
"newtab": "newtab.html"
}
}
Then you can use this manifest, together with a newtab.html and required resources, to make a simple extension.
There are many guides past that point; you can see the Learn Basics part of the official docs. Remember you can always ask a new question here if you run into specific implementation questions.
As the title suggests, I would like to find out if there's a way to prevent ST2 from opening binary files when I click on them. For example when I click on an image, there's no point displaying the hex representation inside the text editor.
One additional note: I'm not interested in hiding binary files from the sidebar.
Files containing null bytes are opened as hexadecimal by default
In your User or Default Settings file:
"enable_hexadecimal_encoding": false
Unfortunately I'm not aware of a way to disabled previewing of specific formats, but if you want to avoid accidental clicks on enormous binary files that may slow down the editor you could disable all previewing from sidebar clicks.
In your User or Default Settings file(s):
"preview_on_click": false
I have similar situation like you. I dont want sublime open editor for binary like jpg png files. Instead open system default application is more reasonable.
Create one Build. Refer to Sublime Text 2 keyboard shortcut to open file in specified browser (e.g. Chrome) It will both open default application and hex editor.
Plugin OpenDefaultApplication https://github.com/SublimeText/OpenDefaultApplication
It will have context right click menu OpenInDefaultApplication. But It will both open default application and hex editor as well
Plugin: Non Text Files https://packagecontrol.io/packages/Non%20Text%20Files Add config in the user setting
"binary_file_patterns": ["*.JPG","*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.tga", "*.dds", "*.ico", "*.eot", "*.pdf", "*.swf", "*.jar", "*.zip"],
"prevent_bin_preview": true,
"open_externally_patterns": [
"*.JPG",
"*.jpg",
"*.jpeg",
"*.JPEG",
"*.png",
"*.PGN",
"*.gif",
"*.GIF",
"*.zip",
"*.ZIP",
"*.pdf",
"*.PDF"
]
I choose the third way, it's quite suitable for me. It will open jpg file in system default application and quickly close the edit mode automatically.
For Sublime Text 3
file_exclude_patterns Setting
If your binary files have a file extension, then yes.
In your Sublime Settings you can use this setting to prevent you from seeing the files in the left project folders:
"file_exclude_patterns":
[
"*.db",
"*.dll",
"*.ds_store",
"*.egg",
"*.enc",
"*.eot",
"*.exe",
"*.ko",
"*.otf",
"*.pdb",
"*.pdf",
"*.pgn",
"*.plist",
"*.psd",
"*.pxm",
"*.pyc",
"*.rdb",
"*.sqlite",
"*.sublime-workspace",
"*.ttf",
"*.woff",
"*.woff2",
"*.zip",
],
Just modify this to your needs, and then you will not see this in your project folders in Sublime.
Toggle
Maybe you just want to turn it off or on for the current file?
Try Sublime Command Palette using CTRL OR Command + Shift + P
and type:
HexViewer: Toggle Hex View
and press Enter or Return then the file will switch between HEX and TEXT.
Extra
If you don't want any-file to be converted to HEX then please use #steven-teo's answer.
If you want to learn more about the HEX Viewer you can see the Code Here & Documentation Here.
**Note: Keys vary for the Sublime Command Palette more info on that.
When I view files on GitHub, tabs appear as 8 spaces.
Example:
Is that possible to change this configuration to 2 or 4 spaces?
You can append ?ts=2 or ?ts=4 to the URL to change the tab-size.
Example: https://github.com/jquery/jquery/blob/main/src/core.js?ts=2
It seems that the value can be anything from 1 to 12. It does not work on Gists or raw file views though.
Source: GitHub Cheat Sheet
Set default displayed tab size for your repository
When you have a .editorconfig in your repository it will respect it
when viewing code on GitHub.
indent_style = tab and indent_size = 4 shows tabs with 4 columns
instead of 8
https://github.com/isaacs/github/issues/170#issuecomment-150489692
Example .editorconfig for multiple extensions which works in JetBrains' products:
root = true
[*]
end_of_line = lf
insert_final_newline = true
# Matches multiple files with brace expansion notation
[*.{js,jsx,html,sass}]
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
Change how you see tabs on other repositories
Install Stylus in your browser, than install GitHub: better-sized tabs in code.
There are also Google Chrome extensions:
https://chrome.google.com/webstore/detail/github-tab-sizer/djpnapkcpjomnkfekaedkigfomiedpjf
https://chrome.google.com/webstore/detail/github-tab-size/ofjbgncegkdemndciafljngjbdpfmbkn/related
Since Sept. 2021, you can set the tab size directly in your GitHub settings: github.com/settings/appearance.
Announced in Changelog "Tab size rendering preference".
No more .editorconfig
No more ?ts=2 added to the URL
Just:
Note: you cannot enter "3" for instance. You would get:
Tab size rendering preference could not be saved:
Validation failed:
Tab size is not included in the list
It actually is possible to do it, with a browser extension. Install Stylish (in Firefox or Chrome), then install this user style: “GitHub: better-sized tabs in code”.
It might not work for some languages. For example, I was viewing a JavaScript file and I did not notice any changes. So I deleted the style the author had and put the following lines into it:
.tab-size {
-webkit-tab-size: 4 !important;
-moz-tab-size: 4 !important;
-o-tab-size: 4 !important;
tab-size: 4 !important;
}
And it worked on Chrome (screenshot).
As you can see from the screenshot, I also enabled widescreen mode and changed the color scheme to Solarized. So I have three user styles running on GitHub pages via the Stylish extension for Chrome. I hope this helps someone.
Update
Yes. As stated by mortenpi, this can be done by through an additional query parameter. See his answer for more details.
Original answer
Is that possible to change this configuration to 2 or 4 spaces?
No. It's only available as part of the editing feature through the Ace editor and the change is not persisted.
This blog post gives some more information about the embedded IDE.
However, provided you know the url of the blob (file) you're willing to review, you can switch to the edit mode easily by changing the blob segment with an edit segment and use the dropdown to select your prefered tab size.
Standard view: https://github.com/moroshko/mmSelect/blob/master/mm_select.js
Ace view: https://github.com/moroshko/mmSelect/edit/master/mm_select.js
If the project is yours, create a file in the project root named “.editorconfig” and give it the following contents.
[*]
indent_style = tab
indent_size = 4
This will cause GitHub to render tabs 4-wide within the project.
This is an EditorConfig file, which is formally specified, supported by many editors, and also supports more extensive editor configuration, like specifying that all .html files are UTF-8 encoded.
If the project isn’t yours, consider opening an issue requesting the author specify the indent style they intended.
If you're into UserScripts, this did it for me:
// ==UserScript==
// #name GitHub Tabs
// #namespace http://foldoc.org/
// #version 1
// #description Set sensible tabs on GitHub
// #author Denis Howe
// #match https://github.com/*
// ==/UserScript==
document.querySelectorAll('table').forEach(t => { t.dataset.tabSize = 2 });
I did that for fixing them http://valjok.blogspot.com/2014/07/indentation-correction-for-exposing.html.
Another option is when embedding your gist, replace all tabs with required number of spaces
<div id="willReplaceTabs">
<script src="https://gist.github.com/valtih1978/99d8b320e59fcde634ad/cf1b512b79ca4182f619ed939755826c7f403c6f.js"></script>
<script language="javascript">
var spaces = " "
willReplaceTabs.innerHTML = willReplaceTabs.innerHTML.replace(/\t/g, spaces)
</script>
</div>
If it's an option for the project you're working on, changing your editor to treat tabs as spaces will fix the problem.
So, for example, in Visual Studio Code, the config looks like this:
{
"editor.tabSize": 2,
"editor.insertSpaces": true
}
In Sublime it's:
{
"tab_size": 2,
"translate_tabs_to_spaces": true
}
Until recently I insisted on non-spaced tabs. After switching, it fixed the Github rendering weirdness, and I haven't noticed any significant downsides in my workflow.
The best solution is, if possible, to convince maintainers of the source code you're looking at to replace all the tabs by the correct number of spaces.
Using tabs is problematic in code today given that you're often seeing it on the web, where the decision of "how many spaces per tab" depends on where it's being displayed.