How to set TextMate Soft Tabs to 1? - textmate

I want my tabs to be 1 space only, however, TextMate does not let me do it. Is there a way of doing it?
thanks

Click the tab size popup in the status bar, enable soft tabs, select "other..." and set it to 1.
Source- the textmate website:
4.11 Using Spaces Instead of Tabs
TextMate can use spaces instead of tab characters. This is done by clicking the “Tab Size” pop-up in the status bar and enabling Soft Tabs.
This setting will only affect the current language and all languages with a common root that do not have the option set yet. The same applies to the state of spell checking, soft wrap and the actual tab size.
When soft tabs are enabled, TextMate will for the most part act exactly as if you were using hard tabs but the document does indeed contain spaces.

set a .tm_properties file in either ~/ or your project root to with the following content:
softTabs = true
tabSize = 1
Your preference is, like comments imply, rather strange, but serviceable nonetheless.

Related

TextMate 2 Escape key: how to disable next completion and previous completion

By default, pressing Esc in TextMate cycles through possible completions (in addition to closing dialog boxes), which can put unwanted characters in your document, especially if you are used to Esc being a safe key to hit in most text editors. (In fact, in a lot of IDEs, pressing Esc a lot is necessary to close auto-completion popups so the up and down arrow keys work.)
How do I disable this behavior, so in normal text editing, the Esc key does nothing, but closing dialogs still works as expected?
What works
Based on a comment from #matt I found that I can do what I need by overriding the default key binding, as mentioned here, https://manual.macromates.com/en/key_bindings.html :
In addition TextMate has a /path/‍to/‍TextMate.app/‍Contents/‍Resources/‍KeyBindings.dict file with some extra key bindings which are specific to TextMate (and thus not appropriate to put in the per user global key bindings file). You can copy this file to ~/Library/‍Application Support/‍TextMate and edit it, this will then take precedence over the bundled file.
I edited the file and took out the line with nextCompletion, assigned to shift+Esc ($\033) and assigned both Esc and shift+Esc to call noop
"\033" = "noop:";
"$\033" = "noop:";
I learned about the existence of the noop selector here:
https://github.com/textmate/textmate/search?utf8=%E2%9C%93&q=noop
After quitting and relaunching TextMate Esc now does nothing except close dialogs.
(Apparently to change this one setting, you need to know Objective-C to recognize selector strings, (and assembly which has 'nop') so you can guess that there should be a noop selector. And you need to know octal, so you recognize the Escape key as 033 = 27.)
Things I tried that failed
EDIT: for reference for people wondering how it can take 90 minutes to change one little setting.
I found this paragraph in the manual, at the end of section 4.2:
When you provide your own completion command (or list) you may want to
disable the default matches. This can be done by setting
disableDefaultCompletion to 1.
I tried setting disableDefaultCompletion to 1 in the Preferences > Variables pane and quitting and reopening the app. I found that Bundle menu > Select Bundle Item and clicking Settings shows a list of all the settings, including my disableDefaultCompletion = 1 at the bottom. Apparently this doesn't do anything? (Other settings overridden by different bundles show as crossed out, which my settings is not.)
I also searched the http://github.com/textmate/textmate repo for the string disableDefaultCompletion and it shows in the search results, so this is feature should exist there somewhere.
I tried quitting the app and then on the commandline:
defaults write com.macromates.TextMate disableDefaultCompletion true
Relaunching and trying again (hitting Esc to the right of a close } in JavaScript mode) and it is still not disabling completion.

Disable word-wrap by default in Sublime "Find in Files" results

Sublime's "Find in Files" (CTRL-SHIFT-F or CMD-SHIFT-F) search results always have word wrap on by default. This is really annoying whenever a file containing a single huge line of text gets caught in the results, since:
wrapping the huge line takes ages and slows Sublime (and perhaps the whole computer) to a crawl, and
it makes the results difficult to read, since the wrapped line may take up screens and screens of space
It's possible to disable word-wrap from the "View" menu, but this change doesn't persist after closing the "Find Results" tab.
Is there a way to turn off word wrap for all Find Results?
Yes, with the Find Results tab active (ensure the "Use Buffer" option is enabled in the Find in Files panel to get a tab instead of an output panel when you perform the search), you can navigate to the Preferences -> Syntax Specific menu item and enter:
"word_wrap": false,
and save it. This will ensure that word wrap is always disabled for Find Results.
(You can always turn "Use Buffer" off again afterwards, it's only necessary for the menu item to open the correct syntax specific settings file, which is Packages/User/Find Results.sublime-settings.)
In default, Sublime opens the files without word wrapping. If you want to enable it, just go to Preferences > Settings and add "word_wrap": true to the Preferences.sublime-settings file

Changing all my indents to 3 spaces. Code::Blocks

I have to submit an assignment and they want all the indents to be 3 spaces. I don't know how to change the settings of Astyle.dll so that it will change them 3 spaces instead of the default 4. Any ideas?
Also, Astyle seems to like having no indent between switch() and its cases, and I need there to be an indent there. Any ideas?
All of Astyle's settings are exposed in the Code::Blocks editor settings dialog. To access them, open the Settings menu, click Editor, and scroll through the sidebar to find the Default code entry.
I have to submit an assignment and they want all the indents to be 3 spaces.
Switch to the Indentation tab, found under Source Formatter in the sidebar, and change Indentation size (in spaces): to 3.
Also, Astyle seems to like to have no indent between switch() and its cases, and i need there to be an indent there.
If I understand what you need correctly, check the box that says Indent switches (keyword case:) and check the box that says Indent case: statement in switches (commands under case:).
You can change any other settings you want as well. When you're done, hit OK, then reformat your code and make sure the settings are set the way you want them.

How to disable seemingly random syntax higlight in Notepad++

Can anyone suggest:
Why does it higlight like this? I don't seem to do anything to activate it:
How to disable it?
This is old, but I ran into the same problem and just figured out an easy fix.
From the file menu: Language > N > Normal Text
I'm not sure if this is the same issue as mine, but I wanted to keep the language setting enabled but remove the highlighting.
I did this by going to Settings --> Preferences --> Highlghting
Removed the Enable check mark for Highlight Matching Tags.
1) Go to settings -> Style Configurator.
2) Select the language that Notepad++ has chosen, usually based on filename extension. You can also change this manually under the Language menu setting.
3) Go through the Styles until you find the style that applied the highlighting. You can tell because the Background colour will match the highlighted color.
4) Change Background colour to white.
I do not have an answer for your first question
For your second question do the following steps
Inside Notepad++ press ctrl A( select all)
Right click for context menu.
select Remove style and click on Clear all Styles
This will clear all the highlights.
FYI. You may also see this sort of behavior when using a vertical edge in background mode. Switching to line mode will eliminate the highlighting of lines that run over the set character count for the vertical edge.

Textmate 2 indentation with Python

When I indent by tabbing "Tab" key, the tab is replaced by 4 spaces. Does anyone know how could I set it to normal?
At the bottom of the editor window there is a menu for tab size, you can set the desired width there as well as turning on soft tabs which inserts spaces instead of tabs but treats them as tabs when editing. Your choice will be saved based on the active file type so make sure to set it when in a python file.

Resources