# HG changeset patch # User vimboss # Date 1126907743 0 # Node ID 339999b511a0d529f09219a5d61b810fc75261ef # Parent 0d6092bb72e6c3a9b421d1e67efbcbe9aea6a3c0 updated for version 7.0148 diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim new file mode 100644 --- /dev/null +++ b/runtime/autoload/zip.vim @@ -0,0 +1,226 @@ +" zip.vim: Handles browsing zipfiles +" AUTOLOAD PORTION +" Date: Sep 16, 2005 +" Version: 2 +" Maintainer: Charles E Campbell, Jr +" License: Vim License (see vim's :help license) +" Copyright: Copyright (C) 2005 Charles E. Campbell, Jr. {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" zipPlugin.vim is provided *as is* and comes with no warranty +" of any kind, either expressed or implied. By using this +" plugin, you agree that in no event will the copyright +" holder be liable for any damages resulting from the use +" of this software. + +" --------------------------------------------------------------------- +" Initialization: {{{1 +let s:keepcpo= &cpo +set cpo&vim +if exists("g:loaded_zip") + finish +endif + +let g:loaded_zip= "v2" + +" ---------------- +" Functions: {{{1 +" ---------------- + +" --------------------------------------------------------------------- +" zip#Browse: {{{2 +fun! zip#Browse(zipfile) +" call Dfunc("zip#Browse(zipfile<".a:zipfile.">)") + + " sanity checks + if !executable("unzip") + echohl Error | echo "***error*** (zip#Browse) unzip not available on your system" + call inputsave()|call input("Press to continue")|call inputrestore() +" call Dret("zip#Browse") + return + endif + if !filereadable(a:zipfile) + echohl Error | echo "***error*** (zip#Browse) File not readable<".a:zipfile.">" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() +" call Dret("zip#Browse") + return + endif + if &ma != 1 + set ma + endif + let w:zipfile= a:zipfile + + setlocal noswapfile + setlocal buftype=nofile + setlocal bufhidden=hide + setlocal nobuflisted + setlocal nowrap + set ft=tar + + " give header + exe "$put ='".'\"'." zip.vim version ".g:loaded_zip."'" + exe "$put ='".'\"'." Browsing zipfile ".a:zipfile."'" + exe "$put ='".'\"'." Select a file with cursor and press ENTER"."'" + $put ='' + 0d + $ + + exe "silent r! unzip -l ".a:zipfile + $d + silent 4,$v/^\s\+\d\+\s\{0,5}\d/d + silent 4,$s/^\%(.*\)\s\+\(\S\)/\1/ + + setlocal noma nomod ro + noremap :call ZipBrowseSelect() + +" call Dret("zip#Browse") +endfun + +" --------------------------------------------------------------------- +" ZipBrowseSelect: {{{2 +fun! s:ZipBrowseSelect() +" call Dfunc("ZipBrowseSelect() zipfile<".w:zipfile.">") + let fname= getline(".") + + " sanity check + if fname =~ '^"' +" call Dret("ZipBrowseSelect") + return + endif + if fname =~ '/$' + echohl Error | echo "***error*** (zip#Browse) Please specify a file, not a directory" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() +" call Dret("ZipBrowseSelect") + return + endif + +" call Decho("fname<".fname.">") + + " get zipfile to the new-window + let zipfile= substitute(w:zipfile,'.zip$','','e') + + new + wincmd _ + exe "e zipfile:".zipfile.':'.fname + filetype detect + +" call Dret("ZipBrowseSelect") +endfun + +" --------------------------------------------------------------------- +" zip#Read: {{{2 +fun! zip#Read(fname,mode) +" call Dfunc("zip#Read(fname<".a:fname.">,mode=".a:mode.")") + let zipfile = substitute(a:fname,'zipfile:\(.\{-}\):.*$','\1','') + let fname = substitute(a:fname,'zipfile:.\{-}:\(.*\)$','\1','') +" call Decho("zipfile<".zipfile."> fname<".fname.">") + + exe "r! unzip -p ".zipfile." ".fname + + " cleanup + 0d + set nomod + +" call Dret("zip#Read") +endfun + +" --------------------------------------------------------------------- +" zip#Write: {{{2 +fun! zip#Write(fname) +" call Dfunc("zip#Write(fname<".a:fname.")") + + " sanity checks + if !executable("zip") + echohl Error | echo "***error*** (zip#Write) sorry, your system doesn't appear to have the zip pgm" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() +" call Dret("zip#Write") + return + endif + if !exists("*mkdir") + echohl Error | echo "***error*** (zip#Write) sorry, mkdir() doesn't work on your system" | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() +" call Dret("zip#Write") + return + endif + + let curdir= getcwd() + let tmpdir= tempname() +" call Decho("orig tempname<".tmpdir.">") + if tmpdir =~ '\.' + let tmpdir= substitute(tmpdir,'\.[^.]*$','','e') + endif +" call Decho("tmpdir<".tmpdir.">") + call mkdir(tmpdir,"p") + + " attempt to change to the indicated directory + try + exe "cd ".escape(tmpdir,' \') + catch /^Vim\%((\a\+)\)\=:E344/ + echohl Error | echo "***error*** (zip#Write) cannot cd to temporary directory" | Echohl None + call inputsave()|call input("Press to continue")|call inputrestore() +" call Dret("zip#Write") + return + endtry +" call Decho("current directory now: ".getcwd()) + + " place temporary files under .../_ZIPVIM_/ + if isdirectory("_ZIPVIM_") + call s:Rmdir("_ZIPVIM_") + endif + call mkdir("_ZIPVIM_") + cd _ZIPVIM_ +" call Decho("current directory now: ".getcwd()) + + let zipfile = substitute(a:fname,'zipfile:\(.\{-}\):.*$','\1','') + let fname = substitute(a:fname,'zipfile:.\{-}:\(.*\)$','\1','') + let dirpath = substitute(fname,'/[^/]\+$','','e') + if zipfile !~ '/' + let zipfile= curdir.'/'.zipfile + endif +" call Decho("zipfile<".zipfile."> fname<".fname.">") + + call mkdir(dirpath,"p") + exe "w! ".fname + if executable("cygpath") + let dirpath = substitute(system("cygpath ".dirpath),'\n','','e') + let zipfile = substitute(system("cygpath ".zipfile),'\n','','e') + endif + +" call Decho("zip -u ".zipfile.".zip ".fname) + call system("zip -u ".zipfile.".zip ".fname) + if v:shell_error != 0 + echohl Error | echo "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname | echohl None + call inputsave()|call input("Press to continue")|call inputrestore() + endif + + " cleanup and restore current directory + cd .. + call s:Rmdir("_ZIPVIM_") + exe "cd ".escape(curdir,' \') + setlocal nomod + +" call Dret("zip#Write") +endfun + +" --------------------------------------------------------------------- +" Rmdir: {{{2 +fun! s:Rmdir(fname) +" call Dfunc("Rmdir(fname<".a:fname.">)") + if has("unix") + call system("/bin/rm -rf ".a:fname) + elseif has("win32") || has("win95") || has("win64") || has("win16") + if &shell =~? "sh$" + call system("/bin/rm -rf ".a:fname) + else + call system("del /S ".a:fname) + endif + endif +" call Dret("Rmdir") +endfun + +" ------------------------------------------------------------------------ +" Modelines And Restoration: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo +" vim:ts=8 fdm=marker diff --git a/runtime/compiler/eruby.vim b/runtime/compiler/eruby.vim new file mode 100644 --- /dev/null +++ b/runtime/compiler/eruby.vim @@ -0,0 +1,38 @@ +" Vim compiler file +" Language: eRuby +" Maintainer: Doug Kearns +" Info: $Id$ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- + +if exists("current_compiler") + finish +endif +let current_compiler = "eruby" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=eruby + +CompilerSet errorformat=eruby:\ %f:%l:%m, + \%E%f:%l:\ %m, + \%-Z%p^, + \%C%m, + \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2005 Sep 12 +*eval.txt* For Vim version 7.0aa. Last change: 2005 Sep 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4972,7 +4972,7 @@ then define the function like this: > echo "Done!" endfunction -The file name and the name used before the colon in the function must match +The file name and the name used before the # in the function must match exactly, and the defined function must have the name exactly as it will be called. @@ -4983,9 +4983,6 @@ a path separator. Thus when calling a f Vim will look for the file "autoload/foo/bar.vim" in 'runtimepath'. -The name before the first colon must be at least two characters long, -otherwise it looks like a scope, such as "s:". - This also works when reading a variable that has not been set yet: > :let l = foo#bar#lvar diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -1,4 +1,4 @@ -*filetype.txt* For Vim version 7.0aa. Last change: 2005 Aug 30 +*filetype.txt* For Vim version 7.0aa. Last change: 2005 Sep 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -184,7 +184,8 @@ A. If you want to overrule all default f < 3. To use the new filetype detection you must restart Vim. The files in the "ftdetect" directory are used after all the default - checks, thus they can overrule a previously detected file type. + checks, thus they can overrule a previously detected file type. But you + can also use |:setfiletype| to keep a previously detected filetype. B. If you want to detect your file after the default file type checks. diff --git a/runtime/doc/tags b/runtime/doc/tags --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -5294,7 +5294,6 @@ hebrew hebrew.txt /*hebrew* hebrew.txt hebrew.txt /*hebrew.txt* help various.txt /*help* help-context help.txt /*help-context* -help-tags tags 1 help-translated various.txt /*help-translated* help-xterm-window various.txt /*help-xterm-window* help.txt help.txt /*help.txt* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.0aa. Last change: 2005 Sep 14 +*todo.txt* For Vim version 7.0aa. Last change: 2005 Sep 16 VIM REFERENCE MANUAL by Bram Moolenaar @@ -30,6 +30,8 @@ be worked on, but only if you sponsor Vi *known-bugs* -------------------- Known bugs and current work ----------------------- +Test11 fails sometimes. (athena, huge features) + ccomplete: - How to use a popup menu? - When a typedef or struct is local to a file only use it in that file? diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.0aa. Last change: 2005 Sep 13 +*version7.txt* For Vim version 7.0aa. Last change: 2005 Sep 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1361,4 +1361,7 @@ searching for "qa" instead of quitting a GUI: When scrolling with the scrollbar and there is a line that doesn't fit redrawing may fail. Make sure w_skipcol is valid before redrawing. +"dFxd;" deleted the character under the cursor, "d;" didn't remember the +exclusiveness of the motion. + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/doc/zip.txt b/runtime/doc/zip.txt new file mode 100644 --- /dev/null +++ b/runtime/doc/zip.txt @@ -0,0 +1,31 @@ +*zip.txt* Zip File Interface Sep 16, 2005 + +Author: Charles E. Campbell, Jr. + (remove NOSPAM from Campbell's email first) +Copyright: Copyright (C) 2005 Charles E. Campbell, Jr. {{{1 *zip-copyright* + Permission is hereby granted to use and distribute this code, + with or without modifications, provided that this copyright + notice is copied with it. Like anything else that's free, + zip.vim and zipPlugin.vim are provided *as is* and comes with no + warranty of any kind, either expressed or implied. By using this + plugin, you agree that in no event will the copyright holder be + liable for any damages resulting from the use of this software. + +============================================================================== +1. Contents *zip* *zip-contents* + 1. Contents..................................................|zip-contents| + 2. Usage.....................................................|zip-usage| + 3. History...................................................|zip-history| + +============================================================================== +2. Usage *zip-usage* *zip-manual* + +============================================================================== +3. History *zip-history* + v2 Sep 16, 2005 * silenced some commands (avoiding hit-enter prompt) + * began testing under Windows; works thus far + * filetype detection fixed + v1 Sep 15, 2005 * Initial release, had browsin, reading, and writing + +============================================================================== +vim:tw=78:ts=8:ft=help diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim --- a/runtime/ftplugin/ruby.vim +++ b/runtime/ftplugin/ruby.vim @@ -1,14 +1,125 @@ " Vim filetype plugin -" Language: Ruby -" Maintainer: Gavin Sinclair -" Last Change: 2002/08/12 -" URL: www.soyabean.com.au/gavin/vim/index.html +" Language: Ruby +" Maintainer: Gavin Sinclair +" Info: $Id$ +" URL: http://vim-ruby.sourceforge.net +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- +" +" Original matchit support thanks to Ned Konz. See his ftplugin/ruby.vim at +" http://bike-nomad.com/vim/ruby.vim. +" ---------------------------------------------------------------------------- " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) - finish + finish endif let b:did_ftplugin = 1 -" There are no known setting particularly appropriate for Ruby. Please -" contact the maintainer if you think of some. +let s:cpo_save = &cpo +set cpo&vim + +" Matchit support +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_ignorecase = 0 + + " TODO: improve optional do loops + let b:match_words = + \ '\%(' . + \ '\%(\%(\.\|\:\:\)\s*\)\@' . + \ '\|' . + \ '\%(\%(^\|\.\.\.\=\|[\,;=([<>~\*/%!&^|+-]\)\s*\)\@<=\%(if\|unless\|until\|while\)\>' . + \ '\)' . + \ ':' . + \ '\%(' . + \ '\%(\%(\.\|\:\:\)\s*\)\@' . + \ '\|' . + \ '\%(\%(^\|;\)\s*\)\@<=\' . + \ '\)' . + \ ':' . + \ '\%(\%(\.\|\:\:\)\s*\)\@' + + let b:match_skip = + \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . + \ "\\'" + +endif + +setlocal formatoptions-=t formatoptions+=croql + +setlocal include=^\\s*\\<\\(load\\\|\w*require\\)\\> +setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.rb','') +setlocal suffixesadd=.rb + +" TODO: +"setlocal define=^\\s*def + +setlocal comments=:# +setlocal commentstring=#\ %s + +if !exists("s:rubypath") + if executable("ruby") + if &shellxquote == "'" + let s:rubypath = system('ruby -e "puts (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})"') + else + let s:rubypath = system("ruby -e 'puts (begin; require %q{rubygems}; Gem.all_load_paths; rescue LoadError; []; end + $:).join(%q{,})'") + endif + let s:rubypath = substitute(s:rubypath,',.$',',,','') + else + " If we can't call ruby to get its path, just default to using the + " current directory and the directory of the current file. + let s:rubypath = ".,," + endif +endif + +let &l:path = s:rubypath + +if has("gui_win32") && !exists("b:browsefilter") + let b:browsefilter = "Ruby Source Files (*.rb)\t*.rb\n" . + \ "All Files (*.*)\t*.*\n" +endif + +let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< " + \ "| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip" + +let &cpo = s:cpo_save +unlet s:cpo_save + +" +" Instructions for enabling "matchit" support: +" +" 1. Look for the latest "matchit" plugin at +" +" http://www.vim.org/scripts/script.php?script_id=39 +" +" It is also packaged with Vim, in the $VIMRUNTIME/macros directory. +" +" 2. Copy "matchit.txt" into a "doc" directory (e.g. $HOME/.vim/doc). +" +" 3. Copy "matchit.vim" into a "plugin" directory (e.g. $HOME/.vim/plugin). +" +" 4. Ensure this file (ftplugin/ruby.vim) is installed. +" +" 5. Ensure you have this line in your $HOME/.vimrc: +" filetype plugin on +" +" 6. Restart Vim and create the matchit documentation: +" +" :helptags ~/.vim/doc +" +" Now you can do ":help matchit", and you should be able to use "%" on Ruby +" keywords. Try ":echo b:match_words" to be sure. +" +" Thanks to Mark J. Reed for the instructions. See ":help vimrc" for the +" locations of plugin directories, etc., as there are several options, and it +" differs on Windows. Email gsinclair@soyabean.com.au if you need help. +" + +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim --- a/runtime/indent/ruby.vim +++ b/runtime/indent/ruby.vim @@ -1,11 +1,20 @@ " Vim indent file -" Language: Ruby -" Maintainer: Gavin Sinclair -" Last Change: 2003 May 11 -" URL: www.soyabean.com.au/gavin/vim/index.html -" Changes: (since vim 6.1) -" - indentation after a line ending in comma, etc, (even in a comment) was -" broken, now fixed (2002/08/14) +" Language: Ruby +" Maintainer: Gavin Sinclair +" Developer: Nikolai Weibull +" Info: $Id$ +" URL: http://vim-ruby.rubyforge.org/ +" Anon CVS: See above site +" Licence: GPL (http://www.gnu.org) +" Disclaimer: +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" ---------------------------------------------------------------------------- + +" 0. Initialization {{{1 +" ================= " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -13,55 +22,363 @@ if exists("b:did_indent") endif let b:did_indent = 1 +" Now, set up our indentation expression and keys that trigger it. setlocal indentexpr=GetRubyIndent() -setlocal nolisp -setlocal nosmartindent -setlocal autoindent -setlocal indentkeys+==end,=else,=elsif,=when,=ensure,=rescue +setlocal indentkeys=0{,0},0),0],!^F,o,O,e +setlocal indentkeys+==end,=elsif,=when,=ensure,=rescue,==begin,==end " Only define the function once. if exists("*GetRubyIndent") finish endif +let s:cpo_save = &cpo +set cpo&vim + +" 1. Variables {{{1 +" ============ + +" Regex of syntax group names that are or delimit string or are comments. +let s:syng_strcom = '\' + +" Regex of syntax group names that are strings or comments. +let s:syng_strcom2 = '\' + +" Regex of syntax group names that are strings. +let s:syng_string = + \ '\' + +" Regex of syntax group names that are strings or documentation. +let s:syng_stringdoc = + \'\' + +" Expression used to check whether we should skip a match with searchpair(). +let s:skip_expr = + \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '".s:syng_strcom."'" + +" Regex used for words that, at the start of a line, add a level of indent. +let s:ruby_indent_keywords = '^\s*\zs\<\%(module\|class\|def\|if\|for' . + \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure' . + \ '\|rescue\)\>' . + \ '\|\%([*+/,=:-]\|<<\|>>\)\s*\zs' . + \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>' + +" Regex used for words that, at the start of a line, remove a level of indent. +let s:ruby_deindent_keywords = + \ '^\s*\zs\<\%(ensure\|else\|rescue\|elsif\|when\|end\)\>' + +" Regex that defines the start-match for the 'end' keyword. +"let s:end_start_regex = '\%(^\|[^.]\)\<\%(module\|class\|def\|if\|for\|while\|until\|case\|unless\|begin\|do\)\>' +" TODO: the do here should be restricted somewhat (only at end of line)? +let s:end_start_regex = '^\s*\zs\<\%(module\|class\|def\|if\|for' . + \ '\|while\|until\|case\|unless\|begin\)\>' . + \ '\|\%([*+/,=:-]\|<<\|>>\)\s*\zs' . + \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\)\>' . + \ '\|\' + +" Regex that defines the middle-match for the 'end' keyword. +let s:end_middle_regex = '\<\%(ensure\|else\|\%(\%(^\|;\)\s*\)\@<=\\|when\|elsif\)\>' + +" Regex that defines the end-match for the 'end' keyword. +let s:end_end_regex = '\%(^\|[^.]\)\@<=\' + +" Expression used for searchpair() call for finding match for 'end' keyword. +let s:end_skip_expr = s:skip_expr . + \ ' || (expand("") == "do"' . + \ ' && getline(".") =~ "^\\s*\\")' + +" Regex that defines continuation lines, not including (, {, or [. +let s:continuation_regex = '\%([\\*+/.,=:-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' + +" Regex that defines continuation lines. +" TODO: this needs to deal with if ...: and so on +let s:continuation_regex2 = + \ '\%([\\*+/.,=:({[-]\|\W[|&?]\|||\|&&\)\s*\%(#.*\)\=$' + +" Regex that defines blocks. +let s:block_regex = + \ '\%(\\|{\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=\s*\%(#.*\)\=$' + +" 2. Auxiliary Functions {{{1 +" ====================== + +" Check if the character at lnum:col is inside a string, comment, or is ascii. +function s:IsInStringOrComment(lnum, col) + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_strcom +endfunction + +" Check if the character at lnum:col is inside a string or comment. +function s:IsInStringOrComment2(lnum, col) + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_strcom2 +endfunction + +" Check if the character at lnum:col is inside a string. +function s:IsInString(lnum, col) + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_string +endfunction + +" Check if the character at lnum:col is inside a string or documentation. +function s:IsInStringOrDocumentation(lnum, col) + return synIDattr(synID(a:lnum, a:col, 0), 'name') =~ s:syng_stringdoc +endfunction + +" Find line above 'lnum' that isn't empty, in a comment, or in a string. +function s:PrevNonBlankNonString(lnum) + let in_block = 0 + let lnum = prevnonblank(a:lnum) + while lnum > 0 + " Go in and out of blocks comments as necessary. + " If the line isn't empty (with opt. comment) or in a string, end search. + let line = getline(lnum) + if line =~ '^=begin$' + if in_block + let in_block = 0 + else + break + endif + elseif !in_block && line =~ '^=end$' + let in_block = 1 + elseif !in_block && line !~ '^\s*#.*$' && !(s:IsInStringOrComment(lnum, 1) + \ && s:IsInStringOrComment(lnum, strlen(line))) + break + endif + let lnum = prevnonblank(lnum - 1) + endwhile + return lnum +endfunction + +" Find line above 'lnum' that started the continuation 'lnum' may be part of. +function s:GetMSL(lnum) + " Start on the line we're at and use its indent. + let msl = a:lnum + let lnum = s:PrevNonBlankNonString(a:lnum - 1) + while lnum > 0 + " If we have a continuation line, or we're in a string, use line as MSL. + " Otherwise, terminate search as we have found our MSL already. + let line = getline(lnum) + let col = match(line, s:continuation_regex2) + 1 + if (col > 0 && !s:IsInStringOrComment(lnum, col)) + \ || s:IsInString(lnum, strlen(line)) + let msl = lnum + else + break + endif + let lnum = s:PrevNonBlankNonString(lnum - 1) + endwhile + return msl +endfunction + +" Check if line 'lnum' has more opening brackets than closing ones. +function s:LineHasOpeningBrackets(lnum) + let open_0 = 0 + let open_2 = 0 + let open_4 = 0 + let line = getline(a:lnum) + let pos = match(line, '[][(){}]', 0) + while pos != -1 + if !s:IsInStringOrComment(a:lnum, pos + 1) + let idx = stridx('(){}[]', line[pos]) + if idx % 2 == 0 + let open_{idx} = open_{idx} + 1 + else + let open_{idx - 1} = open_{idx - 1} - 1 + endif + endif + let pos = match(line, '[][(){}]', pos + 1) + endwhile + return (open_0 > 0) . (open_2 > 0) . (open_4 > 0) +endfunction + +function s:Match(lnum, regex) + let col = match(getline(a:lnum), a:regex) + 1 + return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0 +endfunction + +function s:MatchLast(lnum, regex) + let line = getline(a:lnum) + let col = match(line, '.*\zs' . a:regex) + while col != -1 && s:IsInStringOrComment(a:lnum, col) + let line = strpart(line, 0, col) + let col = match(line, '.*' . a:regex) + endwhile + return col + 1 +endfunction + +" 3. GetRubyIndent Function {{{1 +" ========================= + function GetRubyIndent() - " Find a non-blank line above the current line. - let lnum = prevnonblank(v:lnum - 1) + " 3.1. Setup {{{2 + " ---------- + + " Set up variables for restoring position in file. Could use v:lnum here. + let vcol = col('.') + + " 3.2. Work on the current line {{{2 + " ----------------------------- + + " Get the current line. + let line = getline(v:lnum) + let ind = -1 + + " If we got a closing bracket on an empty line, find its match and indent + " according to it. For parentheses we indent to its column - 1, for the + " others we indent to the containing line's MSL's level. Return -1 if fail. + let col = matchend(line, '^\s*[]})]') + if col > 0 && !s:IsInStringOrComment(v:lnum, col) + call cursor(v:lnum, col) + let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) + if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 + let ind = line[col-1]==')' ? virtcol('.')-1 : indent(s:GetMSL(line('.'))) + endif + return ind + endif + + " If we have a =begin or =end set indent to first column. + if match(line, '^\s*\%(=begin\|=end\)$') != -1 + return 0 + endif + + " If we have a deindenting keyword, find its match and indent to its level. + " TODO: this is messy + if s:Match(v:lnum, s:ruby_deindent_keywords) +" let lnum = s:PrevNonBlankNonString(v:lnum - 1) +" +" if lnum == 0 +" return 0 +" endif +" +" return indent(v:lnum) - &sw + call cursor(v:lnum, 1) + if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', + \ s:end_skip_expr) > 0 + if strpart(getline('.'), 0, col('.') - 1) =~ '=\s*' + let ind = virtcol('.') - 1 + else + let ind = indent('.') + endif + endif + return ind + endif + + " If we are in a multi-line string or line-comment, don't do anything to it. + if s:IsInStringOrDocumentation(v:lnum, matchend(line, '^\s*') + 1) + return indent('.') + endif + + " 3.3. Work on the previous line. {{{2 + " ------------------------------- + + " Find a non-blank, non-multi-line string line above the current line. + let lnum = s:PrevNonBlankNonString(v:lnum - 1) " At the start of the file use zero indent. if lnum == 0 return 0 endif - " If the line trailed with [*+,.(] - but not in a comment - trust the user - if getline(lnum) =~ '\(\[^#\].*\)?\(\*\|\.\|+\|,\|(\)\(\s*#.*\)\=$' - return -1 + " Set up variables for current line. + let line = getline(lnum) + let ind = indent(lnum) + + " If the previous line ended with a block opening, add a level of indent. + if s:Match(lnum, s:block_regex) + return indent(s:GetMSL(lnum)) + &sw + endif + + " If the previous line contained an opening bracket, and we are still in it, + " add indent depending on the bracket type. + if line =~ '[[({]' + let counts = s:LineHasOpeningBrackets(lnum) + if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + return virtcol('.') + elseif counts[1] == '1' || counts[2] == '1' + return ind + &sw + else + call cursor(v:lnum, vcol) + end endif - " Add a 'shiftwidth' after lines beginning with: - " module, class, dev, if, for, while, until, else, elsif, case, when, { - let ind = indent(lnum) - let flag = 0 - if getline(lnum) =~ '^\s*\(module\>\|class\>\|def\>\|if\>\|for\>\|while\>\|until\>\|else\>\|elsif\>\|case\>\|when\>\|unless\|begin\|ensure\>\|rescue\>\)' - \ || getline(lnum) =~ '{\s*$' - \ || getline(lnum) =~ '\({\|\\).*|.*|\s*$' - \ || getline(lnum) =~ '\\(\s*#.*\)\=$' - let ind = ind + &sw - let flag = 1 + " If the previous line ended with an "end", match that "end"s beginning's + " indent. + let col = s:Match(lnum, '\%(^\|[^.]\)\\s*\%(#.*\)\=$') + if col > 0 + call cursor(lnum, col) + if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW', + \ s:end_skip_expr) > 0 + let n = line('.') + let ind = indent('.') + let msl = s:GetMSL(n) + if msl != n + let ind = indent(msl) + end + return ind + endif + end + + let col = s:Match(lnum, s:ruby_indent_keywords) + if col > 0 + call cursor(lnum, col) + let ind = virtcol('.') - 1 + &sw +" let ind = indent(lnum) + &sw + " TODO: make this better (we need to count them) (or, if a searchpair + " fails, we know that something is lacking an end and thus we indent a + " level + if s:Match(lnum, s:end_end_regex) + let ind = indent('.') + endif + return ind endif - " Subtract a 'shiftwidth' after lines ending with - " "end" when they begin with while, if, for, until - if flag == 1 && getline(lnum) =~ '\\(\s*#.*\)\=$' - let ind = ind - &sw + " 3.4. Work on the MSL line. {{{2 + " -------------------------- + + " Set up variables to use and search for MSL to the previous line. + let p_lnum = lnum + let lnum = s:GetMSL(lnum) + + " If the previous line wasn't a MSL and is continuation return its indent. + " TODO: the || s:IsInString() thing worries me a bit. + if p_lnum != lnum + if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line)) + return ind + endif endif - " Subtract a 'shiftwidth' on end, else and, elsif, when and } - if getline(v:lnum) =~ '^\s*\(end\>\|else\>\|elsif\>\|when\>\|ensure\>\|rescue\>\|}\)' - let ind = ind - &sw + " Set up more variables, now that we know we wasn't continuation bound. + let line = getline(lnum) + let msl_ind = indent(lnum) + + " If the MSL line had an indenting keyword in it, add a level of indent. + " TODO: this does not take into account contrived things such as + " module Foo; class Bar; end + if s:Match(lnum, s:ruby_indent_keywords) + let ind = msl_ind + &sw + if s:Match(lnum, s:end_end_regex) + let ind = ind - &sw + endif + return ind endif + " If the previous line ended with [*+/.-=], indent one extra level. + if s:Match(lnum, s:continuation_regex) + if lnum == p_lnum + let ind = msl_ind + &sw + else + let ind = msl_ind + endif + endif + + " }}}2 + return ind endfunction -" vim:sw=2 +" }}}1 + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/runtime/keymap/tamil_tscii.vim b/runtime/keymap/tamil_tscii.vim new file mode 100644 --- /dev/null +++ b/runtime/keymap/tamil_tscii.vim @@ -0,0 +1,572 @@ +" Keymap file for the editing Tamil language files in TSCII encoding. +" +" Maintainer: Yegappan Lakshmanan (yegappan AT yahoo DOT com) +" Last updated: August 4, 2005 +" +" You will need a fixed width TSCII font to use this encoding. The +" Avarangal TSCII fixed width font (TSC_AvarangalFxd) is used to test +" this keymap. +" +" Visit http://www.tscii.org for more information about the TSCII +" encoding. +" +let b:keymap_name = "tamil_tscii" + +loadkeymap + +" Uyir (Vowels) letters +a +aa +A +i +ii +I +u +uu +U +e +ee +E +ai +o +oo +O +au +q + +" mey (Consonants) letters +k +ka +kaa +kA +ki +kii +kI +ku +kuu +kU +ke +kee +kE +kai +ko +koo +kO +kau + +g +ga +gaa +gA +gi +gii +gI +gu +guu +gU +ge +gee +gE +gai +go +goo +gO +gau + +ng +nga +ngaa +ngA +ngi +ngii +ngI +ngu +nguu +ngU +nge +ngee +ngE +ngai +ngo +ngoo +ngO +ngau + +ch +cha +chaa +chA +chi +chii +chI +chu +chuu +chU +che +chee +chE +chai +cho +choo +chO +chau + +s +sa +saa +sA +si +sii +sI +su +suu +sU +se +see +sE +sai +so +soo +sO +sau + +nj +nja +njaa +njA +nji +njii +njI +nju +njuu +njU +nje +njee +njE +njai +njo +njoo +njO +njau + +t +ta +taa +tA +ti +tii +tI +tu +tuu +tU +te +tee +tE +tai +to +too +tO +tau + +d +da +daa +dA +di +dii +dI +du +duu +dU +de +dee +dE +dai +do +doo +dO +dau + +N +Na +Naa +NA +Ni +Nii +NI +Nu +Nuu +NU +Ne +Nee +NE +Nai +No +Noo +NO +Nau + +th +tha +thaa +thA +thi +thii +thI +thu +thuu +thU +the +thee +thE +thai +tho +thoo +thO +thau + +w +wa +waa +wA +wi +wii +wI +wu +wuu +wU +we +wee +wE +wai +wo +woo +wO +wau + +n- +n-a +n-aa +n-A +n-i +n-ii +n-I +n-u +n-uu +n-U +n-e +n-ee +n-E +n-ai +n-o +n-oo +n-O +n-au + +p +pa +paa +pA +pi +pii +pI +pu +puu +pU +pe +pee +pE +pai +po +poo +pO +pau + +b +ba +baa +bA +bi +bii +bI +bu +buu +bU +be +bee +bE +bai +bo +boo +bO +bau + +m +ma +maa +mA +mi +mii +mI +mu +muu +mU +me +mee +mE +mai +mo +moo +mO +mau + +y +ya +yaa +yA +yi +yii +yI +yu +yuu +yU +ye +yee +yE +yai +yo +yoo +yO +yau + +r +ra +raa +rA +ri +rii +rI +ru +ruu +rU +re +ree +rE +rai +ro +roo +rO +rau + +l +la +laa +lA +li +lii +lI +lu +luu +lU +le +lee +lE +lai +lo +loo +lO +lau + +v +va +vaa +vA +vi +vii +vI +vu +vuu +vU +ve +vee +vE +vai +vo +voo +vO +vau + +z +za +zaa +zA +zi +zii +zI +zu +zuu +zU +ze +zee +zE +zai +zo +zoo +zO +zau + +L +La +Laa +LA +Li +Lii +LI +Lu +Luu +LU +Le +Lee +LE +Lai +Lo +Loo +LO +Lau + +R +Ra +Raa +RA +Ri +Rii +RI +Ru +Ruu +RU +Re +Ree +RE +Rai +Ro +Roo +RO +Rau + +n +na +naa +nA +ni +nii +nI +nu +nuu +nU +ne +nee +nE +nai +no +noo +nO +nau + +" Grantha letters +j +ja +jaa +jA +ji +jii +jI +ju +juu +jU +je +jee +jE +jai +jo +joo +jO +jau + +sh +sha +shaa +shA +shi +shii +shI +shu +shuu +shU +she +shee +shE +shai +sho +shoo +shO +shau + +S +Sa +Saa +SA +Si +Sii +SI +Su +Suu +SU +Se +See +SE +Sai +So +Soo +SO +Sau + +h +ha +haa +hA +hi +hii +hI +hu +huu +hU +he +hee +hE +hai +ho +hoo +hO +hau + +x +xa +xaa +xA +xi +xii +xI +xu +xuu +xU +xe +xee +xE +xai +xo +xoo +xO +xau + +sri + diff --git a/runtime/syntax/eruby.vim b/runtime/syntax/eruby.vim --- a/runtime/syntax/eruby.vim +++ b/runtime/syntax/eruby.vim @@ -10,7 +10,6 @@ " but WITHOUT ANY WARRANTY; without even the implied warranty of " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " GNU General Public License for more details. -" ---------------------------------------------------------------------------- " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -33,9 +32,12 @@ else syn include @rubyTop syntax/ruby.vim endif -syn region erubyOneLiner matchgroup=erubyDelimiter start="^\s*\zs%" end="$" contains=@rubyTop,erubyDelimiter keepend -syn region erubyBlock matchgroup=erubyDelimiter start="<%=\=" end="%>" contains=@rubyTop containedin=ALLBUT,erubyComment keepend -syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" keepend +syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment + +syn region erubyOneLiner matchgroup=erubyDelimiter start="^%%\@!" end="$" contains=@rubyTop containedin=ALLBUT,@erubyRegions keepend oneline +syn region erubyBlock matchgroup=erubyDelimiter start="<%%\@!" end="%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions +syn region erubyExpression matchgroup=erubyDelimiter start="<%=" end="%>" contains=@rubyTop containedin=ALLBUT,@erubyRegions +syn region erubyComment matchgroup=erubyDelimiter start="<%#" end="%>" contains=rubyTodo,@Spell containedin=ALLBUT,@erubyRegions keepend " Define the default highlighting. " For version 5.7 and earlier: only when not done already @@ -59,4 +61,4 @@ if main_syntax == 'eruby' unlet main_syntax endif -" vim: sw=2 sts=2 ts=8 ff=unix nowrap: +" vim: nowrap sw=2 sts=2 ts=8 ff=unix: diff --git a/src/ops.c b/src/ops.c --- a/src/ops.c +++ b/src/ops.c @@ -2140,8 +2140,8 @@ op_tilde(oap) pos_T pos; #ifdef FEAT_VISUAL struct block_def bd; -#endif int todo; +#endif int did_change = 0; if (u_save((linenr_T)(oap->start.lnum - 1), @@ -2158,10 +2158,10 @@ op_tilde(oap) pos.col = bd.textcol; for (todo = bd.textlen; todo > 0; --todo) { -#ifdef FEAT_MBYTE +# ifdef FEAT_MBYTE if (has_mbyte) todo -= (*mb_ptr2len)(ml_get_pos(&pos)) - 1; -#endif +# endif did_change |= swapchar(oap->op_type, &pos); if (inc(&pos) == -1) /* at end of file */ break; @@ -2195,16 +2195,13 @@ op_tilde(oap) else if (!oap->inclusive) dec(&(oap->end)); - for (todo = oap->end.col - pos.col + 1; todo > 0; --todo) + while (ltoreq(pos, oap->end)) { -#ifdef FEAT_MBYTE - if (has_mbyte) - todo -= (*mb_ptr2len)(ml_get_pos(&pos)) - 1; -#endif did_change |= swapchar(oap->op_type, &pos); if (inc(&pos) == -1) /* at end of file */ break; } + if (did_change) { changed_lines(oap->start.lnum, oap->start.col, oap->end.lnum + 1, diff --git a/src/screen.c b/src/screen.c --- a/src/screen.c +++ b/src/screen.c @@ -2931,7 +2931,7 @@ win_line(wp, lnum, startrow, endrow) wp->w_cursor.lnum = lnum; wp->w_cursor.col = ptr - line; len = spell_move_to(wp, FORWARD, TRUE, TRUE, &spell_attr); - if (len == 0 || wp->w_cursor.col > ptr - line) + if (len == 0 || (int)wp->w_cursor.col > ptr - line) { /* no bad word found at line start, don't check until end of a * word */ diff --git a/src/search.c b/src/search.c --- a/src/search.c +++ b/src/search.c @@ -1440,6 +1440,11 @@ searchc(cap, t_cmd) /* For multi-byte re-use last bytes[] and bytelen. */ } + if (dir == BACKWARD) + cap->oap->inclusive = FALSE; + else + cap->oap->inclusive = TRUE; + p = ml_get_curline(); col = curwin->w_cursor.col; len = (int)STRLEN(p); diff --git a/src/testdir/test58.ok b/src/testdir/test58.ok --- a/src/testdir/test58.ok +++ b/src/testdir/test58.ok @@ -34,7 +34,7 @@ test déôl ['deol', 'déôr', 'test'] end -['put', 'test', 'uk'] +['put', 'OK', 'test'] the ['put', 'uk', 'test'] gebletegek @@ -75,7 +75,7 @@ wrong bad ['put', 'uk', 'OK'] inputs -['input', 'puts', 'put'] +['input', 'puts', 'outputs'] comment ['Comment'] ok @@ -143,7 +143,7 @@ wordutilize pro ['bork', 'end', 'word'] borkborkborkborkborkbork -['borkbork borkborkborkbork', 'borkborkbork borkborkbork', 'borkborkborkborkbork bork'] +['bork borkborkborkborkbork', 'borkbork borkborkborkbork', 'borkborkbork borkborkbork'] tomatotomatotomato ['tomato tomatotomato', 'tomatotomato tomato', 'tomato tomato tomato'] endstart @@ -153,13 +153,13 @@ endend startstart ['start start'] wordend -['word end', 'wordword', 'word'] +['word end', 'word', 'wordword'] wordstart ['word start', 'bork start'] startwordwordwordwordend ['startwordwordwordword end', 'startwordwordwordword', 'start wordwordwordword end'] borkpreborkpreborkbork -['borkpreborkprebork bork', 'borkprebork preborkbork', 'bork preborkpreborkbork'] +['bork preborkpreborkbork', 'borkprebork preborkbork', 'borkpreborkprebork bork'] test 5-5 # file: Xtest.latin1.spl @@ -211,7 +211,7 @@ mee meea2 ['meea1', 'meeaé', 'lead'] prabar -['prebar', 'leadbar', 'bar'] +['prebar', 'bar', 'leadbar'] probarbirk ['prebarbork'] middle @@ -243,7 +243,7 @@ mee meea2 ['meea1', 'meeaé', 'lead'] prabar -['prebar', 'leadbar', 'bar'] +['prebar', 'bar', 'leadbar'] probarmaat ['prebarmeat'] middle diff --git a/src/testdir/test59.ok b/src/testdir/test59.ok --- a/src/testdir/test59.ok +++ b/src/testdir/test59.ok @@ -34,7 +34,7 @@ test déôl ['deol', 'déôr', 'test'] end -['put', 'test', 'uk'] +['put', 'OK', 'test'] the ['put', 'uk', 'test'] gebletegek @@ -75,7 +75,7 @@ wrong bad ['put', 'uk', 'OK'] inputs -['input', 'puts', 'put'] +['input', 'puts', 'outputs'] comment ['Comment'] ok @@ -143,7 +143,7 @@ wordutilize pro ['bork', 'end', 'word'] borkborkborkborkborkbork -['borkbork borkborkborkbork', 'borkborkbork borkborkbork', 'borkborkborkborkbork bork'] +['bork borkborkborkborkbork', 'borkbork borkborkborkbork', 'borkborkbork borkborkbork'] tomatotomatotomato ['tomato tomatotomato', 'tomatotomato tomato', 'tomato tomato tomato'] endstart @@ -153,13 +153,13 @@ endend startstart ['start start'] wordend -['word end', 'wordword', 'word'] +['word end', 'word', 'wordword'] wordstart ['word start', 'bork start'] startwordwordwordwordend ['startwordwordwordword end', 'startwordwordwordword', 'start wordwordwordword end'] borkpreborkpreborkbork -['borkpreborkprebork bork', 'borkprebork preborkbork', 'bork preborkpreborkbork'] +['bork preborkpreborkbork', 'borkprebork preborkbork', 'borkpreborkprebork bork'] test 5-5 # file: Xtest.utf-8.spl @@ -211,7 +211,7 @@ mee meea2 ['meea1', 'meeaé', 'lead'] prabar -['prebar', 'leadbar', 'bar'] +['prebar', 'bar', 'leadbar'] probarbirk ['prebarbork'] middle @@ -243,7 +243,7 @@ mee meea2 ['meea1', 'meeaé', 'lead'] prabar -['prebar', 'leadbar', 'bar'] +['prebar', 'bar', 'leadbar'] probarmaat ['prebarmeat'] middle diff --git a/src/version.h b/src/version.h --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 14)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 14, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 16)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 16, compiled "