Massive vim coolness

git-svn-id: http://photonzero.com/dotfiles/trunk@22 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
michener 2008-06-21 00:48:56 +00:00
parent c87a962056
commit 86cc58a3d4
13 changed files with 4583 additions and 138 deletions

View file

@ -1,5 +1,6 @@
winsize 110 43
winsize 115 45
set expandtab
set guifont=DejaVu\ Sans\ Mono:h14.00
call AppleTSetPath("~/work/client")
map gg :CmdT

1660
.vim/autoload/DrawIt.vim Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,6 @@
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" File: "/home/michener/.vim/barak.vim"
" Version: 1.4
" Created: "Sun Jul 30 23:54:41 PDT 2006"
" Updated: "Sun Jan 7 02:12:52 PST 2007"
" Copyright (C) 2006, Barak Michener <michener@csua.berkeley.edu>
" Copyright (C) 2008, Barak Michener <barak@photonzero.com>
" Modified from colorscheme "dante":
" Copyright (C) 2002, Caciano Machado <caciano@inf.ufrgs.br>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -56,12 +53,14 @@ endif
" syntax hi colors
hi Comment term=bold ctermfg=darkgreen guifg=ForestGreen
hi PreProc term=underline ctermfg=darkmagenta guifg=magenta3
hi Constant term=underline ctermfg=red guifg=firebrick3
hi Constant term=underline ctermfg=red guifg=#b62f61
hi String term=underline ctermfg=red guifg=firebrick3
hi Boolean term=underline ctermfg=magenta guifg=LightSalmon1
"hi Type term=underline ctermfg=darkcyan gui=none guifg=CadetBlue3
hi Type term=underline ctermfg=darkcyan gui=none guifg=turquoise3
hi Statement term=bold ctermfg=blue gui=none guifg=RoyalBlue1
hi Type term=underline ctermfg=darkcyan gui=bold guifg=turquoise3
hi Statement term=bold ctermfg=blue gui=bold guifg=RoyalBlue1
hi Identifier term=underline ctermfg=darkcyan guifg=DeepSkyBlue
hi Function ctermfg=darkcyan guifg=MediumPurple2
hi Function ctermfg=darkcyan gui=bold guifg=MediumPurple2
hi Ignore term=bold ctermfg=darkgray gui=bold guifg=gray45
hi Special term=underline ctermfg=brown guifg=khaki3
hi Error term=reverse ctermfg=gray ctermbg=red guifg=gray guibg=red3
@ -72,7 +71,8 @@ hi Number term=underline ctermfg=darkyellow guifg=goldenrod1
hi link String Constant
hi link Character Constant
hi link Number Constant
hi link Boolean Constant
"hi link Boolean Constant
hi link javaScriptNull Special
hi link Float Number
"hi link Function Identifier
hi link Number Constant
@ -83,7 +83,8 @@ hi link Keyword Statement
hi link Exception Statement
hi link Operator Statement
hi link Include PreProc
hi link Define PreProc
"hi link Define PreProc
hi link Define Statement
hi link Macro PreProc
hi link PreCondit PreProc
"hi link StorageClass Type

245
.vim/colors/zenburn.vim Normal file
View file

@ -0,0 +1,245 @@
" Vim color file
" Maintainer: Jani Nurminen <jani.nurminen@pp4.inet.fi>
" Last Change: $Id: zenburn.vim,v 1.15 2006/09/07 15:57:46 jnurmine Exp $
" URL: http://slinky.imukuppi.org/zenburn/
" License: GPL
"
" Nothing too fancy, just some alien fruit salad to keep you in the zone.
" This syntax file was designed to be used with dark environments and
" low light situations. Of course, if it works during a daybright office, go
" ahead :)
"
" Owes heavily to other Vim color files! With special mentions
" to "BlackDust", "Camo" and "Desert".
"
" To install, copy to ~/.vim/colors directory. Then :colorscheme zenburn.
" See also :help syntax
"
" Credits:
" - Jani Nurminen - original Zenburn
" - Steve Hall & Cream posse - higher-contrast Visual selection
" - Kurt Maier - 256 color console coloring, low and high contrast toggle,
" bug fixing
"
" CONFIGURABLE PARAMETERS:
"
" You can use the default (don't set any parameters), or you can
" set some parameters to tweak the Zenburn colours.
"
" * You can now set a darker background for bright environments. To activate, use:
" contrast Zenburn, use:
"
" let g:zenburn_high_Contrast = 1
"
" * To get more contrast to the Visual selection, use
"
" let g:zenburn_alternate_Visual = 1
"
" * To use alternate colouring for Error message, use
"
" let g:zenburn_alternate_Error = 1
"
" * The new default for Include is a duller orange. To use the original
" colouring for Include, use
"
" let g:zenburn_alternate_Include = 1
"
" * To turn the parameter(s) back to defaults, use UNLET:
"
" unlet g:zenburn_alternate_Include
"
" Setting to 0 won't work!
"
" That's it, enjoy!
"
" TODO
" - Visual alternate color is broken? Try GVim >= 7.0.66 if you have trouble
" - IME colouring (CursorIM)
" - obscure syntax groups: check and colourize
" - add more groups if necessary
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name="zenburn"
hi Boolean guifg=#dca3a3
hi Character guifg=#dca3a3 gui=bold
hi Comment guifg=#7f9f7f gui=italic
hi Conditional guifg=#f0dfaf gui=bold
hi Constant guifg=#dca3a3 gui=bold
hi Cursor guifg=#000d18 guibg=#8faf9f gui=bold
hi Debug guifg=#bca3a3 gui=bold
hi Define guifg=#ffcfaf gui=bold
hi Delimiter guifg=#8f8f8f
hi DiffAdd guifg=#709080 guibg=#313c36 gui=bold
hi DiffChange guibg=#333333
hi DiffDelete guifg=#333333 guibg=#464646
hi DiffText guifg=#ecbcbc guibg=#41363c gui=bold
hi Directory guifg=#dcdccc gui=bold
hi ErrorMsg guifg=#80d4aa guibg=#2f2f2f gui=bold
hi Exception guifg=#c3bf9f gui=bold
hi Float guifg=#c0bed1
hi FoldColumn guifg=#93b3a3 guibg=#3f4040
hi Folded guifg=#93b3a3 guibg=#3f4040
hi Function guifg=#efef8f
hi Identifier guifg=#efdcbc
hi IncSearch guibg=#f8f893 guifg=#385f38
hi Keyword guifg=#f0dfaf gui=bold
hi Label guifg=#dfcfaf gui=underline
hi LineNr guifg=#9fafaf guibg=#262626
hi Macro guifg=#ffcfaf gui=bold
hi ModeMsg guifg=#ffcfaf gui=none
hi MoreMsg guifg=#ffffff gui=bold
hi NonText guifg=#404040
hi Number guifg=#8cd0d3
hi Operator guifg=#f0efd0
hi PreCondit guifg=#dfaf8f gui=bold
hi PreProc guifg=#ffcfaf gui=bold
hi Question guifg=#ffffff gui=bold
hi Repeat guifg=#ffd7a7 gui=bold
hi Search guifg=#ffffe0 guibg=#284f28
hi SpecialChar guifg=#dca3a3 gui=bold
hi SpecialComment guifg=#82a282 gui=bold
hi Special guifg=#cfbfaf
hi SpecialKey guifg=#9ece9e
hi Statement guifg=#e3ceab gui=none
hi StatusLine guifg=#2e4340 guibg=#ccdc90
hi StatusLineNC guifg=#2e3330 guibg=#88b090
hi StorageClass guifg=#c3bf9f gui=bold
hi String guifg=#cc9393
hi Structure guifg=#efefaf gui=bold
hi Tag guifg=#e89393 gui=bold
hi Title guifg=#efefef gui=bold
hi Todo guifg=#dfdfdf guibg=bg gui=bold
hi Typedef guifg=#dfe4cf gui=bold
hi Type guifg=#dfdfbf gui=bold
hi Underlined guifg=#dcdccc gui=underline
hi VertSplit guifg=#303030 guibg=#688060
hi VisualNOS guifg=#333333 guibg=#f18c96 gui=bold,underline
hi WarningMsg guifg=#ffffff guibg=#333333 gui=bold
hi WildMenu guibg=#2c302d guifg=#cbecd0 gui=underline
" Entering Kurt zone
if &t_Co > 255
hi Boolean ctermfg=181
hi Character ctermfg=181 cterm=bold
hi Comment ctermfg=108
hi Conditional ctermfg=223 cterm=bold
hi Constant ctermfg=181 cterm=bold
hi Cursor ctermfg=233 ctermbg=109 cterm=bold
hi Debug ctermfg=181 cterm=bold
hi Define ctermfg=223 cterm=bold
hi Delimiter ctermfg=245
hi DiffAdd ctermfg=66 ctermbg=237 cterm=bold
hi DiffChange ctermbg=236
hi DiffDelete ctermfg=236 ctermbg=238
hi DiffText ctermfg=217 ctermbg=237 cterm=bold
hi Directory ctermfg=188 cterm=bold
hi ErrorMsg ctermfg=115 ctermbg=236 cterm=bold
hi Exception ctermfg=249 cterm=bold
hi Float ctermfg=251
hi FoldColumn ctermfg=109 ctermbg=238
hi Folded ctermfg=109 ctermbg=238
hi Function ctermfg=228
hi Identifier ctermfg=223
hi IncSearch ctermbg=228 ctermfg=238
hi Keyword ctermfg=223 cterm=bold
hi Label ctermfg=187 cterm=underline
hi LineNr ctermfg=248 ctermbg=235
hi Macro ctermfg=223 cterm=bold
hi ModeMsg ctermfg=223 cterm=none
hi MoreMsg ctermfg=15 cterm=bold
hi NonText ctermfg=238
hi Number ctermfg=116
hi Operator ctermfg=230
hi PreCondit ctermfg=180 cterm=bold
hi PreProc ctermfg=223 cterm=bold
hi Question ctermfg=15 cterm=bold
hi Repeat ctermfg=223 cterm=bold
hi Search ctermfg=230 ctermbg=236
hi SpecialChar ctermfg=181 cterm=bold
hi SpecialComment ctermfg=108 cterm=bold
hi Special ctermfg=181
hi SpecialKey ctermfg=151
hi Statement ctermfg=187 ctermbg=234 cterm=none
hi StatusLine ctermfg=237 ctermbg=186
hi StatusLineNC ctermfg=236 ctermbg=108
hi StorageClass ctermfg=249 cterm=bold
hi String ctermfg=174
hi Structure ctermfg=229 cterm=bold
hi Tag ctermfg=181 cterm=bold
hi Title ctermfg=7 ctermbg=234 cterm=bold
hi Todo ctermfg=108 ctermbg=234 cterm=bold
hi Typedef ctermfg=253 cterm=bold
hi Type ctermfg=187 cterm=bold
hi Underlined ctermfg=188 ctermbg=234 cterm=bold
hi VertSplit ctermfg=236 ctermbg=65
hi VisualNOS ctermfg=236 ctermbg=210 cterm=bold
hi WarningMsg ctermfg=15 ctermbg=236 cterm=bold
hi WildMenu ctermbg=236 ctermfg=194 cterm=bold
if exists("g:zenburn_high_Contrast")
hi Normal ctermfg=188 ctermbg=234
else
hi Normal ctermfg=188 ctermbg=237
hi Cursor ctermbg=109
hi diffadd ctermbg=237
hi diffdelete ctermbg=238
hi difftext ctermbg=237
hi errormsg ctermbg=237
hi foldcolumn ctermbg=238
hi folded ctermbg=238
hi incsearch ctermbg=228
hi linenr ctermbg=238
hi search ctermbg=238
hi statement ctermbg=237
hi statusline ctermbg=144
hi statuslinenc ctermbg=108
hi title ctermbg=237
hi todo ctermbg=237
hi underlined ctermbg=237
hi vertsplit ctermbg=65
hi visualnos ctermbg=210
hi warningmsg ctermbg=236
hi wildmenu ctermbg=236
endif
endif
if exists("g:zenburn_high_Contrast")
" use new darker background
hi Normal guifg=#dcdccc guibg=#1f1f1f
else
" Original, lighter background
hi Normal guifg=#dcdccc guibg=#3f3f3f
endif
if exists("g:zenburn_alternate_Visual")
" Visual with more contrast, thanks to Steve Hall & Cream posse
" gui=none fixes weird highlight problem in at least GVim 7.0.66, thanks to Kurt Maier
hi Visual guifg=#000000 guibg=#71d3b4 gui=none
hi VisualNOS guifg=#000000 guibg=#71d3b4 gui=none
else
" use default visual
hi Visual guifg=#233323 guibg=#71d3b4 gui=none
hi VisualNOS guifg=#233323 guibg=#71d3b4 gui=none
endif
if exists("g:zenburn_alternate_Error")
" use a bit different Error
hi Error guifg=#ef9f9f guibg=#201010 gui=bold
else
" default
hi Error guifg=#e37170 guibg=#332323 gui=none
endif
if exists("g:zenburn_alternate_Include")
" original setting
hi Include guifg=#ffcfaf gui=bold
else
" new, less contrasted one
hi Include guifg=#dfaf8f gui=bold
endif
" TODO check every syntax group that they're ok

397
.vim/doc/DrawIt.txt Normal file
View file

@ -0,0 +1,397 @@
*drawit.txt* The DrawIt Tool Sep 14, 2007
Authors: Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM> {{{1
Sylvain Viart <molo@multimania.com>
(remove NOSPAM from Campbell's email first)
Copyright: Copyright (C) 2004-2007 Charles E. Campbell, Jr. {{{1
Permission is hereby granted to use and distribute this code,
with or without modifications, provided that this copyright
notice is copied with it. Like anything else that's free,
DrawIt.vim is provided *as is* and comes with no warranty
of any kind, either expressed or implied. By using this
plugin, you agree that in no event will the copyright
holder be liable for any damages resulting from the use
of this software.
==============================================================================
1. Contents *drawit-contents* {{{1
1. Contents......................: |drawit-contents|
2. DrawIt Manual.................: |drawit|
3. DrawIt Usage..................: |drawit-usage|
Starting....................: |drawit-start|
Stopping....................: |drawit-stop|
User Map Protection.........: |drawit-protect|
Drawing.....................: |drawit-drawing|
Changing Drawing Characters.: |drawit-setdrawit|
Moving......................: |drawit-moving|
Erasing.....................: |drawit-erase|
Example.....................: |drawit-example|
Visual Block Mode...........: |drawit-visblock|
Brushes.....................: |drawit-brush|
DrawIt Modes................: |drawit-modes|
4. DrawIt History................: |drawit-history|
==============================================================================
2. DrawIt Manual *drawit* {{{1
*drawit-manual*
/===============+============================================================\
|| Starting & | ||
|| Stopping | Explanation ||
++--------------+-----------------------------------------------------------++
|| \di | start DrawIt |drawit-start| ||
|| \ds | stop DrawIt |drawit-stop| ||
|| :DIstart | start DrawIt |drawit-start| ||
|| :DIstop | stop DrawIt |drawit-stop| ||
|| | ||
++==============+===========================================================++
|| Maps | Explanation ||
++--------------+-----------------------------------------------------------++
|| | The DrawIt routines use a replace, move, and ||
|| | replace/insert strategy. The package also lets one insert||
|| | spaces, draw arrows by using the following characters or ||
|| | keypad characters: ||
|| +-----------------------------------------------------------++
|| <left> | move and draw left |drawit-drawing| ||
|| <right> | move and draw right, inserting lines/space as needed ||
|| <up> | move and draw up, inserting lines/space as needed ||
|| <down> | move and draw down, inserting lines/space as needed ||
|| <s-left> | move cursor left |drawit-move| ||
|| <s-right> | move cursor right, inserting lines/space as needed ||
|| <s-up> | move cursor up, inserting lines/space as needed ||
|| <s-down> | move cursor down, inserting lines/space as needed ||
|| <space> | toggle into and out of erase mode ||
|| > | insert a > and move right (draw -> arrow) ||
|| < | insert a < and move left (draw <- arrow) ||
|| ^ | insert a ^ and move up (draw ^ arrow) ||
|| v | insert a v and move down (draw v arrow) ||
|| <pgdn> | replace with a \, move down and right, and insert a \ ||
|| <end> | replace with a /, move down and left, and insert a / ||
|| <pgup> | replace with a /, move up and right, and insert a / ||
|| <home> | replace with a \, move up and left, and insert a \ ||
|| \> | insert a fat > and move right (draw -> arrow) ||
|| \< | insert a fat < and move left (draw <- arrow) ||
|| \^ | insert a fat ^ and move up (draw ^ arrow) ||
|| \v | insert a fat v and move down (draw v arrow) ||
||<s-leftmouse> | drag and draw with current brush |drawit-brush| ||
||<c-leftmouse> | drag and move current brush |drawit-brush| ||
|| | ||
||==============+===========================================================++
||Visual Cmds | Explanation ||
||--------------+-----------------------------------------------------------++
|| | The drawing mode routines use visual-block mode to ||
|| | select endpoints for lines, arrows, and ellipses. Bresen- ||
|| | ham and Bresenham-like algorithms are used for this. ||
|| | ||
|| | These routines need a block of spaces, and so the canvas ||
|| | routine must first be used to create such a block. The ||
|| | canvas routine will query the user for the number of ||
|| | lines to hold |'textwidth'| spaces. ||
|| +-----------------------------------------------------------++
|| \a | draw arrow from corners of visual-block selected region ||
|| \b | draw box on visual-block selected region ||
|| \c | the canvas routine (will query user, see above) ||
|| \e | draw an ellipse on visual-block selected region ||
|| \f | flood figure with a character (you will be prompted) ||
|| \l | draw line from corners of visual-block selected region ||
|| \s | spacer: appends spaces up to the textwidth (default: 78) ||
|| | ||
++==============+===========================================================++
|| Function and Explanation ||
++--------------+-----------------------------------------------------------++
|| :call SetDrawIt('vertical','horizontal','crossing','\','/','X','*') ||
|| set drawing characters for motions for moving ||
|| and for the ellipse drawing boundary ||
|| default motion ||
|| | up/down, ||
|| - left/right, ||
|| + -| crossing, ||
|| \ downright, ||
|| / downleft, and ||
|| X \/ crossing ||
++=======================+==================================================++
|| Commands | Explanation ||
++-----------------------+--------------------------------------------------++
|| :SetBrush a-z | sets brush (register) to given register ||
|| :'<,'>SetBrush a-z | yanks visual block to brush (register) ||
\============================================================================/
==============================================================================
3. DrawIt Usage *drawit-usage* {{{1
STARTING *drawit-start* {{{2
\di
Typically one puts <drawit.vim> into the .vim/plugin directory
(vimfiles\plugin for Windows) where it becomes always available. It uses a
minimal interface (\di: you can think of it as *D*raw*I*t or *D*rawIt
*I*nitialize) to start it and (\ds: *D*rawIt *S*top) to stop it. Instead of
using "\" you may specify your own preference for a map leader (see
|mapleader|).
A message, "[DrawIt]", will appear on the message line.
STOPPING *drawit-stop* {{{2
\ds
When you are done with DrawIt, use \ds to stop DrawIt mode. Stopping DrawIt
will restore your usual options and remove the maps DrawIt set up.
A message, "[DrawIt off]", will appear on the message line.
USER MAP PROTECTION *drawit-protect* {{{2
Starting DrawIt causes it to set up a number of maps which facilitate drawing.
DrawIt accomodates users with conflicting maps by saving both maps and user
options and before setting them to what DrawIt needs. When you stop DrawIt
(|drawit-stop|), DrawIt will restore the user's maps and options as they were
before DrawIt was started.
OPTIONS *drawit-options* {{{2
*g:drawit_insertmode*
g:drawit_insertmode : if this variable exists and is 1 then maps are
made which make cursor-control drawing available
while in insert mode, too. Otherwise, DrawIt's
maps only affect normal mode.
DRAWING *drawit-drawing* {{{2
After DrawIt is started, use the number pad or arrow keys to move the cursor
about. As the cursor moves, DrawIt will then leave appropriate "line"
characters behind as you move horizontally, vertically, or diagonally, and
will transparently enlarge your file to accommodate your drawing as needed.
The trail will consist of -, |, \, / characters (depending on which direction
and SetDrawIt() changes), and + and X characters where line crossings occur.
You may use h-j-k-l to move about your display and generally use editing
commands as you wish even while in DrawIt mode.
CHANGING DRAWING CHARACTERS *drawit-setdrawit* {{{2
The SetDrawIt() function is available for those who wish to change the
characters that DrawIt uses. >
ex. :call SetDrawIt('*','*','*','*','*','*','*')
ex. :call SetDrawIt('-','|','-','\','/','/','*')
<
The first example shows how to change all the DrawIt drawing characters to
asterisks, and the second shows how to give crossing priority to - and /.
The default setting is equivalent to: >
:call SetDrawIt('|','-','+','\','/','X','*')
<
where SetDrawit()'s arguments refer, in order, to the >
vertical drawing character
horizontal drawing character
horizontal/vertical crossing drawing character
down right drawing character
down left drawing character
diagonal crossing drawing character
ellipse boundary drawing character
<
MOVING *drawit-move* *drawit-moving* {{{2
DrawIt supports shifting the arrow keys to cause motion of the cursor. The
motion of the cursor will not modify what's below the cursor. The cursor
will move and lines and/or spaces will be inserted to support the move as
required. Your terminal may not support shifted arrow keys, however, or Vim
may not catch them as such. For example, on the machine I use, shift-up
(<s-up>) produced <Esc>[161q, but vim didn't know that sequence was a <s-up>.
I merely made a nmap:
nmap <Esc>[161q <s-up>
and vim thereafter recognized the <s-up> command.
ERASING *drawit-erase* {{{2
<space>
The <space> key will toggle DrawIt's erase mode/DrawIt mode. When in [DrawIt
erase] mode, a message "[DrawIt erase]" will appear and the number pad will
now cause spaces to be drawn instead of the usual drawing characters. The
drawing behavior will be restored when the <space> key toggles DrawIt back
to regular DrawIt mode.
EXAMPLES *drawit-example* {{{2
Needless to say, the square spirals which follow were done with DrawIt and
a bit of block editing with Vim: >
+------------ -----------+ +------------ -----------+ +------------
|+----------+ +---------+| |+----------+ +---------+| |+----------+
||+--------+| |+-------+|| ||+--------+| |+-------+|| ||+--------+|
|||-------+|| ||+------||| |||-------+|| ||+------||| |||-------+||
||+-------+|| ||+------+|| ||+-------+|| ||+------+|| ||+-------+||
|+---------+| |+--------+| |+---------+| |+--------+| |+---------+|
+-----------+ +----------+ +-----------+ +----------+ +-----------+
VISUAL BLOCK MODE FOR ARROWS LINES BOXES AND ELLIPSES *drawit-visblock* {{{2
\a : draw arrow from corners of visual-block selected region *drawit-a*
\b : draw box on visual-block selected region *drawit-b*
\c : the canvas routine (will query user, see above) *drawit-c*
\e : draw an ellipse on visual-block selected region *drawit-e*
\f : flood figure with a character (you will be prompted) *drawit-f*
\l : draw line from corners of visual-block selected region *drawit-l*
\s : spacer: appends spaces up to the textwidth (default: 78) *drawit-s*
The DrawIt package has been merged with Sylvain Viart's drawing package (by
permission) which provides DrawIt with visual-block selection of
starting/ending point drawing of arrows (\a), lines (\l), and boxes (\b).
Additionally I wrote an ellipse drawing function using visual block
specification (|drawit-e|).
One may create a block of spaces for these maps to operate in; the "canvas"
routine (\c) will help create such blocks. First, the s:Canvas() routine will
query the user for the number of lines s/he wishes to have, and will then fill
those lines with spaces out to the |'textwidth'| if user has specified it;
otherwise, the display width will be used.
The Sylvain Viart functions and the ellipse drawing function depend
upon using visual block mode. As a typical use: >
Example: * \h
DrawIt asks: how many lines under the cursor? 10
DrawIt then appends 10 lines filled with blanks
out to textwidth (if defined) or 78 columns.
* ctrl-v (move) \b
DrawIt then draws a box
* ctrl-v (move) \e
DrawIt then draws an ellipse
<
Select the first endpoint with ctrl-v and then move to the other endpoint.
One may then select \a for arrows, \b for boxes, \e for ellipses, or \l for
lines. The internal s:AutoCanvas() will convert tabs to spaces and will
extend with spaces as needed to support the visual block. Note that when
DrawIt is enabled, virtualedit is also enabled (to "all").
>
Examples:
__ _ *************** +-------+
\_ _/ **** **** | |
\_ _/ ** ---------> ** | |
\_ _/ **** **** | |
\__/ <------- *************** +-------+
\l \a \e and \a \b
<
*drawit-setbrush*
BRUSHES *drawit-brush* {{{2
>
:SetBrush a-z
<
Set the current brush to the given letter (actually, its
a named register). Default brush: a >
ex. :SetBrush b
:'<,'>SetBrush a-z
<
Set the current brush to the given letter, and yank the visual
block to that named register). Default brush: a
>
<leftmouse>
<
Select a visual-block region. One may use "ay, for example,
to yank selected text to register a.
>
<shift-leftmouse>
<
One may drag and draw with the current brush (default brush: a)
by holding down the shift key and the leftmouse button and moving
the mouse. Blanks in the brush are considered to be transparent.
>
<ctrl-leftmouse>
<
One may drag and move a selection with <ctrl-leftmouse>. First,
select the region using the <leftmouse>. Release the mouse button,
then press ctrl and the <leftmouse> button; while continuing to press
the button, move the mouse. The selected block of text will then
move along with the cursor.
>
\ra ... \rz
<
Replace text with the given register's contents (ie. the brush).
>
\pa ... \pz
<
Like \ra ... \rz, except that blanks are considered to be transparent.
Example: Draw the following >
\ \
o o
*
---
< Then use ctrl-v, move, "ay to grab a copy into register a.
By default, the current brush uses register a (change brush
with :SetBrush [reg]). Hold the <shift> and <leftbutton>
keys down and move the mouse; as you move, a copy of the
brush will be left behind.
DRAWIT MODES *drawit-modes* {{{2
-[DrawIt] regular DrawIt mode (|drawit-start|)
-[DrawIt off] DrawIt is off (|drawit-stop| )
-[DrawIt erase] DrawIt will erase using the number pad (|drawit-erase|)
g:DrChipTopLvlMenu: by default its "DrChip"; you may set this to whatever
you like in your <.vimrc>. This variable controls where
DrawIt's menu items are placed.
==============================================================================
4. History *drawit-history* {{{1
9 Sep 14, 2007 * Johann-Guenter Simon fixed a bug with s:DrawErase();
it called SetDrawIt() and that call hadn't been
updated to account for the new b:di_ellipse
parameter.
8 Feb 12, 2007 * fixed a bug which prevented multi-character user
maps from being restored properly
May 03, 2007 * Extended SetDrawIt() to handle b:di_ellipse, the
ellipse boundary drawing character
* Changed "Holer" to "Canvas", and wrote AutoCanvas(),
which allow one to use the visual-block drawing
maps without creating a canvas first.
* DrawIt now uses the ctrl-leftmouse to move a visual
block selected region.
* Floods can now be done inside an ellipse
* DrawIt's maps are now all users of <buffer>
7 Feb 16, 2005 * now checks that "m" is in &go before attempting to
use menus
Aug 17, 2005 * report option workaround
Nov 01, 2005 * converted DrawIt to use autoload feature of vim 7.0
Dec 28, 2005 * now uses cecutil to save/restore user maps
Jan 18, 2006 * cecutil now updated to use keepjumps
Jan 23, 2006 * :DIstart and :DIstop commands provided; thus users
using "set noremap" can still use DrawIt.
Jan 26, 2006 * DrawIt menu entry now keeps its place
Apr 10, 2006 * Brushes were implemented
6 Feb 24, 2003 * The latest DrawIt now provides a fill function.
\f will ask for a character to fill the figure
surrounding the current cursor location. Plus
I suggest reading :he drawit-tip for those whose
home/pageup/pagedown/end keys aren't all working
properly with DrawIt.
08/18/03 : \p[a-z] and \r[a-z] implemented
08/04/03 : b:..keep variables renamed to b:di_..keep variables
StopDrawIt() now insures that erase mode is off
03/11/03 : included g:drawit_insertmode handling
02/21/03 : included flood function
12/11/02 : deletes trailing whitespace only if holer used
8/27/02 : fat arrowheads included
: shift-arrow keys move but don't modify
---------------------------------------------------------------------
vim:tw=78:ts=8:ft=help:fdm=marker

View file

@ -46,7 +46,35 @@ b:VCSCommandSourceFile vcscommand.txt /*b:VCSCommandSourceFile*
b:VCSCommandVCSType vcscommand.txt /*b:VCSCommandVCSType*
cs surround.txt /*cs*
cvscommand-changes vcscommand.txt /*cvscommand-changes*
drawit DrawIt.txt /*drawit*
drawit-a DrawIt.txt /*drawit-a*
drawit-b DrawIt.txt /*drawit-b*
drawit-brush DrawIt.txt /*drawit-brush*
drawit-c DrawIt.txt /*drawit-c*
drawit-contents DrawIt.txt /*drawit-contents*
drawit-drawing DrawIt.txt /*drawit-drawing*
drawit-e DrawIt.txt /*drawit-e*
drawit-erase DrawIt.txt /*drawit-erase*
drawit-example DrawIt.txt /*drawit-example*
drawit-f DrawIt.txt /*drawit-f*
drawit-history DrawIt.txt /*drawit-history*
drawit-l DrawIt.txt /*drawit-l*
drawit-manual DrawIt.txt /*drawit-manual*
drawit-modes DrawIt.txt /*drawit-modes*
drawit-move DrawIt.txt /*drawit-move*
drawit-moving DrawIt.txt /*drawit-moving*
drawit-options DrawIt.txt /*drawit-options*
drawit-protect DrawIt.txt /*drawit-protect*
drawit-s DrawIt.txt /*drawit-s*
drawit-setbrush DrawIt.txt /*drawit-setbrush*
drawit-setdrawit DrawIt.txt /*drawit-setdrawit*
drawit-start DrawIt.txt /*drawit-start*
drawit-stop DrawIt.txt /*drawit-stop*
drawit-usage DrawIt.txt /*drawit-usage*
drawit-visblock DrawIt.txt /*drawit-visblock*
drawit.txt DrawIt.txt /*drawit.txt*
ds surround.txt /*ds*
g:drawit_insertmode DrawIt.txt /*g:drawit_insertmode*
i_CTRL-G_S surround.txt /*i_CTRL-G_S*
i_CTRL-G_s surround.txt /*i_CTRL-G_s*
project project.txt /*project*

View file

@ -0,0 +1,65 @@
" DrawItPlugin.vim: a simple way to draw things in Vim -- just put this file in
" your plugin directory, use \di to start (\ds to stop), and
" just move about using the cursor keys.
"
" You may also use visual-block mode to select endpoints and
" draw lines, arrows, and ellipses.
"
" Date: Jul 18, 2006
" Maintainer: Charles E. Campbell, Jr. (Charles.E.Campbell.1@gsfc.nasa.gov)
" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
" DrawIt.vim is provided *as is* and comes with no warranty
" of any kind, either expressed or implied. By using this
" plugin, you agree that in no event will the copyright
" holder be liable for any damages resulting from the use
" of this software.
"
" Required: this script requires Vim 7.0 (or later) {{{1
" To Enable: simply put this plugin into your ~/.vim/plugin directory {{{2
"
" GetLatestVimScripts: 40 1 :AutoInstall: DrawIt.vim
"
" (Zeph 3:1,2 WEB) Woe to her who is rebellious and polluted, the {{{1
" oppressing city! She didn't obey the voice. She didn't receive
" correction. She didn't trust in Yahweh. She didn't draw near to her God.
" ---------------------------------------------------------------------
" Load Once: {{{1
if &cp || exists("g:loaded_DrawItPlugin")
finish
endif
let g:loaded_DrawItPlugin = 1
let s:keepcpo = &cpo
set cpo&vim
" ---------------------------------------------------------------------
" DrChip Menu Support: {{{1
if has("gui_running") && has("menu") && &go =~ 'm'
if !exists("g:DrChipTopLvlMenu")
let g:DrChipTopLvlMenu= "DrChip."
endif
exe 'menu '.g:DrChipTopLvlMenu.'DrawIt.Start\ DrawIt<tab>\\di <Leader>di'
endif
" ---------------------------------------------------------------------
" Public Interface: {{{1
if !hasmapto('<Plug>StartDrawIt')
map <unique> <Leader>di <Plug>StartDrawIt
endif
map <silent> <Plug>StartDrawIt :set lz<cr>:call DrawIt#StartDrawIt()<cr>:set nolz<cr>
com! -nargs=0 DIstart set lz|call DrawIt#StartDrawIt()|set nolz
if !hasmapto('<Plug>StopDrawIt')
map <unique> <Leader>ds <Plug>StopDrawIt
endif
map <silent> <Plug>StopDrawIt :set lz<cr>:call DrawIt#StopDrawIt()<cr>:set nolz<cr>
com! -nargs=0 DIstop set lz|call DrawIt#StopDrawIt()|set nolz
" ---------------------------------------------------------------------
" Cleanup And Modelines:
" vim: fdm=marker
let &cpo= s:keepcpo
unlet s:keepcpo

View file

@ -0,0 +1,449 @@
" camelcasemotion.vim: Mappings for motion through CamelCaseWords and
" underscore_notation.
"
" DESCRIPTION: {{{1
" VIM provides many built-in motions, e.g. to move to the next word, or
" end of the current word. Most programming languages use either CamelCase
" ("anIdentifier") or underscore_notation ("an_identifier") naming
" conventions for identifiers. The best way to navigate inside those
" identifiers using VIM built-in motions is the '[count]f{char}' motion, i.e.
" 'f<uppercase char>' or 'f_', respectively. But we can make this easier:
"
" This script defines motions ',w', ',b' and ',e' (similar to 'w', 'b', 'e'),
" which do not move word-wise (forward/backward), but Camel-wise; i.e. to word
" boundaries and uppercase letters. The motions also work on underscore
" notation, where words are delimited by underscore ('_') characters.
" From here on, both CamelCase and underscore_notation entities are referred
" to as "words" (in double quotes). Just like with the regular motions, a
" [count] can be prepended to move over multiple "words" at once.
" Outside of "words" (e.g. in non-keyword characters like // or ;), the new
" motions move just like the regular motions.
"
" VIM provides a built-in text object called 'inner word' ('iw'), which works
" in operator-pending and visual mode. Analog to that, this script defines
" inner "word" motions 'i,w', 'i,b' and 'i,e', which select the "word" (or
" multiple "words" if a [count] is given) where the cursor is located.
"
" USAGE:
" Use the new motions ',w', ',b' and ',e' in normal mode, operator-pending
" mode (cp. :help operator), and visual mode. For example, type 'bc,w' to
" change 'Camel' in 'CamelCase' to something else.
"
" EXAMPLE: motions
" Given the following CamelCase identifiers in a source code fragment:
" set Script31337PathAndNameWithoutExtension11=%~dpn0
" set Script31337PathANDNameWITHOUTExtension11=%~dpn0
" and the corresponding identifiers in underscore_notation:
" set script_31337_path_and_name_without_extension_11=%~dpn0
" set SCRIPT_31337_PATH_AND_NAME_WITHOUT_EXTENSION_11=%~dpn0
"
" ,w moves to ([x] is cursor position): [s]et, [s]cript, [3]1337, [p]ath,
" [a]nd, [n]ame, [w]ithout, [e]xtension, [1]1, [d]pn0, dpn[0], [s]et
" ,b moves to: [d]pn0, [1]1, [e]xtension, [w]ithout, ...
" ,e moves to: se[t], scrip[t], 3133[7], pat[h], an[d], nam[e], withou[t],
" extensio[n], 1[1], dpn[0]
"
" EXAMPLE: inner motions
" Given the following identifier, with the cursor positioned at [x]:
" script_31337_path_and_na[m]e_without_extension_11
"
" v3i,w selects script_31337_path_and_[name_without_extension_]11
" v3i,b selects script_31337_[path_and_name]_without_extension_11
" v3i,e selects script_31337_path_and_[name_without_extension]_11
" Instead of visual mode, you can also use c3i,w to change, d3i,w to delete,
" gU3i,w to upper-case, and so on.
"
" INSTALLATION: {{{1
" Put the script into your user or system VIM plugin directory (e.g.
" ~/.vim/plugin).
"
" DEPENDENCIES:
" - Requires VIM 7.0 or higher.
"
" CONFIGURATION:
" If you want to use different mappings, map your keys to the
" <Plug>CamelCaseMotion_? mapping targets _before_ sourcing this script
" (e.g. in your .vimrc).
"
" Example: Replace the default 'w', 'b' and 'e' mappings instead of defining
" additional mappings ',w', ',b' and ',e':
" map <silent> w <Plug>CamelCaseMotion_w
" map <silent> b <Plug>CamelCaseMotion_b
" map <silent> e <Plug>CamelCaseMotion_e
"
" Example: Replace default 'iw' text-object and define 'ib' and 'ie' motions:
" omap <silent> iw <Plug>CamelCaseMotion_iw
" vmap <silent> iw <Plug>CamelCaseMotion_iw
" omap <silent> ib <Plug>CamelCaseMotion_ib
" vmap <silent> ib <Plug>CamelCaseMotion_ib
" omap <silent> ie <Plug>CamelCaseMotion_ie
" vmap <silent> ie <Plug>CamelCaseMotion_ie
"
" LIMITATIONS:
"
" ASSUMPTIONS:
"
" KNOWN PROBLEMS:
" - A degenerate CamelCaseWord containing '\U\u\d' (e.g. "MaP1Roblem")
" confuses the operator-pending and visual mode ,e mapping if 'selection' is
" not set to "exclusive". It'll skip "P" and select "P1" in one step. As a
" workaround, use ',w' instead of ',e'; those two mappings have the same
" effect inside CamelCaseWords, anyway.
" - The operator-pending and visual mode ,e mapping doesn't work properly when
" it reaches the end of the buffer; the final character of the moved-over
" "word" remains. As a workaround, use the default 'e' motion instead of
" ',e'.
" - When the VIM setting 'selection' is not set to "exclusive", a
" forward-backward combination in visual mode (e.g. 'v,w,b') selects one
" additional character to the left, instead of only the character where the
" motion started. Likewise, extension of the visual selection from the front
" end is off by one additional character.
"
" TODO:
"
" Copyright: (C) 2007-2008 by Ingo Karkat
" The VIM LICENSE applies to this script; see ':help copyright'.
"
" Source: Based on vimtip #1016 by Anthony Van Ham.
" Maintainer: Ingo Karkat <ingo@karkat.de>
" REVISION DATE REMARKS {{{1
" 1.40.017 19-May-2008 BF: Now using :normal! to be independent from
" any user mappings. Thanks to Neil Walker for the
" patch.
" 1.40.016 28-Apr-2008 BF: Wrong forward motion stop at the second
" digit if a word starts with multiple numbers
" (e.g. 1234.56789). Thanks to Wasim Ahmed for
" reporting this.
" 1.40.015 24-Apr-2008 ENH: Added inner "word" text objects 'i,w' etc.
" that work analoguous to the built-in 'iw' text
" object. Thanks to David Kotchan for this
" suggestion.
" 1.30.014 20-Apr-2008 The motions now also stop at non-keyword
" boundaries, just like the regular motions. This
" has no effect inside a CamelCaseWord or inside
" underscore_notation, but it makes the motions
" behave like the regular motions (which is
" important if you replace the default motions).
" Thanks to Mun Johl for reporting this.
" Now using non-capturing parentheses \%() in the
" patterns.
" 1.30.013 09-Apr-2008 Refactored away s:VisualCamelCaseMotion().
" Allowing users to use mappings different than
" ,w ,b ,e by defining <Plug>CamelCaseMotion_?
" target mappings. This can even be used to
" replace the default 'w', 'b' and 'e' mappings,
" as suggested by Mun Johl.
" Mappings are now created in a generic function.
" Now requires VIM 7.0 or higher.
" 1.20.012 02-Jun-2007 BF: Corrected motions through mixed
" CamelCase_and_UnderScore words by re-ordering
" and narrowing the search patterns.
" 1.20.011 02-Jun-2007 Thanks again to Joseph Barker for discussing the
" complicated visual mode mapping on the vim-dev
" mailing list and coming up with a great
" simplification:
" Removed s:CheckForChangesToTheSelectionSetting().
" Introduced s:VisualCamelCaseMotion(), which
" handles the differences depending on the
" 'selection' setting.
" Visual mode mappings now directly map to the
" s:VisualCamelCaseMotion() function; no mark is
" clobbered, the complex mapping with the inline
" expression has been retired.
" 1.20.010 29-May-2007 BF: The operator-pending and visual mode ,e
" mapping doesn't work properly when it reaches
" the end of line; the final character of the
" moved-over "word" remains. Fixed this problem
" unless the "word" is at the very end of the
" buffer.
" ENH: The visual mode motions now also (mostly)
" work with the (default) setting
" 'set selection=inclusive', instead of selecting
" one character too much.
" ENH: All mappings will check for changes to the
" 'selection' setting and remap the visual mode
" mappings via function
" s:SetupVisualModeMappings(). We cannot rely on
" the setting while sourcing camelcasemotion.vim
" because the mswin.vim script may be sourced
" afterwards, and its 'behave mswin' changes
" 'selection'.
" Refactored the arguments of function
" s:CamelCaseMotion(...).
" 1.10.009 28-May-2007 BF: Degenerate CamelCaseWords that consist of
" only a single uppercase letter (e.g. "P" in
" "MapPRoblem") are skipped by all motions. Thanks
" to Joseph Barker for reporting this.
" BF: In CamelCaseWords that consist of uppercase
" letters followed by decimals (e.g.
" "MyUPPER123Problem", the uppercase "word" is
" skipped by all motions.
" 1.10.008 28-May-2007 Incorporated major improvements and
" simplifications done by Joseph Barker:
" Operator-pending and visual mode motions now
" accept [count] of more than 9.
" Visual selections can now be extended from
" either end.
" Instead of misusing the :[range], the special
" variable v:count1 is used. Custom commands are
" not needed anymore.
" Operator-pending and visual mode mappings are
" now generic: There's only a single mapping for
" ,w that can be repeated, rather than having a
" separate mapping for 1,w 2,w 3,w ...
" 1.00.007 22-May-2007 Added documentation for publication.
" 006 20-May-2007 BF: visual mode [1,2,3],e on pure CamelCase
" mistakenly marks [2,4,6] words. If the cursor is
" on a uppercase letter, the search pattern
" '\u\l\+' doesn't match at the cursor position,
" so another match won. Changed search pattern
" from '\l\+',
" 005 16-May-2007 Added support for underscore notation.
" Added support for "forward to end of word"
" (',e') motion.
" 004 16-May-2007 Improved search pattern so that
" UppercaseWORDSInBetween and digits are handled,
" too.
" 003 15-May-2007 Changed mappings from <Leader>w to ,w;
" other \w mappings interfere here, because it's
" irritating when the cursor jump doesn't happen
" immediately, because VIM waits whether the
" mapping is complete. ,w is faster to type that
" \w (and, because of the left-right touch,
" preferred over gw).
" Added visual mode mappings.
" 0.02 15-Feb-2006 BF: missing <SID> for omaps.
" 0.01 11-Oct-2005 file creation
" Avoid installing twice or when in compatible mode
if exists("loaded_camelcasemotion") || (v:version < 700)
finish
endif
let loaded_camelcasemotion = 1
" }}}1
"- functions ------------------------------------------------------------------"
function! s:CamelCaseMove( direction, count, mode ) " {{{1
" Note: There is no inversion of the regular expression character class
" 'keyword character' (\k). We need an inversion "non-keyword" defined as
" "any non-whitespace character that is not a keyword character (e.g.
" [!@#$%^&*()]. This can be specified via a non-whitespace character in
" whose place no keyword character matches (\k\@!\S).
"echo "count is " . a:count
let l:i = 0
while l:i < a:count
if a:direction == 'e'
" "Forward to end" motion.
"call search( '\>\|\(\a\|\d\)\+\ze_', 'We' )
" end of ...
" number | ACRONYM followed by CamelCase or number | CamelCase | underscore_notation | non-keyword | word
call search( '\d\+\|\u\+\ze\%(\u\l\|\d\)\|\u\l\+\|\%(\a\|\d\)\+\ze_\|\%(\k\@!\S\)\+\|\%(_\@!\k\)\+\>', 'We' )
" Note: word must be defined as '\k\>'; '\>' on its own somehow
" dominates over the previous branch. Plus, \k must exclude the
" underscore, or a trailing one will be incorrectly moved over:
" '\%(_\@!\k\)'.
if a:mode == 'o'
" Note: Special additional treatment for operator-pending mode
" "forward to end" motion.
" The difference between normal mode, operator-pending and visual
" mode is that in the latter two, the motion must go _past_ the
" final "word" character, so that all characters of the "word" are
" selected. This is done by appending a 'l' motion after the
" search for the next "word".
"
" In operator-pending mode, the 'l' motion only works properly
" at the end of the line (i.e. when the moved-over "word" is at
" the end of the line) when the 'l' motion is allowed to move
" over to the next line. Thus, the 'l' motion is added
" temporarily to the global 'whichwrap' setting.
" Without this, the motion would leave out the last character in
" the line. I've also experimented with temporarily setting
" "set virtualedit=onemore" , but that didn't work.
let l:save_ww = &whichwrap
set whichwrap+=l
normal! l
let &whichwrap = l:save_ww
endif
else
" Forward (a:direction == '') and backward (a:direction == 'b')
" motion.
let l:direction = (a:direction == 'w' ? '' : a:direction)
" CamelCase: Jump to beginning of either (start of word, Word, WORD,
" 123).
" Underscore_notation: Jump to the beginning of an underscore-separated
" word or number.
"call search( '\<\|\u', 'W' . l:direction )
"call search( '\<\|\u\(\l\+\|\u\+\ze\u\)\|\d\+', 'W' . l:direction )
"call search( '\<\|\u\(\l\+\|\u\+\ze\u\)\|\d\+\|_\zs\(\a\|\d\)\+', 'W' . l:direction )
" beginning of ...
" word | empty line | non-keyword after whitespaces | non-whitespace after word | number | ACRONYM followed by CamelCase or number | CamelCase | underscore followed by ACRONYM, Camel, lowercase or number
call search( '\<\D\|^$\|\%(^\|\s\)\+\zs\k\@!\S\|\>\S\|\d\+\|\u\+\ze\%(\u\l\|\d\)\|\u\l\+\|_\zs\%(\u\+\|\u\l\+\|\l\+\|\d\+\)', 'W' . l:direction )
" Note: word must be defined as '\<\D' to avoid that a word like
" 1234Test is moved over as [1][2]34[T]est instead of [1]234[T]est
" because \< matches with zero width, and \d\+ will then start
" matching '234'. To fix that, we make \d\+ be solely responsible
" for numbers by taken this away from \< via \<\D. (An alternative
" would be to replace \d\+ with \D\%#\zs\d\+, but that one is more
" complex.) All other branches are not affected, because they match
" multiple characters and not the same character multiple times.
endif
let l:i = l:i + 1
endwhile
endfunction
" }}}1
function! s:CamelCaseMotion( direction, count, mode ) " {{{1
"*******************************************************************************
"* PURPOSE:
" Perform the motion over CamelCaseWords or underscore_notation.
"* ASSUMPTIONS / PRECONDITIONS:
" none
"* EFFECTS / POSTCONDITIONS:
" Move cursor / change selection.
"* INPUTS:
" a:direction one of 'w', 'b', 'e'
" a:count number of "words" to move over
" a:mode one of 'n', 'o', 'v', 'iv' (latter one is a special visual mode
" when inside the inner "word" text objects.
"* RETURN VALUES:
" none
"*******************************************************************************
" Visual mode needs special preparations and postprocessing;
" normal and operator-pending mode breeze through to s:CamelCaseMove().
if a:mode == 'v'
" Visual mode was left when calling this function. Reselecting the current
" selection returns to visual mode and allows to call search() and issue
" normal mode motions while staying in visual mode.
normal! gv
endif
if a:mode == 'v' || a:mode == 'iv'
" Note_1a:
if &selection != 'exclusive' && a:direction == 'w'
normal! l
endif
endif
call s:CamelCaseMove( a:direction, a:count, a:mode )
if a:mode == 'v' || a:mode == 'iv'
" Note: 'selection' setting.
if &selection == 'exclusive' && a:direction == 'e'
" When set to 'exclusive', the "forward to end" motion (',e') does not
" include the last character of the moved-over "word". To include that, an
" additional 'l' motion is appended to the motion; similar to the
" special treatment in operator-pending mode.
normal! l
elseif &selection != 'exclusive' && a:direction != 'e'
" Note_1b:
" The forward and backward motions move to the beginning of the next "word".
" When 'selection' is set to 'inclusive' or 'old', this is one character too far.
" The appended 'h' motion undoes this. Because of this backward step,
" though, the forward motion finds the current "word" again, and would
" be stuck on the current "word". An 'l' motion before the CamelCase
" motion (see Note_1a) fixes that.
normal! h
end
endif
endfunction
" }}}1
function! s:CamelCaseInnerMotion( direction, count ) " {{{1
" If the cursor is positioned on the first character of a CamelWord, the
" backward motion would move to the previous word, which would result in a
" wrong selection. To fix this, first move the cursor to the right, so that
" the backward motion definitely will cover the current "word" under the
" cursor.
normal! l
" Move "word" backwards, enter visual mode, then move "word" forward. This
" selects the inner "word" in visual mode; the operator-pending mode takes
" this selection as the area covered by the motion.
if a:direction == 'b'
" Do not do the selection backwards, because the backwards "word" motion
" in visual mode + selection=inclusive has an off-by-one error.
call s:CamelCaseMotion( 'b', a:count, 'n' )
normal! v
" We decree that 'b' is the opposite of 'e', not 'w'. This makes more
" sense at the end of a line and for underscore_notation.
call s:CamelCaseMotion( 'e', a:count, 'iv' )
else
call s:CamelCaseMotion( 'b', 1, 'n' )
normal! v
call s:CamelCaseMotion( a:direction, a:count, 'iv' )
endif
endfunction
" }}}1
"- mappings -------------------------------------------------------------------
" The count is passed into the function through the special variable 'v:count1',
" which is easier than misusing the :[range] that :call supports.
" <C-U> is used to delete the unused range.
" Another option would be to use a custom 'command! -count=1', but that doesn't
" work with the normal mode mapping: When a count is typed before the mapping,
" the ':' will convert a count of 3 into ':.,+2MyCommand', but ':3MyCommand'
" would be required to use -count and <count>.
"
" We do not provide the fourth "backward to end" motion (,E), because it is
" seldomly used.
function! s:CreateMotionMappings() "{{{1
" Create mappings according to this template:
" (* stands for the mode [nov], ? for the underlying motion [wbe].)
"
" *noremap <script> <Plug>CamelCaseMotion_? :<C-U>call <SID>CamelCaseMotion('?',v:count1,'*')<CR>
" if ! hasmapto('<Plug>CamelCaseMotion_?', '*')
" *map <silent> ,? <Plug>CamelCaseMotion_?
" endif
for l:mode in ['n', 'o', 'v']
for l:motion in ['w', 'b', 'e']
let l:targetMapping = '<Plug>CamelCaseMotion_' . l:motion
execute l:mode . 'noremap <script> ' . l:targetMapping . ' :<C-U>call <SID>CamelCaseMotion(''' . l:motion . ''',v:count1,''' . l:mode . ''')<CR>'
if ! hasmapto(l:targetMapping, l:mode)
execute l:mode . 'map <silent> ,' . l:motion . ' ' . l:targetMapping
endif
endfor
endfor
endfunction
" }}}1
" To create a text motion, a mapping for operator-pending mode needs to be
" defined. This mapping should move the cursor according to the implemented
" motion, or mark the covered text via a visual selection. As inner text motions
" need to mark both to the left and right of the cursor position, the visual
" selection needs to be used.
"
" VIM's built-in inner text objects also work in visual mode; they have
" different behavior depending on whether visual mode has just been entered or
" whether text has already been selected.
" We deviate from that and always override the existing selection.
function! s:CreateInnerMotionMappings() "{{{1
" Create mappings according to this template:
" (* stands for the mode [ov], ? for the underlying motion [wbe].)
"
" *noremap <script> <Plug>CamelCaseMotion_i? :<C-U>call <SID>CamelCaseInnerMotion('?',v:count1)<CR>
" if ! hasmapto('<Plug>CamelCaseInnerMotion_i?', '*')
" *map <silent> i,? <Plug>CamelCaseInnerMotion_i?
" endif
for l:mode in ['o', 'v']
for l:motion in ['w', 'b', 'e']
let l:targetMapping = '<Plug>CamelCaseMotion_i' . l:motion
execute l:mode . 'noremap <script> ' . l:targetMapping . ' :<C-U>call <SID>CamelCaseInnerMotion(''' . l:motion . ''',v:count1)<CR>'
if ! hasmapto(l:targetMapping, l:mode)
execute l:mode . 'map <silent> i,' . l:motion . ' ' . l:targetMapping
endif
endfor
endfor
endfunction
" }}}1
call s:CreateMotionMappings()
call s:CreateInnerMotionMappings()
" vim: set sts=4 sw=4 noexpandtab ff=unix fdm=marker :

482
.vim/plugin/cecutil.vim Normal file
View file

@ -0,0 +1,482 @@
" cecutil.vim : save/restore window position
" save/restore mark position
" save/restore selected user maps
" Author: Charles E. Campbell, Jr.
" Version: 17
" Date: Sep 04, 2007
"
" Saving Restoring Destroying Marks: {{{1
" call SaveMark(markname) let savemark= SaveMark(markname)
" call RestoreMark(markname) call RestoreMark(savemark)
" call DestroyMark(markname)
" commands: SM RM DM
"
" Saving Restoring Destroying Window Position: {{{1
" call SaveWinPosn() let winposn= SaveWinPosn()
" call RestoreWinPosn() call RestoreWinPosn(winposn)
" \swp : save current window/buffer's position
" \rwp : restore current window/buffer's previous position
" commands: SWP RWP
"
" Saving And Restoring User Maps: {{{1
" call SaveUserMaps(mapmode,maplead,mapchx,suffix)
" call RestoreUserMaps(suffix)
"
" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
"
" You believe that God is one. You do well. The demons also {{{1
" believe, and shudder. But do you want to know, vain man, that
" faith apart from works is dead? (James 2:19,20 WEB)
" Load Once: {{{1
if &cp || exists("g:loaded_cecutil")
finish
endif
let g:loaded_cecutil = "v17"
let s:keepcpo = &cpo
set cpo&vim
"DechoVarOn
" -----------------------
" Public Interface: {{{1
" -----------------------
" Map Interface: {{{2
if !hasmapto('<Plug>SaveWinPosn')
map <unique> <Leader>swp <Plug>SaveWinPosn
endif
if !hasmapto('<Plug>RestoreWinPosn')
map <unique> <Leader>rwp <Plug>RestoreWinPosn
endif
nmap <silent> <Plug>SaveWinPosn :call SaveWinPosn()<CR>
nmap <silent> <Plug>RestoreWinPosn :call RestoreWinPosn()<CR>
" Command Interface: {{{2
com! -bar -nargs=0 SWP call SaveWinPosn()
com! -bar -nargs=0 RWP call RestoreWinPosn()
com! -bar -nargs=1 SM call SaveMark(<q-args>)
com! -bar -nargs=1 RM call RestoreMark(<q-args>)
com! -bar -nargs=1 DM call DestroyMark(<q-args>)
if v:version < 630
let s:modifier= "sil "
else
let s:modifier= "sil keepj "
endif
" ---------------------------------------------------------------------
" SaveWinPosn: {{{1
" let winposn= SaveWinPosn() will save window position in winposn variable
" call SaveWinPosn() will save window position in b:cecutil_winposn{b:cecutil_iwinposn}
" let winposn= SaveWinPosn(0) will *only* save window position in winposn variable (no stacking done)
fun! SaveWinPosn(...)
" call Dfunc("SaveWinPosn() a:0=".a:0)
if line(".") == 1 && getline(1) == ""
" call Dfunc("SaveWinPosn : empty buffer")
return ""
endif
let so_keep = &so
let siso_keep = &siso
let ss_keep = &ss
set so=0 siso=0 ss=0
let swline = line(".")
let swcol = col(".")
let swwline = winline() - 1
let swwcol = virtcol(".") - wincol()
let savedposn = "call GoWinbufnr(".winbufnr(0).")|silent ".swline
let savedposn = savedposn."|".s:modifier."norm! 0z\<cr>"
if swwline > 0
let savedposn= savedposn.":".s:modifier."norm! ".swwline."\<c-y>\<cr>"
endif
if swwcol > 0
let savedposn= savedposn.":".s:modifier."norm! 0".swwcol."zl\<cr>"
endif
let savedposn = savedposn.":".s:modifier."call cursor(".swline.",".swcol.")\<cr>"
" save window position in
" b:cecutil_winposn_{iwinposn} (stack)
" only when SaveWinPosn() is used
if a:0 == 0
if !exists("b:cecutil_iwinposn")
let b:cecutil_iwinposn= 1
else
let b:cecutil_iwinposn= b:cecutil_iwinposn + 1
endif
" call Decho("saving posn to SWP stack")
let b:cecutil_winposn{b:cecutil_iwinposn}= savedposn
endif
let &so = so_keep
let &siso = siso_keep
let &ss = ss_keep
" if exists("b:cecutil_iwinposn") " Decho
" call Decho("b:cecutil_winpos{".b:cecutil_iwinposn."}[".b:cecutil_winposn{b:cecutil_iwinposn}."]")
" else " Decho
" call Decho("b:cecutil_iwinposn doesn't exist")
" endif " Decho
" call Dret("SaveWinPosn [".savedposn."]")
return savedposn
endfun
" ---------------------------------------------------------------------
" RestoreWinPosn: {{{1
fun! RestoreWinPosn(...)
" call Dfunc("RestoreWinPosn() a:0=".a:0)
" call Decho("getline(1)<".getline(1).">")
" call Decho("line(.)=".line("."))
if line(".") == 1 && getline(1) == ""
" call Dfunc("RestoreWinPosn : empty buffer")
return ""
endif
let so_keep = &so
let siso_keep = &siso
let ss_keep = &ss
set so=0 siso=0 ss=0
if a:0 == 0 || a:1 == ""
" use saved window position in b:cecutil_winposn{b:cecutil_iwinposn} if it exists
if exists("b:cecutil_iwinposn") && exists("b:cecutil_winposn{b:cecutil_iwinposn}")
" call Decho("using stack b:cecutil_winposn{".b:cecutil_iwinposn."}<".b:cecutil_winposn{b:cecutil_iwinposn}.">")
try
exe "silent! ".b:cecutil_winposn{b:cecutil_iwinposn}
catch /^Vim\%((\a\+)\)\=:E749/
" ignore empty buffer error messages
endtry
" normally drop top-of-stack by one
" but while new top-of-stack doesn't exist
" drop top-of-stack index by one again
if b:cecutil_iwinposn >= 1
unlet b:cecutil_winposn{b:cecutil_iwinposn}
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
while b:cecutil_iwinposn >= 1 && !exists("b:cecutil_winposn{b:cecutil_iwinposn}")
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
endwhile
if b:cecutil_iwinposn < 1
unlet b:cecutil_iwinposn
endif
endif
else
echohl WarningMsg
echomsg "***warning*** need to SaveWinPosn first!"
echohl None
endif
else " handle input argument
" call Decho("using input a:1<".a:1.">")
" use window position passed to this function
exe "silent ".a:1
" remove a:1 pattern from b:cecutil_winposn{b:cecutil_iwinposn} stack
if exists("b:cecutil_iwinposn")
let jwinposn= b:cecutil_iwinposn
while jwinposn >= 1 " search for a:1 in iwinposn..1
if exists("b:cecutil_winposn{jwinposn}") " if it exists
if a:1 == b:cecutil_winposn{jwinposn} " and the pattern matches
unlet b:cecutil_winposn{jwinposn} " unlet it
if jwinposn == b:cecutil_iwinposn " if at top-of-stack
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 " drop stacktop by one
endif
endif
endif
let jwinposn= jwinposn - 1
endwhile
endif
endif
" seems to be something odd: vertical motions after RWP
" cause jump to first column. Following fixes that
if wincol() > 1
silent norm! hl
elseif virtcol(".") < virtcol("$")
silent norm! lh
endif
let &so = so_keep
let &siso = siso_keep
let &ss = ss_keep
" call Dret("RestoreWinPosn")
endfun
" ---------------------------------------------------------------------
" GoWinbufnr: go to window holding given buffer (by number) {{{1
" Prefers current window; if its buffer number doesn't match,
" then will try from topleft to bottom right
fun! GoWinbufnr(bufnum)
" call Dfunc("GoWinbufnr(".a:bufnum.")")
if winbufnr(0) == a:bufnum
" call Dret("GoWinbufnr : winbufnr(0)==a:bufnum")
return
endif
winc t
let first=1
while winbufnr(0) != a:bufnum && (first || winnr() != 1)
winc w
let first= 0
endwhile
" call Dret("GoWinbufnr")
endfun
" ---------------------------------------------------------------------
" SaveMark: sets up a string saving a mark position. {{{1
" For example, SaveMark("a")
" Also sets up a global variable, g:savemark_{markname}
fun! SaveMark(markname)
" call Dfunc("SaveMark(markname<".a:markname.">)")
let markname= a:markname
if strpart(markname,0,1) !~ '\a'
let markname= strpart(markname,1,1)
endif
" call Decho("markname=".markname)
let lzkeep = &lz
set lz
if 1 <= line("'".markname) && line("'".markname) <= line("$")
let winposn = SaveWinPosn(0)
exe s:modifier."norm! `".markname
let savemark = SaveWinPosn(0)
let g:savemark_{markname} = savemark
let savemark = markname.savemark
call RestoreWinPosn(winposn)
else
let g:savemark_{markname} = ""
let savemark = ""
endif
let &lz= lzkeep
" call Dret("SaveMark : savemark<".savemark.">")
return savemark
endfun
" ---------------------------------------------------------------------
" RestoreMark: {{{1
" call RestoreMark("a") -or- call RestoreMark(savemark)
fun! RestoreMark(markname)
" call Dfunc("RestoreMark(markname<".a:markname.">)")
if strlen(a:markname) <= 0
" call Dret("RestoreMark : no such mark")
return
endif
let markname= strpart(a:markname,0,1)
if markname !~ '\a'
" handles 'a -> a styles
let markname= strpart(a:markname,1,1)
endif
" call Decho("markname=".markname." strlen(a:markname)=".strlen(a:markname))
let lzkeep = &lz
set lz
let winposn = SaveWinPosn(0)
if strlen(a:markname) <= 2
if exists("g:savemark_{markname}") && strlen(g:savemark_{markname}) != 0
" use global variable g:savemark_{markname}
" call Decho("use savemark list")
call RestoreWinPosn(g:savemark_{markname})
exe "norm! m".markname
endif
else
" markname is a savemark command (string)
" call Decho("use savemark command")
let markcmd= strpart(a:markname,1)
call RestoreWinPosn(markcmd)
exe "norm! m".markname
endif
call RestoreWinPosn(winposn)
let &lz = lzkeep
" call Dret("RestoreMark")
endfun
" ---------------------------------------------------------------------
" DestroyMark: {{{1
" call DestroyMark("a") -- destroys mark
fun! DestroyMark(markname)
" call Dfunc("DestroyMark(markname<".a:markname.">)")
" save options and set to standard values
let reportkeep= &report
let lzkeep = &lz
set lz report=10000
let markname= strpart(a:markname,0,1)
if markname !~ '\a'
" handles 'a -> a styles
let markname= strpart(a:markname,1,1)
endif
" call Decho("markname=".markname)
let curmod = &mod
let winposn = SaveWinPosn(0)
1
let lineone = getline(".")
exe "k".markname
d
put! =lineone
let &mod = curmod
call RestoreWinPosn(winposn)
" restore options to user settings
let &report = reportkeep
let &lz = lzkeep
" call Dret("DestroyMark")
endfun
" ---------------------------------------------------------------------
" QArgSplitter: to avoid \ processing by <f-args>, <q-args> is needed. {{{1
" However, <q-args> doesn't split at all, so this one returns a list
" with splits at all whitespace (only!), plus a leading length-of-list.
" The resulting list: qarglist[0] corresponds to a:0
" qarglist[i] corresponds to a:{i}
fun! QArgSplitter(qarg)
" call Dfunc("QArgSplitter(qarg<".a:qarg.">)")
let qarglist = split(a:qarg)
let qarglistlen = len(qarglist)
let qarglist = insert(qarglist,qarglistlen)
" call Dret("QArgSplitter ".string(qarglist))
return qarglist
endfun
" ---------------------------------------------------------------------
" ListWinPosn:
"fun! ListWinPosn() " Decho
" if !exists("b:cecutil_iwinposn") || b:cecutil_iwinposn == 0 " Decho
" call Decho("nothing on SWP stack") " Decho
" else " Decho
" let jwinposn= b:cecutil_iwinposn " Decho
" while jwinposn >= 1 " Decho
" if exists("b:cecutil_winposn{jwinposn}") " Decho
" call Decho("winposn{".jwinposn."}<".b:cecutil_winposn{jwinposn}.">") " Decho
" else " Decho
" call Decho("winposn{".jwinposn."} -- doesn't exist") " Decho
" endif " Decho
" let jwinposn= jwinposn - 1 " Decho
" endwhile " Decho
" endif " Decho
"endfun " Decho
"com! -nargs=0 LWP call ListWinPosn() " Decho
" ---------------------------------------------------------------------
" SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{1
" which can be used to restore user maps later with
" call RestoreUserMaps()
"
" mapmode - see :help maparg for its list
" ex. "n" = Normal
" If the first letter is u, then unmapping will be done
" ex. "un" = Normal + unmapping
" maplead - see mapchx
" mapchx - "<something>" handled as a single map item.
" ex. "<left>"
" - "string" a string of single letters which are actually
" multiple two-letter maps (using the maplead:
" maplead . each_character_in_string)
" ex. maplead="\" and mapchx="abc" saves user mappings for
" \a, \b, and \c
" Of course, if maplead is "", then for mapchx="abc",
" mappings for a, b, and c are saved.
" - :something handled as a single map item, w/o the ":"
" ex. mapchx= ":abc" will save a mapping for "abc"
" suffix - a string unique to your plugin
" ex. suffix= "DrawIt"
fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
" call Dfunc("SaveUserMaps(mapmode<".a:mapmode."> maplead<".a:maplead."> mapchx<".a:mapchx."> suffix<".a:suffix.">)")
if !exists("s:restoremap_{a:suffix}")
" initialize restoremap_suffix to null string
let s:restoremap_{a:suffix}= ""
endif
" set up dounmap: if 1, then save and unmap (a:mapmode leads with a "u")
" if 0, save only
if a:mapmode =~ '^u'
let dounmap= 1
let mapmode= strpart(a:mapmode,1)
else
let dounmap= 0
let mapmode= a:mapmode
endif
" save single map :...something...
if strpart(a:mapchx,0,1) == ':'
let amap= strpart(a:mapchx,1)
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
endif
let amap = a:maplead.amap
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:silent! ".mapmode."unmap ".amap
if maparg(amap,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".amap." ".maprhs
endif
if dounmap
exe "silent! ".mapmode."unmap ".amap
endif
" save single map <something>
elseif strpart(a:mapchx,0,1) == '<'
let amap = a:mapchx
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
endif
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".amap
if maparg(a:mapchx,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".maprhs
endif
if dounmap
exe "silent! ".mapmode."unmap ".amap
endif
" save multiple maps
else
let i= 1
while i <= strlen(a:mapchx)
let amap= a:maplead.strpart(a:mapchx,i-1,1)
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
endif
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|silent! ".mapmode."unmap ".amap
if maparg(amap,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".amap." ".maprhs
endif
if dounmap
exe "silent! ".mapmode."unmap ".amap
endif
let i= i + 1
endwhile
endif
" call Dret("SaveUserMaps : restoremap_".a:suffix.": ".s:restoremap_{a:suffix})
endfun
" ---------------------------------------------------------------------
" RestoreUserMaps: {{{1
" Used to restore user maps saved by SaveUserMaps()
fun! RestoreUserMaps(suffix)
" call Dfunc("RestoreUserMaps(suffix<".a:suffix.">)")
if exists("s:restoremap_{a:suffix}")
let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e')
if s:restoremap_{a:suffix} != ""
" call Decho("exe ".s:restoremap_{a:suffix})
exe "silent! ".s:restoremap_{a:suffix}
endif
unlet s:restoremap_{a:suffix}
endif
" call Dret("RestoreUserMaps")
endfun
" ---------------------------------------------------------------------
" Restore: {{{1
let &cpo= s:keepcpo
unlet s:keepcpo
" ---------------------------------------------------------------------
" Modelines: {{{1
" vim: ts=4 fdm=marker

File diff suppressed because it is too large Load diff

252
.vim/syntax/javascript.vim Normal file
View file

@ -0,0 +1,252 @@
" Vim syntax file
" Language: JavaScript
" Maintainer: Yi Zhao (ZHAOYI) <zzlinux AT hotmail DOT com>
" Last Change: May 17, 2007
" Version: 0.7.5
" Changes: 1, Get the vimdiff problem fixed finally.
" Matthew Gallant reported the problem and test the fix. ;)
" 2, Follow the suggestioin from Ingo Karkat.
" The 'foldtext' and 'foldlevel' settings should only be
" changed if the file being edited is pure JavaScript,
" not if JavaScript syntax is embedded inside other syntaxes.
" 3, Remove function FT_JavaScriptDoc().
" Since VIM do the better than me.
"
" TODO:
" - Add the HTML syntax inside the JSDoc
if !exists("main_syntax")
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
let main_syntax = 'javascript'
endif
"" Drop fold if it set but VIM doesn't support it.
let b:javascript_fold='true'
if version < 600 " Don't support the old version
unlet! b:javascript_fold
endif
"" dollar sigh is permittd anywhere in an identifier
setlocal iskeyword+=$
syntax sync fromstart
syntax sync maxlines=200
"" JavaScript comments
syntax keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
syntax region javaScriptLineComment start=+\/\/+ end=+$+ keepend contains=javaScriptCommentTodo,@Spell
syntax region javaScriptLineComment start=+^\s*\/\/+ skip=+\n\s*\/\/+ end=+$+ keepend contains=javaScriptCommentTodo,@Spell fold
syntax region javaScriptCvsTag start="\$\cid:" end="\$" oneline contained
syntax region javaScriptComment start="/\*" end="\*/" contains=javaScriptCommentTodo,javaScriptCvsTag,@Spell fold
"" JSDoc support start
if !exists("javascript_ignore_javaScriptdoc")
syntax case ignore
"" syntax coloring for javadoc comments (HTML)
"syntax include @javaHtml <sfile>:p:h/html.vim
"unlet b:current_syntax
syntax region javaScriptDocComment matchgroup=javaScriptComment start="/\*\*\s*$" end="\*/" contains=javaScriptDocTags,javaScriptCommentTodo,javaScriptCvsTag,@javaScriptHtml,@Spell fold
syntax match javaScriptDocTags contained "@\(param\|argument\|requires\|exception\|throws\|type\|class\|extends\|see\|link\|member\|module\|method\|title\|namespace\|optional\|default\|base\|file\)\>" nextgroup=javaScriptDocParam,javaScriptDocSeeTag skipwhite
syntax match javaScriptDocTags contained "@\(beta\|deprecated\|description\|fileoverview\|author\|license\|version\|returns\=\|constructor\|private\|protected\|final\|ignore\|addon\|exec\)\>"
syntax match javaScriptDocParam contained "\%(#\|\w\|\.\|:\|\/\)\+"
syntax region javaScriptDocSeeTag contained matchgroup=javaScriptDocSeeTag start="{" end="}" contains=javaScriptDocTags
syntax case match
endif "" JSDoc end
syntax case match
"" Syntax in the JavaScript code
syntax match javaScriptSpecial "\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\."
syntax region javaScriptStringD start=+"+ skip=+\\\\\|\\$"+ end=+"+ contains=javaScriptSpecial,@htmlPreproc
syntax region javaScriptStringS start=+'+ skip=+\\\\\|\\$'+ end=+'+ contains=javaScriptSpecial,@htmlPreproc
syntax region javaScriptRegexpString start=+/\(\*\|/\)\@!+ skip=+\\\\\|\\/+ end=+/[gim]\{-,3}+ contains=javaScriptSpecial,@htmlPreproc oneline
syntax match javaScriptNumber /\<-\=\d\+L\=\>\|\<0[xX]\x\+\>/
syntax match javaScriptFloat /\<-\=\%(\d\+\.\d\+\|\d\+\.\|\.\d\+\)\%([eE][+-]\=\d\+\)\=\>/
syntax match javaScriptLabel /\(?\s*\)\@<!\<\w\+\(\s*:\)\@=/
"" JavaScript Prototype
syntax keyword javaScriptPrototype prototype
"" Programm Keywords
syntax keyword javaScriptSource import export
syntax keyword javaScriptType const this var void yield
syntax keyword javaScriptOperator delete new in instanceof let typeof
syntax keyword javaScriptBoolean true false
syntax keyword javaScriptNull null
"" Statement Keywords
syntax keyword javaScriptConditional if else
syntax keyword javaScriptRepeat do while for
syntax keyword javaScriptBranch break continue switch case default return
syntax keyword javaScriptStatement try catch throw with finally
syntax keyword javaScriptGlobalObjects Array Boolean Date Function Infinity JavaArray JavaClass JavaObject JavaPackage Math Number NaN Object Packages RegExp String Undefined java netscape sun
syntax keyword javaScriptExceptions Error EvalError RangeError ReferenceError SyntaxError TypeError URIError
syntax keyword javaScriptFutureKeys abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public
"" DOM/HTML/CSS specified things
" DOM2 Objects
syntax keyword javaScriptGlobalObjects DOMImplementation DocumentFragment Document Node NodeList NamedNodeMap CharacterData Attr Element Text Comment CDATASection DocumentType Notation Entity EntityReference ProcessingInstruction
syntax keyword javaScriptExceptions DOMException
" DOM2 CONSTANT
syntax keyword javaScriptDomErrNo INDEX_SIZE_ERR DOMSTRING_SIZE_ERR HIERARCHY_REQUEST_ERR WRONG_DOCUMENT_ERR INVALID_CHARACTER_ERR NO_DATA_ALLOWED_ERR NO_MODIFICATION_ALLOWED_ERR NOT_FOUND_ERR NOT_SUPPORTED_ERR INUSE_ATTRIBUTE_ERR INVALID_STATE_ERR SYNTAX_ERR INVALID_MODIFICATION_ERR NAMESPACE_ERR INVALID_ACCESS_ERR
syntax keyword javaScriptDomNodeConsts ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE CDATA_SECTION_NODE ENTITY_REFERENCE_NODE ENTITY_NODE PROCESSING_INSTRUCTION_NODE COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE DOCUMENT_FRAGMENT_NODE NOTATION_NODE
" HTML events and internal variables
syntax case ignore
syntax keyword javaScriptHtmlEvents onblur onclick oncontextmenu ondblclick onfocus onkeydown onkeypress onkeyup onmousedown onmousemove onmouseout onmouseover onmouseup onresize
syntax case match
" Follow stuff should be highligh within a special context
" While it can't be handled with context depended with Regex based highlight
" So, turn it off by default
if exists("javascript_enable_domhtmlcss")
" DOM2 things
syntax match javaScriptDomElemAttrs contained /\%(nodeName\|nodeValue\|nodeType\|parentNode\|childNodes\|firstChild\|lastChild\|previousSibling\|nextSibling\|attributes\|ownerDocument\|namespaceURI\|prefix\|localName\|tagName\)\>/
syntax match javaScriptDomElemFuncs contained /\%(insertBefore\|replaceChild\|removeChild\|appendChild\|hasChildNodes\|cloneNode\|normalize\|isSupported\|hasAttributes\|getAttribute\|setAttribute\|removeAttribute\|getAttributeNode\|setAttributeNode\|removeAttributeNode\|getElementsByTagName\|getAttributeNS\|setAttributeNS\|removeAttributeNS\|getAttributeNodeNS\|setAttributeNodeNS\|getElementsByTagNameNS\|hasAttribute\|hasAttributeNS\)\>/ nextgroup=javaScriptParen skipwhite
" HTML things
syntax match javaScriptHtmlElemAttrs contained /\%(className\|clientHeight\|clientLeft\|clientTop\|clientWidth\|dir\|id\|innerHTML\|lang\|length\|offsetHeight\|offsetLeft\|offsetParent\|offsetTop\|offsetWidth\|scrollHeight\|scrollLeft\|scrollTop\|scrollWidth\|style\|tabIndex\|title\)\>/
syntax match javaScriptHtmlElemFuncs contained /\%(blur\|click\|focus\|scrollIntoView\|addEventListener\|dispatchEvent\|removeEventListener\|item\)\>/ nextgroup=javaScriptParen skipwhite
" CSS Styles in JavaScript
syntax keyword javaScriptCssStyles contained color font fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight letterSpacing lineBreak lineHeight quotes rubyAlign rubyOverhang rubyPosition
syntax keyword javaScriptCssStyles contained textAlign textAlignLast textAutospace textDecoration textIndent textJustify textJustifyTrim textKashidaSpace textOverflowW6 textShadow textTransform textUnderlinePosition
syntax keyword javaScriptCssStyles contained unicodeBidi whiteSpace wordBreak wordSpacing wordWrap writingMode
syntax keyword javaScriptCssStyles contained bottom height left position right top width zIndex
syntax keyword javaScriptCssStyles contained border borderBottom borderLeft borderRight borderTop borderBottomColor borderLeftColor borderTopColor borderBottomStyle borderLeftStyle borderRightStyle borderTopStyle borderBottomWidth borderLeftWidth borderRightWidth borderTopWidth borderColor borderStyle borderWidth borderCollapse borderSpacing captionSide emptyCells tableLayout
syntax keyword javaScriptCssStyles contained margin marginBottom marginLeft marginRight marginTop outline outlineColor outlineStyle outlineWidth padding paddingBottom paddingLeft paddingRight paddingTop
syntax keyword javaScriptCssStyles contained listStyle listStyleImage listStylePosition listStyleType
syntax keyword javaScriptCssStyles contained background backgroundAttachment backgroundColor backgroundImage gackgroundPosition backgroundPositionX backgroundPositionY backgroundRepeat
syntax keyword javaScriptCssStyles contained clear clip clipBottom clipLeft clipRight clipTop content counterIncrement counterReset cssFloat cursor direction display filter layoutGrid layoutGridChar layoutGridLine layoutGridMode layoutGridType
syntax keyword javaScriptCssStyles contained marks maxHeight maxWidth minHeight minWidth opacity MozOpacity overflow overflowX overflowY verticalAlign visibility zoom cssText
syntax keyword javaScriptCssStyles contained scrollbar3dLightColor scrollbarArrowColor scrollbarBaseColor scrollbarDarkShadowColor scrollbarFaceColor scrollbarHighlightColor scrollbarShadowColor scrollbarTrackColor
" Highlight ways
syntax match javaScriptDotNotation "\." nextgroup=javaScriptPrototype,javaScriptDomElemAttrs,javaScriptDomElemFuncs,javaScriptHtmlElemAttrs,javaScriptHtmlElemFuncs
syntax match javaScriptDotNotation "\.style\." nextgroup=javaScriptCssStyles
endif "DOM/HTML/CSS
"" end DOM/HTML/CSS specified things
"" Code blocks
syntax cluster javaScriptAll contains=javaScriptComment,javaScriptLineComment,javaScriptDocComment,javaScriptStringD,javaScriptStringS,javaScriptRegexpString,javaScriptNumber,javaScriptFloat,javaScriptLabel,javaScriptSource,javaScriptType,javaScriptOperator,javaScriptBoolean,javaScriptNull,javaScriptFunction,javaScriptConditional,javaScriptRepeat,javaScriptBranch,javaScriptStatement,javaScriptGlobalObjects,javaScriptExceptions,javaScriptFutureKeys,javaScriptDomErrNo,javaScriptDomNodeConsts,javaScriptHtmlEvents,javaScriptDotNotation
syntax region javaScriptBracket matchgroup=javaScriptBracket transparent start="\[" end="\]" contains=@javaScriptAll,javaScriptParensErrB,javaScriptParensErrC,javaScriptBracket,javaScriptParen,javaScriptBlock,@htmlPreproc
syntax region javaScriptParen matchgroup=javaScriptParen transparent start="(" end=")" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrC,javaScriptParen,javaScriptBracket,javaScriptBlock,@htmlPreproc
syntax region javaScriptBlock matchgroup=javaScriptBlock transparent start="{" end="}" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrB,javaScriptParen,javaScriptBracket,javaScriptBlock,@htmlPreproc
"" catch errors caused by wrong parenthesis
syntax match javaScriptParensError ")\|}\|\]"
syntax match javaScriptParensErrA contained "\]"
syntax match javaScriptParensErrB contained ")"
syntax match javaScriptParensErrC contained "}"
if main_syntax == "javascript"
syntax sync ccomment javaScriptComment
endif
"" Fold control
if exists("b:javascript_fold")
syntax match javaScriptFunction /\<function\>/ nextgroup=javaScriptFuncName skipwhite
syntax match javaScriptOpAssign /=\@<!=/ nextgroup=javaScriptFuncBlock skipwhite skipempty
syntax region javaScriptFuncName contained matchgroup=javaScriptFuncName start=/\%(\$\|\w\)*\s*(/ end=/)/ contains=javaScriptLineComment,javaScriptComment nextgroup=javaScriptFuncBlock skipwhite skipempty
syntax region javaScriptFuncBlock contained matchgroup=javaScriptFuncBlock start="{" end="}" contains=@javaScriptAll,javaScriptParensErrA,javaScriptParensErrB,javaScriptParen,javaScriptBracket,javaScriptBlock fold
if &l:filetype=='javascript' && !&diff
" Fold setting
" Redefine the foldtext (to show a JS function outline) and foldlevel
" only if the entire buffer is JavaScript, but not if JavaScript syntax
" is embedded in another syntax (e.g. HTML).
setlocal foldmethod=syntax
setlocal foldlevel=4
endif
else
syntax keyword javaScriptFunction function
setlocal foldmethod<
setlocal foldlevel<
endif
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_javascript_syn_inits")
if version < 508
let did_javascript_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink javaScriptComment Comment
HiLink javaScriptLineComment Comment
HiLink javaScriptDocComment Comment
HiLink javaScriptCommentTodo Todo
HiLink javaScriptCvsTag Function
HiLink javaScriptDocTags Special
HiLink javaScriptDocSeeTag Function
HiLink javaScriptDocParam Function
HiLink javaScriptStringS String
HiLink javaScriptStringD String
HiLink javaScriptRegexpString String
HiLink javaScriptCharacter Character
HiLink javaScriptPrototype Type
HiLink javaScriptConditional Conditional
HiLink javaScriptBranch Conditional
HiLink javaScriptRepeat Repeat
HiLink javaScriptStatement Statement
HiLink javaScriptFunction Function
HiLink javaScriptError Error
HiLink javaScriptParensError Error
HiLink javaScriptParensErrA Error
HiLink javaScriptParensErrB Error
HiLink javaScriptParensErrC Error
HiLink javaScriptOperator Operator
HiLink javaScriptType Type
HiLink javaScriptNull Type
HiLink javaScriptNumber Number
HiLink javaScriptFloat Number
HiLink javaScriptBoolean Boolean
HiLink javaScriptLabel Label
HiLink javaScriptSpecial Special
HiLink javaScriptSource Special
HiLink javaScriptGlobalObjects Special
HiLink javaScriptExceptions Special
HiLink javaScriptDomErrNo Constant
HiLink javaScriptDomNodeConsts Constant
HiLink javaScriptDomElemAttrs Label
HiLink javaScriptDomElemFuncs PreProc
HiLink javaScriptHtmlEvents Special
HiLink javaScriptHtmlElemAttrs Label
HiLink javaScriptHtmlElemFuncs PreProc
HiLink javaScriptCssStyles Label
delcommand HiLink
endif
" Define the htmlJavaScript for HTML syntax html.vim
"syntax clear htmlJavaScript
"syntax clear javaScriptExpression
syntax cluster htmlJavaScript contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError
syntax cluster javaScriptExpression contains=@javaScriptAll,javaScriptBracket,javaScriptParen,javaScriptBlock,javaScriptParenError,@htmlPreproc
let b:current_syntax = "javascript"
if main_syntax == 'javascript'
unlet main_syntax
endif
" vim: ts=4

9
.vimrc
View file

@ -2,7 +2,7 @@ syntax on
"colorscheme slate
"colorscheme dante
colorscheme barak
set gfn=Monaco:h12:a
"set gfn=Monaco:h12:a
set ts=4
set nocompatible
set smartcase
@ -18,6 +18,9 @@ source ~/.vim/plugin/AppleT.vim
au BufNewFile,BufRead motd.public,/tmp/motd.public.r.* setf motd
"Highlighting features
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType python set tags+=$HOME/.vim/tags/python.ctags
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType python call SuperTabSetCompletionType("<C-X><C-O>")
let python_highlight_all = 1
set t_Co=16
@ -30,6 +33,7 @@ nnoremap gc :tabnew<CR>
nnoremap gK :tabclose<CR>
nnoremap gn gt
nnoremap gp gT
nnoremap gz :pclose<CR>
nmap P o<Esc>p
nnoremap j gj
nnoremap k gk
@ -54,4 +58,7 @@ if !exists(":W")
command W :w
endif
command SaveSession :mksession! ~/.vim_last_session
command LoadSession :source ~/.vim_last_session
"inoremap ;a <esc>