I need to execute a visual selection of text. What I want is something similar to C-x C-e in Emacs. Then, there is no need to create a VIM source file for a short calculation. However, I don't know very well the machinery of VIM. Therefore, all I was able to do is something like this:
function! SourceRange() range let tmp = tempname() call writefile(getline(a:firstline, \ a:lastline), l:tmp) execute "source " . l:tmp call delete(l:tmp) endfunction command! -range Source \ <line1>,<line2>call SourceRange() I found this solution somewhere in the Internet. I don't like it, because I don't want to write a temp file. I would appreciate if a fellow from this group could point out a solution that does without a temporary file. I want to visual select a region of my text and source it. Thus :'<,'>Source The above program works, but it requires a temp file. As far as I know, Emacs does not require a temp file. VIM probably does not either. The other thing I need is to write scripts in Common Lisp, instead of Vimscript. When I work with Emacs, I almost never use elisp for scripting. I have created a function based on call-process-region to transfer the duty to sbcl, that is very fast compared to elisp. I want to do the same thing in VIM, and I think that I succeeded. However, my solution needs a temp file, which I think is something very unpleasant. Here is my ugly solution: function! LispRange() range let tmp = tempname() execute "w !sbcl --script > " . l:tmp execute "r " . l:tmp call delete(l:tmp) endfunction command! -range Lisp silent \ <line1>,<line2> call LispRange() >From the first execute, you can see that I was able to send data to sbcl >without a temp file. However much I tried, I couldn't bring the output from >Lisp to my file without a temp file. Again I would be very pleased if someone >could point out an elegant solution to the problem. -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
