Sublime autocomple: Is it possible to preserve the case of typed letters in plain-text file? - sublimetext3

When I type: Te sublime provides a long autocomplete list like:
test, tested, team, testing, testphp, ..... (These words are exiting in the current text file)
Then I choose tested from the list and press tab, autocomplete happens and finish the word as:
tested
Now What I want is to preserve the case of the 1st letter (that is T in this example). It should not change the case of already typed characters.
The word after completion should be:
Tested
Is that possible with any sublime setting or a package?

Sublime's autocomplete is case-sensitive, because so many programming languages are as well. For example, in Python, test and Test are completely different identifiers and can't be used interchangeably. So, if you only have test somewhere in your buffer (or project), and you type in Te and hit Tab, it will autocomplete as test, not Test. However, if you have both test and Test already existing in the buffer, it will autocomplete Te properly as Test.
Package Control does not appear to have any plugins that are related to case-insensitive autocomplete, although with the current Sublime Text 4 API including classes such as CompletionList and CompletionItem, it should be possible to write such a plugin.

Related

MBCS File Menus generate ???? Characters

I am working on an MBCS app using MFC. I am trying to support Asian languages. For the purposes of this discussion, we'll say I'm trying to support Chinese. I am able to support Pop up dialogs via MessageBoxW and Dialog SCREENs by pasting Chinese characters directly into the RC file. I can't get file menus to work using either resource view or editing the RC file directly. Whenever I type in ANY Asian character, the screen shows ???. One ? for each character. I have tried modifying the menu in C++ using ModifyMenuW. I get more question marks. Visual Studio shows everything working, and the RC file is unicode (UTF-16). I can't easily convert my project to unicode mode. Spanish, French, and German all works fine (one of the Essets in German doesn't work, but that isn't a show stopper). What should I try next?
Thanks in advance!
Well, the easy answer would be change the application to Unicode, but this is not always simple, or possible at all.
Concerning using Unicode in a MBCS application, some things are possible and some others not. For example, I have made a MBCS application displaying and editing translations of program strings (messages, menues etc) in a ListView control, however ListView does have a specific message to turn it to Unicode (LVM_SETUNICODEFORMAT) and support operations (see also CCM_SETUNICODEFORMAT). Menus aren't controls though, but they do have "wide" (Unicode) functions.
If you want to use Unicode in your application, there are some tests you need to make. Success is not guaranteeded, but you can at least draw some conclusions and determine whether what you want to do is possible.
Test1:
You mentioned trying ModifyMenuW(), but this will try to modify an existing menu. Instead, try InsertMenuW() or InsertMenuItemW(). Any unicode string should be displayed properly, so try not just Chinese, but other laguages too (eg Greek or Russian). And btw, I can't see how French works and German doesn't (they use the same codepage - West European). What's the system codepage of your test-machine?
Test2: (if the above has failed)
Try changing the whole menu (SetMenu()) with having a single (unicode) menu item as its root.
Test3: (if the above have failed)
Then you need to check whether the window containing the menu must be Unicode. Create a simple "Hello World" Win32 application, or find a sample, if Visual Studio does not do this for you (these basically register the window class, create the main window and start the message-loop) - you must add a menu too, using the "wide" version of the menu functions explicitly. If this doesn't work, try changing the code that creates the window to unicode. This way you will know whether you need a unicode window, to own the menu.
Please make these tests and let us know the results. I will further post if needed.

How to highlight variables in sublime?

How to highlight variables in sublime text 3? like in netbeans
Your question is not very clear, but here are some options. First, if you're just trying to get variables highlighted differently, you'll need a color scheme with more options than the default Monokai. There are many available on Package Control, but one in particular that I know will work (since I'm its author) is Neon:
You can use the excellent tmTheme Editor to see how this or hundreds of other themes will look (sort of) in different languages. (I say "sort of" because the highlighting engine used on the website is different than the one in Sublime, so there will be some differences. Overall it's pretty good, though.)
On the other hand, if you're trying to highlight all the instances of the $page variable, you'll have to do two things. First, double-click on $page to select it. Then, select Find -> Quick Find All (or use its keyboard shortcut) to select all the instances of $page in the document:
The gutter icons and colored underlines are from the BracketHighlighter plugin
Unfortunately, this is the only way to get this to work when using PHP and other languages like JavaScript that denote variables with a $ or other symbol. If we were to use Python, for example, you could just double-click on page and it would look like so:
As you can see, all the other instances of page have boxes around them. This behavior is hard-coded into Sublime, so while it can be turned on and off, it can't be modified or told to recognize other characters in any way.
Good luck!

How can I create a short cut to wrap selection sublime text

I want to be able to select some content in sublime text, then press cmd+ctrl+l and then the selected content to be wrapped with an advanced version of markdown link. for example
[ $selection ](linkGoesHere "titleGoesHere")
You can likely get this working by writing a snippet or plugin to suit your needs.
You will be able to bind a plugin to your preferred keystroke, but snippets are triggered as you type in your file. Therefore a plugin is more likely to be your solution (since this requires some text to be written, selected, then the command executed), but if that ends up as a dead end, you might be able to use a snippet to accomplish the same task.

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.

Creating your own LaTeX keyboard layout : 1 key = multiple caracters

I've been looking for the answer for quite some time now. This is a project I have but I can't manage to find a way to do it. The main idea would be to plug an additional keyboard on my computer that write multiple letters by hitting only one key. For example, instead of writing down a (when I hit the a key), it would write \textbf{ (for example).
I already manage to find the keyboard layout file under Linux and to switch the a and b keys, but I cannot find a way to print multiple characters.
I know it exist editors (like Texmaker or Kile) that have auto-completion, but I'm most of the time working in project in groups and therefore we use writelatex.com which does not propose auto-completion in it's free user pack ! Besides, I'm doing that for my personal interest.
Thanks a lot.
Have a look at autokey. It can assign phrases to hotkeys. It requires X11.
Another option might be to use a powerful text editor like vim or emacs which both have features like this, and then copy/paste the text into writelatex.com.
Some browsers have add-ons that allow you to edit the contents of a text field on a web page with a chosen text editor.
Edit: In Xorg you can use the X KeyBoard extension to e.g. change the meaning of individual keys. While you can configure the keyboard to generate (multibyte) unicode characters, you cannot assign arbitraty character strings to one key, to the best of my knowledge.

Resources