If you want to do auto-complete tasks more efficiently then it is better to use an auto-complete plugin of vim editor. The main limitation of the built-in auto-complete feature of vim is that it has limited options for doing auto-complete tasks. Press Ctrl+p to select the last item from the list. Enable the insert mode, type the character ‘i’ and press Ctrl+n to display the auto-complete list. The following image shows the use of Ctrl+p command of vim. If Ctrl+n is pressed after typing ‘p’ then ‘ print‘ function will be auto-selected like the following image. To select any particular variable or function, type the first character of the variable or function name and press Ctrl+n to open the auto-complete list. It will display the list of all declared variable and function names. Press i to enter in the insert mode and move the cursor where you want to add the code. Here, average.py file is opened in vim editor. Open any new or existing python file in vim editor to test the auto-complete feature. Some uses of the auto-complete feature of vim are shown in the next part of the tutorial. Ctrl+p is used to select the last word from the list. Ctrl+n is used to open the drop-down list and the user can select any word from the list to enter as the next word. This feature works after entering in INSERT mode. Vim editor has built-in auto-complete feature. When the cursor is set at the position of any starting bracket then it will highlight both starting and ending brackets for showmatch setting. When the tab key is pressed then 4 spaces will be added for ts setting like the following image. Underline is added where the cursor is located for cursorline setting.
The line number is added in each line of the file for number setting. The effects of the settings will be shown after opening the file in vim editor. Print ( "The average value is ", round (average, 2 ) ) The content of the file is given below.Īverage = ( int (n1 )+ int (n2 )+ int (n3 ) )/ 3
Here, average.py file is opened on vim editor. Open any python script in vim editor and check the effect of the new settings. Set fileformat=unix Check the effect of the settings
#Python script editor macvim how to
"It is used to inform vim about the file format and how to read the file "It is used for adding automatic indention in vim "It is used to convert all new tab character into space "It is used to control the number of columns when left or right shift is pressed " It is used to control the number of tabs that will be used by vim when tab " Highlight the matching part of the brackets, (), and " Display an underline where the cursor is located " Enable syntax highlighting for python codes