Skip to content

Interact wtih the terminal in vim 8.1 especially for Python programming

Notifications You must be signed in to change notification settings

zhf-0/vim-interact-terminal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vim-interact-terminal(REPL)

Interact wtih the terminal, or REPL(Read-Eval-Print Loop), in vim 8.1 especially for Python programming. Theoretically, it can also be used for bash and other languages. The main feature is sending the commands to the console and execute without considering the indent problem !

Advantages compared with other similar plugins

  • installation and configuration are so easy without any effort.
  • support multiple languages, including Python,bash
  • support virtual environment of Python naturally, which can be verified by following steps
    • activate one venv,
    • open a *.py using vim
    • type:terminal to open a built-in terminal
    • type pip show numpy(or other packages), which can list the location of package. Using the location to tell whether it's in the virtual environment or not

install

Copy the content in vimrc to the vim config file, eg~/.vimrc.

After the installation, there are two ways to open the ipython console:

  • open the console with --no-autoindent, for example
:terminal ipython3 --no-autoindent

Otherwise this plugin can't work properly!

  • open the console with built-in command
:Ip3

which is controlled by the following config

command Ip3 terminal ipython3 --no-autoindent
command P3 terminal python3

So, you can change the alias by yourself

usage

The short cut is <leader>s.

  • in normal mode: typing <leader>s will send the current line to the console and execute
  • in visual mode: typing <leader>s will send the selected lines to the console and execute
  • in visual mode: typing <leader>j will just send the selected content, which can be a few words in one line or several lines, to the console without executing

example 1gif send commands with indent 2gif bash command 3

issue

ipython console 5 python console 6

About

Interact wtih the terminal in vim 8.1 especially for Python programming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published