path: root/vim/ftdetect
AgeCommit message (Collapse)AuthorFilesLines
2018-07-10Add explicit group to ftdetect ruleTom Ryder1-1/+1
This isn't strictly necessary, as it's sourced into the group from filetype.vim, but making it explicit appeases vint.
2018-07-09Add extra Perl file detection rulesTom Ryder1-0/+9
2018-06-06Consolidate .vimrc and .vim/filetype.vimTom Ryder40-244/+0
And add .vim/script.vim, to be composed in the next commit
2018-06-03Add mail ftdetect rulesTom Ryder1-0/+4
2018-06-03Remove accidentally committed ";" fileTom Ryder1-12/+0
2018-06-03Add shebang and opening tag detect for PHPTom Ryder2-0/+20
2018-06-03Refine shebangs in filetype detectionTom Ryder6-8/+8
2018-06-03Implement personal filetype.vimTom Ryder39-12/+209
This implements only the syntax highlighting for file types I regularly use and care about, implemented in the way I want them to work, with files named per type in ftdetect/*.vim. I have chosen only file types with which I regularly deal and for which syntax highlighting and filetype/indent plugins are actually useful. Most other files, e.g. system config files I edit infrequently and only with sudoedit(8), don't really benefit from that. Much of this is just copied from the distribution filetype.vim file, but some of it I do specifically in a way I want, such as the shell decision logic. We'll see how well this works.
2018-01-26Remove help ftdetect rulesTom Ryder1-4/+0
No longer applicable since pathogen.vim was removed in 3e2740f.
2017-11-13Force muttrc filetype from ftdetect rulesTom Ryder1-1/+1
Looks like these were getting categorised as "rc", or "M$ Resource files", in the core filetype.vim.
2017-11-12Add path rules for detecting Vim help filesTom Ryder1-0/+4
This matches .txt files in any 'doc' directory with 'vim' or '.vim' in its ancestry.
2017-11-08Remove superfluous augroups around ftdetect defsTom Ryder5-43/+27
From :help ftdetect, item 2: > 2. Create a file that contains an autocommand to detect the file type. > Example: > au BufRead,BufNewFile *.mine set filetype=mine > Note that there is no "augroup" command, this has already been done > when sourcing your file.
2017-11-06Move pipes from end to start of continued linesTom Ryder1-6/+6
The Google Vimscript Guide says: <https://google.github.io/styleguide/vimscriptfull.xml#Whitespace> > Place one space after the backslash denoting a line continuation. > > When continuing a multi-line command a pipe can be substituted for > this space as necessary, as follows: > > autocommand BufEnter <buffer> > \ if !empty(s:var) > \| call some#function() > \|else > \| call some#function(s:var) > \|endif
2017-10-30Apply name conventions, scoping to Vim identifiersTom Ryder5-5/+5
The Google VimScript Style Guide says <https://google.github.io/styleguide/vimscriptguide.xml#Naming>: >In general, use plugin-names-like-this, FunctionNamesLikeThis, >CommandNamesLikeThis, augroup_names_like_this, >variable_names_like_this. Adjusted variable, function, and `augroup` names accordingly, including setting script scope for some of the functions and their calls (`s:` and `<SID>` prefixes). Initially I tried using `prefix#`, but it turns out that this is a namespacing contention for publically callable functions like `pathogen#infect`, and none of these functions need to be publically callable.
2017-10-30Use conventional indent for continued VimL linesTom Ryder5-17/+17
I had four spaces, but with a 'shiftwidth' of 2, 6 is the conventional value. From :help ft-vim-indent: >For indenting Vim scripts there is one variable that specifies the >amount of indent for a continuation line, a line that starts with a >backslash: > > :let g:vim_indent_cont = &sw * 3 > >Three times shiftwidth is the default value.
2017-10-30Rearrange and better explain ksh syntax workaroundTom Ryder1-9/+0
Move the rule setting the custom b:is_ksh variable used for this workaround (established in 52615f6) into an ftplugin file, rather than into ftdetect; the latter seems a much more appropriate place since by this point we've definitely decided the file type is "sh". From the revised comment in this changeset: >Setting g:is_posix above also prompts Vim's core syntax/sh.vim script >to set g:is_kornshell and thereby b:is_kornshell to the same value as >g:is_posix. > >That's very confusing, so before it happens we'll copy b:is_kornshell's >value as determined by filetype.vim and ~/.vim/ftdetect/sh.vim into a >custom variable b:is_ksh, before its meaning gets confused. > >b:is_ksh as a name is more inline with b:is_bash and b:is_sh, anyway, >so we'll just treat b:is_kornshell like it's both misnamed and broken. > >We can then switch on our custom variable in ~/.vim/after/syntax/sh.vim >to apply settings that actually *are* unique to Korn shell and its >derivatives.
2017-10-30Add detection, tweak indent/whitespace for CSV/TSVTom Ryder2-0/+14
Vim does not seem to have any built-in detection or settings for CSV or TSV files, so I've added a couple here, based on filename patterns matching the .csv and .tsv extensions. If either of these types are detected, the 'autoindent' and 'expandtab' options are both switched off, as they're undesirable, especially in TSVs where a literal tab is almost certainly what's intended. Ideally, these same two setting would apply to any filetype not otherwise categorisable, but I can't figure out a way to do that safely yet; there was an attempt made in d3d998c.
2017-10-30Use :setfiletype in lieu of :setlocal filetype=Tom Ryder3-5/+5
Use this recommended syntax in the custom ftplugin settings. Seems to be the recommended way to set filetype idempotently, and is present even in very old Vim (6.2 tested). From the Vim documentation for :setfiletype: >Set the 'filetype' option to {filetype}, but only if not done yet in a >sequence of (nested) autocommands. This is short for: > :if !did_filetype() > : setlocal filetype={filetype} > :endif >This command is used in a filetype.vim file to avoid setting the >'filetype' option twice, causing different settings and syntax files to >be loaded.
2017-10-30Use consistent long-line indentTom Ryder1-2/+2
Use four spaces for the indent of lines that are continuations of the previous line, using VimL's bizarre backslashed syntax, to keep them distinct from the indentation to show control structures.
2017-10-30Merge two ftdetect rules for Muttrc filesTom Ryder1-7/+1
Put the patterns together with a comma to keep them in the same rule. I suspect my original intention was to keep things clear, but this doesn't seem so bad now.
2017-10-30Clear autocommands in ftdetect augroupsTom Ryder3-0/+3
Clear autocommand definitions for each of the ftdetect augroups with `autocmd!` as the first command within them. This avoids ending up with doubled-up autocmd definitions if the configuration file is re-sourced, and is pretty standard good Vimscript practice. It's done correctly elsewhere in my Vim configuration, for example in config/undo.vim, but it's been unintentionally omitted here.
2017-10-30Move vim/after/ftdetect to vim/ftdetectTom Ryder3-0/+49
There's no particular reason to run these file detection rules after the plugins have run, so we'll put them in a more expected directory. I've created a new Makefile target to install this, `install-vim-ftdetect`, which is included as a prerequisite of the `install-vim` target.