How would be possible to assign a shortcut for word wrap like as sublime text do? i.e. if the code line is too long it should be automatically break to the next line. wikipedia.org.org/Word_wrap
asked Apr 11, 2014 at 5:53
Sayat SatybaldSayat Satybald
6,2105 gold badges33 silver badges52 bronze badges
3
I think «soft wrap» might be what you’re after. It’s read-only, i.e. does not change the characters in the file, it only wraps what you see on screen.
Intellij >= 14.1.4: As pointed out by looper in the comments, the options are under File > Settings > Editor > General — under the Virtual Space or Soft Wraps sub-group.
Intellij < 14.1.4: Look under File > Settings > Editor > Virtual Space.
It doesn’t have a shortcut by default, but you can assign one in the keymap.
AndroidStudio >= 1.4.1: the options are under File > Settings > Editor > General — under the Soft Wraps sub-group.
You can also right click the gutter (the vertical bar where line number is shown) and select «Use Soft wraps» — thanks to Bajal for comment.
To assign a shortcut for toggling softwrap: Look under File > Settings > Keymap, search for «softwrap», then assign your preferred shortcut.
answered Apr 14, 2014 at 23:34
ShornShorn
18.3k14 gold badges87 silver badges157 bronze badges
6
[ctrl+alt+s] or File->settings to open settings dialogue.
Search for code style. its under project settings.
In code style, General check
wrap when typing reaches margin
That will give you wrapping of code.
answered Apr 11, 2014 at 8:53
DineshkumarDineshkumar
4,1475 gold badges28 silver badges43 bronze badges
3
One can also right click the gutter (the vertical bar where line number is shown) and select «Use Soft wraps» — thanks to Bajal for comment.
This is the easiest way, and i found it in comments. I think it should be an answer so everybody can see it easily.
answered May 22, 2018 at 13:55
acpumaacpuma
4795 silver badges15 bronze badges
In order to wrap text in the code editor in IntelliJ IDEA 2020 follow these steps:
- Crtl + Shift + «A» OR Help -> Find Action
- Enter: «wrap» into text box
- Toggle: View | Active Editor Soft-Wrap «ON»
Ardent Coder
3,7179 gold badges28 silver badges52 bronze badges
answered May 8, 2020 at 3:42
Noah PGNoah PG
1512 silver badges3 bronze badges
In the Community Edition, Do Following:
File >> Settings >> Editor >> Code Style >> Java
Go to Wrapping And Braces Tab.
Set the «Right margin (columns)» option with number of columns you would like as line wrapping point.
Set «Wrap on typing» to YES.
Don’t forget to apply the changes before you click Ok.
AlexW
8567 silver badges9 bronze badges
answered Apr 7, 2016 at 16:22
VishalVishal
1,8632 gold badges19 silver badges22 bronze badges
For IntelliJ IDEA Version: 2019.3
-
Go to File > Settings
-
A new window will appear
-
Select Editor > General
Navigate to Soft Wraps section, check the box, and using a semi-colon as the delimeter, * and ? as wildcards, add the desired file-extensions.
Select Apply and you are good to go.
answered Dec 15, 2019 at 9:44
The answer to this question is:
Use the option Ensure right margin is not exceeded
— the bottom option in the screenshot:
answered Dec 6, 2020 at 0:01
ACVACV
9,7205 gold badges72 silver badges81 bronze badges
Right click anywhere on the number of lines bar and click soft-wrap
Or you can just go to View -> Active Editor -> Soft-Wrap
answered Jun 20, 2022 at 3:13
SkideeSkidee
5275 silver badges8 bronze badges
(In Community Edition 2016+) go : IntelliJ IDEA>Preferences >Editor>General: select options «Use soft wraps in editor» and «Use original line’s indent for wrapped parts»
answered Apr 1, 2016 at 23:20
Alferd NobelAlferd Nobel
2,8912 gold badges29 silver badges34 bronze badges
OS X 10.8 IntelliJ Idea 15.0.5:
IntelliJ IDEA Menu/Preferences/Editor/General/Soft Wraps
answered Apr 20, 2016 at 5:18
GyuriGyuri
4,4284 gold badges34 silver badges43 bronze badges
The gutter’s context menu has a soft wrap option. Right-click on the gutter located to the far left of the editor to reveal the menu
answered Mar 29, 2022 at 23:12
TestillaTestilla
5907 silver badges21 bronze badges
It can help.
Thats the solution I have found, when I was trying the wrap the codelines, in the code-editor, when I was decreasing/increasing(stretching) the window-code-editor.
answered Aug 15, 2020 at 17:20
GtdDevGtdDev
6985 silver badges13 bronze badges
It helped me adding » *.java» after » *.adoc;» because in «Settings», then «General» and then » Soft-wrap these files:» I had only » *.md; *.txt; *.rst;
*.adoc «. If after that you add «; *.java» your long java code will be wrapped to a new line.
Thx for the screens. It helped me a lot.
answered Jul 11, 2021 at 22:50
Use this page to configure formatting options for Java files. When you change these settings, the Preview pane shows how this will affect your code.
Tabs and Indents
Item |
Description |
---|---|
Use tab character |
|
Smart tabs |
The Smart tabs checkbox is available if the Use tab character checkbox is selected. |
Tab size |
In this field, specify the number of spaces included in a tab. |
Indent |
In this field, specify the number of spaces to be inserted for each indent level. |
Continuation indent |
In this field, specify the number of spaces to be inserted between the elements of an array, in expressions, method declarations and method calls. |
Keep indents on empty lines |
If this checkbox is selected, IntelliJ IDEA will keep indents on the empty lines as if they contained some code. If this checkbox is cleared, IntelliJ IDEA will delete the tab characters and spaces. |
Label indent |
In this field, specify the number of spaces to be inserted at the next line before a label statement. |
Absolute label indent |
If this checkbox is selected, label indentation is counted as an absolute number of spaces. Otherwise, label indentation is counted relative to previous indent levels. |
Do not indent top level class members |
Select this checkbox to have top level class members located at the class declaration indentation level. |
Use indents relative to expression start |
Use this checkbox to switch between the two possible indentation behaviors:
|
Spaces
Use this tab to specify where you want spaces in your code. To have IntelliJ IDEA automatically insert a space at a location, select the checkbox next to this location in the list. The results are displayed in the preview pane.
Wrapping and Braces
In this tab, customize the code style options, which IntelliJ IDEA will apply on reformatting the source code. The left-hand pane contains the list of exceptions (Keep when reformatting), and placement and alignment options for the various code constructs (lists, statements, operations, annotations, and so on) The right-hand pane shows the preview.
Alignment takes precedence over indentation options.
Hard wrap at
Use the Hard wrap at field to specify a margin space required on the right side of an element. If you select the Default option, then a value of the right margin from the global settings is used.
Wrap on typing
Use the Wrap on typing settings to specify how the edited text is fitted in the specified Hard wrap at:
-
Default: in this case IntelliJ IDEA uses the Wrap on typing option that is specified in the global settings.
-
Yes: in this case IntelliJ IDEA uses the value specified in the Right Margin field.
-
No: in this case this option is switched off and a line can exceed the value specified in the right margin.
Visual guides
Use the Visual guides field to specify multiple right margins. You can leave a default value or enter the number of spaces for your margin. If you want to specify several margins, enter numbers separated by comma.
Keep when reformatting
Use the checkboxes to configure exceptions that IntelliJ IDEA will make when reformatting the source code. For example, by default, the Line breaks checkbox is selected. If your code contains lines that are shorter than a standard convention, you can convert them by disabling the Line breaks checkbox before you reformat the source code.
Wrapping options
The wrapping style applies to the various code constructs, specified in the left-hand pane (for example, method call arguments, method declaration parameters, or assignment statements).
Item |
Description |
---|---|
Wrapping style |
From this list, select the desired wrapping style:
|
Alignment options
Item |
Description |
---|---|
Align when multiline |
If this checkbox is selected, a code construct starts at the same column on each next line. Otherwise, the position of a code construct is determined by the current indentation level. |
|
Select this checkbox to have the specified character or characters moved to the next line when the lines are wrapped. |
‘else’ on new line |
Use this checkbox to have the corresponding statements or characters moved to the next line. |
New line after |
Select this checkbox to have the code after the specified character moved to a new line. |
Special ‘else if’ treatment |
If this checkbox is selected, Otherwise, |
Indent ‘case’ branches |
If this checkbox is selected, the |
Braces placement options
Item |
Description |
---|---|
Braces placement style |
Use this list to specify the position of the opening brace in class declarations, method declarations, and other types of declarations. The available options are:
|
Force braces |
From this list, choose the braces introduction method for
|
Chained method calls
Use the following options to format chained method calls and make them easier to read. Note that builder method calls are always wrapped regardless of the settings for chained calls.
Item |
Description |
---|---|
Wrap first call |
Allow wrapping the first method call in chained methods. |
Align when multiline |
Align several method calls. |
Builder methods |
Specify comma-separated names (identifiers) of methods that you want to be treated as builder methods. For example: |
Keep builder methods indents |
Keep additional indents that you insert manually intact as you reformat code. |
Blank lines
Use this tab to define where and how many blank lines you want IntelliJ IDEA to retain and insert in your code after reformatting. For each type of location, specify the number of blank lines to be inserted. The results are displayed in the preview pane.
Item |
Description |
---|---|
Keep maximum blank lines |
In this area, specify the number of blank lines to be kept after reformatting in the specified locations. |
Minimum blank lines |
In this area, specify the number of blank lines to be present in the specified locations. |
JavaDoc
Item |
Description |
---|---|
Alignment |
In this area, define the way Javadoc comments should be aligned.
|
Blank lines |
In this area, define where blank lines should be inserted in Javadoc comments.
|
Invalid tags |
In this area, define whether invalid tags should be preserved or not.
|
Other |
In this area, specify additional formatting options for Javadoc comments.
|
Arrangement
This tab lets you define a set of rules that rearranges your code according to your preferences.
Item |
Description |
---|---|
Grouping Rules |
Use this area to set the grouping rules.
|
Matching rules |
Use this area to define elements order as a list of rules, where every rule has a set of matches such as modifier or type.
|
Empty rule |
Use this area to create a new matching rule or edit an existing one. You can select from the following filters:
|
This icon appears when you select Order by Name from the Order list. The icon indicates that the items in this rule are sorted alphabetically. |
Imports
This table lists actions to be performed when imports are optimized.
Item |
Description |
---|---|
General |
In this area, configure general import options. Options:
|
JSP Imports Layout |
In this area, configure how JSP import statements should be organized in your code. The introduced changes are displayed in the Preview pane below. Options:
|
Packages to Use Import with ‘*’ |
In this area, configure a list of packages and classes to be always imported completely. Options:
|
Import Layout |
In this area, configure how import statements should be organized in your code. You can set up certain classes to be positioned first, or last, or one after another. Imported classes will be grouped as per their packages and sorted alphabetically within a package. Options:
|
Code Generation
Item |
Description |
---|---|
Naming |
|
Default Visibility |
Select the default access level for generated fields and methods. You can either specify it explicitly, or select Escalate to automatically raise it to a necessary level. |
Final Modifier |
Specify whether you want to generate local variables and parameters with the |
Comment Code |
Use this area to configure code style for generated comments (line Ctrl+/ and block Ctrl+Shift+/):
|
Override Method Signature |
|
Lambda Body |
If a lambda expression calls an existing method, it is preferable to refer to the method by name using a method reference. These checkboxes affect the Lambda can be replaced with method reference inspection. If enabled, the corresponding lambda expressions will be highlighted as warnings with a relevant quick-fix. If disabled, the code will not be highlighted, but an intention to replace the lambda expression with a method reference will still be available.
|
Last modified: 27 March 2023
Как можно было бы назначить ярлык для переноса слов, как это делает возвышенный текст? т. е. если строка кода слишком длинная, она должна автоматически переходить на следующую строку. wikipedia.org.org/Word_wrap
person
Sayat Satybald
schedule
11.04.2014
source
источник
Ответы (11)
Я думаю, что вам нужна мягкая упаковка. Он доступен только для чтения, т.е. не изменяет символы в файле, а только переносит то, что вы видите на экране.
Intellij ›= 14.1.4: как указано в комментариях, параметры находятся в разделе Файл › Настройки › Редактор › Общие — в подгруппе Virtual Space или Soft Wraps.
Intellij ‹ 14.1.4. Найдите в разделе Файл > Настройки > Редактор > Виртуальное пространство. По умолчанию у него нет ярлыка, но вы можете назначить его в раскладке клавиш.
AndroidStudio ›= 1.4.1: параметры находятся в разделе Файл › Настройки › Редактор › Общие в подгруппе Soft Wraps.
Вы также можете щелкнуть правой кнопкой мыши по желобу (вертикальная полоса, на которой показан номер строки) и выбрать «Использовать мягкую обертку» — спасибо Баджалу за комментарий.
Чтобы назначить ярлык для переключения softwrap: Найдите в разделе Файл › Настройки › Keymap, найдите softwrap, затем назначьте нужный ярлык.
person
Shorn
schedule
14.04.2014
[ctrl+alt+s] или Файл->Настройки, чтобы открыть диалог настроек.
Поиск стиля кода. это в настройках проекта.
В стиле кода, общая проверка
wrap when typing reaches margin
Это даст вам упаковку кода.
person
Dineshkumar
schedule
11.04.2014
Можно также щелкнуть правой кнопкой мыши по желобу (вертикальная полоса, где показан номер строки) и выбрать «Использовать мягкие обертки» — спасибо Баджалу за комментарий.
Это самый простой способ, и я нашел его в комментариях. Я думаю, что это должен быть ответ, чтобы все могли легко его увидеть.
person
acpuma
schedule
22.05.2018
В Community Edition сделайте следующее:
Файл >> Настройки >> Редактор >> Стиль кода >> Java
Перейдите на вкладку «Обертывание и скобки».
Установите параметр «Правое поле (столбцы)» с количеством столбцов, которые вы хотели бы использовать в качестве точки переноса строки. Установите для параметра «Перенос при вводе» значение ДА.
Не забудьте применить изменения, прежде чем нажать «ОК».
person
Vishal
schedule
07.04.2016
Чтобы обернуть текст в редакторе кода в IntelliJ IDEA 2020, выполните следующие действия:
- Ctrl + Shift + «A» ИЛИ Справка -> Найти действие
- Введите: «обернуть» в текстовое поле
- Переключить: Просмотр | Active Editor Soft-Wrap «ВКЛ.»
person
Noah PG
schedule
08.05.2020
Для версии IntelliJ IDEA: 2019.3
-
Перейдите в Файл > Настройки
-
Появится новое окно
-
Выберите Редактор > Общие
Перейдите в раздел Soft Wraps, установите флажок и используйте точку с запятой в качестве разделителя, * и? в качестве подстановочных знаков добавьте нужные расширения файлов. Выберите «Применить», и все готово.
person
Community
schedule
15.12.2019
(В Community Edition 2016+) перейдите: IntelliJ IDEA> Настройки> Редактор> Общие: выберите параметры «Использовать мягкие переносы в редакторе» и «Использовать исходный отступ строки для обернутых частей»
person
Alferd Nobel
schedule
01.04.2016
OS X 10.8 IntelliJ Idea 15.0.5: Меню IntelliJ IDEA/Настройки/Редактор/Общие/Мягкие обертки
person
Gyuri
schedule
20.04.2016
Ответ на этот вопрос:
Используйте вариант Ensure right margin is not exceeded
— нижний вариант на скриншоте:
person
ACV
schedule
06.12.2020
Это может помочь. Это решение, которое я нашел, когда пытался обернуть строки кода в редакторе кода, когда я уменьшал/увеличивал (растягивал) редактор оконного кода.
person
PaulDev
schedule
15.08.2020
Мне помогло добавление *.java после *.adoc; потому что в Настройках, потом Общие и потом Софт-обертка эти файлы: у меня были только *.md; *.текст; *.первый; *.адок . Если после этого вы добавите ; *.java ваш длинный java-код будет перенесен на новую строку. Спасибо за экраны. Это мне очень помогло.
person
MonaRad
schedule
11.07.2021
report this ad
Last Updated: 03 Apr 2022 17:54 GMT | User: @c2cDev | Topic: Java
IDEA IntelliJ is one of the most popular IDE for Java developers around the world, by default when you look at the console, you will see that if the logs are too long then horizontal scroll is enabled and it becomes a bit hard to read the logs efficiently.
If you want to word warp the log messages in the console you can do it by clicking on the Soft-Warp button as highlighted in the below image,
Before Word-Warp IntelliJ Console Jobs
After Word Wrap IntelliJ Console Logs
I have recently started to use IntelliJ Idea as my text editor and integrated it into my creative process.
As I am a software developer, IntelliJ IDE is, for me, a must. IDE is in front of me opened all the time. Therefore it is a chance for me to write a lot of content in the IDE. It is a better choice to use IDE instead of switching to another text editor or using another means of word processing.
Since I am also aiming to work on several articles or documents simultaneously, every decrease in ambiguity and complexity counts towards faster results. The creative process is not possible to automatize. But what it is possible to automatize are redundant tasks during text handling and editing.
Why turn IntelliJ Idea IDE into your word processor?
First of all, IntelliJ Idea IDE already comes in its 2020 version with very, very good support for English vocabulary. So writing in English in IDE was never easier than now.
Plus, when implementing the advantage of multiple IntelliJ shortcuts, the word processing is swift. Especially if you write your text in .html, .adoc or .md format.
Overall, IntelliJ IDE comes in all versions with Git support, which is an additional advantage against traditional word processors. You can easily version your articles’ state and keep a history of your edits in one place. Article versioning is a feature that is available only in very advanced mode in cloud SaaS.
However, what I have found very tedious was text formatting in IntelliJ. As expected, I was using IntelliJ Idea IDE for coding, mostly Java, and thus the text was supposed to be wrapped automatically after 120 characters. When I then copied my articles to other word processors in my pipelines, such as Microsoft Word or Grammarly, I always needed painfully deleted every single break line to make a single continuous line of text. That was also one of the most common mistakes I had after publishing articles through WordPress – linebreaks were always in places where they should not be.
After enough time spent doing this pointless work, fixing many wrong break lines, I have decided to end it and figure out how to speed up the process. Because every second I spend editing an article is second, I could use it towards another article’s creative process.
How to turn IntelliJ Idea into text editor?
First of all, go to Settings > Editor > General and check all checkboxes in Soft Wraps section.
Then go to Settings > Code Style and select Scheme Project. Here unselect the checkbox “Wrap on typing”.
I would recommend this change be saved under the current project scheme, not under the IDE scheme. If you are using the same IntelliJ for coding, wrapping will conflict with your code clarity if you save the change under the IDE scheme.
Hit Apply button to apply all the changes.
Initialize soft-wrap in IntelliJ code editor
In the active editor tab, on the left side of the text line panel, after the right-click, there is an option soft-wrap
to initiate the wrapping. Soft-wrap is not initialized automatically on every new file open. Therefore you will need to initialize soft-wrap on every new file open.
Tip for shortcut
When you open a new file, the text is, by default, unwrapped. You can either right-click on the newly opened line meter on the left side and hit Soft-Wrap
from the menu option. Or you can set up a special shortcut for soft-wrapping, while the shortcut is not set by default.
To set up your shortcut, go to File > Settings > Keymap and search for “Soft-Wrap” in Main Menu > View > Active Editor. Add to action key shortcut. I personally use Alt + P key shortcut. That is not a conflicting key shortcut with keys combinations easy to remember.
These are my must-have settings tweaks for IntelliJ IDEA, mixed with some useful tips. However, I recommend going through all the preferences in the Settings Dialog yourself. You probably don’t even know about some problems the IDE can solve for you when adjusted correctly.
Check out my config-files for more IDEA settings.
Table of contents:
How to change settings
There are several ways to change settings in IntelliJ IDEA.
To open the Settings Dialog, select «File» → «Settings…» or use the Ctrl
+ Alt
+ S
shortcut. You can then navigate through the settings in the left panel. Speed up the search by using quick find — simply type part of the setting name.
Sometimes you don’t even need to open the settings dialog. Press Ctrl
+ Shift
+ A
and type the setting name. If it’s a checkbox option, you can press Return
to toggle the setting — effective immediately!
Finally, some settings are only applied to the current project, e.g. the JavaScript language level. To customize default project settings, go to «File» → «Other Settings» → «Default settings…».
Show current IDEA memory usage in the status bar
☑ Appearance & Behavior → Appearance → Show memory indicator
Activate this option to show the current IDE heap level and memory usage in the lower right corner of the status bar. Additionally, you can click on this widget to run the garbage collector.
For big projects you might want to increase the maximum heap memory size. Open IDE_HOMEidea[64][.exe].vmoptions
and adjust the -Xmx
value.
Adjust for widescreen
☑ Appearance & Behavior → Appearance → Widescreen tool window layout
If you have a widescreen monitor, you should enable this setting. Basically, this will give you more space for your side panels.
Notice: those screenshots are highly exaggerated to demonstrate the difference — usually, you wouldn’t open so many panels. If you do, consider the Ctrl
+ Shift
+ F12
shortcut to toggle the panels and maximize the editor view.
Zoom with the mouse wheel
☑ Editor → General → Change font size (zoom) with Ctrl+Mouse Wheel
That’s a feature known from most other text editors and browsers, but it’s disabled by default. Enable this option to zoom using Ctrl
+ Mouse Wheel
. Since IDEA 2021.3, you can decide whether all tabs should be affected.
Show line numbers on the editor gutter
☑ Editor → General → Appearance → Show line numbers
That’s self-explanatory. Additionally, press Ctrl
+ G
to navigate to a line number.
Wrap long lines
☑ Editor > General > Use soft wraps in editor ☑ Editor > General > (Console >) Use soft wraps in console Editor > General > Use custom soft wraps indent/additional shift: 1
If you don’t like scrolling long lines horizontally, activate word wrapping. I also like to add a small indent. When you put the cursor on a wrapped line, IntelliJ will additionally insert small arrow symbols to highlight the wraps.
Improve tab appearance
☑ Editor → General → Editor Tabs → Hide file extension in editor tabs ☐ Editor → General → Editor Tabs → Show «close» button on editor tabs
By hiding both file extensions and close icons you will gain a lot of free space in the editor tab panel. File icons are enough to infer the file types, and you are still able to close tabs by pressing the middle mouse key or Ctrl
+ F4
.
Hadi Hariri, who gives great talks about IntelliJ Tips and Tricks, recommends turning off editor tabs completely. Instead, use Ctrl
+ E
to switch between recent files and Ctrl
+ Shift
+ E
to switch between recently edited files.
Sort debugger fields alphabetically
☑ Build, Execution, Deployment → Debugger → Data Views → Sort alphabetically
By default, debugger variables are listed in the order in which they were defined. I find this makes it harder to find the right values.
Bonus tip: you can focus any list/tree panel (like debugger variables, or the project view) and search for a value by simply starting to type. If multiple values match the search string, use ↓
and ↑
keys to step through them. In this example I typed mo
, so I can toggle the selection between module
and mongoose
:
Improve Java imports
☑ Editor → General → Auto Import → Add unambiguous imports on the fly
This will add import statements automatically, if there is only one class in the classpath with the exact name.
Editor → General → Auto Import → Exclude from Import and Completion
Usually, if you want to use the List
class, IntelliJ won’t import it automatically, even with the previous option enabled. That’s because there are two List
classes in the classpath: java.util.List
and java.awt.List
. Fortunately, you can exclude classes and packages from import assistance and code completion. It works exactly like Type Filters in Eclipse. I usually exclude:
com.sun
sun
java.awt.List
java.sql.Date
and some project specific packages.
You don’t need to add those entries manually. Whenever IntelliJ suggests multiple classes to import, press →
and select the class or package to exclude.
That’s a new feature in IntelliJ IDEA 15. Finally, we are able to remove unwanted tool window buttons. Just right click a sidebar button and select Remove from sidebar. You can restore a hidden tool window with View → Tool Windows.
Use a custom terminal shell
☑ Tools → Terminal → Shell path
IDEA comes with a handy terminal panel (Alt
+ F12
). However, using the default Windows command prompt can sometimes be annoying. Fortunately, you can use a more useful shell within IntelliJ IDEA, like the Git Bash (by default under C:Program FilesGitbinbash.exe
).
You can customize the terminal font and colors here:
☑ Editor → Colors & Fonts → Console Font/Colors
Вопрос:
Могу ли я включить перенос слов в IntelliJ IDEA глобально, а не только для текущего проекта? Кроме того, могу ли я избавиться от переписывания длинных строк текста в виде конкатенации? Я обернулся в Файл → Настройки → Стиль кода (правое поле (столбцы)… обертывание при вводе текста, но все же, когда я использую System.out.println(“Некоторая длинная длинная строка”), он, похоже, конкатенируется на во-первых, и я должен изменить это.
Лучший ответ:
AFAIK, настройки форматирования кода организованы в схемах, а не для текущего проекта.
Откройте “Настройки” -Dialog, перейдите в “Редактор” → “Стиль кода” и активируйте “Wrap on typing”. Длинные строки будут завернуты во время ввода. Если вы вставляете длинную строку из буфера обмена, обертка выполняется после нажатия Ctrl Alt L (Windows).
Как можно было бы назначить ярлык для переноса слов, как это делает возвышенный текст? то есть, если строка кода слишком длинная, она должна автоматически переноситься на следующую строку. http://e n.wikipedia.org/wiki/Word_wrap
2014-04-11 05:53
13
ответов
Решение
I think «soft wrap» might be what you’re after. It’s read-only, ie does not change the characters in the file, it only wraps what you see on screen.
Intellij >= 14.1.4: As pointed out by looper in the comments, the options are under File > Settings > Editor > General — under the Virtual Space or Soft Wraps sub-group.
Intellij < 14.1.4: Look under File > Settings > Editor > Virtual Space. It doesn’t have a shortcut by default, but you can assign one in the keymap.
AndroidStudio >= 1.4.1: the options are under File > Settings > Editor > General — under the Soft Wraps sub-group.
You can also right click the gutter (the vertical bar where line number is shown) and select «Use Soft wraps» — thanks to Bajal for comment.
2014-04-14 23:34
[Ctrl+ Alt+ S] или Файл-> настройки, чтобы открыть диалог настроек.
Поиск стиля кода. его в настройках проекта.
В стиле кода, общая проверка
wrap when typing reaches margin
Это даст вам упаковку кода.
2014-04-11 08:53
Можно также щелкнуть правой кнопкой мыши по желобу (вертикальная полоса, где показан номер строки) и выбрать «Использовать мягкие переносы» — спасибо Баджалу за комментарий.
Это самый простой способ, и я нашел его в комментариях. Я думаю, что это должен быть ответ, чтобы каждый мог видеть это легко.
2018-05-22 13:55
Чтобы обернуть текст в редакторе кода в IntelliJ IDEA 2020, выполните следующие действия:
- Crtl + Shift + «A» ИЛИ Справка -> Найти действие
- Введите: «обернуть» в текстовое поле
- Переключить: Просмотр | Активный редактор Soft-Wrap «ВКЛ»
2020-05-08 06:42
В Community Edition выполните следующие действия:
Файл >> Настройки >> Редактор >> Стиль кода >> Java
Перейдите на вкладку «Упаковка и брекеты».
Установите опцию «Правое поле (столбцы)» с количеством столбцов, которые вы хотите использовать в качестве точки переноса строк. Установите «Wrap при наборе текста» на ДА.
Не забудьте применить изменения, прежде чем нажать Ok.
2016-04-07 16:22
Для версии IntelliJ IDEA: 2019.3
-
Перейдите в Файл> Настройки
-
Появится новое окно
-
Выберите Editor > General
Перейдите в раздел Soft Wraps, установите флажок и используйте точку с запятой в качестве разделителя, * и? в качестве подстановочных знаков добавьте желаемые расширения файлов. Выберите Применить, и все готово.
2019-12-15 12:44
Ответ на этот вопрос:
Воспользуйтесь опцией
Ensure right margin is not exceeded
— нижний вариант на скриншоте:
2020-12-06 03:01
Щелкните правой кнопкой мыши в любом месте на панели количества строк и выберите «мягкий перенос».
Или вы можете просто перейти в View -> Active Editor -> Soft-Wrap.
2022-06-20 03:13
(В Community Edition 2016+): IntelliJ IDEA> «Установки»> «Редактор»> «Общие»: выберите параметры «Использовать мягкие переносы в редакторе» и «Использовать отступ строки оригинала для обернутых частей»
2016-04-01 23:20
OS X 10.8 IntelliJ Idea 15.0.5:
IntelliJ IDEA Меню / Настройки / Редактор / Общие / Мягкие упаковки
2016-04-20 05:18
Контекстное меню желоба имеет опцию мягкого обтекания. Щелкните правой кнопкой мыши на желобе, расположенном в крайнем левом углу редактора, чтобы открыть меню.
2022-03-29 23:12
Мне помогло добавление «* .java» после «* .adoc;» потому что в «Настройках», затем «Общие», а затем «Мягко оберните эти файлы:» у меня были только «* .md; *.txt; *.rst; * .adoc». Если после этого вы добавите «; * .java», ваш длинный java-код будет перенесен в новую строку. Спасибо за экраны. Это мне очень помогло.
2021-07-12 01:50
Это может помочь. Это решение, которое я нашел, когда пытался обернуть строки кода в редакторе кода, когда я уменьшал / увеличивал (растягивал) редактор оконного кода.
2020-08-15 20:20
I solved this by following this guide. It was meant for PHPStorm but works for IntelliJ IDEA as well (probably WebStorm too!). It was very simple, actually. A basic recap:
- Saved the following PHP code in my project root. It’s basically just a PHPDoc comment:
<?php die('This file is not really here!'); /** * ------------- DO NOT UPLOAD THIS FILE TO LIVE SERVER --------------------- * * Implements code completion for CodeIgniter in phpStorm * phpStorm indexes all class constructs, so if this file is in the project it will be loaded. * ------------------------------------------------------------------- * Drop the following file into a CI project in phpStorm * You can put it in the project root and phpStorm will load it. * (If phpStorm doesn't load it, try closing the project and re-opening it) * * Under system/core/ * Right click on Controller.php and set Mark as Plain Text * Do the same for Model.php * ------------------------------------------------------------------- * This way there is no editing of CI core files for this simple layer of code completion. * * PHP version 5 * * LICENSE: GPL http://www.gnu.org/copyleft/gpl.html * * Created 1/28/12, 11:06 PM * * @category * @package CodeIgniter CI_phpStorm.php * @author Jeff Behnke * @copyright 2009-11 Valid-Webs.com * @license GPL http://www.gnu.org/copyleft/gpl.html * @version 2012.01.28 */ /** * @property CI_DB_active_record $db This is the platform-independent base Active Record implementation class. * @property CI_DB_forge $dbforge Database Utility Class * @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them.
Memory consumption can also be displayed. * @property CI_Calendar $calendar This class enables the creation of calendars * @property CI_Cart $cart Shopping Cart Class * @property CI_Config $config This class contains functions that enable config files to be managed * @property CI_Controller $controller This class object is the super class that every library in.
CodeIgniter will be assigned to. * @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP. * @property CI_Encrypt $encrypt Provides two-way keyed encoding using XOR Hashing and Mcrypt * @property CI_Exceptions $exceptions Exceptions Class * @property CI_Form_validation $form_validation Form Validation Class * @property CI_Ftp $ftp FTP Class * @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking. * @property CI_Image_lib $image_lib Image Manipulation class * @property CI_Input $input Pre-processes global input data for security * @property CI_Lang $lang Language Class * @property CI_Loader $load Loads views and files * @property CI_Log $log Logging Class * @property CI_Model $model CodeIgniter Model Class * @property CI_Output $output Responsible for sending final output to browser * @property CI_Pagination $pagination Pagination Class * @property CI_Parser $parser Parses pseudo-variables contained in the specified template view,
replacing them with the data in the second param * @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data
in order to help with debugging and optimization. * @property CI_Router $router Parses URIs and determines routing * @property CI_Session $session Session Class * @property CI_Sha1 $sha1 Provides 160 bit hashing using The Secure Hash Algorithm * @property CI_Table $table HTML table generation
Lets you create tables manually or from database result objects, or arrays. * @property CI_Trackback $trackback Trackback Sending/Receiving Class * @property CI_Typography $typography Typography Class * @property CI_Unit_test $unit_test Simple testing class * @property CI_Upload $upload File Uploading Class * @property CI_URI $uri Parses URIs and determines routing * @property CI_User_agent $user_agent Identifies the platform, browser, robot, or mobile devise of the browsing agent * @property CI_Validation $validation //dead * @property CI_Xmlrpc $xmlrpc XML-RPC request handler class * @property CI_Xmlrpcs $xmlrpcs XML-RPC server class * @property CI_Zip $zip Zip Compression Class * @property CI_Javascript $javascript Javascript Class * @property CI_Jquery $jquery Jquery Class * @property CI_Utf8 $utf8 Provides support for UTF-8 environments * @property CI_Security $security Security Class, xss, csrf, etc... */ class CI_Controller{} /** * @property CI_DB_active_record $db This is the platform-independent base Active Record implementation class. * @property CI_DB_forge $dbforge Database Utility Class * @property CI_Benchmark $benchmark This class enables you to mark points and calculate the time difference between them.
Memory consumption can also be displayed. * @property CI_Calendar $calendar This class enables the creation of calendars * @property CI_Cart $cart Shopping Cart Class * @property CI_Config $config This class contains functions that enable config files to be managed * @property CI_Controller $controller This class object is the super class that every library in.
CodeIgniter will be assigned to. * @property CI_Email $email Permits email to be sent using Mail, Sendmail, or SMTP. * @property CI_Encrypt $encrypt Provides two-way keyed encoding using XOR Hashing and Mcrypt * @property CI_Exceptions $exceptions Exceptions Class * @property CI_Form_validation $form_validation Form Validation Class * @property CI_Ftp $ftp FTP Class * @property CI_Hooks $hooks Provides a mechanism to extend the base system without hacking. * @property CI_Image_lib $image_lib Image Manipulation class * @property CI_Input $input Pre-processes global input data for security * @property CI_Lang $lang Language Class * @property CI_Loader $load Loads views and files * @property CI_Log $log Logging Class * @property CI_Model $model CodeIgniter Model Class * @property CI_Output $output Responsible for sending final output to browser * @property CI_Pagination $pagination Pagination Class * @property CI_Parser $parser Parses pseudo-variables contained in the specified template view,
replacing them with the data in the second param * @property CI_Profiler $profiler This class enables you to display benchmark, query, and other data
in order to help with debugging and optimization. * @property CI_Router $router Parses URIs and determines routing * @property CI_Session $session Session Class * @property CI_Sha1 $sha1 Provides 160 bit hashing using The Secure Hash Algorithm * @property CI_Table $table HTML table generation
Lets you create tables manually or from database result objects, or arrays. * @property CI_Trackback $trackback Trackback Sending/Receiving Class * @property CI_Typography $typography Typography Class * @property CI_Unit_test $unit_test Simple testing class * @property CI_Upload $upload File Uploading Class * @property CI_URI $uri Parses URIs and determines routing * @property CI_User_agent $user_agent Identifies the platform, browser, robot, or mobile devise of the browsing agent * @property CI_Validation $validation //dead * @property CI_Xmlrpc $xmlrpc XML-RPC request handler class * @property CI_Xmlrpcs $xmlrpcs XML-RPC server class * @property CI_Zip $zip Zip Compression Class * @property CI_Javascript $javascript Javascript Class * @property CI_Jquery $jquery Jquery Class * @property CI_Utf8 $utf8 Provides support for UTF-8 environments * @property CI_Security $security Security Class, xss, csrf, etc... */ class CI_Model{}
2. Found /system/core/controller.php
and /system/core/model.php
inside of IntelliJ IDEA and right clicked->Mark as Plain Text.
3. Done! It works great, no more false errors, and code completion!