how to wrap the line of code in xcode with a hotkey? - swift

let say i have this code:
plane.materials = gridMaterial
and I want the gridMaterial to be enclosed with []. Is there a hotkey to just highlight the gridMaterial and press the hotkey? Is there a keyboard shortcut?

Go to Xcode (top menu) -> Settings -> Text Editing -> Editing. Then check the box in front of Enclose selection in matching delimiters.
After that highlight what ever the are in your code and press[.

Related

Automatically select pasted text in Sublime Text 3

Is there any way, plugin, macro or something to make Sublime Text 3 automatically select the text that was just pasted?
I need to copy and paste some JSON data, but the pasted text is never in line with the surrounding text. Paste and indent -feature does not work properly for this.
What does work is the reindent feature, but it requires me to select a block of text and pressing a hotkey. So after pasting I would benefit for having the just pasted block of text being automatically selected, so I can just press the reindent hotkey to properly indent what I pasted.
Furthermore, it would be even better if I could bind the whole process to a hotkey, so:
Select text
Copy
Press some self defined hotkey to run a macro(?)
This macro the pastes the text, selects the pasted text and runs the reindent hotkey (*)
*So basically I would like to make a keybinding, say, ctrl+shift+b to do the following:
ctrl+v
Somehow select pasted text
ctrl+shift+f
You can create a plugin to do this, and execute it with a keybinding:
from the Tools menu -> Developer -> New Plugin...
select all and replace with the following
import sublime
import sublime_plugin
class PasteAndReindentCommand(sublime_plugin.TextCommand):
def run(self, edit):
before_selections = [sel for sel in self.view.sel()]
self.view.run_command('paste')
after_selections = [sel for sel in self.view.sel()]
new_selections = list()
delta = 0
for before, after in zip(before_selections, after_selections):
new = sublime.Region(before.begin() + delta, after.end())
delta = after.end() - before.end()
new_selections.append(new)
self.view.sel().clear()
self.view.sel().add_all(new_selections)
self.view.run_command('reindent')
save it, in the folder ST suggests (Packages/User/) as something like paste_and_reindent.py
add the following to your User keybindings { "keys": ["ctrl+shift+b"], "command": "paste_and_reindent" },
Note that Ctrl+Shift+B will replace the default binding for "Build With".
How it works:
when the keybinding is pressed, it runs the new command created in the plugin
this stores the current text selection positions
then it performs the paste operation
then it gets the new text caret positions
then it compares the old positions to the new ones, and selects the text that was pasted
then it runs the reindent command
You could get it to clear the selections again afterwards (by repositioning the text carets to the end of the selections - i.e. the default behavior after pasting) by doing another comparison of the selections before and after the reindentation.
On MacOS you can add:
"find_selected_text": true
to Sublime Text->Preferences->Settings (User Settings View)

What is the property name to break long lines in VS Code?

When I have long text line I would like to show it next line.
What is the property name in VS Code?
The menu under File > Preferences or press Ctrl+, (on Mac Code > Preferences > Settings or press Command (or Cmd) ⌘+,) provides entries to configure user and workspace settings. You are provided with a list of default Settings.
Set editor.wordWrap: on in your User Settings or Workspace Settings under preference.
Select the below options to change to the desired settings.
Off - Lines will never wrap.
on - Lines will wrap at the viewport width.
wordWrapColumn - Lines will wrap at "Editor: Word Wrap Column".
bounded - Lines will wrap at the minimum of viewport and "Editor: Word Wrap Column".
You can toggle word wrap for the VS Code session with Alt+Z (macOS: Option (or Alt) ⌥+Z) or select View > Word Wrap from Menu.
For more about User and Workspace Settings or Key Bindings for Visual Studio Code
On Windows, press Alt + Z (macOS: Option ⌥ + Z) to toggle word wrapping, or, select View > Toggle Word Wrap from VSCode Menu.
For Windows, Pressing Alt+Z will break the line.
For Windows users do the following in -->
Open VScode
Go to Settings(Gear icon on the bottom-left side)
Click Settings in the menu
In the searching bar search for "word wrap"
Click the drop-down menu and change it to "on"
This setting will wrap your words according to your editor: viewport.
In case this auto wrapping isn't working you can press --> Alt + z to wrap content
In VS Code:
Install Beautify plugin. (or any Formatter)
Go to the file & select the desired part.
Right-Click on it & select Format Selection Or press Ctrl + k Ctrl + F.
Hope this helps.
HTML > Format: Wrap Line Length
set the maximum number of characters (for example - 1000)
You can press Ctrl + W / Ctrl + L to toggle word wrapping or select Main menu "Edit>Advanced>Word Wrap" .

How can I remove this expression?

I recently used this tool so I am bigger.
when I wrote codes, suddenly this expression appeared.
How can I remove this expression?
thank you.
It notice you that is a tab space:
You can change the configuration like this :
Window -> Preferences -> General -> Text Editor.
Then uncheck Show white spaces character

How to add quotation marks around selected text in Eclipse

Countless times i have needed to put a quotation marks around text during programming. I remember awhile ago that i have seen someone selecting text and simply do magic with the keyboard shortcuts and putting quotation marks around it. How to do so?
In eclipse
1. Window -> Preferences -> Java -> Editor -> Templates
2. Click on "New"
3. Type "quote" for name (you can name it whatever you want)
4. In the pattern box, enter "${word_selection}"${cursor}
5. Click ok
6. Click apply and close preferences
7. Select the string you want quoted, press CTRL + <space> and type quote

Spaces instead of tabs in Eclipse (Galileo 3.52)?

Is there any way in Eclipse (Galileo 3.52) to have it replace tabs with spaces ("soft tabs")? I've tried two things so far . . .
Windows>Preferences>Editors>Text Editors... check "Insert spaces for tabs"
...and...
Window->Preferences->Java->Code Style->Formatter->Edit... "Use Spaces to indent wrapped lines"
(... this forces you to create a new profile to save these settings)
This produces partial success - the first tab is turned in to spaces but subsequent ones are still tabs. So if I type
tabtab 1234
...I end up with...
spacespacespacespace tab 1234
You can do:
Window -> Preferences -> Java -> Code Style -> Formatter
Click on “Show” button (or "Edit") right beside the name of the profile you are using.
In the indentantion Tab, change the "Tab Policy" field to "spaces only"
Click Ok, and save the profile with the name you want.
Could the missing setting be the Tab policy: Spaces only combo box in Preferences >Java > Code Style Formatter > Edit > Indentation (right above where you changed Use spaces to indent wrapped lines)?