forked from aniani/vim
updated for version 7.0219
This commit is contained in:
@@ -4,12 +4,18 @@ These are functions used by plugins and for general use. They will be loaded
|
|||||||
automatically when the function is invoked. See ":help autoload".
|
automatically when the function is invoked. See ":help autoload".
|
||||||
|
|
||||||
gzip.vim for editing compressed files
|
gzip.vim for editing compressed files
|
||||||
netrw.vim browsing (remote) directories and editing remote files
|
netrw*.vim browsing (remote) directories and editing remote files
|
||||||
tar.vim browsing tar files
|
tar.vim browsing tar files
|
||||||
zip.vim browsing zip files
|
zip.vim browsing zip files
|
||||||
|
paste.vim common code for mswin.vim, menu.vim and macmap.vim
|
||||||
|
spellfile.vim downloading of a missing spell file
|
||||||
|
|
||||||
Occult completion files:
|
Omni completion files:
|
||||||
ccomplete.vim C
|
ccomplete.vim C
|
||||||
csscomplete.vim HTML / CSS
|
csscomplete.vim HTML / CSS
|
||||||
htmlcomplete.vim HTML
|
htmlcomplete.vim HTML
|
||||||
|
javascriptcomplete.vim Javascript
|
||||||
|
phpcomplete.vim PHP
|
||||||
|
pycomplete.vim Python
|
||||||
|
syntaxcomplete.vim from syntax highlighting
|
||||||
|
xmlcomplete.vim XML (uses files in the xml directory)
|
||||||
|
39
runtime/autoload/paste.vim
Normal file
39
runtime/autoload/paste.vim
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
" Vim support file to help with paste mappings and menus
|
||||||
|
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||||
|
" Last Change: 2006 Mar 09
|
||||||
|
|
||||||
|
" Define the string to use for items that are present both in Edit, Popup and
|
||||||
|
" Toolbar menu. Also used in mswin.vim and macmap.vim.
|
||||||
|
|
||||||
|
" Pasting blockwise and linewise selections is not possible in Insert and
|
||||||
|
" Visual mode without the +virtualedit feature. They are pasted as if they
|
||||||
|
" were characterwise instead. Add to that some tricks to leave the cursor in
|
||||||
|
" the right position, also for "gi".
|
||||||
|
if has("virtualedit")
|
||||||
|
let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
|
||||||
|
let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
|
||||||
|
let paste#paste_cmd['i'] = '<Esc>' . paste#paste_cmd['n'] . 'gi'
|
||||||
|
|
||||||
|
func! paste#Paste()
|
||||||
|
let ove = &ve
|
||||||
|
set ve=all
|
||||||
|
normal! `^
|
||||||
|
if @+ != ''
|
||||||
|
normal! "+gP
|
||||||
|
endif
|
||||||
|
let c = col(".")
|
||||||
|
normal! i
|
||||||
|
if col(".") < c " compensate for i<ESC> moving the cursor left
|
||||||
|
normal! l
|
||||||
|
endif
|
||||||
|
let &ve = ove
|
||||||
|
endfunc
|
||||||
|
else
|
||||||
|
let paste#paste_cmd = {'n': "\"=@+.'xy'<CR>gPFx\"_2x"}
|
||||||
|
let paste#paste_cmd['v'] = '"-c<Esc>gix<Esc>' . paste#paste_cmd['n'] . '"_x'
|
||||||
|
let paste#paste_cmd['i'] = 'x<Esc>' . paste#paste_cmd['n'] . '"_s'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if has("virtualedit")
|
||||||
|
else
|
||||||
|
endif
|
@@ -89,6 +89,7 @@ DOCS = \
|
|||||||
sponsor.txt \
|
sponsor.txt \
|
||||||
starting.txt \
|
starting.txt \
|
||||||
spell.txt \
|
spell.txt \
|
||||||
|
sql.txt \
|
||||||
syntax.txt \
|
syntax.txt \
|
||||||
tabpage.txt \
|
tabpage.txt \
|
||||||
tagsrch.txt \
|
tagsrch.txt \
|
||||||
@@ -213,6 +214,7 @@ HTMLS = \
|
|||||||
sponsor.html \
|
sponsor.html \
|
||||||
starting.html \
|
starting.html \
|
||||||
spell.html \
|
spell.html \
|
||||||
|
sql.html \
|
||||||
syntax.html \
|
syntax.html \
|
||||||
tabpage.html \
|
tabpage.html \
|
||||||
tagsrch.html \
|
tagsrch.html \
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
*netbeans.txt* For Vim version 7.0aa. Last change: 2006 Feb 05
|
*netbeans.txt* For Vim version 7.0aa. Last change: 2006 Mar 09
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Gordon Prieur
|
VIM REFERENCE MANUAL by Gordon Prieur
|
||||||
@@ -259,10 +259,19 @@ problems and has been fixed in 2.2. To decrease the likelihood of this
|
|||||||
confusion happening again, netbeans_saved() has been renamed to
|
confusion happening again, netbeans_saved() has been renamed to
|
||||||
netbeans_save_buffer().
|
netbeans_save_buffer().
|
||||||
|
|
||||||
|
We are now at version 2.3. For the differences between 2.2 and 2.3 search for
|
||||||
|
"2.3" below.
|
||||||
|
|
||||||
The messages are currently sent over a socket. Since the messages are in
|
The messages are currently sent over a socket. Since the messages are in
|
||||||
plain UTF-8 text this protocol could also be used with any other communication
|
plain UTF-8 text this protocol could also be used with any other communication
|
||||||
mechanism.
|
mechanism.
|
||||||
|
|
||||||
|
To see an example implementation look at the gvim tool in Agide. Currently
|
||||||
|
found here:
|
||||||
|
http://cvs.sf.net/viewcvs.py/a-a-p/Agide/Tools/GvimTool.py?view=markup
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
10.1 Kinds of messages |nb-messages|
|
10.1 Kinds of messages |nb-messages|
|
||||||
10.2 Terms |nb-terms|
|
10.2 Terms |nb-terms|
|
||||||
10.3 Commands |nb-commands|
|
10.3 Commands |nb-commands|
|
||||||
@@ -612,11 +621,22 @@ getText Return the contents of the buffer as a string.
|
|||||||
insert off text
|
insert off text
|
||||||
Insert "text" before position "off". "text" is a string
|
Insert "text" before position "off". "text" is a string
|
||||||
argument, "off" a number.
|
argument, "off" a number.
|
||||||
|
"off" should have a "\n" (newline) at the end of each line.
|
||||||
|
Or "\r\n" when 'fileformat' is "dos". When using "insert" in
|
||||||
|
an empty buffer Vim will set 'fileformat' accordingly.
|
||||||
|
When "off" points to the start of a line the text is inserted
|
||||||
|
above this line. Thus when "off" is zero lines are inserted
|
||||||
|
before the first line.
|
||||||
|
When "off" points after the start of a line, possibly on the
|
||||||
|
NUL at the end of a line, the first line of text is appended
|
||||||
|
to this line. Further lines come below it.
|
||||||
Possible replies:
|
Possible replies:
|
||||||
123 no problem
|
123 no problem
|
||||||
123 !message failed
|
123 !message failed
|
||||||
Note that the message in the reply is not quoted.
|
Note that the message in the reply is not quoted.
|
||||||
Also sets the current buffer, if necessary.
|
Also sets the current buffer, if necessary.
|
||||||
|
Does not move the cursor to the changed text.
|
||||||
|
Resets undo information.
|
||||||
|
|
||||||
remove off length
|
remove off length
|
||||||
Delete "length" bytes of text at position "off". Both
|
Delete "length" bytes of text at position "off". Both
|
||||||
|
@@ -1,10 +1,13 @@
|
|||||||
" SQL filetype plugin file
|
" SQL filetype plugin file
|
||||||
" Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase)
|
" Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase)
|
||||||
" Version: 0.08
|
" Version: 1.0
|
||||||
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
|
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
|
||||||
" Last Change: Mon Feb 21 2005 7:27:36 AM
|
" Last Change: Wed Jan 11 2006 10:04:55 AM
|
||||||
" Download: http://vim.sourceforge.net/script.php?script_id=454
|
" Download: http://vim.sourceforge.net/script.php?script_id=454
|
||||||
|
|
||||||
|
" For more details please use:
|
||||||
|
" :h sql.txt
|
||||||
|
"
|
||||||
" This file should only contain values that are common to all SQL languages
|
" This file should only contain values that are common to all SQL languages
|
||||||
" Oracle, Microsoft SQL Server, Sybase ASA/ASE, MySQL, and so on
|
" Oracle, Microsoft SQL Server, Sybase ASA/ASE, MySQL, and so on
|
||||||
" If additional features are required create:
|
" If additional features are required create:
|
||||||
@@ -12,6 +15,22 @@
|
|||||||
" .vim/after/ftplugin/sql.vim (Unix)
|
" .vim/after/ftplugin/sql.vim (Unix)
|
||||||
" to override and add any of your own settings.
|
" to override and add any of your own settings.
|
||||||
|
|
||||||
|
|
||||||
|
" This file also creates a command, SQLSetType, which allows you to change
|
||||||
|
" SQL dialects on the fly. For example, if I open an Oracle SQL file, it
|
||||||
|
" is color highlighted appropriately. If I open an Informix SQL file, it
|
||||||
|
" will still be highlighted according to Oracles settings. By running:
|
||||||
|
" :SQLSetType sqlinformix
|
||||||
|
"
|
||||||
|
" All files called sqlinformix.vim will be loaded from the indent and syntax
|
||||||
|
" directories. This allows you to easily flip SQL dialects on a per file
|
||||||
|
" basis. NOTE: you can also use completion:
|
||||||
|
" :SQLSetType <tab>
|
||||||
|
"
|
||||||
|
" To change the default dialect, add the following to your vimrc:
|
||||||
|
" let g:sql_type_default = 'sqlanywhere'
|
||||||
|
|
||||||
|
|
||||||
" Only do this when not done yet for this buffer
|
" Only do this when not done yet for this buffer
|
||||||
if exists("b:did_ftplugin")
|
if exists("b:did_ftplugin")
|
||||||
finish
|
finish
|
||||||
@@ -20,8 +39,146 @@ endif
|
|||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
set cpo=
|
set cpo=
|
||||||
|
|
||||||
|
" Functions/Commands to allow the user to change SQL syntax dialects
|
||||||
|
" through the use of :SQLSetType <tab> for completion.
|
||||||
|
" This works with both Vim 6 and 7.
|
||||||
|
|
||||||
|
if !exists("*SQL_SetType")
|
||||||
|
" NOTE: You cannot use function! since this file can be
|
||||||
|
" sourced from within this function. That will result in
|
||||||
|
" an error reported by Vim.
|
||||||
|
function SQL_GetList(ArgLead, CmdLine, CursorPos)
|
||||||
|
|
||||||
|
if !exists('s:sql_list')
|
||||||
|
" Grab a list of files that contain "sql" in their names
|
||||||
|
let list_indent = globpath(&runtimepath, 'indent/*sql*')
|
||||||
|
let list_syntax = globpath(&runtimepath, 'syntax/*sql*')
|
||||||
|
let list_ftplugin = globpath(&runtimepath, 'ftplugin/*sql*')
|
||||||
|
|
||||||
|
let sqls = "\n".list_indent."\n".list_syntax."\n".list_ftplugin."\n"
|
||||||
|
|
||||||
|
" Strip out everything (path info) but the filename
|
||||||
|
" Regex
|
||||||
|
" From between two newline characters
|
||||||
|
" Non-greedily grab all characters
|
||||||
|
" Followed by a valid filename \w\+\.\w\+ (sql.vim)
|
||||||
|
" Followed by a newline, but do not include the newline
|
||||||
|
"
|
||||||
|
" Replace it with just the filename (get rid of PATH)
|
||||||
|
"
|
||||||
|
" Recursively, since there are many filenames that contain
|
||||||
|
" the word SQL in the indent, syntax and ftplugin directory
|
||||||
|
let sqls = substitute( sqls,
|
||||||
|
\ '[\n]\%(.\{-}\)\(\w\+\.\w\+\)\n\@=',
|
||||||
|
\ '\1\n',
|
||||||
|
\ 'g'
|
||||||
|
\ )
|
||||||
|
|
||||||
|
" Remove duplicates, since sqlanywhere.vim can exist in the
|
||||||
|
" sytax, indent and ftplugin directory, yet we only want
|
||||||
|
" to display the option once
|
||||||
|
let index = match(sqls, '.\{-}\ze\n')
|
||||||
|
while index > -1
|
||||||
|
" Get the first filename
|
||||||
|
let file = matchstr(sqls, '.\{-}\ze\n', index)
|
||||||
|
" Recursively replace any *other* occurrence of that
|
||||||
|
" filename with nothing (ie remove it)
|
||||||
|
let sqls = substitute(sqls, '\%>'.(index+strlen(file)).'c\<'.file.'\>\n', '', 'g')
|
||||||
|
" Move on to the next filename
|
||||||
|
let index = match(sqls, '.\{-}\ze\n', (index+strlen(file)+1))
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
" Sort the list if using version 7
|
||||||
|
if v:version >= 700
|
||||||
|
let mylist = split(sqls, "\n")
|
||||||
|
let mylist = sort(mylist)
|
||||||
|
let sqls = join(mylist, "\n")
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:sql_list = sqls
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:sql_list
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function SQL_SetType(name)
|
||||||
|
|
||||||
|
" User has decided to override default SQL scripts and
|
||||||
|
" specify a vendor specific version
|
||||||
|
" (ie Oracle, Informix, SQL Anywhere, ...)
|
||||||
|
" So check for an remove any settings that prevent the
|
||||||
|
" scripts from being executed, and then source the
|
||||||
|
" appropriate Vim scripts.
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
unlet b:did_ftplugin
|
||||||
|
endif
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
" echomsg 'SQLSetType - clearing syntax'
|
||||||
|
syntax clear
|
||||||
|
endif
|
||||||
|
if exists("b:did_indent")
|
||||||
|
" echomsg 'SQLSetType - clearing indent'
|
||||||
|
unlet b:did_indent
|
||||||
|
" Set these values to their defaults
|
||||||
|
setlocal indentkeys&
|
||||||
|
setlocal indentexpr&
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Ensure the name is in the correct format
|
||||||
|
let new_sql_type = substitute(a:name,
|
||||||
|
\ '\s*\([^\.]\+\)\(\.\w\+\)\?', '\L\1', '')
|
||||||
|
|
||||||
|
" Do not specify a buffer local variable if it is
|
||||||
|
" the default value
|
||||||
|
if new_sql_type == 'sql'
|
||||||
|
let new_sql_type = 'sqloracle'
|
||||||
|
endif
|
||||||
|
let b:sql_type_override = new_sql_type
|
||||||
|
|
||||||
|
" Vim will automatically source the correct files if we
|
||||||
|
" change the filetype. You cannot do this with setfiletype
|
||||||
|
" since that command will only execute if a filetype has
|
||||||
|
" not already been set. In this case we want to override
|
||||||
|
" the existing filetype.
|
||||||
|
let &filetype = 'sql'
|
||||||
|
endfunction
|
||||||
|
command! -nargs=* -complete=custom,SQL_GetList SQLSetType :call SQL_SetType(<q-args>)
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists("b:sql_type_override")
|
||||||
|
" echo 'sourcing buffer ftplugin/'.b:sql_type_override.'.vim'
|
||||||
|
if globpath(&runtimepath, 'ftplugin/'.b:sql_type_override.'.vim') != ''
|
||||||
|
exec 'runtime ftplugin/'.b:sql_type_override.'.vim'
|
||||||
|
" else
|
||||||
|
" echomsg 'ftplugin/'.b:sql_type_override.' not exist, using default'
|
||||||
|
endif
|
||||||
|
elseif exists("g:sql_type_default")
|
||||||
|
" echo 'sourcing global ftplugin/'.g:sql_type_default.'.vim'
|
||||||
|
if globpath(&runtimepath, 'ftplugin/'.g:sql_type_default.'.vim') != ''
|
||||||
|
exec 'runtime ftplugin/'.g:sql_type_default.'.vim'
|
||||||
|
" else
|
||||||
|
" echomsg 'ftplugin/'.g:sql_type_default.'.vim not exist, using default'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" If the above runtime command succeeded, do not load the default settings
|
||||||
|
if exists("b:did_ftplugin")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:undo_ftplugin = "setl comments<"
|
||||||
|
|
||||||
" Don't load another plugin for this buffer
|
" Don't load another plugin for this buffer
|
||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
|
let b:current_ftplugin = 'sql'
|
||||||
|
|
||||||
|
" Win32 can filter files in the browse dialog
|
||||||
|
if has("gui_win32") && !exists("b:browsefilter")
|
||||||
|
let b:browsefilter = "SQL Files (*.sql)\t*.sql\n" .
|
||||||
|
\ "All Files (*.*)\t*.*\n"
|
||||||
|
endif
|
||||||
|
|
||||||
" Some standard expressions for use with the matchit strings
|
" Some standard expressions for use with the matchit strings
|
||||||
let s:notend = '\%(\<end\s\+\)\@<!'
|
let s:notend = '\%(\<end\s\+\)\@<!'
|
||||||
@@ -112,69 +269,78 @@ endif
|
|||||||
" [d, [D, [_CTRL_D and so on features
|
" [d, [D, [_CTRL_D and so on features
|
||||||
" Match these values ignoring case
|
" Match these values ignoring case
|
||||||
" ie DECLARE varname INTEGER
|
" ie DECLARE varname INTEGER
|
||||||
let &l:define = '\c\(DECLARE\|IN\|OUT\|INOUT\)\s*'
|
let &l:define = '\c\<\(VARIABLE\|DECLARE\|IN\|OUT\|INOUT\)\>'
|
||||||
|
|
||||||
|
|
||||||
" Mappings to move to the next BEGIN ... END block
|
" Mappings to move to the next BEGIN ... END block
|
||||||
" \W - no characters or digits
|
" \W - no characters or digits
|
||||||
nmap <buffer> <silent> ]] :call search('\c^\s*begin\>', 'W' )<CR>
|
nmap <buffer> <silent> ]] :call search('\\c^\\s*begin\\>', 'W' )<CR>
|
||||||
nmap <buffer> <silent> [[ :call search('\c^\s*begin\>', 'bW' )<CR>
|
nmap <buffer> <silent> [[ :call search('\\c^\\s*begin\\>', 'bW' )<CR>
|
||||||
nmap <buffer> <silent> ][ :call search('\c^\s*end\W*$', 'W' )<CR>
|
nmap <buffer> <silent> ][ :call search('\\c^\\s*end\\W*$', 'W' )<CR>
|
||||||
nmap <buffer> <silent> [] :call search('\c^\s*end\W*$', 'bW' )<CR>
|
nmap <buffer> <silent> [] :call search('\\c^\\s*end\\W*$', 'bW' )<CR>
|
||||||
vmap <buffer> <silent> ]] /\c^\s*begin\><CR>
|
vmap <buffer> <silent> ]] /\\c^\\s*begin\\><CR>
|
||||||
vmap <buffer> <silent> [[ ?\c^\s*begin<CR>
|
vmap <buffer> <silent> [[ ?\\c^\\s*begin\\><CR>
|
||||||
vmap <buffer> <silent> ][ /\c^\s*end\W*$<CR>
|
vmap <buffer> <silent> ][ /\\c^\\s*end\\W*$<CR>
|
||||||
vmap <buffer> <silent> [] ?\c^\s*end\W*$<CR>
|
vmap <buffer> <silent> [] ?\\c^\\s*end\\W*$<CR>
|
||||||
|
|
||||||
|
|
||||||
|
" By default only look for CREATE statements, but allow
|
||||||
|
" the user to override
|
||||||
|
if !exists('g:ftplugin_sql_statements')
|
||||||
|
let g:ftplugin_sql_statements = 'create'
|
||||||
|
endif
|
||||||
|
|
||||||
" Predefined SQL objects what are used by the below mappings using
|
" Predefined SQL objects what are used by the below mappings using
|
||||||
" the ]} style maps.
|
" the ]} style maps.
|
||||||
" This global variable allows the users to override it's value
|
" This global variable allows the users to override it's value
|
||||||
" from within their vimrc.
|
" from within their vimrc.
|
||||||
|
" Note, you cannot use \?, since these patterns can be used to search
|
||||||
|
" backwards, you must use \{,1}
|
||||||
if !exists('g:ftplugin_sql_objects')
|
if !exists('g:ftplugin_sql_objects')
|
||||||
let g:ftplugin_sql_objects = 'function,procedure,event,' .
|
let g:ftplugin_sql_objects = 'function,procedure,event,' .
|
||||||
\ '\(existing\\|global\s\+temporary\s\+\)\?table,trigger' .
|
\ '\\(existing\\\\|global\\s\\+temporary\\s\\+\\)\\\{,1}' .
|
||||||
|
\ 'table,trigger' .
|
||||||
\ ',schema,service,publication,database,datatype,domain' .
|
\ ',schema,service,publication,database,datatype,domain' .
|
||||||
\ ',index,subscription,synchronization,view,variable'
|
\ ',index,subscription,synchronization,view,variable'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Replace all ,'s with bars, except ones with numbers after them.
|
||||||
|
" This will most likely be a \{,1} string.
|
||||||
let s:ftplugin_sql_objects =
|
let s:ftplugin_sql_objects =
|
||||||
\ '\c^\s*' .
|
\ '\\c^\\s*' .
|
||||||
\ '\(create\s\+\(or\s\+replace\s\+\)\?\)\?' .
|
\ '\\(\\(' .
|
||||||
\ '\<\(' .
|
\ substitute(g:ftplugin_sql_statements, ',\d\@!', '\\\\\\|', 'g') .
|
||||||
\ substitute(g:ftplugin_sql_objects, ',', '\\\\|', 'g') .
|
\ '\\)\\s\\+\\(or\\s\\+replace\\\s\+\\)\\{,1}\\)\\{,1}' .
|
||||||
\ '\)\>'
|
\ '\\<\\(' .
|
||||||
|
\ substitute(g:ftplugin_sql_objects, ',\d\@!', '\\\\\\|', 'g') .
|
||||||
|
\ '\\)\\>'
|
||||||
|
|
||||||
" Mappings to move to the next CREATE ... block
|
" Mappings to move to the next CREATE ... block
|
||||||
" map <buffer> <silent> ]} :call search(g:ftplugin_sql_objects, 'W' )<CR>
|
|
||||||
" nmap <buffer> <silent> [{ :call search('\c^\s*\(create\s\+\(or\s\+replace\s\+\)\?\)\?\<\(function\\|procedure\\|event\\|table\\|trigger\\|schema\)\>', 'bW' )<CR>
|
|
||||||
" exec 'nmap <buffer> <silent> ]} /'.s:ftplugin_sql_objects.'<CR>'
|
|
||||||
exec "nmap <buffer> <silent> ]} :call search('".s:ftplugin_sql_objects."', 'W')<CR>"
|
exec "nmap <buffer> <silent> ]} :call search('".s:ftplugin_sql_objects."', 'W')<CR>"
|
||||||
exec "nmap <buffer> <silent> [{ :call search('".s:ftplugin_sql_objects."', 'bW')<CR>"
|
exec "nmap <buffer> <silent> [{ :call search('".s:ftplugin_sql_objects."', 'bW')<CR>"
|
||||||
" Could not figure out how to use a :call search() string in visual mode
|
" Could not figure out how to use a :call search() string in visual mode
|
||||||
" without it ending visual mode
|
" without it ending visual mode
|
||||||
|
" Unfortunately, this will add a entry to the search history
|
||||||
exec 'vmap <buffer> <silent> ]} /'.s:ftplugin_sql_objects.'<CR>'
|
exec 'vmap <buffer> <silent> ]} /'.s:ftplugin_sql_objects.'<CR>'
|
||||||
exec 'vmap <buffer> <silent> [{ ?'.s:ftplugin_sql_objects.'<CR>'
|
exec 'vmap <buffer> <silent> [{ ?'.s:ftplugin_sql_objects.'<CR>'
|
||||||
" vmap <buffer> <silent> ]} /\c^\s*\(create\s\+\(or\s\+replace\s\+\)\?\)\?\<\(function\\|procedure\\|event\\|table\\|trigger\\|schema\)\><CR>
|
|
||||||
" vmap <buffer> <silent> [{ ?\c^\s*\(create\s\+\(or\s\+replace\s\+\)\?\)\?\<\(function\\|procedure\\|event\\|table\\|trigger\\|schema\)\><CR>
|
|
||||||
|
|
||||||
" Mappings to move to the next COMMENT
|
" Mappings to move to the next COMMENT
|
||||||
"
|
"
|
||||||
" Had to double the \ for the \| separator since this has a special
|
" Had to double the \ for the \| separator since this has a special
|
||||||
" meaning on maps
|
" meaning on maps
|
||||||
let b:comment_leader = '\(--\\|\/\/\\|\*\\|\/\*\\|\*\/\)'
|
let b:comment_leader = '\\(--\\\|\\/\\/\\\|\\*\\\|\\/\\*\\\|\\*\\/\\)'
|
||||||
" Find the start of the next comment
|
" Find the start of the next comment
|
||||||
let b:comment_start = '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
|
let b:comment_start = '^\\(\\s*'.b:comment_leader.'.*\\n\\)\\@<!'.
|
||||||
\ '\(\s*'.b:comment_leader.'\)'
|
\ '\\(\\s*'.b:comment_leader.'\\)'
|
||||||
" Find the end of the previous comment
|
" Find the end of the previous comment
|
||||||
let b:comment_end = '\(^\s*'.b:comment_leader.'.*\n\)'.
|
let b:comment_end = '\\(^\\s*'.b:comment_leader.'.*\\n\\)'.
|
||||||
\ '\(^\s*'.b:comment_leader.'\)\@!'
|
\ '\\(^\\s*'.b:comment_leader.'\\)\\@!'
|
||||||
" Skip over the comment
|
" Skip over the comment
|
||||||
let b:comment_jump_over = "call search('".
|
let b:comment_jump_over = "call search('".
|
||||||
\ '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
|
\ '^\\(\\s*'.b:comment_leader.'.*\\n\\)\\@<!'.
|
||||||
\ "', 'W')"
|
\ "', 'W')"
|
||||||
let b:comment_skip_back = "call search('".
|
let b:comment_skip_back = "call search('".
|
||||||
\ '^\(\s*'.b:comment_leader.'.*\n\)\@<!'.
|
\ '^\\(\\s*'.b:comment_leader.'.*\\n\\)\\@<!'.
|
||||||
\ "', 'bW')"
|
\ "', 'bW')"
|
||||||
" Move to the start and end of comments
|
" Move to the start and end of comments
|
||||||
exec 'nnoremap <silent><buffer> ]" /'.b:comment_start.'<CR>'
|
exec 'nnoremap <silent><buffer> ]" /'.b:comment_start.'<CR>'
|
||||||
@@ -187,11 +353,29 @@ exec 'vnoremap <silent><buffer> [" /'.b:comment_end.'<CR>'
|
|||||||
" *
|
" *
|
||||||
" */
|
" */
|
||||||
" or
|
" or
|
||||||
" //
|
|
||||||
" or
|
|
||||||
" --
|
" --
|
||||||
|
" or
|
||||||
|
" //
|
||||||
setlocal comments=s1:/*,mb:*,ex:*/,:--,://
|
setlocal comments=s1:/*,mb:*,ex:*/,:--,://
|
||||||
|
|
||||||
|
" Set completion with CTRL-X CTRL-O to autoloaded function.
|
||||||
|
if exists('&omnifunc')
|
||||||
|
" This is used by the sqlcomplete.vim plugin
|
||||||
|
" Source it for it's global functions
|
||||||
|
runtime autoload/syntaxcomplete.vim
|
||||||
|
|
||||||
|
setlocal omnifunc=sqlcomplete#Complete
|
||||||
|
" Prevent the intellisense plugin from loading
|
||||||
|
let b:sql_vis = 1
|
||||||
|
imap <buffer> <c-space>t <C-O>:let b:sql_compl_type='table'<CR><C-X><C-O>
|
||||||
|
imap <buffer> <c-space>p <C-O>:let b:sql_compl_type='procedure'<CR><C-X><C-O>
|
||||||
|
imap <buffer> <c-space>v <C-O>:let b:sql_compl_type='view'<CR><C-X><C-O>
|
||||||
|
imap <buffer> <c-space>c <C-O>:let b:sql_compl_type='column'<CR><C-X><C-O>
|
||||||
|
imap <buffer> <c-space>f <C-O>:let b:sql_compl_type='function'<CR><C-X><C-O>
|
||||||
|
imap <buffer> <c-space>o <C-O>:let b:sql_compl_type='option'<CR><C-X><C-O>
|
||||||
|
imap <buffer> <c-right> <C-O>:let b:sql_compl_type='column'<CR><C-X><C-O>
|
||||||
|
endif
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
|
|
||||||
" vim:sw=4:ff=unix:
|
" vim:sw=4:ff=unix:
|
||||||
|
39
runtime/indent/sql.vim
Normal file
39
runtime/indent/sql.vim
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
" Vim indent file loader
|
||||||
|
" Language: SQL
|
||||||
|
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
|
||||||
|
" Last Change: Thu Sep 15 2005 10:27:51 AM
|
||||||
|
" Version: 1.0
|
||||||
|
" Download: http://vim.sourceforge.net/script.php?script_id=495
|
||||||
|
|
||||||
|
" Description: Checks for a:
|
||||||
|
" buffer local variable,
|
||||||
|
" global variable,
|
||||||
|
" If the above exist, it will source the type specified.
|
||||||
|
" If none exist, it will source the default sqlanywhere.vim file.
|
||||||
|
|
||||||
|
|
||||||
|
" Only load this indent file when no other was loaded.
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Default to the standard Vim distribution file
|
||||||
|
let filename = 'sqlanywhere'
|
||||||
|
|
||||||
|
" Check for overrides. Buffer variables have the highest priority.
|
||||||
|
if exists("b:sql_type_override")
|
||||||
|
" Check the runtimepath to see if the file exists
|
||||||
|
if globpath(&runtimepath, 'indent/'.b:sql_type_override.'.vim') != ''
|
||||||
|
let filename = b:sql_type_override
|
||||||
|
endif
|
||||||
|
elseif exists("g:sql_type_default")
|
||||||
|
if globpath(&runtimepath, 'indent/'.g:sql_type_default.'.vim') != ''
|
||||||
|
let filename = g:sql_type_default
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Source the appropriate file
|
||||||
|
exec 'runtime indent/'.filename.'.vim'
|
||||||
|
|
||||||
|
|
||||||
|
" vim:sw=4:ff=unix:
|
384
runtime/indent/sqlanywhere.vim
Normal file
384
runtime/indent/sqlanywhere.vim
Normal file
@@ -0,0 +1,384 @@
|
|||||||
|
" Vim indent file
|
||||||
|
" Language: SQL
|
||||||
|
" Maintainer: David Fishburn <fishburn at ianywhere dot com>
|
||||||
|
" Last Change: Wed Sep 14 2005 10:21:15 PM
|
||||||
|
" Version: 1.4
|
||||||
|
" Download: http://vim.sourceforge.net/script.php?script_id=495
|
||||||
|
|
||||||
|
" Notes:
|
||||||
|
" Indenting keywords are based on Oracle and Sybase Adaptive Server
|
||||||
|
" Anywhere (ASA). Test indenting was done with ASA stored procedures and
|
||||||
|
" fuctions and Oracle packages which contain stored procedures and
|
||||||
|
" functions.
|
||||||
|
" This has not been tested against Microsoft SQL Server or
|
||||||
|
" Sybase Adaptive Server Enterprise (ASE) which use the Transact-SQL
|
||||||
|
" syntax. That syntax does not have end tags for IF's, which makes
|
||||||
|
" indenting more difficult.
|
||||||
|
"
|
||||||
|
" Known Issues:
|
||||||
|
" The Oracle MERGE statement does not have an end tag associated with
|
||||||
|
" it, this can leave the indent hanging to the right one too many.
|
||||||
|
|
||||||
|
" Only load this indent file when no other was loaded.
|
||||||
|
if exists("b:did_indent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:did_indent = 1
|
||||||
|
let b:current_indent = "sqlanywhere"
|
||||||
|
|
||||||
|
setlocal indentkeys-=0{
|
||||||
|
setlocal indentkeys-=0}
|
||||||
|
setlocal indentkeys-=:
|
||||||
|
setlocal indentkeys-=0#
|
||||||
|
setlocal indentkeys-=e
|
||||||
|
|
||||||
|
" This indicates formatting should take place when one of these
|
||||||
|
" expressions is used. These expressions would normally be something
|
||||||
|
" you would type at the BEGINNING of a line
|
||||||
|
" SQL is generally case insensitive, so this files assumes that
|
||||||
|
" These keywords are something that would trigger an indent LEFT, not
|
||||||
|
" an indent right, since the SQLBlockStart is used for those keywords
|
||||||
|
setlocal indentkeys+==~end,=~else,=~elseif,=~elsif,0=~when,0=)
|
||||||
|
|
||||||
|
" GetSQLIndent is executed whenever one of the expressions
|
||||||
|
" in the indentkeys is typed
|
||||||
|
setlocal indentexpr=GetSQLIndent()
|
||||||
|
|
||||||
|
" Only define the functions once.
|
||||||
|
if exists("*GetSQLIndent")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" List of all the statements that start a new block.
|
||||||
|
" These are typically words that start a line.
|
||||||
|
" IS is excluded, since it is difficult to determine when the
|
||||||
|
" ending block is (especially for procedures/functions).
|
||||||
|
let s:SQLBlockStart = '^\s*\%('.
|
||||||
|
\ 'if\|else\|elseif\|elsif\|'.
|
||||||
|
\ 'while\|loop\|do\|'.
|
||||||
|
\ 'begin\|'.
|
||||||
|
\ 'case\|when\|merge\|exception'.
|
||||||
|
\ '\)\>'
|
||||||
|
let s:SQLBlockEnd = '^\s*\(end\)\>'
|
||||||
|
|
||||||
|
" The indent level is also based on unmatched paranethesis
|
||||||
|
" If a line has an extra "(" increase the indent
|
||||||
|
" If a line has an extra ")" decrease the indent
|
||||||
|
function s:CountUnbalancedParan( line, paran_to_check )
|
||||||
|
let l = a:line
|
||||||
|
let lp = substitute(l, '[^(]', '', 'g')
|
||||||
|
let l = a:line
|
||||||
|
let rp = substitute(l, '[^)]', '', 'g')
|
||||||
|
|
||||||
|
if a:paran_to_check =~ ')'
|
||||||
|
" echom 'CountUnbalancedParan ) returning: ' .
|
||||||
|
" \ (strlen(rp) - strlen(lp))
|
||||||
|
return (strlen(rp) - strlen(lp))
|
||||||
|
elseif a:paran_to_check =~ '('
|
||||||
|
" echom 'CountUnbalancedParan ( returning: ' .
|
||||||
|
" \ (strlen(lp) - strlen(rp))
|
||||||
|
return (strlen(lp) - strlen(rp))
|
||||||
|
else
|
||||||
|
" echom 'CountUnbalancedParan unknown paran to check: ' .
|
||||||
|
" \ a:paran_to_check
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Unindent commands based on previous indent level
|
||||||
|
function s:CheckToIgnoreRightParan( prev_lnum, num_levels )
|
||||||
|
let lnum = a:prev_lnum
|
||||||
|
let line = getline(lnum)
|
||||||
|
let ends = 0
|
||||||
|
let num_right_paran = a:num_levels
|
||||||
|
let ignore_paran = 0
|
||||||
|
let vircol = 1
|
||||||
|
|
||||||
|
while num_right_paran > 0
|
||||||
|
silent! exec 'norm! '.lnum."G\<bar>".vircol."\<bar>"
|
||||||
|
let right_paran = search( ')', 'W' )
|
||||||
|
if right_paran != lnum
|
||||||
|
" This should not happen since there should be at least
|
||||||
|
" num_right_paran matches for this line
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
let vircol = virtcol(".")
|
||||||
|
|
||||||
|
" if getline(".") =~ '^)'
|
||||||
|
let matching_paran = searchpair('(', '', ')', 'bW',
|
||||||
|
\ 'IsColComment(line("."), col("."))')
|
||||||
|
|
||||||
|
if matching_paran < 1
|
||||||
|
" No match found
|
||||||
|
" echom 'CTIRP - no match found, ignoring'
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
|
||||||
|
if matching_paran == lnum
|
||||||
|
" This was not an unmatched parantenses, start the search again
|
||||||
|
" again after this column
|
||||||
|
" echom 'CTIRP - same line match, ignoring'
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
" echom 'CTIRP - match: ' . line(".") . ' ' . getline(".")
|
||||||
|
|
||||||
|
if getline(matching_paran) =~? '\(if\|while\)\>'
|
||||||
|
" echom 'CTIRP - if/while ignored: ' . line(".") . ' ' . getline(".")
|
||||||
|
let ignore_paran = ignore_paran + 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
" One match found, decrease and check for further matches
|
||||||
|
let num_right_paran = num_right_paran - 1
|
||||||
|
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
" Fallback - just move back one
|
||||||
|
" return a:prev_indent - &sw
|
||||||
|
return ignore_paran
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Based on the keyword provided, loop through previous non empty
|
||||||
|
" non comment lines to find the statement that initated the keyword.
|
||||||
|
" Return its indent level
|
||||||
|
" CASE ..
|
||||||
|
" WHEN ...
|
||||||
|
" Should return indent level of CASE
|
||||||
|
" EXCEPTION ..
|
||||||
|
" WHEN ...
|
||||||
|
" something;
|
||||||
|
" WHEN ...
|
||||||
|
" Should return indent level of exception.
|
||||||
|
function s:GetStmtStarterIndent( keyword, curr_lnum )
|
||||||
|
let lnum = a:curr_lnum
|
||||||
|
|
||||||
|
" Default - reduce indent by 1
|
||||||
|
let ind = indent(a:curr_lnum) - &sw
|
||||||
|
|
||||||
|
if a:keyword =~? 'end'
|
||||||
|
exec 'normal! ^'
|
||||||
|
let stmts = '^\s*\%('.
|
||||||
|
\ '\<begin\>\|' .
|
||||||
|
\ '\%(\%(\<end\s\+\)\@<!\<loop\>\)\|' .
|
||||||
|
\ '\%(\%(\<end\s\+\)\@<!\<case\>\)\|' .
|
||||||
|
\ '\%(\%(\<end\s\+\)\@<!\<for\>\)\|' .
|
||||||
|
\ '\%(\%(\<end\s\+\)\@<!\<if\>\)'.
|
||||||
|
\ '\)'
|
||||||
|
let matching_lnum = searchpair(stmts, '', '\<end\>\zs', 'bW',
|
||||||
|
\ 'IsColComment(line("."), col(".")) == 1')
|
||||||
|
exec 'normal! $'
|
||||||
|
if matching_lnum > 0 && matching_lnum < a:curr_lnum
|
||||||
|
let ind = indent(matching_lnum)
|
||||||
|
endif
|
||||||
|
elseif a:keyword =~? 'when'
|
||||||
|
exec 'normal! ^'
|
||||||
|
let matching_lnum = searchpair(
|
||||||
|
\ '\%(\<end\s\+\)\@<!\<case\>\|\<exception\>\|\<merge\>',
|
||||||
|
\ '',
|
||||||
|
\ '\%(\%(\<when\s\+others\>\)\|\%(\<end\s\+case\>\)\)',
|
||||||
|
\ 'bW',
|
||||||
|
\ 'IsColComment(line("."), col(".")) == 1')
|
||||||
|
exec 'normal! $'
|
||||||
|
if matching_lnum > 0 && matching_lnum < a:curr_lnum
|
||||||
|
let ind = indent(matching_lnum)
|
||||||
|
else
|
||||||
|
let ind = indent(a:curr_lnum)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ind
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Check if the line is a comment
|
||||||
|
function IsLineComment(lnum)
|
||||||
|
let rc = synIDattr(
|
||||||
|
\ synID(a:lnum,
|
||||||
|
\ match(getline(a:lnum), '\S')+1, 0)
|
||||||
|
\ , "name")
|
||||||
|
\ =~? "comment"
|
||||||
|
|
||||||
|
return rc
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Check if the column is a comment
|
||||||
|
function IsColComment(lnum, cnum)
|
||||||
|
let rc = synIDattr(synID(a:lnum, a:cnum, 0), "name")
|
||||||
|
\ =~? "comment"
|
||||||
|
|
||||||
|
return rc
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Check if the column is a comment
|
||||||
|
function ModuloIndent(ind)
|
||||||
|
let ind = a:ind
|
||||||
|
|
||||||
|
if ind > 0
|
||||||
|
let modulo = ind % &shiftwidth
|
||||||
|
|
||||||
|
if modulo > 0
|
||||||
|
let ind = ind - modulo
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ind
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
" Find correct indent of a new line based upon the previous line
|
||||||
|
function GetSQLIndent()
|
||||||
|
let lnum = v:lnum
|
||||||
|
let ind = indent(lnum)
|
||||||
|
|
||||||
|
" 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
|
||||||
|
" return ind
|
||||||
|
" endif
|
||||||
|
|
||||||
|
" while 1
|
||||||
|
" Get previous non-blank line
|
||||||
|
let prevlnum = prevnonblank(lnum - 1)
|
||||||
|
if prevlnum <= 0
|
||||||
|
return ind
|
||||||
|
endif
|
||||||
|
|
||||||
|
if IsLineComment(prevlnum) == 1
|
||||||
|
if getline(v:lnum) =~ '^\s*\*'
|
||||||
|
let ind = ModuloIndent(indent(prevlnum))
|
||||||
|
return ind + 1
|
||||||
|
endif
|
||||||
|
" If the previous line is a comment, then return -1
|
||||||
|
" to tell Vim to use the formatoptions setting to determine
|
||||||
|
" the indent to use
|
||||||
|
" But only if the next line is blank. This would be true if
|
||||||
|
" the user is typing, but it would not be true if the user
|
||||||
|
" is reindenting the file
|
||||||
|
if getline(v:lnum) =~ '^\s*$'
|
||||||
|
return -1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" let prevline = getline(prevlnum)
|
||||||
|
" if prevline !~ '^\s*$'
|
||||||
|
" " echom 'previous non blank - break: ' . prevline
|
||||||
|
" break
|
||||||
|
" endif
|
||||||
|
" endwhile
|
||||||
|
|
||||||
|
" echom 'PREVIOUS INDENT: ' . indent(prevlnum) . ' LINE: ' . getline(prevlnum)
|
||||||
|
|
||||||
|
" This is the line you just hit return on, it is not the current line
|
||||||
|
" which is new and empty
|
||||||
|
" Based on this line, we can determine how much to indent the new
|
||||||
|
" line
|
||||||
|
|
||||||
|
" Get default indent (from prev. line)
|
||||||
|
let ind = indent(prevlnum)
|
||||||
|
let prevline = getline(prevlnum)
|
||||||
|
|
||||||
|
" Now check what's on the previous line to determine if the indent
|
||||||
|
" should be changed, for example IF, BEGIN, should increase the indent
|
||||||
|
" where END IF, END, should decrease the indent.
|
||||||
|
if prevline =~? s:SQLBlockStart
|
||||||
|
" Move indent in
|
||||||
|
let ind = ind + &sw
|
||||||
|
" echom 'prevl - SQLBlockStart - indent ' . ind . ' line: ' . prevline
|
||||||
|
elseif prevline =~ '[()]'
|
||||||
|
if prevline =~ '('
|
||||||
|
let num_unmatched_left = s:CountUnbalancedParan( prevline, '(' )
|
||||||
|
else
|
||||||
|
let num_unmatched_left = 0
|
||||||
|
endif
|
||||||
|
if prevline =~ ')'
|
||||||
|
let num_unmatched_right = s:CountUnbalancedParan( prevline, ')' )
|
||||||
|
else
|
||||||
|
let num_unmatched_right = 0
|
||||||
|
" let num_unmatched_right = s:CountUnbalancedParan( prevline, ')' )
|
||||||
|
endif
|
||||||
|
if num_unmatched_left > 0
|
||||||
|
" There is a open left paranethesis
|
||||||
|
" increase indent
|
||||||
|
let ind = ind + ( &sw * num_unmatched_left )
|
||||||
|
elseif num_unmatched_right > 0
|
||||||
|
" if it is an unbalanced paranethesis only unindent if
|
||||||
|
" it was part of a command (ie create table(..) )
|
||||||
|
" instead of part of an if (ie if (....) then) which should
|
||||||
|
" maintain the indent level
|
||||||
|
let ignore = s:CheckToIgnoreRightParan( prevlnum, num_unmatched_right )
|
||||||
|
" echom 'prevl - ) unbalanced - CTIRP - ignore: ' . ignore
|
||||||
|
|
||||||
|
if prevline =~ '^\s*)'
|
||||||
|
let ignore = ignore + 1
|
||||||
|
" echom 'prevl - begins ) unbalanced ignore: ' . ignore
|
||||||
|
endif
|
||||||
|
|
||||||
|
if (num_unmatched_right - ignore) > 0
|
||||||
|
let ind = ind - ( &sw * (num_unmatched_right - ignore) )
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
" echom 'CURRENT INDENT: ' . ind . ' LINE: ' . getline(v:lnum)
|
||||||
|
|
||||||
|
" This is a new blank line since we just typed a carriage return
|
||||||
|
" Check current line; search for simplistic matching start-of-block
|
||||||
|
let line = getline(v:lnum)
|
||||||
|
|
||||||
|
if line =~? '^\s*els'
|
||||||
|
" Any line when you type else will automatically back up one
|
||||||
|
" ident level (ie else, elseif, elsif)
|
||||||
|
let ind = ind - &sw
|
||||||
|
" echom 'curr - else - indent ' . ind
|
||||||
|
elseif line =~? '^\s*end\>'
|
||||||
|
let ind = s:GetStmtStarterIndent('end', v:lnum)
|
||||||
|
" General case for end
|
||||||
|
" let ind = ind - &sw
|
||||||
|
" echom 'curr - end - indent ' . ind
|
||||||
|
elseif line =~? '^\s*when\>'
|
||||||
|
let ind = s:GetStmtStarterIndent('when', v:lnum)
|
||||||
|
" If the WHEN clause is used with a MERGE or EXCEPTION
|
||||||
|
" clause, do not change the indent level, since these
|
||||||
|
" statements do not have a corresponding END statement.
|
||||||
|
" if stmt_starter =~? 'case'
|
||||||
|
" let ind = ind - &sw
|
||||||
|
" endif
|
||||||
|
" elseif line =~ '^\s*)\s*;\?\s*$'
|
||||||
|
" elseif line =~ '^\s*)'
|
||||||
|
elseif line =~ '^\s*)'
|
||||||
|
let num_unmatched_right = s:CountUnbalancedParan( line, ')' )
|
||||||
|
let ignore = s:CheckToIgnoreRightParan( v:lnum, num_unmatched_right )
|
||||||
|
" If the line ends in a ), then reduce the indent
|
||||||
|
" This catches items like:
|
||||||
|
" CREATE TABLE T1(
|
||||||
|
" c1 int,
|
||||||
|
" c2 int
|
||||||
|
" );
|
||||||
|
" But we do not want to unindent a line like:
|
||||||
|
" IF ( c1 = 1
|
||||||
|
" AND c2 = 3 ) THEN
|
||||||
|
" let num_unmatched_right = s:CountUnbalancedParan( line, ')' )
|
||||||
|
" if num_unmatched_right > 0
|
||||||
|
" elseif strpart( line, strlen(line)-1, 1 ) =~ ')'
|
||||||
|
" let ind = ind - &sw
|
||||||
|
if line =~ '^\s*)'
|
||||||
|
" let ignore = ignore + 1
|
||||||
|
" echom 'curr - begins ) unbalanced ignore: ' . ignore
|
||||||
|
endif
|
||||||
|
|
||||||
|
if (num_unmatched_right - ignore) > 0
|
||||||
|
let ind = ind - ( &sw * (num_unmatched_right - ignore) )
|
||||||
|
endif
|
||||||
|
" endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
" echom 'final - indent ' . ind
|
||||||
|
return ModuloIndent(ind)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" vim:sw=4:ff=unix:
|
83
runtime/macmap.vim
Normal file
83
runtime/macmap.vim
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
" System gvimrc file for Mac OS X
|
||||||
|
" Author: Benji Fisher <benji@member.AMS.org>
|
||||||
|
" Last Change: Thu Mar 09 09:00 AM 2006 EST
|
||||||
|
"
|
||||||
|
" Define Mac-standard keyboard shortcuts.
|
||||||
|
|
||||||
|
" Save and restore compatible mode.
|
||||||
|
let s:save_cpo = &cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
nnoremap <D-n> :confirm enew<CR>
|
||||||
|
vmap <D-n> <Esc><D-n>gv
|
||||||
|
imap <D-n> <C-O><D-n>
|
||||||
|
cmap <D-n> <C-C><D-n>
|
||||||
|
omap <D-n> <Esc><D-n>
|
||||||
|
|
||||||
|
nnoremap <D-o> :browse confirm e<CR>
|
||||||
|
vmap <D-o> <Esc><D-o>gv
|
||||||
|
imap <D-o> <C-O><D-o>
|
||||||
|
cmap <D-o> <C-C><D-o>
|
||||||
|
omap <D-o> <Esc><D-o>
|
||||||
|
|
||||||
|
nnoremap <silent> <D-w> :if winheight(2) < 0 <Bar>
|
||||||
|
\ confirm enew <Bar>
|
||||||
|
\ else <Bar>
|
||||||
|
\ confirm close <Bar>
|
||||||
|
\ endif<CR>
|
||||||
|
vmap <D-w> <Esc><D-w>gv
|
||||||
|
imap <D-w> <C-O><D-w>
|
||||||
|
cmap <D-w> <C-C><D-w>
|
||||||
|
omap <D-w> <Esc><D-w>
|
||||||
|
|
||||||
|
nnoremap <silent> <D-s> :if expand("%") == ""<Bar>browse confirm w<Bar>
|
||||||
|
\ else<Bar>confirm w<Bar>endif<CR>
|
||||||
|
vmap <D-s> <Esc><D-s>gv
|
||||||
|
imap <D-s> <C-O><D-s>
|
||||||
|
cmap <D-s> <C-C><D-s>
|
||||||
|
omap <D-s> <Esc><D-s>
|
||||||
|
|
||||||
|
nnoremap <D-S-s> :browse confirm saveas<CR>
|
||||||
|
vmap <D-S-s> <Esc><D-s>gv
|
||||||
|
imap <D-S-s> <C-O><D-s>
|
||||||
|
cmap <D-S-s> <C-C><D-s>
|
||||||
|
omap <D-S-s> <Esc><D-s>
|
||||||
|
|
||||||
|
" From the Edit menu of SimpleText:
|
||||||
|
nnoremap <D-z> u
|
||||||
|
vmap <D-z> <Esc><D-z>gv
|
||||||
|
imap <D-z> <C-O><D-z>
|
||||||
|
cmap <D-z> <C-C><D-z>
|
||||||
|
omap <D-z> <Esc><D-z>
|
||||||
|
|
||||||
|
vnoremap <D-x> "+x
|
||||||
|
|
||||||
|
vnoremap <D-c> "+y
|
||||||
|
|
||||||
|
cnoremap <D-c> <C-Y>
|
||||||
|
|
||||||
|
nnoremap <D-v> "+gP
|
||||||
|
cnoremap <D-v> <C-R>+
|
||||||
|
execute 'vnoremap <script> <D-v>' paste#paste_cmd['v']
|
||||||
|
execute 'inoremap <script> <D-v>' paste#paste_cmd['i']
|
||||||
|
|
||||||
|
nnoremap <silent> <D-a> :if &slm != ""<Bar>exe ":norm gggH<C-O>G"<Bar>
|
||||||
|
\ else<Bar>exe ":norm ggVG"<Bar>endif<CR>
|
||||||
|
vmap <D-a> <Esc><D-a>
|
||||||
|
imap <D-a> <Esc><D-a>
|
||||||
|
cmap <D-a> <C-C><D-a>
|
||||||
|
omap <D-a> <Esc><D-a>
|
||||||
|
|
||||||
|
nnoremap <D-f> /
|
||||||
|
vmap <D-f> <Esc><D-f>
|
||||||
|
imap <D-f> <Esc><D-f>
|
||||||
|
cmap <D-f> <C-C><D-f>
|
||||||
|
omap <D-f> <Esc><D-f>
|
||||||
|
|
||||||
|
nnoremap <D-g> n
|
||||||
|
vmap <D-g> <Esc><D-g>
|
||||||
|
imap <D-g> <C-O><D-g>
|
||||||
|
cmap <D-g> <C-C><D-g>
|
||||||
|
omap <D-g> <Esc><D-g>
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
@@ -47,16 +47,17 @@ augroup Network
|
|||||||
au BufReadCmd file://* exe "silent doau BufReadPre ".netrw#RFC2396(expand("<amatch>"))|exe 'e '.substitute(netrw#RFC2396(expand("<amatch>")),'file://\(.*\)','\1',"")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("<amatch>"))
|
au BufReadCmd file://* exe "silent doau BufReadPre ".netrw#RFC2396(expand("<amatch>"))|exe 'e '.substitute(netrw#RFC2396(expand("<amatch>")),'file://\(.*\)','\1',"")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("<amatch>"))
|
||||||
au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".netrw#RFC2396(expand("<amatch>"))|exe 'e '.substitute(netrw#RFC2396(expand("<amatch>")),'file://localhost/\(.*\)','\1',"")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("<amatch>"))
|
au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".netrw#RFC2396(expand("<amatch>"))|exe 'e '.substitute(netrw#RFC2396(expand("<amatch>")),'file://localhost/\(.*\)','\1',"")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("<amatch>"))
|
||||||
endif
|
endif
|
||||||
au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<amatch>")|exe 'Nread 0r "'.expand("<amatch>").'"'|exe "silent doau BufReadPost ".expand("<amatch>")
|
au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<amatch>")|exe '2Nread "'.expand("<amatch>").'"'|exe "silent doau BufReadPost ".expand("<amatch>")
|
||||||
au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau FileReadPre ".expand("<amatch>")|exe 'Nread "' .expand("<amatch>").'"'|exe "silent doau FileReadPost ".expand("<amatch>")
|
au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau FileReadPre ".expand("<amatch>")|exe 'Nread "' .expand("<amatch>").'"'|exe "silent doau FileReadPost ".expand("<amatch>")
|
||||||
au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<amatch>")|exe 'Nwrite "' .expand("<amatch>").'"'|exe "silent doau BufWritePost ".expand("<amatch>")
|
au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<amatch>")|exe 'Nwrite "' .expand("<amatch>").'"'|exe "silent doau BufWritePost ".expand("<amatch>")
|
||||||
au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau FileWritePre ".expand("<amatch>")|exe "'[,']".'Nwrite "' .expand("<amatch>").'"'|exe "silent doau FileWritePost ".expand("<amatch>")
|
au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau FileWritePre ".expand("<amatch>")|exe "'[,']".'Nwrite "' .expand("<amatch>").'"'|exe "silent doau FileWritePost ".expand("<amatch>")
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
" Commands: :Nread, :Nwrite, :NetUserPass {{{2
|
" Commands: :Nread, :Nwrite, :NetUserPass {{{2
|
||||||
com! -nargs=* Nread call netrw#NetSavePosn()<bar>call netrw#NetRead(<f-args>)<bar>call netrw#NetRestorePosn()
|
com! -count=1 -nargs=* Nread call netrw#NetSavePosn()<bar>call netrw#NetRead(<count>,<f-args>)<bar>call netrw#NetRestorePosn()
|
||||||
com! -range=% -nargs=* Nwrite call netrw#NetSavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#NetRestorePosn()
|
com! -range=% -nargs=* Nwrite call netrw#NetSavePosn()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call netrw#NetRestorePosn()
|
||||||
com! -nargs=* NetUserPass call NetUserPass(<f-args>)
|
com! -nargs=* NetUserPass call NetUserPass(<f-args>)
|
||||||
|
com! -nargs=+ Ncopy call netrw#NetObtain(<f-args>)
|
||||||
|
|
||||||
" Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2
|
" Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2
|
||||||
com! -nargs=? -bar -bang -count=0 Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>)
|
com! -nargs=? -bar -bang -count=0 Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>)
|
||||||
|
169
src/netbeans.c
169
src/netbeans.c
@@ -100,8 +100,6 @@ extern HWND s_hwnd; /* Gvim's Window handle */
|
|||||||
static int cmdno; /* current command number for reply */
|
static int cmdno; /* current command number for reply */
|
||||||
static int haveConnection = FALSE; /* socket is connected and
|
static int haveConnection = FALSE; /* socket is connected and
|
||||||
initialization is done */
|
initialization is done */
|
||||||
static int oldFire = 1;
|
|
||||||
|
|
||||||
#ifdef FEAT_GUI_MOTIF
|
#ifdef FEAT_GUI_MOTIF
|
||||||
static void netbeans_Xt_connect __ARGS((void *context));
|
static void netbeans_Xt_connect __ARGS((void *context));
|
||||||
#endif
|
#endif
|
||||||
@@ -1439,13 +1437,7 @@ nb_do_cmd(
|
|||||||
}
|
}
|
||||||
else if (streq((char *)cmd, "insert"))
|
else if (streq((char *)cmd, "insert"))
|
||||||
{
|
{
|
||||||
pos_T *pos;
|
|
||||||
pos_T mypos;
|
|
||||||
char_u *to_free;
|
char_u *to_free;
|
||||||
char_u *nl;
|
|
||||||
linenr_T lnum;
|
|
||||||
pos_T old_w_cursor;
|
|
||||||
int old_b_changed;
|
|
||||||
|
|
||||||
if (skip >= SKIP_STOP)
|
if (skip >= SKIP_STOP)
|
||||||
{
|
{
|
||||||
@@ -1475,115 +1467,127 @@ nb_do_cmd(
|
|||||||
}
|
}
|
||||||
else if (args != NULL)
|
else if (args != NULL)
|
||||||
{
|
{
|
||||||
/*
|
int ff_detected = EOL_UNKNOWN;
|
||||||
* We need to detect EOL style
|
int buf_was_empty = (buf->bufp->b_ml.ml_flags & ML_EMPTY);
|
||||||
* because addAnno passes char-offset
|
size_t len = 0;
|
||||||
*/
|
int added = 0;
|
||||||
int ff_detected = EOL_UNKNOWN;
|
int oldFire = netbeansFireChanges;
|
||||||
int buf_was_empty = (buf->bufp->b_ml.ml_flags & ML_EMPTY);
|
int old_b_changed;
|
||||||
char_u lbuf[4096]; /* size of largest insert sent by exted */
|
char_u *nl;
|
||||||
int lbuf_len = 0;
|
linenr_T lnum;
|
||||||
|
linenr_T lnum_start;
|
||||||
|
pos_T *pos;
|
||||||
|
|
||||||
oldFire = netbeansFireChanges;
|
|
||||||
netbeansFireChanges = 0;
|
netbeansFireChanges = 0;
|
||||||
lbuf[0] = '\0';
|
|
||||||
|
|
||||||
|
/* Jump to the buffer where we insert. After this "curbuf"
|
||||||
|
* can be used. */
|
||||||
nb_set_curbuf(buf->bufp);
|
nb_set_curbuf(buf->bufp);
|
||||||
old_b_changed = curbuf->b_changed;
|
old_b_changed = curbuf->b_changed;
|
||||||
|
|
||||||
|
/* Convert the specified character offset into a lnum/col
|
||||||
|
* position. */
|
||||||
pos = off2pos(curbuf, off);
|
pos = off2pos(curbuf, off);
|
||||||
if (pos != NULL)
|
if (pos != NULL)
|
||||||
{
|
{
|
||||||
if (pos->lnum == 0)
|
if (pos->lnum <= 0)
|
||||||
pos->lnum = 1;
|
lnum_start = 1;
|
||||||
|
else
|
||||||
|
lnum_start = pos->lnum;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* if the given position is not found, assume we want
|
/* If the given position is not found, assume we want
|
||||||
* the end of the file. See setLocAndSize HACK. */
|
* the end of the file. See setLocAndSize HACK. */
|
||||||
pos = &mypos;
|
if (buf_was_empty)
|
||||||
pos->col = 0;
|
lnum_start = 1; /* above empty line */
|
||||||
#ifdef FEAT_VIRTUALEDIT
|
else
|
||||||
pos->coladd = 0;
|
lnum_start = curbuf->b_ml.ml_line_count + 1;
|
||||||
#endif
|
|
||||||
pos->lnum = curbuf->b_ml.ml_line_count;
|
|
||||||
}
|
|
||||||
lnum = pos->lnum;
|
|
||||||
old_w_cursor = curwin->w_cursor;
|
|
||||||
curwin->w_cursor = *pos;
|
|
||||||
|
|
||||||
if (curbuf->b_start_eol == FALSE
|
|
||||||
&& lnum > 0
|
|
||||||
&& lnum <= curbuf->b_ml.ml_line_count)
|
|
||||||
{
|
|
||||||
/* Append to a partial line */
|
|
||||||
char_u *partial = ml_get(lnum);
|
|
||||||
|
|
||||||
STRCPY(lbuf, partial);
|
|
||||||
lbuf_len = STRLEN(partial);
|
|
||||||
ml_delete(lnum, FALSE);
|
|
||||||
buf_was_empty = (curbuf->b_ml.ml_flags & ML_EMPTY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* "lnum" is the line where we insert: either append to it or
|
||||||
|
* insert a new line above it. */
|
||||||
|
lnum = lnum_start;
|
||||||
|
|
||||||
|
/* Loop over the "\n" separated lines of the argument. */
|
||||||
doupdate = 1;
|
doupdate = 1;
|
||||||
while (*args)
|
while (*args != NUL)
|
||||||
{
|
{
|
||||||
nl = (char_u *)strchr((char *)args, '\n');
|
nl = vim_strchr(args, '\n');
|
||||||
if (nl != NULL)
|
if (nl == NULL)
|
||||||
{
|
{
|
||||||
STRNCAT(lbuf, args, nl - args);
|
/* Incomplete line, probably truncated. Next "insert"
|
||||||
lbuf[lbuf_len + nl - args] = '\0';
|
* command should append to this one. */
|
||||||
args += nl - args + 1;
|
len = STRLEN(args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
STRCPY(lbuf, args);
|
len = nl - args;
|
||||||
args += STRLEN(lbuf);
|
|
||||||
|
/*
|
||||||
|
* We need to detect EOL style, because the commands
|
||||||
|
* use a character offset.
|
||||||
|
*/
|
||||||
|
if (nl > args && nl[-1] == '\r')
|
||||||
|
{
|
||||||
|
ff_detected = EOL_DOS;
|
||||||
|
--len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ff_detected = EOL_UNIX;
|
||||||
|
}
|
||||||
|
args[len] = NUL;
|
||||||
|
|
||||||
|
if (lnum == lnum_start
|
||||||
|
&& ((pos != NULL && pos->col > 0)
|
||||||
|
|| (lnum == 1 && buf_was_empty)))
|
||||||
|
{
|
||||||
|
char_u *oldline = ml_get(lnum);
|
||||||
|
char_u *newline;
|
||||||
|
|
||||||
|
/* Insert halfway a line. For simplicity we assume we
|
||||||
|
* need to append to the line. */
|
||||||
|
newline = alloc_check(STRLEN(oldline) + len + 1);
|
||||||
|
if (newline != NULL)
|
||||||
|
{
|
||||||
|
STRCPY(newline, oldline);
|
||||||
|
STRCAT(newline, args);
|
||||||
|
ml_replace(lnum, newline, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Append a new line. Not that we always do this,
|
||||||
|
* also when the text doesn't end in a "\n". */
|
||||||
|
ml_append((linenr_T)(lnum - 1), args, len + 1, FALSE);
|
||||||
|
++added;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if (nl == NULL)
|
||||||
* EOL detecting. Not sure how to deal with '\n' on Mac.
|
break;
|
||||||
*/
|
++lnum;
|
||||||
if (buf_was_empty && nl && *(nl - 1) != '\r')
|
args = nl + 1;
|
||||||
ff_detected = EOL_UNIX;
|
|
||||||
|
|
||||||
/* nbdebug((" INSERT[%d]: %s\n", lnum, lbuf)); */
|
|
||||||
ml_append((linenr_T)(lnum++ - 1), lbuf,
|
|
||||||
STRLEN(lbuf) + 1, FALSE);
|
|
||||||
lbuf[0] = '\0'; /* empty buffer */
|
|
||||||
lbuf_len = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*(args - 1) == '\n')
|
/* Adjust the marks below the inserted lines. */
|
||||||
{
|
appended_lines_mark(lnum_start - 1, (long)added);
|
||||||
curbuf->b_p_eol = TRUE;
|
|
||||||
curbuf->b_start_eol = TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
curbuf->b_p_eol = FALSE;
|
|
||||||
curbuf->b_start_eol = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
appended_lines_mark(pos->lnum - 1, lnum - pos->lnum);
|
/*
|
||||||
|
* When starting with an empty buffer set the fileformat.
|
||||||
/* We can change initial ff without consequences
|
* This is just guessing...
|
||||||
* Isn't it a kind of hacking?
|
|
||||||
*/
|
*/
|
||||||
if (buf_was_empty)
|
if (buf_was_empty)
|
||||||
{
|
{
|
||||||
if (ff_detected == EOL_UNKNOWN)
|
if (ff_detected == EOL_UNKNOWN)
|
||||||
|
#if defined(MSDOS) || defined(MSWIN) || defined(OS2)
|
||||||
ff_detected = EOL_DOS;
|
ff_detected = EOL_DOS;
|
||||||
|
#else
|
||||||
|
ff_detected = EOL_UNIX;
|
||||||
|
#endif
|
||||||
set_fileformat(ff_detected, OPT_LOCAL);
|
set_fileformat(ff_detected, OPT_LOCAL);
|
||||||
curbuf->b_start_ffc = *curbuf->b_p_ff;
|
curbuf->b_start_ffc = *curbuf->b_p_ff;
|
||||||
|
|
||||||
/* Safety check: only delete empty line */
|
|
||||||
if (*ml_get(curbuf->b_ml.ml_line_count) == NUL)
|
|
||||||
ml_delete(curbuf->b_ml.ml_line_count, FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
curwin->w_cursor = old_w_cursor;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX - GRP - Is the next line right? If I've inserted
|
* XXX - GRP - Is the next line right? If I've inserted
|
||||||
* text the buffer has been updated but not written. Will
|
* text the buffer has been updated but not written. Will
|
||||||
@@ -1592,6 +1596,7 @@ nb_do_cmd(
|
|||||||
curbuf->b_changed = old_b_changed; /* logically unchanged */
|
curbuf->b_changed = old_b_changed; /* logically unchanged */
|
||||||
netbeansFireChanges = oldFire;
|
netbeansFireChanges = oldFire;
|
||||||
|
|
||||||
|
/* Undo info is invalid now... */
|
||||||
u_blockfree(curbuf);
|
u_blockfree(curbuf);
|
||||||
u_clearall(curbuf);
|
u_clearall(curbuf);
|
||||||
}
|
}
|
||||||
|
@@ -4155,7 +4155,7 @@ find_decl(ptr, len, locally, thisblock, searchflags)
|
|||||||
if (curwin->w_cursor.lnum >= old_pos.lnum)
|
if (curwin->w_cursor.lnum >= old_pos.lnum)
|
||||||
t = FAIL; /* match after start is failure too */
|
t = FAIL; /* match after start is failure too */
|
||||||
|
|
||||||
if (thisblock)
|
if (thisblock && t != FAIL)
|
||||||
{
|
{
|
||||||
pos_T *pos;
|
pos_T *pos;
|
||||||
|
|
||||||
|
114
src/os_mac.h
114
src/os_mac.h
@@ -40,37 +40,11 @@
|
|||||||
/*
|
/*
|
||||||
* Unix interface
|
* Unix interface
|
||||||
*/
|
*/
|
||||||
#if defined(__MWERKS__) /* for CodeWarrior */
|
|
||||||
# include <unistd.h>
|
|
||||||
# include <utsname.h>
|
|
||||||
# include <unix.h>
|
|
||||||
#endif
|
|
||||||
#if defined(__APPLE_CC__) /* for Project Builder and ... */
|
#if defined(__APPLE_CC__) /* for Project Builder and ... */
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
|
||||||
/* Get stat.h or something similar. Comment: How come some OS get in in vim.h */
|
/* Get stat.h or something similar. Comment: How come some OS get in in vim.h */
|
||||||
#if defined(__MWERKS__)
|
|
||||||
# include <stat.h>
|
|
||||||
#endif
|
|
||||||
#if defined(__APPLE_CC__)
|
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
#endif
|
/* && defined(HAVE_CURSE) */
|
||||||
#if defined(__MRC__) || defined(__SC__) /* for Apple MPW Compilers */
|
|
||||||
/* There's no stat.h for MPW? */
|
|
||||||
# ifdef powerc
|
|
||||||
# pragma options align=power
|
|
||||||
# endif
|
|
||||||
struct stat
|
|
||||||
{
|
|
||||||
UInt32 st_mtime;
|
|
||||||
UInt32 st_mode;
|
|
||||||
UInt32 st_size;
|
|
||||||
};
|
|
||||||
# ifdef powerc
|
|
||||||
# pragma options align=reset
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#if defined(__APPLE_CC__) /* && defined(HAVE_CURSE) */
|
|
||||||
/* The curses.h from MacOS X provides by default some BACKWARD compatibilty
|
/* The curses.h from MacOS X provides by default some BACKWARD compatibilty
|
||||||
* definition which can cause us problem later on. So we undefine a few of them. */
|
* definition which can cause us problem later on. So we undefine a few of them. */
|
||||||
# include <curses.h>
|
# include <curses.h>
|
||||||
@@ -84,29 +58,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#ifdef MACOS_X
|
#include <dirent.h>
|
||||||
# include <dirent.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Incompatibility checks
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Got problem trying to use shared library in 68k */
|
|
||||||
#if !defined(__POWERPC__) && !defined(__i386__) && defined(FEAT_PYTHON)
|
|
||||||
# undef FEAT_PYTHON
|
|
||||||
# warning Auto-disabling Python. Not yet supported in 68k.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(__POWERPC__) && !defined(__ppc__) && !defined(__i386__)
|
|
||||||
# if !__option(enumsalwaysint)
|
|
||||||
# error "You must compile with enums always int!"
|
|
||||||
# endif
|
|
||||||
# if defined(__MWERKS__) && !defined(__fourbyteints__)
|
|
||||||
# error "You must compile the project with 4-byte ints"
|
|
||||||
/* MPW ints are always 4 byte long */
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MacOS specific #define
|
* MacOS specific #define
|
||||||
@@ -120,13 +72,7 @@
|
|||||||
*/
|
*/
|
||||||
/* When compiled under MacOS X (including CARBON version)
|
/* When compiled under MacOS X (including CARBON version)
|
||||||
* we use the Unix File path style. Also when UNIX is defined. */
|
* we use the Unix File path style. Also when UNIX is defined. */
|
||||||
#if defined(UNIX) || (defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX)
|
|
||||||
# undef COLON_AS_PATHSEP
|
|
||||||
# define USE_UNIXFILENAME
|
# define USE_UNIXFILENAME
|
||||||
#else
|
|
||||||
# define COLON_AS_PATHSEP
|
|
||||||
# define DONT_ADD_PATHSEP_TO_DIR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -176,67 +122,35 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SYS_VIMRC_FILE
|
#ifndef SYS_VIMRC_FILE
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define SYS_VIMRC_FILE "$VIM:vimrc"
|
|
||||||
# else
|
|
||||||
# define SYS_VIMRC_FILE "$VIM/vimrc"
|
# define SYS_VIMRC_FILE "$VIM/vimrc"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef SYS_GVIMRC_FILE
|
#ifndef SYS_GVIMRC_FILE
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define SYS_GVIMRC_FILE "$VIM:gvimrc"
|
|
||||||
# else
|
|
||||||
# define SYS_GVIMRC_FILE "$VIM/gvimrc"
|
# define SYS_GVIMRC_FILE "$VIM/gvimrc"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef SYS_MENU_FILE
|
#ifndef SYS_MENU_FILE
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define SYS_MENU_FILE "$VIMRUNTIME:menu.vim"
|
|
||||||
# else
|
|
||||||
# define SYS_MENU_FILE "$VIMRUNTIME/menu.vim"
|
# define SYS_MENU_FILE "$VIMRUNTIME/menu.vim"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef SYS_OPTWIN_FILE
|
#ifndef SYS_OPTWIN_FILE
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define SYS_OPTWIN_FILE "$VIMRUNTIME:optwin.vim"
|
|
||||||
# else
|
|
||||||
# define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim"
|
# define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef EVIM_FILE
|
#ifndef EVIM_FILE
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define EVIM_FILE "$VIMRUNTIME:evim.vim"
|
|
||||||
# else
|
|
||||||
# define EVIM_FILE "$VIMRUNTIME/evim.vim"
|
# define EVIM_FILE "$VIMRUNTIME/evim.vim"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
# ifndef USR_GVIMRC_FILE
|
# ifndef USR_GVIMRC_FILE
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define USR_GVIMRC_FILE "$VIM:.gvimrc"
|
|
||||||
# else
|
|
||||||
# define USR_GVIMRC_FILE "~/.gvimrc"
|
# define USR_GVIMRC_FILE "~/.gvimrc"
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
# ifndef GVIMRC_FILE
|
# ifndef GVIMRC_FILE
|
||||||
# define GVIMRC_FILE "_gvimrc"
|
# define GVIMRC_FILE "_gvimrc"
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef USR_VIMRC_FILE
|
#ifndef USR_VIMRC_FILE
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define USR_VIMRC_FILE "$VIM:.vimrc"
|
|
||||||
# else
|
|
||||||
# define USR_VIMRC_FILE "~/.vimrc"
|
# define USR_VIMRC_FILE "~/.vimrc"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USR_EXRC_FILE
|
#ifndef USR_EXRC_FILE
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define USR_EXRC_FILE "$VIM:.exrc"
|
|
||||||
# else
|
|
||||||
# define USR_EXRC_FILE "~/.exrc"
|
# define USR_EXRC_FILE "~/.exrc"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef VIMRC_FILE
|
#ifndef VIMRC_FILE
|
||||||
@@ -248,11 +162,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DFLT_HELPFILE
|
#ifndef DFLT_HELPFILE
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define DFLT_HELPFILE "$VIMRUNTIME:doc:help.txt"
|
|
||||||
# else
|
|
||||||
# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt"
|
# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FILETYPE_FILE
|
#ifndef FILETYPE_FILE
|
||||||
@@ -275,20 +185,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SYNTAX_FNAME
|
#ifndef SYNTAX_FNAME
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define SYNTAX_FNAME "$VIMRUNTIME:syntax:%s.vim"
|
|
||||||
# else
|
|
||||||
# define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim"
|
# define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_VIMINFO
|
#ifdef FEAT_VIMINFO
|
||||||
# ifndef VIMINFO_FILE
|
# ifndef VIMINFO_FILE
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define VIMINFO_FILE "$VIM:viminfo"
|
|
||||||
# else
|
|
||||||
# define VIMINFO_FILE "~/.viminfo"
|
# define VIMINFO_FILE "~/.viminfo"
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
#endif /* FEAT_VIMINFO */
|
#endif /* FEAT_VIMINFO */
|
||||||
|
|
||||||
@@ -301,21 +203,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DFLT_VDIR
|
#ifndef DFLT_VDIR
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define DFLT_VDIR "$VIM:vimfiles:view" /* default for 'viewdir' */
|
|
||||||
# else
|
|
||||||
# define DFLT_VDIR "$VIM/vimfiles/view" /* default for 'viewdir' */
|
# define DFLT_VDIR "$VIM/vimfiles/view" /* default for 'viewdir' */
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DFLT_ERRORFILE "errors.err"
|
#define DFLT_ERRORFILE "errors.err"
|
||||||
|
|
||||||
#ifndef DFLT_RUNTIMEPATH
|
#ifndef DFLT_RUNTIMEPATH
|
||||||
# ifdef COLON_AS_PATHSEP
|
|
||||||
# define DFLT_RUNTIMEPATH "$VIM:vimfiles,$VIMRUNTIME,$VIM:vimfiles:after"
|
|
||||||
# else
|
|
||||||
# define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after"
|
# define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -414,7 +308,3 @@
|
|||||||
# define TRACE 1 ? (void)0 : printf
|
# define TRACE 1 ? (void)0 : printf
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MACOS_CLASSIC
|
|
||||||
# define TRACE 1 ? (int)0 : printf
|
|
||||||
#endif
|
|
||||||
|
@@ -9756,6 +9756,7 @@ spell_suggest(count)
|
|||||||
selected = prompt_for_number(&mouse_used);
|
selected = prompt_for_number(&mouse_used);
|
||||||
if (mouse_used)
|
if (mouse_used)
|
||||||
selected -= lines_left;
|
selected -= lines_left;
|
||||||
|
lines_left = Rows; /* avoid more prompt */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selected > 0 && selected <= sug.su_ga.ga_len && u_save_cursor() == OK)
|
if (selected > 0 && selected <= sug.su_ga.ga_len && u_save_cursor() == OK)
|
||||||
|
@@ -325,11 +325,7 @@
|
|||||||
#ifdef BACKSLASH_IN_FILENAME
|
#ifdef BACKSLASH_IN_FILENAME
|
||||||
# define PATH_ESC_CHARS ((char_u *)" \t*?[{`%#")
|
# define PATH_ESC_CHARS ((char_u *)" \t*?[{`%#")
|
||||||
#else
|
#else
|
||||||
# ifdef COLON_AS_PATHSEP
|
# define PATH_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|")
|
||||||
# define PATH_ESC_CHARS ((char_u *)" \t*?[{`$%#/")
|
|
||||||
# else
|
|
||||||
# define PATH_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|")
|
|
||||||
# endif
|
|
||||||
# define SHELL_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|<>();&!")
|
# define SHELL_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|<>();&!")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user