Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

👶 lightweight vim plugin for python

License

NotificationsYou must be signed in to change notification settings

kimbo/vim-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Little vim plugin for python

Installation

git clone https://github.com/kimbo/vim-python.git ~/.vim/pack/plugins/start/vim-python

Usage

The suggested way to use vim-python is to define some mappings in your ~/.vimrc:

autocmdBufNewFile,BufReadPost*.pynnoremap<F3>:PySetArgs<CR>autocmdBufNewFile,BufReadPost*.pynnoremap<F4>:PyBreakpoint<CR>autocmdBufNewFile,BufReadPost*.pynnoremap<F5>:PyRun<CR>autocmdBufNewFile,BufReadPost*.pynnoremap<F6>:PyRunWithArgs<CR>autocmdBufNewFile,BufReadPost*.pynnoremap<c-_>:PyCommentNormal<CR>autocmdBufNewFile,BufReadPost*.pyxnoremap<c-_>:PyCommentVisual<CR>

You can customize these to map to whatever keys you want.

After that, open up a Python file and start trying out the functions in the next section.

Functions

Here's a table that describes the functions that vim-python provides.

Function nameDescriptionSuggested mapping from above
:PySetArgsSet the arguments to be used when:PyRun is invokedF3
:PyBreakpointToggle a breakpoint on/above the current line. This just insertsimport pdb; pdb.set_trace()F4
:PyRunRun the current file as a Python script. If ./venv/bin/python exists, it will be the interpreter chosen. Otherwise, the defaultpython is usedF5
:PyRunWithArgsSet the arguments to be run, and then run the current file as a Python script. This combines:PySetArgs and:PyRun for convenienceF6
:PyCommentNormal and:PyCommentVisualToggle comment on the current line or visual selectionCtrl+/

Helpful tips

  • After running:PySetArgs orPyRunWithArgs, those args will be used as the default arguments until you exit vim or change the arguments
  • To quickly modify your previous arguments (e.g. to add an extra--some-param), run:PySetArgs or:PyRunWithArgs and then use the up arrow to view previous args.

About

👶 lightweight vim plugin for python

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp