Skip to content

Commit

Permalink
Initial import of the r2pipe support for Vim
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Oct 2, 2023
1 parent 3a1dba2 commit cee5d82
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions vim/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

D=${HOME}/.vim/ftdetect

all:

mkdir -p $(D)
cp -f r2pipe.vim $(D)
24 changes: 24 additions & 0 deletions vim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# r2pipe.vim

This vim plugin allows you to run r2 commands into the current Vim buffer

## Installation

Just type `make`. If you want to get rid of that run: `make uninstall`

Note that the same code works with neovim. But it's not yet installed. Contribs are welcome

## How to use

In one terminal start the r2 webserver

In vim open

## Future

Right now this is just a PoC, but there are a lot of things to be done to improve the integration between r2 and vim

* [ ] Use r2p instead of `curl` (one less dependency, and support socket files, pipes..)
* [ ] Make interactive buffers and use the right syntax highlighting for disasm, hexa, ..
* [ ] Setup split layouts to navigate function list, disasm, etc
* [ ] Improve apis
19 changes: 19 additions & 0 deletions vim/r2pipe.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@



let s:host = "localhost"
let s:port = "9090"

function! r2pipe#endpoint(host, port)
let s:host = a:host
let s:port = a:port
endfunction

function! r2pipe#cmd(c)
" TODO: use r2p instead of curl when it supports http endpoints
let res = system("curl -s http://".s:host.":".s:port."/cmd/" . a:c)
put=res
endfunction

" :r2("pd 10") <--- shortest form
cnoreabbrev r2 call r2pipe#cmd

0 comments on commit cee5d82

Please sign in to comment.