Re: sample ~/.vimrc

"DJ Lucas" ([email protected] via blfs-dev Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.beyond.devel
Message-ID <[email protected]>
On 5/30/2025 3:53 PM, Bruce Dubbs ([email protected] via 
blfs-dev Mailing List) wrote:
> On 5/30/25 3:24 PM, DJ Lucas ([email protected] via blfs-dev 
> Mailing List) wrote:
>> It annoys me as, for whatever reason, I cannot remember where to look 
>> and need to do so after every break! :-)
>>
>> From  ":h defaults" in modern vim:
>>
>> Defaults without a .vimrc file
>> ==================================================================
>> If Vim is started normally and no user vimrc file is found, the
>> $VIMRUNTIME/defaults.vim script is loaded.  This will set 
>> 'compatible' off,
>> switch on syntax highlighting and a few more things.  See the script for
>> details.  NOTE: this is done since Vim 8.0, not in Vim 7.4. (it was 
>> added in
>> patch 7.4.2111 to be exact).
>>
>> This should work well for new Vim users.  If you create your own 
>> .vimrc, it is
>> recommended to add these lines somewhere near the top:
>>          unlet! skip_defaults_vim
>>          source $VIMRUNTIME/defaults.vim
>> Then Vim works like before you had a .vimrc.
>> Copying $VIMRUNTIME/vimrc_example.vim to your .vimrc is another way 
>> to do
>> this. Alternatively, you can copy defaults.vim to your .vimrc and 
>> modify it
>> (but then you won't get updates when it changes).
>> ==================================================================
>>
>> The .vimrc example in the book dates back to well before vim 7.4. I 
>> think these two lines should probably be added to the default .vimrc 
>> in the book - per the developers' recommendation. It will not matter 
>> for power users as the .vimrc that has been developed over the past 
>> 10+ years is copied from machine to machine anyway. Maybe add a note 
>> about the location of $VIMRUNTIME (or show the command so it doesn't 
>> have to be updated when a new minor is released - ':echo $VIMRUNITME' 
>> works well enough).
>
> There are lots of things to set in vim.  Here is my config:
>
> $ cat /etc/vimrc
> " Begin /etc/vimrc
>
> " Ensure defaults are set before customizing settings, not after
> "source $VIMRUNTIME/defaults.vim
> let skip_defaults_vim=1


<Snip>

>
> set mouse=
>
>
>

<Snip>

>
>
> One problem I had was that the defaults were being run AFTER the 
> configuration file. That overwrote my settings.  The default mouse 
> setting was very irritating when using the center mouse button for 
> pasting.
>
If you override the defaults they override just fine. I suspect 'set 
mouse -=a' would stop visual mode but still allow intelligent selection 
and middle click paste (have to be in insert mode first obviously). I do 
most via ssh now days, haven't installed GPM in a long time. When we add 
a personal .vimrc, the defaults are no longer applied for the user. The 
point was to include the defaults, per the vendor's recommendation, in 
the book. The user can decide if they need to be overridden and at least 
have a known working sample. It'd make a reasonable default for 
/etc/skel as well.

--DJ

-- 
http://lists.linuxfromscratch.org/sympa/info/blfs-dev
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.