Welcome to ST.
You mean code snippets like that?
>>> my_dict = {'a' : 'one', 'b' : 'two'}
>>> 'a' in my_dict
True
>>> 'b' in my_dict
True
>>> 'c' in my_dict
False
I don’t remember a plugin which automatically strips >>>
characters.
Answer 1)
I can’t answer this question as I was not faced to such a task too often.
Answer 2)
The biggest advantage of ST is you can automate nearly everything you need easily using python and adapt ST to your needs. But this is also one of the most tricky things with ST. There are thousands of packages out there to provide more or less useful and more or less general/personal functionality. It is quite hard to find a correct set of plugins required for efficient every day work. This is besides a question which depends on personal tastes and the tasks you are faced to.
like a macro
ST supports JSON based macros, but I never felt comfortable with that syntax as JSON is too noisy with all its terrible brackets, braces and quotations. The idea behind them is simple - just chain the available commands after each other and put it into a *.sublime-macro file. A macro can than be bound to a key or added to menu/command pallet.
some search and replace magic
I use RegReplace to do automated text replacements like that. You can setup predefined rules which include anything you need to do comprehensive find and replace operations and recall them easily in macros, by key bindings or create menu/command pallet entries for them.
Example:
I have the following entry in the reg_replace_rules.sublime-settings (created with a easy to use “Wizard”)
"strip_python_command_line":
{
"find": "^>>>\\s*",
"name": "strip_python_command_line",
"replace": ""
}
This rule can be used by other python packages as follows:
view.run_command("reg_replace", {"replacements": ["strip_python_command_line"]})
You can create a key binding
{
"keys": ["f9"],
"command": "reg_replace",
"args": {
"replacements": ["strip_python_command_line"]
},
}
or add the following entry to a Packages/User/Default.sublime-commands file to have it available in the command pallet:
{
"caption": "Reg Replace: Strip python command line chars (>>>)",
"command": "reg_replace",
"args": {"replacements": ["strip_python_command_line"]}
},
You can even chain several replacement rules.
This way the text is not automatically replaced on paste but with only little more effort. I honestly don’t feel happy with automated paste replacements as there always might be situations you don’t want such special automatism.