" Vim completion script
" Language: XHTML 1.0 Strict
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
-" Last Change: 2006 Feb 6
+" Last Change: 2006 Feb 18
function! htmlcomplete#CompleteTags(findstart, base)
if a:findstart
let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
return [opentag.">"]
endif
+ " Load data {{{
+ if !exists("g:xmldata_xhtml10s")
+ runtime! autoload/xml/xhtml10s.vim
+ endif
+ " }}}
+ " Tag completion {{{
" Deal with tag completion.
let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
if opentag == ''
" Hack for sometimes failing GetLastOpenTag.
" As far as I tested fail isn't GLOT fault but problem
" of invalid document - not properly closed tags and other mish-mash.
- " If returns empty string assume <body>. Safe bet.
- let opentag = 'body'
- endif
- " }}}
- " Load data {{{
- if !exists("g:xmldata_xhtml10s")
- runtime! autoload/xml/xhtml10s.vim
+ " Also when document is empty. Return list of *all* tags.
+ let tags = keys(g:xmldata_xhtml10s)
+ call filter(tags, 'v:val !~ "^vimxml"')
+ else
+ let tags = g:xmldata_xhtml10s[opentag][0]
endif
" }}}
- " Tag completion {{{
- let tags = g:xmldata_xhtml10s[opentag][0]
for m in sort(tags)
if m =~ '^'.context
" Vim completion script
" Language: XML
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
-" Last Change: 2006 Feb 6
+" Last Change: 2006 Feb 18
" This function will create Dictionary with users namespace strings and values
" canonical (system) names of data files. Names should be lowercase,
let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
let opentag = substitute(opentag, '^\k*:', '', '')
if opentag == ''
- return []
+ "return []
+ let tags = keys(g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]})
+ call filter(tags, 'v:val !~ "^vimxml"')
+ else
+ let tags = g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[opentag][0]
endif
- let tags = g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[opentag][0]
let context = substitute(context, '^\k*:', '', '')
for m in tags
starting.txt \
spell.txt \
syntax.txt \
+ tabpage.txt \
tagsrch.txt \
term.txt \
tips.txt \
starting.html \
spell.html \
syntax.html \
+ tabpage.html \
tagsrch.html \
tags.html \
term.html \
-*autocmd.txt* For Vim version 7.0aa. Last change: 2006 Feb 13
+*autocmd.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
|WinEnter| after entering another window
|WinLeave| before leaving a window
+|TabEnterPost| after entering another tab page
+|TabLeavePre| before leaving a tab page
|CmdwinEnter| after entering the command-line window
|CmdwinLeave| before leaving the command-line window
where this option was set, and <amatch> for
the new value of 'syntax'.
See |:syn-on|.
+ *TabEnterPost*
+TabEnterPost Just after entering a tab page. |tab-page|
+ Before triggering the WinEnter and BufEnter
+ events.
+ *TabLeavePre*
+TabLeavePre Just before leaving a tab page. |tab-page|
+ BufLeave and WinLeave events will have been
+ triggered first.
*TermChanged*
TermChanged After the value of 'term' has changed. Useful
for re-loading the syntax file to update the
-*diff.txt* For Vim version 7.0aa. Last change: 2006 Jan 22
+*diff.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
This only works when a standard "diff" command is available. See 'diffexpr'.
+Diffs are local to the current tab page |tab-page|. You can't see diffs with
+a window in another tab page. This does make it possible to have several
+diffs at the same time, each in their own tab page.
+
What happens is that Vim opens a window for each of the files. This is like
using the |-O| argument. This uses vertical splits. If you prefer horizontal
splits add the |-o| argument: >
*:diffo* *:diffoff*
:diffoff Switch off diff mode for the current window.
-:diffoff! Switch off diff mode for all windows.
+:diffoff! Switch off diff mode for all windows in the current tab page.
The ":diffoff" command resets the relevant options to their default value.
This may be different from what the values were before diff mode was started,
-*editing.txt* For Vim version 7.0aa. Last change: 2006 Jan 20
+*editing.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
Vim refuses to |abandon| the current buffer, and when
the last file in the argument list has not been
edited.
+ If there are other tab pages and quitting the last
+ window in the current tab page the current tab page is
+ closed |tab-page|.
:conf[irm] q[uit] Quit, but give prompt when changes have been made, or
the last file in the argument list has not been
-*eval.txt* For Vim version 7.0aa. Last change: 2006 Feb 14
+*eval.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
String attribute {what} of syntax ID {synID}
synIDtrans( {synID}) Number translated syntax ID of {synID}
system( {expr} [, {input}]) String output of shell command/filter {expr}
+tabpage( [{expr}]) Number number of current tab page
taglist( {expr}) List list of tags matching {expr}
tagfiles() List tags files used
tempname() String name for a temporary file
wincol() Number window column of the cursor
winheight( {nr}) Number height of window {nr}
winline() Number window line of the cursor
-winnr() Number number of current window
+winnr( [{expr}]) Number number of current window
winrestcmd() String returns command to restore window sizes
winwidth( {nr}) Number width of window {nr}
writefile({list}, {fname} [, {binary}])
Use |:checktime| to force a check.
+tabpagenr([{arg}]) *tabpagenr()*
+ The result is a Number, which is the number of the current
+ tab page. The first tab page has number 1.
+ When the optional argument is "$", the number of the last tab
+ page is returned (the tab page count).
+ The number can be used with the |:tab| command.
+
+
taglist({expr}) *taglist()*
Returns a list of tags matching the regular expression {expr}.
Each list item is a dictionary with at least the following
winnr([{arg}]) The result is a Number, which is the number of the current
window. The top window has number 1.
When the optional argument is "$", the number of the
- last window is returnd (the window count).
+ last window is returned (the window count).
When the optional argument is "#", the number of the last
accessed window is returned (where |CTRL-W_p| goes to).
If there is no previous window 0 is returned.
-*help.txt* For Vim version 7.0aa. Last change: 2005 Nov 30
+*help.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM - main help file
k
|tagsrch.txt| tags and special searches
|quickfix.txt| commands for a quick edit-compile-fix cycle
|windows.txt| commands for using multiple windows and buffers
+|tabpage.txt| commands for using multiple tab pages
|syntax.txt| syntax highlighting
|spell.txt| spell checking
|diff.txt| working with two or three versions of the same file
-*index.txt* For Vim version 7.0aa. Last change: 2006 Jan 26
+*index.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
|:omap| :om[ap] like ":map" but for Operator-pending mode
|:omapclear| :omapc[lear] remove all mappings for Operator-pending mode
|:omenu| :ome[nu] add menu for Operator-pending mode
-|:only| :on[ly] close all windows except current one
+|:only| :on[ly] close all windows except the current one
|:onoremap| :ono[remap] like ":noremap" but for Operator-pending mode
|:onoremenu| :onoreme[nu] like ":noremenu" but for Operator-pending mode
|:options| :opt[ions] open the options-window
|:syncbind| :sync[bind] sync scroll binding
|:t| :t same as ":copy"
|:tNext| :tN[ext] jump to previous matching tag
+|:tabclose| :tabc[lose] close current tab page
+|:tabedit| :tabe[dit] edit a file in a new tab page
+|:tabfind| :tabf[ind] find file in 'path', edit it in a new tab page
+|:tabnew| :tabn[ew] edit a file in a new tab page
+|:tabonly| :tabo[nly] close all tab pages except the current one
+|:tabs| :tabs list the tab pages and what they contain
+|:tab| :tab jump to another tab page
|:tag| :ta[g] jump to tag
|:tags| :tags show the contents of the tag stack
|:tcl| :tc[l] execute Tcl command
-*options.txt* For Vim version 7.0aa. Last change: 2006 Feb 14
+*options.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
winsize window sizes
Don't include both "curdir" and "sesdir".
+ There is no option to include tab pages yet, only the current tab page
+ is stored in the session. |tab-page|
When "curdir" nor "sesdir" is included, file names are stored with
absolute paths.
"slash" and "unix" are useful on Windows when sharing session files
'S' flag in 'cpoptions'.
Only normal file name characters can be used, "/\*?[|<>" are illegal.
+ *'tabline'* *'tal'*
+'tabline' 'tal' number (default 1)
+ global
+ {not in Vi}
+ {not available when compiled without the +windows
+ feature}
+ The value of this option specifies when the line with tab page labels
+ will be displayed:
+ 0: never
+ 1: only if there are at least two tab pages
+ 2: always
+ |tab-page|
+
*'tabstop'* *'ts'*
'tabstop' 'ts' number (default 8)
local to buffer
-*starting.txt* For Vim version 7.0aa. Last change: 2006 Feb 14
+*starting.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
-O[N] Open N windows, split vertically. Otherwise it's like -o.
If both the -o and the -O option are given, the last one on
the command line determines how the windows will be split.
+ {not in Vi}
+
+ *-p*
+-p[N] Open N tab pages. If [N] is not given, one tab page is opened
+ for every file given as argument. The maximum is 10 tab
+ pages. If there are more tab pages than arguments, the last
+ few tab pages will be editing an empty file.
{not in Vi}
*-T*
11. Open all windows
When the |-o| flag was given, windows will be opened (but not
displayed yet).
+ When the |-p| flag was given, tab pages will be created (but not
+ displayed yet).
When switching screens, it happens now. Redrawing starts.
If the "-q" flag was given to Vim, the first error is jumped to.
Buffers for all windows will be loaded.
:nmap <F2> :wa<Bar>exe "mksession! " . v:this_session<CR>:so ~/sessions/
This saves the current Session, and starts off the command to load another.
+A session only includes the current tab page. There currently is no option to
+store all tab pages. |tab-page|
+
The |SessionLoadPost| autocmd event is triggered after a session file is
loaded/sourced.
*SessionLoad-variable*
--- /dev/null
+*tabpage.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
+
+
+ VIM REFERENCE MANUAL by Bram Moolenaar
+
+
+Editing with windows in multuple tab pages. *tab-page* *tabpage*
+
+The commands which have been added to use multiple tab pages are explained
+here. Additionally, there are explanations for commands that work differently
+when used in combination with more than one tab page.
+
+1. Introduction |tab-page-intro|
+2. Commands |tab-page-commands|
+3. Other items |tab-page-other|
+
+{Vi does not have any of these commands}
+{not able to use multiple tab pages when the |+windows| feature was disabled
+at compile time}
+
+==============================================================================
+1. Introduction *tab-page-intro*
+
+A tab page holds one or more windows. You can easily switch between tab
+pages, so that you have several collections of windows to work on different
+things.
+
+Usually you will see a list of labels at the top of the Vim window, one for
+each tab page. With the mouse you can click on the label to jump to that tab
+page. There are other ways to move between tab pages, see below.
+
+Most commands work only in the current tab page. That includes the |CTRL-W|
+commands, |:windo|, |:all| and |:ball|. The commands that are aware of
+other tab pages than the current one are mentioned below.
+
+Tabs are also a nice way to edit a buffer temporarily without changing the
+current window layout. Open a new tab page, do whatever you want to do and
+close the tab page.
+
+==============================================================================
+2. Commands *tab-page-commands*
+
+OPENING A NEW TAB PAGE:
+
+When starting Vim "vim -p filename ..." opens each file argument in a separate
+tab page (up to 10). |-p|
+
+:tabe[dit] *:tabe* *:tabedit*
+:tabn[ew] Open a new tab page with an empty window.
+
+:tabe[dit] [++opt] [+cmd] {file}
+:tabn[ew] [++opt] [+cmd] {file}
+ Open a new tab page and edit {file}, like with |:edit|.
+
+:tabf[ind] [++opt] [+cmd] {file}
+ Open a new tab page and edit {file} in 'path', like with
+ |:find|.
+ {not available when the |+file_in_path| feature was disabled
+ at compile time}
+
+
+CLOSING A TAB PAGE:
+
+Using |:close| in the last window of a tab page closes it.
+
+Using the mouse: If the tab page line is displayed you can click in the "X" at
+the top right to close the current tab page. |'tabline'|
+
+ *:tabc* *:tabclose*
+:tabc[lose][!] Close current tab page.
+ This command fails when:
+ - There is only one tab page on the screen. *E784*
+ - When 'hidden' is not set, [!] is not used, a buffer has
+ changes, and there is no other window on this buffer.
+ Changes to the buffer are not written and won't get lost, so
+ this is a "safe" command.
+
+:tabc[lose][!] {count}
+ Close tab page {count}. Fails in the same way as ':tabclose"
+ above.
+
+ *:tabo* *:tabonly*
+:tabo[nly][!] Close all other tab pages.
+ When the 'hidden' option is set, all buffers in closed windows
+ become hidden.
+ When 'hidden' is not set, and the 'autowrite' option is set,
+ modified buffers are written. Otherwise, windows that have
+ buffers that are modified are not removed, unless the [!] is
+ given, then they become hidden. But modified buffers are
+ never abandoned, so changes cannot get lost.
+
+
+SWITCHING TO ANOTHER TAB PAGE:
+
+Using the mouse: If the tab page line is displayed you can click in a tab page
+label to switch to that tab page. |'tabline'|
+
+:tab *:tab* *gt*
+gt Go to the next tab page. Wraps around from the last to the
+ first one.
+
+:tab {count}
+{count}gt Go to tab page {count}. The first tab page has number one.
+
+
+Other commands:
+ *:tabs*
+:tabs List the tab pages and the windows they contain. Shows a "+"
+ for modified buffers.
+
+==============================================================================
+3. Other items *tab-page-other*
+
+You can use the 'tabline' option to specify when you want the line with tab
+page labels to appear: never, when there is more than one tab page or always.
+
+Diff mode works per tab page. You can see the diffs between several files
+within one tab page. Other tab pages can show differences between other
+files.
+
+The TabLeavePre and TabEnterPost autocommand events can be used to do
+something when switching from one tab page to another.
+
+
+ vim:tw=78:ts=8:ft=help:norl:
't_vs' term.txt /*'t_vs'*
't_xs' term.txt /*'t_xs'*
'ta' options.txt /*'ta'*
+'tabline' options.txt /*'tabline'*
'tabstop' options.txt /*'tabstop'*
'tag' options.txt /*'tag'*
'tagbsearch' options.txt /*'tagbsearch'*
'tagrelative' options.txt /*'tagrelative'*
'tags' options.txt /*'tags'*
'tagstack' options.txt /*'tagstack'*
+'tal' options.txt /*'tal'*
'tb' options.txt /*'tb'*
'tbi' options.txt /*'tbi'*
'tbidi' options.txt /*'tbidi'*
-n starting.txt /*-n*
-nb starting.txt /*-nb*
-o starting.txt /*-o*
+-p starting.txt /*-p*
-q starting.txt /*-q*
-qf starting.txt /*-qf*
-r starting.txt /*-r*
:tN tagsrch.txt /*:tN*
:tNext tagsrch.txt /*:tNext*
:ta tagsrch.txt /*:ta*
+:tab tabpage.txt /*:tab*
+:tabc tabpage.txt /*:tabc*
+:tabclose tabpage.txt /*:tabclose*
+:tabe tabpage.txt /*:tabe*
+:tabedit tabpage.txt /*:tabedit*
+:tabo tabpage.txt /*:tabo*
+:tabonly tabpage.txt /*:tabonly*
+:tabs tabpage.txt /*:tabs*
:tag tagsrch.txt /*:tag*
:tags tagsrch.txt /*:tags*
:tc if_tcl.txt /*:tc*
E781 spell.txt /*E781*
E782 spell.txt /*E782*
E783 spell.txt /*E783*
+E784 tabpage.txt /*E784*
E79 message.txt /*E79*
E80 message.txt /*E80*
E800 arabic.txt /*E800*
TERM starting.txt /*TERM*
TTpro-telnet syntax.txt /*TTpro-telnet*
Tab intro.txt /*Tab*
+TabEnterPost autocmd.txt /*TabEnterPost*
+TabLeavePre autocmd.txt /*TabLeavePre*
Tcl if_tcl.txt /*Tcl*
TermChanged autocmd.txt /*TermChanged*
TermResponse autocmd.txt /*TermResponse*
gs various.txt /*gs*
gsp.vim syntax.txt /*gsp.vim*
gstar pattern.txt /*gstar*
+gt tabpage.txt /*gt*
gtk-tooltip-colors gui_x11.txt /*gtk-tooltip-colors*
gu change.txt /*gu*
gugu change.txt /*gugu*
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*
t_vs term.txt /*t_vs*
t_xs term.txt /*t_xs*
tab intro.txt /*tab*
+tab-page tabpage.txt /*tab-page*
+tab-page-commands tabpage.txt /*tab-page-commands*
+tab-page-intro tabpage.txt /*tab-page-intro*
+tab-page-other tabpage.txt /*tab-page-other*
+tabpage tabpage.txt /*tabpage*
+tabpage.txt tabpage.txt /*tabpage.txt*
+tabpagenr() eval.txt /*tabpagenr()*
tag tagsrch.txt /*tag*
tag-! tagsrch.txt /*tag-!*
tag-any-white tagsrch.txt /*tag-any-white*
-*tips.txt* For Vim version 7.0aa. Last change: 2006 Feb 16
+*tips.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
This example shows the use of a few advanced tricks:
- using the |CursorMoved| autocommand event
- using |searchpairpos()| to find a matching paren
+- using |synID()| to detect whether the cursor is in a string or comment
- using |:match| to highlight something
- using a |pattern| to match a specific position in the file.
This should be put in a Vim script file, since it uses script-local variables.
-Note that it doesn't recognize strings or comments in the text.
+It skips matches in strings or comments, unless the cursor started in string
+or comment. This requires syntax highlighting.
>
let s:paren_hl_on = 0
function s:Highlight_Matching_Paren()
let c = '\['
let c2 = '\]'
endif
+ let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
+ \ '=~? "string\\|comment"'
+ execute 'if' s_skip '| let s_skip = 0 | endif'
- let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags)
+ let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip)
if m_lnum > 0 && m_lnum >= line('w0') && m_lnum <= line('w$')
exe 'match Search /\(\%' . c_lnum . 'l\%' . c_col .
-*todo.txt* For Vim version 7.0aa. Last change: 2006 Feb 17
+*todo.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
Support WINDOW TABS. Works like several pages, each with their own split
windows. Let's call them "tab pages".
- - Add tabpage(): returns current tab page number.
- - ":tabsplit" makes a copy of the current tab page.
- - Add TabLeavePre and TabEnterPost autocommands
- line at top of frame with tabs.
Add 'tabtext' option, like 'statusline'.
- - check for E999
- - docs:
- General remark: commands that work on windows only work on the windows
- in the current tab page. Including :windo.
- Session file only contains the current tab page.
- :tabedit
- :tabfind
- :tab N
- :tabs
- {count}gt
- :close may close current tab page if there is one window.
- :tabclose
- :tabclose N - close tab N
- :tabonly - close all other tabs.
- :close and :quit (last window in tab)
- "gt": Use "1gt" - "99gt" to switch to another tab. "gt" goes to the
- next one. Hint in docs: To mess with another buffer, without
- changing the window layout, do this in another tab.
- 'tabline' values 0/1/2
- mouse click in tabline:
- select a tab page
- X closes current tab page
- :argall and :ball only opens window for buffers that are not in any
- window in any tab page
- :diffoff only works in the current tab page
- diff works per tab page
- "vim -p *" opens each file in a separate tab page (up to 10).
- - add GUI Tabs for some systems.
- Patch for GTK 1.2 passed on by Christian Michon, 2004 Jan 6.
- Simple patch for GTK by Luis M (nov 7).
- Need to be able to search the windows in inactive tabs, e.g. for the
- quickfix window.
-Future enhancements:
- tab page local variables?
- tab page local options? 'diffopt' could differ between tab pages.
- tab page local colors?
+ quickfix window?
+ - docs:
+ Add info to the user manual somewhere.
Crash with X command server (Ciaran McCreesh).
-Motif: in diff mode dragging one scrollbar doesn't update the other one.
-
Ctags still hasn't included the patch. Darren is looking for someone to do
maintanance.
Check if file explorer can handle directory names and links with a single
quote. (Nieko Maatjes, 2005 Jan 4)
+Future enhancements for tab pages:
+ - Add GUI Tabs for all systems.
+ Patch for GTK 1.2 passed on by Christian Michon, 2004 Jan 6.
+ Simple patch for GTK by Luis M (nov 7).
+ - ":tabsplit" makes a copy of the current tab page.
+ - Add local variables for each tab page?
+ - Add local options for each tab page? E.g., 'diffopt' could differ
+ between tab pages.
+ - Add local highlighting for a tab page?
+
Vi incompatibility:
8 With undo/redo only marks in the changed lines should be changed. Other
-*version7.txt* For Vim version 7.0aa. Last change: 2006 Feb 17
+*version7.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
When "umask" is set such that nothing is writable then the viminfo file would
be written without write permission. (Julian Bridle)
+Motif: In diff mode dragging one scrollbar didn't update the scrollbar of the
+other diff'ed window.
+
vim:tw=78:ts=8:ft=help:norl:
-*windows.txt* For Vim version 7.0aa. Last change: 2006 Jan 27
+*windows.txt* For Vim version 7.0aa. Last change: 2006 Feb 18
VIM REFERENCE MANUAL by Bram Moolenaar
Note: All CTRL-W commands can also be executed with |:wincmd|, for those
places where a Normal mode command can't be used or is inconvenient.
+The main Vim window can hold several split windows. There are also tab pages
+|tab-page|, each of which can hold multiple windows.
+
==============================================================================
2. Starting Vim *windows-starting*
:clo[se][!] Close current window. When the 'hidden' option is set, or
when the buffer was changed and the [!] is used, the buffer
becomes hidden (unless there is another window editing it).
+ When there is only one window in the current tab page and
+ there is another tab page, this closes the current tab page.
+ |tab-page|.
This command fails when: *E444*
- There is only one window on the screen.
- When 'hidden' is not set, [!] is not used, the buffer has
:hid[e] Quit current window, unless it is the last window on the
screen. The buffer becomes hidden (unless there is another
window editing it or 'bufhidden' is "unload" or "delete").
+ If the window is the last one in the current tab page the tab
+ page is closed. |tab-page|
The value of 'hidden' is irrelevant for this command.
Changes to the buffer are not written and won't get lost, so
this is a "safe" command.
Rearrange the screen to open one window for each argument.
All other windows are closed. When a count is given, this is
the maximum number of windows to open.
+ Only uses the current tab page |tab-page|.
When the 'hidden' option is set, all buffers in closed windows
become hidden.
When 'hidden' is not set, and the 'autowrite' option is set,
CTRL-W w
:{cmd}
etc.
-< When an error is detected on one window, further
+< This only works in the current tab page.
+ When an error is detected on one window, further
windows will not be visited.
The last window (or where an error occurred) becomes
the current window.
of windows opened ('winwidth' if |:vertical| was prepended).
Buf/Win Enter/Leave autocommands are not executed for the new
windows here, that's only done when they are really entered.
+ Only uses the current tab page |tab-page|.
Note: All the commands above that start editing another buffer, keep the
'readonly' flag as it was. This differs from the ":edit" command, which sets
directory. You can move this bundle (the Vim.app directory) anywhere
you want, for example, /Applications.
+ You need at least Xcode 1.5 to compile Vim 7.0.
+
+
1.2 X-Windows or Plain Text
If you do not want the Carbon interface, you must explicitly tell
configure to use a different GUI.
cd ..
- ./configure --enable-gui=gtk2
+ ./configure --disable-darwin --enable-gui=gtk2
make; make install
NOTE: The following GUI options are supported:
$(ALL_GUI_PRO) \
$(TCL_PRO)
+ICON_APP = gui_mac.icns
+
PRO_MANUAL = os_amiga.pro os_msdos.pro os_win16.pro os_win32.pro \
os_mswin.pro os_beos.pro os_vms.pro os_riscos.pro $(PERL_PRO)
cp config.mk.dist $(SHADOWDIR)
mkdir $(SHADOWDIR)/xxd
cd $(SHADOWDIR)/xxd; ln -s ../../xxd/*.[ch] ../../xxd/Make* .
+ if test -f $(ICON_APP); then \
+ cd $(SHADOWDIR); \
+ ln -s ../$(ICON_APP) ../os_mac.rsr.hqx ../dehqx.py .; \
+ fi
mkdir $(SHADOWDIR)/testdir
cd $(SHADOWDIR)/testdir; ln -s ../../testdir/Makefile \
../../testdir/vimrc.unix \
-DAPP_VER=$(VERSION) -DICON_APP=$(ICON_APP)
### Icons
-ICON_APP = gui_mac.icns
ICONS = $(RESDIR)/$(ICON_APP)
# If you uncomment the following lines the *.icns in the src directory will be
static pos_T compl_startpos;
static colnr_T compl_col = 0; /* column where the text starts
* that is being completed */
-static int save_sm = -1;
static char_u *compl_orig_text = NULL; /* text as it was before
* completion started */
static int compl_cont_mode = 0;
compl_pattern = NULL;
vim_free(compl_leader);
compl_leader = NULL;
- save_sm = -1;
edit_submode_extra = NULL;
}
+/*
+ * Return TRUE when Insert completion is active.
+ */
+ int
+ins_compl_active()
+{
+ return compl_started;
+}
+
/*
* Delete one character before the cursor and show the subset of the matches
* that match the word that is now before the cursor.
compl_matches = 0;
msg_clr_cmdline(); /* necessary for "noshowmode" */
ctrl_x_mode = 0;
- if (save_sm >= 0)
- p_sm = save_sm;
if (edit_submode != NULL)
{
edit_submode = NULL;
{
/* First time we hit ^N or ^P (in a row, I mean) */
- /* Turn off 'sm' so we don't show matches with ^X^L */
- save_sm = p_sm;
- p_sm = FALSE;
-
did_ai = FALSE;
#ifdef FEAT_SMARTINDENT
did_si = FALSE;
static void f_synIDattr __ARGS((typval_T *argvars, typval_T *rettv));
static void f_synIDtrans __ARGS((typval_T *argvars, typval_T *rettv));
static void f_system __ARGS((typval_T *argvars, typval_T *rettv));
+static void f_tabpagenr __ARGS((typval_T *argvars, typval_T *rettv));
static void f_taglist __ARGS((typval_T *argvars, typval_T *rettv));
static void f_tagfiles __ARGS((typval_T *argvars, typval_T *rettv));
static void f_tempname __ARGS((typval_T *argvars, typval_T *rettv));
{"synIDattr", 2, 3, f_synIDattr},
{"synIDtrans", 1, 1, f_synIDtrans},
{"system", 1, 2, f_system},
+ {"tabpagenr", 0, 1, f_tabpagenr},
{"tagfiles", 0, 0, f_tagfiles},
{"taglist", 1, 1, f_taglist},
{"tempname", 0, 0, f_tempname},
rettv->vval.v_string = res;
}
+/*
+ * "tabpagenr()" function
+ */
+/* ARGSUSED */
+ static void
+f_tabpagenr(argvars, rettv)
+ typval_T *argvars;
+ typval_T *rettv;
+{
+ int nr = 1;
+#ifdef FEAT_WINDOWS
+ tabpage_T *tp;
+ char_u *arg;
+
+ if (argvars[0].v_type != VAR_UNKNOWN)
+ {
+ arg = get_tv_string_chk(&argvars[0]);
+ nr = 0;
+ if (arg != NULL)
+ {
+ if (STRCMP(arg, "$") == 0)
+ for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
+ ++nr;
+ else
+ EMSG2(_(e_invexpr2), arg);
+ }
+ }
+ else
+ for (tp = first_tabpage; tp != curtab; tp = tp->tp_next)
+ ++nr;
+#endif
+ rettv->vval.v_number = nr;
+}
+
/*
* "tagfiles()" function
*/
EX(CMD_tabedit, "tabedit", ex_tabedit,
BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
EX(CMD_tabfind, "tabfind", ex_tabedit,
+ BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|NEEDARG|TRLBAR),
+EX(CMD_tabnew, "tabnew", ex_tabedit,
BANG|FILE1|RANGE|NOTADR|EDITCMD|ARGOPT|TRLBAR),
EX(CMD_tabonly, "tabonly", ex_tabonly,
TRLBAR|CMDWIN),
else
# endif
if (first_tabpage->tp_next == NULL)
- EMSG(_("E999: Cannot close last tab page"));
+ EMSG(_("E784: Cannot close last tab page"));
else
{
if (eap->addr_count > 0)
beep_flush();
return;
}
- if (tp->tp_topframe != topframe)
+ if (tp != curtab)
{
tabpage_close_other(tp, eap->forceit);
return;
}
/*
- * :tabedit [[+command] file] open new Tab page with empty window
- * :tabedit [[+command] file] open new Tab page and edit "file"
- * :tabfind [[+command] file] open new Tab page and find "file"
+ * :tabedit open new Tab page with empty window
+ * :tabedit [+command] file open new Tab page and edit "file"
+ * :tabnew [[+command] file] just like :tabedit
+ * :tabfind [+command] file open new Tab page and find "file"
*/
void
ex_tabedit(eap)
eap->errmsg = e_trailing;
return;
}
+ if (*end != *p)
+ {
+ EMSG2(_(e_invarg2), p);
+ return;
+ }
c = *end;
*end = NUL;
{"SpellFileMissing",EVENT_SPELLFILEMISSING},
{"StdinReadPost", EVENT_STDINREADPOST},
{"StdinReadPre", EVENT_STDINREADPRE},
- {"Syntax", EVENT_SYNTAX},
{"SwapExists", EVENT_SWAPEXISTS},
+ {"Syntax", EVENT_SYNTAX},
+ {"TabEnterPost", EVENT_TABENTERPOST},
+ {"TabLeavePre", EVENT_TABLEAVEPRE},
{"TermChanged", EVENT_TERMCHANGED},
{"TermResponse", EVENT_TERMRESPONSE},
{"User", EVENT_USER},
* have both a left and right scrollbar, and we drag one of them, we still
* need to update the other one.
*/
- if ( (gui.dragged_sb == SBAR_LEFT
- || gui.dragged_sb == SBAR_RIGHT)
- && (!gui.which_scrollbars[SBAR_LEFT]
- || !gui.which_scrollbars[SBAR_RIGHT])
- && !force)
- return;
-
- if (!force && (gui.dragged_sb == SBAR_LEFT || gui.dragged_sb == SBAR_RIGHT))
+ if (!force && (gui.dragged_sb == SBAR_LEFT || gui.dragged_sb == SBAR_RIGHT)
+ && gui.which_scrollbars[SBAR_LEFT]
+ && gui.which_scrollbars[SBAR_RIGHT])
{
/*
* If we have two scrollbars and one of them is being dragged, just
gui.dragged_wp->w_scrollbars[0].value,
gui.dragged_wp->w_scrollbars[0].size,
gui.dragged_wp->w_scrollbars[0].max);
- return;
}
/* avoid that moving components around generates events */
{
if (wp->w_buffer == NULL) /* just in case */
continue;
+ /* Skip a scrollbar that is being dragged. */
+ if (!force && (gui.dragged_sb == SBAR_LEFT
+ || gui.dragged_sb == SBAR_RIGHT)
+ && gui.dragged_wp == wp)
+ continue;
+
#ifdef SCROLL_PAST_END
max = wp->w_buffer->b_ml.ml_line_count - 1;
#else
#endif
sb->size = size;
sb->max = max;
- if (gui.which_scrollbars[SBAR_LEFT] && gui.dragged_sb != SBAR_LEFT)
+ if (gui.which_scrollbars[SBAR_LEFT]
+ && (gui.dragged_sb != SBAR_LEFT || gui.dragged_wp != wp))
gui_mch_set_scrollbar_thumb(&wp->w_scrollbars[SBAR_LEFT],
val, size, max);
if (gui.which_scrollbars[SBAR_RIGHT]
- && gui.dragged_sb != SBAR_RIGHT)
+ && (gui.dragged_sb != SBAR_RIGHT || gui.dragged_wp != wp))
gui_mch_set_scrollbar_thumb(&wp->w_scrollbars[SBAR_RIGHT],
val, size, max);
}
#endif
break;
-#ifdef TARGET_API_MAC_OSX
- /* For some reason on MacOS X, an argument like:
- -psn_0_10223617 is passed in when invoke from Finder
- or with the 'open' command */
- case 'p':
- argv_idx = -1; /* bypass full -psn */
- main_start_gui();
- break;
-#endif
case 'M': /* "-M" no changes or writing of files */
reset_modifiable();
/* FALLTHROUGH */
break;
case 'p': /* "-p[N]" open N tab pages */
+#ifdef TARGET_API_MAC_OSX
+ /* For some reason on MacOS X, an argument like:
+ -psn_0_10223617 is passed in when invoke from Finder
+ or with the 'open' command */
+ if (argv[0][argv_idx] == 's')
+ {
+ argv_idx = -1; /* bypass full -psn */
+ main_start_gui();
+ break;
+ }
+#endif
#ifdef FEAT_WINDOWS
/* default is 0: open window for each file */
parmp->window_count = get_number_arg((char_u *)argv[0],
&& msg_silent == 0
#ifdef FEAT_MBYTE
&& charlen == 1
+#endif
+#ifdef FEAT_INS_EXPAND
+ && !ins_compl_active()
#endif
)
showmatch(c);
void ins_compl_show_pum __ARGS((void));
char_u *find_word_start __ARGS((char_u *ptr));
char_u *find_word_end __ARGS((char_u *ptr));
+int ins_compl_active __ARGS((void));
void ins_compl_check_keys __ARGS((int frequency));
int get_literal __ARGS((void));
void insertchar __ARGS((int c, int flags, int second_indent));
long v;
int char_attr = 0; /* attributes for next character */
+ int attr_pri = FALSE; /* char_attr has priority */
int area_highlighting = FALSE; /* Visual or incsearch highlighting
in this line */
int attr = 0; /* attributes for area highlighting */
}
/*
- * handle 'insearch' and ":s///c" highlighting
+ * handle 'incsearch' and ":s///c" highlighting
*/
else
#endif /* FEAT_VISUAL */
else if (area_attr != 0
&& (vcol == tocol
|| (noinvcur && (colnr_T)vcol == wp->w_virtcol)))
-#ifdef LINE_ATTR
- area_attr = line_attr; /* stop highlighting */
- else if (line_attr && ((fromcol == -10 && tocol == MAXCOL)
- || (vcol < fromcol || vcol > tocol)))
- area_attr = line_attr;
-#else
area_attr = 0; /* stop highlighting */
-#endif
#ifdef FEAT_SEARCH_EXTRA
if (!n_extra)
}
#endif
- if (area_attr != 0)
- char_attr = area_attr;
-#ifdef FEAT_SYN_HL
- else if (search_attr == 0 && has_syntax)
- char_attr = syntax_attr;
-#endif
- else
- char_attr = search_attr;
-
#ifdef FEAT_DIFF
- if (diff_hlf != (hlf_T)0 && n_extra == 0)
+ if (diff_hlf != (hlf_T)0)
{
if (diff_hlf == HLF_CHD && ptr - line >= change_start)
diff_hlf = HLF_TXD; /* changed text */
if (diff_hlf == HLF_TXD && ptr - line > change_end)
diff_hlf = HLF_CHD; /* changed line */
- if (attr == 0 || area_attr != attr)
- area_attr = hl_attr(diff_hlf);
- if (attr == 0 || char_attr != attr)
- {
- if (search_attr != 0)
- char_attr = search_attr;
- else
- char_attr = hl_attr(diff_hlf);
- }
+ line_attr = hl_attr(diff_hlf);
}
#endif
+
+ /* Decide which of the highlight attributes to use. */
+ attr_pri = TRUE;
+ if (area_attr != 0)
+ char_attr = area_attr;
+ else if (search_attr != 0)
+ char_attr = search_attr;
+#ifdef LINE_ATTR
+ /* Use line_attr when not in the Visual or 'incsearch' area
+ * (area_attr may be 0 when "noinvcur" is set). */
+ else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
+ || (vcol < fromcol || vcol >= tocol)))
+ char_attr = line_attr;
+#endif
+ else
+ {
+ attr_pri = FALSE;
+#ifdef FEAT_SYN_HL
+ if (has_syntax)
+ char_attr = syntax_attr;
+ else
+#endif
+ char_attr = 0;
+ }
}
/*
line = ml_get_buf(wp->w_buffer, lnum, FALSE);
ptr = line + v;
- if (area_attr == 0 && search_attr == 0)
+ if (!attr_pri)
char_attr = syntax_attr;
else
char_attr = hl_combine_attr(syntax_attr, char_attr);
if (has_spell && v >= word_end && v > cur_checked_col)
{
spell_attr = 0;
- if (area_attr == 0 && search_attr == 0)
+ if (!attr_pri)
char_attr = syntax_attr;
if (c != 0 && (!has_syntax || can_spell))
{
}
if (spell_attr != 0)
{
- if (area_attr == 0 && search_attr == 0)
+ if (!attr_pri)
char_attr = hl_combine_attr(char_attr, spell_attr);
else
char_attr = hl_combine_attr(spell_attr, char_attr);
if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
{
c = lcs_trail;
- if (area_attr == 0 && search_attr == 0)
+ if (!attr_pri)
{
n_attr = 1;
extra_attr = hl_attr(HLF_8);
c = ' ';
lcs_eol_one = -1;
--ptr; /* put it back at the NUL */
- if (area_attr == 0 && search_attr == 0)
+ if (!attr_pri)
{
extra_attr = hl_attr(HLF_AT);
n_attr = 1;
n_extra = byte2cells(c) - 1;
c_extra = NUL;
c = *p_extra++;
- if (area_attr == 0 && search_attr == 0)
+ if (!attr_pri)
{
n_attr = n_extra + 1;
extra_attr = hl_attr(HLF_8);
/* Don't override visual selection highlighting. */
if (n_attr > 0
&& draw_state == WL_LINE
- && (area_attr == 0 || char_attr != area_attr)
- && (search_attr == 0 || char_attr != search_attr))
+ && !attr_pri)
char_attr = extra_attr;
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
else
mb_utf8 = FALSE; /* don't draw as UTF-8 */
#endif
- if ((area_attr == 0 || char_attr != area_attr)
- && (search_attr == 0 || char_attr != search_attr))
+ if (!attr_pri)
{
saved_attr3 = char_attr; /* save current attr */
char_attr = hl_attr(HLF_AT); /* later copied to char_attr */
#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 (2006 Feb 17)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 17, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 18)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2006 Feb 18, compiled "
/*
* The characters and attributes cached for the screen.
*/
-#define schar_T char_u
+typedef char_u schar_T;
#ifdef FEAT_SYN_HL
typedef unsigned short sattr_T;
# define MAX_TYPENR 65535
EVENT_SPELLFILEMISSING, /* spell file missing */
EVENT_CURSORMOVED, /* cursor was moved */
EVENT_CURSORMOVEDI, /* cursor was moved in Insert mode */
+ EVENT_TABLEAVEPRE, /* before leaving a tab page */
+ EVENT_TABENTERPOST, /* after entering a tab page */
NUM_EVENTS /* MUST be the last one */
};
#if defined(FEAT_WINDOWS) || defined(PROTO)
static tabpage_T *alloc_tabpage __ARGS((void));
static void free_tabpage __ARGS((tabpage_T *tp));
-static void leave_tabpage __ARGS((tabpage_T *tp));
+static int leave_tabpage __ARGS((buf_T *new_curbuf));
static void enter_tabpage __ARGS((tabpage_T *tp, buf_T *old_curbuf));
static void frame_fix_height __ARGS((win_T *wp));
static int frame_minheight __ARGS((frame_T *topfrp, win_T *next_curwin));
{
tabpage_T *tp;
- /* Use the next tab page if it exists. */
- if (curtab->tp_next != NULL)
+ /* Use the next tab page if we are currently at the first one. */
+ if (curtab == first_tabpage)
return curtab->tp_next;
/* Find the previous tab page. */
for (tp = first_tabpage; tp->tp_next != NULL; tp = tp->tp_next)
if (tp->tp_next == curtab)
- return tp;
- return first_tabpage;
+ break;
+ return tp;
}
/*
return FAIL;
/* Remember the current windows in this Tab page. */
- leave_tabpage(curtab);
+ if (leave_tabpage(NULL) == FAIL)
+ {
+ vim_free(newtp);
+ return FAIL;
+ }
curtab = newtp;
/* Create a new empty window. */
}
/* Failed, get back the previous Tab page */
- topframe = tp->tp_topframe;
- curwin = tp->tp_curwin;
- prevwin = tp->tp_prevwin;
- firstwin = tp->tp_firstwin;
- lastwin = tp->tp_lastwin;
- curtab = tp;
+ enter_tabpage(curtab, curbuf);
return FAIL;
}
}
/*
- * Prepare for leaving the current tab page "tp".
+ * Prepare for leaving the current tab page.
+ * When autocomands change "curtab" we don't leave the tab page and return
+ * FAIL.
+ * Careful: When OK is returned need to get a new tab page very very soon!
*/
- static void
-leave_tabpage(tp)
- tabpage_T *tp;
+/*ARGSUSED*/
+ static int
+leave_tabpage(new_curbuf)
+ buf_T *new_curbuf; /* what is going to be the new curbuf,
+ NULL if unknown */
{
+ tabpage_T *tp = curtab;
+
+#ifdef FEAT_AUTOCMD
+ if (new_curbuf != curbuf)
+ {
+ apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf);
+ if (curtab != tp)
+ return FAIL;
+ }
+ apply_autocmds(EVENT_WINLEAVE, NULL, NULL, FALSE, curbuf);
+ if (curtab != tp)
+ return FAIL;
+ apply_autocmds(EVENT_TABLEAVEPRE, NULL, NULL, FALSE, curbuf);
+ if (curtab != tp)
+ return FAIL;
+#endif
#if defined(FEAT_GUI)
/* Remove the scrollbars. They may be added back later. */
if (gui.in_use)
tp->tp_old_Columns = Columns;
firstwin = NULL;
lastwin = NULL;
+ return OK;
}
/*
prevwin = tp->tp_prevwin;
#ifdef FEAT_AUTOCMD
+ apply_autocmds(EVENT_TABENTERPOST, NULL, NULL, FALSE, curbuf);
+ apply_autocmds(EVENT_WINENTER, NULL, NULL, FALSE, curbuf);
if (old_curbuf != curbuf)
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
#endif
/* The tabpage line may have appeared or disappeared, may need to resize
* the frames for that. When the Vim window was resized need to update
* frame sizes too. */
- if (tp->tp_old_Rows != Rows || old_off != firstwin->w_winrow)
+ if (curtab->tp_old_Rows != Rows || old_off != firstwin->w_winrow)
shell_new_rows();
#ifdef FEAT_VERTSPLIT
- if (tp->tp_old_Columns != Columns && starting == 0)
+ if (curtab->tp_old_Columns != Columns && starting == 0)
shell_new_columns(); /* update window widths */
#endif
goto_tabpage(n)
int n;
{
- tabpage_T *otp = curtab;
tabpage_T *tp;
int i;
- if (otp == NULL)
- return;
-
if (n == 0)
{
/* No count, go to next tab page, wrap around end. */
- if (otp->tp_next == NULL)
+ if (curtab->tp_next == NULL)
tp = first_tabpage;
else
- tp = otp->tp_next;
+ tp = curtab->tp_next;
}
else
{
}
}
- leave_tabpage(otp);
- enter_tabpage(tp, curbuf);
+ if (leave_tabpage(tp->tp_curwin->w_buffer) == OK)
+ {
+ if (valid_tabpage(tp))
+ enter_tabpage(tp, curbuf);
+ else
+ enter_tabpage(curtab, curbuf);
+ }
}
/*