Accepting request 811871 from home:lnussel:branches:editors

- remove duplicated settings in defaults.vim from SUSE vimrc
- move SUSE vim settings to /usr in data-common package so leave
  /etc/vimrc to the admin.
- require data-common in vim-small so it gets the settings
- install spec file template as plugin as vim-small doesn't support
  it

OBS-URL: https://build.opensuse.org/request/show/811871
OBS-URL: https://build.opensuse.org/package/show/editors/vim?expand=0&rev=606
This commit is contained in:
Ondřej Súkup 2020-06-05 16:23:31 +00:00 committed by Git OBS Bridge
parent aa45c45e7f
commit 82210ee5ca
5 changed files with 71 additions and 75 deletions

35
spec.vim Normal file
View File

@ -0,0 +1,35 @@
function! SKEL_spec()
0r /usr/share/vim/current/skeletons/skeleton.spec
language time en_US
if $USER != ''
let login = $USER
elseif $LOGNAME != ''
let login = $LOGNAME
else
let login = 'unknown'
endif
let newline = stridx(login, "\n")
if newline != -1
let login = strpart(login, 0, newline)
endif
if $HOSTNAME != ''
let hostname = $HOSTNAME
else
let hostname = system('hostname -f')
if v:shell_error
let hostname = 'localhost'
endif
endif
let newline = stridx(hostname, "\n")
if newline != -1
let hostname = strpart(hostname, 0, newline)
endif
exe "%s/specCURRENT_YEAR/" . strftime("%Y") . "/ge"
exe "%s/specRPM_CREATION_DATE/" . strftime("%a\ %b\ %d\ %Y") . "/ge"
exe "%s/specRPM_CREATION_AUTHOR_MAIL/" . login . "@" . hostname . "/ge"
exe "%s/specRPM_CREATION_NAME/" . expand("%:t:r") . "/ge"
setf spec
endfunction
" Skeleton for spec files
autocmd BufNewFile *.spec call SKEL_spec()

View File

@ -5,75 +5,15 @@
" version: 2017/04/28
" commented lines start with `"'
function! SKEL_spec()
0r /usr/share/vim/current/skeletons/skeleton.spec
language time en_US
if $USER != ''
let login = $USER
elseif $LOGNAME != ''
let login = $LOGNAME
else
let login = 'unknown'
endif
let newline = stridx(login, "\n")
if newline != -1
let login = strpart(login, 0, newline)
endif
if $HOSTNAME != ''
let hostname = $HOSTNAME
else
let hostname = system('hostname -f')
if v:shell_error
let hostname = 'localhost'
endif
endif
let newline = stridx(hostname, "\n")
if newline != -1
let hostname = strpart(hostname, 0, newline)
endif
exe "%s/specCURRENT_YEAR/" . strftime("%Y") . "/ge"
exe "%s/specRPM_CREATION_DATE/" . strftime("%a\ %b\ %d\ %Y") . "/ge"
exe "%s/specRPM_CREATION_AUTHOR_MAIL/" . login . "@" . hostname . "/ge"
exe "%s/specRPM_CREATION_NAME/" . expand("%:t:r") . "/ge"
setf spec
endfunction
" enable syntax highlighting
syntax on
" automatically indent lines (default)
" set noautoindent
" select case-insenitiv search (not default)
" set ignorecase
" show cursor line and column in the status line
set ruler
" show matching brackets
set showmatch
" display mode INSERT/REPLACE/...
set showmode
" changes special characters in search patterns (default)
" set magic
" Required to be able to use keypad keys and map missed escape sequences
set esckeys
" get easier to use and more user friendly vim defaults
" CAUTION: This option breaks some vi compatibility.
" Switch it off if you prefer real vi compatibility
set nocompatible
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" Complete longest common string, then each full match
" enable this for bash compatible behaviour
" set wildmode=longest,full
" Try to get the correct main terminal type
if &term =~ "xterm"
let myterm = "xterm"
@ -82,11 +22,13 @@ elseif &term =~ "screen"
else
let myterm = &term
endif
let myterm = substitute(myterm, "cons[0-9][0-9].*$", "linux", "")
let myterm = substitute(myterm, "cons[0-9][0-9].*$", "linux", "")
let myterm = substitute(myterm, "vt1[0-9][0-9].*$", "vt100", "")
let myterm = substitute(myterm, "vt2[0-9][0-9].*$", "vt220", "")
let myterm = substitute(myterm, "\\([^-]*\\)[_-].*$", "\\1", "")
if has('eval')
let myterm = substitute(myterm, "cons[0-9][0-9].*$", "linux", "")
let myterm = substitute(myterm, "cons[0-9][0-9].*$", "linux", "")
let myterm = substitute(myterm, "vt1[0-9][0-9].*$", "vt100", "")
let myterm = substitute(myterm, "vt2[0-9][0-9].*$", "vt220", "")
let myterm = substitute(myterm, "\\([^-]*\\)[_-].*$", "\\1", "")
endif
" Here we define the keys of the NumLock in keyboard transmit mode of xterm
" which misses or hasn't activated Alt/NumLock Modifiers. Often not defined
@ -341,8 +283,5 @@ endif " has("autocmd")
" that it potentially can open for malicious users to do harmful things.
set nomodeline
" Skeleton for spec files
autocmd BufNewFile *.spec call SKEL_spec()
" get easier to use and more user friendly vim defaults
" /etc/vimrc ends here

