summaryrefslogtreecommitdiffstats
path: root/lldb/utils/vim-lldb
diff options
context:
space:
mode:
authorDaniel Malea <daniel.malea@intel.com>2013-05-23 21:34:26 +0000
committerDaniel Malea <daniel.malea@intel.com>2013-05-23 21:34:26 +0000
commit96a6f90d84412e08cb1f6d5d8069a610bd14e015 (patch)
treee13f3dadaf742713064acbcf21a870b67c306fec /lldb/utils/vim-lldb
parentabfcca30d81d4a88039ce42f78c2aa8a84e01769 (diff)
downloadbcm5719-llvm-96a6f90d84412e08cb1f6d5d8069a610bd14e015.tar.gz
bcm5719-llvm-96a6f90d84412e08cb1f6d5d8069a610bd14e015.zip
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
Diffstat (limited to 'lldb/utils/vim-lldb')
-rw-r--r--lldb/utils/vim-lldb/doc/lldb.txt11
-rw-r--r--lldb/utils/vim-lldb/plugin/lldb.vim15
2 files changed, 23 insertions, 3 deletions
diff --git a/lldb/utils/vim-lldb/doc/lldb.txt b/lldb/utils/vim-lldb/doc/lldb.txt
index e3801970999..e54e6f2db0d 100644
--- a/lldb/utils/vim-lldb/doc/lldb.txt
+++ b/lldb/utils/vim-lldb/doc/lldb.txt
@@ -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:
diff --git a/lldb/utils/vim-lldb/plugin/lldb.vim b/lldb/utils/vim-lldb/plugin/lldb.vim
index e4a248c1fd9..ac5cfe3fbb4 100644
--- a/lldb/utils/vim-lldb/plugin/lldb.vim
+++ b/lldb/utils/vim-lldb/plugin/lldb.vim
@@ -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()
OpenPOWER on IntegriCloud