mirror of
https://github.com/vim/vim.git
synced 2025-07-04 23:07:33 -04:00
updated for version 7.0147
This commit is contained in:
parent
cd292719e0
commit
ab194816fe
@ -1,11 +1,11 @@
|
||||
" vim:set ts=8 sts=4 sw=4:
|
||||
"
|
||||
" tar.vim -- a Vim plugin for browsing tarfiles
|
||||
" Copyright (c) 2002, Michael C. Toren <mct@toren.net>
|
||||
" Distributed under the GNU General Public License.
|
||||
"
|
||||
" Version: 1.01
|
||||
" Last Change: 2005 Jul 26
|
||||
" Version: 2
|
||||
" Date: Sep 14, 2005
|
||||
" Modified By: Charles E. Campbell, Jr.
|
||||
"
|
||||
" Updates are available from <http://michael.toren.net/code/>. If you
|
||||
" find this script useful, or have suggestions for improvements, please
|
||||
@ -13,14 +13,15 @@
|
||||
" Also look there for further comments and documentation.
|
||||
"
|
||||
" This part defines the functions. The autocommands are in plugin/tar.vim.
|
||||
if exists("g:loaded_tar") || &cp
|
||||
finish
|
||||
endif
|
||||
let g:loaded_tar= "v2"
|
||||
|
||||
let s:version = "1.01"
|
||||
|
||||
function! tar#Write(argument)
|
||||
echo "ERROR: Sorry, no write support for tarfiles yet"
|
||||
endfunction
|
||||
|
||||
function! tar#Read(argument, cleanup)
|
||||
" ---------------------------------------------------------------------
|
||||
" tar#Read: {{{1
|
||||
fun! tar#Read(argument, cleanup)
|
||||
" call Dfunc("tar#Read(argument<".a:argument."> cleanup=".a:cleanup.")")
|
||||
let l:argument = a:argument
|
||||
let l:argument = substitute(l:argument, '^tarfile:', '', '')
|
||||
let l:argument = substitute(l:argument, '^\~', $HOME, '')
|
||||
@ -28,7 +29,8 @@ function! tar#Read(argument, cleanup)
|
||||
let l:tarfile = l:argument
|
||||
while 1
|
||||
if (l:tarfile == "" || l:tarfile == "/")
|
||||
echo "ERROR: Could not find a readable tarfile in path:" l:argument
|
||||
echo "***error*** (tar#Read) Could not find a readable tarfile in path:" l:argument
|
||||
" call Dret("tar#Read")
|
||||
return
|
||||
endif
|
||||
|
||||
@ -42,6 +44,7 @@ function! tar#Read(argument, cleanup)
|
||||
let l:toextract = strpart(l:argument, strlen(l:tarfile) + 1)
|
||||
|
||||
if (l:toextract == "")
|
||||
" call Dret("tar#Read")
|
||||
return
|
||||
endif
|
||||
|
||||
@ -52,12 +55,90 @@ function! tar#Read(argument, cleanup)
|
||||
if (a:cleanup)
|
||||
0d "blank line
|
||||
execute "doautocmd BufReadPost " . expand("%")
|
||||
setlocal readonly
|
||||
setlocal nomod
|
||||
silent preserve
|
||||
endif
|
||||
endfunction
|
||||
" call Dret("tar#Read")
|
||||
endfun
|
||||
|
||||
function! tar#Browse(tarfile)
|
||||
" ---------------------------------------------------------------------
|
||||
" tar#Write: {{{1
|
||||
fun! tar#Write(argument)
|
||||
" call Dfunc("tar#Write(argument<".a:argument.">)")
|
||||
"
|
||||
" sanity checks
|
||||
if !executable("tar")
|
||||
echo "***error*** (TarWrite) sorry, your system doesn't appear to have the tar pgm"
|
||||
" call Dret("tar#Write")
|
||||
return
|
||||
endif
|
||||
if !exists("*mkdir")
|
||||
echo "***error*** (TarWrite) sorry, mkdir() doesn't work on your system"
|
||||
" call Dret("tar#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/
|
||||
echo "***error*** (TarWrite) cannot cd to temporary directory"
|
||||
" call Dret("tar#Write")
|
||||
return
|
||||
endtry
|
||||
" call Decho("current directory now: ".getcwd())
|
||||
|
||||
" place temporary files under .../_TARVIM_/
|
||||
if isdirectory("_TARVIM_")
|
||||
call s:Rmdir("_TARVIM_")
|
||||
endif
|
||||
call mkdir("_TARVIM_")
|
||||
cd _TARVIM_
|
||||
" call Decho("current directory now: ".getcwd())
|
||||
|
||||
let tarfile = curdir."/".substitute(a:argument,'tarfile:\([^/]\{-}\)/.*$','\1','')
|
||||
let path = substitute(a:argument,'^.\{-}/','','')
|
||||
let dirpath = substitute(path,'/\=[^/]\+$','','')
|
||||
" call Decho("path <".path.">")
|
||||
" call Decho("dirpath<".dirpath.">")
|
||||
call mkdir(dirpath,"p")
|
||||
exe "w! ".path
|
||||
if executable("cygpath")
|
||||
let path = substitute(system("cygpath ".path),'\n','','e')
|
||||
let tarfile = substitute(system("cygpath ".tarfile),'\n','','e')
|
||||
endif
|
||||
|
||||
" call Decho("tar --delete -f ".tarfile." ".path)
|
||||
call system("tar --delete -f ".tarfile." ".path)
|
||||
if v:shell_error != 0
|
||||
echo "***error*** (TarWrite) sorry, your tar pgm doesn't support deletion of ".path
|
||||
else
|
||||
" call Decho("tar -rf ".tarfile." ".path)
|
||||
call system("tar -rf ".tarfile." ".path)
|
||||
endif
|
||||
|
||||
" cleanup and restore current directory
|
||||
cd ..
|
||||
call s:Rmdir("_TARVIM_")
|
||||
exe "cd ".escape(curdir,' \')
|
||||
setlocal nomod
|
||||
|
||||
" call Dret("tar#Write")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" tar#Browse: {{{1
|
||||
fun! tar#Browse(tarfile)
|
||||
" call Dfunc("tar#Browse(tarfile<".a:tarfile.">)")
|
||||
setlocal noswapfile
|
||||
setlocal buftype=nofile
|
||||
setlocal bufhidden=hide
|
||||
@ -76,11 +157,12 @@ function! tar#Browse(tarfile)
|
||||
endif
|
||||
|
||||
if ! filereadable(l:tarfile)
|
||||
echo "ERROR: File not readable:" l:tarfile
|
||||
echo "***error*** (tar#Browse) File not readable:" l:tarfile
|
||||
" call Dret("tar#Browse")
|
||||
return
|
||||
endif
|
||||
|
||||
call s:Say("\" tar.vim version " . s:version)
|
||||
call s:Say("\" tar.vim version " . g:loaded_tar)
|
||||
call s:Say("\" Browsing tarfile " . l:tarfile)
|
||||
call s:Say("\" Hit ENTER to view a file in a new window")
|
||||
call s:Say("")
|
||||
@ -89,12 +171,15 @@ function! tar#Browse(tarfile)
|
||||
0d "blank line
|
||||
/^$/1
|
||||
|
||||
setlocal readonly
|
||||
setlocal nomodifiable
|
||||
noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
|
||||
endfunction
|
||||
setlocal noma nomod ro
|
||||
|
||||
function! s:TarBrowseSelect()
|
||||
noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
|
||||
" call Dret("tar#Browse")
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" TarBrowseSelect: {{{1
|
||||
fun! s:TarBrowseSelect()
|
||||
let l:line = getline(".")
|
||||
|
||||
if (l:line =~ '^" ')
|
||||
@ -110,10 +195,12 @@ function! s:TarBrowseSelect()
|
||||
new
|
||||
wincmd _
|
||||
execute "e " . l:selection
|
||||
endfunction
|
||||
endfun
|
||||
|
||||
" kludge to deal with compressed archives
|
||||
function! s:TarCatCommand(tarfile)
|
||||
" ---------------------------------------------------------------------
|
||||
" TarCatCommand: kludge to deal with compressed archives {{{1
|
||||
fun! s:TarCatCommand(tarfile)
|
||||
" call Dfunc("s:TarCatCommand(tarfile<".a:tarfile.">)")
|
||||
if a:tarfile =~# '\.\(gz\|tgz\|Z\)$'
|
||||
let l:cat = "gzip -d -c"
|
||||
elseif a:tarfile =~# '\.bz2$'
|
||||
@ -121,10 +208,33 @@ function! s:TarCatCommand(tarfile)
|
||||
else
|
||||
let l:cat = "cat"
|
||||
endif
|
||||
" call Dret("s:TarCatCommand ".l:cat)
|
||||
return l:cat
|
||||
endfunction
|
||||
endfun
|
||||
|
||||
function! s:Say(string)
|
||||
" ---------------------------------------------------------------------
|
||||
" Say: {{{1
|
||||
fun! s:Say(string)
|
||||
let @" = a:string
|
||||
$ put
|
||||
endfunction
|
||||
endfun
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Rmdir: {{{1
|
||||
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: {{{1
|
||||
" vim:set ts=8 sts=4 sw=4 fdm=marker:
|
||||
|
@ -1,4 +1,4 @@
|
||||
*motion.txt* For Vim version 7.0aa. Last change: 2005 Jul 31
|
||||
*motion.txt* For Vim version 7.0aa. Last change: 2005 Sep 14
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -642,6 +642,8 @@ i' *v_i'* *i'*
|
||||
i` *v_i`* *i`*
|
||||
Like a", a' and a`, but exclude the quotes and
|
||||
repeating won't extend the Visual selection.
|
||||
Special case: With a count of 2 the quotes are
|
||||
included, but no extra white space as with a"/a'/a`.
|
||||
|
||||
When used after an operator:
|
||||
For non-block objects:
|
||||
|
@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 7.0aa. Last change: 2005 Sep 13
|
||||
*todo.txt* For Vim version 7.0aa. Last change: 2005 Sep 14
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -36,8 +36,6 @@ ccomplete:
|
||||
|
||||
When 'foldcolumn' is 1 show more + to be able to open all folds? (Donohue)
|
||||
|
||||
After vi" another i" should include the quotes.
|
||||
|
||||
Mac unicode patch (Da Woon Jung):
|
||||
- selecting proportional font breaks display
|
||||
- UTF-8 text causes display problems. Font replacement causes this.
|
||||
|
@ -1,8 +1,8 @@
|
||||
" Vim syntax file
|
||||
" Language: TeX
|
||||
" Maintainer: Dr. Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM>
|
||||
" Last Change: Aug 15, 2005
|
||||
" Version: 29
|
||||
" Last Change: Sep 14, 2005
|
||||
" Version: 30
|
||||
" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
|
||||
"
|
||||
" Notes: {{{1
|
||||
@ -73,7 +73,7 @@ endif
|
||||
if !exists("g:tex_fold_enabled")
|
||||
let g:tex_fold_enabled= 0
|
||||
elseif g:tex_fold_enabled && !has("folding")
|
||||
let g:sh_fold_enabled= 0;
|
||||
let g:tex_fold_enabled= 0
|
||||
echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support"
|
||||
endif
|
||||
if g:tex_fold_enabled && &fdm == "manual"
|
||||
|
@ -1418,7 +1418,10 @@ EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer"));
|
||||
EXTERN char_u e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));
|
||||
#endif
|
||||
EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
|
||||
#if defined(FEAT_SYN_HL) || \
|
||||
(defined(FEAT_INS_EXPAND) && defined(FEAT_COMPL_FUNC))
|
||||
EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
|
||||
#endif
|
||||
|
||||
#ifdef MACOS_X_UNIX
|
||||
EXTERN short disallow_gui INIT(= FALSE);
|
||||
|
82
src/search.c
82
src/search.c
@ -4085,11 +4085,10 @@ find_prev_quote(line, col_start, quotechar, escape)
|
||||
* Find quote under the cursor, cursor at end.
|
||||
* Returns TRUE if found, else FALSE.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
current_quote(oap, count, include, quotechar)
|
||||
oparg_T *oap;
|
||||
long count; /* not used */
|
||||
long count;
|
||||
int include; /* TRUE == include quote char */
|
||||
int quotechar; /* Quote character */
|
||||
{
|
||||
@ -4100,15 +4099,51 @@ current_quote(oap, count, include, quotechar)
|
||||
#ifdef FEAT_VISUAL
|
||||
int vis_empty = TRUE; /* Visual selection <= 1 char */
|
||||
int vis_bef_curs = FALSE; /* Visual starts before cursor */
|
||||
int inside_quotes = FALSE; /* Looks like "i'" done before */
|
||||
int selected_quote = FALSE; /* Has quote inside selection */
|
||||
int i;
|
||||
|
||||
/* Correct cursor when 'selection' is exclusive */
|
||||
if (VIsual_active)
|
||||
{
|
||||
vis_bef_curs = lt(VIsual, curwin->w_cursor);
|
||||
if (*p_sel == 'e' && vis_bef_curs)
|
||||
dec_cursor();
|
||||
vis_empty = equalpos(VIsual, curwin->w_cursor);
|
||||
vis_bef_curs = lt(VIsual, curwin->w_cursor);
|
||||
}
|
||||
|
||||
if (!vis_empty)
|
||||
{
|
||||
/* Check if the existing selection exactly spans the text inside
|
||||
* quotes. */
|
||||
if (vis_bef_curs)
|
||||
{
|
||||
inside_quotes = VIsual.col > 0
|
||||
&& line[VIsual.col - 1] == quotechar
|
||||
&& line[curwin->w_cursor.col] != NUL
|
||||
&& line[curwin->w_cursor.col + 1] == quotechar;
|
||||
i = VIsual.col;
|
||||
col_end = curwin->w_cursor.col;
|
||||
}
|
||||
else
|
||||
{
|
||||
inside_quotes = curwin->w_cursor.col > 0
|
||||
&& line[curwin->w_cursor.col - 1] == quotechar
|
||||
&& line[VIsual.col] != NUL
|
||||
&& line[VIsual.col + 1] == quotechar;
|
||||
i = curwin->w_cursor.col;
|
||||
col_end = VIsual.col;
|
||||
}
|
||||
|
||||
/* Find out if we have a quote in the selection. */
|
||||
while (i <= col_end)
|
||||
if (line[i++] == quotechar)
|
||||
{
|
||||
selected_quote = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!vis_empty && line[col_start] == quotechar)
|
||||
{
|
||||
/* Already selecting something and on a quote character. Find the
|
||||
@ -4218,14 +4253,29 @@ current_quote(oap, count, include, quotechar)
|
||||
--col_start;
|
||||
}
|
||||
|
||||
/* Set start position */
|
||||
if (!include)
|
||||
/* Set start position. After vi" another i" must include the ".
|
||||
* For v2i" include the quotes. */
|
||||
if (!include && count < 2
|
||||
#ifdef FEAT_VISUAL
|
||||
&& (vis_empty || !inside_quotes)
|
||||
#endif
|
||||
)
|
||||
++col_start;
|
||||
curwin->w_cursor.col = col_start;
|
||||
#ifdef FEAT_VISUAL
|
||||
if (VIsual_active)
|
||||
{
|
||||
if (vis_empty)
|
||||
/* Set the start of the Visual area when the Visual area was empty, we
|
||||
* were just inside quotes or the Visual area didn't start at a quote
|
||||
* and didn't include a quote.
|
||||
*/
|
||||
if (vis_empty
|
||||
|| (vis_bef_curs
|
||||
&& !selected_quote
|
||||
&& (inside_quotes
|
||||
|| (line[VIsual.col] != quotechar
|
||||
&& (VIsual.col == 0
|
||||
|| line[VIsual.col - 1] != quotechar)))))
|
||||
{
|
||||
VIsual = curwin->w_cursor;
|
||||
redraw_curbuf_later(INVERTED);
|
||||
@ -4240,7 +4290,12 @@ current_quote(oap, count, include, quotechar)
|
||||
|
||||
/* Set end position. */
|
||||
curwin->w_cursor.col = col_end;
|
||||
if (include && inc_cursor() == 2)
|
||||
if ((include || count > 1
|
||||
#ifdef FEAT_VISUAL
|
||||
/* After vi" another i" must include the ". */
|
||||
|| (!vis_empty && inside_quotes)
|
||||
#endif
|
||||
) && inc_cursor() == 2)
|
||||
inclusive = TRUE;
|
||||
#ifdef FEAT_VISUAL
|
||||
if (VIsual_active)
|
||||
@ -4253,7 +4308,18 @@ current_quote(oap, count, include, quotechar)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Cursor is at start of Visual area. */
|
||||
/* Cursor is at start of Visual area. Set the end of the Visual
|
||||
* area when it was just inside quotes or it didn't end at a
|
||||
* quote. */
|
||||
if (inside_quotes
|
||||
|| (!selected_quote
|
||||
&& line[VIsual.col] != quotechar
|
||||
&& (line[VIsual.col] == NUL
|
||||
|| line[VIsual.col + 1] != quotechar)))
|
||||
{
|
||||
dec_cursor();
|
||||
VIsual = curwin->w_cursor;
|
||||
}
|
||||
curwin->w_cursor.col = col_start;
|
||||
}
|
||||
if (VIsual_mode == 'V')
|
||||
|
@ -6163,6 +6163,12 @@ init_highlight(both, reset)
|
||||
for (i = 0; pp[i] != NULL; ++i)
|
||||
do_highlight((char_u *)pp[i], reset, TRUE);
|
||||
|
||||
/* Magenta background looks ugly, but grey may not work for 8 colors.
|
||||
* Thus let it depend on the number of colors available. */
|
||||
if (t_colors > 8)
|
||||
do_highlight((char_u *)(*p_bg == 'l' ? "Visual ctermbg=LightGrey"
|
||||
: "Visual ctermbg=DarkGrey"), reset, TRUE);
|
||||
|
||||
#ifdef FEAT_SYN_HL
|
||||
/*
|
||||
* If syntax highlighting is enabled load the highlighting for it.
|
||||
|
@ -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 13)"
|
||||
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Sep 13, compiled "
|
||||
#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 "
|
||||
|
Loading…
x
Reference in New Issue
Block a user