2

I am new to vim and I want to use vim as an IDE. I have installed python-mode for making it into a python IDE. I want to split vim windows into three screens with their own functions.

  1. Top left side window: regular vim editor
  2. Top right side window: python shell interpreter
  3. Bottom window: bash screen displaying output for commands run in top left side window

Would it be possible achieving such arrangement? If so, how may I do it?

This is how my current .vimrc file

set runtimepath+=~/.vim_runtime

source ~/.vim_runtime/vimrcs/basic.vim
source ~/.vim_runtime/vimrcs/filetypes.vim
source ~/.vim_runtime/vimrcs/plugins_config.vim
source ~/.vim_runtime/vimrcs/extended.vim

try
source ~/.vim_runtime/my_configs.vim
catch
endtry

noremap <F5> <ESC>:w<CR>:silent execute "!python %"<CR><CR>
au VimEnter * vsplit
2
  • 1
    Do you really want the bottom window to display output from the vim editor (top left)? Wouldn't it be from the python repl (top right)? Commented Mar 22, 2018 at 9:11
  • I want a seprate pyton repl in top right because while developing I want to try out some python functions before writing into my code. Thats why I want a separate pyton repl
    – Eka
    Commented Mar 22, 2018 at 13:26

2 Answers 2

2

There are some plugins that try to do this, but I've never really found one that works for me. If you can, I would suggest using a terminal multiplexer like tmux (or screen).

That way you could just create a script (say python-tmux) like this

#!/bin/bash
tmux new-session -d 'vim'
tmux split-window -h 'python3'
tmux split-window -v
tmux attach-session -d

and run $ python-tmux to launch your environment. You can add some arguments to open specific files, directories, etc.

the last bottom window is a bash screen which should show the output when commands in top left side window is executed

I never tried this, but I guess you can map a key in vim to run a command or send key presses (e.g. python <current file>) in a specified tmux window in a specific session.

1

I'd do that with tmux:

$ tmux

tmux

$ vim .
CTRL + B
SHIFT + "
$ touch python.out
$ tail -fn +1 python.out &

horizontal split

CTRL + B
;
CTRL + B
SHIFT + %
$ python > python.out
>>> 1 + 1

vertical split

This considers the default key bindings for tmux. Some fine references:

4
  • thank you is it possible to add this as a config file so that it automatically make this setup on starutp of tmax. Is it possible to bind the vim (top left) to bash window (bottom).
    – Eka
    Commented Mar 22, 2018 at 13:31
  • You're welcome! tmux has a server which keeps track of your tmux sessions, so if you detach (CTRL + B -> D) instead of killing you can restore your session with tmux attach (tmux list-sessions may also be handy). Sessions aren't persistent across reboots but this plugin may be a solution for this: github.com/tmux-plugins/tmux-resurrect. Would you please further explain the use case for binding vim and bash? Do you want vim commands output to display in the bottom bash window? If so, which commands are you talking about? Commented Mar 22, 2018 at 14:20
  • I want a RStudio like setup where we have a editor panel and a console panel to output as well as for trying out. Like this one milanor.net/blog/wp-content/uploads/2013/07/0_overall.jpg
    – Eka
    Commented Mar 22, 2018 at 14:32
  • 1 would be the bash panel (bottom)? It looks more like a repl (I believe it is an R repl indeed) and less like a bash shell. I still couldn't understand the connection between the vim editor and the bash cmd line. Commented Mar 22, 2018 at 14:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .