remove interactive prompt from profile scripts
This commit is contained in:
parent
a71f8c8cb7
commit
76de4434ca
2
vim.csh
2
vim.csh
@ -11,7 +11,7 @@ switch ( $vim_cond-$vi_cond )
|
||||
breaksw
|
||||
case -/usr/bin/vi:
|
||||
# apply only if founded vi is in expected dir from distro
|
||||
alias vim "read -rep 'No vim found, using vi, press ENTER to continue' -n1 -t 20 -s && vi"
|
||||
alias vim vi
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
|
2
vim.fish
2
vim.fish
@ -16,7 +16,7 @@ switch "$vim_cond-$vi_cond"
|
||||
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
|
||||
command vi $argv
|
||||
end
|
||||
end
|
||||
|
||||
|
35
vim.sh
35
vim.sh
@ -1,30 +1,31 @@
|
||||
__vi_internal_vim_alias()
|
||||
(
|
||||
# if user installs vim-enanced and alias is already set
|
||||
test -f /usr/bin/vim && exec vim "$@"
|
||||
# run vim if installed
|
||||
test -f /usr/bin/vim && exec /usr/bin/vim "$@"
|
||||
|
||||
# if user hates the "No vim found .." interrupting message
|
||||
test -f "$HOME"/.i-know-vim-is-vi && exec vi "$@"
|
||||
# run vi otherwise
|
||||
test -f /usr/bin/vi && exec /usr/bin/vi "$@"
|
||||
)
|
||||
|
||||
if [ -n "${ZSH_VERSION-}" ]; then
|
||||
read -t 10 -s -k 1 '?No vim found, using vi, press ENTER to continue...' && echo ''
|
||||
else
|
||||
read -rep $'No vim found, using vi, press ENTER to continue...\n' -n1 -t 10 -s
|
||||
fi
|
||||
exec vi "$@"
|
||||
__view_internal_vim_alias()
|
||||
(
|
||||
# run vim -R instead of view if vim installed
|
||||
test -f /usr/bin/vim && exec /usr/bin/vim -R "$@"
|
||||
|
||||
# run view otherwise
|
||||
test -f /usr/bin/view && exec /usr/bin/view "$@"
|
||||
)
|
||||
|
||||
|
||||
if [ -n "${BASH_VERSION-}" -o -n "${KSH_VERSION-}" -o -n "${ZSH_VERSION-}" ]; then
|
||||
# This will avoid user defined aliases and possibly stuff defined earlier in the PATH.
|
||||
# This will avoid user defined aliases
|
||||
case "$(command -v vim)-$(command -v vi)" in
|
||||
/usr/bin/vim-/usr/bin/vi)
|
||||
"/usr/bin/vim-/usr/bin/vi" | "-/usr/bin/vi")
|
||||
# apply only when founded vim and vi are in expected dirs from distro
|
||||
alias vi=vim
|
||||
alias view="vim -R"
|
||||
;;
|
||||
-/usr/bin/vi)
|
||||
# apply only if founded vi is in expected dir from distro
|
||||
# we need to call a shell function to avoid shell restarts when vi/vim
|
||||
# is being installed/uninstalled
|
||||
alias vi=__vi_internal_vim_alias
|
||||
alias view=__view_internal_vim_alias
|
||||
alias vim=__vi_internal_vim_alias
|
||||
;;
|
||||
esac
|
||||
|
1
vim.spec
1
vim.spec
@ -827,6 +827,7 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags
|
||||
* Wed Dec 16 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.2143-2
|
||||
- make profile files as ghosts to prevent further conflicts
|
||||
- remove ownership of /etc/profile.d - rpmlinter reports it as an error
|
||||
- remove interactive prompt from profile scripts
|
||||
|
||||
* Mon Dec 14 2020 Zdenek Dohnal <zdohnal@redhat.com> - 2:8.2.2143-1
|
||||
- patchlevel 2143
|
||||
|
Loading…
Reference in New Issue
Block a user