[Tutor] Enable Python feature in vim editor
Peter Downs
padowns at gmail.com
Tue Nov 23 13:04:51 EST 2021
Hey Klaus,
I like how you wrap the language specific settings in a function instead
of having a bunch of separate autocmd lines like I do.
I also map function keys to tools like linters and the interpreter:
==8<==
autocmd BufNewFile,BufRead *.py nnoremap <buffer> <F5> :w<cr>:exec
'!clear; pylint' shellescape(@%, 1)<cr>
autocmd BufNewFile,BufRead *.py nnoremap <buffer> <F6> :w<cr>:exec
'!clear; pylama' shellescape(@%, 1)<cr>
autocmd BufNewFile,BufRead *.py nnoremap <buffer> <F9> :w<cr>:exec
'!clear; python3' shellescape(@%, 1)<cr>
==8<==
that way you can test the code or check the syntax without leaving vim
or switching windows.
Peter
On 11/23/21 7:39 AM, Klaus Jantzen via Tutor wrote:
> Hi,
>
> in my .vimrc I have the following Python related entries:
>
> ============
>
>
> au BufRead, BufNewFile *.py call SetPythonOptions()
> function SetPythonOptions()
> autocmd!
> set tabstop=4
> set softtabstop=4
> set shiftwidth=4
> " use spaces instead of tab
> set expandtab
> set autoindent
> endfunction
>
> " remove trailing blanks in Python files
> au BufWritePre *.py %s/\s\+$//e
>
> ==============
>
> K.D.J.
>
> On 11/22/21 5:48 PM, Kaushal Shriyan wrote:
>> Hi,
>>
>> I am using vim editor to write python scripts. Is there a way to enable
>> syntax, help and indentation of python script?
>>
>> Thanks in advance. I look forward to hearing from you.
>>
>> Best Regards,
>>
>> Kaushal
>> _______________________________________________
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list