You are not logged in.

#1 2011-06-16 11:00:47

awayand
Member
Registered: 2009-09-25
Posts: 398

[SOLVED] rerunning perl code efficiently

I am trying to learn perl and for that reason I am looking for the most efficient setup to do coding and not waste time compiling and restarting, etc.

Here is my current setup: I am using gvim and dwm, and I have one urxvt client open. I code in gvim, the file I am editing is called "tt" (for faster typing) and is located in my ~/bin directory, is chmod +'ed and of course in my path. So what I do is I edit my code in gvim, and when I want to see if my program works, I save the file in gvim (using ":w"), and then go to my urxvt terminal and just type "tt" to execute.

Anyone have a suggestion how to make this faster or give me some insights as to how they would do this most efficiently?

Last edited by awayand (2011-07-30 04:59:08)

Offline

#2 2011-06-16 11:10:34

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: [SOLVED] rerunning perl code efficiently

Depending on how large your program gets and what it does, it may be quicker to recompile each time to get the speed of a compiled language, but I would not worry about that for now.

You could use both vim and tmux, so you can save in vim, then switch panes (in mine, this means pressing ^b and then the direction I want to move, as in vim). [Edit: You're probably using dwm keybindings to just switch windows, which is as fast as this will be]

Also, depending on what your script does, you can execute commands from inside of vim. Try :!ls . If that looks alright to you, you can use :!tt . This comes in handy for other things to, where you can pipe any selection (through visual mode or made manually) to an external command and have the results put in it's place.

Honestly, programming usually isn't something you try to do as fast as possible. As your program grows, the runtime will matter much more than the amount of time it takes for you to do a context switch.

Last edited by jac (2011-06-16 11:12:17)

Offline

#3 2011-06-16 12:06:48

awayand
Member
Registered: 2009-09-25
Posts: 398

Re: [SOLVED] rerunning perl code efficiently

thanks for that! I have experimented with tmux as well, it really is a nice app, too, but I prefer X to have a little bit of a mix of things and more flexibility, i.e. more screen estate thanks to smaller fonts, quick browser lookups, etc.

Just wondering, is there some kind of "best practice" to compile and start out of vim? I don't want to keep saving before launching my app, I wonder if other people have the same issue and use some kind of macro or otherwise to get things rolling with vim? I like the :!tt command, but I wonder if I can do a :! command from vim that will redirect to my terminal instead or something like that?

Offline

#4 2011-06-16 23:56:57

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: [SOLVED] rerunning perl code efficiently

I'm not sure what you mean by your first paragraph. I use tmux in rxvt-unicode, so it is in X and I can just mod-k to my browser (it's my keybinding for moving to the previous window). I'm using Xmonad now, I can't remember the default for dwm. My point is, I have smaller fonts and higher resolution while still getting the benefit of tmux.

I honestly don't know. I don't really use vim's command execution that often except for piping text through a command. I've heard of things setup to compile easily using vim, whenever you save. A cursory google'ing has brought me nothing though. Perhaps searching for ways to make vim more IDE like would net you some results?

Offline

#5 2011-07-30 04:58:51

awayand
Member
Registered: 2009-09-25
Posts: 398

Re: [SOLVED] rerunning perl code efficiently

thanks for the helpful answers! marking this thread as solved.

Offline

#6 2011-07-30 11:36:53

tadzik
Member
From: &tadzik
Registered: 2009-07-17
Posts: 91

Re: [SOLVED] rerunning perl code efficiently

Offline

Board footer

Powered by FluxBB