From 0a36e6cf86e8af7dd312e06a43da49d2046024d574133e07752fb1d3429b40b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ismail=20D=C3=B6nmez?= Date: Mon, 7 Nov 2011 12:59:59 +0000 Subject: [PATCH] - Move spec skeleton functionality into /etc/vimrc (bnc#720898) OBS-URL: https://build.opensuse.org/package/show/editors/vim?expand=0&rev=67 --- dot.vimrc | 38 -------------------------------------- spec.skeleton | 7 +------ suse.vimrc | 38 +++++++++++++++++++++++++++++++++++++- vim.changes | 5 +++++ vim.spec | 17 +++++++++-------- 5 files changed, 52 insertions(+), 53 deletions(-) delete mode 100644 dot.vimrc diff --git a/dot.vimrc b/dot.vimrc deleted file mode 100644 index 4a262ee..0000000 --- a/dot.vimrc +++ /dev/null @@ -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 diff --git a/spec.skeleton b/spec.skeleton index 264cd56..558b43e 100644 --- a/spec.skeleton +++ b/spec.skeleton @@ -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 diff --git a/suse.vimrc b/suse.vimrc index 8ad242d..b855060 100644 --- a/suse.vimrc +++ b/suse.vimrc @@ -2,9 +2,42 @@ " author: Klaus Franken " author: Werner Fink " author: Florian La Roche -" 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 diff --git a/vim.changes b/vim.changes index f26c418..363495d 100644 --- a/vim.changes +++ b/vim.changes @@ -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 diff --git a/vim.spec b/vim.spec index 5dc1519..d297dee 100644 --- a/vim.spec +++ b/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