Feature requests
-
I love Pythonista, but please add these:
- A keyboard shortcut for Comment/Uncomment : “Command + /“
- Ability to copy text from Console
-
if you open dropdown on console there is copy all text option or you can select and copy/paste directly.
for comment uncomment you can write scripts using Editor module to do this. there are many posts like this one to help you along this.
-
@masscode
for your second request.. place this in your library and add it to your keyboard scripts.from editor import * def main(): text = get_text() selected_range = get_selection() selected_string = text[selected_range[0]:selected_range[1]] all_lines = text.splitlines() selected_line_range = get_line_selection() selected_lines = text[selected_line_range[0]:selected_line_range[1]].splitlines() comment = str('#') replacement = str('') nl = str('\n') for line in selected_lines: if line.strip().startswith(comment): replacement += line.replace(comment, str('')) else: replacement += comment + line if line != selected_lines[-1]: replacement += nl replace_text(selected_line_range[0], selected_line_range[1], replacement) set_selection(selected_line_range[0])
this will comment any selected line or if non selected it will comment the line the cursor is currently placed.
if a line in selection is already commented it will remove that comment #
-
#NOTE:
if this wont work because editor cannot be ran in appextensions then place it in editor actions
-
last edited by
-
@cvp no i just whiped that one up real fast. didnt have time to search my repos for the tools one 😅
-
@stephen ok, sorry, it is what we called Pythonista tools in the past, due to its icon 🙄
-
@cvp lol i thought you were refering to the script in pythonista repo for comment/uncomment lol i appoligise lol
-
Copying text from Console work great.
About the other one, I think I’ve followed your instructions, but I don’t seem to be able to make it work.
I’ve created a file with the code you provided, and added a shortcut in the “Editor Action”.
In the script, it does not specify the key combination, so I would think I need to set it in the Shortcut, but I don’t see that. I see:- Run script
- Arguments
- Reset environment
- Custom title
- Icon
- Icon colour
I would add screenshots, but I don’t see that option. How are you doing it?
-
you can try using ⌘ + U to access Editor Actions but im not sure if you can set a script to a key. but when u open the "wrench" u can select the comment script to run it on ur current open script.
-
@stephen
I’m a little confused now.
I was hoping to have a feature where I can hit ⌘ + / to comment or uncomment the current line the cursor is on, or a block of lines if multiple lines are selected, very much like it is available in some IDEs.
The script seems to do that, but I cannot trigger it by a keyboard shortcut.
Is what you are suggesting, please a cursor on a line I want to comment, hit ⌘ + U, and touch the shortcut on the screen? (Image below)
In the ideal world, I would like to use the ⌘ + / keyboard shortcut without having to touch the screen since my hands are already there.
-
so far all i can see is you have to use ObjC_utils to acomplish this. im only just getting into this area so im goingbto see what i can figure out butbchance is you might have to wait for one of the vetrans to pick this up. i havnt quit tho!
-
Got it! Thanks @stephen!
-
@stephen said:
vetrans
I'm one but I don't have an external keyboard, thus no experience at all, sorry
-
@masscode I don't know anything and thus I can't help you but did you check Black Mamba
-
@cvp
I didn’t know about Black Mamba till now. I’m on it!
-
@cvp @stephen
I’ve just installed Black Mamba and the “toggle comments” works beautifully!!
Thanks guys!!
-
@masscode no problem have a good day
-
Color themes..
Could the color scheme Halcyon from VSCode be added to Pythonista..?
-
@mattaeuss said:
e Halcyon from VSCode be added to Pythonista..?
not the exact theme. this is becaus VS has manymore elements available to color. but this is as closevas i could bet i hope it will surfice
Halcyon themehere is where i referenced the colors..
-
This post is deleted!last edited by