Spell check with CAPS using Sublime Text - sublimetext3

I’ve noticed that Sublime Text 3 seems to ignore CAPITALISED words when using the spell checker.
Quite a lot of my document has strings in caps. I don’t want to mess with the formatting, just check the spelling.
Is there a file I can modify to toggle spell check where capitals are involved in SublimeText3?
I realise this may get thrown out for not being a coding question but I'll show you a Venn diagram of those who use SO and those who know how to really use Sublime Text.

The answer is yes, you can spell-check words in all caps, but it's going to take some effort. There is a setting that is appropriate here:
// Word list to use for spell checking. May also be a list of dictionaries.
"dictionary": "Packages/Language - English/en_US.dic",
The included dictionaries (there is one for en_US and one for en_GB) include some words in all caps, such as AIDS and DNA, but not all, so you'll need to make your own .dic file. Fortunately, this is fairly straightforward. You'll need to extract the original file, convert it to upper case in Sublime, save it, then change your settings to point to both dictionaries.
To extract the dictionary package, install PackageResourceViewer from Package Control. Open the Command Palette with CtrlShiftP (⌘ShiftP on macOS), type in prv, make sure PackageResourceViewer: Extract Package is selected, and hit Enter. Next, select the Language - English package, hit Enter, then hit Enter again when it shows Start Extraction (1 of XX items selected). A little popup should come up telling you the package was extracted successfully.
Next, you'll need to navigate to the correct folder and open the dictionary file in Sublime. Select Preferences → Browse Packages… (macOS: :Sublime Text → Preferences → Browse Packages…) to open the Packages directory in your file manager:
Linux: ~/.config/sublime-text-3/Packages or ~/.config/sublime-text/Packages
macOS/OS X: ~/Library/Application Support/Sublime Text 3/Packages or ~/Library/Application Support/Sublime Text/Packages
Windows Regular Install: C:\Users\YourUserName\AppData\Roaming\Sublime Text 3\Packages or C:\Users\YourUserName\AppData\Roaming\Sublime Text\Packages
Windows Portable Install: InstallationFolder\Sublime Text 3\Data\Packages or InstallationFolder\Sublime Text\Data\Packages
The exact path depends on version and whether or not you upgraded from Sublime Text 3.
Once in Packages, navigate into the Language - English directory and open either en_US.dic or en_GB.dic (depending on your locale and preference) in Sublime. Hit CtrlA (macOS: ⌘A) to Select All. Next, select Edit → Convert Case → Upper Case and all letters will be capitalized. Finally, select File → Save As…. Navigate up one level from Language - English to Packages, then go into the User directory and save the file there as en_US_CAPS.dic or en_GB_CAPS.dic, depending on which original you opened.
Finally, select Preferences → Settings and add the following to your user settings on the right side:
"dictionary": ["Packages/Language - English/en_US.dic", "Packages/User/en_US_CAPS.dic"],
Change both occurrences of US to GB if that's what you're using. Save, and you should be all set.
If you want to clean up a little at the end, you can delete the Packages/Language - English folder that was created earlier, but things should be just fine if you don't.

Related

Theme for text files in Sublime Text 3

