Search the Community
Showing results for tags 'other'.
Hotkeys for IDE JetBrains (PyCharm, PHPStorm, WebStorm) Comment and uncomment code Use shortcuts to comment and uncomment lines and blocks of code: • Ctrl Slash : for single line comments ( //... ) • Ctrl Shift Slash : for block comments ( /*...*/ ) Navigate to declaration To navigate to the declaration of a class, method, or variable from its usage, place the caret at the symbol and press Ctrl + B (Navigate | Declaration or Usages). You can also click a usage with the Ctrl key pressed to jump to the declaration. Find and replace Press Ctrl + F to display the search bar. Press Ctrl + R to add another field where you can type the replace string. In the Find in Files dialog, you can switch to replace by pressing Ctrl + Shift + R . Similarly, press Ctrl + Shift + F to hide the Replace with field and switch to regular search. Show usages You can view the list of all usages of a class, method or variable across the whole project, and quickly navigate to the selected item. Place the caret at a symbol and press Ctrl + Alt + F7 (Edit | Find Usages | Show Usages). To jump to a usage, select it from the list and press Enter Expand code selection Press Ctrl + W to expand code selection. Each time you press Ctrl + W , the selection expands to other areas of code. For example, the selection expands from a method name to the expression calling this method, then to the whole statement, then to the containing block, and so on. Search Everywhere Press Shift twice to search for files, actions, symbols, UI elements, Git branches and comments across your project. Pressing double Shift again, will extend the search to non-project items. Use tabs or direct shortcuts Ctrl + N for classes, Ctrl + Shift + N for files, Ctrl + Alt Shift + N for symbols, and Ctrl + Shift + A for actions to narrow your search results. Move statements up and down The Code | Move Statement Up/Down actions are useful for reorganizing code lines, for example for bringing a variable declaration closer to the variable usage. Select a code fragment and press Ctrl + Shift ↑ or Ctrl + Shift ↓ . The following picture shows the initial location of a code fragment: Override methods You can easily override methods of the base class by pressing Ctrl + O (Code | Override Methods). To implement methods of the interfaces (or of the abstract base class) that the current class implements, press Ctrl + I (Code | Implement Methods). Find usages Press Alt + F7 to quickly locate all occurrences of code referencing the symbol at the caret, no matter if the symbol is a part of a class, method, field, parameter, or another statement. Postfix code completion Postfix code completion is applied from right to left to avoid backward caret jumps when coding. Type a dot . after the code fragment that you want to change and select the desired option. To see the suggestion list with postfix templates, you can also press Ctrl + J Surround code fragments You can quickly wrap a code block in useful constructs. Select it in the editor and press Ctrl + Alt + T (Code | Surround With). The list of available options or wrappers is context-sensitive and depends on the language. For example, you can surround html blocks with tags, and so on. Show file structure You can quickly navigate within the current file with Ctrl + F12 (Navigate | File Structure). File structure shows the list of members of the current class. To navigate to an element, select it and press Enter or F4 . To easily locate an item in the list, start typing its name. Extract Variable refactoring The Extract Variable refactoring wraps a selected expression into a variable. It adds a new variable declaration and uses the expression as an initializer. Select an expression and press Ctrl + Alt + V (Refactor | Extract/Introduce | Variable). Live templates Use live templates to insert frequent code constructs. When you select a live template from the suggestion list, the template expands to the variant that is defined on the Editor | Live Templates page of the Settings/Preferences dialog ( Ctrl + Alt + S ). Use Tab to move between the template fields. Switch scheme You can apply a different code style, coloring scheme, or keymap with a single keystroke right from the editor. Press Ctrl Back Quote (View | Quick Switch Scheme) to specify the scheme you want to switch to. Select In To quickly select the currently edited element (a class, file, method, or field) in another view, press Alt + F1 or call Navigate | Select In To quickly open any class in the editor, press Ctrl + N (Navigate | Class) and start typing the name of the class. Then, click the class from the suggestion list. Similarly, you can open any file in your project by using Ctrl + Shift + N (Navigate | File). Show parameter info If the caret is positioned between the parentheses of a method call, press Ctrl + P to bring up a list of valid parameters. Debugger If you want to log program state during debugging, use non-suspending breakpoints. Select the expression that you want to log, hold Shift , and click the gutter at the line where the expression should be logged. Paste from the clipboard history Press Ctrl + Shift + V to select the text fragment that you have previously copied to the clipboard. Navigate to a file To quickly open a file, press Ctrl + Shift + N (Navigate | File) and start typing its name. View recent files Press Ctrl + E (View | Recent Files) to view the list of recently opened files. You can also bring up the results of the recently performed usage searches. To do that, use the same Ctrl + E shortcut within the Find tool window, and select the desired search result from the Recent Find Usages popup. Find Action To quickly find a menu command, setting, or an action, press Ctrl + Shift + A (Help | Find Action). Quick Definition Press Ctrl + Shift + I (View | Quick Definition) to preview the definition or content of the symbol at the caret, without opening it in a separate editor tab. Duplicate a code block or a line Press Ctrl + D in the editor to duplicate the selected code block, or the current line when no block is selected. Quick code documentation To quickly see the documentation for a class or method at the caret, press Ctrl + Q Version Control PyCharm provides out-of-the-box integration with the following version control systems: Git, Mercurial, Subversion, and Perforce. Version your application to collaborate on it, as well as to eliminate the risks of storing all of your codebase locally. Press Alt + 9 to view the history of the changes in the project or press Ctrl + K to send your local changes to the repository. Complete XML tag names Press Ctrl + Space twice to complete XML tag names from namespaces not declared in the current file. If the namespace is not declared yet, the declaration is generated automatically. View inheritance hierarchy To see the inheritance hierarchy for the selected class, press Ctrl + H (Navigate | Type Hierarchy). You can also invoke the hierarchy view directly from the editor to see the hierarchy for the currently edited class. Navigate to recent locations Press Ctrl + Shift + E to get a list of recently viewed or changed code fragments. Join lines To join two lines into one and remove unnecessary spaces, press Ctrl + Shift + J Code completion in the suggestions list while using item by pressing Ctrl Period . PyCharm will insert the selected item followed by a dot or -> depending on the current context. Copy a line If nothing is selected in the editor, press Ctrl + C to copy the whole line at the caret to the clipboard. Recent search history When searching for a text string in a file, use recent search history. Press Ctrl + F to open the search bar and then press Alt + ↓ to show the list of recent entries. View code reference information You can use Ctrl + Q (View | Quick Documentation), Ctrl + P (View | Parameter Info), Ctrl + B (Navigate | Declaration), and similar shortcuts not only in the editor but also in the suggestions list while using code completion. Quick Definition You can invoke the Quick Definition Viewer ( Ctrl + Shift + I ) for items in code completion lists and the class, file, or symbol navigation commands. Camel case in Search Everywhere Use camel case in the Search Everywhere popup (double Shift ) to filter the list of results when searching for a class, file, or symbol. Wildcards in Search Everywhere Use text patterns in Search Everywhere (double Shift ) when searching for a class, file, or symbol. Use * and space : • * stands for any number of arbitrary characters. • space marks the end of a pattern. The preceding string is considered not just a prefix but a whole pattern. Highlight usages within a file Press Ctrl + Shift + F7 (Edit | Find Usages | Highlight Usages in File) to quickly highlight usages of a certain variable in the current file. Press F3 and Shift + F3 to navigate through the highlighted usages. Press Escape to remove highlighting. Extracting a method The Extract Method refactoring creates a method out of a code fragment. Select a block of code and press Ctrl + Alt + M (Refactor | Extract | Method). Navigate to a symbol To quickly open any class, field, or function in the editor, press Ctrl + Alt + Shift+N (Navigate | Symbol) and start typing its name. Scratch files Scratch files are temporary files that let you experiment and prototype in the editor, without creating any project files. To create a scratch file, press Ctrl Alt + Shift Insert , and then select the language to use. Code completion You can accept the current selection in the code completion suggestions list with the period key (.), comma (,), semicolon (;), space, and some other characters. The selected name is automatically entered in the editor followed by the entered character. To use this feature, make sure that the Insert selected suggestion by pressing space, dot, or other context-dependent keys checkbox is selected on the Editor | General | Code Completion page of the Settings/Preferences dialog Ctrl + Alt + S . Close editor tabs To close all editor tabs except the current one, keep Alt (Windows and Linux) or Alt(Option) (macOS) pressed and click on the current editor tab. Verify regular expressions To verify that your regular expression is correct, place the caret within the expression you want to check, press Alt+Enter , and select Check RegExp. In the popup, type a sample string that should match your regular expression. The icon shows that the match occurred. Horizontal scroll To scroll a file horizontally, turn the mouse wheel while keeping Shift pressed. Compare files and folders To compare any two files or folders, select them in the Project tool window and press Ctrl + D Refactor This If you position the caret at a symbol and press Ctrl + Alt + Shift + T , the list of refactorings that are applicable to the current context will open. Close all editor tabs To close all editor tabs, right-click a tab and select Close All Tabs. To close all tabs except the active one, press Alt (Windows and Linux) or Alt(Option) (macOS) and click the Close button on the active tab. Use the switcher for navigation To switch between opened files and tool windows, use the Switcher Ctrl + Tab . For navigation, press and hold Ctrl and use the Up and Down arrow keys or Tab and Shift + Tab , and Alt . Press Delete or BackSpace to close an editor tab or hide a tool window. Working with Markdown cells To edit a Markdown cell, double-click it and start typing. To preview the output, press Shift + Enter . Use multiple carets In PyCharm, you can have multiple carets. Press and hold Shift + Alt + Ctrl (Windows and Linux) or Shift + Alt(Option) Cmd (macOS), and then click at different positions to set additional carets in the editor. You can then press Shift with the left or right arrow keys to select multiple text fragments. Press Escape to remove all the carets except for the recently added one. Search for code inspections To quickly find and run an inspection, press Ctrl + Alt + Shift + I and start typing the name of the inspection or its group. Choose the inspection from the suggestion list and specify the scope. Select completion suggestions When the Show suggestions as you type option is enabled for code completion, you can use the Lookup Up and Lookup Down actions to close the suggestion list and move the caret up or down in the editor. On Windows, use the Ctrl + Down and Ctrl + Up shortcuts. On macOS, the shortcuts are not configured by default, so you can assign any key combination that is convenient for you in Preferences | Keymap. Code completion in the search bar Press Ctrl + Space in the search bar when you search for text in the current file Ctrl + F , so that you don't need to type the entire string. View recent changes Use Alt + Shift + C to quickly review recent changes in the project. Change focus in tool windows Escape in any tool window moves the focus to the editor. Shift + Escape moves the focus to the editor and hides the current or the last active tool window. F12 moves the focus from the editor to the last focused tool window. If you have already spent some time working in the interactive consoles, you don't need to re-type the previously entered commands to repeat them. Instead, press Ctrl Up / Ctrl Down (on Window/Linux) and Up / Down arrow buttons (on macOS) to scroll through the history of commands. Code completion Code completion suggests the choices that are reachable from the current caret position as you type. Press Ctrl + Space twice to extend the suggestions list. Change built-in web server port To change the built-in web server port, in the Settings/Preferences dialog ( Ctrl + Alt + S ), go to Build, Execution, Deployment | Debugger) and set the new value in the Built-in server port field. Hide all tool window bars If you need more screen workspace, you can hide the tool windows bars by clicking in the lower left corner. Also, you can show the tool window buttons only for a moment. For this, press the Alt key (on Windows/*nix) or Command (on macOS) twice and keep it down. While the key is pressed, the tool window buttons are visible. Open list of run configurations Press Alt + Shift + F10 to access the list of Run/Debug configurations on the main toolbar without using the mouse. Search in nested directories You can jump to a file located in a deeply nested directory by pressing Ctrl + Shift + N and typing several characters of the enclosing directories and filename. Use either a slash or a backslash as a delimiter. Add copyright notices In PyCharm, you can configure different copyright notices for different sets of files. For convenience, you can use variables. For example, use $today.year to keep the year up to date. In the Settings/Preferences dialog ( Ctrl + Alt + S ), select Editor | Copyright | Copyright Profiles, create a new profile, and add the text for your copyright notice using variables. Edit multiple lines at the same time To select multiple fragments in the column mode Alt + Shift Insert , press and hold Ctrl + Alt + Shift (Windows and Linux) and Ctrl Alt(Option) Shift (macOS), Options for context actions When you press Alt + Enter to invoke a quick-fix or an intention action, click the right arrow key to reveal the list of additional options. Depending on the context, you can choose to disable the inspection, fix all problems, change the inspection profile, and so on. Match case in code completion When using basic code completion Ctrl + Space , you don't need to type the upper-case letters in CamelHump names. It is enough to type the initial letters of the camel names in lower case, and they will be smartly recognized. Use Emmet Use Emmet to speed up the HTML, XML, or CSS development. In the Settings/Preferences dialog ( Ctrl + Alt + S ), go to Editor | Emmet and select the Enable Emmet checkbox on the Emmet | HTML, Emmet | CSS, or Emmet | JSX page. Close editor tabs You can close tabs in the editor and tool windows without using the context menu commands. Click the tab to be closed with the middle mouse button or use Shift + Click + it. Use method separators Enable separator lines between methods in the editor to distinguish each method's body at a glance. Editor | General | Appearance page of the Settings/Preferences dialog Ctrl + Alt + S , select the Show method separators checkbox. Code completion You can use code completion Ctrl + Space for completing words in text files and in comments. The completion window includes words that are already present in the current file. Copy as rich text You can copy text from the editor as rich text to paste it into any other editor that recognizes RTF. Make sure the Copy as rich text checkbox is selected on the Editor | General page of the Settings/Preferences dialog ( Ctrl + Alt + S ). Code completion When you use basic code completion Ctrl + Space , type any characters that exist anywhere in an identifier. You can customize the structure of import statements in your code. Imports can be placed separately, grouped by source, or left unstructured. To make your choice, go to Settings/Preferences ( Ctrl + Alt + S , select Editor | Code style | Python, and select the corresponding checkbox under Structure of "from" imports. View quick documentation on hover You don't need to invoke quick documentation explicitly Ctrl + Q . If you hover your mouse pointer over the desired symbol, the quick documentation popup window will show automatically. To enable this feature, select the Show quick documentation on hover checkbox on the Editor | Code Editing page of the Settings/Preferences dialog ( Ctrl + Alt + S ). Search for settings and plugins Enter / in the search field of the Search Everywhere ( Shift twice) window to search for a group of settings, their options, and plugins. The navigation bar at the top is a quick alternative to the Project tool window where you can go through the structure of your project, open specific files, and jump to specific code elements in the current file. Press Alt + Home to show the navigation bar and use arrow keys to switch between files and folders. Working in the interactive consoles, you don't need to memorise the command line syntax or available functions. Instead, you can use the familiar code completion Ctrl + Space . Moreover, from within the lookup list, you can press Ctrl + Q to view the item's documentation. Access breakpoints via context actions Get access to the most common breakpoint actions and filters through context actions ( Alt + Enter ). Add custom dictionaries to check spelling When some words are missing in the pre-defined dictionaries, you can create your own. A custom dictionary is a .dic text file containing each word on a new line. To add new dictionaries, open settings by pressing Ctrl + Alt + S and navigate to Editor | Natural Languages | Spelling. Evaluate expressions while debugging To evaluate any expression while debugging your program, select the expression in the editor and press Alt + F8 . Select several code elements To select several code elements, press and hold Alt (Option) , and double-click each word you want to select. Commit changes partially You can split changes made to the same file between different commits. In the Commit tool window Alt + 0 , click Diff. Select the checkbox next to each chunk of modified or new code that you want to commit and click Commit. Unselected changes will stay in the current changelist. Check spelling and grammar Spelling and grammar checks are enabled by default. These checks are provided by the Grazie plugin, which is bundled with the IDE. To configure proofreading settings, open settings by pressing Ctrl + Alt + S and navigate to Editor | Natural Languages | Grammar . All texts, including comments, textual strings and literals, are inspected against the pre-defined or custom dictionaries. Typos are highlighted so that you can choose the correct word, accept the current spelling, or disable the inspection. To fix a spelling or grammar error, press Alt + Enter to see the list of available actions. Column selection mode To select a rectangular piece of code, drag your mouse while pressing Shift + Alt (on Windows and Linux) / Shift + Alt (Option) (on macOS) . Open terminal with a shortcut PyCharm allows you to launch the embedded local terminal by using the keyboard shortcut. Press Alt + F12 and see the terminal running. Select several code fragments To select multiple text fragments, press and hold Shift + Alt + Ctrl (Windows and Linux) and Shift + Alt (Option) Cmd (macOS) and drag your mouse across the text: Navigate to the last change To return to the last place where you made changes in code, press Ctrl + Shift Backspace or select Navigate | Last Edit Location from the main menu. If you press Ctrl + Shift Backspace several times, you see later deeper into your changes history. Compare files and folders When you are comparing files or folders, you can apply the differences between panes in the Differences viewer using the chevron buttons: To append the contents of the current pane to the other pane, keep Ctrl pressed. The buttons will change to . To revert changes, keep Shift pressed. The chevrons turn into. Preview references images Preview a referenced image in a popup instead a separate editor tab: place the caret at the image name and press Ctrl + Shift + I View live template details When choosing a live template from a suggestion list, press Ctrl + Q to view quick documentation - to be sure you make the right choice. Delete tasks When working with a lengthy list of tasks, you don't have to delete the tasks one by one. Select several tasks by using Shift or Control/Command , click the right arrow, and then click Remove. Find Action If you do not remember a shortcut that calls an action, press Ctrl + Shift + A and start typing the action name. To apply the action, select it from the suggestion list. A shortcut is displayed near the action name. Search in settings You can quickly find a page in the Settings/Preferences dialog Ctrl + Alt + S without browsing through the numerous options. Type some characters contained in the option description, and the list of settings will reduce to the matching ones. Select the desired entry and see the specific setting that contains the entered characters highlighted. Execute cells in Jupyter notebook Press Shift + Enter to execute the current cell in a Jupyter notebook and select the next one. Rename CSS selectors in HTML You can rename CSS selectors directly in HTML. Position the caret at the selector to be renamed and press Shift + F6 The easiest way to run a utility of the manage.py task is to choose Run manage.py Task in the Tools menu, or press Ctrl + Alt + R As you type the name of the utility you want to run, the lookup list shrinks to show the matching entries only. Use PyCharm terminal You don't need to leave PyCharm to work with your favorite shell. Instead, you can use the embedded local terminal. To open it, press Alt + F12 Navigate between methods Press Alt + ↑ and Alt + ↓ to quickly move between methods in the editor. Choose shell for the terminal Use your favorite shell from the built-in Terminal. In the Settings/Preferences dialog Ctrl + Alt + S , go to Tools | Terminal and specify the path to your shell executable. Open To navigate to any part of the file path, Ctrl Click (on Windows and Linux)/ ⌘ Click (on macOS) its tab in the editor. Select the desired element, and it will be opened in the file browser. Breakpoints To avoid accidentally removing breakpoints, you can choose to remove them by dragging them from the gutter. Press Ctrl + Alt + S , go to Build, Execution, Deployment | Debugger and select Drag to the editor or click with middle mouse button. Click a breakpoint to enable or disable it. Clone the caret upwards or downwards To clone the caret upwards or downwards, press Ctrl + Shift + A → Clone Caret Above or Ctrl + Shift + A → Clone Caret Below . Change code selection In the editor, press Ctrl + W / Ctrl + Shift + W to extend or shrink your current code selection. Edit tags simultaneously You can edit both the opening and closing tags in XML/HTML files simultaneously. Make sure to select the Simultaneous <tag></tag> editing checkbox in the Editor | General | Smart keys | HTML/CSS page of the Settings/Preferences dialog ( Ctrl + Alt + S ). Access VCS-related options Press Alt Back Quote to access all VCS-related commands available in the current context. Run a query To run a query, right-click a query and select Execute or use a shortcut (Cmd + Enter for macOS, Ctrl+Enter for Windows and Linux). Code completion When using code completion, you can accept the currently highlighted selection in the popup list by pressing Tab . Unlike accepting with Enter , the selected name will overwrite the rest of the name to the right of the caret. This can be especially useful for replacing one method or variable name with another.