After a long search, I have finally found a solution for working with the 
Julia REPL and vim. I am working in a Windows 7/x64 environment but I 
believe my setup can also be used in other situations. I am posting it here 
in the hopes of it being useful to some other vimmer getting their hands 
dirty with Julia.

My earlier setup was a follows - 

1. Manually sync the directories of gvim and julia REPL
2. Open file in gvim, save, in julia, do include("foo.jl") and iterate
3. Keep doing the Alt+Tab to keep going back and forth between the two

After a point, it because clear that this setup is not going to fly. My 
current setup is as follows-

1. Install Cygwin and in particular bash and GNU/screen
2. Ensure that the bash.exe and screen.exe from cygwin are in your PATH
3. Ensure that julia.exe is in your PATH
4. In vim, install julia-vim <https://github.com/JuliaLang/julia-vim>, 
ervandew/screen <https://github.com/ervandew/screen> plugins
5. Make some changes to the _vimrc (my setup is below)

My current setup helps me work as follows (can be modified using _vimrc 
mappings)


   1. Start gvim
   2. cd to required directory
   3. Type <Leader><Leader> in normal mode
   4. This starts a julia session that communicates with gvim using screen. 
   It also automatically changes the directory in the julia REPL to the 
   directory gvim cwd.
   5. Open the main script (say run.jl) in gvim
   6. You can execute commands from this file in two ways 
      - Typing <Leader><Leader> in gvim executes the whole paragraph in 
      which the cursor is located, i.e. this paragraph is automatically sent to 
      Julia REPL for execution
      - Typing <Leader>s sends the command 'include("run.jl");' to julia, 
      i.e. whatever is the current buffer in gvim
   7. I have made another modification so that I can designate a file in 
   gvim as the main file, say, run.jl and then begin editing another script 
   foo.jl that is including from run.jl. Now typing <Leader>s sends the 
   designated main script, i.e. "include("run.jl")" to julia. I can continue 
   to work on foo.jl and look at the results in the julia REPL
   8. When I am done with julia, I type <Leader>x to end the julia session 
   which automatically closes julia and the screen session


This setup has done wonders to my productivity when I am working with 
Julia. My demo _vimrc script is here [Gist Link 
<https://gist.github.com/skrisna/f078bb34782b98e50728#file-_vimrc>].

Thanks.

Reply via email to