Skip to content

Commit 608fae9

Browse files
committed
move vim customizations from vimrc to vimrc.local
- replace vimrc with original from debian/ubuntu
1 parent 60b4417 commit 608fae9

File tree

7 files changed

+198
-59
lines changed

7 files changed

+198
-59
lines changed

files/default/bookworm/etc/vim/vimrc

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
" $VIMRUNTIME refers to the versioned system directory where Vim stores its
2+
" system runtime files -- /usr/share/vim/vim<version>.
3+
"
4+
" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc.
5+
" This happens after /etc/vim/vimrc(.local) are loaded, so it will override
6+
" any settings in these files.
7+
"
8+
" If you don't want that to happen, uncomment the below line to prevent
9+
" defaults.vim from being loaded.
10+
" let g:skip_defaults_vim = 1
11+
"
12+
" If you would rather _use_ default.vim's settings, but have the system or
13+
" user vimrc override its settings, then uncomment the line below.
14+
" source $VIMRUNTIME/defaults.vim
15+
16+
" All Debian-specific settings are defined in $VIMRUNTIME/debian.vim and
17+
" sourced by the call to :runtime you can find below. If you wish to change
18+
" any of those settings, you should do it in this file or
19+
" /etc/vim/vimrc.local, since debian.vim will be overwritten everytime an
20+
" upgrade of the vim packages is performed. It is recommended to make changes
21+
" after sourcing debian.vim so your settings take precedence.
22+
23+
runtime! debian.vim
24+
25+
" Uncomment the next line to make Vim more Vi-compatible
26+
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes
27+
" numerous options, so any other options should be set AFTER changing
28+
" 'compatible'.
29+
"set compatible
30+
31+
" Vim5 and later versions support syntax highlighting. Uncommenting the next
32+
" line enables syntax highlighting by default.
33+
"syntax on
34+
35+
" If using a dark background within the editing area and syntax highlighting
36+
" turn on this option as well
37+
"set background=dark
38+
39+
" Uncomment the following to have Vim jump to the last position when
40+
" reopening a file
41+
"au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
42+
43+
" Uncomment the following to have Vim load indentation rules and plugins
44+
" according to the detected filetype.
45+
"filetype plugin indent on
46+
47+
" The following are commented out as they cause vim to behave a lot
48+
" differently from regular Vi. They are highly recommended though.
49+
"set showcmd " Show (partial) command in status line.
50+
"set showmatch " Show matching brackets.
51+
"set ignorecase " Do case insensitive matching
52+
"set smartcase " Do smart case matching
53+
"set incsearch " Incremental search
54+
"set autowrite " Automatically save before commands like :next and :make
55+
"set hidden " Hide buffers when they are abandoned
56+
"set mouse=a " Enable mouse usage (all modes)
57+
58+
" Source a global configuration file if available
59+
if filereadable("/etc/vim/vimrc.local")
60+
source /etc/vim/vimrc.local
61+
endif
62+

files/default/bullseye/etc/vim/vimrc

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
2+
" the call to :runtime you can find below. If you wish to change any of those
3+
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
4+
" will be overwritten everytime an upgrade of the vim packages is performed.
5+
" It is recommended to make changes after sourcing debian.vim since it alters
6+
" the value of the 'compatible' option.
7+
8+
runtime! debian.vim
9+
10+
" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc.
11+
" This happens after /etc/vim/vimrc(.local) are loaded, so it will override
12+
" any settings in these files.
13+
" If you don't want that to happen, uncomment the below line to prevent
14+
" defaults.vim from being loaded.
15+
" let g:skip_defaults_vim = 1
16+
17+
" Uncomment the next line to make Vim more Vi-compatible
18+
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
19+
" options, so any other options should be set AFTER setting 'compatible'.
20+
"set compatible
21+
22+
" Vim5 and later versions support syntax highlighting. Uncommenting the next
23+
" line enables syntax highlighting by default.
24+
"syntax on
25+
26+
" If using a dark background within the editing area and syntax highlighting
27+
" turn on this option as well
28+
"set background=dark
29+
30+
" Uncomment the following to have Vim jump to the last position when
31+
" reopening a file
32+
"au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
33+
34+
" Uncomment the following to have Vim load indentation rules and plugins
35+
" according to the detected filetype.
36+
"filetype plugin indent on
37+
38+
" The following are commented out as they cause vim to behave a lot
39+
" differently from regular Vi. They are highly recommended though.
40+
"set showcmd " Show (partial) command in status line.
41+
"set showmatch " Show matching brackets.
42+
"set ignorecase " Do case insensitive matching
43+
"set smartcase " Do smart case matching
44+
"set incsearch " Incremental search
45+
"set autowrite " Automatically save before commands like :next and :make
46+
"set hidden " Hide buffers when they are abandoned
47+
"set mouse=a " Enable mouse usage (all modes)
48+
49+
" Source a global configuration file if available
50+
if filereadable("/etc/vim/vimrc.local")
51+
source /etc/vim/vimrc.local
52+
endif
53+

