add fish profile for Vim

This commit is contained in:
Zdenek Dohnal 2020-10-15 14:00:54 +02:00
parent 17062c8b2d
commit 64066330a2
2 changed files with 34 additions and 2 deletions

25
vim.fish Normal file
View File

@ -0,0 +1,25 @@
# This will avoid user defined aliases and possibly stuff defined earlier in the PATH.
# Redirecting is for the case when the binary is missing.
set vim_cond (which vim 2> /dev/null)
set vi_cond (which vi 2> /dev/null)
switch "$vim_cond-$vi_cond"
case /usr/bin/vim-/usr/bin/vi
# apply only if founded vim and vi are in the expected dir from distro
function vi
command vim $argv
end
function view
command vim -R $argv
end
case -/usr/bin/vi
# apply only when no vim is installed and founded vi is in the expected dir from distro
function vim
command read -p 'No vim found, using vi, press ENTER to continue' -n1 -t 20 -s && vi $argv
end
end
# just in case
set -e vim_cond
set -e vi_cond

View File

@ -40,6 +40,7 @@ Source15: macros.vim
Source16: vim-default-editor.sh Source16: vim-default-editor.sh
Source17: vim-default-editor.csh Source17: vim-default-editor.csh
Source18: vim-default-editor.fish Source18: vim-default-editor.fish
Source19: vim.fish
Patch2002: vim-7.0-fixkeys.patch Patch2002: vim-7.0-fixkeys.patch
Patch2003: vim-7.4-specsyntax.patch Patch2003: vim-7.4-specsyntax.patch
@ -546,6 +547,7 @@ install -p -m644 %{SOURCE16} %{buildroot}/%{_sysconfdir}/profile.d/vim-default-e
install -p -m644 %{SOURCE17} %{buildroot}/%{_sysconfdir}/profile.d/vim-default-editor.csh install -p -m644 %{SOURCE17} %{buildroot}/%{_sysconfdir}/profile.d/vim-default-editor.csh
mkdir -p %{buildroot}/%{_datadir}/fish/vendor_conf.d/ mkdir -p %{buildroot}/%{_datadir}/fish/vendor_conf.d/
install -p -m644 %{SOURCE18} %{buildroot}/%{_datadir}/fish/vendor_conf.d/vim-default-editor.fish install -p -m644 %{SOURCE18} %{buildroot}/%{_datadir}/fish/vendor_conf.d/vim-default-editor.fish
install -p -m644 %{SOURCE19} %{buildroot}/%{_datadir}/fish/vendor_conf.d/vim.fish
install -p -m644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/virc install -p -m644 %{SOURCE4} %{buildroot}/%{_sysconfdir}/virc
install -p -m644 %{SOURCE5} %{buildroot}/%{_sysconfdir}/vimrc install -p -m644 %{SOURCE5} %{buildroot}/%{_sysconfdir}/vimrc
@ -744,7 +746,9 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%endif %endif
%files minimal %files minimal
%dir %{_sysconfdir}/profile.d/ %dir %{_datadir}/fish/vendor_conf.d
%{_datadir}/fish/vendor_conf.d/vim.fish
%dir %{_sysconfdir}/profile.d
%config(noreplace) %{_sysconfdir}/profile.d/vim.* %config(noreplace) %{_sysconfdir}/profile.d/vim.*
%config(noreplace) %{_sysconfdir}/virc %config(noreplace) %{_sysconfdir}/virc
%{_bindir}/ex %{_bindir}/ex
@ -760,7 +764,9 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
%{_mandir}/man5/virc.* %{_mandir}/man5/virc.*
%files enhanced %files enhanced
%dir %{_sysconfdir}/profile.d/ %dir %{_datadir}/fish/vendor_conf.d
%{_datadir}/fish/vendor_conf.d/vim.fish
%dir %{_sysconfdir}/profile.d
%config(noreplace) %{_sysconfdir}/profile.d/vim.* %config(noreplace) %{_sysconfdir}/profile.d/vim.*
%{_bindir}/vim %{_bindir}/vim
%{_bindir}/rvim %{_bindir}/rvim
@ -824,6 +830,7 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
* Thu Oct 15 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.1815-2 * Thu Oct 15 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.1815-2
- vim-default-editor.fish - dont give EDITOR universal scope - vim-default-editor.fish - dont give EDITOR universal scope
- vim.sh, vim.csh - set aliases only for OS default vi and vim - vim.sh, vim.csh - set aliases only for OS default vi and vim
- add fish profile for Vim
* Mon Oct 12 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.1815-2 * Mon Oct 12 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.1815-2
- fix installing fish profile, set virtual provide for default editor - fix installing fish profile, set virtual provide for default editor