path: root/vim
AgeCommit message (Collapse)AuthorFilesLines
2017-11-12Add guards for presence of b:undo_* varTom Ryder15-78/+158
This variable is not set in older Vims (early 6.x), and I think it's worth guarding for.
2017-11-12Exclude SC1090 (failed source) shellcheck errorTom Ryder1-3/+3
This error seems to be raised when ShellCheck can't source a file because its filename is not known until runtime. I don't want it to do that anyway, so I've just excluded it by default.
2017-11-12Move lots of local Vim config into vim/afterTom Ryder41-292/+413
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-11Add author/license boilerplate to all pluginsTom Ryder2-0/+6
user_ftplugin.vim and user_indent.vim seem to be missing it.
2017-11-11Merge branch 'feature/vim-mutt-plug' into developTom Ryder3-0/+76
* 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
2017-11-11Move mutt_mail.vim line select logic into pluginTom Ryder2-10/+19
This makes the configuration shorter and easier to read.
2017-11-11Add new mail_mutt.vim plugin, apply mappingsTom Ryder3-8/+65
This plugin provides a shortcut for staring email messages in Mutt with a range of lines.
2017-11-10Sort 'shortmess' flag settings alphabeticallyTom Ryder1-6/+6
2017-11-10Add 'o' and 'O' back into 'shortmess'Tom Ryder1-0/+4
These flags prevent multiple messages from reading or writing multiple files from queuing up and forcing an enter prompt. They're part of the default, which is why I didn't notice their absence until I tried using the setting previous to this commit and opened two files at once.
2017-11-10Set up individual flags for 'shortmess'Tom Ryder1-2/+23
Most of these are actually the default; may as well explicitly set and document them, however. t and T in particular are new.
2017-11-10Use exists+ test rather than exists&Tom Ryder5-6/+6
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')
2017-11-10Adjust some whitespace and comment layoutTom Ryder7-3/+12
2017-11-10Move matchit.vim sourcing into plugin.vimTom Ryder2-4/+4
2017-11-10Rename netrw.vim to plugin.vimTom Ryder1-0/+0
For plugin-specific configuration.
2017-11-10Remove 'shellslash' settingTom Ryder1-6/+0
This will allow the Windows-specific stuff in my new auto_* plugins to quote filenames correctly.
2017-11-10Move fedora.vim into os.vimTom Ryder1-0/+0
For OS-dependent config.
2017-11-10Remove 'tildeop' settingTom Ryder1-3/+0
I never use it. May as well defer to the vi default.
2017-11-10Rearrange three smaller files into display.vimTom Ryder5-18/+20
2017-11-10Move 'paste' options into terminal.vimTom Ryder2-6/+7
'paste' is specific to the terminal only anyway.
2017-11-10Move wildmenu config into completion.vimTom Ryder2-23/+24
2017-11-10Rename complete.vim to completion.vimTom Ryder1-0/+0
Clearer filename and more consistent to use the noun.
2017-11-10Rename term.vim to terminal.vimTom Ryder1-0/+0
A little clearer and a needless abbreviation anyway.
2017-11-10Rename yank.vim to registers.vimTom Ryder1-0/+0
More likely to share options this way.
2017-11-10Move nrformats.vim content to format.vimTom Ryder2-3/+4
2017-11-10Rename startup.vim to messages.vimTom Ryder1-0/+0
More accurate given the content, and more likely to have other options set in it.
2017-11-10Merge encoding.vim and file.vim into files.vimTom Ryder2-4/+5
2017-11-10Move backup, swap, and undo dir logic into pluginsTom Ryder9-71/+235
2017-11-10Merge join,indent.vim into whitespace.vimTom Ryder3-31/+33
2017-11-10Append angle brackets rather than resetting optTom Ryder1-1/+1
2017-11-10Remove setting for 'tabstop'Tom Ryder1-3/+0
:help 'tabstop' says that setting it may be a bad idea: > Note: Setting 'tabstop' to any other value than 8 can make your file > appear wrong in many places (e.g., when printing it). On thinking about it, it's actually probably better to show literal tabs as eight screen spaces, as it will make it very obvious when there are tabs in the file.
2017-11-09Remove false error flagging for sh char class globTom Ryder1-0/+5
The syntax highlighter flags this code with an error on the final square bracket: `case $foo in [![:ascii:]]) ;; esac`, but that's all legal. I'm not yet sure how to fix it, so will just turn the error group for now.
2017-11-09Fix 'while'/'until' highlighting in syntax/sh.vimTom Ryder1-0/+14
These two changes coax syntax/sh.vim into realising that POSIX shell does not specify 'until' as a builtin (that's a Bash/Ksh thing), and that POSIX shell is able to nest 'while' loops within other blocks (that's not a Bash/Ksh thing).
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-08Beginnings of a buffer-to-Mutt mailer pluginTom Ryder1-0/+10
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 Ryder10-13/+40
Unload all maps too, with silent! in case they don't exist.
2017-11-08Add clustering for POSIX shell syntax groupsTom Ryder1-0/+3
This is what was missing after I initially redefined these groups and stopped all POSIX shell scripts thinking they were POSIX. The words now highlight correctly when within control structures again.
2017-11-08Add `kill` as shStatementTom Ryder1-0/+1
It's not a shell builtin in `dash`, but it is in `Bash`, and I kind of think of it that way.
2017-11-08Add `break`, `continue`, `return` as shStatementTom Ryder1-1/+5
2017-11-08Override commands and variables for syntax/sh.vimTom Ryder1-0/+76
The defaults for these groups don't make much sense to me, so I completely reset them. This isn't quite complete yet; for some reason as soon as e.g. an IFS= setting is contained in e.g. an "if" or "while" block, they don't highlight correctly anymore. There's probably some other part of the core syntax/sh.vim file I need to include here.
2017-11-08Disable unwanted shell error syntax for any shellTom Ryder1-12/+7
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-08Remove superfluous augroups around ftdetect defsTom Ryder5-43/+27
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.
2017-11-08Use sh.vim local vars not global POSIX hacksTom Ryder2-26/+23
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.