aboutsummaryrefslogtreecommitdiff
path: root/vim/plugin
Commit message (Collapse)AuthorAgeFilesLines
* Add author/license boilerplate to all pluginsTom Ryder2017-11-112-0/+6
| | | | user_ftplugin.vim and user_indent.vim seem to be missing it.
* Merge branch 'feature/vim-mutt-plug' into developTom Ryder2017-11-111-0/+56
|\ | | | | | | | | | | | | * feature/vim-mutt-plug: Move mutt_mail.vim line select logic into plugin Add new mail_mutt.vim plugin, apply mappings Beginnings of a buffer-to-Mutt mailer plugin
| * Move mutt_mail.vim line select logic into pluginTom Ryder2017-11-111-0/+15
| | | | | | | | This makes the configuration shorter and easier to read.
| * Add new mail_mutt.vim plugin, apply mappingsTom Ryder2017-11-111-0/+41
| | | | | | | | | | This plugin provides a shortcut for staring email messages in Mutt with a range of lines.
* | Use exists+ test rather than exists&Tom Ryder2017-11-102-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From :help hidden-options: >Not all options are supported in all versions. This depends on the >supported features and sometimes on the system. A remark about this is >in curly braces below. When an option is not supported it may still be >set without getting an error, this is called a hidden option. You can't >get the value of a hidden option though, it is not stored. > >To test if option "foo" can be used with ":set" use something like this: > if exists('&foo') >This also returns true for a hidden option. To test if option "foo" is >really supported use something like this: > if exists('+foo')
* | Move backup, swap, and undo dir logic into pluginsTom Ryder2017-11-103-0/+169
|/
* Add user_ftplugin.vim and user_indent.vim pluginsTom Ryder2017-11-072-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add commands to copy_linebreak.vimTom Ryder2017-11-071-1/+14
| | | | | | Just to be thorough; if +user_commands are available, offer :CopyLinebreakEnable, :CopyLinebreakDisable, and :CopyLinebreakToggle commands.
* Give copy_linebreak.vim enable/disable funcs, mapsTom Ryder2017-11-071-22/+34
| | | | | Add s:CopylinebreakDisable() and s:CopylinebreakEnable functions, and mapping targets for each of them, just to be thorough.
* Add :FixedJoin commandTom Ryder2017-11-071-2/+9
| | | | | This is optiona; if the user's Vim doesn't have the 'user_commands' feature, the command will just quietly not be created.
* Add :StripTrailingWhitespace commandTom Ryder2017-11-071-2/+9
| | | | | This is optional; if the user's Vim doesn't have the 'user_commands' feature, the command will just quietly not be created.
* Use consistent comment layout for Vim pluginsTom Ryder2017-11-064-9/+11
|
* Refactor toggle_option_flag.vimTom Ryder2017-11-061-23/+58
| | | | | | | | | | Got carried away and rewrote a lot of this all in one hit. * Show single-line error messages with an s:Error() function * Flag early errors on nonexistent options * Test for the flag both before and after trying to toggle it to use as the basis for error reporting and return value, in a new s:Has() function
* Correct a commentTom Ryder2017-11-061-1/+1
| | | | This likely got butchered by a wayward search-and-replace.
* Use stridx() instead of very-nomagic regex matchTom Ryder2017-11-061-9/+10
| | | | | I couldn't find this function at first, but it's what I need: a way to check whether a string appears in another one.
* Use strlen() instead of len()Tom Ryder2017-11-061-1/+1
| | | | | | strlen() is older, and also more specific to what we want to do. len() just happens to work on strings, but was introduced for counting Lists and Dictionaries.
* Escape option value assign correctlyTom Ryder2017-11-061-1/+1
| | | | This allows e.g.: ':ToggleOptionFlag fillchars diff: '; note the whitespace!
* Extend toggle_option_flag.vim for string flagsTom Ryder2017-11-061-13/+22
| | | | | | | | This commit extends toggle_option_flag.vim to allow the exported commands to toggle values of more than one character, for comma-separated options like 'switchbuf', e.g.: :ToggleOptionFlag switchbuf useopen
* Rename l:op to l:operation for clarityTom Ryder2017-11-061-3/+3
| | | | Just to avoid confusing it with something like l:option.
* Separate command building from execution in toggleTom Ryder2017-11-061-3/+7
| | | | | These are functionally equivalent; it's just clearer and more editing-friendly to do one thing at a time.
* Use idiomatic VimL regex for param validationTom Ryder2017-11-061-2/+2
| | | | \a and \L are, I think, perlre-style VimL regex inventions.
* Restore some judicious \m\C hedging in VimTom Ryder2017-11-062-4/+4
| | | | | These are technically not really needed, but this is more consistent with good style recommendations in the Google VimScript style guide.
* Caution about :execute not eval() in VimL commentsTom Ryder2017-11-061-3/+3
| | | | May as well refer to the actual command I'm using.
* Remove \m\C prefix from inapplicable VimL regexesTom Ryder2017-11-061-2/+2
|
* Don't overwrite plugin-specified user commandsTom Ryder2017-11-062-11/+11
| | | | | | | | | | | | | The Google Vimscript Style Guide says: <https://google.github.io/styleguide/vimscriptguide.xml#Commands> > Excluding [!] prevents your plugin from silently clobbering existing > commands. Command conflicts should be resolved by the user. This makes sense to me as we can think of <Plug> mapping and user commands as being the user-accessible portion of the interface, rather than the functions which can be properly namespaced with autoload#Syntax(), if exposed at all.
* Complete ToggleOptionFlag commands with opt namesTom Ryder2017-11-061-2/+2
| | | | | Only a small subset of option names actually apply, so I'm not entirely sure this is actually better than nothing.
* Don't report lines deleted after stripping spaceTom Ryder2017-11-051-1/+1
| | | | | Prepend the line :delete command with a :silent to stop it reporting the number of lines it removed.
* Use BufReadPost hook for big_file_options.vimTom Ryder2017-11-051-4/+4
| | | | | | | Using BufReadPre meant that it was too early to set the 'syntax' option locally for the buffer. This fixes that, and also works correctly for cases where the buffer does not necessarily correspond to a file on disk.
* Add short-circuit boilerplate to pluginsTom Ryder2017-11-046-199/+221
| | | | | | | | | | | | | | | | | | | | Set a g:loaded_* flag to prevent repeated reloads, and refuse to load at all if &compatible is set or if required features are missing. Some more accommodating plugins avoid the problems 'compatible' causes by saving its value at startup into a script variable, setting the option to the Vim default, and then restoring it when the plugin is done, to prevent any of its flags from interfering in the plugin code: let s:save_cpo = &cpo set cpo&vim ... let &cpo = s:save_cpo unlet s:save_cpo I don't want this boilerplate, so I'm going to do what Tim Pope's modules seem to, and just have the plugin refuse to do a single thing if 'compatible' is set.
* Merge branch 'feature/space-dots' into developTom Ryder2017-11-042-2/+2
|\ | | | | | | | | * feature/space-dots: Use spaces around concat dots in VimL consistently
| * Use spaces around concat dots in VimL consistentlyTom Ryder2017-11-042-2/+2
| |
* | Adjust plugin code layout a lotTom Ryder2017-11-046-25/+58
|/ | | | | | | | | | | | | 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.
* Rename toggle plugin again, use commands not funcsTom Ryder2017-11-041-0/+44
| | | | | | This method makes a bit more sense, and amounts to slightly less verbose mapping commands. It does really on the +user_commands feature being available, however.
* Use same comment boilerplate for custom pluginsTom Ryder2017-11-045-1/+17
| | | | A brief explanation, an author name, and the license should do fine.
* Check 'eval' feature for loading command_typos.vimTom Ryder2017-11-041-1/+1
| | | | | I strongly suspect the presence of 'user_commands' implies it, but I'm not sure.
* Don't suggest mappings in Vim plugin commentsTom Ryder2017-11-044-60/+0
| | | | Pretty useless, really.
* Spin 'fo' toggle out into new flag toggler pluginTom Ryder2017-11-041-0/+54
| | | | | | | | | This is an experimental new plugin that provides a command to toggle individual single-character flags in an option with a value of a set of such flags, in my case 'formatoptions'. A fair bit of evil eval()ing via :execute here, but I've tried to control it with some strict patern matching.
* Spin copyable linebreak config into new pluginTom Ryder2017-11-041-0/+36
| | | | | Calling this one copy_linebreak.vim. Renamed both the internal function and the plugin key.
* Spin stable join config out into new pluginTom Ryder2017-11-041-0/+26
| | | | | Again using the <Plug> mapping abstraction and not defining the mapping for the user.
* Use <Plug> prefix, make space strip configurableTom Ryder2017-11-041-4/+6
| | | | | | This properly abstracts out the StripTrailingWhitespace mapping rather than forcing it to <leader>x within the plugin itself. A bit nicer this way.
* Rename a misnamed variable in big_file.vimTom Ryder2017-11-041-4/+4
| | | | The word "size" was added to this variable's name unnecesarily.
* Rename bigfile plugin to big_fileTom Ryder2017-11-041-12/+12
| | | | | | | | Just for consistency with the other plugins I'm making. I don't think I really like the cutesy names given to Vim plugins. I prefer the slightly longer and maybe even namespaced names like Perl distributions and modules have. Let's see how well this works.
* Move trailing space strip config into pluginTom Ryder2017-11-031-0/+57
|
* Separate command typos config to pluginTom Ryder2017-11-031-0/+14
| | | | | Tentatively named command_typos.vim. I've just moved this as-is for now, but it will need review, especially the hardcoded mappings.
* Have bigfileturn local syntax off (configurably)Tom Ryder2017-11-021-0/+10
|
* Make bigfile 'synmaxcol' setting configurableTom Ryder2017-11-021-2/+7
| | | | | Defaults to 256 columns and only sets it if the option's value isn't already lower than that.
* Refactor plugin function for dependency injectionTom Ryder2017-11-021-13/+21
| | | | | | | Pass the filename to check and the size limit into the function directly from the autocmd hook. Improve commenting and spacing as we go.
* Rename variable and autocmd to use plugin prefixTom Ryder2017-11-021-4/+4
| | | | | | Just removing an underscore from the variable name so that g:big_file_size becomes g:bigfile_size, and remove the "dotfiles" prefix from the autocmd.
* Make bigfile size variable an option with defaultTom Ryder2017-11-021-2/+4
| | | | | This arranges for g:big_file_size only to set itself to 10 MiB if the variable is not already set, presumably by the user in their vimrc.
* Expand comment header for bigfile.vimTom Ryder2017-11-021-1/+8
| | | | Include some author and license metadata.