[Python] Keep efficient by Vim in Pycharm

Source: Internet
Author: User

from:http://blog.csdn.net/u013088062/article/details/50144201

from:http://blog.csdn.net/u013088062/article/details/50148219

There are already plans

Custom Scenarios

Configuring the VIM scheme

There are already plans

1. Theme

There is no doubt that Pycharm is an IDE with a powerful shortcut key system, which means that any action you make in Pycharm, such as opening a file, switching the editing area, and so on, can be accomplished by shortcut keys. Using shortcut keys not only improves the speed of the operation, it also looks very cool. However, if you are accustomed to using some shortcut key scheme, your fingers will become accustomed to change it is more difficult. This part of the tutorial is about how to tailor the Pycharm shortcut settings according to your habits, so you can use them handy.

For the basic shortcut key combination, usage is not mentioned here, details can refer to configuring keyboard shortcuts or Keymap.

2. Select a shortcut key configuration scheme

This is a very simple step, click the Settings button in the main toolbar and click Keymap in the Settings dialog box.

In the corresponding page drop- down list, select a shortcut key configuration scheme :

Click Apply to save your changes. For example, we chose the eclipse scenario here, so deleting a row of shortcut keys is what we are accustomed to ctrl+d.

Custom Scenarios

3, change the shortcut key configuration scheme.

Here we describe how to change the configuration of shortcut keys.

Imagine the situation: you chose the shortcut configuration for the Emacs scheme, but this configuration does not have a predefined definition of how to delete a row by using the shortcut key:

Let's say you want to specify the shortcut key as Ctrl+d for this function, as follows:

(1) Click the Settings button in the main toolbar and click Keymap in the Settings dialog box.

(2) select Emacsin the corresponding down list.

(3) In the list of shortcut keys below, expand the Editor Actions node and navigate to the Delete line feature .

(4) Right click on the shortcut menu and choose Add Keyboard Shortcut

(5) Enter the shortcut key combination you want in the first stroke of the Open Enter Keyboard shortcut window:

  

One thing to note is that all input from the keyboard is recognized as the user's shortcut setting when you enter the desired shortcut key, for example, if you want to set a shortcut key combination Ctrl+d, you need to press Ctrl and D the key at once.

If you press the wrong key, you can only use the mouse pointer to delete the wrong input, because the input Backspace from the keyboard will also be recognized as a shortcut key setting by the system.

(6) The next need to pay attention to the system warning: This ctrl+d shortcut key combination already exists, indicating that Pycharm has linked this shortcut key combination to other settings, fortunately, the previous settings are not commonly used, you can replace it, so click OK.

Pycharm will give you a warning when you replace the message:

(7) Once again browse the set of shortcut key scheme:

  

You will find that the configuration scheme is automatically renamed as Emacs copyat this time.

This is because Pycharm does not allow users to change their pre-defined shortcut configuration scheme, they can only change their copy files . Click Apply and close the dialog box.

Finally, test whether our changes take effect. Open a py file, position the cursor to the row to be deleted, press Ctrl+d, the line code is deleted successfully, and the setting change succeeds.

Configuring the VIM scheme

1. Theme

If you are a fan of vim and do not intend to use other types of editors, then this tutorial will be more suitable for you. Here's a detailed description of how to download, install, and use VIM with the help of the pycharm ideavim plugin .

As for Python programming and the use of VIM, see official website, vim documentation.

3. Download and install the Ideavim plugin

Click the Settings button in the main toolbar of Pycharm and select the Plugins page under the IDE Settings interface. All plugins installed under the current platform will be displayed. However Ideavim is not in it, you need to click the Browse jetbrains plugins button and type vim in the search field to find the corresponding plugin:

To install the plugin:

After restarting Pycharm, you can use:

4. Changes after reboot

Vim and Pycharm are based on keyboard input text editing software, the response of the Ideavim plug-in shortcut settings are likely to conflict with Pycharm shortcut settings, which is why pycharm need to follow the existing shortcut key configuration to re-create a set of Vim version of the shortcut key scheme.

  Pycharm 5:

  

When Pycharm is restarted, you will see the Vim Keymap Settings dialog box, where you can choose a shortcut configuration scheme as the shortcut key scheme in the current VIM environment:

We choose the default configuration here, click OK, you can see Pycharm created a new shortcut key configuration:

Next, look at the shortcut Settings screen again. Click the Settings button to enter the Settings dialog box, under IDE Settings , click the Keymap page. A scheme name called Vim appears in the corresponding shortcut configuration drop-down list, which defines some default shortcut key combinations, such as CTRL + V for pasting, and so on:

However, there is a more important Pycharm interface setting, click Tools on the main toolbar and Select the Vim Emulator command:

When you install the Ideavim plugin, this command is selected by default (with a checkmark in front), which means that the current VIM emulator is available.

Uncheck, the Pycharm will return to the normal shortcut key-like body;

Check again, Pycharm will reload the vim version of the shortcut configuration scheme:

5. Edit mode

Now we can edit in vim mode, when our input cursor is a small black block, which means we are currently in normal mode:

If you want to change to insert mode, press the I key and the cursor will change to a vertical bar:

In this mode, you can enter new code or modify the current code. Of course you can also choose other modes, such as pressing R to enter replace input mode.

By the way, in order to quickly enter the VIM simulation, you can view the status bar related information: status bar

Press the ESC key to return to normal edit mode.

Ideavim has many of the features of the Vim editor, such as short form, shortcut key combinations, various commands, and more, see: A lot more.

[Python] Keep efficient by Vim in Pycharm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.