aboutsummaryrefslogtreecommitdiff
path: root/vim/indent
Commit message (Collapse)AuthorAgeFilesLines
* Turn off Vim 'softtabstop' for CSV and TSV filesTom Ryder2018-02-172-2/+4
| | | | | Otherwise entering a Tab in insert mode inserts four spaces. I'm not sure how I didn't notice this before.
* Adjust explanation of PHP indent skipTom Ryder2018-02-011-3/+9
| | | | Include the variable guard, just for completeness' sake.
* Break some continued lines in Vim indent filesTom Ryder2018-01-212-4/+2
| | | | | This will mean they load correctly when the 'C' flag preventing line-breaking is in 'cpoptions', and 'compatible' is set.
* Move lots of local Vim config into vim/afterTom Ryder2017-11-123-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use consistent/thorough ftplugin/indent unloadingTom Ryder2017-11-083-6/+8
| | | | Unload all maps too, with silent! in case they don't exist.
* Add user_ftplugin.vim and user_indent.vim pluginsTom Ryder2017-11-073-19/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Use b:undo variables correctlyTom Ryder2017-11-079-32/+21
| | | | | | | | | | | 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.
* Use spaces around concat dots in VimL consistentlyTom Ryder2017-11-041-3/+3
|
* Reload indent global defaults before each filetypeTom Ryder2017-10-313-0/+9
| | | | | | Just to be comprehensive, reinstate the global defaults for all the indenting options via the indent/_GLOBAL.vim stub each time the filetype is changed.
* Use clunkier, more compatible indent option resetTom Ryder2017-10-311-6/+5
| | | | | | This method of re-setting the numeric indent local options to their global analogues looks a bit gross, but seems to work on much older versions of Vim (6.2 in this testing).
* Move non-indent HTML Vim config indent->ftpluginTom Ryder2017-10-301-12/+0
| | | | | This was mistakenly moved along with some indentation settings in 9858af6.
* Use correct syntax for numeric indent resetsTom Ryder2017-10-301-3/+3
| | | | | | These trailing equals signs were vestigial from an attempt in f33111b to use what I thought was a backwards-compatible syntax for resetting a local option to its global state.
* Use version guard around numeric indent resetsTom Ryder2017-10-301-3/+8
| | | | | | | | | | | | | | My old 6.2 version of Vim tolerates neither `option<` nor `option=` syntax for resetting local versions of these options, so I'm just going to have to guard against running those commands on ancient Vim for now. They seem to work correctly on 7.0. :setlocal shiftwidth< Number required after =: shiftwidth< :setlocal shiftwidth= Number required after =: shiftwidth= :setlocal shiftwidth=0 Argument must be positive: shiftwidth=0
* Use backward-compat syntax for reset indent optsTom Ryder2017-10-301-3/+3
| | | | | | | For compatibility with older versions of Vim, string-based (not boolean) options need to be reset with `setlocal option=`, rather than `<`. New versions of Vim tolerate the latter for the string values, and do what you meant.
* Add autoindent and expandtab to indent _GLOBALTom Ryder2017-10-301-0/+2
| | | | | | This will mean the correct value is restored for filetypes that source this file as part of their indent processing, and won't stay broken if we switched from e.g. CSV or TSV.
* Use a common file to restore global indent optsTom Ryder2017-10-306-31/+17
| | | | | | Remove the duplicated code instated to use the global defaults for indent-related options and put it into a common file to source with :runtime.
* Move filetype-specific indent options into indent/Tom Ryder2017-10-308-0/+53
| | | | | | 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.
* Move PHP indent nixing into ~/.vim/indentTom Ryder2017-10-301-0/+4
This method short-circuits the unwanted PHP expression-based indenting configuration completely, rather than running it all and then undoing it after the fact. This involves creating a new direction ~/.vim/indent, and a Makefile target install-vim-indent to copy everything into it.