How long is too long for .vimrc?

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

How long is too long for .vimrc?

robert h-2

I am not running into problems at all. I was just curious. I am a basic
user of Vim and my .vimrc is 305 lines long (including comments and
blank lines). Is there a point where you modularize it? I am not sure I
see the point there. Is there a "best practive" for maintaining a .vimrc?

Robert


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

scott-268

On Sunday 08 February 2009 12:57 pm, R. Hicks wrote:
>
> I am not running into problems at all. I was just curious. I am a basic
> user of Vim and my .vimrc is 305 lines long (including comments and
> blank lines). Is there a point where you modularize it? I am not sure I
> see the point there. Is there a "best practive" for maintaining a .vimrc?

mine's 468 and counting:

    http://home.swbell.net/toothpik/.vimrc

there's probably a case to be made that it's incrementally
faster to define all functions in .vimrc since sourced
modules require some filesystem i/o, but the difference is
negligible and the most important concern IMO is how well
organized it is for your understanding and ease of
maintenance

i source modules when the functions are long or ... well,
when i feel like it -- there are no rules

enjoy

sc



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

Tony Mechelynck
In reply to this post by robert h-2

On 08/02/09 19:57, R. Hicks wrote:
> I am not running into problems at all. I was just curious. I am a basic
> user of Vim and my .vimrc is 305 lines long (including comments and
> blank lines). Is there a point where you modularize it? I am not sure I
> see the point there. Is there a "best practive" for maintaining a .vimrc?
>
> Robert

The hard limit on 32-bit machines is 2 gigabytes per file (see ":h
limits") which is probably far more than you will ever need. On 64-bit
machines, the help says "much more" but my guess is 9.2 10^18 bytes (or
2^63) if your hard disk is big enough.

Otherwise, I recommend modularizing it (into functions and/or sourced
sub-scripts) once the script you have starts being too large or too
confusing to be manageable otherwise. Of course, this is a subjective
assessment.

IMHO, the "best practice" regarding vimrc scripts is that it has to be
practical for its user to find his place in it, find back what serves
which purpose, and, when necessary, modify it.


Best regards,
Tony.
--
"People think love is an emotion.  Love is good sense."
                -- Ken Kesey

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

panshizhu
In reply to this post by robert h-2

R. Hicks 写道:
> I am not running into problems at all. I was just curious. I am a basic
> user of Vim and my .vimrc is 305 lines long (including comments and
> blank lines). Is there a point where you modularize it? I am not sure I
> see the point there. Is there a "best practive" for maintaining a .vimrc?
>
> Robert

just FYI, mine is 467 lines and I consider a length less than 500 lines
for a vimrc is good.



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

Tony Mechelynck

On 09/02/09 01:55, pansz wrote:

> R. Hicks 写道:
>> I am not running into problems at all. I was just curious. I am a basic
>> user of Vim and my .vimrc is 305 lines long (including comments and
>> blank lines). Is there a point where you modularize it? I am not sure I
>> see the point there. Is there a "best practive" for maintaining a .vimrc?
>>
>> Robert
>
> just FYI, mine is 467 lines and I consider a length less than 500 lines
> for a vimrc is good.

Mine is 473 lines; but if someone has a vimrc of, say, 530 lines, what
he should NOT do is bring it below 500 by removing comment lines, blank
lines, or by putting several commands on a single line.

Best regards,
Tony.
--
Tussman's Law:
        Nothing is as inevitable as a mistake whose time has come.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

robert h-2
In reply to this post by Tony Mechelynck

Tony Mechelynck wrote:

> On 08/02/09 19:57, R. Hicks wrote:
>> I am not running into problems at all. I was just curious. I am a basic
>> user of Vim and my .vimrc is 305 lines long (including comments and
>> blank lines). Is there a point where you modularize it? I am not sure I
>> see the point there. Is there a "best practive" for maintaining a .vimrc?
>>
>> Robert
>
> The hard limit on 32-bit machines is 2 gigabytes per file (see ":h
> limits") which i
> IMHO, the "best practice" regarding vimrc scripts is that it has to be
> practical for its user to find his place in it, find back what serves
> which purpose, and, when necessary, modify it.
>

I have comments on different sections (ala autocommands, functions,
text, ui, general, etc.).  I don't get lost in it. I was just wondering
about its practical size which from other comments I am 100 or so lines
short of.  :-)

Robert


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

Antony Scriven-3
In reply to this post by robert h-2

2009/2/8 R. Hicks <[hidden email]>:

 > I am not running into problems at all. I was just
 > curious. I am a basic user of Vim and my .vimrc is 305
 > lines long (including comments and blank lines). Is there
 > a point where you modularize it? I am not sure I see the
 > point there. Is there a "best practive" for maintaining
 > a .vimrc?

2000+ and no probs. I modularise it using folds.
I find lots of small files more of a hassle. --Antony

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

Ben Schmidt
In reply to this post by robert h-2

R. Hicks wrote:
> I am not running into problems at all. I was just curious. I am a basic
> user of Vim and my .vimrc is 305 lines long (including comments and
> blank lines). Is there a point where you modularize it? I am not sure I
> see the point there. Is there a "best practive" for maintaining a .vimrc?

I think it's a really personal thing. I'm tending more and more to put
small modules in ~/.vim/plugin instead of ~/.vimrc, as well as
filetype-specific stuff in ~/.vim/whatever, and ~/.vim/after/whatever.
But others prefer to put most stuff in their ~/.vimrc, including
autocommands for their filetype specific stuff.

In terms of efficiency, I don't think a few hundred lines is really very
long, though it will slow Vim's startup time the longer it gets. That's
one benefit of filetype-specific files and autoload scripts over .vimrc
and standard plugins. The benefit of having everything in .vimrc is that
it's easier to transfer to another machine, etc.

Ben.




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

Tom Link-3

> The benefit of having everything in .vimrc is that
> it's easier to transfer to another machine, etc.

Interesting. My conclusion would have been quite the opposite. In my
experience having everything in the vimrc makes it difficult to
maintain for different environments. My vimrc is now about 2000 lines
long and I wish I would have started modularizing it much earlier.

If I started over again, I would put only variable and option
definitions that have to be loaded before any plugins into the vimrc
file. IMHO utility functions should go into autoload files,
functionality you use all the time into plugins, filetype-specific
stuff into ftplugin/{FILETYPE}/config.vim. Aynway, everyone to his/her
taste.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

Ben Schmidt

Tom Link wrote:
>> The benefit of having everything in .vimrc is that
>> it's easier to transfer to another machine, etc.
>
> Interesting. My conclusion would have been quite the opposite. In my
> experience having everything in the vimrc makes it difficult to
> maintain for different environments.

I wasn't thinking of different environments with differing
configurations. i'm not sure which I'd think is the winner approach
there; conditionals in .vimrc have their benefits, in that you can
specify exactly the right conditions upon which code should be included,
rather than fiddling more manually with files.

But what I was actually thinking about was simply using the identical
configuration on different machines. It's easier just to copy your
.vimrc than a whole .vim folder.

I like you do prefer the modular approach, though, and, like you, also
have a .vimrc that doesn't use this approach as much as I'd like.

Ben.




--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

Cyril Slobin-4
In reply to this post by panshizhu

On Mon, Feb 9, 2009 at 3:55 AM, pansz <[hidden email]> wrote:

> just FYI, mine is 467 lines and I consider a length less than
> 500 lines for a vimrc is good.

Mine is 499 ;-)

