2

Is there a way to get the following in Vim: If I execute a command in Vim like !make c, I would like to have a frame/split that pops up like in syntastic instead of switching to terminal view. That way, I would be able to go on writing or doing stuff in vim during compilation/command execution.

If I remember right, they added some asynchronous feature to vim (how ever it is used) so there is probably a plugin can fulfill my wish.

It would be also important, that when I execute another command I don't want to have a second window that pops up. It shall all be in the same window.

  • Thank you for editing, but I think that fulfil is also right, just not american English. Also I think that there need to be an that between "plugin" and "can fulfil" but I am not sure. – baxbear Jul 7 '17 at 16:46
  • are you aware of tmux? – laktak Jul 7 '17 at 20:06
  • Yes, I am using it already – baxbear Jul 7 '17 at 20:23
  • 1
    If I understand your question properly what you are looking for is being developped: Neovim already has a :terminal command which does what you want and Bram Moolenaar started to implement a similar feature in Vim 3 days ago. So you could have a look at neovim or wait to see how this feature will be implemented in Vim. – statox Jul 10 '17 at 11:07
  • :term is now part of vim (even if it is still not finished) and it does what I was looking for – baxbear Sep 7 '17 at 9:53
1

You can use your shell in a split inside the vim session using this plugin : ConqueShell

Since this opens in a split view, it would not disturb your currently working area.

I have mapped it as such on my Windows machine :

map cc :ConqueTermSplit cmd.exe<CR><CR>

Note : <CR> has been written twice to avoid a warning message at startup that goes away after pressing Enter.

1

Since you already have tmux, why don't you just split the window and run the command in a new pane?

If you want to automate this with a Vim mapping take a look at vim-tmux-runner.

  • I tried to explain why - gone more and more into detail and noticed by explaining what exactly I am looking for it is nearly impossible to get - I am not opening a split because I have already splits and tabs and stuff open and max out splits with one vim instant pretty often – baxbear Jul 10 '17 at 10:59
  • How about a tmux split on top of the currently split vim session? – Grant Bowman Jul 14 '17 at 4:09
1

I use a normal command aliased to Sh and then place the command I want to run after it.

With this text in a sourced file (e.g. vimrc):

command! -nargs=* -complete=shellcmd ShellRead new | setlocal buftype=nofile bufhidden=hide noswapfile | read !<args>
cabbrev Sh ShellRead

I then type: Sh !make c instead of using the ! and the command runs and shows the output in a new window within vim.

It does consume the vim session, however, so mainly I use it for quick tasks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.