TextMate Live Preview of GFM (GitHub flavored Markdown) - textmate

I found TextMate support for GitHub flavored Markdown
http://github.github.com/github-flavored-markdown/
and now try to install (lots of ruby stuff needs to be installed, struggling..)
then will try to have live preview feature.
Perhaps, it is possible with a shortcut key, but is it possible on every modification without saving the file?

Yes, it's possible to make a preview without file saving, just run Bundles > Markdown Redcarpet > Preview or here is a shortcut for this: ⌃+⌥+⌘+P.
To use a keyboard shortcut properly, I recommend to uninstall original Markdown bundle.

Related

Rubymine HAML autocompletion similar to SublimeText 3

I have a SublimeText 3 and RubyMine 2016.1 versions installed. When I work with HAML files in Sublime, I have a nice auto-completion similar to this:
As I type h1 and press Tab it becomes %h1, so I don't have to type % symbol.
Tried the same thing in RubyMine and nothing happened.
How can I achieve same auto-completion feature in RubyMine HAML as I had in a Sublime? Is that even possible or should I consider this behaviour as a feature of RubyMine IDE?
Thanks!
I don't think this kind of auto completion is supported in Rubymine.
By the way, even the code completion in HTML templates requires you to first type the < character so that auto-completion starts presenting suggestions, so I guess it is a general intention of the Jetbrains team to require the user to type the special character (such as % in HAML) first.
For a while I thought you might be able to add this functionality using Textmate Bundles import (Textmate bundles use the same format as Sublime bundles), but it appears that only the syntax-highlighting rules in them are supported in Rubymine. So this approach probably won't work either even if you managed to find a bundle with the auto completion feature for HAML files.

Customising the syntax colour in Sublime Text 3

