total idiot question: +=, .=, etc...

catlee at catlee at
Wed Jun 23 14:04:10 EDT 1999

> |>> vim 5.x version.)
> |
> |:map! += ^[:s/\([a-zA-Z_][a-zA-Z0-9_]*\)$/\1=\1+/^M:noh^MA
> |
> |Where   ":" means go into vim Commandmode
> |        "^[" means Esc, you have to enter it pressing Ctrl-v and
then Esc
> |        "^M" means "Return', you have to enter pressing Ctrl-v and
then Return

I've got the following in my .vimrc file:
au BufReadPost * if b:current_syntax == "python"
au BufReadPost * 	map! += ^[:s/\(\S*\)$/\1=\1+/^M:noh^MA
au BufReadPost * endif

What this does is check to see if the current syntax is python.  The
mapping hopefully covers more complex
expressions than yours does, it takes all the previous non-whitespace
characters as the expression to copy.  I wonder if there's a way to use
the vim syntax parsing mechanism to determine what an expression is?


Sent via
Share what you know. Learn what you don't.

More information about the Python-list mailing list