diff options
| author | D. Ben Knoble <ben.knoble+github@gmail.com> | 2025-11-05 17:08:11 -0500 |
|---|---|---|
| committer | Sam James <sam@gentoo.org> | 2025-11-16 07:57:38 +0000 |
| commit | 7fd20a6847a54a26924a1b55f254c11ce6705c1a (patch) | |
| tree | 98c461e5568c52bf366611b50fc7b864871d78c2 /app-editors/vim-core | |
| parent | dc3c5190cecfa30cf2e5518fbd6f6d6cc0e9a943 (diff) | |
| download | gentoo-7fd20a6847a54a26924a1b55f254c11ce6705c1a.tar.gz gentoo-7fd20a6847a54a26924a1b55f254c11ce6705c1a.tar.bz2 gentoo-7fd20a6847a54a26924a1b55f254c11ce6705c1a.zip | |
app-editors/vim-core: provide an escape hatch to avoid the system vimrc
It contains some problems or otherwise unnecessary settings for users
with highly customized personal configurations.
Here's taste of what it takes to disable the system vimrc's effects
otherwise:
" Undo /etc/vim/vimrc settings first
set backspace& autoindent& history& ruler& viminfo& suffixes& numberwidth&
set modeline& fileencodings& guifontset& hlsearch&
silent! unmap Q
" - Skip turning off syntax, since my vimrc is smart enough to already check
" t_Co, has('gui_running'), _and_ !exists("g:syntax_on") before calling
" `syntax enabled`.
" - Skip undoing term settings because they don't apply to me
" - Ignore filetype plugin on, even though it comes way too early; I do it again
" later.
" - &shell should not be empty for me
" - I set is_bash set later, fine
" Hmph. These autocommand set options like tabstop, shiftwidth, expandtab
" globally insetad of locally. Broken.
silent! autocmd! gentoo
" Don't need this variable: I have a vimrc
unlet! g:skip_defaults_vim
" Can't revert the Filetype * autocommand for omnifunc because it's not in a
" group, so I'll just have to live with duplicates.
Obviously this doesn't cover all the effects, some of which are
next-to-impossible to reliably revert, and some of the changes or
omissions are relevant only to certain users. But for folks who just
want a blank slate, we need to provide an escape hatch. Unlike
defaults.vim, we cannot provide a simple mechanism to skip the whole
file: by the time we would set the variable, in a local or user vimrc,
it's too late!
Instead, we first source any files in runtimepath called
"skip_etc_vimrc.vim": they have an opportunity to go early and perform
tasks like
let skip_etc_vimrc = 1
to skip the remainder of the script. It's a complicated workaround, but
it avoids a new USE flag.
Signed-off-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/44504
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-editors/vim-core')
| -rw-r--r-- | app-editors/vim-core/files/vimrc-r8 | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app-editors/vim-core/files/vimrc-r8 b/app-editors/vim-core/files/vimrc-r8 index 3ad6ba14289e..c770ab2ef3f6 100644 --- a/app-editors/vim-core/files/vimrc-r8 +++ b/app-editors/vim-core/files/vimrc-r8 @@ -1,6 +1,15 @@ scriptencoding utf-8 " ^^ Please leave the above line at the start of the file. +" If you want to completely disable this script, make sure to put +" "let skip_etc_vimrc = 1" in a skip_etc_vimrc.vim in your runtimepath, like +" ~/.vim/skip_etc_vimrc. +runtime! skip_etc_vimrc.vim +" Bail out when a power user would prefer to avoid the system configuration +if exists('skip_etc_vimrc') + finish +endif + " Default configuration file for Vim " Written by Aron Griffis <agriffis@gentoo.org> |
