Line 64: | Line 64: | ||
</pre> |
</pre> |
||
+ | 這個東西很搞笑,竟然能編輯。 |
||
− | ==Comments== |
||
+ | 你們說這是為什麽呢? |
||
− | A minor point: It's "recommended" to keep 'tabstop' at 8 when using 'expandtab', since that will ensure that the text or code looks the same way in dumb viewers and when printing. ([[User:Spiiph|Spiiph]] 13:50, 28 July 2009 (UTC)) |
||
+ | 寫他嗎一大堆,有用的話沒有幾個。 |
||
− | |||
+ | 寫那麽多有個P用。 |
||
− | However, the tabstop = 8 rule is nowhere near universal. For instance, in Java and Python, tabs are usually 4 spaces. [[User:Meviin|Meviin]] 15:22, June 27, 2012 (UTC) |
||
+ | 還不如這樣: |
||
− | |||
+ | 飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,最後不其這個 |
||
− | When using 'expandtab', it should always look the same in "dumb" viewers anyway, since you're inserting spaces instead of tabs. --[[User:Fritzophrenic|Fritzophrenic]] 16:22, June 27, 2012 (UTC) |
||
− | |||
− | I agree with --[[User:Fritzophrenic|Fritzophrenic]]. I do that for years. The best way to configure is setting 'expandtab' to '1' and setting 'tabstop' to something you like. I always replaced tabs with spaces. Even before I started to use Vim (many years ago). [[User:antonello.ale]] 01:17, November 21, 2012 (UTC) |
Revision as of 02:15, 20 January 2013
created 2007 · complexity basic · author Datagrok · version 7.0
Many tips that you find on this site and others will tell you to add some code to your .vimrc
file. (Or on Windows, your _vimrc
file.) :help vimrc-intro
Once you do this a few times, it can get pretty big and confusing, especially if the bits of configuration you are adding are each specific to a single language. Worse, some settings might be incompatible with others.
Happily, Vim has a very nice built-in way to organize and manage language-specific options by breaking them out into files and directories. You can learn all about it by reading :help vimfiles, :help ftplugin-overrule, :help after-directory.
The quick way to get started is to move all the language-specific stuff from your .vimrc file into a file named .vim/ftplugin/language.vim
(or $HOME/vimfiles/ftplugin/language.vim
on Windows).
This turns a .vimrc that looks like this:
autocmd FileType * set tabstop=2|set shiftwidth=2|set noexpandtab autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab au BufEnter *.py set ai sw=4 ts=4 sta et fo=croql
Into this:
" File ~/.vimrc " ($HOME/_vimrc on Windows) " Global settings for all files (but may be overridden in ftplugin). set tabstop=2 set shiftwidth=2 set noexpandtab " File ~/.vim/ftplugin/python.vim " ($HOME/vimfiles/ftplugin/python.vim on Windows) " Python specific settings. setlocal tabstop=4 setlocal shiftwidth=4 setlocal expandtab setlocal autoindent setlocal smarttab setlocal formatoptions=croql
If there is a filetype plugin distributed with Vim that you want to completely disable, make your own (perhaps empty) settings file and adding this line:
let b:did_ftplugin = 1
If you like most of what Vim's filetype plugin is doing, but you want to override something specific, you can place your settings in .vim/after/ftplugin/language.vim
($HOME/vimfiles/after/ftplugin/language.vim
on Windows). See :help after-directory
If there is a new file extension that you want Vim to recognize, don't muck about with augroup
in your .vimrc, put the settings in the right place. See :help ftdetect
There is a lot more you can do with your ~/.vim
directory ($HOME/vimfiles
on Windows). ~/.vim/compiler
is a good place to keep configuration that gets applied on a per-compiler basis (for example, I might need to use any of javac, jikes, ant, or make to compile and parse the compiler output for a java source file.) I also like to keep a couple color schemes in ~/.vim/colors
, and I keep notes in vimhelp format in ~/.vim/doc
. Periodically running :helptags ~/.vim/doc
lets me jump to a tag in those notes using :h
. :help helptags :help vimfiles
This tip suggests moving language-specific settings to a suitable ftplugin file. For that to work, you need to have file type detection enabled. Enter the command :filetype
to determine whether detection is enabled on your system. On some Linux distributions, file type detection is disabled, in which case you should add a command like the following to your vimrc:
filetype plugin on " Alternative: use the following to also enable language-dependent indenting. filetype plugin indent on
這個東西很搞笑,竟然能編輯。 你們說這是為什麽呢? 寫他嗎一大堆,有用的話沒有幾個。 寫那麽多有個P用。 還不如這樣: 飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒飢餓咖啡機額將法科額外餓雞誒就誒三孔味道可誒餓, 大可餓看忘了我咯我餓好誒我便去我餓恩誒恩房內誒飛蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡蛾誒減法誒就誒就誒就誒咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,咖啡蛾誒減法誒就誒就誒就誒就誒就誒飢餓誒那方 飛蛾就額將誒飛蛾撲火非蟲螢火蟲歐洲非粥亞洲粥鋪粥面粥面粉分娩粥分娩分餓咖啡就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓, 大可餓看忘了我咯我就誒三孔味道可誒餓,最後不其這個