Using several languages in Sublime Text 3 spell check - sublimetext2

I have two dictionaries: ru_RU and en_US. How can I use it together in Sublime Text 3 spell check? Is it possible?

This is currently not possible. It has been mentioned in the official issues list for ST3 - see this issue for details.

I have this working for me using this steps.
Download your dictionary (e.g. from GitHub or following the README.md recipe in this respository).
Create a folder in your Sublime Text 3 config (e.g. "Language - Spanish"), this will be the name shown in the ST menu, and move the dictionary inside this folder.
~/.config/sublime-text-3/Packages/Language - Spanish
Be sure that spell checking is active and the dictionaries as well in your preference settings:
"spell_check": true,
"dictionary": [
"Packages/Language - English/en_US.dic",
"Packages/Language - Spanish/Spanish.dic"
],
Now you can switch the current spell checking:
View > Dictionary > Language - Spanish > Spanish

For me was solved following this instructions:
https://www.sublimetext.com/docs/3/spell_checking.html
I've downloaded the dict files from:
https://github.com/SublimeText/Dictionaries
Then I simply copy the UTF-8 encoded dictionary files (in my case Spanish) into Packages/Language - Spanish/ (You can access it from Preferences/Browse Packages).
Then activate by adding this line to user setting's
"spell_check": true,
Or by View/Spell Check menu.
You can select the dictionary from the View/Dictionary menu.
It would not be an easy task to create the affix for a "merged" language, like 2 dicts working at once. In my case I'd love some Spanglish dict... have to work on it.

Related

Sublime Text - find all instances of an html class name project-wide

