| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
This isn't strictly necessary, as it's sourced into the group from
filetype.vim, but making it explicit appeases vint.
|
| |
|
|
|
|
| |
And add .vim/script.vim, to be composed in the next commit
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
No longer applicable since pathogen.vim was removed in 3e2740f.
|
|
|
|
|
| |
Looks like these were getting categorised as "rc", or "M$ Resource
files", in the core filetype.vim.
|
|
|
|
|
| |
This matches .txt files in any 'doc' directory with 'vim' or '.vim' in
its ancestry.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
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.
|