files/default/jammy/etc/vim/vimrc

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
2+
" the call to :runtime you can find below. If you wish to change any of those
3+
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
4+
" will be overwritten everytime an upgrade of the vim packages is performed.
5+
" It is recommended to make changes after sourcing debian.vim since it alters
6+
" the value of the 'compatible' option.
7+
8+
runtime! debian.vim
9+
10+
" Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc.
11+
" This happens after /etc/vim/vimrc(.local) are loaded, so it will override
12+
" any settings in these files.
13+
" If you don't want that to happen, uncomment the below line to prevent
14+
" defaults.vim from being loaded.
15+
" let g:skip_defaults_vim = 1
16+
17+
" Uncomment the next line to make Vim more Vi-compatible
18+
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
19+
" options, so any other options should be set AFTER setting 'compatible'.
20+
"set compatible
21+
22+
" Vim5 and later versions support syntax highlighting. Uncommenting the next
23+
" line enables syntax highlighting by default.
24+
if has("syntax")
25+
syntax on
26+
endif
27+
28+
" If using a dark background within the editing area and syntax highlighting
29+
" turn on this option as well
30+
"set background=dark
31+
32+
" Uncomment the following to have Vim jump to the last position when
33+
" reopening a file
34+
"au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
35+
36+
" Uncomment the following to have Vim load indentation rules and plugins
37+
" according to the detected filetype.
38+
"filetype plugin indent on
39+
40+
" The following are commented out as they cause vim to behave a lot
41+
" differently from regular Vi. They are highly recommended though.
42+
"set showcmd " Show (partial) command in status line.
43+
"set showmatch " Show matching brackets.
44+
"set ignorecase " Do case insensitive matching
45+
"set smartcase " Do smart case matching
46+
"set incsearch " Incremental search
47+
"set autowrite " Automatically save before commands like :next and :make
48+
"set hidden " Hide buffers when they are abandoned
49+
"set mouse=a " Enable mouse usage (all modes)
50+
51+
" Source a global configuration file if available
52+
if filereadable("/etc/vim/vimrc.local")
53+
source /etc/vim/vimrc.local
54+
endif
55+

manifests/profile/vim.pp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@
1111
class nebula::profile::vim {
1212
package { 'vim': }
1313

14+
# Replace default vimrc
15+
# This is only here to eliminate our previous customizations
16+
# Remove after December 2024
1417
file { '/etc/vim/vimrc':
15-
content => template('nebula/profile/vim/vimrc.vim.erb'),
18+
source => "puppet:///modules/nebula/default/${facts['os']['distro']['codename']}${title}",
19+
require => Package['vim'],
20+
}
21+
22+
file { '/etc/vim/vimrc.local':
23+
content => template('nebula/profile/vim/vimrc.local.erb'),
1624
require => Package['vim'],
1725
}
1826

spec/classes/profile/vim_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
it { is_expected.to contain_package("vim") }
1414

1515
it do
16-
expect(subject).to contain_file("/etc/vim/vimrc")
16+
expect(subject).to contain_file("/etc/vim/vimrc.local")
1717
.that_requires("Package[vim]")
1818
end
1919

2020
[
2121
%r{^set mouse=$}
2222
].each do |line|
23-
it { is_expected.to contain_file("/etc/vim/vimrc").with_content(line) }
23+
it { is_expected.to contain_file("/etc/vim/vimrc.local").with_content(line) }
2424
end
2525

2626
it "never enables any mouse usage of any kind" do
27-
expect(subject).to contain_file("/etc/vim/vimrc").without_content(
27+
expect(subject).to contain_file("/etc/vim/vimrc.local").without_content(
2828
%r{^set mouse=.+$}
2929
)
3030
end

templates/profile/vim/vimrc.local.erb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
" Managed by puppet (nebula/profile/base/vimrc.local.erb)
2+
3+
syntax on
4+
5+
if has("autocmd")
6+
filetype plugin indent on
7+
endif
8+
9+
set showcmd " Show (partial) command in status line.
10+
set showmatch " Show matching brackets.
11+
set ignorecase " Do case insensitive matching
12+
set smartcase " Do smart case matching
13+
set incsearch " Incremental search
14+
set autowrite " Automatically save before commands like :next and :make
15+
set hidden " Hide buffers when they are abandoned
16+
set mouse=

templates/profile/vim/vimrc.vim.erb

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)