Improve vim-lldb expression commands for objective-c and implement evaluate-under-cursor:

1. Added new :Lpo command
2. :Lpo and :Lprint can be invoked without parameters. In that case
cursor word will be used
3. Added :LpO command in that case instead of <cword> will be used
stripped <cWORD>. This command is useful for printing objective-c
properties (for ex.: self.tableView). 

Patch by Arthur Evstifeev!!

llvm-svn: 182613
This commit is contained in:
Daniel Malea 2013-05-23 21:34:26 +00:00
parent abfcca30d8
commit 96a6f90d84
2 changed files with 23 additions and 3 deletions

View File

@ -37,10 +37,10 @@ Possible window name arguments to the Lhide and Lshow commands include:
* locals
* registers
* threads
lldb-:Lattach
*lldb-:Lattach*
:Lattach <process-name> Attach to a process by name.
lldb-:Ldetach
*lldb-:Ldetach*
:Ldetach Detach from the current process.
*lldb-:Ltarget*
@ -90,6 +90,13 @@ Possible window name arguments to the Lhide and Lshow commands include:
command is invoked. If no arguments are provided,
a breakpoint at the location under the cursor.
*lldb-:Lprint*
*lldb-:Lpo*
*lldb-:LpO*
:Lprint <expr> Aliases to the lldb print and po commands. Cursor
:Lpo <expr> word (cursor WORD for LpO) will be used when
:LpO <expr> expression omitted.
MAPPINGS *lldb-mappings*
On Mac OS X (under MacVim) , the following key mappings are available:

View File

@ -82,7 +82,9 @@ function! s:InitLldbPlugin()
command -complete=custom,s:CompleteCommand -nargs=* Lwatchpoint python ctrl.doCommand('watchpoint', '<args>')
" Convenience (shortcut) LLDB commands
command -complete=custom,s:CompleteCommand -nargs=* Lprint python ctrl.doCommand('print', '<args>')
command -complete=custom,s:CompleteCommand -nargs=* Lprint python ctrl.doCommand('print', vim.eval("s:CursorWord('<args>')"))
command -complete=custom,s:CompleteCommand -nargs=* Lpo python ctrl.doCommand('po', vim.eval("s:CursorWord('<args>')"))
command -complete=custom,s:CompleteCommand -nargs=* LpO python ctrl.doCommand('po', vim.eval("s:CursorWORD('<args>')"))
command -complete=custom,s:CompleteCommand -nargs=* Lbt python ctrl.doCommand('bt', '<args>')
" Frame/Thread-Selection (commands that also do an Uupdate but do not
@ -135,4 +137,15 @@ returnCompleteWindow(a, l, p)
EOF
endfunction()
" Returns cword if search term is empty
function! s:CursorWord(term)
return empty(a:term) ? expand('<cword>') : a:term
endfunction()
" Returns cleaned cWORD if search term is empty
function! s:CursorWORD(term)
" Will strip all non-alphabetic characters from both sides
return empty(a:term) ? substitute(expand('<cWORD>'), '^\A*\(.\{-}\)\A*$', '\1', '') : a:term
endfunction()
call s:InitLldbPlugin()