Re: finding the originating map command

2012-07-02 Thread Gary Johnson
On 2012-07-02, Tim Johnson wrote:
 I have mapped ,cs to a function called CheckSyntax
 if I execute 
 : map ,cs
 I get 
 ,cs * :call CheckSyntax()CR 
 if I execute
 :verbose map ,cs
 I get
,cs * :call CheckSyntax()CR
Last set from
  /Users/http/run/baker/journal/000_main__journal.vim
 which helpful is tracking down mappings I might not need or want.
 
 However I would like to be able to 
 1)Find where the mapping originated
 i.e. I have the mapping in ~/.vim/plugin/tj_code_insert.vim

I don't think Vim remembers any place but the last where a mapping
was defined.  However, you can start Vim like this,

$ vim -V15verbose.out ...

and capture all the ex commands to the file verbose.out.  Then you
can open that file and search for

map\s\+,cs\

or filter verbose.out with something like this

$ grep 'map[^I ][^I ]*,cs\\|^[^l]' verbose.out | grep -C2 map

to find the various places where that mapping was defined.  Those ^I
pairs are literal tabs.  The \|^[^l] is there to capture all the
lines saying what file is being sourced, function being called,
etc., without all the lines beginning with line  other than the
one(s) defining your mapping.

 2)Find where a function originated
 i.e. where is CheckSyntax defined?

:verbose function CheckSyntax

will tell you where the function was last defined.

HTH,
Gary

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php


Re: finding the originating map command

2012-07-02 Thread Tim Johnson
* Gary Johnson garyj...@spocom.com [120702 15:29]:
 On 2012-07-02, Tim Johnson wrote:
 
 I don't think Vim remembers any place but the last where a mapping
 was defined.  However, you can start Vim like this,
 
 $ vim -V15verbose.out ...
 
 and capture all the ex commands to the file verbose.out.  Then you
 can open that file and search for
 
 map\s\+,cs\
 
 or filter verbose.out with something like this
 
 $ grep 'map[^I ][^I ]*,cs\\|^[^l]' verbose.out | grep -C2 map
 
 to find the various places where that mapping was defined.  Those ^I
 pairs are literal tabs.  The \|^[^l] is there to capture all the
 lines saying what file is being sourced, function being called,
 etc., without all the lines beginning with line  other than the
 one(s) defining your mapping.
 
  2)Find where a function originated
  i.e. where is CheckSyntax defined?
 
 :verbose function CheckSyntax
 
 will tell you where the function was last defined.
  That is great Gary, thanks for such a succint solution.
  cheers
-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com

-- 
You received this message from the vim_use maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php