Views save way too many settings

24 views
Skip to first unread message

So8res

unread,
Oct 20, 2012, 3:32:30 PM10/20/12
to vim...@googlegroups.com
Views are great. Until you change your workflow.

Let's say that you have 'autochdir' set for a few months, views being made and loaded the whole time by autocmds. Then, for one reason or another, you decide to turn 'autochdir' off.

Now what happens when you edit a file? Is it a new file, or does it have a view? If it's a new file then autochdir will be off, but if it's got a view then autochdir will be off. You've got to either:

* Spend weeks in fear, not knowing what's set where. Seemingly at random you find old files that have crazy settings.
* Delete all your views. Now your folds and marks are gone! Oh no.
* Manually edit your vim files to remove the "setlocal autochdir" lines.

All of these are pretty annoying. It would be awesome if view files only added a setting line if the local setting differs from the global setting.

Christian J. Robinson

unread,
Oct 20, 2012, 3:37:34 PM10/20/12
to vim...@googlegroups.com
On Sat, Oct 20, 2012 at 1:32 PM, So8res <so8...@gmail.com> wrote:
> Views are great. Until you change your workflow.

[snip]

> All of these are pretty annoying. It would be awesome if view files only added a setting line if the local setting differs from the global setting.

It gets worse. Mappings are saved too, and a ton of other stuff.
You've pretty much illustrated why I can't and won't use views even
though it's a feature I need, but the reason I never complained about
it is that I realize it's basically impossible for the developers to
satisfy everybody, and some people will want/need these things (yes,
including mappings) to be saved and restored.

- Christian

--
Christian J. Robinson <hep...@gmail.com>

Ingo Karkat

unread,
Oct 20, 2012, 3:47:49 PM10/20/12
to vim...@googlegroups.com
Why doesn't tweaking 'sessionoptions' / 'viewoptions' help you?

I, for one, never write ad-hoc mappings, and use ftplugin scripts to set buffer
options. Therefore, I have removed "options" from both settings, so they won't
be recorded.

-- regards, ingo

So8res

unread,
Oct 20, 2012, 3:48:21 PM10/20/12
to vim...@googlegroups.com
Well there is ':help viewoptions' -- it seems like adding a 'mappings' option to 'viewoptions' could address your problem. And adding a 'diff' option or some such which means only local settings are saved would probably fix my problem.

The cool thing about vim is that while it's huge and complex, there's pretty much a way to do everything.

So8res

unread,
Oct 20, 2012, 3:53:13 PM10/20/12
to vim...@googlegroups.com
@ingo -- I like having 'options' in there because I often find 'shiftwidth' and 'tabstop' often differ by buffer or filetype. Especially if you're working on a multitude of c projects, and none of them have the same tabbing settings: ftplugins won't help you there. 'viewoptions' has the right idea, but I think that the 'options' option should be a bit finer.

Christian J. Robinson

unread,
Oct 20, 2012, 4:11:34 PM10/20/12
to vim...@googlegroups.com
On Sat, 20 Oct 2012, Ingo Karkat wrote:

> On 20-Oct-2012 21:37:34 +0200, Christian J. Robinson wrote:
>
>> You've pretty much illustrated why I can't and won't use views even
>> though it's a feature I need
>
> Why doesn't tweaking 'sessionoptions' / 'viewoptions' help you?

It looks like I did try that at once, now that I'm looking at my
~/.vimrc, but for some reason that I can't recall any more it still
wasn't workable for me so I haven't used the feature since.

- Christian

--
It's easy to love people in China.
It's tougher to love the person living next door.
Christian J. Robinson <hep...@gmail.com> http://christianrobinson.name/

Ingo Karkat

unread,
Oct 20, 2012, 4:12:29 PM10/20/12
to vim...@googlegroups.com
Ah, I see. For indentation, I have written a plugin - IndentConsistencyCop
(http://www.vim.org/scripts/script.php?script_id=1690), that checks and adapts
if necessary. For project-specific settings, I use the localrc.vim plugin
(http://www.vim.org/scripts/script.php?script_id=3393).

If you encode the options in sessions and/or views, you must be careful to
always open your files through them, don't you? I have always regarded these as
helpful, but essentially volatile metadata that I don't drag around to other
systems I'm working on.

It's no surprise that people have different workflows, each with their own pros
and cons.

-- regards, ingo

So8res

unread,
Oct 20, 2012, 4:22:12 PM10/20/12
to vim...@googlegroups.com
The trouble I find with indent consistency plugins (which I've tried) is that they completely choke when you're working on a project which you don't control (i.e. making pull requests / patches / etc). I much prefer to have local settings. .local.vimrc is an interesting idea, but I really don't like crapping files all over my directory tree: I much prefer having everything in a centralized viewdir.

> different work flows, each with their own pros and cons

For sure! I would love it if vim views were a bit more versatile to support a few more workflows.

Reply all
Reply to author
Forward
0 new messages