Difference between revisions of "Python"
From Teknologisk videncenter
m (→Vim setting for python) |
m |
||
Line 25: | Line 25: | ||
autocmd FileType python imap <buffer> <F2> <esc>:w<CR>:exec '! python' shellescape(@%, 1)<CR> | autocmd FileType python imap <buffer> <F2> <esc>:w<CR>:exec '! python' shellescape(@%, 1)<CR> | ||
</source> | </source> | ||
− | + | ==Links== | |
+ | *[https://www.python4data.science/en/latest/index.html Python for data science] | ||
[[Category:Python]] | [[Category:Python]] |
Revision as of 09:52, 10 December 2023
Programming style
- Recomended indent - 4 spaces
pip install reindent # Pyhon reindent script
reindent my_script.py
Vim setting for python
add following lines in ~/.vimrc
"Python Settings
autocmd FileType python set softtabstop=4
autocmd FileType python set tabstop=4
autocmd FileType python set autoindent
autocmd FileType python set expandtab
autocmd FileType python set textwidth=80
autocmd FileType python set smartindent
autocmd FileType python set shiftwidth=4
" Map <F2> to write file and execute script in both command- and insert mode
autocmd FileType python map <buffer> <F2> :w<CR>:exec '! python' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <F2> <esc>:w<CR>:exec '! python' shellescape(@%, 1)<CR>