Also I use three plugins written by myself, but I do not consider them
as parts of .vimrc: they are solving some clearly distinct tasks, and
I can easily say what will be missing if I remove them.

Unlike this, .vimrc contains a lot of miscellaneous functions: tweak
here, twiddle there, there is no logical way to select some part of
them and put in a separate module.

P.S. http://slobin.pp.ru/vim/_vimrc.html

--
http://slobin.pp.ru/ `When I use a word,' Humpty Dumpty said,
<[hidden email]> `it means just what I choose it to mean'

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

RE: How long is too long for .vimrc?

Gene Kwiecinski
In reply to this post by scott-268

>mine's 468 and counting:
>    http://home.swbell.net/toothpik/.vimrc

Hmm, kewl..  Mine's like, well, 8 lines long.  :D

Was meaning to change things that bug me when I run into 'em, but never
really got around to it.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How long is too long for .vimrc?

panshizhu
In reply to this post by Ben Schmidt

Ben Schmidt 写道:
> But what I was actually thinking about was simply using the identical
> configuration on different machines. It's easier just to copy your
> .vimrc than a whole .vim folder.

Copy the .vimrc is easier than .vim folder only if you don't change it
very often. consider you change it on computer A and changed it on
computer B you will need to merge the changes unless you always brings
the file with you and copy it every time before you use vim. That IMO
would be tedious.

I think .vim folder is easier, because folders can be managed by
subversion or any kind of version control system, my ~/.vim is a working
copy of subversion and I can simply change anything in any computer and
submit them, an svn update will do all the merges I need. For any new
computer an svn checkout would get all my want. All those works only for
folders, not for individual files.

I even put my .vimrc and .gvimrc into .vim folder and create soft links
to my home. since maintain a .vim folder as svn working copy is far
easier than maintain two separate files in the rather crowded home folder.


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---