Setting-up Vimux ( vim + tmux ) in Linux machine

By using vimux we can use vim as an IDE. It basically opens a terminal below vim panel with 20 width and then run the mapped command. Pre-requisites are vim and tmux installed.

Installation :

Make sure vim plugin manager will be installed. I installed pathgen. Now run the below command :
 cd ~/.vim/bundle
 git clone

Configuration :

The function used to configure vimux are VimuxRunCommand, VimuxPromptCommand, VimuxRunLastCommand.
  • VimuxRunCommand : used to run certain system command. It is mapped with autocmd FileType which map different commands for different filetypes. Press LEADER + e
  • VimuxPromptCommand : used to open a prompt to run user supplied command. Press LEADER + p
  • VimuxRunLastCommand : used to run last command Executed by VimuxRunLastCommand. Press LEADER + l
Note : LEADER key is mapped to / (slach), by default it is mapped to \ (backword-slash).
Now rest of the configuration is as follows on ~/.vimrc :
 let mapleader = "/" 
 autocmd FileType ruby map <Leader>e :call VimuxRunCommand("clear; ruby " . bufname("%"))<CR>
 autocmd FileType python map <Leader>e :call VimuxRunCommand("clear; python " . bufname("%"))<CR>
 autocmd FileType sh map <Leader>e :call VimuxRunCommand("clear; bash " . bufname("%"))<CR>
 autocmd FileType c map <Leader>e :call VimuxRunCommand("clear; gcc " . bufname("%") . " && ./a.out")<CR>
 autocmd FileType cpp map <Leader>e :call VimuxRunCommand("clear; g++ " . bufname("%") . " && ./a.out")<CR>
 map <Leader>p :VimuxPromptCommand<CR>
 map <Leader>l :VimuxRunLastCommand<CR>

Usage :
  • To execute file Press / + e
  • To get CommandPrompt Press / + p
  • To execute last command Press / + l
Note : Always run vim inside tmux sessions otherwise it does not work properly.