Since one of the last updates the theme for .txt files in my Sublime Text 3 has changed. I am currently using the Monokai Theme for Sublime and would like to have the same theme options for all file types (black background, line numbers on the left, slim right sidebar/margin). Only when opening .txt files the background switches to white and the sidebars/margins become too wide taking half of the screen space.
An example can be seen on the left side of the screenshot. on the right side my sublime settings are displayed:
I have tried changing the "Preferences" -> "Color Scheme... " to any other color scheme. The changes seem to apply to the other file types I use (.json, .csv, .py etc). Only the .txt files seem not to be affected by any scheme changes.
Changing "Preferences" -> "Theme..." doesn't change much.
Neither could I find any specific settings for .txt files in "Preferences" -> "Settings".
There are two potential sources of the problem - an overzealous plugin or a messed-up .sublime-settings file. First, look in your Packages/User directory, where Packages is the one opened when selecting Preferences → Browse Packages…:
Linux: ~/.config/sublime-text-3/Packages
OS X: ~/Library/Application Support/Sublime Text 3/Packages
Windows Regular Install: C:\Users\YourUserName\AppData\Roaming\Sublime Text 3\Packages
Windows Portable Install: InstallationFolder\Sublime Text 3\Data\Packages
In the User directory, look for files named Text.sublime-settings or Markdown*.sublime-settings, then try deleting them (or renaming them to *.bak so they won't get processed).
If that doesn't work, take the list of all installed plugins from Packages/User/Package Control.sublime-settings and put it in your user preferences in the "ignored_packages" setting. Hopefully that will solve the problem. To identify the offending plugin, start removing plugins from "ignored_packages" one at a time until the behavior comes back.

How can I use a right to left language in "Sublime Text" editor

I want to use some strings which are in my language (Persian) in "Sublime Text", but the editor does not show them correctly, for example:
it should be:
<title>عنوان صفحه</title>
but this is how sublime is showing it:
The encoding is set to utf-8.
What should I do to fix it?
There is This Plugin But It Does Not Work Properly
https://packagecontrol.io/packages/Bidirectional%20text%20support
added by barlop
Important Note- As comments indicate, this plugin doesn't really work. People have issues copy/pasting from sublime into notepad. It's OK for viewing but that's not much of an answer.
Note, sublime with this plugin might show leters in the correct order but copy/paste in notepad and it might not so try copy/pasting in notepad first before typing a whole load in there. Also this plugin might not move the cursor in a right to left fashion. (i.e. type a letter the cursor when typing in a right to left language should move to the left)
To install,
i've tested this on ST3 portable.
if you go to the tools menu you see there's no bidirectional option
Then if you go here
https://packagecontrol.io/packages/Bidirectional%20text%20support
see it mentions
their github page here
https://github.com/praveenvijayan/Sublime-Text-2-BIDI
Click on Clone/Download then download zip
extract it and Copy the folder to the packages folder.. i.e. open sublime, do preferences..browse packages , and it gives a folder like C:\Users\harvey\Downloads\ST3\Data\Packages Paste the folder there. (maybe it's better to put it in the user subdirectory, I don't know).
Then go to the tools menu and you see bidirectional options like bidirectional text that weren't there before
And while you're at it you may want to install "package control" if it's not already installed. Go to tools..command palette.. type 'package' see if package control appears. Or go to preferences, see if there is package control listed. If not then you don't have 'package control' installed. You can install package control by going to https://packagecontrol.io/ and click install and it gives you some python code in 2 tabs, one for ST2, one for ST3, and you can paste it into your console(view..console). But it's not strictly necessary you can install the bidirectional package without doing that.
The RTL-Mirror plugin for sublime 3 will show you the correct text by hitting Ctrl+F1 on Windows and OSX and Shift+F1 on Linux. it's not the perefect solution but it helps.
For the last few years my workflow has to been use VS Code as an IDE, for coding, and Sublime Text 3 (sorry, 4) for editing plain text because of its startup speed and because VS Code would be overkill.
However, since it's pretty clear by this point that the ST devs don't intend to implement RTL support, and because I would rather not have to install a third text editor just to deal with RTL text (which there are very few of anyway), there were only two convenient options left for me to open up RTL files on Windows.
Use Windows 10's Notepad (yes, really)
This is the superior solution since the new Notepad works well, starts up faster than Sublime, and not only renders RTL text but renders it quite well. The only downside is the lack of a dark mode.
Use VS Code (or whatever your preferred IDE is)
Both free IDEs like VS Code and paid ones like PHPStorm and IntelliJ seem to support RTL out of the box, but pretty much the only good reason to do this is if you absolutely need dark mode or are not on Windows - otherwise all of them up start up far slower than Sublime, and in the case of VS Code, render RTL text worse than Notepad does (I can't speak for JetStorm IDEs on that front).
Who knows, if I find a better alternative text editor that I can move my custom theme over to I may eventually move away from Sublime completely to another editor, but until then, sticking to two editors.

How to open Sublime Text files in window based on extension?

Is there any way to get Sublime to open all files of a certain extension in the same window? For example, when using a 2x2 grid, I'd like to keep all SCSS files in the upper left, all HAML in upper right, JS lower left and search in lower right. I'd like to use the search function, and have files go to the other three tabs instead of the search window each time.
I've tried the 'open in relevant window' plugin and it doesn't appear to make any difference.
When opening lots of files it gets very tedious opening them and having to manually move them to a window that wasn't active when opening.
Edit: I'm working on a Mac, so I'd need something that works there, or preferably cross platform.
Edit: Op is working on a Mac, I'll leave this in case any windows users are interested in this solution.
---
Perhaps an extra shell extension would help.
If you're familiar with the Registry, you can create a new key that opens all selected files in a new window. Simply create a modified version of what Sublime Text already has.
The existing key for Sublime Text exists here:
HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text\command
With the default value of (depending on version):
C:\Program Files\Sublime Text 3\sublime_text.exe "%1"
You could create a new key like so:
HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text (new window)\command
Then add the -n arguement to the default value:
C:\Program Files\Sublime Text 3\sublime_text.exe -n "%1"
This will create a new window every time you use the shell extension to open files and will keep multiple files organized in the same window.
To take this a step further, if you have any programming experience you could create your own shell extension which takes a list of files and groups them for you, which then in turn can create the new windows programmatically.

Sublime Text 3 Project

I am trying to use sublime for editing and making rainmeter skins, I have installed a plugin that recognizes rainmeter code nice.
In my code I have an #include=\somelocation...
at that location the file has things like colour=something
In the actual file being loaded fontColor=#colour#
How do I get it so that if I change the name of colour inside the location file it would update everywhere else?
You can use the Find in Files... functionality, located in the Find menu. In the Find: box, enter what you'd like to look for (the buttons to the left allow you to search by regex, respect capitalization, and other options - just mouse over for a description). In the Where: box, enter where you'd like to search. If nothing is entered, the search will run in all open files and folders. Click on the ... button for some extra options. Finally, enter what you'd like to replace the found values with (if anything, you can also use this dialog to simply search files).
Clicking Find will first perform the search for you, so you can verify its results. Clicking Replace will do all the replacements.

RTL language with Sublime Text editor

The RTL languages are not supported in the sublime text editor
I tried this plug-in Bidirectional text support
on windows os
Copied all files from the zip Sublime-Text-2-BIDI-master to the ST3 folder and changed the font type and size.
then I copied the unicodedata.pyd to C:\Users\USERNAME\AppData\Roaming\Sublime Text 2\Packages\Bidirectional text support\bidi
now the Tools > Bidirectional text part didn't look gray anymore but it is still disabled.
also I copied these two lines but it didn't work
sys.platform.startswith('win'):
sys.path.append('../../..')
Any help would be appreciated
In order to get Sublime Text to work with Arabic characters using Sublime Text BIDI plugin on Windows correctly, ensure you've done the following:
Copy the plugin folder to the following path C:\Users\USERNAME\AppData\Roaming\Sublime Text 2\Packages\
Copy unicodedata.pyd from ST installation directory to both, the main plugin folder which in your case is Sublime-Text-2-BIDI-master and inside bidi folder.
Set your sublime user-settings to the following:
{
"font-face": "arial",
"font_size": 11,
"default_encoding": "UTF-8",
"fallback_encoding": "Arabic (Windows 1256)"
}
Reload the plugin by viewing rtl.py and saving
In the case that doesn't fix it, you can read what sublime console log outputs when you click on Bidirectional text for a given Arabic text, console log can be accessed through ctrl+~.
Very Easy,
Just follow this Video steps
دعم اللغة العربية في برنامج Sublime
1- Download the Sublime-BIDI-master folder from Github of solution
2- Extract it and paste under \Sublime Text Build (whatever)\Data\Packages(the downloaded folder).
3- open sublime wit any RTL Language file and right click anywhere you'll new options (Bidirectional text) .. Click it :).
However, in my Sublime version (build 3126), Arabic letters will be reshaped when switching to Bidi.
Initially in the range U+0621-U+064A, which are the usual Unicode codes for Arabic letters, characters will be mapped to the range U+FE70-U+FEFC, which are codes for each (isolated, initial, middle, final) Arabic connected forms. These latter codes, called Arabic-Presentation-Forms-B, are deprecated by Unicode and their usage should be very limited.
For example, before switching to Bidi, the word كتب, looks ب ت ك, from left to right U+0643 U+062A U+0628. This is the memory order. (It is up to the final rendering tool to display the string in visual order by connecting letters.)
After Bidi switching in Sublime, the word will appear good as كتب, because the codes are ﺐ ‎U+FE90 followed by ﺘ U+‎FE98 followed by ﻛ U+‎FEDB. In this order. That means, in a Bidi enabled tool like a browser, it will appear ﺐﺘﻛ as the final visual order. This is not what the user expects.
So, not only Bidi switching changes the letters code, it also changes the memory order.
Personal experience.
When editing a source file (HTML and other languages or formats) containing some RTL characters, it is really tricky to navigate in the text edited. So the mode "before" (logical or memory order) might be very helpful than the mode "after" (visual or display order). With logical order, it's useless to join letters, it doesn't make sens.
Check this link, I had the same problem but solved it with the Sublime Text BIDI plugin.
I was still facing an issue because of the editor's font. It will be recommended to use a fixed-width font like Courier New. This should ensure the plug-in works as expected.

Resources