diff --git a/wiki/linux/vim/python.md b/wiki/linux/vim/python.md new file mode 100644 index 0000000..d00e523 --- /dev/null +++ b/wiki/linux/vim/python.md @@ -0,0 +1,24 @@ +# Python + +Python is a common programming language. +In this entry we will focus on making vim support python and use vim as an ide +for it. + +## Autocompletion + +### Coc + +To enable autocompletion for [coc](coc.md) you need to install the coc-package +`coc-python`. Do that by adding it to the extension section of your `init.vim`. + +## Formatting + +Install `autopep8` to your system. +Then add `autocmd FileType python setlocal formatprg=autopep8\ -` and +`autocmd FileType python noremap gggqG` to your +`init.vim` to reformat on F8. + +## Line length + +To set your python buffers to show column 80 add +`autocmd BufEnter,FileType python set colorcolumn=80` to your `init.vim`. diff --git a/wiki/programming-languages/python.md b/wiki/programming-languages/python.md new file mode 100644 index 0000000..cb5646d --- /dev/null +++ b/wiki/programming-languages/python.md @@ -0,0 +1,40 @@ +# Python + +[Python](https://www.python.org) is an interpreted general-purpose programming +language. + +## Installation + +You can install python using various ways. +With `pyenv` you can switch between different versions. +Install `pyenv` and `pyenv-virtualenv` and proceed with adding + +```txt +export PATH=${HOME}/.pyenv/bin:$PATH +eval "$(pyenv init -)" +eval "$(pyenv virtualenv-init -)" +``` + +to your `~/.profile`. +You can then set and install your preferred version of python globally with +`pyenv install ` and `pyenv global `. + +Analog to managing python versions, `pipenv` can manage pip and package versions. + +### Avoid Errors in Vim + +Make sure to add + +```vimscript +let g:python_host_prog = "/usr/bin/python2" +let g:python3_host_prog = "/usr/bin/python3" +``` + +to your `init.vim` to avoid usage of `pyenv`s version of python in autocompletion. + +## IDE + +### Vim + +The steps to make Vim a python IDE are described in +[the vim section of this wiki](../linux/vim/python.md).