I'm in the process of creating my own syntax colour theme for Sublime Text 3. I've done quite a lot but I want to copy most of the JavaScript colour syntax from the default 'Cobalt' theme that comes with ST3 (and possibly mix-and-match from other themes). I can't seem to find the Cobalt theme anywhere on my Mac?
Any ideas on where this might be?
Instead of navigating through /Applications, the easiest way of accessing built-in packages in Sublime Text 3 is to use #skuroda's excellent PackageResourceViewer plugin, available through Package Control. Once installed, restart Sublime and hit ⌘ShiftP to open the Command Palette. Type prv to bring up the PackageResourceViewer options, and select Open Resource. Scroll down to Color Scheme - Default, hit Enter, then scroll down to select Cobalt.tmTheme and hit Enter. You can now hit Esc to get rid of the menu, and start looking through the theme file for the bits you want to copy.
Good luck!
In Sublime Text installation directory, if I'm not mistaken, that's /Applications/ on OS X, there's a Packages directory, which contains a package file Color Scheme - Default.sublime-package which contains all the default color schemes.
.sublime-package is a simple zip file with modified extension, so you may simply copy it somewhere in your home directory, extract it and browse through the Cobalt.tmTheme file.
P.S. If you have trouble opening it with OS X archive manager, you may simply rename it:
mv name.sublime-package name.zip
But as far as I remember, it could be done simply like (correct me here if I'm wrong)
unzip name.sublime-package -d somedir

Beginner's TextMate Question

So I'm coming from the world of Visual Studio wherein which I have "intellisense" and certain keyboard shortcuts (thanks also in large part to ReSharper). I am transitioning to the Mac and have a copy of TextMate.
How do you get it to automatically place a closing HTML tag when you create a new one? Is this a "bundle" and if so how do I get it to work.
Sorry, beginner's question
Assuming you are in HTML mode... (look at the status bar at the bottom)...
Type a word then press ctrl <
That will use the word to create open and close tags for the word (e.g. table)
table^<
<table></table>
You can use the "Tab trigger" snippets from the HTML bundle (installed by default). For example, if you want a body tag, you can type:
body[TAB]
and TextMate will insert the full opening and closing tag.
For more on the various HTML bundle capabilities (because there are several) see http://manual.macromates.com/en/bundles#html

Vim key bindings in Xcode?

Is there any way to have Vim key bindings in Xcode?
If you still interested in Vim keybinding plugin for Xcode I made one. Here it is.
http://programming.jugglershu.net/softwares/xvim.html
This is currently developed for personal (my) use. So you may feel bad with some lack of implementation. Give me a feed back(feature request) then. I'll add some keybinds if I have enough time.
#pkamb's answer is correct, but slightly out of date. In the Xcode 13 GM, Apple tweaked how to enable Vim keybindings.
To improve access to the Vim Mode, Xcode replaced the Enable Vim key bindings preference with an Edit > Vim Mode menu item. (75491567)
The next best thing is JetBrains' excellent Objective-C IDE AppCode. They have a great Vim plugin called IdeaVIM that is actively maintained.
I use MacVim as editor instead xcode. For code completion i use vim plugin named clang_complete - awesome plugin.
Xcode 13 in 2021 has added native Vim key binding support:
Xcode > Preferences > Text Editing > Editing > Enable Vim key bindings
https://developer.apple.com/xcode/
Vim mode
Many common key combinations and editing modes familiar to Vim users are supported directly within the code editor, using the new bottom bar to show mode indicators.
I myself use and really appreciate Shu's XVim, but for completeness and in case you're still interested, just recently viemu has opened its beta for Xcode, you can check it out at
http://www.viemu.com/blog/2013/05/01/viemu-for-xcode-public-beta-available/
I haven't tried it yet, but there's also $20 ViCiOUS. Right now, I use Shu's XVim plugin (cf. his answer), and recommend it.
ViEmu is finally available for Xcode, check it out. It uses the same vim emulation engine that they are using for their Visual Studio plug-in, so all the polishing that has been added to the product since 2005 is there.
I'm not affiliated to them, but I tested ViEmu and if it was available for Xcode 5, I would have paid for a license.
Try Editor -> Vim Mode in Xcode =>13.
It supports most of the common key bindings but there are exceptions, which is understandable given it's a relatively new feature. Most notably for me is the lack of support for a .vimrc file so if you want that (or just want more features) you can still use https://github.com/XVimProject/XVim2. Judging by the current maintainer it might eventually be made redundant by Xcode's default vim support but it still works well for me.

Code Formatting In Xcode

Is there anyway to format the code in Xcode like you can do in Eclipse or Netbenas. I have not found any option in menu, is there any hot key for this or its simply not in Xcode?
In Xcode 4, it's been moved to Editor > Structure > Re-Indent command (and has a default shortcut of CTRL+I ).
Select some text and then: Edit->Format->Re-Indent
You can bind this to a hotkey in the preferences.
Well, first of all welcome to 2021. I know it's a very old question but still people like me visit this and for those people, I'm putting out multiple available solutions in one answer that worked for me after 2 hours of research and testing.
Re-Indent
As everyone else is suggesting, it's one of the default solution if you just want to re-indent the lines of code:
Goto: Editor -> Structure -> Re-Indent or use shortcut control + I
Using Xcode Extensions
There are 2 extensions I found and used which works charmingly for me.
1) SwiftFormat: mentioning the steps to install the xcode extension here from the readme.
Like the command-line tool, you can install the SwiftFormat for Xcode
extension application via Homebrew. Assuming you already have Homebrew
installed, type:
$ brew install --cask swiftformat-for-xcode
open the SwiftFormat for Xcode.app that you just installed. there you can change the rules of formatting.
After that, open the system preference -> extensions -> xcode source editor and mark the checkbox for SwiftFormat.
Restart the Xcode
Voila! You're good to go. you can use three options. format selected code, format entire file OR just lint file.
2) Swimat: (it is already mentioned in one of the answer here by #Guy Daher) steps to install from readme
Install via homebrew-cask
Homebrew latest version
brew install --cask swimat
Similar to above extension installation, open the Swimat.app if it does not open then try to sove it from system preferences -> security & privacy -> open swimat app
after opening, click on install in ./bin folder to make it work globally (not sure about this step but I just did it)
Restart Xcode
now you can goto editor -> swimat -> format
Bingo! You're good to go.
Additional uninvited help
You can simply set the keybinding to use any of this command. i.e. I've set the android studio default command to reformat the code as option + command + L
ps If anyone else found a better extension, please let me know in comment, I'll add it to the list.
Other than re-indentation (Edit > Format > Re-Indent), not really. However, Xcode does have support for scripts (the menu to the right of the Window menu), so you could conceivably write a script that formats your code how you like it.
Edit: here are some links that touch on this subject:
http://hackertoys.com/2008/09/18/adding-a-code-beautifier-script-to-xcode (dead link)
http://8020world.com/jcmendez/2006/11/geeky-stuff/software/adding-a-script-menu-to-xcode-to-reformat-code-using-astyle (dead link)
Here are the shortcuts, to format the code in Xcode
1.Format entire code (entire class/controller)
select the entire code and press ⌘+| on mac to format your code.
2.Format particular block of code
select the code and press
⌘+] for right move and ⌘+[ for left move
Note : as per #JavierGiovannini sugesstion you can do using Editor Menu option
3.Select code --> Go to Editor --> Structure --> Re-Indent
My personal favorite code formatter is Uncrustify.
It has many, many options, so I also suggest you download UniversalIndentGUI, a GUI to help set Uncrustify's behavior to your liking.
XCode 8 Extensions
Another option is to use an extension like Swimat. Does the job for me. However, the caveat is that it does not format on save due to the restrictive Xcode Extension APIs, but they're trying to find a workaround.
Not saying this is best approach, but for completeness, if you cut and then paste the code back in, Xcode will automatically format it for you.
In v.4 you can make some adjustments through xCode preferences...
Fix code indentation in Xcode
^-I (control - capital i)
: format the current line
⌘-A + ^-I
: format the whole code file
Try this solution: ⌘A [⌘K ⌘F]

Resources