Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thanks, I really appreciate how you broke it down. One thing that I was wondering about that you don't address directly is: how do you compile/execute your code? Do you have to exit vim every time, run your compile/execute command, then relaunch vim? Sorry if this is really specific.


In vim, you can execute shell commands straight from the main command mode (the default mode starts in). For a C project, compiling might be as simple as typing:

:!make

Then run with:

:!./myprog

In both cases, the output will be viewable in a temporary window. You can also pipe the output of a shell command into a vim buffer (aka file) by prefixing you command with "r":

:r !./myprog

This takes all the output from ./myprog and lets you view/edit it in vim.

If your language has a more involved build process, chances are someone has written a plugin to help you and posted it on the vim scripts page: http://www.vim.org/scripts/script_search_results.php.

Enjoy :)


For longer and more interactive shell interactions you can use job control, if your shell supports job control (bash, zsh and pretty much every reasonable user shell in existence). Ctrl-Z will suspend vim and drop you back into your shell, you can then unsuspend vim by running "fg" (at least in bash).

Alternatively, my own work flow consists of using tmux to have a split screen terminal, Vim left, REPL right.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: