[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Chicken with VIM
From: |
Tobia Conforto |
Subject: |
Re: [Chicken-users] Chicken with VIM |
Date: |
Sun, 17 Aug 2008 21:41:03 +0200 |
Xin Wang wrote:
I can't find "suggested by Alex Querioz" lines in my Slackware's
VIM-7.1. But I find them in 7.2. Well, I copy 7.2's scheme.vim to
syntax/ and move these line to the end.
Yes, it's the new version shipped with Vim 7.2 and it's giving me
trouble with the s-expr comment #; I cannot get it to work, no matter
where I place it.
2. You can just add it to the wiki.
3. This too.
And so is 6. All these are wonderful suggestions. :)
Ok, will do.
And the send-to-screen function was stolen from
http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/.
So the kudos is for Jonathan Palardy. I will add this link to the
wiki.
I fixed a couple of problems with it:
- some shell metacharacters were not quoted properly, try to \es on
(print "$HOME") for example;
- csi's current-directory needs to be changed to that of the file
being loaded, otherwise include statements and other stuff will fail.
For the latter, we need the posix library in the running csi. This
happens implicitly if one loads the readline egg in .csirc (as I
suppose everybody does?) otherwise one will need to (use posix)
I also added a new command to send the highlighted text in visual mode
to csi, rewrote Send() to be more general, and used shorter mappings
(a matter of taste, I guess.)
Here is my version, I'll put it on the wiki if it's ok with you:
"Generic function to send some text to a named screen window
fun! Send(window,text)
let text_str = "'".substitute(a:text, "'", "'\\\\''", "g")."\n'"
call system("screen -p ".a:window." -X stuff ".text_str)
endf
"Generate csi commands to load the current file
fun! Chicken_load_current_file()
let dir_str = '"'.escape(expand("%:p:h"),'\"').'"'
let file_str = '"'.escape(expand("%:p:t"),'\"').'"'
return '(change-directory '.dir_str.') (load '.file_str.')'
endf
"name of the GNU screen window running csi
let g:csi = "csi"
"\t = eval Top s-expr, \f = load current File, \e = Eval selected text
nmap <silent> <leader>t 99[(:sil norm yab<cr>``:call Send(g:csi, @")<cr>
nmap <silent> <leader>f :call Send(g:csi,
Chicken_load_current_file())<cr>
vmap <silent> <leader>e y:call Send(g:csi, @")<cr>
Tobia