[Lldb-commits] [lldb] r182613 - Improve vim-lldb expression commands for objective-c and implement evaluate-under-cursor:
Daniel Malea
daniel.malea at intel.com
Thu May 23 14:34:26 PDT 2013
Author: dmalea
Date: Thu May 23 16:34:26 2013
New Revision: 182613
URL: http://llvm.org/viewvc/llvm-project?rev=182613&view=rev
Log:
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!!
Modified:
lldb/trunk/utils/vim-lldb/doc/lldb.txt
lldb/trunk/utils/vim-lldb/plugin/lldb.vim
Modified: lldb/trunk/utils/vim-lldb/doc/lldb.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/vim-lldb/doc/lldb.txt?rev=182613&r1=182612&r2=182613&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/doc/lldb.txt (original)
+++ lldb/trunk/utils/vim-lldb/doc/lldb.txt Thu May 23 16:34:26 2013
@@ -37,10 +37,10 @@ Possible window name arguments to the Lh
* 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 Lh
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:
Modified: lldb/trunk/utils/vim-lldb/plugin/lldb.vim
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/vim-lldb/plugin/lldb.vim?rev=182613&r1=182612&r2=182613&view=diff
==============================================================================
--- lldb/trunk/utils/vim-lldb/plugin/lldb.vim (original)
+++ lldb/trunk/utils/vim-lldb/plugin/lldb.vim Thu May 23 16:34:26 2013
@@ -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()
More information about the lldb-commits
mailing list