comparison runtime/doc/usr_43.txt @ 7183:ffad29dc7eee

commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 30 14:37:44 2015 +0100 Update runtime files.
author Christian Brabandt <cb@256bit.org>
date Fri, 30 Oct 2015 14:45:04 +0100
parents 359743c1f59a
children 9f48eab77d62
comparison
equal deleted inserted replaced
7182:c6a1a1ea7c19 7183:ffad29dc7eee
1 *usr_43.txt* For Vim version 7.4. Last change: 2008 Dec 28 1 *usr_43.txt* For Vim version 7.4. Last change: 2015 Oct 23
2 2
3 VIM USER MANUAL - by Bram Moolenaar 3 VIM USER MANUAL - by Bram Moolenaar
4 4
5 Using filetypes 5 Using filetypes
6 6
44 44
45 2. Create the file "~/.vim/ftplugin/c.vim", with the contents: > 45 2. Create the file "~/.vim/ftplugin/c.vim", with the contents: >
46 46
47 setlocal softtabstop=4 47 setlocal softtabstop=4
48 noremap <buffer> <LocalLeader>c o/**************<CR><CR>/<Esc> 48 noremap <buffer> <LocalLeader>c o/**************<CR><CR>/<Esc>
49 let b:undo_ftplugin = "setl softtabstop< | unmap <buffer> <LocalLeader>c"
49 50
50 Try editing a C file. You should notice that the 'softtabstop' option is set 51 Try editing a C file. You should notice that the 'softtabstop' option is set
51 to 4. But when you edit another file it's reset to the default zero. That is 52 to 4. But when you edit another file it's reset to the default zero. That is
52 because the ":setlocal" command was used. This sets the 'softtabstop' option 53 because the ":setlocal" command was used. This sets the 'softtabstop' option
53 only locally to the buffer. As soon as you edit another buffer, it will be 54 only locally to the buffer. As soon as you edit another buffer, it will be
57 Likewise, the mapping for "\c" will disappear when editing another buffer. 58 Likewise, the mapping for "\c" will disappear when editing another buffer.
58 The ":map <buffer>" command creates a mapping that is local to the current 59 The ":map <buffer>" command creates a mapping that is local to the current
59 buffer. This works with any mapping command: ":map!", ":vmap", etc. The 60 buffer. This works with any mapping command: ":map!", ":vmap", etc. The
60 |<LocalLeader>| in the mapping is replaced with the value of the 61 |<LocalLeader>| in the mapping is replaced with the value of the
61 "maplocalleader" variable. 62 "maplocalleader" variable.
63
64 The line to set b:undo_ftplugin is for when the filetype is set to another
65 value. In that case you will want to undo your preferences. The
66 b:undo_ftplugin variable is executed as a command. Watch out for characters
67 with a special meaning inside a string, such as a backslash.
62 68
63 You can find examples for filetype plugins in this directory: > 69 You can find examples for filetype plugins in this directory: >
64 70
65 $VIMRUNTIME/ftplugin/ 71 $VIMRUNTIME/ftplugin/
66 72