I have installed vim plug-in - t9md/vim-ruby-xmpfilter.
My .vimrc contains
1 set nocompatible " We're running Vim, not Vi!
2 syntax on " Enable syntax highlighting
3 filetype on " Enable filetype detection
4 filetype indent on " Enable filetype-specific indenting
5 filetype plugin on " Enable filetype-specific plugins
6
7 set number
8 set expandtab
9 set tabstop=2 shiftwidth=2 softtabstop=2
10 set autoindent
11
12
13 "let g:xmpfilter_cmd = '/home/kirti/.rvm/rubies/ruby-2.0.0-p0/bin/ruby'
14
15 set rtp+=~/.vim/bundle/vundle/
16 call vundle#rc()
17
18 " let Vundle manage Vundle
19 " required!
20
21 set shell=/bin/bash\ -i
22
23 Bundle 't9md/vim-ruby-xmpfilter'
24 Bundle 'Townk/vim-autoclose'
25 Bundle 'vim-ruby/vim-ruby'
26 Bundle 'gmarik/vundle'
27 Bundle 'scrooloose/nerdtree'
28
29 autocmd FileType ruby nmap <buffer> <M-c> <Plug>(xmpfilter-mark)
30 autocmd FileType ruby xmap <buffer> <M-c> <Plug>(xmpfilter-mark)
31 autocmd FileType ruby imap <buffer> <M-c> <Plug>(xmpfilter-mark)
32
33 autocmd FileType ruby nmap <buffer> <M-z> <Plug>(xmpfilter-run)
34 autocmd FileType ruby xmap <buffer> <M-z> <Plug>(xmpfilter-run)
35 autocmd FileType ruby imap <buffer> <M-z> <Plug>(xmpfilter-run)
When I write in my .rb file as 1 + 1
, then Ctrl+c
, so I get 1 + 1 # =>
. Now when I am trying to execute it I am getting error as "xmpfilter: command not found"
.
xmpfilter
and RVM
both is installed in my ubuntu13.10.
kirti@kirti-Aspire-5733Z:~$ which xmpfilter
/home/kirti/.rvm/gems/ruby-2.0.0-p0/bin/xmpfilter
kirti@kirti-Aspire-5733Z:~$ which rvm
/home/kirti/.rvm/bin/rvm
kirti@kirti-Aspire-5733Z:~$
I have installed
tpope/vim-rvm
plug-in and it solved my problem.I just put
Bundle 'tpope/vim-rvm'
in my.vimrc
file. Then ran:BundleInstall
to install that plugin.Then I ran
:Rvm use default
.Now I write the below code :
I pressed
Alt+c
to insert# =>
. Then I pressedAlt+z
and got the output as I was looking for.