aboutsummaryrefslogtreecommitdiff
path: root/vim/ftplugin/html.vim
Commit message (Collapse)AuthorAgeFilesLines
* Move lots of local Vim config into vim/afterTom Ryder2017-11-121-36/+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.
* Remove null command from b:undo_* variablesTom Ryder2017-11-081-2/+2
| | | | | I didn't realise that a null command at the front of .e.g '|cmd|cmd2' printed the current line! Removed that.
* Use consistent/thorough ftplugin/indent unloadingTom Ryder2017-11-081-0/+6
| | | | Unload all maps too, with silent! in case they don't exist.
* Adjust plugin code layout a lotTom Ryder2017-11-041-5/+10
| | | | | | | | | | | | | 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.
* Add tidy mapping for HTMLTom Ryder2017-11-041-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.
* Break long lines in check/lint/tidy mappingsTom Ryder2017-11-041-2/+4
|
* Make all lint/check/tidy maps local and silentTom Ryder2017-11-041-2/+2
| | | | | | 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.
* Improve comments on check/lint/tidy mapsTom Ryder2017-11-031-1/+1
|
* Use long form options for tidy(1) Vim callTom Ryder2017-11-031-2/+2
|
* Use direct :write !cmd instead of shellescape()Tom Ryder2017-11-031-6/+1
| | | | | | | | | 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.
* Use full ':execute' not just ':exe' in VimLTom Ryder2017-11-031-1/+1
| | | | We should probably avoid this sort of abbreviation in scripts.
* Check for availability of Vim shellescape()Tom Ryder2017-11-031-4/+6
| | | | | It doesn't seem to be in very old Vims; worth testing for to avoid errors if I try to use the function.
* Revert "Adjust UrlLink() to yank word without t...Tom Ryder2017-11-031-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.
* Adjust UrlLink() to yank word without text objectsTom Ryder2017-11-031-1/+3
|
* Refactor UrlLink() function normal! commandsTom Ryder2017-11-031-2/+10
| | | | | | | | | Tidy up the 'normal!' commands and comment them in appropriate groups. Take advantage of the natural command-termination at the end of a 'normal!' string to end insert mode. It would be better to do all of this with pure VimL functions, but I don't know how yet.
* Use single quotes for HTML link mapping :executeTom Ryder2017-11-031-2/+2
| | | | Saves some backslashing, just like in shell and Perl!
* Refactor HTML tidy(1) mappingTom Ryder2017-11-031-1/+4
| | | | | Move the logic into a script function. Use single quotes for the strings, too, since we don't need interpolation.
* Use <Leader>/<LocalLeader> correctly in Vim configTom Ryder2017-11-031-2/+2
| | | | | | | From ":help <LocalLeader>": > In a global plugin <Leader> should be used and in a filetype plugin > <LocalLeader>. "mapleader" and "maplocalleader" can be equal.
* Apply name conventions, scoping to Vim identifiersTom Ryder2017-10-301-2/+2
| | | | | | | | | | | | | | | | | | 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.
* Merge branch 'vim/vint'Tom Ryder2017-10-301-4/+4
|\ | | | | | | | | | | The Vim configuration, excluding the submodule plugin bundles, now passes a strict run of the vim-vint tool. There's also now a `lint-vim` target in the Makefile.
* | Move non-indent HTML Vim config indent->ftpluginTom Ryder2017-10-301-0/+11
|/ | | | | This was mistakenly moved along with some indentation settings in 9858af6.
* Move filetype-specific indent options into indent/Tom Ryder2017-10-301-18/+0
| | | | | | I'm still getting used to the structure of the configuration here, and had mistakenly put these indent-related settings into files in the ftplugin directory.
* Add some more file-specific indent preferencesTom Ryder2017-10-301-0/+7
| | | | | | | | | | For some languages in which I write often: C, HTML, Perl, PHP, and shell scripts. All of these values presently match the defaults specified in config/indent.vim, but for languages I commonly use it's probably appropriate to have files to set the indent settings explicitly anyway, especially if we switched from a filetype with different values.
* Move vim/after/ftplugin files into vim/ftpluginTom Ryder2017-10-301-0/+11
None of the settings in here need to be run after the core configuration files are loaded, so I'll put them in a slightly more accessible or logical place. This adds a new target `install-vim-ftplugin`, and makes that a prerequisite of the `install-vim` target.