Added vim runtime files

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8393 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2004-07-13 23:28:30 +00:00
parent 1cdd04177a
commit f22750bb9d
1019 changed files with 211921 additions and 0 deletions

View File

@ -0,0 +1,38 @@
SubDir OBOS_TOP src apps bin vim runtime ;
local VIMDIR = [ FDirName $(OBOS_ETC_DIR) vim vim63 ] ;
rule RuntimeFiles
{
local vimRuntimeFiles = [ GLOB $(<) : *.vim *.txt *.info *.ps ] ;
for file in $(vimRuntimeFiles:D=)
{
MakeLocate <etc>$(file) : [ FDirName $(VIMDIR) $(<) ] ;
File <etc>$(file) : $(file) ;
LocalClean clean : <etc>$(file) ;
}
SEARCH on $(vimRuntimeFiles:D=) = $(<) ;
}
RuntimeFiles $(SUBDIR) ;
RuntimeFiles [ FDirName $(SUBDIR) colors ] ;
RuntimeFiles [ FDirName $(SUBDIR) compiler ] ;
RuntimeFiles [ FDirName $(SUBDIR) doc ] ;
RuntimeFiles [ FDirName $(SUBDIR) ftplugin ] ;
RuntimeFiles [ FDirName $(SUBDIR) indent ] ;
RuntimeFiles [ FDirName $(SUBDIR) keymap ] ;
#RuntimeFiles [ FDirName $(SUBDIR) lang ] ;
RuntimeFiles [ FDirName $(SUBDIR) macros ] ;
RuntimeFiles [ FDirName $(SUBDIR) macros hanoi ] ;
RuntimeFiles [ FDirName $(SUBDIR) macros life ] ;
RuntimeFiles [ FDirName $(SUBDIR) macros maze ] ;
RuntimeFiles [ FDirName $(SUBDIR) macros urm ] ;
RuntimeFiles [ FDirName $(SUBDIR) plugin ] ;
RuntimeFiles [ FDirName $(SUBDIR) print ] ;
RuntimeFiles [ FDirName $(SUBDIR) syntax ] ;
RuntimeFiles [ FDirName $(SUBDIR) tools ] ;
RuntimeFiles [ FDirName $(SUBDIR) tutor ] ;

View File

@ -0,0 +1,86 @@
:" Use this script to create the file "bugreport.txt", which contains
:" information about the environment of a possible bug in Vim.
:"
:" Maintainer: Bram Moolenaar <Bram@vim.org>
:" Last change: 2001 Feb 02
:"
:" To use inside Vim:
:" :so $VIMRUNTIME/bugreport.vim
:" Or, from the command line:
:" vim -s $VIMRUNTIME/bugreport.vim
:"
:" The "if 1" lines are to avoid error messages when expression evaluation is
:" not compiled in.
:"
:if 1
: let more_save = &more
:endif
:set nomore
:if has("unix")
: !echo "uname -a" >bugreport.txt
: !uname -a >>bugreport.txt
:endif
:redir >>bugreport.txt
:version
:if 1
: func <SID>CheckDir(n)
: if isdirectory(a:n)
: echo 'directory "' . a:n . '" exists'
: else
: echo 'directory "' . a:n . '" does NOT exist'
: endif
: endfun
: func <SID>CheckFile(n)
: if filereadable(a:n)
: echo '"' . a:n . '" is readable'
: else
: echo '"' . a:n . '" is NOT readable'
: endif
: endfun
: echo "--- Directories and Files ---"
: echo '$VIM = "' . $VIM . '"'
: call <SID>CheckDir($VIM)
: echo '$VIMRUNTIME = "' . $VIMRUNTIME . '"'
: call <SID>CheckDir($VIMRUNTIME)
: call <SID>CheckFile(&helpfile)
: call <SID>CheckFile(fnamemodify(&helpfile, ":h") . "/tags")
: call <SID>CheckFile($VIMRUNTIME . "/menu.vim")
: call <SID>CheckFile($VIMRUNTIME . "/filetype.vim")
: call <SID>CheckFile($VIMRUNTIME . "/syntax/synload.vim")
: delfun <SID>CheckDir
: delfun <SID>CheckFile
:endif
:set all
:set termcap
:if has("autocmd")
: au
:endif
:if 1
: echo "--- Normal/Visual mode mappings ---"
:endif
:map
:if 1
: echo "--- Insert/Command-line mode mappings ---"
:endif
:map!
:if 1
: echo "--- Abbreviations ---"
:endif
:ab
:if 1
: echo "--- Highlighting ---"
:endif
:highlight
:if 1
: echo "--- Variables ---"
:endif
:if 1
: let
:endif
:redir END
:set more&
:if 1
: let &more = more_save
: unlet more_save
:endif
:e bugreport.txt

View File

@ -0,0 +1,61 @@
README.txt for color scheme files
These files are used for the ":colorscheme" command. They appear in the
Edit/Color Scheme menu in the GUI.
Hints for writing a color scheme file:
There are two basic ways to define a color scheme:
1. Define a new Normal color and set the 'background' option accordingly.
set background={light or dark}
highlight clear
highlight Normal ...
...
2. Use the default Normal color and automatically adjust to the value of
'background'.
highlight clear Normal
set background&
highlight clear
if &background == "light"
highlight Error ...
...
else
highlight Error ...
...
endif
You can use ":highlight clear" to reset everything to the defaults, and then
change the groups that you want differently. This also will work for groups
that are added in later versions of Vim.
Note that ":highlight clear" uses the value of 'background', thus set it
before this command.
Some attributes (e.g., bold) might be set in the defaults that you want
removed in your color scheme. Use something like "gui=NONE" to remove the
attributes.
To see which highlight group is used where, find the help for
"highlight-groups" and "group-name".
You can use ":highlight" to find out the current colors. Exception: the
ctermfg and ctermbg values are numbers, which are only valid for the current
terminal. Use the color names instead. See ":help cterm-colors".
The default color settings can be found in the source file src/syntax.c.
Search for "highlight_init".
If you think you have a color scheme that is good enough to be used by others,
please check the following items:
- Does it work in a color terminal as well as in the GUI?
- Is 'background' either used or appropriately set to "light" or "dark"?
- Try setting 'hlsearch' and searching for a pattern, is the match easy to
spot?
- Split a window with ":split" and ":vsplit". Are the status lines and
vertical separators clearly visible?
- In the GUI, is it easy to find the cursor, also in a file with lots of
syntax highlighting?
- Do not use hard coded escape sequences, these will not work in other
terminals. Always use color names or #RRGGBB for the GUI.

View File

@ -0,0 +1,77 @@
" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file
" Maintainer: Steven Vertigan <steven@vertigan.wattle.id.au>
" Last Change: 2003 May 11
" Revision #4: Support for new "Underline" group. Removed superfluous html
" formatting.
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "blue"
hi Normal guifg=white guibg=darkBlue
hi Normal ctermfg=white ctermbg=darkBlue
hi NonText guifg=magenta ctermfg=lightMagenta
hi comment guifg=gray gui=bold
hi comment ctermfg=gray
hi constant guifg=cyan ctermfg=cyan
hi identifier guifg=gray ctermfg=gray
hi statement guifg=yellow gui=none ctermfg=yellow
hi preproc guifg=green ctermfg=green
hi type guifg=orange ctermfg=darkYellow
hi special guifg=magenta ctermfg=lightMagenta
hi Underlined guifg=cyan ctermfg=cyan
hi Underlined gui=underline cterm=underline
hi ErrorMsg guifg=orange guibg=darkBlue
hi ErrorMsg ctermfg=lightRed
hi WarningMsg guifg=cyan guibg=darkBlue gui=bold
hi WarningMsg ctermfg=cyan
hi ModeMsg guifg=yellow gui=NONE
hi ModeMsg ctermfg=yellow
hi MoreMsg guifg=yellow gui=NONE
hi MoreMsg ctermfg=yellow
hi Error guifg=red guibg=darkBlue gui=underline
hi Error ctermfg=red
hi Todo guifg=black guibg=orange
hi Todo ctermfg=black ctermbg=darkYellow
hi Cursor guifg=black guibg=white
hi Cursor ctermfg=black ctermbg=white
hi Search guifg=black guibg=orange
hi Search ctermfg=black ctermbg=darkYellow
hi IncSearch guifg=black guibg=yellow
hi IncSearch ctermfg=black ctermbg=darkYellow
hi LineNr guifg=pink ctermfg=lightMagenta
hi title guifg=white gui=bold cterm=bold
hi StatusLineNC gui=NONE guifg=black guibg=blue
hi StatusLineNC ctermfg=black ctermbg=blue
hi StatusLine gui=bold guifg=cyan guibg=blue
hi StatusLine ctermfg=cyan ctermbg=blue
hi label guifg=yellow ctermfg=yellow
hi operator guifg=orange gui=bold ctermfg=darkYellow
hi clear Visual
hi Visual term=reverse
hi Visual ctermfg=black ctermbg=darkCyan
hi Visual guifg=black guibg=darkCyan
hi DiffChange guibg=darkGreen guifg=black
hi DiffChange ctermbg=darkGreen ctermfg=black
hi DiffText guibg=olivedrab guifg=black
hi DiffText ctermbg=lightGreen ctermfg=black
hi DiffAdd guibg=slateblue guifg=black
hi DiffAdd ctermbg=blue ctermfg=black
hi DiffDelete guibg=coral guifg=black
hi DiffDelete ctermbg=cyan ctermfg=black
hi Folded guibg=orange guifg=black
hi Folded ctermbg=yellow ctermfg=black
hi FoldColumn guibg=gray30 guifg=black
hi FoldColumn ctermbg=gray ctermfg=black
hi cIf0 guifg=gray ctermfg=gray

View File

@ -0,0 +1,62 @@
" Vim color file
" Maintainer: Bohdan Vlasyuk <bohdan@vstu.edu.ua>
" Last Change: 2002 Mar 09
" darkblue -- for those who prefer dark background
" [note: looks bit uglier with come terminal palettes,
" but is fine on default linux console palette.]
set bg=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "darkblue"
hi Normal guifg=#c0c0c0 guibg=#000040 ctermfg=gray ctermbg=black
hi ErrorMsg guifg=#ffffff guibg=#287eff ctermfg=white ctermbg=lightblue
hi Visual guifg=#8080ff guibg=fg gui=reverse ctermfg=lightblue ctermbg=fg cterm=reverse
hi VisualNOS guifg=#8080ff guibg=fg gui=reverse,underline ctermfg=lightblue ctermbg=fg cterm=reverse,underline
hi Todo guifg=#d14a14 guibg=#1248d1 ctermfg=red ctermbg=darkblue
hi Search guifg=#90fff0 guibg=#2050d0 ctermfg=white ctermbg=darkblue cterm=underline term=underline
hi IncSearch guifg=#b0ffff guibg=#2050d0 ctermfg=darkblue ctermbg=gray
hi SpecialKey guifg=cyan ctermfg=darkcyan
hi Directory guifg=cyan ctermfg=cyan
hi Title guifg=magenta gui=none ctermfg=magenta cterm=bold
hi WarningMsg guifg=red ctermfg=red
hi WildMenu guifg=yellow guibg=black ctermfg=yellow ctermbg=black cterm=none term=none
hi ModeMsg guifg=#22cce2 ctermfg=lightblue
hi MoreMsg ctermfg=darkgreen ctermfg=darkgreen
hi Question guifg=green gui=none ctermfg=green cterm=none
hi NonText guifg=#0030ff ctermfg=darkblue
hi StatusLine guifg=blue guibg=darkgray gui=none ctermfg=blue ctermbg=gray term=none cterm=none
hi StatusLineNC guifg=black guibg=darkgray gui=none ctermfg=black ctermbg=gray term=none cterm=none
hi VertSplit guifg=black guibg=darkgray gui=none ctermfg=black ctermbg=gray term=none cterm=none
hi Folded guifg=#808080 guibg=#000040 ctermfg=darkgrey ctermbg=black cterm=bold term=bold
hi FoldColumn guifg=#808080 guibg=#000040 ctermfg=darkgrey ctermbg=black cterm=bold term=bold
hi LineNr guifg=#90f020 ctermfg=green cterm=none
hi DiffAdd guibg=darkblue ctermbg=darkblue term=none cterm=none
hi DiffChange guibg=darkmagenta ctermbg=magenta cterm=none
hi DiffDelete ctermfg=blue ctermbg=cyan gui=bold guifg=Blue guibg=DarkCyan
hi DiffText cterm=bold ctermbg=red gui=bold guibg=Red
hi Cursor guifg=#000020 guibg=#ffaf38 ctermfg=bg ctermbg=brown
hi lCursor guifg=#ffffff guibg=#000000 ctermfg=bg ctermbg=darkgreen
hi Comment guifg=#80a0ff ctermfg=darkred
hi Constant ctermfg=magenta guifg=#ffa0a0 cterm=none
hi Special ctermfg=brown guifg=Orange cterm=none gui=none
hi Identifier ctermfg=cyan guifg=#40ffff cterm=none
hi Statement ctermfg=yellow cterm=none guifg=#ffff60 gui=none
hi PreProc ctermfg=magenta guifg=#ff80ff gui=none cterm=none
hi type ctermfg=green guifg=#60ff60 gui=none cterm=none
hi Underlined cterm=underline term=underline
hi Ignore guifg=bg ctermfg=bg

View File

@ -0,0 +1,23 @@
" Vim color file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2001 Jul 23
" This is the default color scheme. It doesn't define the Normal
" highlighting, it uses whatever the colors used to be.
" Set 'background' back to the default. The value can't always be estimated
" and is then guessed.
hi clear Normal
set bg&
" Remove all existing highlighting and set the defaults.
hi clear
" Load the syntax highlighting defaults, if it's enabled.
if exists("syntax_on")
syntax reset
endif
let colors_name = "default"
" vim: sw=2

View File

@ -0,0 +1,57 @@
" Vim color file
" Maintainer: David Schweikert <dws@ee.ethz.ch>
" Last Change: 2004 May 16
" First remove all existing highlighting.
hi clear
let colors_name = "delek"
hi Normal guifg=Black guibg=white
" Groups used in the 'highlight' and 'guicursor' options default value.
hi ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White
hi IncSearch term=reverse cterm=reverse gui=reverse
hi ModeMsg term=bold cterm=bold gui=bold
hi VertSplit term=reverse cterm=reverse gui=reverse
hi Visual term=reverse cterm=reverse gui=reverse guifg=Grey guibg=fg
hi VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold
hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red
hi Cursor guibg=Green guifg=NONE
hi lCursor guibg=Cyan guifg=NONE
hi Directory term=bold ctermfg=DarkBlue guifg=Blue
hi LineNr term=underline ctermfg=Brown guifg=Brown
hi MoreMsg term=bold ctermfg=DarkGreen gui=bold guifg=SeaGreen
hi Question term=standout ctermfg=DarkGreen gui=bold guifg=SeaGreen
hi Search term=reverse ctermbg=Yellow ctermfg=NONE guibg=Yellow guifg=NONE
hi SpecialKey term=bold ctermfg=DarkBlue guifg=Blue
hi Title term=bold ctermfg=DarkMagenta gui=bold guifg=Magenta
hi WarningMsg term=standout ctermfg=DarkRed guifg=Red
hi WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
hi Folded term=standout ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue
hi FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue
hi DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue
hi DiffChange term=bold ctermbg=LightMagenta guibg=LightMagenta
hi DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan
hi StatusLine cterm=bold ctermbg=blue ctermfg=yellow guibg=gold guifg=blue
hi StatusLineNC cterm=bold ctermbg=blue ctermfg=black guibg=gold guifg=blue
hi NonText term=bold ctermfg=Blue gui=bold guifg=gray guibg=white
hi Cursor guibg=fg guifg=bg
" syntax highlighting
hi PreProc term=underline cterm=NONE ctermfg=darkmagenta gui=NONE guifg=magenta3
hi Identifier term=underline cterm=NONE ctermfg=darkcyan gui=NONE guifg=cyan4
hi Comment term=NONE cterm=NONE ctermfg=darkred gui=NONE guifg=red2
hi Constant term=underline cterm=NONE ctermfg=darkgreen gui=NONE guifg=green3
hi Special term=bold cterm=NONE ctermfg=lightred gui=NONE guifg=deeppink
hi Statement term=bold cterm=bold ctermfg=blue gui=bold guifg=blue
hi Type term=underline cterm=NONE ctermfg=blue gui=bold guifg=blue
if exists("syntax_on")
let syntax_cmd = "enable"
runtime syntax/syncolor.vim
unlet syntax_cmd
endif
" vim: sw=2

View File

@ -0,0 +1,108 @@
" Vim color file
" Maintainer: Hans Fugal <hans@fugal.net>
" Last Change: $Date: 2004/07/13 23:28:24 $
" Last Change: $Date: 2004/07/13 23:28:24 $
" URL: http://hans.fugal.net/vim/colors/desert.vim
" Version: $Id: desert.vim,v 1.1 2004/07/13 23:28:24 korli Exp $
" cool help screens
" :he group-name
" :he highlight-groups
" :he cterm-colors
set background=dark
if version > 580
" no guarantees for version 5.8 and below, but this makes it stop
" complaining
hi clear
if exists("syntax_on")
syntax reset
endif
endif
let g:colors_name="desert"
hi Normal guifg=White guibg=grey20
" highlight groups
hi Cursor guibg=khaki guifg=slategrey
"hi CursorIM
"hi Directory
"hi DiffAdd
"hi DiffChange
"hi DiffDelete
"hi DiffText
"hi ErrorMsg
hi VertSplit guibg=#c2bfa5 guifg=grey50 gui=none
hi Folded guibg=grey30 guifg=gold
hi FoldColumn guibg=grey30 guifg=tan
hi IncSearch guifg=slategrey guibg=khaki
"hi LineNr
hi ModeMsg guifg=goldenrod
hi MoreMsg guifg=SeaGreen
hi NonText guifg=LightBlue guibg=grey30
hi Question guifg=springgreen
hi Search guibg=peru guifg=wheat
hi SpecialKey guifg=yellowgreen
hi StatusLine guibg=#c2bfa5 guifg=black gui=none
hi StatusLineNC guibg=#c2bfa5 guifg=grey50 gui=none
hi Title guifg=indianred
hi Visual gui=none guifg=khaki guibg=olivedrab
"hi VisualNOS
hi WarningMsg guifg=salmon
"hi WildMenu
"hi Menu
"hi Scrollbar
"hi Tooltip
" syntax highlighting groups
hi Comment guifg=SkyBlue
hi Constant guifg=#ffa0a0
hi Identifier guifg=palegreen
hi Statement guifg=khaki
hi PreProc guifg=indianred
hi Type guifg=darkkhaki
hi Special guifg=navajowhite
"hi Underlined
hi Ignore guifg=grey40
"hi Error
hi Todo guifg=orangered guibg=yellow2
" color terminal definitions
hi SpecialKey ctermfg=darkgreen
hi NonText cterm=bold ctermfg=darkblue
hi Directory ctermfg=darkcyan
hi ErrorMsg cterm=bold ctermfg=7 ctermbg=1
hi IncSearch cterm=NONE ctermfg=yellow ctermbg=green
hi Search cterm=NONE ctermfg=grey ctermbg=blue
hi MoreMsg ctermfg=darkgreen
hi ModeMsg cterm=NONE ctermfg=brown
hi LineNr ctermfg=3
hi Question ctermfg=green
hi StatusLine cterm=bold,reverse
hi StatusLineNC cterm=reverse
hi VertSplit cterm=reverse
hi Title ctermfg=5
hi Visual cterm=reverse
hi VisualNOS cterm=bold,underline
hi WarningMsg ctermfg=1
hi WildMenu ctermfg=0 ctermbg=3
hi Folded ctermfg=darkgrey ctermbg=NONE
hi FoldColumn ctermfg=darkgrey ctermbg=NONE
hi DiffAdd ctermbg=4
hi DiffChange ctermbg=5
hi DiffDelete cterm=bold ctermfg=4 ctermbg=6
hi DiffText cterm=bold ctermbg=1
hi Comment ctermfg=darkcyan
hi Constant ctermfg=brown
hi Special ctermfg=5
hi Identifier ctermfg=6
hi Statement ctermfg=3
hi PreProc ctermfg=5
hi Type ctermfg=2
hi Underlined cterm=underline ctermfg=5
hi Ignore cterm=bold ctermfg=7
hi Ignore ctermfg=darkgrey
hi Error cterm=bold ctermfg=7 ctermbg=1
"vim: sw=4

View File

@ -0,0 +1,50 @@
" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file
" Maintainer: Ron Aaron <ron@ronware.org>
" Last Change: 2003 May 02
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "elflord"
hi Normal guifg=cyan guibg=black
hi Comment term=bold ctermfg=DarkCyan guifg=#80a0ff
hi Constant term=underline ctermfg=Magenta guifg=Magenta
hi Special term=bold ctermfg=DarkMagenta guifg=Red
hi Identifier term=underline cterm=bold ctermfg=Cyan guifg=#40ffff
hi Statement term=bold ctermfg=Yellow gui=bold guifg=#aa4444
hi PreProc term=underline ctermfg=LightBlue guifg=#ff80ff
hi Type term=underline ctermfg=LightGreen guifg=#60ff60 gui=bold
hi Function term=bold ctermfg=White guifg=White
hi Repeat term=underline ctermfg=White guifg=white
hi Operator ctermfg=Red guifg=Red
hi Ignore ctermfg=black guifg=bg
hi Error term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=White
hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow
" Common groups that link to default highlighting.
" You can specify other highlighting easily.
hi link String Constant
hi link Character Constant
hi link Number Constant
hi link Boolean Constant
hi link Float Number
hi link Conditional Repeat
hi link Label Statement
hi link Keyword Statement
hi link Exception Statement
hi link Include PreProc
hi link Define PreProc
hi link Macro PreProc
hi link PreCondit PreProc
hi link StorageClass Type
hi link Structure Type
hi link Typedef Type
hi link Tag Special
hi link SpecialChar Special
hi link Delimiter Special
hi link SpecialComment Special
hi link Debug Special

View File

@ -0,0 +1,54 @@
" Vim color file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2001 May 21
" This color scheme uses a dark grey background.
" First remove all existing highlighting.
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "evening"
hi Normal ctermbg=DarkGrey ctermfg=White guifg=White guibg=grey20
" Groups used in the 'highlight' and 'guicursor' options default value.
hi ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White
hi IncSearch term=reverse cterm=reverse gui=reverse
hi ModeMsg term=bold cterm=bold gui=bold
hi StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold
hi StatusLineNC term=reverse cterm=reverse gui=reverse
hi VertSplit term=reverse cterm=reverse gui=reverse
hi Visual term=reverse cterm=reverse gui=reverse guifg=Grey guibg=fg
hi VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold
hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red
hi Cursor guibg=Green guifg=Black
hi lCursor guibg=Cyan guifg=Black
hi Directory term=bold ctermfg=LightCyan guifg=Cyan
hi LineNr term=underline ctermfg=Yellow guifg=Yellow
hi MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen
hi NonText term=bold ctermfg=LightBlue gui=bold guifg=LightBlue guibg=grey30
hi Question term=standout ctermfg=LightGreen gui=bold guifg=Green
hi Search term=reverse ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
hi SpecialKey term=bold ctermfg=LightBlue guifg=Cyan
hi Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta
hi WarningMsg term=standout ctermfg=LightRed guifg=Red
hi WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
hi Folded term=standout ctermbg=LightGrey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue
hi FoldColumn term=standout ctermbg=LightGrey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue
hi DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue
hi DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta
hi DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan
" Groups for syntax highlighting
hi Constant term=underline ctermfg=Magenta guifg=#ffa0a0 guibg=grey5
hi Special term=bold ctermfg=LightRed guifg=Orange guibg=grey5
if &t_Co > 8
hi Statement term=bold cterm=bold ctermfg=Yellow guifg=#ffff60 gui=bold
endif
hi Ignore ctermfg=DarkGrey guifg=grey20
" vim: sw=2

View File

@ -0,0 +1,64 @@
" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file
" Maintainer: Ron Aaron <ron@ronware.org>
" Last Change: 2003 May 02
hi clear
set background=dark
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "koehler"
hi Normal guifg=white guibg=black
hi Scrollbar guifg=darkcyan guibg=cyan
hi Menu guifg=black guibg=cyan
hi SpecialKey term=bold cterm=bold ctermfg=darkred guifg=Blue
hi NonText term=bold cterm=bold ctermfg=darkred gui=bold guifg=Blue
hi Directory term=bold cterm=bold ctermfg=brown guifg=Blue
hi ErrorMsg term=standout cterm=bold ctermfg=grey ctermbg=blue guifg=White guibg=Red
hi Search term=reverse ctermfg=white ctermbg=red guifg=white guibg=Red
hi MoreMsg term=bold cterm=bold ctermfg=darkgreen gui=bold guifg=SeaGreen
hi ModeMsg term=bold cterm=bold gui=bold guifg=White guibg=Blue
hi LineNr term=underline cterm=bold ctermfg=darkcyan guifg=Yellow
hi Question term=standout cterm=bold ctermfg=darkgreen gui=bold guifg=Green
hi StatusLine term=bold,reverse cterm=bold ctermfg=lightblue ctermbg=white gui=bold guifg=blue guibg=white
hi StatusLineNC term=reverse ctermfg=white ctermbg=lightblue guifg=white guibg=blue
hi Title term=bold cterm=bold ctermfg=darkmagenta gui=bold guifg=Magenta
hi Visual term=reverse cterm=reverse gui=reverse
hi WarningMsg term=standout cterm=bold ctermfg=darkblue guifg=Red
hi Cursor guifg=bg guibg=Green
hi Comment term=bold cterm=bold ctermfg=cyan guifg=#80a0ff
hi Constant term=underline cterm=bold ctermfg=magenta guifg=#ffa0a0
hi Special term=bold cterm=bold ctermfg=red guifg=Orange
hi Identifier term=underline ctermfg=brown guifg=#40ffff
hi Statement term=bold cterm=bold ctermfg=yellow gui=bold guifg=#ffff60
hi PreProc term=underline ctermfg=darkblue guifg=#ff80ff
hi Type term=underline cterm=bold ctermfg=lightgreen gui=bold guifg=#60ff60
hi Error term=reverse ctermfg=darkcyan ctermbg=black guifg=Red guibg=Black
hi Todo term=standout ctermfg=black ctermbg=darkcyan guifg=Blue guibg=Yellow
hi link IncSearch Visual
hi link String Constant
hi link Character Constant
hi link Number Constant
hi link Boolean Constant
hi link Float Number
hi link Function Identifier
hi link Conditional Statement
hi link Repeat Statement
hi link Label Statement
hi link Operator Statement
hi link Keyword Statement
hi link Exception Statement
hi link Include PreProc
hi link Define PreProc
hi link Macro PreProc
hi link PreCondit PreProc
hi link StorageClass Type
hi link Structure Type
hi link Typedef Type
hi link Tag Special
hi link SpecialChar Special
hi link Delimiter Special
hi link SpecialComment Special
hi link Debug Special

View File

@ -0,0 +1,54 @@
" Vim color file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2001 May 21
" This color scheme uses a light grey background.
" First remove all existing highlighting.
set background=light
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "morning"
hi Normal ctermfg=Black ctermbg=LightGrey guifg=Black guibg=grey90
" Groups used in the 'highlight' and 'guicursor' options default value.
hi ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White
hi IncSearch term=reverse cterm=reverse gui=reverse
hi ModeMsg term=bold cterm=bold gui=bold
hi StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold
hi StatusLineNC term=reverse cterm=reverse gui=reverse
hi VertSplit term=reverse cterm=reverse gui=reverse
hi Visual term=reverse cterm=reverse gui=reverse guifg=Grey guibg=fg
hi VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold
hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red
hi Cursor guibg=Green guifg=NONE
hi lCursor guibg=Cyan guifg=NONE
hi Directory term=bold ctermfg=DarkBlue guifg=Blue
hi LineNr term=underline ctermfg=Brown guifg=Brown
hi MoreMsg term=bold ctermfg=DarkGreen gui=bold guifg=SeaGreen
hi NonText term=bold ctermfg=Blue gui=bold guifg=Blue guibg=grey80
hi Question term=standout ctermfg=DarkGreen gui=bold guifg=SeaGreen
hi Search term=reverse ctermbg=Yellow ctermfg=NONE guibg=Yellow guifg=NONE
hi SpecialKey term=bold ctermfg=DarkBlue guifg=Blue
hi Title term=bold ctermfg=DarkMagenta gui=bold guifg=Magenta
hi WarningMsg term=standout ctermfg=DarkRed guifg=Red
hi WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
hi Folded term=standout ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue
hi FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue
hi DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue
hi DiffChange term=bold ctermbg=LightMagenta guibg=LightMagenta
hi DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan
" Colors for syntax highlighting
hi Constant term=underline ctermfg=DarkRed guifg=Magenta guibg=grey95
hi Special term=bold ctermfg=DarkMagenta guifg=SlateBlue guibg=grey95
if &t_Co > 8
hi Statement term=bold cterm=bold ctermfg=Brown gui=bold guifg=Brown
endif
hi Ignore ctermfg=LightGrey guifg=grey90
" vim: sw=2

View File

@ -0,0 +1,41 @@
" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file
" Maintainer: Ron Aaron <ron@ronware.org>
" Last Change: 2003 May 02
hi clear
set background=dark
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "murphy"
hi Normal ctermbg=Black ctermfg=lightgreen guibg=Black guifg=lightgreen
hi Comment term=bold ctermfg=LightRed guifg=Orange
hi Constant term=underline ctermfg=LightGreen guifg=White gui=NONE
hi Identifier term=underline ctermfg=LightCyan guifg=#00ffff
hi Ignore ctermfg=black guifg=bg
hi PreProc term=underline ctermfg=LightBlue guifg=Wheat
hi Search term=reverse guifg=white guibg=Blue
hi Special term=bold ctermfg=LightRed guifg=magenta
hi Statement term=bold ctermfg=Yellow guifg=#ffff00 gui=NONE
hi Type ctermfg=LightGreen guifg=grey gui=none
hi Error term=reverse ctermbg=Red ctermfg=White guibg=Red guifg=White
hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow
" From the source:
hi Cursor guifg=Orchid guibg=fg
hi Directory term=bold ctermfg=LightCyan guifg=Cyan
hi ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White
hi IncSearch term=reverse cterm=reverse gui=reverse
hi LineNr term=underline ctermfg=Yellow guifg=Yellow
hi ModeMsg term=bold cterm=bold gui=bold
hi MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen
hi NonText term=bold ctermfg=Blue gui=bold guifg=Blue
hi Question term=standout ctermfg=LightGreen gui=bold guifg=Cyan
hi SpecialKey term=bold ctermfg=LightBlue guifg=Cyan
hi StatusLine term=reverse,bold cterm=reverse gui=NONE guifg=White guibg=darkblue
hi StatusLineNC term=reverse cterm=reverse gui=NONE guifg=white guibg=#333333
hi Title term=bold ctermfg=LightMagenta gui=bold guifg=Pink
hi WarningMsg term=standout ctermfg=LightRed guifg=Red
hi Visual term=reverse cterm=reverse gui=NONE guifg=white guibg=darkgreen

View File

@ -0,0 +1,26 @@
" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file
" Maintainer: Ron Aaron <ron@ronware.org>
" Last Change: 2003 May 02
hi clear
set background=dark
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "pablo"
highlight Comment ctermfg=8 guifg=#808080
highlight Constant ctermfg=14 cterm=none guifg=#00ffff gui=none
highlight Identifier ctermfg=6 guifg=#00c0c0
highlight Statement ctermfg=3 cterm=bold guifg=#c0c000 gui=bold
highlight PreProc ctermfg=10 guifg=#00ff00
highlight Type ctermfg=2 guifg=#00c000
highlight Special ctermfg=12 guifg=#0000ff
highlight Error ctermbg=9 guibg=#ff0000
highlight Todo ctermfg=4 ctermbg=3 guifg=#000080 guibg=#c0c000
highlight Directory ctermfg=2 guifg=#00c000
highlight StatusLine ctermfg=11 ctermbg=12 cterm=none guifg=#ffff00 guibg=#0000ff gui=none
highlight Normal guifg=#ffffff guibg=#000000
highlight Search ctermbg=3 guibg=#c0c000

View File

@ -0,0 +1,60 @@
" Vim color file
" Maintainer: David Ne\v{c}as (Yeti) <yeti@physics.muni.cz>
" Last Change: 2003-04-23
" URL: http://trific.ath.cx/Ftp/vim/colors/peachpuff.vim
" This color scheme uses a peachpuff background (what you've expected when it's
" called peachpuff?).
"
" Note: Only GUI colors differ from default, on terminal it's just `light'.
" First remove all existing highlighting.
set background=light
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "peachpuff"
hi Normal guibg=PeachPuff guifg=Black
hi SpecialKey term=bold ctermfg=4 guifg=Blue
hi NonText term=bold cterm=bold ctermfg=4 gui=bold guifg=Blue
hi Directory term=bold ctermfg=4 guifg=Blue
hi ErrorMsg term=standout cterm=bold ctermfg=7 ctermbg=1 gui=bold guifg=White guibg=Red
hi IncSearch term=reverse cterm=reverse gui=reverse
hi Search term=reverse ctermbg=3 guibg=Gold2
hi MoreMsg term=bold ctermfg=2 gui=bold guifg=SeaGreen
hi ModeMsg term=bold cterm=bold gui=bold
hi LineNr term=underline ctermfg=3 guifg=Red3
hi Question term=standout ctermfg=2 gui=bold guifg=SeaGreen
hi StatusLine term=bold,reverse cterm=bold,reverse gui=bold guifg=White guibg=Black
hi StatusLineNC term=reverse cterm=reverse gui=bold guifg=PeachPuff guibg=Gray45
hi VertSplit term=reverse cterm=reverse gui=bold guifg=White guibg=Gray45
hi Title term=bold ctermfg=5 gui=bold guifg=DeepPink3
hi Visual term=reverse cterm=reverse gui=reverse guifg=Grey80 guibg=fg
hi VisualNOS term=bold,underline cterm=bold,underline gui=bold,underline
hi WarningMsg term=standout ctermfg=1 gui=bold guifg=Red
hi WildMenu term=standout ctermfg=0 ctermbg=3 guifg=Black guibg=Yellow
hi Folded term=standout ctermfg=4 ctermbg=7 guifg=Black guibg=#e3c1a5
hi FoldColumn term=standout ctermfg=4 ctermbg=7 guifg=DarkBlue guibg=Gray80
hi DiffAdd term=bold ctermbg=4 guibg=White
hi DiffChange term=bold ctermbg=5 guibg=#edb5cd
hi DiffDelete term=bold cterm=bold ctermfg=4 ctermbg=6 gui=bold guifg=LightBlue guibg=#f6e8d0
hi DiffText term=reverse cterm=bold ctermbg=1 gui=bold guibg=#ff8060
hi Cursor guifg=bg guibg=fg
hi lCursor guifg=bg guibg=fg
" Colors for syntax highlighting
hi Comment term=bold ctermfg=4 guifg=#406090
hi Constant term=underline ctermfg=1 guifg=#c00058
hi Special term=bold ctermfg=5 guifg=SlateBlue
hi Identifier term=underline ctermfg=6 guifg=DarkCyan
hi Statement term=bold ctermfg=3 gui=bold guifg=Brown
hi PreProc term=underline ctermfg=5 guifg=Magenta3
hi Type term=underline ctermfg=2 gui=bold guifg=SeaGreen
hi Ignore cterm=bold ctermfg=7 guifg=bg
hi Error term=reverse cterm=bold ctermfg=7 ctermbg=1 gui=bold guifg=White guibg=Red
hi Todo term=standout ctermfg=0 ctermbg=3 guifg=Blue guibg=Yellow

View File

@ -0,0 +1,43 @@
" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file
" Maintainer: Ron Aaron <ron@ronware.org>
" Last Change: 2003 May 02
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "ron"
hi Normal guifg=cyan guibg=black
hi NonText guifg=brown
hi comment guifg=green
hi constant guifg=cyan gui=bold
hi identifier guifg=cyan gui=NONE
hi statement guifg=lightblue gui=NONE
hi preproc guifg=Pink2
hi type guifg=seagreen gui=bold
hi special guifg=yellow
hi ErrorMsg guifg=Black guibg=Red
hi WarningMsg guifg=Black guibg=Green
hi Error guibg=Red
hi Todo guifg=Black guibg=orange
hi Cursor guibg=#60a060 guifg=#00ff00
hi Search guibg=lightslateblue
hi IncSearch gui=NONE guibg=steelblue
hi LineNr guifg=darkgrey
hi title guifg=darkgrey
hi StatusLineNC gui=NONE guifg=lightblue guibg=darkblue
hi StatusLine gui=bold guifg=cyan guibg=blue
hi label guifg=gold2
hi operator guifg=orange
hi clear Visual
hi Visual term=reverse cterm=reverse gui=reverse
hi DiffChange guibg=darkgreen
hi DiffText guibg=olivedrab
hi DiffAdd guibg=slateblue
hi DiffDelete guibg=coral
hi Folded guibg=gray30
hi FoldColumn guibg=gray30 guifg=white
hi cIf0 guifg=gray

View File

@ -0,0 +1,60 @@
" Vim color file
" Maintainer: Yasuhiro Matsumoto <mattn@mail.goo.ne.jp>
" Last Change: 2001 May 25
" This look like normal text editor.
" This color scheme uses a light background.
" First remove all existing highlighting.
set background=light
hi clear
if exists("syntax_on")
syntax reset
endif
let colors_name = "shine"
hi Normal ctermbg=White ctermfg=Black guifg=Black guibg=White
" Groups used in the 'highlight' and 'guicursor' options default value.
hi ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White
hi IncSearch term=reverse cterm=reverse gui=reverse
hi ModeMsg term=bold cterm=bold gui=bold
hi StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold
hi StatusLineNC term=reverse cterm=reverse gui=reverse
hi VertSplit term=reverse cterm=reverse gui=reverse
hi Visual term=reverse cterm=reverse gui=reverse guifg=Grey guibg=fg
hi VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold
hi DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red
hi Cursor ctermbg=Green guibg=Green guifg=Black
hi lCursor guibg=Cyan guifg=Black
hi Directory term=bold ctermfg=LightRed guifg=Red
hi LineNr term=underline ctermfg=Yellow guifg=Yellow
hi MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen
hi NonText term=bold ctermfg=LightBlue gui=bold guifg=LightBlue guibg=grey90
hi Question term=standout ctermfg=LightGreen gui=bold guifg=Green
hi Search term=reverse ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
hi SpecialKey term=bold ctermfg=LightBlue guifg=Blue
hi Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta
hi WarningMsg term=standout ctermfg=LightRed guifg=Red
hi WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black
hi Folded term=standout ctermbg=LightGrey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue
hi FoldColumn term=standout ctermbg=LightGrey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue
hi DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue
hi DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta
hi DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan
hi Comment ctermfg=DarkGrey ctermbg=White guifg=DarkGrey gui=bold
hi SpecialChar ctermfg=DarkGrey ctermbg=White guifg=DarkGrey gui=bold
hi StorageClass ctermfg=Red ctermbg=White guifg=Red gui=bold
hi Number ctermfg=LightRed ctermbg=White guifg=LightRed gui=bold
" Groups for syntax highlighting
hi Constant term=underline ctermfg=Magenta guifg=#a07070 guibg=grey80
hi Special term=bold ctermfg=LightRed guifg=DarkOrange guibg=grey80
if &t_Co > 8
hi Statement term=bold cterm=bold ctermfg=DarkGreen ctermbg=White guifg=#ffff60 gui=bold
endif
hi Ignore ctermfg=LightGrey guifg=grey90
" vim: sw=2

View File

@ -0,0 +1,50 @@
" Vim color file
" Maintainer: Thorsten Maerz <info@netztorte.de>
" Last Change: 2001 Jul 23
" grey on black
" optimized for TFT panels
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
"colorscheme default
let g:colors_name = "torte"
" hardcoded colors :
" GUI Comment : #80a0ff = Light blue
" GUI
highlight Normal guifg=Grey80 guibg=Black
highlight Search guifg=Black guibg=Red gui=bold
highlight Visual guifg=Grey25 gui=bold
highlight Cursor guifg=Black guibg=Green gui=bold
highlight Special guifg=Orange
highlight Comment guifg=#80a0ff
highlight StatusLine guifg=blue guibg=white
highlight Statement guifg=Yellow gui=NONE
highlight Type gui=NONE
" Console
highlight Normal ctermfg=LightGrey ctermbg=Black
highlight Search ctermfg=Black ctermbg=Red cterm=NONE
highlight Visual cterm=reverse
highlight Cursor ctermfg=Black ctermbg=Green cterm=bold
highlight Special ctermfg=Brown
highlight Comment ctermfg=Blue
highlight StatusLine ctermfg=blue ctermbg=white
highlight Statement ctermfg=Yellow cterm=NONE
highlight Type cterm=NONE
" only for vim 5
if has("unix")
if v:version<600
highlight Normal ctermfg=Grey ctermbg=Black cterm=NONE guifg=Grey80 guibg=Black gui=NONE
highlight Search ctermfg=Black ctermbg=Red cterm=bold guifg=Black guibg=Red gui=bold
highlight Visual ctermfg=Black ctermbg=yellow cterm=bold guifg=Grey25 gui=bold
highlight Special ctermfg=LightBlue cterm=NONE guifg=LightBlue gui=NONE
highlight Comment ctermfg=Cyan cterm=NONE guifg=LightBlue gui=NONE
endif
endif

View File

@ -0,0 +1,54 @@
" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file
" Maintainer: Ron Aaron <ron@ronware.org>
" Last Change: 2003 May 02
set background=light
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "zellner"
hi Comment term=bold ctermfg=Red guifg=Red
hi Normal guifg=black guibg=white
hi Constant term=underline ctermfg=Magenta guifg=Magenta
hi Special term=bold ctermfg=Magenta guifg=Magenta
hi Identifier term=underline ctermfg=Blue guifg=Blue
hi Statement term=bold ctermfg=DarkRed gui=NONE guifg=Brown
hi PreProc term=underline ctermfg=Magenta guifg=Purple
hi Type term=underline ctermfg=Blue gui=NONE guifg=Blue
hi Visual term=reverse ctermfg=Yellow ctermbg=Red gui=NONE guifg=Black guibg=Yellow
hi Search term=reverse ctermfg=Black ctermbg=Cyan gui=NONE guifg=Black guibg=Cyan
hi Tag term=bold ctermfg=DarkGreen guifg=DarkGreen
hi Error term=reverse ctermfg=15 ctermbg=9 guibg=Red guifg=White
hi Todo term=standout ctermbg=Yellow ctermfg=Black guifg=Blue guibg=Yellow
hi StatusLine term=bold,reverse cterm=NONE ctermfg=Yellow ctermbg=DarkGray gui=NONE guifg=Yellow guibg=DarkGray
hi! link MoreMsg Comment
hi! link ErrorMsg Visual
hi! link WarningMsg ErrorMsg
hi! link Question Comment
hi link String Constant
hi link Character Constant
hi link Number Constant
hi link Boolean Constant
hi link Float Number
hi link Function Identifier
hi link Conditional Statement
hi link Repeat Statement
hi link Label Statement
hi link Operator Statement
hi link Keyword Statement
hi link Exception Statement
hi link Include PreProc
hi link Define PreProc
hi link Macro PreProc
hi link PreCondit PreProc
hi link StorageClass Type
hi link Structure Type
hi link Typedef Type
hi link SpecialChar Special
hi link Delimiter Special
hi link SpecialComment Special
hi link Debug Special

View File

@ -0,0 +1,11 @@
This directory contains Vim scripts to be used with a specific compiler.
They are used with the ":compiler" command.
These scripts usually set options, for example 'errorformat'.
See ":help write-compiler-plugin".
If you want to write your own compiler plugin, have a look at the other files
for how to do it, the format is simple.
If you think a compiler plugin you have written is useful for others, please
send it to Bram@vim.org.

View File

@ -0,0 +1,38 @@
" Vim Compiler File
" Compiler: ant
" Maintainer: Johannes Zellner <johannes@zellner.org>
" Last Change: Tue, 27 Apr 2004 15:01:45 CEST
if exists("current_compiler")
finish
endif
let current_compiler = "ant"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo&vim
CompilerSet makeprg=ant
" first line:
" ant with jikes +E, which assumes the following
" two property lines in your 'build.xml':
"
" <property name = "build.compiler" value = "jikes"/>
" <property name = "build.compiler.emacs" value = "true"/>
"
" second line:
" ant with javac
"
" note that this will work also for tasks like [wtkbuild]
"
setlocal errorformat=\ %#[%.%#]\ %#%f:%l:%v:%*\\d:%*\\d:\ %t%[%^:]%#:%m,
\%A\ %#[%.%#]\ %f:%l:\ %m,%-Z\ %#[%.%#]\ %p^,%C\ %#[%.%#]\ %#%m
" ,%-C%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -0,0 +1,19 @@
" Vim compiler file
" Compiler: bcc - Borland C
" Maintainer: Emile van Raaij (eraaij@xs4all.nl)
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "bcc"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
" A workable errorformat for Borland C
CompilerSet errorformat=%*[^0-9]%n\ %f\ %l:\ %m
" default make
CompilerSet makeprg=make

View File

@ -0,0 +1,30 @@
" Vim compiler file
" Compiler: BDF to PCF Conversion
" Maintainer: Nikolai Weibull <sourc@pcppopper.org>
" URL: http://www.pcppopper.org/vim/compiler/pcp/bdf/
" Latest Revision: 2004-05-22
" arch-tag: 2e2f3a55-199b-468c-aa2e-d6b1a7b87806
if exists("current_compiler")
finish
endif
let current_compiler = "bdf"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
CompilerSet makeprg=bdftopcf\ $*
CompilerSet errorformat=%ABDF\ %trror\ on\ line\ %l:\ %m,
\%-Z%p^,
\%Cbdftopcf:\ bdf\ input\\,\ %f\\,\ corrupt,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: set sts=2 sw=2:

View File

@ -0,0 +1,20 @@
" Vim compiler file
" Compiler: Checkstyle
" Maintainer: Doug Kearns <djkea2@mugca.its.monash.edu.au>
" URL: http://mugca.its.monash.edu.au/~djkea2/vim/compiler/checkstyle.vim
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "checkstyle"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=java\ com.puppycrawl.tools.checkstyle.Main\ -f\ plain
" sample error: WebTable.java:282: '+=' is not preceeded with whitespace.
" WebTable.java:201:1: '{' should be on the previous line.
CompilerSet errorformat=%f:%l:\ %m,%f:%l:%v:\ %m,%-G%.%#

View File

@ -0,0 +1,19 @@
" Vim compiler file
" Compiler: ms C#
" Maintainer: Joseph H. Yao (hyao@sina.com)
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "cs"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
" default errorformat
CompilerSet errorformat&
" default make
CompilerSet makeprg=csc\ %

View File

@ -0,0 +1,15 @@
" Vim compiler file
" Compiler: ATT dot
" Maintainer: Marcos Macedo <bar4ka@bol.com.br>
" Last Change: 2004 May 16
if exists("current_compiler")
finish
endif
let current_compiler = "dot"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=dot\ -T$*\ \"%:p\"\ -o\ \"%:p:r.$*\"

View File

@ -0,0 +1,27 @@
" Vim compiler file
" Compiler: Fortran Company/NAGWare F compiler
" URL: http://www.unb.ca/chem/ajit/compiler/fortran_F.vim
" Maintainer: Ajit J. Thakkar (ajit AT unb.ca); <http://www.unb.ca/chem/ajit/>
" Version: 0.2
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "fortran_F"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cposet=&cpoptions
set cpoptions-=C
CompilerSet errorformat=%trror:\ %f\\,\ line\ %l:%m,
\%tarning:\ %f\\,\ line\ %l:%m,
\%tatal\ Error:\ %f\\,\ line\ %l:%m,
\%-G%.%#
CompilerSet makeprg=F
let &cpoptions=s:cposet
unlet s:cposet

View File

@ -0,0 +1,30 @@
" Vim compiler file
" Compiler: Compaq Visual Fortran
" Maintainer: Joh.-G. Simon (johann-guenter.simon@linde-le.com)
" Last Change: 11/05/2002
if exists("current_compiler")
finish
endif
let current_compiler = "fortran_cv"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cposet = &cpoptions
set cpoptions-=C
" A workable errorformat for Compaq Visual Fortran
CompilerSet errorformat=
\%E%f(%l)\ :\ Error:%m,
\%W%f(%l)\ :\ Warning:%m,
\%-Z%p%^%.%#,
\%-G%.%#,
" Compiler call
CompilerSet makeprg=df\ /nologo\ /noobj\ /c\ %
" Visual fortran defaults to printing output on stderr
" Adjust option shellpipe accordingly
let &cpoptions = s:cposet
unlet s:cposet

View File

@ -0,0 +1,33 @@
" Vim compiler file
" Compiler: Essential Lahey Fortran 90
" Probably also works for Lahey Fortran 90
" URL: http://www.unb.ca/chem/ajit/compiler/fortran_elf90.vim
" Maintainer: Ajit J. Thakkar (ajit AT unb.ca); <http://www.unb.ca/chem/ajit/>
" Version: 0.2
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "fortran_elf90"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cposet=&cpoptions
set cpoptions-=C
CompilerSet errorformat=\%ALine\ %l\\,\ file\ %f,
\%C%tARNING\ --%m,
\%C%tATAL\ --%m,
\%C%tBORT\ --%m,
\%+C%\\l%.%#\.,
\%C%p\|,
\%C%.%#,
\%Z%$,
\%-G%.%#
CompilerSet makeprg=elf90
let &cpoptions=s:cposet
unlet s:cposet

View File

@ -0,0 +1,48 @@
" Vim compiler file
" Compiler: g77 (GNU Fortran)
" Maintainer: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
" Last Change: $Date: 2004/07/13 23:28:22 $
" $Revision: 1.1 $
if exists("current_compiler")
finish
endif
let current_compiler = "fortran_g77"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
" Note: The errorformat assumes GNU make
" sample multiline errors (besides gcc backend one-liners):
" gev.f:14:
" parameter UPLO = 'Upper-triangle'
" ^
" Unsupported VXT statement at (^)
" gev.f:6:
" integer desca( * ), descb( * )
" 1
" gev.f:19: (continued):
" end subroutine
" 2
" Invalid declaration of or reference to symbol `desca' at (2) [initially seen at (1)]
CompilerSet errorformat=
\%Omake:\ %r,
\%f:%l:\ warning:\ %m,
\%A%f:%l:\ (continued):,
\%W%f:%l:\ warning:,
\%A%f:%l:\ ,
\%-C\ \ \ %p%*[0123456789^]%.%#,
\%-C\ \ \ %.%#,
\%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
\%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
\%DMaking\ %*\\a\ in\ %f,
\%Z%m
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -0,0 +1,27 @@
" Vim compiler file
" Compiler: Lahey/Fujitsu Fortran 95
" URL: http://www.unb.ca/chem/ajit/compiler/fortran_lf95.vim
" Maintainer: Ajit J. Thakkar (ajit AT unb.ca); <http://www.unb.ca/chem/ajit/>
" Version: 0.2
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "fortran_lf95"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cposet=&cpoptions
set cpoptions-=C
CompilerSet errorformat=\ %#%n-%t:\ \"%f\"\\,\ line\ %l:%m,
\Error\ LINK\.%n:%m,
\Warning\ LINK\.%n:%m,
\%-G%.%#
CompilerSet makeprg=lf95
let &cpoptions=s:cposet
unlet s:cposet

View File

@ -0,0 +1,28 @@
" Vim compiler file
" Compiler: HP aCC
" Maintainer: Matthias Ulrich <matthias-ulrich@web.de>
" URL: http://www.subhome.de/vim/hp_acc.vim
" Last Change: 2004 Mar 27
"
" aCC --version says: "HP ANSI C++ B3910B A.03.13"
" This compiler has been tested on:
" hp-ux 10.20, hp-ux 11.0 and hp-ux 11.11 (64bit)
"
" Tim Brown's aCC is: "HP ANSI C++ B3910B A.03.33"
" and it also works fine...
if exists("current_compiler")
finish
endif
let current_compiler = "hp_acc"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet errorformat=%A%trror\ %n\:\ \"%f\"\\,\ line\ %l\ \#\ %m,
\%A%tarning\ %n\:\ \"%f\"\\,\ line\ %l\ \#\ %m\ %#,
\%Z\ \ \ \ %p^%.%#,
\%-C%.%#
" vim:ts=8:sw=4:cindent

View File

@ -0,0 +1,18 @@
" Vim compiler file
" Compiler: icc - Intel C++
" Maintainer: Peter Puck <PtrPck@netscape.net>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "icc"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
" I think that Intel is calling the compiler icl under Windows
CompilerSet errorformat=%-Z%p^,%f(%l):\ remark\ #%n:%m,%f(%l)\ :\ (col.\ %c)\ remark:\ %m,%E%f(%l):\ error:\ %m,%E%f(%l):\ error:\ #%n:\ %m,%W%f(%l):\ warning\ #%n:\ %m,%W%f(%l):\ warning:\ %m,%-C%.%#

View File

@ -0,0 +1,21 @@
" Vim compiler file
" Compiler: Intel C++ 7.1
" Maintainer: David Harrison <david_jr@users.sourceforge.net>
" Last Change: 2004 May 16
if exists("current_compiler")
finish
endif
let current_compiler = "intel"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet errorformat=%E%f(%l):\ error:\ %m,
\%W%f(%l):\ warning:\ %m,
\%I%f(%l):\ remark\ #%n:\ %m,
\%+C\ \ %m.,
\%-Z\ \ %p^,
\%-G\\s%#,
\%-G%.%#

View File

@ -0,0 +1,21 @@
" Vim compiler file
" Compiler: SGI IRIX 5.3 cc
" Maintainer: David Harrison <david_jr@users.sourceforge.net>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "irix5_c"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet errorformat=\%Ecfe:\ Error:\ %f\\,\ line\ %l:\ %m,
\%Wcfe:\ Warning:\ %n:\ %f\\,\ line\ %l:\ %m,
\%Wcfe:\ Warning\ %n:\ %f\\,\ line\ %l:\ %m,
\%W(%l)\ \ Warning\ %n:\ %m,
\%-Z\ %p^,
\-G\\s%#,
\%-G%.%#

View File

@ -0,0 +1,21 @@
" Vim compiler file
" Compiler: SGI IRIX 5.3 CC or NCC
" Maintainer: David Harrison <david_jr@users.sourceforge.net>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "irix5_cpp"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet errorformat=%E\"%f\"\\,\ line\ %l:\ error(%n):\ ,
\%E\"%f\"\\,\ line\ %l:\ error(%n):\ %m,
\%W\"%f\"\\,\ line\ %l:\ warning(%n):\ %m,
\%+IC++\ prelinker:\ %m,
\%-Z\ \ %p%^,
\%+C\ %\\{10}%.%#,
\%-G%.%#

View File

@ -0,0 +1,18 @@
" Vim compiler file
" Compiler: javac
" Maintainer: Doug Kearns <djkea2@mugca.its.monash.edu.au>
" URL: http://mugca.its.monash.edu.au/~djkea2/vim/compiler/javac.vim
" Last Change: 2004 Apr 15
if exists("current_compiler")
finish
endif
let current_compiler = "javac"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=javac
CompilerSet errorformat=%E%f:%l:\ %m,%-Z%p^,%-C%.%#,%-G%.%#

View File

@ -0,0 +1,18 @@
" Vim Compiler File
" Compiler: Jikes
" Maintainer: Dan Sharp <dwsharp at hotmail dot com>
" Last Change: 2004 Mar 27
" URL: http://mywebpage.netscape.com/sharppeople/vim/compiler
if exists("current_compiler")
finish
endif
let current_compiler = "jikes"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
" Jikes defaults to printing output on stderr
CompilerSet makeprg=jikes\ -Xstdout\ +E\ \"%\"
CompilerSet errorformat=%f:%l:%v:%*\\d:%*\\d:%*\\s%m

View File

@ -0,0 +1,21 @@
" Vim compiler file
" Compiler: SGI IRIX 6.5 MIPS C (cc)
" Maintainer: David Harrison <david_jr@users.sourceforge.net>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "mips_c"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet errorformat=%Ecc\-%n\ %.%#:\ ERROR\ File\ =\ %f\%\\,\ Line\ =\ %l,
\%Wcc\-%n\ %.%#:\ WARNING\ File\ =\ %f\%\\,\ Line\ =\ %l,
\%Icc\-%n\ %.%#:\ REMARK\ File\ =\ %f\%\\,\ Line\ =\ %l,
\%+C\ \ %m.,
\%-Z\ \ %p^,
\%-G\\s%#,
\%-G%.%#

View File

@ -0,0 +1,22 @@
" Vim compiler file
" Compiler: SGI IRIX 6.5 MIPSPro C (c89)
" Maintainer: David Harrison <david_jr@users.sourceforge.net>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "mipspro_c89"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet errorformat=%Ecc\-%n\ %.%#:\ ERROR\ File\ =\ %f\%\\,\ Line\ =\ %l,
\%Wcc\-%n\ %.%#:\ WARNING\ File\ =\ %f\%\\,\ Line\ =\ %l,
\%Icc\-%n\ %.%#:\ REMARK\ File\ =\ %f\%\\,\ Line\ =\ %l,
\%-Z%p%^,
\%+C\ %\\{10}%m%.,
\%+C\ \ %m,
\%-G\\s%#,
\%-G%.%#

View File

@ -0,0 +1,21 @@
" Vim compiler file
" Compiler: SGI IRIX 6.5 MIPSPro C++ (CC)
" Maintainer: David Harrison <david_jr@users.sourceforge.net>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "mipspro_cpp"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet errorformat=%Ecc\-%n\ %.%#:\ ERROR\ File\ =\ %f\%\\,\ Line\ =\ %l,
\%Wcc\-%n\ %.%#:\ WARNING\ File\ =\ %f\%\\,\ Line\ =\ %l,
\%Icc\-%n\ %.%#:\ REMARK\ File\ =\ %f\%\\,\ Line\ =\ %l,
\%+C\ \ %m.,
\%-Z\ \ %p^,
\%-G\\s%#,
\%-G%.%#

View File

@ -0,0 +1,20 @@
" Vim Compiler File
" Compiler: Modelsim Vcom
" Maintainer: Paul Baleme <pbaleme@mail.com>
" Last Change: September 8, 2003
" Thanks to: allanherriman@hotmail.com
if exists("current_compiler")
finish
endif
let current_compiler = "modelsim_vcom"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
"setlocal errorformat=\*\*\ %tRROR:\ %f(%l):\ %m,%tRROR:\ %f(%l):\ %m,%tARNING\[%*[0-9]\]:\ %f(%l):\ %m,\*\*\ %tRROR:\ %m,%tRROR:\ %m,%tARNING\[%*[0-9]\]:\ %m
"setlocal errorformat=%tRROR:\ %f(%l):\ %m,%tARNING\[%*[0-9]\]:\ %m
CompilerSet errorformat=\*\*\ %tRROR:\ %f(%l):\ %m,\*\*\ %tRROR:\ %m,\*\*\ %tARNING:\ %m,\*\*\ %tOTE:\ %m,%tRROR:\ %f(%l):\ %m,%tARNING\[%*[0-9]\]:\ %f(%l):\ %m,%tRROR:\ %m,%tARNING\[%*[0-9]\]:\ %m

View File

@ -0,0 +1,17 @@
" Vim compiler file
" Compiler: Miscrosoft Visual C
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2004 Mar 19
if exists("current_compiler")
finish
endif
let current_compiler = "msvc"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
" The errorformat for MSVC is the default.
CompilerSet errorformat&
CompilerSet makeprg=nmake

View File

@ -0,0 +1,15 @@
" Vim compiler file
" Compiler: ATT neato
" Maintainer: Marcos Macedo <bar4ka@bol.com.br>
" Last Change: 2004 May 16
if exists("current_compiler")
finish
endif
let current_compiler = "neato"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=neato\ -T$*\ \"%:p\"\ -o\ \"%:p:r.$*\"

View File

@ -0,0 +1,24 @@
" Vim compiler file
" Compiler: onsgmls
" Maintainer: Robert Rowsome <rowsome@wam.umd.edu>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "onsgmls"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
CompilerSet makeprg=onsgmls\ -s\ %
CompilerSet errorformat=onsgmls:%f:%l:%c:%t:%m,
\onsgmls:%f:%l:%c:%m
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -0,0 +1,20 @@
" Vim compiler file
" Compiler: Apple Project Builder
" Maintainer: Alexander von Below (public@vonBelow.Com)
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "pbx"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
" The compiler actually is gcc, so the errorformat is unchanged
CompilerSet errorformat&
" default make
CompilerSet makeprg=pbxbuild

View File

@ -0,0 +1,39 @@
" Vim Compiler File
" Compiler: Perl syntax checks (perl -Wc)
" Maintainer: Christian J. Robinson <infynity@onewest.net>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "perl"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:savecpo = &cpo
set cpo&vim
if getline(1) =~# '-[^ ]*T'
CompilerSet makeprg=perl\ -WTc\ %
else
CompilerSet makeprg=perl\ -Wc\ %
endif
CompilerSet errorformat=
\%-G%.%#had\ compilation\ errors.,
\%-G%.%#syntax\ OK,
\%m\ at\ %f\ line\ %l.,
\%+A%.%#\ at\ %f\ line\ %l\\,%.%#,
\%+C%.%#
" Explanation:
" %-G%.%#had\ compilation\ errors., - Ignore the obvious.
" %-G%.%#syntax\ OK, - Don't include the 'a-okay' message.
" %m\ at\ %f\ line\ %l., - Most errors...
" %+A%.%#\ at\ %f\ line\ %l\\,%.%#, - As above, including ', near ...'
" %+C%.%# - ... Which can be multi-line.
let &cpo = s:savecpo
unlet s:savecpo

View File

@ -0,0 +1,16 @@
" Vim compiler file
" Compiler: Unit testing tool for Python
" Maintainer: Max Ischenko <mfi@ukr.net>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "pyunit"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]%\\@=%m

View File

@ -0,0 +1,33 @@
" Vim compiler file
" Compiler: reStructuredText Documentation Format
" Maintainer: Nikolai Weibull <source@pcppopper.org>
" URL: http://www.pcppopper.org/vim/compiler/pcp/rst/
" Latest Revision: 2004-05-22
" arch-tag: ac64a95a-5d45-493d-a9f9-f96fc8568657
if exists("current_compiler")
finish
endif
let current_compiler = "rst"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
CompilerSet errorformat=
\%f:%l:\ (%tEBUG/0)\ %m,
\%f:%l:\ (%tNFO/1)\ %m,
\%f:%l:\ (%tARNING/2)\ %m,
\%f:%l:\ (%tRROR/3)\ %m,
\%f:%l:\ (%tEVERE/3)\ %m,
\%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
\%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
\%DMaking\ %*\\a\ in\ %f
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: set sts=2 sw=2:

View File

@ -0,0 +1,62 @@
" Vim compiler file
" Compiler: Ruby syntax check and/or error reporting
" Maintainer: Tim Hammerquist <timmy@cpan.org>
" Last Change: Tue Jul 16 00:38:00 PDT 2002
"
" Changelog:
" 0.2: script saves and restores 'cpoptions' value to prevent problems with
" line continuations
" 0.1: initial release
"
" Contributors:
" Hugh Sasse <hgs@dmu.ac.uk>
" Doug Kearns <djkea2@mugca.its.monash.edu.au>
"
" Todo:
" match error type %m
"
" Comments:
" I know this file isn't perfect. If you have any questions, suggestions,
" patches, etc., please don't hesitate to let me know.
"
" This is my first experience with 'errorformat' and compiler plugins and
" I welcome any input from more experienced (or clearer-thinking)
" individuals.
if exists("current_compiler")
finish
endif
let current_compiler = "ruby"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
" default settings runs script normally
" add '-c' switch to run syntax check only:
"
" CompilerSet makeprg=ruby\ -wc\ $*
"
" or add '-c' at :make command line:
"
" :make -c %<CR>
"
CompilerSet makeprg=ruby\ -w\ $*
CompilerSet errorformat=
\%+E%f:%l:\ parse\ error,
\%W%f:%l:\ warning:\ %m,
\%E%f:%l:in\ %*[^:]:\ %m,
\%E%f:%l:\ %m,
\%-C%\tfrom\ %f:%l:in\ %.%#,
\%-Z%\tfrom\ %f:%l,
\%-Z%p^,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ft=vim

View File

@ -0,0 +1,28 @@
" Vim compiler file
" Compiler: se (SmartEiffel Compiler)
" Maintainer: Doug Kearns <djkea2@mugca.its.monash.edu.au>
" URL: http://mugca.its.monash.edu.au/~djkea2/vim/compiler/se.vim
" Last Change: 2004 May 16
if exists("current_compiler")
finish
endif
let current_compiler = "se"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
CompilerSet makeprg=compile\ %
CompilerSet errorformat=%W******\ Warning:\ %m,
\%E******\ Fatal\ Error:\ %m,
\%E******\ Error:\ %m,
\%CLine\ %l\ column\ %c\ in\ %\\w%\\+\ (%f)\ :,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -0,0 +1,70 @@
" Vim compiler file
" Compiler: splint/lclint (C source code checker)
" Maintainer: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
" Splint Home: http://www.splint.org/
" Last Change: $Date: 2004/07/13 23:28:21 $
" $Revision: 1.1 $
if exists("current_compiler")
finish
endif
let current_compiler = "splint"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
" adapt this if you want to check more than one file at a time.
" put command line options in .splintrc or ~/.splintrc
CompilerSet makeprg=splint\ %
" Note: when using the new array bounds checking flags: Each warning
" usually has several lines and several references to source code mostly
" within one or two lines (see sample warning below). The easiest way
" not to mess up file name detection and not to jump to all positions is
" to add something like
" -linelen 500 +boundscompacterrormessages
" to your .splintrc and 'set cmdheight=4' or more.
" TODO: reliable way to distinguish file names and constraints.
"
" sample warning (generic):
"
"foo.c:1006:12: Clauses exit with var referencing local storage in one
" case, fresh storage in other case
" foo.c:1003:2: Fresh storage var allocated
"
" sample warning (bounds checking):
"
"bounds.c: (in function updateEnv)
"bounds.c:10:5: Possible out-of-bounds store:
" strcpy(str, tmp)
" Unable to resolve constraint:
" requires maxSet(str @ bounds.c:10:13) >= maxRead(getenv("MYENV") @
" bounds.c:6:9)
" needed to satisfy precondition:
" requires maxSet(str @ bounds.c:10:13) >= maxRead(tmp @ bounds.c:10:18)
" derived from strcpy precondition: requires maxSet(<parameter 1>) >=
" maxRead(<parameter 2>)
" A memory write may write to an address beyond the allocated buffer. (Use
" -boundswrite to inhibit warning)
CompilerSet errorformat=%OLCLint*m,
\%OSplint*m,
\%*[\ ]%f:%l:%c:\ %m,
\%*[\ ]%f:%l:\ %m,
\%*[^\"]\"%f\"%*\\D%l:\ %m,
\\"%f\"%*\\D%l:\ %m,
\%A%f:%l:%c:\ %m,
\%A%f:%l:%m,
\\"%f\"\\,
\\ line\ %l%*\\D%c%*[^\ ]\ %m,
\%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
\%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
\%DMaking\ %*\\a\ in\ %f,
\%C\ \ %m
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -0,0 +1,18 @@
" Vim compiler file
" Compiler: tcl
" Maintainer: Doug Kearns <djkea2@mugca.its.monash.edu.au>
" URL: http://mugca.its.monash.edu.au/~djkea2/vim/compiler/tcl.vim
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "tcl"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=tcl
CompilerSet errorformat=%EError:\ %m,%+Z\ %\\{4}(file\ \"%f\"\ line\ %l),%-G%.%#

View File

@ -0,0 +1,68 @@
" Vim compiler file
" Compiler: TeX
" Maintainer: Artem Chuprina <ran@ran.pp.ru>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
" If makefile exists and we are not asked to ignore it, we use standard make
" (do not redefine makeprg)
if exists('b:tex_ignore_makefile') || exists('g:tex_ignore_makefile') ||
\(!filereadable('Makefile') && !filereadable('makefile'))
" If buffer-local variable 'tex_flavor' exists, it defines TeX flavor,
" otherwize the same for global variable with same name, else it will be
" LaTeX
if exists("b:tex_flavor")
let current_compiler = b:tex_flavor
elseif exists("g:tex_flavor")
let current_compiler = g:tex_flavor
else
let current_compiler = "latex"
endif
let &l:makeprg=current_compiler.' -interaction=nonstopmode'
else
let current_compiler = 'make'
endif
let s:cpo_save = &cpo
set cpo-=C
" Value errorformat are taken from vim help, see :help errorformat-LaTeX, with
" addition from Srinath Avadhanula <srinath@fastmail.fm>
CompilerSet errorformat=%E!\ LaTeX\ %trror:\ %m,
\%E!\ %m,
\%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,
\%+W%.%#\ at\ lines\ %l--%*\\d,
\%WLaTeX\ %.%#Warning:\ %m,
\%Cl.%l\ %m,
\%+C\ \ %m.,
\%+C%.%#-%.%#,
\%+C%.%#[]%.%#,
\%+C[]%.%#,
\%+C%.%#%[{}\\]%.%#,
\%+C<%.%#>%.%#,
\%C\ \ %m,
\%-GSee\ the\ LaTeX%m,
\%-GType\ \ H\ <return>%m,
\%-G\ ...%.%#,
\%-G%.%#\ (C)\ %.%#,
\%-G(see\ the\ transcript%.%#),
\%-G\\s%#,
\%+O(%*[^()])%r,
\%+O%*[^()](%*[^()])%r,
\%+P(%f%r,
\%+P\ %\\=(%f%r,
\%+P%*[^()](%f%r,
\%+P[%\\d%[^()]%#(%f%r,
\%+Q)%r,
\%+Q%*[^()])%r,
\%+Q[%\\d%*[^()])%r
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -0,0 +1,29 @@
" Vim compiler file
" Compiler: HTML Tidy
" Maintainer: Doug Kearns <djkea2@mugca.its.monash.edu.au>
" URL: http://mugca.its.monash.edu.au/~djkea2/vim/compiler/tidy.vim
" Last Change: 2004 Mar 27
" NOTE: set 'tidy_compiler_040800' if you are using the 4th August 2000 release
" of HTML Tidy.
if exists("current_compiler")
finish
endif
let current_compiler = "tidy"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
" this is needed to work around a bug in the 04/08/00 release of tidy which
" failed to set the filename if the -quiet option was used
if exists("tidy_compiler_040800")
CompilerSet makeprg=tidy\ -errors\ --gnu-emacs\ yes\ %
else
CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes\ %
endif
" sample warning: foo.html:8:1: Warning: inserting missing 'foobar' element
" sample error: foo.html:9:2: Error: <foobar> is not recognized!
CompilerSet errorformat=%f:%l:%c:\ Error:%m,%f:%l:%c:\ Warning:%m,%-G%.%#

View File

@ -0,0 +1,29 @@
" Vim compiler file
" Compiler: xmllint
" Maintainer: Doug Kearns <djkea2@mugca.its.monash.edu.au>
" URL: http://mugca.its.monash.edu.au/~djkea2/vim/compiler/xmllint.vim
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "xmllint"
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
let s:cpo_save = &cpo
set cpo-=C
CompilerSet makeprg=xmllint\ --valid\ --noout\
CompilerSet errorformat=%E%f:%l:\ error:\ %m,
\%W%f:%l:\ warning:\ %m,
\%E%f:%l:\ validity\ error:\ %m,
\%W%f:%l:\ validity\ warning:\ %m,
\%-Z%p^,
\%-G%.%#
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -0,0 +1,23 @@
" Vim Compiler File
" Compiler: xmlwf
" Maintainer: Robert Rowsome <rowsome@wam.umd.edu>
" Last Change: 2004 Mar 27
if exists("current_compiler")
finish
endif
let current_compiler = "xmlwf"
let s:cpo_save = &cpo
set cpo&vim
if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=xmlwf\ %
CompilerSet errorformat=%f:%l%c:%m
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@ -0,0 +1,25 @@
" This Vim script deletes all the menus, so that they can be redefined.
" Warning: This also deletes all menus defined by the user!
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2001 May 27
aunmenu *
silent! unlet did_install_default_menus
silent! unlet did_install_syntax_menu
if exists("did_menu_trans")
menutrans clear
unlet did_menu_trans
endif
silent! unlet find_help_dialog
silent! unlet menutrans_help_dialog
silent! unlet menutrans_path_dialog
silent! unlet menutrans_tags_dialog
silent! unlet menutrans_textwidth_dialog
silent! unlet menutrans_fileformat_dialog
silent! unlet menutrans_no_file
" vim: set sw=2 :

View File

@ -0,0 +1,323 @@
*arabic.txt* For Vim version 6.3. Last change: 2003 May 11
VIM REFERENCE MANUAL by Nadim Shaikli
Arabic Language support (options & mappings) for Vim *Arabic*
{Vi does not have any of these commands}
*E800*
In order to use right-to-left and Arabic mapping support, it is
necessary to compile VIM with the |+arabic| feature.
These functions have been created by Nadim Shaikli <nadim-at-arabeyes.org>
It is best to view this file with these settings within VIM's GUI: >
:set encoding=utf-8
:set arabicshape
Introduction
------------
Arabic is a rather demanding language in which a number of special
features are required. Characters are right-to-left oriented and
ought to appear as such on the screen (ie. from right to left).
Arabic also requires shaping of its characters, meaning the same
character has a different visual form based on its relative location
within a word (initial, medial, final or stand-alone). Arabic also
requires two different forms of combining and the ability, in
certain instances, to either superimpose upto two characters on top
of another (composing) or the actual substitution of two characters
into one (combining). Lastly, to display Arabic properly one will
require not only ISO-8859-6 (U+0600-U+06FF) fonts, but will also
require Presentation Form-B (U+FE70-U+FEFF) fonts both of which are
subsets within a so-called ISO-10646-1 font.
The commands, prompts and help files are not in Arabic, therefore
the user interface remains the standard Vi interface.
Highlights
----------
o Editing left-to-right files as in the original VIM hasn't changed.
o Viewing and editing files in right-to-left windows. File
orientation is per window, so it is possible to view the same
file in right-to-left and left-to-right modes, simultaneously.
o No special terminal with right-to-left capabilities is required.
The right-to-left changes are completely hardware independent.
Only Arabic fonts are necessary.
o Compatible with the original VIM. Almost all features work in
right-to-left mode (there are liable to be bugs).
o Changing keyboard mapping and reverse insert modes using a single
command.
o Toggling complete Arabic support via a single command.
o While in Arabic mode, numbers are entered from left to right. Upon
entering a none number character, that character will be inserted
just into the left of the last number.
o Arabic keymapping on the command line in reverse insert mode.
o Proper Bidirectional functionality is possible given VIM is
started within a Bidi capable terminal emulator.
Arabic Fonts *arabicfonts*
------------
VIM requires monospaced fonts of which there are many out there.
Arabic requires ISO-8859-6 as well as Presentation Form-B fonts
(without Form-B, Arabic will _NOT_ be usable). It is highly
recommended that users search for so-called 'ISO-10646-1' fonts.
Do an Internet search or check www.arabeyes.org for further
info on where to attain the necessary Arabic fonts.
Font Installation
-----------------
o Installation of fonts for X Window systems (Unix/Linux)
Depending on your system, copy your_ARABIC_FONT file into a
directory of your choice. Change to the directory containing
the Arabic fonts and execute the following commands:
% mkfontdir
% xset +fp path_name_of_arabic_fonts_directory
Usage
-----
Prior to the actual usage of Arabic within VIM, a number of settings
need to be accounted for and invoked.
o Setting the Arabic fonts
+ For VIM GUI set the 'guifont' to your_ARABIC_FONT. This is done
by entering the following command in the VIM window.
>
:set guifont=your_ARABIC_FONT
<
NOTE: the string 'your_ARABIC_FONT' is used to denote a complete
font name akin to that used in linux/unix system.
(eg. -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1)
You can append the 'guifont' set command to your .vimrc file
in order to get the same above noted results. In other words,
you can include ':set guifont=your_ARABIC_FONT' to your .vimrc
file.
+ Under the X Window environment, you can also start VIM with
'-fn your_ARABIC_FONT' option.
o Setting the appropriate character Encoding
To enable the correct Arabic encoding the following command needs
to be appended,
>
:set encoding=utf-8
<
to your .vimrc file (entering the command manually into you VIM
window is highly discouraged). In short, include ':set
encoding=utf-8' to your .vimrc file.
Attempts to use Arabic without UTF-8 will result the following
warning message,
*W17* >
Arabic requires UTF-8, do ':set encoding=utf-8'
o Enable Arabic settings [short-cut]
In order to simplify and streamline things, you can either invoke
VIM with the command-line option,
% vim -A my_utf8_arabic_file ...
or enable 'arabic' via the following command within VIM
>
:set arabic
<
The two above noted possible invocations are the preferred manner
in which users are instructed to proceed. Baring an enabled 'termbidi'
setting, both command options:
1. set the appropriate keymap
2. enable the deletion of a single combined pair character
3. enable rightleft mode
4. enable rightleftcmd mode (affecting the command-line)
5. enable arabicshape mode (do visual character alterations)
You may also append the command to your .vimrc file and simply
include ':set arabic' to it.
You are also capable of disabling Arabic support via
>
:set noarabic
<
which resets everything that the command had enabled without touching
the global settings as they could affect other possible open buffers.
In short the 'noarabic' command,
1. resets to the alternate keymap
2. disables the deletion of a single combined pair character
3. disables rightleft mode
NOTE: the 'arabic' command takes into consideration 'termbidi' for
possible external bi-directional (bidi) support from the
terminal ("mlterm" for instance offers such support).
'termbidi', if available, is superior to rightleft support
and its support is preferred due to its level of offerings.
'arabic' when 'termbidi' is enabled only sets the keymap.
If, on the other hand, you'd like to be verbose and explicit and
are opting not to use the 'arabic' short-cut command, here's what
is needed (ie. if you use ':set arabic' you can skip this section) -
+ Arabic Keymapping Activation
To activate the Arabic keymap (ie. to remap your english/latin
keyboard to look-n-feel like a standard Arabic one), set the
'keymap' command to "arabic". This is done by entering
>
:set keymap=arabic
<
in your VIM window. You can also append the 'keymap' set command to
your .vimrc file. In other words, you can include ':set keymap=arabic'
to your .vimrc file.
To turn toggle (or switch) your keymapping between Arabic and the
default mapping (english), its advised that users use the 'CTRL-^'
key press while in insert (or add/replace) mode. The command-line
will display your current mapping by displaying an "Arabic" string
next to your insertion mode (eg. -- INSERT Arabic --) indicating
your current keymap.
+ Arabic deletion of a combined pair character
By default VIM has the 'delcombine' option disabled. This option
allows the deletion of ALEF in a LAM_ALEF (LAA) combined character
and still retain the LAM (ie. it reverts to treating the combined
character as its natural two characters form -- this also pertains
to harakat and their combined forms). You can enable this option
by entering
>
:set delcombine
<
in our VIM window. You can also append the 'delcombine' set command
to your .vimrc file. In other words, you can include ':set delcombine'
to your .vimrc file.
+ Arabic right-to-left Mode
By default VIM starts in Left-to-right mode. 'rightleft' is the
command that allows one to alter a window's orientation - that can
be accomplished via,
- Toggling between left-to-right and right-to-left modes is
accomplished through ':set rightleft' and ':set norightleft'.
- While in Left-to-right mode, enter ':set rl' in the command line
('rl' is the abbreviation for rightleft).
- Put the ':set rl' line in your '.vimrc' file to start the VIM in
right-to-left mode permanently.
+ Arabic right-to-left command-line Mode
For certain commands the editing can be done in right-to-left mode.
Currently this is only applicable to search commands.
This is controlled with the 'rightleftcmd' option. The default is
"search", which means that windows in which 'rightleft' is set will
edit search commands in right-left mode. To disable this behavior,
>
:set rightleftcmd=
<
To enable right-left editing of search commands again,
>
:set rightleftcmd&
<
+ Arabic Shaping Mode
To activate the required visual characters alterations (shaping,
composing, combining) which the Arabic language requires, enable
the 'arabicshape' command. This is done by entering
>
:set arabicshape
<
in our VIM window. You can also append the 'arabicshape' set
command to your .vimrc file. In other words, you can include
':set arabicshape' to your .vimrc file.
Keymap/Keyboard *arabickeymap*
---------------
The character/letter encoding used in VIM is the standard UTF-8.
It is widely discouraged that any other encoding be used or even
attempted.
Note: UTF-8 is an all encompassing encoding and as such is
the only supported (and encouraged) encoding with
regard to Arabic (all other proprietary encodings
should be discouraged and frowned upon).
o Keyboard
+ CTRL-^ in insert/replace mode toggles between Arabic/Latin mode
+ Keyboard mapping is based on the Microsoft's Arabic keymap (the
defacto standard in the Arab world):
+---------------------------------------------------------------------+
|! |@ |# |$ |% |^ |& |* |( |) |_ |+ || |~ ّ |
|1 ١ |2 ٢ |3 ٣ |4 ٤ |5 ٥ |6 ٦ |7 ٧ |8 ٨ |9 ٩ |0 ٠ |- |= |\ |` ذ |
+---------------------------------------------------------------------+
|Q َ |W ً |E ُ |R ٌ |T لإ |Y إ |U ` |I ÷ |O x |P ؛ |{ < |} > |
|q ض |w ص |e ث |r ق |t ف |y غ |u ع |i ه |o خ |p ح |[ ج |] د |
+-----------------------------------------------------------+
|A ِ |S ٍ |D [ |F ] |G لأ |H أ |J ـ |K ، |L / |: |" |
|a ش |s س |d ي |f ب |g ل |h ا |j ت |k ن |l م |; ك |' ط |
+------------------------------------------------------+
|Z ~ |X ْ |C { |V } |B لآ |N آ |M ' |< , |> . |? ؟ |
|z ئ |x ء |c ؤ |v ر |b لا |n ى |m ة |, و |. ز |/ ظ |
+-------------------------------------------------+
Restrictions
------------
o VIM in its GUI form does not currently support Bi-directionality
(ie. the ability to see both Arabic and Latin intermixed within
the same line).
Known Bugs
----------
There is one known minor bug,
1. If you insert a haraka (eg. Fatha (U+064E)) after a LAM (U+0644)
and then insert an ALEF (U+0627), the appropriate combining will
not happen due to the sandwiched haraka resulting in something
that will NOT be displayed correctly.
WORK-AROUND: Don't include harakats between LAM and ALEF combos.
In general, don't anticipate to see correct visual
representation with regard to harakats and LAM+ALEF
combined characters (even those entered after both
characters). The problem noted is strictly a visual
one, meaning saving such a file will contain all the
appropriate info/encodings - nothing is lost.
No other bugs are known to exist.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,904 @@
*autocmd.txt* For Vim version 6.3. Last change: 2004 Apr 20
VIM REFERENCE MANUAL by Bram Moolenaar
Automatic commands *autocommand*
For a basic explanation, see section |40.3| in the user manual.
1. Introduction |autocmd-intro|
2. Defining autocommands |autocmd-define|
3. Removing autocommands |autocmd-remove|
4. Listing autocommands |autocmd-list|
5. Events |autocmd-events|
6. Patterns |autocmd-patterns|
7. Groups |autocmd-groups|
8. Executing autocommands |autocmd-execute|
9. Using autocommands |autocmd-use|
{Vi does not have any of these commands}
{only when the |+autocmd| feature has not been disabled at compile time}
==============================================================================
1. Introduction *autocmd-intro*
You can specify commands to be executed automatically for when reading or
writing a file, when entering or leaving a buffer or window, and when exiting
Vim. For example, you can create an autocommand to set the 'cindent' option
for files matching *.c. You can also use autocommands to implement advanced
features, such as editing compressed files (see |gzip-example|). The usual
place to put autocommands is in your .vimrc or .exrc file.
*E203* *E204* *E143*
WARNING: Using autocommands is very powerful, and may lead to unexpected side
effects. Be careful not to destroy your text.
- It's a good idea to do some testing on an expendable copy of a file first.
For example: If you use autocommands to decompress a file when starting to
edit it, make sure that the autocommands for compressing when writing work
correctly.
- Be prepared for an error halfway through (e.g., disk full). Vim will mostly
be able to undo the changes to the buffer, but you may have to clean up the
changes to other files by hand (e.g., compress a file that has been
decompressed).
- If the BufRead* events allow you to edit a compressed file, the FileRead*
events should do the same (this makes recovery possible in some rare cases).
It's a good idea to use the same autocommands for the File* and Buf* events
when possible.
==============================================================================
2. Defining autocommands *autocmd-define*
Note: The ":autocmd" command cannot be followed by another command, since any
'|' is considered part of the command.
*:au* *:autocmd*
:au[tocmd] [group] {event} {pat} [nested] {cmd}
Add {cmd} to the list of commands that Vim will
execute automatically on {event} for a file matching
{pat}. Vim always adds the {cmd} after existing
autocommands, so that the autocommands execute in the
order in which they were given. See |autocmd-nested|
for [nested].
Note that special characters (e.g., "%", "<cword>") in the ":autocmd"
arguments are not expanded when the autocommand is defined. These will be
expanded when the Event is recognized, and the {cmd} is executed. The only
exception is that "<sfile>" is expanded when the autocmd is defined. Example:
>
:au BufNewFile,BufRead *.html so <sfile>:h/html.vim
Here Vim expands <sfile> to the name of the file containing this line.
When your .vimrc file is sourced twice, the autocommands will appear twice.
To avoid this, put this command in your .vimrc file, before defining
autocommands: >
:autocmd! " Remove ALL autocommands for the current group.
If you don't want to remove all autocommands, you can instead use a variable
to ensure that Vim includes the autocommands only once: >
:if !exists("autocommands_loaded")
: let autocommands_loaded = 1
: au ...
:endif
When the [group] argument is not given, Vim uses the current group (as defined
with ":augroup"); otherwise, Vim uses the group defined with [group]. Note
that [group] must have been defined before. You cannot define a new group
with ":au group ..."; use ":augroup" for that.
While testing autocommands, you might find the 'verbose' option to be useful: >
:set verbose=9
This setting makes Vim echo the autocommands as it executes them.
When defining an autocommand in a script, it will be able to call functions
local to the script and use mappings local to the script. When the event is
triggered and the command executed, it will run in the context of the script
it was defined in. This matters if |<SID>| is used in a command.
When executing the commands, the messages from one command overwrites a
previous message. This is different from when executing the commands
manually. Mostly the screen will not scroll up, thus there is no hit-enter
prompt. When one command outputs two messages this can happen anyway.
==============================================================================
3. Removing autocommands *autocmd-remove*
:au[tocmd]! [group] {event} {pat} [nested] {cmd}
Remove all autocommands associated with {event} and
{pat}, and add the command {cmd}. See
|autocmd-nested| for [nested].
:au[tocmd]! [group] {event} {pat}
Remove all autocommands associated with {event} and
{pat}.
:au[tocmd]! [group] * {pat}
Remove all autocommands associated with {pat} for all
events.
:au[tocmd]! [group] {event}
Remove ALL autocommands for {event}.
:au[tocmd]! [group] Remove ALL autocommands.
When the [group] argument is not given, Vim uses the current group (as defined
with ":augroup"); otherwise, Vim uses the group defined with [group].
==============================================================================
4. Listing autocommands *autocmd-list*
:au[tocmd] [group] {event} {pat}
Show the autocommands associated with {event} and
{pat}.
:au[tocmd] [group] * {pat}
Show the autocommands associated with {pat} for all
events.
:au[tocmd] [group] {event}
Show all autocommands for {event}.
:au[tocmd] [group] Show all autocommands.
If you provide the [group] argument, Vim lists only the autocommands for
[group]; otherwise, Vim lists the autocommands for ALL groups. Note that this
argument behavior differs from that for defining and removing autocommands.
==============================================================================
5. Events *autocmd-events* *E215* *E216*
*autocommand-events* *{event}*
Vim recognizes the following events. Vim ignores the case of event names
(e.g., you can use "BUFread" or "bufread" instead of "BufRead").
*BufNewFile*
BufNewFile When starting to edit a file that doesn't
exist. Can be used to read in a skeleton
file.
*BufReadPre* *E200* *E201*
BufReadPre When starting to edit a new buffer, before
reading the file into the buffer. Not used
if the file doesn't exist.
*BufRead* *BufReadPost*
BufRead or BufReadPost When starting to edit a new buffer, after
reading the file into the buffer, before
executing the modelines. See |BufWinEnter|
for when you need to do something after
processing the modelines.
This does NOT work for ":r file". Not used
when the file doesn't exist. Also used after
successfully recovering a file.
*BufReadCmd*
BufReadCmd Before starting to edit a new buffer. Should
read the file into the buffer. |Cmd-event|
*BufFilePre*
BufFilePre Before changing the name of the current buffer
with the ":file" or ":saveas" command.
*BufFilePost*
BufFilePost After changing the name of the current buffer
with the ":file" or ":saveas" command.
*FileReadPre*
FileReadPre Before reading a file with a ":read" command.
*FileReadPost*
FileReadPost After reading a file with a ":read" command.
Note that Vim sets the '[ and '] marks to the
first and last line of the read. This can be
used to operate on the lines just read.
*FileReadCmd*
FileReadCmd Before reading a file with a ":read" command.
Should do the reading of the file. |Cmd-event|
*FilterReadPre* *E135*
FilterReadPre Before reading a file from a filter command.
Vim checks the pattern against the name of
the current buffer, not the name of the
temporary file that is the output of the
filter command.
*FilterReadPost*
FilterReadPost After reading a file from a filter command.
Vim checks the pattern against the name of
the current buffer as with FilterReadPre.
*FileType*
FileType When the 'filetype' option has been set.
<afile> can be used for the name of the file
where this option was set, and <amatch> for
the new value of 'filetype'.
See |filetypes|.
*Syntax*
Syntax When the 'syntax' option has been set.
<afile> can be used for the name of the file
where this option was set, and <amatch> for
the new value of 'syntax'.
See |:syn-on|.
*StdinReadPre*
StdinReadPre Before reading from stdin into the buffer.
Only used when the "-" argument was used when
Vim was started |--|.
*StdinReadPost*
StdinReadPost After reading from the stdin into the buffer,
before executing the modelines. Only used
when the "-" argument was used when Vim was
started |--|.
*BufWrite* *BufWritePre*
BufWrite or BufWritePre Before writing the whole buffer to a file.
*BufWritePost*
BufWritePost After writing the whole buffer to a file
(should undo the commands for BufWritePre).
*BufWriteCmd*
BufWriteCmd Before writing the whole buffer to a file.
Should do the writing of the file and reset
'modified' if successful. The buffer contents
should not be changed. |Cmd-event|
*FileWritePre*
FileWritePre Before writing to a file, when not writing the
whole buffer.
*FileWritePost*
FileWritePost After writing to a file, when not writing the
whole buffer.
*FileWriteCmd*
FileWriteCmd Before writing to a file, when not writing the
whole buffer. Should do the writing to the
file. Should not change the buffer.
|Cmd-event|
*FileAppendPre*
FileAppendPre Before appending to a file.
*FileAppendPost*
FileAppendPost After appending to a file.
*FileAppendCmd*
FileAppendCmd Before appending to a file. Should do the
appending to the file. |Cmd-event|
*FilterWritePre*
FilterWritePre Before writing a file for a filter command or
making a diff.
Vim checks the pattern against the name of
the current buffer, not the name of the
temporary file that is the output of the
filter command.
*FilterWritePost*
FilterWritePost After writing a file for a filter command or
making a diff.
Vim checks the pattern against the name of
the current buffer as with FilterWritePre.
*FileChangedShell*
FileChangedShell When Vim notices that the modification time of
a file has changed since editing started.
Also when the file attributes of the file
change. |timestamp|
Mostly triggered after executing a shell
command, but also with a |:checktime| command
or when Vim regains input focus.
This autocommand is triggered for each changed
file. It is not used when 'autoread' is set
and the buffer was not changed. If a
FileChangedShell autocommand is present the
warning message and prompt is not given.
This is useful for reloading related buffers
which are affected by a single command.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer that was changed "<afile>".
NOTE: The commands must not change the current
buffer, jump to another buffer or delete a
buffer. *E246*
NOTE: This event never nests, to avoid an
endless loop. This means that while executing
commands for the FileChangedShell event no
other FileChangedShell event will be
triggered.
*FileChangedRO*
FileChangedRO Before making the first change to a read-only
file. Can be used to check-out the file from
a source control system. Not triggered when
the change was caused by an autocommand.
WARNING: This event is triggered when making a
change, just before the change is applied to
the text. If the autocommand moves the cursor
the effect of the change is undefined.
*FocusGained*
FocusGained When Vim got input focus. Only for the GUI
version and a few console versions where this
can be detected.
*FocusLost*
FocusLost When Vim lost input focus. Only for the GUI
version and a few console versions where this
can be detected.
*FuncUndefined*
FuncUndefined When a user function is used but it isn't
defined. Useful for defining a function only
when it's used. Both <amatch> and <afile> are
set to the name of the function.
*CursorHold*
CursorHold When the user doesn't press a key for the time
specified with 'updatetime'. Not re-triggered
until the user has pressed a key (i.e. doesn't
fire every 'updatetime' ms if you leave Vim to
make some coffee. :) See |CursorHold-example|
for previewing tags.
This event is only triggered in Normal mode.
Note: Interactive commands cannot be used for
this event. There is no hit-enter prompt,
the screen is updated directly (when needed).
Note: In the future there will probably be
another option to set the time.
Hint: to force an update of the status lines
use: >
:let &ro = &ro
< {only on Amiga, Unix, Win32, MSDOS and all GUI
versions}
*BufEnter*
BufEnter After entering a buffer. Useful for setting
options for a file type. Also executed when
starting to edit a buffer, after the
BufReadPost autocommands.
*BufLeave*
BufLeave Before leaving to another buffer. Also when
leaving or closing the current window and the
new current window is not for the same buffer.
Not used for ":qa" or ":q" when exiting Vim.
*BufWinEnter*
BufWinEnter After a buffer is displayed in a window. This
can be when the buffer is loaded (after
processing the modelines), when a hidden
buffer is displayed in a window (and is no
longer hidden) or a buffer already visible in
a window is also displayed in another window.
*BufWinLeave*
BufWinLeave Before a buffer is removed from a window.
Not when it's still visible in another window.
Also triggered when exiting. It's triggered
before BufUnload or BufHidden.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being unloaded "<afile>".
*BufUnload*
BufUnload Before unloading a buffer. This is when the
text in the buffer is going to be freed. This
may be after a BufWritePost and before a
BufDelete. Also used for all buffers that are
loaded when Vim is going to exit.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being unloaded "<afile>".
*BufHidden*
BufHidden Just after a buffer has become hidden. That
is, when there are no longer windows that show
the buffer, but the buffer is not unloaded or
deleted. Not used for ":qa" or ":q" when
exiting Vim.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being unloaded "<afile>".
*BufNew*
BufNew Just after creating a new buffer. Also used
just after a buffer has been renamed. When
the buffer is added to the buffer list BufAdd
will be triggered too.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being created "<afile>".
*BufCreate* *BufAdd*
BufAdd or BufCreate Just after creating a new buffer which is
added to the buffer list, or adding a buffer
to the buffer list.
Also used just after a buffer in the buffer
list has been renamed.
The BufCreate event is for historic reasons.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being created "<afile>".
*BufDelete*
BufDelete Before deleting a buffer from the buffer list.
The BufUnload may be called first (if the
buffer was loaded).
Also used just before a buffer in the buffer
list is renamed.
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being deleted "<afile>".
*BufWipeout*
BufWipeout Before completely deleting a buffer. The
BufUnload and BufDelete events may be called
first (if the buffer was loaded and was in the
buffer list). Also used just before a buffer
is renamed (also when it's not in the buffer
list).
NOTE: When this autocommand is executed, the
current buffer "%" may be different from the
buffer being deleted "<afile>".
*WinEnter*
WinEnter After entering another window. Not done for
the first window, when Vim has just started.
Useful for setting the window height.
If the window is for another buffer, Vim
executes the BufEnter autocommands after the
WinEnter autocommands.
Note: When using ":split fname" the WinEnter
event is triggered after the split but before
the file "fname" is loaded.
*WinLeave*
WinLeave Before leaving a window. If the window to be
entered next is for a different buffer, Vim
executes the BufLeave autocommands before the
WinLeave autocommands (but not for ":new").
Not used for ":qa" or ":q" when exiting Vim.
*CmdwinEnter*
CmdwinEnter After entering the command-line window.
Useful for setting options specifically for
this special type of window. This is
triggered _instead_ of BufEnter and WinEnter.
<afile> is set to a single character,
indicating the type of command-line.
|cmdwin-char|
*CmdwinLeave*
CmdwinLeave Before leaving the command-line window.
Useful to clean up any global setting done
with CmdwinEnter. This is triggered _instead_
of BufLeave and WinLeave.
<afile> is set to a single character,
indicating the type of command-line.
|cmdwin-char|
*GUIEnter*
GUIEnter After starting the GUI successfully, and after
opening the window. It is triggered before
VimEnter when using gvim. Can be used to
position the window from a .gvimrc file: >
:autocmd GUIEnter * winpos 100 50
< *VimEnter*
VimEnter After doing all the startup stuff, including
loading .vimrc files, executing the "-c cmd"
arguments, creating all windows and loading
the buffers in them.
*VimLeavePre*
VimLeavePre Before exiting Vim, just before writing the
.viminfo file. This is executed only once,
if there is a match with the name of what
happens to be the current buffer when exiting.
Mostly useful with a "*" pattern. >
:autocmd VimLeavePre * call CleanupStuff()
< To detect an abnormal exit use |v:dying|.
*VimLeave*
VimLeave Before exiting Vim, just after writing the
.viminfo file. Executed only once, like
VimLeavePre.
To detect an abnormal exit use |v:dying|.
*EncodingChanged*
EncodingChanged Fires off when the 'encoding' option is
changed. Useful to set up fonts, for example.
*FileEncoding*
FileEncoding Obsolete. It still works and is equivalent
to |EncodingChanged|.
*RemoteReply*
RemoteReply When a reply from a Vim that functions as
server was received |server2client()|.
<amatch> is equal to the {serverid} from which
the reply was sent, and <afile> is the actual
reply string.
Note that even if an autocommand is defined,
the reply should be read with |remote_read()|
to consume it.
*TermChanged*
TermChanged After the value of 'term' has changed. Useful
for re-loading the syntax file to update the
colors, fonts and other terminal-dependent
settings. Executed for all loaded buffers.
*TermResponse*
TermResponse After the response to |t_RV| is received from
the terminal. The value of |v:termresponse|
can be used to do things depending on the
terminal version.
*UserGettingBored*
UserGettingBored When the user hits CTRL-C. Just kidding! :-)
*User*
User Never executed automatically. To be used for
autocommands that are only executed with
":doautocmd".
You can specify a comma-separated list of event names. No white space can be
used in this list. The command applies to all the events in the list.
For READING FILES there are four kinds of events possible:
BufNewFile starting to edit a non-existent file
BufReadPre BufReadPost starting to edit an existing file
FilterReadPre FilterReadPost read the temp file with filter output
FileReadPre FileReadPost any other file read
Vim uses only one of these four kinds when reading a file. The "Pre" and
"Post" events are both triggered, before and after reading the file.
Note that the autocommands for the *ReadPre events and all the Filter events
are not allowed to change the current buffer (you will get an error message if
this happens). This is to prevent the file to be read into the wrong buffer.
Note that the 'modified' flag is reset AFTER executing the BufReadPost
and BufNewFile autocommands. But when the 'modified' option was set by the
autocommands, this doesn't happen.
You can use the 'eventignore' option to ignore a number of events or all
events.
==============================================================================
6. Patterns *autocmd-patterns* *{pat}*
The file pattern {pat} is tested for a match against the file name in one of
two ways:
1. When there is no '/' in the pattern, Vim checks for a match against only
the tail part of the file name (without its leading directory path).
2. When there is a '/' in the pattern, Vim checks for a match against the
both short file name (as you typed it) and the full file name (after
expanding it to a full path and resolving symbolic links).
Examples: >
:autocmd BufRead *.txt set et
Set the 'et' option for all text files. >
:autocmd BufRead /vim/src/*.c set cindent
Set the 'cindent' option for C files in the /vim/src directory. >
:autocmd BufRead /tmp/*.c set ts=5
If you have a link from "/tmp/test.c" to "/home/nobody/vim/src/test.c", and
you start editing "/tmp/test.c", this autocommand will match.
Note: To match part of a path, but not from the root directory, use a '*' as
the first character. Example: >
:autocmd BufRead */doc/*.txt set tw=78
This autocommand will for example be executed for "/tmp/doc/xx.txt" and
"/usr/home/piet/doc/yy.txt". The number of directories does not matter here.
The file name that the pattern is matched against is after expanding
wildcards. Thus is you issue this command: >
:e $ROOTDIR/main.$EXT
The argument is first expanded to: >
/usr/root/main.py
Before it's matched with the pattern of the autocommand. Careful with this
when using events like FileReadCmd, the value of <amatch> may not be what you
expect.
Environment variables can be used in a pattern: >
:autocmd BufRead $VIMRUNTIME/doc/*.txt set expandtab
And ~ can be used for the home directory (if $HOME is defined): >
:autocmd BufWritePost ~/.vimrc so ~/.vimrc
:autocmd BufRead ~archive/* set readonly
The environment variable is expanded when the autocommand is defined, not when
the autocommand is executed. This is different from the command!
*file-pattern*
The pattern is interpreted like mostly used in file names:
* matches any sequence of characters
? matches any single character
\? matches a '?'
. matches a '.'
~ matches a '~'
, separates patterns
\, matches a ','
{ } like \( \) in a |pattern|
, inside { }: like \| in a |pattern|
\ special meaning like in a |pattern|
[ch] matches 'c' or 'h'
[^ch] match any character but 'c' and 'h'
Note that for all systems the '/' character is used for path separator (even
MS-DOS and OS/2). This was done because the backslash is difficult to use
in a pattern and to make the autocommands portable across different systems.
Matching with the pattern is done when an event is triggered. Changing the
buffer name in one of the autocommands, or even deleting the buffer, does not
change which autocommands will be executed. Example: >
au BufEnter *.foo bdel
au BufEnter *.foo set modified
This will delete the current buffer and then set 'modified' in what has become
the current buffer instead. Vim doesn't take into account that "*.foo"
doesn't match with that buffer name. It matches "*.foo" with the name of the
buffer at the moment the event was triggered.
==============================================================================
7. Groups *autocmd-groups*
Autocommands can be put together in a group. This is useful for removing or
executing a group of autocommands. For example, all the autocommands for
syntax highlighting are put in the "highlight" group, to be able to execute
":doautoall highlight BufRead" when the GUI starts.
When no specific group is selected, Vim uses the default group. The default
group does not have a name. You cannot execute the autocommands from the
default group separately; you can execute them only by executing autocommands
for all groups.
Normally, when executing autocommands automatically, Vim uses the autocommands
for all groups. The group only matters when executing autocommands with
":doautocmd" or ":doautoall", or when defining or deleting autocommands.
The group name can contain any characters except white space. The group name
"end" is reserved (also in uppercase).
The group name is case sensitive. Note that this is different from the event
name!
*:aug* *:augroup*
:aug[roup] {name} Define the autocmd group name for the
following ":autocmd" commands. The name "end"
or "END" selects the default group.
*:augroup-delete* *E367*
:aug[roup]! {name} Delete the autocmd group {name}. Don't use
this if there is still an autocommand using
this group! This is not checked.
To enter autocommands for a specific group, use this method:
1. Select the group with ":augroup {name}".
2. Delete any old autocommands with ":au!".
3. Define the autocommands.
4. Go back to the default group with "augroup END".
Example: >
:augroup uncompress
: au!
: au BufEnter *.gz %!gunzip
:augroup END
This prevents having the autocommands defined twice (e.g., after sourcing the
.vimrc file again).
==============================================================================
8. Executing autocommands *autocmd-execute*
Vim can also execute Autocommands non-automatically. This is useful if you
have changed autocommands, or when Vim has executed the wrong autocommands
(e.g., the file pattern match was wrong).
Note that the 'eventignore' option applies here too. Events listed in this
option will not cause any commands to be executed.
*:do* *:doau* *:doautocmd* *E217*
:do[autocmd] [group] {event} [fname]
Apply the autocommands matching [fname] (default:
current file name) for {event} to the current buffer.
You can use this when the current file name does not
match the right pattern, after changing settings, or
to execute autocommands for a certain event.
It's possible to use this inside an autocommand too,
so you can base the autocommands for one extension on
another extension. Example: >
:au Bufenter *.cpp so ~/.vimrc_cpp
:au Bufenter *.cpp doau BufEnter x.c
< Be careful to avoid endless loops. See
|autocmd-nested|.
When the [group] argument is not given, Vim executes
the autocommands for all groups. When the [group]
argument is included, Vim executes only the matching
autocommands for that group. Note: if you use an
undefined group name, Vim gives you an error message.
*:doautoa* *:doautoall*
:doautoa[ll] [group] {event} [fname]
Like ":doautocmd", but apply the autocommands to each
loaded buffer. Note that {fname} is used to select
the autocommands, not the buffers to which they are
applied.
Careful: Don't use this for autocommands that delete a
buffer, change to another buffer or change the
contents of a buffer; the result is unpredictable.
This command is intended for autocommands that set
options, change highlighting, and things like that.
==============================================================================
9. Using autocommands *autocmd-use*
For WRITING FILES there are four possible sets of events. Vim uses only one
of these sets for a write command:
BufWriteCmd BufWritePre BufWritePost writing the whole buffer
FilterWritePre FilterWritePost writing to filter temp file
FileAppendCmd FileAppendPre FileAppendPost appending to a file
FileWriteCmd FileWritePre FileWritePost any other file write
When there is a matching "*Cmd" autocommand, it is assumed it will do the
writing. No further writing is done and the other events are not triggered.
|Cmd-event|
Note that the *WritePost commands should undo any changes to the buffer that
were caused by the *WritePre commands; otherwise, writing the file will have
the side effect of changing the buffer.
Before executing the autocommands, the buffer from which the lines are to be
written temporarily becomes the current buffer. Unless the autocommands
change the current buffer or delete the previously current buffer, the
previously current buffer is made the current buffer again.
The *WritePre and *AppendPre autocommands must not delete the buffer from
which the lines are to be written.
The '[ and '] marks have a special position:
- Before the *ReadPre event the '[ mark is set to the line just above where
the new lines will be inserted.
- Before the *ReadPost event the '[ mark is set to the first line that was
just read, the '] mark to the last line.
- Before executing the *WritePre and *AppendPre autocommands the '[ mark is
set to the first line that will be written, the '] mark to the last line.
Careful: '[ and '] change when using commands that change the buffer.
In commands which expect a file name, you can use "<afile>" for the file name
that is being read |:<afile>| (you can also use "%" for the current file
name). "<abuf>" can be used for the buffer number of the currently effective
buffer. This also works for buffers that doesn't have a name. But it doesn't
work for files without a buffer (e.g., with ":r file").
*gzip-example*
Examples for reading and writing compressed files: >
:augroup gzip
: autocmd!
: autocmd BufReadPre,FileReadPre *.gz set bin
: autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip
: autocmd BufReadPost,FileReadPost *.gz set nobin
: autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r")
: autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r
: autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r
: autocmd FileAppendPre *.gz !gunzip <afile>
: autocmd FileAppendPre *.gz !mv <afile>:r <afile>
: autocmd FileAppendPost *.gz !mv <afile> <afile>:r
: autocmd FileAppendPost *.gz !gzip <afile>:r
:augroup END
The "gzip" group is used to be able to delete any existing autocommands with
":autocmd!", for when the file is sourced twice.
("<afile>:r" is the file name without the extension, see |:_%:|)
The commands executed for the BufNewFile, BufRead/BufReadPost, BufWritePost,
FileAppendPost and VimLeave events do not set or reset the changed flag of the
buffer. When you decompress the buffer with the BufReadPost autocommands, you
can still exit with ":q". When you use ":undo" in BufWritePost to undo the
changes made by BufWritePre commands, you can still do ":q" (this also makes
"ZZ" work). If you do want the buffer to be marked as modified, set the
'modified' option.
To execute Normal mode commands from an autocommand, use the ":normal"
command. Use with care! If the Normal mode command is not finished, the user
needs to type characters (e.g., after ":normal m" you need to type a mark
name).
If you want the buffer to be unmodified after changing it, reset the
'modified' option. This makes it possible to exit the buffer with ":q"
instead of ":q!".
*autocmd-nested* *E218*
By default, autocommands do not nest. If you use ":e" or ":w" in an
autocommand, Vim does not execute the BufRead and BufWrite autocommands for
those commands. If you do want this, use the "nested" flag for those commands
in which you want nesting. For example: >
:autocmd FileChangedShell *.c nested e!
The nesting is limited to 10 levels to get out of recursive loops.
It's possible to use the ":au" command in an autocommand. This can be a
self-modifying command! This can be useful for an autocommand that should
execute only once.
There is currently no way to disable the autocommands. If you want to write a
file without executing the autocommands for that type of file, write it under
another name and rename it with a shell command. In some situations you can
use the 'eventignore' option.
Note: When reading a file (with ":read file" or with a filter command) and the
last line in the file does not have an <EOL>, Vim remembers this. At the next
write (with ":write file" or with a filter command), if the same line is
written again as the last line in a file AND 'binary' is set, Vim does not
supply an <EOL>. This makes a filter command on the just read lines write the
same file as was read, and makes a write command on just filtered lines write
the same file as was read from the filter. For example, another way to write
a compressed file: >
:autocmd FileWritePre *.gz set bin|'[,']!gzip
:autocmd FileWritePost *.gz undo|set nobin
<
*autocommand-pattern*
You can specify multiple patterns, separated by commas. Here are some
examples: >
:autocmd BufRead * set tw=79 nocin ic infercase fo=2croq
:autocmd BufRead .letter set tw=72 fo=2tcrq
:autocmd BufEnter .letter set dict=/usr/lib/dict/words
:autocmd BufLeave .letter set dict=
:autocmd BufRead,BufNewFile *.c,*.h set tw=0 cin noic
:autocmd BufEnter *.c,*.h abbr FOR for (i = 0; i < 3; ++i)<CR>{<CR>}<Esc>O
:autocmd BufLeave *.c,*.h unabbr FOR
For makefiles (makefile, Makefile, imakefile, makefile.unix, etc.): >
:autocmd BufEnter ?akefile* set include=^s\=include
:autocmd BufLeave ?akefile* set include&
To always start editing C files at the first function: >
:autocmd BufRead *.c,*.h 1;/^{
Without the "1;" above, the search would start from wherever the file was
entered, rather than from the start of the file.
*skeleton* *template*
To read a skeleton (template) file when opening a new file: >
:autocmd BufNewFile *.c 0r ~/vim/skeleton.c
:autocmd BufNewFile *.h 0r ~/vim/skeleton.h
:autocmd BufNewFile *.java 0r ~/vim/skeleton.java
To insert the current date and time in a *.html file when writing it: >
:autocmd BufWritePre,FileWritePre *.html ks|call LastMod()|'s
:fun LastMod()
: if line("$") > 20
: let l = 20
: else
: let l = line("$")
: endif
: exe "1," . l . "g/Last modified: /s/Last modified: .*/Last modified: " .
: \ strftime("%Y %b %d")
:endfun
You need to have a line "Last modified: <date time>" in the first 20 lines
of the file for this to work. Vim replaces <date time> (and anything in the
same line after it) with the current date and time. Explanation:
ks mark current position with mark 's'
call LastMod() call the LastMod() function to do the work
's return the cursor to the old position
The LastMod() function checks if the file is shorter than 20 lines, and then
uses the ":g" command to find lines that contain "Last modified: ". For those
lines the ":s" command is executed to replace the existing date with the
current one. The ":execute" command is used to be able to use an expression
for the ":g" and ":s" commands. The date is obtained with the strftime()
function. You can change its argument to get another date string.
When entering :autocmd on the command-line, completion of events and command
names may be done (with <Tab>, CTRL-D, etc.) where appropriate.
Vim executes all matching autocommands in the order that you specify them.
It is recommended that your first autocommand be used for all files by using
"*" as the file pattern. This means that you can define defaults you like
here for any settings, and if there is another matching autocommand it will
override these. But if there is no other matching autocommand, then at least
your default settings are recovered (if entering this file from another for
which autocommands did match). Note that "*" will also match files starting
with ".", unlike Unix shells.
*autocmd-searchpat*
Autocommands do not change the current search patterns. Vim saves the current
search patterns before executing autocommands then restores them after the
autocommands finish. This means that autocommands do not affect the strings
highlighted with the 'hlsearch' option. Within autocommands, you can still
use search patterns normally, e.g., with the "n" command.
If you want an autocommand to set the search pattern, such that it is used
after the autocommand finishes, use the ":let @/ =" command.
The search-highlighting cannot be switched off with ":nohlsearch" in an
autocommand. Use the 'h' flag in the 'viminfo' option to disable search-
highlighting when starting Vim.
*Cmd-event*
When using one of the "*Cmd" events, the matching autocommands are expected to
do the file reading or writing. This can be used when working with a special
kind of file, for example on a remote system.
CAREFUL: If you use these events in a wrong way, it may have the effect of
making it impossible to read or write the matching files! Make sure you test
your autocommands properly. Best is to use a pattern that will never match a
normal file name, for example "ftp://*".
When defining a BufReadCmd it will be difficult for Vim to recover a crashed
editing session. When recovering from the original file, Vim reads only those
parts of a file that are not found in the swap file. Since that is not
possible with a BufReadCmd, use the |:preserve| command to make sure the
original file isn't needed for recovery. You might want to do this only when
you expect the file to be modified.
The |v:cmdarg| variable holds the "++enc=" and "++ff=" argument that are
effective. These should be used for the command that reads/writes the file.
The |v:cmdbang| variable is one when "!" was used, zero otherwise.
See the $VIMRUNTIME/plugin/netrw.vim for examples.
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,992 @@
*cmdline.txt* For Vim version 6.3. Last change: 2004 Mar 31
VIM REFERENCE MANUAL by Bram Moolenaar
*Cmdline-mode* *Command-line-mode*
Command-line mode *Cmdline* *Command-line* *mode-cmdline* *:*
Command-line mode is used to enter Ex commands (":"), search patterns
("/" and "?"), and filter commands ("!").
Basic command line editing is explained in chapter 20 of the user manual
|usr_20.txt|.
1. Command-line editing |cmdline-editing|
2. Command-line completion |cmdline-completion|
3. Ex command-lines |cmdline-lines|
4. Ex command-line ranges |cmdline-ranges|
5. Ex special characters |cmdline-special|
6. Command-line window |cmdline-window|
==============================================================================
1. Command-line editing *cmdline-editing*
Normally characters are inserted in front of the cursor position. You can
move around in the command-line with the left and right cursor keys. With the
<Insert> key, you can toggle between inserting and overstriking characters.
{Vi: can only alter the last character in the line}
Note that if your keyboard does not have working cursor keys or any of the
other special keys, you can use ":cnoremap" to define another key for them.
For example, to define tcsh style editing keys: *tcsh-style* >
:cnoremap <C-A> <Home>
:cnoremap <C-F> <Right>
:cnoremap <C-B> <Left>
:cnoremap <Esc>b <S-Left>
:cnoremap <Esc>f <S-Right>
(<> notation |<>|; type all this literally)
*cmdline-too-long*
When the command line is getting longer than what fits on the screen, only the
part that fits will be shown. The cursor can only move in this visible part,
thus you cannot edit beyond that.
*cmdline-history* *history*
The command-lines that you enter are remembered in a history table. You can
recall them with the up and down cursor keys. There are actually four
history tables:
- one for ':' commands
- one for search strings
- one for expressions
- one for input lines, typed for the |input()| function.
These are completely separate. Each history can only be accessed when
entering the same type of line.
Use the 'history' option to set the number of lines that are remembered
(default: 20).
Notes:
- When you enter a command-line that is exactly the same as an older one, the
old one is removed (to avoid repeated commands moving older commands out of
the history).
- Only commands that are typed are remembered. Ones that completely come from
mappings are not put in the history
- All searches are put in the search history, including the ones that come
from commands like "*" and "#". But for a mapping, only the last search is
remembered (to avoid that long mappings trash the history).
{Vi: no history}
{not available when compiled without the |+cmdline_hist| feature}
There is an automatic completion of names on the command-line; see
|cmdline-completion|.
*c_CTRL-V*
CTRL-V Insert next non-digit literally. Up to three digits form the
decimal value of a single byte. The non-digit and the three
digits are not considered for mapping. This works the same
way as in Insert mode (see above, |i_CTRL-V|).
Note: Under Windows CTRL-V is often mapped to paste text.
Use CTRL-Q instead then.
*c_CTRL-Q*
CTRL-Q Same as CTRL-V. But with some terminals it is used for
control flow, it doesn't work then.
*c_<Left>*
<Left> cursor left
*c_<Right>*
<Right> cursor right
*c_<S-Left>*
<S-Left> or <C-Left> *c_<C-Left>*
cursor one WORD left
*c_<S-Right>*
<S-Right> or <C-Right> *c_<C-Right>*
cursor one WORD right
CTRL-B or <Home> *c_CTRL-B* *c_<Home>*
cursor to beginning of command-line
CTRL-E or <End> *c_CTRL-E* *c_<End>*
cursor to end of command-line
*c_<LeftMouse>*
<LeftMouse> cursor to position of mouse click.
CTRL-H *c_<BS>* *c_CTRL-H*
<BS> delete the character in front of the cursor (see |:fixdel| if
your <BS> key does not do what you want).
*c_<Del>*
<Del> delete the character under the cursor (at end of line:
character before the cursor) (see |:fixdel| if your <Del>
key does not do what you want).
*c_CTRL-W*
CTRL-W delete the word before the cursor
*c_CTRL-U*
CTRL-U remove all characters between the cursor position and
the beginning of the line. Previous versions of vim
deleted all characters on the line. If that is the
preferred behavior, add the following to your .vimrc: >
:cnoremap <C-U> <C-E><C-U>
<
Note: if the command-line becomes empty with one of the
delete commands, Command-line mode is quit.
*c_<Insert>*
<Insert> Toggle between insert and overstrike. {not in Vi}
{char1} <BS> {char2} or *c_digraph*
CTRL-K {char1} {char2} *c_CTRL-K*
enter digraph (see |digraphs|). When {char1} is a special
key, the code for that key is inserted in <> form. {not in Vi}
CTRL-R {0-9a-z"%#:-=.} *c_CTRL-R* *c_<C-R>*
Insert the contents of a numbered or named register. Between
typing CTRL-R and the second character '"' will be displayed
to indicate that you are expected to enter the name of a
register.
The text is inserted as if you typed it, but mappings and
abbreviations are not used. Command-line completion through
'wildchar' is not triggered though. And characters that end
the command line are inserted literally (<Esc>, <CR>, <NL>,
<C-C>). A <BS> or CTRL-W could still end the command line
though, and remaining characters will then be interpreted in
another mode, which might not be what you intended.
Special registers:
'"' the unnamed register, containing the text of
the last delete or yank
'%' the current file name
'#' the alternate file name
'*' the clipboard contents (X11: primary selection)
'+' the clipboard contents
'/' the last search pattern
':' the last command-line
'-' the last small (less than a line) delete
'.' the last inserted text
*c_CTRL-R_=*
'=' the expression register: you are prompted to
enter an expression (see |expression|)
See |registers| about registers. {not in Vi}
CTRL-R CTRL-F *c_CTRL-R_CTRL-F* *c_<C-R>_<C-F>*
CTRL-R CTRL-P *c_CTRL-R_CTRL-P* *c_<C-R>_<C-P>*
CTRL-R CTRL-W *c_CTRL-R_CTRL-W* *c_<C-R>_<C-W>*
CTRL-R CTRL-A *c_CTRL-R_CTRL-A* *c_<C-R>_<C-A>*
Insert the object under the cursor:
CTRL-F the Filename under the cursor
CTRL-P the Filename under the cursor, expanded with
'path' as in |gf|
CTRL-W the Word under the cursor
CTRL-A the WORD under the cursor; see |WORD|
{not in Vi}
CTRL-F and CTRL-P: {only when +file_in_path feature is
included}
*c_CTRL-R_CTRL-R* *c_<C-R>_<C-R>*
*c_CTRL-R_CTRL-O* *c_<C-R>_<C-O>*
CTRL-R CTRL-R {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A}
CTRL-R CTRL-O {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A}
Insert register or object under the cursor. Works like
|c_CTRL-R| but inserts the text literally. For example, if
register a contains "xy^Hz" (where ^H is a backspace),
"CTRL-R a" will insert "xz" while "CTRL-R CTRL-R a" will
insert "xy^Hz".
CTRL-\ e {expr} *c_CTRL-\_e*
Evaluate {expr} and replace the whole command line with the
result. You will be prompted for the expression, type <Enter>
to finish it. It's most useful in mappings though. See
|expression|.
See |c_CTRL-R_=| for inserting the result of an expression.
Useful functions are |getcmdline()| and |getcmdpos()|.
The cursor position is unchanged, except when the cursor was
at the end of the line, then it stays at the end.
|setcmdpos()| can be used to set the cursor position.
Example: >
:cmap <F7> <C-\>eAppendSome()<CR>
:func AppendSome()
:let cmd = getcmdline() . " Some()"
:" place the cursor on the )
:call setcmdpos(strlen(cmd))
:return cmd
:endfunc
<
*c_CTRL-Y*
CTRL-Y When there is a modeless selection, copy the selection into
the clipboard. |modeless-selection|
If there is no selection CTRL-Y is inserted as a character.
CTRL-J *c_CTRL-J* *c_<NL>* *c_<CR>*
<CR> or <NL> start entered command
*c_<Esc>*
<Esc> When typed and 'x' not present in 'cpoptions', quit
Command-line mode without executing. In macros or when 'x'
present in 'cpoptions', start entered command.
*c_CTRL-C*
CTRL-C quit command-line without executing
*c_<Up>*
<Up> recall older command-line from history, whose beginning
matches the current command-line (see below).
{not available when compiled without the |+cmdline_hist|
feature}
*c_<Down>*
<Down> recall more recent command-line from history, whose beginning
matches the current command-line (see below).
{not available when compiled without the |+cmdline_hist|
feature}
*c_<S-Up>* *c_<PageUp>*
<S-Up> or <PageUp>
recall older command-line from history
{not available when compiled without the |+cmdline_hist|
feature}
*c_<S-Down>* *c_<PageDown>*
<S-Down> or <PageDown>
recall more recent command-line from history
{not available when compiled without the |+cmdline_hist|
feature}
CTRL-D command-line completion (see |cmdline-completion|)
'wildchar' option
command-line completion (see |cmdline-completion|)
CTRL-N command-line completion (see |cmdline-completion|)
CTRL-P command-line completion (see |cmdline-completion|)
CTRL-A command-line completion (see |cmdline-completion|)
CTRL-L command-line completion (see |cmdline-completion|)
*c_CTRL-_*
CTRL-_ a - switch between Hebrew and English keyboard mode, which is
private to the command-line and not related to hkmap.
This is useful when Hebrew text entry is required in the
command-line, searches, abbreviations, etc. Applies only if
Vim is compiled with the |+rightleft| feature and the
'allowrevins' option is set.
See |rileft.txt|.
b - switch between Farsi and English keyboard mode, which is
private to the command-line and not related to fkmap. In
Farsi keyboard mode the characters are inserted in reverse
insert manner. This is useful when Farsi text entry is
required in the command-line, searches, abbreviations, etc.
Applies only if Vim is compiled with the |+farsi| feature.
See |farsi.txt|.
*c_CTRL-^*
CTRL-^ Toggle the use of language |:lmap| mappings and/or Input
Method.
When typing a pattern for a search command and 'imsearch' is
not -1, VAL is the value of 'imsearch', otherwise VAL is the
value of 'iminsert'.
When language mappings are defined:
- If VAL is 1 (langmap mappings used) it becomes 0 (no langmap
mappings used).
- If VAL was not 1 it becomes 1, thus langmap mappings are
enabled.
When no language mappings are defined:
- If VAL is 2 (Input Method is used) it becomes 0 (no input
method used)
- If VAL has another value it becomes 2, thus the Input Method
is enabled.
These language mappings are normally used to type characters
that are different from what the keyboard produces. The
'keymap' option can be used to install a whole number of them.
When entering a command line, langmap mappings are switched
off, since you are expected to type a command. After
switching it on with CTRL-^, the new state is not used again
for the next command or Search pattern.
{not in Vi}
For Emacs-style editing on the command-line see |emacs-keys|.
The <Up> and <Down> keys take the current command-line as a search string.
The beginning of the next/previous command-lines are compared with this
string. The first line that matches is the new command-line. When typing
these two keys repeatedly, the same string is used again. For example, this
can be used to find the previous substitute command: Type ":s" and then <Up>.
The same could be done by typing <S-Up> a number of times until the desired
command-line is shown. (Note: the shifted arrow keys do not work on all
terminals)
*his* *:history*
:his[tory] Print the history of last entered commands.
{not in Vi}
{not available when compiled without the |+cmdline_hist|
feature}
:his[tory] [{name}] [{first}][, [{last}]]
List the contents of history {name} which can be:
c[md] or : command-line history
s[earch] or / search string history
e[xpr] or = expression register history
i[nput] or @ input line history
a[ll] all of the above
{not in Vi}
If the numbers {first} and/or {last} are given, the respective
range of entries from a history is listed. These numbers can
be specified in the following form:
*:history-indexing*
A positive number represents the absolute index of an entry
as it is given in the first column of a :history listing.
This number remains fixed even if other entries are deleted.
A negative number means the relative position of an entry,
counted from the newest entry (which has index -1) backwards.
Examples:
List entries 6 to 12 from the search history: >
:history / 6,12
<
List the recent five entries from all histories: >
:history all -5,
==============================================================================
2. Command-line completion *cmdline-completion*
When editing the command-line, a few commands can be used to complete the
word before the cursor. This is available for:
- Command names: At the start of the command-line.
- Tags: Only after the ":tag" command.
- File names: Only after a command that accepts a file name or a setting for
an option that can be set to a file name. This is called file name
completion.
- Options: Only after the ":set" command.
- Mappings: Only after a ":map" or similar command.
- Variable and function names: Only after a ":if", ":call" or similar command.
When Vim was compiled with the |+cmdline_compl| feature disabled, only file
names, directories and help items can be completed.
These are the commands that can be used:
*c_CTRL-D*
CTRL-D List names that match the pattern in front of the cursor.
When showing file names, directories are highlighted (see
'highlight' option). Names where 'suffixes' matches are moved
to the end.
*c_CTRL-I* *c_wildchar* *c_<Tab>*
'wildchar' option
A match is done on the pattern in front of the cursor. The
match (if there are several, the first match) is inserted
in place of the pattern. (Note: does not work inside a
macro, because <Tab> or <Esc> are mostly used as 'wildchar',
and these have a special meaning in some macros.) When typed
again and there were multiple matches, the next
match is inserted. After the last match, the first is used
again (wrap around).
The behavior can be changed with the 'wildmode' option.
*c_CTRL-N*
CTRL-N After using 'wildchar' which got multiple matches, go to next
match. Otherwise recall more recent command-line from history.
<S-Tab> *c_CTRL-P* *c_<S-Tab>*
CTRL-P After using 'wildchar' which got multiple matches, go to
previous match. Otherwise recall older command-line from
history. <S-Tab> only works with the GUI, on the Amiga and
with MS-DOS.
*c_CTRL-A*
CTRL-A All names that match the pattern in front of the cursor are
inserted.
*c_CTRL-L*
CTRL-L A match is done on the pattern in front of the cursor. If
there is one match, it is inserted in place of the pattern.
If there are multiple matches the longest common part is
inserted in place of the pattern. If the result is shorter
than the pattern, no completion is done.
The 'wildchar' option defaults to <Tab> (CTRL-E when in Vi compatible mode; in
a previous version <Esc> was used). In the pattern standard wildcards '*' and
'?' are accepted. '*' matches any string, '?' matches exactly one character.
If you like tcsh's autolist completion, you can use this mapping:
:cnoremap X <C-L><C-D>
(Where X is the command key to use, <C-L> is CTRL-L and <C-D> is CTRL-D)
This will find the longest match and then list all matching files.
If you like tcsh's autolist completion, you can use the 'wildmode' option to
emulate it. For example, this mimics autolist=ambiguous:
:set wildmode=longest,list
This will find the longest match with the first 'wildchar', then list all
matching files with the next.
*suffixes*
For file name completion you can use the 'suffixes' option to set a priority
between files with almost the same name. If there are multiple matches,
those files with an extension that is in the 'suffixes' option are ignored.
The default is ".bak,~,.o,.h,.info,.swp,.obj", which means that files ending
in ".bak", "~", ".o", ".h", ".info", ".swp" and ".obj" are sometimes ignored.
It is impossible to ignore suffixes with two dots. Examples:
pattern: files: match: ~
test* test.c test.h test.o test.c
test* test.h test.o test.h and test.o
test* test.i test.h test.c test.i and test.c
If there is more than one matching file (after ignoring the ones matching
the 'suffixes' option) the first file name is inserted. You can see that
there is only one match when you type 'wildchar' twice and the completed
match stays the same. You can get to the other matches by entering
'wildchar', CTRL-N or CTRL-P. All files are included, also the ones with
extensions matching the 'suffixes' option.
To completely ignore files with some extension use 'wildignore'.
The old value of an option can be obtained by hitting 'wildchar' just after
the '='. For example, typing 'wildchar' after ":set dir=" will insert the
current value of 'dir'. This overrules file name completion for the options
that take a file name.
If you would like using <S-Tab> for CTRL-P in an xterm, put this command in
your .cshrc: >
xmodmap -e "keysym Tab = Tab Find"
And this in your .vimrc: >
:cmap <Esc>[1~ <C-P>
==============================================================================
3. Ex command-lines *cmdline-lines*
The Ex commands have a few specialties:
*:quote*
'"' at the start of a line causes the whole line to be ignored. '"'
after a command causes the rest of the line to be ignored. This can be used
to add comments. Example: >
:set ai "set 'autoindent' option
It is not possible to add a comment to a shell command ":!cmd" or to the
":map" command and friends, because they see the '"' as part of their
argument.
*:bar* *:\bar*
'|' can be used to separate commands, so you can give multiple commands in one
line. If you want to use '|' in an argument, precede it with '\'.
These commands see the '|' as their argument, and can therefore not be
followed by another command:
:argdo
:autocmd
:bufdo
:command
:cscope
:debug
:folddoopen
:folddoclosed
:function
:global
:help
:helpfind
:make
:normal
:perl
:perldo
:promptfind
:promptrepl
:pyfile
:python
:registers
:read !
:scscope
:tcl
:tcldo
:tclfile
:vglobal
:windo
:write !
:[range]!
a user defined command without the "-bar" argument |:command|
Note that this is confusing (inherited from Vi): With ":g" the '|' is included
in the command, with ":s" it is not.
To be able to use another command anyway, use the ":execute" command.
Example (append the output of "ls" and jump to the first line): >
:execute 'r !ls' | '[
There is one exception: When the 'b' flag is present in 'cpoptions', with the
":map" and ":abbr" commands and friends CTRL-V needs to be used instead of
'\'. You can also use "<Bar>" instead. See also |map_bar|.
Examples: >
:!ls | wc view the output of two commands
:r !ls | wc insert the same output in the text
:%g/foo/p|> moves all matching lines one shiftwidth
:%s/foo/bar/|> moves one line one shiftwidth
:map q 10^V| map "q" to "10|"
:map q 10\| map \ l map "q" to "10\" and map "\" to "l"
(when 'b' is present in 'cpoptions')
You can also use <NL> to separate commands in the same way as with '|'. To
insert a <NL> use CTRL-V CTRL-J. "^@" will be shown. Using '|' is the
preferred method. But for external commands a <NL> must be used, because a
'|' is included in the external command. To avoid the special meaning of <NL>
it must be preceded with a backslash. Example: >
:r !date<NL>-join
This reads the current date into the file and joins it with the previous line.
Note that when the command before the '|' generates an error, the following
commands will not be executed.
Because of Vi compatibility the following strange commands are supported: >
:| print current line (like ":p")
:3| print line 3 (like ":3p")
:3 goto line 3
A colon is allowed between the range and the command name. It is ignored
(this is Vi compatible). For example: >
:1,$:s/pat/string
When the character '%' or '#' is used where a file name is expected, they are
expanded to the current and alternate file name (see the chapter "editing
files" |:_%| |:_#|).
Embedded spaces in file names are allowed on the Amiga if one file name is
expected as argument. Trailing spaces will be ignored, unless escaped with a
backslash or CTRL-V. Note that the ":next" command uses spaces to separate
file names. Escape the spaces to include them in a file name. Example: >
:next foo\ bar goes\ to school\
starts editing the three files "foo bar", "goes to" and "school ".
When you want to use the special characters '"' or '|' in a command, or want
to use '%' or '#' in a file name, precede them with a backslash. The
backslash is not required in a range and in the ":substitute" command.
*:_!*
The '!' (bang) character after an Ex command makes the command behave in a
different way. The '!' should be placed immediately after the command, without
any blanks in between. If you insert blanks the '!' will be seen as an
argument for the command, which has a different meaning. For example:
:w! name write the current buffer to file "name", overwriting
any existing file
:w !name send the current buffer as standard input to command
"name"
==============================================================================
4. Ex command-line ranges *cmdline-ranges* *[range]* *E16* *E493*
Some Ex commands accept a line range in front of them. This is noted as
[range]. It consists of one or more line specifiers, separated with ',' or
';'.
The basics are explained in section |10.3| of the user manual.
*:,* *:;*
When separated with ';' the cursor position will be set to that line
before interpreting the next line specifier. This doesn't happen for ','.
Examples: >
4,/this line/
< from line 4 till match with "this line" after the cursor line. >
5;/that line/
< from line 5 till match with "that line" after line 5.
The default line specifier for most commands is the cursor position, but the
commands ":write" and ":global" have the whole file (1,$) as default.
If more line specifiers are given than required for the command, the first
one(s) will be ignored.
Line numbers may be specified with: *:range* *E14* *{address}*
{number} an absolute line number
. the current line *:.*
$ the last line in the file *:$*
% equal to 1,$ (the entire file) *:%*
't position of mark t (lowercase) *:'*
'T position of mark T (uppercase); when the mark is in
another file it cannot be used in a range
/{pattern}[/] the next line where {pattern} matches *:/*
?{pattern}[?] the previous line where {pattern} matches *:?*
\/ the next line where the previously used search
pattern matches
\? the previous line where the previously used search
pattern matches
\& the next line where the previously used substitute
pattern matches
Each may be followed (several times) by '+' or '-' and an optional number.
This number is added or subtracted from the preceding line number. If the
number is omitted, 1 is used.
The "/" and "?" after {pattern} are required to separate the pattern from
anything that follows.
The "/" and "?" may be preceded with another address. The search starts from
there. The difference from using ';' is that the cursor isn't moved.
Examples: >
/pat1//pat2/ Find line containing "pat2" after line containing
"pat1", without moving the cursor.
7;/pat2/ Find line containing "pat2", after line 7, leaving
the cursor in line 7.
The {number} must be between 0 and the number of lines in the file. When
using a 0 (zero) this is interpreted as a 1 by most commands. Commands that
use it as a count do use it as a zero (|:tag|, |:pop|, etc). Some commands
interpret the zero as "before the first line" (|:read|, search pattern, etc).
Examples: >
.+3 three lines below the cursor
/that/+1 the line below the next line containing "that"
.,$ from current line until end of file
0;/that the first line containing "that", also matches in the
first line.
1;/that the first line after line 1 containing "that"
Some commands allow for a count after the command. This count is used as the
number of lines to be used, starting with the line given in the last line
specifier (the default is the cursor line). The commands that accept a count
are the ones that use a range but do not have a file name argument (because
a file name can also be a number).
Examples: >
:s/x/X/g 5 substitute 'x' by 'X' in the current line and four
following lines
:23d 4 delete lines 23, 24, 25 and 26
Folds and Range
When folds are active the line numbers are rounded off to include the whole
closed fold. See |fold-behavior|.
Reverse Range
A range should have the lower line number first. If this is not the case, Vim
will ask you if it should swap the line numbers. This is not done within the
global command ":g".
Count and Range *N:*
When giving a count before entering ":", this is translated into:
:.,.+(count - 1)
In words: The 'count' lines at and after the cursor. Example: To delete
three lines: >
3:d<CR> is translated into: .,.+2d<CR>
<
Visual Mode and Range *v_:*
{Visual}: Starts a command-line with the Visual selected lines as a
range. The code ":'<,'>" is used for this range, which makes
it possible to select a similar line from the command-line
history for repeating a command on different Visually selected
lines.
==============================================================================
5. Ex special characters *cmdline-special*
In Ex commands, at places where a file name can be used, the following
characters have a special meaning. These can also be used in the expression
function expand() |expand()|.
% is replaced with the current file name *:_%*
# is replaced with the alternate file name *:_#*
#n (where n is a number) is replaced with the file name of
buffer n. "#0" is the same as "#"
## is replaced with all names in the argument list *:_##*
concatenated, separated by spaces. Each space in a name
is preceded with a backslash.
Note that these give the file name as it was typed. If an absolute path is
needed (when using the file name from a different directory), you need to add
":p". See |filename-modifiers|.
Note that backslashes are inserted before spaces, so that the command will
correctly interpret the file name. But this doesn't happen for shell
commands. For those you probably have to use quotes: >
:!ls "%"
:r !spell "%"
To avoid the special meaning of '%' and '#' insert a backslash before it.
Detail: The special meaning is always escaped when there is a backslash before
it, no matter how many backslashes.
you type: result ~
# alternate.file
\# #
\\# \#
*:<cword>* *:<cWORD>* *:<cfile>* *<cfile>*
*:<sfile>* *<sfile>* *:<afile>* *<afile>*
*:<abuf>* *<abuf>* *:<amatch>* *<amatch>*
*E495* *E496* *E497* *E498* *E499* *E500*
Note: these are typed literally, they are not special keys!
<cword> is replaced with the word under the cursor (like |star|)
<cWORD> is replaced with the WORD under the cursor (see |WORD|)
<cfile> is replaced with the path name under the cursor (like what
|gf| uses)
<afile> when executing autocommands, is replaced with the file name
for a file read or write
<abuf> when executing autocommands, is replaced with the currently
effective buffer number (for ":r file" it is the current
buffer, the file being read is not in a buffer).
<amatch> when executing autocommands, is replaced with the match for
which this autocommand was executed. It differs form
<afile> only when the file name isn't used to match with
(for FileType and Syntax events).
<sfile> when executing a ":source" command, is replaced with the
file name of the sourced file;
when executing a function, is replaced with
"function {function-name}"; function call nesting is
indicated like this:
"function {function-name1}..{function-name2}". Note that
filename-modifiers are useless when <sfile> is used inside
a function.
*filename-modifiers*
*:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs*
The file name modifiers can be used after "%", "#", "#n", "<cfile>", "<sfile>",
"<afile>" or "<abuf>". They are also used with the |fnamemodify()| function.
These are not available when Vim has been compiled without the |+modify_fname|
feature.
These modifiers can be given, in this order:
:p Make file name a full path. Must be the first modifier. Also
changes "~/" (and "~user/" for Unix and VMS) to the path for
the home directory. If the name is a directory a path
separator is added at the end. For a file name that does not
exist and does not have an absolute path the result is
unpredictable.
:8 Converts the path to 8.3 short format (currently only on
win32). Will act on as much of a path that is an existing
path.
:~ Reduce file name to be relative to the home directory, if
possible. File name is unmodified if it is not below the home
directory.
:. Reduce file name to be relative to current directory, if
possible. File name is unmodified if it is not below the
current directory.
For maximum shortness, use ":~:.".
:h Head of the file name (the last component and any separators
removed). Cannot be used with :e, :r or :t.
Can be repeated to remove several components at the end.
When the file name ends in a path separator, only the path
separator is removed. Thus ":p:h" on a directory name results
on the directory name itself (without trailing slash).
When the file name is an absolute path (starts with "/" for
Unix; "x:\" for MS-DOS, WIN32, OS/2; "drive:" for Amiga), that
part is not removed. When there is no head (path is relative
to current directory) the result is empty.
:t Tail of the file name (last component of the name). Must
precede any :r or :e.
:r Root of the file name (the last extension removed). When
there is only an extension (file name that starts with '.',
e.g., ".vimrc"), it is not removed. Can be repeated to remove
several extensions (last one first).
:e Extension of the file name. Only makes sense when used alone.
When there is no extension the result is empty.
When there is only an extension (file name that starts with
'.'), the result is empty. Can be repeated to include more
extensions. If there are not enough extensions (but at least
one) as much as possible are included.
:s?pat?sub?
Substitute the first occurrence of "pat" with "sub". This
works like the |:s| command. "pat" is a regular expression.
Any character can be used for '?', but it must not occur in
"pat" or "sub".
After this, the previous modifiers can be used again. For
example ":p", to make a full path after the substitution.
:gs?pat?sub?
Substitute all occurrences of "path" with "sub". Otherwise
this works like ":s".
Examples, when the file name is "src/version.c", current dir
"/home/mool/vim": >
:p /home/mool/vim/src/version.c
:p:. src/version.c
:p:~ ~/vim/src/version.c
:h src
:p:h /home/mool/vim/src
:p:h:h /home/mool/vim
:t version.c
:p:t version.c
:r src/version
:p:r /home/mool/vim/src/version
:t:r version
:e c
:s?version?main? src/main.c
:s?version?main?:p /home/mool/vim/src/main.c
:p:gs?/?\\? \home\mool\vim\src\version.c
Examples, when the file name is "src/version.c.gz": >
:p /home/mool/vim/src/version.c.gz
:e gz
:e:e c.gz
:e:e:e c.gz
:e:e:r c
:r src/version.c
:r:e c
:r:r src/version
:r:r:r src/version
<
*extension-removal* *:_%<*
If a "<" is appended to "%", "#", "#n" or "CTRL-V p" the extension of the file
name is removed (everything after and including the last '.' in the file
name). This is included for backwards compatibility with version 3.0, the
":r" form is preferred. Examples: >
% current file name
%< current file name without extension
# alternate file name for current window
#< idem, without extension
#31 alternate file number 31
#31< idem, without extension
<cword> word under the cursor
<cWORD> WORD under the cursor (see |WORD|)
<cfile> path name under the cursor
<cfile>< idem, without extension
Note: Where a file name is expected wildcards expansion is done. On Unix the
shell is used for this, unless it can be done internally (for speed).
Backticks also work, like in >
:n `echo *.c`
(backtick expansion is not possible in |restricted-mode|)
But expansion is only done if there are any wildcards before expanding the
'%', '#', etc.. This avoids expanding wildcards inside a file name. If you
want to expand the result of <cfile>, add a wildcard character to it.
Examples: (alternate file name is "?readme?")
command expands to ~
:e # :e ?readme?
:e `ls #` :e {files matching "?readme?"}
:e #.* :e {files matching "?readme?.*"}
:cd <cfile> :cd {file name under cursor}
:cd <cfile>* :cd {file name under cursor plus "*" and then expanded}
When the expanded argument contains a "!" and it is used for a shell command
(":!cmd", ":r !cmd" or ":w !cmd"), it is escaped with a backslash to avoid it
being expanded into a previously used command. When the 'shell' option
contains "sh", this is done twice, to avoid the shell trying to expand the
"!".
*filename-backslash*
For filesystems that use a backslash as directory separator (MS-DOS, Windows,
OS/2), it's a bit difficult to recognize a backslash that is used to escape
the special meaning of the next character. The general rule is: If the
backslash is followed by a normal file name character, it does not have a
special meaning. Therefore "\file\foo" is a valid file name, you don't have
to type the backslash twice.
An exception is the '$' sign. It is a valid character in a file name. But
to avoid a file name like "$home" to be interpreted as an environment variable,
it needs to be preceded by a backslash. Therefore you need to use "/\$home"
for the file "$home" in the root directory. A few examples:
FILE NAME INTERPRETED AS ~
$home expanded to value of environment var $home
\$home file "$home" in current directory
/\$home file "$home" in root directory
\\$home file "\\", followed by expanded $home
==============================================================================
6. Command-line window *cmdline-window* *cmdwin*
In the command-line window the command line can be edited just like editing
text in any window. It is a special kind of window, because you cannot leave
it in a normal way.
{not available when compiled without the |+cmdline_hist| or |+vertsplit|
feature}
OPEN
There are two ways to open the command-line window:
1. From Command-line mode, use the key specified with the 'cedit' option.
The default is CTRL-F when 'compatible' is not set.
2. From Normal mode, use the "q:", "q/" or "q?" command. *q:* *q/* *q?*
This starts editing an Ex command-line ("q:") or search string ("q/" or
"q?"). Note that this is not possible while recording is in progress (the
"q" stops recording then).
When the window opens it is filled with the command-line history. The last
line contains the command as typed so far. The left column will show a
character that indicates the type of command-line being edited, see
|cmdwin-char|.
Vim will be in Normal mode when the editor is opened, except when 'insertmode'
is set.
The height of the window is specified with 'cmdwinheight' (or smaller if there
is no room). The window is always full width and is positioned just above the
command-line.
EDIT
You can now use commands to move around and edit the text in the window. Both
in Normal mode and Insert mode.
It is possible to use ":", "/" and other commands that use the command-line,
but it's not possible to open another command-line window then. There is no
nesting.
*E11*
The command-line window is not a normal window. It is not possible to move to
another window or edit another buffer. All commands that would do this are
disabled in the command-line window. Of course it _is_ possible to execute
any command that you entered in the command-line window.
CLOSE *E199*
There are several ways to leave the command-line window:
<CR> Execute the command-line under the cursor. Works both in
Insert and in Normal mode.
CTRL-C Continue in Command-line mode. The command-line under the
cursor is used as the command-line. Works both in Insert and
in Normal mode. ":close" also works. There is no redraw,
thus the window will remain visible.
:quit Discard the command line and go back to Normal mode.
":exit", ":xit" and CTRL-\ CTRL-N also work.
:qall Quit Vim, unless there are changes in some buffer.
:qall! Quit Vim, discarding changes to any buffer.
Once the command-line window is closed the old window sizes are restored. The
executed command applies to the window and buffer where the command-line was
started from. This works as if the command-line window was not there, except
that there will be an extra screen redraw.
The buffer used for the command-line window is deleted. Any changes to lines
other than the one that is executed with <CR> are lost.
VARIOUS
The command-line window cannot be used:
- when there already is a command-line window (no nesting)
- for entering a encryption key or when using inputsecret()
- when Vim was not compiled with the +vertsplit feature
Some options are set when the command-line window is opened:
'filetype' "vim", when editing an Ex command-line; this starts Vim syntax
highlighting if it was enabled
'rightleft' off
'modifiable' on
'buftype' "nofile"
'swapfile' off
It is allowed to write the buffer contents to a file. This is an easy way to
save the command-line history and read it back later.
If the 'wildchar' option is set to <Tab>, and the command-line window is used
for an Ex command, then two mappings will be added to use <Tab> for completion
in the command-line window, like this: >
:imap <buffer> <Tab> <C-X><C-V>
:nmap <buffer> <Tab> a<C-X><C-V>
Note that hitting <Tab> in Normal mode will do completion on the next
character. That way it works at the end of the line.
If you don't want these mappings, disable them with: >
au CmdwinEnter [:>] iunmap <Tab>
au CmdwinEnter [:>] nunmap <Tab>
You could put these lines in your vimrc file.
While in the command-line window you cannot use the mouse to put the cursor in
another window, or drag statuslines of other windows. You can drag the
statusline of the command-line window itself and the statusline above it.
Thus you can resize the command-line window, but not others.
AUTOCOMMANDS
Two autocommand events are used: |CmdwinEnter| and |CmdwinLeave|. Since this
window is of a special type, the WinEnter, WinLeave, BufEnter and BufLeave
events are not triggered. You can use the Cmdwin events to do settings
specifically for the command-line window. Be careful not to cause side
effects!
Example: >
:au CmdwinEnter : let b:cpt_save = &cpt | set cpt=v
:au CmdwinLeave : let &cpt = b:cpt_save
This sets 'complete' to use command-line completion in Insert mode for CTRL-N.
Another example: >
:au CmdwinEnter [/?] startinsert
This will make Vim start in Insert mode in the command-line window.
*cmdwin-char*
The character used for the pattern indicates the type of command-line:
: normal Ex command
> debug mode command |debug-mode|
/ forward search string
? backward search string
= expression for "= |expr-register|
@ string for |input()|
- text for |:insert| or |:append|
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,135 @@
*debugger.txt* For Vim version 6.3. Last change: 2001 Dec 22
VIM REFERENCE MANUAL by Gordon Prieur
Debugger Support Features *debugger-support*
1. Debugger Features |debugger-features|
2. Vim Compile Options |debugger-compilation|
3. Integrated Debuggers |debugger-integration|
{Vi does not have any of these features}
==============================================================================
1. Debugger Features *debugger-features*
The following features are available for an integration with a debugger or
an Integrated Programming Environment (IPE) or Integrated Development
Environment (IDE):
Alternate Command Input |alt-input|
Debug Signs |debug-signs|
Debug Source Highlight |debug-highlight|
Message Footer |gui-footer|
Balloon Evaluation |balloon-eval|
These features were added specifically for use in the Motif version of gvim.
However, the |alt-input| and |debug-highlight| were written to be usable in
both vim and gvim. Some of the other features could be used in the non-GUI
vim with slight modifications. However, I did not do this nor did I test the
reliability of building for vim or non Motif GUI versions.
1.1 Alternate Command Input *alt-input*
For Vim to work with a debugger there must be at least an input connection
with a debugger or external tool. In many cases there will also be an output
connection but this isn't absolutely necessary.
The purpose of the input connection is to let the external debugger send
commands to Vim. The commands sent by the debugger should give the debugger
enough control to display the current debug environment and state.
The current implementation is based on the X Toolkit dispatch loop and the
XtAddInput() function call.
1.2 Debug Signs *debug-signs*
Many debuggers mark specific lines by placing a small sign or color highlight
on the line. The |:sign| command lets the debugger set this graphic mark. Some
examples where this feature would be used would be a debugger showing an arrow
representing the Program Counter (PC) of the program being debugged. Another
example would be a small stop sign for a line with a breakpoint. These visible
highlights let the user keep track of certain parts of the state of the
debugger.
This feature can be used with more than debuggers, too. An IPE can use a sign
to highlight build errors, searched text, or other things. The sign feature
can also work together with the |debug-highlight| to ensure the mark is
highly visible.
Debug signs are defined and placed using the |:sign| command.
1.3 Debug Source Highlight *debug-highlight*
This feature allows a line to have a predominant highlight. The highlight is
intended to make a specific line stand out. The highlight could be made to
work for both vim and gvim, whereas the debug sign is, in most cases, limited
to gvim. The one exception to this is Sun Microsystem's dtterm. The dtterm
from Sun has a "sign gutter" for showing signs.
1.4 Message Footer *gui-footer*
The message footer can be used to display messages from a debugger or IPE. It
can also be used to display menu and toolbar tips. The footer area is at the
bottom of the GUI window, below the line used to display colon commands.
The display of the footer is controlled by the 'guioptions' letter 'F'.
1.5 Balloon Evaluation *balloon-eval*
This feature allows a debugger, or other external tool, to display dynamic
information based on where the mouse is pointing. The purpose of this feature
was to allow Sun's Visual WorkShop debugger to display expression evaluations.
However, the feature was implemented in as general a manner as possible and
could be used for displaying other information as well.
The Balloon Evaluation has some settable parameters too. The font list and
colors can be set via X resources (XmNballoonEvalFontList,
XmNballoonEvalBackground, and XmNballoonEvalForeground).
The 'balloondelay' option sets the delay before an attempt is made to show a
balloon.
The 'ballooneval' option needs to be set to switch it on.
Balloon evaluation is only available when compiled with the |+balloon_eval|
and |+sun_workshop| features.
The Balloon evaluation functions are also used to show a tooltip for the
toolbar. The 'ballooneval' option does not need to be set for this. But the
other settings apply.
==============================================================================
2. Vim Compile Options *debugger-compilation*
The debugger features were added explicitly for use with Sun's Visual
WorkShop Integrated Programming Environment (ipe). However, they were done
in as generic a manner as possible so that integration with other debuggers
could also use some or all of the tools used with Sun's ipe.
The following compile time preprocessor variables control the features:
Alternate Command Input ALT_X_INPUT
Debug Glyphs FEAT_SIGNS
Debug Highlights FEAT_SIGNS
Message Footer FEAT_FOOTER
Balloon Evaluation FEAT_BEVAL
The first integration with a full IPE/IDE was with Sun Visual WorkShop. To
compile a gvim which interfaces with VWS set the following flag, which sets
all the above flags:
Sun Visual WorkShop FEAT_SUN_WORKSHOP
==============================================================================
3. Integrated Debuggers *debugger-integration*
Currently the only fully integrated debugger/IPE/IDE is Sun's Visual WorkShop
Integrated Programming Environment.
vim:tw=78:sw=4:ts=8:ft=help:norl:

View File

@ -0,0 +1,384 @@
*develop.txt* For Vim version 6.3. Last change: 2004 Jan 17
VIM REFERENCE MANUAL by Bram Moolenaar
Development of Vim. *development*
This text is important for those who want to be involved in further developing
Vim.
1. Design goals |design-goals|
2. Coding style |coding-style|
3. Design decisions |design-decisions|
4. Assumptions |design-assumptions|
See the file README.txt in the "src" directory for an overview of the source
code.
Vim is open source software. Everybody is encouraged to contribute to help
improving Vim. For sending patches a context diff "diff -c" is preferred.
Also see http://www.vim.org/tips/tip.php?tip_id=618.
==============================================================================
1. Design goals *design-goals*
Most important things come first (roughly).
Note that quite a few items are contradicting. This is intentional. A
balance must be found between them.
VIM IS... VI COMPATIBLE *design-compatible*
First of all, it should be possible to use Vim as a drop-in replacement for
Vi. When the user wants to, he can use Vim in compatible mode and hardly
notice any difference with the original Vi.
Exceptions:
- We don't reproduce obvious Vi bugs in Vim.
- There are different versions of Vi. I am using Version 3.7 (6/7/85) as a
reference. But support for other versions is also included when possible.
The Vi part of POSIX is not considered a definitive source.
- Vim adds new commands, you cannot rely on some command to fail because it
didn't exist in Vi.
- Vim will have a lot of features that Vi doesn't have. Going back from Vim
to Vi will be a problem, this cannot be avoided.
- Some things are hardly ever used (open mode, sending an e-mail when
crashing, etc.). Those will only be included when someone has a good reason
why it should be included and it's not too much work.
- For some items it is debatable whether Vi compatibility should be
maintained. There will be an option flag for these.
VIM IS... IMPROVED *design-improved*
The IMproved bits of Vim should make it a better Vi, without becoming a
completely different editor. Extensions are done with a "Vi spirit".
- Use the keyboard as much as feasible. The mouse requires a third hand,
which we don't have. Many terminals don't have a mouse.
- When the mouse is used anyway, avoid the need to switch back to the
keyboard. Avoid mixing mouse and keyboard handling.
- Add commands and options in a consistent way. Otherwise people will have a
hard time finding and remembering them. Keep in mind that more commands and
options will be added later.
- A feature that people do not know about is a useless feature. Don't add
obscure features, or at least add hints in documentation that they exists.
- Minimize using CTRL and other modifiers, they are more difficult to type.
- There are many first-time and inexperienced Vim users. Make it easy for
them to start using Vim and learn more over time.
- There is no limit to the features that can be added. Selecting new features
is one based on (1) what users ask for, (2) how much effort it takes to
implement and (3) someone actually implementing it.
VIM IS... MULTI PLATFORM *design-multi-platform*
Vim tries to help as many users on as many platforms as possible.
- Support many kinds of terminals. The minimal demands are cursor positioning
and clear-screen. Commands should only use key strokes that most keyboards
have. Support all the keys on the keyboard for mapping.
- Support many platforms. A condition is that there is someone willing to do
Vim development on that platform, and it doesn't mean messing up the code.
- Support many compilers and libraries. Not everybody is able or allowed to
install another compiler or GUI library.
- People switch from one platform to another, and from GUI to terminal
version. Features should be present in all versions, or at least in as many
as possible with a reasonable effort. Try to avoid that users must switch
between platforms to accomplish their work efficiently.
- That a feature is not possible on some platforms, or only possible on one
platform, does not mean it cannot be implemented. [This intentionally
contradicts the previous item, these two must be balanced.]
VIM IS... WELL DOCUMENTED *design-documented*
- A feature that isn't documented is a useless feature. A patch for a new
feature must include the documentation.
- Documentation should be comprehensive and understandable. Using examples is
recommended.
- Don't make the text unnecessarily long. Less documentation means that an
item is easier to find.
VIM IS... HIGH SPEED AND SMALL IN SIZE *design-speed-size*
Using Vim must not be a big attack on system resources. Keep it small and
fast.
- Computers are becoming faster and bigger each year. Vim can grow too, but
no faster than computers are growing. Keep Vim usable on older systems.
- Many users start Vim from a shell very often. Startup time must be short.
- Commands must work efficiently. The time they consume must be as small as
possible. Useful commands may take longer.
- Don't forget that some people use Vim over a slow connection. Minimize the
communication overhead.
- Items that add considerably to the size and are not used by many people
should be a feature that can be disabled.
- Vim is a component among other components. Don't turn it into a massive
application, but have it work well together with other programs.
VIM IS... MAINTAINABLE *design-maintain*
- The source code should not become a mess. It should be reliable code.
- Use the same layout in all files to make it easy to read |coding-style|.
- Use comments in a useful way!
- Porting to another platform should be made easy, without having to change
too much platform-independent code.
- Use the object-oriented spirit: Put data and code together. Minimize the
knowledge spread to other parts of the code.
VIM IS... FLEXIBLE *design-flexible*
Vim should make it easy for users to work in their preferred styles rather
than coercing its users into particular patterns of work. This can be for
items with a large impact (e.g., the 'compatible' option) or for details. The
defaults are carefully chosen such that most users will enjoy using Vim as it
is. Commands and options can be used to adjust Vim to the desire of the user
and its environment.
VIM IS... NOT *design-not*
- Vim is not a shell or an Operating System. You will not be able to run a
shell inside Vim or use it to control a debugger. This should work the
other way around: Use Vim as a component from a shell or in an IDE.
A satirical way to say this: "Unlike Emacs, Vim does not attempt to include
everything but the kitchen sink, but some people say that you can clean one
with it. ;-)"
- Vim is not a fancy GUI editor that tries to look nice at the cost of
being less consistent over all platforms. But functional GUI features are
welcomed.
==============================================================================
2. Coding style *coding-style*
These are the rules to use when making changes to the Vim source code. Please
stick to these rules, to keep the sources readable and maintainable.
This list is not complete. Look in the source code for more examples.
MAKING CHANGES *style-changes*
The basic steps to make changes to the code:
1. Adjust the documentation. Doing this first gives you an impression of how
your changes affect the user.
2. Make the source code changes.
3. Check ../doc/todo.txt if the change affects any listed item.
4. Make a patch with "diff -c" against the unmodified code and docs.
5. Make a note about what changed and include it with the patch.
USE OF COMMON FUNCTIONS *style-functions*
Some functions that are common to use, have a special Vim version. Always
consider using the Vim version, because they were introduced with a reason.
NORMAL NAME VIM NAME DIFFERENCE OF VIM VERSION
free() vim_free() Checks for freeing NULL
malloc() alloc() Checks for out of memory situation
malloc() lalloc() Like alloc(), but has long argument
strcpy() STRCPY() Includes cast to (char *), for char_u * args
strchr() vim_strchr() Accepts special characters
strrchr() vim_strrchr() Accepts special characters
isspace() vim_isspace() Can handle characters > 128
iswhite() vim_iswhite() Only TRUE for Tab and space
memcpy() vim_memmove() Handles overlapped copies
bcopy() vim_memmove() Handles overlapped copies
memset() vim_memset() Uniform for all systems
NAMES *style-names*
Function names can not be more than 31 characters long (because of VMS).
Don't use "delete" as a variable name, C++ doesn't like it.
Because of the requirement that Vim runs on as many systems as possible, we
need to avoid using names that are already defined by the system. This is a
list of names that are known to cause trouble. The name is given as a regexp
pattern.
is.*() POSIX, ctype.h
to.*() POSIX, ctype.h
d_.* POSIX, dirent.h
l_.* POSIX, fcntl.h
gr_.* POSIX, grp.h
pw_.* POSIX, pwd.h
sa_.* POSIX, signal.h
mem.* POSIX, string.h
str.* POSIX, string.h
wcs.* POSIX, string.h
st_.* POSIX, stat.h
tms_.* POSIX, times.h
tm_.* POSIX, time.h
c_.* POSIX, termios.h
MAX.* POSIX, limits.h
__.* POSIX, system
_[A-Z].* POSIX, system
E[A-Z0-9]* POSIX, errno.h
*_t POSIX, for typedefs. Use *_T instead.
wait don't use as argument to a function, conflicts with types.h
index shadows global declaration
time shadows global declaration
new C++ reserved keyword
try Borland C++ doesn't like it to be used as a variable.
basename() GNU string function
dirname() GNU string function
get_env_value() Linux system function
VARIOUS *style-various*
Typedef'ed names should end in "_t": >
typedef int some_t;
Define'ed names should be uppercase: >
#define SOME_THING
Features always start with "FEAT_": >
#define FEAT_FOO
Don't use '\"', some compilers can't handle it. '"' works fine.
Don't use:
#if HAVE_SOME
Some compilers can't handle that and complain that "HAVE_SOME" is not defined.
Use
#ifdef HAVE_SOME
or
#if defined(HAVE_SOME)
STYLE *style-examples*
General rule: One statement per line.
Wrong: if (cond) a = 1;
OK: if (cond)
a = 1;
Wrong: while (cond);
OK: while (cond)
;
Wrong: do a = 1; while (cond);
OK: do
a = 1;
while (cond);
Functions start with:
Wrong: int function_name(int arg1, int arg2)
OK: /*
* Explanation of what this function is used for.
*
* Return value explanation.
*/
int
function_name(arg1, arg2)
int arg1; /* short comment about arg1 */
int arg2; /* short comment about arg2 */
{
int local; /* comment about local */
local = arg1 * arg2;
NOTE: Don't use ANSI style function declarations. A few people still have to
use a compiler that doesn't support it.
SPACES AND PUNCTUATION *style-spaces*
No space between a function name and the bracket:
Wrong: func (arg);
OK: func(arg);
Do use a space after if, while, switch, etc.
Wrong: if(arg) for(;;)
OK: if (arg) for (;;)
Use a space after a comma and semicolon:
Wrong: func(arg1,arg2); for (i = 0;i < 2;++i)
OK: func(arg1, arg2); for (i = 0; i < 2; ++i)
Use a space before and after '=', '+', '/', etc.
Wrong: var=a*5;
OK: var = a * 5;
In general: Use empty lines to group lines of code together. Put a comment
just above the group of lines. This makes it more easy to quickly see what is
being done.
OK: /* Prepare for building the table. */
get_first_item();
table_idx = 0;
/* Build the table */
while (has_item())
table[table_idx++] = next_item();
/* Finish up. */
cleanup_items();
generate_hash(table);
==============================================================================
3. Design decisions *design-decisions*
Folding
Several forms of folding should be possible for the same buffer. For example,
have one window that shows the text with function bodies folded, another
window that shows a function body.
Folding is a way to display the text. It should not change the text itself.
Therefore the folding has been implemented as a filter between the text stored
in a buffer (buffer lines) and the text displayed in a window (logical lines).
Naming the window
The word "window" is commonly used for several things: A window on the screen,
the xterm window, a window inside Vim to view a buffer.
To avoid confusion, other items that are sometimes called window have been
given another name. Here is an overview of the related items:
screen The whole display. For the GUI it's something like 1024x768
pixels. The Vim shell can use the whole screen or part of it.
shell The Vim application. This can cover the whole screen (e.g.,
when running in a console) or part of it (xterm or GUI).
window View on a buffer. There can be several windows in Vim,
together with the command line, menubar, toolbar, etc. they
fit in the shell.
To be continued...
==============================================================================
4. Assumptions *design-assumptions*
Size of variables:
char 8 bit signed
char_u 8 bit unsigned
int 16, 32 or 64 bit signed
unsigned 16, 32 or 64 bit unsigned
long 32 or 64 bit signed, can hold a pointer
Note that some compilers cannot handle long lines or strings. The C89
standard specifies a limit of 509 characters.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,371 @@
*diff.txt* For Vim version 6.3. Last change: 2004 May 01
VIM REFERENCE MANUAL by Bram Moolenaar
*diff* *vimdiff* *gvimdiff* *diff-mode*
This file describes the +diff feature: Showing differences between two or
three versions of the same file.
The basics are explained in section |08.7| of the user manual.
1. Starting diff mode |vimdiff|
2. Viewing diffs |view-diffs|
3. Jumping to diffs |jumpto-diffs|
4. Copying diffs |copy-diffs|
5. Diff options |diff-options|
{not in Vi}
==============================================================================
1. Starting diff mode
The easiest way to start editing in diff mode is with the "vimdiff" command.
This starts Vim as usual, and additionally sets up for viewing the differences
between the arguments. >
vimdiff file1 file2 [file3 [file4]]
This is equivalent to: >
vim -d file1 file2 [file3 [file4]]
You may also use "gvimdiff" or "vim -d -g". The GUI is started then.
You may also use "viewdiff" or "gviewdiff". Vim starts in readonly mode then.
"r" may be prepended for restricted mode (see |-Z|).
The second and following arguments may also be a directory name. Vim will
then append the file name of the first argument to the directory name to find
the file.
This only works when a standard "diff" command is available. See 'diffexpr'.
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: >
vimdiff -o file1 file2 [file3]
In each of the edited files these options are set:
'diff' on
'scrollbind' on
'scrollopt' includes "hor"
'wrap' off
'foldmethod' "diff"
'foldcolumn' 2
These options are set local to the window. When editing another file they are
reset to the global value.
The differences shown are actually the differences in the buffer. Thus if you
make changes after loading a file, these will be included in the displayed
diffs. You might have to do ":diffupdate" now and then, not all changes are
immediately taken into account.
In your .vimrc file you could do something special when Vim was started in
diff mode. You could use a construct like this: >
if &diff
setup for diff mode
else
setup for non-diff mode
endif
While already in Vim you can start diff mode in three ways.
*E98*
:diffsplit {filename} *:diffs* *:diffsplit*
Open a new window on the file {filename}. The options are set
as for "vimdiff" for the current and the newly opened window.
Also see 'diffexpr'.
*:difft* *:diffthis*
:diffthis Make the current window part of the diff windows. This sets
the option like for "vimdiff".
:diffpatch {patchfile} *:diffp* *:diffpatch*
Use the current buffer, patch it with the diff found in
{patchfile} and open a buffer on the result. The options are
set as for "vimdiff".
{patchfile} can be in any format that the "patch" program
understands or 'patchexpr' can handle.
Note that {patchfile} should only contain a diff for one file,
the current file. If {patchfile} contains diffs for other
files as well, the results are unpredictable. Vim changes
directory to /tmp to avoid files in the current directory
accidentally being patched. But it may still result in
various ".rej" files to be created. And when absolute path
names are present these files may get patched anyway.
To make these commands use a vertical split, prepend |:vertical|. Examples: >
:vert diffsplit main.c~
:vert diffpatch /tmp/diff
<
*E96*
There can be up to four buffers with 'diff' set.
Since the option values are remembered with the buffer, you can edit another
file for a moment and come back to the same file and be in diff mode again.
If you don't want diff mode, reset the 'diff' option. And you probably want
to get rid of the fold column: >
:set nodiff foldcolumn=0
==============================================================================
2. Viewing diffs *view-diffs*
The effect is that the diff windows show the same text, with the differences
highlighted. When scrolling the text, the 'scrollbind' option will make the
text in other windows to be scrolled as well. With vertical splits the text
should be aligned properly.
The alignment of text will go wrong when:
- 'wrap' is on, some lines will be wrapped and occupy two or more screen
lines
- folds are open in one window but not another
- 'scrollbind' is off
- changes have been made to the text
- "filler" is not present in 'diffopt', deleted/inserted lines makes the
alignment go wrong
All the buffers edited in a window where the 'diff' option is set will join in
the diff. This is also possible for hidden buffers. They must have been
edited in a window first for this to be possible.
Since 'diff' is a window-local option, it's possible to view the same buffer
in diff mode in one window and "normal" in another window. It is also
possible to view the changes you have made to a buffer, but since Vim doesn't
allow having two buffers for the same file, you need to make a copy of the
original file and diff with that. For example: >
:!cp % tempfile
:diffsplit tempfile
A buffer that is unloaded cannot be used for the diff. But it does work for
hidden buffers. You can use ":hide" to close a window without unloading the
buffer.
*:diffu* *:diffupdate*
Vim attempts to keep the differences updated when you make changes to the
text. This mostly takes care of inserted and deleted lines. Changes within a
line and more complicated changes do not cause the differences to be updated.
To force the differences to be updated use: >
:diffupdate
Vim will show filler lines for lines that are missing in one window but are
present in another. These lines were inserted in another file or deleted in
this file. Removing "filler" from the 'diffopt' option will make Vim not
display these filler lines.
Folds are used to hide the text that wasn't changed. See |folding| for all
the commands that can be used with folds.
The context of lines above a difference that are not included in the fold can
be set with the 'diffopt' option. For example, to set the context to three
lines: >
:set diffopt=filler,context:3
The diffs are highlighted with these groups:
|hl-DiffAdd| DiffAdd Added (inserted) lines. These lines exist in
this buffer but not in another.
|hl-DiffChange| DiffChange Changed lines.
|hl-DiffText| DiffText Changed text inside a Changed line. Vim
finds the first character that is different,
and the last character that is different
(searching from the end of the line). The
text in between is highlighted. This means
that parts in the middle that are still the
same are highlighted anyway.
|hl-DiffDelete| DiffDelete Deleted lines. Also called filler lines,
because they don't really exist in this
buffer.
==============================================================================
3. Jumping to diffs *jumpto-diffs*
Two commands can be used to jump to diffs:
*[c*
[c Jump backwards to the previous start of a change.
When a count is used, do it that many times.
*]c*
]c Jump forwards to the next start of a change.
When a count is used, do it that many times.
It is an error if there is no change for the cursor to move to.
==============================================================================
4. Diff copying *copy-diffs* *E99* *E100* *E101* *E102* *E103*
There are two commands to copy text from one buffer to another. The result is
that the buffers will be equal within the specified range.
*:diffg* *:diffget*
:[range]diffg[et] [bufspec]
Modify the current buffer to undo difference with another
buffer. If [bufspec] is given, that buffer is used.
Otherwise this only works if there is one other buffer in diff
mode.
See below for [range].
*:diffpu* *:diffput*
:[range]diffpu[t] [bufspec]
Modify another buffer to undo difference with the current
buffer. Just like ":diffget" but the other buffer is modified
instead of the current one.
See below for [range].
*do*
do Same as ":diffget" without argument or range. The "o" stands
for "obtain" ("dg" can't be used, it could be the start of
"dgg"!).
*dp*
dp Same as ":diffput" without argument or range.
When no [range] is given, the diff at the cursor position or just above it is
affected. When [range] is used, Vim tries to only put or get the specified
lines. When there are deleted lines, this may not always be possible.
There can be deleted lines below the last line of the buffer. When the cursor
is on the last line in the buffer and there is no diff above this line, the
":diffget" and "do" commands will obtain lines from the other buffer.
To be able to get those lines from another buffer in a [range] it's allowed to
use the last line number plus one. This command gets all diffs from the other
buffer: >
:1,$+1diffget
Note that deleted lines are displayed, but not counted as text lines. You
can't move the cursor into them. To fill the deleted lines with the lines
from another buffer use ":diffget" on the line below them.
The [bufspec] argument above can be a buffer number, a pattern for a buffer
name or a part of a buffer name. Examples:
:diffget Use the other buffer which is in diff mode
:diffget 3 Use buffer 3
:diffget v2 Use the buffer which matches "v2" and is in
diff mode (e.g., "file.c.v2")
==============================================================================
5. Diff options *diff-options*
Also see |'diffopt'| and the "diff" item of |'fillchars'|.
FINDING THE DIFFERENCES *diff-diffexpr*
The 'diffexpr' option can be set to use something else than the standard
"diff" program to compare two files and find the differences.
When 'diffexpr' is empty, Vim uses this command to find the differences
between file1 and file2: >
diff file1 file2 > outfile
The ">" is replaced with the value of 'shellredir'.
The output of "diff" must be a normal "ed" style diff. Do NOT use a context
diff. This example explains the format that Vim expects: >
1a2
> bbb
4d4
< 111
7c7
< GGG
---
> ggg
The "1a2" item appends the line "bbb".
The "4d4" item deletes the line "111".
The '7c7" item replaces the line "GGG" with "ggg".
When 'diffexpr' is not empty, Vim evaluates to obtain a diff file in the
format mentioned. These variables are set to the file names used:
v:fname_in original file
v:fname_new new version of the same file
v:fname_out resulting diff file
Additionally, 'diffexpr' should take care of "icase" and "iwhite" in the
'diffopt' option. 'diffexpr' cannot change the value of 'lines' and
'columns'.
Example (this does almost the same as 'diffexpr' being empty): >
set diffexpr=MyDiff()
function MyDiff()
let opt = ""
if &diffopt =~ "icase"
let opt = opt . "-i "
endif
if &diffopt =~ "iwhite"
let opt = opt . "-b "
endif
silent execute "!diff -a --binary " . opt . v:fname_in . " " . v:fname_new .
\ " > " . v:fname_out
endfunction
The "-a" argument is used to force comparing the files as text, comparing as
binaries isn't useful. The "--binary" argument makes the files read in binary
mode, so that a CTRL-Z doesn't end the text on DOS.
*E97*
Vim will do a test if the diff output looks alright. If it doesn't, you will
get an error message. Possible causes:
- The "diff" program cannot be executed.
- The "diff" program doesn't produce normal "ed" style diffs (see above).
- The 'shell' and associated options are not set correctly. Try if filtering
works with a command like ":!sort".
- You are using 'diffexpr' and it doesn't work.
If it's not clear what the problem is set the 'verbose' option to see more
messages.
USING PATCHES *diff-patchexpr*
The 'patchexpr' option can be set to use something else than the standard
"patch" program.
When 'patchexpr' is empty, Vim will call the "patch" program like this: >
patch -o outfile origfile < patchfile
This should work fine with most versions of the "patch" program. Note that a
CR in the middle of a line may cause problems, it is seen as a line break.
If the default doesn't work for you, set the 'patchexpr' to an expression that
will have the same effect. These variables are set to the file names used:
v:fname_in original file
v:fname_diff patch file
v:fname_out resulting patched file
Example (this does the same as 'patchexpr' being empty): >
let patchexpr=MyPatch
function MyPatch
:call system("patch -o " . v:fname_out . " " . v:fname_in .
\ " < " . v:fname_diff)
endfunction
Make sure that using the "patch" program doesn't have unwanted side effects.
For example, watch out for additionally generated files, which should be
deleted. It should just patch the file and nothing else.
Vim will change directory to "/tmp" or another temp directory before
evaluating 'patchexpr'. This hopefully avoids that files in the current
directory are accidentally patched. Vim will also delete files starting with
v:fname_in and ending in ".rej" and ".orig".
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,322 @@
*digraph.txt* For Vim version 6.3. Last change: 2001 Sep 03
VIM REFERENCE MANUAL by Bram Moolenaar
Digraphs *digraphs* *Digraphs*
Digraphs are used to enter characters that normally cannot be entered by
an ordinary keyboard. These are mostly accented characters which have the
eighth bit set. The digraphs are easier to remember than the decimal number
that can be entered with CTRL-V (see |i_CTRL-V|).
There is a brief introduction on digraphs in the user manual: |24.9|
An alternative is using the 'keymap' option.
1. Defining digraphs |digraphs-define|
2. Using digraphs |digraphs-use|
3. Default digraphs |digraphs-default|
{Vi does not have any of these commands}
==============================================================================
1. Defining digraphs *digraphs-define*
*:dig* *:digraphs*
:dig[raphs] show currently defined digraphs.
*E104* *E39*
:dig[raphs] {char1}{char2} {number} ...
Add digraph {char1}{char2} to the list. {number} is
the decimal representation of the character.
Example: >
:digr e: 235 a: 228
< Avoid defining a digraph with '_' (underscore) as the
first character, it has a special meaning in the
future.
Vim is normally compiled with the |+digraphs| feature. If the feature is
disabled, the ":digraph" command will display an error message.
Example of the output of ":digraphs": >
TH Þ 222 ss ß 223 a! à 224 a' á 225 a> â 226 a? ã 227 a: ä 228
The first two characters in each column are the characters you have to type to
enter the digraph.
In the middle of each column is the resulting character. This may be mangled
if you look at it on a system that does not support digraphs or if you print
this file.
The decimal number is the number of the character.
==============================================================================
2. Using digraphs *digraphs-use*
There are two methods to enter digraphs: *i_digraph*
CTRL-K {char1} {char2} or
{char1} <BS> {char2}
The first is always available; the second only when the 'digraph' option is
set.
If a digraph with {char1}{char2} does not exist, Vim searches for a digraph
{char2}{char1}. This helps when you don't remember which character comes
first.
Note that when you enter CTRL-K {char1}, where {char1} is a special key, Vim
enters the code for that special key. This is not a digraph.
Once you have entered the digraph, Vim treats the character like a normal
character that occupies only one character in the file and on the screen.
Example: >
'B' <BS> 'B' will enter the broken '|' character (166)
'a' <BS> '>' will enter an 'a' with a circumflex (226)
CTRL-K '-' '-' will enter a soft hyphen (173)
The current digraphs are listed with the ":digraphs" command. Some of the
default ones are listed below |digraph-table|.
For CTRL-K, there is one general digraph: CTRL-K <Space> {char} will enter
{char} with the highest bit set. You can use this to enter meta-characters.
The <Esc> character cannot be part of a digraph. When hitting <Esc>, Vim
stops digraph entry and ends Insert mode or Command-line mode, just like
hitting an <Esc> out of digraph context. Use CTRL-V 155 to enter meta-ESC
(CSI).
If you accidentally typed an 'a' that should be an 'e', you will type 'a' <BS>
'e'. But that is a digraph, so you will not get what you want. To correct
this, you will have to type <BS> e again. To avoid this don't set the
'digraph' option and use CTRL-K to enter digraphs.
You may have problems using Vim with characters which have an ASCII value
above 128. For example: You insert ue (u-umlaut) and the editor echoes \334
in Insert mode. After leaving the Insert mode everything is fine. Note that
fmt removes all characters with ASCII codes above 128 from the text being
formatted. On some Unix systems this means you have to define the
environment-variable LC_CTYPE. If you are using csh, then put the following
line in your .cshrc: >
setenv LC_CTYPE iso_8859_1
==============================================================================
3. Default digraphs *digraphs-default*
Vim comes with a set of default digraphs. Check the output of ":digraphs" to
see them.
On most systems Vim uses the same digraphs. They work for the Unicode and
ISO-8859-1 character sets. These default digraphs are taken from the RFC1345
mnemonics. To make it easy to remember the mnemonic, the second character has
a standard meaning:
char name char meaning ~
Exclamation mark ! Grave
Apostrophe ' Acute accent
Greater-Than sign > Circumflex accent
Question Mark ? tilde
Hyphen-Minus - Macron
Left parenthesis ( Breve
Full Stop . Dot Above
Colon : Diaeresis
Comma , Cedilla
Underline _ Underline
Solidus / Stroke
Quotation mark " Double acute accent
Semicolon ; Ogonek
Less-Than sign < Caron
Zero 0 Ring above
Two 2 Hook
Nine 9 Horn
Equals = Cyrillic
Asterisk * Greek
Percent sign % Greek/Cyrillic special
Plus + smalls: Arabic, capitals: Hebrew
Three 3 some Latin/Greek/Cyrillic letters
Four 4 Bopomofo
Five 5 Hiragana
Six 6 Katakana
Example: a: is ä and o: is ö
These are the RFC1345 digraphs for the one-byte characters. See the output of
":digraphs" for the others. The characters above 255 are only available when
Vim was compiled with the |+multi_byte| feature.
*digraph-table*
char digraph hex dec official name ~
^@ NU 0x00 0 NULL (NUL)
^A SH 0x01 1 START OF HEADING (SOH)
^B SX 0x02 2 START OF TEXT (STX)
^C EX 0x03 3 END OF TEXT (ETX)
^D ET 0x04 4 END OF TRANSMISSION (EOT)
^E EQ 0x05 5 ENQUIRY (ENQ)
^F AK 0x06 6 ACKNOWLEDGE (ACK)
^G BL 0x07 7 BELL (BEL)
^H BS 0x08 8 BACKSPACE (BS)
^I HT 0x09 9 CHARACTER TABULATION (HT)
^@ LF 0x0a 10 LINE FEED (LF)
^K VT 0x0b 11 LINE TABULATION (VT)
^L FF 0x0c 12 FORM FEED (FF)
^M CR 0x0d 13 CARRIAGE RETURN (CR)
^N SO 0x0e 14 SHIFT OUT (SO)
^O SI 0x0f 15 SHIFT IN (SI)
^P DL 0x10 16 DATALINK ESCAPE (DLE)
^Q D1 0x11 17 DEVICE CONTROL ONE (DC1)
^R D2 0x12 18 DEVICE CONTROL TWO (DC2)
^S D3 0x13 19 DEVICE CONTROL THREE (DC3)
^T D4 0x14 20 DEVICE CONTROL FOUR (DC4)
^U NK 0x15 21 NEGATIVE ACKNOWLEDGE (NAK)
^V SY 0x16 22 SYNCRONOUS IDLE (SYN)
^W EB 0x17 23 END OF TRANSMISSION BLOCK (ETB)
^X CN 0x18 24 CANCEL (CAN)
^Y EM 0x19 25 END OF MEDIUM (EM)
^Z SB 0x1a 26 SUBSTITUTE (SUB)
^[ EC 0x1b 27 ESCAPE (ESC)
^\ FS 0x1c 28 FILE SEPARATOR (IS4)
^] GS 0x1d 29 GROUP SEPARATOR (IS3)
^^ RS 0x1e 30 RECORD SEPARATOR (IS2)
^_ US 0x1f 31 UNIT SEPARATOR (IS1)
SP 0x20 32 SPACE
# Nb 0x23 35 NUMBER SIGN
$ DO 0x24 36 DOLLAR SIGN
@ At 0x40 64 COMMERCIAL AT
[ <( 0x5b 91 LEFT SQUARE BRACKET
\ // 0x5c 92 REVERSE SOLIDUS
] )> 0x5d 93 RIGHT SQUARE BRACKET
^ '> 0x5e 94 CIRCUMFLEX ACCENT
` '! 0x60 96 GRAVE ACCENT
{ (! 0x7b 123 LEFT CURLY BRACKET
| !! 0x7c 124 VERTICAL LINE
} !) 0x7d 125 RIGHT CURLY BRACKET
~ '? 0x7e 126 TILDE
^? DT 0x7f 127 DELETE (DEL)
~@ PA 0x80 128 PADDING CHARACTER (PAD)
~A HO 0x81 129 HIGH OCTET PRESET (HOP)
~B BH 0x82 130 BREAK PERMITTED HERE (BPH)
~C NH 0x83 131 NO BREAK HERE (NBH)
~D IN 0x84 132 INDEX (IND)
~E NL 0x85 133 NEXT LINE (NEL)
~F SA 0x86 134 START OF SELECTED AREA (SSA)
~G ES 0x87 135 END OF SELECTED AREA (ESA)
~H HS 0x88 136 CHARACTER TABULATION SET (HTS)
~I HJ 0x89 137 CHARACTER TABULATION WITH JUSTIFICATION (HTJ)
~J VS 0x8a 138 LINE TABULATION SET (VTS)
~K PD 0x8b 139 PARTIAL LINE FORWARD (PLD)
~L PU 0x8c 140 PARTIAL LINE BACKWARD (PLU)
~M RI 0x8d 141 REVERSE LINE FEED (RI)
~N S2 0x8e 142 SINGLE-SHIFT TWO (SS2)
~O S3 0x8f 143 SINGLE-SHIFT THREE (SS3)
~P DC 0x90 144 DEVICE CONTROL STRING (DCS)
~Q P1 0x91 145 PRIVATE USE ONE (PU1)
~R P2 0x92 146 PRIVATE USE TWO (PU2)
~S TS 0x93 147 SET TRANSMIT STATE (STS)
~T CC 0x94 148 CANCEL CHARACTER (CCH)
~U MW 0x95 149 MESSAGE WAITING (MW)
~V SG 0x96 150 START OF GUARDED AREA (SPA)
~W EG 0x97 151 END OF GUARDED AREA (EPA)
~X SS 0x98 152 START OF STRING (SOS)
~Y GC 0x99 153 SINGLE GRAPHIC CHARACTER INTRODUCER (SGCI)
~Z SC 0x9a 154 SINGLE CHARACTER INTRODUCER (SCI)
~[ CI 0x9b 155 CONTROL SEQUENCE INTRODUCER (CSI)
~\ ST 0x9c 156 STRING TERMINATOR (ST)
~] OC 0x9d 157 OPERATING SYSTEM COMMAND (OSC)
~^ PM 0x9e 158 PRIVACY MESSAGE (PM)
~_ AC 0x9f 159 APPLICATION PROGRAM COMMAND (APC)
| NS 0xa0 160 NO-BREAK SPACE
¡ !I 0xa1 161 INVERTED EXCLAMATION MARK
¢ Ct 0xa2 162 CENT SIGN
£ Pd 0xa3 163 POUND SIGN
¤ Cu 0xa4 164 CURRENCY SIGN
¥ Ye 0xa5 165 YEN SIGN
¦ BB 0xa6 166 BROKEN BAR
§ SE 0xa7 167 SECTION SIGN
¨ ': 0xa8 168 DIAERESIS
© Co 0xa9 169 COPYRIGHT SIGN
ª -a 0xaa 170 FEMININE ORDINAL INDICATOR
« << 0xab 171 LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
¬ NO 0xac 172 NOT SIGN
­ -- 0xad 173 SOFT HYPHEN
® Rg 0xae 174 REGISTERED SIGN
¯ 'm 0xaf 175 MACRON
° DG 0xb0 176 DEGREE SIGN
± +- 0xb1 177 PLUS-MINUS SIGN
² 2S 0xb2 178 SUPERSCRIPT TWO
³ 3S 0xb3 179 SUPERSCRIPT THREE
´ '' 0xb4 180 ACUTE ACCENT
µ My 0xb5 181 MICRO SIGN
¶ PI 0xb6 182 PILCROW SIGN
· .M 0xb7 183 MIDDLE DOT
¸ ', 0xb8 184 CEDILLA
¹ 1S 0xb9 185 SUPERSCRIPT ONE
º -o 0xba 186 MASCULINE ORDINAL INDICATOR
» >> 0xbb 187 RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
¼ 14 0xbc 188 VULGAR FRACTION ONE QUARTER
½ 12 0xbd 189 VULGAR FRACTION ONE HALF
¾ 34 0xbe 190 VULGAR FRACTION THREE QUARTERS
¿ ?I 0xbf 191 INVERTED QUESTION MARK
À A! 0xc0 192 LATIN CAPITAL LETTER A WITH GRAVE
Á A' 0xc1 193 LATIN CAPITAL LETTER A WITH ACUTE
 A> 0xc2 194 LATIN CAPITAL LETTER A WITH CIRCUMFLEX
à A? 0xc3 195 LATIN CAPITAL LETTER A WITH TILDE
Ä A: 0xc4 196 LATIN CAPITAL LETTER A WITH DIAERESIS
Å AA 0xc5 197 LATIN CAPITAL LETTER A WITH RING ABOVE
Æ AE 0xc6 198 LATIN CAPITAL LETTER AE
Ç C, 0xc7 199 LATIN CAPITAL LETTER C WITH CEDILLA
È E! 0xc8 200 LATIN CAPITAL LETTER E WITH GRAVE
É E' 0xc9 201 LATIN CAPITAL LETTER E WITH ACUTE
Ê E> 0xca 202 LATIN CAPITAL LETTER E WITH CIRCUMFLEX
Ë E: 0xcb 203 LATIN CAPITAL LETTER E WITH DIAERESIS
Ì I! 0xcc 204 LATIN CAPITAL LETTER I WITH GRAVE
Í I' 0xcd 205 LATIN CAPITAL LETTER I WITH ACUTE
Î I> 0xce 206 LATIN CAPITAL LETTER I WITH CIRCUMFLEX
Ï I: 0xcf 207 LATIN CAPITAL LETTER I WITH DIAERESIS
Ð D- 0xd0 208 LATIN CAPITAL LETTER ETH (Icelandic)
Ñ N? 0xd1 209 LATIN CAPITAL LETTER N WITH TILDE
Ò O! 0xd2 210 LATIN CAPITAL LETTER O WITH GRAVE
Ó O' 0xd3 211 LATIN CAPITAL LETTER O WITH ACUTE
Ô O> 0xd4 212 LATIN CAPITAL LETTER O WITH CIRCUMFLEX
Õ O? 0xd5 213 LATIN CAPITAL LETTER O WITH TILDE
Ö O: 0xd6 214 LATIN CAPITAL LETTER O WITH DIAERESIS
× *X 0xd7 215 MULTIPLICATION SIGN
Ø O/ 0xd8 216 LATIN CAPITAL LETTER O WITH STROKE
Ù U! 0xd9 217 LATIN CAPITAL LETTER U WITH GRAVE
Ú U' 0xda 218 LATIN CAPITAL LETTER U WITH ACUTE
Û U> 0xdb 219 LATIN CAPITAL LETTER U WITH CIRCUMFLEX
Ü U: 0xdc 220 LATIN CAPITAL LETTER U WITH DIAERESIS
Ý Y' 0xdd 221 LATIN CAPITAL LETTER Y WITH ACUTE
Þ TH 0xde 222 LATIN CAPITAL LETTER THORN (Icelandic)
ß ss 0xdf 223 LATIN SMALL LETTER SHARP S (German)
à a! 0xe0 224 LATIN SMALL LETTER A WITH GRAVE
á a' 0xe1 225 LATIN SMALL LETTER A WITH ACUTE
â a> 0xe2 226 LATIN SMALL LETTER A WITH CIRCUMFLEX
ã a? 0xe3 227 LATIN SMALL LETTER A WITH TILDE
ä a: 0xe4 228 LATIN SMALL LETTER A WITH DIAERESIS
å aa 0xe5 229 LATIN SMALL LETTER A WITH RING ABOVE
æ ae 0xe6 230 LATIN SMALL LETTER AE
ç c, 0xe7 231 LATIN SMALL LETTER C WITH CEDILLA
è e! 0xe8 232 LATIN SMALL LETTER E WITH GRAVE
é e' 0xe9 233 LATIN SMALL LETTER E WITH ACUTE
ê e> 0xea 234 LATIN SMALL LETTER E WITH CIRCUMFLEX
ë e: 0xeb 235 LATIN SMALL LETTER E WITH DIAERESIS
ì i! 0xec 236 LATIN SMALL LETTER I WITH GRAVE
í i' 0xed 237 LATIN SMALL LETTER I WITH ACUTE
î i> 0xee 238 LATIN SMALL LETTER I WITH CIRCUMFLEX
ï i: 0xef 239 LATIN SMALL LETTER I WITH DIAERESIS
ð d- 0xf0 240 LATIN SMALL LETTER ETH (Icelandic)
ñ n? 0xf1 241 LATIN SMALL LETTER N WITH TILDE
ò o! 0xf2 242 LATIN SMALL LETTER O WITH GRAVE
ó o' 0xf3 243 LATIN SMALL LETTER O WITH ACUTE
ô o> 0xf4 244 LATIN SMALL LETTER O WITH CIRCUMFLEX
õ o? 0xf5 245 LATIN SMALL LETTER O WITH TILDE
ö o: 0xf6 246 LATIN SMALL LETTER O WITH DIAERESIS
÷ -: 0xf7 247 DIVISION SIGN
ø o/ 0xf8 248 LATIN SMALL LETTER O WITH STROKE
ù u! 0xf9 249 LATIN SMALL LETTER U WITH GRAVE
ú u' 0xfa 250 LATIN SMALL LETTER U WITH ACUTE
û u> 0xfb 251 LATIN SMALL LETTER U WITH CIRCUMFLEX
ü u: 0xfc 252 LATIN SMALL LETTER U WITH DIAERESIS
ý y' 0xfd 253 LATIN SMALL LETTER Y WITH ACUTE
þ th 0xfe 254 LATIN SMALL LETTER THORN (Icelandic)
ÿ y: 0xff 255 LATIN SMALL LETTER Y WITH DIAERESIS
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,269 @@
*farsi.txt* For Vim version 6.3. Last change: 2002 Oct 29
VIM REFERENCE MANUAL by Mortaza Ghassab Shiran
Right to Left and Farsi Mapping for Vim *farsi* *Farsi*
{Vi does not have any of these commands}
*E27*
In order to use right-to-left and Farsi mapping support, it is necessary to
compile Vim with the |+farsi| feature.
These functions have been made by Mortaza G. Shiran <shiran@jps.net>
Introduction
------------
In right-to-left oriented files the characters appear on the screen from right
to left. This kind of file is most useful when writing Farsi documents,
composing faxes or writing Farsi memos.
The commands, prompts and help files are not in Farsi, therefore the user
interface remains the standard Vi interface.
Highlights
----------
o Editing left-to-right files as in the original Vim, no change.
o Viewing and editing files in right-to-left windows. File orientation is
per window, so it is possible to view the same file in right-to-left and
left-to-right modes, simultaneously.
o Compatibility to the original Vim. Almost all features work in
right-to-left mode (see bugs below).
o Changing keyboard mapping and reverse insert modes using a single
command.
o Backing from reverse insert mode to the correct place in the file
(if possible).
o While in Farsi mode, numbers are entered from left to right. Upon entering
a none number character, that character will be inserted just into the
left of the last number.
o No special terminal with right-to-left capabilities is required. The
right-to-left changes are completely hardware independent. Only
Farsi font is necessary.
o Farsi keymapping on the command line in reverse insert mode.
o Toggling between left-to-right and right-to-left via F8 function key.
o Toggling between Farsi ISIR-3342 standard encoding and VIM Farsi via F9
function key. Since this makes sense only for the text written in
right-to-left mode, this function is also supported only in right-to-left
mode.
Farsi Fonts *farsi fonts*
-----------
If the "extra" archive has been unpacked, the following files are found in the
subdirectories of the '$VIM/farsi' directory:
+ far-a01.pcf X Windows fonts for Unix including Linux systems
+ far-a01.bf X Windows fonts for SunOs
+ far-a01.f16 a screen fonts for Unix including Linux systems
+ far-a01.fon a monospaced fonts for Windows NT/95/98
+ far-a01.com a screen fonts for DOS
Font Installation
-----------------
o Installation of fonts for MS Window systems (NT/95/98)
From 'Control Panel' folder, start the 'Fonts' program. Then from 'file'
menu item select 'Install New Fonts ...'. Browse and select the
'far-a01.fon', then follow the installation guide.
NOTE: several people have reported that this does not work. The solution
is unknown.
o Installation of fonts for X Window systems (Unix/Linux)
Depending on your system, copy far-a01.pcf.Z or far-a01.pcf.gz into a
directory of your choice. Change to the directory containing the Farsi
fonts and execute the following commands:
> mkfontdir
> xset +fp path_name_of_farsi_fonts_directory
o Installation of fonts for X Window systems (SunOs)
Copy far-a01.bf font into a directory of your choice.
Change to the directory containing the far-a01.fb fonts and
execute the following commands:
> fldfamily
> xset +fp path_name_of_fonts_directory
o Installation of ASCII screen fonts (Unix/Linux)
For Linux system, copy the far-a01.f16 fonts into /usr/lib/kbd/consolefonts
directory and execute the setfont program as "setfont far-a01.f16". For
other systems (e.g. SCO Unix), please refer to the fonts installation
section of your system administration manuals.
o Installation of ASCII screen fonts (DOS)
After system power on, prior to the first use of VIM, upload the Farsi
fonts by executing the far-a01.com font uploading program.
Usage
-----
Prior to starting VIM, the environment in which VIM can run in Farsi mode,
must be set. In addition to installation of Farsi fonts, following points
refer to some of the system environments, which you may need to set:
Key code mapping, loading graphic card in ASCII screen mode, setting the IO
driver in 8 bit clean mode ... .
o Setting the Farsi fonts
+ For VIM GUI set the 'guifont' to far-a01. This is done by entering
':set guifont=far-a01' in the VIM window.
You can have 'guifont' set to far-a01 by VIM during the VIM startup
by appending the ':set guifont=far-a01' into your .vimrc file
(in case of NT/95/98 platforms _vimrc).
Under the X Window environment, you can also start the VIM with
'-fn far-a01' option.
+ For the VIM within a xterm, start a xterm with the Farsi fonts (e.g.
kterm -fn far-a01). Then start the VIM inside the kterm.
+ For VIM under DOS, prior to the first usage of VIM, upload the Farsi
fonts by executing the far-a01.com fonts uploading program.
o Farsi Keymapping Activation
To activate the Farsi keymapping, set either 'altkeymap' or 'fkmap'.
This is done by entering ':set akm' or ':set fk' in the VIM window.
You can have 'altkeymap' or 'fkmap' set as default by appending ':set akm'
or ':set fk' in your .vimrc file or _vimrc in case of NT/95/98 platforms.
To turn off the Farsi keymapping as a default second language keymapping,
reset the 'altkeymap' by entering ':set noakm'.
o right-to-left Farsi Mode
By default VIM starts in Left-to-right mode. Following are ways to change
the window orientation:
+ Start the VIM with -F option (e.g. vim -F ... ).
+ Use F8 function key to toggle between left-to-right and right-to-left.
+ While in Left-to-right mode, enter 'set rl' in the command line ('rl' is
the abbreviation for rightleft).
+ Put the 'set rl' line in your '.vimrc' file to start the VIM in
right-to-left mode permanently.
Encoding
--------
The letter encoding used is the VIM extended ISIR-3342 standard with a built
in function to convert between VIM extended ISIR-3342 and ISIR-3342 standard.
For document portability reasons, the letter encoding is kept the same across
different platforms (i.e. UNIX's, NT/95/98, MS DOS, ...).
o Keyboard
+ CTRL-_ in insert/replace modes toggles between Farsi(akm)/Latin
mode as follows:
+ CTRL-_ moves the cursor to the end of the typed text in edit mode.
+ CTRL-_ in command mode only toggles keyboard mapping between Farsi(akm)/
Latin. The Farsi text is then entered in reverse insert mode.
+ F8 - Toggles between left-to-right and right-to-left.
+ F9 - Toggles the encoding between ISIR-3342 standard and VIM extended
ISIR-3342 (supported only in right-to-left mode).
+ Keyboard mapping is based on the Iranian ISIRI-2901 standard.
Following table shows the keyboard mapping while Farsi(akm) mode set:
-------------------------------------
` 1 2 3 4 5 6 7 8 9 0 - =
¢ ± ² ³ ´ µ ¶ · ¸ ¹ ° ­ ½
-------------------------------------
~ ! @ # $ % ^ & * ( ) _ +
~ £ § ® ¤ ¥ ª ¬ è ¨ © é «
-------------------------------------
q w e r t z u i o p [ ]
Ó Ò Æ Ù Ø Õ Ö à Ê É Ç ˆ
-------------------------------------
Q W E R T Z U I O P { }
÷ õ ô ó ò ý ð ö [ ] { }
-------------------------------------
a s d f g h j k l ; ' \
Ñ Ð á Ã Ü Á Å Þ Ý Ú Û ë
-------------------------------------
A S D F G H J K L : " |
ù û  þ ú ø À ü æ ç º » ê
-------------------------------------
< y x c v b n m , . /
¾ × Ô Î Í Ì Ë Ä ß ¦ ¯
-------------------------------------
> Y X C V B N M < > ?
¼ ñ Ô Ï Í ¡ Ë Â ¾ ¼ ¿
-------------------------------------
Note:
¡ stands for Farsi PSP (break without space)
¢ stands for Farsi PCN (for HAMZE attribute )
Restrictions
------------
o In insert/replace mode and fkmap (Farsi mode) set, CTRL-B is not
supported.
o If you change the character mapping between Latin/Farsi, the redo buffer
will be reset (emptied). That is, redo is valid and will function (using
'.') only within the mode you are in.
o While numbers are entered in Farsi mode, the redo buffer will be reset
(emptied). That is, you can not redo the last changes (using '.') after
entering numbers.
o While in left-to-right and Farsi mode set, CTRL-R is not supported.
o While in right-to-left mode, the search on 'Latin' pattern does not work,
except if you enter the Latin search pattern in reverse.
o In the command mode, there is no support for entering the numbers from left
to right and also for the sake of the flexibility the keymapping logic is
restricted.
o Under X Window environment, if you want to run the VIM within a xterm
terminal emulator and Farsi mode set, you need to have an ANSI compatible
xterm terminal emulator. This is because the letter codes above 128 decimal
have certain meanings in the standard xterm terminal emulator.
Note: Under X Window environment, VIM GUI works fine in Farsi mode.
This eliminates the need of any xterm terminal emulator.
Bugs
----
While in insert/replace and Farsi mode set, if you repeatedly change the
cursor position (via cursor movement) and enter new text and then try to undo
the last change, the undo will lag one change behind. But as you continue to
undo, you will reach the original line of text. You can also use U to undo all
changes made in the current line.
For more information about the bugs refer to rileft.txt.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,529 @@
*filetype.txt* For Vim version 6.3. Last change: 2004 May 05
VIM REFERENCE MANUAL by Bram Moolenaar
Filetypes *filetype* *file-type*
1. Filetypes |filetypes|
2. Filetype plugin |filetype-plugins|
3. Docs for the default filetype plugins. |ftplugin-docs|
Also see |autocmd.txt|.
{Vi does not have any of these commands}
==============================================================================
1. Filetypes *filetypes* *file-types*
Vim can detect the type of file that is edited. This is done by checking the
file name and sometimes by inspecting the contents of the file for specific
text.
*:filetype* *:filet*
To enable file type detection, use this command in your vimrc: >
:filetype on
Each time a new or existing file is edited, Vim will try to recognize the type
of the file and set the 'filetype' option. This will trigger the FileType
event, which can be used to set the syntax highlighting, set options, etc.
NOTE: Filetypes and 'compatible' don't work together well, since being Vi
compatible means options are global. Resetting 'compatible' is recommended,
if you didn't do that already.
Detail: The ":filetype on" command will load one of these files:
Amiga $VIMRUNTIME/filetype.vim
Mac $VIMRUNTIME:filetype.vim
MS-DOS $VIMRUNTIME\filetype.vim
RiscOS Vim:Filetype
Unix $VIMRUNTIME/filetype.vim
VMS $VIMRUNTIME/filetype.vim
This file is a Vim script that defines autocommands for the
BufNewFile and BufRead events. If the file type is not found by the
name, the file $VIMRUNTIME/scripts.vim is used to detect it from the
contents of the file.
To add your own file types, see |new-filetype| below.
If the file type is not detected automatically, or it finds the wrong type,
you can either set the 'filetype' option manually, or add a modeline to your
file. Example, for in an IDL file use the command: >
:set filetype=idl
or add this |modeline| to the file: >
/* vim: set filetype=idl : */
<
*:filetype-plugin-on*
You can enable loading the plugin files for specific file types with: >
:filetype plugin on
If filetype detection was not switched on yet, it will be as well.
This actually loads the file "ftplugin.vim" in 'runtimepath'.
The result is that when a file is edited its plugin file is loaded (if there
is one for the detected filetype). |filetype-plugin|
*:filetype-plugin-off*
You can disable it again with: >
:filetype plugin off
The filetype detection is not switched off then. But if you do switch off
filetype detection, the plugins will not be loaded either.
This actually loads the file "ftplugof.vim" in 'runtimepath'.
*:filetype-indent-on*
You can enable loading the indent file for specific file types with: >
:filetype indent on
If filetype detection was not switched on yet, it will be as well.
This actually loads the file "indent.vim" in 'runtimepath'.
The result is that when a file is edited its indent file is loaded (if there
is one for the detected filetype). |indent-expression|
*:filetype-indent-off*
You can disable it again with: >
:filetype indent off
The filetype detection is not switched off then. But if you do switch off
filetype detection, the indent files will not be loaded either.
This actually loads the file "indoff.vim" in 'runtimepath'.
*:filetype-off*
To disable file type detection, use this command: >
:filetype off
This will keep the flags for "plugin" and "indent", but since no file types
are being detected, they won't work until the next ":filetype on".
Overview: *:filetype-overview*
command detection plugin indent ~
:filetype on on unchanged unchanged
:filetype off off unchanged unchanged
:filetype plugin on on on unchanged
:filetype plugin off unchanged off unchanged
:filetype indent on on unchanged on
:filetype indent off unchanged unchanged off
:filetype plugin indent on on on on
:filetype plugin indent off unchanged off off
To see the current status, type: >
:filetype
The output looks something like this: >
filetype detection:ON plugin:ON indent:OFF
The file types are also used for syntax highlighting. If the ":syntax on"
command is used, the file type detection is installed too. There is no need
to do ":filetype on" after ":syntax on".
To disable one of the file types, add a line in the your filetype file, see
|remove-filetype|.
*filetype-detect*
To detect the file type again: >
:filetype detect
Use this if you started with an empty file and typed text that makes it
possible to detect the file type. For example, when you entered this in a
shell script: "#!/bin/csh".
When filetype detection was off, it will be enabled first, like the "on"
argument was used.
*filetype-overrule*
When the same extension is used for two filetypes, Vim tries to guess what
kind of file it is. This doesn't always work. A number of global variables
can be used to overrule the filetype used for certain extensions:
file name variable ~
*.asa g:filetype_asa |aspvbs-syntax| |aspperl-syntax|
*.asp g:filetype_asp |aspvbs-syntax| |aspperl-syntax|
*.asm g:asmsyntax |asm-syntax|
*.prg g:filetype_prg
*.pl g:filetype_pl
*.inc g:filetype_inc
*.w g:filetype_w |cweb-syntax|
*.i g:filetype_i |progress-syntax|
*.p g:filetype_p |pascal-syntax|
*.sh g:bash_is_sh |sh-syntax|
*filetype-ignore*
To avoid that certain files are being inspected, the g:ft_ignore_pat variable
is used. The default value is set like this: >
:let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'
This means that the contents of compressed files are not inspected.
*new-filetype*
If a file type that you want to use is not detected yet, there are three ways
to add it. In any way, it's better not modify the $VIMRUNTIME/filetype.vim
file. It will be overwritten when installing a new version of Vim.
A. If you want to overrule all default file type checks.
This works by writing one file for each filetype. The disadvantage is that
means there can be many files. The advantage is that you can simply drop
this file in the right directory to make it work.
1. Create your user runtime directory. You would normally use the first
item of the 'runtimepath' option. Then create the directory "ftdetect"
inside it. Example for Unix: >
:!mkdir ~/.vim
:!mkdir ~/.vim/ftdetect
<
2. Create a file that contains an autocommand to detect the file type.
Example: >
au BufRead,BufNewFile *.mine set filetype=mine
< Note that there is no "augroup" command, this has already been done
when sourcing your file. You could also use the pattern "*" and then
check the contents of the file to recognize it.
Write this file as "mine.vim" in the "ftdetect" directory in your user
runtime directory. For example, for Unix: >
:w ~/.vim/ftdetect/mine.vim
< 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.
B. If you want to detect your file after the default file type checks.
This works like A above, but instead of setting 'filetype' unconditionally
use ":setfiletype". This will only set 'filetype' if no file type was
detected yet. Example: >
au BufRead,BufNewFile *.txt setfiletype text
<
You can also use the already detected file type in your command. For
example, to use the file type "mypascal" when "pascal" has been detected: >
au BufRead,BufNewFile * if &ft == 'pascal' | set ft=mypascal
| endif
C. If your file type can be detected by the file name.
1. Create your user runtime directory. You would normally use the first
item of the 'runtimepath' option. Example for Unix: >
:!mkdir ~/.vim
<
2. Create a file that contains autocommands to detect the file type.
Example: >
" my filetype file
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
au! BufRead,BufNewFile *.mine setfiletype mine
au! BufRead,BufNewFile *.xyz setfiletype drawing
augroup END
< Write this file as "filetype.vim" in your user runtime directory. For
example, for Unix: >
:w ~/.vim/filetype.vim
< 3. To use the new filetype detection you must restart Vim.
Your filetype.vim will be sourced before the default FileType autocommands
have been installed. Your autocommands will match first, and the
":setfiletype" command will make sure that no other autocommands will set
'filetype' after this.
*new-filetype-scripts*
D. If your filetype can only be detected by inspecting the contents of the
file.
1. Create your user runtime directory. You would normally use the first
item of the 'runtimepath' option. Example for Unix: >
:!mkdir ~/.vim
<
2. Create a vim script file for doing this. Example: >
if did_filetype() " filetype already set..
finish " ..don't do these checks
endif
if getline(1) =~ '^#!.*\<mine\>'
setfiletype mine
elseif getline(1) =~? '\<drawing\>'
setfiletype drawing
endif
< See $VIMRUNTIME/scripts.vim for more examples.
Write this file as "scripts.vim" in your user runtime directory. For
example, for Unix: >
:w ~/.vim/scripts.vim
<
3. The detection will work right away, no need to restart Vim.
Your scripts.vim is loaded before the default checks for file types, which
means that your rules override the default rules in
$VIMRUNTIME/scripts.vim.
*remove-filetype*
If a file type is detected that is wrong for you, install a filetype.vim or
scripts.vim to catch it (see above). You can set 'filetype' to a non-existing
name to avoid that it will be set later anyway: >
:set filetype=ignored
If you are setting up a system with many users, and you don't want each user
to add/remove the same filetypes, consider writing the filetype.vim and
scripts.vim files in a runtime directory that is used for everybody. Check
the 'runtimepath' for a directory to use. If there isn't one, set
'runtimepath' in the |system-vimrc|. Be careful to keep the default
directories!
*autocmd-osfiletypes*
On operating systems which support storing a file type with the file, you can
specify that an autocommand should only be executed if the file is of a
certain type.
The actual type checking depends on which platform you are running Vim
on; see your system's documentation for details.
To use osfiletype checking in an autocommand you should put a list of types to
match in angle brackets in place of a pattern, like this: >
:au BufRead *.html,<&faf;HTML> runtime! syntax/html.vim
This will match:
- Any file whose name ends in `.html'
- Any file whose type is `&faf' or 'HTML', where the meaning of these types
depends on which version of Vim you are using.
Unknown types are considered NOT to match.
You can also specify a type and a pattern at the same time (in which case they
must both match): >
:au BufRead <&fff>diff*
This will match files of type `&fff' whose names start with `diff'.
Note that osfiletype checking is skipped if Vim is compiled without the
|+osfiletype| feature.
*plugin-details*
The "plugin" directory can be in any of the directories in the 'runtimepath'
option. All of these directories will be searched for plugins and they are
all loaded. For example, if this command: >
set runtimepath
produces this output: >
runtimepath=/etc/vim,~/.vim,/usr/local/share/vim/vim60
then Vim will load all plugins in these directories: >
/etc/vim/plugin/
~/.vim/plugin/
/usr/local/share/vim/vim60/plugin/
Note that the last one is the value of $VIMRUNTIME which has been expanded.
What if it looks like your plugin is not being loaded? You can find out what
happens when Vim starts up by using the |-V| argument: >
vim -V1
You will see a lot of messages, in between them is a remark about loading the
plugins. It starts with: >
Searching for "plugin/*.vim" in
There you can see where Vim looks for your plugin scripts.
==============================================================================
2. Filetype plugin *filetype-plugins*
When loading filetype plugins has been enabled |:filetype-plugin-on|, options
will be set and mappings defined. These are all local to the buffer, they
will not be used for other files.
Defining mappings for a filetype may get in the way of the mappings you
define yourself. There are a few ways to avoid this:
1. Set the "maplocalleader" variable to the key sequence you want the mappings
to start with. Example: >
:let maplocalleader = ","
< All mappings will then start with a comma instead of the default, which
is a backslash. Also see |<LocalLeader>|.
2. Define your own mapping. Example: >
:map ,p <Plug>MailQuote
< You need to check the description of the plugin file below for the
functionality it offers and the string to map to.
You need to define your own mapping before the plugin is loaded (before
editing a file of that type). The plugin will then skip installing the
default mapping.
3. Disable defining mappings for a specific filetype by setting a variable,
which contains the name of the filetype. For the "mail" filetype this
would be: >
:let no_mail_maps = 1
4. Disable defining mappings for all filetypes by setting a variable: >
:let no_plugin_maps = 1
<
*ftplugin-overrule*
If a global filetype plugin does not do exactly what you want, there are three
ways to change this:
1. Add a few settings.
You must create a new filetype plugin in a directory early in
'runtimepath'. For Unix, for example you could use this file: >
vim ~/.vim/ftplugin/fortran.vim
< You can set those settings and mappings that you would like to add. Note
that the global plugin will be loaded after this, it may overrule the
settings that you do here. If this is the case, you need to use one of the
following two methods.
2. Make a copy of the plugin and change it.
You must put the copy in a directory early in 'runtimepath'. For Unix, for
example, you could do this: >
cp $VIMRUNTIME/ftplugin/fortran.vim ~/.vim/ftplugin/fortran.vim
< Then you can edit the copied file to your liking. Since the b:did_ftplugin
variable will be set, the global plugin will not be loaded.
A disadvantage of this method is that when the distributed plugin gets
improved, you will have to copy and modify it again.
3. Overrule the settings after loading the global plugin.
You must create a new filetype plugin in a directory from the end of
'runtimepath'. For Unix, for example, you could use this file: >
vim ~/.vim/after/ftplugin/fortran.vim
< In this file you can change just those settings that you want to change.
==============================================================================
3. Docs for the default filetype plugins. *ftplugin-docs*
CHANGELOG *changelog-plugin*
Allows for easy entrance of Changelog entries in Changelog files. There are
some commands, mappings, and variables worth exploring:
Options:
'comments' is made empty to not mess up formatting.
'textwidth' is set to 78, which is standard.
'formatoptions' the 't' flag is added to wrap when inserting text.
Commands:
NewChangelogEntry Adds a new Changelog entry in an intelligent fashion
(see below).
Local mappings:
<Leader>o Starts a new Changelog entry in an equally intelligent
fashion (see below).
Global mappings:
NOTE: The global mappings are accessed by sourcing the
ftplugin/changelog.vim file first, e.g. with >
runtime ftplugin/man.vim
< in your |.vimrc|.
<Leader>o Switches to the ChangeLog buffer opened for the
current directory, or opens it in a new buffer if it
exists in the current directory. Then it does the
same as the local <Leader>o described above.
Variables:
g:changelog_timeformat The date (and time) format used in ChangeLog entries.
The format accepted is the same as for the
|strftime()| function.
The default is "%Y-%m-%d" which is the standard format
for many ChangeLog layouts.
g:changelog_username The name and email address of the user.
The default is deduced from environment variables and
system files. It searches /etc/passwd for the comment
part of the current user, which informally contains
the real name of the user up to the first separating
comma. then it checks the $NAME environment variable
and finally runs `whoami` and `hostname` to build an
email address. The final form is >
Full Name <user@host>
<
g:changelog_new_date_format
The format to use when creating a new date-entry.
The following table describes special tokens in the
string:
%% insert a single '%' character
%d insert the date from above
%u insert the user from above
%c where to position cursor when done
The default is "%d %u\n\n\t* %c\n\n", which produces
something like (| is where cursor will be, unless at
the start of the line where it denotes the beginning
of the line) >
|2003-01-14 Full Name <user@host>
|
| * |
<
g:changelog_new_entry_format
The format used when creating a new entry.
The following table describes special tokens in the
string:
%c where to position cursor when done
The default is "\t*%c", which produces something
similar to >
| * |
<
g:changelog_date_entry_search
The search pattern to use when searching for a
date-entry.
The same tokens that can be used for
g:changelog_new_date_format can be used here as well.
The default is '^\s*%d\_s*%u' which finds lines
matching the form >
|2003-01-14 Full Name <user@host>
< and some similar formats.
The Changelog entries are inserted where they add the least amount of text.
After figuring out the current date and user, the file is searched for an
entry beginning with the current date and user and if found adds another item
under it. If not found, a new entry and item is prepended to the beginning of
the Changelog.
FORTRAN *fortran-plugin*
Options:
'expandtab' is switched on to avoid tabs as required by the Fortran
standards unless the user has set fortran_have_tabs in .vimrc.
'textwidth' is set to 72 for fixed source format as required by the
Fortran standards and to 80 for free source format.
'formatoptions' is set to break code and comment lines and to preserve long
lines. You can format comments with |gq|.
For further discussion of fortran_have_tabs and the method used for the
detection of source format see |fortran-syntax|.
MAIL *mail-plugin*
Options:
'modeline' is switched off to avoid the danger of trojan horses, and to
avoid that a Subject line with "Vim:" in it will cause an
error message.
'textwidth' is set to 72. This is often recommended for e-mail.
'formatoptions' is set to break text lines and to repeat the comment leader
in new lines, so that a leading ">" for quotes is repeated.
You can also format quoted text with |gq|.
Local mappings:
<LocalLeader>q or \\MailQuote
Quotes the text selected in Visual mode, or from the cursor position
to the end of the file in Normal mode. This means "> " is inserted in
each line.
MAN *man-plugin* *:Man*
Displays a manual page in a nice way. Also see the user manual
|find-manpage|.
To start using the ":Man" command before any manual page was loaded, source
this script from your startup vimrc file: >
runtime ftplugin/man.vim
Options:
'iskeyword' the '.' character is added to be able to use CTRL-] on the
manual page name.
Commands:
Man {name} Display the manual page for {name} in a window.
Man {number} {name}
Display the manual page for {name} in a section {number}.
Global mapping:
<Leader>K Displays the manual page for the word under the cursor.
Local mappings:
CTRL-] Jump to the manual page for the word under the cursor.
CTRL-T Jump back to the previous manual page.
RPM SPEC *spec-plugin*
Since the text for this plugin is rather long it has been put in a separate
file: |pi_spec.txt|.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,581 @@
*fold.txt* For Vim version 6.3. Last change: 2004 May 20
VIM REFERENCE MANUAL by Bram Moolenaar
Folding *Folding* *folding*
You can find an introduction on folding in chapter 28 of the user manual.
|usr_28.txt|
1. Fold methods |fold-methods|
2. Fold commands |fold-commands|
3. Fold options |fold-options|
4. Behavior of folds |fold-behavior|
{Vi has no Folding}
{not available when compiled without the +folding feature}
==============================================================================
1. Fold methods *fold-methods*
The folding method can be set with the 'foldmethod' option.
When setting 'foldmethod' to a value other than "manual", all folds are
deleted and new ones created. Switching to the "manual" method doesn't remove
the existing folds. This can be used to first define the folds automatically
and then change them manually.
There are six methods to select folds:
manual manually define folds
indent more indent means a higher fold level
expr specify an expression to define folds
syntax folds defined by syntax highlighting
diff folds for unchanged text
marker folds defined by markers in the text
MANUAL *fold-manual*
Use commands to manually define the fold regions. This can also be used by a
script that parses text to find folds.
The level of a fold is only defined by its nesting. To increase the fold
level of a fold for a range of lines, define a fold inside it that has the
same lines.
The manual folds are lost when you abandon the file. To save the folds use
the |:mkview| command. The view can be restored later with |:loadview|.
INDENT *fold-indent*
The folds are automatically defined by the indent of the lines.
The foldlevel is computed from the indent of the line, divided by the
'shiftwidth' (rounded down). A sequence of lines with the same or higher fold
level form a fold, with the lines with a higher level forming a nested fold.
The nesting of folds is limited with 'foldnestmax'.
Some lines are ignored and get the fold level of the line above or below it,
whatever is the lowest. These are empty or white lines and lines starting
with a character in 'foldignore'. White space is skipped before checking for
characters in 'foldignore'. For C use "#" to ignore preprocessor lines.
When you want to ignore lines in another way, use the 'expr' method. The
|indent()| function can be used in 'foldexpr' to get the indent of a line.
EXPR *fold-expr*
The folds are automatically defined by their foldlevel, like with the "indent"
method. The value of the 'foldexpr' option is evaluated to get the foldlevel
of a line. Examples:
This will create a fold for all consecutive lines that start with a Tab: >
:set foldexpr=getline(v:lnum)[0]==\"\\t\"
This will call a function to compute the fold level: >
:set foldexpr=MyFoldLevel(v:lnum)
This will make a fold out of paragraphs separated by blank lines: >
:set foldexpr=getline(v:lnum)=~'^\\s*$'&&getline(v:lnum+1)=~'\\S'?'<1':1
this does the same: >
:set foldexpr=getline(v:lnum-1)=~'^\\s*$'&&getline(v:lnum)=~'\\S'?'>1':1
Note that backslashes must be used to escape characters that ":set" handles
differently (space, backslash, double quote, etc., see |option-backslash|).
These are the conditions with which the expression is evaluated:
- The current buffer and window are set for the line.
- The variable "v:lnum" is set to the line number.
- The result is used for the fold level in this way:
value meaning ~
0 the line is not in a fold
1, 2, .. the line is in a fold with this level
-1 the fold level is undefined, use the fold level of a
line before or after this line, whichever is the
lowest.
"=" use fold level from the previous line
"a1", "a2", .. add one, two, .. to the fold level of the previous
line
"s1", "s2", .. subtract one, two, .. from the fold level of the
previous line
"<1", "<2", .. a fold with this level ends at this line
">1", ">2", .. a fold with this level starts at this line
It is not required to mark the start (end) of a fold with ">1" ("<1"), a fold
will also start (end) when the fold level is higher (lower) than the fold
level of the previous line.
There must be no side effects from the expression. The text in the buffer,
cursor position, the search patterns, options etc. must not be changed.
If there is some error in the expression, or the resulting value isn't
recognized, there is no error message and the fold level will be zero.
For debugging the 'debug' option can be set to "msg", the error messages will
be visible then.
Note: Since the expression has to be evaluated for every line, this fold
method can be very slow!
Try to avoid the "=", "a" and "s" return values, since Vim often has to search
backwards for a line for which the fold level is defined. This can be slow.
|foldlevel()| can be useful to compute a fold level relative to a previous
fold level. But note that foldlevel() may return -1 if the level is not known
yet. And it returns the level at the start of the line, while a fold might
end in that line.
SYNTAX *fold-syntax*
A fold is defined by syntax items that have the "fold" argument. |:syn-fold|
The fold level is defined by nesting folds. The nesting of folds is limited
with 'foldnestmax'.
Be careful to specify proper syntax syncing. If this is not done right, folds
may differ from the displayed highlighting. This is especially relevant when
using patterns that match more than one line. In case of doubt, try using
brute-force syncing: >
:syn sync fromstart
DIFF *fold-diff*
The folds are automatically defined for text that is not part of a change or
close to a change.
This method only works properly when the 'diff' option is set for the current
window and changes are being displayed. Otherwise the whole buffer will be
one big fold.
The 'diffopt' option can be used to specify the context. That is, the number
of lines between the fold and a change that are not included in the fold. For
example, to use a context of 8 lines: >
:set diffopt=filler,context:8
The default context is six lines.
When 'scrollbind' is also set, Vim will attempt to keep the same folds open in
other diff windows, so that the same text is visible.
MARKER *fold-marker*
Markers in the text tell where folds start and end. This allows you to
precisely specify the folds. This will allow deleting and putting a fold,
without the risk of including the wrong lines. The 'foldtext' option is
normally set such that the text before the marker shows up in the folded line.
This makes it possible to give a name to the fold.
Markers can have a level included, or can use matching pairs. Including a
level is easier, you don't have to add end markers and avoid problems with
non-matching marker pairs. Example: >
/* global variables {{{1 */
int varA, varB;
/* functions {{{1 */
/* funcA() {{{2 */
void funcA() {}
/* funcB() {{{2 */
void funcB() {}
A fold starts at a "{{{" marker. The following number specifies the fold
level. What happens depends on the difference between the current fold level
and the level given by the marker:
1. If a marker with the same fold level is encountered, the previous fold
ends and another fold with the same level starts.
2. If a marker with a higher fold level is found, a nested fold is started.
3. if a marker with a lower fold level is found, all folds up to and including
this level end and a fold with the specified level starts.
The number indicates the fold level. A zero cannot be used.
You can use "}}}" with a digit to indicate the level of the fold that
ends. The fold level of the following line will be one less than the
indicated level. Note that Vim doesn't look back to the level of the matching
marker (that would take too much time). Example: >
{{{1
fold level here is 1
{{{3
fold level here is 3
}}}3
fold level here is 2
You can also use matching pairs of "{{{" and "}}}" markers to define folds.
Each "{{{" increases the fold level by one, each "}}}" decreases the fold
level by one. Be careful to keep the markers matching! Example: >
{{{
fold level here is 1
{{{
fold level here is 2
}}}
fold level here is 1
You can mix using markers with a number and without a number. A useful way of
doing this is to use numbered markers for large folds, and unnumbered markers
locally in a function. For example use level one folds for the sections of
your file like "structure definitions", "local variables" and "functions".
Use level 2 markers for each definition and function, Use unnumbered markers
inside functions. When you make changes in a function to split up folds, you
don't have to renumber the markers.
The markers can be set with the 'foldmarker' option. It is recommended to
keep this at the default value of "{{{,}}}", so that files can be exchanged
between Vim users. Only change it when it is required for the file (e.g., it
contains markers from another folding editor, or the default markers cause
trouble for the language of the file).
*fold-create-marker*
"zf" can be used to create a fold defined by markers. Vim will insert the
markers for you. Vim will append the start and end marker, as specified with
'foldmarker'. The markers are appended to the end of the line.
'commentstring' is used if it isn't empty.
This does not work properly when:
- The line already contains a marker with a level number. Vim then doesn't
know what to do.
- Folds nearby use a level number in their marker which gets in the way.
- The line is inside a comment, 'commentstring' isn't empty and nested
comments don't work. For example with C: adding /* {{{ */ inside a comment
will truncate the existing comment. Either put the marker before or after
the comment, or add the marker manually.
Generally it's not a good idea to let Vim create markers when you already have
markers with a level number.
*fold-delete-marker*
"zd" can be used to delete a fold defined by markers. Vim will delete the
markers for you. Vim will search for the start and end markers, as specified
with 'foldmarker', at the start and end of the fold. When the text around the
marker matches with 'commentstring', that text is deleted as well.
This does not work properly when:
- A line contains more than one marker and one of them specifies a level.
Only the first one is removed, without checking if this will have the
desired effect of deleting the fold.
- The marker contains a level number and is used to start or end several folds
at the same time.
==============================================================================
2. Fold commands *fold-commands* *E490*
All folding commands start with "z". Hint: the "z" looks like a folded piece
of paper, if you look at it from the side.
CREATING AND DELETING FOLDS ~
*zf* *E350*
zf{motion} or
{Visual}zf Operator to create a fold.
This only works when 'foldmethod' is "manual" or "marker".
The new fold will be closed for the "manual" method.
'foldenable' will be set.
Also see |fold-create-marker|.
*zF*
zF Create a fold for N lines. Works like "zf".
:{range}fo[ld] *:fold* *:fo*
Create a fold for the lines in {range}. Works like "zf".
*zd* *E351*
zd Delete one fold at the cursor. When the cursor is on folded
line, that fold is deleted. Nested folds are moved one level
up. In Visual mode all folds (partially) in the selected area
are deleted. Careful: This easily deletes more folds than you
expect and there is no undo.
This only works when 'foldmethod' is "manual" or "marker".
Also see |fold-delete-marker|.
*zD*
zD Delete folds recursively at the cursor. In Visual mode all
folds (partially) in the selected area and all nested folds in
them are deleted.
This only works when 'foldmethod' is "manual" or "marker".
Also see |fold-delete-marker|.
*zE* *E352*
zE Eliminate all folds in the window.
This only works when 'foldmethod' is "manual" or "marker".
Also see |fold-delete-marker|.
OPENING AND CLOSING FOLDS ~
A fold smaller than 'foldminlines' will always be displayed like it was open.
Therefore the commands below may work differently on small folds.
*zo*
zo Open one fold under the cursor. When a count is given, that
many folds deep will be opened. In Visual mode one level of
folds is opened for all lines in the selected area.
*zO*
zO Open all folds under the cursor recursively. Folds that don't
contain the cursor line are unchanged.
In Visual mode it opens all folds that are in the selected
area, also those that are only partly selected.
*zc*
zc Close one fold under the cursor. When a count is given, that
many folds deep are closed. In Visual mode one level of folds
is closed for all lines in the selected area.
'foldenable' will be set.
*zC*
zC Close all folds under the cursor recursively. Folds that
don't contain the cursor line are unchanged.
In Visual mode it closes all folds that are in the selected
area, also those that are only partly selected.
'foldenable' will be set.
*za*
za When on a closed fold: open it. When folds are nested, you
may have to use "za" several times. When a count is given,
that many closed folds are opened.
When on an open fold: close it and set 'foldenable'. This
will only close one level, since using "za" again will open
the fold. When a count is given that many folds will be
closed (that's not the same as repeating "za" that many
times).
*zA*
zA When on a closed fold: open it recursively.
When on an open fold: close it recursively and set
'foldenable'.
*zv*
zv View cursor line: Open just enough folds to make the line in
which the cursor is located not folded.
*zx*
zx Update folds: Undo manually opened and closed folds: re-apply
'foldlevel', then do "zv": View cursor line.
*zX*
zX Undo manually opened and closed folds: re-apply 'foldlevel'.
*zm*
zm Fold more: Subtract one from 'foldlevel'. If 'foldlevel' was
already zero nothing happens.
'foldenable' will be set.
*zM*
zM Close all folds: set 'foldlevel' to 0.
'foldenable' will be set.
*zr*
zr Reduce folding: Add one to 'foldlevel'.
*zR*
zR Open all folds. This sets 'foldlevel' to highest fold level.
*:foldo* *:foldopen*
:{range}foldo[pen][!]
Open folds in {range}. When [!] is added all folds are
opened. Useful to see all the text in {range}. Without [!]
one level of folds is opened.
*:foldc* *:foldclose*
:{range}foldc[lose][!]
Close folds in {range}. When [!] is added all folds are
closed. Useful to hide all the text in {range}. Without [!]
one level of folds is closed.
*zn*
zn Fold none: reset 'foldenable'. All folds will be open.
*zN*
zN Fold normal: set 'foldenable'. All folds will be as they
were before.
*zi*
zi Invert 'foldenable'.
MOVING OVER FOLDS ~
*[z*
[z Move to the start of the current open fold. If already at the
start, move to the start of the fold that contains it. If
there is no containing fold, the command fails.
When a count is used, repeats the command N times.
*]z*
]z Move to the end of the current open fold. If already at the
end, move to the end of the fold that contains it. If there
is no containing fold, the command fails.
When a count is used, repeats the command N times.
*zj*
zj Move downwards to the start of the next fold. A closed fold
is counted as one fold.
When a count is used, repeats the command N times.
This command can be used after an |operator|.
*zk*
zk Move upwards to the end of the previous fold. A closed fold
is counted as one fold.
When a count is used, repeats the command N times.
This command can be used after an |operator|.
EXECUTING COMMANDS ON FOLDS ~
:[range]foldd[oopen] {cmd} *:foldd* *:folddoopen*
Execute {cmd} on all lines that are not in a closed fold.
When [range] is given, only these lines are used.
Each time {cmd} is executed the cursor is positioned on the
line it is executed for.
This works like the ":global" command: First all lines that
are not in a closed fold are marked. Then the {cmd} is
executed for all marked lines. Thus when {cmd} changes the
folds, this has no influence on where it is executed (except
when lines are deleted, of course).
Example: >
:folddoopen s/end/loop_end/ge
< Note the use of the "e" flag to avoid getting an error message
where "end" doesn't match.
:[range]folddoc[losed] {cmd} *:folddoc* *:folddoclosed*
Execute {cmd} on all lines that are in a closed fold.
Otherwise like ":folddoopen".
==============================================================================
3. Fold options *fold-options*
COLORS *fold-colors*
The colors of a closed fold are set with the Folded group |hl-Folded|. The
colors of the fold column are set with the FoldColumn group |hl-FoldColumn|.
Example to set the colors: >
:highlight Folded guibg=grey guifg=blue
:highlight FoldColumn guibg=darkgrey guifg=white
FOLDLEVEL *fold-foldlevel*
'foldlevel' is a number option: The higher the more folded regions are open.
When 'foldlevel' is 0, all folds are closed.
When 'foldlevel' is positive, some folds closed.
When 'foldlevel' is very high, all folds are open.
'foldlevel' is applied when it is changed. After that manually folds can be
opened and closed.
When increased, folds above the new level are opened. No manually opened
folds will be closed.
When decreased, folds above the new level are closed. No manually closed
folds will be opened.
FOLDTEXT *fold-foldtext*
'foldtext' is a string option that specifies an expression. This expression
is evaluated to obtain the text displayed for a closed fold. Example: >
:set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g')
This shows the first line of the fold, with "/*", "*/" and "{{{" removed.
Note the use of backslashes to avoid some characters to be interpreted by the
":set" command. It's simpler to define a function and call that: >
:set foldtext=MyFoldText()
:function MyFoldText()
: let line = getline(v:foldstart)
: let sub = substitute(line, '/\*\|\*/\|{{{\d\=', '', 'g')
: return v:folddashes . sub
:endfunction
Evaluating 'foldtext' is done in the |sandbox|. The current window is set to
the window that displays the line. Errors are ignored.
The default value is |foldtext()|. This returns a reasonable text for most
types of folding. If you don't like it, you can specify your own 'foldtext'
expression. It can use these special Vim variables:
v:foldstart line number of first line in the fold
v:foldend line number of last line in the fold
v:folddashes a string that contains dashes to represent the
foldlevel.
v:foldlevel the foldlevel of the fold
In the result a TAB is replaced with a space and unprintable characters are
made into printable characters.
The resulting line is truncated to fit in the window, it never wraps.
When there is room after the text, it is filled with the character specified
by 'fillchars'.
Note that backslashes need to be used for characters that the ":set" command
handles differently: Space, backslash and double-quote. |option-backslash|
FOLDCOLUMN *fold-foldcolumn*
'foldcolumn' is a number, which sets the width for a column on the side of the
window to indicate folds. When it is zero, there is no foldcolumn. A normal
value is 4 or 5. The minimal useful value is 2. The maximum is 12.
An open fold is indicated with a column that has a '-' at the top and '|'
characters below it. This column stops where the open fold stops. When folds
nest, the nested fold is one character right of the fold it's contained in.
A closed fold is indicated with a '+'.
Where the fold column is too narrow to display all nested folds, digits are
shown to indicate the nesting level.
The mouse can also be used to open and close folds by clicking in the
fold column:
- Click on a '+' to open the closed fold at this row.
- Click on any other non-blank character to close the open fold at this row.
OTHER OPTIONS
'foldenable' 'fen': Open all folds while not set.
'foldexpr' 'fde': Expression used for "expr" folding.
'foldignore' 'fdi': Characters used for "indent" folding.
'foldmarker' 'fmr': Defined markers used for "marker" folding.
'foldmethod' 'fdm': Name of the current folding method.
'foldminlines' 'fml': Minimum number of screen lines for a fold to be
displayed closed.
'foldnestmax' 'fdn': Maximum nesting for "indent" and "syntax" folding.
'foldopen' 'fdo': Which kinds of commands open closed folds.
'foldclose' 'fcl': When the folds not under the cursor are closed.
==============================================================================
4. Behavior of folds *fold-behavior*
When moving the cursor upwards or downwards and when scrolling, the cursor
will move to the first line of a sequence of folded lines. When the cursor is
already on a folded line, it moves to the next unfolded line or the next
closed fold.
While the cursor is on folded lines, the cursor is always displayed in the
first column. The ruler does show the actual cursor position, but since the
line is folded, it cannot be displayed there.
Many movement commands handle a sequence of folded lines like an empty line.
For example, the "w" command stops once in the first column.
When in Insert mode, the cursor line is never folded. That allows you to see
what you type!
When using an operator, a closed fold is included as a whole. Thus "dl"
deletes the whole closed fold under the cursor.
For Ex commands the range is adjusted to always start at the first line of a
fold and end at the last line of a fold. Thus this command: >
:s/foo/bar/g
when used with the cursor on a closed fold, will replace "foo" with "bar" in
all lines of the fold.
This does not happen for |:folddoopen| and |:folddoclosed|.
When editing a buffer that has been edited before, the last used folding
settings are used again. For manual folding the defined folds are restored.
For all folding methods the manually opened and closed folds are restored.
If this buffer has been edited in this window, the values from back then are
used. Otherwise the values from the window where the buffer was edited last
are used.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,951 @@
*gui.txt* For Vim version 6.3. Last change: 2004 Jun 02
VIM REFERENCE MANUAL by Bram Moolenaar
Vim's Graphical User Interface *gui* *GUI*
1. Starting the GUI |gui-start|
2. Scrollbars |gui-scrollbars|
3. Mouse Control |gui-mouse|
4. Making GUI Selections |gui-selections|
5. Menus |menus|
6. Extras |gui-extras|
7. Shell Commands |gui-shell|
Other GUI documentation:
|gui_x11.txt| For specific items of the X11 GUI.
|gui_w32.txt| For specific items of the Win32 GUI.
{Vi does not have any of these commands}
==============================================================================
1. Starting the GUI *gui-start* *E229* *E233*
First you must make sure you actually have a version of Vim with the GUI code
included. You can check this with the ":version" command, it should include
"+GUI_Athena", "+GUI_BeOS", "+GUI_GTK", "+GUI_Motif" or "MS-Windows ... bit
GUI version".
How to start the GUI depends on the system used. Mostly you can run the
GUI version of Vim with:
gvim [options] [files...]
The X11 version of Vim can run both in GUI and in non-GUI mode. See
|gui-x11-start|.
*gui-init* *gvimrc* *.gvimrc* *_gvimrc*
When the GUI starts up initializations are carried out, in this order:
- The termcap options are reset to their default value for the GUI.
- If the system menu file exists, it is sourced. The name of this file is
normally "$VIMRUNTIME/menu.vim". You can check this with ":version". Also
see |$VIMRUNTIME|. To skip loading the system menu include 'M' in
'guioptions'. *buffers-menu* *no_buffers_menu*
The system menu file includes a "Buffers" menu. If you don't want this, set
the "no_buffers_menu" variable in your .vimrc (not .gvimrc!): >
:let no_buffers_menu = 1
< NOTE: Switching on syntax highlighting also loads the menu file, thus
disabling the Buffers menu must be done before ":syntax on".
The path names are truncated to 35 characters. You can truncate them at a
different length, for example 50, like this: >
:let bmenu_max_pathlen = 50
- If the "-U {gvimrc}" command-line option has been used when starting Vim,
the {gvimrc} file will be read for initializations. The following
initializations are skipped.
- For Unix and MS-Windows, if the system gvimrc exists, it is sourced. The
name of this file is normally "$VIM/gvimrc". You can check this with
":version". Also see |$VIM|.
- The following are tried, and only the first one that exists is used:
- If the GVIMINIT environment variable exists and is not empty, it is
executed as an Ex command.
- If the user gvimrc file exists, it is sourced. The name of this file is
normally "$HOME/.gvimrc". You can check this with ":version".
- For Win32, when $HOME is not set, "$VIM\_gvimrc" is used.
- When a "_gvimrc" file is not found, ".gvimrc" is tried too. And vice
versa.
- If the 'exrc' option is set (which is NOT the default) the file ./.gvimrc
is sourced, if it exists and isn't the same file as the system or user
gvimrc file. If this file is not owned by you, some security restrictions
apply. When ".gvimrc" is not found, "_gvimrc" is tried too. For Macintosh
and DOS/Win32 "_gvimrc" is tried first.
NOTE: All but the first one are not carried out if Vim was started with
"-u NONE" and no "-U" argument was given, or when started with "-U NONE".
All this happens AFTER the normal Vim initializations, like reading your
.vimrc file. See |initialization|.
But the GUI window is only opened after all the initializations have been
carried out. If you want some commands to be executed just after opening the
GUI window, use the |GUIEnter| autocommand event. Example: >
:autocommand GUIEnter * winpos 100 50
You can use the gvimrc files to set up your own customized menus (see |:menu|)
and initialize other things that you may want to set up differently from the
terminal version.
Recommended place for your personal GUI initializations:
Unix $HOME/.gvimrc
OS/2 $HOME/.gvimrc or $VIM/.gvimrc
MS-DOS and Win32 $HOME/_gvimrc or $VIM/_gvimrc
Amiga s:.gvimrc or $VIM/.gvimrc
There are a number of options which only have meaning in the GUI version of
Vim. These are 'guicursor', 'guifont', 'guipty' and 'guioptions'. They are
documented in |options.txt| with all the other options.
If using the Motif or Athena version of the GUI (but not for the GTK+ or Win32
version), a number of X resources are available. See |gui-resources|.
Another way to set the colors for different occasions is with highlight
groups. The "Normal" group is used to set the background and foreground
colors. Example (which looks nice): >
:highlight Normal guibg=grey90
The "guibg" and "guifg" settings override the normal background and
foreground settings. The other settings for the Normal highlight group are
not used. Use the 'guifont' option to set the font.
Also check out the 'guicursor' option, to set the colors for the cursor in
various modes.
Vim tries to make the window fit on the screen when it starts up. This avoids
that you can't see part of it. On the X Window System this requires a bit of
guesswork. You can change the height that is used for the window title and a
task bar with the 'guiheadroom' option.
*:winp* *:winpos* *E188*
:winp[os]
Display current position of the top left corner of the GUI vim
window in pixels. Does not work in all versions.
:winp[os] {X} {Y} *E466*
Put the GUI vim window at the given {X} and {Y} coordinates.
The coordinates should specify the position in pixels of the
top left corner of the window. Does not work in all versions.
Does work in an (new) xterm |xterm-color|.
When the GUI window has not been opened yet, the values are
remembered until the window is opened. The position is
adjusted to make the window fit on the screen (if possible).
*:win* *:winsize* *E465*
:win[size] {width} {height}
Set the window height to {width} by {height} characters.
Obsolete, use ":set lines=11 columns=22".
If you get less lines than expected, check the 'guiheadroom'
option.
If you are running the X Window System, you can get information about the
window Vim is running in with this command: >
:!xwininfo -id $WINDOWID
==============================================================================
2. Scrollbars *gui-scrollbars*
There are vertical scrollbars and a horizontal scrollbars. You may
configure which ones appear with the 'guioptions' option.
The interface looks like this (with ":set guioptions=mlrb"):
+------------------------------+
| File Edit Help | <- Menu bar (m)
+-+--------------------------+-+
|^| |^|
|#| Text area. |#|
| | | |
|v|__________________________|v|
Normal status line -> |-+ File.c 5,2 +-|
between Vim windows |^|""""""""""""""""""""""""""|^|
| | | |
| | Another file buffer. | |
| | | |
|#| |#|
Left scrollbar (l) -> |#| |#| <- Right
|#| |#| scrollbar (r)
| | | |
|v| |v|
+-+--------------------------+-+
| |< #### >| | <- Bottom
+-+--------------------------+-+ scrollbar (b)
Any of the scrollbar or menu components may be turned off by not putting the
appropriate letter in the 'guioptions' string. The bottom scrollbar is
only useful when 'nowrap' is set.
VERTICAL SCROLLBARS *gui-vert-scroll*
Each Vim window has a scrollbar next to it which may be scrolled up and down
to move through the text in that buffer. The size of the scrollbar-thumb
indicates the fraction of the buffer which can be seen in the window.
When the scrollbar is dragged all the way down, the last line of the file
will appear in the top of the window.
If a window is shrunk to zero height (by the growth of another window) its
scrollbar disappears. It reappears when the window is restored.
If a window is vertically split, it will get a scrollbar when it is the
current window and when, taking the middle of the current window and drawing a
vertical line, this line goes through the window.
When there are scrollbars on both sides, and the middle of the current window
is on the left half, the right scrollbar column will contain scrollbars for
the rightmost windows. The same happens on the other side.
HORIZONTAL SCROLLBARS *gui-horiz-scroll*
The horizontal scrollbar (at the bottom of the Vim GUI) may be used to
scroll text sideways when the 'wrap' option is turned off. The
scrollbar-thumb size is such that the text of the longest visible line may be
scrolled as far as possible left and right. The cursor is moved when
necessary, it must remain on a visible character (unless 'virtualedit' is
set).
Computing the length of the longest visible takes quite a bit of computation,
and it has to be done every time something changes. If this takes too much
time or you don't like the cursor jumping to another line, include the 'h'
flag in 'guioptions'. Then the scrolling is limited by the text of the
current cursor line.
*athena-intellimouse*
If you have an Intellimouse and an X server that supports using the wheel,
then you can use the wheel to scroll the text up and down in gvim. This works
with XFree86 4.0 and later, and with some older versions when you add patches.
See |scroll-mouse-wheel|.
For older versions of XFree86 you must patch your X server. The following
page has a bit of information about using the Intellimouse on Linux as well as
links to the patches and X server binaries (may not have the one you need
though):
http://www.inria.fr/koala/colas/mouse-wheel-scroll/
==============================================================================
3. Mouse Control *gui-mouse*
The mouse only works if the appropriate flag in the 'mouse' option is set.
When the GUI is switched on, and 'mouse' wasn't set yet, the 'mouse' option is
automatically set to "a", enabling it for all modes except for the
|hit-enter| prompt. If you don't want this, a good place to change the
'mouse' option is the "gvimrc" file.
Other options that are relevant:
'mousefocus' window focus follows mouse pointer |gui-mouse-focus|
'mousemodel' what mouse button does which action
'mousehide' hide mouse pointer while typing text
'selectmode' whether to start Select mode or Visual mode
A quick way to set these is with the ":behave" command.
*:behave* *:be*
:be[have] {model} Set behavior for mouse and selection. Valid
arguments are:
mswin MS-Windows behavior
xterm Xterm behavior
Using ":behave" changes these options:
option mswin xterm ~
'selectmode' "mouse,key" ""
'mousemodel' "popup" "extend"
'keymodel' "startsel,stopsel" ""
'selection' "exclusive" "inclusive"
In the $VIMRUNTIME directory, there is a script called |mswin.vim|, which will
also map a few keys to the MS-Windows cut/copy/paste commands. This is NOT
compatible, since it uses the CTRL-V, CTRL-X and CTRL-C keys. If you don't
mind, use this command: >
:so $VIMRUNTIME/mswin.vim
For scrolling with a wheel on a mouse, see |scroll-mouse-wheel|.
3.1 Moving Cursor with Mouse *gui-mouse-move*
Click the left mouse button somewhere in a text buffer where you want the
cursor to go, and it does!
This works in when 'mouse' contains ~
Normal mode 'n' or 'a'
Visual mode 'v' or 'a'
Insert mode 'i' or 'a'
Select mode is handled like Visual mode.
You may use this with an operator such as 'd' to delete text from the current
cursor position to the position you point to with the mouse. That is, you hit
'd' and then click the mouse somewhere.
*gui-mouse-focus*
The 'mousefocus' option can be set to make the keyboard focus follow the
mouse pointer. This means that the window where the mouse pointer is, is the
active window. Warning: this doesn't work very well when using a menu,
because the menu command will always be applied to the top window.
If you are on the ':' line (or '/' or '?'), then clicking the left or right
mouse button will position the cursor on the ':' line (if 'mouse' contains
'c', 'a' or 'A').
In any situation the middle mouse button may be clicked to paste the current
selection.
3.2 Selection with Mouse *gui-mouse-select*
The mouse can be used to start a selection. How depends on the 'mousemodel'
option:
'mousemodel' is "extend": use the right mouse button
'mousemodel' is "popup": use the left mouse button, while keeping the Shift
key pressed.
If there was no selection yet, this starts a selection from the old cursor
position to the position pointed to with the mouse. If there already is a
selection then the closest end will be extended.
If 'selectmode' contains "mouse", then the selection will be in Select mode.
This means that typing normal text will replace the selection. See
|Select-mode|. Otherwise, the selection will be in Visual mode.
Double clicking may be done to make the selection word-wise, triple clicking
makes it line-wise, and quadruple clicking makes it rectangular block-wise.
See |gui-selections| on how the selection is used.
3.3 Other Text Selection with Mouse *gui-mouse-modeless*
*modeless-selection*
A different kind of selection is used when:
- in Command-line mode
- in the Command-line window and pointing in another window
- at the |hit-enter| prompt
- whenever the current mode is not in the 'mouse' option
- when holding the CTRL and SHIFT keys in the GUI
Since Vim continues like the selection isn't there, and there is no mode
associated with the selection, this is called modeless selection. Any text in
the Vim window can be selected. Select the text by pressing the left mouse
button at the start, drag to the end and release. To extend the selection,
use the right mouse button when 'mousemodel' is "extend", or the left mouse
button with the shift key pressed when 'mousemodel' is "popup".
The middle mouse button pastes the text.
The selection is removed when the selected text is scrolled or changed.
On the command line CTRL-Y can be used to copy the selection into the
clipboard. To do this from Insert mode, use CTRL-O : CTRL-Y <CR>.
3.4 Using Mouse on Status Lines *gui-mouse-status*
Clicking the left or right mouse button on the status line below a Vim
window makes that window the current window. This actually happens on button
release (to be able to distinguish a click from a drag action).
With the left mouse button a status line can be dragged up and down, thus
resizing the windows above and below it. This does not change window focus.
The same can be used on the vertical separator: click to give the window left
of it focus, drag left and right to make windows wider and narrower.
3.5 Various Mouse Clicks *gui-mouse-various*
<S-LeftMouse> Search forward for the word under the mouse click.
When 'mousemodel' is "popup" this starts or extends a
selection.
<S-RightMouse> Search backward for the word under the mouse click.
<C-LeftMouse> Jump to the tag name under the mouse click.
<C-RightMouse> Jump back to position before the previous tag jump
(same as "CTRL-T")
3.6 Mouse Mappings *gui-mouse-mapping*
The mouse events, complete with modifiers, may be mapped. Eg: >
:map <S-LeftMouse> <RightMouse>
:map <S-LeftDrag> <RightDrag>
:map <S-LeftRelease> <RightRelease>
:map <2-S-LeftMouse> <2-RightMouse>
:map <2-S-LeftDrag> <2-RightDrag>
:map <2-S-LeftRelease> <2-RightRelease>
:map <3-S-LeftMouse> <3-RightMouse>
:map <3-S-LeftDrag> <3-RightDrag>
:map <3-S-LeftRelease> <3-RightRelease>
:map <4-S-LeftMouse> <4-RightMouse>
:map <4-S-LeftDrag> <4-RightDrag>
:map <4-S-LeftRelease> <4-RightRelease>
These mappings make selection work the way it probably should in a Motif
application, with shift-left mouse allowing for extending the visual area
rather than the right mouse button.
Mouse mapping with modifiers does not work for modeless selection.
3.7 Drag and drop *drag-n-drop*
You can drag and drop one or more files into the Vim window, where they will
be opened as if a |:drop| command was used.
If you hold down Shift while doing this, Vim changes to the first dropped
file's directory. If you hold Ctrl Vim will always split a new window for the
file. Otherwise it's only done if the current buffer has been changed.
You can also drop a directory on Vim. This starts the explorer plugin for
that directory (assuming it was enabled, otherwise you'll get an error
message). Keep Shift pressed to change to the directory instead.
If Vim happens to be editing a command line, the names of the dropped files
and directories will be inserted at the cursor. This allows you to use these
names with any Ex command. Special characters (space, tab, double quote and
'|'; backslash on non-MS-Windows systems) will be escaped.
==============================================================================
4. Making GUI Selections *gui-selections*
*quotestar*
You may make selections with the mouse (see |gui-mouse-select|), or by using
Vim's Visual mode (see |v|). If 'a' is present in 'guioptions', then
whenever a selection is started (Visual or Select mode), or when the selection
is changed, Vim becomes the owner of the windowing system's primary selection
(on MS-Windows the |gui-clipboard| is used; under X11, the |x11-selection| is
used - you should read whichever of these is appropriate now).
*clipboard*
There is a special register for storing this selection, it is the "*
register. Nothing is put in here unless the information about what text is
selected is about to change (eg with a left mouse click somewhere), or when
another application wants to paste the selected text. Then the text is put
in the "* register. For example, to cut a line and make it the current
selection/put it on the clipboard: >
"*dd
Similarly, when you want to paste a selection from another application, e.g.,
by clicking the middle mouse button, the selection is put in the "* register
first, and then 'put' like any other register. For example, to put the
selection (contents of the clipboard): >
"*p
When using this register under X11, also see |x11-selection|. This also
explains the related "+ register.
Note that when pasting text from one Vim into another separate Vim, the type
of selection (character, line, or block) will also be copied. For other
applications the type is always character. However, if the text gets
transferred via the |x11-cut-buffer|, the selection type is ALWAYS lost.
When the "unnamed" string is included in the 'clipboard' option, the unnamed
register is the same as the "* register. Thus you can yank to and paste the
selection without prepending "* to commands.
==============================================================================
5. Menus *menus*
For an introduction see |usr_42.txt| in the user manual.
5.1 Using Menus *using-menus*
Basically, menus can be used just like mappings. You can define your own
menus, as many as you like.
Long-time Vim users won't use menus much. But the power is in adding your own
menus and menu items. They are most useful for things that you can't remember
what the key sequence was.
For creating menus in a different language, see |:menutrans|.
*menu.vim*
The default menus are read from the file "$VIMRUNTIME/menu.vim". See
|$VIMRUNTIME| for where the path comes from. You can set up your own menus.
Starting off with the default set is a good idea. You can add more items, or,
if you don't like the defaults at all, start with removing all menus
|:unmenu-all|. You can also avoid the default menus being loaded by adding
this line to your .vimrc file (NOT your .gvimrc file!): >
:let did_install_default_menus = 1
If you also want to avoid the Syntax menu: >
:let did_install_syntax_menu = 1
If you do want the Syntax menu but not all the entries for each available
syntax file (which take quite a bit of time to load): >
:let skip_syntax_sel_menu = 1
<
*console-menus*
Although this documentation is in the GUI section, you can actually use menus
in console mode too. You will have to load |menu.vim| explicitly then, it is
not done by default. You can use the |:emenu| command and command-line
completion with 'wildmenu' to access the menu entries almost like a real menu
system. To do this, put these commands in your .vimrc file: >
:source $VIMRUNTIME/menu.vim
:set wildmenu
:set cpo-=<
:set wcm=<C-Z>
:map <F4> :emenu <C-Z>
Pressing <F4> will start the menu. You can now use the cursor keys to select
a menu entry. Hit <Enter> to execute it. Hit <Esc> if you want to cancel.
This does require the |+menu| feature enabled at compile time.
*tear-off-menus*
GTK+ and Motif support Tear-off menus. These are sort of sticky menus or
pop-up menus that are present all the time. If the resizing does not work
correctly, this may be caused by using something like "Vim*geometry" in the
defaults. Use "Vim.geometry" instead.
The Win32 GUI version emulates Motif's tear-off menus. Actually, a Motif user
will spot the differences easily, but hopefully they're just as useful. You
can also use the |:tearoff| command together with |hidden-menus| to create
floating menus that do not appear on the main menu bar.
5.2 Creating New Menus *creating-menus*
*:me* *:menu* *:noreme* *:noremenu*
*:am* *:amenu* *:an* *:anoremenu*
*:nme* *:nmenu* *:nnoreme* *:nnoremenu*
*:ome* *:omenu* *:onoreme* *:onoremenu*
*:vme* *:vmenu* *:vnoreme* *:vnoremenu*
*:ime* *:imenu* *:inoreme* *:inoremenu*
*:cme* *:cmenu* *:cnoreme* *:cnoremenu*
*E330* *E327* *E331* *E336* *E333*
*E328* *E329* *E337*
To create a new menu item, use the ":menu" commands. They are mostly like
the ":map" set of commands but the first argument is a menu item name, given
as a path of menus and submenus with a '.' between them. eg: >
:menu File.Save :w<CR>
:inoremenu File.Save <C-O>:w<CR>
:menu Edit.Big\ Changes.Delete\ All\ Spaces :%s/[ ^I]//g<CR>
This last one will create a new item in the menu bar called "Edit", holding
the mouse button down on this will pop up a menu containing the item
"Big Changes", which is a sub-menu containing the item "Delete All Spaces",
which when selected, performs the operation.
Special characters in a menu name:
& The next character is the shortcut key. Make sure each
shortcut key is only used once in a (sub)menu. If you want to
insert a literal "&" in the menu name use "&&".
<Tab> Separates the menu name from right-aligned text. This can be
used to show the equivalent typed command. The text "<Tab>"
can be used here for convenience. If you are using a real
Tab, don't forget to put a backslash before it!
Example: >
:amenu &File.&Open<Tab>:e :browse e<CR>
[typed literally]
With the shortcut "F" (while keeping the <Alt> key pressed), and then "O",
this menu can be used. The second part is shown as "Open :e". The ":e"
is right aligned, and the "O" is underlined, to indicate it is the shortcut.
The ":amenu" command can be used to define menu entries for all modes at once.
To make the command work correctly, a character is automatically inserted for
some modes:
mode inserted appended ~
Normal nothing nothing
Visual <C-C> <C-\><C-G>
Insert <C-O>
Cmdline <C-C> <C-\><C-G>
Op-pending <C-C> <C-\><C-G>
Appending CTRL-\ CTRL-G is for going back to insert mode when 'insertmode' is
set. |CTRL-\_CTRL-G|
Example: >
:amenu File.Next :next^M
is equal to: >
:nmenu File.Next :next^M
:vmenu File.Next ^C:next^M^\^G
:imenu File.Next ^O:next^M
:cmenu File.Next ^C:next^M^\^G
:omenu File.Next ^C:next^M^\^G
Careful: In Insert mode this only works for a SINGLE Normal mode command,
because of the CTRL-O. If you have two or more commands, you will need to use
the ":imenu" command. For inserting text in any mode, you can use the
expression register: >
:amenu Insert.foobar "='foobar'<CR>P
Note that the '<' and 'k' flags in 'cpoptions' also apply here (when
included they make the <> form and raw key codes not being recognized).
Note that <Esc> in Cmdline mode executes the command, like in a mapping. This
is Vi compatible. Use CTRL-C to quit Cmdline mode.
*:menu-<silent>* *:menu-silent*
To define a menu which will not be echoed on the command line, add
"<silent>" as the first argument. Example: >
:menu <silent> Settings.Ignore\ case :set ic<CR>
The ":set ic" will not be echoed when using this menu. Messages from the
executed command are still given though. To shut them up too, add a ":silent"
in the executed command: >
:menu <silent> Search.Header :exe ":silent normal /Header\r"<CR>
<
*:menu-<script>* *:menu-script*
The "to" part of the menu will be inspected for mappings. If you don't want
this, use the ":noremenu" command (or the similar one for a specific mode).
If you do want to use script-local mappings, add "<script>" as the very first
argument to the ":menu" command or after "<silent>".
*menu-priority*
You can give a priority to a menu. Menus with a higher priority go more to
the right. The priority is given as a number before the ":menu" command.
Example: >
:80menu Buffer.next :bn<CR>
The default menus have these priorities:
File 10
Edit 20
Tools 40
Syntax 50
Buffers 60
Window 70
Help 9999
When no or zero priority is given, 500 is used.
The priority for the PopUp menu is not used.
The Help menu will be placed on the far right side of the menu bar on systems
which support this (Motif and GTK+). For GTK+ 2, this is not done anymore
because right-aligning the Help menu is now discouraged UI design.
You can use a priority higher than 9999, to make it go after the Help menu,
but that is non-standard and is discouraged. The highest possible priority is
about 32000. The lowest is 1.
*sub-menu-priority*
The same mechanism can be used to position a sub-menu. The priority is then
given as a dot-separated list of priorities, before the menu name: >
:menu 80.500 Buffer.next :bn<CR>
Giving the sub-menu priority is only needed when the item is not to be put
in a normal position. For example, to put a sub-menu before the other items: >
:menu 80.100 Buffer.first :brew<CR>
Or to put a sub-menu after the other items, and further items with default
priority will be put before it: >
:menu 80.900 Buffer.last :blast<CR>
When a number is missing, the default value 500 will be used: >
:menu .900 myMenu.test :echo "text"<CR>
The menu priority is only used when creating a new menu. When it already
existed, e.g., in another mode, the priority will not change. Thus, the
priority only needs to be given the first time a menu is used.
An exception is the PopUp menu. There is a separate menu for each mode
(Normal, Op-pending, Visual, Insert, Cmdline). The order in each of these
menus can be different. This is different from menu-bar menus, which have
the same order for all modes.
NOTE: sub-menu priorities currently don't work for all versions of the GUI.
*menu-separator* *E332*
Menu items can be separated by a special item that inserts some space between
items. Depending on the system this is displayed as a line or a dotted line.
These items must start with a '-' and end in a '-'. The part in between is
used to give it a unique name. Priorities can be used as with normal items.
Example: >
:menu Example.item1 :do something
:menu Example.-Sep- :
:menu Example.item2 :do something different
Note that the separator also requires a rhs. It doesn't matter what it is,
because the item will never be selected. Use a single colon to keep it
simple.
*gui-toolbar*
The toolbar is currently available in the Win32, Athena, Motif, GTK+ (X11) and
Photon GUI. It should turn up in other GUIs in due course. The default
toolbar is setup in menu.vim.
The display of the toolbar is controlled by the 'guioptions' letter 'T'. You
can thus have menu & toolbar together, or either on its own, or neither.
The appearance is controlled by the 'toolbar' option. You can chose between
an image, text or both.
*toolbar-icon*
The toolbar is defined as a special menu called ToolBar, which only has one
level. Vim interprets the items in this menu as follows:
1) If an "icon=" argument was specified, the file with this name is used.
The file can either be specified with the full path or with the base name.
In the last case it is searched for in the "bitmaps" directory in
'runtimepath', like in point 3). Examples: >
:amenu icon=/usr/local/pixmaps/foo_icon.xpm ToolBar.Foo :echo "Foo"<CR>
:amenu icon=FooIcon ToolBar.Foo :echo "Foo"<CR>
< Note that in the first case the extension is included, while in the second
case it is omitted.
If the file cannot be opened the next points are tried.
A space in the file name must be escaped with a backslash.
A menu priority must come _after_ the icon argument: >
:amenu icon=foo 1.42 ToolBar.Foo :echo "42!"<CR>
2) An item called 'BuiltIn##', where ## is a number, is taken as number ## of
the built-in bitmaps available in Vim. Currently there are 31 numbered
from 0 to 30 which cover most common editing operations |builtin-tools|. >
:amenu ToolBar.BuiltIn22 :call SearchNext("back")<CR>
3) An item with another name is first searched for in the directory
"bitmaps" in 'runtimepath'. If found, the bitmap file is used as the
toolbar button image. Note that the exact filename is OS-specific: For
example, under Win32 the command >
:amenu ToolBar.Hello :echo "hello"<CR>
< would find the file 'hello.bmp'. Under GTK+/X11 it is 'Hello.xpm'. With
GTK+ 2 the files 'Hello.png', 'Hello.xpm' and 'Hello.bmp' are checked for
existence, and the first one found would be used.
For MS-Windows and GTK+ 2 the bitmap is scaled to fit the button. For
MS-Windows a size of 18 by 18 pixels works best.
For MS-Windows the bitmap should have 16 colors with the standard palette.
The light grey pixels will be changed to the Window frame color and the
dark grey pixels to the window shadow color. More colors might also work,
depending on your system.
4) If the bitmap is still not found, Vim checks for a match against its list
of built-in names. Each built-in button image has a name.
So the command >
:amenu ToolBar.Open :e
< will show the built-in "open a file" button image if no open.bmp exists.
All the built-in names can be seen used in menu.vim.
5) If all else fails, a blank, but functioning, button is displayed.
*builtin-tools*
nr Name Normal action ~
00 New open new window
01 Open browse for file to open in current window
02 Save write buffer to file
03 Undo undo last change
04 Redo redo last undone change
05 Cut delete selected text to clipboard
06 Copy copy selected text to clipboard
07 Paste paste text from clipboard
08 Print print current buffer
09 Help open a buffer on Vim's builtin help
10 Find start a search command
11 SaveAll write all modified buffers to file
12 SaveSesn write session file for current situation
13 NewSesn write new session file
14 LoadSesn load session file
15 RunScript browse for file to run as a Vim script
16 Replace prompt for substitute command
17 WinClose close current window
18 WinMax make current window use many lines
19 WinMin make current window use few lines
20 WinSplit split current window
21 Shell start a shell
22 FindPrev search again, backward
23 FindNext search again, forward
24 FindHelp prompt for word to search help for
25 Make run make and jump to first error
26 TagJump jump to tag under the cursor
27 RunCtags build tags for files in current directory
28 WinVSplit split current window vertically
29 WinMaxWidth make current window use many columns
30 WinMinWidth make current window use few columns
*hidden-menus* *win32-hidden-menus*
In the Win32 and GTK+ GUI, starting a menu name with ']' excludes that menu
from the main menu bar. You must then use the |:popup| or |:tearoff| command
to display it.
*popup-menu*
In the Win32, GTK+, Motif, Athena and Photon GUI, you can define the special
menu "PopUp". This is the menu that is displayed when the right mouse button
is pressed, if 'mousemodel' is set to popup or popup_setpos.
5.3 Showing What Menus Are Mapped To *showing-menus*
To see what an existing menu is mapped to, use just one argument after the
menu commands (just like you would with the ":map" commands). If the menu
specified is a submenu, then all menus under that hierarchy will be shown.
If no argument is given after :menu at all, then ALL menu items are shown
for the appropriate mode (eg, Command-line mode for :cmenu).
Special characters in the list, just before the rhs:
* The menu was defined with "nore" to disallow remapping.
& The menu was defined with "<script>" to allow remapping script-local
mappings only.
- The menu was disabled.
Note that hitting <Tab> while entering a menu name after a menu command may
be used to complete the name of the menu item.
5.4 Executing Menus *execute-menus*
*:em* *:emenu* *E334* *E335*
:[range]em[enu] {menu} Execute {menu} from the command line.
The default is to execute the Normal mode
menu. If a range is specified, it executes
the Visual mode menu.
If used from <c-o>, it executes the
insert-mode menu Eg: >
:emenu File.Exit
If the console-mode vim has been compiled with WANT_MENU defined, you can
use :emenu to access useful menu items you may have got used to from GUI
mode. See 'wildmenu' for an option that works well with this. See
|console-menus| for an example.
When using a range, if the lines match with '<,'>, then the menu is executed
using the last visual selection.
5.5 Deleting Menus *delete-menus*
*:unme* *:unmenu*
*:aun* *:aunmenu*
*:nunme* *:nunmenu*
*:ounme* *:ounmenu*
*:vunme* *:vunmenu*
*:iunme* *:iunmenu*
*:cunme* *:cunmenu*
To delete a menu item or a whole submenu, use the unmenu commands, which are
analogous to the unmap commands. Eg: >
:unmenu! Edit.Paste
This will remove the Paste item from the Edit menu for Insert and
Command-line modes.
Note that hitting <Tab> while entering a menu name after an umenu command
may be used to complete the name of the menu item for the appropriate mode.
To remove all menus use: *:unmenu-all* >
:unmenu * " remove all menus in Normal and visual mode
:unmenu! * " remove all menus in Insert and Command-line mode
:aunmenu * " remove all menus in all modes
If you want to get rid of the menu bar: >
:set guioptions-=m
5.6 Disabling Menus *disable-menus*
*:menu-disable* *:menu-enable*
If you do not want to remove a menu, but disable it for a moment, this can be
done by adding the "enable" or "disable" keyword to a ":menu" command.
Examples: >
:menu disable &File.&Open\.\.\.
:amenu enable *
:amenu disable &Tools.*
The command applies to the modes as used with all menu commands. Note that
characters like "&" need to be included for translated names to be found.
When the argument is "*", all menus are affected. Otherwise the given menu
name and all existing submenus below it are affected.
5.7 Examples for Menus *menu-examples*
Here is an example on how to add menu items with menu's! You can add a menu
item for the keyword under the cursor. The register "z" is used. >
:nmenu Words.Add\ Var wb"zye:menu! Words.<C-R>z <C-R>z<CR>
:nmenu Words.Remove\ Var wb"zye:unmenu! Words.<C-R>z<CR>
:vmenu Words.Add\ Var "zy:menu! Words.<C-R>z <C-R>z <CR>
:vmenu Words.Remove\ Var "zy:unmenu! Words.<C-R>z<CR>
:imenu Words.Add\ Var <Esc>wb"zye:menu! Words.<C-R>z <C-R>z<CR>a
:imenu Words.Remove\ Var <Esc>wb"zye:unmenu! Words.<C-R>z<CR>a
(the rhs is in <> notation, you can copy/paste this text to try out the
mappings, or put these lines in your gvimrc; "<C-R>" is CTRL-R, "<CR>" is
the <CR> key. |<>|)
5.8 Tooltips & Menu tips
See section |42.4| in the user manual.
*:tmenu* *:tm*
:tm[enu] {menupath} {rhs} Define a tip for a menu or tool. {only in
X11 and Win32 GUI}
:tm[enu] [menupath] List menu tips. {only in X11 and Win32 GUI}
*:tunmenu* *:tu*
:tu[nmenu] {menupath} Remove a tip for a menu or tool.
{only in X11 and Win32 GUI}
When a tip is defined for a menu item, it appears in the command-line area
when the mouse is over that item, much like a standard Windows menu hint in
the status bar. (Except when Vim is in Command-line mode, when of course
nothing is displayed.)
When a tip is defined for a ToolBar item, it appears as a tooltip when the
mouse pauses over that button, in the usual fashion. Use the |hl-Tooltip|
highlight group to change its colors.
A "tip" can be defined for each menu item. For example, when defining a menu
item like this: >
:amenu MyMenu.Hello :echo "Hello"<CR>
The tip is defined like this: >
:tmenu MyMenu.Hello Displays a greeting.
And delete it with: >
:tunmenu MyMenu.Hello
Tooltips are currently only supported for the X11 and Win32 GUI. However, they
should appear for the other gui platforms in the not too distant future.
The ":tmenu" command works just like other menu commands, it uses the same
arguments. ":tunmenu" deletes an existing menu tip, in the same way as the
other unmenu commands.
If a menu item becomes invalid (i.e. its actions in all modes are deleted) Vim
deletes the menu tip (and the item) for you. This means that :aunmenu deletes
a menu item - you don't need to do a :tunmenu as well.
5.9 Popup Menus
In the Win32 and GTK+ GUI, you can cause a menu to popup at the cursor.
This behaves similarly to the PopUp menus except that any menu tree can
be popped up.
This command is for backwards compatibility, using it is discouraged, because
it behaves in a strange way.
*:popup* *:popu*
:popu[p] {name} Popup the menu {name}. The menu named must
have at least one subentry, but need not
appear on the menu-bar (see |hidden-menus|).
{only available for Win32 and GTK GUI}
Example: >
:popup File
will make the "File" menu (if there is one) appear at the text cursor. >
:amenu ]Toolbar.Make :make<CR>
:popup ]Toolbar
This creates a popup menu that doesn't exist on the main menu-bar.
Note that a menu that starts with ']' will not be displayed.
==============================================================================
6. Extras *gui-extras*
This section describes other features which are related to the GUI.
- With the GUI, there is no wait for one second after hitting escape, because
the key codes don't start with <Esc>.
- Typing ^V followed by a special key in the GUI will insert "<Key>", since
the internal string used is meaningless. Modifiers may also be held down to
get "<Modifiers-Key>".
- In the GUI, the modifiers SHIFT, CTRL, and ALT (or META) may be used within
mappings of special keys and mouse events. eg: :map <M-LeftDrag> <LeftDrag>
- In the GUI, several normal keys may have modifiers in mappings etc, these
are <Space>, <Tab>, <NL>, <CR>, <Esc>.
- To check in a Vim script if the GUI is being used, you can use something
like this: >
if has("gui_running")
echo "yes, we have a GUI"
else
echo "Boring old console"
endif
==============================================================================
7. Shell Commands *gui-shell*
For the X11 GUI the external commands are executed inside the gvim window.
See |gui-pty|.
WARNING: Executing an external command from the X11 GUI will not always
work. "normal" commands like "ls", "grep" and "make" mostly work fine.
Commands that require an intelligent terminal like "less" and "ispell" won't
work. Some may even hang and need to be killed from another terminal. So be
careful!
For the Win32 GUI the external commands are executed in a separate window.
See |gui-shell-win32|.
vim:tw=78:sw=4:ts=8:ft=help:norl:

View File

@ -0,0 +1,186 @@
*gui_w16.txt* For Vim version 6.3. Last change: 2001 Sep 03
VIM REFERENCE MANUAL by Bram Moolenaar
Vim's Graphical User Interface *gui-w16* *win16-gui*
1. Starting the GUI |win16-start|
2. Vim as default editor |win16-default-editor|
3. Using the clipboard |win16-clipboard|
4. Shell Commands |win16-shell|
5. Special colors |win16-colors|
6. Windows dialogs & browsers |win16-dialogs|
7. Various |win16-various|
Other relevant documentation:
|gui.txt| For generic items of the GUI.
|os_msdos.txt| For items common to DOS and Windows.
|gui_w32.txt| Some items here are also applicable to the Win16 version.
{Vi does not have a Windows GUI}
The Win16 version of Vim will run on Windows 3.1 or later. It has not been
tested on 3.0, it probably won't work without being recompiled and
modified. (but you really should upgrade to 3.11 anyway. :)
In most respects it behaves identically to the Win32 GUI version, including
having a flat-style toolbar(!). The chief differences:
1) Bold/Italic text is not available, to speed up repaint/reduce resource
usage. (You can re-instate this by undefining MSWIN16_FASTTEXT.)
2) No tearoff menu emulation.
3) No OLE interface.
4) No long filename support (of course)
5) No tooltips on toolbar buttons - instead they produce command-line tips
like menu items do.
6) Line length limited to 32767 characters (like 16-bit DOS version)
==============================================================================
1. Starting the GUI *win16-start*
The Win16 GUI version of Vim will always start the GUI, no matter how you
start it or what it's called. There is no 'console' version as such, but you
can use one of the DOS versions in a DOS box.
The Win16 GUI has an extra menu item: "Window/Select Font". It brings up the
standard Windows font selector. Note that bold and italic fonts are not
supported in an attempt to maximize GDI drawing speed.
Setting the menu height doesn't work for the Win16 GUI.
*win16-maximized*
If you want Vim to start with a maximized window, add this command to your
vimrc or gvimrc file: >
au GUIEnter * simalt ~x
<
There is a specific version of gvim.exe that runs under the Win32s subsystem
of Windows 3.1 or 3.11. See |win32s|.
==============================================================================
2. Vim as default editor *win16-default-editor*
To set Vim as the default editor for a file type you can use File Manager's
"Associate" feature.
When you open a file in Vim by double clicking it, Vim changes to that
file's directory.
See also |notepad|.
==============================================================================
3. Using the clipboard *win16-clipboard*
Windows has a clipboard, where you can copy text to, and paste text from. Vim
supports this in several ways.
The clipboard works in the same way as the Win32 version: see |gui-clipboard|.
==============================================================================
4. Shell Commands *win16-shell*
Vim spawns a DOS window for external commands, to make it possible to run any
DOS command. The window uses the _default.pif settings.
*win16-!start*
Normally, Vim waits for a command to complete before continuing (this makes
sense for most shell commands which produce output for Vim to use). If you
want Vim to start a program and return immediately, you can use the following
syntax:
:!start {command}
This may only work for a Windows program though.
Don't forget that you must tell Windows 3.1x to keep executing a DOS command
in the background while you switch back to Vim.
==============================================================================
5. Special colors *win16-colors*
On Win16, the normal DOS colors can be used. See |dos-colors|.
Additionally the system configured colors can also be used. These are known
by the names Sys_XXX, where XXX is the appropriate system color name, from the
following list (see the Win32 documentation for full descriptions). Case is
ignored.
Sys_BTNFace Sys_BTNShadow Sys_ActiveBorder
Sys_ActiveCaption Sys_AppWorkspace Sys_Background
Sys_BTNText Sys_CaptionText Sys_GrayText
Sys_Highlight Sys_HighlightText Sys_InactiveBorder
Sys_InactiveCaption Sys_InactiveCaptionText Sys_Menu
Sys_MenuText Sys_ScrollBar Sys_Window
Sys_WindowFrame Sys_WindowText
Probably the most useful values are
Sys_Window Normal window background
Sys_WindowText Normal window text
Sys_Highlight Highlighted background
Sys_HighlightText Highlighted text
These extra colors are also available:
Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet,
See also |rgb.txt|.
==============================================================================
*win16-dialogs*
6. Windows dialogs & browsers
The Win16 GUI can use familiar Windows components for some operations, as well
as the traditional interface shared with the console version.
6.1 Dialogs
The dialogs displayed by the "confirm" family (i.e. the 'confirm' option,
|:confirm| command and |confirm()| function are GUI-based rather than the
console-based ones used by other versions. There is no option to change this.
6.2 File Browsers
When prepending ":browse" before file editing commands, a file requester is
used to allow you to select an existing file. See |:browse|.
==============================================================================
7. Various *win16-various*
*win16-printing*
The "File/Print" menu uses Notepad to print the current buffer. This is a bit
clumsy, but it's portable. If you want something else, you can define your
own print command. For example, you could look for the 16-bit version of
PrintFile. See $VIMRUNTIME/menu.vim for how it works by default.
Using this should also work: >
:w >>prn
Vim supports a number of standard MS Windows features. Some of these are
detailed elsewhere: see |'mouse'|, |win32-hidden-menus|.
Also see |:simalt|
*win16-drag-n-drop*
You can drag and drop one or more files into the vim window, where they will
be opened as normal. If you hold down Shift while doing this, Vim changes to
the (first) dropped file's directory. If you hold Ctrl, Vim will always split
a new window for the file. Otherwise it's only done if the current buffer has
been changed.
You can also drop a directory's icon, but rather than open all files in the
directory (which wouldn't usually be what you want) Vim instead changes to
that directory and begins a new file.
If Vim happens to be editing a command line, the names of the dropped files
and directories will be inserted at the cursor. This allows you to use these
names with any Ex command.
*win16-truetype*
It is recommended that you use a raster font and not a TrueType
fixed-pitch font. e.g. Use Courier, not Courier New. This is not just
to use less resources but because there are subtle bugs in the
handling of fixed-pitch TrueType in Win3.1x. In particular, when you move
a block cursor over a pipe character '|', the cursor is drawn in the wrong
size and bits get left behind. This is a bug in the Win3.1x GDI, it doesn't
happen if you run the exe under 95/NT.
vim:tw=78:sw=4:ts=8:ft=help:norl:

View File

@ -0,0 +1,472 @@
*gui_w32.txt* For Vim version 6.3. Last change: 2004 May 03
VIM REFERENCE MANUAL by Bram Moolenaar
Vim's Win32 Graphical User Interface *gui-w32* *win32-gui*
1. Starting the GUI |gui-w32-start|
2. Vim as default editor |vim-default-editor|
3. Using the clipboard |gui-clipboard|
4. Shell Commands |gui-shell-win32|
5. Special colors |win32-colors|
6. Windows dialogs & browsers |gui-w32-dialogs|
7. Command line arguments |gui-w32-cmdargs|
8. Various |gui-w32-various|
Other relevant documentation:
|gui.txt| For generic items of the GUI.
|os_win32.txt| For Win32 specific items.
{Vi does not have a Windows GUI}
==============================================================================
1. Starting the GUI *gui-w32-start*
The Win32 GUI version of Vim will always start the GUI, no matter how you
start it or what it's called.
The GUI will always run in the Windows subsystem. Mostly shells automatically
return with a command prompt after starting gvim. If not, you should use the
"start" command: >
start gvim [options] file ..
Note: All fonts (bold, italic) must be of the same size!!! If you don't do
this, text will disappear or mess up the display. Vim does not check the font
sizes. It's the size in screen pixels that must be the same. Note that some
fonts that have the same point size don't have the same pixel size!
Additionally, the positioning of the fonts must be the same (ascent and
descent).
The Win32 GUI has an extra menu item: "Edit/Select Font". It brings up the
standard Windows font selector.
Setting the menu height doesn't work for the Win32 GUI.
*gui-win32-maximized*
If you want Vim to start with a maximized window, add this command to your
vimrc or gvimrc file: >
au GUIEnter * simalt ~x
<
*gui-w32s*
There is a specific version of gvim.exe that runs under the Win32s subsystem
of Windows 3.1 or 3.11. See |win32s|.
==============================================================================
2. Vim as default editor *vim-default-editor*
To set Vim as the default editor for a file type:
1. Start a Windows Explorer
2. Chose View/Options -> File Types
3. Select the path to gvim for every file type that you want to use it for.
(you can also use three spaces in the file type field, for files without an
extension).
In the "open" action, use: >
gvim "%1"
< The quotes are required for using file names with embedded spaces.
You can also use this: >
gvim "%L"
< This should avoid short (8.3 character) file names in some situations. But
I'm not sure if this works everywhere.
When you open a file in Vim by double clicking it, Vim changes to that
file's directory.
If you want Vim to start full-screen, use this for the Open action: >
gvim -c "simalt ~x" "%1"
Another method, which also works when you put Vim in another directory (e.g.,
when you have got a new version):
1. select a file you want to use Vim with
2. <Shift-F10>
3. select "Open With..." menu entry
4. click "Other..."
5. browse to the (new) location of Vim and click "Open"
6. make "Always Use this program..." checked
7. <OK>
*send-to-menu* *sendto*
You can also install Vim in the "Send To" menu:
1. Start a Windows Explorer
2. Navigate to your sendto directory:
Windows 95: %windir%\sendto (e.g. "c:\windows\sendto")
Windows NT: %windir%\profiles\%user%\sendto (e.g.
"c:\winnt\profiles\mattha\sendto").
3. Right-click in the file pane and select New->Shortcut
4. Follow the shortcut wizard, using the full path to VIM/GVIM.
When you 'send a file to Vim', Vim changes to that file's directory. Note,
however, that any long directory names will appear in their short (MS-DOS)
form. This is a limitation of the Windows "Send To" mechanism.
*notepad*
You could replace notepad.exe with gvim.exe, but that has a few side effects.
Some programs rely on notepad arguments, which are not recognized by Vim. For
example "notepad -p" is used by some applications to print a file. It's
better to leave notepad where it is and use another way to start Vim.
*win32-popup-menu*
A more drastic approach is to install an "Edit with Vim" entry in the popup
menu for the right mouse button. With this you can edit any file with Vim.
This can co-exist with the file associations mentioned above. The difference
is that the file associations will make starting Vim the default action. With
the "Edit with Vim" menu entry you can keep the existing file association for
double clicking on the file, and edit the file with Vim when you want. For
example, you can associate "*.mak" with your make program. You can execute
the makefile by double clicking it and use the "Edit with Vim" entry to edit
the makefile.
You can select any files and right-click to see a menu option called "Edit
with gvim". Chosing this menu option will invoke gvim with the file you have
selected. If you select multiple files, you will find two gvim-related menu
options:
"Edit with multiple gvims" -- one gvim for each file in the selection
"Edit with single gvim" -- one gvim for all the files in the selection
And if there already is a gvim running:
"Edit with existing gvim" -- edit the file with the running gvim
*install-registry*
You can add the "Edit with Vim" menu entry in an easy way by using the
"install.exe" program. It will add several registry entries for you.
You can also do this by hand. This is complicated! Use the install.exe if
you can.
1. Start the registry editor with "regedit".
2. Add these keys:
key value name value ~
HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}
{default} Vim Shell Extension
HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32
{default} {path}\gvimext.dll
ThreadingModel Apartment
HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim
{default} {51EEE242-AD87-11d3-9C1E-0090278BBD99}
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved
{51EEE242-AD87-11d3-9C1E-0090278BBD99}
Vim Shell Extension
HKEY_LOCAL_MACHINE\Software\Vim\Gvim
path {path}\gvim.exe
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\vim 5.6
DisplayName Vim 5.6: Edit with Vim popup menu entry
UninstallString {path}\uninstal.exe
Replace {path} with the path that leads to the executable.
Don't type {default}, this is the value for the key itself.
To remove "Edit with Vim" from the popup menu, just remove the registry
entries mentioned above. The "uninstal.exe" program can do this for you. You
can also use the entry in the Windows standard "Add/Remove Programs" list.
If you notice that this entry overrules other file type associations, set
those associations again by hand (using Windows Explorer, see above). This
only seems to happen on some Windows NT versions (Windows bug?). Procedure:
1. Find the name of the file type. This can be done by starting the registry
editor, and searching for the extension in \\HKEY_CLASSES_ROOT
2. In a Windows Explorer, use View/Options/File Types. Search for the file
type in the list and click "Edit". In the actions list, you can select on
to be used as the default (normally the "open" action) and click on the
"Set Default" button.
Vim in the "Open With..." context menu *win32-open-with-menu*
If you use the Vim install program you have the choice to add Vim to the "Open
With..." menu. This means you can use Vim to edit many files. Not every file
(for unclear reasons...), thus the "Edit with Vim" menu entry is still useful.
One reason to add this is to be able to edit HTML files directly from Internet
Explorer. To enable this use the "Tools" menu, "Internet Options..." entry.
In the dialog select the "Programs" tab and select Vim in the "HTML editor"
choice. If it's not there than installing didn't work properly.
Doing this manually can be done with this script:
----------------------------------------------------------
REGEDIT4
[HKEY_CLASSES_ROOT\Applications\gvim.exe]
[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell]
[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit]
[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\edit\command]
@="c:\\vim\\vim62\\gvim.exe \"%1\""
[HKEY_CLASSES_ROOT\.htm\OpenWithList\gvim.exe]
[HKEY_CLASSES_ROOT\*\OpenWithList\gvim.exe]
----------------------------------------------------------
Change the "c:\\vim\\vim62" bit to where gvim.exe is actually located.
To uninstall this run the Vim uninstall program or manually delete the
registry entries with "regedit".
==============================================================================
3. Using the clipboard *gui-clipboard*
Windows has a clipboard, where you can copy text to, and paste text from. Vim
supports this in several ways. For other systems see |gui-selections|.
The "* register reflects the contents of the clipboard. |quotestar|
When the "unnamed" string is included in the 'clipboard' option, the unnamed
register is the same. Thus you can yank to and paste from the clipboard
without prepending "* to commands.
The 'a' flag in 'guioptions' is not included by default. This means that text
is only put on the clipboard when an operation is performed on it. Just
Visually selecting text doesn't put it on the clipboard. When the 'a' flag is
included, the text is copied to the clipboard even when it is not operated
upon.
*mswin.vim*
To use the standard MS-Windows way of CTRL-X, CTRL-C and CTRL-V, use the
$VIMRUNTIME/mswin.vim script. You could add this line to your _vimrc file: >
source $VIMRUNTIME/mswin.vim
Since CTRL-C is used to copy the text to the clipboard, it can't be used to
cancel an operation. Use CTRL-Break for that.
*CTRL-V-alternative*
Since CTRL-V is used to paste, you can't use it to start a blockwise Visual
selection. You can use CTRL-Q instead. You can also use CTRL-Q in Insert
mode and Command-line mode to get the old meaning of CTRL-V. But CTRL-Q
doesn't work for terminals when it's used for control flow.
NOTE: The clipboard support still has a number of bugs. See |todo|.
==============================================================================
4. Shell Commands *gui-shell-win32*
Vim uses another window for external commands, to make it possible to run any
command. The external command gets its own environment for running, just like
it was started from a DOS prompt.
*win32-vimrun*
Executing an external command is done indirectly by the "vimrun" command. The
"vimrun.exe" must be in the path for this to work. Or it must be in the same
directory as the Vim executable. If "vimrun" cannot be found, the command is
executed directly, but then the DOS window closes immediately after the
external command has finished.
WARNING: If you close this window with the "X" button, and confirm the
question if you really want to kill the application, Vim may be killed too!
(This does not apply to commands run asynchronously with ":!start".)
In Windows 95, the window in which the commands are executed is always 25x80
characters, to be as DOS compatible as possible (this matters!). The default
system font is used. On NT, the window will be the default you have set up for
"Console" in Control Panel. On Win32s, the properties of the DOS box are
determined by _default.pif in the windows directory.
*msdos-mode*
If you get a dialog that says "This program is set to run in MS-DOS mode..."
when you run an external program, you can solve this by changing the
properties of the associated shortcut:
- Use a Windows Explorer to find the command.com that is used. It can be
c:\command.com, c:\dos\command.com, c:\windows\command.com, etc.
- With the right mouse button, select properties of this command.com.
- In the Program tab select "Advanced".
- Unselect "MS-DOS mode".
- Click "OK" twice.
*win32-!start*
Normally, Vim waits for a command to complete before continuing (this makes
sense for most shell commands which produce output for Vim to use). If you
want Vim to start a program and return immediately, you can use the following
syntax on W95 & NT: >
:!start {command}
On Win32s, you will have to go to another window instead. Don't forget that
you must tell Windows 3.1x to keep executing a DOS command in the background
while you switch back to Vim.
==============================================================================
5. Special colors *win32-colors*
On Win32, the normal DOS colors can be used. See |dos-colors|.
Additionally the system configured colors can also be used. These are known
by the names Sys_XXX, where XXX is the appropriate system color name, from the
following list (see the Win32 documentation for full descriptions). Case is
ignored. note: On Win32s not all of these colors are supported.
Sys_3DDKShadow Sys_3DFace Sys_BTNFace
Sys_3DHilight Sys_3DHighlight Sys_BTNHilight
Sys_BTNHighlight Sys_3DLight Sys_3DShadow
Sys_BTNShadow Sys_ActiveBorder Sys_ActiveCaption
Sys_AppWorkspace Sys_Background Sys_Desktop
Sys_BTNText Sys_CaptionText Sys_GrayText
Sys_Highlight Sys_HighlightText Sys_InactiveBorder
Sys_InactiveCaption Sys_InactiveCaptionText Sys_InfoBK
Sys_InfoText Sys_Menu Sys_MenuText
Sys_ScrollBar Sys_Window Sys_WindowFrame
Sys_WindowText
Probably the most useful values are
Sys_Window Normal window background
Sys_WindowText Normal window text
Sys_Highlight Highlighted background
Sys_HighlightText Highlighted text
These extra colors are also available:
Gray, Grey, LightYellow, SeaGreen, Orange, Purple, SlateBlue, Violet,
*rgb.txt*
Additionally, colors defined by a "rgb.txt" file can be used. This file is
well known from X11. A few lines from it: >
255 218 185 peach puff
205 133 63 peru
255 181 197 pink
This shows the layout of the file: First the R, G and B value as a decimal
number, followed by the name of the color. The four fields are separated by
spaces.
You can get an rgb.txt file from any X11 distribution. It is located in a
directory like "/usr/X11R6/lib/X11/". For Vim it must be located in the
$VIMRUNTIME directory. Thus the file can be found with "$VIMRUNTIME/rgb.txt".
==============================================================================
*gui-w32-dialogs* *dialog*
6. Windows dialogs & browsers
The Win32 GUI can use familiar Windows components for some operations, as well
as the traditional interface shared with the console version.
6.1 Dialogs
The dialogs displayed by the "confirm" family (i.e. the 'confirm' option,
|:confirm| command and |confirm()| function) are GUI-based rather than the
console-based ones used by other versions. The 'c' flag in 'guioptions'
changes this.
6.2 File Browsers
When prepending ":browse" before file editing commands, a file requester is
used to allow you to select an existing file. See |:browse|.
6.3 Tearoff Menus
The Win32 GUI emulates Motif's tear-off menus. At the top of each menu you
will see a small graphic "rip here" sign. Selecting it will cause a floating
window to be created with the same menu entries on it. The floating menu can
then be accessed just as if it was the original (including sub-menus), but
without having to go to the menu bar each time.
This is most useful if you find yourself using a command buried in a sub-menu
over and over again.
The tearoff menus can be positioned where you like, and always stay just above
the Main Vim window. You can get rid of them by closing them as usual; they
also of course close when you exit Vim.
*:tearoff* *:te*
:te[aroff] {name} Tear-off the menu {name}. The menu named must have at
least one subentry, but need not appear on the
menu-bar (see |win32-hidden-menus|).
Example: >
:tearoff File
will make the "File" menu (if there is one) appear as a tearoff menu. >
:amenu ]Toolbar.Make :make<CR>
:tearoff ]Toolbar
This creates a floating menu that doesn't exist on the main menu-bar.
Note that a menu that starts with ']' will not be displayed.
==============================================================================
7. Command line arguments *gui-w32-cmdargs*
Analysis of a command line into parameters is not standardised in MS Windows.
Gvim has to provide logic to analyse a command line. This logic is likely to
be different from the default logic provided by a compilation system used to
build vim. The differences relate to unusual double quote (") usage.
The arguments "C:\My Music\freude.txt" and "+/Sch\"iller" are handled in the
same way. The argument "+/Sch""iller" may be handled different by gvim and
vim, depending what it was compiled with.
The rules are:
a) A parameter is a sequence of graphic characters.
b) Parameters are separated by white space.
c) A parameter can be enclosed in double quotes to include white space.
d) A sequence of zero or more backslashes (\) and a double quote (")
is special. The effective number of backslashes is halved, rounded
down. An even number of backslashes reverses the acceptability of
spaces and tabs, an odd number of backslashes produces a literal
double quote.
So:
" is a special double quote
\" is a literal double quote
\\" is a literal backslash and a special double quote
\\\" is a literal backslash and a literal double quote
\\\\" is 2 literal backslashes and a special double quote
\\\\\" is 2 literal backslashes and a literal double quote
etc.
Example: >
gvim "C:\My Music\freude" +"set ignorecase" +/"\"foo\\" +\"bar\\\"
opens "C:\My Music\freude" and executes the line mode commands: >
set ignorecase; /"foo\ and /bar\"
==============================================================================
8. Various *gui-w32-various*
*gui-w32-printing*
The "File/Print" menu prints the text with syntax highlighting, see
|:hardcopy|. If you just want to print the raw text and have a default
printer installed this should also work: >
:w >>prn
Vim supports a number of standard MS Windows features. Some of these are
detailed elsewhere: see |'mouse'|, |win32-hidden-menus|.
*drag-n-drop-win32*
You can drag and drop one or more files into the Vim window, where they will
be opened as normal. See |drag-n-drop|.
*:simalt* *:si*
:sim[alt] {key} simulate pressing {key} while holding Alt pressed.
{not in Vi} {only for Win32 versions}
Normally, Vim takes control of all Alt-<Key> combinations, to increase the
number of possible mappings. This clashes with the standard use of Alt as the
key for accessing menus.
The quick way of getting standard behavior is to set the 'winaltkeys' option
to "yes". This however prevents you from mapping Alt keys at all.
Another way is to set 'winaltkeys' to "menu". Menu shortcut keys are then
handled by windows, other ALT keys can be mapped. This doesn't allow a
dependency on the current state though.
To get round this, the :simalt command allows Vim (when 'winaltkeys' is not
"yes") to fake a Windows-style Alt keypress. You can use this to map Alt key
combinations (or anything else for that matter) to produce standard Windows
actions. Here are some examples: >
:map <M-f> :simalt f<CR>
This makes Alt-F pop down the 'File' menu (with the stock Menu.vim) by
simulating the keystrokes Alt, F. >
:map <M-Space> :simalt ~<CR>
This maps Alt-Space to pop down the system menu for the Vim window. Note that
~ is used by simalt to represent the <Space> character. >
:map <C-n> :simalt ~n<CR>
Maps Control-N to produce the keys Alt-Space followed by N. This minimizes the
Vim window via the system menu.
*intellimouse-wheel-problems*
When using the Intellimouse mouse wheel causes Vim to stop accepting input, go
to:
ControlPanel - Mouse - Wheel - UniversalScrolling - Exceptions
And add gvim to the list of applications. This problem only appears to happen
with the Intellimouse driver 2.2 and when "Universal Scrolling" is turned on.
vim:tw=78:sw=4:ts=8:ft=help:norl:

View File

@ -0,0 +1,576 @@
*gui_x11.txt* For Vim version 6.3. Last change: 2004 Mar 16
VIM REFERENCE MANUAL by Bram Moolenaar
Vim's Graphical User Interface *gui-x11* *GUI-X11*
*Athena* *Motif*
1. Starting the X11 GUI |gui-x11-start|
2. GUI Resources |gui-resources|
3. Shell Commands |gui-pty|
4. Various |gui-x11-various|
5. GTK version |gui-gtk|
6. GNOME version |gui-gnome|
7. Compiling |gui-x11-compiling|
8. X11 selection mechanism |x11-selection|
Other relevant documentation:
|gui.txt| For generic items of the GUI.
{Vi does not have any of these commands}
==============================================================================
1. Starting the X11 GUI *gui-x11-start* *E665*
Then you can run the GUI version of Vim in either of these ways:
gvim [options] [files...]
vim -g [options] [files...]
So if you call the executable "gvim", or make "gvim" a link to the executable,
then the GUI version will automatically be used. Additional characters may be
added after "gvim", for example "gvim-5".
You may also start up the GUI from within the terminal version by using one of
these commands:
:gui [++opt] [+cmd] [-f|-b] [files...] *:gu* *:gui*
:gvim [++opt] [+cmd] [-f|-b] [files...] *:gv* *:gvim*
The "-f" option runs Vim in the foreground.
The "-b" option runs Vim in the background (this is the default).
Also see |++opt| and |+cmd|.
*gui-fork*
When the GUI is started, it does a fork() and exits the current process.
When gvim was started from a shell this makes the shell accept further
commands. If you don't want this (e.g. when using gvim for a mail program
that waits for gvim to exit), start gvim with "gvim -f", "vim -gf" or use
":gui -f". Don't use "vim -fg", because "-fg" specifies the foreground
color.
When using "gvim -f" and then ":gui", Vim will run in the foreground. The
"-f" argument will be remembered. To force running Vim in the background use
":gui -b".
"gvim --nofork" does the same as "gvim -f".
If you want the GUI to run in the foreground always, include the 'f'
flag in 'guioptions'. |-f|.
==============================================================================
2. GUI Resources *gui-resources* *.Xdefaults*
If using the Motif or Athena version of the GUI (not for the GTK+ or Win32
version), a number of X resources are available. You should use Vim's class
"Vim" when setting these. They are as follows:
Resource name Meaning ~
reverseVideo Boolean: should reverse video be used?
background Color of background.
foreground Color of normal text.
scrollBackground Color of trough portion of scrollbars.
scrollForeground Color of slider and arrow portions of scrollbars.
menuBackground Color of menu backgrounds.
menuForeground Color of menu foregrounds.
tooltipForeground Color of tooltip and balloon foreground.
tooltipBackground Color of tooltip and balloon background.
font Name of font used for normal text.
boldFont Name of font used for bold text.
italicFont Name of font used for italic text.
boldItalicFont Name of font used for bold, italic text.
menuFont Name of font used for the menus, used when compiled
without the |+xfontset| feature
menuFontSet Name of fontset used for the menus, used when compiled
with the |+xfontset| feature
tooltipFont Name of the font used for the tooltip and balloons.
When compiled with the |+xfontset| feature this is a
fontset name.
geometry Initial geometry to use for gvim's window (default
is same size as terminal that started it).
scrollbarWidth Thickness of scrollbars.
borderWidth Thickness of border around text area.
menuHeight Height of the menu bar (only for Athena).
A special font for italic, bold, and italic-bold text will only be used if
the user has specified one via a resource. No attempt is made to guess what
fonts should be used for these based on the normal text font.
Note that the colors can also be set with the ":highlight" command, using the
"Normal", "Menu", "Tooltip", and "Scrollbar" groups. Example: >
:highlight Menu guibg=lightblue
:highlight Tooltip guibg=yellow
:highlight Scrollbar guibg=lightblue guifg=blue
:highlight Normal guibg=grey90
<
*font-sizes*
Note: All fonts (except for the menu and tooltip) must be of the same size!!!
If you don't do this, text will disappear or mess up the display. Vim does
not check the font sizes. It's the size in screen pixels that must be the
same. Note that some fonts that have the same point size don't have the same
pixel size! Additionally, the positioning of the fonts must be the same
(ascent and descent). You can check this with "xlsfonts -l {fontname}".
If any of these things are also set with Vim commands, eg with
":set guifont=Screen15", then this will override the X resources (currently
'guifont' is the only option that is supported).
Here is an example of what you might put in your ~/.Xdefaults file: >
Vim*useSchemes: all
Vim*sgiMode: true
Vim*useEnhancedFSB: true
Vim.foreground: Black
Vim.background: Wheat
Vim*fontList: 7x13
The first three of these are standard resources on Silicon Graphics machines
which make Motif applications look even better, highly recommended!
The "Vim*fontList" is to set the menu font for Motif. Example: >
Vim*menuBar*fontList: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
With Athena: >
Vim*menuBar*SmeBSB*font: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
Vim*menuBar*MenuButton*font: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
NOTE: A more portable, and indeed more correct, way to specify the menu font
in either Motif or Athena is through the resource: >
Vim.menuFont: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
Or, when compiled with the |+xfontset| feature: >
Vim.menuFontSet: -*-courier-medium-r-*-*-10-*-*-*-*-*-*-*
Don't use "Vim*geometry" in the defaults. This will break the menus. Use
"Vim.geometry" instead.
If you get an error message "Cannot allocate colormap entry for "gray60",
try adding this to your Vim resources (change the colors to your liking): >
Vim*scrollBackground: Black
Vim*scrollForeground: Blue
The resources can also be set with arguments to Vim:
argument meaning ~
*-gui*
-display {display} Run vim on {display} *-display*
-iconic Start vim iconified *-iconic*
-background {color} Use {color} for the background *-background*
-bg {color} idem *-bg*
-foreground {color} Use {color} for normal text *-foreground*
-fg {color} idem *-fg*
-ul {color} idem *-ul*
-font {font} Use {font} for normal text *-font*
-fn {font} idem *-fn*
-boldfont {font} Use {font} for bold text *-boldfont*
-italicfont {font} Use {font} for italic text *-italicfont*
-menufont {font} Use {font} for menu items *-menufont*
-menufontset {fontset} Use {fontset} for menu items *-menufontset*
-mf {font} idem *-mf*
-geometry {geom} Use {geom} for initial geometry *-geometry*
-geom {geom} idem, see |-geometry-example| *-geom*
-borderwidth {width} Use a border width of {width} *-borderwidth*
-bw {width} idem *-bw*
*-scrollbarwidth*
-scrollbarwidth {width} Use a scrollbar width of {width}
-sw {width} idem *-sw*
-menuheight {height} Use a menu bar height of {height} *-menuheight*
-mh {height} idem *-mh*
NOTE: On Motif the value is ignored, the menu height
is computed to fit the menus.
-reverse Use reverse video *-reverse*
-rv idem *-rv*
+reverse Don't use reverse video *-+reverse*
+rv idem *-+rv*
-xrm {resource} Set the specified resource *-xrm*
Note about reverse video: Vim checks that the result is actually a light text
on a dark background. The reason is that some X11 versions swap the colors,
and some don't. These two examples will both give yellow text on a blue
background:
gvim -fg Yellow -bg Blue -reverse
gvim -bg Yellow -fg Blue -reverse
*-geometry-example*
An example for the geometry argument: >
gvim -geometry 80x63+8+100
This creates a window with 80 columns and 63 lines at position 8 pixels from
the left and 100 pixels from the top of the screen.
==============================================================================
3. Shell Commands *gui-pty*
WARNING: Executing an external command from the GUI will not always work.
"normal" commands like "ls", "grep" and "make" mostly work fine. Commands
that require an intelligent terminal like "less" and "ispell" won't work.
Some may even hang and need to be killed from another terminal. So be
careful!
There are two ways to do the I/O with a shell command: Pipes and a pseudo-tty.
The default is to use a pseudo-tty. This should work best on most systems.
Unfortunately, the implementation of the pseudo-tty is different on every Unix
system. And some systems require root permission. To avoid running into
problems with a pseudo-tty when you least expect it, test it when not editing
a file. Be prepared to "kill" the started command or Vim. Commands like
":r !cat" may hang!
If using a pseudo-tty does not work for you, reset the 'guipty' option: >
:set noguipty
Using a pipe should work on any Unix system, but there are disadvantages:
- Some shell commands will notice that a pipe is being used and behave
differently. E.g., ":!ls" will list the files in one column.
- The ":sh" command won't show a prompt, although it will sort of work.
- When using ":make" it's not possible to interrupt with a CTRL-C.
Typeahead while the external command is running is often lost. This happens
both with a pipe and a pseudo-tty. This is a known problem, but it seems it
can't be fixed (or at least, it's very difficult).
*gui-pty-erase*
When your erase character is wrong for an external command, you should fix
this in your "~/.cshrc" file, or whatever file your shell uses for
initializations. For example, when you want to use backspace to delete
characters, but hitting backspaces produces "^H" instead, try adding this to
your "~/.cshrc": >
stty erase ^H
The ^H is a real CTRL-H, type it as CTRL-V CTRL-H.
==============================================================================
4. Various *gui-x11-various*
*gui-x11-printing*
The "File/Print" menu simply sends the current buffer to "lpr". No options or
whatever. If you want something else, you can define your own print command.
For example: >
:10amenu File.Print :w !lpr -Php3
:10vmenu File.Print :w !lpr -Php3
<
*X11-icon*
Vim uses a black&white icon by default when compiled with Motif or Athena. A
colored Vim icon is included as $VIMRUNTIME/vim32x32.xpm. For GTK+, this is
the builtin icon used. Unfortunately, how you should install it depends on
your window manager. When you use this, remove the 'i' flag from
'guioptions', to remove the black&white icon: >
:set guioptions-=i
If you use one of the fvwm* family of window managers simply add this line to
your .fvwm2rc configuration file: >
Style "vim" Icon vim32x32.xpm
Make sure the icon file's location is consistent with the window manager's
ImagePath statement. Either modify the ImagePath from within your .fvwm2rc or
drop the icon into one the pre-defined directories: >
ImagePath /usr/X11R6/include/X11/pixmaps:/usr/X11R6/include/X11/bitmaps
Note: older versions of fvwm use "IconPath" instead of "ImagePath".
For CDE "dtwm" (a derivative of Motif) add this line in the .Xdefaults: >
Dtwm*Vim*iconImage: /usr/local/share/vim/vim32x32.xpm
For "mwm" (Motif window manager) the line would be: >
Mwm*Vim*iconImage: /usr/local/share/vim/vim32x32.xpm
Mouse Pointers Available in X11 *X11_mouse_shapes*
By using the |'mouseshape'| option, the mouse pointer can be automatically
changed whenever Vim enters one of its various modes (e.g., Insert or
Command). Currently, the available pointers are:
arrow an arrow pointing northwest
beam a I-like vertical bar
size an arrow pointing up and down
busy a wristwatch
blank an invisible pointer
crosshair a thin "+" sign
hand1 a dark hand pointing northeast
hand2 a light hand pointing northwest
pencil a pencil pointing southeast
question question_arrow
right_arrow an arrow pointing northeast
up_arrow an arrow pointing upwards
Additionally, any of the mouse pointers that are built into X11 may be
used by specifying an integer from the X11/cursorfont.h include file.
If a name is used that exists on other systems, but not in X11, the default
"arrow" pointer is used.
==============================================================================
5. GTK version *gui-gtk* *GTK+* *GTK*
The GTK version of the GUI works a little bit different.
GTK does _not_ use the traditional X resource settings. Thus items in your
~/.Xdefaults or app-defaults files are not used.
Many of the traditional X command line arguments are not supported. (e.g.,
stuff like -bg, -fg, etc). The ones that are supported are:
command line argument resource name meaning ~
-fn or -font .font font name for the text
-geom or -geometry .geometry size of the gvim window
-rv or -reverse *reverseVideo white text on black background
-display display to be used
-fg -foreground {color} foreground color
-bg -background {color} background color
To set the font, see |'guifont'|. For GTK, there's also a menu option that
does this.
Additionally, there are these command line arguments, which are handled by GTK
internally. Look in the GTK documentation for how they are used:
--sync
--gdk-debug
--gdk-no-debug
--no-xshm (not in GTK+ 2)
--xim-preedit (not in GTK+ 2)
--xim-status (not in GTK+ 2)
--gtk-debug
--gtk-no-debug
--g-fatal-warnings
--gtk-module
--display (GTK+ counterpart of -display; works the same way.)
--screen (The screen number; for GTK+ 2.2 multihead support.)
These arguments are ignored when the |+netbeans_intg| feature is used:
-xrm
-mf
As for colors, Vim's color settings (for syntax highlighting) is still
done the traditional Vim way. See |:highlight| for more help.
If you want to set the colors of remaining gui components (e.g., the
menubar, scrollbar, whatever), those are GTK specific settings and you
need to set those up in some sort of gtkrc file. You'll have to refer
to the GTK documentation, however little there is, on how to do this.
See http://developer.gnome.org/doc/API/2.0/gtk/gtk-Resource-Files.html
for more information.
*gtk-tooltip-colors*
Example, which sets the tooltip colors to black on light-yellow: >
style "tooltips"
{
bg[NORMAL] = "#ffffcc"
fg[NORMAL] = "#000000"
}
widget "gtk-tooltips*" style "tooltips"
Write this in the file ~/.gtkrc and it will be used by GTK+. For GTK+ 2
you might have to use the file ~/.gtkrc-2.0 instead, depending on your
distribution.
Using Vim as a GTK+ plugin *gui-gtk-socketid*
When the GTK+ version of Vim starts up normally, it creates its own top level
window (technically, a 'GtkWindow'). GTK+ provides an embedding facility with
its GtkSocket and GtkPlug widgets. If one GTK+ application creates a
GtkSocket widget in one of its windows, an entirely different GTK+ application
may embed itself into the first application by creating a top-level GtkPlug
widget using the socket's ID.
If you pass Vim the command-line option '--socketid' with a decimal or
hexadecimal value, Vim will create a GtkPlug widget using that value instead
of the normal GtkWindow. This enables Vim to act as a GTK+ plugin.
This really is a programmer's interface, and is of no use without a supporting
application to spawn the Vim correctly. For more details on GTK+ sockets, see
http://www.gtk.org/api/
Note that this feature requires the latest GTK version. GTK 1.2.10 still has
a small problem. The socket feature has not yet been tested with GTK+ 2 --
feel free to volunteer.
==============================================================================
6. GNOME version *gui-gnome* *Gnome* *GNOME*
The GNOME GUI works just like the GTK+ version. See |GTK+| above for how it
works. It looks a bit different though, and implements one important feature
that's not available in the plain GTK+ GUI: Interaction with the session
manager. |gui-gnome-session|
These are the different looks:
- Uses GNOME dialogs (GNOME 1 only). The GNOME 2 GUI uses the same nice
dialogs as the GTK+ 2 version.
- Uses the GNOME dock, so that the toolbar and menubar can be moved to
different locations other than the top (e.g., the toolbar can be placed on
the left, right, top, or bottom). The placement of the menubar and
toolbar is only saved in the GNOME 2 version.
- That means the menubar and toolbar handles are back! Yeah! And the
resizing grid still works too.
GNOME is automatically compiled with if it was found by configure.
(FIXME: Is this still true? Use --enable-gnome-check to force it to.)
GNOME session support *gui-gnome-session* *gnome-session*
On logout, Vim shows the well-known exit confirmation dialog if any buffers
are modified. Clicking [Cancel] will stop the logout process. Otherwise the
current session is stored to disk by using the |:mksession| command, and
restored the next time you log in.
The GNOME session support should also work with the KDE session manager.
If you are experiencing any problems please report them as bugs.
Note: The automatic session save works entirely transparent, in order to
avoid conflicts with your own session files, scripts and autocommands. That
means in detail:
- The session file is stored to a separate directory (usually $HOME/.gnome2).
- 'sessionoptions' is ignored, and a hardcoded set of appropriate flags is
used instead: >
blank,curdir,folds,globals,help,options,winsize
- The internal variable |v:this_session| is not changed when storing the
session. Also, it is restored to its old value when logging in again.
The position and size of the GUI window is not saved by Vim since doing so
is the window manager's job. But if compiled with GTK+ 2 support, Vim helps
the WM to identify the window by restoring the window role (using the |--role|
command line argument).
==============================================================================
7. Compiling *gui-x11-compiling*
If using X11, Vim's Makefile will by default first try to find the necessary
GTK+ files on your system. If the GTK+ files cannot be found, then the Motif
files will be searched for. Finally, if this fails, the Athena files will be
searched for. If all three fail, the GUI will be disabled.
For GTK+, Vim's configuration process requires that GTK+ be properly
installed. That is, the shell script 'gtk-config' must be in your PATH, and
you can already successful compile, build, and execute a GTK+ program. The
reason for this is because the compiler flags (CFLAGS) and link flags
(LDFLAGS) are obtained through the 'gtk-config' shell script.
If you want to build with GTK+ 2 support pass the --enable-gtk2-check argument
to ./configure. Optionally, support for GNOME 2 will be compiled if the
--enable-gnome-check option is also given. Note that the support for GTK+ 2
is still experimental. However, many people have reported that it works just
fine for them.
Otherwise, if you are using Motif or Athena, when you have the Motif or Athena
files in a directory where configure doesn't look, edit the Makefile to enter
the names of the directories. Search for "GUI_INC_LOC" for an example to set
the Motif directories, "CONF_OPT_X" for Athena.
*gui-x11-gtk*
At the time of this writing, you may use either GTK+ version 1.0.6 or 1.2. It
is suggested that you use v1.2 since not all of Vim's GUI features are present
if using v1.0.6. For instance, there are no tearoff menus present in v1.0.6.
Using a version from GTK+'s CVS tree may or may not work, and is therefore not
supported and not recommended.
For the experimental GTK+ 2 GUI, using the latest release of the GTK+ 2.0 or
GTK+ 2.2 series is recommended. CVS HEAD seems to work fine most of time as
well.
Lastly, although GTK+ has supposedly been ported to the Win32 platform, this
has not been tested with Vim and is also unsupported. Also, it's unlikely to
even compile since GTK+ GUI uses parts of the generic X11 code. This might
change in distant future; particularly because getting rid of the X11 centric
code parts is also required for GTK+ framebuffer support.
*gui-x11-motif*
For Motif, you need at least Motif version 1.2 and/or X11R5. Motif 2.0 and
X11R6 are OK. Motif 1.1 and X11R4 might work, no guarantee (there may be a
few problems, but you might make it compile and run with a bit of work, please
send me the patches if you do). The newest releases of LessTif have been
reported to work fine too.
*gui-x11-athena*
The Athena version uses the Xaw widget set by default. If you have the 3D
version, you might want to link with Xaw3d instead. This will make the
menus look a bit better. Edit the Makefile and look for "XAW_LIB". The
scrollbars will remain the same, because Vim has its own, which are already
3D (in fact, they look more like Motif).
*gui-x11-neXtaw*
The neXtaw version is mostly like Athena, but uses different widgets.
*gui-x11-misc*
In general, do not try to mix files from different GTK+, Motif, Athena and X11
versions. This will cause problems. For example, using header files for
X11R5 with a library for X11R6 probably doesn't work (although the linking
won't give an error message, Vim will crash later).
==============================================================================
8. X11 selection mechanism *x11-selection*
If using X11, in either the GUI or an xterm with an X11-aware Vim, then Vim
provides varied access to the X11 selection and clipboard. These are accessed
by using the two selection registers "* and "+.
X11 provides two basic types of global store, selections and cut-buffers,
which differ in one important aspect: selections are "owned" by an
application, and disappear when that application (e.g., Vim) exits, thus
losing the data, whereas cut-buffers, are stored within the X-server itself
and remain until written over or the X-server exits (e.g., upon logging out).
The contents of selections are held by the originating application (e.g., upon
a copy), and only passed on to another application when that other application
asks for them (e.g., upon a paste).
The contents of cut-buffers are immediately written to, and are then
accessible directly from the X-server, without contacting the originating
application.
*quoteplus* *quote+*
There are three documented X selections: PRIMARY (which is expected to
represent the current visual selection - as in Vim's Visual mode), SECONDARY
(which is ill-defined) and CLIPBOARD (which is expected to be used for
cut, copy and paste operations).
Of these three, Vim uses PRIMARY when reading and writing the "* register
(hence when the X11 selections are available, Vim sets a default value for
|'clipboard'| of "autoselect"), and CLIPBOARD when reading and writing the "+
register. Vim does not access the SECONDARY selection.
Examples: (assuming the default option values)
- Select an URL in Visual mode in Vim. Go to a text field in Netscape and
click the middle mouse button. The selected text will be inserted
(hopefully!).
- Select some text in Netscape by dragging with the mouse. Go to Vim and
press the middle mouse button: The selected text is inserted.
- Select some text in Vim and do "+y. Go to Netscape, select some text in a
textfield by dragging with the mouse. Now use the right mouse button and
select "Paste" from the popup menu. The selected text is overwritten by the
text from Vim.
Note that the text in the "+ register remains available when making a Visual
selection, which makes other text available in the "* register. That allows
overwriting selected text.
*x11-cut-buffer*
There are, by default, 8 cut-buffers: CUT_BUFFER0 to CUT_BUFFER7. Vim only
uses CUT_BUFFER0, which is the one that xterm uses by default.
Whenever Vim is about to become unavailable (either via exiting or becoming
suspended), and thus unable to respond to another application's selection
request, it writes the contents of any owned selection to CUT_BUFFER0. If the
"+ CLIPBOARD selection is owned by Vim, then this is written in preference,
otherwise if the "* PRIMARY selection is owned by Vim, then that is written.
Similarly, when Vim tries to paste from "* or "+ (either explicitly, or, in
the case of the "* register, when the middle mouse button is clicked), if the
requested X selection is empty or unavailable, Vim reverts to reading the
current value of the CUT_BUFFER0.
Note that when text is copied to CUT_BUFFER0 in this way, the type of
selection (character, line or block) is always lost, even if it is a Vim which
later pastes it.
Xterm, by default, always writes visible selections to both PRIMARY and
CUT_BUFFER0. When it pastes, it uses PRIMARY if this is available, or else
falls back upon CUT_BUFFER0. For this reason, when cutting and pasting
between Vim and an xterm, you should use the "* register. Xterm doesn't use
CLIPBOARD, thus the "+ doesn't work with xterm.
Most newer applications will provide their current selection via PRIMARY ("*)
and use CLIPBOARD ("+) for cut/copy/paste operations. You thus have access to
both by choosing to use either of the "* or "+ registers.
vim:tw=78:sw=4:ts=8:ft=help:norl:

View File

@ -0,0 +1,101 @@
*hangulin.txt* For Vim version 6.3. Last change: 2001 Sep 03
VIM REFERENCE MANUAL by Chi-Deok Hwang and Sung-Hyun Nam
Introduction *hangul*
------------
It is to input hangul, the Korean language, with VIM GUI version.
If you have a XIM program, you can use another |+xim| feature.
Basically, it is for whom has no XIM program.
Compile
-------
Next is a basic option. You can add any other configure option. >
./configure --with-x --enable-multibyte --enable-fontset --enable-hangulinput
And you should check the feature.h. If |+hangul_input| feature is enabled
by configure, you can select more options such as keyboard type, 2 bulsik
or 3 bulsik. You can find keywords like next in there. >
#define HANGUL_DEFAULT_KEYBOARD 2
#define ESC_CHG_TO_ENG_MODE
/* #define X_LOCALE */
/* #define SLOW_XSERVER */
Environment variables
---------------------
You should set LANG variable to Korean locale such as ko or ko_KR.euc.
If you set LC_ALL variable, it should be set to Korean locale also.
VIM resource
------------
You should add nexts to your global vimrc ($HOME/.vimrc). >
:set fileencoding=korea
Keyboard
--------
You can change keyboard type (2 bulsik or 3 bulsik) using VIM_KEYBOARD
or HANGUL_KEYBOARD_TYPE environment variables. For sh, just do (2 bulsik): >
export VIM_KEYBOARD="2"
or >
export HANGUL_KEYBOARD_TYPE="2"
If both are set, VIM_KEYBOARD has higher priority.
Hangul Fonts
------------
You can set text font using $HOME/.Xdefaults or $HOME/.gvimrc.
But to use Hangul, you should set 'guifontset' in your vimrc.
$HOME/.Xdefaults: >
Vim.font: english_font
! Nexts are for hangul menu with Athena
*international: True
Vim*fontSet: english_font,hangul_font
! Nexts are for hangul menu with Motif
*international: True
Vim*fontList: english_font;hangul_font:
$HOME/.gvimrc: >
set guifontset=english_font,hangul_font
attention! the , (comma) or ; (semicolon)
And there should be no ':set guifont'. If it exists, then Gvim ignores
':set guifontset'. It means VIM runs without fontset supporting.
So, you can see only English. Hangul does not be correctly displayed.
After 'fontset' feature is enabled, VIM does not allow using 'font'.
For example, if you use >
:set guifontset=eng_font,your_font
in your .gvimrc, then you should do for syntax >
:hi Comment guifg=Cyan font=another_eng_font,another_your_font
If you just do >
:hi Comment font=another_eng_font
then you can see a GOOD error message. Be careful!
hangul_font width should be twice than english_font width.
Unsupported Feature
-------------------
Johab font not yet supported. And I don't have any plan.
If you really want to use johab font, you can use the
hanguldraw.c in gau package.
Hanja input not yet supported. And I don't have any plan.
If you really want to input hanja, just use VIM with hanterm.
Bug or Comment
--------------
Send comments, patches and suggestions to:
Chi-Deok Hwang <hwang@mizi.co.kr>
Nam SungHyun <namsh@lge.com>
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,145 @@
*hebrew.txt* For Vim version 6.3. Last change: 2003 May 11
VIM REFERENCE MANUAL by Ron Aaron (and Avner Lottem)
Hebrew Language support (options & mapping) for Vim *hebrew*
The supporting 'rightleft' functionality was originally created by Avner
Lottem:
E-mail: alottem@iil.intel.com
Phone: +972-4-8307322
Ron Aaron <ron@ronware.org> is currently helping support these features.
{Vi does not have any of these commands}
All this is only available when the |+rightleft| feature was enabled at
compile time.
Introduction
------------
Hebrew-specific options are 'hkmap', 'hkmapp' 'keymap'=hebrew and 'aleph'.
Hebrew-useful options are 'delcombine', 'allowrevins', 'revins', 'rightleft'
and 'rightleftcmd'.
The 'rightleft' mode reverses the display order, so characters are displayed
from right to left instead of the usual left to right. This is useful
primarily when editing Hebrew or other Middle-Eastern languages.
See |rileft.txt| for further details.
Details
--------------
+ Options:
+ 'rightleft' ('rl') sets window orientation to right-to-left. This means
that the logical text 'ABC' will be displayed as 'CBA', and will start
drawing at the right edge of the window, not the left edge.
+ 'hkmap' ('hk') sets keyboard mapping to Hebrew, in insert/replace modes.
+ 'aleph' ('al'), numeric, holds the decimal code of Aleph, for keyboard
mapping.
+ 'hkmapp' ('hkp') sets keyboard mapping to 'phonetic hebrew'
NOTE: these three ('hkmap', 'hkmapp' and 'aleph') are obsolete. You should
use ":set keymap=hebrewp" instead.
+ 'delcombine' ('deco'), boolean, if editing UTF-8 encoded Hebrew, allows
one to remove the niqud or te`amim by pressing 'x' on a character (with
associated niqud).
+ 'rightleftcmd' ('rlc') makes the command-prompt for searches show up on
the right side. It only takes effect if the window is 'rightleft'.
+ Encoding:
+ Under Unix, ISO 8859-8 encoding (Hebrew letters codes: 224-250).
+ Under MS DOS, PC encoding (Hebrew letters codes: 128-154).
These are defaults, that can be overridden using the 'aleph' option.
+ You should prefer using UTF8, as it supports the combining-characters
('deco' does nothing if UTF8 encoding is not active).
+ Vim arguments:
+ 'vim -H file' starts editing a Hebrew file, i.e. 'rightleft' and 'hkmap'
are set.
+ Keyboard:
+ The 'allowrevins' option enables the CTRL-_ command in Insert mode and
in Command-line mode.
+ CTRL-_ in insert/replace modes toggles 'revins' and 'hkmap' as follows:
When in rightleft window, 'revins' and 'nohkmap' are toggled, since
English will likely be inserted in this case.
When in norightleft window, 'revins' 'hkmap' are toggled, since Hebrew
will likely be inserted in this case.
CTRL-_ moves the cursor to the end of the typed text.
+ CTRL-_ in command mode only toggles keyboard mapping (see Bugs below).
This setting is independent of 'hkmap' option, which only applies to
insert/replace mode.
Note: On some keyboards, CTRL-_ is mapped to CTRL-?.
+ Keyboard mapping while 'hkmap' is set (standard Israeli keyboard):
q w e r t y u i o p
/ ' ק ר א ט ו ן ם פ
a s d f g h j k l ; '
ש ד ג כ ע י ח ל ך ף ,
z x c v b n m , . /
ז ס ב ה נ מ צ ת ץ .
This is also the keymap when 'keymap=hebrew' is set. The advantage of
'keymap' is that it works properly when using UTF8, e.g. it inserts the
correct characters; 'hkmap' does not. The 'keymap' keyboard can also
insert niqud and te`amim. To see what those mappings are,look at the
keymap file 'hebrew.vim' etc.
Typing backwards
If the 'revins' (reverse insert) option is set, inserting happens backwards.
This can be used to type Hebrew. When inserting characters the cursor is not
moved and the text moves rightwards. A <BS> deletes the character under the
cursor. CTRL-W and CTRL-U also work in the opposite direction. <BS>, CTRL-W
and CTRL-U do not stop at the start of insert or end of line, no matter how
the 'backspace' option is set.
There is no reverse replace mode (yet).
If the 'showmode' option is set, "-- REVERSE INSERT --" will be shown in the
status line when reverse Insert mode is active.
When the 'allowrevins' option is set, reverse Insert mode can be also entered
via CTRL-_, which has some extra functionality: First, keyboard mapping is
changed according to the window orientation -- if in a left-to-right window,
'revins' is used to enter Hebrew text, so the keyboard changes to Hebrew
('hkmap' is set); if in a right-to-left window, 'revins' is used to enter
English text, so the keyboard changes to English ('hkmap' is reset). Second,
when exiting 'revins' via CTRL-_, the cursor moves to the end of the typed
text (if possible).
Pasting when in a rightleft window
----------------------------------
When cutting text with the mouse and pasting it in a rightleft window
the text will be reversed, because the characters come from the cut buffer
from the left to the right, while inserted in the file from the right to
the left. In order to avoid it, toggle 'revins' (by typing CTRL-? or CTRL-_)
before pasting.
Hebrew characters and the 'isprint' variable
--------------------------------------------
Sometimes Hebrew character codes are in the non-printable range defined by
the 'isprint' variable. For example in the Linux console, the Hebrew font
encoding starts from 128, while the default 'isprint' variable is @,161-255.
The result is that all Hebrew characters are displayed as ~x. To solve this
problem, set isprint=@,128-255.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,197 @@
*help.txt* For Vim version 6.3. Last change: 2004 May 04
VIM - main help file
k
Move around: Use the cursor keys, or "h" to go left, h l
"j" to go down, "k" to go up, "l" to go right. j
Close this window: Use ":q<Enter>".
Get out of Vim: Use ":qa!<Enter>" (careful, all changes are lost!).
Jump to a subject: Position the cursor on a tag between |bars| and hit CTRL-].
With the mouse: ":set mouse=a" to enable the mouse (in xterm or GUI).
Double-click the left mouse button on a tag between |bars|.
Jump back: Type CTRL-T or CTRL-O (repeat to go further back).
Get specific help: It is possible to go directly to whatever you want help
on, by giving an argument to the ":help" command |:help|.
It is possible to further specify the context:
*help-context*
WHAT PREPEND EXAMPLE ~
Normal mode commands (nothing) :help x
Visual mode commands v_ :help v_u
Insert mode commands i_ :help i_<Esc>
Command-line commands : :help :quit
Command-line editing c_ :help c_<Del>
Vim command arguments - :help -r
Options ' :help 'textwidth'
Search for help: Type ":help word", then hit CTRL-D to see matching
help entries for "word".
VIM stands for Vi IMproved. Most of VIM was made by Bram Moolenaar, but only
through the help of many others. See |credits|.
------------------------------------------------------------------------------
*doc-file-list* *Q_ct*
BASIC:
|quickref| Overview of the most common commands you will use
|tutor| 30 minutes training course for beginners
|copying| About copyrights
|iccf| Helping poor children in Uganda
|sponsor| Sponsor Vim development, become a registered Vim user
|www| Vim on the World Wide Web
|bugs| Where to send bug reports
USER MANUAL: These files explain how to accomplish an editing task.
|usr_toc.txt| Table Of Contents
Getting Started ~
|usr_01.txt| About the manuals
|usr_02.txt| The first steps in Vim
|usr_03.txt| Moving around
|usr_04.txt| Making small changes
|usr_05.txt| Set your settings
|usr_06.txt| Using syntax highlighting
|usr_07.txt| Editing more than one file
|usr_08.txt| Splitting windows
|usr_09.txt| Using the GUI
|usr_10.txt| Making big changes
|usr_11.txt| Recovering from a crash
|usr_12.txt| Clever tricks
Editing Effectively ~
|usr_20.txt| Typing command-line commands quickly
|usr_21.txt| Go away and come back
|usr_22.txt| Finding the file to edit
|usr_23.txt| Editing other files
|usr_24.txt| Inserting quickly
|usr_25.txt| Editing formatted text
|usr_26.txt| Repeating
|usr_27.txt| Search commands and patterns
|usr_28.txt| Folding
|usr_29.txt| Moving through programs
|usr_30.txt| Editing programs
|usr_31.txt| Exploiting the GUI
Tuning Vim ~
|usr_40.txt| Make new commands
|usr_41.txt| Write a Vim script
|usr_42.txt| Add new menus
|usr_43.txt| Using filetypes
|usr_44.txt| Your own syntax highlighted
|usr_45.txt| Select your language
Making Vim Run ~
|usr_90.txt| Installing Vim
REFERENCE MANUAL: These files explain every detail of Vim.
General subjects ~
|intro.txt| general introduction to Vim; notation used in help files
|help.txt| overview and quick reference (this file)
|index.txt| alphabetical index of all commands
|help-tags| all the tags you can jump to (index of tags)
|howto.txt| how to do the most common editing tasks
|tips.txt| various tips on using Vim
|message.txt| (error) messages and explanations
|quotes.txt| remarks from users of Vim
|todo.txt| known problems and desired extensions
|develop.txt| development of Vim
|uganda.txt| Vim distribution conditions and what to do with your money
Basic editing ~
|starting.txt| starting Vim, Vim command arguments, initialisation
|editing.txt| editing and writing files
|motion.txt| commands for moving around
|scroll.txt| scrolling the text in the window
|insert.txt| Insert and Replace mode
|change.txt| deleting and replacing text
|indent.txt| automatic indenting for C and other languages
|undo.txt| Undo and Redo
|repeat.txt| repeating commands, Vim scripts and debugging
|visual.txt| using the Visual mode (selecting a text area)
|various.txt| various remaining commands
|recover.txt| recovering from a crash
Advanced editing ~
|cmdline.txt| Command-line editing
|options.txt| description of all options
|pattern.txt| regexp patterns and search commands
|map.txt| key mapping and abbreviations
|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
|syntax.txt| syntax highlighting
|diff.txt| working with two or three versions of the same file
|autocmd.txt| automatically executing commands on an event
|filetype.txt| settings done specifically for a type of file
|eval.txt| expression evaluation, conditional commands
|fold.txt| hide (fold) ranges of lines
Special issues ~
|remote.txt| using Vim as a server or client
|term.txt| using different terminals and mice
|digraph.txt| list of available digraphs
|mbyte.txt| multi-byte text support
|mlang.txt| non-English language support
|arabic.txt| Arabic language support and editing
|farsi.txt| Farsi (Persian) editing
|hebrew.txt| Hebrew language support and editing
|russian.txt| Russian language support and editing
|hangulin.txt| Hangul (Korean) input mode
|rileft.txt| right-to-left editing mode
GUI ~
|gui.txt| Graphical User Interface (GUI)
|gui_w16.txt| Windows 3.1 GUI
|gui_w32.txt| Win32 GUI
|gui_x11.txt| X11 GUI
Interfaces ~
|if_cscop.txt| using cscope with Vim
|if_perl.txt| Perl interface
|if_pyth.txt| Python interface
|if_sniff.txt| SNiFF+ interface
|if_tcl.txt| Tcl interface
|if_ole.txt| OLE automation interface for Win32
|if_ruby.txt| Ruby interface
|debugger.txt| Interface with a debugger
|workshop.txt| Sun Visual Workshop interface
|netbeans.txt| NetBeans External Editor interface
|sign.txt| debugging signs
Versions ~
|vi_diff.txt| Main differences between Vim and Vi
|version4.txt| Differences between Vim version 3.0 and 4.x
|version5.txt| Differences between Vim version 4.6 and 5.x
|version6.txt| Differences between Vim version 5.7 and 6.x
*sys-file-list*
Remarks about specific systems ~
|os_390.txt| OS/390 Unix
|os_amiga.txt| Amiga
|os_beos.txt| BeOS and BeBox
|os_dos.txt| MS-DOS and MS-Windows NT/95 common items
|os_mac.txt| Macintosh
|os_mint.txt| Atari MiNT
|os_msdos.txt| MS-DOS (plain DOS and DOS box under Windows)
|os_os2.txt| OS/2
|os_qnx.txt| QNX
|os_risc.txt| RISC-OS
|os_unix.txt| Unix
|os_vms.txt| VMS
|os_win32.txt| MS-Windows 95/98/NT
*standard-plugin-list*
Standard plugins ~
|pi_netrw.txt| Reading and writing files over a network
|pi_gzip.txt| Reading and writing compressed files
|pi_expl.txt| File explorer
LOCAL ADDITIONS: *local-additions*
------------------------------------------------------------------------------
*bars* Bars example
Now that you've jumped here with CTRL-] or a double mouse click, you can use
CTRL-T, CTRL-O, g<RightMouse>, or <C-RightMouse> to go back to where you were.
------------------------------------------------------------------------------
vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl:

View File

@ -0,0 +1,96 @@
*howto.txt* For Vim version 6.3. Last change: 2001 Sep 03
VIM REFERENCE MANUAL by Bram Moolenaar
How to ... *howdoi* *how-do-i* *howto* *how-to*
|tutor| get started
|:quit| exit? I'm trapped, help me!
|initialization| initialize Vim
|vimrc-intro| write a Vim script file (vimrc)
|suspend| suspend Vim
|usr_11.txt| recover after a crash
|07.4| keep a backup of my file when writing over it
|usr_07.txt| edit files
|23.4| edit binary files
|usr_24.txt| insert text
|deleting| delete text
|usr_04.txt| change text
|04.5| copy and move text
|usr_25.txt| format text
|30.6| format comments
|30.2| indent C programs
|25.3| automatically set indent
|usr_26.txt| repeat commands
|02.5| undo and redo
|usr_03.txt| move around
|word-motions| word motions
|left-right-motions| left-right motions
|up-down-motions| up-down motions
|object-motions| text-object motions
|various-motions| various motions
|object-select| text-object selection
|'whichwrap'| move over line breaks
|'virtualedit'| move to where there is no text
|usr_27.txt| specify pattern for searches
|tags-and-searches| do tags and special searches
|29.4| search in include'd files used to find
variables, functions, or macros
|K| look up manual for the keyword under cursor
|03.7| scroll
|'sidescroll'| scroll horizontally/sideways
|'scrolloff'| set visible context lines
|mode-switching| change modes
|04.4| use Visual mode
|'insertmode'| start Vim in Insert mode
|40.1| map keys
|24.7| create abbreviations
|ins-expandtab| expand a tab to spaces in Insert mode
|i_CTRL-R| insert contents of a register in Insert mode
|24.3| complete words in Insert mode
|25.1| break a line before it gets too long
|20.1| do command-line editing
|20.3| do command-line completion
|'cmdheight'| increase the height of command-line
|10.3| specify command-line ranges
|40.3| specify commands to be executed automatically
before/after reading/writing entering/leaving a
buffer/window
|'autowrite'| write automatically
|30.1| speedup edit-compile-edit cycle or compile and fix
errors within Vim
|options| set options
|auto-setting| set options automatically
|term-dependent-settings| set options depending on terminal name
|save-settings| save settings
|:quote| comment my exrc/vimrc/gvimrc files
|'helpheight'| change the default help height
|'highlight'| set various highlighting modes
|'title'| set the window title
|'icon'| set window icon title
|'report'| avoid seeing the change messages on every line
|'shortmess'| avoid |hit-enter| prompts
|mouse-using| use mouse with Vim
|usr_08.txt| manage multiple windows and buffers
|gui.txt| use the gui
|You can't! (yet)| do dishes using Vim
|usr_06.txt| switch on syntax highlighting
|2html.vim| convert a colored file to HTML
|less| use Vim like less or more with syntax highlighting
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,474 @@
*if_cscop.txt* For Vim version 6.3. Last change: 2004 Jan 17
VIM REFERENCE MANUAL by Andy Kahn
*cscope* *Cscope*
This document explains how to use Vim's cscope interface.
Cscope is a tool like ctags, but think of it as ctags on steroids since it
does a lot more than what ctags provides. In Vim, jumping to a result from
a cscope query is just like jumping to any tag; it is saved on the tag stack
so that with the right keyboard mappings, you can jump back and forth between
functions as you normally would with |tags|.
1. Cscope introduction |cscope-intro|
2. Cscope related commands |cscope-commands|
3. Cscope options |cscope-options|
4. How to use cscope in Vim |cscope-howtouse|
5. Limitations |cscope-limitations|
6. Suggested usage |cscope-suggestions|
7. Availability & Information |cscope-info|
This is currently for Unix and Win32 only.
{Vi does not have any of these commands}
==============================================================================
1. Cscope introduction *cscope-intro*
The following text is taken from a version of the cscope man page:
-----
Cscope is an interactive screen-oriented tool that helps you:
Learn how a C program works without endless flipping through a thick
listing.
Locate the section of code to change to fix a bug without having to
learn the entire program.
Examine the effect of a proposed change such as adding a value to an
enum variable.
Verify that a change has been made in all source files such as adding
an argument to an existing function.
Rename a global variable in all source files.
Change a constant to a preprocessor symbol in selected lines of files.
It is designed to answer questions like:
Where is this symbol used?
Where is it defined?
Where did this variable get its value?
What is this global symbol's definition?
Where is this function in the source files?
What functions call this function?
What functions are called by this function?
Where does the message "out of space" come from?
Where is this source file in the directory structure?
What files include this header file?
Cscope answers these questions from a symbol database that it builds the
first time it is used on the source files. On a subsequent call, cscope
rebuilds the database only if a source file has changed or the list of
source files is different. When the database is rebuilt the data for the
unchanged files is copied from the old database, which makes rebuilding
much faster than the initial build.
-----
When cscope is normally invoked, you will get a full-screen selection
screen allowing you to make a query for one of the above questions.
However, once a match is found to your query and you have entered your
text editor to edit the source file containing match, you cannot simply
jump from tag to tag as you normally would with vi's Ctrl-] or :tag
command.
Vim's cscope interface is done by invoking cscope with its line-oriented
interface, and then parsing the output returned from a query. The end
result is that cscope query results become just like regular tags, so
you can jump to them just like you do with normal tags (Ctrl-] or :tag)
and then go back by popping off the tagstack with Ctrl-T. (Please note
however, that you don't actually jump to a cscope tag simply by doing
Ctrl-] or :tag without remapping these commands or setting an option.
See the remaining sections on how the cscope interface works and for
suggested use.)
==============================================================================
2. Cscope related commands *cscope-commands*
*:cscope* *:cs* *:scs* *:scscope* *E259* *E262* *E561* *E560*
All cscope commands are accessed through suboptions to the main cscope
command ":cscope". The shortest abbreviation is ":cs". The ":scscope"
command does the same and also splits the window (short: "scs").
The available subcommands are:
*E563* *E564* *E566* *E568* *E569* *E622* *E623*
*E625* *E626* *E609*
add : Add a new cscope database/connection.
USAGE :cs add {file|dir} [pre-path] [flags]
[pre-path] is the pathname used with the -P command to cscope.
[flags] are any additional flags you want to pass to cscope.
EXAMPLES >
:cscope add /usr/local/cdb/cscope.out
:cscope add /projects/vim/cscope.out /usr/local/vim
:cscope add cscope.out /usr/local/vim -C
<
*cscope-find* *cs-find*
*E565* *E567*
find : Query cscope. All cscope query options are available
except option #5 ("Change this grep pattern").
USAGE :cs find {querytype} {name}
{querytype} corresponds to the actual cscope line
interface numbers as well as default nvi commands:
0 or s: Find this C symbol
1 or g: Find this definition
2 or d: Find functions called by this function
3 or c: Find functions calling this function
4 or t: Find this text string
6 or e: Find this egrep pattern
7 or f: Find this file
8 or i: Find files #including this file
EXAMPLES >
:cscope find c vim_free
:cscope find 3 vim_free
<
These two examples perform the same query. >
:cscope find 0 DEFAULT_TERM
<
Executing this example on the source code for Vim 5.1 produces the
following output:
Cscope tag: DEFAULT_TERM
# line filename / context / line
1 1009 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"amiga"
2 1013 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"win32"
3 1017 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"pcterm"
4 1021 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"ansi"
5 1025 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"vt52"
6 1029 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"os2ansi"
7 1033 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"ansi"
8 1037 vim-5.1-gtk/src/term.c <<GLOBAL>>
# undef DEFAULT_TERM
9 1038 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"beos-ansi"
10 1042 vim-5.1-gtk/src/term.c <<GLOBAL>>
#define DEFAULT_TERM (char_u *)"mac-ansi"
11 1335 vim-5.1-gtk/src/term.c <<set_termname>>
term = DEFAULT_TERM;
12 1459 vim-5.1-gtk/src/term.c <<set_termname>>
if (STRCMP(term, DEFAULT_TERM))
13 1826 vim-5.1-gtk/src/term.c <<termcapinit>>
term = DEFAULT_TERM;
14 1833 vim-5.1-gtk/src/term.c <<termcapinit>>
term = DEFAULT_TERM;
15 3635 vim-5.1-gtk/src/term.c <<update_tcap>>
p = find_builtin_term(DEFAULT_TERM);
Enter nr of choice (<CR> to abort):
The output shows several pieces of information:
1. The tag number (there are 15 in this example).
2. The line number where the tag occurs.
3. The filename where the tag occurs.
4. The context of the tag (e.g., global, or the function name).
5. The line from the file itself.
help : Show a brief synopsis.
USAGE :cs help
*E260* *E261*
kill : Kill a cscope connection (or kill all cscope connections).
USAGE :cs kill {num|partial_name}
To kill a cscope connection, the connection number or a partial
name must be specified. The partial name is simply any part of
the pathname of the cscope database. Kill a cscope connection
using the partial name with caution!
If the specified connection number is -1, then _ALL_ cscope
connections will be killed.
reset : Reinit all cscope connections.
USAGE :cs reset
show : Show cscope connections.
USAGE :cs show
*:cstag* *E257* *E562*
If you use cscope as well as ctags, |:cstag| allows you to search one or
the other before making a jump. For example, you can choose to first
search your cscope database(s) for a match, and if one is not found, then
your tags file(s) will be searched. The order in which this happens
is determined by the value of |csto|. See |cscope-options| for more
details.
|:cstag| performs the equivalent of ":cs find g" on the identifier when
searching through the cscope database(s).
|:cstag| performs the equivalent of |:tjump| on the identifier when searching
through your tags file(s).
==============================================================================
3. Cscope options *cscope-options*
Use the |:set| command to set all cscope options. Ideally, you would do
this in one of your startup files (e.g., .vimrc). Some cscope related
variables are only valid within |.vimrc|. Setting them after vim has
started will have no effect!
*cscopeprg* *csprg*
'cscopeprg' specifies the command to execute cscope. The default is
"cscope". For example: >
:set csprg=/usr/local/bin/cscope
<
*cscopequickfix* *csqf* *E469*
{not available when compiled without the |+quickfix| feature}
'cscopequickfix' specifies whether to use quickfix window to show cscope
results. This is a list of comma-separated values. Each item consists of
|cscope-find| command (s, g, d, c, t, e, f or i) and flag (+, - or 0).
'+' indicates that results must be appended to quickfix window,
'-' implies previous results clearance, '0' or command absence - don't use
quickfix. Search is performed from start until first command occurrence.
The default value is "" (don't use quickfix anyway). The following value
seems to be useful: "s-,c-,d-,i-,t-,e-".
*cscopetag* *cst*
If 'cscopetag' set, the commands ":tag" and CTRL-] as well as "vim -t" will
always use |:cstag| instead of the default :tag behavior. Effectively, by
setting 'cst', you will always search your cscope databases as well as your
tag files. The default is off. Examples: >
:set cst
:set nocst
<
*cscopetagorder* *csto*
The value of 'csto' determines the order in which |:cstag| performs a search.
If 'csto' is set to zero, cscope database(s) are searched first, followed
by tag file(s) if cscope did not return any matches. If 'csto' is set to
one, tag file(s) are searched before cscope database(s). The default is zero.
Examples: >
:set csto=0
:set csto=1
<
*cscopeverbose* *csverb*
If 'cscopeverbose' is not set (the default), messages will not be printed
indicating success or failure when adding a cscope database. Ideally, you
should reset this option in your |.vimrc| before adding any cscope databases,
and after adding them, set it. From then on, when you add more databases
within Vim, you will get a (hopefully) useful message should the database fail
to be added. Examples: >
:set csverb
:set nocsverb
<
*cscopepathcomp* *cspc*
The value of 'cspc' determines how many components of a file's path to
display. With the default value of zero the entire path will be displayed.
The value one will display only the filename with no path. Other values
display that many components. For example: >
:set cspc=3
will display the last 3 components of the file's path, including the file
name itself.
==============================================================================
4. How to use cscope in Vim *cscope-howtouse*
The first thing you need to do is to build a cscope database for your
source files. For the most basic case, simply do "cscope -b". Please
refer to the cscope man page for more details.
Assuming you have a cscope database, you need to "add" the database to Vim.
This establishes a cscope "connection" and makes it available for Vim to use.
You can do this in your .vimrc file, or you can do it manually after starting
vim. For example, to add the cscope database "cscope.out", you would do:
:cs add cscope.out
You can double-check the result of this by executing ":cs show". This will
produce output which looks like this:
# pid database name prepend path
0 28806 cscope.out <none>
Note:
Because of the Microsoft RTL limitations, Win32 version shows 0 instead
of the real pid.
Once a cscope connection is established, you can make queries to cscope and
the results will be printed to you. Queries are made using the command
":cs find". For example:
:cs find g ALIGN_SIZE
This can get a little cumbersome since one ends up doing a significant
amount of typing. Fortunately, there are ways around this by mapping
shortcut keys. See |cscope-suggestions| for suggested usage.
If the results return only one match, you will automatically be taken to it.
If there is more than one match, you will be given a selection screen to pick
the match you want to go to. After you have jumped to the new location,
simply hit Ctrl-T to get back to the previous one.
==============================================================================
5. Limitations *cscope-limitations*
Cscope support for Vim is only available on systems that support these four
system calls: fork(), pipe(), execl(), waitpid(). This means it is mostly
limited to Unix systems.
Additionally Cscope support works for Win32. For more information and a
cscope version for Win32 see:
http://iamphet.nm.ru/cscope/index.html
There are a couple of hard-coded limitations:
1. The maximum number of cscope connections allowed is 8. Do you
really need more?
2. Doing a |:tjump| when |:cstag| searches the tag files is not
configurable (e.g., you can't do a tselect instead).
==============================================================================
6. Suggested usage *cscope-suggestions*
Put these entries in your .vimrc (adjust the pathname accordingly to your
setup): >
if has("cscope")
set csprg=/usr/local/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
By setting 'cscopetag', we have effectively replaced all instances of the :tag
command with :cstag. This includes :tag, Ctrl-], and "vim -t". In doing
this, the regular tag command not only searches your ctags generated tag
files, but your cscope databases as well.
Some users may want to keep the regular tag behavior and have a different
shortcut to access :cstag. For example, one could map Ctrl-_ (underscore)
to :cstag with the following command: >
map <C-_> :cstag <C-R>=expand("<cword>")<CR><CR>
A couple of very commonly used cscope queries (using ":cs find") is to
find all functions calling a certain function and to find all occurrences
of a particular C symbol. To do this, you can use these mappings as an
example: >
map g<C-]> :cs find 3 <C-R>=expand("<cword>")<CR><CR>
map g<C-\> :cs find 0 <C-R>=expand("<cword>")<CR><CR>
These mappings for Ctrl-] (right bracket) and Ctrl-\ (backslash) allow you to
place your cursor over the function name or C symbol and quickly query cscope
for any matches.
Or you may use the following scheme, inspired by Vim/Cscope tutorial from
Cscope Home Page (http://cscope.sourceforge.net/): >
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" Using 'CTRL-spacebar' then a search type makes the vim window
" split horizontally, with search result displayed in
" the new window.
nmap <C-Space>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one
nmap <C-Space><C-Space>s
\:vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>g
\:vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>c
\:vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>t
\:vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>e
\:vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>i
\:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space><C-Space>d
\:vert scs find d <C-R>=expand("<cword>")<CR><CR>
==============================================================================
7. Cscope availability and information *cscope-info*
If you do not already have cscope (it did not come with your compiler
license or OS distribution), then you can download it for free from:
http://cscope.sourceforge.net/
This is released by SCO under the BSD license.
If you want a newer version of cscope, you will probably have to buy it.
According to the (old) nvi documentation:
You can buy version 13.3 source with an unrestricted license
for $400 from AT&T Software Solutions by calling +1-800-462-8146.
Also you can download cscope 13.x and mlcscope 14.x (multi-lingual cscope
which supports C, C++, Java, lex, yacc, breakpoint listing, Ingres, and SDL)
from World-Wide Exptools Open Source packages page:
http://www.bell-labs.com/project/wwexptools/packages.html
In Solaris 2.x, if you have the C compiler license, you will also have
cscope. Both are usually located under /opt/SUNWspro/bin
SGI developers can also get it. Search for Cscope on this page:
http://freeware.sgi.com/index-by-alpha.html
https://toolbox.sgi.com/toolbox/utilities/cscope/
The second one is for those who have a password for the SGI toolbox.
There is source to an older version of a cscope clone (called "cs") available
on the net. Due to various reasons, this is not supported with Vim.
The cscope interface/support for Vim was originally written by
Andy Kahn <ackahn@netapp.com>. The original structure (as well as a tiny
bit of code) was adapted from the cscope interface in nvi. Please report
any problems, suggestions, patches, et al., you have for the usage of
cscope within Vim to him.
*cscope-win32*
For a cscope version for Win32 see: http://iamphet.nm.ru/cscope/index.html
Win32 support was added by Sergey Khorev <khorev@softlab.ru>. Contact him
if you have Win32-specific issues.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,162 @@
*if_ole.txt* For Vim version 6.3. Last change: 2003 Jun 19
VIM REFERENCE MANUAL by Paul Moore
The OLE Interface to Vim *ole-interface*
1. Activation |ole-activation|
2. Methods |ole-methods|
3. The "normal" command |ole-normal|
4. Registration |ole-registration|
5. MS Visual Studio integration |MSVisualStudio|
{Vi does not have any of these commands}
OLE is only available when compiled with the |+ole| feature. See
src/if_ole.INSTALL.
An alternative is using the client-server communication |clientserver|.
==============================================================================
1. Activation *ole-activation*
Vim acts as an OLE automation server, accessible from any automation client,
for example, Visual Basic, Python, or Perl. The Vim application "name" (its
"ProgID", in OLE terminology) is "Vim.Application".
Hence, in order to start a Vim instance (or connect to an already running
instance), code similar to the following should be used:
[Visual Basic] >
Dim Vim As Object
Set Vim = CreateObject("Vim.Application")
[Python] >
from win32com.client.dynamic import Dispatch
vim = Dispatch('Vim.Application')
[Perl] >
use Win32::OLE;
$vim = new Win32::OLE 'Vim.Application';
Vim does not support acting as a "hidden" OLE server, like some other OLE
Automation servers. When a client starts up an instance of Vim, that instance
is immediately visible. Simply closing the OLE connection to the Vim instance
is not enough to shut down the Vim instance - it is necessary to explicitly
execute a quit command (for example, :qa!, :wqa).
==============================================================================
2. Methods *ole-methods*
Vim exposes four methods for use by clients.
*ole-sendkeys*
SendKeys(keys) Execute a series of keys.
This method takes a single parameter, which is a string of keystrokes. These
keystrokes are executed exactly as if they had been types in at the keyboard.
Special keys can be given using their <..> names, as for the right hand side
of a mapping. Note: Execution of the Ex "normal" command is not supported -
see below |ole-normal|.
Examples (Visual Basic syntax) >
Vim.SendKeys "ihello<Esc>"
Vim.SendKeys "ma1GV4jy`a"
These examples assume that Vim starts in Normal mode. To force Normal mode,
start the key sequence with CTRL-\ CTRL-N as in >
Vim.SendKeys "<C-\><C-N>ihello<Esc>"
CTRL-\ CTRL-N returns Vim to Normal mode, when in Insert or Command-line mode.
Note that this doesn't work halfway a Vim command
*ole-eval*
Eval(expr) Evaluate an expression.
This method takes a single parameter, which is an expression in Vim's normal
format (see |expression|). It returns a string, which is the result of
evaluating the expression.
Examples (Visual Basic syntax) >
Line20 = Vim.Eval("getline(20)")
Twelve = Vim.Eval("6 + 6") ' Note this is a STRING
Font = Vim.Eval("&guifont")
<
*ole-setforeground*
SetForeground() Make the Vim window come to the foreground
This method takes no arguments. No value is returned.
Example (Visual Basic syntax) >
Vim.SetForeground
<
*ole-gethwnd*
GetHwnd() Return the handle of the Vim window.
This method takes no arguments. It returns the hwnd of the main Vimwindow.
You can use this if you are writing something which needs to manipulate the
Vim window, or to track it in the z-order, etc.
Example (Visual Basic syntax) >
Vim_Hwnd = Vim.GetHwnd
<
==============================================================================
3. The "normal" command *ole-normal*
Due to the way Vim processes OLE Automation commands, combined with the method
of implementation of the ex command :normal, it is not possible to execute the
:normal command via OLE automation. Any attempt to do so will fail, probably
harmlessly, although possibly in unpredictable ways.
There is currently no practical way to trap this situation, and users must
simply be aware of the limitation.
==============================================================================
4. Registration *ole-registration* *E243*
Before Vim will act as an OLE server, it must be registered in the system
registry. In order to do this, Vim should be run with a single parameter of
"-register".
*-register* >
gvim -register
If gvim with OLE support is run and notices that no Vim OLE server has been
registered, it will present a dialog and offers you the choice to register by
clicking "Yes".
In some situations registering is not possible. This happens when the
registry is not writable. If you run into this problem you need to run gvim
as "Administrator".
Once vim is registered, the application path is stored in the registry. Before
moving, deleting, or upgrading Vim, the registry entries should be removed
using the "-unregister" switch.
*-unregister* >
gvim -unregister
The OLE mechanism will use the first registered Vim it finds. If a Vim is
already running, this one will be used. If you want to have (several) Vim
sessions open that should not react to OLE commands, use the non-OLE version,
and put it in a different directory. The OLE version should then be put in a
directory that is not in your normal path, so that typing "gvim" will start
the non-OLE version.
*-silent*
To avoid the message box that pops up to report the result, prepend "-silent":
>
gvim -silent -register
gvim -silent -unregister
==============================================================================
5. MS Visual Studio integration *MSVisualStudio* *VisVim*
The OLE version can be used to run Vim as the editor in Microsoft Visual
Studio. This is called "VisVim". It is included in the archive that contains
the OLE version. The documentation can be found in the runtime directory, the
README_VisVim.txt file.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,258 @@
*if_perl.txt* For Vim version 6.3. Last change: 2004 May 01
VIM REFERENCE MANUAL by Sven Verdoolaege
and Matt Gerassimof
Perl and Vim *perl* *Perl*
1. Editing Perl files |perl-editing|
2. Compiling VIM with Perl interface |perl-compiling|
3. Using the Perl interface |perl-using|
{Vi does not have any of these commands}
The Perl interface only works when Vim was compiled with the |+perl| feature.
==============================================================================
1. Editing Perl files *perl-editing*
Vim syntax highlighting supports Perl and POD files. Vim assumes a file is
Perl code if the filename has a .pl or .pm suffix. Vim also examines the first
line of a file, regardless of the filename suffix, to check if a file is a
Perl script (see scripts.vim in Vim's syntax directory). Vim assumes a file
is POD text if the filename has a .POD suffix.
To use tags with Perl, you need a recent version of Exuberant ctags. Look
here:
http://ctags.sourceforge.net
Alternatively, you can use the Perl script pltags.pl, which is shipped with
Vim in the $VIMRUNTIME/tools directory. This script has currently more
features than Exuberant ctags' Perl support.
==============================================================================
2. Compiling VIM with Perl interface *perl-compiling*
To compile Vim with Perl interface, you need Perl 5.004 (or later). Perl must
be installed before you compile Vim. Vim's Perl interface does NOT work with
the 5.003 version that has been officially released! It will probably work
with Perl 5.003_05 and later.
The Perl patches for Vim were made by:
Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
Matt Gerassimof
Perl for MS-Windows can be found at:
http://www.perl.com/CPAN/ports/nt/Standard/x86/
==============================================================================
3. Using the Perl interface *perl-using*
*:perl* *:pe*
:pe[rl] {cmd} Execute Perl command {cmd}. The current package
is "main".
:pe[rl] << {endpattern}
{script}
{endpattern}
Execute Perl script {script}.
{endpattern} must NOT be preceded by any white space.
If {endpattern} is omitted, it defaults to a dot '.'
like for the |:append| and |:insert| commands. Using
'.' helps when inside a function, because "$i;" looks
like the start of an |:insert| command to Vim.
This form of the |:perl| command is mainly useful for
including perl code in vim scripts.
Note: This command doesn't work when the Perl feature
wasn't compiled in. To avoid errors, see
|script-here|.
Example vim script: >
function! WhitePearl()
perl << EOF
VIM::Msg("pearls are nice for necklaces");
VIM::Msg("rubys for rings");
VIM::Msg("pythons for bags");
VIM::Msg("tcls????");
EOF
endfunction
<
*:perldo* *:perld*
:[range]perld[o] {cmd} Execute Perl command {cmd} for each line in the
[range], with $_ being set to the text of each line in
turn, without a trailing <EOL>. Setting $_ will change
the text, but note that it is not possible to add or
delete lines using this command.
The default for [range] is the whole file: "1,$".
Here are some things you can try: >
:perl $a=1
:perldo $_ = reverse($_);1
:perl VIM::Msg("hello")
:perl $line = $curbuf->Get(42)
<
*E299*
Executing Perl commands in the |sandbox| is limited. ":perldo" will not be
possible at all. ":perl" will be evaluated in the Safe environment, if
possible.
*perl-overview*
Here is an overview of the functions that are available to Perl: >
:perl VIM::Msg("Text") # displays a message
:perl VIM::Msg("Error", "ErrorMsg") # displays an error message
:perl VIM::Msg("remark", "Comment") # displays a highlighted message
:perl VIM::SetOption("ai") # sets a vim option
:perl $nbuf = VIM::Buffers() # returns the number of buffers
:perl @buflist = VIM::Buffers() # returns array of all buffers
:perl $mybuf = (VIM::Buffers('qq.c'))[0] # returns buffer object for 'qq.c'
:perl @winlist = VIM::Windows() # returns array of all windows
:perl $nwin = VIM::Windows() # returns the number of windows
:perl ($success, $v) = VIM::Eval('&path') # $v: option 'path', $success: 1
:perl ($success, $v) = VIM::Eval('&xyz') # $v: '' and $success: 0
:perl $v = VIM::Eval('expand("<cfile>")') # expands <cfile>
:perl $curwin->SetHeight(10) # sets the window height
:perl @pos = $curwin->Cursor() # returns (row, col) array
:perl @pos = (10, 10)
:perl $curwin->Cursor(@pos) # sets cursor to @pos
:perl $curwin->Cursor(10,10) # sets cursor to row 10 col 10
:perl $mybuf = $curwin->Buffer() # returns the buffer object for window
:perl $curbuf->Name() # returns buffer name
:perl $curbuf->Number() # returns buffer number
:perl $curbuf->Count() # returns the number of lines
:perl $l = $curbuf->Get(10) # returns line 10
:perl @l = $curbuf->Get(1 .. 5) # returns lines 1 through 5
:perl $curbuf->Delete(10) # deletes line 10
:perl $curbuf->Delete(10, 20) # delete lines 10 through 20
:perl $curbuf->Append(10, "Line") # appends a line
:perl $curbuf->Append(10, "Line1", "Line2", "Line3") # appends 3 lines
:perl @l = ("L1", "L2", "L3")
:perl $curbuf->Append(10, @l) # appends L1, L2 and L3
:perl $curbuf->Set(10, "Line") # replaces line 10
:perl $curbuf->Set(10, "Line1", "Line2") # replaces lines 10 and 11
:perl $curbuf->Set(10, @l) # replaces 3 lines
<
*perl-Msg*
VIM::Msg({msg}, {group}?)
Displays the message {msg}. The optional {group}
argument specifies a highlight group for Vim to use
for the message.
*perl-SetOption*
VIM::SetOption({arg}) Sets a vim option. {arg} can be any argument that the
":set" command accepts. Note that this means that no
spaces are allowed in the argument! See |:set|.
*perl-Buffers*
VIM::Buffers([{bn}...]) With no arguments, returns a list of all the buffers
in an array context or returns the number of buffers
in a scalar context. For a list of buffer names or
numbers {bn}, returns a list of the buffers matching
{bn}, using the same rules as Vim's internal
|bufname()| function.
*perl-Windows*
VIM::Windows([{wn}...]) With no arguments, returns a list of all the windows
in an array context or returns the number of windows
in a scalar context. For a list of window numbers
{wn}, returns a list of the windows with those
numbers.
*perl-DoCommand*
VIM::DoCommand({cmd}) Executes Ex command {cmd}.
*perl-Eval*
VIM::Eval({expr}) Evaluates {expr} and returns (success, val).
success=1 indicates that val contains the value of
{expr}; success=0 indicates a failure to evaluate
the expression. '@x' returns the contents of register
x, '&x' returns the value of option x, 'x' returns the
value of internal |variables| x, and '$x' is equivalent
to perl's $ENV{x}. All |functions| accessible from
the command-line are valid for {expr}.
*perl-SetHeight*
Window->SetHeight({height})
Sets the Window height to {height}, within screen
limits.
*perl-GetCursor*
Window->Cursor({row}?, {col}?)
With no arguments, returns a (row, col) array for the
current cursor position in the Window. With {row} and
{col} arguments, sets the Window's cursor position to
{row} and {col}. Note that {col} is numbered from 0,
Perl-fashion, and thus is one less than the value in
Vim's ruler.
Window->Buffer() *perl-Buffer*
Returns the Buffer object corresponding to the given
Window.
*perl-Name*
Buffer->Name() Returns the filename for the Buffer.
*perl-Number*
Buffer->Number() Returns the number of the Buffer.
*perl-Count*
Buffer->Count() Returns the number of lines in the Buffer.
*perl-Get*
Buffer->Get({lnum}, {lnum}?, ...)
Returns a text string of line {lnum} in the Buffer
for each {lnum} specified. An array can be passed
with a list of {lnum}'s specified.
*perl-Delete*
Buffer->Delete({lnum}, {lnum}?)
Deletes line {lnum} in the Buffer. With the second
{lnum}, deletes the range of lines from the first
{lnum} to the second {lnum}.
*perl-Append*
Buffer->Append({lnum}, {line}, {line}?, ...)
Appends each {line} string after Buffer line {lnum}.
The list of {line}s can be an array.
*perl-Set*
Buffer->Set({lnum}, {line}, {line}?, ...)
Replaces one or more Buffer lines with specified
{lines}s, starting at Buffer line {lnum}. The list of
{line}s can be an array. If the arguments are
invalid, replacement does not occur.
$main::curwin
The current window object.
$main::curbuf
The current buffer object.
*script-here*
When using a script language in-line, you might want to skip this when the
language isn't supported. But this mechanism doesn't work: >
if has('perl')
perl << EOF
this will NOT work!
EOF
endif
Instead, put the Perl/Python/Ruby/etc. command in a function and call that
function: >
if has('perl')
function DefPerl()
perl << EOF
this works
EOF
endfunction
call DefPerl()
endif
Note that "EOF" must be at the start of the line.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,299 @@
*if_pyth.txt* For Vim version 6.3. Last change: 2004 Feb 28
VIM REFERENCE MANUAL by Paul Moore
The Python Interface to Vim *python* *Python*
1. Commands |python-commands|
2. The vim module |python-vim|
3. Buffer objects |python-buffer|
4. Range objects |python-range|
5. Window objects |python-window|
{Vi does not have any of these commands}
The Python interface is available only when Vim was compiled with the
|+python| feature.
==============================================================================
1. Commands *python-commands*
*:python* *:py* *E205* *E263* *E264*
:[range]py[thon] {stmt}
Execute Python statement {stmt}.
:[range]py[thon] << {endmarker}
{script}
{endmarker}
Execute Python script {script}.
Note: This command doesn't work when the Python
feature wasn't compiled in. To avoid errors, see
|script-here|.
{endmarker} must NOT be preceded by any white space. If {endmarker} is
omitted from after the "<<", a dot '.' must be used after {script}, like
for the |:append| and |:insert| commands.
This form of the |:python| command is mainly useful for including python code
in Vim scripts.
Example: >
function! IcecreamInitialize()
python << EOF
class StrawberryIcecream:
def __call__(self):
print 'EAT ME'
EOF
endfunction
<
Note: Python is very sensitive to the indenting. Also make sure the "class"
line and "EOF" do not have any indent.
*:pyfile* *:pyf*
:[range]pyf[ile] {file}
Execute the Python script in {file}. The whole
argument is used as a single file name. {not in Vi}
Both of these commands do essentially the same thing - they execute a piece of
Python code, with the "current range" |python-range| set to the given line
range.
In the case of :python, the code to execute is in the command-line.
In the case of :pyfile, the code to execute is the contents of the given file.
Python commands cannot be used in the |sandbox|.
To pass arguments you need to set sys.argv[] explicitly. Example: >
:python import sys
:python sys.argv = ["foo", "bar"]
:pyfile myscript.py
Here are some examples *python-examples* >
:python from vim import *
:python from string import upper
:python current.line = upper(current.line)
:python print "Hello"
:python str = current.buffer[42]
(Note that changes - like the imports - persist from one command to the next,
just like in the Python interpreter.)
==============================================================================
2. The vim module *python-vim*
Python code gets all of its access to vim (with one exception - see
|python-output| below) via the "vim" module. The vim module implements two
methods, three constants, and one error object. You need to import the vim
module before using it: >
:python import vim
Overview >
print "Hello" # displays a message
vim.command(cmd) # execute an ex command
w = vim.windows[n] # gets window "n"
cw = vim.current.window # gets the current window
b = vim.buffers[n] # gets buffer "n"
cb = vim.current.buffer # gets the current buffer
w.height = lines # sets the window height
w.cursor = (row, col) # sets the window cursor position
pos = w.cursor # gets a tuple (row, col)
name = b.name # gets the buffer file name
line = b[n] # gets a line from the buffer
lines = b[n:m] # gets a list of lines
num = len(b) # gets the number of lines
b[n] = str # sets a line in the buffer
b[n:m] = [str1, str2, str3] # sets a number of lines at once
del b[n] # deletes a line
del b[n:m] # deletes a number of lines
Methods of the "vim" module
vim.command(str) *python-command*
Executes the vim (ex-mode) command str. Returns None.
Examples: >
vim.command("set tw=72")
vim.command("%s/aaa/bbb/g")
< The following definition executes Normal mode commands: >
def normal(str):
vim.command("normal "+str)
# Note the use of single quotes to delimit a string containing
# double quotes
normal('"a2dd"aP')
< *E659*
The ":python" command cannot be used recursively with Python 2.2 and
older. This only works with Python 2.3 and later: >
:python vim.command("python print 'Hello again Python'")
vim.eval(str) *python-eval*
Evaluates the expression str using the vim internal expression
evaluator (see |expression|). Returns the expression result as a
string.
Examples: >
text_width = vim.eval("&tw")
str = vim.eval("12+12") # NB result is a string! Use
# string.atoi() to convert to
# a number.
Error object of the "vim" module
vim.error *python-error*
Upon encountering a Vim error, Python raises an exception of type
vim.error.
Example: >
try:
vim.command("put a")
except vim.error:
# nothing in register a
Constants of the "vim" module
Note that these are not actually constants - you could reassign them.
But this is silly, as you would then lose access to the vim objects
to which the variables referred.
vim.buffers *python-buffers*
A sequence object providing access to the list of vim buffers. The
object supports the following operations: >
b = vim.buffers[i] # Indexing (read-only)
b in vim.buffers # Membership test
n = len(vim.buffers) # Number of elements
for b in vim.buffers: # Sequential access
<
vim.windows *python-windows*
A sequence object providing access to the list of vim windows. The
object supports the following operations: >
w = vim.windows[i] # Indexing (read-only)
w in vim.windows # Membership test
n = len(vim.windows) # Number of elements
for w in vim.windows: # Sequential access
<
vim.current *python-current*
An object providing access (via specific attributes) to various
"current" objects available in vim:
vim.current.line The current line (RW) String
vim.current.buffer The current buffer (RO) Buffer
vim.current.window The current window (RO) Window
vim.current.range The current line range (RO) Range
The last case deserves a little explanation. When the :python or
:pyfile command specifies a range, this range of lines becomes the
"current range". A range is a bit like a buffer, but with all access
restricted to a subset of lines. See |python-range| for more details.
Output from Python *python-output*
Vim displays all Python code output in the Vim message area. Normal
output appears as information messages, and error output appears as
error messages.
In implementation terms, this means that all output to sys.stdout
(including the output from print statements) appears as information
messages, and all output to sys.stderr (including error tracebacks)
appears as error messages.
*python-input*
Input (via sys.stdin, including input() and raw_input()) is not
supported, and may cause the program to crash. This should probably be
fixed.
==============================================================================
3. Buffer objects *python-buffer*
Buffer objects represent vim buffers. You can obtain them in a number of ways:
- via vim.current.buffer (|python-current|)
- from indexing vim.buffers (|python-buffers|)
- from the "buffer" attribute of a window (|python-window|)
Buffer objects have one read-only attribute - name - the full file name for
the buffer. They also have three methods (append, mark, and range; see below).
You can also treat buffer objects as sequence objects. In this context, they
act as if they were lists (yes, they are mutable) of strings, with each
element being a line of the buffer. All of the usual sequence operations,
including indexing, index assignment, slicing and slice assignment, work as
you would expect. Note that the result of indexing (slicing) a buffer is a
string (list of strings). This has one unusual consequence - b[:] is different
from b. In particular, "b[:] = None" deletes the whole of the buffer, whereas
"b = None" merely updates the variable b, with no effect on the buffer.
Buffer indexes start at zero, as is normal in Python. This differs from vim
line numbers, which start from 1. This is particularly relevant when dealing
with marks (see below) which use vim line numbers.
The buffer object methods are:
b.append(str) Append a line to the buffer
b.append(list) Append a list of lines to the buffer
Note that the option of supplying a list of strings to
the append method differs from the equivalent method
for Python's built-in list objects.
b.mark(name) Return a tuple (row,col) representing the position
of the named mark (can also get the []"<> marks)
b.range(s,e) Return a range object (see |python-range|) which
represents the part of the given buffer between line
numbers s and e |inclusive|.
Examples (assume b is the current buffer) >
print b.name # write the buffer file name
b[0] = "hello!!!" # replace the top line
b[:] = None # delete the whole buffer
del b[:] # delete the whole buffer (same as above)
b[0:0] = [ "a line" ] # add a line at the top
del b[2] # delete a line (the third)
b.append("bottom") # add a line at the bottom
n = len(b) # number of lines
(row,col) = b.mark('a') # named mark
r = b.range(1,5) # a sub-range of the buffer
==============================================================================
4. Range objects *python-range*
Range objects represent a part of a vim buffer. You can obtain them in a
number of ways:
- via vim.current.range (|python-current|)
- from a buffer's range() method (|python-buffer|)
A range object is almost identical in operation to a buffer object. However,
all operations are restricted to the lines within the range (this line range
can, of course, change as a result of slice assignments, line deletions, or
the range.append() method).
The range object attributes are:
r.start Index of first line into the buffer
r.end Index of last line into the buffer
The range object methods are:
r.append(str) Append a line to the range
r.append(list) Append a list of lines to the range
Note that the option of supplying a list of strings to
the append method differs from the equivalent method
for Python's built-in list objects.
Example (assume r is the current range):
# Send all lines in a range to the default printer
vim.command("%d,%dhardcopy!" % (r.start+1,r.end+1))
==============================================================================
5. Window objects *python-window*
Window objects represent vim windows. You can obtain them in a number of ways:
- via vim.current.window (|python-current|)
- from indexing vim.windows (|python-windows|)
You can manipulate window objects only through their attributes. They have no
methods, and no sequence or other interface.
Window attributes are:
buffer (read-only) The buffer displayed in this window
cursor (read-write) The current cursor position in the window
This is a tuple, (row,col).
height (read-write) The window height, in rows
width (read-write) The window width, in columns
The height attribute is writable only if the screen is split horizontally.
The width attribute is writable only if the screen is split vertically.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,175 @@
*if_ruby.txt* For Vim version 6.3. Last change: 2004 Mar 14
VIM REFERENCE MANUAL by Shugo Maeda
The Ruby Interface to Vim *ruby* *Ruby*
1. Commands |ruby-commands|
2. The VIM module |ruby-vim|
3. VIM::Buffer objects |ruby-buffer|
4. VIM::Window objects |ruby-window|
5. Global variables |ruby-globals|
{Vi does not have any of these commands}
*E266* *E267* *E268* *E269* *E270* *E271* *E272* *E273*
The Ruby interface only works when Vim was compiled with the |+ruby| feature.
The home page for ruby is http://www.ruby-lang.org/. You can find links for
downloading Ruby there.
==============================================================================
1. Commands *ruby-commands*
*:ruby* *:rub*
:rub[y] {cmd} Execute Ruby command {cmd}.
:rub[y] << {endpattern}
{script}
{endpattern}
Execute Ruby script {script}.
{endpattern} must NOT be preceded by any white space.
If {endpattern} is omitted, it defaults to a dot '.'
like for the |:append| and |:insert| commands. This
form of the |:ruby| command is mainly useful for
including ruby code in vim scripts.
Note: This command doesn't work when the Ruby feature
wasn't compiled in. To avoid errors, see
|script-here|.
Example Vim script: >
function! RedGem()
ruby << EOF
class Garnet
def initialize(s)
@buffer = VIM::Buffer.current
vimputs(s)
end
def vimputs(s)
@buffer.append(@buffer.count,s)
end
end
gem = Garnet.new("pretty")
EOF
endfunction
<
*:rubydo* *:rubyd* *E265*
:[range]rubyd[o] {cmd} Evaluate Ruby command {cmd} for each line in the
[range], with $_ being set to the text of each line in
turn, without a trailing <EOL>. Setting $_ will change
the text, but note that it is not possible to add or
delete lines using this command.
The default for [range] is the whole file: "1,$".
*:rubyfile* *:rubyf*
:rubyf[ile] {file} Execute the Ruby script in {file}. This is the same as
":ruby load 'file'", but allows file name completion.
Executing Ruby commands is not possible in the |sandbox|.
==============================================================================
2. The VIM module *ruby-vim*
Ruby code gets all of its access to vim via the "VIM" module.
Overview >
print "Hello" # displays a message
VIM.command(cmd) # execute an ex command
num = VIM::Window.count # gets the number of windows
w = VIM::Window[n] # gets window "n"
cw = VIM::Window.current # gets the current window
num = VIM::Buffer.count # gets the number of buffers
b = VIM::Buffer[n] # gets buffer "n"
cb = VIM::Buffer.current # gets the current buffer
w.height = lines # sets the window height
w.cursor = [row, col] # sets the window cursor position
pos = w.cursor # gets an array [row, col]
name = b.name # gets the buffer file name
line = b[n] # gets a line from the buffer
num = b.count # gets the number of lines
b[n] = str # sets a line in the buffer
b.delete(n) # deletes a line
b.append(n, str) # appends a line after n
<
Module Functions:
*ruby-message*
VIM::message({msg})
Displays the message {msg}.
*ruby-set_option*
VIM::set_option({arg})
Sets a vim option. {arg} can be any argument that the ":set" command
accepts. Note that this means that no spaces are allowed in the
argument! See |:set|.
*ruby-command*
VIM::command({cmd})
Executes Ex command {cmd}.
*ruby-evaluate*
VIM::evaluate({expr})
Evaluates {expr} using the vim internal expression evaluator (see
|expression|). Returns the expression result as a string.
==============================================================================
3. VIM::Buffer objects *ruby-buffer*
VIM::Buffer objects represent vim buffers.
Class Methods:
current Returns the current buffer object.
count Returns the number of buffers.
self[{n}] Returns the buffer object for the number {n}. The first number
is 0.
Methods:
name Returns the name of the buffer.
number Returns the number of the buffer.
count Returns the number of lines.
length Returns the number of lines.
self[{n}] Returns a line from the buffer. {n} is the line number.
self[{n}] = {str}
Sets a line in the buffer. {n} is the line number.
delete({n}) Deletes a line from the buffer. {n} is the line number.
append({n}, {str})
Appends a line after the line {n}.
==============================================================================
4. VIM::Window objects *ruby-window*
VIM::Window objects represent vim windows.
Class Methods:
current Returns the current window object.
count Returns the number of windows.
self[{n}] Returns the window object for the number {n}. The first number
is 0.
Methods:
buffer Returns the buffer displayed in the window.
height Returns the height of the window.
height = {n} Sets the window height to {n}.
cursor Returns a [row, col] array for the cursor position.
cursor = [{row}, {col}]
Sets the cursor position to {row} and {col}.
==============================================================================
4. Global variables *ruby-globals*
There are two global variables.
$curwin The current window object.
$curbuf The current buffer object.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,95 @@
*if_sniff.txt* For Vim version 6.3. Last change: 2001 Sep 03
VIM REFERENCE MANUAL
by Anton Leherbauer (toni@takefive.co.at)
SNiFF+ and Vim *sniff*
1. Introduction |sniff-intro|
2. Commands |sniff-commands|
3. Compiling Vim with SNiFF+ interface |sniff-compiling|
{Vi does not have any of these commands} *E275* *E274* *E276* *E278* *E279*
The SNiFF+ interface only works, when Vim was compiled with the |+sniff|
feature.
==============================================================================
1. Introduction *sniff-intro*
The following features for the use with SNiFF+ are available:
* Vim can be used for all editing requests
* SNiFF+ recognizes and updates all browsers when a file is saved in Vim
* SNiFF+ commands can be issued directly from Vim
How to use Vim with SNiFF+
1. Make sure SNiFF+ is running.
2. In the Editor view of the Preferences dialog set the Field named
'External Editor' to 'Emacs/Vim'.
4. Start Vim
5. Connect to SNiFF+ (:sniff connect)
Once a connection is established, SNiFF+ uses Vim for all requests to show or
edit source code. On the other hand, you can send queries to SNiFF+ with the
:sniff command.
==============================================================================
2. Commands *sniff-commands*
*:sniff* *:sni*
:sni[ff] request [symbol] Send request to sniff with optional symbol.
{not in Vi}
:sni[ff] Display all possible requests and the connection
status
Most requests require a symbol (identifier) as parameter. If it is omitted,
Vim will use the current word under the cursor.
The available requests are listed below:
request mapping description
-------------------------------------------------------------------------------
connect sc Establish connection with SNiFF+.
Make sure SNiFF+ is prepared for this in the
Preferences
disconnect sq Disconnect from SNiFF+. You can reconnect any
time with :sniff connect (or 'sc')
toggle st Toggle between implementation
and definition file
find-symbol sf Load the symbol into a Symbol Browser
browse-class sb Loads the class into a Class Browser
superclass ss Edit superclass of symbol
overridden so Edit overridden method of symbol
retrieve-file srf Retrieve symbol in current file
retrieve-project srp Retrieve symbol in current project
retrieve-all-projects srP Retrieve symbol in all projects
retrieve-next sR Retrieve symbol using current Retriever
settings
goto-symbol sg Goto definition or implementation of symbol
hierarchy sh Load symbol into the Hierarchy Browser
restr-hier sH same as above but show only related classes
xref-to sxt Start a refers-to query on symbol and
load the results into the Cross Referencer
xref-by sxb Start a referred-by query on symbol
xref-has sxh Start a refers-to components query on symbol
xref-used-by sxu Start a referred-by as component query on
symbol
show-docu sd Show documentation of symbol
gen-docu sD Generate documentation of symbol
The mappings are defined in a file 'sniff.vim', which is part of every SNiFF+
product ($SNIFF_DIR/config/sniff.vim). This file is sourced whenever Vim
connects to SNiFF+.
==============================================================================
3. Compiling Vim with SNiFF+ interface *sniff-compiling*
To compile Vim with SNiFF+ support, you need two source files of the extra
archive: if_sniff.c and if_sniff.h.
On Unix: Edit the Makefile and uncomment the line "--enable-sniff". Or run
configure manually with this argument.
On NT: Specify SNIFF=yes with your make command.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,512 @@
*if_tcl.txt* For Vim version 6.3. Last change: 2004 Jan 17
VIM REFERENCE MANUAL by Ingo Wilken
The Tcl Interface to Vim *tcl* *Tcl* *TCL*
1. Commands |tcl-ex-commands|
2. Tcl commands |tcl-commands|
3. Tcl variables |tcl-variables|
4. Tcl window commands |tcl-window-cmds|
5. Tcl buffer commands |tcl-buffer-cmds|
6. Miscellaneous; Output from Tcl |tcl-misc| |tcl-output|
7. Known bugs & problems |tcl-bugs|
8. Examples |tcl-examples|
{Vi does not have any of these commands} *E280* *E281*
The Tcl interface only works when Vim was compiled with the |+tcl| feature.
WARNING: There are probably still some bugs. Please send bug reports,
comments, ideas etc to <Ingo.Wilken@informatik.uni-oldenburg.de>
==============================================================================
1. Commands *tcl-ex-commands* *E571* *E572*
*:tcl* *:tc*
:tc[l] {cmd} Execute Tcl command {cmd}.
:[range]tc[l] << {endmarker}
{script}
{endmarker}
Execute Tcl script {script}.
Note: This command doesn't work when the Tcl feature
wasn't compiled in. To avoid errors, see
|script-here|.
{endmarker} must NOT be preceded by any white space. If {endmarker} is
omitted from after the "<<", a dot '.' must be used after {script}, like for
the |:append| and |:insert| commands.
This form of the |:tcl| command is mainly useful for including tcl code in Vim
scripts.
Example: >
function! DefineDate()
tcl << EOF
proc date {} {
return [clock format [clock seconds]]
}
EOF
endfunction
<
*:tcldo* *:tcld*
:[range]tcld[o] {cmd} Execute Tcl command {cmd} for each line in [range]
with the variable "line" being set to the text of each
line in turn, and "lnum" to the line number. Setting
"line" will change the text, but note that it is not
possible to add or delete lines using this command.
If {cmd} returns an error, the command is interrupted.
The default for [range] is the whole file: "1,$".
See |tcl-var-line| and |tcl-var-lnum|. {not in Vi}
*:tclfile* *:tclf*
:tclf[ile] {file} Execute the Tcl script in {file}. This is the same as
":tcl source {file}", but allows file name completion.
{not in Vi}
Note that Tcl objects (like variables) persist from one command to the next,
just as in the Tcl shell.
Executing Tcl commands is not possible in the |sandbox|.
==============================================================================
2. Tcl commands *tcl-commands*
Tcl code gets all of its access to vim via commands in the "::vim" namespace.
The following commands are implemented: >
::vim::beep # Guess.
::vim::buffer {n} # Create Tcl command for one buffer.
::vim::buffer list # Create Tcl commands for all buffers.
::vim::command [-quiet] {cmd} # Execute an ex command.
::vim::expr {expr} # Use Vim's expression evaluator.
::vim::option {opt} # Get vim option.
::vim::option {opt} {val} # Set vim option.
::vim::window list # Create Tcl commands for all windows.
Commands:
::vim::beep *tcl-beep*
Honk. Does not return a result.
::vim::buffer {n} *tcl-buffer*
::vim::buffer exists {n}
::vim::buffer list
Provides access to vim buffers. With an integer argument, creates a
buffer command (see |tcl-buffer-cmds|) for the buffer with that
number, and returns its name as the result. Invalid buffer numbers
result in a standard Tcl error. To test for valid buffer numbers,
vim's internal functions can be used: >
set nbufs [::vim::expr bufnr("$")]
set isvalid [::vim::expr "bufexists($n)"]
< The "list" option creates a buffer command for each valid buffer, and
returns a list of the command names as the result.
Example: >
set bufs [::vim::buffer list]
foreach b $bufs { $b append end "The End!" }
< The "exists" option checks if a buffer with the given number exists.
Example: >
if { [::vim::buffer exists $n] } { ::vim::command ":e #$n" }
< This command might be replaced by a variable in future versions.
See also |tcl-var-current| for the current buffer.
::vim::command {cmd} *tcl-command*
::vim::command -quiet {cmd}
Execute the vim (ex-mode) command {cmd}. Any ex command that affects
a buffer or window uses the current buffer/current window. Does not
return a result other than a standard Tcl error code. After this
command is completed, the "::vim::current" variable is updated.
The "-quiet" flag suppresses any error messages from vim.
Examples: >
::vim::command "set ts=8"
::vim::command "%s/foo/bar/g"
< To execute normal-mode commands, use "normal" (see |:normal|): >
set cmd "jj"
::vim::command "normal $cmd"
< See also |tcl-window-command| and |tcl-buffer-command|.
::vim::expr {expr} *tcl-expr*
Evaluates the expression {expr} using vim's internal expression
evaluator (see |expression|). Any expression that queries a buffer
or window property uses the current buffer/current window. Returns
the result as a string.
Examples: >
set perl_available [::vim::expr has("perl")]
< See also |tcl-window-expr| and |tcl-buffer-expr|.
::vim::option {opt} *tcl-option*
::vim::option {opt} {value}
Without second argument, queries the value of a vim option. With this
argument, sets the vim option to {value}, and returns the previous
value as the result. Any options that are marked as 'local to buffer'
or 'local to window' affect the current buffer/current window. The
global value is not changed, use the ":set" command for that. For
boolean options, {value} should be "0" or "1", or any of the keywords
"on", "off" or "toggle". See |option-summary| for a list of options.
Example: >
::vim::option ts 8
< See also |tcl-window-option| and |tcl-buffer-option|.
::vim::window {option} *tcl-window*
Provides access to vim windows. Currently only the "list" option is
implemented. This creates a window command (see |tcl-window-cmds|) for
each window, and returns a list of the command names as the result.
Example: >
set wins [::vim::window list]
foreach w $wins { $w height 4 }
< This command might be replaced by a variable in future versions.
See also |tcl-var-current| for the current window.
==============================================================================
3. Tcl variables *tcl-variables*
The ::vim namespace contains a few variables. These are created when the Tcl
interpreter is called from vim and set to current values. >
::vim::current # array containing "current" objects
::vim::lbase # number of first line
::vim::range # array containing current range numbers
line # current line as a string (:tcldo only)
lnum # current line number (:tcldo only)
Variables:
::vim::current *tcl-var-current*
This is an array providing access to various "current" objects
available in vim. The contents of this array are updated after
"::vim::command" is called, as this might change vim's current
settings (e.g., by deleting the current buffer).
The "buffer" element contains the name of the buffer command for the
current buffer. This can be used directly to invoke buffer commands
(see |tcl-buffer-cmds|). This element is read-only.
Example: >
$::vim::current(buffer) insert begin "Hello world"
< The "window" element contains the name of the window command for the
current window. This can be used directly to invoke window commands
(see |tcl-window-cmds|). This element is read-only.
Example: >
$::vim::current(window) height 10
<
::vim::lbase *tcl-var-lbase*
This variable controls how Tcl treats line numbers. If it is set to
'1', then lines and columns start at 1. This way, line numbers from
Tcl commands and vim expressions are compatible. If this variable is
set to '0', then line numbers and columns start at 0 in Tcl. This is
useful if you want to treat a buffer as a Tcl list or a line as a Tcl
string and use standard Tcl commands that return an index ("lsort" or
"string first", for example). The default value is '1'. Currently,
any non-zero values is treated as '1', but your scripts should not
rely on this. See also |tcl-linenumbers|.
::vim::range *tcl-var-range*
This is an array with three elements, "start", "begin" and "end". It
contains the line numbers of the start and end row of the current
range. "begin" is the same as "start". This variable is read-only.
See |tcl-examples|.
line *tcl-var-line*
lnum *tcl-var-lnum*
These global variables are only available if the ":tcldo" ex command
is being executed. They contain the text and line number of the
current line. When the Tcl command invoked by ":tcldo" is completed,
the current line is set to the contents of the "line" variable, unless
the variable was unset by the Tcl command. The "lnum" variable is
read-only. These variables are not in the "::vim" namespace so they
can be used in ":tcldo" without much typing (this might be changed in
future versions). See also |tcl-linenumbers|.
==============================================================================
4. Tcl window commands *tcl-window-cmds*
Window commands represent vim windows. They are created by several commands:
::vim::window list |tcl-window|
"windows" option of a buffer command |tcl-buffer-windows|
The ::vim::current(window) variable contains the name of the window command
for the current window. A window command is automatically deleted when the
corresponding vim window is closed.
Lets assume the name of the window command is stored in the Tcl variable "win",
i.e. "$win" calls the command. The following options are available: >
$win buffer # Create Tcl command for window's buffer.
$win command {cmd} # Execute ex command in windows context.
$win cursor # Get current cursor position.
$win cursor {var} # Set cursor position from array variable.
$win cursor {row} {col} # Set cursor position.
$win delcmd {cmd} # Call Tcl command when window is closed.
$win expr {expr} # Evaluate vim expression in windows context.
$win height # Report the window's height.
$win height {n} # Set the window's height.
$win option {opt} [val] # Get/Set vim option in windows context.
Options:
$win buffer *tcl-window-buffer*
Creates a Tcl command for the window's buffer, and returns its name as
the result. The name should be stored in a variable: >
set buf [$win buffer]
< $buf is now a valid Tcl command. See |tcl-buffer-cmds| for the
available options.
$win cursor *tcl-window-cursor*
$win cursor {var}
$win cursor {row} {col}
Without argument, reports the current cursor position as a string.
This can be converted to a Tcl array variable: >
array set here [$win cursor]
< "here(row)" and "here(column)" now contain the cursor position.
With a single argument, the argument is interpreted as the name of a
Tcl array variable, which must contain two elements "row" and "column".
These are used to set the cursor to the new position: >
$win cursor here ;# not $here !
< With two arguments, sets the cursor to the specified row and column: >
$win cursor $here(row) $here(column)
< Invalid positions result in a standard Tcl error, which can be caught
with "catch". The row and column values depend on the "::vim::lbase"
variable. See |tcl-var-lbase|.
$win delcmd {cmd} *tcl-window-delcmd*
Registers the Tcl command {cmd} as a deletion callback for the window.
This command is executed (in the global scope) just before the window
is closed. Complex commands should be build with "list": >
$win delcmd [list puts vimerr "window deleted"]
< See also |tcl-buffer-delcmd|.
$win height *tcl-window-height*
$win height {n}
Without argument, reports the window's current height. With an
argument, tries to set the window's height to {n}, then reports the
new height (which might be different from {n}).
$win command [-quiet] {cmd} *tcl-window-command*
$win expr {expr} *tcl-window-expr*
$win option {opt} [val] *tcl-window-option*
These are similar to "::vim::command" etc., except that everything is
done in the context of the window represented by $win, instead of the
current window. For example, setting an option that is marked 'local
to window' affects the window $win. Anything that affects or queries
a buffer uses the buffer displayed in this window (i.e. the buffer
that is represented by "$win buffer"). See |tcl-command|, |tcl-expr|
and |tcl-option| for more information.
Example: >
$win option number on
==============================================================================
5. Tcl buffer commands *tcl-buffer-cmds*
Buffer commands represent vim buffers. They are created by several commands:
::vim::buffer {N} |tcl-buffer|
::vim::buffer list |tcl-buffer|
"buffer" option of a window command |tcl-window-buffer|
The ::vim::current(buffer) variable contains the name of the buffer command
for the current buffer. A buffer command is automatically deleted when the
corresponding vim buffer is destroyed. Whenever the buffer's contents are
changed, all marks in the buffer are automatically adjusted. Any changes to
the buffer's contents made by Tcl commands can be undone with the "undo" vim
command (see |undo|).
Lets assume the name of the buffer command is stored in the Tcl variable "buf",
i.e. "$buf" calls the command. The following options are available: >
$buf append {n} {str} # Append a line to buffer, after line {n}.
$buf command {cmd} # Execute ex command in buffers context.
$buf count # Report number of lines in buffer.
$buf delcmd {cmd} # Call Tcl command when buffer is deleted.
$buf delete {n} # Delete a single line.
$buf delete {n} {m} # Delete several lines.
$buf expr {expr} # Evaluate vim expression in buffers context.
$buf get {n} # Get a single line as a string.
$buf get {n} {m} # Get several lines as a list.
$buf insert {n} {str} # Insert a line in buffer, as line {n}.
$buf last # Report line number of last line in buffer.
$buf mark {mark} # Report position of buffer mark.
$buf name # Report name of file in buffer.
$buf number # Report number of this buffer.
$buf option {opt} [val] # Get/Set vim option in buffers context.
$buf set {n} {text} # Replace a single line.
$buf set {n} {m} {list} # Replace several lines.
$buf windows # Create Tcl commands for buffer's windows.
<
*tcl-linenumbers*
Most buffer commands take line numbers as arguments. How Tcl treats these
numbers depends on the "::vim::lbase" variable (see |tcl-var-lbase|). Instead
of line numbers, several keywords can be also used: "top", "start", "begin",
"first", "bottom", "end" and "last".
Options:
$buf append {n} {str} *tcl-buffer-append*
$buf insert {n} {str} *tcl-buffer-insert*
Add a line to the buffer. With the "insert" option, the string
becomes the new line {n}, with "append" it is inserted after line {n}.
Example: >
$buf insert top "This is the beginning."
$buf append end "This is the end."
< To add a list of lines to the buffer, use a loop: >
foreach line $list { $buf append $num $line ; incr num }
<
$buf count *tcl-buffer-count*
Reports the total number of lines in the buffer.
$buf delcmd {cmd} *tcl-buffer-delcmd*
Registers the Tcl command {cmd} as a deletion callback for the buffer.
This command is executed (in the global scope) just before the buffer
is deleted. Complex commands should be build with "list": >
$buf delcmd [list puts vimerr "buffer [$buf number] gone"]
< See also |tcl-window-delcmd|.
$buf delete {n} *tcl-buffer-delete*
$buf delete {n} {m}
Deletes line {n} or lines {n} through {m} from the buffer.
This example deletes everything except the last line: >
$buf delete first [expr [$buf last] - 1]
<
$buf get {n} *tcl-buffer-get*
$buf get {n} {m}
Gets one or more lines from the buffer. For a single line, the result
is a string; for several lines, a list of strings.
Example: >
set topline [$buf get top]
<
$buf last *tcl-buffer-last*
Reports the line number of the last line. This value depends on the
"::vim::lbase" variable. See |tcl-var-lbase|.
$buf mark {mark} *tcl-buffer-mark*
Reports the position of the named mark as a string, similar to the
cursor position of the "cursor" option of a window command (see
|tcl-window-cursor|). This can be converted to a Tcl array variable: >
array set mpos [$buf mark "a"]
< "mpos(column)" and "mpos(row)" now contain the position of the mark.
If the mark is not set, a standard Tcl error results.
$buf name
Reports the name of the file in the buffer. For a buffer without a
file, this is an empty string.
$buf number
Reports the number of this buffer. See |:buffers|.
This example deletes a buffer from vim: >
::vim::command "bdelete [$buf number]"
<
$buf set {n} {string} *tcl-buffer-set*
$buf set {n} {m} {list}
Replace one or several lines in the buffer. If the list contains more
elements than there are lines to replace, they are inserted into the
buffer. If the list contains fewer elements, any unreplaced line is
deleted from the buffer.
$buf windows *tcl-buffer-windows*
Creates a window command for each window that displays this buffer, and
returns a list of the command names as the result.
Example: >
set winlist [$buf windows]
foreach win $winlist { $win height 4 }
< See |tcl-window-cmds| for the available options.
$buf command [-quiet] {cmd} *tcl-buffer-command*
$buf expr {exr} *tcl-buffer-expr*
$buf option {opt} [val] *tcl-buffer-option*
These are similar to "::vim::command" etc., except that everything is
done in the context of the buffer represented by $buf, instead of the
current buffer. For example, setting an option that is marked 'local
to buffer' affects the buffer $buf. Anything that affects or queries
a window uses the first window in vim's window list that displays this
buffer (i.e. the first entry in the list returned by "$buf windows").
See |tcl-command|, |tcl-expr| and |tcl-option| for more information.
Example: >
if { [$buf option modified] } { $buf command "w" }
==============================================================================
6. Miscellaneous; Output from Tcl *tcl-misc* *tcl-output*
The standard Tcl commands "exit" and "catch" are replaced by custom versions.
"exit" terminates the current Tcl script and returns to vim, which deletes the
Tcl interpreter. Another call to ":tcl" then creates a new Tcl interpreter.
"exit" does NOT terminate vim! "catch" works as before, except that it does
not prevent script termination from "exit". An exit code != 0 causes the ex
command that invoked the Tcl script to return an error.
Two new I/O streams are available in Tcl, "vimout" and "vimerr". All output
directed to them is displayed in the vim message area, as information messages
and error messages, respectively. The standard Tcl output streams stdout and
stderr are mapped to vimout and vimerr, so that a normal "puts" command can be
used to display messages in vim.
==============================================================================
7. Known bugs & problems *tcl-bugs*
Calling one of the Tcl ex commands from inside Tcl (via "::vim::command") may
have unexpected side effects. The command creates a new interpreter, which
has the same abilities as the standard interpreter - making "::vim::command"
available in a safe child interpreter therefore makes the child unsafe. (It
would be trivial to block nested :tcl* calls or ensure that such calls from a
safe interpreter create only new safe interpreters, but quite pointless -
depending on vim's configuration, "::vim::command" may execute arbitrary code
in any number of other scripting languages.) A call to "exit" within this new
interpreter does not affect the old interpreter; it only terminates the new
interpreter, then script processing continues normally in the old interpreter.
Input from stdin is currently not supported.
==============================================================================
8. Examples: *tcl-examples*
Here are a few small (and maybe useful) Tcl scripts.
This script sorts the lines of the entire buffer (assume it contains a list
of names or something similar):
set buf $::vim::current(buffer)
set lines [$buf get top bottom]
set lines [lsort -dictionary $lines]
$buf set top bottom $lines
This script reverses the lines in the buffer. Note the use of "::vim::lbase"
and "$buf last" to work with any line number setting.
set buf $::vim::current(buffer)
set t $::vim::lbase
set b [$buf last]
while { $t < $b } {
set tl [$buf get $t]
set bl [$buf get $b]
$buf set $t $bl
$buf set $b $tl
incr t
incr b -1
}
This script adds a consecutive number to each line in the current range:
set buf $::vim::current(buffer)
set i $::vim::range(start)
set n 1
while { $i <= $::vim::range(end) } {
set line [$buf get $i]
$buf set $i "$n\t$line"
incr i ; incr n
}
The same can also be done quickly with two ex commands, using ":tcldo":
:tcl set n 1
:[range]tcldo set line "$n\t$line" ; incr n
This procedure runs an ex command on each buffer (idea stolen from Ron Aaron):
proc eachbuf { cmd } {
foreach b [::vim::buffer list] {
$b command $cmd
}
}
Use it like this:
:tcl eachbuf %s/foo/bar/g
Be careful with Tcl's string and backslash substitution, tough. If in doubt,
surround the ex command with curly braces.
If you want to add some Tcl procedures permanently to vim, just place them in
a file (e.g. "~/.vimrc.tcl" on Unix machines), and add these lines to your
startup file (usually "~/.vimrc" on Unix):
if has("tcl")
tclfile ~/.vimrc.tcl
endif
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,522 @@
*indent.txt* For Vim version 6.3. Last change: 2004 Apr 25
VIM REFERENCE MANUAL by Bram Moolenaar
This file is about indenting C programs and other files.
1. Indenting C programs |C-indenting|
2. Indenting by expression |indent-expression|
==============================================================================
1. Indenting C programs *C-indenting*
The basics for C indenting are explained in section |30.2| of the user manual.
Vim has options for automatically indenting C program files. These options
affect only the indent and do not perform other formatting. For comment
formatting, see |format-comments|.
Note that this will not work when the |+smartindent| or |+cindent| features
have been disabled at compile time.
There are in fact four methods available for indentation:
'autoindent' uses the indent from the previous line.
'smartindent' is like 'autoindent' but also recognizes some C syntax to
increase/reduce the indent where appropriate.
'cindent' Works more cleverly than the other two and is configurable to
different indenting styles.
'indentexpr' The most flexible of all: Evaluates an expression to compute
the indent of a line. When non-empty this method overrides
the other ones. See |indent-expression|.
The rest of this section describes the 'cindent' option.
Note that 'cindent' indenting does not work for every code scenario. Vim
is not a C compiler: it does not recognize all syntax.
These four options control C program indenting:
'cindent' Enables Vim to perform C program indenting automatically.
'cinkeys' Specifies which keys trigger reindenting in insert mode.
'cinoptions' Sets your preferred indent style.
'cinwords' Defines keywords that start an extra indent in the next line.
If 'lisp' is not on and 'equalprg' is empty, the "=" operator indents using
Vim's built-in algorithm rather than calling an external program.
See |autocommand| for how to set the 'cindent' option automatically for C code
files and reset it for others.
*cinkeys-format* *indentkeys-format*
The 'cinkeys' option is a string that controls Vim's indenting in response to
typing certain characters or commands in certain contexts. Note that this not
only triggers C-indenting. When 'indentexpr' is not empty 'indentkeys' is
used instead. The format of 'cinkeys' and 'indentkeys' is equal.
The default is "0{,0},0),:,0#,!^F,o,O,e" which specifies that indenting occurs
as follows:
"0{" if you type '{' as the first character in a line
"0}" if you type '}' as the first character in a line
"0)" if you type ')' as the first character in a line
":" if you type ':' after a label or case statement
"0#" if you type '#' as the first character in a line
"!^F" if you type CTRL-F (which is not inserted)
"o" if you type a <CR> anywhere or use the "o" command (not in
insert mode!)
"O" if you use the "O" command (not in insert mode!)
"e" if you type the second 'e' for an "else" at the start of a
line
Characters that can precede each key:
! When a '!' precedes the key, Vim will not insert the key but will
instead reindent the current line. This allows you to define a
command key for reindenting the current line. CTRL-F is the default
key for this. Be careful if you define CTRL-I for this because CTRL-I
is the ASCII code for <Tab>.
* When a '*' precedes the key, Vim will reindent the line before
inserting the key. If 'cinkeys' contains "*<Return>", Vim reindents
the current line before opening a new line.
0 When a zero precedes the key (but appears after '!' or '*') Vim will
reindent the line only if the key is the first character you type in
the line. When used before "=" Vim will only reindent the line if
there is only white space before the word.
When neither '!' nor '*' precedes the key, Vim reindents the line after you
type the key. So ';' sets the indentation of a line which includes the ';'.
Special key names:
<> Angle brackets mean spelled-out names of keys. For example: "<Up>",
"<Ins>" (see |key-notation|).
^ Letters preceded by a caret (^) are control characters. For example:
"^F" is CTRL-F.
o Reindent a line when you use the "o" command or when Vim opens a new
line below the current one (e.g., when you type <Enter> in insert
mode).
O Reindent a line when you use the "O" command.
e Reindent a line that starts with "else" when you type the second 'e'.
: Reindent a line when a ':' is typed which is after a label or case
statement. Don't reindent for a ":" in "class::method" for C++. To
Reindent for any ":", use "<:>".
=word Reindent when typing the last character of "word". "word" may
actually be part of another word. Thus "=end" would cause reindenting
when typing the "d" in "endif" or "endwhile". But not when typing
"bend". Also reindent when completion produces a word that starts
with "word". "0=word" reindents when there is only white space before
the word.
=~word Like =word, but ignore case.
If you really want to reindent when you type 'o', 'O', 'e', '0', '<', '>',
'*', ':' or '!', use "<o>", "<O>", "<e>", "<0>", "<<>", "<>>", "<*>", "<:>" or
"<!>", respectively, for those keys.
For an emacs-style indent mode where lines aren't indented every time you
press Enter but only if you press Tab, I suggest:
:set cinkeys=0{,0},:,0#,!<Tab>,!^F
You might also want to switch off 'autoindent' then.
Note: If you change the current line's indentation manually, Vim ignores the
cindent settings for that line. This prevents vim from reindenting after you
have changed the indent by typing <BS>, <Tab>, or <Space> in the indent or
used CTRL-T or CTRL-D.
*cinoptions-values*
The 'cinoptions' option sets how Vim performs indentation. In the list below,
"N" represents a number of your choice (the number can be negative). When
there is an 's' after the number, Vim multiplies the number by 'shiftwidth':
"1s" is 'shiftwidth', "2s" is two times 'shiftwidth', etc. You can use a
decimal point, too: "-0.5s" is minus half a 'shiftwidth'. The examples below
assume a 'shiftwidth' of 4.
>N Amount added for "normal" indent. Used after a line that should
increase the indent (lines starting with "if", an opening brace,
etc.). (default 'shiftwidth').
cino= cino=>2 cino=>2s >
if (cond) if (cond) if (cond)
{ { {
foo; foo; foo;
} } }
<
eN Add N to the prevailing indent inside a set of braces if the
opening brace at the End of the line (more precise: is not the
first character in a line). This is useful if you want a
different indent when the '{' is at the start of the line from
when '{' is at the end of the line. (default 0).
cino= cino=e2 cino=e-2 >
if (cond) { if (cond) { if (cond) {
foo; foo; foo;
} } }
else else else
{ { {
bar; bar; bar;
} } }
<
nN Add N to the prevailing indent for a statement after an "if",
"while", etc., if it is NOT inside a set of braces. This is
useful if you want a different indent when there is no '{'
before the statement from when there is a '{' before it.
(default 0).
cino= cino=n2 cino=n-2 >
if (cond) if (cond) if (cond)
foo; foo; foo;
else else else
{ { {
bar; bar; bar;
} } }
<
fN Place the first opening brace of a function or other block in
column N. This applies only for an opening brace that is not
inside other braces and is at the start of the line. What comes
after the brace is put relative to this brace. (default 0).
cino= cino=f.5s cino=f1s >
func() func() func()
{ { {
int foo; int foo; int foo;
<
{N Place opening braces N characters from the prevailing indent.
This applies only for opening braces that are inside other
braces. (default 0).
cino= cino={.5s cino={1s >
if (cond) if (cond) if (cond)
{ { {
foo; foo; foo;
<
}N Place closing braces N characters from the matching opening
brace. (default 0).
cino= cino={2,}-0.5s cino=}2 >
if (cond) if (cond) if (cond)
{ { {
foo; foo; foo;
} } }
<
^N Add N to the prevailing indent inside a set of braces if the
opening brace is in column 0. This can specify a different
indent for whole of a function (some may like to set it to a
negative number). (default 0).
cino= cino=^-2 cino=^-s >
func() func() func()
{ { {
if (cond) if (cond) if (cond)
{ { {
a = b; a = b; a = b;
} } }
} } }
<
:N Place case labels N characters from the indent of the switch().
(default 'shiftwidth').
cino= cino=:0 >
switch (x) switch(x)
{ {
case 1: case 1:
a = b; a = b;
default: default:
} }
<
=N Place statements occurring after a case label N characters from
the indent of the label. (default 'shiftwidth').
cino= cino==10 >
case 11: case 11: a = a + 1;
a = a + 1; b = b + 1;
<
lN If N != 0 Vim will align with a case label instead of the
statement after it in the same line.
cino= cino=l1 >
switch (a) { switch (a) {
case 1: { case 1: {
break; break;
} }
<
bN If N != 0 Vim will align a final "break" with the case label,
so that case..break looks like a sort of block. (default: 0).
cino= cino=b1 >
switch (x) switch(x)
{ {
case 1: case 1:
a = b; a = b;
break; break;
default: default:
a = 0; a = 0;
break; break;
} }
<
gN Place C++ scope declarations N characters from the indent of the
block they are in. (default 'shiftwidth'). A scope declaration
can be "public:", "protected:" or "private:".
cino= cino=g0 >
{ {
public: public:
a = b; a = b;
private: private:
} }
<
hN Place statements occurring after a C++ scope declaration N
characters from the indent of the label. (default
'shiftwidth').
cino= cino=h10 >
public: public: a = a + 1;
a = a + 1; b = b + 1;
<
pN Parameter declarations for K&R-style function declarations will
be indented N characters from the margin. (default
'shiftwidth').
cino= cino=p0 cino=p2s >
func(a, b) func(a, b) func(a, b)
int a; int a; int a;
char b; char b; char b;
<
tN Indent a function return type declaration N characters from the
margin. (default 'shiftwidth').
cino= cino=t0 cino=t7 >
int int int
func() func() func()
<
iN Indent C++ base class declarations and contructor
initializations, if they start in a new line (otherwise they
are aligned at the right side of the ':').
(default 'shiftwidth').
cino= cino=i0 >
class MyClass : class MyClass :
public BaseClass public BaseClass
{} {}
MyClass::MyClass() : MyClass::MyClass() :
BaseClass(3) BaseClass(3)
{} {}
<
+N Indent a continuation line (a line that spills onto the next) N
additional characters. (default 'shiftwidth').
cino= cino=+10 >
a = b + 9 * a = b + 9 *
c; c;
<
cN Indent comment lines after the comment opener, when there is no
other text with which to align, N characters from the comment
opener. (default 3). See also |format-comments|.
cino= cino=c5 >
/* /*
text. text.
*/ */
<
CN When N is non-zero, indent comment lines by the amount specified
with the c flag above even if there is other text behind the
comment opener. (default 0).
cino=c0 cino=c0,C1 >
/******** /********
text. text.
********/ ********/
< (Example uses ":set comments& comments-=s1:/* comments^=s0:/*")
/N Indent comment lines N characters extra. (default 0).
cino= cino=/4 >
a = b; a = b;
/* comment */ /* comment */
c = d; c = d;
<
(N When in unclosed parentheses, indent N characters from the line
with the unclosed parentheses. Add a 'shiftwidth' for every
unclosed parentheses. When N is 0 or the unclosed parentheses
is the first non-white character in its line, line up with the
next non-white character after the unclosed parentheses.
(default 'shiftwidth' * 2).
cino= cino=(0 >
if (c1 && (c2 || if (c1 && (c2 ||
c3)) c3))
foo; foo;
if (c1 && if (c1 &&
(c2 || c3)) (c2 || c3))
{ {
<
uN Same as (N, but for one level deeper. (default 'shiftwidth').
cino= cino=u2 >
if (c123456789 if (c123456789
&& (c22345 && (c22345
|| c3)) || c3))
<
UN When N is non-zero, do not ignore the indenting specified by
( or u in case that the unclosed parentheses is the first
non-white character in its line. (default 0).
cino= or cino=(s cino=(s,U1 >
c = c1 && c = c1 &&
( (
c2 || c2 ||
c3 c3
) && c4; ) && c4;
<
wN When in unclosed parentheses and N is non-zero and either
using "(0" or "u0", respectively, or using "U0" and the unclosed
parentheses is the first non-white character in its line, line
up with the character immediately after the unclosed parentheses
rather than the first non-white character. (default 0).
cino=(0 cino=(0,w1 >
if ( c1 if ( c1
&& ( c2 && ( c2
|| c3)) || c3))
foo; foo;
<
WN When in unclosed parentheses and N is non-zero and either
using "(0" or "u0", respectively and the unclosed parentheses is
the last non-white character in its line and it is not the
closing parentheses, indent the following line N characters
relative to the outer context (i.e. start of the line or the
next unclosed parentheses). (default: 0).
cino=(0 cino=(0,W4 >
a_long_line( a_long_line(
argument, argument,
argument); argument);
a_short_line(argument, a_short_line(argument,
argument); argument);
<
mN When N is non-zero, line up a line starting with a closing
parentheses with the first character of the line with the
matching opening parentheses. (default 0).
cino=(s cino=(s,m1 >
c = c1 && ( c = c1 && (
c2 || c2 ||
c3 c3
) && c4; ) && c4;
if ( if (
c1 && c2 c1 && c2
) )
foo; foo;
<
*java-cinoptions* *java-indenting*
jN Indent java anonymous classes correctly. The value 'N' is
currently unused but must be non-zero (e.g. 'j1'). 'j1' will
indent for example the following code snippet correctly: >
object.add(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
do_something();
}
});
<
)N Vim searches for unclosed parentheses at most N lines away.
This limits the time needed to search for parentheses. (default
20 lines).
*N Vim searches for unclosed comments at most N lines away. This
limits the time needed to search for the start of a comment.
(default 30 lines).
The defaults, spelled out in full, are:
cinoptions=>s,e0,n0,f0,{0,}0,^0,:s,=s,l0,gs,hs,ps,ts,+s,c3,C0,(2s,us,
\U0,w0,m0,j0,)20,*30
Vim puts a line in column 1 if:
- It starts with '#' (preprocessor directives), if 'cinkeys' contains '#'.
- It starts with a label (a keyword followed by ':', other than "case" and
"default").
- Any combination of indentations causes the line to have less than 0
indentation.
==============================================================================
2. Indenting by expression *indent-expression*
The basics for using flexible indenting are explained in section |30.3| of the
user manual.
If you want to write your own indent file, it must set the 'indentexpr'
option. Setting the 'indentkeys' option is often useful. See the
$VIMRUNTIME/indent directory for examples.
REMARKS ABOUT SPECIFIC INDENT FILES ~
FORTRAN *fortran-indent*
Block if, select case, and where constructs are indented. Comments, labelled
statements and continuation lines are indented if the Fortran is in free
source form, whereas they are not indented if the Fortran is in fixed source
form because of the left margin requirements. Hence manual indent corrections
will be necessary for labelled statements and continuation lines when fixed
source form is being used. For further discussion of the method used for the
detection of source format see |fortran-syntax|.
Do loops ~
All do loops are left unindented by default. Do loops can be unstructured in
Fortran with (possibly multiple) loops ending on a labelled executable
statement of almost arbitrary type. Correct indentation requires
compiler-quality parsing. Old code with do loops ending on labelled statements
of arbitrary type can be indented with elaborate programs such as Tidy
(http://www.unb.ca/chem/ajit/f_tidy.htm). Structured do/continue loops are
also left unindented because continue statements are also used for purposes
other than ending a do loop. Programs such as Tidy can convert structured
do/continue loops to the do/enddo form. Do loops of the do/enddo variety can
be indented. If you use only structured loops of the do/enddo form, you should
declare this by setting the fortran_do_enddo variable in your .vimrc as
follows >
let fortran_do_enddo=1
in which case do loops will be indented. If all your loops are of do/enddo
type only in, say, .f90 files, then you should set a buffer flag with an
autocommand such as >
au! BufRead,BufNewFile *.f90 let b:fortran_do_enddo=1
to get do loops indented in .f90 files and left alone in Fortran files with
other extensions such as .for.
VERILOG *verilog-indent*
General block statements such as if, for, case, always, initial, function,
specify and begin, etc., are indented. The module block statements (first
level blocks) are not indented by default. you can turn on the indent with
setting a variable in the .vimrc as follows: >
let b:verilog_indent_modules = 1
then the module blocks will be indented. To stop this, remove the variable: >
:unlet b:verilog_indent_modules
To set the variable only for Verilog file. The following statements can be
used: >
au BufReadPost * if exists("b:current_syntax")
au BufReadPost * if b:current_syntax == "verilog"
au BufReadPost * let b:verilog_indent_modules = 1
au BufReadPost * endif
au BufReadPost * endif
Furthermore, setting the variable b:verilog_indent_width to change the
indenting width (default is 'shiftwidth'): >
let b:verilog_indent_width = 4
let b:verilog_indent_width = &sw * 2
In addition, you can turn the verbose mode for debug issue: >
let b:verilog_indent_verbose = 1
Make sure to do ":set cmdheight=2" first to allow the display of the message.
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,890 @@
*intro.txt* For Vim version 6.3. Last change: 2004 May 01
VIM REFERENCE MANUAL by Bram Moolenaar
Introduction to Vim *ref* *reference*
1. Introduction |intro|
2. Vim on the internet |internet|
3. Credits |credits|
4. Notation |notation|
5. Modes, introduction |vim-modes-intro|
6. Switching from mode to mode |mode-switching|
7. The window contents |window-contents|
8. Definitions |definitions|
==============================================================================
1. Introduction *intro*
Vim stands for Vi IMproved. It used to be Vi IMitation, but there are so many
improvements that a name change was appropriate. Vim is a text editor which
includes almost all the commands from the Unix program "Vi" and a lot of new
ones. It is very useful for editing programs and other plain text.
All commands are given with the keyboard. This has the advantage that you
can keep your fingers on the keyboard and your eyes on the screen. For those
who want it, there is mouse support and a GUI version with scrollbars and
menus (see |gui.txt|).
An overview of this manual can be found in the file "help.txt", |help.txt|.
It can be accessed from within Vim with the <Help> or <F1> key and with the
|:help| command (just type ":help", without the bars or quotes).
The 'helpfile' option can be set to the name of the help file, in case it
is not located in the default place. You can jump to subjects like with tags:
Use CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back.
Throughout this manual the differences between Vi and Vim are mentioned in
curly braces, like this: {Vi does not have on-line help}. See |vi_diff.txt|
for a summary of the differences between Vim and Vi.
This manual refers to Vim on various machines. There may be small differences
between different computers and terminals. Besides the remarks given in this
document, there is a separate document for each supported system, see
|sys-file-list|.
This manual is a reference for all the Vim commands and options. This is not
an introduction to the use of Vi or Vim, it gets a bit complicated here and
there. For beginners, there is a hands-on |tutor|. To learn using Vim, read
the user manual |usr_toc.txt|.
*book*
There are many books on Vi that contain a section for beginners. There are
two books I can recommend:
"Vim - Vi Improved" by Steve Oualline
This is the very first book completely dedicated to Vim. It is very good for
beginners. The most often used commands are explained with pictures and
examples. The less often used commands are also explained, the more advanced
features are summarized. There is a comprehensive index and a quick
reference. Parts of this book have been included in the user manual
|frombook|.
Published by New Riders Publishing. ISBN: 0735710015
For more information try one of these:
http://iccf-holland.org/click5.html
http://www.vim.org/iccf/click5.html
"Learning the Vi editor" by Linda Lamb and Arnold Robbins
This is a book about Vi that includes a chapter on Vim (in the sixth edition).
The first steps in Vi are explained very well. The commands that Vim adds are
only briefly mentioned. There is also a German translation.
Published by O'Reilly. ISBN: 1-56592-426-6.
==============================================================================
2. Vim on the internet *internet*
*www* *faq* *FAQ* *distribution* *download*
The Vim pages contain the most recent information about Vim. They also
contain links to the most recent version of Vim. The FAQ is a list of
Frequently Asked Questions. Read this if you have problems.
VIM home page: http://www.vim.org/
VIM FAQ: http://vimdoc.sf.net/
Downloading: ftp://ftp.vim.org/pub/vim/MIRRORS
Usenet News group where Vim is discussed: *news* *usenet*
comp.editors
This group is also for other editors. If you write about Vim, don't forget to
mention that.
*mail-list* *maillist*
There are several mailing lists for Vim:
<vim@vim.org>
For discussions about using existing versions of Vim: Useful mappings,
questions, answers, where to get a specific version, etc.
<vim-dev@vim.org> *vim-dev* *vimdev*
For discussions about changing Vim: New features, porting, patches,
beta-test versions, etc.
<vim-announce@vim.org> *vim-announce*
Announcements about new versions of Vim; also for beta-test versions
and ports to different systems.
<vim-multibyte@vim.org> *vim-multibyte*
For discussions about using and improving the multi-byte aspects of
Vim.
<vim-mac@vim.org> *vim-mac*
For discussions about using and improving the Macintosh version of
Vim.
See http://www.vim.org/maillist.php for the latest information.
NOTE:
- You can only send messages to these lists if you have subscribed!
- You need to send the messages from the same location as where you subscribed
from (to avoid spam mail).
- Maximum message size is 40000 characters.
*subscribe-maillist*
If you want to join, send a message to
<vim-help@vim.org>
Make sure that your "From:" address is correct. Then the list server will
give you help on how to subscribe.
You can retrieve old messages from the maillist software, and an index of
messages. Ask vim-help for instructions.
Archives are kept at: *maillist-archive*
http://groups.yahoo.com/group/vim
http://groups.yahoo.com/group/vimdev
http://groups.yahoo.com/group/vimannounce
http://groups.yahoo.com/group/vim-multibyte
http://groups.yahoo.com/group/vim-mac
Additional maillists:
<vim-fr@club.voila.fr> *french-maillist*
Vim list in the French language. Subscribe by sending a message to
<vim-fr-subscribe@club.voila.fr>
Or go to http://groups.yahoo.com/group/vim-fr.
Bug reports: *bugs* *bug-reports* *bugreport.vim*
Send bug reports to: Vim bugs <bugs@vim.org>
This is not a maillist but the message is redirected to the Vim maintainer.
Please be brief; all the time that is spent on answering mail is subtracted
from the time that is spent on improving Vim! Always give a reproducible
example and try to find out which settings or other things influence the
appearance of the bug. Try different machines, if possible. Send me patches
if you can!
In case of doubt, use: >
:so $VIMRUNTIME/bugreport.vim
This will create a file "bugreport.txt" in the current directory, with a lot
of information of your environment. Before sending this out, check if it
doesn't contain any confidential information!
*debug-vim*
When Vim crashes in one of the test files, and you are using gcc for
compilation, here is what you can do to find out exactly where Vim crashes:
1. Compile Vim with the "-g" option (there is a line in the Makefile for this,
which you can uncomment).
2. Execute these commands (replace "11" with the test that fails): >
cd testdir
gdb ../vim
run -u unix.vim -U NONE -s dotest.in test11.in
3. Check where Vim crashes, gdb should give a message for this.
4. Get a stack trace from gdb with this command: >
where
< You can check out different places in the stack trace with: >
frame 3
< Replace "3" with one of the numbers in the stack trace.
*year-2000* *Y2K*
Since Vim internally doesn't use dates for editing, there is no year 2000
problem to worry about. Vim does use the time in the form of seconds since
January 1st 1970. It is used for a time-stamp check of the edited file and
the swap file, which is not critical and should only cause warning messages.
There might be a year 2038 problem, when the seconds don't fit in a 32 bit int
anymore. This depends on the compiler, libraries and operating system.
Specifically, time_t and the ctime() function are used. And the time_t is
stored in four bytes in the swap file. But that's only used for printing a
file date/time for recovery, it will never affect normal editing.
The Vim strftime() function directly uses the strftime() system function.
localtime() uses the time() system function. getftime() uses the time
returned by the stat() system function. If your system libraries are year
2000 compliant, Vim is too.
The user may create scripts for Vim that use external commands. These might
introduce Y2K problems, but those are not really part of Vim itself.
==============================================================================
3. Credits *credits* *author*
Most of Vim was written by Bram Moolenaar <Bram@vim.org>.
Parts of the documentation come from several Vi manuals, written by:
W.N. Joy
Alan P.W. Hewett
Mark Horton
The Vim editor is based on Stevie and includes (ideas from) other software,
worked on by the people mentioned here. Other people helped by sending me
patches, suggestions and giving feedback about what is good and bad in Vim.
Vim would never have become what it is now, without the help of these people!
Ron Aaron Win32 GUI changes
Zoltan Arpadffy work on VMS port
Tony Andrews Stevie
Gert van Antwerpen changes for DJGPP on MS-DOS
Berkeley DB(3) ideas for swap file implementation
Keith Bostic Nvi
Walter Briscoe Makefile updates, various patches
Ralf Brown SPAWNO library for MS-DOS
Robert Colon many useful remarks
Marcin Dalecki GTK+ GUI port, toolbar icons, gettext()
Kayhan Demirel sent me news in Uganda
Chris & John Downey xvi (ideas for multi-windows version)
Henk Elbers first VMS port
Eric Fischer Mac port, 'cindent', and other improvements
Benji Fisher Answering lots of user questions
Bill Foster Athena GUI port
Loic Grenie xvim (ideas for multi windows version)
Sven Guckes Vim promotor and previous WWW page maintainer
Darren Hiebert Exuberant ctags
Bruce Hunsaker improvements for VMS port
Andy Kahn Cscope support, GTK+ GUI port
Oezguer Kesim Maintainer of Vim Mailing Lists
Axel Kielhorn work on the Macintosh port
Steve Kirkendall Elvis
Roger Knobbe original port to Windows NT
Sergey Laskavy Vim's help from Moscow
Felix von Leitner Maintainer of Vim Mailing Lists
David Leonard Port of Python extensions to Unix
Avner Lottem Edit in right-to-left windows
Flemming Madsen X11 client-server, various features and patches
MicroSoft Gave me a copy of DevStudio to compile Vim with
Paul Moore Python interface extensions, many patches
Katsuhito Nagano Work on multi-byte versions
Sung-Hyun Nam Work on multi-byte versions
Vince Negri Win32 GUI and generic console enhancements
Steve Oualline Author of the first Vim book |frombook|
George V. Reilly Win32 port, Win32 GUI start-off
Stephen Riehm bug collector
Stefan Roemer various patches and help to users
Ralf Schandl IBM OS/390 port
Olaf Seibert DICE and BeBox version, regexp improvements
Mortaza Shiran Farsi patches
Peter da Silva termlib
Paul Slootman OS/2 port
Henry Spencer regular expressions
Dany St-Amant Macintosh port
Tim Thompson Stevie
G. R. (Fred) Walter Stevie
Sven Verdoolaege Perl interface
Robert Webb Command-line completion, GUI versions, and
lots of patches
Ingo Wilken Tcl interface
Mike Williams PostScript printing
Juergen Weigert Lattice version, AUX improvements, UNIX and
MS-DOS ports, autoconf
Stefan 'Sec' Zehl Maintainer of vim.org
I wish to thank all the people that sent me bug reports and suggestions. The
list is too long to mention them all here. Vim would not be the same without
the ideas from all these people: They keep Vim alive!
In this documentation there are several references to other versions of Vi:
*Vi*
Vi "the original". Without further remarks this is the version
of Vi that appeared in Sun OS 4.x. ":version" returns
"Version 3.7, 6/7/85". Sometimes other versions are referred
to. Only runs under Unix. Source code only available with a
license. More information on Vi can be found through:
http://vi-editor.org [doesn't currently work...]
*Posix*
Posix From the IEEE standard 1003.2, Part 2: Shell and utilities.
Generally known as "Posix". This is a textual description of
how Vi is supposed to work.
The version used is a draft from beginning 1996, so all remarks are
"expected to comply to" this. Anything can change though...
*Nvi*
Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD.
Very good compatibility with the original Vi, with a few extensions.
The version used is 1.79. ":version" returns "Version 1.79
(10/23/96)". There has been no release the last few years, although
there is a development version 1.81.
Source code is freely available.
*Elvis*
Elvis Another Vi clone, made by Steve Kirkendall. Very compact but isn't
as flexible as Vim.
The version used is 2.1. It is still being developed. Source code is
freely available.
==============================================================================
4. Notation *notation*
When syntax highlighting is used to read this, text that is not typed
literally is often highlighted with the Special group. These are items in [],
{} and <>, and CTRL-X.
Note that Vim uses all possible characters in commands. Sometimes the [], {}
and <> are part of what you type, the context should make this clear.
[] Characters in square brackets are optional.
*count* *[count]* *E489*
[count] An optional number that may precede the command to multiply
or iterate the command. If no number is given, a count of one
is used, unless otherwise noted. Note that in this manual the
[count] is not mentioned in the description of the command,
but only in the explanation. This was done to make the
commands easier to look up. If the 'showcmd' option is on,
the (partially) entered count is shown at the bottom of the
window. You can use <Del> to erase the last digit (|N<Del>|).
*[quotex]*
["x] An optional register designation where text can be stored.
See |registers|. The x is a single character between 'a' and
'z' or 'A' and 'Z' or '"', and in some cases (with the put
command) between '0' and '9', '%', '#', or others. The
uppercase and lowercase letter designate the same register,
but the lowercase letter is used to overwrite the previous
register contents, while the uppercase letter is used to
append to the previous register contents. Without the ""x" or
with """" the stored text is put into the unnamed register.
*{}*
{} Curly braces denote parts of the command which must appear,
but which can take a number of different values. The
differences between Vim and Vi are also given in curly braces
(this will be clear from the context).
*{char1-char2}*
{char1-char2} A single character from the range char1 to char2. For
example: {a-z} is a lowercase letter. Multiple ranges may be
concatenated. For example, {a-zA-Z0-9} is any alphanumeric
character.
*{motion}*
{motion} A command that moves the cursor. These are explained in
|motion.txt|. Examples:
w to start of next word
b to begin of current word
4j four lines down
/The<CR> to next occurrence of "The"
This is used after an |operator| command to move over the text
that is to be operated upon.
- If the motion includes a count and the operator also had a
count, the two counts are multiplied. For example: "2d3w"
deletes six words.
- The motion can be backwards, e.g. "db" to delete to the
start of the word.
- The motion can also be a mouse click. The mouse is not
supported in every terminal though.
- The ":omap" command can be used to map characters while an
operator is pending.
- Ex commands can be used to move the cursor. This can be
used to call a function that does some complicated motion.
The motion is always characterwise exclusive, no matter
what ":" command is used. This means it's impossible to
include the last character of a line without the line break
(unless 'virtualedit' is set).
If the Ex command changes the text before where the operator
start or jumps to another buffer the result is
unpredictable. It is possible to change the text further
down. Jumping to another buffer is possible if the current
buffer is not unloaded.
*{Visual}*
{Visual} A selected text area. It is started with the "v", "V", or
CTRL-V command, then any cursor movement command can be used
to change the end of the selected text.
This is used before an |operator| command to highlight the
text that is to be operated upon.
See |Visual-mode|.
*<character>*
<character> A special character from the table below, optionally with
modifiers, or a single ASCII character with modifiers.
*'character'*
'c' A single ASCII character.
*CTRL-{char}*
CTRL-{char} {char} typed as a control character; that is, typing {char}
while holding the CTRL key down. The case of {char} does not
matter; thus CTRL-A and CTRL-a are equivalent. But on some
terminals, using the SHIFT key will produce another code,
don't use it then.
*'option'*
'option' An option, or parameter, that can be set to a value, is
enclosed in single quotes. See |options|.
*quotecommandquote*
"command" A reference to a command that you can type is enclosed in
double quotes.
*key-notation* *key-codes* *keycodes*
These names for keys are used in the documentation. They can also be used
with the ":map" command (insert the key name by pressing CTRL-K and then the
key you want the name for).
notation meaning equivalent decimal value(s) ~
-----------------------------------------------------------------------
<Nul> zero CTRL-@ 0 (stored as 10) *<Nul>*
<BS> backspace CTRL-H 8 *backspace*
<Tab> tab CTRL-I 9 *tab* *Tab*
*linefeed*
<NL> linefeed CTRL-J 10 (used for <Nul>)
<FF> formfeed CTRL-L 12 *formfeed*
<CR> carriage return CTRL-M 13 *carriage-return*
<Return> same as <CR> *<Return>*
<Enter> same as <CR> *<Enter>*
<Esc> escape CTRL-[ 27 *escape* *<Esc>*
<Space> space 32 *space*
<lt> less-than < 60 *<lt>*
<Bslash> backslash \ 92 *backslash* *<Bslash>*
<Bar> vertical bar | 124 *<Bar>*
<Del> delete 127
<CSI> command sequence intro ALT-Esc 155 *<CSI>*
<xCSI> CSI when typed in the GUI *<xCSI>*
<EOL> end-of-line (can be <CR>, <LF> or <CR><LF>,
depends on system and 'fileformat') *<EOL>*
<Up> cursor-up *cursor-up* *cursor_up*
<Down> cursor-down *cursor-down* *cursor_down*
<Left> cursor-left *cursor-left* *cursor_left*
<Right> cursor-right *cursor-right* *cursor_right*
<S-Up> shift-cursor-up
<S-Down> shift-cursor-down
<S-Left> shift-cursor-left
<S-Right> shift-cursor-right
<C-Left> control-cursor-left
<C-Right> control-cursor-right
<F1> - <F12> function keys 1 to 12 *function_key* *function-key*
<S-F1> - <S-F12> shift-function keys 1 to 12 *<S-F1>*
<Help> help key
<Undo> undo key
<Insert> insert key
<Home> home *home*
<End> end *end*
<PageUp> page-up *page_up* *page-up*
<PageDown> page-down *page_down* *page-down*
<kHome> keypad home (upper left) *keypad-home*
<kEnd> keypad end (lower left) *keypad-end*
<kPageUp> keypad page-up (upper right) *keypad-page-up*
<kPageDown> keypad page-down (lower right) *keypad-page-down*
<kPlus> keypad + *keypad-plus*
<kMinus> keypad - *keypad-minus*
<kMultiply> keypad * *keypad-multiply*
<kDivide> keypad / *keypad-divide*
<kEnter> keypad Enter *keypad-enter*
<kPoint> keypad Decimal point *keypad-point*
<k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9*
<S-...> shift-key *shift* *<S-*
<C-...> control-key *control* *ctrl* *<C-*
<M-...> alt-key or meta-key *meta* *alt* *<M-*
<A-...> same as <M-...> *<A-*
<D-...> command-key (Macintosh only) *<D-*
<t_xx> key with "xx" entry in termcap
-----------------------------------------------------------------------
Note: The shifted cursor keys, the help key, and the undo key are only
available on a few terminals. On the Amiga, shifted function key 10 produces
a code (CSI) that is also used by key sequences. It will be recognized only
after typing another key.
Note: There are two codes for the delete key. 127 is the decimal ASCII value
for the delete key, which is always recognized. Some delete keys send another
value, in which case this value is obtained from the termcap entry "kD". Both
values have the same effect. Also see |:fixdel|.
Note: The keypad keys are used in the same way as the corresponding "normal"
keys. For example, <kHome> has the same effect as <Home>. If a keypad key
sends the same raw key code as it non-keypad equivalent, it will be recognized
as the non-keypad code. For example, when <kHome> sends the same code as
<Home>, when pressing <kHome> Vim will think <Home> was pressed. Mapping
<kHome> will not work then.
*<>*
Examples are often given in the <> notation. Sometimes this is just to make
clear what you need to type, but often it can be typed literally, e.g., with
the ":map" command. The rules are:
1. Any printable characters are typed directly, except backslash and '<'
2. A backslash is represented with "\\", double backslash, or "<Bslash>".
3. A real '<' is represented with "\<" or "<lt>". When there is no
confusion possible, a '<' can be used directly.
4. "<key>" means the special key typed. This is the notation explained in
the table above. A few examples:
<Esc> Escape key
<C-G> CTRL-G
<Up> cursor up key
<C-LeftMouse> Control- left mouse click
<S-F11> Shifted function key 11
<M-a> Meta- a ('a' with bit 8 set)
<M-A> Meta- A ('A' with bit 8 set)
<t_kd> "kd" termcap entry (cursor down key)
If you want to use the full <> notation in Vim, you have to make sure the '<'
flag is excluded from 'cpoptions' (when 'compatible' is not set, it already is
by default). >
:set cpo-=<
The <> notation uses <lt> to escape the special meaning of key names. Using a
backslash also works, but only when 'cpoptions' does not include the 'B' flag.
Examples for mapping CTRL-H to the six characters "<Home>": >
:imap <C-H> \<Home>
:imap <C-H> <lt>Home>
The first one only works when the 'B' flag is not in 'cpoptions'. The second
one always works.
To get a literal "<lt>" in a mapping: >
:map <C-L> <lt>lt>
For mapping, abbreviation and menu commands you can then copy-paste the
examples and use them directly. Or type them literally, including the '<' and
'>' characters. This does NOT work for other commands, like ":set" and
":autocmd"!
==============================================================================
5. Modes, introduction *vim-modes-intro* *vim-modes*
Vim has six BASIC modes:
*Normal* *Normal-mode* *command-mode*
Normal mode In Normal mode you can enter all the normal editor
commands. If you start the editor you are in this
mode (unless you have set the 'insertmode' option,
see below). This is also known as command mode.
Visual mode This is like Normal mode, but the movement commands
extend a highlighted area. When a non-movement
command is used, it is executed for the highlighted
area. See |Visual-mode|.
If the 'showmode' option is on "-- VISUAL --" is shown
at the bottom of the window.
Select mode This looks most like the MS-Windows selection mode.
Typing a printable character deletes the selection
and starts Insert mode. See |Select-mode|.
If the 'showmode' option is on "-- SELECT --" is shown
at the bottom of the window.
Insert mode In Insert mode the text you type is inserted into the
buffer. See |Insert-mode|.
If the 'showmode' option is on "-- INSERT --" is shown
at the bottom of the window.
Command-line mode In Command-line mode (also called Cmdline mode) you
Cmdline mode can enter one line of text at the bottom of the
window. This is for the Ex commands, ":", the pattern
search commands, "?" and "/", and the filter command,
"!". |Cmdline-mode|
Ex mode Like Command-line mode, but after entering a command
you remain in Ex mode. Very limited editing of the
command line. |Ex-mode|
There are five ADDITIONAL modes. These are variants of the BASIC modes:
*Operator-pending* *Operator-pending-mode*
Operator-pending mode This is like Normal mode, but after an operator
command has started, and Vim is waiting for a {motion}
to specify the text that the operator will work on.
Replace mode Replace mode is a special case of Insert mode. You
can do the same things as in Insert mode, but for
each character you enter, one character of the existing
text is deleted. See |Replace-mode|.
If the 'showmode' option is on "-- REPLACE --" is
shown at the bottom of the window.
Insert Normal mode Entered when CTRL-O given in Insert mode. This is
like Normal mode, but after executing one command Vim
returns to Insert mode.
If the 'showmode' option is on "-- (insert) --" is
shown at the bottom of the window.
Insert Visual mode Entered when starting a Visual selection from Insert
mode, e.g., by using CTRL-O and then "v", "V" or
CTRL-V. When the Visual selection ends, Vim returns
to Insert mode.
If the 'showmode' option is on "-- (insert) VISUAL --"
is shown at the bottom of the window.
Insert Select mode Entered when starting Select mode from Insert mode.
E.g., by dragging the mouse or <S-Right>.
When the Select mode ends, Vim returns to Insert mode.
If the 'showmode' option is on "-- (insert) SELECT --"
is shown at the bottom of the window.
==============================================================================
6. Switching from mode to mode *mode-switching*
If for any reason you do not know which mode you are in, you can always get
back to Normal mode by typing <Esc> twice. This doesn't work for Ex mode
though, use ":visual".
You will know you are back in Normal mode when you see the screen flash or
hear the bell after you type <Esc>. However, when pressing <Esc> after using
CTRL-O in Insert mode you get a beep but you are still in Insert mode, type
<Esc> again.
*i_esc*
TO mode ~
Normal Visual Select Insert Replace Cmd-line Ex ~
FROM mode ~
Normal v V ^V *4 *1 R : / ? ! Q
Visual *2 ^G c C -- : --
Select *5 ^O ^G *6 -- -- --
Insert <Esc> -- -- <Insert> -- --
Replace <Esc> -- -- <Insert> -- --
Command-line *3 -- -- :start -- --
Ex :vi -- -- -- -- --
- NA
-- not possible
*1 Go from Normal mode to Insert mode by giving the command "i", "I", "a",
"A", "o", "O", "c", "C", "s" or S".
*2 Go from Visual mode to Normal mode by giving a non-movement command, which
causes the command to be executed, or by hitting <Esc> "v", "V" or "CTRL-V"
(see |v_v|), which just stops Visual mode without side effects.
*3 Go from Command-line mode to Normal mode by:
- Hitting <CR> or <NL>, which causes the entered command to be executed.
- Deleting the complete line (e.g., with CTRL-U) and giving a final <BS>.
- Hitting CTRL-C or <Esc>, which quits the command-line without executing
the command.
In the last case <Esc> may be the character defined with the 'wildchar'
option, in which case it will start command-line completion. You can
ignore that and type <Esc> again. {Vi: when hitting <Esc> the command-line
is executed. This is unexpected for most people; therefore it was changed
in Vim. But when the <Esc> is part of a mapping, the command-line is
executed. If you want the Vi behaviour also when typing <Esc>, use ":cmap
^V<Esc> ^V^M"}
*4 Go from Normal to Select mode by:
- use the mouse to select text while 'selectmode' contains "mouse"
- use a non-printable command to move the cursor while keeping the Shift
key pressed, and the 'selectmode' option contains "key"
- use "v", "V" or "CTRL-V" while 'selectmode' contains "cmd"
- use "gh", "gH" or "g CTRL-H" |g_CTRL-H|
*5 Go from Select mode to Normal mode by using a non-printable command to move
the cursor, without keeping the Shift key pressed.
*6 Go from Select mode to Insert mode by typing a printable character. The
selection is deleted and the character is inserted.
If the 'insertmode' option is on, editing a file will start in Insert mode.
*CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* *v_CTRL-\_CTRL-N*
Additionally the command CTRL-\ CTRL-N or <C-\><C-N> can be used to go to
Normal mode from any other mode. This can be used to make sure Vim is in
Normal mode, without causing a beep like <Esc> would. However, this does not
work in Ex mode. When used after a command that takes an argument, such as
|f| or |m|, the timeout set with 'ttimeoutlen' applies.
*CTRL-\_CTRL-G* *i_CTRL-\_CTRL-G* *c_CTRL-\_CTRL-G* *v_CTRL-\_CTRL-G*
The command CTRL-\ CTRL-G or <C-\><C-G> can be used to go to Insert mode when
'insertmode' is set. Otherwise it goes to Normal mode. This can be used to
make sure Vim is in the mode indicated by 'insertmode', without knowing in
what mode Vim currently is.
*Q* *mode-Ex* *Ex-mode* *Ex* *EX* *E501*
Q Switch to "Ex" mode. This is a bit like typing ":"
commands one after another, except:
- You don't have to keep pressing ":".
- The screen doesn't get updated after each command.
- There is no normal command-line editing.
- Mappings and abbreviations are not used.
In fact, you are editing the lines with the "standard"
line-input editing commands (<Del> or <BS> to erase,
CTRL-U to kill the whole line).
Vim will enter this mode by default if it's invoked as
"ex" on the command-line.
Use the ":vi" command |:visual| to exit "Ex" mode.
Note: In older versions of Vim "Q" formatted text,
that is now done with |gq|. But if you use the
|vimrc_example.vim| script "Q" works like "gq".
*gQ*
gQ Switch to "Ex" mode, but really behave like typing ":"
commands after another. All command line editing,
completion etc. is available.
Use the ":vi" command |:visual| to exit "Ex" mode.
{not in Vi}
==============================================================================
7. The window contents *window-contents*
In Normal mode and Insert/Replace mode the screen window will show the current
contents of the buffer: What You See Is What You Get. There are two
exceptions:
- When the 'cpoptions' option contains '$', and the change is within one line,
the text is not directly deleted, but a '$' is put at the last deleted
character.
- When inserting text in one window, other windows on the same text are not
updated until the insert is finished.
{Vi: The screen is not always updated on slow terminals}
Lines longer than the window width will wrap, unless the 'wrap' option is off
(see below). The 'linebreak' option can be set to wrap at a blank character.
If the window has room after the last line of the buffer, Vim will show '~' in
the first column of the last lines in the window, like this: >
+-----------------------+
|some line |
|last line |
|~ |
|~ |
+-----------------------+
Thus the '~' lines indicate that the end of the buffer was reached.
If the last line in a window doesn't fit, Vim will indicate this with a '@' in
the first column of the last lines in the window, like this: >
+-----------------------+
|first line |
|second line |
|@ |
|@ |
+-----------------------+
Thus the '@' lines indicate that there is a line that doesn't fit in the
window.
When the "lastline" flag is present in the 'display' option, you will not see
'@' characters at the left side of window. If the last line doesn't fit
completely, only the part that fits is shown, and the last three characters of
the last line are replaced with "@@@", like this: >
+-----------------------+
|first line |
|second line |
|a very long line that d|
|oesn't fit in the wi@@@|
+-----------------------+
If there is a single line that is too long to fit in the window, this is a
special situation. Vim will show only part of the line, around where the
cursor is. There are no special characters shown, so that you can edit all
parts of this line.
{Vi: gives an "internal error" on lines that do not fit in the window}
The '@' occasion in the 'highlight' option can be used to set special
highlighting for the '@' and '~' characters. This makes it possible to
distinguish them from real characters in the buffer.
The 'showbreak' option contains the string to put in front of wrapped lines.
*wrap-off*
If the 'wrap' option is off, long lines will not wrap. Only the part that
fits on the screen is shown. If the cursor is moved to a part of the line
that is not shown, the screen is scrolled horizontally. The advantage of
this method is that columns are shown as they are and lines that cannot fit
on the screen can be edited. The disadvantage is that you cannot see all the
characters of a line at once. The 'sidescroll' option can be set to the
minimal number of columns to scroll. {Vi: has no 'wrap' option}
All normal ASCII characters are displayed directly on the screen. The <Tab>
is replaced with the number of spaces that it represents. Other non-printing
characters are replaced with "^{char}", where {char} is the non-printing
character with 64 added. Thus character 7 (bell) will be shown as "^G".
Characters between 127 and 160 are replaced with "~{char}", where {char} is
the character with 64 subtracted. These characters occupy more than one
position on the screen. The cursor can only be positioned on the first one.
If you set the 'number' option, all lines will be preceded with their
number. Tip: If you don't like wrapping lines to mix with the line numbers,
set the 'showbreak' option to eight spaces:
":set showbreak=\ \ \ \ \ \ \ \ "
If you set the 'list' option, <Tab> characters will not be shown as several
spaces, but as "^I". A '$' will be placed at the end of the line, so you can
find trailing blanks.
In Command-line mode only the command-line itself is shown correctly. The
display of the buffer contents is updated as soon as you go back to Command
mode.
The last line of the window is used for status and other messages. The
status messages will only be used if an option is on:
status message option default Unix default ~
current mode 'showmode' on on
command characters 'showcmd' on off
cursor position 'ruler' off off
The current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|. The
command characters are those that you typed but were not used yet. {Vi: does
not show the characters you typed or the cursor position}
If you have a slow terminal you can switch off the status messages to speed
up editing:
:set nosc noru nosm
If there is an error, an error message will be shown for at least one second
(in reverse video). {Vi: error messages may be overwritten with other
messages before you have a chance to read them}
Some commands show how many lines were affected. Above which threshold this
happens can be controlled with the 'report' option (default 2).
On the Amiga Vim will run in a CLI window. The name Vim and the full name of
the current file name will be shown in the title bar. When the window is
resized, Vim will automatically redraw the window. You may make the window as
small as you like, but if it gets too small not a single line will fit in it.
Make it at least 40 characters wide to be able to read most messages on the
last line.
On most Unix systems, resizing the window is recognized and handled correctly
by Vim. {Vi: not ok}
==============================================================================
8. Definitions *definitions*
screen The whole area that Vim uses to work in. This can be
a terminal emulator window. Also called "the Vim
window".
window A view on a buffer.
A screen contains one or more windows, separated by status lines and with the
command line at the bottom.
+-------------------------------+
screen | window 1 | window 2 |
| | |
| | |
|= status line =|= status line =|
| window 3 |
| |
| |
|==== status line ==============|
|command line |
+-------------------------------+
The command line is also used for messages. It scrolls up the screen when
there is not enough room in the command line.
A difference is made between four types of lines:
buffer lines The lines in the buffer. This is the same as the
lines as they are read from/written to a file. They
can be thousands of characters long.
logical lines The buffer lines with folding applied. Buffer lines
in a closed fold are changed to a single logical line:
"+-- 99 lines folded". They can be thousands of
characters long.
window lines The lines displayed in a window: A range of logical
lines with wrapping, line breaks, etc. applied. They
can only be as long as the width of the window allows,
longer lines are wrapped or truncated.
screen lines The lines of the screen that Vim uses. Consists of
the window lines of all windows, with status lines
and the command line added. They can only be as long
as the width of the screen allows. When the command
line gets longer it wraps and lines are scrolled to
make room.
buffer lines logical lines window lines screen lines ~
1. one 1. one 1. +-- folded 1. +-- folded
2. two 2. +-- folded 2. five 2. five
3. three 3. five 3. six 3. six
4. four 4. six 4. seven 4. seven
5. five 5. seven 5. === status line ===
6. six 6. aaa
7. seven 7. bbb
8. ccc ccc c
1. aaa 1. aaa 1. aaa 9. cc
2. bbb 2. bbb 2. bbb 10. ddd
3. ccc ccc ccc 3. ccc ccc ccc 3. ccc ccc c 11. ~
4. ddd 4. ddd 4. cc 12. === status line ===
5. ddd 13. (command line)
6. ~
==============================================================================
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,775 @@
*message.txt* For Vim version 6.3. Last change: 2004 Jan 17
VIM REFERENCE MANUAL by Bram Moolenaar
This file contains an alphabetical list of messages and error messages that
Vim produces. You can use this if you don't understand what the message
means. It is not complete though.
1. Old messages |:messages|
2. Error messages |error-messages|
3. Messages |messages|
==============================================================================
1. Old messages *:messages* *:mes* *message-history*
The ":messages" command can be used to view previously given messages. This
is especially useful when messages have been overwritten or truncated. This
depends on the 'shortmess' option.
The number of remembered messages is fixed at 20.
If you are using translated messages, the first printed line tells who
maintains the messages or the translations. You can use this to contact the
maintainer when you spot a mistake.
If you want to find help on a specific (error) message, use the ID at the
start of the message. For example, to get help on the message: >
E72: Close error on swap file
or (translated): >
E72: Errore durante chiusura swap file
Use: >
:help E72
If you are lazy, it also works without the shift key: >
:help e72
==============================================================================
2. Error messages *error-messages*
When an error message is displayed, but it is removed before you could read
it, you can see it again with: >
:echo errmsg
or view a list of recent messages with: >
:messages
LIST OF MESSAGES
*E222* *E228* *E232* *E256* *E293* *E298* *E304* *E317*
*E318* *E356* *E438* *E439* *E440* *E316* *E320* *E322*
*E323* *E341* *E473* *E570* >
Add to read buffer
makemap: Illegal mode
Cannot create BalloonEval with both message and callback
Hangul automata ERROR
block was not locked
Didn't get block nr {N}?
ml_timestamp: Didn't get block 0??
pointer block id wrong {N}
Updated too many blocks?
get_varp ERROR
u_undo: line numbers wrong
undo list corrupt
undo line missing
ml_get: cannot find line {N}
cannot find line {N}
line number out of range: {N} past the end
line count wrong in block {N}
Internal error
fatal error in cs_manage_matches
This is an internal error. If you can reproduce it, please send in a bug
report. |bugs|
>
ATTENTION
Found a swap file by the name ...
See |ATTENTION|.
*E92* >
Buffer {N} not found
The buffer you requested does not exist. This can also happen when you have
wiped out a buffer which contains a mark or is referenced in another way.
|:bwipeout|
*E95* >
Buffer with this name already exists
You cannot have two buffers with the same name.
*E72* >
Close error on swap file
The |swap-file|, that is used to keep a copy of the edited text, could not be
closed properly. Mostly harmless.
*E169* >
Command too recursive
This happens when an Ex command executes an Ex command that executes an Ex
command, etc. This is only allowed 200 times. When it's more there probably
is an endless loop. Probably a |:execute| or |:source| command is involved.
*E254* >
Cannot allocate color {name}
The color name {name} is unknown. See |gui-colors| for a list of colors that
are available on most systems.
*E458* >
Cannot allocate colormap entry for "xxxx"
Cannot allocate colormap entry, some colors may be incorrect
This means that there are not enough colors available for Vim. It will still
run, but some of the colors will not appear in the specified color. Try
stopping other applications that use many colors, or start them after starting
gvim.
Netscape is known to consume a lot of colors. You can avoid this by telling
it to use its own colormap: >
netscape -install
Or tell it to limit to a certain number of colors (64 should work well): >
netscape -ncols 64
This can also be done with a line in your Xdefaults file: >
Netscape*installColormap: Yes
or >
Netscape*maxImageColors: 64
<
*E79* >
Cannot expand wildcards
A filename contains a strange combination of characters, which causes Vim to
attempt expanding wildcards but this fails. This does NOT mean that no
matching file names could be found, but that the pattern was illegal.
*E459* >
Cannot go back to previous directory
While expanding a file name, Vim failed to go back to the previously used
directory. All file names being used may be invalid now! You need to have
execute permission on the current directory.
*E190* *E212* >
Cannot open "{filename}" for writing
Can't open file for writing
For some reason the file you are writing to cannot be created or overwritten.
The reason could be that you do not have permission to write in the directory
or the file name is not valid.
*E166* >
Can't open linked file for writing
You are trying to write to a file which can't be overwritten, and the file is
a link (either a hard link or a symbolic link). Writing might still be
possible if the directory that contains the link or the file is writable, but
Vim now doesn't know if you want to delete the link and write the file in its
place, or if you want to delete the file itself and write the new file in its
place. If you really want to write the file under this name, you have to
manually delete the link or the file, or change the permissions so that Vim
can overwrite.
*E46* >
Cannot set read-only variable "{name}"
You are trying to assign a value to an argument of a function |a:var| or a Vim
internal variable |v:var| which is read-only.
*E90* >
Cannot unload last buffer
Vim always requires one buffer to be loaded, otherwise there would be nothing
to display in the window.
*E40* >
Can't open errorfile <filename>
When using the ":make" or ":grep" commands: The file used to save the error
messages or grep output cannot be opened. This can have several causes:
- 'shellredir' has a wrong value.
- The shell changes directory, causing the error file to be written in another
directory. This could be fixed by changing 'makeef', but then the make
command is still executed in the wrong directory.
- 'makeef' has a wrong value.
- The 'grepprg' or 'makeprg' could not be executed. This cannot always be
detected (especially on MS-Windows). Check your $PATH.
>
Can't open file C:\TEMP\VIoD243.TMP
On MS-Windows, this message appears when the output of an external command was
to be read, but the command didn't run successfully. This can be caused by
many things. Check the 'shell', 'shellquote', 'shellxquote', 'shellslash' and
related options. It might also be that the external command was not found,
there is no different error message for that.
*E12* >
Command not allowed from exrc/vimrc in current dir or tag search
Some commands are not allowed for security reasons. These commands mostly
come from a .exrc or .vimrc file in the current directory, or from a tags
file. Also see 'secure'.
*E74* >
Command too complex
A mapping resulted in a very long command string. Could be caused by a
mapping that indirectly calls itself.
>
CONVERSION ERROR
When writing a file and the text "CONVERSION ERROR" appears, this means that
some bits were lost when converting text from the internally used UTF-8 to the
format of the file. The file will not be marked unmodified. If you care
about the loss of information, set the 'fileencoding' option to another value
that can handle the characters in the buffer and write again. If you don't
care, you can abandon the buffer or reset the 'modified' option.
*E302* >
Could not rename swap file
When the file name changes, Vim tries to rename the |swap-file| as well.
This failed and the old swap file is now still used. Mostly harmless.
*E43* *E44* >
Damaged match string
Corrupted regexp program
Something inside Vim went wrong and resulted in a corrupted regexp. If you
know how to reproduce this problem, please report it. |bugs|
*E208* *E209* *E210* >
Error writing to "{filename}"
Error closing "{filename}"
Error reading "{filename}"
This occurs when Vim is trying to rename a file, but a simple change of file
name doesn't work. Then the file will be copied, but somehow this failed.
The result may be that both the original file and the destination file exist
and the destination file may be incomplete.
>
Vim: Error reading input, exiting...
This occurs when Vim cannot read typed characters while input is required.
Vim got stuck, the only thing it can do is exit. This can happen when both
stdin and stderr are redirected and executing a script that doesn't exit Vim.
*E47* >
Error while reading errorfile
Reading the error file was not possible. This is NOT caused by an error
message that was not recognized.
*E80* >
Error while writing
Writing a file was not completed successfully. The file is probably
incomplete.
*E13* *E189* >
File exists (use ! to override)
"{filename}" exists (use ! to override)
You are protected from accidentally overwriting a file. When you want to
write anyway, use the same command, but add a "!" just after the command.
Example: >
:w /tmp/test
changes to: >
:w! /tmp/test
<
*E139* >
File is loaded in another buffer
You are trying to write a file under a name which is also used in another
buffer. This would result in two versions of the same file.
*E142* >
File not written: Writing is disabled by 'write' option
The 'write' option is off. This makes all commands that try to write a file
generate this message. This could be caused by a |-m| commandline argument.
You can switch the 'write' option on with ":set write".
*E25* >
GUI cannot be used: Not enabled at compile time
You are running a version of Vim that doesn't include the GUI code. Therefore
"gvim" and ":gui" don't work.
*E49* >
Invalid scroll size
This is caused by setting an invalid value for the 'scroll', 'scrolljump' or
'scrolloff' options.
*E17* >
"{filename}" is a directory
You tried to write a file with the name of a directory. This is not possible.
You probably need to append a file name.
*E19* >
Mark has invalid line number
You are using a mark that has a line number that doesn't exist. This can
happen when you have a mark in another file, and some other program has
deleted lines from it.
*E219* *E220* >
Missing {.
Missing }.
Using a {} construct in a file name, but there is a { without a matching } or
the other way around. It should be used like this: {foo,bar}. This matches
"foo" and "bar".
*E315* >
ml_get: invalid lnum:
This is an internal Vim error. Please try to find out how it can be
reproduced, and submit a bug report |bugreport.vim|.
*E173* >
{number} more files to edit
You are trying to exit, while the last item in the argument list has not been
edited. This protects you from accidentally exiting when you still have more
files to work on. See |argument-list|. If you do want to exit, just do it
again and it will work.
*E23* *E194* >
No alternate file
No alternate file name to substitute for '#'
The alternate file is not defined yet. See |alternate-file|.
*E32* >
No file name
The current buffer has no name. To write it, use ":w fname". Or give the
buffer a name with ":file fname".
*E141* >
No file name for buffer {number}
One of the buffers that was changed does not have a file name. Therefore it
cannot be written. You need to give the buffer a file name: >
:buffer {number}
:file {filename}
<
*E33* >
No previous substitute regular expression
When using the '~' character in a pattern, it is replaced with the previously
used pattern in a ":substitute" command. This fails when no such command has
been used yet. See |/~|.
*E35* >
No previous regular expression
When using an empty search pattern, the previous search pattern is used. But
that is not possible if there was no previous search.
*E24* >
No such abbreviation
You have used an ":unabbreviate" command with an argument which is not an
existing abbreviation. All variations of this command give the same message:
":cunabbrev", ":iunabbrev", etc. Check for trailing white space.
>
/dev/dsp: No such file or directory
Only given for GTK GUI with Gnome support. Gnome tries to use the audio
device and it isn't present. You can ignore this error.
*E31* >
No such mapping
You have used an ":unmap" command with an argument which is not an existing
mapping. All variations of this command give the same message: ":cunmap",
":unmap!", etc. Check for trailing white space.
*E37* *E89* >
No write since last change (use ! to override)
No write since last change for buffer {N} (use ! to override)
You are trying to |abandon| a file that has changes. Vim protects you from
losing your work. You can either write the changed file with ":w", or, if you
are sure, |abandon| it anyway, and lose all the changes. This can be done by
adding a '!' character just after the command you used. Example: >
:e other_file
changes to: >
:e! other_file
<
*E162* >
No write since last change for buffer "{name}"
This appears when you try to exit Vim while some buffers are changed. You
will either have to write the changed buffer (with |:w|), or use a command to
abandon the buffer forcefully, e.g., with ":qa!". Careful, make sure you
don't throw away changes you really want to keep. You might have forgotten
about a buffer, especially when 'hidden' is set.
*E38* >
Null argument
Something inside Vim went wrong and resulted in a NULL pointer. If you know
how to reproduce this problem, please report it. |bugs|
*E172* >
Only one file name allowed
The ":edit" command only accepts one file name. When you want to specify
several files for editing use ":next" |:next|.
*E41* *E82* *E83* *E342* >
Out of memory!
Out of memory! (allocating {number} bytes)
Cannot allocate any buffer, exiting...
Cannot allocate buffer, using other one...
Oh, oh. You must have been doing something complicated, or some other program
is consuming your memory. Be careful! Vim is not completely prepared for an
out-of-memory situation. First make sure that any changes are saved. Then
try to solve the memory shortage. To stay on the safe side, exit Vim and
start again. Also see |msdos-limitations|.
*E339* >
Pattern too long
This only happens on systems with 16 bit ints: The compiled regexp pattern is
longer than about 65000 characters. Try using a shorter pattern.
*E45* >
'readonly' option is set (use ! to override)
You are trying to write a file that was marked as read-only. To write the
file anyway, either reset the 'readonly' option, or add a '!' character just
after the command you used. Example: >
:w
changes to: >
:w!
<
*E294* *E295* *E301* >
Read error in swap file
Seek error in swap file read
Oops, lost the swap file!!!
Vim tried to read text from the |swap-file|, but something went wrong. The
text in the related buffer may now be corrupted! Check carefully before you
write a buffer. You may want to write it in another file and check for
differences.
*E192* >
Recursive use of :normal too deep
You are using a ":normal" command, whose argument again uses a ":normal"
command in a recursive way. This is restricted to 'maxmapdepth' levels. This
example illustrates how to get this message: >
:map gq :normal gq<CR>
If you type "gq", it will execute this mapping, which will call "gq" again.
*E22* >
Scripts nested too deep
Scripts can be read with the "-s" command-line argument and with the ":source"
command. The script can then again read another script. This can continue
for about 14 levels. When more nesting is done, Vim assumes that there is a
recursive loop somewhere and stops with this error message.
*E319* >
Sorry, the command is not available in this version
You have used a command that is not present in the version of Vim you are
using. When compiling Vim, many different features can be enabled or
disabled. This depends on how big Vim has chosen to be and the operating
system. See |+feature-list| for when which feature is available. The
|:version| command shows which feature Vim was compiled with.
*E300* >
Swap file already exists (symlink attack?)
This message appears when Vim is trying to open a swap file and finds it
already exists or finds a symbolic link in its place. This shouldn't happen,
because Vim already checked that the file doesn't exist. Either someone else
opened the same file at exactly the same moment (very unlikely) or someone is
attempting a symlink attack (could happen when editing a file in /tmp or when
'directory' starts with "/tmp", which is a bad choice).
*E432* >
Tags file not sorted: {file name}
Vim (and Vi) expect tags files to be sorted in ASCII order. Binary searching
can then be used, which is a lot faster than a linear search. If your tags
files are not properly sorted, reset the |'tagbsearch'| option.
This message is only given when Vim detects a problem when searching for a
tag. Sometimes this message is not given, even thought the tags file is not
properly sorted.
*E460* >
The resource fork would be lost (add ! to override)
On the Macintosh (classic), when writing a file, Vim attempts to preserve all
info about a file, including its resource fork. If this is not possible you
get this error message. Append "!" to the command name to write anyway (and
lose the info).
*E424* >
Too many different highlighting attributes in use
Vim can only handle about 223 different kinds of highlighting. If you run
into this limit, you have used too many |:highlight| commands with different
arguments. A ":highlight link" is not counted.
*E77* >
Too many file names
When expanding file names, more than one match was found. Only one match is
allowed for the command that was used.
*E303* >
Unable to open swap file for "{filename}", recovery impossible
Vim was not able to create a swap file. You can still edit the file, but if
Vim unexpected exits the changes will be lost. And Vim may consume a lot of
memory when editing a big file. You may want to change the 'directory' option
to avoid this error. See |swap-file|.
*E140* >
Use ! to write partial buffer
When using a range to write part of a buffer, it is unusual to overwrite the
original file. It is probably a mistake (e.g., when Visual mode was active
when using ":w"), therefore Vim requires using a ! after the command, e.g.:
":3,10w!".
>
Warning: Cannot convert string "<Key>Escape,_Key_Cancel" to type
VirtualBinding
Messages like this appear when starting up. This is not a Vim problem, your
X11 configuration is wrong. You can find a hint on how to solve this here:
http://groups.yahoo.com/group/solarisonintel/message/12179.
*W10* >
Warning: Changing a readonly file
The file is read-only and you are making a change to it anyway. You can use
the |FileChangedRO| autocommand event to avoid this message (the autocommand
must reset the 'readonly' option). See 'modifiable' to completely disallow
making changes to a file.
*W13* >
Warning: File "{filename}" has been created after editing started
You are editing a file in Vim when it didn't exist, but it does exist now.
You will have to decide if you want to keep the version in Vim or the newly
created file. This message is not given when 'buftype' is not empty.
*W11* >
Warning: File "{filename}" has changed since editing started
The file which you have started editing has got another timestamp and the
contents changed (more precisely: When reading the file again with the current
option settings and autocommands you would end up with different text). This
probably means that some other program changed the file. You will have to
find out what happened, and decide which version of the file you want to keep.
Set the 'autoread' option if you want to do this automatically.
This message is not given when 'buftype' is not empty.
There is one situation where you get this message even though there is nothing
wrong: If you save a file in Windows on the day the daylight saving time
starts. It can be fixed in one of these ways:
- Add this line in your autoexec.bat: >
SET TZ=-1
< Adjust the "-1" for your time zone.
- Disable "automatically adjust clock for daylight saving changes".
- Just write the file again the next day. Or set your clock to the next day,
write the file twice and set the clock back.
*W12* >
Warning: File "{filename}" has changed and the buffer was changed in Vim as well
Like the above, and the buffer for the file was changed in this Vim as well.
You will have to decide if you want to keep the version in this Vim or the one
on disk. This message is not given when 'buftype' is not empty.
*W16* >
Warning: Mode of file "{filename}" has changed since editing started
When the timestamp for a buffer was changed and the contents are still the
same but the mode (permissions) have changed. This usually occurs when
checking out a file from a version control system, which causes the read-only
bit to be reset. It should be safe to reload the file. Set 'autoread' to
automatically reload the file.
*E211* >
Warning: File "{filename}" no longer available
The file which you have started editing has disappeared, or is no longer
accessible. Make sure you write the buffer somewhere to avoid losing
changes. This message is not given when 'buftype' is not empty.
*W14* >
Warning: List of file names overflow
You must be using an awful lot of buffers. It's now possible that two buffers
have the same number, which causes various problems. You might want to exit
Vim and restart it.
*E296* *E297* >
Seek error in swap file write
Write error in swap file
This mostly happens when the disk is full. Vim could not write text into the
|swap-file|. It's not directly harmful, but when Vim unexpectedly exits some
text may be lost without recovery being possible. Vim might run out of memory
when this problem persists.
*connection-refused* >
Xlib: connection to "<machine-name:0.0" refused by server
This happens when Vim tries to connect to the X server, but the X server does
not allow a connection. The connection to the X server is needed to be able
to restore the title and for the xterm clipboard support. Unfortunately this
error message cannot be avoided, except by disabling the |+xterm_clipboard|
and |+X11| features.
*E10* >
\\ should be followed by /, ? or &
A command line started with a backslash or the range of a command contained a
backslash in a wrong place. This is often caused by command-line continuation
being disabled. Remove the 'C' flag from the 'cpoptions' option to enable it.
*E471* >
Argument required
This happens when an Ex command with mandatory argument(s) was executed, but
no argument has been specified.
*E474* *E475* >
Invalid argument
An Ex command has been executed, but an invalid argument has been specified.
*E488* >
Trailing characters
An argument has been added to an Ex command that does not permit one.
*E477* *E478* >
No ! allowed
Don't panic!
You have added a "!" after an Ex command that doesn't permit one.
*E481* >
No range allowed
A range was specified for an Ex command that doesn't permit one. See
|cmdline-ranges|.
*E482* *E483* >
Can't create file {filename}
Can't get temp file name
Vim cannot create a temporary file.
*E484* *E485* >
Can't open file %s"
Can't read file %s"
Vim cannot read a temporary file.
*E464* >
Ambiguous use of user-defined command
There are two user-defined commands with a common name prefix, and you used
Command-line completion to execute one of them. |user-cmd-ambiguous|
Example: >
:command MyCommand1 echo "one"
:command MyCommand2 echo "two"
:MyCommand
<
*E492* >
Not an editor command
You tried to execute a command that is neither an Ex command nor
a user-defined command.
==============================================================================
3. Messages *messages*
This is an (incomplete) overview of various messages that Vim gives:
*hit-enter* *press-enter* *hit-return* *press-return* >
Hit ENTER or type command to continue
This message is given when there is something on the screen for you to read,
and the screen is about to be redrawn:
- After executing an external command (e.g., ":!ls" and "=").
- Something is displayed on the status line that is longer than the width of
the window, or runs into the 'showcmd' or 'ruler' output.
-> Hit <Enter> or <Space> to redraw the screen and continue, without that key
being used otherwise.
-> Hit ":" or any other Normal mode command character to start that command.
-> Hit <C-Y> to copy (yank) a modeless selection to the clipboard register.
-> Use a menu. The characters defined for Cmdline-mode are used.
-> When 'mouse' contains the 'r' flag, clicking the left mouse button works
like pressing <Space>. This makes it impossible to select text though.
-> For the GUI clicking the left mouse button in the last line works like
pressing <Space>.
{Vi: only ":" commands are interpreted}
To reduce the number of hit-enter prompts:
- Set 'cmdheight' to 2 or higher.
- Add flags to 'shortmess'.
- Reset 'showcmd' and/or 'ruler'.
Also see 'mouse'. The hit-enter message is highlighted with the |hl-Question|
group.
*more-prompt* *pager* >
-- More --
-- More -- (RET: line, SPACE: page, d: half page, q: quit)
-- More -- (RET/BS: line, SPACE/b: page, d/u: half page, q: quit)
This message is given when the screen is filled with messages. It is only
given when the 'more' option is on. It is highlighted with the |hl-MoreMsg|
group.
Type effect ~
<CR> or <NL> or j or <Down> one more line
<BS> or k or <Up> one line back (*)
<Space> or <PageDown> next page
b or <PageUp> previous page (*)
d down half a page
u up half a page (*)
q, <Esc> or CTRL-C stop the listing
: stop the listing and enter a
command-line
<C-Y> yank (copy) a modeless selection to
the clipboard ("* and "+ registers)
{menu-entry} what the menu is defined to in
Cmdline-mode.
<LeftMouse> (**) next page
Any other key causes the meaning of the keys to be displayed.
(*) backwards scrolling is only supported for these commands: >
:clist
(**) Clicking the left mouse button only works:
- For the GUI: in the last line of the screen.
- When 'r' is included in 'mouse' (but then selecting text won't work).
Note: The typed key is directly obtained from the terminal, it is not mapped
and typeahead is ignored.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,205 @@
*mlang.txt* For Vim version 6.3. Last change: 2004 Feb 24
VIM REFERENCE MANUAL by Bram Moolenaar
Multi-language features *multilang* *multi-lang*
This is about using messages and menus in various languages. For editing
multi-byte text see |multibyte|.
The basics are explained in the user manual: |usr_45.txt|.
1. Messages |multilang-messages|
2. Menus |multilang-menus|
3. Scripts |multilang-scripts|
Also see |help-translated| for multi-language help.
{Vi does not have any of these features}
{not available when compiled without the |+multi_lang| feature}
==============================================================================
1. Messages *multilang-messages*
Vim picks up the locale from the environment. In most cases this means Vim
will use the language that you prefer, unless it's not available.
To see a list of supported locale names on your system, look in one of these
directories (for Unix):
/usr/lib/locale ~
/usr/share/locale ~
Unfortunately, upper/lowercase differences matter. Also watch out for the
use of "-" and "_".
*:lan* *:lang* *:language* *E197*
:lan[guage]
:lan[guage] mes[sages]
:lan[guage] cty[pe]
:lan[guage] tim[e]
Print the current language (aka locale).
With the "messages" argument the language used for
messages is printed. Technical: LC_MESSAGES.
With the "ctype" argument the language used for
character encoding is printed. Technical: LC_CTYPE.
With the "time" argument the language used for
strftime() is printed. Technical: LC_TIME.
Without argument all parts of the locale are printed
(this is system dependent).
The current language can also be obtained with the
|v:lang|, |v:ctype| and |v:lc_time| variables.
:lan[guage] {name}
:lan[guage] mes[sages] {name}
:lan[guage] cty[pe] {name}
:lan[guage] tim[e] {name}
Set the current language (aka locale) to {name}.
The locale {name} must be a valid locale on your
system. Some systems accept aliases like "en" or
"en_US", but some only accept the full specification
like "en_US.ISO_8859-1".
With the "messages" argument the language used for
messages is set. This can be different when you want,
for example, English messages while editing Japanese
text. This sets $LC_MESSAGES.
With the "ctype" argument the language used for
character encoding is set. This affects the libraries
that Vim was linked with. It's unusual to set this to
a different value from 'encoding'. This sets
$LC_CTYPE.
With the "time" argument the language used for time
and date messages is set. This affects strftime().
This sets $LC_TIME.
Without an argument both are set, and additionally
$LANG is set.
This will make a difference for items that depend on
the language (some messages, time and date format).
Not fully supported on all systems
If this fails there will be an error message. If it
succeeds there is no message. Example: >
:language
Current language: C
:language de_DE.ISO_8859-1
:language mes
Current messages language: de_DE.ISO_8859-1
:lang mes en
<
MS-WINDOWS MESSAGE TRANSLATIONS *win32-gettext*
If you used the self-installing .exe file, message translations should work
already. Otherwise get the libintl.dll file if you don't have it yet:
http://sourceforge.net/projects/gettext
This also contains tools xgettext, msgformat and others.
libintl.dll should be placed in same directory with (g)vim.exe, or some
place where PATH environment value describe. Message files (vim.mo)
have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES", where "xx" is the
abbreviation of the language (mostly two letters).
If you write your own translations you need to generate the .po file and
convert it to a .mo file. You need to get the source distribution and read
the file "src/po/README.txt".
To overrule the automatic choice of the language, set the $LANG variable to
the language of your choice. use "en" to disable translations. >
:let $LANG = 'ja'
(text for Windows by Muraoka Taro)
==============================================================================
2. Menus *multilang-menus*
See |45.2| for the basics.
Note that if changes have been made to the menus after the translation was
done, some of the menus may be shown in English. Please try contacting the
maintainer of the translation and ask him to update it. You can find the
name and e-mail address of the translator in
"$VIMRUNTIME/lang/menu_<lang>.vim".
To set the font (or fontset) to use for the menus, use the |:highlight|
command. Example: >
:highlight Menu font=k12,r12
ALIAS LOCALE NAMES
Unfortunately, the locale names are different on various systems, even though
they are for the same language and encoding. If you do not get the menu
translations you expected, check the output of this command: >
echo v:lang
Now check the "$VIMRUNTIME/lang" directory for menu translation files that use
a similar language. A difference in a "-" being a "_" already causes a file
not to be found! Another common difference to watch out for is "iso8859-1"
versus "iso_8859-1". Fortunately Vim makes all names lowercase, thus you
don't have to worry about case differences. Spaces are changed to
underscores, to avoid having to escape them.
If you find a menu translation file for your language with a different name,
create a file in your own runtime directory to load that one. The name of
that file could be: >
~/.vim/lang/menu_<v:lang>.vim
Check the 'runtimepath' option for directories which are searched. In that
file put a command to load the menu file with the other name: >
runtime lang/menu_<other_lang>.vim
TRANSLATING MENUS
If you want to do your own translations, you can use the |:menutrans| command,
explained below. It is recommended to put the translations for one language
in a Vim script. For a language that has no translation yet, please consider
becoming the maintainer and make your translations available to all Vim users.
Send an e-mail to the Vim maintainer <maintainer@vim.org>.
*:menut* *:menutrans* *:menutranslate*
:menut[ranslate] clear
Clear all menu translations.
:menut[ranslate] {english} {mylang}
Translate menu name {english} to {mylang}. All
special characters like "&" and "<Tab>" need to be
included. Spaces and dots need to be escaped with a
backslash, just like in other |:menu| commands.
See the $VIMRUNTIME/lang directory for examples.
To try out your translations you first have to remove all menus. This is how
you can do it without restarting Vim: >
:source $VIMRUNTIME/delmenu.vim
:source <your-new-menu-file>
:source $VIMRUNTIME/menu.vim
Each part of a menu path is translated separately. The result is that when
"Help" is translated to "Hilfe" and "Overview" to "Überblick" then
"Help.Overview" will be translated to "Hilfe.Überblick".
==============================================================================
3. Scripts *multilang-scripts*
In Vim scripts you can use the |v:lang| variable to get the current language
(locale). The default value is "C" or comes from the $LANG environment
variable.
The following example shows how this variable is used in a simple way, to make
a message adapt to language preferences of the user, >
:if v:lang =~ "de_DE"
: echo "Guten Morgen"
:else
: echo "Good morning"
:endif
<
vim:tw=78:sw=4:ts=8:ft=help:norl:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,735 @@
*netbeans.txt* For Vim version 6.3. Last change: 2004 May 01
VIM REFERENCE MANUAL by Gordon Prieur
NetBeans ExternalEditor Integration Features *netbeans*
*netbeans-support*
1. Introduction |netbeans-intro|
2. NetBeans Key Bindings |netbeans-keybindings|
3. Configuring Vim for NetBeans |netbeans-configure|
4. Downloading NetBeans |netbeans-download|
5. Preparing NetBeans for Vim |netbeans-preparation|
6. Obtaining the External Editor Module |obtaining-exted|
7. Setting up NetBeans to run with Vim |netbeans-setup|
8. Messages |netbeans-messages|
9. Running Vim from NetBeans |netbeans-run|
10. NetBeans protocol |netbeans-protocol|
11. Known problems |netbeans-problems|
{Vi does not have any of these features}
{only available when compiled with the |+netbeans_intg| feature}
==============================================================================
1. Introduction *netbeans-intro*
NetBeans is an open source Integrated Development Environment developed
jointly by Sun Microsystems, Inc. and the netbeans.org developer community.
Initially just a Java IDE, NetBeans has had C, C++, and Fortran support added
in recent releases.
For more information visit the main NetBeans web site http://www.netbeans.org
or the NetBeans External Editor site at http://externaleditor.netbeans.org.
Sun Microsystems, Inc. also ships NetBeans under the name Sun ONE Studio.
Visit http://www.sun.com for more information regarding the Sun ONE Studio
product line.
Current releases of NetBeans provide full support for Java and limited support
for C, C++, and Fortran. Current releases of Sun ONE Studio provide full
support for Java, C, C++, and Fortran.
The interface to NetBeans is also supported by Agide, the A-A-P GUI IDE.
Agide is very different from NetBeans:
- Based on Python instead of Java, much smaller footprint and fast startup.
- Agide is a framework in which many different tools can work together.
See the A-A-P website for information: http://www.A-A-P.org.
==============================================================================
2. NetBeans Key Bindings *netbeans-keybindings*
Vim understands a number of key bindings that execute NetBeans commands. These
are typically all the Function key combinations. To execute a NetBeans command,
the user must press the Pause key followed by a NetBeans key binding. For
example, in order to compile a Java file, the NetBeans key binding is "F9". So,
while in vim, press "Pause F9" to compile a java file. To toggle a breakpoint
at the current line, press "Pause Shift F8".
The Pause key is Function key 21. If you don't have a working Pause key and
want to use F8 instead, use: >
:map <F8> <F21>
The External Editor module dynamically reads the NetBeans key bindings so vim
should always have the latest key bindings, even when NetBeans changes them.
==============================================================================
3. Configuring Vim for NetBeans *netbeans-configure*
For more help installing vim, please read |usr_90.txt| in the Vim User Manual.
On Unix
When running configure without arguments the NetBeans interface should be
included. That is, if the configure check to find out if your system supports
the required features succeeds.
In case you do not want the NetBeans interface you can disable it by
uncommenting a line with "--disable-netbeans" in the Makefile.
Currently, only gvim is supported in this integration as NetBeans does not
have means to supply a terminal emulator for the vim command. Furthermore,
there is only GUI support for GTK, GNOME, and Motif.
If Motif support is required the user must supply XPM libraries. See
|workshop-xpm| for details on obtaining the latest version of XPM.
On MS-Windows
The Win32 support is now in beta stage.
To use XPM signs on Win32 (e.g. when using with NetBeans) you can compile
XPM by yourself or use precompiled libraries from http://iamphet.nm.ru/misc/
(for MS Visual C++) or http://gnuwin32.sourceforge.net (for MinGW).
==============================================================================
4. Downloading NetBeans *netbeans-download*
The NetBeans IDE is available for download from netbeans.org. You can download
a released version, download sources, or use CVS to download the current
source tree. If you choose to download sources, follow directions from
netbeans.org on building NetBeans.
Depending on the version of NetBeans you download, you may need to do further
work to get the required External Editor module. This is the module which lets
NetBeans work with gvim (or xemacs :-). See http://externaleditor.netbeans.org
for details on downloading this module if your NetBeans release does not have
it.
For C, C++, and Fortran support you will also need the cpp module. See
http://cpp.netbeans.org for information regarding this module.
You can also download Sun ONE Studio from Sun Microsystems, Inc for a 30 day
free trial. See http://www.sun.com for further details.
==============================================================================
5. Preparing NetBeans for Vim *netbeans-preparation*
In order for NetBeans to work with vim, the NetBeans External Editor module
must be loaded and enabled. If you have a Sun ONE Studio Enterprise Edition
then this module should be loaded and enabled. If you have a NetBeans release
you may need to find another way of obtaining this open source module.
You can check if you have this module by opening the Tools->Options dialog
and drilling down to the "Modules" list (IDE Configuration->System->Modules).
If your Modules list has an entry for "External Editor" you must make sure
it is enabled (the "Enabled" property should have the value "True"). If your
Modules list has no External Editor see the next section on |obtaining-exted|.
==============================================================================
6. Obtaining the External Editor Module *obtaining-exted*
There are 2 ways of obtaining the External Editor module. The easiest way
is to use the NetBeans Update Center to download and install the module.
Unfortunately, some versions do not have this module in their update
center. If you cannot download via the update center you will need to
download sources and build the module. I will try and get the module
available from the NetBeans Update Center so building will be unnecessary.
Also check http://externaleditor.netbeans.org for other availability options.
To download the External Editor sources via CVS and build your own module,
see http://externaleditor.netbeans.org and http://www.netbeans.org.
Unfortunately, this is not a trivial procedure.
==============================================================================
7. Setting up NetBeans to run with Vim *netbeans-setup*
Assuming you have loaded and enabled the NetBeans External Editor module
as described in |netbeans-preparation| all you need to do is verify that
the gvim command line is properly configured for your environment.
Open the Tools->Options dialog and open the Editing category. Select the
External Editor. The right hand pane should contain a Properties tab and
an Expert tab. In the Properties tab make sure the "Editor Type" is set
to "Vim". In the Expert tab make sure the "Vim Command" is correct.
You should be careful if you change the "Vim Command". There are command
line options there which must be there for the connection to be properly
set up. You can change the command name but thats about it. If your gvim
can be found by your $PATH then the VIM Command can start with "gvim". If
you don't want gvim searched from your $PATH then hard code in the full
Unix path name. At this point you should get a gvim for any source file
you open in NetBeans.
If some files come up in gvim and others (with different file suffixes) come
up in the default NetBeans editor you should verify the MIME type in the
Expert tab MIME Type property. NetBeans is MIME oriented and the External
Editor will only open MIME types specified in this property.
==============================================================================
8. Messages *netbeans-messages*
These messages are specific for NetBeans:
*E463*
Region is guarded, cannot modify
NetBeans defines guarded areas in the text, which you cannot
change.
*E656*
NetBeans dissallows writes of unmodified buffers
NetBeans does not support writes of unmodified buffers that
were opened from NetBeans.
*E657*
Partial writes disallowed for NetBeans buffers
NetBeans does not support partial writes for buffers that were
opened from NetBeans.
*E658*
NetBeans connection lost for this buffer
NetBeans has become confused about the state of this file.
Rather than risc data corruption, NetBeans has severed the
connection for this file. Vim will take over responsibility
for saving changes to this file and NetBeans will no longer
know of these changes.
==============================================================================
9. Running Vim from NetBeans *netbeans-run*
NetBeans starts Vim with the |-nb| argument. Three forms can be used, that
differ in the way the information for the connection is specified:
-nb={fname} from a file
-nb:{hostname}:{addr}:{password} directly
-nb from a file or environment
*E660* *E668*
For security reasons, the best method is to write the information in a file
readable only by the user. The name of the file can be passed with the
"-nb={fname}" argument or, when "-nb" is used without a parameter, the
environment variable "__NETBEANS_CONINFO". The file must contain these three
lines, in any order:
host={hostname}
port={addr}
auth={password}
Other lines are ignored. The caller of Vim is responsible for deleting the
file afterwards.
{hostname} is the name of the machine where NetBeans is running. When omitted
the environment variable "__NETBEANS_HOST" is used or the default "localhost".
{addr} is the port number for NetBeans. When omitted the environment variable
"__NETBEANS_SOCKET" is used or the default 3219.
{password} is the password for connecting to NetBeans. When omitted the
environment variable "__NETBEANS_VIM_PASSWORD" is used or "changeme".
==============================================================================
10. NetBeans protocol *netbeans-protocol*
The communication between NetBeans and Vim uses plain text messages. This
protocol was first designed to work with the external editor module of
NetBeans (see http://externaleditor.netbeans.org). Later it was extended to
work with Agide (A-A-P GUI IDE, see http://www.a-a-p.org). The extensions are
marked with "version 2.1".
Version 2.2 of the protocol has several minor changes which should only
affect NetBeans users (ie, not Agide users). However, a bug was fixed which
could cause confusion. The netbeans_saved() function sent a "save" protocol
command. In protocol version 2.1 and earlier this was incorrectly interpreted
as a notification that a write had taken place. In reality, it told NetBeans
to save the file so multiple writes were being done. This caused various
problems and has been fixed in 2.2. To decrease the likelyhood of this
confusion happening again, netbeans_saved() has been renamed to
netbeans_save_buffer().
The messages are currently sent over a socket. Since the messages are in
plain UTF-8 text this protocol could also be used with any other communication
mechanism.
10.1 Kinds of messages |nb-messages|
10.2 Terms |nb-terms|
10.3 Commands |nb-commands|
10.4 Functions and Replies |nb-functions|
10.5 Events |nb-events|
10.6 Special messages |nb-special|
*E627* *E628* *E629* *E630* *E631* *E632* *E633* *E634* *E635* *E636*
*E637* *E638* *E639* *E640* *E641* *E642* *E643* *E644* *E645* *E646*
*E647* *E648* *E649* *E650* *E651* *E652* *E653* *E654*
These errors occur when a message violates the protocol.
10.1 Kinds of messages *nb-messages*
There are four kinds of messages:
kind direction comment ~
Command IDE -> editor no reply necessary
Function IDE -> editor editor must send back a reply
Reply editor -> IDE only in response to a Function
Event editor -> IDE no reply necessary
The messages are sent as a single line with a terminating newline character.
Arguments are separated by a single space. The first item of the message
depends on the kind of message:
kind first item example ~
Command bufID:name!seqno 11:showBalloon!123 "text"
Function bufID:name/seqno 11:getLength/123
Reply seqno 123 5000
Event bufID:name=123 11:keyCommand=123 "S-F2"
10.2 Terms *nb-terms*
bufID Buffer number. A message may be either for a specific buffer
or generic. Generic messages use a bufID of zero. NOTE: this
buffer ID is assigned by the IDE, it is not Vim's buffer
number. The bufID must be a sequentially rising number,
starting at one.
seqno The IDE uses a sequence number for Commands and Functions. A
Reply must use the sequence number of the Function that it is
associated with. A zero sequence number can be used for
Events (the seqno of the last received Command or Function can
also be used).
string Argument in double quotes. Text is in UTF-8 encoding. This
means ASCII is passed as-is. Special characters are
represented with a backslash:
\" double quote
\n newline
\r carriage-return
\t tab (optional, also works literally)
\\ backslash
NUL bytes are not allowed!
boolean Argument with two possible values:
T true
F false
number Argument with a decimal number.
optnum Argument with either a decimal number or "none" (without the
quotes).
offset A number argument that indicates a byte position in a buffer.
The first byte has offset zero. Line breaks are counted for
how they appear in the file (CR/LF counts for two bytes).
Note that a multi-byte character is counted for the number of
bytes it takes.
lnum/col Argument with a line number and column number position. The
line number starts with one, the column is the byte position,
starting with zero. Note that a multi-byte character counts
for several columns.
pathname String argument: file name with full path.
10.3 Commands *nb-commands*
actionMenuItem Not implemented.
actionSensitivity
Not implemented.
addAnno serNum typeNum off len
Place an annotation in this buffer.
Arguments:
serNum number serial number of this placed
annotation, used to be able to remove
it
typeNum number sequence number of the annotation
defined with defineAnnoType for this
buffer
off number offset where annotation is to be placed
len number not used
In version 2.1 "lnum/col" can be used instead of "off".
balloonResult text
Not implemented.
close Close the buffer. This leaves us without current buffer, very
dangerous to use!
create Creates a buffer without a name. Replaces the current buffer
(it's hidden when it was changed).
NetBeans uses this as the first command for a file that is
being opened. The sequence of commands could be:
create
setCaretListener (ignored)
setModified (no effect)
setContentType (ignored)
startDocumentListen
setTitle
setFullName
defineAnnoType typeNum typeName tooltip glyphFile fg bg
Define a type of annotation for this buffer.
Arguments:
typeNum number sequence number (not really used)
typeName string name that identifies this annotation
tooltip string not used
glyphFile string name of icon file
fg optnum foreground color for line highlighting
bg optnum background color for line highlighting
Vim will define a sign for the annotation.
When both "fg" and "bg" are "none" no line highlighting is
used (new in version 2.1).
When "glyphFile" is empty, no text sign is used (new in
version 2.1).
When "glyphFile" is one or two characters long, a text sign is
defined (new in version 2.1).
Note: the annotations will be defined in sequence, and the
sequence number is later used with addAnno.
editFile pathname
Set the name for the buffer and edit the file "pathname", a
string argument.
Normal way for the IDE to tell the editor to edit a file. If
the IDE is going to pass the file text to the editor use these
commands instead:
setFullName
insert
initDone
New in version 2.1.
enableBalloonEval
Not implemented.
endAtomic End an atomic operation. The changes between "startAtomic"
and "endAtomic" can be undone as one operation. But it's not
implemented yet. Redraw when necessary.
guard off len
Mark an area in the buffer as guarded. This means it cannot
be edited. "off" and "len" are numbers and specify the text
to be guarded.
initDone Mark the buffer as ready for use. Implicitly makes the buffer
the current buffer. Fires the BufReadPost autocommand event.
moveAnnoToFront serNum
Not implemented.
netbeansBuffer isNetbeansBuffer
If "isNetbeansBuffer" is "T" then this buffer is ``owned'' by
NetBeans.
New in version 2.2.
putBufferNumber pathname
Associate a buffer number with the Vim buffer by the name
"pathname", a string argument. To be used when the editor
reported editing another file to the IDE and the IDE needs to
tell the editor what buffer number it will use for this file.
Also marks the buffer as initialized.
New in version 2.1.
raise Bring the editor to the foreground.
New in version 2.1.
removeAnno serNum
Remove a previously place annotation for this buffer.
"serNum" is the same number used in addAnno.
save Save the buffer when it was modified. The other side of the
interface is expected to write the buffer and invoke
"setModified" to reset the "changed" flag of the buffer.
The writing is skipped when one of these conditions is true:
- 'write' is not set
- the buffer is read-only
- the buffer does not have a file name
- 'buftype' disallows writing
New in version 2.2.
setAsUser Not implemented.
setBufferNumber pathname
Associate a buffer number with Vim buffer by the name
"pathname". To be used when the editor reported editing
another file to the IDE and the IDE needs to tell the editor
what buffer number it will use for this file.
Has the side effect of making the buffer the current buffer.
See "putBufferNumber" for a more useful command.
setContentType
Not implemented.
setDot off Make the buffer the current buffer and set the cursor at the
specified position. If there are folds they are opened to
make the cursor line visible.
In version 2.1 "lnum/col" can be used instead of "off".
setExitDelay seconds
Set the delay for exiting to "seconds", a number.
This delay is used to give the IDE a chance to handle things
before really exiting. The default delay is two seconds.
New in version 2.1.
setFullName pathname
Set the file name to be used for a buffer to "pathname", a
string argument.
Used when the IDE wants to edit a file under control of the
IDE. This makes the buffer the current buffer, but does not
read the file. "insert" commands will be used next to set the
contents.
setLocAndSize Not implemented.
setMark Not implemented.
setModified modified
When the boolean argument "modified" is "T" mark the buffer as
modified, when it is "F" mark it as unmodified.
setReadOnly Not implemented.
setStyle Not implemented.
setTitle name
Set the title for the buffer to "name", a string argument.
The title is only used for NetBeans functions, not by Vim.
setVisible visible
When the boolean argument "visible" is "T", goto the buffer.
The "F" argument does nothing.
showBalloon text
Show a balloon (popup window) at the mouse pointer position,
containing "text", a string argument. The balloon should
disappear when the mouse is moved more than a few pixels.
New in version 2.1.
specialKeys Not implemented.
startAtomic Begin an atomic operation. The screen will not be updated
until "endAtomic" is given.
startCaretListen
Not implemented.
startDocumentListen
Mark the buffer to report changes to the IDE with the
"insert" and "remove" events. The default is to report
changes.
stopCaretListen
Not implemented.
stopDocumentListen
Mark the buffer to stop reporting changes to the IDE.
Opposite of startDocumentListen.
unguard off len
Opposite of "guard", remove guarding for a text area.
version Not implemented.
10.4 Functions and Replies *nb-functions*
getDot Not implemented.
getCursor Return the current buffer and cursor position.
The reply is:
seqno bufID lnum col off
seqno = sequence number of the function
bufID = buffer ID of the current buffer (if this is unknown -1
is used)
lnum = line number of the cursor (first line is one)
col = column number of the cursor (in bytes, zero based)
off = offset of the cursor in the buffer (in bytes)
New in version 2.1.
getLength Return the length of the buffer in bytes.
Reply example for a buffer with 5000 bytes:
123 5000
TODO: explain use of partial line.
getMark Not implemented.
getModified When a buffer is specified: Return zero if the buffer does not
have changes, one if it does have changes.
When no buffer is specified (buffer number zero): Return the
number of buffers with changes. When the result is zero it's
safe to tell Vim to exit.
New in version 2.1.
getText Return the contents of the buffer as a string.
Reply example for a buffer with two lines
123 "first line\nsecond line\n"
NOTE: docs indicate an offset and length argument, but this is
not implemented.
insert off text
Insert "text" before position "off". "text" is a string
argument, "off" a number.
Possible replies:
123 no problem
123 !message failed
Note that the message in the reply is not quoted.
remove off length
Delete "length" bytes of text at position "off". Both
arguments are numbers.
Possible replies:
123 no problem
123 !message failed
Note that the message in the reply is not quoted.
saveAndExit Perform the equivalent of closing Vim: ":confirm qall".
If there are no changed files or the user does not cancel the
operation Vim exits and no result is sent back. The IDE can
consider closing the connection as a successful result.
If the user cancels the operation the number of modified
buffers that remains is returned and Vim does not exit.
New in version 2.1.
10.5 Events *nb-events*
balloonEval off len type
The mouse pointer rests on text for a short while. When "len"
is zero, there is no selection and the pointer is at position
"off". When "len" is non-zero the text from position "off" to
"off" + "len" is selected.
Only sent after "enableBalloonEval" was used for this buffer.
"type" is not yet defined.
Not implemented yet.
balloonText text
Used when 'ballooneval' is set and the mouse pointer rests on
some text for a moment. "text" is a string, the text under
the mouse pointer.
New in version 2.1.
buttonRelease button lnum col
Report which button was pressed and the location of the cursor
at the time of the release. Only for buffers that are owned
by NetBeans. This event is not sent if the button was
released while the mouse was in the status line or in a
separator line. If col is less than 1 the button release was
in the sign area.
New in version 2.2.
fileClosed Not implemented.
fileModified Not implemented.
fileOpened pathname open modified
A file was opened by the user.
Arguments:
pathname string name of the file
open boolean always "T"
modified boolean always "F"
geometry cols rows x y
Report the size and position of the editor window.
Arguments:
cols number number of text columns
rows number number of text rows
x number pixel position on screen
y number pixel position on screen
Only works for Motif.
insert off text
Text "text" has been inserted in Vim at position "off".
Only fired when enabled, see "startDocumentListen".
invokeAction Not implemented.
keyCommand keyName
Reports a special key being pressed with name "keyName", which
is a string.
Supported key names:
F1 function key 1
F2 function key 2
...
F12 function key 12
' ' space (without the quotes)
! exclamation mark
... any other ASCII printable character
~ tilde
X any unrecognized key
The key may be prepended by "C", "S" and/or "M" for Control,
Shift and Meta (Alt) modifiers. If there is a modifier a dash
is used to separate it from the key name. For example:
"C-F2".
ASCII characters are new in version 2.1.
keyAtPos keyName lnum/col
Like "keyCommand" and also report the line number and column
of the cursor.
New in version 2.1.
killed A file was closed by the user. Only for files that have been
assigned a number by the IDE.
newDotAndMark off off
Reports the position of the cursor being at "off" bytes into
the buffer. Only sent just before a "keyCommand" event.
quit Not implemented.
remove off len
Text was deleted in Vim at position "off" with byte length
"len".
Only fired when enabled, see "startDocumentListen".
revert Not implemented.
save The buffer has been saved and is now unmodified.
Only fired when enabled, see "startDocumentListen".
startupDone The editor has finished its startup work and is ready for
editing files.
New in version 2.1.
unmodified The buffer is now unmodified.
Only fired when enabled, see "startDocumentListen".
version vers Report the version of the interface implementation. Vim
reports "2.2" (including the quotes).
10.6 Special messages *nb-special*
These messages do not follow the style of the messages above. They are
terminated by a newline character.
ACCEPT Not used.
AUTH password editor -> IDE: First message that the editor sends to the IDE.
Must contain the password for the socket server, as specified
with the |-nb| argument. No quotes are used!
DISCONNECT IDE -> editor: break the connection. The editor will exit.
The IDE must only send this message when there are no unsaved
changes!
DETACH IDE -> editor: break the connection without exiting the
editor. Used when the IDE exits without bringing down the
editor as well.
New in version 2.1.
REJECT Not used.
==============================================================================
11. Known problems *netbeans-problems*
NUL bytes are not possible. For editor -> IDE they will appear as NL
characters. For IDE -> editor they cannot be inserted.
vim:tw=78:ts=8:ft=help:norl:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,340 @@
*os_390.txt* For Vim version 6.3. Last change: 2003 Jun 03
VIM REFERENCE MANUAL by Ralf Schandl
*zOS* *z/OS* *OS390* *os390* *MVS*
This file contains the particulars for the z/OS UNIX version of Vim.
1. Open source on z/OS UNIX |zOS-open-source|
2. Your feedback is needed |zOS-feedback|
3. Building VIM for z/OS UNIX |zOS-building|
4. ASCII/EBCDIC dependent scripts |zOS-has-ebcdic|
5. XTerm Problems |zOS-xterm|
6. Motif Problems |zOS-Motif|
7 Bugs |zOS-Bugs|
8. Known weaknesses |zOS-weaknesses|
9. Changes |zOS-changes|
DISCLAIMER: ~
We are IBM employees, but IBM is not responsible for this port. This is our
private fun, and is provided in the hopes that it may be useful to others.
Please note that this software has NOT been submitted to any formal IBM
testing and is published AS IS. Please do not contact IBM for support for this
software, as it is not an official component of any IBM product. IT IS NOT
SUPPORTED, GUARANTEED, OR RELATED WHATSOEVER TO IBM.
Contributors: ~
The port to z/OS UNIX was done by Ralf Schandl for the Redbook mentioned
below.
Changes, bug-reports, or both by:
David Moore
Anthony Giorgio <agiorgio@fastmail.fm>
and others
This document was written by Ralf Schandl and revised by Anthony Giorgio.
==============================================================================
1. Open source on z/OS UNIX *OS390-open-source* *zOS-open-source*
If you are interested in other Open Source Software on z/OS UNIX, have a
look at the following Redbook:
Mike MacIsaac et al
"Open Source Software for z/OS and OS/390 UNIX"
IBM Form Number: SG24-5944-01
ISBN: 0738424633
You can find out more information, order a hard copy, or download a PDF
version of these Redbooks at:
http://www.redbooks.ibm.com
==============================================================================
2. Your feedback is needed *OS390-feedback* *zOS-feedback*
Vim should compile, link, and run right out of the box on a standard IBM z/OS
UNIX mainframe. I've personally run it on z/OS V1R2 and V1R3 machines without
problems.
Many changes had to be done to the code to port Vim to z/OS UNIX. As like
most UNIX programs, Vim contained heavy ASCII dependencies. I might have
missed an ASCII dependency, or it is possible that a new one has been added
with a feature or bug fix. Most programmers are simply not aware of possible
ASCII/EBCDIC conversion issues. If you hit a problem that seems related to
this, feel free to contact us at the email addresses above.
One indication of ASCII/EBCDIC conversion problems is screen corruption with
"unprintable" characters. For example, at one point the errorbell was broken
in Vim. Any time Vim tried to ring the terminal bell an ASCII character 0x07
would be printed. This works fine on most terminals, but is broken on an
EBCDIC one. The correct solution was to define a different value for the bell
character on EBCDIC systems.
Remember, it's only possible to fix a bug if the community knows about it.
Don't rely on someone else to report it! See the section |bug-reports|.
==============================================================================
3. Building VIM for z/OS UNIX *OS390-building* *zOS-building*
A word on debugging code first: ~
The normal run of configure adds the flag '-g' to the compiler options,
to include debugging information into the executable. This information
are normally removed from the executable with the strip command during
installation. On z/OS UNIX, it is not possible to remove this from
the executable. The strip command exists on z/OS UNIX and is called
during the installation, but it does nothing. It is equivalent to the
'touch' command. This is due to the way debug symbols are stored in the
objects generated by the compiler.
If you want to build Vim without debugging code, export the environment
variable CFLAGS set to an empty string before you call the configure script.
>
export CFLAGS=""
Building without X11: ~
Note: Use cc to build Vim. The c89 compiler has stricter syntax checking
and will not compile Vim cleanly.
If you build VIM without X11 support, compiling and building is
straightforward. Don't forget to export _CC_CCMODE=1 before calling
configure and make.
>
$ export _CC_CCMODE=1
$./configure --with-features=big --without-x --enable-gui=no
$ make
$ make test
<
Test notes:
Test 11 will fail if you do not have gzip installed.
Test 42 will fail, as VIM on z/OS UNIX doesn't support the multibyte
feature. (David Moore: "Doesn't work _yet_! :-) I'll see what I
can do.")
>
$ make install
Building with X11: ~
There are two ways for building Vim with X11 support. You can link it
statically with the X11 libraries or can bind it with the X11 DLLs. The
statically linked version results in a huge executable (~13MB), while the
dynamically linked executable is much smaller (~4.5MB).
Here is what you do, if you want Motif:
a) Static link >
$ configure --with-features=big --enable-gui=motif
$ make
<
VIM is now linked statically with the X11 libraries.
b) Dynamic link:
Make VIM as described for the static link. Then change the contents of
the 'auto/link.sed' file by appending: >
s%-lXm *%/usr/lib/Xm.x %g
s%-lX11 *%/usr/lib/X11.x %g
s%-lSM *%/usr/lib/SM.x %g
s%-lICE *%/usr/lib/ICE.x %g
<
Then do: >
$ rm vim
$ make
<
Now Vim is linked with the X11-DLLs.
See the Makefile and the file link.sh on how link.sed is used.
==============================================================================
4. ASCII/EBCDIC dependent scripts *OS390-has-ebcdic* *zOS-has-ebcdic*
For the internal script language the feature "ebcdic" was added. With this
you can fix ASCII dependent scripts like this:
>
if has("ebcdic")
let space = 64
else
let space = 32
endif
<
==============================================================================
5. XTerm problems *OS390-xterm* *zOS-xterm*
Note: This problem was resolved in version 6.1b. ~
I saw one problem with XTerm on z/OS UNIX. The terminal code for moving the
cursor to the left is wrong in the termlib database. Perhaps not wrong, but
it didn't work with VIM syntax highlighting and command line cursor movement.
If the highlighting is messed up while you type, but is okay after you refreshed
the screen with <C-L> or if you can't move to the left with the cursor key on
the command line, try adding >
:set t_le=^H
<
to your .vimrc. Note: '^H' is one character, hit <C-V><C-H> to get it.
==============================================================================
6. Motif Problems *OS390-Motif* *zOS-Motif*
It seems that in porting the Motif library to z/OS, a translation from EBCDIC
to ASCII for the accelerator characters of the pull-down menus was forgotten.
Even after I tried to hand convert the menus, the accelerator keys continued
to only work for the opening of menus (like <Alt-F> to open the file menu).
They still do not work for the menu items themselves (like <Alt-F>O to open
the file browser).
There is no solution for this as of yet.
==============================================================================
7. Bugs *OS390-bugs* *zOS-Bugs*
- Vim will consistently hang when a large amount of text is selected in
visual block mode. This may be due to a memory corruption issue. Note that
this occurs in both the terminal and gui versions.
==============================================================================
8. Known weaknesses *OS390-weaknesses* *zOS-weaknesses*
- No binary search in tag files.
The program /bin/sort sorts by ASCII value by default. This program is
normally used by ctags to sort the tags. There might be a version of
ctags out there, that does it right, but we can't be sure. So this seems to
be a permanent restriction.
- Multibyte support (utf-8) doesn't work, it's disabled at compile time.
(|multibyte|)
- The cscope interface (|cscope|) doesn't work for the version of cscope
that we use on our mainframe. We have a copy of version 15.0b12, and it
causes Vim to hang when using the "cscope add" command. I'm guessing that
the binary format of the cscope database isn't quite what Vim is expecting.
I've tried to port the current version of cscope (15.3) to z/OS, without
much success. If anyone is interested in trying, drop me a line if you
make any progress.
- No glib/gtk support. I have not been able to successfully compile glib on
z/OS UNIX. This means you'll have to live without the pretty gtk toolbar.
Never tested:
- Perl interface (|perl|)
- Hangul input (|hangul|)
- Encryption support (|encryption|)
- Langmap (|'langmap'|)
- Python support (|Python|)
- Right-to-left mode (|'rightleft'|)
- SNiFF+ interface (|sniff|)
- TCL interface (|tcl|)
...
If you try any of these features and they work, drop us a note!
==============================================================================
9. Changes *OS390-changes* *zOS-changes*
This is a small reference of the changes made to the z/OS port of Vim. It is
not an exhaustive summary of all the modifications made to the code base.
6.1b (beta):
Changed KS_LE in term.c to be "\b" instead of "\010" This fixed the
screen corruption problems in gVim reported by Anthony Giorgio.
Anthony Giorgio updated this document:
- Changed OS/390 to z/OS where appropriate. IBM decided to rename
all of its servers and operating systems. z/OS and OS/390
are the same product, but the version numbering system was
reset for the name change. (e.g. OS/390 V2R11 == z/OS V1R1)
- Added information about second edition of the Open Source Redbook.
- Moved Redbook information to a separate section.
- Various tweaks and changes.
- Updated testing section.
6.0au:
Changed configure.in
Changed documentation.
Anthony Giorgio fixed the errorbell.
David Moore found some problems, which were fixed by Bram and/or David for
6.0au.
6.0q (alpha):
Minor changes for nrformats=alpha (see |'nrformats'|).
Problem with hard-coded keycode for the English pound sign. Added a define in
ascii.h
Disabled multibyte for EBCDIC in feature.h
6.0f (alpha):
First compile of Vim 6 on z/OS UNIX. Some minor changes were needed.
Finally found the reason why make from the top level didn't work (I must have
been blind before!). The Makefile contained a list of targets in one target
line. On all other UNIX's the macro $@ evaluates to the first target in this
list, only on z/OS UNIX it evaluates to the last one :-(.
5.6-390d:
Cleaned up some hacks.
5.6-390c:
I grepped through the source and examined every spot with a character
involved in a operation (+-). I hope I now found all EBCDIC/ASCII
stuff, but ....
Fixed:
- fixed warning message in do_fixdel()
- fixed translation from Ctrl-Char to symbolic name (like ^h to CTRL-H)
for :help
- fixed yank/delete/... into register
- fixed :register command
- fixed viminfo register storing
- fixed quick-access table in findoptions()
- fixed 'g^H' select mode
- fixed tgetstr() 'get terminal capability string', ESC and
Ctrl chars where wrong. (Not used on OS/390 UNIX)
ctags:
- added trigraphs support (used in prolog of system header files)
(get.c)
- fixed sorting order with LC_COLLATE=S390 to force EBCDIC sorting.
(sort.c)
5.6-390b:
Changed:
- configure.in:
- added test for OS/390 UNIX
- added special compiler and linker options if building with X11
- configure:
- after created via autoconf hand-edited it to make the test for
ICEConnectionNumber work. This is a autoconf problem. OS/390 UNIX
needs -lX11 for this.
- Makefile
- Don't include the lib directories ('-L...') into the variable
ALL_LIBS. Use own variable ALL_LIB_DIRS instead. A fully POSIX
compliant compiler must not accept objects/libraries and options
mixed. Now we can call the linker like this:
$(CC) $(LDFLAGS) $(ALL_LIB_DIRS) $(OBJ) $(ALL_LIBS)
Fixed:
- Double quote couldn't be entered
Missed ASCII dependencies while setting up terminal
In ASCII 127 is the delete char, in EBCDIC codepage 1047 the value 127
is the double quote.
- fixed ':fixdel'
5.6-390a:
first alpha release for OS/390 UNIX.
Addition:
- For the internal script language I added the feature "ebcdic".
This can be queried with the has()-function of the internal
script language.
------------------------------------------------------------------------------
vim:tw=78:fo=tcq2:ts=8:ft=help:norl:

View File

@ -0,0 +1,139 @@
*os_amiga.txt* For Vim version 6.3. Last change: 2004 Apr 25
VIM REFERENCE MANUAL by Bram Moolenaar
*Amiga*
This file contains the particularities for the Amiga version of Vim.
There is also a section specifically for |MorphOS| below.
Installation on the Amiga:
- Assign "VIM:" to the directory where the Vim "doc" directory is. Vim will
look for the file "VIM:doc/help.txt" (for the help command).
Setting the environment variable $VIM also works. And the other way around:
when $VIM used and it is not defined, "VIM:" is used.
- With DOS 1.3 or earlier: Put "arp.library" in "libs:". Vim must have been
compiled with the |+ARP| feature enabled. Make sure that newcli and run are
in "C:" (for executing external commands).
- Put a shell that accepts a command with "-c" (e.g. "Csh" from Fish disk
624) in "c:" or in any other directory that is in your search path (for
executing external commands).
If you have sufficient memory you can avoid startup delays by making Vim and
csh resident with the command "rez csh vim". You will have to put
"rezlib.library" in your "libs:" directory. Under 2.0 you will need rez
version 0.5.
If you do not use digraphs, you can save some memory by recompiling without
the |+digraphs| feature. If you want to use Vim with other terminals you can
recompile with the TERMCAP option. Vim compiles with Manx 5.x and SAS 6.x.
See the makefiles and feature.h.
If you want to use different colors set the termcap codes:
t_mr (for inverted text)
t_md (for bold text)
t_me (for normal text after t_mr and t_md)
t_so (for standout mode)
t_se (for normal text after t_so)
t_us (for underlined text)
t_ue (for normal text after t_us)
t_ZH (for italic text)
t_ZR (for normal text after t_ZH)
Standard ANSI escape sequences are used. The codes are:
30 grey char 40 grey cell >0 grey background 0 all attributes off
31 black char 41 black cell >1 black background 1 boldface
32 white char 42 white cell >2 white background 2 faint
33 blue char 43 blue cell >3 blue background 3 italic
34 grey char 44 grey cell >4 grey background 4 underscore
35 black char 45 black cell >5 black background 7 reverse video
36 white char 46 white cell >6 white background 8 invisible
37 blue char 47 blue cell >7 blue background
The codes with '>' must be the last. The cell and background color should be
the same. The codes can be combined by separating them with a semicolon. For
example to get white text on a blue background: >
:set t_me=^V<Esc>[0;32;43;>3m
:set t_se=^V<Esc>[0;32;43;>3m
:set t_ue=^V<Esc>[0;32;43;>3m
:set t_ZR=^V<Esc>[0;32;43;>3m
:set t_md=^V<Esc>[1;32;43;>3m
:set t_mr=^V<Esc>[7;32;43;>3m
:set t_so=^V<Esc>[0;31;43;>3m
:set t_us=^V<Esc>[4;32;43;>3m
:set t_ZH=^V<Esc>[3;32;43;>3m
When using multiple commands with a filter command, e.g. >
:r! echo this; echo that
Only the output of the last command is used. To fix this you have to group the
commands. This depends on the shell you use (that is why it is not done
automatically in Vim). Examples: >
:r! (echo this; echo that)
:r! {echo this; echo that}
Commands that accept a single file name allow for embedded spaces in the file
name. However, when using commands that accept several file names, embedded
spaces need to be escaped with a backslash.
------------------------------------------------------------------------------
Vim for MorphOS *MorphOS*
[this section mostly by Ali Akcaagac]
For the latest info about the MorphOS version:
http://www.akcaagac.com/index_vim.html
Problems ~
There are a couple of problems which are not MorphOS related but more Vim and
UN*X related. When starting up Vim in ram: it complains with a nag requester
from MorphOS please simply ignore it. Another problem is when running Vim as
is some plugins will cause a few problems which you can ignore as well.
Hopefully someone will be fixing it over the time.
To pass all these problems for now you can either run:
vim <file to be edited>
or if you want to run Vim plain and enjoy the motion of Helpfiles etc. it then
would be better to enter:
vim --noplugins <of course you can add a file>
Installation ~
1) Please copy the binary 'VIM' file to c:
2) Get the Vim runtime package from:
ftp://ftp.vim.org/pub/vim/amiga/vim62rt.tgz
and unpack it in your 'Apps' directory of the MorphOS installation. For me
this would create following directory hierarchy:
MorphOS:Apps/Vim/Vim62/...
3) Add the following lines to your s:shell-startup (Important!).
;Begin VIM
Set VIM=MorphOS:Apps/Vim/Vim62
Assign HOME: ""
;End VIM
4) Copy the '.vimrc' file to s:
5) There is also a file named 'color-sequence' included in this archive. This
will set the MorphOS Shell to show ANSI colors. Please copy the file to s:
and change the s:shell-startup to:
;Begin VIM
Set VIM=MorphOS:Apps/Vim/Vim62
Assign HOME: ""
Execute S:Color-Sequence
Cls
;End VIM
vim:tw=78:ts=8:ft=help:norl:

View File

@ -0,0 +1,348 @@
*os_beos.txt* For Vim version 6.3. Last change: 2004 May 01
VIM REFERENCE MANUAL by Bram Moolenaar
*BeOS* *BeBox*
This is a port of Vim 5.1 to the BeOS Preview Release 2 (also known as PR2)
or later.
This file contains the particularities for the BeBox/BeOS version of Vim. For
matters not discussed in this file, Vim behaves very much like the Unix
|os_unix.txt| version.
1. General |beos-general|
2. Compiling Vim |beos-compiling|
3. Timeout in the Terminal |beos-timeout|
4. Unicode vs. Latin1 |beos-unicode|
5. The BeOS GUI |beos-gui|
6. The $VIM directory |beos-vimdir|
7. Drag & Drop |beos-dragndrop|
8. Single Launch vs. Multiple
Launch |beos-launch|
9. Fonts |beos-fonts|
10. The meta key modifier |beos-meta|
11. Mouse key mappings |beos-mouse|
12. Color names |beos-colors|
13. Compiling with Perl |beos-perl|
1. General *beos-general*
The default syntax highlighting mostly works with different foreground colors
to highlight items. This works best if you set your Terminal window to a
darkish background and light letters. Some middle-grey background (for
instance (r,g,b)=(168,168,168)) with black letters also works nicely. If you
use the default light background and dark letters, it may look better to
simply reverse the notion of foreground and background color settings. To do
this, add this to your .vimrc file (where <Esc> may need to be replaced with
the escape character): >
:if &term == "beos-ansi"
: set t_AB=<Esc>[3%dm
: set t_AF=<Esc>[4%dm
:endif
2. Compiling Vim *beos-compiling*
From the Advanced Access Preview Release (AAPR) on, Vim can be configured with
the standard configure script. To get the compiler and its flags right, use
the following command-line in the shell (you can cut and paste it in one go):
CC=$BE_C_COMPILER CFLAGS="$BE_DEFAULT_C_FLAGS -O7" \
./configure --prefix=/boot/home/config
$BE_C_COMPILER is usually "mwcc", $BE_DEFAULT_C_FLAGS is usually "-I- -I."
When configure has run, and you wish to enable GUI support, you must edit the
config.mk file so that the lines with GUI_xxx refer to $(BEOSGUI_xxx) instead
of $(NONE_xxx).
Alternatively you can make this change in the Makefile; it will have a
more permanent effect. Search for "NONE_".
After compilation you need to add the resources to the binary. Add the
following few lines near the end (before the line with "exit $exit_value") of
the link.sh script to do this automatically.
rmattr BEOS:TYPE vim
copyres os_beos.rsrc vim
mimeset vim
Also, create a dummy file "strip":
#!/bin/sh
mimeset $1
exit 0
You will need it when using "make install" to install Vim.
Now type "make" to compile Vim, then "make install" to install it.
If you want to install Vim by hand, you must copy Vim to $HOME/config/bin, and
create a bunch of symlinks to it ({g,r,rg}{vim,ex,view}). Furthermore you must
copy Vims configuration files to $HOME/config/share/vim:
vim-5.0s/{*.vim,doc,syntax}. For completeness, you should also copy the nroff
manual pages to $HOME/config/man/man1. Don't forget ctags/ctags and xxd/xxd!
Obviously, you need the unlimited linker to actually link Vim. See
http://www.metrowerks.com for purchasing the CodeWarrior compiler for BeOS.
There are currently no other linkers that can do the job.
This won't be able to include the Perl or Python interfaces even if
you have the appropriate files installed. |beos-perl|
3. Timeout in the Terminal *beos-timeout*
Because some POSIX/UNIX features are still missing[1], there is no direct OS
support for read-with-timeout in the Terminal. This would meat that you cannot
use :mappings of more than one character, unless you also :set notimeout.
|'timeout'|
To circumvent this problem, I added a workaround to provide the necessary
input with timeout by using an extra thread which reads ahead one character.
As a side effect, it also makes Vim recognize when the Terminal window
resizes.
Function keys are not supported in the Terminal since they produce very
indistinctive character sequences.
These problems do not exist in the GUI.
[1]: there is no select() on file descriptors; also the termios VMIN and VTIME
settings do not seem to work properly. This has been the case since DR7 at
least and still has not been fixed as of PR2.
*beos-unicode*
4. Unicode vs. Latin1 *beos-utf8*
BeOS uses Unicode and UTF-8 for text strings (16-bit characters encoded to
8-bit characters). Vim assumes ISO-Latin1 or other 8-bit character codes.
This does not produce the desired results for non-ASCII characters. Try the
command :digraphs to see. If they look messed up, use :set isprint=@ to
(slightly) improve the display of ISO-Latin1 characters 128-255. This works
better in the GUI, depending on which font you use (below).
You may also use the /boot/bin/xtou command to convert UTF-8 files from (xtou
-f iso1 filename) or to (xtou -t iso1 filename) ISO-Latin1 characters.
5. The BeOS GUI *beos-gui*
Normally Vim starts with the GUI if you start it as gvim or vim -g. The BeOS
version tries to determine if it was started from the Tracker instead of the
Terminal, and if so, use the GUI anyway. However, the current detection scheme
is fooled if you use the command "vim - </dev/null" or "vim filename &". The
latter can be called a feature but probably only works because there is no
BSD-style job control.
Stuff that does not work yet:
- Running external commands from the GUI does not work 100% (again due to lack
of support for select()). There was a choice between seeing the command's
output, or being able to interrupt it. I chose for seeing the output. Even
now the command sometimes crashes mysteriously, apparently in Be's
malloc_internal() called from the putenv() function, after fork()ing. (data
access exception occurred, ec01b0ec: 90e80000 *stw r7, 0x0000 (r8))(:!ls
works usually, :r !ls usually doesn't). This has been reported as bug
# 971215-083826.
- The window title.
- Starting the GUI from the Terminal version with :gui always acts as if
:gui -f were used. There is no way to fix this that I can see.
- There are some small display glitches here and there that I hope to clean up
later. Most of them occur when the window is partially obscured. Some of
them seem to be bugs in BeOS, because the Terminal has similar glitches.
- Mouse up events are not generated when outside the window. This is a bug in
BeOS. You can notice this when selecting text and moving the cursor outside
the window, then letting go of the mouse button. Another way is when you
drag the scrollbar and do the same thing. Because Vim still thinks you are
still playing with the scrollbar it won't change it itself. I provided a
workaround which kicks in when the window is activated or deactivated (so it
works best with focus- follows-mouse (/boot/bin/ffm) turned on).
- The cursor does not flash (very low priority; I'm not sure I even like it
when it flashes)
The $VIM directory *beos-vimdir*
$VIM is the symbolic name for the place where Vims support files are stored.
The default value for $VIM is set at compile time and can be determined with >
:version
The normal value is /boot/home/config/share/vim. If you don't like it you can
set the VIM environment variable to override this, or set 'helpfile' in your
.vimrc: >
:if version >= 500
: set helpfile=~/vim/vim54/doc/help.txt
: syntax on
:endif
7. Drag & Drop *beos-dragndrop*
You can drop files and directories on either the Vim icon (starts a new Vim
session, unless you use the File Types application to set Vim to be "Single
Launch") or on the Vim window (starts editing the files). Dropping a folder
sets Vim's current working directory. |:cd| |:pwd| If you drop files or
folders with either SHIFT key pressed, Vim changes directory to the folder
that contains the first item dropped. When starting Vim, there is no need to
press shift: Vim behaves as if you do.
Files dropped set the current argument list. |argument-list|
8. Single Launch vs. Multiple Launch *beos-launch*
As distributed Vim's Application Flags (as seen in the FileTypes preference)
are set to Multiple Launch. If you prefer, you can set them to Single Launch
instead. Attempts to start a second copy of Vim will cause the first Vim to
open the files instead. This works from the Tracker but also from the command
line. In the latter case, non-file (option) arguments are not supported.
NB: Only the GUI version has a BApplication (and hence Application Flags).
This section does not apply to the GUI-less version, should you compile one.
9. Fonts *beos-fonts*
Set fonts with >
:set guifont=Courier10_BT/Roman/10
where the first part is the font family, the second part the style, and the
third part the size. You can use underscores instead of spaces in family and
style.
Best results are obtained with monospaced fonts (such as Courier). Vim
attempts to use all fonts in B_FIXED_SPACING mode but apparently this does not
work for proportional fonts (despite what the BeBook says).
Vim also tries to use the B_ISO8859_1 encoding, also known as ISO Latin 1.
This also does not work for all fonts. It does work for Courier, but not for
ProFontISOLatin1/Regular (strangely enough). You can verify this by giving the >
:digraphs
command, which lists a bunch of characters with their ISO Latin 1 encoding.
If, for instance, there are "box" characters among them, or the last character
isn't a dotted-y, then for this font the encoding does not work.
If the font you specify is unavailable, you get the system fixed font.
Standard fixed-width system fonts are:
ProFontISOLatin1/Regular
Courier10_BT/Roman
Courier10_BT/Italic
Courier10_BT/Bold
Courier10_BT/Bold_Italic
Standard proportional system fonts are:
Swis721_BT/Roman
Swis721_BT/Italic
Swis721_BT/Bold
Swis721_BT/Bold_Italic
Dutch801_Rm_BT/Roman
Dutch801_Rm_BT/Italic
Dutch801_Rm_BT/Bold
Dutch801_Rm_BT/Bold_Italic
Baskerville/Roman
Baskerville/Italic
Baskerville/Bold
Baskerville/Bold_Italic
SymbolProp_BT/Regular
Try some of them, just for fun.
10. The meta key modifier *beos-meta*
The META key modifier is obtained by the left or right OPTION keys. This is
because the ALT (aka COMMAND) keys are not passed to applications.
11. Mouse key mappings *beos-mouse*
Vim calls the various mouse buttons LeftMouse, MiddleMouse and RightMouse. If
you use the default Mouse preference settings these names indeed correspond to
reality. Vim uses this mapping:
Button 1 -> LeftMouse,
Button 2 -> RightMouse,
Button 3 -> MiddleMouse.
If your mouse has fewer than 3 buttons you can provide your own mapping from
mouse clicks with modifier(s) to other mouse buttons. See the file
vim-5.x/macros/swapmous.vim for an example. |gui-mouse-mapping|
12. Color names *beos-colors*
Vim has a number of color names built-in. Additional names are read from the
file $VIMRUNTIME/rgb.txt, if present. This file is basically the color
database from X. Names used from this file are cached for efficiency.
13. Compiling with Perl *beos-perl*
Compiling with Perl support enabled is slightly tricky. The Metrowerks
compiler has some strange ideas where to search for include files. Since
several include files with Perl have the same names as some Vim header
files, the wrong ones get included. To fix this, run the following Perl
script while in the vim-5.0/src directory: >
preproc.pl > perl.h
#!/bin/env perl
# Simple #include expander, just good enough for the Perl header files.
use strict;
use IO::File;
use Config;
sub doinclude
{
my $filename = $_[0];
my $fh = new IO::File($filename, "r");
if (defined $fh) {
print "/* Start of $filename */\n";
while (<$fh>) {
if (/^#include "(.*)"/) {
doinclude($1);
print "/* Back in $filename */\n";
} else {
print $_;
}
}
print "/* End of $filename */\n";
undef $fh;
} else {
print "/* Cannot open $filename */\n";
print "#include \"$filename\"\n";
}
}
chdir $Config{installarchlib}."/CORE";
doinclude "perl.h";
It expands the "perl.h" header file, using only other Perl header files.
Now you can configure & make Vim with the --enable-perlinterp option.
Be warned though that this adds about 616 kilobytes to the size of Vim!
Without Perl, Vim with default features and GUI is about 575K, with Perl
it is about 1191K.
-Olaf Seibert
[Note: these addresses no longer work:]
<rhialto@polder.ubc.kun.nl>
http://polder.ubc.kun.nl/~rhialto/be
vim:tw=78:ts=8:ft=help:norl:

Some files were not shown because too many files have changed in this diff Show More