path: root/vim/ftplugin
AgeCommit message (Collapse)AuthorFilesLines
2018-07-17Add my own ftplugin for awkTom Ryder1-0/+9
An official one only got added in early 2016, and it does almost nothing; may as well implement my own instead.
2018-07-12Add ftplugin for tmuxTom Ryder1-0/+9
Just with comment formatting rules--there's no stock ftplugin in Vim at the moment, just a syntax file.
2018-07-10Move after/ftplugin/sed.vim to ftplugin/sed.vimTom Ryder1-0/+9
Vim doesn't have a stock ftplugin for sed at all (just syntax), so this can be our base one.
2018-07-10Clean up existing ftplugins a bitTom Ryder3-5/+9
2018-06-30Add comments to vim ftpluginsTom Ryder3-0/+9
2018-06-30Add CSV, TSV, and password file filetypesTom Ryder3-0/+15
2018-06-30Remove ftplugin overrides for html/markdownTom Ryder2-10/+0
No longer needed
2018-06-30Review vim/ftplugin and vim/indent filesTom Ryder2-51/+2
2018-06-23Correct Vim 'formatlistpat' def for MarkdownTom Ryder1-2/+2
2018-06-23Correct an exists() call in markdown ftpluginTom Ryder1-1/+1
Evidently copy-pasted from documentation.
2018-06-16Consistently require 'nocompatible' for ftpluginsTom Ryder2-26/+2
2018-06-06Check for 'formatlistpat' option existenceTom Ryder1-3/+5
2018-06-05Restore ftplugin extras to vim/after dirTom Ryder3-186/+0
This reverts commit a14bc50. Changed my mind; decided it's tidier this way.
2018-06-05Add ftplugin infrastructure and commentsTom Ryder1-6/+16
Preparing for spinoff release
2018-06-05Add global options for markdown_autoformat.vimTom Ryder1-13/+19
2018-06-05Use += shorthand in Vim ftpluginTom Ryder1-1/+1
We're already very dependent on Vim >=7 for this ftplugin, so we may as well use all its syntactic sugar.
2018-06-05Pass in mapped key directly, not a flagTom Ryder1-8/+4
This seems obvious now.
2018-06-04Use correct function for function existence checkTom Ryder1-3/+3
2018-06-04Move Markdown and PHP ftplugins from after dirTom Ryder3-0/+174
Because we use our own private copies of the primary filetype plugins, they'll get loaded in the correct order from here. Also adjust Makefile to accommodate the extra level.
2018-06-04Make private copy of ftplugin/markdown.vimTom Ryder1-0/+43
2018-06-04Correct a comment in ftplugin/php.vimTom Ryder1-1/+1
2018-02-01Replace ftplugin/php.vim with custom versionTom Ryder1-0/+38
Per the comment in the new file, this is to avoid loading in HTML ftplugins as well, a curiosity of the stock ftplugin/php.vim file that's probably a well-intentioned way of accommodating templated files with a mix of PHP and HTML in them.
2017-11-12Move lots of local Vim config into vim/afterTom Ryder7-141/+0
This is a relatively drastic change that should have been done progressively, but I got carried away in ripping everything out and putting it back in again. Reading the documentation for writing a Vim script (:help usr_41.txt), I am convinced that all of the content that was in the vim/ftplugin directory and some of the vim/indent directory actually belonged in vim/after/ftplugin and vim/after/indent respectively. This is because the section on filetypes makes the distinction between replacing the core filetype or indent plugins and merely adding to or editing them after the fact; from :help ftplugin: > If you do want to use the default plugin, but overrule one of the > settings, you can write the different setting in a script: > > setlocal textwidth=70 > > Now write this in the "after" directory, so that it gets sourced after > the distributed "vim.vim" ftplugin after-directory. For Unix this > would be "~/.vim/after/ftplugin/vim.vim". Note that the default > plugin will have set "b:did_ftplugin", but it is ignored here. Therefore, I have deleted the user_indent.vim and user_ftplugin.vim plugins and their documentation that I wrote, and their ftplugin.vim and indent.vim shims in ~/.vim, in an attempt to make these plugins elegantly undo-ready, and instead embraced the way the documentation and $VIMRUNTIME structure seems to suggest. I broke the ftplugin files up by function and put them under subdirectories of vim/after named by filetype, as the 'runtimepath' layout permits. In doing so, I also carefully applied the documentation's advice: * Short-circuiting repeated loads * Checking for existing mappings using the <Plug> prefix approach * Avoiding repeated function declarations overwriting each other * Guarding against 'cpotions' mangling things (by simply short-circuiting if 'compatible' is set). I've made the b:undo_ftplugin and b:undo_indent commands less forgiving, and append commands to it inline with the initial establishment of the setup they're reversing, including checking that the b:undo_* variable actually exists in the first place. For the indentation scripts, however, three of the four files originally in vim/indent actually do belong there: 1. csv.vim, because it doesn't have an indent file in the core. 2. tsv.vim, because it doesn't have an indent file in the core. 3. php.vim, because it does what ftplugins are allowed to do in preventing the core indent rules from running at all. The indent/vim.vim rules, however, have been moved to after/indent/vim.vim, because the tweaks it makes for two-space indentation are designed to supplement the core indent rules, not replace them. Finally, I've adjusted Makefile targets accordingly for the above, given the vim/ftplugin directory is now empty and there are three new directories in vim/after to install. We wrap these under a single `install-vim-after` parent target for convenience. The `install-vim-after-ftplugin` target accommodates the additional level of filetype directories beneath it.
2017-11-08Correct prefix for b:undo_* variableTom Ryder1-1/+1
This was causing nasty errors whenever I started editing a Perl file.
2017-11-08Use "nunmap" not "unmap" for b:undo_* varTom Ryder2-5/+5
We only want to remove the normal mode mapping, since that's all we set.
2017-11-08Remove null command from b:undo_* variablesTom Ryder3-6/+6
I didn't realise that a null command at the front of .e.g '|cmd|cmd2' printed the current line! Removed that.
2017-11-08Use consistent/thorough ftplugin/indent unloadingTom Ryder7-7/+32
Unload all maps too, with silent! in case they don't exist.
2017-11-08Break a long conditional in vim/ftdetect/sh.vimTom Ryder1-1/+2
Just for legibility.
2017-11-08Rename b:check and b:lint with sh_ prefixTom Ryder1-9/+9
Just to reduce the chance of colliding with existing buffer variable names.
2017-11-08Remove overkill defined-and-false check of sh varsTom Ryder1-4/+4
syntax/sh.vim only uses the existence of these variables for its checks and as far as I can see never their actual values, so let's not overdo things.
2017-11-08Clear b:check/lint in ftdetect/sh.vim b:undoTom Ryder1-1/+1
2017-11-08Move ftplugin/sh.vim b:undo def to end of fileTom Ryder1-2/+4
2017-11-08Use correct undo variable name in ftplugin/sh.vimTom Ryder1-1/+1
This was likely a copy-paste error.
2017-11-08Use sh.vim local vars not global POSIX hacksTom Ryder1-19/+14
Rather than setting g:is_posix and working around core syntax/sh.vim's ideas about Korn and POSIX shells, forego sh.vim's efforts to guess what shell the system /bin/sh is entirely. It's irrelevant to me anyway, since I'll often be writing shell scripts to run on an entirely different system. Instead, if we have a #!/bin/sh shebang reflected in the b:is_sh variable set by core filetype.vim, and we don't have any other buffer-level indication of what shell this is, assume it's POSIX, because I very rarely write Bourne. Then, after the syntax file is loaded, clear away all but one of the resulting b:is_* variables. I have a feeling this is going to end with me re-implementing this syntax file, possibly as separate sh.vim, bash.vim, and ksh.vim files.
2017-11-07Add user_ftplugin.vim and user_indent.vim pluginsTom Ryder4-28/+8
This reverts commit 09b83b6 and replaces it with a working version. Because of the order in which the autocmd hooks run, the attempted method of adding unloading instructions for my custom ftplugin and indent rules to the b:undo_ftplugin and b:undo_indent doesn't actually work. This is because the custom rules for both groups from ~/.vim are sourced *first*, before their core versions, so the changes the custom rules made to b:undo_ftplugin and b:undo_indent are simply clobbered by the core version when it loads itself. Therefore we need to arrange for two things: 1. A custom variable needs to be checked and executed when the filetype changes to revert the changes for the custom ftplugin or indent rules. 2. That execution needs to take place *first* when the filetype changes. I wrote two simple plugins with very similar code that are designed to run as a user's custom ftplugin.vim and indent.vim implementations, running before their brethren in the Vim core, and setting up an autocmd hook to :execute b:undo_user_ftplugin and b:undo_user_indent plugin respectively. This seemed to work well, so I've implemented it. It involves adding a shim to ~/.vim/indent.vim and ~/.vim/ftplugin.vim to "preload" the plugin when the `filetype indent plugin on` call is made. I've added that to the relevant Makefile targets.
2017-11-07Use b:undo variables correctlyTom Ryder4-0/+36
Setting or adding to b:undo_indent and b:undo_ftplugin variables, which I only learned about just now, allows me to avoid the _GLOBAL.vim hack and remove some files from both vim/indent/ and vim/ftplugin/. These variables aren't subjected to :execute automatically in anything older than Vim 7.0, but I don't think that's too much of a concern as the only real reason they're needed are for changing filetypes in the same buffer, which doesn't happen that often anyway.
2017-11-05Put missing exclamation mark back into shell checkTom Ryder1-1/+1
Looks like this was mistakenly omitted in commit 09f8635.
2017-11-04Simplify shell linting code with single varsTom Ryder1-8/+8
Put the entire command line for the determined check and lint into the variable, so it can just be directly executed.
2017-11-04Adjust plugin code layout a lotTom Ryder4-15/+26
Including renaming big_file.vim and accompanying functions yet again, to big_file_options.vim. Trying to keep complex autocmd and mapping definitions on long lines broken up semantically; definition and options on one line, patterns or mapping key on the next, and the command to run on the last. Also trying to make sure that <silent>, <buffer>, and <unique> are applied in the correct places, and that all mapping commands are using the :<C-U> idiom for the command prefix.
2017-11-04Add lint mapping for VimscriptTom Ryder1-0/+5
Runs `vint -s`; the -s includes stylistic suggestions.
2017-11-04Add check and lint mappings for shell scriptTom Ryder1-0/+22
The commands to use in this case are dependent on the particular shell being used.
2017-11-04Add tidy mapping for HTMLTom Ryder1-0/+4
This mapping mirrors the one for Perl that passes the content of the buffer through a program to tidy it (i.e. not merely check but actively change it). The tidy(1) option chosen here, -quiet, is the bare minimum to make this invocation useful. We would never want the boilerplate it otherwise emits to be in the buffer after a call. Everything else should be applied in a configuration file, which I'll do in a separate feature.
2017-11-04Break long lines in check/lint/tidy mappingsTom Ryder2-5/+12
2017-11-04Make all lint/check/tidy maps local and silentTom Ryder2-5/+5
That is, apply <buffer> and <silent> to each of them, to make them only apply to the current buffer and to prevent them from echoing the command they're running.
2017-11-03Improve comments on check/lint/tidy mapsTom Ryder2-4/+4
2017-11-03Use long form options for tidy(1) Vim callTom Ryder1-2/+2
2017-11-03Use direct :write !cmd instead of shellescape()Tom Ryder2-17/+7
This is a much better method of calling external programs on the buffer's contents, not just because it avoids the mess of :execute evaluation but also because it doesn't require that there actually be a filename for the current buffer. This drastically simplifies the HTML tidy(1) call in particular.
2017-11-03Use full ':execute' not just ':exe' in VimLTom Ryder2-3/+3
We should probably avoid this sort of abbreviation in scripts.
2017-11-03Check for availability of Vim shellescape()Tom Ryder2-10/+17
It doesn't seem to be in very old Vims; worth testing for to avoid errors if I try to use the function.
2017-11-03Revert "Adjust UrlLink() to yank word without t...Tom Ryder1-3/+1
I thought text objects were introduced to Vim a lot later than they actually were; this works fine even in Vim 6, so I'll leave it as it's nicer. This reverts commit ffb5cbc7c681e2fdcb780dbdc51cf3458a937791.