View File

@ -1,7 +1,7 @@
Index: vim-8.2.0348/runtime/defaults.vim
Index: vim-8.2.0701/runtime/defaults.vim
===================================================================
--- vim-8.2.0348.orig/runtime/defaults.vim
+++ vim-8.2.0348/runtime/defaults.vim
--- vim-8.2.0701.orig/runtime/defaults.vim
+++ vim-8.2.0701/runtime/defaults.vim
@@ -77,13 +77,15 @@ inoremap <C-U> <C-G>u<C-U>
" can position the cursor, Visually select and scroll with the mouse.
" Only xterm can grab the mouse events when using the shift key, for other
@ -25,3 +25,10 @@ Index: vim-8.2.0348/runtime/defaults.vim
" Switch syntax highlighting on when the terminal has colors or when using the
" GUI (which always has colors).
@@ -139,3 +141,6 @@ if has('langmap') && exists('+langremap'
" compatible).
set nolangremap
endif
+
+" include SUSE tweaks
+ru suse.vim

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu May 28 12:05:51 UTC 2020 - Ludwig Nussel <lnussel@suse.de>
- remove duplicated settings in defaults.vim from SUSE vimrc
- move SUSE vim settings to /usr in data-common package so leave
/etc/vimrc to the admin.
- require data-common in vim-small so it gets the settings
- install spec file template as plugin as vim-small doesn't support
it
-------------------------------------------------------------------
Thu May 21 15:16:53 UTC 2020 - Christian Boltz <suse-beta@cboltz.de>

View File

@ -41,6 +41,7 @@ Source14: vitmp.1
Source15: vim132
Source19: gvim.desktop
Source20: spec.skeleton
Source21: spec.vim
Source23: apparmor.vim
Source24: gvim.svg
Source25: gvim_24.png
@ -130,7 +131,7 @@ Group: Productivity/Text/Editors
BuildArch: noarch
%description data-common
This package contains common runtime & syntax files for vim and gvim.
This package contains basic runtime & syntax files for vim
%package -n gvim
Summary: A GUI for Vi
@ -161,6 +162,7 @@ Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides: vi
Provides: vim_client
Requires: vim-data-common = %{version}-%{release}
%description small
Vim compiled with reduced feature set such as no script
@ -328,7 +330,8 @@ install -m 0755 %{SOURCE15} %{buildroot}%{_datadir}/vim/%{VIM_SUBDIR}/tools/vim1
ln -s -f %{VIM_SUBDIR} %{buildroot}%{_datadir}/vim/current
# additional files
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/vimrc
install -D -m 0644 %{SOURCE3} %{buildroot}%{_datadir}/vim/current/suse.vimrc
install -D -m 0644 /dev/null %{buildroot}%{_sysconfdir}/vimrc
install -D -m 0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/gvimrc
# create site wide runtime directory
@ -344,7 +347,8 @@ mkdir -m 0755 %{buildroot}%{_datadir}/vim/current/skeletons
mkdir -m 0755 %{buildroot}%{_sysconfdir}/skel
# install spec helper
install -m 0644 %{SOURCE20} %{buildroot}%{_datadir}/vim/current/skeletons/skeleton.spec
install -m 0644 %{SOURCE20} %{buildroot}%{_datadir}/vim/current/skeletons/skeleton.spec
install -m 0644 %{SOURCE21} %{buildroot}%{_datadir}/vim/current/plugin/spec.vim
# desktop file for gvim
install -D -m 0644 %{SOURCE19} %{buildroot}%{_datadir}/applications/gvim.desktop
@ -439,7 +443,6 @@ fi
%{_sbindir}/update-alternatives --remove vim %{_bindir}/vim-small
%files
%config(noreplace) %{_sysconfdir}/vimrc
%ghost %{_sysconfdir}/alternatives/vim
%{_bindir}/vim-nox11
%{_bindir}/vim
@ -546,6 +549,8 @@ fi
%{_datadir}/vim/%{VIM_SUBDIR}/tutor/*
%files data-common
%ghost %config(noreplace) %{_sysconfdir}/vimrc
%{_datadir}/vim/%{VIM_SUBDIR}/suse.vimrc
%{_datadir}/vim/%{VIM_SUBDIR}/autoload/dist/ft.vim
%{_datadir}/vim/%{VIM_SUBDIR}/syntax/nosyntax.vim
%{_datadir}/vim/%{VIM_SUBDIR}/syntax/resolv.vim