more information, read :help 'showmode' 19.11. How do I configure Vim to show pending/partial commands on the status line? You can set the 'showcmd' option to display pending/partial commands in the status line: :set showcmd For more information, read :help 'showcmd' 19.12. How do I configure the Vim status line to display different settings/values? You can set the 'statusline' option to display different values/settings in the Vim status line. For more information, read :help 'statusline' :help 'laststatus' :help 'rulerformat' :help 'ruler' 19.13. How do I configure Vim to display status line always? You can set the 'laststatus' option to 2 to display the status line always. :set laststatus=2 For more information, read :help 'laststatus' 19.14. How do I make a Vim setting persistent across different Vim invocations/instances/sessions? To make a Vim option setting persistent across different Vim instances, add your setting to the .vimrc or .gvimrc file. You can also use the ":mkvimrc" command to generate a vimrc file for the current settings. For more information, read :help save-settings :help vimrc :help gvimrc :help vimrc-intro :help :mkvimrc :help initialization 19.15. Why do I hear a beep (why does my window flash) about 1 second after I hit the Escape key? This is normal behavior. If your window flashes, then you've got the visual bell on. Otherwise, you should hear a beep. Vim needs a timeout to tell the difference between a simple escape and, say, a cursor key sequence. When you press a key in normal mode (and even in insert mode) and that key is the beginning of a mapping, Vim waits a certain amount of time to see if the rest of the mapping sequence follows. If the mapping sequence is completed before a given timeout period, the mapping for that sequence of keys is applied. If you interrupt the mapping, the normal actions associated with the keys are executed. For example, if you have a mapping defined as ":imap vvv Vim is great!!" and you type "vvv" quickly, the "Vim is great!!" will be inserted into your text. But if you type "vv v" then that is what will put into your text. This is also true if you type "vvv" too slowly where "too slowly" is longer than the value for the timeout option. Setting the timeout option to a larger value can help alleviate problems that appear when using function keys over a slow line. For more information, read :help ttimeout 19.16. How do I make the 'c' and 's' commands display a '$' instead of deleting the characters I'm changing? To make the 'c' and 's' commands display a '$' instead of deleting the characters, add the $ flag to the 'cpoptions' option: :set cpoptions+=$ For more information, read :help 'cpoptions' 19.17. How do I remove more than one flag using a single ":set" command from a Vim option? You can remove more than one flag from a Vim option using a single ":set" command, by specifying the flags in exactly the same order as they appear in the option. For example, if you use the following command to remove the 't' and 'n' flags from the 'formatoptions' option: :set formatoptions-=tn The 't' and 'n' flags will be removed from the 'formatoptions' option, only if the 'formatoptions' option contains these flags in this order: 'tn'. Otherwise, it will not remove the flags. To avoid this problem, you can remove the flags one by one: :set formatoptions-=t formatoptions-=n For more information, read :help :set-= ============================================================================= SECTION 20 - MAPPING KEYS 20.1. How do I know what a key is mapped to? To see what a key is mapped to, use the following commands: :map <key> :map! <key> You can also check the mappings in a particular mode using one of the ":cmap", ":nmap", ":vmap", ":imap", ":omap", etc commands. For more information, read :help map-listing :help map-overview 20.2. How do list all the user-defined key mappings? You can list all the user-defined key mappings using: :map For more information, read :help map-listing 20.3. How do I unmap a previously mapped key? You can unmap a previously mapped key using the ":unmap" command: :unmap <key> :unmap! <key> For mode specific mappings, you can use one of the ":nunmap/:vunmap/:ounmap/:iunmap/:lunmap/:cunmap" commands. The following command will fail to unmap a buffer-local mapped key: :unmap <key> To unmap a buffer-local mapped key, you have to use the <buffer> keyword in the unmap command: :unmap <buffer> <key> :unmap! <buffer> <key> For more information, read :help :unmap :help map-modes :help map-local :help 'mapleader' 20.4. I am not able to create a mapping for the <xxx> key. What is wrong? First make sure that the key is passed to Vim. In insert mode, press CTRL-V followed by the desired key. You should see the keycode corresponding to the key . If you do see the keycode, then you can create a mapping for the key using the following command: :map <C-V><xxx> <your_command_to_be_mapped> For more information, read :help map-keys-fails :help :map-special-keys :help key-codes 20.5. How do I map the numeric keypad keys? First make sure that the numeric keypad keys are passed to Vim. Next, you can use the following command to map the numeric keypad keys: :map <kSomething> <your_command> where, <kSomething> can be kHome, kEnd, kPageUp, kPageDown, kPlus, kMinus, kDivide, kMultiply, kEnter, etc. For more information, read :help key-codes :help terminal-options 20.6. How do I create a mapping that works only in visual mode? You can create mappings that work only in specific mode (normal, command, insert, visual, etc). To create a mapping that works only in the visual mode, use the ":vmap" command: :vmap <F3> <your mapping here> For more information, read :help :vmap :help map-modes :help 40.1 20.7. In a Vim script, how do I know which keys to use for my mappings, so that the mapped key will not collide with an already used key? Vim uses most of the keys in the keyboard. You can use the <leader> prefix in maps to define keys which will not overlap with Vim keys. For example: :map <leader>S <C-W>s :map <leader>j <C-W>j :map <leader>k <C-W>k where by default <leader> gets substituted with a backslash (\), so the user would enter \s \j \k to invoke the above map commands. The user can change the mapleader variable to be whatever they wanted: :let mapleader = "," When writing a plugin or other script, more often than not, it is advisable to use :noremap instead of :map to avoid side effects from user defined mappings. For more information, read :help <Leader> :help <LocalLeader> :help write-plugin 20.8. How do I map the escape key? You can map the Escape key to some other key using the ":map" command. For example, the following command maps the escape key to CTRL-O. :map <C-O> <Esc> 20.9. How do I map a key to perform nothing? You can map a key to <Nop> to perform nothing when the key is pressed. For example, with the following mappings, the <F7> key will do nothing when pressed. :map <F7> <Nop> :map! <F7> <Nop> For more information, read :help <Nop> :help :map :help :map! :help map-modes 20.10. I want to use the Tab key to indent a block of text and Shift-Tab key to unindent a block of text. How do I map the keys to do this? This behavior is similar to textpad, visual studio, etc. Use the following mapping: :inoremap <S-Tab> <C-O><LT><LT> :nnoremap <Tab> >> :nnoremap <S-Tab> <LT><LT> :vnoremap <Tab> > :vnoremap <S-Tab> <LT> Note that, the <S-Tab> mapping will work only if Vim receives the correct key sequence. This is mostly the case with GUI Vim. For more information, read :help :inoremap :help :nnoremap :help :vnoremap :help <S-Tab> :help i_CTRL-O :help >> :help << :help <LT> 20.11. In my mappings the special characters like <CR> are not recognized. How can I configure Vim to recognize special characters? Check the value of the 'cpoptions' option: :set cpoptions? If this option contains the '<' flag, then special characters will not be recognized in mappings. Remove the '<' flag from 'cpoptions' option: :set cpo-=< Also, check the value of the 'compatible' option: :se compatible? The 'compatible' option must be reset: :se nocompatible For more information, read :help 'cpoptions' :help 'compatible' 20.12. How do I use the '|' to separate multiple commands in a map? You can escape the '|' character using backslash (\) to use '|' in a map. :map _l :!ls \| more<CR> You can also try the following command: :map _l :!ls <bar> more<CR> There are also other ways to do this. For more information, read :help map_bar 20.13. If I have a mapping/abbreviation whose ending is the beginning of another mapping/abbreviation, how do I keep the first from expanding into the second one? Instead of using the ":map lhs rhs" command, use the ":noremap lhs rhs" command. For abbreviations, use "noreabbrev lhs rhs". The "nore" prefix prevents the mapping or abbreviation from being expanded again. For more information, read :help :noremap :help :noreabbrev 20.14. Why does it take a second or more for Vim to process a key, sometimes when I press a key? Make sure you have not defined a mapping for this key using the following command: :map <key> If a mapping is defined for this key and the mapped key contains more than one character, then Vim will wait for the next character to be pressed to determine whether it is the mapped key or not. For example, if you have mapped "ab", then if you press "a", Vim will wait for the next key to be pressed. If the next key is "b", Vim will execute the mapped sequence. Otherwise, Vim will proceed with the normal processing of "a" followed by the next key. If the 'timeout' option is set (which is the default), then Vim will timeout after waiting for the period specified with the 'timeoutlen' option (default is 1 second). For more information, read :help map-typing :help 'timeoutlen' :help 'ttimeoutlen' :help 'timeout' :help 'ttimeout' :help vt100-cursor-keys :help slow-fast-terminal 20.15. How do I map a key to run an external command using a visually selected text? You can the ":vmap" command to map a key in the visual mode. In the mapped command sequence, you have to first yank the text. The yanked text is available in the '"' register. Now, you can use the contents of this register to run the external command. For example, to run the external command "perldoc" on a visually selected text, you can use the following mapping: :vmap <F7> y:!exec "!perldoc '" . @" . "'"<CR> If you want the mapping to work in the visual mode, but not with the highlighted text, you can use the following command: :vmap <F7> :<C-U>!perldoc <cword><CR> The above mapping will use the word under the cursor instead of the highlighted text. Note the use of the <C-U> before invoking the "perldoc" external command. The <C-U> is used to erase the range of text selected in the visual mode and displayed on the command line. If the visual range is not removed using <C-U>, then the output from the external command will replace the visually selected text. For more information, read :help :vmap :help quote_quote :help let-register :help c_CTRL-U :help :!cmd 20.16. How do I map the Ctrl-I key while still retaining the functionality of the <Tab> key? The Ctrl-I key and the <Tab> key produce the same keycode, so Vim cannot distinguish between the Ctrl-I and the <Tab> key. When you map the Ctrl-I key, the <Tab> key is also mapped (and vice versa). The same restriction applies for the Ctrl-[ key and the <Esc> key. For more information, read :help keycodes ============================================================================= SECTION 21 - ABBREVIATIONS 21.1. How do I auto correct misspelled words? You can auto correct misspelled words using abbreviations. For example, the following abbreviation can be used to correct "teh" with "the": :abbreviate teh the Vim supports abbreviations in insert mode, replace mode and command-line mode. For more information, read :help 24.7 :help abbreviations :help Q_ab 21.2. How do I create multi-line abbreviations? You can create multi-line abbreviations by embedding the "<CR>" key code in the text: iabbrev #c --------------<CR>-- Date:<CR>--<CR>--------- With the above abbreviation, when you type #c, it will be expanded to the following text: -------------- -- Date: -- --------- For more information, read :help abbreviations 21.3. When my abbreviations are expanded, an additional space character is added at the end of the expanded text. How do I avoid this character? To avoid an additional space character at the end of the expanded text, you can expand the abbreviation by pressing the CTRL-] key. The abbreviation will be expanded without adding a space character at the end. Another alternative is to use the following function and command: function! Eatchar(pat) let c = nr2char(getchar()) return (c =~ a:pat) ? '' : c endfunction command! -nargs=+ Iabbr execute "iabbr" <q-args> . "<C-R>=Eatchar('\\s')<CR>" Now, define your abbreviations using the new "Iabbr" command instead of the builtin "iabbrev" command. With this command, after expanding the abbreviated text, the next typed space character will be discarded. For more information, read :help abbreviations 21.4. How do I insert the current date/time stamp into the file? You can use the strftime() function to insert the current data/time stamp in a file. For example, you can use the following abbreviation: iabbrev dts <C-R>=strftime("%y/%m/%d %H:%M")<CR> With this abbreviation, when you type dts in insert mode, it will be expanded to the date/time stamp. Some other forms of the above abbreviation are listed below: iabbrev mdyl <C-R>=strftime("%a %d %b %Y")<CR> iabbrev mdys <C-R>=strftime("%y%m%d")<CR> iabbrev mdyc <C-R>=strftime("%c")<CR> iabbrev hml <C-R>=strftime("%d/%m/%y %H:%M:%S")<CR> iabbrev hms <C-R>=strftime("%H:%M:%S")<CR> For more information, read :help strftime() :help i_CTRL-R 21.5. How do I prevent an abbreviation from expanding in insert mode? You can prevent an abbreviation from expanding in insert mode by typing CTRL-V before the character after the abrreviated word. For more information, read :help abbreviations ============================================================================= SECTION 22 - RECORD AND PLAYBACK 22.1. How do I repeat an editing operation (insertion, deletion, paste, etc)? You can repeat the last editing operation using the '.' command. This will repeat the last simple change like a insert, delete, change, paste, etc. For more information, read :help 04.3 :help single-repeat :help Q_re 22.2. How I record and repeat a set of key sequences? You can use the 'q' command in normal mode to record a set of key sequences and store it in a register. For example, in the normal mode you can press q followed by a register name {0-9a-bA-Z"} to start the recording. To end/stop the recording press q again. You can playback/repeat the recorded key sequences by pressing @ followed by the register name. e.g. @a. Another approach is to start Vim with the "-w" command-line argument. $ vim -w <file_name> Vim will record all the characters typed in the session in the specified file "file_name". You can use the recorded file with the "-s" command line argument to play it back: $ vim -s <file_name> For more information, read :help 10.1 :help recording :help -w :help -s 22.3. How do I edit/modify a recorded set of key sequences? The recorded key sequences are stored in a register. You can paste the contents of the register into a Vim buffer, edit the pasted text and again yank the text into the register. You can also use the ":let" command to modify the register. For example: :let @a = "iHello World\<Esc>" For more information, read :help recording :help 10.1 :help let-register :help <> :help 'cpoptions' 22.4. How do I write recorded key sequences to a file? The recorded key sequences are stored in a register. You can paste the contents of the register into a Vim buffer. Now you can save the buffer into a file. You can also modify the pasted text and again yank into the register to modify the recorded key sequence. For example, if you record a set of key sequences using qa ..... q. The recorded key sequences are stored in the register 'a'. You can paste the contents of register 'a' using "ap. For more information, read :help recording :help 10.1 22.5. I am using register 0 to record my key sequences (i.e. q0 .... q). In the recorded key sequences, I am yanking some text. After the first replay of the recorded key sequence, I am no longer able to play it back. Register 0 contains the text from the last yank operation. In your recorded key sequence, when the yank is performed, register 0 is overwritten with the yanked text. So your recording stored in register 0 is lost. You have to use some other register. For more information, read :help registers ============================================================================= SECTION 23 - AUTOCOMMANDS 23.1. How do I execute a command when I try to modify a read-only file? You can use the FileChangedRO autocommand event to execute a command when a read-only file modified. For example, you can use this event to checkout a read-only file: :autocmd FileChangedRO * call MyCheckoutFunction() For more information, read :help FileChangedRO 23.2. How do I execute a command every time when entering a buffer? You can use the BufEnter autocommand event to execute a command every time when entering a buffer. For example: :autocmd BufEnter *.c set formatoptions=croqt For more information, read :help BufEnter 23.3. How do I execute a command every time when entering a window? You can use the WinEnter autocommand event to execute a command every time when entering a window. For example: :autocmd WinEnter *.c call MyFunction() For more information, read :help WinEnter 23.4. From an autocmd, how can I determine the name of the file or the buffer number for which the autocommand is executed? You can use the special words <afile> or <abuf> in an autocmd to get the name of the file or the buffer number for which the autocommand is executed. For more information, read :help :<afile> :help :<abuf> :help :<amatch> 23.5. How do I automatically save all the changed buffers whenever Vim loses focus? You can define an autocommand for the FocusLost event which will save all the modified buffers whenever Vim loses focus: :autocmd FocusLost * wall For more information, read :help FocusLost :help :wall 23.6. How do I execute/run a function when Vim exits to do some cleanup? You can use VimLeave autocmd event to execute a function just before Vim exists. For example, :autocmd VimLeave * call MyCleanupFunction() For more information, read :help VimLeave ============================================================================= SECTION 24 - SYNTAX HIGHLIGHT 24.1. How do I turn off/on syntax highlighting? By default, the Vim syntax highlighting is turned off. To enable the syntax highlighting, you can use one of the following commands: :syntax enable or :syntax on To disable the syntax highlighting, you can use the following command: :syntax off For more information, read :help 06.1 :help 06.4 :help :syntax-enable :help :syntax-on :help :syn-clear 24.2. How do I change the background and foreground colors used by Vim? Vim uses the "Normal" highlight group for the background and foreground colors. To change the foreground/background colors, you have to modify the "Normal" highlight group. For example, to set the background color to blue and foreground color to white, you can use :highlight Normal ctermbg=blue ctermfg=white guibg=blue guifg=white If you are using the Motif or the Athena version of the GUI Vim, then you can modify the foreground and background resource names in the .Xdefaults files to change the colors: Vim.foreground: Black Vim.backround: Wheat You can also use the "-foreground" and "-background" command-line arguments to specify the foreground and background colors. These arguments are supported only in the Motif or Athena versions: $ gvim -foreground Black -background Wheat For more information, read :help :highlight :help .Xdefaults :help -gui 24.3. How do I change the highlight colors to suit a dark/light background? You can set the 'background' option to either 'dark' or 'light' to change the highlight colors to suit a dark/light background: :set background=dark For more information, read :help 'background' :help 6.2 24.4. How do I change the color of the line numbers displayed when the ":set number" command is used? The line numbers displayed use the LineNr highlighting group. To display the current colors used, use :hi LineNr To change the color modify the LineNr highlight group. For example: :hi linenr guifg=red guibg=black This will give red numbers on a black background in GVIM. For more information, read :help :highlight 24.5. How do I change the background color used for a Visually selected block? You can modify the 'Visual' highlight group to change the color used for a visually selected block: :highlight Visual guibg=red For more information, read :help :highlight :help hl-Visual 24.6. How do I highlight the special characters (tabs, trailing spaces, end of line, etc) displayed by the 'list' option? You can modify the "NonText" and "SpecialKey" highlight groups to highlight the special characters displayed by the 'list' option: :highlight NonText guibg=red :highlight SpecialKey guibg=green The "NonText" highlighting group is used for "eol", "extends" and "precedes" settings in the "listchars" option. The "SpecialKey" highlighting group is used for the "tab" and "trail" settings. For more information, read :help 'listchars' :help hl-NonText :help hl-SpecialKey 24.7. How do I specify a colorscheme in my .vimrc/.gvimrc file, so that Vim uses the specified colorscheme everytime? You can specify the color scheme using the ":colorscheme" command in your .vimrc or .gvimrc file: colorschme evening For more information, read :help :colorscheme 24.8. Vim syntax highlighting is broken. When I am editing a file, some parts of the file is not syntax highlighted or syntax highlighted incorrectly. Vim doesn't read the whole file to parse the text for syntax highlighting. It starts parsing wherever you are viewing the file. That saves a lot of time, but sometimes the colors are wrong. A simple fix is refreshing the screen using the CTRL-L key. Or scroll back a bit and then forward again. You can also use the command: :syntax sync fromstart Note that this might considerably slow down the screen refreshing. For more information, read :help :syn-sync :help :syn-sync-first 24.9. Is there a built-in function to syntax-highlight the corresponding matching bracket? No. Vim doesn't support syntax-highlighting matching brackets. You can try using the plugin developed by Charles Campbell: http://vim.sourceforge.net/tips/tip.php?tip_id=177 You can jump to a matching bracket using the '%' key. You can set the 'showmatch' option to temporarily jump to a matching bracket when in insert mode. For more information, read :help % :help 'showmatch' :help 'matchtime' :help 'matchpairs' 24.10. How do I turn off the C comment syntax highlighting? You can use the following command to turn off C comment syntax highlighting: :highlight clear comment For more information, read :help c-syntax 24.11. How do I add my own syntax extensions to the standard syntax files supplied with Vim? You should not modify the syntax files supplied with Vim to add your extensions. When you install the next version of Vim, you will lose your changes. Instead you should create a file under the ~/.vim/after/syntax directory with the same name as the original syntax file and add your additions to this file. For more information, read :help mysyntaxfile-add :help 'runtimepath' 24.12. How do I replace a standard syntax file that comes with the Vim distribution with my own syntax file? You can replace a standary syntax file that comes with the Vim distribution by creating a file with the same name as the original syntax file and placing it in the vim runtime syntax (~/.vim/syntax) directory. For example, to replace the c.vim syntax file in a Unix system, place the new c.vim in the ~/.vim/syntax directory. In a MS-Windows system, place the new syntax file in the $HOME/vimfiles/syntax or $VIM/vimfiles/syntax directory. For more information, read :help mysyntaxfile-replace :help 44.11 :help mysyntaxfile 24.13. How do I highlight all the characters after a particular column? You can use the ":match" command to highlight all the characters after a particular column: :match Todo '\%>75v.\+' This will highlight all the characters after the 75th column. For more information, read :help :match :help /\%v :help /\+ :help /. 24.14. How do I convert a source file (.c, .h, etc) with the Vim syntax highlighting into a HTML file? You can use the 2html.vim script to convert a source file into a HTML file with the Vim syntax highlighting. Use the following command: :runtime! syntax/2html.vim For more information, read :help convert-to-HTML 24.15. How do I list the definition of all the current highlight groups? You can list the definition of all the current highlight groups using the ":highlight" (without any arguments) ex command. For more information, read :help :highlight ============================================================================= SECTION 25 - VIM SCRIPT WRITING 25.1. How do I list the names of all the scripts sourced by Vim? You can use the ":scriptnames" command to list the names of all the scripts sourced by Vim: :scriptnames For more information, read :help :scriptnames 25.2. How do I debug Vim scripts? Vim has built-in support for a primitive debugger to debug Vim plugins and scripts. Using this debugger you can set breakpoints and step through the plugin functions. For more information, read :help debug-scripts :help -D 25.3. How do I locate the script/plugin which sets a Vim option? You can use the ":verbose" command to locate the plugin/script which last modified a Vim option. For example: :verbose set textwidth? For more information, read :help :set-verbose :help :verbose 25.4. I am getting some error/informational messages from Vim (possibly when running a script), the messages are cleared immediately. How do I display the messages again? You can use the ":messages" command to display the previous messages. :messages For more information, read :help :messages :help :echoerr :help :echomsg :help message-history 25.5. How do I save and restore a plugin specific information across Vim invocations? Vim will save and restore global variables that start with an uppercase letter and don't contain a lower case letter. For this to work, the 'viminfo' option must contain the '!' flag. Vim will store the variables in the viminfo file. For more information, read :help 'viminfo' :help viminfo-file :help variables 25.6. How do I start insert mode from a Vim function? You can use the ":startinsert" command to start the insert mode from inside a Vim function. For more information, read :help :startinsert 25.7. How do I change the cursor position from within a Vim function? You can use the cursor() function to position the cursor. call cursor(lnum, col) You can also use the following command to change the cursor position: exe "normal! " . lnum . "G" . col . "|" For more information, read :help cursor() :help bar 25.8. How do I check the value of an environment variable in the .vimrc file? You can use prefix the environment variable name with the '$' character to use it from a Vim script/function. You can refer to the value of an environment variable using the $env_var syntax: if $EDITOR == 'vi' endif For more information, read :help expr-env 25.9. How do I check whether an environment variable is set or not from a Vim function? You can use the exists() function to check for the existence of a environment variable. if exists("$MY_ENV_VAR") endif For more information, read :help exists() :help expr-env 25.10. How do I call/use the Vim built-in functions? You can use the ":call" command to invoke a Vim built-in function: :call cursor(10,20) You can use the ":echo" command to echo the value returned by a function: :echo char2nr('a') You can use the ":let" command to assign the value returned by a function to a variable: :let a = getline('.') To store the return value from a function into a Vim register, you can use the following command: :let @a = system('ls') The above command will store the return value from the 'ls' command into the register 'a'. For more information, read :help :call :help :echo :help :let :help :let-register :help user-functions :help usr_41.txt 25.11. I am using some normal mode commands in my Vim script. How do I avoid using the user-defined mappings for these normal mode commands and use the standard Vim functionality for these normal mode commands? You can use the "normal!" command in your script to invoke a normal-mode command. This will use the standard functionality of the normal mode command and will not use the user-defined mapping. For more information, read :help :normal 25.12. How do I get the current visually selected text into a Vim variable or register? You can get the current visually selected text into a Vim variable by yanking the text into Vim register and then assigning the contents of the register into the variable: :normal! gvy :let myvar = @" The above command copies the visually selected text into the variable "myvar". You can also use the command: :normal! gv"*y In the above command, gv reselects the last visually selected text and the rest of the command copies the selected text into the * (clipboard) register. Alternatively, you can set the 'a' flag in the 'guioptions' option to automatically copy a visually selected text into the * register. To do this as part of a visual map, you can use a command similar to the one shown below: :vmap <F3> "*y:call ... For more information, read :help gv :help :normal :help let-@ :help quotestar :help clipboard :help registers 25.13. I have some text in a Vim variable 'myvar'. I would like to use this variable in a ":s" substitute command to replace a text 'mytext'. How do I do this? You can use the 'execute' command to evaluate the variable: :execute '%s/mytext/' . myvar . '/' For more information, read :help :execute You can also use "\=" in the substitute command to evaluate the variable: :%s/mytext/\=myvar/ For more information, read :help sub-replace-special 25.14. A Vim variable (bno) contains a buffer number. How do I use this variable to open the corresponding buffer? The :buffer command will not accept a variable name. It accepts only a buffer number or buffer name. You have to use the ":execute" command to evaluate the variable into the corresponding value. For example: :execute "buffer " . bno For more information, read :help :execute 25.15. How do I store the value of a Vim option into a Vim variable? You can prefix the option name with the '&' character and assign the option value to a Vim variable using the "let" command. For example, to store the value of the 'textwidth' option into the Vim variable "old_tw", you can use the following command: :let old_tw = &tw To do the opposite, to set the 'textwidth' option with the value stored in the 'old_tw' variable, you can use the following command: :let &tw = old_tw For more information, read :help expr-option :help let-option 25.16. I have copied and inserted some text into a buffer from a Vim function. How do I indent the inserted text from the Vim function? You can use the following command to format the just inserted text: :normal '[='] For more information, read :help '[ :help '] :help = :help :normal 25.17. How do I get the character under the cursor from a Vim script? You can use the getline() function and use string index [] to get the character: :echo getline(".")[col(".") - 1] In the above command, getline(".") returns the text in the current line. The indexing of the string starts at zero, and you can get a single character in a string by its index with the "string[index]" notation. The col(".") returns the column of the cursor position; the adjustment is to get the right character of the string. Alternatively, you can use the following sequence of commands to get the character under the cursor: normal! vy let ch=@" Note that the above commands will change the '< and '> marks. For more information, read :help getline() :help col() :help expr-[] 25.18. How do I get the name of the current file without the extension? You can get the name of the current file without the extension using: :echo expand("%:r") With some commands, you can use the file name modifiers directly: :cd %:p:h :!gcc -o %:r.o % For more information, read :help filename-modifiers :help expand() :help cmdline-special :help fnamemodify() 25.19. How do I get the basename of the current file? You can use the :t filename modifier to get the basename of the current file: :echo expand("%:t") For more information, read :help filename-modifiers 25.20. How do I get the output from a Vim function into the current buffer? You can insert the return value from a function using the following command in insert mode: <C-R>=MyFunc() Note that this will only insert the return value of the function. For more information, read :help i_CTRL-R :help i_CTRL-R_CTRL-R :help i_CTRL-R_CTRL-O :help expression 25.21. How do I call external programs from a Vim function? There are several ways to call external programs from a Vim function. You can use the builtin system() function to invoke external programs and get the result: :let output = system("ls") You can also use "!" ex-command to run an external command. For more information, read :help system() :help :! :help 10.9 25.22. How do I get the return status of a program executed using the ":!" command? You can use the predefined Vim v:shell_error variable to get the return status of the last run shell command. For more information, read :help v:shell_error 25.23. How do I determine whether the current buffer is modified or not? You can check the value of the 'modified' option to determine whether the current buffer is modified: :set modified? From a Vim script, you can check the value of the 'modified' option: if &modified echo "File is modified" endif For more information, read :help 'modified' 25.24. I would like to use the carriage return character in a normal command from a Vim script. How do I specify the carriage return character? You can use the ":execute" command to specify the special (control) character in a normal mode command: :execute "normal \<CR>" :execute "normal ixxx\<Esc>" For more information, read :help :execute :help expr-quote 25.25. How do I split long lines in a Vim script? You can split long lines in a Vim script by inserting the backslash character ("\") at the start of the next line. For example, For more information, read :help line-continuation 25.26. When I try to "execute" my function using the "execute 'echo Myfunc()'" command, the cursor is moved to the top of the current buffer. Why? The ":execute" command runs the normal mode command specified by the argument. In the case of the following command: :execute "echo Myfunc()" The call to "echo Myfunc()" will return 0. The ":execute" command will run the normal mode command "0", which moves the cursor to the top of the file. To call a Vim function, you should use the ":call" command instead of the ":execute" command: :call Myfunc() For more information, read :help :call :help :execute :help :echo :help user-functions :help 41.5 :help 41.6 25.27. How do I source/execute the contents of a register? If you have yanked a set of Vim commands into a Vim register (for example register 'a'), then you can source the contents of the register using one of the following commands: :@a or :exe @a For more information, read :help :@ 25.28. After calling a Vim function or a mapping, when I press the 'u' key to undo the last change, Vim undoes all the changes made by the mapping/function. Why? When you call a function or a mapping, all the operations performed by the function/mapping are treated as one single operation. When you undo the last operation by pressing 'u', all the changes made by the function/mapping are reversed. For more information, read :help undo-redo :help map-undo 25.29. How can I call a function defined with s: (script local function) from another script/plugin? The s: prefix for a Vim function name is used to create a script local function. A script local function can be called only from within that script and cannot be called from other scripts. To define a function in a script/plugin, so that it can be called from other plugins/scripts, define the function without the s: prefix. For more information, read :help script-variable :help script-local :help :scriptnames 25.30. Is it possible to un-source a sourced script? In otherwords, reverse all the commands executed by sourcing a script. No. It is not possible to reverse or undo all the commands executed by sourcing a script. For more information, read :help :source ============================================================================= SECTION 26 - PLUGINS 26.1. How do I set different options for different types of files? You can create filetype plugins to set different options for different types of files. You should first enable filetype plugins using the command: :filetype plugin on A filetype plugin is a vim script that is loaded whenever Vim opens or creates a file of that type. For example, to ensure that the 'textwidth' option is set to 80 when editing a C program (filetype 'c'), create one of the following files: ~/.vim/ftplugin/c.vim (Unix) %HOME%\vimfiles\ftplugin\c.vim (Windows) with the following text in it: setlocal textwidth=80 You can also use autocommands to set specific options when editing specific type of files. For example, to set the 'textwidth' option to 75 for only *.txt files, you can use the following autocmd: autocmd BufRead *.txt setlocal textwidth=80 For more information, read :help filetype-plugin :help add-filetype-plugin :help autocmd :help 40.3 26.2. I have downloaded a Vim plugin or a syntax file or a indent file, or a color scheme or a filetype plugin from the web. Where should I copy these files so that Vim will find them? You can place the Vim runtime files (plugins, syntax files, indent files, color schemes, filetype plugins, etc) under one of the directories specified in the 'runtimepath' option. To determine the current value of the 'runtimepath' option, use the following command: :set runtimepath For Unix systems, this is usally the "$HOME/.vim" directory. For MS-Windows systems, this is usually the $VIM\vimfiles or $HOME\vimfiles directory. Depending on the type of the runtime file, you have to place it under a specific directory under the above runtime directory. The names of the directories are listed below: colors/ - color scheme files compiler/ - compiler files doc/ - documentation ftplugin/ - filetype plugins indent/ - indent scripts keymap/ - key mapping files lang/ - menu translations plugin/ - plugin scripts syntax/ - syntax files tutor/ - files for vimtutor For more information, read :help your-runtime-dir :help 'runtimepath' :help :runtime 26.3. How do I extend an existing filetype plugin? You can extend an existing filetype plugin by creating a file under either the $VIMRTUNTIME/after/ftplugin or the $VIMRTUNTIME/ftplugin directory. The name of the file should be the same as the name of the existing filetype plugin file. You can place your additions to the new file. If you placed the file in the after/ftplugin runtime directory, then Vim will first source the existing filetype plugin file and then will source the new file. If you placed the file in the $VIMRTUNTIME/ftplugin runtime directory, then Vim will first source the new file and then will source the existing filetype plugin file. For more information, read :help ftplugin-overrule :help filetype-plugin :help add-filetype-plugin :help 'runtimepath' 26.4. How do I turn off loading the Vim plugins? You can reset the 'loadplugins' option to turn off loading the plugins: :set noloadplugins You can also specify the "--noplugin" command line argument to stop loading the plugins: $ vim --noplugin For more information, read :help 'loadplugins' :help --noplugin :help load-plugins 26.5. How do I turn on/off loading the filetype plugins? By default, Vim will not load the filetype plugins. You can configure Vim to load filetype plugins using the command: filetype plugin on You can turn off loading the filetype plugins using: filetype plugin off For more information, read :help filetype-plugin-on :help filetype-plugin-off :help :filetype 26.6. How do I override settings made in a file type plugin in the global ftplugin directory for all the file types? You can use an autocommand triggered on the FileType event: au Filetype * set formatoptions=xyz This should at least be after "filetype on" in your vimrc. Best is to put it in your "myfiletypefile" file, so that it's always last. If you want to override a setting for a particular filetype, then create a file with the same name as the original filetype plugin in the ~/.vim/after/ftplugin directory For example, to override a setting in the c.vim filetype plugin, create a c.vim file in the ~/.vim/after/ftplugin directory and add your preferences in this file. For more information, read :help ftplugin-overrule :help ftplugins :help myfiletypefile 26.7. How do I disable the Vim directory browser plugin? To disable the directory browsing Vim plugin, add the following line to your .vimrc file: let loaded_explorer = 1 For more information, read :help file-explorer 26.8. How do I set the filetype option for files with names matching a particular pattern or depending on the file extension? You can set the 'filetype' option for files with names matching a particular pattern using an autocmd. For example, to set the 'filetype' option to 'c' for all files with extension '.x', you can use the following autocmd: autocmd! BufRead,BufNewFile *.x setfiletype c A better alternative to the above approach is to create a filetype.vim file in the ~/.vim directory (or in one of the directories specified in the 'runtimepath' option) and add the following lines: " my filetype file if exists("did_load_filetypes") finish endif augroup filetypedetect au! BufRead,BufNewFile *.x setfiletype c augroup END For more information, read :help new-filetype :help 43.2 :help :setfiletype ============================================================================= SECTION 27 - EDITING PROGRAM FILES 27.1. How do I enable automatic indentation for C/C++ files? You can enable file-type based indentation using: :filetype indent on If you want to only enable automatic C indentation, then use: :set cindent For more information, read :help 'cindent' :help C-indenting :help filetype 27.2. How do I configure the indentation used for C/C++ files? You can configure the Vim C indentation by modifying the value of the 'cinoptions', 'cinkeys' and 'cinwords' options. For more information, read :help 'cindent' :help 'cinoptions' :help 'cinkeys' :help 'cinwords' :help C-indenting :help cinoptions-values :help 'smartindent' 27.3. How do I turn off the automatic indentation feature? By default, the automatic indentation is not turned on. You must have configured Vim to do automatic indentation in either .vimrc or .gvimrc files. You can disable automatic indentation using either, :filetype indent off or :set nocindent Also, check the setting for the following options: :set autoindent? :set smartindent? :set indentexpr? For more information, read :help 'cindent' :help filetype-indent-off :help 'autoindent' :help 'smartindent' :help 'indentexpr' 27.4. How do I change the number of space characters used for the automatic indentation? You can modify the 'shiftwidth' option to change the number of space characters used for the automatic indentation: :set shiftwidth=4 For more information, read :help 'shiftwidth' 27.5. I am editing a C program using Vim. How do I display the definition of a macro or a variable? You can use the [d command to display the definition of a macro and the [i command to display the definition of a variable. For more information, read :help [d :help [i :help include-search :help 29.4 :help 29.5 27.6. I am editing a C program using Vim. How do I jump to the beginning or end of a code block from within the block? You can use '[{' command to jump to the beginning of the code block and ']} to jump to the end of the code block from inside the block. For more information, read :help [{ :help ]} :help various-motions 27.7. Is there a way to turn off the "//" comment auto-insertion behavior for C++ files? If I'm sitting on a line beginning with "//", then I open a new line above or below it, Vim automatically inserts new "//" chars. You can modify the value of the 'comments' option to stop Vim from inserting the C++ comment character ("//") automatically. For example: :set comments=sr:/*,mb:*,el:*/ For more information, read :help 'comments' :help format-comments 27.8. How do I add the comment character '#' to a set of lines at the beginning of each line? First, select the first character in all the lines using visual block mode (CTRL-V). Press 'I' to start inserting characters at the beginning of the line. Enter the comment character and then stop the insert mode by pressing <Esc>. Vim will automatically insert the entered characters at the beginning of all the selected lines. For more information, read :help visual-block :help blockwise-operators :help v_b_I 27.9. How do I edit a header file with the same name as the corresponding C source file? You can use the following command to edit a header file with the same name as the corresponding C source file: :e %:t:r.h You can use the following command to edit the file in a new split window: :sp %:t:r.h In the above commands, the percent sign expands to the name of the current file. The ":t" modifier extracts the tail (last component) of the filename. The ":r" modifier extracts the root of the filename. The .h is appended to the resulting name to get the header filename. Another approach is to use the following command: :sfind %:t:r.h This command will search for the header file in the directories specified in the 'path' option. For more information, read :help cmdline-special :help filename-modifiers :help :sfind :help 'path' 27.10. How do I automatically insert comment leaders while typing comments? To automatically insert comment leaders while typing comments, add the 'r' and 'o' flags to the 'formatoptions' option. :set formatoptions+=ro You may also want to add the 'c' flag to auto-wrap comments using the 'textwidth' option setting and the 'q' flag to format comments with the "gq" command: :set formatoptions=croq For more information, read :help 30.6 :help format-comments :help 'comments' :help fo-table ============================================================================= SECTION 28 - QUICKFIX 28.1. How do I build programs from Vim? You can use the ":make" command to build programs from Vim. The ":make" command runs the program specified by the 'makeprg' option. For more information, read :help 30.1 :help make_makeprg :help 'makeprg' :help 'makeef' :help :make :help quickfix 28.2. When I run the make command in Vim I get the errors listed as the compiler compiles the program. When it finishes this list disappears and I have to use the :clist command to see the error message again. Is there any other way to see these error messages? You can use the ":copen" or ":cwindow" command to open the quickfix window that contains the compiler output. You can select different error lines from this window and jump to the corresponding line in the source code. For more information, read :help :copen :help :cwindow :help quickfix ============================================================================= SECTION 29 - FOLDING 29.1. How do I extend the Vim folding support? You can use the 'foldexpr' option to fold using an user specified function. For example, to fold subroutines of the following form into a single line: sub foo { my $barf; $barf = 3; return $barf; } You can use the following commands: set foldmethod=expr set foldexpr=MyFoldExpr(v:lnum) fun! MyFoldExpr(line) let str = getline(a:line) if str =~ '^sub\>' return '1' elseif str =~ '^}' return '<1' else return foldlevel(a:line - 1) endif endfun For more information, read :help 'foldexpr' :help fold-expr 29.2. When I enable folding by setting the 'foldmethod' option, all the folds are closed. How do I prevent this? You can set the 'foldlevelstart' option to a particular value to close only folds above the specified value. :set foldlevelstart=99 For more information, read :help 'foldlevelstart' :help 'foldlevel' :help fold-foldlevel 29.3. How do I control how many folds will be opened when I start editing a file? You can modify the 'foldlevelstart' option to control the number of folds that will be opened when you start editing a file. To start editing with all the folds closed: :set foldlevelstart=0 To start editing with all the folds opened, you can use :set foldlevelstart=999 For more information, read :help 'foldlevelstart' 29.4. How do I open and close folds using the mouse? You can click on the + and - characters displayed at the leftmost column to open and close fold. For this to work, you have to set the 'foldcolumn' to a value greater than zero: :set foldcolumn=2 For more information, read :help 'foldcolumn' 29.5. How do I change the text displayed for a closed fold? You can use the 'foldtext' option to change the text displayed for a closed fold. For more information, read :help 'foldtext' :help fold-foldtext :help 'fillchars' 29.6. How do I store and restore manually created folds across different Vim invocations? You can use the ":mkview" command to store manually created folds. Later, you can use the ":loadview" command to restore the folds. For this to work, the 'viewoptions' must contain "folds". For more information, read :help 28.4 :help :mkview :help :loadview :help 'viewoptions' :help 'viewdir' :help :mksession :help 'sessionoptions' ============================================================================= SECTION 30 - VIM WITH EXTERNAL APPLICATIONS 30.1. Can I run a shell inside a Vim window? Currently Vim doesn't have support for running shell and other external commands inside a Vim window. For more information, read :help shell-window Alternatively, you can try using the Unix "screen" utility or the 'splitvt' program. You can also use the vimsh plugin by Brian Sturk to run a shell in a Vim window. To use this you need to have Vim built with python support. For more information visit the following URL: http://vim.sourceforge.net/scripts/script.php?script_id=165 30.2. How do I pass the word under the cursor to an external command? You can use the special keyword <cword> to pass the word under the cursor to an external command. For example: :!dict <cword> For more information, read :help <cword> 30.3. How do I get the output of a shell command into a Vim buffer? You can use the ":r !" command to get the output of a shell command into a Vim buffer. For example, to insert the output of the "ls" shell command, you can use the following command: :r !ls To insert the output of the shell command above the first line use the following command: :0r !ls For more information, read :help :r! 30.4. How do I pipe the contents of the current buffer to an external command and replace the contents of the buffer with the output from the command? You can use the :! command to pipe the contents of the current buffer to a external command and replace the contents of the buffer with the output from the command. For example, to sort the contents of the current buffer, using the Unix sort command, you can use the following command: :%!sort To sort only lines 10-20, you can use the following command :10,20!sort Also, if you want to pipe a buffer to an external command but not put the results back in the buffer, you can use :w !sort The above command will pipe the entire buffer to the sort command. Note that the space between the 'w' and the '!' is critical. To pipe only a range of lines, you can use :10,20w !sort The above command will pipe the lines 10-20 to the sort command. For more information, read :help :range! :help 10.9 :help :w_c 30.5. How do I sort a section of my file? You can pipe a section of the file to the Unix "sort" utility to sort the file. For example: :5,100!sort You can also use a visual block, and use the "!sort" command on the selected block. To sort using visual blocks (sort based on a column or sort just the column itself), read the following tip from the Vim online web page: http://vim.sourceforge.net/tips/tip.php?tip_id=588 30.6. Is there a step-by-step guide for using Vim with slrn? Visit the following link to get information about using Vim with Slrn: http://thingy.apana.org.au/~fun/slrn/ 30.7. How do I use Vim as a pager? You can use Vim as a pager using the $VIMRUNTIME/macros/less.sh shell script, supplied as part of the standard Vim distribution. This shell script uses the $VIMRUNTIME/macros/less.vim Vim script to provide less like key bindings. For more information, read :help less 30.8. How do I view Unix man pages from inside Vim? You can view Unix man pages, inside Vim, using the man.vim plugin supplied as part of the standard Vim distribution. To use this plugin, add the following line to your startup vimrc file: runtime ftplugin/man.vim You can also press the K key to run the program specified by the 'keywordprg' option with the keyword under the cursor. By default, 'keywordprg' is set to run man on the keyword under the cursor. For more information, read :help man-plugin :help K :help 'keywordprg' 30.9. How do I change the diff command used by the Vim diff support? By default, the Vim diff support uses the 'diff' command. You can change this by changing the 'diffexpr' option. For more information, read :help diff-diffexpr :help 'diffexpr' 30.10. How do I use the Vim diff mode without folding? You can use the following command-line to start Vim with two filenames and use the diff mode without folding: $ vim -o file1 file2 "+windo set diff scrollbind scrollopt+=hor nowrap" If you like vertically split windows, then replace "-o" with "-O". For more information, read :help vimdiff ============================================================================= SECTION 31 - GUI VIM 31.1. How do I create buffer specific menus? Adding support for buffer specific menus is in the Vim TODO list. In the mean time, you can try Michael Geddes's plugin, buffermenu.vim: http://vim.sourceforge.net/scripts/script.php?script_id=246 31.2. How do I change the font used by GUI Vim? You can change the 'guifont' option to change the font used by GUI Vim. To display the current value of this option, you can use :set guifont? You can add the displayed font name to the .vimrc file to use the font across Vim sessions. For example, add the following line to the .vimrc file to use Andale Mono font. set guifont=Andale_Mono:h10:cANSI For Win32, GTK and Photon version of Vim, you can use the following command to bringup a dialog which will help you in changing the guifont: :set guifont=* You can also use the -font Vim command line option to specify the font used for normal text. For more information, read :help 'guifont' :help 'guifontset' :help 'guifontwide' :help font-sizes :help -font :help -boldfont :help -italicfont :help -menufont :help -menufontset 31.3. When starting GUI Vim, how do I specify the location of the GVIM window? You can use the "-geometry" command line argument to specify the location of the GUI Vim window. For example: $ gvim -geometry 80x25+100+300 For more information, read :help 31.4 :help -geom 31.4. How do I add a horizontal scrollbar in GVim? You can enable the horizontal scrollbar by modifying the 'guioptions' option: :set guioptions+=b For more information, read :help 'guioptions' :help gui-horiz-scroll 31.5. How do I make the scrollbar appear in the left side by default? You can add the 'l' flag to the 'guioptions' option to make the scrollbar appear in the left side. :set guioptions+=l :set guioptions-=r For more information, read :help 'guioptions' :help gui-scrollbars 31.6. How do I remove the Vim menubar? You can remove the Vim menubar by removing the 'm' flag from the 'guioptions' option: :set guioptions-=m For more information, read :help 'guioptions' 31.7. I am using GUI Vim. When I press the ALT key and a letter, the menu starting with that letter is selected. I don't want this behavior as I want to map the ALT-<key> combination. How do I do this? You can use the 'winaltkeys' option to disable the use of the ALT key to select a menu item: :set winaltkeys=no For more information, read :help 'winaltkeys' :help :simalt 31.8. Is it possible to scroll the text by dragging the scrollbar so that the cursor stays in the original location? The way Vim is designed, the cursor position has to be in a visible spot in normal, visual, select and insert mode. This cannot be changed without modifying Vim. When the scrollbar is used, the cursor will be moved so that it is always visible. Another approach to solving this problem is to use the Vim marks. You can mark the current cursor position using ma. Then scroll to a different part of the text and jump back to the old position using `a. You can also try the following suggestion from the Vim Online website: http://www.vim.org/tip_view.php?tip_id=320 For more information, read :help mark-motions 31.9. How do I get gvim to start browsing files in a particular directory when using the ":browse" command? You can set the 'browsedir' option to the default directory to use for the ":browse" command. :set browsedir='<your_dir>' For more information, read :help 'browsedir' 31.10. For some questions, like when a file is changed outside of Vim, Vim displays a GUI dialog box. How do I replace this GUI dialog box with a console dialog box? You can set the 'c' flag in the 'guioptions' option to configure Vim to use console dialogs instead of GUI dialogs: :set guioptions+=c For more information, read :help 'guioptions' 31.11. I am trying to use GUI Vim as the editor for my xxx application. When the xxx application launches GUI Vim to edit a file, the control immediately returns to the xxx application. How do I start GUI Vim, so that the control returns to the xxx application only after I quit Vim? You have to start GUI Vim with the '-f' (foreground) command line option: $ gvim -f By default, GUI Vim will disconnect from the program that started Vim. With the '-f' option, GUI Vim will not disconnect from the program that started it. For more information, read :help gui-fork :help -f 31.12. Why does the "Select Font" dialog doesn't show all the fonts installed in my system? Vim supports only fixed width (mono-spaced) fonts. Proportional fonts are not supported. In the "Select Font" dialog, only fixed width fonts will be displayed. For more information, read :help font-sizes :help 'guifont' 31.13. How do I use the mouse in Vim command-line mode? You can set the 'c' flag in the 'mouse' option to use mouse in the Vim command-line mode: :set mouse+=c For more information, read :help mouse-using :help gui-mouse :help 09.2 31.14. When I use the middle mouse button to scroll text, it pastes the last copied text. How do I disable this behavior? You can map the middle mouse button to <Nop> to disable the middle mouse button: :map <MiddleMouse> <Nop> :map! <MiddleMouse> <Nop> For more information, read :help gui-mouse-mapping :help <Nop> 31.15. How do I change the location and size of a GUI Vim window? You can use the "winpos" command to change the Vim window position. To change the size of the window, you can modify the "lines" and "columns" options. For example, the following commands will position the GUI Vim window at the X,Y co-ordinates 50,50 and set the number of lines to 50 and the number of columsn to 80. :winpos 50 50 :set lines=50 :set columns=80 The arguments to the 'winpos' command specify the pixel co-ordinates of the Vim window. The 'lines' and 'columns' options specify the number of lines and characters to use for the height and the width of the window respectively. For more information, read :help 31.4 :help :winpos :help 'lines' :help 'columns' :help GUIEnter ============================================================================= SECTION 32 - VIM ON UNIX 32.1. I am running Vim in a xterm. When I press the CTRL-S key, Vim freezes. What should I do now? Many terminal emulators and real terminal drivers use the CTRL-S key to stop the data from arriving so that you can stop a fast scrolling display to look at it (also allowed older terminals to slow down the computer so that it did not get buffer overflows). You can start the output again by pressing the CTRL-Q key. When you press the CTRL-S key, the terminal driver will stop sending the output data. As a result of this, it will look like Vim is hung. If you press the CTRL-Q key, then everything will be back to normal. You can turn off the terminal driver flow control using the 'stty' command: $ stty -ixon -ixoff or, you can change the keys used for the terminal flow control, using the following commands: $ stty stop <char> $ stty start <char> 32.2. I am seeing weird screen update problems in Vim. What can I do to solve this screen/display update problems? You have to use a proper terminal emulator like xterm with correct TERM settings (TERM=xterm) and a correct terminfo/termcap file. For more information, read :help 'term' 32.3. I am using the terminal/console version of Vim. In insertmode, When I press the backspace key, the character before the cursor is not erased. How do I configure Vim to do this? You have to make sure that Vim gets the correct keycode for the backpspace key. You can try using the command: :fixdel Make sure the TERM environment variable is set to the correct terminal name. You can try using the 'stty' command: $ stty erase ^H where, you have to enter the ^H character by pressing the CTRL-V key and then the CTRL-H key. For more information, read :help :fixdel :help Linux-backspace :help NetBSD-backspace 32.4. I am using Vim in a xterm. When I quit Vim, the screen contents are restored back to the original contents. How do I disable this? The xterm has a capability called "alternate screen". If this capability is present, vim switches to that alternate screen upon startup and back on exit, thus restoring the original screen contents. To disable this feature, add the following line to your .vimrc file: :set t_ti= t_te= For more information, read :help restorescreen :help xterm-screens 32.5. When I start Vim, it takes quite a few seconds to start. How do I minimize the startup time? This may be related to Vim opening the X display for setting the xterm title and using the X clipboard. Make sure the DISPLAY variable is set to point to the correct host. Try using the command line: $ vim -X This will prevent Vim from opening the X display. With this command-line option, the X clipboard cannot be used and also Vim will not be able to change the xterm title. You can also set the 'clipboard' option to :set clipboard=exclude:.* This has the same effect as using the -X command-line argument. For more information, read :help -X :help 'clipboard' 32.6. How can I make the cursor in gvim in unix stop blinking? You can modify the 'guicursor' option, to stop the cursor from blinking. For example: :set guicursor=a:blinkon0 For more information, read :help 'guicursor' 32.7. How do I change the menu font on GTK Vim? You can modify the ~/.gtkrc file to change the menu font on GTK Vim. For example: style "default" { font ="smooth09" } class "*" style "default" The last line changes the font of all widgets. For more information, read :help gui-gtk 32.8. How do I prevent <Ctrl-Z> from suspending Vim? You can map <Ctrl-Z> to prevent the suspending. Here are some suggestions: - Make <Ctrl-Z> do nothing: :map <C-Z> <Nop> - Make <Ctrl-Z> start a shell: :map <C-Z> :shell<CR> - Make <Ctrl-Z> give an error message: :map <C-Z> :"suspending disabled<CR> For the last example, the double quote is necessary in order to keep the message on the status line. 32.9. When I kill the xterm running Vim, the Vim process continues to run and takes up a lot of CPU (99%) time. Why is this happening? When Vim is built with support for Python interface, you will have this problem. This is a known problem with the python thread library and Vim. To solve this problem, use a Vim binary built without the Python interface. For more information, read :help +python :help python 32.10. How do I get the Vim syntax highlighting to work in a Unix terminal? The easiest and simplest way to get Vim syntax highlighting is to use the GUI version of Vim (GVIM). To get syntax highlighting to work in the console/terminal version of Vim, you have to run a terminal emulator (like Xfree86 xterm or rxvt or dtterm) that supports color. Note that if a terminal emulator supports changing the background and foreground colors, that does not mean that it also supports ANSI escape sequences for changing the color. You can download the latest version of Xfree86 xterm from http://dickey.his.com/xterm/xterm.html. You can download the latest version of rxvt from http://www.rxvt.org. You have to install the terminfo/termcap file that supports colors for the terminal emulator. Also, set the TERM environment variable to the correct name of the term that supports colors. You can use the colortest.vim script supplied with the Vim runtime package to test the color setup. To use this script, follow these steps: :e $VIMRUNTIME/syntax/colortest.vim :source % For more information, read :help 06.2 :help terminal-colors :help termcap-colors :help startup-terminal :help xterm-color :help colortest.vim ============================================================================= SECTION 33 - VIM ON MS-WINDOWS 33.1. In MS-Windows, CTRL-V doesn't start the blockwise visual mode. What happened? The mswin.vim script provides key mappings and options to make Vim behave like a MS-Windows application. One of the keys mapped is CTRL-V which is used for pasting text in MS-Windows applications. This will disable the use of CTRL-V to start the blockwise visual mode. The mswin.vim script maps CTRL-Q for staring the blockwise visual mode. So you can use CTRL-Q instead of CTRL-V. For more information, read :help CTRL-V :help CTRl-V-alternative :help CTRL-Q :help 10.5 33.2. When I press the CTRL-Y key, it acts like the CTRL-R key. How do I configure Vim to treat CTRL-Y as CTRL-Y? The mapping of the CTRL-Y key to the CTRL-R key is done by the mswin.vim script. The mswin.vim script maps CTRL-Y to make Vim behave like a standard MS-Windows application. This is explained in ":help CTRL-Y". You can either comment out the line in mswin.vim that maps the CTRL-Y key or you can remove the line in your .vimrc file that sources the mswin.vim script. 33.3. How do I start GUI Vim in a maximized window always? You can use the "simalt" command to maximize the Vim window. You can use the GUIEnter autocmd to maximize the Vim window on startup: autocmd GUIEnter * simalt ~x For more information, read :help :simalt :help GUIEnter :help gui-win32-maximized 33.4. After doing some editing operations, Vim freezes. The cursor becomes an empty rectangle. I am not able enter any characters. What is happening? Most probably, you used the mouse wheel to scroll the text in Vim. There is a known problem in using intellimouse mouse wheel with Vim. To avoid this problem, disable Universal scrolling support for Vim. For more information, read :help intellimouse-wheel-problems 33.5. I am using Windows XP, the display speed of maximized GVim is very slow. What can I do to speed the display updates? This may be due to the fact that you have enabled 'Smooth edges of screen fonts' in the display properties. Try turning off font smoothing or try changing the smoothing method to "Standard". 33.6. What are the recommended settings for using Vim with cygwin? You may want to set the following shell related Vim settings: :set shellcmdflag=-c :set shellquote= :set shellslash " Use the forward slash for expansion. :set shellxquote=\" :set shell=d:\cygwin\bin\bash.exe " Use the bash shell :set shellpipe=2>&1| tee :set shellredir=>%s 2>&1 33.7. I am trying to use GNU diff with Vim diff mode. When I run the diff from command line, it works. When I try to use the diff with Vim it doesn't work. What should I do now? There is a problem with using GNU diff with Vim. You can try using the GNU diff.exe built by Ron Aaron from the following link: http://www.mossbayeng.com/~ron/vim/builds.html 33.8. Is it possible to use Vim as an external editor for MS-Windows Outlook email client? You can use the "cubiclevim" COM Add-In to use Vim as an external editor for MS-Windows Outlook email client. Visit the following URL for more information: http://sourceforge.net/projects/cubiclevim Note that currently this works only with MS-Office 2000 and XP. 33.9. I am using Vim to edit HTML files. How do I start internet explorer with the current file to preview the HTML file? You can use the following command: :!start c:\progra~1\intern~1\iexplore.exe file://%:p<CR> 33.10. I would like to use Vim with Microsoft Visual Studio. How do I do this? You have to download and use the OLE version of Vim (for example: gvim61ole.zip). This file also contains instructions on how to use Vim with Visual Studio. For more information, read :help MSVisualStudio 33.11. Where do I place the _vimrc and _gvimrc files? You can place the _vimrc and _gvimrc files under the directory pointed to by the VIM environment variable. If you are sharing this system with other users, then you can place the files in a directory and set the HOME environment variable to this directory. For more information, read :help $HOME-use :help _vimrc 33.12. Everytime I save a file, Vim warns about the file being changed outside of Vim. Why? If you get the following warning message, everytime you save a file: WARNING: The file has been changed since reading it!!! Do you really want to write to it (y/n)? then this problem could be related to a bug in MS-Windows on the day daylight saving time starts. Vim remembers the timestamp of the file after it was written. Just before the next write the timestamp is obtained again to check if the file was changed outside of Vim. This works correctly, except on the day daylight saving time starts. This problem will go away the next day after the day the daylight saving time starts. For more information, read :help W11 ============================================================================= SECTION 34 - PRINTING 34.1. How do I print a file along with line numbers for all the lines? You can set the 'printoptions' option and use the ":hardcopy" command to print your file: :set printoptions=number:y :hardcopy For more information, read :help 'printoptions' :help :hardcopy 34.2. How do I print a file with the Vim syntax highlighting colors? You can use the ":hardcopy" command to print a file with the Vim syntax highlighting colors. You can also convert your file to a HTML file using the 2html.vim script and print the HTML file. For more information, read :help syntax-printing :help 2html.vim :help :hardcopy :help printing ============================================================================= SECTION 35 - BUILDING VIM FROM SOURCE 35.1. How do I build Vim from the sources on a Unix system? For a Unix system, follow these steps to build Vim from the sources: - Download the source and run-time files archive (vim-##.tar.bz2) from the ftp://ftp.vim.org/pub/vim/unix directory. - Extract the archive using the bzip2 and tar utilities using the command: $ bunzip2 -c <filename> | tar -xf - - Run the 'make' command to configure and build Vim with the default configuration. - Run 'make install' command to install Vim in the default directory. To enable/disable various Vim features, before running the 'make' command you can run the 'configure' command with different flags to include/exclude the various Vim features. To list all the available options for the 'configure' command, use: $ configure -help For more information, read :help install 35.2. How do I install Vim in my home directory or a directory other than the default installation directory in Unix? To install Vim in a directory other than the default installation directory, you have to specify the directory using the --prefix option while running the configure script. $ ./configure --prefix=/users/xyz You can enable/disable various Vim feature by supplying different arguments to the configure script. For more information about all these options, run $ ./configure --help For more information, read :help install-home :help install 35.3. How do I build Vim from the sources on a MS-Windows system? For a MS-Windows system, Vim can be built using either the Visual C++ compiler or the Borland C++ compiler or the Ming GCC compiler or the cygwin gcc compiler. Follow these steps to build Vim from the sources for MS-Windows: - Download the source (vim##src.zip), runtime (vim##rt.zip) and the extra (vim-##-extra.tar.gz) archives from the ftp://ftp.vim.org/pub/vim/pc directory. - Extract the archives into a directory (for example, c:\vimsrc) - Depending on the installed compiler, you can use the corresponding makefile to build the Vim sources. For Visual C++ use the Make_mvc.mak makefile, for borland C++ use the Make_bc5.mak makefile, for ming GCC use the Make_ming.mak makefile, for cygwin gcc use the Make_cyg.mak makefile. Depending on whether you want to build the GUI version of Vim or the console version of Vim, you have to pass different arguments to the makefiles. After successfully building the sources, you can copy the vim.exe or gvim.exe file to the desired directory along with the files from the runtime archive. You can visit the following site for extensive information about building Vim on a MS-Windows system using the various compilers: http://mywebpage.netscape.com/SharpPeople/vim/howto/index.html For more information, read :help install 35.4. The Vim help, syntax, indent files are missing from my Vim installation. How do I install these files? The Vim help, syntax, indent and other runtime files are part of the Vim runtime package. You need to download and install the Vim runtime package. For example, for MS-Windows, the name of the Vim 6.1 runtime package is vim61rt.zip. For more information, read :help install 35.5. I have built Vim from the source and installed the Vim package using "make install". Do I need to keep the Vim source directory? No. Once you have built and installed Vim in some directory other than the original source directory (for example, /usr/bin or /usr/local/bin), then you can remove the source directory. 35.6. How do I determine the Vim features which are enabled at compile time? You can use the ":version" command to determine the Vim features that are enabled at compile time. The features that are enabled will be prefixed with a "+". The features that are not enabled will be prefixed with a "-". If you want to test for a feature in a script, you can use the has() function: if has("menu") " Set up some menus endif For more information, read :help :version :help +feature-list :help has() 35.7. Can I build Vim without the GUI support? Yes. You can build Vim by optionally enabling/disabling many of the features including GUI. For more information, read :help install 35.8. When building Vim on a Unix system, I am getting "undefined reference to term_set_winsize' error. How do I resolve this error? You will get this error when the build process is not able to locate the termlib, termcap or ncurses library. You have to install the ncurses-dev package to resolve this error. 35.9. Vim configure keeps complaining about the lack of gtk-config while trying to use GTK 2.03. This is correct, since in GTK 2 they moved to using the generic pkg-config. I can get pkg-config to list the various includes and libs for gtk, but for some reason the configure script still isn't picking this up. Use the following shell script named gtk-config: #!/bin/sh pkg-config gtk+-2.0 $1 $2 ============================================================================= SECTION 36 - VARIOUS 36.1. How do I edit binary files with Vim? You can set the following options to edit binary files in Vim: :set binary :set display=uhex You can also use the "-b" command-line option to edit a binary file: $ vim -b <binary_file_name> You can also use the xxd utility (part of the Vim distribution) to edit binary files. For more information, read :help 23.4 :help edit-binary :help hex-editing :help -b :help 'binary' :help 'endofline' :help 'display' 36.2. How do I disable the visual error flash and the error beep? You can disable both the visual error flash and the error beep using the following command: :set visualbell t_vb= For more information, read :help 'visualbell' :help 'errorbells' :help t_vb 36.3. How do I display the ascii value of a character displayed in a buffer? You can use the 'ga' command to display the ascii value of a displayed character. For more information, read :help ga :help :ascii 36.4. Can I use zero as a count for a Vim command? You cannot use zero as a count for a Vim command, as "0" is a command on its own, moving to the first column of the line. For more information, read :help 0 :help count 36.5. How do I disable the Vim welcome screen? You can disable the Vim welcome screen, by adding the 'I' flag to the 'shortmess' option: :set shortmess+=I For more information, read :help :intro :help 'shortmess' 36.6. How do I avoid the "hit enter to continue" prompt? Vim will prompt you with the "hit enter to continue" prompt, if there are some messages on the screen for you to read and the screen is about to be redrawn. You can add the 'T' flag to the 'shortmess' option to truncate all messages. This will help in avoiding the hit-enter prompt: :set shortmess+=T You can also increase the command height by setting the 'cmdheight' option: :set cmdheight=2 For more information, read :help hit-enter :help avoid-hit-enter :help 'shortmess' :help 'cmdheight' 36.7. How do I invoke Vim from command line to run a group of commands on a group of files? There are several ways to invoke Vim from command line to run a group of commands on a group of files. You can use a set of "-c" command line options to specify a group of commands: $ vim -c "<ex_command_1>" -c "<ex_command_2>" *.txt Each of the ex-command specified with the "-c" command line option is executed one by one sequentially. You can also use a single "-c" command line option and the "|" character to separate the ex commands: $ vim -c "<ex_command_1> | <ex_command_2>" *.txt In the above command, if an ex command fails, then all the remaining ex commands will not be executed. For example, to replace "ABC" with "DEF" in a file from the command-line, you can use the following command: $ vim -c "%s/ABC/DEF/ge | update" myfile.txt To replace "ABC" with "DEF" in multiple files from the command-line, you can use the following command: $ vim -c "argdo %s/ABC/DEF/ge | update" *.txt You can store the group of commands into a file and use the "-s" command line option to run the commands on a set of files. For example, if the group of commands are stored in the file mycmds.txt, then you can use the following command: $ vim -s mycmds.txt *.pl For more information, read :help -c :help -s 36.8. How do I use a normal mode command from insert mode without leaving the insert mode? You can use a normal command from insert mode, without leaving the insert mode, by first pressing the CTRL-O key and then follow that with a single normal mode command. To execute more than one normal mode command, press the CTRL-L key, followed by any number of normal mode commands and then press <Esc> to get back to the insert mode. For more information, read :help i_CTRL-O :help i_CTRL-L 36.9. How do I start Vim in insert mode? You can start Vim in insert mode using the ":startinsert" ex command. $ vim +startinsert myfile.txt The above command will open the file "myfile.txt" and start insert mode with the cursor in front of the first character on the first line. To open the file and start appending after the last character on the last line, you can use the following command: $ vim + +startinsert! myfile.txt For more information, read :help :startinsert ============================================================================= SECTION 37 - UNICODE Author: Tony Mechelynck <antoine.mechelynck AT belgacom.net> 37.1. Is it possible to create Unicode files using Vim? Yes. It may be more or less complicated depending on the keyboard and fonts available to you, but it is always possible to encode any possible Unicode codepoint (and some illegal ones) into a file. To create a Unicode file using Vim, you should have compiled Vim with the "+multi_byte" compile-time option. You can get more information about Unicode from the following sites: http://www.unicode.org http://www.cl.cam.ac.uk/~mgk25/unicode.html For more information, read :help multibyte :help usr_45.txt 37.2. Which Vim settings are particularly important for editing Unicode files? The most important are the various "encoding" options, i.e., 'encoding', 'fileencoding', 'fileencodings' and 'termencoding'. The boolean option 'bomb' is also significant. For more information, read :help 'encoding' :help 'fileencoding' :help 'fileencodings' :help 'termencoding' :help 'bomb' 37.3. What is the 'encoding' option? Basically, the 'encoding' option defines how Vim will represent your data internally. However, all Unicode encodings are represented internally as utf-8 and converted (if necessary) when reading and writing. For more information, read :help 'encoding' 37.4. How does Vim name the various Unicode encodings? Utf-8 is called utf-8 or utf8; utf-16 is called ucs-2 or ucs2; utf-32 is called ucs-4 or ucs4. Also, you may specify endianness (except for utf-8 which does not vary for endianness) by appending le for little-endian or be for big-endian. If you create a file with an encoding of ucs-2 or ucs-4 without specifying endianness, Vim will use what is typical of your machine. For more information, read :help encoding-names :help encoding-values :help encoding-table 37.5. How does Vim specify the presence or absence of a byte-order mark? When reading a file, if the 'fileencodings' option includes "ucs-bom", Vim will check for a byte-order mark. When writing a file, if the 'bomb' option is set, Vim will write a byte-order mark on files whose encoding warrants it. For more information, read :help 'fileencodings' :help 'bomb' 37.6. What is the 'fileencoding' option? The 'fileencoding' option defines the particular encoding which Vim will use to write a file. If empty, then the value of the 'encoding' option is the default. For more information, read :help 'fileencoding' 37.7. What is the 'fileencodings' option? The 'fileencodings' option defines the heuristics used by Vim when opening an existing file. It is a comma separated list of encodings. A special name, "ucs-bom" is used to indicate that Vim should check for the presence of a byte-order mark; however, it will not be recognised if it comes after "utf-8". Normally, "ucs-bom" (if present) should be first in the list. When Vim opens a file, it checks it against the encodings listed in 'fileencodings'. The first one that matches is used. If there is no match, then Vim sets 'fileencoding' to the null string, i.e., the value of 'encoding' will be used. For more information, read :help 'fileencodings' :help 'encoding' 37.8. What is the 'termencoding' option? The 'termencoding' option defines how your keyboard encodes the data you type. If empty, Vim assumes that it has the same value as 'encoding'. Usually it should be set to something that matches your locale. For more information, read :help 'termencoding' :help locale 37.9. What is the 'bomb' option? When reading a file with "ucs-bom" present in the 'fileencodings' option, Vim will set the 'bomb' option on or off depending on the presence or absence of a byte-order mark at the start of the file. When writing, Vim will write a byte-order mark if the 'bomb' option is set. You may set or unset it manually do make Vim write, or not write, the b.o.m. For more information, read :help 'bomb' 37.10. Where can I find an example of a typical use of all these options? There is a "tip", with explains them in different words with an example, at http://vim.sourceforge.net/tip_view.php?tip_id=246 . 37.11. How can I insert Unicode characters into a file using Vim? Several methods are available: - Characters present on your keyboard can be typed in the usual way, even those which require a "dead-key" prefix, like (for instance) the circumflex on French keyboards. - Characters for which a digraph is defined can be typed as two characters prefixed by <Ctrl-K>. - If you have set the 'digraph' option, you can enter the characters for which a digrph is defined as <char1><BS><char2>. - Any character can be entered by using a <Ctrl-V> prefix (or <Ctrl-Q> if <Ctrl-V> is remapped to paste from the clipboard). For more information, read :help digraphs :help 'digraph' :help i_CTRL-V_digit 37.12. How can I know which digraphs are defined and for which characters? First set the 'encoding' option properly (for instance, to utf-8), then use the :digraphs command to list the currently defined digraphs. For more information, read :help :digraphs :help 'encoding' ============================================================================= Current Maintainer: Yegappan Lakshmanan Last updated on: 2 January 2005
Generated by vim2html.pl 3.2 on Wed Oct 19 01:54:34 2005


|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xml.sax.helpers.DefaultHandler org.apache.cayenne.util.AbstractHandler
public class AbstractHandler
The common superclass for all SAX event handlers used to parse the configuration file. Each method just throws an exception, so subclasses should override what they can handle. Each type of XML element (map, node, etc.) has a specific subclass. In the constructor, this class takes over the handling of SAX events from the parent handler and returns control back to the parent in the endElement method.
The idea to use nested handlers for XML document parsing (and code to implement it) were taken from org.apache.tools.ant.ProjectHelper from Jakarta-Ant project (Copyright: Apache Software Foundation). This may not be the best way to build objects from XML, but it is rather consistent. For each nested element in the XML tree a dedicated handler is created (subclass of this AbstractHandler). Once the element is parsed, control is handled back to the parent handler.
| Field Summary | |
|---|---|
protected org.xml.sax.ContentHandler |
parentHandler
Deprecated. Previous handler for the document. |
protected org.xml.sax.XMLReader |
parser
Deprecated. Current parser. |
| Constructor Summary | |
|---|---|
AbstractHandler(org.xml.sax.XMLReader parser,
org.xml.sax.ContentHandler parentHandler)
Deprecated. Creates a handler and sets the parser to use it for the current element. |
| Method Summary | |
|---|---|
void |
characters(char[] buf,
int start,
int count)
Deprecated. Handles text within an element. |
void |
endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
Deprecated. Handles the end of an element. |
protected void |
finished()
Deprecated. Called when this element and all elements nested into it have been handled. |
org.xml.sax.XMLReader |
getParser()
Deprecated. Returns currently used XMLReader. |
void |
startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
org.xml.sax.Attributes atts)
Deprecated. Handles the start of an element. |
| Methods inherited from class org.xml.sax.helpers.DefaultHandler |
|---|
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected org.xml.sax.XMLReader parser
protected org.xml.sax.ContentHandler parentHandler
| Constructor Detail |
|---|
public AbstractHandler(org.xml.sax.XMLReader parser, org.xml.sax.ContentHandler parentHandler)
parser
- Currently used XML parser. Must not be null
.parentHandler
- The handler which should be restored to the parser at the end
of the element. Must not be null
.| Method Detail |
|---|
public org.xml.sax.XMLReader getParser()
public void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts) throws org.xml.sax.SAXException
startElement
in interface org.xml.sax.ContentHandler
startElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
- if this method is not overridden, or in case of error in an
overridden versionpublic void characters(char[] buf, int start, int count) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class org.xml.sax.helpers.DefaultHandler
buf
- A character array of the text within the element. Will not be
null
.start
- The start element in the array.count
- The number of characters to read from the array.
org.xml.sax.SAXException
- if this method is not overridden, or in case of error in an
overridden versionprotected void finished()
public void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName) throws org.xml.sax.SAXException
endElement
in interface org.xml.sax.ContentHandler
endElement
in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
finished()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


[1]
i received it before i sent it back to outpost.
[2]
if that is so inoperable i couldnt even format it before i sent it back to outpost.


...Initializing Contact Manager, please wait...


We did most of the heavy lifting for you to provide a default stylings that incorporate our custom components. Additionally, we refined animations and transitions to provide a smoother experience for developers.
By utilizing elements and principles of Material Design, we were able to create a framework that incorporates components and animations that provide more feedback to users. Additionally, a single underlying responsive system across all platforms allow for.
We have provided detailed documentation as well as specific code examples to help new users get started. We are also always open to feedback and can answer any questions a user may have about Materialize.
We have provided detailed documentation as well as specific code examples to help new users get started. We are also always open to feedback and can answer any questions a user may have about Materialize.


For bullet and box cameras, PTZ controls are hid by default. To show PTZ controls, click the expand button on the Live View tab page.
The following table provides the description for each PTZ control.
| Direction Arrow | Each arrow indicates a direction. |
| Reset/Patrol | Click to enable a bullet or box camera to go to the factory default point and zoom out. Click to enable a dome camera to start a pan patrol. |
| Step | A large step indicates a high PT speed. The step adjustment bar can also control the zooming and focusing speeds for cameras with a motorized zoom lens. |
| Zoom | Click to zoom in and to zoom out. |
| Focus | Click for far focus, for near focus, and for autofocus. You can set the focusing mode in Camera-Image. |
| Aperture | Click to increase the aperture, to decrease the aperture, and for an adaptive aperture. You can set the aperture mode in Camera-Image. |
| Backlight | Click to to turn on the IR lamp and turn off the IR lamp.
Note: This option is available only to IR cameras. |
| Wiper | The wiper is used to clean the glass panel. Clicking will enable the wiper and clicking again will disable the wiper. If you do not manually disable the wiper, the wiper automatically stops working in ten minutes after being enabled. |
| Preset | You can save, delete, and load presets. For details on how to configure a preset, see Camera-PTZ. |