aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Correct misleading output for `lint-bin`Tom Ryder2017-10-311-1/+1
| | | | | We haven't checked all of the shell scripts, just the POSIX sh ones, which at present, is all but one of them; han(1df).
* Adjust `check-bin`, `lint-bin` for built scriptsTom Ryder2017-10-313-3/+7
| | | | | | | | | | | | | | | | Make the `$(BINS)` target a prerequisite of `check-bin` so that all of the scripts with a #!/bin/sh shebang are built, and then check them all by iterating through a glob (and hence an order according to LC_COLLATE) and stripping the `.sh` suffix to find the name of the matching shebanged script. Leverage `shellcheck`'s support of multiple check arguments to build an argument list of the binscripts first before passing all of those to a single call, simply for speed. We don't have anything in this target to test the scripts of any other type, such as the `.awk` or `.sed` scripts. `gawk` has a `--lint` mode that might apply.
* Revert "Drastically simplify `lint` scripts"Tom Ryder2017-10-318-35/+19
| | | | | | | | | | | | I forgot that the `lint` tools here need to check the *built* files, and that that's the reason the `perlcritic` check against the source .pl file was failing. While it's still true that it would be preferable to test the files found in a deterministic order, this branch's attempt to address that issue is pretty much nonsense and can be abandoned. This reverts commit 196155499c04b2c2050302e6575f1bcbbed052f1.
* Drastically simplify `lint` scriptsTom Ryder2017-10-318-19/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using find(1) to run the appropriate lint program over a set of files allows us to be terse and deal a little more dynamically with new files placed in the directories, but the downsides are that it's error-prone and that the order of testing is not predictable, and we'd ideally like the testing to be a little more deterministic than that. Case in point: writing the code for this commit unintentionally uncovered a longstanding issue where the URxvt Perl script `select.pl` was actually not being checked at all, due to an unneeded exclamation mark inverting the `-name` test for `*.pl` files. `select.pl` is presently not passing `perlcritic --brutal` on my machine, and likely has not been compliant since as early as commit 5000365 in March this year: >commit 500036564541ff2d65a7b2f6f6f556202d72d6ce >Author: Tom Ryder <tom@sanctum.geek.nz> >Date: Fri Mar 24 11:01:05 2017 > > Lots of Makefile tidying > > ... > * Favour find(1) calls over shell loops > ... This commit also more clearly delineates between the language being "linted" and the target for which it's being linted. The latter is likely more desirable. This needs clarification.
* Merge branch 'release/v0.1.0' into developTom Ryder2017-10-312-3/+3
|\
| * Remove -no_ssl2 from osc(1df)Tom Ryder2017-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Modern OpenSSL builds, at least on Debian Stretch, don't even include this as an option anymore, because SSLv2 has been so broken for so long. There's not really much point trying to keep it. $ openssl version OpenSSL 1.1.0f 25 May 2017 $ openssl -no_ssl2 Invalid command '-no_ssl2'; type "help" for a list.
| * Bump version number to v0.1.0Tom Ryder2017-10-311-2/+2
|/ | | | Preparing for first "release" under experimental git-flow based model.
* Merge branch 'feature/versioning' into developTom Ryder2017-10-311-0/+2
|\
| * Add VERSION number with null dataTom Ryder2017-10-311-0/+2
|/ | | | | | | We'll use this as the basis for a primitive versioning system as I move to a "git flow" based model for fun and practice. <http://nvie.com/posts/a-successful-git-branching-model/>
* 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).
* Remove duplicated 'encoding' Vim configurationTom Ryder2017-10-311-5/+0
| | | | | This setting is already in vim/config/encoding.vim, having been copied there in 505a2c2; it was intended to be moved rather than copied.
* Complete a partially-written commentTom Ryder2017-10-311-1/+1
| | | | This was added in 52671ad, but not finished.
* Show Vim option values after leader-key toggleTom Ryder2017-10-305-13/+12
| | | | | | | | | | | | Using the very weird syntax: :setlocal option! option? We can toggle the option and print its new value in the same line. For the line breaking options, we only show the value of the 'linebreak' option, because otherwise we print three lines of messages, which requires an <Enter> press, even if we put all three `option?` calls on one :setlocal line.
* Toggle Vim 'hlsearch' and 'incsearch' locallyTom Ryder2017-10-301-4/+4
| | | | | | | | That is, \h and \i shouldn't change the value of the search highlighting or incremental search features globally, just per-buffer. I'm not actually completely sure I want this, but it does seem tidier at the moment.
* Note that StripTrailingWhitespace() does whole docTom Ryder2017-10-301-1/+1
| | | | | Just in case somebody tried to use it to strip whitespace only from a selected range. It could maybe be extended to do this somehow.
* Move 'joinspaces' Vim config to join subfileTom Ryder2017-10-302-4/+3
| | | | | It makes much more sense in this file than it did in the whitespace configuration file.
* Reimplement stable normal-mode J join mappingTom Ryder2017-10-301-4/+24
| | | | | | | | | | | | | This is a tidier method of preserving the cursor position after a normal-mode join that doesn't involve wiping away a mark, though I don't use those too often anyway. It still works with a preceding count via the `v:count1` variable, with an accidental feature: this joins the *next* v:count1 lines, as opposed to joining a *total* of v:count1 lines counting the current one. The latter is what Vim does, but the former is what I'd actually expect, thinking of it as a "repeated operation", so I'm going to leave it this way.
* Add some comments to 'formatoptions' switchingTom Ryder2017-10-301-0/+10
| | | | Just for clarity of reading.
* Move execution out of 'formatoptions' conditionalTom Ryder2017-10-301-2/+3
| | | | Just to do one thing at a time.
* Use full `execute` command, not `exec`Tom Ryder2017-10-301-2/+2
| | | | It's probably best not to use abbreviations in scripts.
* Use clearer method for 'formatoptions' flag toggleTom Ryder2017-10-301-2/+5
| | | | | On looking at this again, I was uncomfortable with `eval`ing an operation. This seems a bit less evil.
* Use explicit case-sensitive 'formatoptions' matchTom Ryder2017-10-301-1/+1
| | | | | | | | Per Google's VimScript style recommendations <https://google.github.io/styleguide/vimscriptguide.xml>: > Always use case-explicit operators for strings (=~# and =~?, never > =~).
* Switch on local formatoptions setting, not globalTom Ryder2017-10-301-1/+1
| | | | | The actual option settings performed by the function are local, so the test should be, too.
* Append "usetab" to `switchbuf`, not switched setTom Ryder2017-10-301-4/+2
| | | | Just to avoid duplication a little; seems a little clearer this way.
* Adjust commenting and spacing of Vim wrap configTom Ryder2017-10-301-3/+18
| | | | | Essentially just breaking up the big block comment at the top into little pieces.
* Keep 'breakindent'-available flag in script varTom Ryder2017-10-301-3/+5
| | | | | | Because this is a version-based check and shouldn't change any runtime, we can just calculate it once as a variable local and persistent to this script, and then store it for reference by the toggling function.
* Rearrange two options for clarityTom Ryder2017-10-301-4/+4
| | | | | It makes more sense to discuss how something wraps after configuring whether it wraps at all.
* Toggle 'wrap' and related Vim options locallyTom Ryder2017-10-301-8/+8
| | | | | Don't change the value of these options for all buffers with the \w and \b maps, just the current one.
* Move linebreak Vim config into wrap config subfileTom Ryder2017-10-302-31/+32
| | | | | | 'linebreak', 'showbreak', 'breakindent', and 'breakindent' are only relevant when 'wrap' is on, so it makes sense for their settings to be grouped together.
* Refactor min.awk to match max.awkTom Ryder2017-10-301-4/+2
| | | | This is more idiomatic, and explicitly initialises the result variable.
* Add line deletion to StripTrailingWhitespace()Tom Ryder2017-10-301-0/+26
| | | | | | | | | | | | | | | | In addition to its existing functionality of removing trailing spaces from the ends of lines, this change has the function remove lines at the end of the file afterwards if they contain no non-whitespace characters, based on its observations during the line iteration. This uses the older VimL functions line() and col() in preference to the newer winsaveview() and winrestview() to restore the cursor position after the range :delete moves it, so that this will hopefully work even on older versions of Vim; that is not yet tested. I am surprised that there is no line deletion function to match e.g. getline(), setline(), but it does seem to be the case: <https://groups.google.com/d/msg/vim_use/TY9NmJXh8EU/iFjOUg68AekJ>
* Add some comments to Vim StripTrailingWhitespace()Tom Ryder2017-10-301-0/+18
| | | | | No functional changes; this is just to make it a little clearer before I add some more functionality to it.
* Backport StripTrailingWhitespace to pre-for VimTom Ryder2017-10-301-2/+4
| | | | | | | | | | | | | | | Use a slightly more verbose but more compatible `:while` loop to accommodate very old versions of Vim that do not have `:for`. Vim 6.2 gives the following terminal output when the `:for` version is run: Error detected while processing /home/tom/.vim/config/whitespace.vim: line 13: E193: :endfunction not inside a function However, it accepts this new version with no complaint, and the function seems to work properly.
* Move 'encoding' Vim config into subfileTom Ryder2017-10-301-0/+4
| | | | | | With the `scriptencoding` call that was in this file removed in 1834c08, there's no longer anything that's sensitive to the order in which this option is loaded relative to any other options.
* Remote `scriptencoding` definitionTom Ryder2017-10-301-2/+1
| | | | | | | There aren't actually any characters outside ASCII in any of the configuration, and for this to work they would need to have the `scriptencoding` at the head of that file, not at the top of the `.vimrc` as here, so I've just removed it.
* Apply name conventions, scoping to Vim identifiersTom Ryder2017-10-3015-26/+26
| | | | | | | | | | | | | | | | | | 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.
* Move viminfo conf from spell.vim into new subfileTom Ryder2017-10-302-12/+11
| | | | This was mistakenly moved from the monolithic .vimrc file in 07fc8ce.
* Correct two paths in README.markdownTom Ryder2017-10-301-2/+2
| | | | | We're referring to the installed path and not the sourced path in this paragraph.
* Replace PerlCritic HTTPS URL prefix with HTTPTom Ryder2017-10-302-2/+2
| | | | perlcritic.com does not seem to support HTTPS.
* Merge branch 'vim/vint'Tom Ryder2017-10-3011-29/+71
|\ | | | | | | | | | | 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.
| * Add a `lint-vim` target for linting Vim configTom Ryder2017-10-304-8/+54
| | | | | | | | | | | | | | | | | | Since I know there's a usable tool for this now in vim-vint, I may as well make a target for my own convenience later. Updated the README.markdown documentation of the `lint-*` targets, restructuring the paragraph into a nested list for clarity. Also updated the `dotfiles(7)` manual page to reflect those changes.
| * Switch to VimL functions for whitespace stripperTom Ryder2017-10-301-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vim-vint says: >Do not use a command that has unintended side effects (see Google >VimScript Style Guide (Dangerous)) >Avoid commands that rely on user settings (see Google VimScript Style >Guide (Fragile)) In both cases, it's referring to the use of :substitute in this file. The Google style guide on which vim-vint is based says <https://google.github.io/styleguide/vimscriptguide.xml?showone=Fragile_commands#Fragile_commands>: >Avoid :s[ubstitute], as its behavior depends upon a number of local >settings. It also says <https://google.github.io/styleguide/vimscriptguide.xml?showone=Dangerous_commands#Dangerous_commands>: > Avoid using :s[ubstitute] as it moves the cursor and prints error > messages. Prefer functions (such as search()) better suited to > scripts. > > For many vim commands, functions exist that do the same thing with > fewer side effects. See :help functions() for a list of built-in > functions. I reimplemented the function based on an answer I found by `romainl` to a similar question: <https://vi.stackexchange.com/a/5962> There are plenty of other trailing-whitespace-stripping solutions out there, but this one can be mine. It now passes vim-vint. I'll make a plugin out of it at some point. The \m\C shibboleth at the front of the regular expression is to enforce the 'magic' setting for the regular expression, and to enforce case-sensitivity. This is recommended by the style guide: <https://google.github.io/styleguide/vimscriptguide.xml?showone=Dangerous_commands#Regular_Expressions > Prefix all regexes with \m\C. > > In addition to the case sensitivity settings, regex behavior depends > upon the user's nomagic setting. To make regexes act like nomagic and > noignorecase are set, prepend all regexes with \m\C. > > You are welcome to use other magic levels (\v) and case sensitivities > (\c) so long as they are intentional and explicit. Before I committed this, I checked with vint -s to include stylistic recommendations as well, and it insisted on l: prefixes to the `li` and `line` variable to make them explicitly local to the function, so I did that, too.
| * Use `normal!` not `normal` in Vim config macroTom Ryder2017-10-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | vim-vint says: >Avoid commands that rely on user settings (see Google VimScript Style >Guide (Fragile)) The style guide explains: >Always use normal! instead of normal. The latter depends upon the >user's key mappings and could do anything. Can't argue with that...
| * Use single-quoted string in gvimrcTom Ryder2017-10-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | vim-vint says: >Prefer single quoted strings (see Google VimScript Style Guide >(Strings)) Perl::Critic warns about a similar thing; don't use doublequotes if you don't need to expand e.g. \n, \r or interpolate variables. Makes sense to me.
| * Remove 'nocompatible' settingTom Ryder2017-10-301-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | vim-vint says: >Do not use nocompatible which has unexpected effects (see :help >nocompatible) I can't actually find anything in the help item it references that says that setting 'nocompatible' is bad, but the situation in which it's needed is very niche anyway; per the removed comment: >Don't make any effort to be compatible with vi, use more sensible >settings. This is only here in case this file gets loaded explicitly >with -u; the mere existence of a ~/.vimrc file already turns this off. We'll just leave it out, and see if anything bad happens..."if in doubt, rip it out".
| * Use ==# consistently in Vim configTom Ryder2017-10-304-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | I got a set of warnings from vim-vint about using just "==" for these comparisons: >Use robust operators `==#` or `==?` instead of `==` (see Google >VimScript Style Guide (Matching)) It does seem a lot more sensible to be explicit about case sensitivity, and not to lean on the configured 'ignorecase' value, especially if the user changes it.
* | Move non-indent HTML Vim config indent->ftpluginTom Ryder2017-10-302-12/+11
|/ | | | | This was mistakenly moved along with some indentation settings in 9858af6.
* Update submodulesTom Ryder2017-10-301-0/+0
|
* Use conventional indent for continued VimL linesTom Ryder2017-10-308-23/+23
| | | | | | | | | | | | | | | I had four spaces, but with a 'shiftwidth' of 2, 6 is the conventional value. From :help ft-vim-indent: >For indenting Vim scripts there is one variable that specifies the >amount of indent for a continuation line, a line that starts with a >backslash: > > :let g:vim_indent_cont = &sw * 3 > >Three times shiftwidth is the default value.