I am trying to learn lua and am experimenting on my linux machine. I am not a programmer, so I am looking for your help to give me some suggestions.

What I want to accomplish is making my compile-rewrite-recompile cycle as efficient as possible.

Here is what I do.

I am using vim in one window to program. I have a shell open in another window. When I want to check my progress, I save the code in vim, switch to my shell, then execute the code.

However, this is still kind of tedious, I was there was a faster, more elegant way. Any ideas? How do you go about this problem?

4 Answers 4


Assuming you have your shell pane to the right of your Vim pane, and you want to use F6 as tdammers suggested, try this mapping: map <F6> :make <Bar> silent !tmux select-pane -R<CR><C-l>. That way the shell pane is selected after make is run. You'll have to use regular tmux commands to switch back to Vim, of course.

EDIT: The <C-l> in the above mapping (which redraws the Vim screen, which is necessary as a side effect of using silent to bypass the need for pressing Enter) clears the errorlist line, which would show the first error if there was one. The mapping map <F6> :make<Bar>silent !tmux select-pane -R<CR><C-l>:cc<CR> redisplays it, but has the side effect of showing the first compilation line executed by make, if there was no error; this compilation line often takes up multiple screen lines, so you still have to hit Enter to continue.


Switching back and forth works well enough for me, but that's partially due to my setup - I run a tiling window manager, and I have two xterms maximized on the same workspace; switching between them is a matter of <Super>-<Tab>.

Alternatively, <Ctrl-Z> to background vim does the same, but within the same xterm.

For larger projects, I probably have a makefile anyway; in a default vim configuration, the :make command runs make in a shell, and I have mapped <F6> to run this command. For running, I still use one of the above methods, but if you like, you can map another key to, say, :!./foobar, where 'foobar' is the name of your binary.

  • sounds good to me, thanks a lot! I think mapping in vim would be my best option. I am also using a tiling window manager, my "windows" are actually two panes in tmux which are kind of a pain to switch back and forth in... But I can maybe really map F6 or so to make this work. Thanks!
    – awayand
    Aug 18, 2012 at 12:39

I use emacs for the whole cycle. You can compile a program such that the compiler messages are written to another buffer. Click on any compiler error message and emacs will take you to the file and line that caused the error.


EDIT :: Oh wait, here is exactly what you are looking for! It is a plugin which allows you to run your Lua code from the editor. Also, here is a convenience plugin for editing Lua in VIM. Hope that helps.

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.