/Python-vim

Primary LanguageVim scriptGNU General Public License v2.0GPL-2.0

Python-vim

Introduction

Python-vim can build a vim-plugin-based environment for python. It will install and configure YouCompleteMe and some other plugins.
It allows you to search and replace words, comment and uncomment codes.
It allows you to jump to definition recusively.
It allows you to format codes with autopep8.

Tested OS list

Ubuntu 16.04
Ubuntu 18.04
CentOS 7

Installation

Python-vim supports only vim 8.
Execute ./check.sh to check if the environment is suitable for the installation.
Execute ./install.sh to do the installation.

Issues

NA

General Usage

Execute source ~/.bashrc after the installation to make vimc work.
To start a go project, execute vimc at the root of the project.

Normal Mode

:Q<CR>: quit vim and all plugins
:W<CR>: save all & :Q<CR>
<C-k> : save

\tg: open or close the window of taglist

<F5>: go to shell, equivalent to :term<CR>
gg=G: format the current file with autopep8

mh: move cursor to left window
mj: move cursor to bottom window
mk: move cursor to top window
ml: move cursor to right window
mw: move cursor to window below/right of the current one
mt: move cursor to top-left window
mb: move cursor to bottom-right window
mp: move cursor to previous window

+: increase width of window towards left
-: decrease width of window towards right

\cc: comment one line
\cv: comment one line with next delimiter
\cm: comment multi lines
\c$: comment to end of line
\cu: uncomment

<C-p>: search file in project

:Grep [keyword]<CR>: search the keyword in project
\vv: search the word under cursor in project
:Replace [keyword]<CR>: replace the word under cursor with keyword in project
:Replace [target] [keyword]<CR>: replace the word target with keyword in project
:UndoReplace<CR>: undo :Replace
cgt: save changes and close all tabs except the first, then close the bottom-right window
:ccl<CR>: close Grep window

\': wrap selected part by "'", if no part is selected, the word under cursor will be wrapped
\\': remove the closest "'" wrapped the part in which the cursor is
similar shortcuts: \" and \\", \( and \\(, \[ and \\[, \{ and \\{, \< and \\<

<F12>: goto definition
<C-o>: go backword
<C-i>: go forward

Insert Mode

<C-j>: move cursor backwards out of parenthesis
<C-k>: goto normal mode and save
<C-e>: move the current character to the end of next word
<C-l>: move the cursor to the end of line
<C-\>: delete the word under the cursor

To get more information about usage, click on the links at the References below.

Tips

  1. vim -Nu ~/.vim/bundle/YouCompleteMe/vimrc_ycm_minimal xxx.py to get minimal vim configuration for YCM to debug YCM.
  2. Debug commands of YCM: :YcmDiags, YcmDebugInfo, YcmToggleLogs.

References

https://github.com/VundleVim/Vundle.vim
https://github.com/Valloric/YouCompleteMe
https://github.com/preservim/nerdtree
https://github.com/dense-analysis/ale
https://github.com/ctrlpvim/ctrlp.vim
https://github.com/scrooloose/nerdcommenter
https://github.com/majutsushi/tagbar
https://github.com/vim-airline/vim-airline
https://github.com/vim-airline/vim-airline-themes
https://github.com/rstacruz/sparkup
https://github.com/Yggdroot/indentLine
https://github.com/jiangmiao/auto-pairs
https://github.com/tpope/vim-repeat
https://github.com/tpope/vim-fugitive
https://github.com/Xuyuanp/nerdtree-git-plugin
https://github.com/YvesZHI/vim-code-dark
https://github.com/vim-python/python-syntax
https://github.com/YvesZHI/killersheep
https://codeyarns.com/2015/03/18/how-to-test-color-setup-in-vim