Can I create a "insert FIXME / CHANGED list" bundle in Textmate 2? - textmate2

In Textmante 2, I have a very usefull bundle: todo ->, this inserts:
=begin
TODO:
=end
then, when I use “show TODO list” bunlde I can see TODO, FIXME, CHANGED… code, but I can’t insert FIXME or CHANGED when I type fixme -> or changed -> as I do with todo ->
Can I create a insert CHANGED list bundle with Textmate 2?

It is so easy as create a new "command type" item from menu:
From Edit Bundle. menu File -> New, and then choose "Command" type, as is in "insert TODO list", then I have copied/pasted from insert TODO list, but I supose there is a way to not DRY (Dont Repeat mYself), but in Textmate i don't know how to don't DRY

Related

How to let Vim show a list of alternative file paths of the same basic name when use gf?

I know, in Vim, gf leads me to the file (actually the first one) whose name is under or after the cursor, n gf leads to the n th file with the same basic name.
I wonder how I can let Vim show a list of all alternatives(if there are), just like g<C-]> to give a list of those for a symbol under the cursor, so I can select the one I'm interested in.
Generally speaking, I need this feature to jump to a c header file that I care.
e.g.
/usr/include/x86_64-linux-gnu/bits/string.h
/usr/include/string.h -- I care this
/usr/include/linux/string.h
How about Smartgf? From the page:
It's better than default gf because:
It doesn't use ctags. So you don't need to run anything after changes.
It shows you all available matches.
...
Use 1-9 keys as quick shortcuts to select search result or use j,k to change cursor
position in the dialog and o,Enter to choose selected item.

develop Haskell code with vim and haskelmode plugin

I have a silly question, I'm sure, I use vim with haskell-mode plugin to develop on haskell but I'm not sure how to enable the keys combination define on the haskellmode -vim, for example:
|_ct| create |tags| file
|_si| show info for id under cursor
|_t| show type for id under cursor
|_T| insert type declaration for id under cursor |balloon| show type
for id under mouse pointer
|_?| browse Haddock entry for id under cursor
|_?1| search Hoogle for id under cursor
|_?2| search Hayoo! for id under cursor
how to type a command on vim that start with '_' (I know there said that this represent cursor and than I suppose that I just have to type 'si' for that field but nothing is happened) on which mode have to type it, I suppose on normal mode. I work on Mac but the same problem I have on linux.
Thanks
Sorin.
From the documentation:
Finally, the mappings actually use <LocalLeader> behind the scenes, so if
you have to, you can redefine maplocalleader to something other than '_'.
Just remember that the docs still refer to mappings starting with '_', to
avoid confusing the majority of users!-)
So you must press _, then C, then T in rapid succession to create a tags file for your project.
Unless you have set your <LocalLeader> to something other than _.

SublimeText: How to find the command for "Next Build Result" to map it to a different key?

Background: I am working on an SML file on SublimeText3 with build system setup.
After a build, i can successfully jump to the first error using the F4 key. I want to add another key mapping for the same "Next Result" command eg:Cmd+N in Vintage mode.
What should i add as in my keybindings file to achieve this?
What documentation,file did you refer/look around to find the proper answer for question 1? What was your thought process in brief to figure it out ?
edit: changed the required keybinding from <leader>cn to Cmd+N to make things easier
For future reference, you can type sublime.log_commands(True) into the Sublime console and then the command name of every action you do will get printed to the console. Once you get the command name you need, you can stop the command printing with sublime.log_commands(False)
You can find the command being called on a default key-binding in the default key bingings file. This file is opened using the menu:
Preferences > Key Bindings - Default
Inside this file you must find the entry corresponding to the keys you are looking for, in this case f4 key is mapped to next_result command as you can see in the key binding:
{ "keys": ["f4"], "command": "next_result" }

How to comment or uncomment code in Textmate 2

How do I comment or uncomment code in Textmate 2?
I came across How do I use a shortcut to comment out code automatically in Textmate? , but it's for Textmate 1.x, and "Bundles" > "Source" > "Comments" doesn't have "Comment line".
I'm using TextMate 2.0-beta.7.1.
I recall disabling command + / because it was causing problems while working on Rails apps, but I assumed that would just disable the keyboard shortcut, not the ability to comment and uncomment lines.
In TextMate 2.0.19 you can comment, or uncomment, a line or selection with the shortcut Cmd (⌘) + /.
If this shortcut doesn't work for you, you can do it like this :
Select Bundles in the menu bar
Select Source
Select Comments
Select Comment line
Happy coding 🖖
TIPS
Define a new shortcut for comment or uncomment
If the native shortcut doesn't work for you, define a new one like this :
Select Bundles in the menu bar
Select Edit Bundles...
Select Source
Select Menu Actions
Select Comments
Select Comment Line / Selection
Click on Key Equivalent
Type your shortcut
Close the Bundles editor
A prompt will ask you to confirm your changes
Test it!
Others useful shortcuts
Insert Block Comment : Option (Alt, ⌥) + Cmd (⌘) + /
Insert Comment Banner: Select the word or text you want to use as a banner and Ctrl (⌃) + Shift (⇧) + B
Insert Comment Header ( This will insert the name of the script and some useful details): You have to define it 😅 because in my case it was empty... I defined it with Ctrl (⌃) + Shift (⇧) + N
Use Help in TextMate 😉
Select Help in the menu bar
type "comment"
This will brings you directly to the option comment line. I suggest doing that first because in most cases, you will find the answer.
Bundles -> Source -> Menu Actions -> Comments -> Comment Line
Is that what you're looking for?

Disable auto-pairing of characters in Textmate 2?

TextMate 1 had a preference called "Auto-pair characters (quotes etc.)" that would allow you to enable or disable the auto pairing functionality.
Is it possible to disable this feature in TextMate 2?
You can disable it for a given bundle as explained in this issue on GitHub.
Basically you have to edit an option file of the bundle and add smartTypingPairs = ( ); near the end of the file.
I don't know if this can be generalized using the .tm_properties files but you are welcome to try (and report your results).
There is also a user defaults key for this:
defaults write com.macromates.TextMate disableTypingPairs -bool YES
Automatic "Typing Pairs" is a TextMate 2 Hidden Setting
When you type an opening brace, parenthesis, quote character, or similar, TextMate will insert the closing character.
Disable via Terminal:
defaults write com.macromates.TextMate disableTypingPairs YES
A follow-up for Ruby coders. After disabling auto-pairing, you'll still find that typing # inside a double-quoted ("...") string expands to #{}. If you want to disable this:
"Bundles" menu -> "Edit Bundles..."
Select "Ruby" in the left column
Select "Other Actions" in the next column
Select "Embedded Code - #{...}" in the third column
Turn off the "Enable this item" checkbox in the drawer
Type Cmd+S to save the updated bundle
Now you can type "# without any auto-expansion/pairing. If you like typing # and having the first { appear but don't want the closing } added, then instead of disabling the item, just edit in the bottom pane to remove the trailing }:
#{${1:$TM_SELECTED_TEXT}
If you like selecting text within strings and typing # to have it enclosed in #{...} though, the above changed will make it quite awkward, so beware.

Resources