Changeset 12662 for lang/vim

Show
Ignore:
Timestamp:
05/29/08 02:59:37 (6 months ago)
Author:
nanki
Message:

lang/vim/misc/gosh.vim: partial S-exp evaluation.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/vim/misc/gosh.vim

    r12652 r12662  
    44"     for example: let mapleader="," 
    55command! Gosh :call <SID>Gosh() 
     6command! GoshPartial :call <SID>GoshPartial() 
    67 
    78nmap <leader>go :Gosh<cr> 
     9nmap <leader>gp :GoshPartial<cr> 
    810 
    911func! s:Gosh() 
    10   let cmd = join(getline(1, line("$")), "\n") 
    11   exe 'bo sp [gosh]' 
    12   call eval("append(0, split(system('echo \"'.cmd.'\" | gosh'), '\n'))") 
     12  call s:GoshReal(join(getline(1, line("$")), "\n")) 
     13endfunc 
     14 
     15func! s:GoshReal(cmd) 
     16  exe 'bo 5sp [gosh]' 
     17  call eval("append(0, split(system('echo \"'.a:cmd.'\" | gosh'), '\n'))") 
    1318 
    1419  setlocal nomodifiable 
     
    2126  setlocal nowrap 
    2227  noremap <buffer> <silent> q :close<cr> 
     28  noremap <buffer> <silent> <Enter> :close<cr> 
    2329endfunc 
     30 
     31func! s:GoshPartial() 
     32  normal "ay% 
     33  call s:GoshReal('(print '.getreg('a').')') 
     34endfunc