I want to find all instances of a class named "validation" in all of my html files project wide. It's a very large project and a search for the word "validation" gives me hundreds of irrelevant results (js functions, css, js/css minified, other classes, functions and html page content containing the word validation, etc). It can sometimes be the second, third, or fourth class declared so searching for "class='validation" doesn't work.
Is there a way to specify that I only want results where validation is a class declared on an html block?
Yes. In the sublime menu go to Find --> Find in Files...
Then match what is in the following image.
The first thing you will want to do is consider other possibilities with how you can solve this problem. Currently, it sounds like you are only using sublime text. Have you considered trying to use a command-line tool like grep?
Here is an example of how it could be used.
I have a project called enfold-child with a bunch of frontend assets for a wordpress project. Let's say, I want to find all of my scss files with the class "home" listed in them somewhere, but I do NOT want to pull in built css files, or anything in my node_modules folder. The way i would do that is as follows:
Folder structure:
..
|build
|scss_files
|node_modules
|css_files
|style.css
grep -rnw build --exclude=*{.css} --exclude-dir=node_modules -e home
grep = handy search utility.
-r = recursive search.
-n = provide line numbers for each match
-w = Select only those lines containing matches that form whole words.
-e = match against a regular expression.
home = the expression I want to search for.
In general, the command line has most anything one could want/need to do most of the nifty operations offered by most text-editors -- such as Sublime. Becoming familiar with the command line will save you a bunch of time and headaches in the future.
In SublimeText, right-click on the folder you want to start the search from and click on Find in Folder. Make sure regex search is enabled (the .* button in the search panel) and use this regex as the search string:
class="([^"]+ )?validation[ "]
That regex will handle cases where "validation" is the only classname as well as cases where its one of several classnames (in which case it can be anywhere in the list).
If you didn't stick to double quotes, this version will work with single or double quotes:
class=['"]([^'"]+ )?validation[ '"]
If you want to use these regexes from the command line with grep, you'll need to include a -E argument for "extended regular expressions".

Sublime ignores syntax specific tab size for new files

I am using the latest Sublime Text 3, and have this in a syntax specific config for JavaScript
{
"translateTabsToSpaces": true,
"tabSize": 2
}
But every time I create a new file, it defaults to 4 spaces. I have tried adding "detect_indentation": true but then ALL files started to be 4 spaces for tabs, ignoring the syntax specific config even further.
Am I missing something?
Your settings names are incorrect. Sublime uses snake_case variables, not camelCase. Your JavaScript.sublime-settings file should look like this:
{
"translate_tabs_to_spaces": true,
"tab_size": 2
}
To see all of the available settings, select Preferences → Settings—Default.

Importing foreign languages from csv file to Stata

I am using Stata 12. I have encountered the following problems. I am importing a bunch of .csv files to Stata using the insheet command. The datasets may conclude Russian, Croatian, Turkish, etc. I think they are encoded in "UTF-8". In .csv files, they are correct. After I imported them into Stata, the original strings are incorrect and become the strange characters. Would you please help me with that? Does Stat-Transfer can solve the problems? Does it support .csv format?
For example,
the original file is like:
My code is like:
insheet using name.csv, c n
save name.dta,replace
The result is like:
And I have tried to adjust the script in the fonts option, which does not work.
As #Nick Cox commented earlier, the problem is that Stata just doesn't support Unicode/UTF-8 encoding.
No, StatTransfer wouldn't resolve the problem (please refer to this explanation).
You can do the trick using an online decoder or MS Word. Let's do it with one language first, say, Russian as in your screenshots. Check out the correct encodings for Croatian, Turkish, and other languages you have.
Save the string variable from your .csv file as plain text (.txt), choosing the UTF-8 encoding option.
Encoding conversion:
Use iconv, suggested by #Dimitriy V. Masterov, or
Use an online tool, such as this: upload .txt file, choose source encoding as UTF-8 and output encoding according to the language of interest (for Russian, it must be CP1251), click "convert" button and save the output file, or
If you have MS Office, you can use also MS Word for the same purpose. Right click on .txt file, choose "Open with...", choose to open with MS Word. In the appeared window, confirm that the file encoding is "Unicode (UTF-8)", open, then click "Save as...", save as plain text. In the newly appeared window, choose "Cyrillic (Windows)" and mark "Insert line breaks". Save.
Check out your new .txt file - it still should have some strange characters (like ÌßÑÎÊÎÌÁÈÍÀÒ) but now Stata can display them properly.
Copy-paste the new string variable in Stata Data Editor, right click on the variable, choose "Font...", and then string "Cyrillic". You should see correct names on the screen both in data editor and in the results window (even though the string itself is intact).
Depending on your OS, you might need to install all appropriate languages first.
Hope it helps.
Update Answer: As of version 14, all of Stata is Unicode aware. That is results, help files, do files, ado files, data labels, etc.
This does not help users limited to accessing versions of Stata before 14, but is one kind of solution. Using the OP's example:
. insheet using "/home/Alexis/Desktop/data.csv"
(3 vars, 4 obs)
. ed
. list
+------------------------------------------------------------------------------+
| v1 v2 v3 |
|------------------------------------------------------------------------------|
1. | RU00040778 RUS ПРAЙCBOTEРXAУCKУПEРC AУДИT |
2. | RU00044434 RUS КПMГ |
3. | RU00044428 RUS Эрнст энд Янг |
4. | RU00044428 RUS Аудиторско-консулбтационная группа Раэвитие Биэнес-систем |
+------------------------------------------------------------------------------+

Save panes layout generated by Origami in Sublime Text 2

Thanks to this great plugin : Origami
I am able to obtain the following layout :
How could I save this view to call it from the view/layout menu ?
You can get the layout data from the Auto Save Session.sublime-session file, under the "layout": key. This file is in standard JSON format, and can be opened in ST2 just fine (select View->Syntax->JavaScript->JSON for syntax highlighting if you want). For OSX, this file is (probably, I'm not in front of my Mac at the moment to verify) located in ~/Library/Application Support/Sublime Text 2/Settings - it should be in the same directory as the Packages/ folder where plugins etc. are stored.
So, to make a keyboard shortcut, set up your Origami layout, then perhaps move some files around, search for some text, anything to update the Auto Save Session.sublime-session file. It may already have updated after changing your layout, so check the time stamp to make sure. Then, open the file and search for layout. Copy the contents of the key - the "cells":, "cols": and "rows": keys inside the curly braces, as well as the curly braces themselves. Then, open Sublime Text 2->Preferences->Key Bindings-User and add the following to it (include the square brackets if you don't have anything in this file yet, omit them if you already do. If you already do, make sure to add a comma , after the last curly brace of the item before):
[
{
"keys": ["alt+shift+o"],
"command": "set_layout",
"args":
|
}
]
Set your cursor where I put the | character after "args": (make sure you delete the |) and paste in the contents of the "layout": key from Auto Save Session.sublime-session you copied earlier. Save the file, and you should now have a keyboard shortcut AltShiftO (O for Origami) that will restore your layout for you. If you have more than one layout you'd like to save, repeat the steps above, and just change the "keys": value to another key combination. If you have a lot of plugins, I highly recommend #skuroda's FindKeyConflicts plugin, which is available through Package Control under the same name. With it you can get a full list of all current key mappings, so if you're planning on assigning a new one you can check to see if it's already taken. The plugin does more, as well, so if you're a plugin dev, or just a customization/macro geek like me, it's really quite useful.
As a caveat, with the complexity of the layout you displayed above, the "layout": key is going to be quite large and complex, and is made larger by the fact that each value in the "cells":, "cols": and "rows": keys is on its own line. I don't know enough regex to clean everything up automatically, but I'm sure it can be done.

Switching between spell checking dictionaries in Sublime Text 2

Is there a way to quickly switch between spell checking dictionaries in Sublime Text 2? I don't want to edit the configuration file each time I write in a different language.
View >> Dictionary >> Select the dictionary you want