| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3126d02 commit 021931b
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,9 +31,8 @@ | |||
| 31 | 31 | { "key": "selector", "operator": "equal", "operand": "string.quoted", "match_all": true } | |
| 32 | 32 | ] | |
| 33 | 33 | }, | |
| 34 | - // Replace a '{|}' with '{{|' when typing within fstring | ||
| 35 | - { "keys": ["{"], "command": "run_macro_file", | ||
| 36 | - "args": {"file": "Packages/MagicPython/settings/sublime/fstring_brace.sublime-macro"}, | ||
| 34 | + // Replace a '{|}' with '{{|' when typing within f-string | ||
| 35 | + { "keys": ["{"], "command": "fstringbrace", | ||
| 37 | 36 | "context": | |
| 38 | 37 | [ | |
| 39 | 38 | { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + """A plugin for Sublime Text to enhance f-string editing experience. | ||
| 2 | + | ||
| 3 | + Specifically, this plugin simplifies typing of escaped curly braces | ||
| 4 | + in an f-string: | ||
| 5 | + {|}, where | is for cursir, gets replaced with | ||
| 6 | + {{|, when '{' is typed again. | ||
| 7 | + """ | ||
| 8 | + | ||
| 9 | + | ||
| 10 | + import sublime | ||
| 11 | + import sublime_plugin | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + class FstringbraceCommand(sublime_plugin.WindowCommand): | ||
| 15 | + def run(self): | ||
| 16 | + view = self.window.active_view() | ||
| 17 | + view.run_command('right_delete') | ||
| 18 | + view.run_command('insert', {'characters': '{'}) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments