# HG changeset patch # User vimboss # Date 1214339971 0 # Node ID b9740fb419865974c9052e0090a1a48ba17432eb # Parent 46bbe11644e0d7a48b89f2bf884d5c75862a2103 updated for version 7.2a diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim --- a/runtime/autoload/rubycomplete.vim +++ b/runtime/autoload/rubycomplete.vim @@ -36,7 +36,7 @@ if !exists("g:rubycomplete_classes_in_gl endif if !exists("g:rubycomplete_buffer_loading") - let g:rubycomplete_classes_in_global = 0 + let g:rubycomplete_buffer_loading = 0 endif if !exists("g:rubycomplete_include_object") diff --git a/runtime/autoload/xml/html401f.vim b/runtime/autoload/xml/html401f.vim --- a/runtime/autoload/xml/html401f.vim +++ b/runtime/autoload/xml/html401f.vim @@ -466,4 +466,3 @@ let g:xmldata_html401t = { \ 'param': ['/>', ''], \ } \ } -" vim:ft=vim:ff=unix diff --git a/runtime/autoload/xml/xhtml10f.vim b/runtime/autoload/xml/xhtml10f.vim --- a/runtime/autoload/xml/xhtml10f.vim +++ b/runtime/autoload/xml/xhtml10f.vim @@ -467,4 +467,3 @@ let g:xmldata_xhtml10f = { \ 'param': ['/>', ''], \ } \ } -" vim:ft=vim:ff=unix diff --git a/runtime/colors/slate.vim b/runtime/colors/slate.vim --- a/runtime/colors/slate.vim +++ b/runtime/colors/slate.vim @@ -9,6 +9,7 @@ if version > 580 syntax reset endif endif +let colors_name = "slate" :hi Normal guifg=White guibg=grey15 :hi Cursor guibg=khaki guifg=slategrey :hi VertSplit guibg=#c2bfa5 guifg=grey40 gui=none cterm=reverse diff --git a/runtime/doc/Makefile b/runtime/doc/Makefile --- a/runtime/doc/Makefile +++ b/runtime/doc/Makefile @@ -14,13 +14,12 @@ VIMEXE = vim include ../../src/auto/config.mk DOCS = \ - ada.txt \ arabic.txt \ autocmd.txt \ change.txt \ cmdline.txt \ + debug.txt \ debugger.txt \ - debug.txt \ develop.txt \ diff.txt \ digraph.txt \ @@ -29,6 +28,8 @@ DOCS = \ farsi.txt \ filetype.txt \ fold.txt \ + ft_ada.txt \ + ft_sql.txt \ gui.txt \ gui_w16.txt \ gui_w32.txt \ @@ -50,10 +51,10 @@ DOCS = \ insert.txt \ intro.txt \ map.txt \ + mbyte.txt \ message.txt \ + mlang.txt \ motion.txt \ - mbyte.txt \ - mlang.txt \ netbeans.txt \ options.txt \ os_390.txt \ @@ -89,10 +90,9 @@ DOCS = \ russian.txt \ scroll.txt \ sign.txt \ + spell.txt \ sponsor.txt \ starting.txt \ - spell.txt \ - sql.txt \ syntax.txt \ tabpage.txt \ tagsrch.txt \ @@ -145,7 +145,6 @@ DOCS = \ workshop.txt HTMLS = \ - ada.html \ arabic.html \ autocmd.html \ change.html \ @@ -160,6 +159,8 @@ HTMLS = \ farsi.html \ filetype.html \ fold.html \ + ft_ada.html \ + ft_sql.html \ gui.html \ gui_w16.html \ gui_w32.html \ @@ -177,14 +178,13 @@ HTMLS = \ if_tcl.html \ indent.html \ index.html \ - vimindex.html \ insert.html \ intro.html \ map.html \ + mbyte.html \ message.html \ + mlang.html \ motion.html \ - mbyte.html \ - mlang.html \ netbeans.html \ options.html \ os_390.html \ @@ -220,10 +220,9 @@ HTMLS = \ russian.html \ scroll.html \ sign.html \ + spell.html \ sponsor.html \ starting.html \ - spell.html \ - sql.html \ syntax.html \ tabpage.html \ tags.html \ @@ -272,6 +271,7 @@ HTMLS = \ version6.html \ version7.html \ vi_diff.html \ + vimindex.html \ visual.html \ windows.html \ workshop.html @@ -291,7 +291,7 @@ CONVERTED = \ evim-ru.UTF-8.1 \ vimdiff-ru.UTF-8.1 \ vimtutor-ru.UTF-8.1 \ - xxd-ru.UTF-8.1 \ + xxd-ru.UTF-8.1 .SUFFIXES: .SUFFIXES: .c .o .txt .html diff --git a/runtime/doc/ft_sql.txt b/runtime/doc/ft_sql.txt new file mode 100644 --- /dev/null +++ b/runtime/doc/ft_sql.txt @@ -0,0 +1,763 @@ +*ft_sql.txt* For Vim version 7.2a. Last change: Wed Apr 26 2006 3:05:33 PM + +by David Fishburn + +This is a filetype plugin to work with SQL files. + +The Structured Query Language (SQL) is a standard which specifies statements +that allow a user to interact with a relational database. Vim includes +features for navigation, indentation and syntax highlighting. + +1. Navigation |sql-navigation| + 1.1 Matchit |sql-matchit| + 1.2 Text Object Motions |sql-object-motions| + 1.3 Predefined Object Motions |sql-predefined-objects| + 1.4 Macros |sql-macros| +2. SQL Dialects |sql-dialects| + 2.1 SQLSetType |SQLSetType| + 2.2 SQL Dialect Default |sql-type-default| +3. Adding new SQL Dialects |sql-adding-dialects| +4. OMNI SQL Completion |sql-completion| + 4.1 Static mode |sql-completion-static| + 4.2 Dynamic mode |sql-completion-dynamic| + 4.3 Tutorial |sql-completion-tutorial| + 4.3.1 Complete Tables |sql-completion-tables| + 4.3.2 Complete Columns |sql-completion-columns| + 4.3.3 Complete Procedures |sql-completion-procedures| + 4.3.4 Complete Views |sql-completion-views| + 4.4 Completion Customization |sql-completion-customization| + 4.5 SQL Maps |sql-completion-maps| + 4.6 Using with other filetypes |sql-completion-filetypes| + +============================================================================== +1. Navigation *sql-navigation* + +The SQL ftplugin provides a number of options to assist with file +navigation. + + +1.1 Matchit *sql-matchit* +----------- +The matchit plugin (http://www.vim.org/scripts/script.php?script_id=39) +provides many additional features and can be customized for different +languages. The matchit plugin is configured by defining a local +buffer variable, b:match_words. Pressing the % key while on various +keywords will move the cursor to its match. For example, if the cursor +is on an "if", pressing % will cycle between the "else", "elseif" and +"end if" keywords. + +The following keywords are supported: > + if + elseif | elsif + else [if] + end if + + [while condition] loop + leave + break + continue + exit + end loop + + for + leave + break + continue + exit + end loop + + do + statements + doend + + case + when + when + default + end case + + merge + when not matched + when matched + + create[ or replace] procedure|function|event + returns + + +1.2 Text Object Motions *sql-object-motions* +----------------------- +Vim has a number of predefined keys for working with text |object-motions|. +This filetype plugin attempts to translate these keys to maps which make sense +for the SQL language. + +The following |Normal| mode and |Visual| mode maps exist (when you edit a SQL +file): > + ]] move forward to the next 'begin' + [[ move backwards to the previous 'begin' + ][ move forward to the next 'end' + [] move backwards to the previous 'end' + + +1.3 Predefined Object Motions *sql-predefined-objects* +----------------------------- +Most relational databases support various standard features, tables, indices, +triggers and stored procedures. Each vendor also has a variety of proprietary +objects. The next set of maps have been created to help move between these +objects. Depends on which database vendor you are using, the list of objects +must be configurable. The filetype plugin attempts to define many of the +standard objects, plus many additional ones. In order to make this as +flexible as possible, you can override the list of objects from within your +|vimrc| with the following: > + let g:ftplugin_sql_objects = 'function,procedure,event,table,trigger' . + \ ',schema,service,publication,database,datatype,domain' . + \ ',index,subscription,synchronization,view,variable' + +The following |Normal| mode and |Visual| mode maps have been created which use +the above list: > + ]} move forward to the next 'create ' + [{ move backward to the previous 'create ' + +Repeatedly pressing ]} will cycle through each of these create statements: > + create table t1 ( + ... + ); + + create procedure p1 + begin + ... + end; + + create index i1 on t1 (c1); + +The default setting for g:ftplugin_sql_objects is: > + let g:ftplugin_sql_objects = 'function,procedure,event,' . + \ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' . + \ 'table,trigger' . + \ ',schema,service,publication,database,datatype,domain' . + \ ',index,subscription,synchronization,view,variable' + +The above will also handle these cases: > + create table t1 ( + ... + ); + create existing table t2 ( + ... + ); + create global temporary table t3 ( + ... + ); + +By default, the ftplugin only searches for CREATE statements. You can also +override this via your |vimrc| with the following: > + let g:ftplugin_sql_statements = 'create,alter' + +The filetype plugin defines three types of comments: > + 1. -- + 2. // + 3. /* + * + */ + +The following |Normal| mode and |Visual| mode maps have been created to work +with comments: > + ]" move forward to the beginning of a comment + [" move forward to the end of a comment + + + +1.4 Macros *sql-macros* +---------- +Vim's feature to find macro definitions, |'define'|, is supported using this +regular expression: > + \c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\> + +This addresses the following code: > + CREATE VARIABLE myVar1 INTEGER; + + CREATE PROCEDURE sp_test( + IN myVar2 INTEGER, + OUT myVar3 CHAR(30), + INOUT myVar4 NUMERIC(20,0) + ) + BEGIN + DECLARE myVar5 INTEGER; + + SELECT c1, c2, c3 + INTO myVar2, myVar3, myVar4 + FROM T1 + WHERE c4 = myVar1; + END; + +Place your cursor on "myVar1" on this line: > + WHERE c4 = myVar1; + ^ + +Press any of the following keys: > + [d + [D + [CTRL-D + + +============================================================================== +2. SQL Dialects *sql-dialects* *sql-types* + *sybase* *TSQL* *Transact-SQL* + *sqlanywhere* + *oracle* *plsql* *sqlj* + *sqlserver* + *mysql* *postgres* *psql* + *informix* + +All relational databases support SQL. There is a portion of SQL that is +portable across vendors (ex. CREATE TABLE, CREATE INDEX), but there is a +great deal of vendor specific extensions to SQL. Oracle supports the +"CREATE OR REPLACE" syntax, column defaults specified in the CREATE TABLE +statement and the procedural language (for stored procedures and triggers). + +The default Vim distribution ships with syntax highlighting based on Oracle's +PL/SQL. The default SQL indent script works for Oracle and SQL Anywhere. +The default filetype plugin works for all vendors and should remain vendor +neutral, but extendable. + +Vim currently has support for a variety of different vendors, currently this +is via syntax scripts. Unfortunately, to flip between different syntax rules +you must either create: + 1. New filetypes + 2. Custom autocmds + 3. Manual steps / commands + +The majority of people work with only one vendor's database product, it would +be nice to specify a default in your |vimrc|. + + +2.1 SQLSetType *sqlsettype* *SQLSetType* +-------------- +For the people that work with many different databases, it would be nice to be +able to flip between the various vendors rules (indent, syntax) on a per +buffer basis, at any time. The ftplugin/sql.vim file defines this function: > + SQLSetType + +Executing this function without any parameters will set the indent and syntax +scripts back to their defaults, see |sql-type-default|. If you have turned +off Vi's compatibility mode, |'compatible'|, you can use the key to +complete the optional parameter. + +After typing the function name and a space, you can use the completion to +supply a parameter. The function takes the name of the Vim script you want to +source. Using the |cmdline-completion| feature, the SQLSetType function will +search the |'runtimepath'| for all Vim scripts with a name containing 'sql'. +This takes the guess work out of the spelling of the names. The following are +examples: > + :SQLSetType + :SQLSetType sqloracle + :SQLSetType sqlanywhere + :SQLSetType sqlinformix + :SQLSetType mysql + +The easiest approach is to the use character which will first complete +the command name (SQLSetType), after a space and another , display a list +of available Vim script names: > + :SQL + + +2.2 SQL Dialect Default *sql-type-default* +----------------------- +As mentioned earlier, the default syntax rules for Vim is based on Oracle +(PL/SQL). You can override this default by placing one of the following in +your |vimrc|: > + let g:sql_type_default = 'sqlanywhere' + let g:sql_type_default = 'sqlinformix' + let g:sql_type_default = 'mysql' + +If you added the following to your |vimrc|: > + let g:sql_type_default = 'sqlinformix' + +The next time edit a SQL file the following scripts will be automatically +loaded by Vim: > + ftplugin/sql.vim + syntax/sqlinformix.vim + indent/sql.vim +> +Notice indent/sqlinformix.sql was not loaded. There is no indent file +for Informix, Vim loads the default files if the specified files does not +exist. + + +============================================================================== +3. Adding new SQL Dialects *sql-adding-dialects* + +If you begin working with a SQL dialect which does not have any customizations +available with the default Vim distribution you can check http://www.vim.org +to see if any customization currently exist. If not, you can begin by cloning +an existing script. Read |filetype-plugins| for more details. + +To help identify these scripts, try to create the files with a "sql" prefix. +If you decide you wish to create customizations for the SQLite database, you +can create any of the following: > + Unix + ~/.vim/syntax/sqlite.vim + ~/.vim/indent/sqlite.vim + Windows + $VIM/vimfiles/syntax/sqlite.vim + $VIM/vimfiles/indent/sqlite.vim + +No changes are necessary to the SQLSetType function. It will automatically +pickup the new SQL files and load them when you issue the SQLSetType command. + + +============================================================================== +4. OMNI SQL Completion *sql-completion* + *omni-sql-completion* + +Vim 7 includes a code completion interface and functions which allows plugin +developers to build in code completion for any language. Vim 7 includes +code completion for the SQL language. + +There are two modes to the SQL completion plugin, static and dynamic. The +static mode populates the popups with the data generated from current syntax +highlight rules. The dynamic mode populates the popups with data retrieved +directly from a database. This includes, table lists, column lists, +procedures names and more. + +4.1 Static Mode *sql-completion-static* +--------------- +The static popups created contain items defined by the active syntax rules +while editing a file with a filetype of SQL. The plugin defines (by default) +various maps to help the user refine the list of items to be displayed. +The defaults static maps are: > + imap a :call sqlcomplete#Map('syntax') + imap k :call sqlcomplete#Map('sqlKeyword') + imap f :call sqlcomplete#Map('sqlFunction') + imap o :call sqlcomplete#Map('sqlOption') + imap T :call sqlcomplete#Map('sqlType') + imap s :call sqlcomplete#Map('sqlStatement') + +The static maps (which are based on the syntax highlight groups) follow this +format: > + imap k :call sqlcomplete#Map('sqlKeyword') + +This command breaks down as: > + imap - Create an insert map + - Only for this buffer + k - Your choice of key map + - Execute one command, return to Insert mode + :call sqlcomplete#Map( - Allows the SQL completion plugin to perform some + housekeeping functions to allow it to be used in + conjunction with other completion plugins. + Indicate which item you want the SQL completion + plugin to complete. + In this case we are asking the plugin to display + items from the syntax highlight group + 'sqlKeyword'. + You can view a list of highlight group names to + choose from by executing the + :syntax list + command while editing a SQL file. + 'sqlKeyword' - Display the items for the sqlKeyword highlight + group + ) - Execute the :let command + - Trigger the standard omni completion key stroke. + Passing in 'sqlKeyword' instructs the SQL + completion plugin to populate the popup with + items from the sqlKeyword highlight group. The + plugin will also cache this result until Vim is + restarted. The syntax list is retrieved using + the syntaxcomplete plugin. + +Using the 'syntax' keyword is a special case. This instructs the +syntaxcomplete plugin to retrieve all syntax items. So this will effectively +work for any of Vim's SQL syntax files. At the time of writing this includes +10 different syntax files for the different dialects of SQL (see section 3 +above, |sql-dialects|). + +Here are some examples of the entries which are pulled from the syntax files: > + All + - Contains the contents of all syntax highlight groups + Statements + - Select, Insert, Update, Delete, Create, Alter, ... + Functions + - Min, Max, Trim, Round, Date, ... + Keywords + - Index, Database, Having, Group, With + Options + - Isolation_level, On_error, Qualify_owners, Fire_triggers, ... + Types + - Integer, Char, Varchar, Date, DateTime, Timestamp, ... + + +4.2 Dynamic Mode *sql-completion-dynamic* +---------------- +Dynamic mode populates the popups with data directly from a database. In +order for the dynamic feature to be enabled you must have the dbext.vim +plugin installed, (http://vim.sourceforge.net/script.php?script_id=356). + +Dynamic mode is used by several features of the SQL completion plugin. +After installing the dbext plugin see the dbext-tutorial for additional +configuration and usage. The dbext plugin allows the SQL completion plugin +to display a list of tables, procedures, views and columns. > + Table List + - All tables for all schema owners + Procedure List + - All stored procedures for all schema owners + View List + - All stored procedures for all schema owners + Column List + - For the selected table, the columns that are part of the table + +To enable the popup, while in INSERT mode, use the following key combinations +for each group (where means hold the CTRL key down while pressing +the space bar): + Table List - t + - (the default map assumes tables) + Stored Procedure List - p + View List - v + Column List - c + + Windows platform only - When viewing a popup window displaying the list + of tables, you can press , this will + replace the table currently highlighted with + the column list for that table. + - When viewing a popup window displaying the list + of columns, you can press , this will + replace the column list with the list of tables. + - This allows you to quickly drill down into a + table to view it's columns and back again. + +The SQL completion plugin caches various lists that are displayed in +the popup window. This makes the re-displaying of these lists very +fast. If new tables or columns are added to the database it may become +necessary to clear the plugins cache. The default map for this is: > + imap R :call sqlcomplete#Map('ResetCache') + + +4.3 SQL Tutorial *sql-completion-tutorial* +---------------- + +This tutorial is designed to take you through the common features of the SQL +completion plugin so that: > + a) You gain familiarity with the plugin + b) You are introduced to some of the more common features + c) Show how to customize it to your preferences + d) Demonstrate "Best of Use" of the plugin (easiest way to configure). + +First, create a new buffer: > + :e tutorial.sql + + +Static features +--------------- +To take you through the various lists, simply enter insert mode, hit: + s (show SQL statements) +At this point, you can page down through the list until you find "select". +If you are familiar with the item you are looking for, for example you know +the statement begins with the letter "s". You can type ahead (without the +quotes) "se" then press: + t +Assuming "select" is highlighted in the popup list press to choose +the entry. Now type: + * fra (show all syntax items) +choose "from" from the popup list. + +When writing stored procedures using the "type" list is useful. It contains +a list of all the database supported types. This may or may not be true +depending on the syntax file you are using. The SQL Anywhere syntax file +(sqlanywhere.vim) has support for this: > + BEGIN + DECLARE customer_id T <-- Choose a type from the list + + +Dynamic features +---------------- +To take advantage of the dynamic features you must first install the +dbext.vim plugin (http://vim.sourceforge.net/script.php?script_id=356). It +also comes with a tutorial. From the SQL completion plugin's perspective, +the main feature dbext provides is a connection to a database. dbext +connection profiles are the most efficient mechanism to define connection +information. Once connections have been setup, the SQL completion plugin +uses the features of dbext in the background to populate the popups. + +What follows assumes dbext.vim has been correctly configured, a simple test +is to run the command, :DBListTable. If a list of tables is shown, you know +dbext.vim is working as expected. If not, please consult the dbext.txt +documentation. + +Assuming you have followed the dbext-tutorial you can press t to +display a list of tables. There is a delay while dbext is creating the table +list. After the list is displayed press . This will remove both the +popup window and the table name already chosen when the list became active. > + + 4.3.1 Table Completion: *sql-completion-tables* + +Press t to display a list of tables from within the database you +have connected via the dbext plugin. +NOTE: All of the SQL completion popups support typing a prefix before pressing +the key map. This will limit the contents of the popup window to just items +beginning with those characters. > + + 4.3.2 Column Completion: *sql-completion-columns* + +The SQL completion plugin can also display a list of columns for particular +tables. The column completion is trigger via c. + +NOTE: The following example uses to trigger a column list while +the popup window is active. This map is only available on the Windows +platforms since *nix does not recognize CTRL and the right arrow held down +together. If you wish to enable this functionality on a *nix platform choose +a key and create one of these mappings (see |sql-completion-maps| for further +details on where to create this imap): > + imap =sqlcomplete#DrillIntoTable() + imap :call sqlcomplete#Map('column') + +Example of using column completion: + - Press t again to display the list of tables. + - When the list is displayed in the completion window, press , + this will replace the list of tables, with a list of columns for the + table highlighted (after the same short delay). + - If you press , this will again replace the column list with the + list of tables. This allows you to drill into tables and column lists + very quickly. + - Press again while the same table is highlighted. You will + notice there is no delay since the column list has been cached. If you + change the schema of a cached table you can press R, which + clears the SQL completion cache. + - NOTE: and have been designed to work while the + completion window is active. If the completion popup window is + not active, a normal or will be executed. + +Lets look how we can build a SQL statement dynamically. A select statement +requires a list of columns. There are two ways to build a column list using +the SQL completion plugin. > + One column at a time: +< 1. After typing SELECT press t to display a list of tables. + 2. Choose a table from the list. + 3. Press to display a list of columns. + 4. Choose the column from the list and press enter. + 5. Enter a "," and press c. Generating a column list + generally requires having the cursor on a table name. The plugin + uses this name to determine what table to retrieve the column list. + In this step, since we are pressing c without the cursor + on a table name the column list displayed will be for the previous + table. Choose a different column and move on. + 6. Repeat step 5 as often as necessary. > + All columns for a table: +< 1. After typing SELECT press t to display a list of tables. + 2. Highlight the table you need the column list for. + 3. Press to choose the table from the list. + 4. Press l to request a comma separated list of all columns + for this table. + 5. Based on the table name chosen in step 3, the plugin attempts to + decide on a reasonable table alias. You are then prompted to + either accept of change the alias. Press OK. + 6. The table name is replaced with the column list of the table is + replaced with the comma separate list of columns with the alias + prepended to each of the columns. + 7. Step 3 and 4 can be replaced by pressing L, which has + a embedded in the map to choose the currently highlighted + table in the list. + +There is a special provision when writing select statements. Consider the +following statement: > + select * + from customer c, + contact cn, + department as dp, + employee e, + site_options so + where c. + +In INSERT mode after typing the final "c." which is an alias for the +"customer" table, you can press either c or . This will +popup a list of columns for the customer table. It does this by looking back +to the beginning of the select statement and finding a list of the tables +specified in the FROM clause. In this case it notes that in the string +"customer c", "c" is an alias for the customer table. The optional "AS" +keyword is also supported, "customer AS c". > + + + 4.3.3 Procedure Completion: *sql-completion-procedures* + +Similar to the table list, p, will display a list of stored +procedures stored within the database. > + + 4.3.4 View Completion: *sql-completion-views* + +Similar to the table list, v, will display a list of views in the +database. + + +4.4 Completion Customization *sql-completion-customization* +---------------------------- + +The SQL completion plugin can be customized through various options set in +your |vimrc|: > + omni_sql_no_default_maps +< - Default: This variable is not defined + - If this variable is defined, no maps are created for OMNI + completion. See |sql-completion-maps| for further discussion. +> + omni_sql_use_tbl_alias +< - Default: a + - This setting is only used when generating a comma separated + column list. By default the map is l. When generating + a column list, an alias can be prepended to the beginning of each + column, for example: e.emp_id, e.emp_name. This option has three + settings: > + n - do not use an alias + d - use the default (calculated) alias + a - ask to confirm the alias name +< + An alias is determined following a few rules: + 1. If the table name has an '_', then use it as a separator: > + MY_TABLE_NAME --> MTN + my_table_name --> mtn + My_table_NAME --> MtN +< 2. If the table name does NOT contain an '_', but DOES use + mixed case then the case is used as a separator: > + MyTableName --> MTN +< 3. If the table name does NOT contain an '_', and does NOT + use mixed case then the first letter of the table is used: > + mytablename --> m + MYTABLENAME --> M + + omni_sql_ignorecase +< - Default: Current setting for|ignorecase| + - Valid settings are 0 or 1. + - When entering a few letters before initiating completion, the list + will be filtered to display only the entries which begin with the + list of characters. When this option is set to 0, the list will be + filtered using case sensitivity. > + + omni_sql_include_owner +< - Default: 0, unless dbext.vim 3.00 has been installed + - Valid settings are 0 or 1. + - When completing tables, procedure or views and using dbext.vim 3.00 + or higher the list of objects will also include the owner name. + When completing these objects and omni_sql_include_owner is enabled + the owner name will be replaced. > + + omni_sql_precache_syntax_groups +< - Default: + ['syntax','sqlKeyword','sqlFunction','sqlOption','sqlType','sqlStatement'] + - sqlcomplete can be used in conjunction with other completion + plugins. This is outlined at |sql-completion-filetypes|. When the + filetype is changed temporarily to SQL, the sqlcompletion plugin + will cache the syntax groups listed in the List specified in this + option. +> + +4.5 SQL Maps *sql-completion-maps* +------------ + +The default SQL maps have been described in other sections of this document in +greater detail. Here is a list of the maps with a brief description of each. + +Static Maps +----------- +These are maps which use populate the completion list using Vim's syntax +highlighting rules. > + a +< - Displays all SQL syntax items. > + k +< - Displays all SQL syntax items defined as 'sqlKeyword'. > + f +< - Displays all SQL syntax items defined as 'sqlFunction. > + o +< - Displays all SQL syntax items defined as 'sqlOption'. > + T +< - Displays all SQL syntax items defined as 'sqlType'. > + s +< - Displays all SQL syntax items defined as 'sqlStatement'. > + +Dynamic Maps +------------ +These are maps which use populate the completion list using the dbext.vim +plugin. > + t +< - Displays a list of tables. > + p +< - Displays a list of procedures. > + v +< - Displays a list of views. > + c +< - Displays a list of columns for a specific table. > + l +< - Displays a comma separated list of columns for a specific table. > + L +< - Displays a comma separated list of columns for a specific table. + This should only be used when the completion window is active. > + +< - Displays a list of columns for the table currently highlighted in + the completion window. is not recognized on most Unix + systems, so this maps is only created on the Windows platform. + If you would like the same feature on Unix, choose a different key + and make the same map in your vimrc. > + +< - Displays the list of tables. + is not recognized on most Unix systems, so this maps is + only created on the Windows platform. If you would like the same + feature on Unix, choose a different key and make the same map in + your vimrc. > + R +< - This maps removes all cached items and forces the SQL completion + to regenerate the list of items. + +Customizing Maps +---------------- +You can create as many additional key maps as you like. Generally, the maps +will be specifying different syntax highlight groups. + +If you do not wish the default maps created or the key choices do not work on +your platform (often a case on *nix) you define the following variable in +your |vimrc|: > + let g:omni_sql_no_default_maps = 1 + +Do no edit ftplugin/sql.vim directly! If you change this file your changes +will be over written on future updates. Vim has a special directory structure +which allows you to make customizations without changing the files that are +included with the Vim distribution. If you wish to customize the maps +create an after/ftplugin/sql.vim (see |after-directory|) and place the same +maps from the ftplugin/sql.vim in it using your own key strokes. was +chosen since it will work on both Windows and *nix platforms. On the windows +platform you can also use or ALT keys. + + +4.6 Using with other filetypes *sql-completion-filetypes* +------------------------------ + +Many times SQL can be used with different filetypes. For example Perl, Java, +PHP, Javascript can all interact with a database. Often you need both the SQL +completion as well as the completion capabilities for the current language you +are editing. + +This can be enabled easily with the following steps (assuming a Perl file): > + 1. :e test.pl + 2. :set filetype=sql + 3. :set ft=perl + +Step 1 +------ +Begins by editing a Perl file. Vim automatically sets the filetype to +"perl". By default, Vim runs the appropriate filetype file +ftplugin/perl.vim. If you are using the syntax completion plugin by following +the directions at |ft-syntax-omni| then the |'omnifunc'| option has been set to +"syntax#Complete". Pressing will display the omni popup containing +the syntax items for Perl. + +Step 2 +------ +Manually setting the filetype to 'sql' will also fire the appropriate filetype +files ftplugin/sql.vim. This file will define a number of buffer specific +maps for SQL completion, see |sql-completion-maps|. Now these maps have +been created and the SQL completion plugin has been initialized. All SQL +syntax items have been cached in preparation. The SQL filetype script detects +we are attempting to use two different completion plugins. Since the SQL maps +begin with , the maps will toggle the |'omnifunc'| when in use. So you +can use to continue using the completion for Perl (using the syntax +completion plugin) and to use the SQL completion features. + +Step 3 +------ +Setting the filetype back to Perl sets all the usual "perl" related items back +as they were. + + +vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -1,4 +1,4 @@ -*gui.txt* For Vim version 7.1. Last change: 2007 May 11 +*gui.txt* For Vim version 7.2a. Last change: 2008 Jun 14 VIM REFERENCE MANUAL by Bram Moolenaar @@ -325,16 +325,22 @@ A different kind of selection is used wh - at the |hit-enter| prompt - whenever the current mode is not in the 'mouse' option - when holding the CTRL and SHIFT keys in the GUI + Since Vim continues like the selection isn't there, and there is no mode associated with the selection, this is called modeless selection. Any text in the Vim window can be selected. Select the text by pressing the left mouse button at the start, drag to the end and release. To extend the selection, use the right mouse button when 'mousemodel' is "extend", or the left mouse button with the shift key pressed when 'mousemodel' is "popup". -The middle mouse button pastes the text. The selection is removed when the selected text is scrolled or changed. + On the command line CTRL-Y can be used to copy the selection into the -clipboard. To do this from Insert mode, use CTRL-O : CTRL-Y . +clipboard. To do this from Insert mode, use CTRL-O : CTRL-Y . When +'guioptions' contains a or A (default on X11), the selection is automatically +copied to the "* register. + +The middle mouse button can then paste the text. On non-X11 systems, you can +use CTRL-R +. 3.4 Using Mouse on Status Lines *gui-mouse-status* diff --git a/runtime/doc/hangulin.txt b/runtime/doc/hangulin.txt --- a/runtime/doc/hangulin.txt +++ b/runtime/doc/hangulin.txt @@ -1,4 +1,4 @@ -*hangulin.txt* For Vim version 7.1. Last change: 2006 Apr 02 +*hangulin.txt* For Vim version 7.2a. Last change: 2006 Apr 02 VIM REFERENCE MANUAL by Chi-Deok Hwang and Sung-Hyun Nam diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1,4 +1,4 @@ -*map.txt* For Vim version 7.1. Last change: 2007 May 11 +*map.txt* For Vim version 7.2a. Last change: 2008 Jun 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -266,12 +266,13 @@ as a special key. 1.3 MAPPING AND MODES *:map-modes* + *mapmode-nvo* *mapmode-n* *mapmode-v* *mapmode-o* There are five sets of mappings - For Normal mode: When typing commands. - For Visual mode: When typing commands while the Visual area is highlighted. - For Operator-pending mode: When an operator is pending (after "d", "y", "c", - etc.). Example: ":omap { w" makes "y{" work like "yw" and "d{" like "dw". + etc.). See below: |omap-info|. - For Insert mode. These are also used in Replace mode. - For Command-line mode: When entering a ":" or "/" command. @@ -282,7 +283,6 @@ to type a count with a zero. *map-overview* *map-modes* Overview of which map command works in which mode: - *mapmode-nvo* *mapmode-n* *mapmode-v* *mapmode-o* commands: modes: ~ Normal Visual+Select Operator-pending ~ :map :noremap :unmap :mapclear yes yes yes @@ -318,6 +318,19 @@ Therefore the ":map" and ":map!" command several modes. In Vim you can use the ":nmap", ":vmap", ":omap", ":cmap" and ":imap" commands to enter mappings for each mode separately. + *omap-info* +Operator-pending mappings can be used to define a movement command that can be +used with any operator. Simple example: ":omap { w" makes "y{" work like "yw" +and "d{" like "dw". + +To ignore the starting cursor position and select different text, you can have +the omap start Visual mode to select the text to be operated upon. Example +that operates on a function name in the current line: > + onoremap F :normal! 0f(hviw +The CTRL-U () is used to remove the range that Vim may insert. The +Normal mode commands find the first '(' character and select the first word +before it. That usually is the function name. + To enter a mapping for Normal and Visual mode, but not Operator-pending mode, first define it for all three modes, then unmap it for Operator-pending mode: :map xx something-difficult @@ -473,7 +486,7 @@ scenario: > :imap foo :set encoding=utf-8 The mapping for is defined with the latin1 encoding, resulting in a 0xc3 -byte. If you type the character á (0xea ) in UTF-8 encoding this is the +byte. If you type the character á (0xe1 ) in UTF-8 encoding this is the two bytes 0xc3 0xa1. You don't want the 0xc3 byte to be mapped then, otherwise it would be impossible to type the á character. @@ -494,9 +507,9 @@ defined. Changing "mapleader" after tha mappings. ** *maplocalleader* -Just like , except that it uses "maplocalleader" instead of -"mapleader". is to be used for mappings which are local to a -buffer. Example: > + is just like , except that it uses "maplocalleader" +instead of "mapleader". is to be used for mappings which are +local to a buffer. Example: > :map q \DoItNow < In a global plugin should be used and in a filetype plugin @@ -1167,7 +1180,7 @@ defined, not where it is invoked! Examp :source script1.vim :let s:error = "Wrong!" :Error s:error -Executing script2.vim will result in "None" to be echoed. Not what you +Executing script2.vim will result in "None" being echoed. Not what you intended! Calling a function may be an alternative. Completion behavior *:command-completion* *E179* @@ -1203,7 +1216,7 @@ Custom completion *:command-completion *E467* *E468* It is possible to define customized completion schemes via the "custom,{func}" or the "customlist,{func}" completion argument. The {func} part should be a -function with the following prototype > +function with the following signature: > :function {func}(ArgLead, CmdLine, CursorPos) @@ -1370,10 +1383,10 @@ This will invoke: > :" A more substantial example :function Allargs(command) - : let i = 0 - : while i < argc() - : if filereadable(argv(i)) - : execute "e " . argv(i) + : let i = 0 + : while i < argc() + : if filereadable(argv(i)) + : execute "e " . argv(i) : execute a:command : endif : let i = i + 1 diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt --- a/runtime/doc/mlang.txt +++ b/runtime/doc/mlang.txt @@ -1,4 +1,4 @@ -*mlang.txt* For Vim version 7.1. Last change: 2006 Jul 12 +*mlang.txt* For Vim version 7.2a. Last change: 2008 Jun 08 VIM REFERENCE MANUAL by Bram Moolenaar @@ -73,6 +73,9 @@ use of "-" and "_". This sets $LC_TIME. Without an argument both are set, and additionally $LANG is set. + When compiled with the |+float| feature the LC_NUMERIC + value will always be set to "C", so that floating + point numbers use '.' as the decimal point. This will make a difference for items that depend on the language (some messages, time and date format). Not fully supported on all systems diff --git a/runtime/doc/os_qnx.txt b/runtime/doc/os_qnx.txt --- a/runtime/doc/os_qnx.txt +++ b/runtime/doc/os_qnx.txt @@ -1,4 +1,4 @@ -*os_qnx.txt* For Vim version 7.1. Last change: 2005 Mar 29 +*os_qnx.txt* For Vim version 7.2a. Last change: 2005 Mar 29 VIM REFERENCE MANUAL by Julian Kinraid diff --git a/runtime/doc/os_vms.txt b/runtime/doc/os_vms.txt --- a/runtime/doc/os_vms.txt +++ b/runtime/doc/os_vms.txt @@ -1,4 +1,4 @@ -*os_vms.txt* For Vim version 7.1. Last change: 2006 Nov 18 +*os_vms.txt* For Vim version 7.2a. Last change: 2006 Nov 18 VIM REFERENCE MANUAL diff --git a/runtime/doc/pi_gzip.txt b/runtime/doc/pi_gzip.txt --- a/runtime/doc/pi_gzip.txt +++ b/runtime/doc/pi_gzip.txt @@ -1,4 +1,4 @@ -*pi_gzip.txt* For Vim version 7.1. Last change: 2002 Oct 29 +*pi_gzip.txt* For Vim version 7.2a. Last change: 2002 Oct 29 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -1,4 +1,4 @@ -*print.txt* For Vim version 7.1. Last change: 2007 Apr 22 +*print.txt* For Vim version 7.2a. Last change: 2008 Apr 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -26,6 +26,9 @@ systems a PostScript file is produced. PostScript printer. For other printers a program like ghostscript needs to be used. +Note: If you have problems printing with |:hardcopy|, an alternative is to use +|:TOhtml| and print the resulting html file from a browser. + *:ha* *:hardcopy* *E237* *E238* *E324* :[range]ha[rdcopy][!] [arguments] Send [range] lines (default whole file) to the @@ -193,7 +196,8 @@ the font. When omitted, the point size This defines the format of the header produced in |:hardcopy| output. The option is defined in the same way as the 'statusline' option. If Vim has not been compiled with the |+statusline| feature, this option has no effect and a -simple default header is used, which shows the page number. +simple default header is used, which shows the page number. The same simple +header is used when this option is empty. *pmbcs-option* 'printmbcharset' 'pmbcs' string (default "") diff --git a/runtime/doc/usr_03.txt b/runtime/doc/usr_03.txt --- a/runtime/doc/usr_03.txt +++ b/runtime/doc/usr_03.txt @@ -1,4 +1,4 @@ -*usr_03.txt* For Vim version 7.1. Last change: 2006 Jun 21 +*usr_03.txt* For Vim version 7.2a. Last change: 2006 Jun 21 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/usr_43.txt b/runtime/doc/usr_43.txt --- a/runtime/doc/usr_43.txt +++ b/runtime/doc/usr_43.txt @@ -1,4 +1,4 @@ -*usr_43.txt* For Vim version 7.1. Last change: 2006 Apr 24 +*usr_43.txt* For Vim version 7.2a. Last change: 2006 Apr 24 VIM USER MANUAL - by Bram Moolenaar diff --git a/runtime/doc/version5.txt b/runtime/doc/version5.txt --- a/runtime/doc/version5.txt +++ b/runtime/doc/version5.txt @@ -1,4 +1,4 @@ -*version5.txt* For Vim version 7.1. Last change: 2007 May 11 +*version5.txt* For Vim version 7.2a. Last change: 2007 May 11 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -1,4 +1,4 @@ -*visual.txt* For Vim version 7.1. Last change: 2006 Sep 26 +*visual.txt* For Vim version 7.2a. Last change: 2006 Sep 26 VIM REFERENCE MANUAL by Bram Moolenaar diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/gitcommit.vim @@ -0,0 +1,68 @@ +" Vim filetype plugin +" Language: git config file +" Maintainer: Tim Pope +" Last Change: 2008 Jun 04 + +" Only do this when not done yet for this buffer +if (exists("b:did_ftplugin")) + finish +endif + +runtime! ftplugin/git.vim +let b:did_ftplugin = 1 + +if &textwidth == 0 + " make sure that log messages play nice with git-log on standard terminals + setlocal textwidth=72 + if !exists("b:undo_ftplugin") + let b:undo_ftplugin = "" + endif + let b:undo_ftplugin = b:undo_ftplugin . "|setl tw<" +endif + +if exists("g:no_gitcommit_commands") || v:version < 700 + finish +endif + +if !exists("b:git_dir") + let b:git_dir = expand("%:p:h") +endif + +" Automatically diffing can be done with: +" autocmd FileType gitcommit DiffGitCached | wincmd p +command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0,b:git_dir,) + +function! s:diffcomplete(A,L,P) + let args = "" + if a:P <= match(a:L." -- "," -- ")+3 + let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n" + end + if exists("b:git_dir") && a:A !~ '^-' + let tree = fnamemodify(b:git_dir,':h') + if strpart(getcwd(),0,strlen(tree)) == tree + let args = args."\n".system("git diff --cached --name-only") + endif + endif + return args +endfunction + +function! s:gitdiffcached(bang,gitdir,...) + let tree = fnamemodify(a:gitdir,':h') + let name = tempname() + let git = "git" + if strpart(getcwd(),0,strlen(tree)) != tree + let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"') + endif + if a:0 + let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'")) + else + let extra = "-p --stat=".&columns + endif + call system(git." diff --cached --no-color ".extra." > ".(exists("*shellescape") ? shellescape(name) : name)) + exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name) + wincmd P + let b:git_dir = a:gitdir + command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0,b:git_dir,) + nnoremap q :q + setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git +endfunction diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim --- a/runtime/ftplugin/html.vim +++ b/runtime/ftplugin/html.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: html " Maintainer: Dan Sharp -" Last Changed: 2006 Apr 26 +" Last Changed: 2007 Nov 20 " URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin if exists("b:did_ftplugin") | finish | endif @@ -13,63 +13,55 @@ let s:save_cpo = &cpo set cpo-=C setlocal commentstring= +setlocal matchpairs+=<:> if exists('&omnifunc') -" Distinguish between HTML versions -" To use with other HTML versions add another -" elseif condition to match proper DOCTYPE -setlocal omnifunc=htmlcomplete#CompleteTags + " Distinguish between HTML versions + " To use with other HTML versions add another + " elseif condition to match proper DOCTYPE + setlocal omnifunc=htmlcomplete#CompleteTags -if &filetype == 'xhtml' - let b:html_omni_flavor = 'xhtml10s' -else - let b:html_omni_flavor = 'html401t' -endif -let i = 1 -while i < 10 && i < line("$") - let line = getline(i) - if line =~ '' + let b:html_omni_flavor = 'html40' + endif + if line =~ '\' + let b:html_omni_flavor .= 't' + elseif line =~ '\' + let b:html_omni_flavor .= 'f' + else + let b:html_omni_flavor .= 's' + endif + endif + endif endif " HTML: thanks to Johannes Zellner and Benji Fisher. if exists("loaded_matchit") let b:match_ignorecase = 1 - let b:match_skip = 's:Comment' let b:match_words = '<:>,' . \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' . \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' . @@ -85,7 +77,7 @@ if has("gui_win32") endif " Undo the stuff we changed. -let b:undo_ftplugin = "setlocal commentstring<" +let b:undo_ftplugin = "setlocal commentstring< matchpairs< omnifunc<" \ " | unlet! b:match_ignorecase b:match_skip b:match_words b:browsefilter" " Restore the saved compatibility options. diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -2,7 +2,7 @@ " Language: PHP " Author: John Wellesz " URL: http://www.2072productions.com/vim/indent/php.vim -" Last Change: 2007 February 25th +" Last Change: 2007 Jun 24 " Newsletter: http://www.2072productions.com/?to=php-indent-for-vim-newsletter.php " Version: 1.24 " @@ -310,11 +310,11 @@ function! ResetOptions() setlocal comments=s1:/*,mb:*,ex:*/,://,:# - setlocal formatoptions-=t + " setlocal formatoptions-=t setlocal formatoptions+=q setlocal formatoptions+=r setlocal formatoptions+=o - setlocal formatoptions+=w + " setlocal formatoptions+=w setlocal formatoptions+=c setlocal formatoptions+=b endif diff --git a/runtime/indent/sql.vim b/runtime/indent/sql.vim --- a/runtime/indent/sql.vim +++ b/runtime/indent/sql.vim @@ -36,4 +36,4 @@ endif exec 'runtime indent/'.filename.'.vim' -" vim:sw=4:ff=unix: +" vim:sw=4: diff --git a/runtime/indent/sqlanywhere.vim b/runtime/indent/sqlanywhere.vim --- a/runtime/indent/sqlanywhere.vim +++ b/runtime/indent/sqlanywhere.vim @@ -1,8 +1,8 @@ " Vim indent file " Language: SQL " Maintainer: David Fishburn -" Last Change: Wed Sep 14 2005 10:21:15 PM -" Version: 1.4 +" Last Change: Mon Apr 02 2007 9:13:47 AM +" Version: 1.5 " Download: http://vim.sourceforge.net/script.php?script_id=495 " Notes: @@ -106,7 +106,7 @@ function s:CheckToIgnoreRightParan( prev " if getline(".") =~ '^)' let matching_paran = searchpair('(', '', ')', 'bW', - \ 'IsColComment(line("."), col("."))') + \ 's:IsColComment(line("."), col("."))') if matching_paran < 1 " No match found @@ -165,7 +165,7 @@ function s:GetStmtStarterIndent( keyword \ '\%(\%(\\)'. \ '\)' let matching_lnum = searchpair(stmts, '', '\\zs', 'bW', - \ 'IsColComment(line("."), col(".")) == 1') + \ 's:IsColComment(line("."), col(".")) == 1') exec 'normal! $' if matching_lnum > 0 && matching_lnum < a:curr_lnum let ind = indent(matching_lnum) @@ -177,7 +177,7 @@ function s:GetStmtStarterIndent( keyword \ '', \ '\%(\%(\\)\|\%(\\)\)', \ 'bW', - \ 'IsColComment(line("."), col(".")) == 1') + \ 's:IsColComment(line("."), col(".")) == 1') exec 'normal! $' if matching_lnum > 0 && matching_lnum < a:curr_lnum let ind = indent(matching_lnum) @@ -191,7 +191,7 @@ endfunction " Check if the line is a comment -function IsLineComment(lnum) +function s:IsLineComment(lnum) let rc = synIDattr( \ synID(a:lnum, \ match(getline(a:lnum), '\S')+1, 0) @@ -203,7 +203,7 @@ endfunction " Check if the column is a comment -function IsColComment(lnum, cnum) +function s:IsColComment(lnum, cnum) let rc = synIDattr(synID(a:lnum, a:cnum, 0), "name") \ =~? "comment" @@ -211,8 +211,9 @@ function IsColComment(lnum, cnum) endfunction -" Check if the column is a comment -function ModuloIndent(ind) +" Instead of returning a column position, return +" an appropriate value as a factor of shiftwidth. +function s:ModuloIndent(ind) let ind = a:ind if ind > 0 @@ -235,7 +236,7 @@ function GetSQLIndent() " If the current line is a comment, leave the indent as is " Comment out this additional check since it affects the " indenting of =, and will not reindent comments as it should - " if IsLineComment(lnum) == 1 + " if s:IsLineComment(lnum) == 1 " return ind " endif @@ -246,9 +247,9 @@ function GetSQLIndent() return ind endif - if IsLineComment(prevlnum) == 1 + if s:IsLineComment(prevlnum) == 1 if getline(v:lnum) =~ '^\s*\*' - let ind = ModuloIndent(indent(prevlnum)) + let ind = s:ModuloIndent(indent(prevlnum)) return ind + 1 endif " If the previous line is a comment, then return -1 @@ -378,7 +379,7 @@ function GetSQLIndent() endif " echom 'final - indent ' . ind - return ModuloIndent(ind) + return s:ModuloIndent(ind) endfunction -" vim:sw=4:ff=unix: +" vim:sw=4: diff --git a/runtime/indent/vhdl.vim b/runtime/indent/vhdl.vim --- a/runtime/indent/vhdl.vim +++ b/runtime/indent/vhdl.vim @@ -1,8 +1,8 @@ " VHDL indent ('93 syntax) " Language: VHDL " Maintainer: Gerald Lai -" Version: 1.50 -" Last Change: 2007 Jan 29 +" Version: 1.54 +" Last Change: 2007 Aug 17 " URL: http://www.vim.org/scripts/script.php?script_id=1450 " only load this indent file when no other was loaded @@ -28,13 +28,13 @@ let s:ES = '\s*\%(--.*\)\=$' let s:NE = '\%(\ 0 ? indent(prevn) : 0 @@ -77,8 +78,8 @@ function GetVHDLindent() if curs =~ '^\s*--' let pn = curn - 1 let ps = getline(pn) - if ps =~ '--' - return stridx(ps, '--') + if curs =~ '^\s*--\s' && ps =~ '--' + return indent(pn) + stridx(substitute(ps, '^\s*', '', ''), '--') else " find nextnonblank line that is not a comment let nn = nextnonblank(curn + 1) @@ -106,14 +107,14 @@ function GetVHDLindent() if (curs =~ '^\s*)' || curs =~? '^\s*\%(\<\%(generic\|map\|port\)\>.*\)\@\s*\S\+\|:[^=]\@=\s*\%(\%(in\|out\|inout\|buffer\|linkage\)\>\|\w\+\s\+:=\)\)') && (prevs =~? s:NC.'\<\%(generic\|map\|port\)\s*(\%(\s*\w\)\=' || (ps =~? s:NC.'\<\%(generic\|map\|port\)'.s:ES && prevs =~ '^\s*(')) " align closing ")" with opening "(" if curs =~ '^\s*)' - return stridx(prevs, '(') + return ind2 + stridx(prevs_noi, '(') endif - let m = matchend(prevs, '(\s*\ze\w') + let m = matchend(prevs_noi, '(\s*\ze\w') if m != -1 - return m + return ind2 + m else - if g:vhdl_align_genportmap - return stridx(prevs, '(') + &sw + if g:vhdl_indent_genportmap + return ind2 + stridx(prevs_noi, '(') + &sw else return ind2 + &sw endif @@ -124,8 +125,8 @@ function GetVHDLindent() " keywords: variable + "<=" without ";" ending " where: start of previous line if prevs =~? '^\s*\S\+\s*<=[^;]*'.s:ES - if g:vhdl_align_rhsassign - return matchend(prevs, '<=\s*\ze.') + if g:vhdl_indent_rhsassign + return ind2 + matchend(prevs_noi, '<=\s*\ze.') else return ind2 + &sw endif diff --git a/runtime/keymap/sinhala-phonetic_utf-8.vim b/runtime/keymap/sinhala-phonetic_utf-8.vim --- a/runtime/keymap/sinhala-phonetic_utf-8.vim +++ b/runtime/keymap/sinhala-phonetic_utf-8.vim @@ -1,7 +1,7 @@ " Vim Keymap file for Sinhala (Sri Lanka) (2003-11-02) " Maintainer : Harshula Jayasuriya -" Last Updated: 2006-06-08 -" This is a static phonetic mapping for a standard US-English keyboard +" Last Updated: 2007-06-30 +" This is a phonetic static mapping for a standard US-English keyboard " (qwerty) " http://www.nongnu.org/sinhala/doc/keymaps/sinhala-keyboard_3.html @@ -48,18 +48,18 @@ J " ඣ - mahaapraana jayanna (jha) z " ඤ - taaluja naasikyaya (nya) Z " ඥ - taaluja sanyooga naasikyaya (jnya) " ඦ - sanyaka jayanna (nyja) -t " ට - alpapraana ttayanna (tta) -T " ඨ - mahaapraana ttayanna (ttha) -d " ඩ - alpapraana ddayanna (dda) -D " ඪ - mahaapraana ddayanna (ddha) + " ට - alpapraana ttayanna (tta) + " ඨ - mahaapraana ttayanna (ttha) + " ඩ - alpapraana ddayanna (dda) + " ඪ - mahaapraana ddayanna (ddha) N " ණ - muurdhaja nayanna (nna) -x " ඬ - sanyaka ddayanna (nndda) - " ත - alpapraana tayanna (ta) - " ථ - mahaapraana tayanna (tha) - " ද - alpapraana dayanna (da) - " ධ - mahaapraana dayanna (dha) +X " ඬ - sanyaka ddayanna (nndda) +t " ත - alpapraana tayanna (ta) +T " ථ - mahaapraana tayanna (tha) +d " ද - alpapraana dayanna (da) +D " ධ - mahaapraana dayanna (dha) n " න - dantaja nayanna (na) -X " ඳ - sanyaka dayanna (nda) +x " ඳ - sanyaka dayanna (nda) p " ප - alpapraana payanna (pa) P " ඵ - mahaapraana payanna (pha) b " බ - alpapraana bayanna (ba) @@ -70,13 +70,13 @@ y " ය - yayanna (ya) r " ර - rayanna (ra) l " ල - dantaja layanna (la) v " à·€ - vayanna (va) - " à· - taaluja sayanna (sha) -S " à·‚ - muurdhaja sayanna (ssa) +S " à· - taaluja sayanna (sha) + " à·‚ - muurdhaja sayanna (ssa) s " à·ƒ - dantaja sayanna (sa) h " à·„ - hayanna (ha) L " à·… - muurdhaja layanna (lla) f " à·† - fayanna (fa) - " à·Š - al-lakuna + " à·Š - al-lakuna " à· - aela-pilla (aa) " à· - ketti aeda-pilla (ae) " à·‘ - diga aeda-pilla (aae) @@ -96,12 +96,12 @@ f " à·† - fayanna (fa) " à·³ - diga gayanukitta (ll) " à·´ - kunddaliya (punctuation) -R " à·Šâ€à¶» - rakaransaya +R " à·Šâ€à¶» - rakaaranshaya Y " à·Šâ€à¶º - yansaya - " ර්†- repaya + " ර්†- repaya - " join - conjunct letters cons 0DCA ZWJ cons - " touch - cons ZWJ 0DCA cons + " join - conjunct letters cons 0DCA ZWJ cons + " touch - cons ZWJ 0DCA cons - " - no-break space. didn't work. - " - ZWNJ. doesn't work! + " - no-break space. didn't work. + " - ZWNJ. doesn't work! diff --git a/runtime/keymap/ukrainian-jcuken.vim b/runtime/keymap/ukrainian-jcuken.vim --- a/runtime/keymap/ukrainian-jcuken.vim +++ b/runtime/keymap/ukrainian-jcuken.vim @@ -4,7 +4,7 @@ " Useful mainly with utf-8 but may work with other encodings " Maintainer: Anatoli Sakhnik -" Last Changed: 2006 Mar 15 +" Last Changed: 2007 Nov 11 " All characters are given literally, conversion to another encoding (e.g., " UTF-8) should work. @@ -88,3 +88,5 @@ z Ñ CYRILLIC SMALL LETTER YA ^ , & . * ; +~ ~ +~~ Stress diff --git a/runtime/macros/less.sh b/runtime/macros/less.sh --- a/runtime/macros/less.sh +++ b/runtime/macros/less.sh @@ -2,8 +2,17 @@ # Shell script to start Vim with less.vim. # Read stdin if no arguments were given. -if test $# = 0; then - vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - +if test -t 1; then + if test $# = 0; then + vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' - + else + vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" + fi else - vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@" + # Output is not a terminal, cat arguments or stdin + if test $# = 0; then + cat + else + cat "$@" + fi fi diff --git a/runtime/plugin/vimballPlugin.vim b/runtime/plugin/vimballPlugin.vim --- a/runtime/plugin/vimballPlugin.vim +++ b/runtime/plugin/vimballPlugin.vim @@ -1,6 +1,6 @@ " vimballPlugin : construct a file containing both paths and files " Author: Charles E. Campbell, Jr. -" Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. +" Copyright: (c) 2004-2007 by Charles E. Campbell, Jr. " The VIM LICENSE applies to Vimball.vim, and Vimball.txt " (see |copyright|) except use "Vimball" instead of "Vim". " No warranty, express or implied. @@ -16,18 +16,18 @@ if &cp || exists("g:loaded_vimballPlugin") finish endif -let g:loaded_vimballPlugin = 1 +let g:loaded_vimballPlugin = "v27" let s:keepcpo = &cpo set cpo&vim " ------------------------------------------------------------------------------ " Public Interface: {{{1 -com! -ra -complete=dir -na=+ -bang MkVimball call vimball#MkVimball(,,0,) -com! -na=? -complete=dir UseVimball call vimball#Vimball(1,) -com! -na=0 VimballList call vimball#Vimball(0) -com! -na=* -complete=dir RmVimball call vimball#RmVimball() +com! -ra -complete=file -na=+ -bang MkVimball call vimball#MkVimball(,,0,) +com! -na=? -complete=dir UseVimball call vimball#Vimball(1,) +com! -na=0 VimballList call vimball#Vimball(0) +com! -na=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball()|call vimball#RestoreSettings() au BufEnter *.vba.gz,*.vba.bz2,*.vba.zip call vimball#Decompress(expand("")) -au BufEnter *.vba setlocal noma bt=nofile fmr=[[[,]]] fdm=marker|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)") +au BufEnter *.vba setlocal ff=unix noma bt=nofile fmr=[[[,]]] fdm=marker|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)") " ===================================================================== " Restoration And Modelines: {{{1 diff --git a/runtime/spell/cleanadd.vim b/runtime/spell/cleanadd.vim --- a/runtime/spell/cleanadd.vim +++ b/runtime/spell/cleanadd.vim @@ -1,6 +1,6 @@ " Vim script to clean the ll.xxxxx.add files of commented out entries " Author: Antonio Colombo, Bram Moolenaar -" Last Update: 2006 Jan 19 +" Last Update: 2008 Jun 3 " Time in seconds after last time an ll.xxxxx.add file was updated " Default is one second. @@ -14,12 +14,19 @@ endif " Delete all comment lines, except the ones starting with ##. for s:fname in split(globpath(&rtp, "spell/*.add"), "\n") if filewritable(s:fname) && localtime() - getftime(s:fname) > g:spell_clean_limit - silent exe "tab split " . escape(s:fname, ' \') - echo "Processing" s:fname + if exists('*fnameescape') + let s:f = fnameescape(s:fname) + else + let s:f = escape(s:fname, ' \|<') + endif + silent exe "tab split " . s:f + echo "Processing" s:f silent! g/^#[^#]/d silent update close + unlet s:f endif endfor +unlet s:fname echo "Done" diff --git a/runtime/syntax/cmusrc.vim b/runtime/syntax/cmusrc.vim --- a/runtime/syntax/cmusrc.vim +++ b/runtime/syntax/cmusrc.vim @@ -1,6 +1,6 @@ " Vim syntax file " Maintainer: Nikolai Weibull -" Latest Revision: 2006-07-22 +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish @@ -9,7 +9,7 @@ endif let s:cpo_save = &cpo set cpo&vim -setlocal iskeyword=@,48-57,_,- +setlocal iskeyword+=- syn keyword cmusrcTodo contained TODO FIXME XXX NOTE diff --git a/runtime/syntax/gp.vim b/runtime/syntax/gp.vim --- a/runtime/syntax/gp.vim +++ b/runtime/syntax/gp.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: gp (version 2.2) +" Language: gp (version 2.4) " Maintainer: Karim Belabas -" Last change: 2006 Apr 12 +" Last change: 2007 Oct 1 " URL: http://pari.math.u-bordeaux.fr if version < 600 @@ -15,7 +15,7 @@ syntax keyword gpStatement break return syntax keyword gpConditional if syntax keyword gpRepeat until while for fordiv forprime forstep forvec " storage class -syntax keyword gpScope local global +syntax keyword gpScope my local global " defaults syntax keyword gpInterfaceKey colors compatible datadir debug debugfiles syntax keyword gpInterfaceKey debugmem echo factor_add_primes format help diff --git a/runtime/syntax/manual.vim b/runtime/syntax/manual.vim --- a/runtime/syntax/manual.vim +++ b/runtime/syntax/manual.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Bram Moolenaar -" Last Change: 2001 Jun 04 +" Last Change: 2008 Jan 26 " This file is used for ":syntax manual". " It installs the Syntax autocommands, but no the FileType autocommands. @@ -17,9 +17,12 @@ endif let syntax_manual = 1 " Remove the connection between FileType and Syntax autocommands. -silent! au! syntaxset FileType +if exists('#syntaxset') + au! syntaxset FileType +endif " If the GUI is already running, may still need to install the FileType menu. -if has("gui_running") && !exists("did_install_syntax_menu") +" Don't do it when the 'M' flag is included in 'guioptions'. +if has("menu") && has("gui_running") && !exists("did_install_syntax_menu") && &guioptions !~# 'M' source $VIMRUNTIME/menu.vim endif diff --git a/runtime/syntax/msmessages.vim b/runtime/syntax/msmessages.vim new file mode 100644 --- /dev/null +++ b/runtime/syntax/msmessages.vim @@ -0,0 +1,135 @@ +" Vim syntax file +" Language: MS Message Text files (*.mc) +" Maintainer: Kevin Locke +" Last Change: 2008 April 09 +" Location: http://kevinlocke.name/programs/vim/syntax/msmessages.vim + +" See format description at +" This file is based on the rc.vim and c.vim + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Common MS Messages keywords +syn case ignore +syn keyword msmessagesIdentifier MessageIdTypedef +syn keyword msmessagesIdentifier SeverityNames +syn keyword msmessagesIdentifier FacilityNames +syn keyword msmessagesIdentifier LanguageNames +syn keyword msmessagesIdentifier OutputBase + +syn keyword msmessagesIdentifier MessageId +syn keyword msmessagesIdentifier Severity +syn keyword msmessagesIdentifier Facility +syn keyword msmessagesIdentifier OutputBase + +syn match msmessagesIdentifier /\/ nextgroup=msmessagesIdentEq skipwhite +syn match msmessagesIdentEq transparent /=/ nextgroup=msmessagesIdentDef skipwhite contained +syn match msmessagesIdentDef display /\w\+/ contained +" Note: The Language keyword is highlighted as part of an msmessagesLangEntry + +" Set value +syn case match +syn region msmessagesSet start="(" end=")" transparent fold contains=msmessagesName keepend +syn match msmessagesName /\w\+/ nextgroup=msmessagesSetEquals skipwhite contained +syn match msmessagesSetEquals /=/ display transparent nextgroup=msmessagesNumVal skipwhite contained +syn match msmessagesNumVal display transparent "\<\d\|\.\d" contains=msmessagesNumber,msmessagesFloat,msmessagesOctalError,msmessagesOctal nextgroup=msmessagesValSep +syn match msmessagesValSep /:/ display nextgroup=msmessagesNameDef contained +syn match msmessagesNameDef /\w\+/ display contained + + +" Comments are converted to C source (by removing leading ;) +" So we highlight the comments as C +syn include @msmessagesC syntax/c.vim +unlet b:current_syntax +syn region msmessagesCComment matchgroup=msmessagesComment start=/;/ end=/$/ contains=@msmessagesC keepend + +" String and Character constants +" Highlight special characters (those which have a escape) differently +syn case ignore +syn region msmessagesLangEntry start=/\\s*=\s*\S\+\s*$/hs=e+1 end=/^\./ contains=msmessagesFormat,msmessagesLangEntryEnd,msmessagesLanguage keepend +syn match msmessagesLanguage /\" +"hex number +syn match msmessagesNumber display contained "\<0x\x\+\(u\=l\{0,2}\|ll\=u\)\>" +" Flag the first zero of an octal number as something special +syn match msmessagesOctal display contained "\<0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=msmessagesOctalZero +syn match msmessagesOctalZero display contained "\<0" +" flag an octal number with wrong digits +syn match msmessagesOctalError display contained "\<0\o*[89]\d*" +syn match msmessagesFloat display contained "\d\+f" +"floating point number, with dot, optional exponent +syn match msmessagesFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=" +"floating point number, starting with a dot, optional exponent +syn match msmessagesFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" +"floating point number, without dot, with exponent +syn match msmessagesFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>" +"hexadecimal floating point number, optional leading digits, with dot, with exponent +syn match msmessagesFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>" +"hexadecimal floating point number, with leading digits, optional dot, with exponent +syn match msmessagesFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>" + +" Types (used in MessageIdTypedef statement) +syn case match +syn keyword msmessagesType int long short char +syn keyword msmessagesType signed unsigned +syn keyword msmessagesType size_t ssize_t sig_atomic_t +syn keyword msmessagesType int8_t int16_t int32_t int64_t +syn keyword msmessagesType uint8_t uint16_t uint32_t uint64_t +syn keyword msmessagesType int_least8_t int_least16_t int_least32_t int_least64_t +syn keyword msmessagesType uint_least8_t uint_least16_t uint_least32_t uint_least64_t +syn keyword msmessagesType int_fast8_t int_fast16_t int_fast32_t int_fast64_t +syn keyword msmessagesType uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t +syn keyword msmessagesType intptr_t uintptr_t +syn keyword msmessagesType intmax_t uintmax_t +" Add some Windows datatypes that will be common in msmessages files +syn keyword msmessagesType BYTE CHAR SHORT SIZE_T SSIZE_T TBYTE TCHAR UCHAR USHORT +syn keyword msmessagesType DWORD DWORDLONG DWORD32 DWORD64 +syn keyword msmessagesType INT INT32 INT64 UINT UINT32 UINT64 +syn keyword msmessagesType LONG LONGLONG LONG32 LONG64 +syn keyword msmessagesType ULONG ULONGLONG ULONG32 ULONG64 + +" Sync to language entries, since they should be most common +syn sync match msmessagesLangSync grouphere msmessagesLangEntry "\" contains=netrwTreeBar + syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar + syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar + syn match netrwHdr "\(\S\+ \)*\S\+\.h\>" contains=netrwTreeBar + syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar + syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar + syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar + syn match netrwTags "\" contains=netrwTreeBar + syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar + syn match netrwTilde "\(\S\+ \)*\S\+\~\>" contains=netrwTreeBar + syn match netrwTmp "\\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar +endif + " --------------------------------------------------------------------- " Highlighting Links: {{{1 -if !exists("did_drchip_dbg_syntax") +if !exists("did_drchip_netrwlist_syntax") let did_drchip_netrwlist_syntax= 1 hi link netrwClassify Function hi link netrwCmdSep Delimiter @@ -56,13 +75,26 @@ if !exists("did_drchip_dbg_syntax") hi link netrwHidePat Statement hi link netrwList Statement hi link netrwVersion Identifier - hi link netrwSymLink Special + hi link netrwSymLink Question hi link netrwExe PreProc hi link netrwDateSep Delimiter + hi link netrwTreeBar Special hi link netrwTimeSep netrwDateSep hi link netrwComma netrwComment hi link netrwHide netrwComment + hi link netrwMarkFile Identifier + + " special syntax highlighting (see :he g:netrw_special_syntax) + hi link netrwBak NonText + hi link netrwCompress Folded + hi link netrwData DiffChange + hi link netrwLib DiffChange + hi link netrwMakefile DiffChange + hi link netrwObj Folded + hi link netrwTilde Folded + hi link netrwTmp Folded + hi link netrwTags Folded endif " Current Syntax: {{{1 diff --git a/runtime/syntax/pdf.vim b/runtime/syntax/pdf.vim new file mode 100644 --- /dev/null +++ b/runtime/syntax/pdf.vim @@ -0,0 +1,73 @@ +" Vim syntax file +" Language: PDF +" Maintainer: Tim Pope +" Last Change: 2007 Dec 16 + +if exists("b:current_syntax") + finish +endif + +if !exists("main_syntax") + let main_syntax = 'pdf' +endif + +syn include @pdfXML syntax/xml.vim + +syn case match + +syn cluster pdfObjects contains=pdfBoolean,pdfConstant,pdfNumber,pdfFloat,pdfName,pdfHexString,pdfString,pdfArray,pdfHash,pdfReference,pdfComment +syn keyword pdfBoolean true false contained +syn keyword pdfConstant null contained +syn match pdfNumber "[+-]\=\<\d\+\>" +syn match pdfFloat "[+-]\=\<\%(\d\+\.\|\d*\.\d\+\)\>" contained + +syn match pdfNameError "#\X\|#\x\X\|#00" contained containedin=pdfName +syn match pdfSpecialChar "#\x\x" contained containedin=pdfName +syn match pdfName "/[^[:space:]\[\](){}<>/]*" contained +syn match pdfHexError "[^[:space:][:xdigit:]<>]" contained +"syn match pdfHexString "<\s*\x[^<>]*\x\s*>" contained contains=pdfHexError +"syn match pdfHexString "<\s*\x\=\s*>" contained +syn region pdfHexString matchgroup=pdfDelimiter start="<<\@!" end=">" contained contains=pdfHexError +syn match pdfStringError "\\." contained containedin=pdfString +syn match pdfSpecialChar "\\\%(\o\{1,3\}\|[nrtbf()\\]\)" contained containedin=pdfString +syn region pdfString matchgroup=pdfDelimiter start="\\\@>" contains=@pdfObjects contained +syn match pdfReference "\<\d\+\s\+\d\+\s\+R\>" +"syn keyword pdfOperator R contained containedin=pdfReference + +syn region pdfObject matchgroup=pdfType start="\" end="\" contains=@pdfObjects +syn region pdfObject matchgroup=pdfType start="\ " Original author: Dirk van Deun @@ -265,6 +265,9 @@ if exists("b:is_chicken") || exists("is_ syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC endif + " suggested by Alex Queiroz + syn match schemeExtSyntax oneline "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" + syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+ endif " Synchronization and the wrapping up... diff --git a/runtime/syntax/tcsh.vim b/runtime/syntax/tcsh.vim --- a/runtime/syntax/tcsh.vim +++ b/runtime/syntax/tcsh.vim @@ -1,7 +1,6 @@ -" Vim syntax file -" Language: C-shell (tcsh) -" Maintainer: Gautam Iyer -" Last Modified: Thu 16 Nov 2006 01:07:04 PM PST +" tcsh.vim: Vim syntax file for tcsh scripts +" Maintainer: Gautam Iyer +" Modified: Sat 16 Jun 2007 04:52:12 PM PDT " " Description: We break up each statement into a "command" and an "end" part. " All groups are either a "command" or part of the "end" of a statement (ie @@ -13,64 +12,118 @@ " causes history to come up as a keyword, which we want to avoid. " Quit when a syntax file was already loaded -if exists("b:current_syntax") +if exists('b:current_syntax') finish endif +let s:oldcpo = &cpo +set cpo&vim " Line continuation is used + +setlocal iskeyword+=- + syn case match " ----- Clusters ----- syn cluster tcshModifiers contains=tcshModifier,tcshModifierError syn cluster tcshQuoteList contains=tcshDQuote,tcshSQuote,tcshBQuote -syn cluster tcshStatementEnds contains=@tcshQuoteList,tcshComment,tcshUsrVar,TcshArgv,tcshSubst,tcshRedir,tcshMeta,tcshHereDoc,tcshSpecial,tcshArguement -syn cluster tcshStatements contains=tcshBuiltins,tcshCommands,tcshSet,tcshSetEnv,tcshAlias,tcshIf,tcshWhile +syn cluster tcshStatementEnds contains=@tcshQuoteList,tcshComment,@tcshVarList,tcshRedir,tcshMeta,tcshHereDoc,tcshSpecial,tcshArguement +syn cluster tcshStatements contains=tcshBuiltin,tcshCommands,tcshIf,tcshWhile syn cluster tcshVarList contains=tcshUsrVar,tcshArgv,tcshSubst +syn cluster tcshConditions contains=tcshCmdSubst,tcshParenExpr,tcshOperator,tcshNumber,@tcshVarList + +" ----- Errors ----- +" Define first, so can be easily overridden. +syn match tcshError contained '\v\S.+' " ----- Statements ----- " Tcsh commands: Any filename / modifiable variable (must be first!) syn match tcshCommands '\v[a-zA-Z0-9\\./_$:-]+' contains=tcshSpecial,tcshUsrVar,tcshArgv,tcshVarError nextgroup=tcshStatementEnd -" Builtin commands except (un)set(env), (un)alias, if, while, else -syn keyword tcshBuiltins nextgroup=tcshStatementEnd alloc bg bindkey break breaksw builtins bye case cd chdir complete continue default dirs echo echotc end endif endsw eval exec exit fg filetest foreach getspath getxvers glob goto hashstat history hup inlib jobs kill limit log login logout ls ls-F migrate newgrp nice nohup notify onintr popd printenv pushd rehash repeat rootnode sched setpath setspath settc setty setxvers shift source stop suspend switch telltc time umask uncomplete unhash universe unlimit ver wait warp watchlog where which +" Builtin commands except those treated specially. Currently (un)set(env), +" (un)alias, if, while, else, bindkey +syn keyword tcshBuiltin nextgroup=tcshStatementEnd alloc bg break breaksw builtins bye case cd chdir complete continue default dirs echo echotc end endif endsw eval exec exit fg filetest foreach getspath getxvers glob goto hashstat history hup inlib jobs kill limit log login logout ls ls-F migrate newgrp nice nohup notify onintr popd printenv pushd rehash repeat rootnode sched setpath setspath settc setty setxvers shift source stop suspend switch telltc time umask uncomplete unhash universe unlimit ver wait warp watchlog where which -" StatementEnd is anything after a builtin / command till the lexical end of a +" StatementEnd is anything after a built-in / command till the lexical end of a " statement (;, |, ||, |&, && or end of line) -syn region tcshStatementEnd transparent contained matchgroup=tcshBuiltins start='' end='\v\\@|$" contains=tcshOperator,tcshNumber,@tcshStatementEnds +" if statements +syn keyword tcshIf nextgroup=tcshIfEnd skipwhite if +syn region tcshIfEnd contained start='\S' skip='\\$' matchgroup=tcshBuiltin end='\v|$' contains=@tcshConditions,tcshSpecial,@tcshStatementEnds +syn region tcshIfEnd contained matchgroup=tcshBuiltin contains=@tcshConditions,tcshSpecial start='(' end='\v\)%(\s+then>)?' skipwhite nextgroup=@tcshStatementEnds +syn region tcshIfEnd contained matchgroup=tcshBuiltin contains=tcshCommands,tcshSpecial start='\v\{\s+' end='\v\s+\}%(\s+then>)?' skipwhite nextgroup=@tcshStatementEnds keepend -" else statements (nextgroup if) -syn keyword tcshElse nextgroup=tcshIf skipwhite else +" else statements +syn keyword tcshBuiltin nextgroup=tcshIf skipwhite else " while statements (contains expressions / operators) -syn keyword tcshWhile nextgroup=tcshWhEnd while -syn region tcshWhEnd contained transparent matchgroup=tcshBuiltins start='' skip="\\$" end="\v$" contains=tcshOperator,tcshNumber,@tcshStatementEnds +syn keyword tcshBuiltin nextgroup=@tcshConditions,tcshSpecial skipwhite while + +" Conditions (for if and while) +syn region tcshParenExpr contained contains=@tcshConditions,tcshSpecial matchgroup=tcshBuiltin start='(' end=')' +syn region tcshCmdSubst contained contains=tcshCommands matchgroup=tcshBuiltin start='\v\{\s+' end='\v\s+\}' keepend + +" Bindkey. Internal editor functions +syn keyword tcshBindkeyFuncs contained backward-char backward-delete-char + \ backward-delete-word backward-kill-line backward-word + \ beginning-of-line capitalize-word change-case + \ change-till-end-of-line clear-screen complete-word + \ complete-word-fwd complete-word-back complete-word-raw + \ copy-prev-word copy-region-as-kill dabbrev-expand delete-char + \ delete-char-or-eof delete-char-or-list + \ delete-char-or-list-or-eof delete-word digit digit-argument + \ down-history downcase-word end-of-file end-of-line + \ exchange-point-and-mark expand-glob expand-history expand-line + \ expand-variables forward-char forward-word + \ gosmacs-transpose-chars history-search-backward + \ history-search-forward insert-last-word i-search-fwd + \ i-search-back keyboard-quit kill-line kill-region + \ kill-whole-line list-choices list-choices-raw list-glob + \ list-or-eof load-average magic-space newline normalize-path + \ normalize-command overwrite-mode prefix-meta quoted-insert + \ redisplay run-fg-editor run-help self-insert-command + \ sequence-lead-in set-mark-command spell-word spell-line + \ stuff-char toggle-literal-history transpose-chars + \ transpose-gosling tty-dsusp tty-flush-output tty-sigintr + \ tty-sigquit tty-sigtsusp tty-start-output tty-stop-output + \ undefined-key universal-argument up-history upcase-word + \ vi-beginning-of-next-word vi-add vi-add-at-eol vi-chg-case + \ vi-chg-meta vi-chg-to-eol vi-cmd-mode vi-cmd-mode-complete + \ vi-delprev vi-delmeta vi-endword vi-eword vi-char-back + \ vi-char-fwd vi-charto-back vi-charto-fwd vi-insert + \ vi-insert-at-bol vi-repeat-char-fwd vi-repeat-char-back + \ vi-repeat-search-fwd vi-repeat-search-back vi-replace-char + \ vi-replace-mode vi-search-back vi-search-fwd vi-substitute-char + \ vi-substitute-line vi-word-back vi-word-fwd vi-undo vi-zero + \ which-command yank yank-pop e_copy_to_clipboard + \ e_paste_from_clipboard e_dosify_next e_dosify_prev e_page_up + \ e_page_down +syn keyword tcshBuiltin nextgroup=tcshBindkeyEnd bindkey +syn region tcshBindkeyEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$' contains=@tcshQuoteList,tcshComment,@tcshVarList,tcshMeta,tcshSpecial,tcshArguement,tcshBindkeyFuncs " Expressions start with @. -syn match tcshExprStart "\v\@\s+" nextgroup=tcshExprVar -syn match tcshExprVar contained "\v\h\w*%(\[\d+\])?" contains=tcshShellVar,tcshEnvVar nextgroup=tcshExprOp -syn match tcshExprOp contained "++\|--" -syn match tcshExprOp contained "\v\s*\=" nextgroup=tcshExprEnd -syn match tcshExprEnd contained "\v.*$"hs=e+1 contains=tcshOperator,tcshNumber,@tcshVarList -syn match tcshExprEnd contained "\v.{-};"hs=e contains=tcshOperator,tcshNumber,@tcshVarList +syn match tcshExprStart '\v\@\s+' nextgroup=tcshExprVar +syn match tcshExprVar contained '\v\h\w*%(\[\d+\])?' contains=tcshShellVar,tcshEnvVar nextgroup=tcshExprOp +syn match tcshExprOp contained '++\|--' +syn match tcshExprOp contained '\v\s*\=' nextgroup=tcshExprEnd +syn match tcshExprEnd contained '\v.*$'hs=e+1 contains=@tcshConditions +syn match tcshExprEnd contained '\v.{-};'hs=e contains=@tcshConditions " ----- Comments: ----- syn match tcshComment '#\s.*' contains=tcshTodo,tcshCommentTi,@Spell @@ -85,12 +138,12 @@ syn match tcshTodo contained '\v\c " want VIM to assume that no backslash quote constructs exist. " Backquotes are treated as commands, and are not contained in anything -if(exists("tcsh_backslash_quote") && tcsh_backslash_quote == 0) - syn region tcshSQuote keepend contained start="\v\\@, >>, >>&, >>!, >>&!] -syn match tcshRedir contained "\v\<|\>\>?\&?!?" +syn match tcshRedir contained '\v\<|\>\>?\&?!?' -" Metachars -syn match tcshMeta contained "\v[]{}*?[]" +" Meta-chars +syn match tcshMeta contained '\v[]{}*?[]' -" Here Documents (<<) -syn region tcshHereDoc contained matchgroup=tcshRedir start="\v\<\<\s*\z(\h\w*)" end="^\z1$" contains=@tcshVarList,tcshSpecial -syn region tcshHereDoc contained matchgroup=tcshRedir start="\v\<\<\s*'\z(\h\w*)'" start='\v\<\<\s*"\z(\h\w*)"$' start="\v\<\<\s*\\\z(\h\w*)$" end="^\z1$" +" Here documents (<<) +syn region tcshHereDoc contained matchgroup=tcshShellVar start='\v\<\<\s*\z(\h\w*)' end='^\z1$' contains=@tcshVarList,tcshSpecial +syn region tcshHereDoc contained matchgroup=tcshShellVar start="\v\<\<\s*'\z(\h\w*)'" start='\v\<\<\s*"\z(\h\w*)"$' start='\v\<\<\s*\\\z(\h\w*)$' end='^\z1$' " Operators -syn match tcshOperator contained "&&\|!\~\|!=\|<<\|<=\|==\|=\~\|>=\|>>\|\*\|\^\|\~\|||\|!\|%\|&\|+\|-\|/\|<\|>\||" -syn match tcshOperator contained "[(){}]" +syn match tcshOperator contained '&&\|!\~\|!=\|<<\|<=\|==\|=\~\|>=\|>>\|\*\|\^\|\~\|||\|!\|%\|&\|+\|-\|/\|<\|>\||' +"syn match tcshOperator contained '[(){}]' " Numbers -syn match tcshNumber contained "\v<-?\d+>" +syn match tcshNumber contained '\v<-?\d+>' -" Arguements -syn match tcshArguement contained "\v\s@<=-(\w|-)*" +" Arguments +syn match tcshArguement contained '\v\s@<=-(\w|-)*' -" Special charectors -syn match tcshSpecial contained "\v\\@ +" Last Change: 2001 May 27 + +aunmenu * + +silent! unlet did_install_default_menus +silent! unlet did_install_syntax_menu +if exists("did_menu_trans") + menutrans clear + unlet did_menu_trans +endif + +silent! unlet find_help_dialog + +silent! unlet menutrans_help_dialog +silent! unlet menutrans_path_dialog +silent! unlet menutrans_tags_dialog +silent! unlet menutrans_textwidth_dialog +silent! unlet menutrans_fileformat_dialog +silent! unlet menutrans_no_file + +" vim: set sw=2 : diff --git a/runtime/tutor/runtime/macmap.vim b/runtime/tutor/runtime/macmap.vim new file mode 100644 --- /dev/null +++ b/runtime/tutor/runtime/macmap.vim @@ -0,0 +1,75 @@ +" System gvimrc file for Mac OS X +" Author: Benji Fisher +" Last Change: Thu Mar 09 09:00 AM 2006 EST +" +" Define Mac-standard keyboard shortcuts. + +" We don't change 'cpoptions' here, because it would not be set properly when +" a .vimrc file is found later. Thus don't use line continuation and use +" in mappings. + +nnoremap :confirm enew +vmap gv +imap +cmap +omap + +nnoremap :browse confirm e +vmap gv +imap +cmap +omap + +nnoremap :if winheight(2) < 0 confirm enew else confirm close endif +vmap gv +imap +cmap +omap + +nnoremap :if expand("%") == ""browse confirm w elseconfirm wendif +vmap gv +imap +cmap +omap + +nnoremap :browse confirm saveas +vmap gv +imap +cmap +omap + +" From the Edit menu of SimpleText: +nnoremap u +vmap gv +imap +cmap +omap + +vnoremap "+x + +vnoremap "+y + +cnoremap + +nnoremap "+gP +cnoremap + +execute 'vnoremap