| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
This is probably fighting too much against the grain, at least for now.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This is a portable method that will work on very old Vims.
|
| |
|
| |
|
|
|
|
| |
Should make testing (!) easier later on.
|
| |
|
|
|
|
|
| |
This was causing the first line of the buffer to be printed on every
filetype change from Perl.
|
|
|
|
|
|
| |
This reverts commit f0b98feb769d9dfbbb0c1825b1291851795163db.
I changed my mind again.
|
|
|
|
|
| |
This one is pretty good, but I think I'll stick with the stock one for
now.
|
|
|
|
|
| |
I'm not sure I actually want to use this anymore; will remove it for now
in the next commit.
|
|
|
|
| |
Just a plain old syntax error.
|
|
|
|
|
| |
Don't add another two spaces if we already did on a previous line; get
the "base" indent first.
|
|
|
|
|
| |
This anchors lines in a Perl heredoc with no indent until it sees the
terminating word. It works really well.
|
|
|
|
|
| |
I think this is mixing two changes I made, which I neglected to commit
separately.
|
|
|
|
|
| |
The modulo operator has a higher precedence than the subtraction
operator, so it doesn't need to be cuddled.
|
|
|
|
|
|
| |
The version of this indent script bundled with Vim sets the 'indentexpr'
and 'indentkeys' options before the GetPerlIndent() function; may as
well follow that pattern.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
From `:help shiftwidth()`:
> Returns the effective value of 'shiftwidth'. This is the 'shiftwidth'
> value unless it is zero, in which case it is the 'tabstop' value. This
> function was introduced with patch 7.3.694 in 2012, everybody should
> have it by now.
I'd like my stuff to work on older versions, though, and it's not hard
to make it work.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Let's give this another try, and maybe configure it this time.
|
| |
|
| |
|
|
|
|
|
| |
Otherwise entering a Tab in insert mode inserts four spaces. I'm not
sure how I didn't notice this before.
|
|
|
|
| |
Include the variable guard, just for completeness' sake.
|
|
|
|
|
| |
This will mean they load correctly when the 'C' flag preventing
line-breaking is in 'cpoptions', and 'compatible' is set.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Unload all maps too, with silent! in case they don't exist.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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).
|
|
|
|
|
| |
This was mistakenly moved along with some indentation settings in
9858af6.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
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.
|