- Move spec skeleton functionality into /etc/vimrc (bnc#720898)
OBS-URL: https://build.opensuse.org/package/show/editors/vim?expand=0&rev=67
This commit is contained in:
parent
071ee1d47a
commit
0a36e6cf86
38
dot.vimrc
38
dot.vimrc
@ -1,38 +0,0 @@
|
||||
" ~/.vimrc (configuration file for vim only)
|
||||
" skeletons
|
||||
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/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
|
||||
autocmd BufNewFile *.spec call SKEL_spec()
|
||||
" filetypes
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
" ~/.vimrc ends here
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package
|
||||
#
|
||||
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) specCURRENT_YEAR SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -15,8 +15,6 @@
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
# norootforbuild
|
||||
|
||||
Name: specRPM_CREATION_NAME
|
||||
Version:
|
||||
Release:
|
||||
@ -43,9 +41,6 @@ make %{?_smp_mflags}
|
||||
%install
|
||||
%make_install
|
||||
|
||||
%clean
|
||||
%{?buildroot:%__rm -rf "%{buildroot}"}
|
||||
|
||||
%post
|
||||
|
||||
%postun
|
||||
|
38
suse.vimrc
38
suse.vimrc
@ -2,9 +2,42 @@
|
||||
" author: Klaus Franken <kfr@suse.de>
|
||||
" author: Werner Fink <werner@suse.de>
|
||||
" author: Florian La Roche <florian@suse.de>
|
||||
" version: 00/01/20
|
||||
" version: 06/11/2011
|
||||
" 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
|
||||
|
||||
@ -248,5 +281,8 @@ 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
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 7 12:59:21 UTC 2011 - idonmez@suse.com
|
||||
|
||||
- Move spec skeleton functionality into /etc/vimrc (bnc#720898)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Nov 6 03:49:09 UTC 2011 - crrodriguez@opensuse.org
|
||||
|
||||
|
17
vim.spec
17
vim.spec
@ -88,7 +88,6 @@ Source15: vim132
|
||||
Source18: missing-vim-client
|
||||
Source19: gvim.desktop
|
||||
Source20: spec.skeleton
|
||||
Source21: dot.vimrc
|
||||
Source22: vim.conf
|
||||
Source23: apparmor.vim
|
||||
Source98: %{name}-7.3-patches.tar.bz2
|
||||
@ -356,10 +355,10 @@ sed -i -e 's|define HAVE_DATE_TIME 1|undef HAVE_DATE_TIME|' src/auto/config.h
|
||||
gcc %{optflags} %{SOURCE13} -o vitmp
|
||||
|
||||
%install
|
||||
#
|
||||
# create icon directory to have the icon from the tarball installed
|
||||
install -d -m 0755 %{buildroot}%{_datadir}/icons/hicolor/48x48/apps
|
||||
%makeinstall STRIP=:
|
||||
|
||||
# the last installed binary is gvim. preserve it and
|
||||
# fix its symlinks. e* was added here as it doesnt make much sense in
|
||||
# console
|
||||
@ -367,13 +366,14 @@ mv -v %{buildroot}%{_bindir}/{vim,gvim-normal}
|
||||
for f in egvim egview eview evim gex gvi gview gvimdiff rgview rgvim ; do
|
||||
ln -s -vf gvim %{buildroot}%{_bindir}/$f
|
||||
done
|
||||
#
|
||||
|
||||
# install the other binaries
|
||||
install -D -m 0755 vim-normal %{buildroot}/bin/vim-normal
|
||||
install -D -m 0755 vim-enhanced %{buildroot}%{_bindir}/vim-enhanced
|
||||
%if 0%{?with_splitted_gvim}
|
||||
install -D -m 0755 gvim-enhanced %{buildroot}%{_bindir}/gvim-enhanced
|
||||
%endif
|
||||
|
||||
# compat symlinks
|
||||
# we need a dummy target for /etc/alternatives/vim
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
|
||||
@ -384,21 +384,23 @@ ln -s -f /bin/vim %{buildroot}%{_bindir}/vim
|
||||
ln -s -f /bin/vim %{buildroot}%{_bindir}/vi
|
||||
ln -s -f vim %{buildroot}%{_bindir}/edit
|
||||
ln -s -f /bin/vim %{buildroot}/bin/ex
|
||||
#
|
||||
|
||||
# man pages
|
||||
ln -s -f vim.1.gz %{buildroot}%{_mandir}/man1/vi.1.gz
|
||||
ln -s -f vim.1.gz %{buildroot}%{_mandir}/man1/ex.1.gz
|
||||
#
|
||||
|
||||
# vitmp
|
||||
install -m 0755 vitmp %{buildroot}%{_bindir}/vitmp
|
||||
install -m 0644 %{SOURCE14} %{buildroot}%{_mandir}/man1/vitmp.1
|
||||
install -m 0755 %{SOURCE15} %{buildroot}%{_datadir}/vim/%{VIM_SUBDIR}/tools/vim132
|
||||
#
|
||||
|
||||
# make the vim settings more generic
|
||||
ln -s -f %{VIM_SUBDIR} %{buildroot}%{_datadir}/vim/current
|
||||
|
||||
# additional files
|
||||
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/vimrc
|
||||
install -D -m 0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/gvimrc
|
||||
|
||||
# create site wide runtime directory
|
||||
mkdir -p -m 0755 %{buildroot}%{site_runtimepath}/after
|
||||
mkdir -m 0755 %{buildroot}%{site_runtimepath}/autoload
|
||||
@ -410,9 +412,9 @@ mkdir -m 0755 %{buildroot}%{site_runtimepath}/ftdetect
|
||||
mkdir -m 0755 %{buildroot}%{site_runtimepath}/after/syntax
|
||||
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 %{SOURCE21} %{buildroot}%{_sysconfdir}/skel/.vimrc
|
||||
|
||||
# desktop file for gvim
|
||||
install -D -m 0644 %{SOURCE19} %{buildroot}%{_datadir}/applications/gvim.desktop
|
||||
@ -521,7 +523,6 @@ fi
|
||||
%files base
|
||||
%defattr(-,root,root,-)
|
||||
%config(noreplace) %{_sysconfdir}/vimrc
|
||||
%config(noreplace) %{_sysconfdir}/skel/.vimrc
|
||||
%ghost %{_sysconfdir}/alternatives/vim
|
||||
%dir /usr/lib/tmpfiles.d
|
||||
%config(noreplace) /usr/lib/tmpfiles.d/vim.conf
|
||||
|
Loading…
Reference in New Issue
Block a user