Created
November 7, 2011 16:25
-
-
Save kana/1345430 to your computer and use it in GitHub Desktop.
Vim: :doautocmd trap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm -f *.log | |
vim -u NONE -i NONE -N -c 'source case-1.vim' | |
vim -u NONE -i NONE -N -c 'source case-2.vim' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
According to :help :autocmd -- | |
> After applying the autocommands the modelines are | |
> processed, so that their settings overrule the | |
> settings from autocommands, like what happens when | |
> editing a file. | |
... is this behavior really useful? | |
Processing modelines should be restricted while opening files, shouldn't it? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
line 8: set updatetime=1 | |
line 9: | |
line 10: quit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filetype plugin indent on | |
autocmd FileType * echo 'FileType is triggered.' | |
edit foo | |
set verbosefile=case-1.log | |
set verbose=99 | |
set updatetime=1 | |
quit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
line 8: set updatetime=1 | |
line 9: | |
line 10: doautocmd User This_doautocmd_should_do_nothing_but_triggers_FileType_event. | |
No matching autocommands | |
Executing FileType Auto commands for "*" | |
autocommand call s:LoadFTPlugin() | |
line 0: call s:LoadFTPlugin() | |
calling function <SNR>3_LoadFTPlugin() | |
line 1: if exists("b:undo_ftplugin") | |
line 2: exe b:undo_ftplugin | |
line 2: setlocal cms< | unlet! b:browsefilter b:match_words | |
line 2: unlet! b:browsefilter b:match_words | |
line 3: unlet! b:undo_ftplugin b:did_ftplugin | |
line 4: endif | |
line 5: | |
line 6: let s = expand("<amatch>") | |
line 7: if s != "" | |
line 8: if &cpo =~# "S" && exists("b:did_ftplugin") | |
line 9: ^I" In compatible mode options are reset to the global values, need to | |
line 10: ^I" set the local values also when a plugin was already used. | |
line 11: ^Iunlet b:did_ftplugin | |
line 12: endif | |
line 13: | |
line 14: " When there is a dot it is used to separate filetype names. Thus for | |
line 15: " "aaa.bbb" load "aaa" and then "bbb". | |
line 16: for name in split(s, '\.') | |
line 17: ^Iexe 'runtime! ftplugin/' . name . '.vim ftplugin/' . name . '_*.vim ftplugin/' . name . '/*.vim' | |
line 17: runtime! ftplugin/sh.vim ftplugin/sh_*.vim ftplugin/sh/*.vim | |
Searching for "ftplugin/sh.vim ftplugin/sh_*.vim ftplugin/sh/*.vim" in "/Users/kana/.vim,/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles,/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73,/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles/after,/Users/kana/.vim/after" | |
Searching for "/Users/kana/.vim/ftplugin/sh.vim" | |
Searching for "/Users/kana/.vim/ftplugin/sh_*.vim" | |
Searching for "/Users/kana/.vim/ftplugin/sh/*.vim" | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles/ftplugin/sh.vim" | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles/ftplugin/sh_*.vim" | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles/ftplugin/sh/*.vim" | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73/ftplugin/sh.vim" | |
chdir(/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73/ftplugin) | |
fchdir() to previous dir | |
line 17: sourcing "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73/ftplugin/sh.vim" | |
line 1: " Vim filetype plugin file | |
line 2: " Language:^Ish | |
line 3: " Maintainer:^IDan Sharp <dwsharp at users dot sourceforge dot net> | |
line 4: " Last Changed: 20 Jan 2009 | |
line 5: " URL:^I^Ihttp://dwsharp.users.sourceforge.net/vim/ftplugin | |
line 6: | |
line 7: if exists("b:did_ftplugin") | finish | endif | |
line 7: finish | endif | |
line 7: endif | |
line 8: let b:did_ftplugin = 1 | |
line 9: | |
line 10: " Make sure the continuation lines below do not cause problems in | |
line 11: " compatibility mode. | |
line 12: let s:save_cpo = &cpo | |
line 13: set cpo-=C | |
line 14: | |
line 15: setlocal commentstring=#%s | |
line 16: | |
line 17: " Shell: thanks to Johannes Zellner | |
line 18: if exists("loaded_matchit") | |
line 19: let s:sol = '\%(;\s*\|^\s*\)\@<=' " start of line | |
line 23: let b:match_words = s:sol.'if\>:' . s:sol.'elif\>:' . s:sol.'else\>:' . s:sol. 'fi\>,' . s:sol.'\%(for\|while\)\>:' . s:sol. 'done\>,' . s:sol.'case\>:' . s:sol. 'esac\>' | |
line 24: endif | |
line 25: | |
line 26: " Change the :browse e filter to primarily show shell-related files. | |
line 27: if has("gui_win32") | |
line 31: let b:browsefilter="Bourne Shell Scripts (*.sh)\t*.sh\n" .^I"Korn Shell Scripts (*.ksh)\t*.ksh\n" .^I"Bash Shell Scripts (*.bash)\t*.bash\n" .^I"All Files (*.*)\t*.*\n" | |
line 32: endif | |
line 33: | |
line 34: " Undo the stuff we changed. | |
line 35: let b:undo_ftplugin = "setlocal cms< | unlet! b:browsefilter b:match_words" | |
line 36: | |
line 37: " Restore the saved compatibility options. | |
line 38: let &cpo = s:save_cpo | |
finished sourcing /Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73/ftplugin/sh.vim | |
continuing in function <SNR>3_LoadFTPlugin | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73/ftplugin/sh_*.vim" | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73/ftplugin/sh/*.vim" | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles/after/ftplugin/sh.vim" | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles/after/ftplugin/sh_*.vim" | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles/after/ftplugin/sh/*.vim" | |
Searching for "/Users/kana/.vim/after/ftplugin/sh.vim" | |
Searching for "/Users/kana/.vim/after/ftplugin/sh_*.vim" | |
Searching for "/Users/kana/.vim/after/ftplugin/sh/*.vim" | |
line 18: endfor | |
line 16: for name in split(s, '\.') | |
line 17: ^Iexe 'runtime! ftplugin/' . name . '.vim ftplugin/' . name . '_*.vim ftplugin/' . name . '/*.vim' | |
line 18: endfor | |
line 19: endif | |
function <SNR>3_LoadFTPlugin returning #0 | |
continuing in FileType Auto commands for "*" | |
Executing FileType Auto commands for "*" | |
autocommand call s:LoadIndent() | |
line 0: call s:LoadIndent() | |
calling function <SNR>4_LoadIndent() | |
line 1: if exists("b:undo_indent") | |
line 2: exe b:undo_indent | |
line 3: unlet! b:undo_indent b:did_indent | |
line 4: endif | |
line 5: let s = expand("<amatch>") | |
line 6: if s != "" | |
line 7: if exists("b:did_indent") | |
line 8: ^Iunlet b:did_indent | |
line 9: endif | |
line 10: | |
line 11: " When there is a dot it is used to separate filetype names. Thus for | |
line 12: " "aaa.bbb" load "indent/aaa.vim" and then "indent/bbb.vim". | |
line 13: for name in split(s, '\.') | |
line 14: ^Iexe 'runtime! indent/' . name . '.vim' | |
line 14: runtime! indent/sh.vim | |
Searching for "indent/sh.vim" in "/Users/kana/.vim,/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles,/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73,/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles/after,/Users/kana/.vim/after" | |
Searching for "/Users/kana/.vim/indent/sh.vim" | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles/indent/sh.vim" | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73/indent/sh.vim" | |
chdir(/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73/indent) | |
fchdir() to previous dir | |
line 14: sourcing "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73/indent/sh.vim" | |
line 1: " Vim indent file | |
line 2: " Language: Shell Script | |
line 3: " Maintainer: Nikolai Weibull <[email protected]> | |
line 4: " Latest Revision: 2010-01-06 | |
line 5: | |
line 6: if exists("b:did_indent") | |
line 7: finish | |
line 8: endif | |
line 9: let b:did_indent = 1 | |
line 10: | |
line 11: setlocal indentexpr=GetShIndent() | |
line 12: setlocal indentkeys+=0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,),0=;;,0=;& | |
line 13: setlocal indentkeys+=0=fin,0=fil,0=fip,0=fir,0=fix | |
line 14: setlocal indentkeys-=:,0# | |
line 15: setlocal nosmartindent | |
line 16: | |
line 17: if exists("*GetShIndent") | |
line 18: finish | |
finished sourcing /Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vim73/indent/sh.vim | |
continuing in function <SNR>4_LoadIndent | |
Searching for "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim/vimfiles/after/indent/sh.vim" | |
Searching for "/Users/kana/.vim/after/indent/sh.vim" | |
line 15: endfor | |
line 13: for name in split(s, '\.') | |
line 14: ^Iexe 'runtime! indent/' . name . '.vim' | |
line 15: endfor | |
line 16: endif | |
function <SNR>4_LoadIndent returning #0 | |
continuing in FileType Auto commands for "*" | |
Executing FileType Auto commands for "*" | |
autocommand echo 'FileType is triggered.' | |
line 0: echo 'FileType is triggered.' | |
FileType is triggered. | |
line 11: | |
line 12: quit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filetype plugin indent on | |
autocmd FileType * echo 'FileType is triggered.' | |
edit foo | |
set verbosefile=case-2.log | |
set verbose=99 | |
set updatetime=1 | |
doautocmd User This_doautocmd_should_do_nothing_but_triggers_FileType_event. | |
quit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim: filetype=sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Nov 6 2011 14:30:13) | |
MacOS X (unix) version | |
Included patches: 1-353 | |
Compiled by kana@avril | |
Huge version without GUI. Features included (+) or not (-): | |
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent | |
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments | |
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs | |
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path | |
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv | |
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent | |
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape | |
+mouse_dec -mouse_gpm -mouse_jsbterm +mouse_netterm -mouse_sysmouse | |
+mouse_xterm +mouse_urxvt +multi_byte +multi_lang -mzscheme -netbeans_intg | |
+path_extra -perl +persistent_undo +postscript +printer +profile -python | |
-python3 +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent | |
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary | |
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title | |
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo | |
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp | |
-xterm_clipboard -xterm_save | |
system vimrc file: "$VIM/vimrc" | |
user vimrc file: "$HOME/.vimrc" | |
user exrc file: "$HOME/.exrc" | |
fall-back for $VIM: "/Users/kana/.vvm/vims/vimorg--v7-3-353/share/vim" | |
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X_UNIX -no-cpp-precomp -g -O -D_FORTIFY_SOURCE=1 | |
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -framework Cocoa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment